From e059d8ece81449acd34e7ea751287a11339f1fcf Mon Sep 17 00:00:00 2001 From: Chaoli Zhou Date: Tue, 22 Mar 2022 11:53:21 +0200 Subject: [PATCH] Update the Extended Capability element to struct sta_info Only the SME-in-hostapd case updated sta->ext_capability while the SME-in-the-driver case updated sta->qos_map_enabled, but not other items related to the extended capabilities. This resulted in reduced information being available through the control interface. Use the shared helper function for both cases to get matching information available regardless of the SME architecture. Signed-off-by: Chaoli Zhou --- src/ap/drv_callbacks.c | 7 +------ src/ap/ieee802_11.c | 26 -------------------------- src/ap/ieee802_11.h | 2 ++ src/ap/ieee802_11_shared.c | 26 ++++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index d97b3535b..54d0d5170 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -261,12 +261,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, } #endif /* NEED_AP_MLME */ -#ifdef CONFIG_INTERWORKING - if (elems.ext_capab && elems.ext_capab_len > 4) { - if (elems.ext_capab[4] & 0x01) - sta->qos_map_enabled = 1; - } -#endif /* CONFIG_INTERWORKING */ + check_ext_capab(hapd, sta, elems.ext_capab, elems.ext_capab_len); #ifdef CONFIG_HS20 wpabuf_free(sta->hs20_ie); diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index bcefe57ed..147b0a670 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -4133,32 +4133,6 @@ static u16 copy_supp_rates(struct hostapd_data *hapd, struct sta_info *sta, } -static u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta, - const u8 *ext_capab_ie, size_t ext_capab_ie_len) -{ -#ifdef CONFIG_INTERWORKING - /* check for QoS Map support */ - if (ext_capab_ie_len >= 5) { - if (ext_capab_ie[4] & 0x01) - sta->qos_map_enabled = 1; - } -#endif /* CONFIG_INTERWORKING */ - - if (ext_capab_ie_len > 0) { - sta->ecsa_supported = !!(ext_capab_ie[0] & BIT(2)); - os_free(sta->ext_capability); - sta->ext_capability = os_malloc(1 + ext_capab_ie_len); - if (sta->ext_capability) { - sta->ext_capability[0] = ext_capab_ie_len; - os_memcpy(sta->ext_capability + 1, ext_capab_ie, - ext_capab_ie_len); - } - } - - return WLAN_STATUS_SUCCESS; -} - - #ifdef CONFIG_OWE static int owe_group_supported(struct hostapd_data *hapd, u16 group) diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index c59ad5e38..923cd520b 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -194,6 +194,8 @@ int get_tx_parameters(struct sta_info *sta, int ap_max_chanwidth, void auth_sae_process_commit(void *eloop_ctx, void *user_ctx); u8 * hostapd_eid_rsnxe(struct hostapd_data *hapd, u8 *eid, size_t len); +u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta, + const u8 *ext_capab_ie, size_t ext_capab_ie_len); size_t hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type); u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type); diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c index 4bff9e591..615489511 100644 --- a/src/ap/ieee802_11_shared.c +++ b/src/ap/ieee802_11_shared.c @@ -1093,3 +1093,29 @@ u8 * hostapd_eid_rsnxe(struct hostapd_data *hapd, u8 *eid, size_t len) return pos; } + + +u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta, + const u8 *ext_capab_ie, size_t ext_capab_ie_len) +{ +#ifdef CONFIG_INTERWORKING + /* check for QoS Map support */ + if (ext_capab_ie_len >= 5) { + if (ext_capab_ie[4] & 0x01) + sta->qos_map_enabled = 1; + } +#endif /* CONFIG_INTERWORKING */ + + if (ext_capab_ie_len > 0) { + sta->ecsa_supported = !!(ext_capab_ie[0] & BIT(2)); + os_free(sta->ext_capability); + sta->ext_capability = os_malloc(1 + ext_capab_ie_len); + if (sta->ext_capability) { + sta->ext_capability[0] = ext_capab_ie_len; + os_memcpy(sta->ext_capability + 1, ext_capab_ie, + ext_capab_ie_len); + } + } + + return WLAN_STATUS_SUCCESS; +}