aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>2018-08-06 19:46:41 (GMT)
committerJouni Malinen <j@w1.fi>2018-12-17 13:50:12 (GMT)
commit870906d5cc398a30c60b7bc3f6de84a5cba2e950 (patch)
treeb3f5e565514c084ce7b195d9da051adfde9411a0 /tests
parent5c7d35ba076a575091661d345d583f117712f13d (diff)
downloadhostap-870906d5cc398a30c60b7bc3f6de84a5cba2e950.zip
hostap-870906d5cc398a30c60b7bc3f6de84a5cba2e950.tar.gz
hostap-870906d5cc398a30c60b7bc3f6de84a5cba2e950.tar.bz2
tests: OCI validation in SA Query frames (OCV)
Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_ap_pmf.py67
1 files changed, 66 insertions, 1 deletions
diff --git a/tests/hwsim/test_ap_pmf.py b/tests/hwsim/test_ap_pmf.py
index c60f66d..e2f6529 100644
--- a/tests/hwsim/test_ap_pmf.py
+++ b/tests/hwsim/test_ap_pmf.py
@@ -11,7 +11,7 @@ logger = logging.getLogger()
import hwsim_utils
import hostapd
-from utils import alloc_fail, fail_test, wait_fail_trigger
+from utils import alloc_fail, fail_test, wait_fail_trigger, HwsimSkip
from wlantest import Wlantest
from wpasupplicant import WpaSupplicant
@@ -58,6 +58,71 @@ def test_ap_pmf_required(dev, apdev):
raise Exception("STA did not reply to SA Query")
@remote_compatible
+def test_ocv_sa_query(dev, apdev):
+ """Test SA Query with OCV"""
+ ssid = "test-pmf-required"
+ params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
+ params["wpa_key_mgmt"] = "WPA-PSK-SHA256"
+ params["ieee80211w"] = "2"
+ params["ocv"] = "1"
+ try:
+ hapd = hostapd.add_ap(apdev[0], params)
+ except Exception, e:
+ if "Failed to set hostapd parameter ocv" in str(e):
+ raise HwsimSkip("OCV not supported")
+ raise
+ Wlantest.setup(hapd)
+ wt = Wlantest()
+ wt.flush()
+ wt.add_passphrase("12345678")
+ dev[0].connect(ssid, psk="12345678", ieee80211w="1", ocv="1",
+ key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
+ scan_freq="2412")
+
+ # Test that client can handle SA Query with OCI element
+ if "OK" not in hapd.request("SA_QUERY " + dev[0].own_addr()):
+ raise Exception("SA_QUERY failed")
+ time.sleep(0.1)
+ if wt.get_sta_counter("valid_saqueryresp_tx", apdev[0]['bssid'],
+ dev[0].own_addr()) < 1:
+ raise Exception("STA did not reply to SA Query")
+
+ # Test that AP can handle SA Query with OCI element
+ if "OK" not in dev[0].request("UNPROT_DEAUTH"):
+ raise Exception("Triggering SA Query from the STA failed")
+ ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=3)
+ if ev is not None:
+ raise Exception("SA Query from the STA failed")
+
+@remote_compatible
+def test_ocv_sa_query_csa(dev, apdev):
+ """Test SA Query with OCV after channel switch"""
+ ssid = "test-pmf-required"
+ params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
+ params["wpa_key_mgmt"] = "WPA-PSK-SHA256"
+ params["ieee80211w"] = "2"
+ params["ocv"] = "1"
+ try:
+ hapd = hostapd.add_ap(apdev[0], params)
+ except Exception, e:
+ if "Failed to set hostapd parameter ocv" in str(e):
+ raise HwsimSkip("OCV not supported")
+ raise
+ Wlantest.setup(hapd)
+ wt = Wlantest()
+ wt.flush()
+ wt.add_passphrase("12345678")
+ dev[0].connect(ssid, psk="12345678", ieee80211w="1", ocv="1",
+ key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
+ scan_freq="2412")
+
+ hapd.request("CHAN_SWITCH 5 2437")
+ time.sleep(1)
+ if wt.get_sta_counter("valid_saqueryreq_tx", apdev[0]['bssid'],
+ dev[0].own_addr()) < 1:
+ raise Exception("STA did not start SA Query after channel switch")
+
+@remote_compatible
def test_ap_pmf_optional(dev, apdev):
"""WPA2-PSK AP with PMF optional"""
ssid = "test-pmf-optional"