| From 6b4c9657caeafecd1fc5c796327c5e6689ef1f24 Mon Sep 17 00:00:00 2001 |
| From: "fancy.liu" <fancy.liu@mediatek.com> |
| Date: Sun, 8 Oct 2023 15:16:55 +0800 |
| Subject: [PATCH] hostapd: mtk: 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 bf5eeb7..89594ec 100644 |
| --- a/hostapd/ctrl_iface.c |
| +++ b/hostapd/ctrl_iface.c |
| @@ -1119,6 +1119,7 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd, |
| { |
| int ret; |
| char *pos, *end; |
| + int i; |
| |
| pos = buf; |
| end = buf + buflen; |
| @@ -1290,6 +1291,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.18.0 |
| |