tests: Work around cfg80211 reg.c intersection (country 98) issues

The Linux kernel commit 113f3aaa81bd ("cfg80211: Prevent regulatory
restore during STA disconnect in concurrent interfaces") broke the
regulatory clearing attempt in many test cases 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 15:55:19 +02:00
parent 99bc57d0d1
commit b586054f95
9 changed files with 176 additions and 38 deletions

View file

@ -106,6 +106,7 @@ def test_dfs(dev, apdev):
raise Exception("Unexpected frequency")
dev[0].connect("dfs", key_mgmt="NONE")
dev[0].wait_regdom(country_ie=True)
hwsim_utils.test_connectivity(dev[0], hapd)
hapd.request("RADAR DETECTED freq=5260 ht_enabled=1 chan_width=1")
@ -128,10 +129,13 @@ def test_dfs(dev, apdev):
time.sleep(1)
hwsim_utils.test_connectivity(dev[0], hapd)
finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
dev[0].request("DISCONNECT")
dev[0].request("ABORT_SCAN")
dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
def test_dfs_etsi(dev, apdev, params):
@ -161,6 +165,7 @@ def test_dfs_etsi(dev, apdev, params):
raise Exception("Unexpected frequency")
dev[0].connect("dfs", key_mgmt="NONE")
dev[0].wait_regdom(country_ie=True)
hwsim_utils.test_connectivity(dev[0], hapd)
hapd.request("RADAR DETECTED freq=%s ht_enabled=1 chan_width=1" % freq)
@ -197,10 +202,13 @@ def test_dfs_etsi(dev, apdev, params):
time.sleep(1)
hwsim_utils.test_connectivity(dev[0], hapd)
finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
dev[0].request("DISCONNECT")
dev[0].request("ABORT_SCAN")
dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
def test_dfs_radar1(dev, apdev):
@ -255,11 +263,15 @@ def test_dfs_radar1(dev, apdev):
raise Exception("Unexpected frequency: " + freq)
dev[0].connect("dfs", key_mgmt="NONE")
dev[0].wait_regdom(country_ie=True)
finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
dev[0].request("DISCONNECT")
dev[0].request("ABORT_SCAN")
dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
def test_dfs_radar2(dev, apdev):
@ -324,11 +336,15 @@ def test_dfs_radar_chanlist(dev, apdev):
if "AP-ENABLED" not in ev:
raise Exception("Unexpected DFS event: " + ev)
dev[0].connect("dfs", key_mgmt="NONE")
dev[0].wait_regdom(country_ie=True)
finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
dev[0].request("DISCONNECT")
dev[0].request("ABORT_SCAN")
dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
def test_dfs_radar_chanlist_vht80(dev, apdev):
@ -359,14 +375,18 @@ def test_dfs_radar_chanlist_vht80(dev, apdev):
if "AP-ENABLED" not in ev:
raise Exception("Unexpected DFS event: " + ev)
dev[0].connect("dfs", key_mgmt="NONE")
dev[0].wait_regdom(country_ie=True)
if hapd.get_status_field('vht_oper_centr_freq_seg0_idx') != "42":
raise Exception("Unexpected seg0 idx")
finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
dev[0].request("DISCONNECT")
dev[0].request("ABORT_SCAN")
dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
def test_dfs_radar_chanlist_vht20(dev, apdev):
@ -397,11 +417,15 @@ def test_dfs_radar_chanlist_vht20(dev, apdev):
if "AP-ENABLED" not in ev:
raise Exception("Unexpected DFS event: " + ev)
dev[0].connect("dfs", key_mgmt="NONE")
dev[0].wait_regdom(country_ie=True)
finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
dev[0].request("DISCONNECT")
dev[0].request("ABORT_SCAN")
dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
def test_dfs_radar_no_ht(dev, apdev):
@ -432,11 +456,15 @@ def test_dfs_radar_no_ht(dev, apdev):
if "AP-ENABLED" not in ev:
raise Exception("Unexpected DFS event: " + ev)
dev[0].connect("dfs", key_mgmt="NONE")
dev[0].wait_regdom(country_ie=True)
finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
dev[0].request("DISCONNECT")
dev[0].request("ABORT_SCAN")
dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
def test_dfs_radar_ht40minus(dev, apdev):
@ -467,12 +495,18 @@ def test_dfs_radar_ht40minus(dev, apdev):
if "AP-ENABLED" not in ev:
raise Exception("Unexpected DFS event: " + ev)
dev[0].connect("dfs", key_mgmt="NONE")
dev[0].wait_regdom(country_ie=True)
dev[0].request("STA_AUTOCONNECT 0")
finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
dev[0].request("DISCONNECT")
dev[0].request("ABORT_SCAN")
dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
dev[0].request("STA_AUTOCONNECT 1")
def test_dfs_ht40_minus(dev, apdev, params):
"""DFS CAC functionality on channel 104 HT40- [long]"""
@ -502,10 +536,14 @@ def test_dfs_ht40_minus(dev, apdev, params):
raise Exception("Unexpected frequency")
dev[0].connect("dfs", key_mgmt="NONE", scan_freq="5520")
dev[0].wait_regdom(country_ie=True)
hwsim_utils.test_connectivity(dev[0], hapd)
finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
dev[0].request("DISCONNECT")
dev[0].request("ABORT_SCAN")
dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()