From patchwork Thu Oct 17 14:54:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 8193 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4XTrTK2J5cz3x1M for ; Thu, 17 Oct 2024 14:54:29 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4XTrTD3zrtz4bQ; Thu, 17 Oct 2024 14:54:24 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4XTrTD2cCVz34Dv; Thu, 17 Oct 2024 14:54:24 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4XTrT91pn6z33g6 for ; Thu, 17 Oct 2024 14:54:21 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "michael.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4XTrT86G79z26g; Thu, 17 Oct 2024 14:54:20 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4XTrT83bSGzThmH; Thu, 17 Oct 2024 14:54:20 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 3/4] udev: network-hotplug-bridges: Silence a warning when interfaces have gone away Date: Thu, 17 Oct 2024 14:54:15 +0000 Message-Id: <20241017145416.25394-3-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241017145416.25394-1-michael.tremer@ipfire.org> References: <20241017145416.25394-1-michael.tremer@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: 5NXF6YPNR3NGQ6CA5ITGHPQQG3B5O2UP X-Message-ID-Hash: 5NXF6YPNR3NGQ6CA5ITGHPQQG3B5O2UP X-MailFrom: root@michael.haj.ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Michael Tremer X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: It can happen that udev has an event for an interface in the queue that has already gone away - or even just being renamed. Then reading the MAC address fails. Because the shell expands the "$(<...)" statement before running the whole line, the read check is useless. Because the code would get too complicated otherwise, I decided to use cat. Not cool, but this does the job. Signed-off-by: Michael Tremer --- config/udev/network-hotplug-bridges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/udev/network-hotplug-bridges b/config/udev/network-hotplug-bridges index 9fded1fd0..39faeb5a9 100644 --- a/config/udev/network-hotplug-bridges +++ b/config/udev/network-hotplug-bridges @@ -42,7 +42,7 @@ detect_zone() { local slave for slave in $(get_value "${zone}_SLAVES"); do # Compare if the mac address matches or if the name matches - if [ -r "/sys/class/net/${INTERFACE}/address" -a "$(/dev/null)" = "${slave}" ] || [ "${INTERFACE}" = "${slave}" ]; then echo "${zone}" return 0 fi