mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
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.
This commit is contained in:
parent
3459c8cb8e
commit
09b5619466
1 changed files with 6 additions and 6 deletions
|
@ -601,6 +601,8 @@ wifideauth(Wifi *wifi, Wnode *wn)
|
||||||
static int
|
static int
|
||||||
goodbss(Wifi *wifi, Wnode *wn)
|
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, wifi->ether->bcast, Eaddrlen) != 0){
|
||||||
if(memcmp(wifi->bssid, wn->bssid, Eaddrlen) != 0)
|
if(memcmp(wifi->bssid, wn->bssid, Eaddrlen) != 0)
|
||||||
return 0; /* bssid doesnt match */
|
return 0; /* bssid doesnt match */
|
||||||
|
@ -803,7 +805,7 @@ wifsproc(void *arg)
|
||||||
Scan:
|
Scan:
|
||||||
/* scan for access point */
|
/* scan for access point */
|
||||||
while(wifi->bss == nil){
|
while(wifi->bss == nil){
|
||||||
ether->link = 0;
|
ethersetlink(ether, 0);
|
||||||
wnscan.channel = 1 + ((wnscan.channel+4) % 13);
|
wnscan.channel = 1 + ((wnscan.channel+4) % 13);
|
||||||
wifiprobe(wifi, &wnscan);
|
wifiprobe(wifi, &wnscan);
|
||||||
do {
|
do {
|
||||||
|
@ -819,11 +821,10 @@ Scan:
|
||||||
if((rate = wn->actrate) != nil)
|
if((rate = wn->actrate) != nil)
|
||||||
ethersetspeed(ether, ((*rate & 0x7f)+3)/4);
|
ethersetspeed(ether, ((*rate & 0x7f)+3)/4);
|
||||||
ethersetlink(ether, 1);
|
ethersetlink(ether, 1);
|
||||||
} else {
|
|
||||||
ethersetlink(ether, 0);
|
|
||||||
}
|
}
|
||||||
now = MACHP(0)->ticks;
|
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);
|
wifideauth(wifi, wn);
|
||||||
wifi->bss = nil;
|
wifi->bss = nil;
|
||||||
break;
|
break;
|
||||||
|
@ -833,9 +834,8 @@ Scan:
|
||||||
wifideauth(wifi, wn); /* stuck in auth, start over */
|
wifideauth(wifi, wn); /* stuck in auth, start over */
|
||||||
if(wn->status == Sconn || wn->status == Sunauth)
|
if(wn->status == Sconn || wn->status == Sunauth)
|
||||||
sendauth(wifi, wn);
|
sendauth(wifi, wn);
|
||||||
if(wn->status == Sauth){
|
if(wn->status == Sauth)
|
||||||
sendassoc(wifi, wn);
|
sendassoc(wifi, wn);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tsleep(&up->sleep, return0, 0, 500);
|
tsleep(&up->sleep, return0, 0, 500);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue