From: Antonio Prcela Date: Thu, 2 Feb 2023 23:02:07 +0000 (+0100) Subject: hostapd: Output hw_mode when using STATUS X-Git-Tag: hostap_2_11~1301 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec02a0e93654515db7476e2d8b4b419cad44d979;p=thirdparty%2Fhostap.git hostapd: Output hw_mode when using STATUS Adding the hw_mode config parameter to the STATUS output to easier determine the current hw_mode of an hostapd access-point. Currently neither STATUS, GET hw_mode, nor GET_CONFIG output it. 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 Signed-off-by: Antonio Prcela --- diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index 168e5f507..2a7c33bf9 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -212,6 +212,26 @@ static const char * timeout_next_str(int val) } +static const char * hw_mode_str(enum hostapd_hw_mode mode) +{ + switch (mode) { + case HOSTAPD_MODE_IEEE80211B: + return "b"; + case HOSTAPD_MODE_IEEE80211G: + return "g"; + case HOSTAPD_MODE_IEEE80211A: + return "a"; + case HOSTAPD_MODE_IEEE80211AD: + return "ad"; + case HOSTAPD_MODE_IEEE80211ANY: + return "any"; + case NUM_HOSTAPD_MODES: + return "invalid"; + } + return "unknown"; +} + + static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd, struct sta_info *sta, char *buf, size_t buflen) @@ -730,6 +750,14 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf, return len; len += ret; + if (mode) { + ret = os_snprintf(buf + len, buflen - len, "hw_mode=%s\n", + hw_mode_str(mode->mode)); + 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"