hostapd: make cli treat UNKNOWN COMMAND as failing
authorDenton Gentry <denny@geekhold.com>
Wed, 30 May 2018 15:05:42 +0000 (15:05 +0000)
committerJo-Philipp Wich <jo@mein.io>
Tue, 18 Dec 2018 08:43:58 +0000 (09:43 +0100)
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>
(backported from a84962ea35e4e97f1c4a42f2eac0242cc2cbd879)
(rebased patches)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
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..7bac937
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/hostapd/hostapd_cli.c
++++ b/hostapd/hostapd_cli.c
+@@ -743,7 +743,7 @@ static int wpa_ctrl_command_sta(struct w
+       }
+       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);