shithub: riscv

Download patch

ref: f39374b47ecc9521e16a691ff900c1a1f11609ff
parent: fb22c348334496404905ef2b6bc5693fcc14af87
author: cinap_lenrek <[email protected]>
date: Sun Jun 23 03:14:52 EDT 2013

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.

--- a/sys/src/9/pc/etheriwl.c
+++ b/sys/src/9/pc/etheriwl.c
@@ -1833,7 +1833,6 @@
 	Wifipkt *w;
 	char *err;
 
-	w = (Wifipkt*)b->rp;
 	edev = wifi->ether;
 	ctlr = edev->ctlr;
 
@@ -1850,9 +1849,16 @@
 	|| 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;
 
--- a/sys/src/9/pc/wifi.c
+++ b/sys/src/9/pc/wifi.c
@@ -417,6 +417,8 @@
 		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,7 +675,6 @@
 		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)
@@ -680,6 +681,7 @@
 			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: