blob: 8784452876b22e4992f5d72e437b1abf9e00d3a0 [file] [log] [blame]
developer29c4d2d2022-12-26 19:41:22 +08001--- a/wpa_supplicant/ap.c
2+++ b/wpa_supplicant/ap.c
developer505c9432023-05-12 18:58:17 +08003@@ -1825,15 +1825,35 @@ int ap_switch_channel(struct wpa_supplic
developer29c4d2d2022-12-26 19:41:22 +08004
5
6 #ifdef CONFIG_CTRL_IFACE
7+
8+static int __ap_ctrl_iface_chanswitch(struct hostapd_iface *iface,
9+ struct csa_settings *settings)
10+{
11+#ifdef NEED_AP_MLME
12+ if (!iface || !iface->bss[0])
13+ return 0;
14+
15+ return hostapd_switch_channel(iface->bss[0], settings);
16+#else
17+ return -1;
18+#endif
19+}
20+
21+
22 int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos)
23 {
24 struct csa_settings settings;
25 int ret = hostapd_parse_csa_settings(pos, &settings);
26
27+ if (!(wpa_s->ap_iface && wpa_s->ap_iface->bss[0]) &&
28+ !(wpa_s->ifmsh && wpa_s->ifmsh->bss[0]))
29+ return -1;
30+
31+ ret = __ap_ctrl_iface_chanswitch(wpa_s->ap_iface, &settings);
32 if (ret)
33 return ret;
34
35- return ap_switch_channel(wpa_s, &settings);
36+ return __ap_ctrl_iface_chanswitch(wpa_s->ifmsh, &settings);
37 }
38 #endif /* CONFIG_CTRL_IFACE */
39