mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-18 18:01:23 +00:00
162 lines
4.5 KiB
Diff
162 lines
4.5 KiB
Diff
From b5ab26896c423a8bf7761552018ce5e399dc6b6b Mon Sep 17 00:00:00 2001
|
|
From: John Crispin <john@phrozen.org>
|
|
Date: Fri, 10 Sep 2021 14:48:07 -0700
|
|
Subject: [PATCH 04/15] mbssid: get and set configuration parameters
|
|
|
|
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@phrozen.org>
|
|
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
|
|
---
|
|
src/ap/beacon.c | 36 ++++++++++++++++++++++++++++++++++--
|
|
src/ap/hostapd.c | 23 +++++++++++++++++++++++
|
|
src/ap/hostapd.h | 2 ++
|
|
src/drivers/driver.h | 15 +++++++++++++++
|
|
4 files changed, 74 insertions(+), 2 deletions(-)
|
|
|
|
--- a/src/ap/beacon.c
|
|
+++ b/src/ap/beacon.c
|
|
@@ -459,6 +459,33 @@ static u8 * hostapd_eid_supported_op_cla
|
|
}
|
|
|
|
|
|
+static int 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 0;
|
|
+
|
|
+ if (!iface->mbssid_max_interfaces) {
|
|
+ wpa_printf(MSG_ERROR, "MBSSID: Driver doesn't support "
|
|
+ "multi-BSSID advertisements");
|
|
+ return -1;
|
|
+ } 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;
|
|
+ }
|
|
+
|
|
+ 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 0;
|
|
+}
|
|
+
|
|
+
|
|
static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
|
|
const struct ieee80211_mgmt *req,
|
|
int is_p2p, size_t *resp_len)
|
|
@@ -1203,7 +1230,6 @@ static u8 * hostapd_probe_resp_offloads(
|
|
/* Generate a Probe Response template for the non-P2P case */
|
|
return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len);
|
|
}
|
|
-
|
|
#endif /* NEED_AP_MLME */
|
|
|
|
|
|
@@ -1498,7 +1524,11 @@ int ieee802_11_build_ap_params(struct ho
|
|
#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);
|
|
@@ -1632,6 +1662,9 @@ int ieee802_11_build_ap_params(struct ho
|
|
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_eid_ext_capab(hapd, tailpos);
|
|
|
|
/*
|
|
@@ -1743,7 +1776,6 @@ int ieee802_11_build_ap_params(struct ho
|
|
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;
|
|
--- a/src/ap/hostapd.c
|
|
+++ b/src/ap/hostapd.c
|
|
@@ -89,6 +89,29 @@ int hostapd_for_each_interface(struct ha
|
|
}
|
|
|
|
|
|
+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)
|
|
--- a/src/ap/hostapd.h
|
|
+++ b/src/ap/hostapd.h
|
|
@@ -714,6 +714,8 @@ struct hostapd_data * hostapd_get_iface(
|
|
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,
|
|
--- a/src/drivers/driver.h
|
|
+++ b/src/drivers/driver.h
|
|
@@ -1627,6 +1627,21 @@ struct wpa_driver_ap_params {
|
|
* 2 = BURST beacon tx mode
|
|
*/
|
|
int beacon_tx_mode;
|
|
+
|
|
+ /**
|
|
+ * 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 {
|