From patchwork Fri Jan 3 10:34:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Cavallari X-Patchwork-Id: 11316759 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 159881580 for ; Fri, 3 Jan 2020 10:35:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF97A222C3 for ; Fri, 3 Jan 2020 10:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727507AbgACKfu (ORCPT ); Fri, 3 Jan 2020 05:35:50 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:52111 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727443AbgACKfu (ORCPT ); Fri, 3 Jan 2020 05:35:50 -0500 Received: from evilbit.green-communications.fr ([92.154.77.116]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.168]) with ESMTPSA (Nemesis) id 1Mz9lL-1jhtAn2q0J-00wGRN; Fri, 03 Jan 2020 11:35:46 +0100 From: Nicolas Cavallari To: Johannes Berg Cc: linux-wireless@vger.kernel.org, =?utf-8?q?Krzysztof_Ha=C5=82asa?= Subject: [PATCH v2 1/2] cfg80211: Add support for userspace to reset stations in IBSS mode. Date: Fri, 3 Jan 2020 11:34:56 +0100 Message-Id: <20200103103457.22778-2-nicolas.cavallari@green-communications.fr> X-Mailer: git-send-email 2.25.0.rc0 In-Reply-To: <20200103103457.22778-1-nicolas.cavallari@green-communications.fr> References: <20200103103457.22778-1-nicolas.cavallari@green-communications.fr> MIME-Version: 1.0 X-Provags-ID: V03:K1:aGpwvmsqQ/IPfqNMpw2Zkk0prJdWShA/0+FF3mmQbEmigZ478cq QJJUDPn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q7r9Eiy/XolRn/6IZg0g0B4yP/JQx2o7+RwS2IZ93byjapt+ lMIzAdGCGz3US/u3LYuN0ha2ptXInBZoxfiS2vwoP+gNEAtoBDdipx32I4TdAq Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Sometimes, userspace is able to detect that a peer silently lost its state (like, if the peer reboots). wpa_supplicant does this for IBSS-RSN and currently only resets the key of the peer so that it can attempt another handshake. However, the kernel also hold state about the station, such as BA sessions, probe response parameters and the like. They also need to be resetted correctly. This patch adds the NL80211_EXT_FEATURE_DEL_IBSS_STA feature flag indicating the driver accepts deleting stations in IBSS mode, which should send a deauth and reset the state of the station, just like in mesh point mode. Signed-off-by: Nicolas Cavallari --- include/uapi/linux/nl80211.h | 4 ++++ net/wireless/nl80211.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 5eab191607f8..8f8b9dcb80f1 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -5521,6 +5521,9 @@ enum nl80211_feature_flags { * feature, which prevents bufferbloat by using the expected transmission * time to limit the amount of data buffered in the hardware. * + * @NL80211_EXT_FEATURE_DEL_IBSS_STA: The driver supports removing stations + * in IBSS mode, essentially by dropping their state. + * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ @@ -5568,6 +5571,7 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_SAE_OFFLOAD, NL80211_EXT_FEATURE_VLAN_OFFLOAD, NL80211_EXT_FEATURE_AQL, + NL80211_EXT_FEATURE_DEL_IBSS_STA, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index da5262b2298b..a2a66a155603 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6073,8 +6073,13 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info) if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO && + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC) return -EINVAL; + if (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_ADHOC && + !wiphy_ext_feature_isset(&rdev->wiphy, + NL80211_EXT_FEATURE_DEL_IBSS_STA)) + return -EOPNOTSUPP; if (!rdev->ops->del_station) return -EOPNOTSUPP; From patchwork Fri Jan 3 10:34:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Cavallari X-Patchwork-Id: 11316761 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1E83138D for ; Fri, 3 Jan 2020 10:35:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0008222C3 for ; Fri, 3 Jan 2020 10:35:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727489AbgACKfu (ORCPT ); Fri, 3 Jan 2020 05:35:50 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:46503 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727350AbgACKft (ORCPT ); Fri, 3 Jan 2020 05:35:49 -0500 Received: from evilbit.green-communications.fr ([92.154.77.116]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.168]) with ESMTPSA (Nemesis) id 1M277h-1ikqGh3VVZ-002XHv; Fri, 03 Jan 2020 11:35:46 +0100 From: Nicolas Cavallari To: Johannes Berg Cc: linux-wireless@vger.kernel.org, =?utf-8?q?Krzysztof_Ha=C5=82asa?= Subject: [PATCH v2 2/2] mac80211: Allow deleting stations in ibss mode to reset their state. Date: Fri, 3 Jan 2020 11:34:57 +0100 Message-Id: <20200103103457.22778-3-nicolas.cavallari@green-communications.fr> X-Mailer: git-send-email 2.25.0.rc0 In-Reply-To: <20200103103457.22778-1-nicolas.cavallari@green-communications.fr> References: <20200103103457.22778-1-nicolas.cavallari@green-communications.fr> MIME-Version: 1.0 X-Provags-ID: V03:K1:hqoj2+HquQp6sR66zV8sfHprA+JFQ6c11uohl/K7RM9OazH1QsS ongj8hE6LrKNI7JjMGcVW89PWwSyKBqqVfe4jp+YLzjTcFoFLL9N95Mxl8Qi6OsECO9adzk zWUZfSVbb+mpLDSv9bgvEaffoTC70niVj94k4VHWJTuV8SSMp9mJyBkvSNu9Ah9/ky9jt/I Ro9SUmlnwLuqSK+vbY1oA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:jXTC2dIqgQ4=:S3q+UgbBcw4GqpNVmUGugL vvZRc9lWU1vZpVNScBMQXlIOFzQldBuBazA/VPSod5aMfKJY6RWTbncj/OFSOQdyfA1HFsvoD VosMexXzcp2ZfYikmyglrxGPqxTQnc9MLzvAjG8ZxPe4Qrgk+R2D2Zya8zi7OojnLKkQ5nyYf qW8mnxOp5Ix0vn/y2yEpRi2AnlHXRu3wn+GACqa+xtJQacI8t3Pd4Udcdudz+gS9UPjjWQM9V 5uXn8QrOu00OmBrwH4pgQuGjOJsCwy8ECSnN/4z+cDKCjd/EGiyV9u1p4d9PgJKzJOxWqmBrG uOu0bjUYagmP/sKSWut9BwIpy0UCwA5C1t1dvrulThseSI24zklqWzPNiWuFt89KEsUawlKFE CpUAxq9HfW5ZDNVehd2oMZah4QPjGmyqo+dro1W3nA/l37+3ijm2ez/73vT+Zt5R/P7G4LDTz MV12UYcAul4Xuxm5derNib3sm69VxSnz0Ghpo54KfXc6IIJAO5A15w4nDWMwjcy6qmXnCi248 fMWx2mnZAM6gs40bJZmgdXfNWp2jGCy0lzcj35FXcHNn+trkEoLieiLo2klMtZhCWhzBKIL3Q xtvO15XUNlslEob4VTVG5t70WBlCqFI7xKlVMeHYa6QGCiOSWLWiyygBStPMrDuobmhFtxBc9 5A5atEjeYloggNBmJD6KdBBeHTV1vzTUOJC99YW/DPemuRFuP3pet1F0Idh7cX3HNjfrObuXk vWkuAL9O0v4d80xTGoxVwrliKhZmHkIT9rPYAgxKt4ySwC+1JYtyszzYleFpvJyu5tr5Irnpm BRkNp2i1gXxU7alVs/ooK1gPQ5fM6qCNoJRl7XWdMdI8i1rzzr3HXGDYpGteTRiYgZH4BTk7b XQAlU+PBQkMbXVFN+E99R6hvezk3Xo/2euX6Iod+S1FZzBSD8X1kkF9yX3+ljT Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Set the NL80211_EXT_FEATURE_DEL_IBSS_STA if the interface support IBSS mode, so that stations can be resetted from user space. mac80211 already deletes stations by itself, so mac80211 drivers must already support this. This has been successfuly tested with ath9k. Signed-off-by: Nicolas Cavallari --- net/mac80211/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 4c2b5ba3ac09..02f36590c01d 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -1065,6 +1065,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) NL80211_EXT_FEATURE_EXT_KEY_ID); } + if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_ADHOC)) + wiphy_ext_feature_set(local->hw.wiphy, + NL80211_EXT_FEATURE_DEL_IBSS_STA); + /* * Calculate scan IE length -- we need this to alloc * memory and to subtract from the driver limit. It