[PATCH v2 2/2] nl80211: Unsolicited bcast probe resp support

Aloka Dixit alokad at codeaurora.org
Thu Sep 10 22:45:47 EDT 2020


Unsolicited broadcast probe response tranmission is used for in-band
discovery in 6GHz band (IEEE P802.11ax/D6.0 26.17.2.3.2, AP behavior for
fast passive scanning).
The new attribute, NL80211_ATTR_UNSOL_BCAST_PROBE_RESP, is nested which
supports following parameters:
(1) NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT - Packet interval
(2) NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL - Template data

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

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 2ee34d11d64e..dc3c5aa672ff 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4301,6 +4301,48 @@ static int nl80211_set_multicast_to_unicast(struct i802_bss *bss,
 }
 
 
+#ifdef CONFIG_IEEE80211AX
+static int nl80211_unsol_bcast_probe_resp(struct i802_bss *bss,
+					  struct nl_msg *msg,
+					  struct wpa_driver_ap_params *params)
+{
+	struct nlattr *attr;
+
+	if (!bss->drv->unsol_bcast_probe_resp) {
+		wpa_printf(MSG_ERROR,
+			   "nl80211: Driver does not support unsolicited broadcast probe response transmission for %s\n",
+			   bss->ifname);
+		return -1;
+	}
+
+	attr = nla_nest_start(msg, NL80211_ATTR_UNSOL_BCAST_PROBE_RESP);
+	if (!attr)
+		return -1;
+
+	if (nla_put_u32(msg, NL80211_UNSOL_BCAST_PROBE_RESP_INT,
+			params->unsol_bcast_probe_resp_interval)) {
+		wpa_printf(MSG_ERROR,
+			   "nl80211: Failed to build unsolicited broadcast probe response msg for %s\n",
+			   bss->ifname);
+		return -1;
+	}
+
+	if (params->unsol_bcast_probe_resp_tmpl &&
+	    nla_put(msg, NL80211_UNSOL_BCAST_PROBE_RESP_TMPL,
+		    params->unsol_bcast_probe_resp_tmpl_len,
+		    params->unsol_bcast_probe_resp_tmpl)) {
+		wpa_printf(MSG_ERROR,
+			   "nl80211: Failed to build unsolicited broadcast probe response msg for %s\n",
+			   bss->ifname);
+		return -1;
+	}
+
+	nla_nest_end(msg, attr);
+	return 0;
+}
+#endif /* CONFIG_IEEE80211AX */
+
+
 static int wpa_driver_nl80211_set_ap(void *priv,
 				     struct wpa_driver_ap_params *params)
 {
@@ -4559,6 +4601,15 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 		if (nla_put_flag(msg, NL80211_ATTR_TWT_RESPONDER))
 			goto fail;
 	}
+
+	if (params->unsol_bcast_probe_resp_interval) {
+		wpa_printf(MSG_DEBUG,
+			   "nl80211: unsolicited probe response interval = %u\n",
+			   params->unsol_bcast_probe_resp_interval);
+		ret = nl80211_unsol_bcast_probe_resp(bss, msg, params);
+		if (ret < 0)
+			goto fail;
+	}
 #endif /* CONFIG_IEEE80211AX */
 
 	ret = send_and_recv_msgs_owner(drv, msg, get_connect_handle(bss), 1,
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
index 017c025a0d75..5528eba85022 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -174,6 +174,7 @@ struct wpa_driver_nl80211_data {
 	unsigned int control_port_ap:1;
 	unsigned int multicast_registrations:1;
 	unsigned int no_rrm:1;
+	unsigned int unsol_bcast_probe_resp: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 46f61fdbf925..62cc9f0fda23 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -644,6 +644,11 @@ 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_UNSOL_BCAST_PROBE_RESP))
+		info->drv->unsol_bcast_probe_resp = 1;
+
 }
 
 
-- 
2.25.0




More information about the Hostap mailing list