tests: Opportunistic Wireless Encryption - duplicated association attempt
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
65a3a273cd
commit
b1cc775cf3
1 changed files with 66 additions and 0 deletions
|
@ -829,6 +829,72 @@ def test_owe_invalid_assoc_resp(dev, apdev):
|
||||||
dev[0].request("REMOVE_NETWORK all")
|
dev[0].request("REMOVE_NETWORK all")
|
||||||
dev[0].dump_monitor()
|
dev[0].dump_monitor()
|
||||||
|
|
||||||
|
def test_owe_double_assoc(dev, apdev):
|
||||||
|
"""Opportunistic Wireless Encryption - duplicated association attempt"""
|
||||||
|
if "OWE" not in dev[0].get_capability("key_mgmt"):
|
||||||
|
raise HwsimSkip("OWE not supported")
|
||||||
|
params = {"ssid": "owe",
|
||||||
|
"wpa": "2",
|
||||||
|
"ieee80211w": "2",
|
||||||
|
"wpa_key_mgmt": "OWE",
|
||||||
|
"rsn_pairwise": "CCMP"}
|
||||||
|
hapd = hostapd.add_ap(apdev[0], params)
|
||||||
|
bssid = hapd.own_addr()
|
||||||
|
|
||||||
|
dev[0].scan_for_bss(bssid, freq="2412")
|
||||||
|
|
||||||
|
hapd.set("ext_mgmt_frame_handling", "1")
|
||||||
|
dev[0].connect("owe", key_mgmt="OWE", owe_group="19", ieee80211w="2",
|
||||||
|
scan_freq="2412", wait_connect=False)
|
||||||
|
|
||||||
|
for i in range(0, 10):
|
||||||
|
req = hapd.mgmt_rx()
|
||||||
|
if req is None:
|
||||||
|
raise Exception("MGMT RX wait timed out")
|
||||||
|
if req['subtype'] == 11:
|
||||||
|
break
|
||||||
|
req = None
|
||||||
|
if not req:
|
||||||
|
raise Exception("Authentication frame not received")
|
||||||
|
hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + binascii.hexlify(req['frame']).decode())
|
||||||
|
|
||||||
|
for i in range(0, 10):
|
||||||
|
req = hapd.mgmt_rx()
|
||||||
|
if req is None:
|
||||||
|
raise Exception("MGMT RX wait timed out")
|
||||||
|
if req['subtype'] == 0:
|
||||||
|
break
|
||||||
|
req = None
|
||||||
|
if not req:
|
||||||
|
raise Exception("Association Request frame not received")
|
||||||
|
hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + binascii.hexlify(req['frame']).decode())
|
||||||
|
|
||||||
|
ev = hapd.wait_event(["MGMT-TX-STATUS"], timeout=5)
|
||||||
|
if ev is None:
|
||||||
|
raise Exception("Management frame TX status not reported (1)")
|
||||||
|
if "stype=1 ok=1" not in ev:
|
||||||
|
raise Exception("Unexpected management frame TX status (1): " + ev)
|
||||||
|
cmd = "MGMT_TX_STATUS_PROCESS stype=1 ok=0 %s" % (ev.split(' ')[3])
|
||||||
|
if "OK" not in hapd.request(cmd):
|
||||||
|
raise Exception("MGMT_TX_STATUS_PROCESS failed")
|
||||||
|
|
||||||
|
hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + binascii.hexlify(req['frame']).decode())
|
||||||
|
|
||||||
|
ev = hapd.wait_event(["MGMT-TX-STATUS"], timeout=5)
|
||||||
|
if ev is None:
|
||||||
|
raise Exception("Management frame TX status not reported (1)")
|
||||||
|
if "stype=1 ok=1" not in ev:
|
||||||
|
raise Exception("Unexpected management frame TX status (1): " + ev)
|
||||||
|
cmd = "MGMT_TX_STATUS_PROCESS stype=1 ok=1 %s" % (ev.split(' ')[3])
|
||||||
|
if "OK" not in hapd.request(cmd):
|
||||||
|
raise Exception("MGMT_TX_STATUS_PROCESS failed")
|
||||||
|
|
||||||
|
ev = dev[0].wait_event(["PMKSA-CACHE-ADDED"], timeout=5)
|
||||||
|
if ev is None:
|
||||||
|
raise Exception("No PMKSA cache entry from OWE added")
|
||||||
|
|
||||||
|
dev[0].wait_connected()
|
||||||
|
|
||||||
def start_owe(dev, apdev, workaround=0):
|
def start_owe(dev, apdev, workaround=0):
|
||||||
if "OWE" not in dev[0].get_capability("key_mgmt"):
|
if "OWE" not in dev[0].get_capability("key_mgmt"):
|
||||||
raise HwsimSkip("OWE not supported")
|
raise HwsimSkip("OWE not supported")
|
||||||
|
|
Loading…
Reference in a new issue