tests: Try to clear scan results after regulatory domain changes

It was possible for regulatory domain changes to "leak" into following
test cases in number of cases where the cfg80211 BSS table remained
after regulatory domain had been restored to world roaming. Try to make
this less likely to occur by explicitly clearing BSS table at the end of
test cases that use different regulatory domain. This makes P2P test
cases that verify channel selection based on world roaming rules more
robust.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-12-15 01:32:01 +02:00
parent 970a23f665
commit 9d7fdac5b3
9 changed files with 176 additions and 5 deletions

View file

@ -98,6 +98,7 @@ def test_ap_acs_40mhz(dev, apdev):
def test_ap_acs_5ghz(dev, apdev): def test_ap_acs_5ghz(dev, apdev):
"""Automatic channel selection on 5 GHz""" """Automatic channel selection on 5 GHz"""
try: try:
hapd = None
params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678") params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
params['hw_mode'] = 'a' params['hw_mode'] = 'a'
params['channel'] = '0' params['channel'] = '0'
@ -120,11 +121,16 @@ def test_ap_acs_5ghz(dev, apdev):
dev[0].connect("test-acs", psk="12345678", scan_freq=freq) dev[0].connect("test-acs", psk="12345678", scan_freq=freq)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_acs_5ghz_40mhz(dev, apdev): def test_ap_acs_5ghz_40mhz(dev, apdev):
"""Automatic channel selection on 5 GHz for 40 MHz channel""" """Automatic channel selection on 5 GHz for 40 MHz channel"""
try: try:
hapd = None
params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678") params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
params['hw_mode'] = 'a' params['hw_mode'] = 'a'
params['channel'] = '0' params['channel'] = '0'
@ -152,11 +158,16 @@ def test_ap_acs_5ghz_40mhz(dev, apdev):
dev[0].connect("test-acs", psk="12345678", scan_freq=freq) dev[0].connect("test-acs", psk="12345678", scan_freq=freq)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_acs_vht(dev, apdev): def test_ap_acs_vht(dev, apdev):
"""Automatic channel selection for VHT""" """Automatic channel selection for VHT"""
try: try:
hapd = None
params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678") params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
params['hw_mode'] = 'a' params['hw_mode'] = 'a'
params['channel'] = '0' params['channel'] = '0'
@ -186,4 +197,8 @@ def test_ap_acs_vht(dev, apdev):
dev[0].connect("test-acs", psk="12345678", scan_freq=freq) dev[0].connect("test-acs", psk="12345678", scan_freq=freq)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()

View file

@ -178,12 +178,14 @@ def test_ap_ht40_5ghz_match(dev, apdev):
"""HT40 co-ex scan on 5 GHz with matching pri/sec channel""" """HT40 co-ex scan on 5 GHz with matching pri/sec channel"""
clear_scan_cache(apdev[0]['ifname']) clear_scan_cache(apdev[0]['ifname'])
try: try:
hapd = None
hapd2 = None
params = { "ssid": "test-ht40", params = { "ssid": "test-ht40",
"hw_mode": "a", "hw_mode": "a",
"channel": "36", "channel": "36",
"country_code": "US", "country_code": "US",
"ht_capab": "[HT40+]"} "ht_capab": "[HT40+]"}
hostapd.add_ap(apdev[1]['ifname'], params) hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
params = { "ssid": "test-ht40", params = { "ssid": "test-ht40",
"hw_mode": "a", "hw_mode": "a",
@ -218,18 +220,26 @@ def test_ap_ht40_5ghz_match(dev, apdev):
dev[0].connect("test-ht40", key_mgmt="NONE", scan_freq=freq) dev[0].connect("test-ht40", key_mgmt="NONE", scan_freq=freq)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_ht40_5ghz_switch(dev, apdev): def test_ap_ht40_5ghz_switch(dev, apdev):
"""HT40 co-ex scan on 5 GHz switching pri/sec channel""" """HT40 co-ex scan on 5 GHz switching pri/sec channel"""
clear_scan_cache(apdev[0]['ifname']) clear_scan_cache(apdev[0]['ifname'])
try: try:
hapd = None
hapd2 = None
params = { "ssid": "test-ht40", params = { "ssid": "test-ht40",
"hw_mode": "a", "hw_mode": "a",
"channel": "36", "channel": "36",
"country_code": "US", "country_code": "US",
"ht_capab": "[HT40+]"} "ht_capab": "[HT40+]"}
hostapd.add_ap(apdev[1]['ifname'], params) hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
params = { "ssid": "test-ht40", params = { "ssid": "test-ht40",
"hw_mode": "a", "hw_mode": "a",
@ -264,18 +274,25 @@ def test_ap_ht40_5ghz_switch(dev, apdev):
dev[0].connect("test-ht40", key_mgmt="NONE", scan_freq=freq) dev[0].connect("test-ht40", key_mgmt="NONE", scan_freq=freq)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
def test_ap_ht40_5ghz_switch2(dev, apdev): def test_ap_ht40_5ghz_switch2(dev, apdev):
"""HT40 co-ex scan on 5 GHz switching pri/sec channel (2)""" """HT40 co-ex scan on 5 GHz switching pri/sec channel (2)"""
clear_scan_cache(apdev[0]['ifname']) clear_scan_cache(apdev[0]['ifname'])
try: try:
hapd = None
hapd2 = None
params = { "ssid": "test-ht40", params = { "ssid": "test-ht40",
"hw_mode": "a", "hw_mode": "a",
"channel": "36", "channel": "36",
"country_code": "US", "country_code": "US",
"ht_capab": "[HT40+]"} "ht_capab": "[HT40+]"}
hostapd.add_ap(apdev[1]['ifname'], params) hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
id = dev[0].add_network() id = dev[0].add_network()
dev[0].set_network(id, "mode", "2") dev[0].set_network(id, "mode", "2")
@ -319,7 +336,13 @@ def test_ap_ht40_5ghz_switch2(dev, apdev):
dev[0].connect("test-ht40", key_mgmt="NONE", scan_freq=freq) dev[0].connect("test-ht40", key_mgmt="NONE", scan_freq=freq)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_obss_scan(dev, apdev): def test_obss_scan(dev, apdev):
"""Overlapping BSS scan request""" """Overlapping BSS scan request"""
@ -447,6 +470,8 @@ def test_olbc(dev, apdev):
def test_olbc_5ghz(dev, apdev): def test_olbc_5ghz(dev, apdev):
"""OLBC detection on 5 GHz""" """OLBC detection on 5 GHz"""
try: try:
hapd = None
hapd2 = None
params = { "ssid": "test-olbc", params = { "ssid": "test-olbc",
"country_code": "FI", "country_code": "FI",
"hw_mode": "a", "hw_mode": "a",
@ -463,12 +488,16 @@ def test_olbc_5ghz(dev, apdev):
"channel": "36", "channel": "36",
"ieee80211n": "0", "ieee80211n": "0",
"wmm_enabled": "0" } "wmm_enabled": "0" }
hostapd.add_ap(apdev[1]['ifname'], params) hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
time.sleep(0.5) time.sleep(0.5)
status = hapd.get_status() status = hapd.get_status()
if status['olbc_ht'] != '1': if status['olbc_ht'] != '1':
raise Exception("Missing OLBC information") raise Exception("Missing OLBC information")
finally: finally:
if hapd:
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
def test_ap_require_ht(dev, apdev): def test_ap_require_ht(dev, apdev):
@ -601,6 +630,7 @@ def test_ap_ht40_csa(dev, apdev):
if not csa_supported(dev[0]): if not csa_supported(dev[0]):
return "skip" return "skip"
try: try:
hapd = None
params = { "ssid": "ht", params = { "ssid": "ht",
"country_code": "US", "country_code": "US",
"hw_mode": "a", "hw_mode": "a",
@ -634,13 +664,18 @@ def test_ap_ht40_csa(dev, apdev):
raise Exception("Unexpected STA disconnection during CSA") raise Exception("Unexpected STA disconnection during CSA")
hwsim_utils.test_connectivity(dev[0], hapd) hwsim_utils.test_connectivity(dev[0], hapd)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_ht40_csa2(dev, apdev): def test_ap_ht40_csa2(dev, apdev):
"""HT with 40 MHz channel width and CSA""" """HT with 40 MHz channel width and CSA"""
if not csa_supported(dev[0]): if not csa_supported(dev[0]):
return "skip" return "skip"
try: try:
hapd = None
params = { "ssid": "ht", params = { "ssid": "ht",
"country_code": "US", "country_code": "US",
"hw_mode": "a", "hw_mode": "a",
@ -674,13 +709,18 @@ def test_ap_ht40_csa2(dev, apdev):
raise Exception("Unexpected STA disconnection during CSA") raise Exception("Unexpected STA disconnection during CSA")
hwsim_utils.test_connectivity(dev[0], hapd) hwsim_utils.test_connectivity(dev[0], hapd)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_ht40_csa3(dev, apdev): def test_ap_ht40_csa3(dev, apdev):
"""HT with 40 MHz channel width and CSA""" """HT with 40 MHz channel width and CSA"""
if not csa_supported(dev[0]): if not csa_supported(dev[0]):
return "skip" return "skip"
try: try:
hapd = None
params = { "ssid": "ht", params = { "ssid": "ht",
"country_code": "US", "country_code": "US",
"hw_mode": "a", "hw_mode": "a",
@ -714,4 +754,8 @@ def test_ap_ht40_csa3(dev, apdev):
raise Exception("Unexpected STA disconnection during CSA") raise Exception("Unexpected STA disconnection during CSA")
hwsim_utils.test_connectivity(dev[0], hapd) hwsim_utils.test_connectivity(dev[0], hapd)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()

View file

@ -58,6 +58,7 @@ def test_ap_vendor_elements(dev, apdev):
def test_ap_country(dev, apdev): def test_ap_country(dev, apdev):
"""WPA2-PSK AP setting country code and using 5 GHz band""" """WPA2-PSK AP setting country code and using 5 GHz band"""
try: try:
hapd = None
bssid = apdev[0]['bssid'] bssid = apdev[0]['bssid']
ssid = "test-wpa2-psk" ssid = "test-wpa2-psk"
passphrase = 'qwertyuiop' passphrase = 'qwertyuiop'
@ -70,7 +71,11 @@ def test_ap_country(dev, apdev):
dev[0].connect(ssid, psk=passphrase, scan_freq="5180") dev[0].connect(ssid, psk=passphrase, scan_freq="5180")
hwsim_utils.test_connectivity(dev[0], hapd) hwsim_utils.test_connectivity(dev[0], hapd)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_acl_accept(dev, apdev): def test_ap_acl_accept(dev, apdev):
"""MAC ACL accept list""" """MAC ACL accept list"""
@ -197,10 +202,15 @@ def test_ap_spectrum_management_required(dev, apdev):
params["local_pwr_constraint"] = "3" params["local_pwr_constraint"] = "3"
params['spectrum_mgmt_required'] = "1" params['spectrum_mgmt_required'] = "1"
try: try:
hostapd.add_ap(apdev[0]['ifname'], params) hapd = None
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="5180") dev[0].connect(ssid, key_mgmt="NONE", scan_freq="5180")
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_max_listen_interval(dev, apdev): def test_ap_max_listen_interval(dev, apdev):
"""Open AP with maximum listen interval limit""" """Open AP with maximum listen interval limit"""

View file

@ -25,6 +25,7 @@ def vht_supported():
def test_ap_vht80(dev, apdev): def test_ap_vht80(dev, apdev):
"""VHT with 80 MHz channel width""" """VHT with 80 MHz channel width"""
try: try:
hapd = None
params = { "ssid": "vht", params = { "ssid": "vht",
"country_code": "FI", "country_code": "FI",
"hw_mode": "a", "hw_mode": "a",
@ -45,11 +46,16 @@ def test_ap_vht80(dev, apdev):
return "skip" return "skip"
raise raise
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_vht80_params(dev, apdev): def test_ap_vht80_params(dev, apdev):
"""VHT with 80 MHz channel width and number of optional features enabled""" """VHT with 80 MHz channel width and number of optional features enabled"""
try: try:
hapd = None
params = { "ssid": "vht", params = { "ssid": "vht",
"country_code": "FI", "country_code": "FI",
"hw_mode": "a", "hw_mode": "a",
@ -80,13 +86,20 @@ def test_ap_vht80_params(dev, apdev):
return "skip" return "skip"
raise raise
finally: finally:
dev[0].request("DISCONNECT")
dev[1].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
dev[1].flush_scan_cache()
def test_ap_vht_20(devs, apdevs): def test_ap_vht_20(devs, apdevs):
"""VHT and 20 MHz channel""" """VHT and 20 MHz channel"""
dev = devs[0] dev = devs[0]
ap = apdevs[0] ap = apdevs[0]
try: try:
hapd = None
params = { "ssid": "test-vht20", params = { "ssid": "test-vht20",
"country_code": "DE", "country_code": "DE",
"hw_mode": "a", "hw_mode": "a",
@ -104,7 +117,11 @@ def test_ap_vht_20(devs, apdevs):
dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE") dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE")
hwsim_utils.test_connectivity(dev, hapd) hwsim_utils.test_connectivity(dev, hapd)
finally: finally:
dev.request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev.flush_scan_cache()
def test_ap_vht_capab_not_supported(dev, apdev): def test_ap_vht_capab_not_supported(dev, apdev):
"""VHT configuration with driver not supporting all vht_capab entries""" """VHT configuration with driver not supporting all vht_capab entries"""
@ -133,6 +150,8 @@ def test_ap_vht_capab_not_supported(dev, apdev):
def test_ap_vht160(dev, apdev): def test_ap_vht160(dev, apdev):
"""VHT with 160 MHz channel width""" """VHT with 160 MHz channel width"""
try: try:
hapd = None
hapd2 = None
params = { "ssid": "vht", params = { "ssid": "vht",
"country_code": "FI", "country_code": "FI",
"hw_mode": "a", "hw_mode": "a",
@ -235,11 +254,21 @@ def test_ap_vht160(dev, apdev):
return "skip" return "skip"
raise raise
finally: finally:
dev[0].request("DISCONNECT")
dev[1].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
dev[1].flush_scan_cache()
def test_ap_vht80plus80(dev, apdev): def test_ap_vht80plus80(dev, apdev):
"""VHT with 80+80 MHz channel width""" """VHT with 80+80 MHz channel width"""
try: try:
hapd = None
hapd2 = None
params = { "ssid": "vht", params = { "ssid": "vht",
"country_code": "US", "country_code": "US",
"hw_mode": "a", "hw_mode": "a",
@ -295,13 +324,22 @@ def test_ap_vht80plus80(dev, apdev):
return "skip" return "skip"
raise raise
finally: finally:
dev[0].request("DISCONNECT")
dev[1].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
dev[1].flush_scan_cache()
def test_ap_vht80_csa(dev, apdev): def test_ap_vht80_csa(dev, apdev):
"""VHT with 80 MHz channel width and CSA""" """VHT with 80 MHz channel width and CSA"""
if not csa_supported(dev[0]): if not csa_supported(dev[0]):
return "skip" return "skip"
try: try:
hapd = None
params = { "ssid": "vht", params = { "ssid": "vht",
"country_code": "US", "country_code": "US",
"hw_mode": "a", "hw_mode": "a",
@ -345,4 +383,8 @@ def test_ap_vht80_csa(dev, apdev):
return "skip" return "skip"
raise raise
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()

View file

@ -203,6 +203,7 @@ def test_ap_wps_conf(dev, apdev):
def test_ap_wps_conf_5ghz(dev, apdev): def test_ap_wps_conf_5ghz(dev, apdev):
"""WPS PBC provisioning with configured AP on 5 GHz band""" """WPS PBC provisioning with configured AP on 5 GHz band"""
try: try:
hapd = None
ssid = "test-wps-conf" ssid = "test-wps-conf"
params = { "ssid": ssid, "eap_server": "1", "wps_state": "2", params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
"wpa_passphrase": "12345678", "wpa": "2", "wpa_passphrase": "12345678", "wpa": "2",
@ -221,11 +222,16 @@ def test_ap_wps_conf_5ghz(dev, apdev):
if 'wpsDeviceName' not in sta or sta['wpsDeviceName'] != "Device A": if 'wpsDeviceName' not in sta or sta['wpsDeviceName'] != "Device A":
raise Exception("Device name not available in STA command") raise Exception("Device name not available in STA command")
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_wps_conf_chan14(dev, apdev): def test_ap_wps_conf_chan14(dev, apdev):
"""WPS PBC provisioning with configured AP on channel 14""" """WPS PBC provisioning with configured AP on channel 14"""
try: try:
hapd = None
ssid = "test-wps-conf" ssid = "test-wps-conf"
params = { "ssid": ssid, "eap_server": "1", "wps_state": "2", params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
"wpa_passphrase": "12345678", "wpa": "2", "wpa_passphrase": "12345678", "wpa": "2",
@ -243,7 +249,11 @@ def test_ap_wps_conf_chan14(dev, apdev):
if 'wpsDeviceName' not in sta or sta['wpsDeviceName'] != "Device A": if 'wpsDeviceName' not in sta or sta['wpsDeviceName'] != "Device A":
raise Exception("Device name not available in STA command") raise Exception("Device name not available in STA command")
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_wps_twice(dev, apdev): def test_ap_wps_twice(dev, apdev):
"""WPS provisioning with twice to change passphrase""" """WPS provisioning with twice to change passphrase"""

View file

@ -124,11 +124,16 @@ def test_dfs(dev, apdev):
time.sleep(1) time.sleep(1)
hwsim_utils.test_connectivity(dev[0], hapd) hwsim_utils.test_connectivity(dev[0], hapd)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_dfs_radar(dev, apdev): def test_dfs_radar(dev, apdev):
"""DFS CAC functionality with radar detected""" """DFS CAC functionality with radar detected"""
try: try:
hapd2 = None
hapd = start_dfs_ap(apdev[0]) hapd = start_dfs_ap(apdev[0])
if hapd is None: if hapd is None:
if not os.path.exists("dfs"): if not os.path.exists("dfs"):
@ -200,7 +205,13 @@ def test_dfs_radar(dev, apdev):
wait_dfs_event(hapd2, None, 5) wait_dfs_event(hapd2, None, 5)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_dfs_radar_on_non_dfs_channel(dev, apdev): def test_dfs_radar_on_non_dfs_channel(dev, apdev):
"""DFS radar detection test code on non-DFS channel""" """DFS radar detection test code on non-DFS channel"""
@ -241,7 +252,11 @@ def test_dfs_radar_chanlist(dev, apdev):
raise Exception("Unexpected DFS event") raise Exception("Unexpected DFS event")
dev[0].connect("dfs", key_mgmt="NONE") dev[0].connect("dfs", key_mgmt="NONE")
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_dfs_radar_chanlist_vht80(dev, apdev): def test_dfs_radar_chanlist_vht80(dev, apdev):
"""DFS chanlist when radar is detected and VHT80 configured""" """DFS chanlist when radar is detected and VHT80 configured"""
@ -277,7 +292,11 @@ def test_dfs_radar_chanlist_vht80(dev, apdev):
if hapd.get_status_field('vht_oper_centr_freq_seg0_idx') != "42": if hapd.get_status_field('vht_oper_centr_freq_seg0_idx') != "42":
raise Exception("Unexpected seg0 idx") raise Exception("Unexpected seg0 idx")
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_dfs_radar_chanlist_vht20(dev, apdev): def test_dfs_radar_chanlist_vht20(dev, apdev):
"""DFS chanlist when radar is detected and VHT40 configured""" """DFS chanlist when radar is detected and VHT40 configured"""
@ -310,4 +329,8 @@ def test_dfs_radar_chanlist_vht20(dev, apdev):
raise Exception("Unexpected DFS event") raise Exception("Unexpected DFS event")
dev[0].connect("dfs", key_mgmt="NONE") dev[0].connect("dfs", key_mgmt="NONE")
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()

View file

@ -258,7 +258,11 @@ def test_nfc_wps_handover_5ghz(dev, apdev):
raise Exception("Association with the AP timed out") raise Exception("Association with the AP timed out")
check_wpa2_connection(dev[0], apdev[0], hapd, ssid) check_wpa2_connection(dev[0], apdev[0], hapd, ssid)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_nfc_wps_handover_chan14(dev, apdev): def test_nfc_wps_handover_chan14(dev, apdev):
"""Connect to WPS AP with NFC connection handover on channel 14""" """Connect to WPS AP with NFC connection handover on channel 14"""
@ -288,7 +292,11 @@ def test_nfc_wps_handover_chan14(dev, apdev):
raise Exception("Association with the AP timed out") raise Exception("Association with the AP timed out")
check_wpa2_connection(dev[0], apdev[0], hapd, ssid) check_wpa2_connection(dev[0], apdev[0], hapd, ssid)
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_nfc_wps_handover_with_pw_token_set(dev, apdev): def test_nfc_wps_handover_with_pw_token_set(dev, apdev):
"""Connect to WPS AP with NFC connection handover (wps_nfc_* set)""" """Connect to WPS AP with NFC connection handover (wps_nfc_* set)"""

View file

@ -38,6 +38,7 @@ def test_p2p_channel_5ghz(dev):
remove_group(dev[0], dev[1]) remove_group(dev[0], dev[1])
finally: finally:
set_country("00") set_country("00")
dev[1].flush_scan_cache()
def test_p2p_channel_5ghz_no_vht(dev): def test_p2p_channel_5ghz_no_vht(dev):
"""P2P group formation with 5 GHz preference when VHT channels are disallowed""" """P2P group formation with 5 GHz preference when VHT channels are disallowed"""
@ -55,6 +56,7 @@ def test_p2p_channel_5ghz_no_vht(dev):
finally: finally:
set_country("00") set_country("00")
dev[0].request("P2P_SET disallow_freq ") dev[0].request("P2P_SET disallow_freq ")
dev[1].flush_scan_cache()
def test_p2p_channel_random_social(dev): def test_p2p_channel_random_social(dev):
"""P2P group formation with 5 GHz preference but all 5 GHz channels disabled""" """P2P group formation with 5 GHz preference but all 5 GHz channels disabled"""
@ -73,6 +75,7 @@ def test_p2p_channel_random_social(dev):
finally: finally:
set_country("00") set_country("00")
dev[0].request("P2P_SET disallow_freq ") dev[0].request("P2P_SET disallow_freq ")
dev[1].flush_scan_cache()
def test_p2p_channel_random(dev): def test_p2p_channel_random(dev):
"""P2P group formation with 5 GHz preference but all 5 GHz channels and all social channels disabled""" """P2P group formation with 5 GHz preference but all 5 GHz channels and all social channels disabled"""
@ -91,6 +94,7 @@ def test_p2p_channel_random(dev):
finally: finally:
set_country("00") set_country("00")
dev[0].request("P2P_SET disallow_freq ") dev[0].request("P2P_SET disallow_freq ")
dev[1].flush_scan_cache()
def test_p2p_channel_random_social_with_op_class_change(dev, apdev, params): def test_p2p_channel_random_social_with_op_class_change(dev, apdev, params):
"""P2P group formation using random social channel with oper class change needed""" """P2P group formation using random social channel with oper class change needed"""
@ -146,6 +150,7 @@ def test_p2p_channel_random_social_with_op_class_change(dev, apdev, params):
dev[0].request("P2P_SET disallow_freq ") dev[0].request("P2P_SET disallow_freq ")
dev[0].request("SET p2p_oper_reg_class 0") dev[0].request("SET p2p_oper_reg_class 0")
dev[0].request("SET p2p_oper_channel 0") dev[0].request("SET p2p_oper_channel 0")
dev[1].flush_scan_cache()
def test_p2p_channel_avoid(dev): def test_p2p_channel_avoid(dev):
"""P2P and avoid frequencies driver event""" """P2P and avoid frequencies driver event"""
@ -184,6 +189,7 @@ def test_p2p_channel_avoid(dev):
finally: finally:
set_country("00") set_country("00")
dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES") dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES")
dev[1].flush_scan_cache()
def test_autogo_following_bss(dev, apdev): def test_autogo_following_bss(dev, apdev):
"""P2P autonomous GO operate on the same channel as station interface""" """P2P autonomous GO operate on the same channel as station interface"""
@ -372,6 +378,11 @@ def test_go_neg_forced_freq_diff_than_bss_freq(dev, apdev):
raise Exception("GO not selected according to go_intent") raise Exception("GO not selected according to go_intent")
hwsim_utils.test_connectivity(wpas, hapd) hwsim_utils.test_connectivity(wpas, hapd)
wpas.request("DISCONNECT")
hapd.request("DISABLE")
subprocess.call(['iw', 'reg', 'set', '00'])
wpas.flush_scan_cache()
def test_go_pref_chan_bss_on_diff_chan(dev, apdev): def test_go_pref_chan_bss_on_diff_chan(dev, apdev):
"""P2P channel selection: Station on different channel than GO configured pref channel""" """P2P channel selection: Station on different channel than GO configured pref channel"""

View file

@ -397,6 +397,8 @@ def test_wnm_bss_keep_alive(dev, apdev):
def test_wnm_bss_tm(dev, apdev): def test_wnm_bss_tm(dev, apdev):
"""WNM BSS Transition Management""" """WNM BSS Transition Management"""
try: try:
hapd = None
hapd2 = None
params = { "ssid": "test-wnm", params = { "ssid": "test-wnm",
"country_code": "FI", "country_code": "FI",
"ieee80211d": "1", "ieee80211d": "1",
@ -491,4 +493,10 @@ def test_wnm_bss_tm(dev, apdev):
if ev is not None: if ev is not None:
raise Exception("Unexpected reassociation"); raise Exception("Unexpected reassociation");
finally: finally:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
subprocess.call(['iw', 'reg', 'set', '00']) subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()