]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix mbo_supp_oper_classes after cfg80211 change
authorJouni Malinen <j@w1.fi>
Fri, 21 Dec 2018 22:55:26 +0000 (00:55 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 22 Dec 2018 14:13:14 +0000 (16:13 +0200)
The Linux kernel commit 113f3aaa81bd ("cfg80211: Prevent regulatory
restore during STA disconnect in concurrent interfaces") broke the
regulatory clearing attempt in this test case since
cfg80211_is_all_idle() is now returning false due to the AP interface
being up and that results in the Country IE -based regulatory
information not getting cleared back to defaults.

Work around this by stopping the AP interface first so that when the
station interface receives the disconnection, there are no other active
interfaces in the system. In addition, wait for REGDOM event for the
Country IE hint after association to avoid disconnection before the
regulatory events have been fully processed.

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

index 2677eba3edc76f3d678b64728e5123fe2f6f54b4..cd6311d9be7460370f690206f93a5e59a9b8986c 100644 (file)
@@ -35,6 +35,7 @@ def run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, country):
     dev[0].dump_monitor()
 
     logger.info("Country: " + country)
+    dev[0].note("Setting country code " + country)
     set_reg(country, apdev[0], apdev[1], dev[0])
     for j in range(5):
         ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=5)
@@ -52,8 +53,10 @@ def run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, country):
         dev[0].connect("test-wnm-mbo", key_mgmt="NONE", scan_freq="5180")
         sta = hapd.get_sta(addr)
         res5 = sta['supp_op_classes'][2:]
-        dev[0].request("REMOVE_NETWORK all")
+        dev[0].wait_regdom(country_ie=True)
         hapd.disable()
+        dev[0].request("REMOVE_NETWORK all")
+        dev[0].request("ABORT_SCAN")
         dev[0].wait_disconnected()
         dev[0].dump_monitor()
 
@@ -63,8 +66,10 @@ def run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, country):
     dev[0].connect("test-wnm-mbo-2", key_mgmt="NONE", scan_freq="2412")
     sta = hapd2.get_sta(addr)
     res2 = sta['supp_op_classes'][2:]
-    dev[0].request("REMOVE_NETWORK all")
+    dev[0].wait_regdom(country_ie=True)
     hapd2.disable()
+    dev[0].request("REMOVE_NETWORK all")
+    dev[0].request("ABORT_SCAN")
     dev[0].wait_disconnected()
     dev[0].dump_monitor()
 
@@ -91,6 +96,7 @@ def test_mbo_supp_oper_classes(dev, apdev):
     hapd2 = hostapd.add_ap(apdev[1], params, no_enable=True)
 
     try:
+        dev[0].request("STA_AUTOCONNECT 0")
         za2, za5 = run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, "ZA")
         fi2, fi5 = run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, "FI")
         us2, us5 = run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, "US")
@@ -101,6 +107,7 @@ def test_mbo_supp_oper_classes(dev, apdev):
         dev[0].dump_monitor()
         set_reg("00", apdev[0], apdev[1], dev[0])
         ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=1)
+        dev[0].request("STA_AUTOCONNECT 1")
 
     za = "515354737475767778797a7b808182"
     fi = "515354737475767778797a7b808182"
index 1064d2c16f84563bfe8771d3a144cce15d88ce41..bfa0b2ba95e502f6b29939cc7b4dae192f723c8d 100644 (file)
@@ -1319,3 +1319,14 @@ class WpaSupplicant:
 
     def note(self, txt):
         self.request("NOTE " + txt)
+
+    def wait_regdom(self, country_ie=False):
+        for i in range(5):
+            ev = self.wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=1)
+            if ev is None:
+                break
+            if country_ie:
+                if "init=COUNTRY_IE" in ev:
+                    break
+            else:
+                break