]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: ignore_broadcast_ssid and SSID List or Short SSID List mismatch
authorJouni Malinen <j@w1.fi>
Sat, 28 Dec 2019 21:21:14 +0000 (23:21 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 28 Dec 2019 21:21:14 +0000 (23:21 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_scan.py

index a9e415b3f1bd8acd738acf8f930844fe0642bd96..43311d7ea58aca1e8a7ad75ae75219c3f364ab1f 100644 (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")