aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2016-11-25 20:48:26 (GMT)
committerJouni Malinen <j@w1.fi>2016-11-25 20:52:39 (GMT)
commitdff690b8597cd0ca17de470c1911352c63cbbbd1 (patch)
treea045159a11d8a684c6b87774ff738c57789d5bd6 /tests
parent346b333d9a57155e5a32a31d951ada38b3c899fc (diff)
downloadhostap-dff690b8597cd0ca17de470c1911352c63cbbbd1.zip
hostap-dff690b8597cd0ca17de470c1911352c63cbbbd1.tar.gz
hostap-dff690b8597cd0ca17de470c1911352c63cbbbd1.tar.bz2
tests: Random MAC address in scans while connected
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_scan.py23
-rw-r--r--tests/hwsim/wpasupplicant.py5
2 files changed, 27 insertions, 1 deletions
diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py
index 1ca4bd0..56f10f8 100644
--- a/tests/hwsim/test_scan.py
+++ b/tests/hwsim/test_scan.py
@@ -790,6 +790,29 @@ def _test_scan_random_mac(dev, apdev, params):
if not found:
raise Exception("Fixed OUI random address not seen")
+def test_scan_random_mac_connected(dev, apdev, params):
+ """Random MAC address in scans while connected"""
+ try:
+ _test_scan_random_mac_connected(dev, apdev, params)
+ finally:
+ dev[0].request("MAC_RAND_SCAN all enable=0")
+
+def _test_scan_random_mac_connected(dev, apdev, params):
+ hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
+ bssid = apdev[0]['bssid']
+ if dev[0].get_driver_status_field('capa.mac_addr_rand_scan_supported') != '1':
+ raise HwsimSkip("Driver does not support random MAC address for scanning")
+
+ dev[0].connect("test-scan", key_mgmt="NONE", scan_freq="2412")
+
+ hostapd.add_ap(apdev[1], { "ssid": "test-scan-2", "channel": "11" })
+ bssid1 = apdev[1]['bssid']
+
+ # Verify that scanning can be completed while connected even if that means
+ # disabling use of random MAC address.
+ dev[0].request("MAC_RAND_SCAN all enable=1")
+ dev[0].scan_for_bss(bssid1, freq=2462, force_scan=True)
+
@remote_compatible
def test_scan_trigger_failure(dev, apdev):
"""Scan trigger to the driver failing"""
diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index ba2552c..23cb395 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -1053,9 +1053,12 @@ class WpaSupplicant:
raise Exception("Failed to trigger scan")
if no_wait:
return
- ev = self.wait_event(["CTRL-EVENT-SCAN-RESULTS"], 15)
+ ev = self.wait_event(["CTRL-EVENT-SCAN-RESULTS",
+ "CTRL-EVENT-SCAN-FAILED"], 15)
if ev is None:
raise Exception("Scan timed out")
+ if "CTRL-EVENT-SCAN-FAILED" in ev:
+ raise Exception("Scan failed: " + ev)
def scan_for_bss(self, bssid, freq=None, force_scan=False, only_new=False):
if not force_scan and self.get_bss(bssid) is not None: