aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2020-05-26 13:15:45 (GMT)
committerJouni Malinen <j@w1.fi>2020-05-26 13:23:39 (GMT)
commiteff431ff3868d5414f6017fa0bccdde03bb0b922 (patch)
treef74441f4054aab23a4c7c1a703038b2549cfd158
parentd578e890eb4fe344824ee9f43124091fc0f848b1 (diff)
downloadhostap-master.zip
hostap-master.tar.gz
hostap-master.tar.bz2
tests: OWE transition mode with owe_transition_ifnameHEADpendingmaster
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
-rw-r--r--tests/hwsim/test_ap_acs.py4
-rw-r--r--tests/hwsim/test_owe.py83
2 files changed, 85 insertions, 2 deletions
diff --git a/tests/hwsim/test_ap_acs.py b/tests/hwsim/test_ap_acs.py
index 0f547cc..eb245e7 100644
--- a/tests/hwsim/test_ap_acs.py
+++ b/tests/hwsim/test_ap_acs.py
@@ -37,7 +37,7 @@ def wait_acs(hapd, return_after_acs=False):
state = hapd.get_status_field("state")
if state != "ACS":
- raise Exception("Unexpected interface state")
+ raise Exception("Unexpected interface state %s (expected ACS)" % state)
ev = hapd.wait_event(["ACS-COMPLETED", "ACS-FAILED", "AP-ENABLED",
"AP-DISABLED"], timeout=20)
@@ -57,7 +57,7 @@ def wait_acs(hapd, return_after_acs=False):
state = hapd.get_status_field("state")
if state != "ENABLED":
- raise Exception("Unexpected interface state")
+ raise Exception("Unexpected interface state %s (expected ENABLED)" % state)
def test_ap_acs(dev, apdev):
"""Automatic channel selection"""
diff --git a/tests/hwsim/test_owe.py b/tests/hwsim/test_owe.py
index 51cd7bf..e0d3568 100644
--- a/tests/hwsim/test_owe.py
+++ b/tests/hwsim/test_owe.py
@@ -16,6 +16,7 @@ from wpasupplicant import WpaSupplicant
import hwsim_utils
from tshark import run_tshark
from utils import HwsimSkip, fail_test, alloc_fail, wait_fail_trigger
+from test_ap_acs import wait_acs
def test_owe(dev, apdev):
"""Opportunistic Wireless Encryption"""
@@ -208,6 +209,88 @@ def run_owe_transition_mode(dev, apdev):
dev[0].wait_connected()
hwsim_utils.test_connectivity(dev[0], hapd)
+def test_owe_transition_mode_ifname(dev, apdev):
+ """Opportunistic Wireless Encryption transition mode (ifname)"""
+ if "OWE" not in dev[0].get_capability("key_mgmt"):
+ raise HwsimSkip("OWE not supported")
+ dev[0].flush_scan_cache()
+ params = {"ssid": "owe-random",
+ "wpa": "2",
+ "wpa_key_mgmt": "OWE",
+ "rsn_pairwise": "CCMP",
+ "ieee80211w": "2",
+ "owe_transition_ifname": apdev[1]['ifname'],
+ "ignore_broadcast_ssid": "1"}
+ hapd = hostapd.add_ap(apdev[0], params)
+ bssid = hapd.own_addr()
+
+ params = {"ssid": "owe-test",
+ "owe_transition_ifname": apdev[0]['ifname']}
+ hapd2 = hostapd.add_ap(apdev[1], params)
+ bssid2 = hapd2.own_addr()
+
+ dev[0].scan_for_bss(bssid, freq="2412")
+ dev[0].scan_for_bss(bssid2, freq="2412")
+
+ id = dev[0].connect("owe-test", key_mgmt="OWE", ieee80211w="2",
+ scan_freq="2412")
+ val = dev[0].get_status_field("key_mgmt")
+ if val != "OWE":
+ raise Exception("Unexpected key_mgmt: " + val)
+
+def test_owe_transition_mode_ifname_acs(dev, apdev):
+ """Opportunistic Wireless Encryption transition mode (ifname, ACS)"""
+ run_owe_transition_mode_ifname_acs(dev, apdev, wait_first=False)
+
+def test_owe_transition_mode_ifname_acs2(dev, apdev):
+ """Opportunistic Wireless Encryption transition mode (ifname, ACS)"""
+ run_owe_transition_mode_ifname_acs(dev, apdev, wait_first=True)
+
+def run_owe_transition_mode_ifname_acs(dev, apdev, wait_first):
+ if "OWE" not in dev[0].get_capability("key_mgmt"):
+ raise HwsimSkip("OWE not supported")
+ dev[0].flush_scan_cache()
+ params = {"ssid": "owe-random",
+ "channel": "0",
+ "wpa": "2",
+ "wpa_key_mgmt": "OWE",
+ "rsn_pairwise": "CCMP",
+ "ieee80211w": "2",
+ "owe_transition_ifname": apdev[1]['ifname'],
+ "ignore_broadcast_ssid": "1"}
+ hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
+ bssid = hapd.own_addr()
+
+ if wait_first:
+ wait_acs(hapd)
+
+ params = {"ssid": "owe-test",
+ "channel": "0",
+ "owe_transition_ifname": apdev[0]['ifname']}
+ hapd2 = hostapd.add_ap(apdev[1], params, wait_enabled=False)
+ bssid2 = hapd2.own_addr()
+
+ wait_acs(hapd2)
+ if not wait_first:
+ state = hapd.get_status_field("state")
+ if state == "ACS-STARTED":
+ time.sleep(5)
+ state = hapd.get_status_field("state")
+ if state != "ENABLED":
+ raise Exception("AP1 startup did not succeed")
+
+ freq = hapd.get_status_field("freq")
+ freq2 = hapd2.get_status_field("freq")
+
+ dev[0].scan_for_bss(bssid, freq=freq)
+ dev[0].scan_for_bss(bssid2, freq=freq2)
+
+ id = dev[0].connect("owe-test", key_mgmt="OWE", ieee80211w="2",
+ scan_freq="%s %s" % (freq, freq2))
+ val = dev[0].get_status_field("key_mgmt")
+ if val != "OWE":
+ raise Exception("Unexpected key_mgmt: " + val)
+
def test_owe_transition_mode_open_only_ap(dev, apdev):
"""Opportunistic Wireless Encryption transition mode connect to open-only AP"""
if "OWE" not in dev[0].get_capability("key_mgmt"):