summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/wifi.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-06-24 22:47:07 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-06-24 22:47:07 +0200
commit4da4785412451e2f2b1c75821beea64857c23771 (patch)
tree2084930721351c44114fa8c10e3925f4b6497a5d /sys/src/9/pc/wifi.c
parent5c0106b7cfe928006222e7e49a504b413359b995 (diff)
wifi: signal ap deassociation to aux/wpa with a zero length read.
aux/wpa needs to reset its reply counter on deassociation to properly restart key negotiation. we signal this with a zero length read on the connections filtering for eapol protocol.
Diffstat (limited to 'sys/src/9/pc/wifi.c')
-rw-r--r--sys/src/9/pc/wifi.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/src/9/pc/wifi.c b/sys/src/9/pc/wifi.c
index a34ab39e9..2d7468115 100644
--- a/sys/src/9/pc/wifi.c
+++ b/sys/src/9/pc/wifi.c
@@ -346,6 +346,25 @@ recvbeacon(Wifi *, Wnode *wn, uchar *d, int len)
}
}
+/* notify aux/wpa with a zero length write that we got deassociated from the ap */
+static void
+wifideassoc(Wifi *wifi)
+{
+ Ether *ether;
+ Netfile *f;
+ int i;
+
+ ether = wifi->ether;
+ for(i=0; i<ether->nfile; i++){
+ f = ether->f[i];
+ if(f == nil || f->in == nil || f->inuse == 0 || f->type != 0x888e)
+ continue;
+ if(wifi->debug)
+ print("#%d: wifideassoc: %#p\n", ether->ctlrno, f);
+ qwrite(f->in, 0, 0);
+ }
+}
+
/* check if a node qualifies as our bss matching bssid and essid */
static int
goodbss(Wifi *wifi, Wnode *wn)
@@ -429,6 +448,7 @@ wifiproc(void *arg)
memset(wn->rxkey, 0, sizeof(wn->rxkey));
memset(wn->txkey, 0, sizeof(wn->txkey));
wn->aid = 0;
+ wifideassoc(wifi);
sendauth(wifi, wn);
break;
}