]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Output country_code and country3 when using STATUS
authorAntonio Prcela <antonio.prcela@gmail.com>
Mon, 20 Feb 2023 22:14:39 +0000 (23:14 +0100)
committerJouni Malinen <j@w1.fi>
Tue, 21 Feb 2023 15:33:03 +0000 (17:33 +0200)
Add 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.

This is 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@gmail.com>
Signed-off-by: Antonio Prcela <antonio.prcela@sartura.hr>
src/ap/ctrl_iface_ap.c

index 2a7c33bf944f6bb5f1410fc48465382f9daf2a09..45f31d9a04af831d0bb9616a3c5210cf8acd30d2 100644 (file)
@@ -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,16 @@ 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=%c%c\ncountry3=0x%X\n",
+                                 iconf->country[0], iconf->country[1],
+                                 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"