Upstreamed patches: 020-mesh-make-forwarding-configurable.patch e6db1bc5da3fd7d5f4dba24aa102543b4749912f 550-WNM-allow-specifying-dialog-token.patch 979f19716539362f8ce60a77bf1b88fdcf5ba8e5 720-ACS-fix-channel-100-frequency.patch 2341585c349231af00cdef8d51458df01bc6965f 741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch 08bdf4f90de61a84ed8f4dd918272dd9d36e2e1f Compile-tested: wpad-wolfssl hostapd-openssl Run-tested: ath79-generic Signed-off-by: David Bauer <mail@david-bauer.net> Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
		
			
				
	
	
		
			107 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			107 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From 8de8cd8380af0c43d4fde67a668d79ef73b26b26 Mon Sep 17 00:00:00 2001
 | 
						|
From: Peter Oh <peter.oh@bowerswilkins.com>
 | 
						|
Date: Tue, 30 Jun 2020 14:18:58 +0200
 | 
						|
Subject: [PATCH 10/19] mesh: Allow DFS channels to be selected if dfs is
 | 
						|
 enabled
 | 
						|
 | 
						|
Note: DFS is assumed to be usable if a country code has been set
 | 
						|
 | 
						|
Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
 | 
						|
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
 | 
						|
---
 | 
						|
 wpa_supplicant/wpa_supplicant.c | 25 +++++++++++++++++++------
 | 
						|
 1 file changed, 19 insertions(+), 6 deletions(-)
 | 
						|
 | 
						|
--- a/wpa_supplicant/wpa_supplicant.c
 | 
						|
+++ b/wpa_supplicant/wpa_supplicant.c
 | 
						|
@@ -2409,7 +2409,7 @@ static int drv_supports_vht(struct wpa_s
 | 
						|
 }
 | 
						|
 
 | 
						|
 
 | 
						|
-static bool ibss_mesh_is_80mhz_avail(int channel, struct hostapd_hw_modes *mode)
 | 
						|
+static bool ibss_mesh_is_80mhz_avail(int channel, struct hostapd_hw_modes *mode, bool dfs_enabled)
 | 
						|
 {
 | 
						|
 	int i;
 | 
						|
 
 | 
						|
@@ -2418,7 +2418,10 @@ static bool ibss_mesh_is_80mhz_avail(int
 | 
						|
 
 | 
						|
 		chan = hw_get_channel_chan(mode, i, NULL);
 | 
						|
 		if (!chan ||
 | 
						|
-		    chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
 | 
						|
+		    chan->flag & HOSTAPD_CHAN_DISABLED)
 | 
						|
+			return false;
 | 
						|
+		
 | 
						|
+		if (!dfs_enabled && chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
 | 
						|
 			return false;
 | 
						|
 	}
 | 
						|
 
 | 
						|
@@ -2447,6 +2450,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
 | 
						|
 	int chwidth, seg0, seg1;
 | 
						|
 	u32 vht_caps = 0;
 | 
						|
 	bool is_24ghz, is_6ghz;
 | 
						|
+	bool dfs_enabled = wpa_s->conf->country[0] &&
 | 
						|
+			   (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
 | 
						|
 
 | 
						|
 	freq->freq = ssid->frequency;
 | 
						|
 
 | 
						|
@@ -2543,8 +2548,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
 | 
						|
 		return;
 | 
						|
 
 | 
						|
 	/* Check primary channel flags */
 | 
						|
-	if (pri_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
 | 
						|
+	if (pri_chan->flag & HOSTAPD_CHAN_DISABLED)
 | 
						|
 		return;
 | 
						|
+	if (pri_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
 | 
						|
+		if (!dfs_enabled)
 | 
						|
+			return;
 | 
						|
 
 | 
						|
 	freq->channel = pri_chan->chan;
 | 
						|
 
 | 
						|
@@ -2577,8 +2585,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
 | 
						|
 		return;
 | 
						|
 
 | 
						|
 	/* Check secondary channel flags */
 | 
						|
-	if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
 | 
						|
+	if (sec_chan->flag & HOSTAPD_CHAN_DISABLED)
 | 
						|
 		return;
 | 
						|
+	if (sec_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
 | 
						|
+		if (!dfs_enabled)
 | 
						|
+			return;
 | 
						|
 
 | 
						|
 	if (ht40 == -1) {
 | 
						|
 		if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS))
 | 
						|
@@ -2667,7 +2678,7 @@ skip_to_6ghz:
 | 
						|
 		return;
 | 
						|
 
 | 
						|
 	/* Back to HT configuration if channel not usable */
 | 
						|
-	if (!ibss_mesh_is_80mhz_avail(channel, mode))
 | 
						|
+	if (!ibss_mesh_is_80mhz_avail(channel, mode, dfs_enabled))
 | 
						|
 		return;
 | 
						|
 
 | 
						|
 	chwidth = CHANWIDTH_80MHZ;
 | 
						|
@@ -2681,7 +2692,7 @@ skip_to_6ghz:
 | 
						|
 		 * above; check the remaining four 20 MHz channels for the total
 | 
						|
 		 * of 160 MHz bandwidth.
 | 
						|
 		 */
 | 
						|
-		if (!ibss_mesh_is_80mhz_avail(channel + 16, mode))
 | 
						|
+		if (!ibss_mesh_is_80mhz_avail(channel + 16, mode, dfs_enabled))
 | 
						|
 			return;
 | 
						|
 
 | 
						|
 		for (j = 0; j < ARRAY_SIZE(bw160); j++) {
 | 
						|
@@ -2711,10 +2722,12 @@ skip_to_6ghz:
 | 
						|
 				if (!chan)
 | 
						|
 					continue;
 | 
						|
 
 | 
						|
-				if (chan->flag & (HOSTAPD_CHAN_DISABLED |
 | 
						|
-						  HOSTAPD_CHAN_NO_IR |
 | 
						|
-						  HOSTAPD_CHAN_RADAR))
 | 
						|
+				if (chan->flag & HOSTAPD_CHAN_DISABLED)
 | 
						|
 					continue;
 | 
						|
+				if (chan->flag & (HOSTAPD_CHAN_RADAR |
 | 
						|
+						  HOSTAPD_CHAN_NO_IR))
 | 
						|
+					if (!dfs_enabled)
 | 
						|
+						continue;
 | 
						|
 
 | 
						|
 				/* Found a suitable second segment for 80+80 */
 | 
						|
 				chwidth = CHANWIDTH_80P80MHZ;
 |