[PATCH 04/13] mbssid: get and set configuration parameters

Aloka Dixit quic_alokad at quicinc.com
Wed Mar 2 14:26:25 PST 2022


From: John Crispin <john at phrozen.org>

Add helper functions to retrieve the context for the transmitting
interfaces of the MBSSID set and the index of a given BSS.

Set device parameters - BSS index, transmitting BSS and
total number of BSS in the MBSSID set.

Signed-off-by: John Crispin <john at phrozen.org>
Co-developed-by: Aloka Dixit <quic_alokad at quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad at quicinc.com>
---
 src/ap/beacon.c      | 33 +++++++++++++++++++++++++++++++--
 src/ap/hostapd.c     | 23 +++++++++++++++++++++++
 src/ap/hostapd.h     |  2 ++
 src/drivers/driver.h | 15 +++++++++++++++
 4 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 8cd1c417043e..1d70cb2ead2c 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -428,6 +428,32 @@ 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)
+{
+	struct hostapd_iface *iface = hapd->iface;
+
+	if (!iface->conf->mbssid || iface->num_bss == 1)
+		return;
+
+	if (!iface->mbssid_max_interfaces) {
+		wpa_printf(MSG_DEBUG,
+			   "MBSSID: Driver doesn't support multi-BSSID advertisements");
+		return;
+	} 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;
+	}
+
+	params->mbssid_tx_iface = hostapd_mbssid_get_tx_bss(hapd)->conf->iface;
+	params->mbssid_index = hostapd_mbssid_get_bss_index(hapd);
+	params->mbssid_count = iface->num_bss;
+	return;
+}
+
+
 static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 				   const struct ieee80211_mgmt *req,
 				   int is_p2p, size_t *resp_len)
@@ -1149,7 +1175,6 @@ static u8 * hostapd_probe_resp_offloads(struct hostapd_data *hapd,
 	/* Generate a Probe Response template for the non-P2P case */
 	return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len);
 }
-
 #endif /* NEED_AP_MLME */
 
 
@@ -1432,7 +1457,11 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 #ifdef NEED_AP_MLME
 	u16 capab_info;
 	u8 *pos, *tailpos, *tailend, *csa_pos;
+#endif /* NEED_AP_MLME */
+
+	os_memset(params, 0, sizeof(*params));
 
+#ifdef NEED_AP_MLME
 #define BEACON_HEAD_BUF_SIZE 256
 #define BEACON_TAIL_BUF_SIZE 512
 	head = os_zalloc(BEACON_HEAD_BUF_SIZE);
@@ -1556,6 +1585,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_eid_ext_capab(hapd, tailpos);
 
@@ -1662,7 +1692,6 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	resp = hostapd_probe_resp_offloads(hapd, &resp_len);
 #endif /* NEED_AP_MLME */
 
-	os_memset(params, 0, sizeof(*params));
 	params->head = (u8 *) head;
 	params->head_len = head_len;
 	params->tail = tail;
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 14b608e67c23..9ca4ffa31d94 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -87,6 +87,29 @@ int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
 }
 
 
+struct hostapd_data * hostapd_mbssid_get_tx_bss(struct hostapd_data *hapd)
+{
+	if (hapd->iconf->mbssid)
+		return hapd->iface->bss[0];
+
+	return hapd;
+}
+
+
+int hostapd_mbssid_get_bss_index(struct hostapd_data *hapd)
+{
+	if (hapd->iconf->mbssid) {
+		size_t i;
+
+		for (i = 1; i < hapd->iface->num_bss; i++)
+			if (hapd->iface->bss[i] == hapd)
+				return i;
+	}
+
+	return 0;
+}
+
+
 void hostapd_reconfig_encryption(struct hostapd_data *hapd)
 {
 	if (hapd->wpa_auth)
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index def0971cc11f..4e9046efa879 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -691,6 +691,8 @@ struct hostapd_data * hostapd_get_iface(struct hapd_interfaces *interfaces,
 void hostapd_event_sta_opmode_changed(struct hostapd_data *hapd, const u8 *addr,
 				      enum smps_mode smps_mode,
 				      enum chan_width chan_width, u8 rx_nss);
+struct hostapd_data * hostapd_mbssid_get_tx_bss(struct hostapd_data *hapd);
+int hostapd_mbssid_get_bss_index(struct hostapd_data *hapd);
 
 #ifdef CONFIG_FST
 void fst_hostapd_fill_iface_obj(struct hostapd_data *hapd,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index cf0f2180e704..0527f120287b 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1582,6 +1582,21 @@ struct wpa_driver_ap_params {
 	 * Unsolicited broadcast Probe Response template length
 	 */
 	size_t unsol_bcast_probe_resp_tmpl_len;
+
+	/**
+	 * mbssid_tx_iface - Transmitting interface of the set
+	 */
+	const char *mbssid_tx_iface;
+
+	/**
+	 * mbssid_index - The index of this BSS in the group
+	 */
+	unsigned int mbssid_index;
+
+	/**
+	 * mbssid_count - Total number of BSSs in the group
+	 */
+	unsigned int mbssid_count;
 };
 
 struct wpa_driver_mesh_bss_params {
-- 
2.31.1




More information about the Hostap mailing list