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 dd506c1..c0b559b 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 310001f..fea1a78 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 6658ec1..5558ccf 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 41d64d2..a14f4e4 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 7a24ba2..60a8300 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 790baeb..b51e102 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 926dbe2..f39ea17 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 2138d89..79caddd 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 d18e1ac..1e87d41 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()