import hostapd
from wpasupplicant import WpaSupplicant
+from utils import parse_ie
def test_ap_track_sta(dev, apdev):
"""Dualband AP tracking unconnected stations"""
dev[0].scan(freq=2437, type="ONLY")
dev[0].scan(freq=2437, type="ONLY")
- if dev[0].get_bss(bssid):
- raise Exception("2.4 GHz AP found unexpectedly")
+ bss = dev[0].get_bss(bssid)
+ if bss:
+ ie = parse_ie(bss['ie'])
+ # Check whether this is from a Beacon frame (TIM element included) since
+ # it is possible that a Beacon frame was received during the active
+ # scan. This test should fail only if a Probe Response frame was
+ # received.
+ if 5 not in ie:
+ raise Exception("2.4 GHz AP found unexpectedly")
def test_ap_track_sta_no_auth(dev, apdev):
"""Dualband AP rejecting authentication from dualband STA on 2.4 GHz"""
# This software may be distributed under the terms of the BSD license.
# See README for more details.
+import binascii
import os
+import struct
import time
import remotehost
phy = "phy" + words[1]
break
return phy
+
+def parse_ie(buf):
+ ret = {}
+ data = binascii.unhexlify(buf)
+ while len(data) >= 2:
+ ie,elen = struct.unpack('BB', data[0:2])
+ data = data[2:]
+ if elen > len(data):
+ break
+ ret[ie] = data[0:elen]
+ data = data[elen:]
+ return ret