[RFC 3/6] mesh: Allow DFS channels to be selected if dfs is enabled
Benjamin Berg
benjamin at sipsolutions.net
Mon Nov 28 07:38:40 PST 2016
Note: DFS is assumed to be usable if a country code has been set
Signed-off-by: Benjamin Berg <benjamin at sipsolutions.net>
---
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
More information about the Hostap
mailing list