From patchwork Mon Dec 4 17:18:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 844334 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y0kSow7W"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yrBSS2dRFz9sRV for ; Tue, 5 Dec 2017 04:19:20 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=eQoFfYZfCxYL9iSaLtC1vkhHOhFQ/l9IvSrYTWvdYg0=; b=Y0k Sow7WXO6a5VtOWIRUjhQ+zpy7zHQR4fEAeR2/Cy+4tqy4UTKOEdhFtv+iLWfg6NpXfbBIBjypNPeH bjCN14Cc66zcNV4M3N68Q0OD46jWoB+24mulhNllz/7AKzL1aQR0VLf4UzVgmdXZF/Sy8Dc/kgORh +S7izD5YJREF4KSznK+odmQPtdFV+7kdhNw0WfZ53xg6T4J223ixCLn9H3Z83SGKCENsJdZb+hBDT I5rvvKKYQzUZQXzlehoMTxrFbWIKRdJjOcAJgxedgBxWiOnaM94HHoIh2GvC9pznfhK3W9CQSDEFI +tKjkw3Fh4AH9DfwXXEGPQcGOXjay5Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLuOS-0003Dd-Aw; Mon, 04 Dec 2017 17:19:00 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLuOL-0002ul-Vh for hostap@lists.infradead.org; Mon, 04 Dec 2017 17:18:56 +0000 Received: from v-f24-64.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id D3E6740A79A; Mon, 4 Dec 2017 09:18:28 -0800 (PST) From: greearb@candelatech.com To: hostap@lists.infradead.org Subject: [PATCH] wpa-cli: Make ping/pong work more reliably. Date: Mon, 4 Dec 2017 09:18:26 -0800 Message-Id: <1512407906-6986-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.7.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171204_091854_093458_0B71C5BA X-CRM114-Status: UNSURE ( 7.48 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Ben Greear 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 the supplicant is busy sending logging info to the wpa_cli. Adding check for IFNAME=foo makes this work better. Signed-off-by: Ben Greear --- src/common/wpa_ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/wpa_ctrl.c b/src/common/wpa_ctrl.c index 623c2a7..1f1c9c4 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