From patchwork Fri Jun 18 10:41:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 12331077 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51119C48BDF for ; Fri, 18 Jun 2021 11:08:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 276F56128C for ; Fri, 18 Jun 2021 11:08:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232127AbhFRLK0 (ORCPT ); Fri, 18 Jun 2021 07:10:26 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:48288 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230268AbhFRLK0 (ORCPT ); Fri, 18 Jun 2021 07:10:26 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=kveik.lan) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1luBxA-001YXx-Po; Fri, 18 Jun 2021 13:42:26 +0300 From: Luca Coelho To: johannes@sipsolutions.net Cc: luca@coelho.fi, linux-wireless@vger.kernel.org Date: Fri, 18 Jun 2021 13:41:54 +0300 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618104156.747775-1-luca@coelho.fi> References: <20210618104156.747775-1-luca@coelho.fi> MIME-Version: 1.0 Subject: [PATCH 29/31] mac8021: Allow probe request injection on passive non radar channels Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ilan Peer 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 Signed-off-by: Luca Coelho --- net/mac80211/tx.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) 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;