blob: 29a3799b5e7aec43fc0dc2fbbafbfa11681f5f96 [file] [log] [blame]
developer7b43f2d2022-04-29 17:53:25 +08001--- a/wpa_supplicant/ap.c
2+++ b/wpa_supplicant/ap.c
developer198585d2022-09-22 17:12:54 +08003@@ -1803,15 +1803,35 @@ int ap_switch_channel(struct wpa_supplic
developer7b43f2d2022-04-29 17:53:25 +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