wpa_cli: Fix endless loop relating to STA-NEXT

Submitted by Ben Greear on June 8, 2017, 3:25 p.m.

Details

Message ID 1496935528-24089-1-git-send-email-greearb@candelatech.com
State New
Headers show

Commit Message

Ben Greear June 8, 2017, 3:25 p.m.
From: Ben Greear <greearb@candelatech.com>

Starting 'wpa_cli -g /foo' against a supplicant that did not
have AP mode support compiled in would cause an endless loop of
log messages in the supplicant, and wpa_cli would not actually work
properly.

This fix was inspired by one posted by Denton Gentry:

http://lists.infradead.org/pipermail/lede-dev/2017-April/007002.html

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 wpa_supplicant/wpa_cli.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 95e83c2..1680c54 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -1825,7 +1825,7 @@  static int wpa_ctrl_command_sta(struct wpa_ctrl *ctrl, const char *cmd,
 	}
 
 	buf[len] = '\0';
-	if (os_memcmp(buf, "FAIL", 4) == 0)
+	if (os_memcmp(buf, "FAIL", 4) == 0 || memcmp(buf, "UNKNOWN COMMAND", 15) == 0)
 		return -1;
 	if (print)
 		printf("%s", buf);