hostapd: make cli treat UNKNOWN COMMAND as failing
authorDenton Gentry <denny@geekhold.com>
Wed, 30 May 2018 15:05:42 +0000 (15:05 +0000)
committerJohn Crispin <john@phrozen.org>
Thu, 7 Jun 2018 07:27:50 +0000 (09:27 +0200)
Avoid infinite loop at 100% CPU when running hostapd_cli
if CONFIG_CTRL_IFACE_MIB is not defined.

  _newselect(4, [3], NULL, NULL, ...)
  recvfrom(3, "UNKNOWN COMMAND\n", 4095, 0, NULL, NULL) = 16
  sendto(3, "STA-NEXT UNKNOWN COMMAND", 24, 0, NULL, 0) = 24

Signed-off-by: Denton Gentry <denny@geekhold.com>
package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch [new file with mode: 0644]

diff --git a/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch b/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch
new file mode 100644 (file)
index 0000000..81e6588
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/hostapd/hostapd_cli.c
++++ b/hostapd/hostapd_cli.c
+@@ -743,7 +743,7 @@ static int wpa_ctrl_command_sta(struct wpa_ctrl *ctrl, const char *cmd,
+       }
+       buf[len] = '\0';
+-      if (memcmp(buf, "FAIL", 4) == 0)
++      if (memcmp(buf, "FAIL", 4) == 0 || memcmp(buf, "UNKNOWN COMMAND", 15) == 0)
+               return -1;
+       if (print)
+               printf("%s", buf);
+-- 
+2.11.0