blob: d87fef046ed93c31d6b143a73b99066a5ac59776 [file] [log] [blame]
From 9639b495a347cdd2aadbe2bc2d336b4398518d29 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 065/104] 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 ed383df7d..581acc260 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