]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Specific vs. wildcard SSID in Probe Request frame in BSSID-scan
authorJouni Malinen <jouni@codeaurora.org>
Mon, 2 Mar 2020 18:44:23 +0000 (20:44 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 2 Mar 2020 18:44:23 +0000 (20:44 +0200)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/hwsim/test_scan.py

index 0b7eca8820389cc590d7e9616574d7e52c73a9d2..56ab9c57d58d038c3a2fbd48cd20d2df79738c80 100644 (file)
@@ -1456,6 +1456,17 @@ def test_scan_parsing(dev, apdev):
     res = dev[0].request("BSS 02:ff:00:00:00:09")
     logger.info("Updated BSS:\n" + res)
 
+def get_probe_req_ies(hapd):
+    for i in range(10):
+        msg = hapd.mgmt_rx()
+        if msg is None:
+            break
+        if msg['subtype'] != 4:
+            continue
+        return parse_ie(binascii.hexlify(msg['payload']).decode())
+
+    raise Exception("Probe Request not seen")
+
 def test_scan_specific_bssid(dev, apdev):
     """Scan for a specific BSSID"""
     dev[0].flush_scan_cache()
@@ -1486,6 +1497,29 @@ def test_scan_specific_bssid(dev, apdev):
     if bss2 and 'beacon_ie' in bss2 and 'ie' in bss2 and bss2['beacon_ie'] == bss2['ie']:
         raise Exception("Second scan did find Probe Response frame")
 
+    hapd.dump_monitor()
+    hapd.set("ext_mgmt_frame_handling", "1")
+
+    # With specific SSID in the Probe Request frame
+    dev[0].request("SCAN TYPE=ONLY freq=2412 bssid=" + bssid)
+    ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], timeout=10)
+    if ev is None:
+        raise Exception("Scan did not complete")
+    ie = get_probe_req_ies(hapd)
+    if ie[0] != b"test-scan":
+        raise Exception("Specific SSID not seen in Probe Request frame")
+
+    hapd.dump_monitor()
+
+    # Without specific SSID in the Probe Request frame
+    dev[0].request("SCAN TYPE=ONLY freq=2412 wildcard_ssid=1 bssid=" + bssid)
+    ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], timeout=10)
+    if ev is None:
+        raise Exception("Scan did not complete")
+    ie = get_probe_req_ies(hapd)
+    if len(ie[0]) != 0:
+        raise Exception("Wildcard SSID not seen in Probe Request frame")
+
 def test_scan_probe_req_events(dev, apdev):
     """Probe Request frame RX events from hostapd"""
     hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})