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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Note: DFS is assumed to be usable if a country code has been set
Signed-off-by: Benjamin Berg <benjamin@xxxxxxxxxxxxxxxx>
---
 wpa_supplicant/wpa_supplicant.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

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


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux