tests: Fix mbo_supp_oper_classes after cfg80211 change

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>
This commit is contained in:
Jouni Malinen 2018-12-22 00:55:26 +02:00
parent 2cef6f6e89
commit 99bc57d0d1
2 changed files with 20 additions and 2 deletions

View file

@ -35,6 +35,7 @@ def run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, country):
dev[0].dump_monitor() dev[0].dump_monitor()
logger.info("Country: " + country) logger.info("Country: " + country)
dev[0].note("Setting country code " + country)
set_reg(country, apdev[0], apdev[1], dev[0]) set_reg(country, apdev[0], apdev[1], dev[0])
for j in range(5): for j in range(5):
ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=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") dev[0].connect("test-wnm-mbo", key_mgmt="NONE", scan_freq="5180")
sta = hapd.get_sta(addr) sta = hapd.get_sta(addr)
res5 = sta['supp_op_classes'][2:] res5 = sta['supp_op_classes'][2:]
dev[0].request("REMOVE_NETWORK all") dev[0].wait_regdom(country_ie=True)
hapd.disable() hapd.disable()
dev[0].request("REMOVE_NETWORK all")
dev[0].request("ABORT_SCAN")
dev[0].wait_disconnected() dev[0].wait_disconnected()
dev[0].dump_monitor() 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") dev[0].connect("test-wnm-mbo-2", key_mgmt="NONE", scan_freq="2412")
sta = hapd2.get_sta(addr) sta = hapd2.get_sta(addr)
res2 = sta['supp_op_classes'][2:] res2 = sta['supp_op_classes'][2:]
dev[0].request("REMOVE_NETWORK all") dev[0].wait_regdom(country_ie=True)
hapd2.disable() hapd2.disable()
dev[0].request("REMOVE_NETWORK all")
dev[0].request("ABORT_SCAN")
dev[0].wait_disconnected() dev[0].wait_disconnected()
dev[0].dump_monitor() 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) hapd2 = hostapd.add_ap(apdev[1], params, no_enable=True)
try: try:
dev[0].request("STA_AUTOCONNECT 0")
za2, za5 = run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, "ZA") za2, za5 = run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, "ZA")
fi2, fi5 = run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, "FI") fi2, fi5 = run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, "FI")
us2, us5 = run_mbo_supp_oper_classes(dev, apdev, hapd, hapd2, "US") 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() dev[0].dump_monitor()
set_reg("00", apdev[0], apdev[1], dev[0]) set_reg("00", apdev[0], apdev[1], dev[0])
ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=1) ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=1)
dev[0].request("STA_AUTOCONNECT 1")
za = "515354737475767778797a7b808182" za = "515354737475767778797a7b808182"
fi = "515354737475767778797a7b808182" fi = "515354737475767778797a7b808182"

View file

@ -1319,3 +1319,14 @@ class WpaSupplicant:
def note(self, txt): def note(self, txt):
self.request("NOTE " + 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