blob: 7ea83ecbb6306987a3ac3ac9a3103c6836aeefac [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 0710501eee6f7a2c06fc8f0c5d3e4db8fddc349d Mon Sep 17 00:00:00 2001
2From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
3Date: Thu, 30 May 2024 11:24:54 +0800
4Subject: [PATCH 097/126] mtk: hostapd: add channel switch band sanity check
5
6Add band sanity check in case user selecting the wrong freq or link id
7
8Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
9---
10 hostapd/ctrl_iface.c | 7 +++++++
11 1 file changed, 7 insertions(+)
12
13diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
14index 2038a3712..14a0483bf 100644
15--- a/hostapd/ctrl_iface.c
16+++ b/hostapd/ctrl_iface.c
17@@ -2816,6 +2816,7 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
18 char *pos)
19 {
20 #ifdef NEED_AP_MLME
21+ struct hostapd_hw_modes *mode = iface->current_mode;
22 struct csa_settings settings;
23 int ret;
24 int dfs_range = 0;
25@@ -2835,6 +2836,12 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
26 settings.link_id = iface->bss[0]->mld_link_id;
27 #endif /* CONFIG_IEEE80211BE */
28
29+ if (!mode ||
30+ !is_same_band(mode->channels->freq, settings.freq_params.freq)) {
31+ wpa_printf(MSG_ERROR, "Invalid band for current mode");
32+ return -1;
33+ }
34+
35 ret = hostapd_ctrl_check_freq_params(&settings.freq_params,
36 settings.punct_bitmap);
37 if (ret) {
38--
392.18.0
40