From f39374b47ecc9521e16a691ff900c1a1f11609ff Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 23 Jun 2013 07:14:52 +0200 Subject: [PATCH] wifi: fix missed eapol frames allow the driver to associate the node with a new aid right after we receive the association response, not just when we transmit a packet which usualy does not happen as eapol is initiated by the access point so there are no transmit calls. we just call transmit from the wifiproc with a nil block to introduce the node. --- sys/src/9/pc/etheriwl.c | 8 +++++++- sys/src/9/pc/wifi.c | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/src/9/pc/etheriwl.c b/sys/src/9/pc/etheriwl.c index 8930a10d2..02b7de2e6 100644 --- a/sys/src/9/pc/etheriwl.c +++ b/sys/src/9/pc/etheriwl.c @@ -1833,7 +1833,6 @@ transmit(Wifi *wifi, Wnode *wn, Block *b) Wifipkt *w; char *err; - w = (Wifipkt*)b->rp; edev = wifi->ether; ctlr = edev->ctlr; @@ -1850,9 +1849,16 @@ transmit(Wifi *wifi, Wnode *wn, Block *b) || memcmp(wn->bssid, ctlr->bssid, Eaddrlen) != 0) rxon(edev, wn); + if(b == nil){ + /* association note has no data to transmit */ + qunlock(ctlr); + return; + } + rate = 0; flags = 0; nodeid = ctlr->bcastnodeid; + w = (Wifipkt*)b->rp; if((w->a1[0] & 1) == 0){ flags |= TFlagNeedACK; diff --git a/sys/src/9/pc/wifi.c b/sys/src/9/pc/wifi.c index 85b1cd886..a34ab39e9 100644 --- a/sys/src/9/pc/wifi.c +++ b/sys/src/9/pc/wifi.c @@ -417,6 +417,8 @@ wifiproc(void *arg) case 0x30: /* reassoc response */ b->rp += wifihdrlen(w); recvassoc(wifi, wn, b->rp, BLEN(b)); + /* notify driver about node aid association */ + (*wifi->transmit)(wifi, wn, nil); break; case 0xb0: /* auth */ setstatus(wifi, Sauth); @@ -673,13 +675,13 @@ wifictl(Wifi *wifi, void *buf, long n) memmove(wifi->bssid, addr, Eaddrlen); goto Findbss; case CMauth: - setstatus(wifi, Sauth); memset(wn->rxkey, 0, sizeof(wn->rxkey)); memset(wn->txkey, 0, sizeof(wn->txkey)); if(cb->f[1] == nil) wn->rsnelen = 0; else wn->rsnelen = hextob(cb->f[1], nil, wn->rsne, sizeof(wn->rsne)); + setstatus(wifi, Sauth); sendassoc(wifi, wn); break; case CMrxkey0: case CMrxkey1: case CMrxkey2: case CMrxkey3: case CMrxkey4: