Skip to contentSkip to conversation

nl80211: fix p2p go mgmt send failure on DFS channel

PATCH In review Liangwei Dong 2 participants 2 messages May 14, 2020 – May 25, 2020 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nl80211: fix p2p go mgmt send failure on DFS channel

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.

---
 net/wireless/nl80211.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
net/wireless/nl80211.c +10 -3
index 3d27b24c68b2..f33fd923bb19 100644
@@ -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);
 
Signature · 1 line
2.26.2
maintainer
#1 lore raw
Quoted 10 lines · Liangwei Dong

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?

net/wireless/nl80211.c static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) · line 10886

Quoted 13 lines
net/wireless/nl80211.c +9 -3
 	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