diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-06-21 19:35:08 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-06-21 19:35:08 +0200 |
commit | ee735f1088282a7c34a97f4ccb44a1d5127a006d (patch) | |
tree | fe224c71b27d3c5144980df90633893728c7b0ab | |
parent | 6b4a9c5d8d291ce15e9f31cb130537fe47a9688e (diff) | |
download | plan9front-ee735f1088282a7c34a97f4ccb44a1d5127a006d.tar.xz |
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
-rw-r--r-- | sys/src/9/pc/wifi.c | 10 | ||||
-rw-r--r-- | sys/src/9/pc/wifi.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/src/9/pc/wifi.c b/sys/src/9/pc/wifi.c index 743f0cac8..4b9b3639d 100644 --- a/sys/src/9/pc/wifi.c +++ b/sys/src/9/pc/wifi.c @@ -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); diff --git a/sys/src/9/pc/wifi.h b/sys/src/9/pc/wifi.h index 9b878d192..f1311c05a 100644 --- a/sys/src/9/pc/wifi.h +++ b/sys/src/9/pc/wifi.h @@ -56,6 +56,7 @@ struct Wifi Queue *iq; ulong watchdog; + ulong lastauth; Ref txseq; void (*transmit)(Wifi*, Wnode*, Block*); |