1 From d3201adfe7d2219217a07ef16ef365ad59c1a89b Mon Sep 17 00:00:00 2001
2 From: Peter Oh <peter.oh@bowerswilkins.com>
3 Date: Tue, 29 May 2018 14:39:21 -0700
4 Subject: [PATCH 17/18] mesh: use right interface context to send DFS event
7 use mesh interface context to send DFS event messages when
8 DFS events are on mesh interface.
10 Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
11 Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
13 src/ap/dfs.c | 27 +++++++++++++++++++--------
14 1 file changed, 19 insertions(+), 8 deletions(-)
18 @@ -637,6 +637,17 @@ static unsigned int dfs_get_cac_time(str
22 +static void *get_message_ctx(struct hostapd_iface *iface)
26 + return iface->owner;
27 +#endif /* CONFIG_MESH */
29 + return iface->bss[0]->msg_ctx;
35 * 1 - continue channel/ap setup
36 @@ -719,7 +730,7 @@ int hostapd_handle_dfs(struct hostapd_if
37 /* Finally start CAC */
38 hostapd_set_state(iface, HAPD_IFACE_DFS);
39 wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq);
40 - wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
41 + wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_START
42 "freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds",
44 iface->conf->channel, iface->conf->secondary_channel,
45 @@ -768,7 +779,7 @@ int hostapd_dfs_complete_cac(struct host
46 int ht_enabled, int chan_offset, int chan_width,
49 - wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED
50 + wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_COMPLETED
51 "success=%d freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
52 success, freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
54 @@ -810,7 +821,7 @@ int hostapd_dfs_pre_cac_expired(struct h
55 int ht_enabled, int chan_offset, int chan_width,
58 - wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED
59 + wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED
60 "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
61 freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
63 @@ -848,7 +859,7 @@ static int hostapd_dfs_start_channel_swi
65 wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d",
67 - wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
68 + wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NEW_CHANNEL
69 "freq=%d chan=%d sec_chan=%d", channel->freq,
70 channel->chan, secondary_channel);
72 @@ -935,7 +946,7 @@ static int hostapd_dfs_start_channel_swi
74 wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d",
76 - wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
77 + wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NEW_CHANNEL
78 "freq=%d chan=%d sec_chan=%d", channel->freq,
79 channel->chan, secondary_channel);
81 @@ -997,7 +1008,7 @@ int hostapd_dfs_radar_detected(struct ho
85 - wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED
86 + wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_RADAR_DETECTED
87 "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
88 freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
90 @@ -1028,7 +1039,7 @@ int hostapd_dfs_nop_finished(struct host
91 int ht_enabled, int chan_offset, int chan_width,
94 - wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED
95 + wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_NOP_FINISHED
96 "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
97 freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
99 @@ -1078,7 +1089,7 @@ int hostapd_dfs_start_cac(struct hostapd
100 int ht_enabled, int chan_offset, int chan_width,
103 - wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
104 + wpa_msg(get_message_ctx(iface), MSG_INFO, DFS_EVENT_CAC_START
105 "freq=%d chan=%d chan_offset=%d width=%d seg0=%d "
106 "seg1=%d cac_time=%ds",
107 freq, (freq - 5000) / 5, chan_offset, chan_width, cf1, cf2, 60);