d948c41b30ba3943cd6d9abad1f137f3a3050768
[openwrt/staging/dangole.git] /
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
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 | 25 +++++++++++++++++++------
13 1 file changed, 19 insertions(+), 6 deletions(-)
14
15 --- a/wpa_supplicant/wpa_supplicant.c
16 +++ b/wpa_supplicant/wpa_supplicant.c
17 @@ -2395,6 +2395,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
18 int chwidth, seg0, seg1;
19 u32 vht_caps = 0;
20 int is_24ghz;
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 @@ -2484,8 +2486,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 freq->channel = pri_chan->chan;
38
39 @@ -2518,8 +2523,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 if (ht40 == -1) {
51 if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS))
52 @@ -2612,8 +2620,11 @@ skip_ht40:
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 = CHANWIDTH_80MHZ;
65 @@ -2633,10 +2644,12 @@ skip_ht40:
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 |
75 + HOSTAPD_CHAN_NO_IR))
76 + if (!dfs_enabled)
77 + continue;
78
79 /* Found a suitable second segment for 80+80 */
80 chwidth = CHANWIDTH_80P80MHZ;