Index: hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/ap.c =================================================================== --- hostapd-2023-02-21-ath12.3-cs.orig/wpa_supplicant/ap.c +++ hostapd-2023-02-21-ath12.3-cs/wpa_supplicant/ap.c @@ -1852,25 +1852,35 @@ int ap_switch_channel(struct wpa_supplic #ifdef CONFIG_CTRL_IFACE -int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos) + +static int __ap_ctrl_iface_chanswitch(struct hostapd_iface *iface, + struct csa_settings *settings) { - struct csa_settings settings; - int ret; +#ifdef NEED_AP_MLME + if (!iface || !iface->bss[0]) + return 0; + + return hostapd_switch_channel(iface->bss[0], settings); +#else + return -1; +#endif +} - if (wpa_s->ifmsh && wpa_s->ifmsh->conf->disable_csa_dfs == 1) { - wpa_printf(MSG_DEBUG, "wpa chanswitch interface %s :" - " cancelling radar handling timeout", - wpa_s->ifmsh->conf->bss[0]->iface); - eloop_cancel_timeout(hostapd_dfs_radar_handling_timeout, - wpa_s->ifmsh, NULL); - } - ret = hostapd_parse_csa_settings(pos, &settings); +int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos) +{ + struct csa_settings settings; + int ret = hostapd_parse_csa_settings(pos, &settings); + + if (!(wpa_s->ap_iface && wpa_s->ap_iface->bss[0]) && + !(wpa_s->ifmsh && wpa_s->ifmsh->bss[0])) + return -1; + ret = __ap_ctrl_iface_chanswitch(wpa_s->ap_iface, &settings); if (ret) return ret; - return ap_switch_channel(wpa_s, &settings); + return __ap_ctrl_iface_chanswitch(wpa_s->ifmsh, &settings); } #endif /* CONFIG_CTRL_IFACE */