From: Ben Greear Date: Mon, 4 Dec 2017 17:18:26 +0000 (-0800) Subject: wpa_ctrl: Make wpa_cli ping/pong work more reliably X-Git-Tag: hostap_2_8~622 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a54979695597f362bd5cfcccb77dfb99b61ed9e;p=thirdparty%2Fhostap.git wpa_ctrl: Make wpa_cli ping/pong work more reliably 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 --- diff --git a/src/common/wpa_ctrl.c b/src/common/wpa_ctrl.c index 623c2a768..1f1c9c422 100644 --- a/src/common/wpa_ctrl.c +++ b/src/common/wpa_ctrl.c @@ -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