[PATCH v3 11/11] mbssid: add nl80211 support

Aloka Dixit quic_alokad at quicinc.com
Wed May 11 14:15:21 PDT 2022


From: John Crispin <john at phrozen.org>

Send MBSSID and EMA configuration parameters to kernel.

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/drivers/driver_nl80211.c | 52 ++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 0127a6be28ed..d092f26fe713 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4535,6 +4535,55 @@ static int nl80211_unsol_bcast_probe_resp(struct i802_bss *bss,
 #endif /* CONFIG_IEEE80211AX */
 
 
+static int nl80211_mbssid(struct nl_msg *msg,
+			 struct wpa_driver_ap_params *params)
+{
+	struct nlattr *config, *elems;
+	int ifidx;
+
+	if (!params->mbssid_tx_iface)
+		return 0;
+
+	config = nla_nest_start(msg, NL80211_ATTR_MBSSID_CONFIG);
+	if (!config)
+		return -1;
+
+	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)
+			return -1;
+		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)
+			return -1;
+
+		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;
+}
+
+
 static int wpa_driver_nl80211_set_ap(void *priv,
 				     struct wpa_driver_ap_params *params)
 {
@@ -4829,6 +4878,9 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 	if (params->unsol_bcast_probe_resp_interval &&
 	    nl80211_unsol_bcast_probe_resp(bss, msg, params) < 0)
 		goto fail;
+
+	if (nl80211_mbssid(msg, params) < 0)
+		goto fail;
 #endif /* CONFIG_IEEE80211AX */
 
 #ifdef CONFIG_SAE
-- 
2.31.1




More information about the Hostap mailing list