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 <antonio.prcela@gmail.com>
Signed-off-by: Antonio Prcela <antonio.prcela@sartura.hr>
This commit is contained in:
Antonio Prcela 2023-02-03 00:02:07 +01:00 committed by Jouni Malinen
parent 390e24c6cb
commit ec02a0e936

View file

@ -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"