]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Try to clear scan results after regulatory domain changes
authorJouni Malinen <j@w1.fi>
Sun, 14 Dec 2014 23:32:01 +0000 (01:32 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 14 Dec 2014 23:32:01 +0000 (01:32 +0200)
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>
tests/hwsim/test_ap_acs.py
tests/hwsim/test_ap_ht.py
tests/hwsim/test_ap_params.py
tests/hwsim/test_ap_vht.py
tests/hwsim/test_ap_wps.py
tests/hwsim/test_dfs.py
tests/hwsim/test_nfc_wps.py
tests/hwsim/test_p2p_channel.py
tests/hwsim/test_wnm.py

index dd506c1303c8fd26dc00c4119102db894c7b924c..c0b559bdb1f954beb8549172ab2c3b779832d723 100644 (file)
@@ -98,6 +98,7 @@ def test_ap_acs_40mhz(dev, apdev):
 def test_ap_acs_5ghz(dev, apdev):
     """Automatic channel selection on 5 GHz"""
     try:
+        hapd = None
         params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
         params['hw_mode'] = 'a'
         params['channel'] = '0'
@@ -120,11 +121,16 @@ def test_ap_acs_5ghz(dev, apdev):
             dev[0].connect("test-acs", psk="12345678", scan_freq=freq)
 
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_ap_acs_5ghz_40mhz(dev, apdev):
     """Automatic channel selection on 5 GHz for 40 MHz channel"""
     try:
+        hapd = None
         params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
         params['hw_mode'] = 'a'
         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)
 
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_ap_acs_vht(dev, apdev):
     """Automatic channel selection for VHT"""
     try:
+        hapd = None
         params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
         params['hw_mode'] = 'a'
         params['channel'] = '0'
@@ -186,4 +197,8 @@ def test_ap_acs_vht(dev, apdev):
             dev[0].connect("test-acs", psk="12345678", scan_freq=freq)
 
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
index 310001f00c484241895fdd0a4f2d1cfc61e9a3fe..fea1a78c338c1e94235bedab9f818748e6315360 100644 (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"""
     clear_scan_cache(apdev[0]['ifname'])
     try:
+        hapd = None
+        hapd2 = None
         params = { "ssid": "test-ht40",
                    "hw_mode": "a",
                    "channel": "36",
                    "country_code": "US",
                    "ht_capab": "[HT40+]"}
-        hostapd.add_ap(apdev[1]['ifname'], params)
+        hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
 
         params = { "ssid": "test-ht40",
                    "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)
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
+        if hapd2:
+            hapd2.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_ap_ht40_5ghz_switch(dev, apdev):
     """HT40 co-ex scan on 5 GHz switching pri/sec channel"""
     clear_scan_cache(apdev[0]['ifname'])
     try:
+        hapd = None
+        hapd2 = None
         params = { "ssid": "test-ht40",
                    "hw_mode": "a",
                    "channel": "36",
                    "country_code": "US",
                    "ht_capab": "[HT40+]"}
-        hostapd.add_ap(apdev[1]['ifname'], params)
+        hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
 
         params = { "ssid": "test-ht40",
                    "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)
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
+        if hapd2:
+            hapd2.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
 
 def test_ap_ht40_5ghz_switch2(dev, apdev):
     """HT40 co-ex scan on 5 GHz switching pri/sec channel (2)"""
     clear_scan_cache(apdev[0]['ifname'])
     try:
+        hapd = None
+        hapd2 = None
         params = { "ssid": "test-ht40",
                    "hw_mode": "a",
                    "channel": "36",
                    "country_code": "US",
                    "ht_capab": "[HT40+]"}
-        hostapd.add_ap(apdev[1]['ifname'], params)
+        hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
 
         id = dev[0].add_network()
         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)
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
+        if hapd2:
+            hapd2.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_obss_scan(dev, apdev):
     """Overlapping BSS scan request"""
@@ -447,6 +470,8 @@ def test_olbc(dev, apdev):
 def test_olbc_5ghz(dev, apdev):
     """OLBC detection on 5 GHz"""
     try:
+        hapd = None
+        hapd2 = None
         params = { "ssid": "test-olbc",
                    "country_code": "FI",
                    "hw_mode": "a",
@@ -463,12 +488,16 @@ def test_olbc_5ghz(dev, apdev):
                    "channel": "36",
                    "ieee80211n": "0",
                    "wmm_enabled": "0" }
-        hostapd.add_ap(apdev[1]['ifname'], params)
+        hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
         time.sleep(0.5)
         status = hapd.get_status()
         if status['olbc_ht'] != '1':
             raise Exception("Missing OLBC information")
     finally:
+        if hapd:
+            hapd.request("DISABLE")
+        if hapd2:
+            hapd2.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
 
 def test_ap_require_ht(dev, apdev):
@@ -601,6 +630,7 @@ def test_ap_ht40_csa(dev, apdev):
     if not csa_supported(dev[0]):
         return "skip"
     try:
+        hapd = None
         params = { "ssid": "ht",
                    "country_code": "US",
                    "hw_mode": "a",
@@ -634,13 +664,18 @@ def test_ap_ht40_csa(dev, apdev):
             raise Exception("Unexpected STA disconnection during CSA")
         hwsim_utils.test_connectivity(dev[0], hapd)
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_ap_ht40_csa2(dev, apdev):
     """HT with 40 MHz channel width and CSA"""
     if not csa_supported(dev[0]):
         return "skip"
     try:
+        hapd = None
         params = { "ssid": "ht",
                    "country_code": "US",
                    "hw_mode": "a",
@@ -674,13 +709,18 @@ def test_ap_ht40_csa2(dev, apdev):
             raise Exception("Unexpected STA disconnection during CSA")
         hwsim_utils.test_connectivity(dev[0], hapd)
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_ap_ht40_csa3(dev, apdev):
     """HT with 40 MHz channel width and CSA"""
     if not csa_supported(dev[0]):
         return "skip"
     try:
+        hapd = None
         params = { "ssid": "ht",
                    "country_code": "US",
                    "hw_mode": "a",
@@ -714,4 +754,8 @@ def test_ap_ht40_csa3(dev, apdev):
             raise Exception("Unexpected STA disconnection during CSA")
         hwsim_utils.test_connectivity(dev[0], hapd)
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
index 6658ec1db4ea98a19749f941f1a2006c630d6c23..5558ccf64d8ca7d361dc2d3ad965aa2efb0a53d9 100644 (file)
@@ -58,6 +58,7 @@ def test_ap_vendor_elements(dev, apdev):
 def test_ap_country(dev, apdev):
     """WPA2-PSK AP setting country code and using 5 GHz band"""
     try:
+        hapd = None
         bssid = apdev[0]['bssid']
         ssid = "test-wpa2-psk"
         passphrase = 'qwertyuiop'
@@ -70,7 +71,11 @@ def test_ap_country(dev, apdev):
         dev[0].connect(ssid, psk=passphrase, scan_freq="5180")
         hwsim_utils.test_connectivity(dev[0], hapd)
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_ap_acl_accept(dev, apdev):
     """MAC ACL accept list"""
@@ -197,10 +202,15 @@ def test_ap_spectrum_management_required(dev, apdev):
     params["local_pwr_constraint"] = "3"
     params['spectrum_mgmt_required'] = "1"
     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")
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_ap_max_listen_interval(dev, apdev):
     """Open AP with maximum listen interval limit"""
index 41d64d2374577445c4d1ae3562e201a8a72c0939..a14f4e478f8f7974ad5beac3207f2a13d12398da 100644 (file)
@@ -25,6 +25,7 @@ def vht_supported():
 def test_ap_vht80(dev, apdev):
     """VHT with 80 MHz channel width"""
     try:
+        hapd = None
         params = { "ssid": "vht",
                    "country_code": "FI",
                    "hw_mode": "a",
@@ -45,11 +46,16 @@ def test_ap_vht80(dev, apdev):
                 return "skip"
         raise
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_ap_vht80_params(dev, apdev):
     """VHT with 80 MHz channel width and number of optional features enabled"""
     try:
+        hapd = None
         params = { "ssid": "vht",
                    "country_code": "FI",
                    "hw_mode": "a",
@@ -80,13 +86,20 @@ def test_ap_vht80_params(dev, apdev):
                 return "skip"
         raise
     finally:
+        dev[0].request("DISCONNECT")
+        dev[1].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
+        dev[1].flush_scan_cache()
 
 def test_ap_vht_20(devs, apdevs):
     """VHT and 20 MHz channel"""
     dev = devs[0]
     ap = apdevs[0]
     try:
+        hapd = None
         params = { "ssid": "test-vht20",
                    "country_code": "DE",
                    "hw_mode": "a",
@@ -104,7 +117,11 @@ def test_ap_vht_20(devs, apdevs):
         dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE")
         hwsim_utils.test_connectivity(dev, hapd)
     finally:
+        dev.request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev.flush_scan_cache()
 
 def test_ap_vht_capab_not_supported(dev, apdev):
     """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):
     """VHT with 160 MHz channel width"""
     try:
+        hapd = None
+        hapd2 = None
         params = { "ssid": "vht",
                    "country_code": "FI",
                    "hw_mode": "a",
@@ -235,11 +254,21 @@ def test_ap_vht160(dev, apdev):
                 return "skip"
         raise
     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'])
+        dev[0].flush_scan_cache()
+        dev[1].flush_scan_cache()
 
 def test_ap_vht80plus80(dev, apdev):
     """VHT with 80+80 MHz channel width"""
     try:
+        hapd = None
+        hapd2 = None
         params = { "ssid": "vht",
                    "country_code": "US",
                    "hw_mode": "a",
@@ -295,13 +324,22 @@ def test_ap_vht80plus80(dev, apdev):
                 return "skip"
         raise
     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'])
+        dev[0].flush_scan_cache()
+        dev[1].flush_scan_cache()
 
 def test_ap_vht80_csa(dev, apdev):
     """VHT with 80 MHz channel width and CSA"""
     if not csa_supported(dev[0]):
         return "skip"
     try:
+        hapd = None
         params = { "ssid": "vht",
                    "country_code": "US",
                    "hw_mode": "a",
@@ -345,4 +383,8 @@ def test_ap_vht80_csa(dev, apdev):
                 return "skip"
         raise
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
index 7a24ba291309ab9f7c4bb11c4fb6ca94ab2c15e1..60a830082b1f395084c379378a32f4df61751980 100644 (file)
@@ -203,6 +203,7 @@ def test_ap_wps_conf(dev, apdev):
 def test_ap_wps_conf_5ghz(dev, apdev):
     """WPS PBC provisioning with configured AP on 5 GHz band"""
     try:
+        hapd = None
         ssid = "test-wps-conf"
         params = { "ssid": ssid, "eap_server": "1", "wps_state": "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":
             raise Exception("Device name not available in STA command")
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_ap_wps_conf_chan14(dev, apdev):
     """WPS PBC provisioning with configured AP on channel 14"""
     try:
+        hapd = None
         ssid = "test-wps-conf"
         params = { "ssid": ssid, "eap_server": "1", "wps_state": "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":
             raise Exception("Device name not available in STA command")
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_ap_wps_twice(dev, apdev):
     """WPS provisioning with twice to change passphrase"""
index 790baeb99031ae4055e1b90d4c2079e6288d7737..b51e102131991718db4b02ada06537cc6ebd2a53 100644 (file)
@@ -124,11 +124,16 @@ 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")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_dfs_radar(dev, apdev):
     """DFS CAC functionality with radar detected"""
     try:
+        hapd2 = None
         hapd = start_dfs_ap(apdev[0])
         if hapd is None:
             if not os.path.exists("dfs"):
@@ -200,7 +205,13 @@ def test_dfs_radar(dev, apdev):
 
         wait_dfs_event(hapd2, None, 5)
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
+        if hapd2:
+            hapd2.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_dfs_radar_on_non_dfs_channel(dev, apdev):
     """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")
         dev[0].connect("dfs", key_mgmt="NONE")
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_dfs_radar_chanlist_vht80(dev, apdev):
     """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":
             raise Exception("Unexpected seg0 idx")
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_dfs_radar_chanlist_vht20(dev, apdev):
     """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")
         dev[0].connect("dfs", key_mgmt="NONE")
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
index 926dbe202792cae87899cbe9bd8acb61b6801c2e..f39ea17c7c4a00410153e8fae9f361688e047af2 100644 (file)
@@ -258,7 +258,11 @@ def test_nfc_wps_handover_5ghz(dev, apdev):
             raise Exception("Association with the AP timed out")
         check_wpa2_connection(dev[0], apdev[0], hapd, ssid)
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_nfc_wps_handover_chan14(dev, apdev):
     """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")
         check_wpa2_connection(dev[0], apdev[0], hapd, ssid)
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()
 
 def test_nfc_wps_handover_with_pw_token_set(dev, apdev):
     """Connect to WPS AP with NFC connection handover (wps_nfc_* set)"""
index 2138d89d96f41ef96bb86a11dd10e524f237e42f..79cadddd6bfccbf3dbe77a846d5cf5f1f70b1cfc 100644 (file)
@@ -38,6 +38,7 @@ def test_p2p_channel_5ghz(dev):
         remove_group(dev[0], dev[1])
     finally:
         set_country("00")
+        dev[1].flush_scan_cache()
 
 def test_p2p_channel_5ghz_no_vht(dev):
     """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:
         set_country("00")
         dev[0].request("P2P_SET disallow_freq ")
+        dev[1].flush_scan_cache()
 
 def test_p2p_channel_random_social(dev):
     """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:
         set_country("00")
         dev[0].request("P2P_SET disallow_freq ")
+        dev[1].flush_scan_cache()
 
 def test_p2p_channel_random(dev):
     """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:
         set_country("00")
         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):
     """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("SET p2p_oper_reg_class 0")
         dev[0].request("SET p2p_oper_channel 0")
+        dev[1].flush_scan_cache()
 
 def test_p2p_channel_avoid(dev):
     """P2P and avoid frequencies driver event"""
@@ -184,6 +189,7 @@ def test_p2p_channel_avoid(dev):
     finally:
         set_country("00")
         dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES")
+        dev[1].flush_scan_cache()
 
 def test_autogo_following_bss(dev, apdev):
     """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")
         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):
     """P2P channel selection: Station on different channel than GO configured pref channel"""
 
index d18e1ac302c028dc287c482ace4a6d2a7c6b6ec5..1e87d411d3bb75235961415b922ef023c2a8e6a6 100644 (file)
@@ -397,6 +397,8 @@ def test_wnm_bss_keep_alive(dev, apdev):
 def test_wnm_bss_tm(dev, apdev):
     """WNM BSS Transition Management"""
     try:
+        hapd = None
+        hapd2 = None
         params = { "ssid": "test-wnm",
                    "country_code": "FI",
                    "ieee80211d": "1",
@@ -491,4 +493,10 @@ def test_wnm_bss_tm(dev, apdev):
         if ev is not None:
             raise Exception("Unexpected reassociation");
     finally:
+        dev[0].request("DISCONNECT")
+        if hapd:
+            hapd.request("DISABLE")
+        if hapd2:
+            hapd2.request("DISABLE")
         subprocess.call(['iw', 'reg', 'set', '00'])
+        dev[0].flush_scan_cache()