]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: FT with RSNXE only from STA
authorJouni Malinen <quic_jouni@quicinc.com>
Fri, 27 Sep 2024 20:02:26 +0000 (23:02 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 27 Sep 2024 20:02:26 +0000 (23:02 +0300)
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_ap_ft.py
tests/hwsim/wpasupplicant.py

index 5b890b4b63fd17104b0fa31cc7727fb30c945cb7..bbbe8cf221298de145b94adbe20666a01e038277 100644 (file)
@@ -1222,6 +1222,55 @@ def test_ap_ft_sae_h2e_and_loop2(dev, apdev):
     finally:
         dev[0].set("sae_pwe", "0")
 
+def test_ap_ft_rsnxe_only_from_sta(dev, apdev):
+    """FT with RSNXE only from STA"""
+    hapd0, hapd1 = start_ft_sae(dev[0], apdev, sae_pwe="0")
+    hapd1.disable()
+    dev[0].scan_for_bss(hapd0.own_addr(), freq=2412)
+    hapd0.set("ext_mgmt_frame_handling", "1")
+    dev[0].connect("test-ft", key_mgmt="FT-SAE", sae_password="12345678",
+                   sae_pwe="2", wait_connect=False)
+
+    for j in range(2):
+        for i in range(0, 10):
+            req = hapd0.mgmt_rx()
+            if req is None:
+                raise Exception("MGMT RX wait timed out (authentication)")
+            if req['subtype'] == 11:
+                break
+            req = None
+        if not req:
+            raise Exception("Authentication frame not received")
+
+        hapd0.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + binascii.hexlify(req['frame']).decode())
+
+    for i in range(0, 10):
+        req = hapd0.mgmt_rx()
+        if req is None:
+            raise Exception("MGMT RX wait timed out (association)")
+        if req['subtype'] == 0:
+            break
+        req = None
+    if not req:
+        raise Exception("Association Request frame not received")
+
+    hapd0.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + binascii.hexlify(req['frame']).decode())
+    ev = hapd0.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 %s" % (" ".join(ev.split(' ')[1:4]))
+    if "OK" not in hapd0.request(cmd):
+        raise Exception("MGMT_TX_STATUS_PROCESS failed")
+
+    dev[0].wait_connected()
+    hapd0.set("ext_mgmt_frame_handling", "0")
+
+    ies = parse_ie(binascii.hexlify(req['payload'][4:]))
+    if 244 not in ies:
+        raise Exception("RSNXE not included in Association Request frame for initial mobility domain association")
+
 def test_ap_ft_sae_h2e_downgrade_attack(dev, apdev):
     """WPA2-PSK-FT-SAE AP (H2E downgrade attack)"""
     try:
index 8d4da761d888c6509ca431cb5c89c3f7a0f8e6d1..c6fb1d9a4e2534349b2fee6ae659450baea8a84c 100644 (file)
@@ -1135,6 +1135,7 @@ class WpaSupplicant:
                       "wpa_deny_ptk0_rekey",
                       "max_idle",
                       "ssid_protection",
+                      "sae_pwe",
                       "enable_4addr_mode"]
         for field in not_quoted:
             if field in kwargs and kwargs[field]: