[][MAC80211][hostapd][add support for runtime set in-band discovery via hostapd_cli (cert)]

[Description]
Add hostapd_cli command:
hostapd_cli unsolic_probe_resp [tx_type] [interval]

0: disable all in-band discovery
1: enable unsolicited probe response
2: enable FILS discovery

[Release-log]
N/A

Change-Id: Ib1c015ea37ca72cb57d232119112658367da505d
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/5973407
diff --git a/autobuild_mac80211_release/package/network/services/hostapd/patches/912-master-add-the-destination-address-of-unsolicited-Probe.patch b/autobuild_mac80211_release/package/network/services/hostapd/patches/912-master-add-the-destination-address-of-unsolicited-Probe.patch
new file mode 100644
index 0000000..e9b630f
--- /dev/null
+++ b/autobuild_mac80211_release/package/network/services/hostapd/patches/912-master-add-the-destination-address-of-unsolicited-Probe.patch
@@ -0,0 +1,71 @@
+From 96a7f383290f78e15f1e7a5bc33099c81f104c5b Mon Sep 17 00:00:00 2001
+From: MeiChia Chiu <meichia.chiu@mediatek.com>
+Date: Fri, 6 May 2022 11:02:36 +0800
+Subject: hostapd: Add the destination address of unsolicited Probe Response
+ frame
+
+Without this, hostapd generates Probe Response frames with the null
+destination address when hostapd enables unsolicited Probe Response
+frame transmission. Fix this to use the broadcast address instead.
+
+Fixes: 024b4b2a298f ("AP: Unsolicited broadcast Probe Response configuration")
+Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
+---
+ src/ap/beacon.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/src/ap/beacon.c b/src/ap/beacon.c
+index eaa403326..58872bfda 100644
+--- a/src/ap/beacon.c
++++ b/src/ap/beacon.c
+@@ -464,7 +464,8 @@ static u8 * hostapd_eid_supported_op_classes(struct hostapd_data *hapd, u8 *eid)
+ 
+ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
+ 				   const struct ieee80211_mgmt *req,
+-				   int is_p2p, size_t *resp_len)
++				   int is_p2p, size_t *resp_len,
++				   bool bcast_probe_resp)
+ {
+ 	struct ieee80211_mgmt *resp;
+ 	u8 *pos, *epos, *csa_pos;
+@@ -531,6 +532,9 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
+ 					   WLAN_FC_STYPE_PROBE_RESP);
+ 	if (req)
+ 		os_memcpy(resp->da, req->sa, ETH_ALEN);
++	else if (bcast_probe_resp)
++		os_memset(resp->da, 0xff, ETH_ALEN);
++
+ 	os_memcpy(resp->sa, hapd->own_addr, ETH_ALEN);
+ 
+ 	os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN);
+@@ -1141,7 +1145,7 @@ void handle_probe_req(struct hostapd_data *hapd,
+ 		     " signal=%d", MAC2STR(mgmt->sa), ssi_signal);
+ 
+ 	resp = hostapd_gen_probe_resp(hapd, mgmt, elems.p2p != NULL,
+-				      &resp_len);
++				      &resp_len, false);
+ 	if (resp == NULL)
+ 		return;
+ 
+@@ -1210,7 +1214,7 @@ static u8 * hostapd_probe_resp_offloads(struct hostapd_data *hapd,
+ 			   "this");
+ 
+ 	/* Generate a Probe Response template for the non-P2P case */
+-	return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len);
++	return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len, false);
+ }
+ 
+ #endif /* NEED_AP_MLME */
+@@ -1228,7 +1232,8 @@ static u8 * hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd,
+ 		hapd->conf->unsol_bcast_probe_resp_interval;
+ 
+ 	return hostapd_gen_probe_resp(hapd, NULL, 0,
+-				      &params->unsol_bcast_probe_resp_tmpl_len);
++				      &params->unsol_bcast_probe_resp_tmpl_len,
++				      true);
+ }
+ #endif /* CONFIG_IEEE80211AX */
+ 
+-- 
+cgit v1.2.3-18-g5258
+