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 <greearb@candelatech.com>
This commit is contained in:
Ben Greear 2017-12-04 09:18:26 -08:00 committed by Jouni Malinen
parent 658c39809b
commit 2a54979695

View file

@ -540,7 +540,8 @@ retry_send:
res = recv(ctrl->s, reply, *reply_len, 0); res = recv(ctrl->s, reply, *reply_len, 0);
if (res < 0) if (res < 0)
return res; 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 /* This is an unsolicited message from
* wpa_supplicant, not the reply to the * wpa_supplicant, not the reply to the
* request. Use msg_cb to report this to the * request. Use msg_cb to report this to the