aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/hostapd_cli.c
diff options
context:
space:
mode:
authorMikael Kanstrup <mikael.kanstrup@sonymobile.com>2016-10-12 12:18:59 (GMT)
committerJouni Malinen <j@w1.fi>2016-10-16 09:28:02 (GMT)
commit4c43f44b29f19e45271cca5fe8573e061a66fcd2 (patch)
tree4b6957309cf6f5c3b68a4266f66822cc1a11dbbb /hostapd/hostapd_cli.c
parent85bab32522967e4de6c940e5c886fc6031f42753 (diff)
downloadhostap-4c43f44b29f19e45271cca5fe8573e061a66fcd2.zip
hostap-4c43f44b29f19e45271cca5fe8573e061a66fcd2.tar.gz
hostap-4c43f44b29f19e45271cca5fe8573e061a66fcd2.tar.bz2
cli: Add list_sta command
Add list_sta command to print addresses of all stations. Command added to both wpa_cli and hostapd_cli. Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
Diffstat (limited to 'hostapd/hostapd_cli.c')
-rw-r--r--hostapd/hostapd_cli.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index e567010..88a5ee1 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -802,6 +802,23 @@ static int hostapd_cli_cmd_all_sta(struct wpa_ctrl *ctrl, int argc,
}
+static int hostapd_cli_cmd_list_sta(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ char addr[32], cmd[64];
+
+ if (wpa_ctrl_command_sta(ctrl, "STA-FIRST", addr, sizeof(addr), 0))
+ return 0;
+ do {
+ if (os_strcmp(addr, "") != 0)
+ printf("%s\n", addr);
+ os_snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr);
+ } while (wpa_ctrl_command_sta(ctrl, cmd, addr, sizeof(addr), 0) == 0);
+
+ return 0;
+}
+
+
static int hostapd_cli_cmd_help(struct wpa_ctrl *ctrl, int argc, char *argv[])
{
print_help(stdout, argc > 0 ? argv[0] : NULL);
@@ -1332,6 +1349,8 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
"<addr> = get MIB variables for one station" },
{ "all_sta", hostapd_cli_cmd_all_sta, NULL,
"= get MIB variables for all stations" },
+ { "list_sta", hostapd_cli_cmd_list_sta, NULL,
+ "= list all stations" },
{ "new_sta", hostapd_cli_cmd_new_sta, NULL,
"<addr> = add a new station" },
{ "deauthenticate", hostapd_cli_cmd_deauthenticate,