wifi: berlin prime bunny hopping

- reduce delay for channel hop to 200ms
- use 1000ms timeout for auth response (dont hop channels while we wait)
- bunny hop sequence is mathematically prooven
This commit is contained in:
cinap_lenrek 2015-06-21 19:35:08 +02:00
parent 6b4a9c5d8d
commit ee735f1088
2 changed files with 9 additions and 2 deletions

View file

@ -533,6 +533,7 @@ wifiproc(void *arg)
&& goodbss(wifi, wn)){
setstatus(wifi, wn, Sconn);
sendauth(wifi, wn);
wifi->lastauth = wn->lastsend;
}
continue;
}
@ -664,9 +665,12 @@ Scan:
/* scan for access point */
while(wifi->bss == nil){
ether->link = 0;
wnscan.channel = 1 + wnscan.channel % 11;
wnscan.channel = 1 + ((wnscan.channel+4) % 13);
wifiprobe(wifi, &wnscan);
tsleep(&up->sleep, return0, 0, 1000);
do {
tsleep(&up->sleep, return0, 0, 200);
now = MACHP(0)->ticks;
} while(TK2MS(now-wifi->lastauth) < 1000);
}
/* maintain access point */
@ -716,6 +720,8 @@ wifiattach(Ether *ether, void (*transmit)(Wifi*, Wnode*, Block*))
wifi->essid[0] = 0;
memmove(wifi->bssid, ether->bcast, Eaddrlen);
wifi->lastauth = MACHP(0)->ticks;
snprint(name, sizeof(name), "#l%dwifi", ether->ctlrno);
kproc(name, wifiproc, wifi);
snprint(name, sizeof(name), "#l%dwifo", ether->ctlrno);

View file

@ -56,6 +56,7 @@ struct Wifi
Queue *iq;
ulong watchdog;
ulong lastauth;
Ref txseq;
void (*transmit)(Wifi*, Wnode*, Block*);