1 From d0a0e1030005834b99225feb64ec3794d31beab0 Mon Sep 17 00:00:00 2001
2 From: Peter Oh <peter.oh@bowerswilkins.com>
3 Date: Thu, 12 Apr 2018 02:49:07 -0700
4 Subject: [PATCH 10/15] 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>
11 wpa_supplicant/ap.c | 55 ++++++++++++++++++++++++++++++++---------
12 wpa_supplicant/events.c | 1 +
13 2 files changed, 44 insertions(+), 12 deletions(-)
15 --- a/wpa_supplicant/ap.c
16 +++ b/wpa_supplicant/ap.c
17 @@ -1328,13 +1328,18 @@ int ap_ctrl_iface_chanswitch(struct wpa_
18 void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
19 int offset, int width, int cf1, int cf2)
21 + struct hostapd_iface *iface = wpa_s->ap_iface;
28 + iface = wpa_s->ifmsh;
30 wpa_s->assoc_freq = freq;
31 if (wpa_s->current_ssid)
32 wpa_s->current_ssid->frequency = freq;
33 - hostapd_event_ch_switch(wpa_s->ap_iface->bss[0], freq, ht,
34 + hostapd_event_ch_switch(iface->bss[0], freq, ht,
35 offset, width, cf1, cf2);
38 @@ -1531,10 +1536,15 @@ int wpas_ap_pmksa_cache_add_external(str
39 void wpas_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
40 struct dfs_event *radar)
42 + struct hostapd_iface *iface = wpa_s->ap_iface;
44 if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
46 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
49 + iface = wpa_s->ifmsh;
50 wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
51 - hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq,
52 + hostapd_dfs_radar_detected(iface, radar->freq,
53 radar->ht_enabled, radar->chan_offset,
55 radar->cf1, radar->cf2);
56 @@ -1544,10 +1554,15 @@ void wpas_event_dfs_radar_detected(struc
57 void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
58 struct dfs_event *radar)
60 + struct hostapd_iface *iface = wpa_s->ap_iface;
62 if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
64 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
67 + iface = wpa_s->ifmsh;
68 wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq);
69 - hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq,
70 + hostapd_dfs_start_cac(iface, radar->freq,
71 radar->ht_enabled, radar->chan_offset,
72 radar->chan_width, radar->cf1, radar->cf2);
74 @@ -1556,10 +1571,16 @@ void wpas_event_dfs_cac_started(struct w
75 void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
76 struct dfs_event *radar)
78 + struct hostapd_iface *iface = wpa_s->ap_iface;
80 if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
82 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
85 + iface = wpa_s->ifmsh;
87 wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
88 - hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq,
89 + hostapd_dfs_complete_cac(iface, 1, radar->freq,
90 radar->ht_enabled, radar->chan_offset,
91 radar->chan_width, radar->cf1, radar->cf2);
93 @@ -1568,10 +1589,15 @@ void wpas_event_dfs_cac_finished(struct
94 void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
95 struct dfs_event *radar)
97 + struct hostapd_iface *iface = wpa_s->ap_iface;
99 if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
101 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
104 + iface = wpa_s->ifmsh;
105 wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
106 - hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq,
107 + hostapd_dfs_complete_cac(iface, 0, radar->freq,
108 radar->ht_enabled, radar->chan_offset,
109 radar->chan_width, radar->cf1, radar->cf2);
111 @@ -1580,10 +1606,15 @@ void wpas_event_dfs_cac_aborted(struct w
112 void wpas_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
113 struct dfs_event *radar)
115 + struct hostapd_iface *iface = wpa_s->ap_iface;
117 if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
119 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
122 + iface = wpa_s->ifmsh;
123 wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
124 - hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq,
125 + hostapd_dfs_nop_finished(iface, radar->freq,
126 radar->ht_enabled, radar->chan_offset,
127 radar->chan_width, radar->cf1, radar->cf2);
129 --- a/wpa_supplicant/events.c
130 +++ b/wpa_supplicant/events.c
131 @@ -4168,6 +4168,7 @@ void wpa_supplicant_event(void *ctx, enu
133 if (wpa_s->current_ssid->mode == WPAS_MODE_AP ||
134 wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO ||
135 + wpa_s->current_ssid->mode == WPAS_MODE_MESH ||
136 wpa_s->current_ssid->mode ==
137 WPAS_MODE_P2P_GROUP_FORMATION) {
138 wpas_ap_ch_switch(wpa_s, data->ch_switch.freq,