diff mbox

[RFC,3/6] mesh: Allow DFS channels to be selected if dfs is enabled

Message ID 20161128153843.3179-4-benjamin@sipsolutions.net
State RFC
Headers show

Commit Message

Benjamin Berg Nov. 28, 2016, 3:38 p.m. UTC
Note: DFS is assumed to be usable if a country code has been set
Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
---
 wpa_supplicant/wpa_supplicant.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

Comments

Jouni Malinen Dec. 1, 2016, 6:55 p.m. UTC | #1
On Mon, Nov 28, 2016 at 04:38:40PM +0100, Benjamin Berg wrote:
> Note: DFS is assumed to be usable if a country code has been set

> diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
> @@ -1862,6 +1862,9 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
>  	struct hostapd_freq_params vht_freq;
>  	int chwidth, seg0, seg1;
>  	u32 vht_caps = 0;
> +	/* Assume DFS is allowed if country is set for now! */
> +	int dfs_enabled = wpa_s->conf->country[0] &&
> +			  (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);

This function is used both for IBSS and mesh. Did you have something
here or in the other patches to prevent IBSS from getting the DFS
capability? These should be kept separate for IBSS and mesh since the
rules are likely somewhat different on who controls operations and also
on how to expected non-DFS-capable devices to behave. In other words,
let's not enable DFS for IBSS as part of this set unless someone has
really tested and thought about that case as well.
diff mbox

Patch

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 5d6326a..3f37077 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1862,6 +1862,9 @@  void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
 	struct hostapd_freq_params vht_freq;
 	int chwidth, seg0, seg1;
 	u32 vht_caps = 0;
+	/* Assume DFS is allowed if country is set for now! */
+	int dfs_enabled = wpa_s->conf->country[0] &&
+			  (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
 
 	freq->freq = ssid->frequency;
 
@@ -1938,7 +1941,9 @@  void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
 		return;
 
 	/* Check primary channel flags */
-	if (pri_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
+	if ((pri_chan->flag & HOSTAPD_CHAN_DISABLED) ||
+	    (!dfs_enabled && !(pri_chan->flag & HOSTAPD_CHAN_RADAR) &&
+	     (pri_chan->flag & HOSTAPD_CHAN_NO_IR)))
 		return;
 
 #ifdef CONFIG_HT_OVERRIDES
@@ -1965,7 +1970,9 @@  void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
 		return;
 
 	/* Check secondary channel flags */
-	if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
+	if ((sec_chan->flag & HOSTAPD_CHAN_DISABLED) ||
+	    (!dfs_enabled && !(sec_chan->flag & HOSTAPD_CHAN_RADAR) &&
+	     (sec_chan->flag & HOSTAPD_CHAN_NO_IR)))
 		return;
 
 	freq->channel = pri_chan->chan;
@@ -2049,7 +2056,9 @@  void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
 			return;
 
 		/* Back to HT configuration if channel not usable */
-		if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
+		if ((chan->flag & HOSTAPD_CHAN_DISABLED) ||
+		    (!dfs_enabled && !(chan->flag & HOSTAPD_CHAN_RADAR) &&
+		     (chan->flag & HOSTAPD_CHAN_NO_IR)))
 			return;
 	}
 
@@ -2070,9 +2079,9 @@  void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
 				if (!chan)
 					continue;
 
-				if (chan->flag & (HOSTAPD_CHAN_DISABLED |
-						  HOSTAPD_CHAN_NO_IR |
-						  HOSTAPD_CHAN_RADAR))
+				if ((chan->flag & HOSTAPD_CHAN_DISABLED) ||
+				    (!dfs_enabled && !(chan->flag & HOSTAPD_CHAN_RADAR) &&
+				     (chan->flag & HOSTAPD_CHAN_NO_IR)))
 					continue;
 
 				/* Found a suitable second segment for 80+80 */