blob: 4a5852af2e45584296a601471c06f32281174b92 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From: Felix Fietkau <nbd@nbd.name>
2Date: Mon, 28 Jan 2019 21:36:44 +0100
3Subject: [PATCH] wpa_supplicant: fix calling channel switch via wpa_cli on
4 mesh interfaces
5
6--- a/wpa_supplicant/ap.c
7+++ b/wpa_supplicant/ap.c
8@@ -1846,17 +1846,37 @@ int ap_switch_channel(struct wpa_supplic
9
10
11 #ifdef CONFIG_CTRL_IFACE
12+
13+static int __ap_ctrl_iface_chanswitch(struct hostapd_iface *iface,
14+ struct csa_settings *settings)
15+{
16+#ifdef NEED_AP_MLME
17+ if (!iface || !iface->bss[0])
18+ return 0;
19+
20+ return hostapd_switch_channel(iface->bss[0], settings);
21+#else
22+ return -1;
23+#endif
24+}
25+
26+
27 int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos)
28 {
29 struct csa_settings settings;
30 int ret = hostapd_parse_csa_settings(pos, &settings);
31
32- if (ret)
33- return ret;
34+ if (!(wpa_s->ap_iface && wpa_s->ap_iface->bss[0]) &&
35+ !(wpa_s->ifmsh && wpa_s->ifmsh->bss[0]))
36+ return -1;
37
38 settings.link_id = -1;
39
40- return ap_switch_channel(wpa_s, &settings);
41+ ret = __ap_ctrl_iface_chanswitch(wpa_s->ap_iface, &settings);
42+ if (ret)
43+ return ret;
44+
45+ return __ap_ctrl_iface_chanswitch(wpa_s->ifmsh, &settings);
46 }
47 #endif /* CONFIG_CTRL_IFACE */
48