[PATCH 14/55] tests: FT-EAP initial association with IEEE 802.1X in Authentication frames

Ilan Peer ilan.peer at intel.com
Thu Dec 3 02:44:13 PST 2026


Verify that FT initial mobility domain association works with IEEE
802.1X over authentication frames and encrypted association frames.

Check that that the MDE and the FTE are included in the IEEE 802.1X
Authentication frames, and that the next transition uses the FT protocol.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/test_ap_ft.py | 82 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 80 insertions(+), 2 deletions(-)

diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py
index 9b7d8799d870..f0e5f153b678 100644
--- a/tests/hwsim/test_ap_ft.py
+++ b/tests/hwsim/test_ap_ft.py
@@ -6,6 +6,7 @@
 
 from remotehost import remote_compatible
 import binascii
+import json
 import os
 import time
 import logging
@@ -18,7 +19,7 @@ import tempfile
 import hwsim_utils
 from hwsim import HWSimRadio
 import hostapd
-from tshark import run_tshark
+from tshark import run_tshark, run_tshark_json
 from utils import *
 from wlantest import Wlantest
 from test_ap_psk import check_mib, find_wpas_process, read_process_memory, verify_not_present, get_key_locations
@@ -140,10 +141,12 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
               roam_with_reassoc=False, also_non_ft=False, only_one_way=False,
               wait_before_roam=0, return_after_initial=False, ieee80211w="1",
               sae_transition=False, beacon_prot=False, sae_ext_key=False,
-              check_ssid=False, gtk_rekey=False):
+              check_ssid=False, gtk_rekey=False, eap_over_auth=False):
     logger.info("Connect to first AP")
 
     copts = {}
+    if eap_over_auth:
+        copts["eap_over_auth_frame"] = "1"
     copts["proto"] = "WPA2"
     copts["ieee80211w"] = ieee80211w
     copts["scan_freq"] = "2412"
@@ -3900,3 +3903,78 @@ def test_ap_ft_pmf_reassoc_resp_no_ack(dev, apdev):
     hwsim_utils.test_connectivity(dev[0], hapd1)
     if "[ASSOC]" not in hapd1.get_sta(dev[0].own_addr())['flags']:
         raise Exception("STA not associated on the AP")
+
+def ft_1x_auth_frames(capfile, auth_seq):
+    filt = "wlan.fc.type_subtype == 0x000b && wlan.fixed.auth.alg == 8 && " + \
+           "wlan.fixed.auth_seq == %d" % auth_seq
+    out = run_tshark_json(capfile, filt)
+    return [p["_source"]["layers"]["frame_raw"][0] for p in json.loads(out)]
+
+def ft_1x_auth_check_capture(capfile):
+    # The Wireshark dissector does not skip the Encapsulation field, so look
+    # for the MDE (36 03 a1 b2 01) and the FTE (37) in the raw frames.
+    mde = "3603a1b201"
+    auth1 = ft_1x_auth_frames(capfile, 1)
+    auth2 = ft_1x_auth_frames(capfile, 2)
+    logger.info("IEEE 802.1X Authentication frames: %d/%d" %
+                (len(auth1), len(auth2)))
+    if not auth1 or mde not in auth1[0]:
+        raise Exception("No MDE in IEEE 802.1X Authentication frame 1")
+
+    if not auth2 or mde + "37" not in auth2[0]:
+        raise Exception("No MDE/FTE in IEEE 802.1X Authentication frame 2")
+
+def test_ap_ft_eap_1x_auth(dev, apdev, params):
+    """FT-EAP initial association with IEEE 802.1X in Authentication frames"""
+    capfile = os.path.join(params['logdir'], "hwsim0.pcapng")
+    ssid = "test-ft"
+    passphrase = "12345678"
+
+    radius = hostapd.radius_params()
+    hapds = []
+    for i, ft_p in enumerate([ft_params1, ft_params2]):
+        p = ft_p(ssid=ssid, passphrase=passphrase)
+        p['wpa_key_mgmt'] = "FT-EAP"
+        p["ieee8021x"] = "1"
+        p["ieee80211w"] = "2"
+        p["assoc_frame_encryption"] = "1"
+        p["eap_using_authentication_frames"] = "1"
+        p = dict(list(radius.items()) + list(p.items()))
+        hapds.append(hostapd.add_ap(apdev[i], p))
+
+    dev[0].flush_scan_cache()
+    run_roams(dev[0], apdev, hapds[0], hapds[1], ssid, passphrase, eap=True,
+              ieee80211w="2", force_initial_conn_to_first_ap=True,
+              eap_over_auth=True, only_one_way=True)
+
+    if hapds[1].get_sta(dev[0].own_addr())['auth_alg'] != '2':
+        raise Exception("FT was not used after the initial association")
+
+    ft_1x_auth_check_capture(capfile)
+
+def test_ap_ft_eap_1x_auth_fte_mismatch(dev, apdev):
+    """FT-EAP initial association over IEEE 802.1X with FTE mismatch in association response"""
+    p = ft_params1(ssid="test-ft", passphrase="12345678")
+    p = dict(list(hostapd.radius_params().items()) + list(p.items()))
+    p["wpa_key_mgmt"] = "FT-EAP"
+    p["ieee8021x"] = "1"
+    p["ieee80211w"] = "2"
+    p["assoc_frame_encryption"] = "1"
+    p["eap_using_authentication_frames"] = "1"
+
+    # The FTE in the Association Response differs from Authentication frame 2
+    p["ft_rsnxe_used"] = "1"
+    hostapd.add_ap(apdev[0], p)
+    dev[0].connect("test-ft", key_mgmt="FT-EAP", ieee80211w="2",
+                   eap="GPSK", identity="gpsk user",
+                   password="abcdefghijklmnop0123456789abcdef",
+                   eap_over_auth_frame="1", scan_freq="2412",
+                   wait_connect=False)
+    ev = dev[0].wait_event(["ENC_ASSOC: FT elements or PMKR1Name mismatch",
+                            "CTRL-EVENT-CONNECTED"], timeout=15)
+    dev[0].request("DISCONNECT")
+    if ev is None:
+        raise Exception("No connection result")
+
+    if "CTRL-EVENT-CONNECTED" in ev:
+        raise Exception("FTE mismatch in Association Response not detected")
-- 
2.55.0




More information about the Hostap mailing list