]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Check operating channel parameter in obss_scan*
authorJouni Malinen <j@w1.fi>
Thu, 26 Dec 2019 21:13:57 +0000 (23:13 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 26 Dec 2019 21:23:05 +0000 (23:23 +0200)
It looks like these test cases can fail with the new "Undefined
secondary channel: drop OBSS scan results" case. Add more checks to
determine if something is wrong with the connection.

In addition, force clearing of the cfg80211 scan cache on the main AP
interface so that a scan result from a previous test case cannot prevent
40 MHz channel bandwidth from being used. This could apparently happen
in the following test case sequence:
ap_ht40_scan_conflict obss_scan

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_ht.py

index b1e2a10d6578f7c523b5cd6ad12d63b0b39dd883..14c53666fbdeb39d4c1a3bf7d72c59a8fadbaa99 100644 (file)
@@ -561,6 +561,7 @@ def test_ap_ht40_5ghz_switch2(dev, apdev):
 
 def test_obss_scan(dev, apdev):
     """Overlapping BSS scan request"""
+    clear_scan_cache(apdev[0])
     params = {"ssid": "obss-scan",
               "channel": "6",
               "ht_capab": "[HT40-]",
@@ -575,6 +576,7 @@ def test_obss_scan(dev, apdev):
 
 def test_obss_scan_ht40_plus(dev, apdev):
     """Overlapping BSS scan request (HT40+)"""
+    clear_scan_cache(apdev[0])
     params = {"ssid": "obss-scan",
               "channel": "6",
               "ht_capab": "[HT40+]",
@@ -585,10 +587,21 @@ def test_obss_scan_ht40_plus(dev, apdev):
               "channel": "9",
               "ieee80211n": "0"}
     hostapd.add_ap(apdev[1], params)
-    run_obss_scan(hapd, dev)
+    run_obss_scan(hapd, dev, ht40plus=True)
 
-def run_obss_scan(hapd, dev):
+def run_obss_scan(hapd, dev, ht40plus=False):
     dev[0].connect("obss-scan", key_mgmt="NONE", scan_freq="2437")
+    res = dev[0].request("SIGNAL_POLL")
+    logger.info("SIGNAL_POLL:\n" + res)
+    sig = res.splitlines()
+    if "FREQUENCY=2437" not in sig:
+        raise Exception("Unexpected frequency")
+    if "WIDTH=40 MHz" not in sig:
+        raise Exception("Not a 40 MHz connection")
+    if ht40plus and "CENTER_FRQ1=2447" not in sig:
+        raise Exception("Not HT40+")
+    if not ht40plus and "CENTER_FRQ1=2427" not in sig:
+        raise Exception("Not HT40-")
     hapd.set("ext_mgmt_frame_handling", "1")
     logger.info("Waiting for OBSS scan to occur")
     ev = dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"], timeout=15)