From patchwork Sat Mar 2 11:09:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 7578 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 ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4Tn2Kr0ntZz3wmD for ; Sat, 2 Mar 2024 11:09:52 +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 ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4Tn2Kp4gWQz1qX; Sat, 2 Mar 2024 11:09:50 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4Tn2Kp470sz32gy; Sat, 2 Mar 2024 11:09:50 +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 ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4Tn2Km4ymcz301M for ; Sat, 2 Mar 2024 11:09:48 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4Tn2Km1drDz1XD; Sat, 2 Mar 2024 11:09:48 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1709377788; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kDaL0blAiVkstDSi+UxYv7DH/AyJRqgDVjVbaniDZeA=; b=0oDYSCHIvhayGJlkpwGYIj+8x/hBPPz0xFpjAKf6hUyLhySURyOK08O0RsGA3WMsjfznIB BXc2GYyiogHt93DQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1709377788; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kDaL0blAiVkstDSi+UxYv7DH/AyJRqgDVjVbaniDZeA=; b=WLr8oVOlqk9J6LT60xJWGDupkvWxqOsv6+yGpK+3OKwMm2GjBc7KHrmv+PVkTScvkjDD7m A2Ay0iKqV49g0xi9mTw/6tXhzYVVQKYWQIrdvgqMF05F7ldY6C52oi4P7JTU3llVdn0qS0 uuexceJrlDka+i8SYcCMF0xCaBCHLP9hGbCgxFFpkrce33t+iqp3t6IPPXJYSlv7U5zA8h kbc6KGB9zEhyMZjK02wlZPJok9fxQOMmt7RMaTB/srvYP/qPtnJGW8J0+JBSCdHB88/bMT O6hEBIXgEAu+Q5PZNUqLlLe7358pJnFs5kc98reoYq7k7YjKSSkab785MbMYdg== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [PATCH 2/5] functions.network: Add network_zone_exists Date: Sat, 2 Mar 2024 12:09:25 +0100 Message-Id: <20240302110928.10377-2-jonatan.schlag@ipfire.org> In-Reply-To: <20240302110928.10377-1-jonatan.schlag@ipfire.org> References: <20240302110928.10377-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: 722BNFYSCGD3SM6QUZZWDXMUFIRYNK6G X-Message-ID-Hash: 722BNFYSCGD3SM6QUZZWDXMUFIRYNK6G X-MailFrom: jonatan.schlag@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 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: As our Network is quite static a case does the trick Signed-off-by: Jonatan Schlag --- src/initscripts/networking/functions.network | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/initscripts/networking/functions.network b/src/initscripts/networking/functions.network index dedbb6f7f..ad0d3f36a 100644 --- a/src/initscripts/networking/functions.network +++ b/src/initscripts/networking/functions.network @@ -289,3 +289,25 @@ qmi_assign_address() { # Change the MAC address ip link set "${intf}" address "${address}" } + +network_zone_exists(){ + local zone="${1}" + + case "${zone}" in + "blue") + [ "${CONFIG_TYPE}" = "3" ] || [ "${CONFIG_TYPE}" = "4" ] + ;; + "green") + [ -n "${GREEN_DEV}" ] && [ -v "GREEN_DEV" ] + ;; + "orange") + [ "${CONFIG_TYPE}" = "2" ] || [ "${CONFIG_TYPE}" = "4" ] + ;; + "red") + return ${EXIT_TRUE} + ;; + *) + return ${EXIT_FALSE} + ;; + esac +}