[PATCH 10/15] wpa_supplicant: Use UHR only with security profiles 0-9
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Tue Nov 24 00:53:06 PST 2026
From: Ilan Peer <ilan.peer at intel.com>
WPA3 Specification v3.6, 12.5 doesn't allow negotiating security
profiles 10 - 15 in a UHR association, and notes that UHR STAs always
negotiate a security profile. Thus, disable support for UHR in
association when:
- The AP doesn't include the Security Profile element OR
- No security profile is selected, e.g., security_profiles is not
enabled OR
- The selected security profile is not one of 0 - 9.
Add the allow_uhr_without_secprof testing option to keep UHR anyway and
use it in the existing UHR tests, whose APs do not use security
profiles.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
tests/hwsim/test_uhr.py | 3 +++
wpa_supplicant/config.c | 1 +
wpa_supplicant/config.h | 3 +++
wpa_supplicant/sme.c | 3 ++-
wpa_supplicant/wpa_supplicant.c | 30 ++++++++++++++++++++++++++++--
wpa_supplicant/wpa_supplicant_i.h | 2 +-
6 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/tests/hwsim/test_uhr.py b/tests/hwsim/test_uhr.py
index 1705a13ec9..af654e8824 100644
--- a/tests/hwsim/test_uhr.py
+++ b/tests/hwsim/test_uhr.py
@@ -85,6 +85,7 @@ 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.set("allow_uhr_without_secprof", "1")
wpas.connect("uhr", key_mgmt="SAE", sae_password=passphrase,
ieee80211w="2", scan_freq="2412")
hapd.wait_sta()
@@ -174,6 +175,7 @@ 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")
+ wpas.set("allow_uhr_without_secprof", "1")
wpas.connect(ssid, sae_password=passphrase, scan_freq="2412",
key_mgmt="SAE", ieee80211w="2")
@@ -246,6 +248,7 @@ 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('allow_uhr_without_secprof', '1')
wpas.connect('uhr', sae_password=passphrase, scan_freq=str(freq),
key_mgmt="SAE", ieee80211w="2",
disable_uhr='1' if not uhr_connection else '0')
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 64eb01a0d7..1edb9194ac 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -6076,6 +6076,7 @@ static const struct global_parse_data global_fields[] = {
#ifdef CONFIG_TESTING_OPTIONS
{ INT_RANGE(mld_connect_band_pref, 0, MLD_CONNECT_BAND_PREF_MAX), 0 },
{ FUNC(mld_connect_bssid_pref), 0 },
+ { INT_RANGE(allow_uhr_without_secprof, 0, 1), 0 },
#endif /* CONFIG_TESTING_OPTIONS */
{ BOOL(ft_prepend_pmkid), CFG_CHANGED_FT_PREPEND_PMKID },
{ INT_RANGE(wfa_gen_capa, 0, 2), 0},
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index abc7d74b39..bc2552dccc 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -1874,6 +1874,9 @@ struct wpa_config {
} mld_connect_band_pref;
u8 mld_connect_bssid_pref[ETH_ALEN];
+
+ /* Allow UHR without a security profile that permits UHR */
+ int allow_uhr_without_secprof;
#endif /* CONFIG_TESTING_OPTIONS */
int mld_force_single_link;
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 9a4b4b2dc4..7de0aeff95 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -5695,7 +5695,8 @@ mscs_fail:
wpa_supplicant_apply_he_overrides(wpa_s, ssid, ¶ms);
#endif /* CONFIG_HE_OVERRIDES */
wpa_supplicant_apply_eht_overrides(wpa_s, ssid, ¶ms);
- wpa_supplicant_apply_uhr_overrides(wpa_s, ssid, ¶ms);
+ wpa_supplicant_apply_uhr_overrides(wpa_s, ssid, wpa_s->current_bss,
+ ¶ms);
#ifdef CONFIG_IEEE80211R
if (auth_type == WLAN_AUTH_FT && wpa_s->sme.ft_ies &&
get_ie(wpa_s->sme.ft_ies, wpa_s->sme.ft_ies_len,
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index b2884a412d..16643345d7 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -5946,7 +5946,7 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
wpa_supplicant_apply_he_overrides(wpa_s, ssid, ¶ms);
#endif /* CONFIG_HE_OVERRIDES */
wpa_supplicant_apply_eht_overrides(wpa_s, ssid, ¶ms);
- wpa_supplicant_apply_uhr_overrides(wpa_s, ssid, ¶ms);
+ wpa_supplicant_apply_uhr_overrides(wpa_s, ssid, bss, ¶ms);
#ifdef CONFIG_P2P
/*
@@ -7925,12 +7925,38 @@ void wpa_supplicant_apply_eht_overrides(
void wpa_supplicant_apply_uhr_overrides(
struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
- struct wpa_driver_associate_params *params)
+ struct wpa_bss *bss, struct wpa_driver_associate_params *params)
{
+ const char *reason = NULL;
+
if (!ssid)
return;
params->disable_uhr = ssid->disable_uhr;
+ if (params->disable_uhr || !bss)
+ return;
+
+ /* WPA3 Specification v3.6, 12.5: UHR requires security profile 0 - 9 */
+ if (!wpa_bss_get_ie_ext(bss, WLAN_EID_EXT_SECURITY_PROFILE))
+ reason = "BSS lacks Security Profile element";
+ else if (!wpa_s->sel_security_profile)
+ reason = "no security profile used";
+ else if (wpa_s->sel_security_profile->number > SEC_PROF_SAE)
+ reason = "security profile not allowed with UHR";
+
+ if (!reason)
+ return;
+
+#ifdef CONFIG_TESTING_OPTIONS
+ if (wpa_s->conf->allow_uhr_without_secprof) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "UHR: %s - allowed for testing",
+ reason);
+ return;
+ }
+#endif /* CONFIG_TESTING_OPTIONS */
+
+ wpa_dbg(wpa_s, MSG_DEBUG, "UHR: %s - disable UHR", reason);
+ params->disable_uhr = 1;
}
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 7dcbfc8fd4..770c096b68 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1859,7 +1859,7 @@ void wpa_supplicant_apply_eht_overrides(
struct wpa_driver_associate_params *params);
void wpa_supplicant_apply_uhr_overrides(
struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
- struct wpa_driver_associate_params *params);
+ struct wpa_bss *bss, struct wpa_driver_associate_params *params);
int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
--
2.56.1
More information about the Hostap
mailing list