]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_cli: Add IFNAME command
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>
Sun, 5 Aug 2012 17:12:16 +0000 (20:12 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 5 Aug 2012 17:12:16 +0000 (20:12 +0300)
This command will return wpa_s->ifname that can be used for a nice
prompt in wpa_cli.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>

wpa_supplicant/ctrl_iface.c
wpa_supplicant/wpa_cli.c

index 7fe969427af349e5ecb0c4d782d2b3ec7b6b7aa4..77f9ee1d17ccd8cab7974cc36f040fe3eb82631a 100644 (file)
@@ -4120,6 +4120,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
        if (os_strcmp(buf, "PING") == 0) {
                os_memcpy(reply, "PONG\n", 5);
                reply_len = 5;
+       } else if (os_strcmp(buf, "IFNAME") == 0) {
+               reply_len = os_strlen(wpa_s->ifname);
+               os_memcpy(reply, wpa_s->ifname, reply_len);
        } else if (os_strncmp(buf, "RELOG", 5) == 0) {
                if (wpa_debug_reopen_file() < 0)
                        reply_len = -1;
index ae67fda008e063059d2ab15a9c09d2e9e5f83a92..880aa1381ca7a0bc33485de70b91e7f1695bc436 100644 (file)
@@ -430,6 +430,12 @@ static int wpa_ctrl_command(struct wpa_ctrl *ctrl, char *cmd)
 }
 
 
+static int wpa_cli_cmd_ifname(struct wpa_ctrl *ctrl, int argc, char *argv[])
+{
+       return wpa_ctrl_command(ctrl, "IFNAME");
+}
+
+
 static int wpa_cli_cmd_status(struct wpa_ctrl *ctrl, int argc, char *argv[])
 {
        if (argc > 0 && os_strcmp(argv[0], "verbose") == 0)
@@ -2947,6 +2953,9 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
        { "status", wpa_cli_cmd_status,
          cli_cmd_flag_none,
          "[verbose] = get current WPA/EAPOL/EAP status" },
+       { "ifname", wpa_cli_cmd_ifname,
+         cli_cmd_flag_none,
+         "= get current interface name" },
        { "ping", wpa_cli_cmd_ping,
          cli_cmd_flag_none,
          "= pings wpa_supplicant" },