e4711a8bdd1cf9c7e8065d30c7aa40b1eae352f6
[openwrt/staging/dedeckeh.git] /
1 From 90aa570a894a907d11f85ced43a248198e24acc1 Mon Sep 17 00:00:00 2001
2 From: Peter Oh <peter.oh@bowerswilkins.com>
3 Date: Tue, 17 Apr 2018 21:55:07 -0700
4 Subject: [PATCH 10/16] 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 ---
11 wpa_supplicant/ap.c | 71 ++++++++++++++++++++++++++++++-----------
12 wpa_supplicant/events.c | 1 +
13 2 files changed, 54 insertions(+), 18 deletions(-)
14
15 --- a/wpa_supplicant/ap.c
16 +++ b/wpa_supplicant/ap.c
17 @@ -1337,13 +1337,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)
20 {
21 - if (!wpa_s->ap_iface)
22 - return;
23 + struct hostapd_iface *iface = wpa_s->ap_iface;
24
25 + if (!wpa_s->ap_iface) {
26 + if (!wpa_s->ifmsh)
27 + return;
28 + else
29 + iface = wpa_s->ifmsh;
30 + }
31 wpa_s->assoc_freq = freq;
32 if (wpa_s->current_ssid)
33 wpa_s->current_ssid->frequency = freq;
34 - hostapd_event_ch_switch(wpa_s->ap_iface->bss[0], freq, ht,
35 + hostapd_event_ch_switch(iface->bss[0], freq, ht,
36 offset, width, cf1, cf2);
37 }
38
39 @@ -1540,10 +1545,16 @@ int wpas_ap_pmksa_cache_add_external(str
40 void wpas_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
41 struct dfs_event *radar)
42 {
43 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
44 - return;
45 + struct hostapd_iface *iface = wpa_s->ap_iface;
46 +
47 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
48 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
49 + return;
50 + else
51 + iface = wpa_s->ifmsh;
52 + }
53 wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
54 - hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq,
55 + hostapd_dfs_radar_detected(iface, radar->freq,
56 radar->ht_enabled, radar->chan_offset,
57 radar->chan_width,
58 radar->cf1, radar->cf2);
59 @@ -1553,10 +1564,16 @@ void wpas_event_dfs_radar_detected(struc
60 void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
61 struct dfs_event *radar)
62 {
63 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
64 - return;
65 + struct hostapd_iface *iface = wpa_s->ap_iface;
66 +
67 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
68 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
69 + return;
70 + else
71 + iface = wpa_s->ifmsh;
72 + }
73 wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq);
74 - hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq,
75 + hostapd_dfs_start_cac(iface, radar->freq,
76 radar->ht_enabled, radar->chan_offset,
77 radar->chan_width, radar->cf1, radar->cf2);
78 }
79 @@ -1565,10 +1582,16 @@ void wpas_event_dfs_cac_started(struct w
80 void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
81 struct dfs_event *radar)
82 {
83 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
84 - return;
85 + struct hostapd_iface *iface = wpa_s->ap_iface;
86 +
87 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
88 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
89 + return;
90 + else
91 + iface = wpa_s->ifmsh;
92 + }
93 wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
94 - hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq,
95 + hostapd_dfs_complete_cac(iface, 1, radar->freq,
96 radar->ht_enabled, radar->chan_offset,
97 radar->chan_width, radar->cf1, radar->cf2);
98 }
99 @@ -1577,10 +1600,16 @@ void wpas_event_dfs_cac_finished(struct
100 void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
101 struct dfs_event *radar)
102 {
103 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
104 - return;
105 + struct hostapd_iface *iface = wpa_s->ap_iface;
106 +
107 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
108 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
109 + return;
110 + else
111 + iface = wpa_s->ifmsh;
112 + }
113 wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
114 - hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq,
115 + hostapd_dfs_complete_cac(iface, 0, radar->freq,
116 radar->ht_enabled, radar->chan_offset,
117 radar->chan_width, radar->cf1, radar->cf2);
118 }
119 @@ -1589,10 +1618,16 @@ void wpas_event_dfs_cac_aborted(struct w
120 void wpas_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
121 struct dfs_event *radar)
122 {
123 - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
124 - return;
125 + struct hostapd_iface *iface = wpa_s->ap_iface;
126 +
127 + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) {
128 + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
129 + return;
130 + else
131 + iface = wpa_s->ifmsh;
132 + }
133 wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
134 - hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq,
135 + hostapd_dfs_nop_finished(iface, radar->freq,
136 radar->ht_enabled, radar->chan_offset,
137 radar->chan_width, radar->cf1, radar->cf2);
138 }
139 --- a/wpa_supplicant/events.c
140 +++ b/wpa_supplicant/events.c
141 @@ -4203,6 +4203,7 @@ void wpa_supplicant_event(void *ctx, enu
142 #ifdef CONFIG_AP
143 if (wpa_s->current_ssid->mode == WPAS_MODE_AP ||
144 wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO ||
145 + wpa_s->current_ssid->mode == WPAS_MODE_MESH ||
146 wpa_s->current_ssid->mode ==
147 WPAS_MODE_P2P_GROUP_FORMATION) {
148 wpas_ap_ch_switch(wpa_s, data->ch_switch.freq,