diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index a1e41713a..a9e415b3f 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -1903,3 +1903,53 @@ def test_scan_only_one(dev, apdev): entries = len(list(filter(lambda x: x.startswith('BSS '), lines))) if entries != 1: raise Exception("expected to find 1 BSS entry, got %d" % entries) + +def test_scan_ssid_list(dev, apdev): + """Scan using SSID List element""" + dev[0].flush_scan_cache() + ssid = "test-ssid-list" + hapd = hostapd.add_ap(apdev[0], {"ssid": ssid, + "ignore_broadcast_ssid": "1"}) + bssid = apdev[0]['bssid'] + found = False + try: + payload = struct.pack('BB', 0, len(ssid)) + 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") + for i in range(10): + check_scan(dev[0], "freq=2412 use_id=1") + if ssid in dev[0].request("SCAN_RESULTS"): + found = True + break + finally: + dev[0].request("VENDOR_ELEM_REMOVE 14 *") + + if not found: + raise Exception("AP not found in scan results") + +def test_scan_short_ssid_list(dev, apdev): + """Scan using Short SSID List element""" + dev[0].flush_scan_cache() + ssid = "test-short-ssid-list" + hapd = hostapd.add_ap(apdev[0], {"ssid": ssid, + "ignore_broadcast_ssid": "1"}) + bssid = apdev[0]['bssid'] + found = False + try: + payload = struct.pack('