[v8,12/16] mesh: Allow DFS channels to be selected if dfs is enabled
diff mbox series

Message ID 4f889807b2b07973f5bec68ed73c0e3dd7061064.1535403927.git.peter.oh@bowerswilkins.com
State Changes Requested
Headers show
Series
  • mesh: enable DFS channels in mesh mode
Related show

Commit Message

Peter Oh Aug. 27, 2018, 9:28 p.m. UTC
From: Peter Oh <peter.oh@bowerswilkins.com>

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 | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

Comments

Jouni Malinen Jan. 3, 2019, 1:40 p.m. UTC | #1
On Mon, Aug 27, 2018 at 02:28:45PM -0700, peter.oh@bowerswilkins.com 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
> @@ -2087,6 +2087,8 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
>  	int chwidth, seg0, seg1;
>  	u32 vht_caps = 0;
> +	int dfs_enabled = wpa_s->conf->country[0] &&
> +		(wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);

That looks strange.. Wouldn't that apply for non-DFS channels as well?

Please also clearly identify the potential impact this might have on
IBSS since this function is used for both mesh and IBSS. I would not
want accidentally enable something unexpected for IBSS as part of these
mesh related changes.

>  	/* 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;

That looks like an overly complex way of doing:

	if ((pri->chan->flag & HOSTAPD_CHAN_DISABLED) ||
	    ((pri->chan->flags & HOSTAPD_CHAN_NO_IR) && !dfs_enabled))
		return;

dfs_enabled should really be accurate here, though, to avoid impact on
non-DFS channels.

>  	/* 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;

Same here.

>  		/* Back to HT configuration if channel not usable */
> -		if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
> +		if (chan->flag & HOSTAPD_CHAN_DISABLED)
>  			return;
> +		if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
> +			if (!dfs_enabled)
> +				return;

And here.

> -				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;

And with a small addition here as well.

Patch
diff mbox series

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 8bd2727..fe4e48f 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2087,6 +2087,8 @@  void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
 	struct hostapd_freq_params vht_freq;
 	int chwidth, seg0, seg1;
 	u32 vht_caps = 0;
+	int dfs_enabled = wpa_s->conf->country[0] &&
+		(wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
 
 	freq->freq = ssid->frequency;
 
@@ -2163,8 +2165,11 @@  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)
 		return;
+	if (pri_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
+		if (!dfs_enabled)
+			return;
 
 #ifdef CONFIG_HT_OVERRIDES
 	if (ssid->disable_ht40)
@@ -2190,8 +2195,11 @@  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)
 		return;
+	if (sec_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
+		if (!dfs_enabled)
+			return;
 
 	freq->channel = pri_chan->chan;
 
@@ -2281,8 +2289,11 @@  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)
 			return;
+		if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
+			if (!dfs_enabled)
+				return;
 	}
 
 	chwidth = VHT_CHANWIDTH_80MHZ;
@@ -2302,10 +2313,11 @@  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)
 					continue;
+				if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
+					if (!dfs_enabled)
+						continue;
 
 				/* Found a suitable second segment for 80+80 */
 				chwidth = VHT_CHANWIDTH_80P80MHZ;