tests: ignore_broadcast_ssid and SSID List or Short SSID List mismatch

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-12-28 23:21:14 +02:00
parent 974f84bb73
commit 94e66da6df

View file

@ -467,11 +467,30 @@ def test_scan_for_auth_wep(dev, apdev):
@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")