blob: abf47cb62ee283734cd9a759212199e24f2cd974 [file] [log] [blame]
From 0fc675cee8f27cbc0277820e9478201c4c8be625 Mon Sep 17 00:00:00 2001
From: "fancy.liu" <fancy.liu@mediatek.com>
Date: Sun, 8 Oct 2023 11:50:06 +0800
Subject: [PATCH 45/69] mtk: hostapd: Add ACS chanlist info in get_config
This patch is used to add ACS chanlist info displaying
for upper layer application obtaining.
Command format:
hostapd_cli -i phy0-ap0 get_config
Signed-off-by: fancy.liu <fancy.liu@mediatek.com>
---
hostapd/ctrl_iface.c | 59 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 6ed47ecce..056a35bc3 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1058,6 +1058,7 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
{
int ret;
char *pos, *end;
+ int i;
pos = buf;
end = buf + buflen;
@@ -1237,6 +1238,64 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
pos += ret;
}
+ /* dump chanlist */
+ if (hapd->iface->conf->acs_ch_list.num > 0) {
+ ret = os_snprintf(pos, end - pos, "chanlist=");
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+
+ for (i = 0; i < hapd->iface->conf->acs_ch_list.num; i++) {
+ if (i > 0) {
+ ret = os_snprintf(pos, end - pos, ", ");
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+ }
+
+ ret = os_snprintf(pos, end - pos, "%d-%d",
+ hapd->iface->conf->acs_ch_list.range[i].min,
+ hapd->iface->conf->acs_ch_list.range[i].max);
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+ }
+
+ ret = os_snprintf(pos, end - pos, "\n");
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+ }
+
+ /* dump freqlist */
+ if (hapd->iface->conf->acs_freq_list.num > 0) {
+ ret = os_snprintf(pos, end - pos, "freqlist=");
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+
+ for (i = 0; i < hapd->iface->conf->acs_freq_list.num; i++) {
+ if (i > 0) {
+ ret = os_snprintf(pos, end - pos, ", ");
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+ }
+
+ ret = os_snprintf(pos, end - pos, "%d-%d",
+ hapd->iface->conf->acs_freq_list.range[i].min,
+ hapd->iface->conf->acs_freq_list.range[i].max);
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+ }
+
+ ret = os_snprintf(pos, end - pos, "\n");
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+ }
+
return pos - buf;
}
--
2.39.2