dev[0].connect("country98", key_mgmt="NONE", scan_freq="2412")
dev[1].request("DISCONNECT")
dev[0].wait_disconnected()
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- time.sleep(1)
+ dev[0].disconnect_and_stop_scan()
dev[0].reset()
dev[1].reset()
dev[0].dump_monitor()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
if ev and "CTRL-EVENT-CONNECTED" in ev:
raise Exception("Unexpected connection")
dev[0].request("REMOVE_NETWORK all")
- dev[0].request("ABORT_SCAN")
+ dev[0].disconnect_and_stop_scan()
tests = [("peap-ver0", ""),
("peap-ver1", ""),
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- res = dev[0].request("ABORT_SCAN")
- for i in range(2 if "OK" in res else 1):
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED",
- "CTRL-EVENT-SCAN-RESULTS"], timeout=0.5)
- dev[0].dump_monitor()
+ dev[0].disconnect_and_stop_scan()
hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
def tdls_clear_reg(hapd, dev):
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- res0 = dev[0].request("ABORT_SCAN")
dev[1].request("DISCONNECT")
- res1 = dev[1].request("ABORT_SCAN")
- for i in range(2 if "OK" in res0 else 1):
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED",
- "CTRL-EVENT-SCAN-RESULTS"], timeout=0.5)
- dev[0].dump_monitor()
- for i in range(2 if "OK" in res1 else 1):
- dev[1].wait_event(["CTRL-EVENT-DISCONNECTED",
- "CTRL-EVENT-SCAN-RESULTS"], timeout=0.5)
- dev[1].dump_monitor()
+ dev[0].disconnect_and_stop_scan()
+ dev[1].disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev.request("DISCONNECT")
- dev.request("ABORT_SCAN")
- dev.wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev.disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
dev.wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev.flush_scan_cache()
hapd.disable()
for i in range(3):
dev[i].request("DISCONNECT")
- dev[i].request("ABORT_SCAN")
for i in range(3):
- dev[i].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[i].disconnect_and_stop_scan()
class APConnection:
def init_params(self):
dev[0].dump_monitor()
if conn.hapd:
conn.hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
@remote_compatible
def test_wpa2_ocv_ap_vht80plus80_mismatch(dev, apdev):
dev[0].dump_monitor()
if conn.hapd:
conn.hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
@remote_compatible
def test_wpa2_ocv_ap_unexpected1(dev, apdev):
dev[0].dump_monitor()
if conn.hapd:
conn.hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
def test_wpa2_ocv_sta_group_hs(dev, apdev):
"""OCV group handshake (STA)"""
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- dev[0].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
- dev[0].request("DISCONNECT")
- res = dev[0].request("ABORT_SCAN")
- for i in range(2 if "OK" in res else 1):
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED",
- "CTRL-EVENT-SCAN-RESULTS"], timeout=0.5)
- dev[0].dump_monitor()
+ dev[0].disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
if hapd:
hapd.request("DISABLE")
time.sleep(0.1)
- dev[0].request("DISCONNECT")
- res = dev[0].request("ABORT_SCAN")
- try:
- dev[0].wait_disconnected()
- except:
- pass
- if "OK" in res:
- dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
wait_regdom_changes(dev[0])
country = dev[0].get_driver_status_field("country")
finally:
if hapd:
hapd.request("DISABLE")
- dev[0].request("DISCONNECT")
- res = dev[0].request("ABORT_SCAN")
- for i in range(2 if "OK" in res else 1):
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED",
- "CTRL-EVENT-SCAN-RESULTS"], timeout=0.5)
+ dev[0].disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5)
dev[0].flush_scan_cache()
dev[1].connect("wpas-ap-dfs", key_mgmt="NONE")
dev[1].wait_regdom(country_ie=True)
dev[0].request("DISCONNECT")
- dev[1].request("DISCONNECT")
- dev[1].request("ABORT_SCAN")
- dev[1].wait_disconnected()
+ dev[1].disconnect_and_stop_scan()
@remote_compatible
def test_wpas_ap_disable(dev):
time.sleep(0.1)
for i in range(count):
dev[i].request("DISCONNECT")
- dev[i].request("ABORT_SCAN")
- dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5)
+ for i in range(count):
+ dev[i].disconnect_and_stop_scan()
subprocess.call(['iw', 'reg', 'set', '00'])
wait_regdom_changes(dev[0])
country = dev[0].get_driver_status_field("country")
if len(res.splitlines()) > 1:
logger.info("flush_scan_cache: Could not clear all BSS entries. These remain:\n" + res)
+ def disconnect_and_stop_scan(self):
+ self.request("DISCONNECT")
+ res = self.request("ABORT_SCAN")
+ for i in range(2 if "OK" in res else 1):
+ self.wait_event(["CTRL-EVENT-DISCONNECTED",
+ "CTRL-EVENT-SCAN-RESULTS"], timeout=0.5)
+ self.dump_monitor()
+
def roam(self, bssid, fail_test=False, assoc_reject_ok=False):
self.dump_monitor()
if "OK" not in self.request("ROAM " + bssid):