8f2f6a78eed3b80b32e8e164caa039c60e59b37b
[openwrt/staging/luka.git] /
1 From bbaa6142eadf229334436fdbf51aa65bb819f771 Mon Sep 17 00:00:00 2001
2 From: Peter Oh <peter.oh@bowerswilkins.com>
3 Date: Tue, 29 May 2018 14:39:15 -0700
4 Subject: [PATCH 11/18] mesh: Allow DFS channels to be selected if dfs is
5 enabled
6
7 Note: DFS is assumed to be usable if a country code has been set
8
9 Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
10 Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
11 ---
12 wpa_supplicant/wpa_supplicant.c | 24 ++++++++++++++++++------
13 1 file changed, 18 insertions(+), 6 deletions(-)
14
15 --- a/wpa_supplicant/wpa_supplicant.c
16 +++ b/wpa_supplicant/wpa_supplicant.c
17 @@ -2060,6 +2060,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
18 struct hostapd_freq_params vht_freq;
19 int chwidth, seg0, seg1;
20 u32 vht_caps = 0;
21 + int dfs_enabled = wpa_s->conf->country[0] &&
22 + (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
23
24 freq->freq = ssid->frequency;
25
26 @@ -2136,8 +2138,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
27 return;
28
29 /* Check primary channel flags */
30 - if (pri_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
31 + if (pri_chan->flag & HOSTAPD_CHAN_DISABLED)
32 return;
33 + if (pri_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
34 + if (!dfs_enabled)
35 + return;
36
37 #ifdef CONFIG_HT_OVERRIDES
38 if (ssid->disable_ht40)
39 @@ -2163,8 +2168,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
40 return;
41
42 /* Check secondary channel flags */
43 - if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
44 + if (sec_chan->flag & HOSTAPD_CHAN_DISABLED)
45 return;
46 + if (sec_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
47 + if (!dfs_enabled)
48 + return;
49
50 freq->channel = pri_chan->chan;
51
52 @@ -2254,8 +2262,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
53 return;
54
55 /* Back to HT configuration if channel not usable */
56 - if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
57 + if (chan->flag & HOSTAPD_CHAN_DISABLED)
58 return;
59 + if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
60 + if (!dfs_enabled)
61 + return;
62 }
63
64 chwidth = VHT_CHANWIDTH_80MHZ;
65 @@ -2275,10 +2286,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
66 if (!chan)
67 continue;
68
69 - if (chan->flag & (HOSTAPD_CHAN_DISABLED |
70 - HOSTAPD_CHAN_NO_IR |
71 - HOSTAPD_CHAN_RADAR))
72 + if (chan->flag & HOSTAPD_CHAN_DISABLED)
73 continue;
74 + if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
75 + if (!dfs_enabled)
76 + continue;
77
78 /* Found a suitable second segment for 80+80 */
79 chwidth = VHT_CHANWIDTH_80P80MHZ;