diff mbox series

[RFC,v1,4/4] nl80211: Allow deleting stations in ibss mode to reset their state.

Message ID 20191209102808.12014-5-nicolas.cavallari@green-communications.fr (mailing list archive)
State RFC
Delegated to: Johannes Berg
Headers show
Series 802.11n IBSS: wlan0 stops receiving packets due to aggregation after sender reboot | expand

Commit Message

Nicolas Cavallari Dec. 9, 2019, 10:28 a.m. UTC
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 allow userspace to use NL80211_CMD_DEL_STATION in IBSS mode,
which should send a deauth and reset the state of the station, just
like in mesh point mode.

This has successfully been tested with mac80211/ath9k. Drivers that do
not support it should just return an error, so that userspace can fall
back to the old methods.

Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
---
 net/wireless/nl80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Johannes Berg Dec. 11, 2019, 9:32 p.m. UTC | #1
On Mon, 2019-12-09 at 11:28 +0100, Nicolas Cavallari wrote:
> 
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index da5262b2298b..82046c990a2a 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -6073,7 +6073,8 @@ 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 we go this route (and I'm not sure, shouldn't be _that_ hard to do
some kind of auth/deauth thing?) then you probably should make this
depend on an nl80211 extended feature bit.

That way, not only do you get visibility in userspace whether it's
supported, but also avoid the need to change those non-mac80211 drivers
(by having only mac80211 set the extended feature)

johannes
Nicolas Cavallari Dec. 12, 2019, 9:56 a.m. UTC | #2
On 11/12/2019 22:32, Johannes Berg wrote:
> and I'm not sure, shouldn't be _that_ hard to do some kind of auth/deauth
> thing?

wpa_supplicant already does this for IBSS RSN. And it does not reset the station
for each received auth frame, the logic is more advanced than that.

(not to mention that it should switch to SAE at some point, but there is this
long standing issue of wpa_supplicant not being able to get the rsn ie of the
peer's probe response)

But for the unencrypted case, i guess simply re-reverting 52874a5e (Revert
"mac80211: in IBSS use the Auth frame to trigger STA reinsertion") and making it
conditional on !privacy should be enough ?

> That way, not only do you get visibility in userspace whether it's
> supported, but also avoid the need to change those non-mac80211 drivers
> (by having only mac80211 set the extended feature)

Ok.
diff mbox series

Patch

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index da5262b2298b..82046c990a2a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6073,7 +6073,8 @@  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 (!rdev->ops->del_station)