[PATCH v3 3/3] nl80211: Add FILS discovery support

Aloka Dixit alokad at codeaurora.org
Mon Dec 14 21:04:28 EST 2020


This patch adds new attributes to support FILS discovery transmission.
New attribute, NL80211_ATTR_FILS_DISCOVERY, is nested which
supports following parameters (IEEE Std 802.11ai-2016, Annex C.3 MIB
detail):
(1) NL80211_FILS_DISCOVERY_ATTR_MIN_INT - Minimum packet interval
(2) NL80211_FILS_DISCOVERY_ATTR_MAX_INT - Maximum packet interval
(3) NL80211_FILS_DISCOVERY_ATTR_TMPL - Template data

Signed-off-by: Aloka Dixit <alokad at codeaurora.org>
---
 src/drivers/driver_nl80211.c      | 54 +++++++++++++++++++++++++++++++
 src/drivers/driver_nl80211.h      |  1 +
 src/drivers/driver_nl80211_capa.c |  4 +++
 3 files changed, 59 insertions(+)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 448c404f303b..2c749cf5f4f6 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4328,6 +4328,49 @@ static int nl80211_put_sae_pwe(struct nl_msg *msg, int pwe)
 #endif /* CONFIG_SAE */
 
 
+#ifdef CONFIG_FILS
+static int nl80211_fils_discovery(struct i802_bss *bss, struct nl_msg *msg,
+				  struct wpa_driver_ap_params *params)
+{
+	struct nlattr *attr;
+
+	if (!bss->drv->fils_discovery) {
+		wpa_printf(MSG_ERROR,
+			   "nl80211: Driver does not support FILS discovery transmission for %s\n",
+			   bss->ifname);
+		return -1;
+	}
+
+	attr = nla_nest_start(msg, NL80211_ATTR_FILS_DISCOVERY);
+	if (!attr)
+		return -1;
+
+	if (nla_put_u32(msg, NL80211_FILS_DISCOVERY_ATTR_INT_MIN,
+			params->fils_discovery_min_int) ||
+	    nla_put_u32(msg, NL80211_FILS_DISCOVERY_ATTR_INT_MAX,
+			params->fils_discovery_max_int)) {
+		wpa_printf(MSG_ERROR,
+			   "nl80211: Failed to build FILS discovery msg for %s\n",
+			   bss->ifname);
+		return -1;
+	}
+
+	if (params->fils_discovery_tmpl &&
+	    nla_put(msg, NL80211_FILS_DISCOVERY_ATTR_TMPL,
+		    params->fils_discovery_tmpl_len,
+		    params->fils_discovery_tmpl)) {
+		wpa_printf(MSG_ERROR,
+			   "nl80211: Failed to build FILS discovery msg for %s\n",
+			   bss->ifname);
+		return -1;
+	}
+
+	nla_nest_end(msg, attr);
+	return 0;
+}
+#endif /* CONFIG_FILS */
+
+
 static int wpa_driver_nl80211_set_ap(void *priv,
 				     struct wpa_driver_ap_params *params)
 {
@@ -4595,6 +4638,17 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 		goto fail;
 #endif /* CONFIG_SAE */
 
+#ifdef CONFIG_FILS
+	if (params->fils_discovery_max_int) {
+		wpa_printf(MSG_DEBUG,
+			   "nl80211: FILS discovery maximum interval = %u\n",
+			   params->fils_discovery_max_int);
+		ret = nl80211_fils_discovery(bss, msg, params);
+		if (ret < 0)
+			goto fail;
+	}
+#endif /* CONFIG_FILS */
+
 	ret = send_and_recv_msgs_owner(drv, msg, get_connect_handle(bss), 1,
 				       NULL, NULL, NULL, NULL);
 	if (ret) {
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
index 4009545fa2d9..1f1b264c9536 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -175,6 +175,7 @@ struct wpa_driver_nl80211_data {
 	unsigned int multicast_registrations:1;
 	unsigned int no_rrm:1;
 	unsigned int get_sta_info_vendor_cmd_avail:1;
+	unsigned int fils_discovery:1;
 
 	u64 vendor_scan_cookie;
 	u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
index 6c2ab515ea14..b2fe7d04494a 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -644,6 +644,10 @@ static void wiphy_info_ext_feature_flags(struct wiphy_info_data *info,
 	if (ext_feature_isset(ext_features, len,
 			      NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS))
 		info->drv->multicast_registrations = 1;
+
+	if (ext_feature_isset(ext_features, len,
+			      NL80211_EXT_FEATURE_FILS_DISCOVERY))
+		info->drv->fils_discovery = 1;
 }
 
 
-- 
2.25.0




More information about the Hostap mailing list