From patchwork Tue Mar 3 11:50:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 216378 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=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 7D10DC3F2D7 for ; Tue, 3 Mar 2020 11:50:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4955E20863 for ; Tue, 3 Mar 2020 11:50:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729072AbgCCLug (ORCPT ); Tue, 3 Mar 2020 06:50:36 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:59753 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbgCCLug (ORCPT ); Tue, 3 Mar 2020 06:50:36 -0500 Received: from localhost.localdomain (unknown [141.24.207.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 69C14580065; Tue, 3 Mar 2020 12:50:34 +0100 (CET) From: Markus Theil To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, nbd@nbd.name, lorenzo@kernel.org, Markus Theil Subject: [PATCH 1/3] nl80211: add monitor mode scan feature Date: Tue, 3 Mar 2020 12:50:15 +0100 Message-Id: <20200303115017.9845-1-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Back in 2007 "mac80211: don't allow scanning in monitor mode" (f27b62d3e7ec) disabled scanning in monitor mode, because hw controlled by the zd1211rw driver got confused during this operation. Nevertheless, it can be useful to scan in monitor mode, e.g. when building a tool which processes scans, channel surveys and monitors the channel passively in monitor mode. This patch adds a feature flag for scanning in monitor mode, which can be set by hw supporting this feature. Signed-off-by: Markus Theil --- include/uapi/linux/nl80211.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index b002ef2060fa..062519967e60 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -5642,6 +5642,9 @@ enum nl80211_feature_flags { * @NL80211_EXT_FEATURE_BEACON_PROTECTION: The driver supports Beacon protection * and can receive key configuration for BIGTK using key indexes 6 and 7. * + * @NL80211_EXT_FEATURE_MONITOR_MODE_SCAN: The driver supports scanning while in + * monitor mode. + * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ @@ -5690,6 +5693,7 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_VLAN_OFFLOAD, NL80211_EXT_FEATURE_AQL, NL80211_EXT_FEATURE_BEACON_PROTECTION, + NL80211_EXT_FEATURE_MONITOR_MODE_SCAN, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, From patchwork Tue Mar 3 11:50:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 216379 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=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 9CBD4C3F2CD for ; Tue, 3 Mar 2020 11:50:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7AE2720866 for ; Tue, 3 Mar 2020 11:50:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729091AbgCCLug (ORCPT ); Tue, 3 Mar 2020 06:50:36 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:59758 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728350AbgCCLug (ORCPT ); Tue, 3 Mar 2020 06:50:36 -0500 Received: from localhost.localdomain (unknown [141.24.207.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 816D8580074; Tue, 3 Mar 2020 12:50:34 +0100 (CET) From: Markus Theil To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, nbd@nbd.name, lorenzo@kernel.org, Markus Theil Subject: [PATCH 2/3] mac80211: conditionally allow scan in monitor mode Date: Tue, 3 Mar 2020 12:50:16 +0100 Message-Id: <20200303115017.9845-2-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303115017.9845-1-markus.theil@tu-ilmenau.de> References: <20200303115017.9845-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This patch checks the monitor mode scan feature flag and conditionally allows scanning in monitor mode for hw which supports this. Signed-off-by: Markus Theil --- net/mac80211/cfg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 7b654d2b8bb2..01a20f2dbf86 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -2313,6 +2313,12 @@ static int ieee80211_scan(struct wiphy *wiphy, !(req->flags & NL80211_SCAN_FLAG_AP))) return -EOPNOTSUPP; break; + case NL80211_IFTYPE_MONITOR: + if (wiphy_ext_feature_isset(wiphy, + NL80211_EXT_FEATURE_MONITOR_MODE_SCAN)) + break; + else + return -EOPNOTSUPP; case NL80211_IFTYPE_NAN: default: return -EOPNOTSUPP;