mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-19 18:31:33 +00:00
196 lines
6.4 KiB
Diff
196 lines
6.4 KiB
Diff
From eb4acfa2e5c146f7637f6abc78b672e885f8780d Mon Sep 17 00:00:00 2001
|
|
From: John Crispin <john@phrozen.org>
|
|
Date: Fri, 10 Sep 2021 15:24:54 -0700
|
|
Subject: [PATCH 13/15] mbssid: add nl80211 support
|
|
|
|
Send MBSSID and EMA configuration parameters to kernel.
|
|
|
|
Signed-off-by: John Crispin <john@phrozen.org>
|
|
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
|
|
---
|
|
src/drivers/driver_nl80211.c | 51 +++++++++++++++++++++++++++-
|
|
src/drivers/driver_nl80211_capa.c | 26 +++++++++++++++
|
|
src/drivers/nl80211_copy.h | 55 +++++++++++++++++++++++++++++++
|
|
3 files changed, 131 insertions(+), 1 deletion(-)
|
|
|
|
--- a/src/drivers/driver_nl80211.c
|
|
+++ b/src/drivers/driver_nl80211.c
|
|
@@ -4537,6 +4537,53 @@ static int nl80211_unsol_bcast_probe_res
|
|
#endif /* CONFIG_IEEE80211AX */
|
|
|
|
|
|
+static int nl80211_mbssid(struct nl_msg *msg,
|
|
+ struct wpa_driver_ap_params *params)
|
|
+{
|
|
+ struct nlattr *config, *elems;
|
|
+ int ifidx;
|
|
+
|
|
+ config = nla_nest_start(msg, NL80211_ATTR_MBSSID_CONFIG);
|
|
+ if (!config)
|
|
+ goto fail;
|
|
+
|
|
+ nla_put_u8(msg, NL80211_MBSSID_CONFIG_ATTR_INDEX, params->mbssid_index);
|
|
+ if (params->mbssid_tx_iface) {
|
|
+ ifidx = if_nametoindex(params->mbssid_tx_iface);
|
|
+ if (ifidx <= 0)
|
|
+ goto fail;
|
|
+ nla_put_u32(msg,
|
|
+ NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX,
|
|
+ ifidx);
|
|
+ }
|
|
+
|
|
+ if (params->ema)
|
|
+ nla_put_flag(msg, NL80211_MBSSID_CONFIG_ATTR_EMA);
|
|
+
|
|
+ nla_nest_end(msg, config);
|
|
+
|
|
+ if (params->mbssid_elem_count && params->mbssid_elem_len &&
|
|
+ params->mbssid_elem_offset && *params->mbssid_elem_offset) {
|
|
+ u8 i, **offs = params->mbssid_elem_offset;
|
|
+
|
|
+ elems = nla_nest_start(msg, NL80211_ATTR_MBSSID_ELEMS);
|
|
+ if (!elems)
|
|
+ goto fail;
|
|
+
|
|
+ for (i = 0; i < params->mbssid_elem_count - 1; i++)
|
|
+ nla_put(msg, i + 1, offs[i + 1] - offs[i], offs[i]);
|
|
+ nla_put(msg, i + 1,
|
|
+ *offs + params->mbssid_elem_len- offs[i],
|
|
+ offs[i]);
|
|
+ nla_nest_end(msg, elems);
|
|
+ }
|
|
+ return 0;
|
|
+
|
|
+fail:
|
|
+ return -1;
|
|
+}
|
|
+
|
|
+
|
|
static int wpa_driver_nl80211_set_ap(void *priv,
|
|
struct wpa_driver_ap_params *params)
|
|
{
|
|
@@ -4834,6 +4881,9 @@ static int wpa_driver_nl80211_set_ap(voi
|
|
goto fail;
|
|
#endif /* CONFIG_FILS */
|
|
|
|
+ if (params->mbssid_count && nl80211_mbssid(msg, params) < 0)
|
|
+ goto fail;
|
|
+
|
|
ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 1);
|
|
if (ret) {
|
|
wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
|
|
@@ -5445,7 +5495,6 @@ const char * nl80211_iftype_str(enum nl8
|
|
}
|
|
}
|
|
|
|
-
|
|
static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv,
|
|
const char *ifname,
|
|
enum nl80211_iftype iftype,
|
|
--- a/src/drivers/driver_nl80211_capa.c
|
|
+++ b/src/drivers/driver_nl80211_capa.c
|
|
@@ -846,6 +846,29 @@ err:
|
|
}
|
|
|
|
|
|
+static void wiphy_info_mbssid(struct wpa_driver_capa *cap, struct nlattr *attr)
|
|
+{
|
|
+ struct nlattr *config[NL80211_MBSSID_CONFIG_ATTR_MAX + 1];
|
|
+
|
|
+ if (nla_parse_nested(config, NL80211_MBSSID_CONFIG_ATTR_MAX, attr,
|
|
+ NULL))
|
|
+ return;
|
|
+
|
|
+ if (!config[NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES])
|
|
+ return;
|
|
+
|
|
+ cap->mbssid_max_interfaces =
|
|
+ nla_get_u8(config[NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES]);
|
|
+
|
|
+ if (config[NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY])
|
|
+ cap->ema_max_periodicity =
|
|
+ nla_get_u8(config[NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY]);
|
|
+
|
|
+ wpa_printf(MSG_DEBUG,
|
|
+ "multiple_bssid: max interfaces %u, max profile periodicity %u\n",
|
|
+ cap->mbssid_max_interfaces, cap->ema_max_periodicity);
|
|
+}
|
|
+
|
|
static int wiphy_info_handler(struct nl_msg *msg, void *arg)
|
|
{
|
|
struct nlattr *tb[NL80211_ATTR_MAX + 1];
|
|
@@ -1070,6 +1093,9 @@ static int wiphy_info_handler(struct nl_
|
|
if (tb[NL80211_ATTR_WIPHY_SELF_MANAGED_REG])
|
|
capa->flags |= WPA_DRIVER_FLAGS_SELF_MANAGED_REGULATORY;
|
|
|
|
+ if (tb[NL80211_ATTR_MBSSID_CONFIG])
|
|
+ wiphy_info_mbssid(capa, tb[NL80211_ATTR_MBSSID_CONFIG]);
|
|
+
|
|
return NL_SKIP;
|
|
}
|
|
|
|
--- a/src/drivers/nl80211_copy.h
|
|
+++ b/src/drivers/nl80211_copy.h
|
|
@@ -7376,6 +7376,61 @@ enum nl80211_sar_specs_attrs {
|
|
NL80211_SAR_ATTR_SPECS_MAX = __NL80211_SAR_ATTR_SPECS_LAST - 1,
|
|
};
|
|
|
|
+/**
|
|
+ * enum nl80211_mbssid_config_attributes - multiple BSSID (MBSSID) and enhanced
|
|
+ * multi-BSSID advertisements (EMA) in AP mode.
|
|
+ * Kernel uses some of these attributes to advertise driver's support for
|
|
+ * MBSSID and EMA.
|
|
+ * Remaining attributes should be used by the userspace to configure the
|
|
+ * features.
|
|
+ *
|
|
+ * @__NL80211_MBSSID_CONFIG_ATTR_INVALID: Invalid
|
|
+ *
|
|
+ * @NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES: Used by the kernel to advertise
|
|
+ * the maximum number of MBSSID interfaces supported by the driver.
|
|
+ * Driver should indicate MBSSID support by setting
|
|
+ * wiphy->mbssid_max_interfaces to a value more than or equal to 2.
|
|
+ *
|
|
+ * @NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY: Used by the kernel
|
|
+ * to advertise the maximum profile periodicity supported by the driver
|
|
+ * if EMA is enabled. Driver should indicate EMA support to the userspace
|
|
+ * by setting wiphy->ema_max_profile_periodicity to
|
|
+ * a non-zero value.
|
|
+ *
|
|
+ * @NL80211_MBSSID_CONFIG_ATTR_INDEX: Mandatory parameter to pass the index of
|
|
+ * this BSS (u8) in the multiple BSSID set.
|
|
+ * Value must be set to 0 for the transmitting interface and non-zero for
|
|
+ * all non-transmitting interfaces. The userspace will be responsible
|
|
+ * for using unique indices for the interfaces.
|
|
+ * Range: 0 to wiphy->mbssid_max_interfaces-1.
|
|
+ *
|
|
+ * @NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX: Mandatory parameter for
|
|
+ * a non-transmitted profile which provides the interface index (u32) of
|
|
+ * the transmitted profile. The value must match one of the interface
|
|
+ * indices advertised by the kernel. Optional if the interface being set up
|
|
+ * is the transmitting one, however, if provided then the value must match
|
|
+ * the interface index of the same.
|
|
+ *
|
|
+ * @NL80211_MBSSID_CONFIG_ATTR_EMA: Flag used to enable EMA AP feature.
|
|
+ * Setting this flag is permitted only if the driver advertises EMA support
|
|
+ * by setting wiphy->ema_max_profile_periodicity to non-zero.
|
|
+ *
|
|
+ * @__NL80211_MBSSID_CONFIG_ATTR_LAST: Internal
|
|
+ * @NL80211_MBSSID_CONFIG_ATTR_MAX: highest attribute
|
|
+ */
|
|
+enum nl80211_mbssid_config_attributes {
|
|
+ __NL80211_MBSSID_CONFIG_ATTR_INVALID,
|
|
+
|
|
+ NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES,
|
|
+ NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY,
|
|
+ NL80211_MBSSID_CONFIG_ATTR_INDEX,
|
|
+ NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX,
|
|
+ NL80211_MBSSID_CONFIG_ATTR_EMA,
|
|
+
|
|
+ /* keep last */
|
|
+ __NL80211_MBSSID_CONFIG_ATTR_LAST,
|
|
+ NL80211_MBSSID_CONFIG_ATTR_MAX = __NL80211_MBSSID_CONFIG_ATTR_LAST - 1,
|
|
+};
|
|
|
|
/**
|
|
* enum nl80211_beacon_tx_mode - Beacon Tx Mode enum.
|