wpa_cli: Send ALL_STA command to the correct interface

wpa_ctrl_command_sta(), called by the "ALL_STA" handler, didn't consider
ifname_prefix, resulting in various commands being sent to the global
control interface, rather than the specified interface when IFNAME=
prefix was used.

This in turn caused the unexpected "UNKNOWN COMMAND" result be
considered as valid station, resulting in infinite loop while trying to
get all stations.

Fix it by considering ifname_prefix, similarly to _wpa_ctrl_command().

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
This commit is contained in:
Eliad Peller 2015-12-10 12:56:06 +02:00 committed by Jouni Malinen
parent 0e6a2cf282
commit 685ea2f60c

View File

@ -1927,6 +1927,12 @@ 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);