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
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.
9 Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
10 Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
12 wpa_supplicant/ap.c | 71 ++++++++++++++++++++++++++++++-----------
13 wpa_supplicant/events.c | 7 ++--
14 2 files changed, 57 insertions(+), 21 deletions(-)
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)
22 - if (!wpa_s->ap_iface)
24 + struct hostapd_iface *iface = wpa_s->ap_iface;
26 + if (!wpa_s->ap_iface) {
30 + iface = wpa_s->ifmsh;
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);
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)
44 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
46 + struct hostapd_iface *iface = wpa_s->ap_iface;
48 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
49 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
52 + iface = wpa_s->ifmsh;
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,
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)
64 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
66 + struct hostapd_iface *iface = wpa_s->ap_iface;
68 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
69 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
72 + iface = wpa_s->ifmsh;
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);
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)
84 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
86 + struct hostapd_iface *iface = wpa_s->ap_iface;
88 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
89 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
92 + iface = wpa_s->ifmsh;
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);
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)
104 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
106 + struct hostapd_iface *iface = wpa_s->ap_iface;
108 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
109 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
112 + iface = wpa_s->ifmsh;
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);
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)
124 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
126 + struct hostapd_iface *iface = wpa_s->ap_iface;
128 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
129 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
132 + iface = wpa_s->ifmsh;
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);
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)
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);
150 #endif /* NEED_AP_MLME && CONFIG_AP */
151 @@ -3823,7 +3823,7 @@ static void wpas_event_dfs_cac_finished(
152 struct dfs_event *radar)
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);
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)
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);
168 #endif /* NEED_AP_MLME && CONFIG_AP */
169 @@ -4278,6 +4278,7 @@ void wpa_supplicant_event(void *ctx, enu
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,