@remote_compatible
def test_scan_hidden(dev, apdev):
"""Control interface behavior on scan parameters"""
- hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan",
+ dev[0].flush_scan_cache()
+ ssid = "test-scan"
+ wrong_ssid = "wrong"
+ hapd = hostapd.add_ap(apdev[0], {"ssid": ssid,
"ignore_broadcast_ssid": "1"})
bssid = apdev[0]['bssid']
check_scan(dev[0], "freq=2412 use_id=1")
+ try:
+ payload = struct.pack('BB', 0, len(wrong_ssid)) + wrong_ssid.encode()
+ ssid_list = struct.pack('BB', 84, len(payload)) + payload
+ cmd = "VENDOR_ELEM_ADD 14 " + binascii.hexlify(ssid_list).decode()
+ if "OK" not in dev[0].request(cmd):
+ raise Exception("VENDOR_ELEM_ADD failed")
+ check_scan(dev[0], "freq=2412 use_id=1")
+
+ payload = struct.pack('<L', binascii.crc32(wrong_ssid.encode()))
+ ssid_list = struct.pack('BBB', 255, 1 + len(payload), 58) + payload
+ cmd = "VENDOR_ELEM_ADD 14 " + binascii.hexlify(ssid_list).decode()
+ if "OK" not in dev[0].request(cmd):
+ raise Exception("VENDOR_ELEM_ADD failed")
+ check_scan(dev[0], "freq=2412 use_id=1")
+ finally:
+ dev[0].request("VENDOR_ELEM_REMOVE 14 *")
if "test-scan" in dev[0].request("SCAN_RESULTS"):
raise Exception("BSS unexpectedly found in initial scan")