[PATCH v3 3/8] AP: add UHR operation as a separate attribute

Johannes Berg johannes at sipsolutions.net
Fri Apr 24 00:11:55 PDT 2026


From: Johannes Berg <johannes.berg at intel.com>

Since the beacon data doesn't contain the full UHR operation
element, the driver will need to have the information about
it separately. Add it to the driver interface.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 src/ap/beacon.c      | 20 +++++++++++++++++++-
 src/drivers/driver.h |  6 ++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 31f6178d0b05..cedb4bd9d537 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -2497,8 +2497,22 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 #endif /* CONFIG_IEEE80211BE */
 
 #ifdef CONFIG_IEEE80211BN
-	if (hostapd_is_uhr_enabled(hapd))
+	if (hostapd_is_uhr_enabled(hapd)) {
+		u8 *uhr_oper;
+
 		tailpos = hostapd_eid_uhr_operation(hapd, tailpos, true);
+		params->uhr_oper = os_zalloc(3 + IEEE80211_UHR_OPER_MAX_SIZE);
+		if (!params->uhr_oper)
+			goto error;
+
+		uhr_oper = hostapd_eid_uhr_operation(hapd, params->uhr_oper,
+						     false);
+		/* check that it was filled */
+		if (uhr_oper == params->uhr_oper) {
+			os_free(params->uhr_oper);
+			params->uhr_oper = NULL;
+		}
+	}
 #endif /* CONFIG_IEEE80211BN */
 
 #ifdef CONFIG_IEEE80211AC
@@ -2708,6 +2722,8 @@ error:
 	os_free(head);
 	os_free(tail);
 	os_free(resp);
+	os_free(params->uhr_oper);
+	params->uhr_oper = NULL;
 	return -1;
 #endif /* CONFIG_SAE || NEED_AP_MLME */
 }
@@ -2739,6 +2755,8 @@ void ieee802_11_free_ap_params(struct wpa_driver_ap_params *params)
 #endif /* CONFIG_IEEE80211AX */
 	os_free(params->allowed_freqs);
 	params->allowed_freqs = NULL;
+	os_free(params->uhr_oper);
+	params->uhr_oper = NULL;
 }
 
 
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 2f50265657a7..485015ef4918 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1950,6 +1950,12 @@ struct wpa_driver_ap_params {
 	 * sae_password - SAE password for SAE offload
 	 */
 	const char *sae_password;
+
+	/**
+	 * uhr_oper - Full UHR operation (beacon only has abridged data),
+	 * includes the extended element header
+	 */
+	u8 *uhr_oper;
 };
 
 struct wpa_driver_mesh_bss_params {
-- 
2.53.0




More information about the Hostap mailing list