]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Make ap_vht_csa_vht40_disable more robust
authorJouni Malinen <j@w1.fi>
Fri, 3 Apr 2020 18:16:06 +0000 (21:16 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 3 Apr 2020 18:19:18 +0000 (21:19 +0300)
Wait for disconnection and reconnection after CSA since mac80211 does
not support clean CSA to disable VHT.

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

index 4e8540cf0ba2a53828955a5b0d0cd34491c6cf05..24658d1f9802fb030eaf297f7c9c5a9ab7f4d11a 100644 (file)
@@ -889,7 +889,7 @@ def test_ap_vht_csa_vht40_disable(dev, apdev):
         hapd = hostapd.add_ap(apdev[0], params)
         bssid = hapd.own_addr()
 
-        dev[0].connect("vht", key_mgmt="NONE", scan_freq="5745")
+        dev[0].connect("vht", key_mgmt="NONE", scan_freq="5200 5745")
         hwsim_utils.test_connectivity(dev[0], hapd)
 
         hapd.request("CHAN_SWITCH 5 5200 center_freq1=5210 sec_channel_offset=1 bandwidth=40 ht")
@@ -903,7 +903,14 @@ def test_ap_vht_csa_vht40_disable(dev, apdev):
             raise Exception("Channel switch event not seen")
         if "freq=5200" not in ev:
             raise Exception("Channel mismatch: " + ev)
-        time.sleep(0.5)
+        ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=5)
+        if ev:
+            # mac80211 does not support CSA to disable VHT, so the channel
+            # switch will be followed by disconnection and attempt to reconnect.
+            # Wait for that here to avoid failing the test case based on how
+            # example the connectivity test would get timed compared to getting
+            # disconnected or reconnected.
+            dev[0].wait_connected()
         hwsim_utils.test_connectivity(dev[0], hapd)
 
         dev[1].connect("vht", key_mgmt="NONE", scan_freq="5200")