[PATCH 06/29] PASN: Extend RSNXE capability field to 32 bits
Sai Pratyusha Magam
smagam at qti.qualcomm.com
Thu Dec 11 05:14:20 PST 2025
From: Ainy Kumari <ainy.kumari at oss.qualcomm.com>
Extend RSNXE capability representation from u16 to u32 to support
use cases requiring more than 16 bits. Update wpa_pasn_add_rsnxe(),
pasn_data structure and related APIs to use u32 for rsnxe_capab.
Signed-off-by: Ainy Kumari <ainy.kumari at oss.qualcomm.com>
---
src/common/wpa_common.c | 31 ++++++++++++++++++++++++-------
src/common/wpa_common.h | 2 +-
src/pasn/pasn_common.c | 2 +-
src/pasn/pasn_common.h | 4 ++--
wpa_supplicant/pasn_supplicant.c | 2 +-
5 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index 171f0736c..5f43d2d60 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -4399,23 +4399,40 @@ int wpa_pasn_parse_parameter_ie(const u8 *data, u8 len, bool from_ap,
}
-void wpa_pasn_add_rsnxe(struct wpabuf *buf, u16 capab)
+void wpa_pasn_add_rsnxe(struct wpabuf *buf, u32 capab)
{
size_t flen;
- flen = (capab & 0xff00) ? 2 : 1;
if (!capab)
return; /* no supported extended RSN capabilities */
+
+ /* Determine how many bytes are needed to represent capab */
+ if (capab & 0xFF000000)
+ flen = 4;
+ else if (capab & 0x00FF0000)
+ flen = 3;
+ else if (capab & 0x0000FF00)
+ flen = 2;
+ else
+ flen = 1;
+
if (wpabuf_tailroom(buf) < 2 + flen)
return;
- capab |= flen - 1; /* bit 0-3 = Field length (n - 1) */
+
+ /* Set field length bits (bit 0-3 = Field length (n - 1)) */
+ capab |= (flen - 1);
wpabuf_put_u8(buf, WLAN_EID_RSNX);
wpabuf_put_u8(buf, flen);
- wpabuf_put_u8(buf, capab & 0x00ff);
- capab >>= 8;
- if (capab)
- wpabuf_put_u8(buf, capab);
+
+ /* Write the capability field byte-by-byte (little-endian) */
+ wpabuf_put_u8(buf, capab & 0x000000FF);
+ if (flen > 1)
+ wpabuf_put_u8(buf, (capab >> 8) & 0x000000FF);
+ if (flen > 2)
+ wpabuf_put_u8(buf, (capab >> 16) & 0x000000FF);
+ if (flen > 3)
+ wpabuf_put_u8(buf, (capab >> 24) & 0x000000FF);
}
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index 44713320a..95d97b6ac 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -807,7 +807,7 @@ int wpa_pasn_validate_rsne(const struct wpa_ie_data *data);
int wpa_pasn_parse_parameter_ie(const u8 *data, u8 len, bool from_ap,
struct wpa_pasn_params_data *pasn_params);
-void wpa_pasn_add_rsnxe(struct wpabuf *buf, u16 capab);
+void wpa_pasn_add_rsnxe(struct wpabuf *buf, u32 capab);
int wpa_pasn_add_extra_ies(struct wpabuf *buf, const u8 *extra_ies, size_t len);
void rsn_set_snonce_cookie(u8 *snonce);
diff --git a/src/pasn/pasn_common.c b/src/pasn/pasn_common.c
index 3b336715a..d09558121 100644
--- a/src/pasn/pasn_common.c
+++ b/src/pasn/pasn_common.c
@@ -152,7 +152,7 @@ void pasn_set_rsn_pairwise(struct pasn_data *pasn, int rsn_pairwise)
}
-void pasn_set_rsnxe_caps(struct pasn_data *pasn, u16 rsnxe_capab)
+void pasn_set_rsnxe_caps(struct pasn_data *pasn, u32 rsnxe_capab)
{
if (!pasn)
return;
diff --git a/src/pasn/pasn_common.h b/src/pasn/pasn_common.h
index 4b300604b..aad9f512e 100644
--- a/src/pasn/pasn_common.h
+++ b/src/pasn/pasn_common.h
@@ -60,7 +60,7 @@ struct pasn_data {
const char *password;
int wpa_key_mgmt;
int rsn_pairwise;
- u16 rsnxe_capab;
+ u32 rsnxe_capab;
u8 *rsnxe_ie;
bool custom_pmkid_valid;
u8 custom_pmkid[PMKID_LEN];
@@ -237,7 +237,7 @@ void pasn_set_noauth(struct pasn_data *pasn, bool noauth);
void pasn_set_password(struct pasn_data *pasn, const char *password);
void pasn_set_wpa_key_mgmt(struct pasn_data *pasn, int key_mgmt);
void pasn_set_rsn_pairwise(struct pasn_data *pasn, int rsn_pairwise);
-void pasn_set_rsnxe_caps(struct pasn_data *pasn, u16 rsnxe_capab);
+void pasn_set_rsnxe_caps(struct pasn_data *pasn, u32 rsnxe_capab);
void pasn_set_rsnxe_ie(struct pasn_data *pasn, const u8 *rsnxe_ie);
void pasn_set_custom_pmkid(struct pasn_data *pasn, const u8 *pmkid);
int pasn_set_extra_ies(struct pasn_data *pasn, const u8 *extra_ies,
diff --git a/wpa_supplicant/pasn_supplicant.c b/wpa_supplicant/pasn_supplicant.c
index 4fd4b7416..46343ea6e 100644
--- a/wpa_supplicant/pasn_supplicant.c
+++ b/wpa_supplicant/pasn_supplicant.c
@@ -623,7 +623,7 @@ static void wpas_pasn_auth_start_cb(struct wpa_radio_work *work, int deinit)
const u8 *indic;
u16 fils_info;
#endif /* CONFIG_FILS */
- u16 capab = 0;
+ u32 capab = 0;
bool derive_kdk;
int ret;
--
2.34.1
More information about the Hostap
mailing list