Adding the country_code and country3 config parameter to the STATUS output to easier determine the current values for each of an hostapd access-point. Currently neither STATUS, GET [country_code/country3] nor GET_CONFIG output it. country3 seems to be always set, or at least 0x20 (' '), whereas country_code can be empty. Useful if the hostapd access point has been created with wpa_ctrl_request() without using a *.conf file (like hostapd.conf). Signed-off-by: Antonio Prcela <antonio.prcela@xxxxxxxxx> Signed-off-by: Antonio Prcela <antonio.prcela@xxxxxxxxxx> --- src/ap/ctrl_iface_ap.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index 2a7c33bf9..374d1aa77 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -716,6 +716,7 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf, { struct hostapd_iface *iface = hapd->iface; struct hostapd_hw_modes *mode = iface->current_mode; + struct hostapd_config *iconf = hapd->iconf; int len = 0, ret, j; size_t i; @@ -758,6 +759,22 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf, len += ret; } + if (iconf->country[0] && iconf->country[1]) { + ret = os_snprintf(buf + len, buflen - len, + "country_code=%.2s\n", + iconf->country); + if (os_snprintf_error(buflen - len, ret)) + return len; + len += ret; + } + + ret = os_snprintf(buf + len, buflen - len, + "country3=0x%X\n", + iconf->country[2]); + if (os_snprintf_error(buflen - len, ret)) + return len; + len += ret; + if (!iface->cac_started || !iface->dfs_cac_ms) { ret = os_snprintf(buf + len, buflen - len, "cac_time_seconds=%d\n" -- 2.39.2
From 4718f4e5b11f566dfea4f12394c8cf2616196d5e Mon Sep 17 00:00:00 2001 From: Antonio Prcela <antonio.prcela@xxxxxxxxx> Date: Mon, 20 Feb 2023 23:00:25 +0100 Subject: [PATCH] hostapd: Output country_code and country3 when using STATUS Adding the country_code and country3 config parameter to the STATUS output to easier determine the current values for each of an hostapd access-point. Currently neither STATUS, GET [country_code/country3] nor GET_CONFIG output it. country3 seems to be always set, or at least 0x20 (' '), whereas country_code can be empty. Useful if the hostapd access point has been created with wpa_ctrl_request() without using a *.conf file (like hostapd.conf). Signed-off-by: Antonio Prcela <antonio.prcela@xxxxxxxxx> Signed-off-by: Antonio Prcela <antonio.prcela@xxxxxxxxxx> --- src/ap/ctrl_iface_ap.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index 2a7c33bf9..374d1aa77 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -716,6 +716,7 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf, { struct hostapd_iface *iface = hapd->iface; struct hostapd_hw_modes *mode = iface->current_mode; + struct hostapd_config *iconf = hapd->iconf; int len = 0, ret, j; size_t i; @@ -758,6 +759,22 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf, len += ret; } + if (iconf->country[0] && iconf->country[1]) { + ret = os_snprintf(buf + len, buflen - len, + "country_code=%.2s\n", + iconf->country); + if (os_snprintf_error(buflen - len, ret)) + return len; + len += ret; + } + + ret = os_snprintf(buf + len, buflen - len, + "country3=0x%X\n", + iconf->country[2]); + if (os_snprintf_error(buflen - len, ret)) + return len; + len += ret; + if (!iface->cac_started || !iface->dfs_cac_ms) { ret = os_snprintf(buf + len, buflen - len, "cac_time_seconds=%d\n" -- 2.39.2
_______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap