OSDN Git Service

Fix wpa_cli 'IFNAME=iface' prefix processing
authorDmitry Shmidt <dimitrysh@google.com>
Wed, 5 Jun 2013 18:06:13 +0000 (11:06 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Wed, 5 Jun 2013 18:06:13 +0000 (11:06 -0700)
Change-Id: I3117a1b74707193dcc0598a47285813d6d7c5567
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
wpa_supplicant/wpa_cli.c

index 968534e..ba1f207 100644 (file)
@@ -406,6 +406,12 @@ static int _wpa_ctrl_command(struct wpa_ctrl *ctrl, char *cmd, int print)
                printf("Not connected to wpa_supplicant - command dropped.\n");
                return -1;
        }
+       if (ifname_prefix) {
+               os_snprintf(buf, sizeof(buf), "IFNAME=%s %s",
+                           ifname_prefix, cmd);
+               buf[sizeof(buf) - 1] = '\0';
+               cmd = buf;
+       }
        len = sizeof(buf) - 1;
        ret = wpa_ctrl_request(ctrl, cmd, os_strlen(cmd), buf, &len,
                               wpa_cli_msg_cb);
@@ -1630,12 +1636,6 @@ static int wpa_ctrl_command_sta(struct wpa_ctrl *ctrl, char *cmd,
                printf("Not connected to hostapd - command dropped.\n");
                return -1;
        }
-       if (ifname_prefix) {
-               os_snprintf(buf, sizeof(buf), "IFNAME=%s %s",
-                           ifname_prefix, cmd);
-               buf[sizeof(buf) - 1] = '\0';
-               cmd = buf;
-       }
        len = sizeof(buf) - 1;
        ret = wpa_ctrl_request(ctrl, cmd, os_strlen(cmd), buf, &len,
                               wpa_cli_msg_cb);