tests: OCV with OCI override on STA

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-05-25 18:32:32 +03:00 committed by Jouni Malinen
parent a3556d5813
commit 5071248bd4

View file

@ -903,3 +903,92 @@ def test_wpa2_ocv_auto_enable_pmf(dev, apdev):
ieee80211w="2")
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
def test_wpa2_ocv_sta_override_eapol(dev, apdev):
"""OCV on 2.4 GHz and STA override EAPOL-Key msg 2/4"""
params = {"channel": "1",
"ieee80211w": "2",
"ocv": "1"}
hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params)
dev[0].set("oci_freq_override_eapol", "2462")
dev[0].connect(ssid, psk=passphrase, scan_freq="2412", ocv="1",
ieee80211w="2", wait_connect=False)
ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
"CTRL-EVENT-DISCONNECTED"], timeout=15)
dev[0].request("DISCONNECT")
if ev is None:
raise Exception("No connection result reported")
if "CTRL-EVENT-CONNECTED" in ev:
raise Exception("Unexpected connection")
if "reason=15" not in ev:
raise Exception("Unexpected disconnection reason: " + ev)
ev = hapd.wait_event(["OCV-FAILURE"], timeout=1)
if ev is None:
raise Exception("OCV failure for EAPOL-Key msg 2/4 not reported")
if "addr=" + dev[0].own_addr() not in ev:
raise Exception("Unexpected OCV failure addr: " + ev)
if "frame=eapol-key-m2" not in ev:
raise Exception("Unexpected OCV failure frame: " + ev)
if "error=primary channel mismatch" not in ev:
raise Exception("Unexpected OCV failure error: " + ev)
def test_wpa2_ocv_sta_override_sa_query_req(dev, apdev):
"""OCV on 2.4 GHz and STA override SA Query Request"""
params = {"channel": "1",
"ieee80211w": "2",
"ocv": "1"}
hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params)
dev[0].connect(ssid, psk=passphrase, scan_freq="2412", ocv="1",
ieee80211w="2")
hapd.wait_sta()
dev[0].set("oci_freq_override_saquery_req", "2462")
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 None:
raise Exception("Disconnection after failed SA Query not reported")
dev[0].set("oci_freq_override_saquery_req", "0")
dev[0].wait_connected()
if "OK" not in dev[0].request("UNPROT_DEAUTH"):
raise Exception("Triggering SA Query from the STA failed")
ev = hapd.wait_event(["OCV-FAILURE"], timeout=3)
if ev is None:
raise Exception("OCV failure for SA Query Request not reported")
if "addr=" + dev[0].own_addr() not in ev:
raise Exception("Unexpected OCV failure addr: " + ev)
if "frame=saqueryreq" not in ev:
raise Exception("Unexpected OCV failure frame: " + ev)
if "error=primary channel mismatch" not in ev:
raise Exception("Unexpected OCV failure error: " + ev)
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=3)
if ev is not None:
raise Exception("SA Query from the STA failed")
def test_wpa2_ocv_sta_override_sa_query_resp(dev, apdev):
"""OCV on 2.4 GHz and STA override SA Query Response"""
params = {"channel": "1",
"ieee80211w": "2",
"ocv": "1"}
hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params)
dev[0].connect(ssid, psk=passphrase, scan_freq="2412", ocv="1",
ieee80211w="2")
dev[0].set("oci_freq_override_saquery_resp", "2462")
hapd.wait_sta()
if "OK" not in hapd.request("SA_QUERY " + dev[0].own_addr()):
raise Exception("SA_QUERY failed")
ev = hapd.wait_event(["OCV-FAILURE"], timeout=3)
if ev is None:
raise Exception("OCV failure for SA Query Response not reported")
if "addr=" + dev[0].own_addr() not in ev:
raise Exception("Unexpected OCV failure addr: " + ev)
if "frame=saqueryresp" not in ev:
raise Exception("Unexpected OCV failure frame: " + ev)
if "error=primary channel mismatch" not in ev:
if "error=did not receive mandatory OCI" in ev:
# This is not correct, but do not report this as test failure for
# now since the issue seems to be in mac80211 not allowing
# wpa_supplicant to process the SA Query Request frame.
logger.info("Unexpected OCV failure error: " + ev)
else:
raise Exception("Unexpected OCV failure error: " + ev)