[PATCH 06/13] mbssid: add MBSSID configuration element

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <john@xxxxxxxxxxx>
Signed-off-by: John Crispin <john@xxxxxxxxxxx>
Signed-off-by: Aloka Dixit <quic_alokad@xxxxxxxxxxx>
---
 src/ap/beacon.c              | 35 +++++++++++++++++++++++------------
 src/common/ieee802_11_defs.h |  1 +
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 3d45f4a69f2c..b2b2bfa8babe 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -428,8 +428,9 @@ static u8 * hostapd_eid_supported_op_classes(struct hostapd_data *hapd, u8 *eid)
 }
 
 
-static void 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;
@@ -437,17 +438,17 @@ static void hostapd_set_mbssid_beacon(struct hostapd_data *hapd,
 	u8 num_mbssid = 0, *end;
 
 	if (!iface->conf->mbssid || iface->num_bss == 1)
-		return;
+		return eid;
 
 	if (!iface->mbssid_max_interfaces) {
 		wpa_printf(MSG_DEBUG,
 			   "MBSSID: Driver doesn't support multi-BSSID advertisements");
-		return;
+		return eid;
 	} else if (iface->num_bss > iface->mbssid_max_interfaces) {
 		wpa_printf(MSG_DEBUG,
 			   "MBSSID: Driver supports maximum %u interfaces for multi-BSSID advertisements",
 			   iface->mbssid_max_interfaces);
-		return;
+		return eid;
 	}
 
 	tx_bss = hostapd_mbssid_get_tx_bss(hapd);
@@ -460,26 +461,26 @@ static void hostapd_set_mbssid_beacon(struct hostapd_data *hapd,
 		if (!iface->ema_max_periodicity) {
 			wpa_printf(MSG_DEBUG,
 				   "MBSSID: Driver doesn't support enhanced multiple BSSID advertisements");
-			return;
+			return eid;
 		}
 		if (num_mbssid > iface->ema_max_periodicity) {
 			wpa_printf(MSG_DEBUG,
 				   "MBSSID: Driver supports maximum %u EMA profile periodicity",
 				   iface->ema_max_periodicity);
-			return;
+			return eid;
 		}
 		params->ema = 1;
 	}
 
 	if (hapd != tx_bss || !num_mbssid)
-		return;
+		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;
+		return eid;
 	}
 
 	params->mbssid_elem_offset = os_zalloc(params->mbssid_elem_count *
@@ -489,7 +490,7 @@ static void hostapd_set_mbssid_beacon(struct hostapd_data *hapd,
 			   "MBSSID: Memory allocation failed for multiple BSSID element offsets");
 		os_free(params->mbssid_elem);
 		params->mbssid_elem = NULL;
-		return;
+		return eid;
 	}
 
 	end = hostapd_eid_mbssid(tx_bss, params->mbssid_elem,
@@ -498,7 +499,15 @@ static void hostapd_set_mbssid_beacon(struct hostapd_data *hapd,
 				 params->mbssid_elem_count,
 				 params->mbssid_elem_offset);
 	params->mbssid_elem_len = end - params->mbssid_elem;
-	return;
+
+	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;
 }
 
 
@@ -1558,6 +1567,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	}
 #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);
@@ -1643,7 +1654,7 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	tailpos = hostapd_eid_supported_op_classes(hapd, tailpos);
 	tailpos = hostapd_eid_ht_capabilities(hapd, tailpos);
 	tailpos = hostapd_eid_ht_operation(hapd, tailpos);
-	hostapd_set_mbssid_beacon(hapd, params);
+	tailpos = hostapd_set_mbssid_beacon(hapd, params, tailpos);
 
 	tailpos = hostapd_eid_ext_capab(hapd, tailpos);
 
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index cd4d60a77d26..f0003655a002 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -480,6 +480,7 @@
 #define WLAN_EID_EXT_HE_MU_EDCA_PARAMS 38
 #define WLAN_EID_EXT_SPATIAL_REUSE 39
 #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
-- 
2.31.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux