3f5178a74ba800fd088e3f8145bc58489719f3c8
[openwrt/staging/luka.git] /
1 From 9a8ca54a264a2820af614043e7af853166b320b0 Mon Sep 17 00:00:00 2001
2 From: Peter Oh <peter.oh@bowerswilkins.com>
3 Date: Tue, 29 May 2018 14:39:14 -0700
4 Subject: [PATCH 10/18] mesh: consider mesh interface on dfs event handler
5
6 Once mesh starts supporting DFS channels, it has to handle DFS related events
7 from drivers, hence add mesh interface to the check list.
8
9 Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
10 Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
11 ---
12 wpa_supplicant/ap.c | 71 ++++++++++++++++++++++++++++++-----------
13 wpa_supplicant/events.c | 7 ++--
14 2 files changed, 57 insertions(+), 21 deletions(-)
15
16 --- a/wpa_supplicant/ap.c
17 +++ b/wpa_supplicant/ap.c
18 @@ -1337,13 +1337,18 @@ int ap_ctrl_iface_chanswitch(struct wpa_
19 void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
20 int offset, int width, int cf1, int cf2)
21 {
22 - if (!wpa_s->ap_iface)
23 - return;
24 + struct hostapd_iface *iface = wpa_s->ap_iface;
25
26 + if (!wpa_s->ap_iface) {
27 + if (!wpa_s->ifmsh)
28 + return;
29 + else
30 + iface = wpa_s->ifmsh;
31 + }
32 wpa_s->assoc_freq = freq;
33 if (wpa_s->current_ssid)
34 wpa_s->current_ssid->frequency = freq;
35 - hostapd_event_ch_switch(wpa_s->ap_iface->bss[0], freq, ht,
36 + hostapd_event_ch_switch(iface->bss[0], freq, ht,
37 offset, width, cf1, cf2);
38 }
39
40 @@ -1540,10 +1545,16 @@ int wpas_ap_pmksa_cache_add_external(str
41 void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
42 struct dfs_event *radar)
43 {
44 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
45 - return;
46 + struct hostapd_iface *iface = wpa_s->ap_iface;
47 +
48 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
49 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
50 + return;
51 + else
52 + iface = wpa_s->ifmsh;
53 + }
54 wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
55 - hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq,
56 + hostapd_dfs_radar_detected(iface, radar->freq,
57 radar->ht_enabled, radar->chan_offset,
58 radar->chan_width,
59 radar->cf1, radar->cf2);
60 @@ -1553,10 +1564,16 @@ void wpas_ap_event_dfs_radar_detected(st
61 void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
62 struct dfs_event *radar)
63 {
64 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
65 - return;
66 + struct hostapd_iface *iface = wpa_s->ap_iface;
67 +
68 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
69 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
70 + return;
71 + else
72 + iface = wpa_s->ifmsh;
73 + }
74 wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq);
75 - hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq,
76 + hostapd_dfs_start_cac(iface, radar->freq,
77 radar->ht_enabled, radar->chan_offset,
78 radar->chan_width, radar->cf1, radar->cf2);
79 }
80 @@ -1565,10 +1582,16 @@ void wpas_ap_event_dfs_cac_started(struc
81 void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
82 struct dfs_event *radar)
83 {
84 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
85 - return;
86 + struct hostapd_iface *iface = wpa_s->ap_iface;
87 +
88 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
89 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
90 + return;
91 + else
92 + iface = wpa_s->ifmsh;
93 + }
94 wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
95 - hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq,
96 + hostapd_dfs_complete_cac(iface, 1, radar->freq,
97 radar->ht_enabled, radar->chan_offset,
98 radar->chan_width, radar->cf1, radar->cf2);
99 }
100 @@ -1577,10 +1600,16 @@ void wpas_ap_event_dfs_cac_finished(stru
101 void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
102 struct dfs_event *radar)
103 {
104 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
105 - return;
106 + struct hostapd_iface *iface = wpa_s->ap_iface;
107 +
108 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
109 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
110 + return;
111 + else
112 + iface = wpa_s->ifmsh;
113 + }
114 wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
115 - hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq,
116 + hostapd_dfs_complete_cac(iface, 0, radar->freq,
117 radar->ht_enabled, radar->chan_offset,
118 radar->chan_width, radar->cf1, radar->cf2);
119 }
120 @@ -1589,10 +1618,16 @@ void wpas_ap_event_dfs_cac_aborted(struc
121 void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
122 struct dfs_event *radar)
123 {
124 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
125 - return;
126 + struct hostapd_iface *iface = wpa_s->ap_iface;
127 +
128 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
129 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
130 + return;
131 + else
132 + iface = wpa_s->ifmsh;
133 + }
134 wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
135 - hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq,
136 + hostapd_dfs_nop_finished(iface, radar->freq,
137 radar->ht_enabled, radar->chan_offset,
138 radar->chan_width, radar->cf1, radar->cf2);
139 }
140 --- a/wpa_supplicant/events.c
141 +++ b/wpa_supplicant/events.c
142 @@ -3802,7 +3802,7 @@ static void wpas_event_dfs_cac_started(s
143 struct dfs_event *radar)
144 {
145 #if defined(NEED_AP_MLME) && defined(CONFIG_AP)
146 - if (wpa_s->ap_iface) {
147 + if (wpa_s->ap_iface || wpa_s->ifmsh) {
148 wpas_ap_event_dfs_cac_started(wpa_s, radar);
149 } else
150 #endif /* NEED_AP_MLME && CONFIG_AP */
151 @@ -3823,7 +3823,7 @@ static void wpas_event_dfs_cac_finished(
152 struct dfs_event *radar)
153 {
154 #if defined(NEED_AP_MLME) && defined(CONFIG_AP)
155 - if (wpa_s->ap_iface) {
156 + if (wpa_s->ap_iface || wpa_s->ifmsh) {
157 wpas_ap_event_dfs_cac_finished(wpa_s, radar);
158 } else
159 #endif /* NEED_AP_MLME && CONFIG_AP */
160 @@ -3839,7 +3839,7 @@ static void wpas_event_dfs_cac_aborted(s
161 struct dfs_event *radar)
162 {
163 #if defined(NEED_AP_MLME) && defined(CONFIG_AP)
164 - if (wpa_s->ap_iface) {
165 + if (wpa_s->ap_iface || wpa_s->ifmsh) {
166 wpas_ap_event_dfs_cac_aborted(wpa_s, radar);
167 } else
168 #endif /* NEED_AP_MLME && CONFIG_AP */
169 @@ -4278,6 +4278,7 @@ void wpa_supplicant_event(void *ctx, enu
170 #ifdef CONFIG_AP
171 if (wpa_s->current_ssid->mode == WPAS_MODE_AP ||
172 wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO ||
173 + wpa_s->current_ssid->mode == WPAS_MODE_MESH ||
174 wpa_s->current_ssid->mode ==
175 WPAS_MODE_P2P_GROUP_FORMATION) {
176 wpas_ap_ch_switch(wpa_s, data->ch_switch.freq,