From 20bb093c1a0555c365afabb1809c8edb7bde4178 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Fri, 10 Sep 2021 14:58:04 -0700 Subject: [PATCH 07/15] mbssid: add non-inheritance element Add data as per IEEE Std 802.11-2020 9.4.2.240 Non-Inheritance element if the transmitted profile is secured but non-transmitted profiles use open security. Signed-off-by: John Crispin Signed-off-by: Sowmiya Sree Elavalagan Signed-off-by: Aloka Dixit --- src/ap/ieee802_11.c | 30 ++++++++++++++++++++++++++++-- src/common/ieee802_11_defs.h | 1 + 2 files changed, 29 insertions(+), 2 deletions(-) --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -7688,12 +7688,14 @@ u8 * hostapd_eid_rnr(struct hostapd_data static size_t hostapd_eid_mbssid_elem_len(struct hostapd_data *hapd, u32 frame_type, size_t *bss_index) { + struct hostapd_data *tx_bss = hostapd_mbssid_get_tx_bss(hapd); size_t len = 3, i; for (i = *bss_index; i < hapd->iface->num_bss; i++) { struct hostapd_data *bss = hapd->iface->bss[i]; - const u8 *auth, *rsn, *rsnx; + const u8 *auth, *rsn = NULL, *rsnx = NULL; size_t nontx_profile_len, auth_len; + u8 ie_count = 0; if (!bss || !bss->conf || !bss->started) continue; @@ -7721,6 +7723,12 @@ static size_t hostapd_eid_mbssid_elem_le if (rsnx) nontx_profile_len += (2 + rsnx[1]); } + if (!rsn && hostapd_wpa_ie(tx_bss, WLAN_EID_RSN)) + ie_count++; + if (!rsnx && hostapd_wpa_ie(tx_bss, WLAN_EID_RSNX)) + ie_count++; + if (ie_count) + nontx_profile_len += (4 + ie_count); if ((len + nontx_profile_len) > 255) goto mbssid_too_big; @@ -7768,6 +7776,7 @@ static u8 * hostapd_eid_mbssid_elem(stru u32 frame_type, u8 max_bssid_indicator, size_t *bss_index) { + struct hostapd_data *tx_bss = hostapd_mbssid_get_tx_bss(hapd); size_t i; u8 *eid_len_offset, *max_bssid_indicator_offset; @@ -7779,7 +7788,8 @@ static u8 * hostapd_eid_mbssid_elem(stru struct hostapd_data *bss = hapd->iface->bss[i]; struct hostapd_bss_config *conf; u8 *eid_len_pos, *nontx_bss_start = eid; - const u8 *auth, *rsn, *rsnx; + const u8 *auth, *rsn = NULL, *rsnx = NULL; + u8 ie_count = 0, non_inherit_ie[2]; size_t auth_len = 0; u16 capab_info; @@ -7826,6 +7836,22 @@ static u8 * hostapd_eid_mbssid_elem(stru eid += (2 + rsnx[1]); } } + if (!rsn && hostapd_wpa_ie(tx_bss, WLAN_EID_RSN)) { + non_inherit_ie[ie_count] = WLAN_EID_RSN; + ie_count++; + } + if (!rsnx && hostapd_wpa_ie(tx_bss, WLAN_EID_RSNX)) { + non_inherit_ie[ie_count] = WLAN_EID_RSNX; + ie_count++; + } + if (ie_count) { + *eid++ = WLAN_EID_EXTENSION; + *eid++ = 2 + ie_count; + *eid++ = WLAN_EID_EXT_NON_INHERITANCE; + *eid++ = ie_count; + os_memcpy(eid, non_inherit_ie, ie_count); + eid += ie_count; + } *eid_len_pos = (eid - eid_len_pos) - 1; --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -482,6 +482,7 @@ #define WLAN_EID_EXT_COLOR_CHANGE_ANNOUNCEMENT 42 #define WLAN_EID_EXT_OCV_OCI 54 #define WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION 55 +#define WLAN_EID_EXT_NON_INHERITANCE 56 #define WLAN_EID_EXT_SHORT_SSID_LIST 58 #define WLAN_EID_EXT_HE_6GHZ_BAND_CAP 59 #define WLAN_EID_EXT_EDMG_CAPABILITIES 61