From 23a89229c9aa2b833d9aa2db163f0b56d913b9bb Mon Sep 17 00:00:00 2001 From: Aloka Dixit Date: Fri, 10 Sep 2021 16:31:14 -0700 Subject: [PATCH 06/15] mbssid: add MBSSID configuration element Add data as per IEEE Std 802.11ax-2021 9.4.2.260 Multiple BSSID Configuration element when enhanced multiple BSSID advertisements (EMA) are enabled. This element informs the clients about the EMA profile periodicity of the multiple BSSID set. Co-developed-by: John Crispin Signed-off-by: John Crispin Signed-off-by: Aloka Dixit --- src/ap/beacon.c | 35 ++++++++++++++++++++++------------- src/common/ieee802_11_defs.h | 1 + 2 files changed, 23 insertions(+), 13 deletions(-) --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -459,8 +459,9 @@ static u8 * hostapd_eid_supported_op_cla } -static int hostapd_set_mbssid_beacon(struct hostapd_data *hapd, - struct wpa_driver_ap_params *params) +static u8 * hostapd_set_mbssid_beacon(struct hostapd_data *hapd, + struct wpa_driver_ap_params *params, + u8 *eid) { struct hostapd_iface *iface = hapd->iface; struct hostapd_data *tx_bss; @@ -468,17 +469,17 @@ static int hostapd_set_mbssid_beacon(str u8 num_mbssid = 0, *end; if (!iface->conf->mbssid || iface->num_bss == 1) - return 0; + return eid; if (!iface->mbssid_max_interfaces) { wpa_printf(MSG_ERROR, "MBSSID: Driver doesn't support " "multi-BSSID advertisements"); - return -1; + return eid; } else if (iface->num_bss > iface->mbssid_max_interfaces) { wpa_printf(MSG_ERROR, "MBSSID: Driver supports maximum %u " "interfaces for multi-BSSID advertisements", iface->mbssid_max_interfaces); - return -1; + return eid; } tx_bss = hostapd_mbssid_get_tx_bss(hapd); @@ -491,26 +492,26 @@ static int hostapd_set_mbssid_beacon(str if (!iface->ema_max_periodicity) { wpa_printf(MSG_WARNING, "MBSSID: Driver doesn't support" " enhanced multiple BSSID advertisements"); - return -1; + return eid; } if (num_mbssid > iface->ema_max_periodicity) { wpa_printf(MSG_WARNING, "MBSSID: Driver supports " "maximum %u EMA profile periodicity", iface->ema_max_periodicity); - return -1; + return eid; } params->ema = 1; } if (hapd != tx_bss || !num_mbssid) - return 0; + return eid; params->mbssid_elem_count = num_mbssid; params->mbssid_elem = os_zalloc(len); if (!params->mbssid_elem) { wpa_printf(MSG_ERROR, "Memory allocation failed for multiple " "BSSID elements"); - return -1; + return eid; } params->mbssid_elem_offset = os_zalloc(params->mbssid_elem_count * @@ -520,7 +521,7 @@ static int hostapd_set_mbssid_beacon(str "multiple BSSID element offsets"); os_free(params->mbssid_elem); params->mbssid_elem = NULL; - return -1; + return eid; } end = hostapd_eid_mbssid(tx_bss, params->mbssid_elem, @@ -530,7 +531,14 @@ static int hostapd_set_mbssid_beacon(str params->mbssid_elem_offset); params->mbssid_elem_len = end - params->mbssid_elem; - return 0; + if (hapd->iconf->ema) { + *eid++ = WLAN_EID_EXTENSION; + *eid++ = 3; + *eid++ = WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION; + *eid++ = iface->num_bss; + *eid++ = params->mbssid_elem_count; + } + return eid; } @@ -1634,6 +1642,8 @@ int ieee802_11_build_ap_params(struct ho } #endif /* CONFIG_IEEE80211AX */ + if (hapd->iconf->ema) + tail_len += 5; /* Multiple BSSID Configuration element */ tail_len += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_BEACON); tail_len += hostapd_mbo_ie_len(hapd); tail_len += hostapd_eid_owe_trans_len(hapd); @@ -1719,8 +1729,7 @@ int ieee802_11_build_ap_params(struct ho tailpos = hostapd_eid_supported_op_classes(hapd, tailpos); tailpos = hostapd_eid_ht_capabilities(hapd, tailpos); tailpos = hostapd_eid_ht_operation(hapd, tailpos); - if (hostapd_set_mbssid_beacon(hapd, params)) - return -1; + tailpos = hostapd_set_mbssid_beacon(hapd, params, tailpos); tailpos = hostapd_eid_ext_capab(hapd, tailpos); --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -481,6 +481,7 @@ #define WLAN_EID_EXT_SPATIAL_REUSE 39 #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_SHORT_SSID_LIST 58 #define WLAN_EID_EXT_HE_6GHZ_BAND_CAP 59 #define WLAN_EID_EXT_EDMG_CAPABILITIES 61