From patchwork Sat Mar 2 11:09:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 7579 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 4Tn2Ks2KBcz3wmD for ; Sat, 2 Mar 2024 11:09:53 +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 4Tn2Kq5vDfz2Jv; Sat, 2 Mar 2024 11:09:51 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4Tn2Kq5Mxgz32gT; Sat, 2 Mar 2024 11:09:51 +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 4Tn2Kn6097z32Q8 for ; Sat, 2 Mar 2024 11:09:49 +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 4Tn2Kn4x0rz1XD; Sat, 2 Mar 2024 11:09:49 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1709377789; 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=XkvyQLBmEZYz6Q9nNrVpxLPBzqWRnA7pl7HYSTcPH+A=; b=E/6eQlhbxAsTKrfAOghp71CAN2ud44gGsmFEvAni3kq9n9e8oyHEvjT8PFV9fWLW8OLLIu pZdNmCC1YLRpVRAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1709377789; 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=XkvyQLBmEZYz6Q9nNrVpxLPBzqWRnA7pl7HYSTcPH+A=; b=QS/0iogvDk7AI3DNBkrO2hbceHvZrkbPQOCOkY8e1X304thS3xuUowcS0m02hVFRuej7UL I2znAl8trNOv5zQIhnCKT+qlyTnyvBiW7ZCtqbkk+CRKVB46wwN3hfO/pppGXb3CwMIUqx TXgimTdf3fMILNByuZDfs9F5v5pWKTEID4gE/y6pdrGOzcR+k5xtOBdNAnI9FkIMM/RPzr /i3NgezSJqKFn8CwcuKB12pzt8cRsbTx+I0T2MMSHCcZstgzBKPpFKpZYZGoOBybuGYfos aGlFsW3HvP+JulI/QUtVvabJ2//H2CHWOYMBnUhumE0A6kdbpu2k8sVBDfHCFQ== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [PATCH 3/5] network initscript: Use network_zone_exists Date: Sat, 2 Mar 2024 12:09:26 +0100 Message-Id: <20240302110928.10377-3-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: O5PJV4WW6SIC36XLT6ECL6G6GWH63DM6 X-Message-ID-Hash: O5PJV4WW6SIC36XLT6ECL6G6GWH63DM6 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: This only a cosmetic change but should making the code easier changeable later on. Signed-off-by: Jonatan Schlag --- src/initscripts/system/network | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 0dcce060f..f334561de 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -21,6 +21,8 @@ . /etc/sysconfig/rc . ${rc_functions} +. /etc/init.d/networking/functions.network + eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) DO="${1}" @@ -54,11 +56,11 @@ case "${DO}" in [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green start # BLUE - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \ + [ "$blue" == "1" ] && network_zone_exists "blue" && \ /etc/rc.d/init.d/networking/blue start # ORANGE - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \ + [ "$orange" == "1" ] && network_zone_exists "orange" && \ /etc/rc.d/init.d/networking/orange start # RED @@ -84,16 +86,16 @@ case "${DO}" in [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green stop # BLUE - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \ + [ "$blue" == "1" ] && network_zone_exists "blue" && \ /etc/rc.d/init.d/networking/blue stop # ORANGE - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \ + [ "$orange" == "1" ] && network_zone_exists "orange" && \ /etc/rc.d/init.d/networking/orange stop # RED if [ "$red" == "1" ]; then - if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then + if network_zone_exists "red"; then /etc/rc.d/init.d/networking/red stop fi fi