[PATCH v2] wpa_supplicant: Do not use UHR without a security profile

Ilan Peer ilan.peer at intel.com
Tue Dec 1 01:28:44 PST 2026


IEEE P802.11bn/D2.1, 37.32 requires a Security Profile element in a UHR
association. Disable UHR if security profiles are not used or, with SME
in wpa_supplicant, none is selected. With SME in the driver, the driver
selects the security profile and handles this.

Update the UHR tests to use security profile 9.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 src/drivers/driver.h            |  7 ++++--
 tests/hwsim/test_uhr.py         | 39 +++++++++++++++++++++++++++------
 wpa_supplicant/wpa_supplicant.c | 25 +++++++++++++++++++++
 3 files changed, 62 insertions(+), 9 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 590748f3a987..14bfeaf1e6ab 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2626,8 +2626,11 @@ struct wpa_driver_capa {
 /** Driver supports adding OKC derived PMKID in (Re)Association Request frame */
 #define WPA_DRIVER_FLAGS2_OKC_PMKID_IN_ASSOC	0x0000004000000000ULL
 	u64 flags2;
-/** Driver supports Security Profile element (IEEE P802.11bn/D2.0, 9.4.2.369
- * and 37.33) handling */
+/**
+ * Driver supports Security Profile element (IEEE P802.11bn/D2.0, 9.4.2.369
+ * and 37.33) handling. With SME in the driver, the driver selects the security
+ * profile and must not use UHR without a security profile.
+ */
 #define WPA_DRIVER_FLAGS2_SECURITY_PROFILE      0x0000008000000000ULL
 
 #define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \
diff --git a/tests/hwsim/test_uhr.py b/tests/hwsim/test_uhr.py
index 1705a13ec92d..4b719d19f531 100644
--- a/tests/hwsim/test_uhr.py
+++ b/tests/hwsim/test_uhr.py
@@ -27,6 +27,13 @@ def uhr_verify_wifi_version(dev):
     if status['wifi_generation'] != "8":
         raise Exception("Unexpected wifi_generation value: " + status['wifi_generation'])
 
+def uhr_sec_prof_params(params):
+    # Security profile 9: SAE-EXT-KEY (AKM 24), GCMP-256, MFPR=1
+    params['wpa_key_mgmt'] = 'SAE-EXT-KEY'
+    params['rsn_pairwise'] = 'GCMP-256'
+    params['group_cipher'] = 'GCMP-256'
+    params['security_profiles'] = '9'
+
 def uhr_verify_status(wpas, hapd, is_ht=False, is_vht=False,
                       sta_expect_uhr=True):
     status = hapd.get_status()
@@ -75,6 +82,7 @@ def test_uhr_simple(dev, apdev):
                                         pwe='2', mfp='2')
         params['ieee80211bn'] = '1'
         params['require_uhr'] = '1'
+        uhr_sec_prof_params(params)
         try:
             hapd = eht_mld_enable_ap(hapd_iface, 0, params)
         except Exception as e:
@@ -85,8 +93,10 @@ def test_uhr_simple(dev, apdev):
         if hapd.get_status_field("ieee80211bn") != "1":
             raise Exception("AP STATUS did not indicate ieee80211bn=1")
         wpas.set("sae_pwe", "1")
-        wpas.connect("uhr", key_mgmt="SAE", sae_password=passphrase,
-                     ieee80211w="2", scan_freq="2412")
+        wpas.set("security_profiles", "1")
+        wpas.connect("uhr", key_mgmt="SAE-EXT-KEY", sae_password=passphrase,
+                     ieee80211w="2", scan_freq="2412",
+                     pairwise="GCMP-256", group="GCMP-256")
         hapd.wait_sta()
         sta = hapd.get_sta(wpas.own_addr())
         uhr_verify_status(wpas, hapd, is_ht=True)
@@ -143,6 +153,8 @@ def uhr_mld_ap_wpa2_params(ssid, passphrase=None, key_mgmt="WPA-PSK-SHA256",
     if pwe is not None:
         params['sae_pwe'] = pwe
 
+    uhr_sec_prof_params(params)
+
     return params
 
 def uhr_mld_enable_ap(iface, link_id, params):
@@ -157,7 +169,8 @@ def uhr_mld_enable_ap(iface, link_id, params):
 
     return hapd
 
-def run_uhr_mld_sae_single_link(dev, apdev, anti_clogging_token=False):
+def run_uhr_mld_sae_single_link(dev, apdev, anti_clogging_token=False,
+                                sec_prof=True):
     with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
             HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
         wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@@ -174,19 +187,29 @@ def run_uhr_mld_sae_single_link(dev, apdev, anti_clogging_token=False):
         hapd0 = uhr_mld_enable_ap(hapd_iface, 0, params)
 
         wpas.set("sae_pwe", "1")
+        if sec_prof:
+            wpas.set("security_profiles", "1")
         wpas.connect(ssid, sae_password=passphrase, scan_freq="2412",
-                     key_mgmt="SAE", ieee80211w="2")
+                     key_mgmt="SAE-EXT-KEY", ieee80211w="2",
+                     pairwise="GCMP-256", group="GCMP-256")
 
         eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True,
                           valid_links=1, active_links=1)
-        uhr_verify_status(wpas, hapd0, is_ht=True)
-        uhr_verify_wifi_version(wpas)
+        uhr_verify_status(wpas, hapd0, is_ht=True, sta_expect_uhr=sec_prof)
+        if sec_prof:
+            uhr_verify_wifi_version(wpas)
+        else:
+            eht_verify_wifi_version(wpas)
         traffic_test(wpas, hapd0)
 
 def test_uhr_mld_sae_single_link(dev, apdev):
     """UHR MLD AP with MLD client SAE H2E connection using single link"""
     run_uhr_mld_sae_single_link(dev, apdev)
 
+def test_uhr_mld_sae_no_security_profile(dev, apdev):
+    """UHR MLD AP with MLD client without security profiles uses EHT"""
+    run_uhr_mld_sae_single_link(dev, apdev, sec_prof=False)
+
 def uhr_5ghz_params(ssid, passphrase, channel, chanwidth, ccfs1, ccfs2=0,
                     he_ccfs1=None, he_oper_chanwidth=None):
     if he_ccfs1 is None:
@@ -246,8 +269,10 @@ def _test_uhr_5ghz(channel, chanwidth, ccfs1, ccfs2=0,
 
         hapd = uhr_mld_enable_ap(hapd_iface, 0, params)
         wpas.set('sae_pwe', '1')
+        wpas.set('security_profiles', '1')
         wpas.connect('uhr', sae_password=passphrase, scan_freq=str(freq),
-                     key_mgmt="SAE", ieee80211w="2",
+                     key_mgmt="SAE-EXT-KEY", ieee80211w="2",
+                     pairwise="GCMP-256", group="GCMP-256",
                      disable_uhr='1' if not uhr_connection else '0')
         hapd.wait_sta()
 
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 62ccff15e4b5..48f3522f2e9c 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -7974,10 +7974,35 @@ void wpa_supplicant_apply_uhr_overrides(
 	struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
 	struct wpa_driver_associate_params *params)
 {
+	const char *reason = NULL;
+
 	if (!ssid)
 		return;
 
 	params->disable_uhr = ssid->disable_uhr;
+	if (params->disable_uhr || ssid->mode != WPAS_MODE_INFRA)
+		return;
+
+	/*
+	 * A UHR association requires a Security Profile element in the
+	 * (Re)Association Request frame.
+	 *
+	 * With SME in the driver, the driver selects the BSS and the security
+	 * profile, so it is responsible for not using UHR without a security
+	 * profile.
+	 */
+	if (!wpas_security_profile_active(wpa_s))
+		reason = "security profiles not enabled or not supported";
+	else if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME))
+		return;
+	else if (!wpa_s->sel_security_profile)
+		reason = "no security profile selected";
+
+	if (!reason)
+		return;
+
+	wpa_dbg(wpa_s, MSG_DEBUG, "UHR: %s - disable UHR", reason);
+	params->disable_uhr = 1;
 }
 
 
-- 
2.55.0




More information about the Hostap mailing list