dfd85f15755684a184fa33bc62c224ac0220a8cc
[openwrt/staging/svanheule.git] /
1 From ce3e491e445ebea9705e76ac7ee3d4841ace1cad Mon Sep 17 00:00:00 2001
2 From: Peter Oh <peter.oh@bowerswilkins.com>
3 Date: Tue, 17 Apr 2018 21:55:08 -0700
4 Subject: [PATCH 11/16] 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 @@ -2033,6 +2033,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 @@ -2109,8 +2111,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 @@ -2136,8 +2141,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 @@ -2227,8 +2235,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 @@ -2248,10 +2259,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;