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