]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mesh: Consider mesh interface on DFS event handler
authorPeter Oh <peter.oh@bowerswilkins.com>
Mon, 27 Aug 2018 21:28:44 +0000 (14:28 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 3 Jan 2019 11:31:55 +0000 (13:31 +0200)
Once mesh starts supporting DFS channels, it has to handle DFS related
events from drivers, hence add mesh interface to the check list.

Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
wpa_supplicant/ap.c
wpa_supplicant/events.c

index 7a25b3f6ae0c545adabfd4e25805b920fae6b50f..c651ad83ce8d13b72b148d894d6424484c833c66 100644 (file)
@@ -1383,13 +1383,16 @@ int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos)
 void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
                       int offset, int width, int cf1, int cf2)
 {
-       if (!wpa_s->ap_iface)
-               return;
+       struct hostapd_iface *iface = wpa_s->ap_iface;
 
+       if (!iface)
+               iface = wpa_s->ifmsh;
+       if (!iface)
+               return;
        wpa_s->assoc_freq = freq;
        if (wpa_s->current_ssid)
                wpa_s->current_ssid->frequency = freq;
-       hostapd_event_ch_switch(wpa_s->ap_iface->bss[0], freq, ht,
+       hostapd_event_ch_switch(iface->bss[0], freq, ht,
                                offset, width, cf1, cf2);
 }
 
@@ -1586,10 +1589,14 @@ int wpas_ap_pmksa_cache_add_external(struct wpa_supplicant *wpa_s, char *cmd)
 void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
                                      struct dfs_event *radar)
 {
-       if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
+       struct hostapd_iface *iface = wpa_s->ap_iface;
+
+       if (!iface)
+               iface = wpa_s->ifmsh;
+       if (!iface || !iface->bss[0])
                return;
        wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
-       hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq,
+       hostapd_dfs_radar_detected(iface, radar->freq,
                                   radar->ht_enabled, radar->chan_offset,
                                   radar->chan_width,
                                   radar->cf1, radar->cf2);
@@ -1599,10 +1606,14 @@ void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
 void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
                                   struct dfs_event *radar)
 {
-       if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
+       struct hostapd_iface *iface = wpa_s->ap_iface;
+
+       if (!iface)
+               iface = wpa_s->ifmsh;
+       if (!iface || !iface->bss[0])
                return;
        wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq);
-       hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq,
+       hostapd_dfs_start_cac(iface, radar->freq,
                              radar->ht_enabled, radar->chan_offset,
                              radar->chan_width, radar->cf1, radar->cf2);
 }
@@ -1611,10 +1622,14 @@ void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
 void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
                                    struct dfs_event *radar)
 {
-       if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
+       struct hostapd_iface *iface = wpa_s->ap_iface;
+
+       if (!iface)
+               iface = wpa_s->ifmsh;
+       if (!iface || !iface->bss[0])
                return;
        wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
-       hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq,
+       hostapd_dfs_complete_cac(iface, 1, radar->freq,
                                 radar->ht_enabled, radar->chan_offset,
                                 radar->chan_width, radar->cf1, radar->cf2);
 }
@@ -1623,10 +1638,14 @@ void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
 void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
                                   struct dfs_event *radar)
 {
-       if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
+       struct hostapd_iface *iface = wpa_s->ap_iface;
+
+       if (!iface)
+               iface = wpa_s->ifmsh;
+       if (!iface || !iface->bss[0])
                return;
        wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
-       hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq,
+       hostapd_dfs_complete_cac(iface, 0, radar->freq,
                                 radar->ht_enabled, radar->chan_offset,
                                 radar->chan_width, radar->cf1, radar->cf2);
 }
@@ -1635,10 +1654,14 @@ void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
 void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
                                        struct dfs_event *radar)
 {
-       if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
+       struct hostapd_iface *iface = wpa_s->ap_iface;
+
+       if (!iface)
+               iface = wpa_s->ifmsh;
+       if (!iface || !iface->bss[0])
                return;
        wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
-       hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq,
+       hostapd_dfs_nop_finished(iface, radar->freq,
                                 radar->ht_enabled, radar->chan_offset,
                                 radar->chan_width, radar->cf1, radar->cf2);
 }
index bdbe9920b2c56c339a3517bd4fe0dd3ae662e6fc..6fccf00f7f7cf318e7ec83aef88b3abc68b7d4eb 100644 (file)
@@ -3910,7 +3910,7 @@ static void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
                                       struct dfs_event *radar)
 {
 #if defined(NEED_AP_MLME) && defined(CONFIG_AP)
-       if (wpa_s->ap_iface) {
+       if (wpa_s->ap_iface || wpa_s->ifmsh) {
                wpas_ap_event_dfs_cac_started(wpa_s, radar);
        } else
 #endif /* NEED_AP_MLME && CONFIG_AP */
@@ -3931,7 +3931,7 @@ static void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
                                        struct dfs_event *radar)
 {
 #if defined(NEED_AP_MLME) && defined(CONFIG_AP)
-       if (wpa_s->ap_iface) {
+       if (wpa_s->ap_iface || wpa_s->ifmsh) {
                wpas_ap_event_dfs_cac_finished(wpa_s, radar);
        } else
 #endif /* NEED_AP_MLME && CONFIG_AP */
@@ -3947,7 +3947,7 @@ static void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
                                       struct dfs_event *radar)
 {
 #if defined(NEED_AP_MLME) && defined(CONFIG_AP)
-       if (wpa_s->ap_iface) {
+       if (wpa_s->ap_iface || wpa_s->ifmsh) {
                wpas_ap_event_dfs_cac_aborted(wpa_s, radar);
        } else
 #endif /* NEED_AP_MLME && CONFIG_AP */
@@ -4426,6 +4426,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 #ifdef CONFIG_AP
                if (wpa_s->current_ssid->mode == WPAS_MODE_AP ||
                    wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO ||
+                   wpa_s->current_ssid->mode == WPAS_MODE_MESH ||
                    wpa_s->current_ssid->mode ==
                    WPAS_MODE_P2P_GROUP_FORMATION) {
                        wpas_ap_ch_switch(wpa_s, data->ch_switch.freq,