diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 1bfdb02de..465d3ff93 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -5798,6 +5798,30 @@ static int wpa_supplicant_global_iface_interfaces(struct wpa_global *global, } +static char * wpas_global_ctrl_iface_ifname(struct wpa_global *global, + const char *ifname, + char *cmd, size_t *resp_len) +{ + struct wpa_supplicant *wpa_s; + + for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { + if (os_strcmp(ifname, wpa_s->ifname) == 0) + break; + } + + if (wpa_s == NULL) { + char *resp = os_strdup("FAIL-NO-IFNAME-MATCH\n"); + if (resp) + *resp_len = os_strlen(resp); + else + *resp_len = 1; + return resp; + } + + return wpa_supplicant_ctrl_iface_process(wpa_s, cmd, resp_len); +} + + char * wpa_supplicant_global_ctrl_iface_process(struct wpa_global *global, char *buf, size_t *resp_len) { @@ -5806,6 +5830,16 @@ char * wpa_supplicant_global_ctrl_iface_process(struct wpa_global *global, int reply_len; int level = MSG_DEBUG; + if (os_strncmp(buf, "IFNAME=", 7) == 0) { + char *pos = os_strchr(buf + 7, ' '); + if (pos) { + *pos++ = '\0'; + return wpas_global_ctrl_iface_ifname(global, + buf + 7, pos, + resp_len); + } + } + if (os_strcmp(buf, "PING") == 0) level = MSG_EXCESSIVE; wpa_hexdump_ascii(level, "RX global ctrl_iface",