All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nl80211: fix p2p go mgmt send failure on DFS channel
@ 2020-05-14  8:54 Liangwei Dong
  2020-05-25  8:40 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Liangwei Dong @ 2020-05-14  8:54 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, liangwei

Start Autonomous p2p GO on DFS channel and then trigger remote
p2p peer to connect to p2p GO. P2P remote device will send
P2P provision discovery request action frame to P2P GO on GO's
home channel - DFS. But when P2P GO sends Provision discovery
response action frame to P2P remote, Kernel rejects the mgmt
frame sending since Kernel doesn't allow "offchan" tx mgmt when
AP interface is active on DFS channel.

Fix by allow "offchan" tx mgmt if the requested channel is same
or compatible with AP's home channel.

Signed-off-by: Liangwei Dong <liangwei@codeaurora.org>
---
 net/wireless/nl80211.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 3d27b24c68b2..f33fd923bb19 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10807,6 +10807,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
 	struct cfg80211_registered_device *rdev = info->user_ptr[0];
 	struct wireless_dev *wdev = info->user_ptr[1];
 	struct cfg80211_chan_def chandef;
+	const struct cfg80211_chan_def *compat_chandef;
 	int err;
 	void *hdr = NULL;
 	u64 cookie;
@@ -10874,9 +10875,15 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
 		return -EINVAL;
 
 	wdev_lock(wdev);
-	if (params.offchan && !cfg80211_off_channel_oper_allowed(wdev)) {
-		wdev_unlock(wdev);
-		return -EBUSY;
+	if (params.offchan &&
+	    !cfg80211_off_channel_oper_allowed(wdev) &&
+	    !cfg80211_chandef_identical(&wdev->chandef, &chandef)) {
+		compat_chandef = cfg80211_chandef_compatible(&wdev->chandef,
+							     &chandef);
+		if (compat_chandef != &chandef) {
+			wdev_unlock(wdev);
+			return -EBUSY;
+		}
 	}
 	wdev_unlock(wdev);
 
-- 
2.26.2

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

* Re: [PATCH] nl80211: fix p2p go mgmt send failure on DFS channel
  2020-05-14  8:54 [PATCH] nl80211: fix p2p go mgmt send failure on DFS channel Liangwei Dong
@ 2020-05-25  8:40 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2020-05-25  8:40 UTC (permalink / raw)
  To: Liangwei Dong; +Cc: linux-wireless

On Thu, 2020-05-14 at 16:54 +0800, Liangwei Dong wrote:
> Start Autonomous p2p GO on DFS channel and then trigger remote
> p2p peer to connect to p2p GO. P2P remote device will send
> P2P provision discovery request action frame to P2P GO on GO's
> home channel - DFS. But when P2P GO sends Provision discovery
> response action frame to P2P remote, Kernel rejects the mgmt
> frame sending since Kernel doesn't allow "offchan" tx mgmt when
> AP interface is active on DFS channel.
> 
> Fix by allow "offchan" tx mgmt if the requested channel is same
> or compatible with AP's home channel.

Maybe we should just fix that in userland?

>  	wdev_lock(wdev);
> -	if (params.offchan && !cfg80211_off_channel_oper_allowed(wdev)) {
> -		wdev_unlock(wdev);
> -		return -EBUSY;
> +	if (params.offchan &&
> +	    !cfg80211_off_channel_oper_allowed(wdev) &&
> +	    !cfg80211_chandef_identical(&wdev->chandef, &chandef)) {
> +		compat_chandef = cfg80211_chandef_compatible(&wdev->chandef,
> +							     &chandef);
> +		if (compat_chandef != &chandef) {
> +			wdev_unlock(wdev);
> +			return -EBUSY;
> +		}

We'll surely have a 20 MHz channel as "chandef", so there's not much
point in checking the compat_chandef for == &chandef, but rather if
compat_chandef is non-NULL we're fine?

Also, chandef_compatible() already checks for identical, so no need to
do that here before.

johannes


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

end of thread, other threads:[~2020-05-25  8:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14  8:54 [PATCH] nl80211: fix p2p go mgmt send failure on DFS channel Liangwei Dong
2020-05-25  8:40 ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.