ref: 5ca4afb2491571cc96ba1c1a6a0bee0b1912bab5
parent: 2f99484b9dac562ce5faf8d9a652151a9a864b3e
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Oct 17 10:45:25 EDT 2015
wifi: prioritize rsne over wpaie if beacon/proble contains both wpa information element and rsne, the rsne wins.
--- a/sys/src/9/pc/wifi.c
+++ b/sys/src/9/pc/wifi.c
@@ -397,6 +397,7 @@
{
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 @@
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,7 +452,7 @@
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 */
@@ -457,6 +459,7 @@
len = x - &d[-2];
memmove(wn->brsne, &d[-2], len);
wn->brsnelen = len;
+ rsnset = 1;
break;
}
}