diff mbox series

[29/31] mac8021: Allow probe request injection on passive non radar channels

Message ID iwlwifi.20210618133832.76e2f5ab0fe3.Iab8e73126dfe75a5448048ce118550bebda200b8@changeid (mailing list archive)
State New
Delegated to: Johannes Berg
Headers show
Series cfg80211/mac80211 patches from our internal tree 2021-06-18 | expand

Commit Message

Luca Coelho June 18, 2021, 10:41 a.m. UTC
From: Ilan Peer <ilan.peer@intel.com>

Based on section 11.1.4.3.8 (Non-scanning probe request transmission)
in Draft P802.11REVmd_D5.0 transmission of a probe request to an AP
known to be in range is allowed. Thus, allow probe request injection on
monitor interface in case the target AP is found in range and the
channel is not a radar channel.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 net/mac80211/tx.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 0b719f3d2dec..663c2fb99b11 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2337,8 +2337,31 @@  netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
 	 * monitor flag interfaces used for AP support.
 	 */
 	if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
-				     sdata->vif.type))
-		goto fail_rcu;
+				     sdata->vif.type)) {
+		/*
+		 * Allow probe request transmissions on non radar channels
+		 * in case the AP is known to be in range. This is in accordance
+		 * to section 11.1.4.3.8 (Non-scanning probe request
+		 * transmission) in Draft P802.11REVmd_D5.0 specification.
+		 */
+		if (!ieee80211_is_probe_req(hdr->frame_control) ||
+		    chandef->chan->flags & IEEE80211_CHAN_RADAR) {
+			goto fail_rcu;
+		} else {
+			struct cfg80211_bss *tmp =
+				cfg80211_get_bss(local->hw.wiphy,
+						 chandef->chan,
+						 hdr->addr1,
+						 NULL, 0,
+						 IEEE80211_BSS_TYPE_ANY,
+						 IEEE80211_PRIVACY_ANY);
+
+			if (!tmp)
+				goto fail_rcu;
+			else
+				cfg80211_put_bss(local->hw.wiphy, tmp);
+		}
+	}
 
 	info->band = chandef->chan->band;