184b6e9e9debf4c618fcc1ea1e68239556585a63
[librecmc/librecmc.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 @@ -2090,6 +2090,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 @@ -2166,8 +2168,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 @@ -2193,8 +2198,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 @@ -2284,8 +2292,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 @@ -2305,10 +2316,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;