ref: 09b5619466b8c1f27dcf5fc742de9a6b2734c025
parent: 3459c8cb8e7414366c96a2e11420b95877ab4b37
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Jan 10 17:48:27 EST 2025
wifi: don't try to associate when bypassed when the interface is bypassed, stop trying to associate/authenticate to the access point. just scan and collect beacon statistics. my asus access point sends spoofed ethernet frames otherwise on the lan, breaking ethermultilink.
--- a/sys/src/9/port/wifi.c
+++ b/sys/src/9/port/wifi.c
@@ -601,6 +601,8 @@
static int
goodbss(Wifi *wifi, Wnode *wn)
{
+ if(wifi->ether->bypass)
+ return 0; /* we'r bypassed, dont try to associate */
if(memcmp(wifi->bssid, wifi->ether->bcast, Eaddrlen) != 0){
if(memcmp(wifi->bssid, wn->bssid, Eaddrlen) != 0)
return 0; /* bssid doesnt match */
@@ -803,7 +805,7 @@
Scan:
/* scan for access point */
while(wifi->bss == nil){
- ether->link = 0;
+ ethersetlink(ether, 0);
wnscan.channel = 1 + ((wnscan.channel+4) % 13);
wifiprobe(wifi, &wnscan);
do {
@@ -819,11 +821,10 @@
if((rate = wn->actrate) != nil)
ethersetspeed(ether, ((*rate & 0x7f)+3)/4);
ethersetlink(ether, 1);
- } else {
- ethersetlink(ether, 0);
}
now = MACHP(0)->ticks;
- if(wn->status != Sneedauth && TK2SEC(now - wn->lastseen) > 20 || goodbss(wifi, wn) == 0){
+ if(wn->status != Sneedauth && TK2SEC(now - wn->lastseen) > 20
+ || goodbss(wifi, wn) == 0){
wifideauth(wifi, wn);
wifi->bss = nil;
break;
@@ -833,9 +834,8 @@
wifideauth(wifi, wn); /* stuck in auth, start over */
if(wn->status == Sconn || wn->status == Sunauth)
sendauth(wifi, wn);
- if(wn->status == Sauth){
+ if(wn->status == Sauth)
sendassoc(wifi, wn);
- }
}
tsleep(&up->sleep, return0, 0, 500);
}
--
⑨