]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_ctrl: Make wpa_cli ping/pong work more reliably
authorBen Greear <greearb@candelatech.com>
Mon, 4 Dec 2017 17:18:26 +0000 (09:18 -0800)
committerJouni Malinen <j@w1.fi>
Tue, 1 Jan 2019 22:45:59 +0000 (00:45 +0200)
In 2013 or so, IFNAME=foo was prepended to at least the Unix socket
communication from wpa_supplicant to wpa_cli. This broke the (fragile)
logic that made ping/pong work more often when wpa_supplicant is busy
sending logging info to wpa_cli.

Adding check for IFNAME=foo makes this work better.

Signed-off-by: Ben Greear <greearb@candelatech.com>
src/common/wpa_ctrl.c

index 623c2a768e43de522c7f05ee6134a36412dd21f8..1f1c9c42204330c27e93b7f15dab09d62f188dd4 100644 (file)
@@ -540,7 +540,8 @@ retry_send:
                        res = recv(ctrl->s, reply, *reply_len, 0);
                        if (res < 0)
                                return res;
-                       if (res > 0 && reply[0] == '<') {
+                       if ((res > 0 && reply[0] == '<') ||
+                           (res > 6 && strncmp(reply, "IFNAME=", 7) == 0)) {
                                /* This is an unsolicited message from
                                 * wpa_supplicant, not the reply to the
                                 * request. Use msg_cb to report this to the