1 From 8de8cd8380af0c43d4fde67a668d79ef73b26b26 Mon Sep 17 00:00:00 2001
2 From: Peter Oh <peter.oh@bowerswilkins.com>
3 Date: Tue, 30 Jun 2020 14:18:58 +0200
4 Subject: [PATCH 10/19] mesh: Allow DFS channels to be selected if dfs is
7 Note: DFS is assumed to be usable if a country code has been set
9 Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
10 Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
12 wpa_supplicant/wpa_supplicant.c | 25 +++++++++++++++++++------
13 1 file changed, 19 insertions(+), 6 deletions(-)
15 --- a/wpa_supplicant/wpa_supplicant.c
16 +++ b/wpa_supplicant/wpa_supplicant.c
17 @@ -2436,7 +2436,7 @@ static int drv_supports_vht(struct wpa_s
21 -static bool ibss_mesh_is_80mhz_avail(int channel, struct hostapd_hw_modes *mode)
22 +static bool ibss_mesh_is_80mhz_avail(int channel, struct hostapd_hw_modes *mode, bool dfs_enabled)
26 @@ -2445,7 +2445,10 @@ static bool ibss_mesh_is_80mhz_avail(int
28 chan = hw_get_channel_chan(mode, i, NULL);
30 - chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
31 + chan->flag & HOSTAPD_CHAN_DISABLED)
34 + if (!dfs_enabled && chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
38 @@ -2474,6 +2477,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
39 int chwidth, seg0, seg1;
41 bool is_24ghz, is_6ghz;
42 + bool dfs_enabled = wpa_s->conf->country[0] &&
43 + (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
45 freq->freq = ssid->frequency;
47 @@ -2570,8 +2575,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
50 /* Check primary channel flags */
51 - if (pri_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
52 + if (pri_chan->flag & HOSTAPD_CHAN_DISABLED)
54 + if (pri_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
58 freq->channel = pri_chan->chan;
60 @@ -2604,8 +2612,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
63 /* Check secondary channel flags */
64 - if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
65 + if (sec_chan->flag & HOSTAPD_CHAN_DISABLED)
67 + if (sec_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
72 if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS))
73 @@ -2694,7 +2705,7 @@ skip_to_6ghz:
76 /* Back to HT configuration if channel not usable */
77 - if (!ibss_mesh_is_80mhz_avail(channel, mode))
78 + if (!ibss_mesh_is_80mhz_avail(channel, mode, dfs_enabled))
81 chwidth = CONF_OPER_CHWIDTH_80MHZ;
82 @@ -2708,7 +2719,7 @@ skip_to_6ghz:
83 * above; check the remaining four 20 MHz channels for the total
84 * of 160 MHz bandwidth.
86 - if (!ibss_mesh_is_80mhz_avail(channel + 16, mode))
87 + if (!ibss_mesh_is_80mhz_avail(channel + 16, mode, dfs_enabled))
90 for (j = 0; j < ARRAY_SIZE(bw160); j++) {
91 @@ -2738,10 +2749,12 @@ skip_to_6ghz:
95 - if (chan->flag & (HOSTAPD_CHAN_DISABLED |
96 - HOSTAPD_CHAN_NO_IR |
97 - HOSTAPD_CHAN_RADAR))
98 + if (chan->flag & HOSTAPD_CHAN_DISABLED)
100 + if (chan->flag & (HOSTAPD_CHAN_RADAR |
101 + HOSTAPD_CHAN_NO_IR))
105 /* Found a suitable second segment for 80+80 */
106 chwidth = CONF_OPER_CHWIDTH_80P80MHZ;