Add DRIVER-STATUS command for hostapd

This is just like the same command in wpa_supplicant, i.e., "hostapd_cli
status driver" can be used to fetch information about the driver status
and capabilities.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-01-05 21:50:34 +02:00
parent fa0ddb1484
commit f0cbb986ff
3 changed files with 15 additions and 3 deletions

View file

@ -1,6 +1,6 @@
/* /*
* hostapd / UNIX domain socket -based control interface * hostapd / UNIX domain socket -based control interface
* Copyright (c) 2004-2013, Jouni Malinen <j@w1.fi> * Copyright (c) 2004-2014, Jouni Malinen <j@w1.fi>
* *
* This software may be distributed under the terms of the BSD license. * This software may be distributed under the terms of the BSD license.
* See README for more details. * See README for more details.
@ -1140,6 +1140,8 @@ static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx,
} else if (os_strcmp(buf, "STATUS") == 0) { } else if (os_strcmp(buf, "STATUS") == 0) {
reply_len = hostapd_ctrl_iface_status(hapd, reply, reply_len = hostapd_ctrl_iface_status(hapd, reply,
reply_size); reply_size);
} else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
reply_len = hostapd_drv_status(hapd, reply, reply_size);
} else if (os_strcmp(buf, "MIB") == 0) { } else if (os_strcmp(buf, "MIB") == 0) {
reply_len = ieee802_11_get_mib(hapd, reply, reply_size); reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
if (reply_len >= 0) { if (reply_len >= 0) {

View file

@ -1,6 +1,6 @@
/* /*
* hostapd - command line interface for hostapd daemon * hostapd - command line interface for hostapd daemon
* Copyright (c) 2004-2013, Jouni Malinen <j@w1.fi> * Copyright (c) 2004-2014, Jouni Malinen <j@w1.fi>
* *
* This software may be distributed under the terms of the BSD license. * This software may be distributed under the terms of the BSD license.
* See README for more details. * See README for more details.
@ -218,6 +218,8 @@ static int hostapd_cli_cmd_relog(struct wpa_ctrl *ctrl, int argc, char *argv[])
static int hostapd_cli_cmd_status(struct wpa_ctrl *ctrl, int argc, char *argv[]) static int hostapd_cli_cmd_status(struct wpa_ctrl *ctrl, int argc, char *argv[])
{ {
if (argc > 0 && os_strcmp(argv[0], "driver") == 0)
return wpa_ctrl_command(ctrl, "STATUS-DRIVER");
return wpa_ctrl_command(ctrl, "STATUS"); return wpa_ctrl_command(ctrl, "STATUS");
} }

View file

@ -1,6 +1,6 @@
/* /*
* hostapd - Driver operations * hostapd - Driver operations
* Copyright (c) 2009-2013, Jouni Malinen <j@w1.fi> * Copyright (c) 2009-2014, Jouni Malinen <j@w1.fi>
* *
* This software may be distributed under the terms of the BSD license. * This software may be distributed under the terms of the BSD license.
* See README for more details. * See README for more details.
@ -272,4 +272,12 @@ static inline int hostapd_drv_switch_channel(struct hostapd_data *hapd,
return hapd->driver->switch_channel(hapd->drv_priv, settings); return hapd->driver->switch_channel(hapd->drv_priv, settings);
} }
static inline int hostapd_drv_status(struct hostapd_data *hapd, char *buf,
size_t buflen)
{
if (hapd->driver == NULL || hapd->driver->status == NULL)
return -1;
return hapd->driver->status(hapd->drv_priv, buf, buflen);
}
#endif /* AP_DRV_OPS */ #endif /* AP_DRV_OPS */