diff mbox series

nl80211: Don't set offchan-OK flag if doing on-channel frame.

Message ID 1553031264-16209-1-git-send-email-greearb@candelatech.com
State Accepted
Headers show
Series nl80211: Don't set offchan-OK flag if doing on-channel frame. | expand

Commit Message

Ben Greear March 19, 2019, 9:34 p.m. UTC
From: Ben Greear <greearb@candelatech.com>

I saw a case where the kernel's nl80211 rejected hostapd's attempt to
send a neighbor report response because nl80211 flagged the frame as
offchannel-OK, but kernel rejects because channel was on ch 100 and
so kernel failed thinking it was constrained by CAC.

So, don't even set the packet as off-channel OK if we are not transmitting
offchannel.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 src/drivers/driver_nl80211.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Jouni Malinen Jan. 3, 2020, 2:36 p.m. UTC | #1
On Tue, Mar 19, 2019 at 02:34:24PM -0700, greearb@candelatech.com wrote:
> I saw a case where the kernel's nl80211 rejected hostapd's attempt to
> send a neighbor report response because nl80211 flagged the frame as
> offchannel-OK, but kernel rejects because channel was on ch 100 and
> so kernel failed thinking it was constrained by CAC.
> 
> So, don't even set the packet as off-channel OK if we are not transmitting
> offchannel.

Thanks, applied with a change to make this apply only for AP mode to
avoid breaking something in station mode if bss->freq is not updated.
diff mbox series

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 77ac8ee..60efa7b 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -7447,10 +7447,11 @@  static int wpa_driver_nl80211_send_action(struct i802_bss *bss,
 	int ret = -1;
 	u8 *buf;
 	struct ieee80211_hdr *hdr;
+	int offchanok = (freq != bss->freq);
 
 	wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, "
-		   "freq=%u MHz wait=%d ms no_cck=%d)",
-		   drv->ifindex, freq, wait_time, no_cck);
+		   "freq=%u MHz wait=%d ms no_cck=%d offchanok=%d)",
+		   drv->ifindex, freq, wait_time, no_cck, offchanok);
 
 	buf = os_zalloc(24 + data_len);
 	if (buf == NULL)
@@ -7476,13 +7477,13 @@  static int wpa_driver_nl80211_send_action(struct i802_bss *bss,
 	     (int) freq == bss->freq || drv->device_ap_sme ||
 	     !drv->use_monitor))
 		ret = wpa_driver_nl80211_send_mlme(bss, buf, 24 + data_len,
-						   0, freq, no_cck, 1,
+						   0, freq, no_cck, offchanok,
 						   wait_time, NULL, 0);
 	else
 		ret = nl80211_send_frame_cmd(bss, freq, wait_time, buf,
 					     24 + data_len,
 					     &drv->send_action_cookie,
-					     no_cck, 0, 1, NULL, 0);
+					     no_cck, 0, offchanok, NULL, 0);
 
 	os_free(buf);
 	return ret;