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;