linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] cfg80211: Add support for userspace to reset stations in IBSS mode
@ 2020-03-05 13:57 Nicolas Cavallari
  2020-03-05 13:57 ` [PATCH v3 2/2] mac80211: Allow deleting stations in ibss mode to reset their state Nicolas Cavallari
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Cavallari @ 2020-03-05 13:57 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg

From: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>

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
by registering for auth/deauth frames, but when it detects this, it is
only able to remove the encryption keys of the peer and close its port.

However, the kernel also hold other 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 <nicolas.cavallari@green-communications.fr>

---
v3: rebased on wireless-testing and reworded commit
v2: Use a nl80211 feature flag instead of patching every driver.
---
 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 b002ef2060fa..872db33034a3 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_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.
  */
@@ -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_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 15000275b32d..35c57bcff871 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6269,8 +6269,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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] mac80211: Allow deleting stations in ibss mode to reset their state
  2020-03-05 13:57 [PATCH v3 1/2] cfg80211: Add support for userspace to reset stations in IBSS mode Nicolas Cavallari
@ 2020-03-05 13:57 ` Nicolas Cavallari
  2020-04-08 11:56   ` Koen Vandeputte
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Cavallari @ 2020-03-05 13:57 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg

From: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>

Set the NL80211_EXT_FEATURE_DEL_IBSS_STA if the interface support IBSS
mode, so that stations can be reset from user space.

mac80211 already deletes stations by itself, so mac80211 drivers must
already support this.

This has been successfully tested with ath9k.

Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>

---
v3: spelling fixes in commit message.
---
 net/mac80211/main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 944e86da5c65..bc7fd67dc987 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1081,6 +1081,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
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/2] mac80211: Allow deleting stations in ibss mode to reset their state
  2020-03-05 13:57 ` [PATCH v3 2/2] mac80211: Allow deleting stations in ibss mode to reset their state Nicolas Cavallari
@ 2020-04-08 11:56   ` Koen Vandeputte
  2020-04-08 14:31     ` Nicolas Cavallari
  0 siblings, 1 reply; 5+ messages in thread
From: Koen Vandeputte @ 2020-04-08 11:56 UTC (permalink / raw)
  To: Nicolas Cavallari, linux-wireless; +Cc: Johannes Berg


On 05.03.20 14:57, Nicolas Cavallari wrote:
> From: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
>
> Set the NL80211_EXT_FEATURE_DEL_IBSS_STA if the interface support IBSS
> mode, so that stations can be reset from user space.
>
> mac80211 already deletes stations by itself, so mac80211 drivers must
> already support this.
>
> This has been successfully tested with ath9k.
>
> Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
>
> ---
> v3: spelling fixes in commit message.
> ---
>   net/mac80211/main.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/net/mac80211/main.c b/net/mac80211/main.c
> index 944e86da5c65..bc7fd67dc987 100644
> --- a/net/mac80211/main.c
> +++ b/net/mac80211/main.c
> @@ -1081,6 +1081,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

Hi Nicolas,


I took these patches for a thorough spin offshore (combined with your 
quick wpa_sup change)


Quick test setup overview:

- Device mounted on top of a vessel, sailing around in windfarms.
- Lots of turbines are equiped with 4x 90deg sectors
- 802.11n HT40 2x2 custom mesh over IBSS, using Dynack
- As the vessel moves around,  IBSS links are continuously dropped and 
re-added throughout the field
- Output of my app, fyi:  https://pastebin.com/raw/vtZSwHC9

I've made 2 identical builds, one containing your patches and one without.

When your patches are used:

--> On devices with multiple radio's, all radio's went deaf within a few 
minutes without any notice in logs.

--> Only a reboot solved the issue but everything goes deaf again within 
a few minutes. (after dropping/adding some links)


Any idea?


Thanks,

Koen


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/2] mac80211: Allow deleting stations in ibss mode to reset their state
  2020-04-08 11:56   ` Koen Vandeputte
@ 2020-04-08 14:31     ` Nicolas Cavallari
  2020-04-08 15:02       ` Koen Vandeputte
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Cavallari @ 2020-04-08 14:31 UTC (permalink / raw)
  To: Koen Vandeputte, Nicolas Cavallari, linux-wireless; +Cc: Johannes Berg

On 08/04/2020 13:56, Koen Vandeputte wrote:
> Quick test setup overview:
> 
> - Device mounted on top of a vessel, sailing around in windfarms.
> - Lots of turbines are equiped with 4x 90deg sectors
> - 802.11n HT40 2x2 custom mesh over IBSS, using Dynack
> - As the vessel moves around,  IBSS links are continuously dropped and
> re-added throughout the field
> - Output of my app, fyi:  https://pastebin.com/raw/vtZSwHC9
> 
> I've made 2 identical builds, one containing your patches and one without.
> 
> When your patches are used:
> 
> --> On devices with multiple radio's, all radio's went deaf within a few
> minutes without any notice in logs.
> 
> --> Only a reboot solved the issue but everything goes deaf again within
> a few minutes. (after dropping/adding some links)
> 
> 
> Any idea?

I would highly suspect the hasty wpa_supplicant patch more than the
kernel patches.

I suppose you don't have any wpa_supplicant verbose logs ? (with the -dd
option).

I don't have physical access to any hardware given the current crisis,
but if you could tell which kernel and wpa_supplicant version you
applied the patch on, and whether you took the patches from the mailing
list or from git including the cleanup patches.

Also, which driver/card did you use ? I mainly tested this with ath9k
with ar93xx.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/2] mac80211: Allow deleting stations in ibss mode to reset their state
  2020-04-08 14:31     ` Nicolas Cavallari
@ 2020-04-08 15:02       ` Koen Vandeputte
  0 siblings, 0 replies; 5+ messages in thread
From: Koen Vandeputte @ 2020-04-08 15:02 UTC (permalink / raw)
  To: Nicolas Cavallari, Nicolas Cavallari, linux-wireless; +Cc: Johannes Berg


On 08.04.20 16:31, Nicolas Cavallari wrote:
> On 08/04/2020 13:56, Koen Vandeputte wrote:
>> Quick test setup overview:
>>
>> - Device mounted on top of a vessel, sailing around in windfarms.
>> - Lots of turbines are equiped with 4x 90deg sectors
>> - 802.11n HT40 2x2 custom mesh over IBSS, using Dynack
>> - As the vessel moves around,  IBSS links are continuously dropped and
>> re-added throughout the field
>> - Output of my app, fyi:  https://pastebin.com/raw/vtZSwHC9
>>
>> I've made 2 identical builds, one containing your patches and one without.
>>
>> When your patches are used:
>>
>> --> On devices with multiple radio's, all radio's went deaf within a few
>> minutes without any notice in logs.
>>
>> --> Only a reboot solved the issue but everything goes deaf again within
>> a few minutes. (after dropping/adding some links)
>>
>>
>> Any idea?
> I would highly suspect the hasty wpa_supplicant patch more than the
> kernel patches.
>
> I suppose you don't have any wpa_supplicant verbose logs ? (with the -dd
> option).
>
> I don't have physical access to any hardware given the current crisis,
> but if you could tell which kernel and wpa_supplicant version you
> applied the patch on, and whether you took the patches from the mailing
> list or from git including the cleanup patches.
>
> Also, which driver/card did you use ? I mainly tested this with ath9k
> with ar93xx.


hw used:

1) (moving)

- cns3xxx board (GW2388)

- 4x pci ar9220 (ath9k)

2)

- imx6

- 2x ar93xx (ath9k)

Sw:

OpenWrt 19.07

Kernel: 4.14.174

mac80211: 4.19.112

wpa sup: 2.9


The timeslots to play are short, so I cannot easily test manually for 
extra verbosity using wpa_sup.
Using tcpdump shows EAPOL packets being exchanged but I guess it fails 
somewhere there.
I used the kernel patches from mailinglist (V3).

If you could cook up a clean patch properly implementing the required 
bits over there, I would be happy to test it again.


Regards,

Koen


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-08 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-05 13:57 [PATCH v3 1/2] cfg80211: Add support for userspace to reset stations in IBSS mode Nicolas Cavallari
2020-03-05 13:57 ` [PATCH v3 2/2] mac80211: Allow deleting stations in ibss mode to reset their state Nicolas Cavallari
2020-04-08 11:56   ` Koen Vandeputte
2020-04-08 14:31     ` Nicolas Cavallari
2020-04-08 15:02       ` Koen Vandeputte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).