From patchwork Tue Jul 21 13:25:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Marples X-Patchwork-Id: 1333041 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=marples.name Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=wZrHmRSE; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=marples.name header.i=@marples.name header.a=rsa-sha256 header.s=mail header.b=nb+43DBx; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B9zs46vY5z9sR4 for ; Tue, 21 Jul 2020 23:26:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Date:Message-ID:Subject:From:To: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=4B7lOQjan4ceHI+1LT6nTjHDWNQTHwhbRU5XFKdLucs=; b=wZrHmRSEegVwbH 3cB1Exq9bL/SzG1MtgXyKWYeu4CCiLR9I8ur3V1FS7mprLpxi6ZxDIH/s46dniRvILi6KXOpJ69SI qh/t7bwzy48c114/YWci0dpmDdA0js8X2Dz6LUbVLUWFTN7dANW5jKUs+/zZt0ed1o/P/9UMUREM8 ed9ENeuY3aWDCwYOWMPW3zuZDTjE7QjX2Zlx4h9dGJgy+YK4lLDoFVj7eCgRT385M18VM6Qc7kAdD kmvC9d+H8ay0xoA8t1dngiaf3Yb70qgyYcRb1jpCnr+crBEy00Y0NZTrKUUmWlxhKmnziNkarcDN7 /74ifS1JRaX/+8TpSbXg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxsH2-0002FY-ET; Tue, 21 Jul 2020 13:25:36 +0000 Received: from relay2.marples.name ([2a00:da00:1800:80d6::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxsH0-0002F0-JB for hostap@lists.infradead.org; Tue, 21 Jul 2020 13:25:35 +0000 Received: from mail.marples.name (cpc115040-bour7-2-0-cust370.15-1.cable.virginm.net [81.108.15.115]) by relay2.marples.name (Postfix) with ESMTPS id 62EEC760 for ; Tue, 21 Jul 2020 13:25:29 +0000 (UTC) Received: from [10.73.0.30] (uberpc.marples.name [10.73.0.30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.marples.name (Postfix) with ESMTPSA id B770A13780 for ; Tue, 21 Jul 2020 14:25:27 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marples.name; s=mail; t=1595337927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gJf8xCcr3socZ6ysoII6bnBACo3wt4MvYKxe63GAD0c=; b=nb+43DBxbgbY0ypC0Ovi09YTmQGf8JcHP8vbYRwoBhU3HEPExKFhCHMxs8nORIuEDrqLCa B8qEHfP8Yip/QPydgwfPAyI2LmjgaOIvofSs3PBdtdp+W6qnGfgtDcETklxdMGZFAuM5Ch hEQ3AVMLOIqQXt778BarMw1ppLhPxHg= To: hostap@lists.infradead.org From: Roy Marples Subject: [PATCH] iface match: unspecified matched interfaces should not log driver fails Message-ID: <7933fe03-cb9b-7652-a5b8-f21f682b8797@marples.name> Date: Tue, 21 Jul 2020 14:25:26 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_092534_882105_4715E02C X-CRM114-Status: GOOD ( 18.28 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org If there is no matching interface given, but interface matching is enabled then all interfaces on the system will try to be initialized. Non wireless interfaces will fail and the loopback device will be one of these, so just log a diagnostic rather than an error. Signed-off-by: Roy Marples --- wpa_supplicant/events.c | 2 -- wpa_supplicant/wpa_supplicant.c | 20 +++++++++++++++++--- wpa_supplicant/wpa_supplicant_i.h | 11 +++++++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 0fcb1762e..978d0bfa7 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -5453,8 +5453,6 @@ void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event, return; wpa_s = wpa_supplicant_add_iface(ctx, wpa_i, NULL); os_free(wpa_i); - if (wpa_s) - wpa_s->matched = 1; } #endif /* CONFIG_MATCH_IFACE */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index e7989baef..fad4f3ad4 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -6044,6 +6044,8 @@ next_driver: wpa_s->drv_priv = wpa_drv_init(wpa_s, wpa_s->ifname); if (wpa_s->drv_priv == NULL) { const char *pos; + int level; + pos = driver ? os_strchr(driver, ',') : NULL; if (pos) { wpa_dbg(wpa_s, MSG_DEBUG, "Failed to initialize " @@ -6051,7 +6053,14 @@ next_driver: driver = pos + 1; goto next_driver; } - wpa_msg(wpa_s, MSG_ERROR, "Failed to initialize driver " + +#ifdef CONFIG_MATCH_IFACE + if (wpa_s->matched == WPA_IFACE_MATCHEDNULL) + level = MSG_DEBUG; + else +#endif + level = MSG_ERROR; + wpa_msg(wpa_s, level, "Failed to initialize driver " "interface"); return -1; } @@ -6197,6 +6206,9 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, return -1; } os_strlcpy(wpa_s->ifname, iface->ifname, sizeof(wpa_s->ifname)); +#ifdef CONFIG_MATCH_IFACE + wpa_s->matched = iface->matched; +#endif if (iface->bridge_ifname) { if (os_strlen(iface->bridge_ifname) >= @@ -6588,6 +6600,10 @@ struct wpa_interface * wpa_supplicant_match_iface(struct wpa_global *global, if (!iface) return NULL; *iface = *miface; + if (!miface->ifname) + iface->matched = WPA_IFACE_MATCHEDNULL; + else + iface->matched = WPA_IFACE_MATCHED; iface->ifname = ifname; return iface; } @@ -6622,8 +6638,6 @@ static int wpa_supplicant_match_existing(struct wpa_global *global) if (iface) { wpa_s = wpa_supplicant_add_iface(global, iface, NULL); os_free(iface); - if (wpa_s) - wpa_s->matched = 1; } } diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 341d84156..730ff290e 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -121,6 +121,17 @@ struct wpa_interface { * interface that is not a network interface. */ int p2p_mgmt; + +#ifdef CONFIG_MATCH_IFACE + /** + * matched - Interface was matched rather than specified + * + */ + int matched; +#define WPA_IFACE_NOTMATCHED 0 +#define WPA_IFACE_MATCHEDNULL 1 +#define WPA_IFACE_MATCHED 2 +#endif /* CONFIG_MATCH_IFACE */ }; /**