summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-10-17 14:45:25 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-10-17 14:45:25 +0200
commit5ca4afb2491571cc96ba1c1a6a0bee0b1912bab5 (patch)
treeac212b3fe5e13074e808aab706633fbd98c15c70
parent2f99484b9dac562ce5faf8d9a652151a9a864b3e (diff)
downloadplan9front-5ca4afb2491571cc96ba1c1a6a0bee0b1912bab5.tar.xz
wifi: prioritize rsne over wpaie
if beacon/proble contains both wpa information element and rsne, the rsne wins.
-rw-r--r--sys/src/9/pc/wifi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/src/9/pc/wifi.c b/sys/src/9/pc/wifi.c
index 55b9ce326..ba4f62244 100644
--- a/sys/src/9/pc/wifi.c
+++ b/sys/src/9/pc/wifi.c
@@ -397,6 +397,7 @@ recvbeacon(Wifi *wifi, Wnode *wn, uchar *d, int len)
{
static uchar wpa1oui[4] = { 0x00, 0x50, 0xf2, 0x01 };
uchar *e, *x, *p, t;
+ int rsnset;
len -= 8+2+2;
if(len < 0)
@@ -408,6 +409,7 @@ recvbeacon(Wifi *wifi, Wnode *wn, uchar *d, int len)
wn->cap = d[0] | d[1]<<8;
d += 2;
+ rsnset = 0;
for(e = d + len; d+2 <= e; d = x){
d += 2;
x = d + d[-1];
@@ -450,13 +452,14 @@ recvbeacon(Wifi *wifi, Wnode *wn, uchar *d, int len)
break;
case 221: /* vendor specific */
len = x - d;
- if(len < sizeof(wpa1oui) || memcmp(d, wpa1oui, sizeof(wpa1oui)) != 0)
+ if(rsnset || len < sizeof(wpa1oui) || memcmp(d, wpa1oui, sizeof(wpa1oui)) != 0)
break;
/* no break */
case 48: /* RSN information */
len = x - &d[-2];
memmove(wn->brsne, &d[-2], len);
wn->brsnelen = len;
+ rsnset = 1;
break;
}
}