From patchwork Tue May 23 17:23:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6900 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4S0cfgz3wlf for ; Tue, 23 May 2023 17:23: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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4R0RbJzkG; Tue, 23 May 2023 17:23:51 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4Q72L9z2ysv; Tue, 23 May 2023 17:23: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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4Q2CHKz2ySG for ; Tue, 23 May 2023 17:23:50 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4P6cYqz1dV; Tue, 23 May 2023 17:23:49 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862629; 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=75as6g0vB2ZxAH8acErRYeHiLa9b6WSHG374AjCT3Ks=; b=/DVw5hgqZ57ZqeG+VFmbtQtJVrI0p5/AGqxZg7xa39Lzt5ljFpJtV262J5cF4DOpBcYIFn cFThHSCmEN2qObCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862629; 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=75as6g0vB2ZxAH8acErRYeHiLa9b6WSHG374AjCT3Ks=; b=d77DEA7c/Vn0YHZZ3mHTocep1lCwAo/6kLHLJweXq6Kdd112kP2xJfzPpb9tbhUa2f80Z4 GfUUe19bzWn+tBzNY9h6aUbItvvHK8uMiYatqh3IY+iWJcJbhBQmSFgqNChghVEbCOkFRa lV14HShkH8mJf8/NwBcdMuu1TWarUcemF59C9HtIOHyV/7T5XwYzzrhc2uwtA6B317cxtP XBB/sTpeshWqpDeIgD+/IRBTcs1vpQtMfWa77wVomrnEY2H+XcEEG/3tYOpr6ywLUfweKF azYI8bvDQLXHTtySX6GwpWZiSLrDeJdo5k2yEJVMwuguWUKdfh9F2byv9kPW7w== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 01/15] Remove ipsec interface creation from network startup Date: Tue, 23 May 2023 19:23:01 +0200 Message-Id: <20230523172314.7826-2-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This is called several times in the boot process. It also depends on connectivity to the internet. So there is no point in calling it here when we do not know if we even have an internet connection. It is called in the ipsecctrl programm which is called in the start and shutdown process of red ( /etc/init.d/networking/red.down/10-ipsec and /etc/init.d/networking/red.up/50-ipsec). Signed-off-by: Jonatan Schlag --- src/initscripts/system/network | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 9ef3fb0d8..7e457edfa 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -70,9 +70,6 @@ case "${DO}" in fi fi - # Create IPsec interfaces - /usr/local/bin/ipsec-interfaces - /etc/rc.d/init.d/static-routes start boot_mesg "Mounting network file systems..." From patchwork Tue May 23 17:23:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6901 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4V5Rxkz3wlf for ; Tue, 23 May 2023 17:23:54 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4V13H5z1bx; Tue, 23 May 2023 17:23:54 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4V0Sgsz302t; Tue, 23 May 2023 17:23:54 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4S53r1z2yTC for ; Tue, 23 May 2023 17:23:52 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4S3xBQzfB; Tue, 23 May 2023 17:23:52 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862632; 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=EEXs+7L69oCOLTKmCRgrl0OLdxw70fzcFjtApxbPAaE=; b=CpkvfEbKUrkYnD7RaXoA7M44WvbtvuiABEvjdvdnBd0OM5s83OICbzU9F8uBFzOEH7mJ0e 6e1WTHjqWY626qCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862632; 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=EEXs+7L69oCOLTKmCRgrl0OLdxw70fzcFjtApxbPAaE=; b=aVXxQaWy7EPfIhVw8kUfEnxHDNMxOomHcjn2XBX5mH1IQeRfLoAq1va+xWrpF3a0Z2QmbZ 9QD0W853LAaOa4yIbSWt2Q5cE3jr984vOCSBepY47evtxxYnRhfr2DLjeIDSGygGH2fEZZ VJ82u4OUI7PKhcCxVg9lsd5cRONB4YgJjfvJuNsgkd5l4UV80VfzCoBAX2ua4XUIvdS2GJ g+MTnq3wt9O3k25lRS1SQfQjdzfK25ErFVjreWi2+jhr3gtlXTkYgygd9683WJ98fTbDVB hUP8Rm+ABEQnvOHb/XULvGB40oKwon9x0diK1RieUywutB3hXcn1L0ZNTCVApg== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 02/15] Remove Start/Stop links for client175 Date: Tue, 23 May 2023 19:23:02 +0200 Message-Id: <20230523172314.7826-3-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This was dropped a while ago Signed-off-by: Jonatan Schlag --- lfs/initscripts | 3 --- 1 file changed, 3 deletions(-) diff --git a/lfs/initscripts b/lfs/initscripts index 19b79a474..e078632ab 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -98,7 +98,6 @@ $(TARGET) : ln -sf ../init.d/fcron /etc/rc.d/rc0.d/K08fcron ln -sf ../init.d/apache /etc/rc.d/rc0.d/K28apache ln -sf ../init.d/sshd /etc/rc.d/rc0.d/K30sshd - ln -sf ../init.d/client175 /etc/rc.d/rc0.d/K34client175 ln -sf ../init.d/setclock /etc/rc.d/rc0.d/K47setclock ln -sf ../init.d/cyrus-sasl /etc/rc.d/rc0.d/K49cyrus-sasl ln -sf ../init.d/vnstat /etc/rc.d/rc0.d/K51vnstat @@ -131,7 +130,6 @@ $(TARGET) : ln -sf ../init.d/sshd /etc/rc.d/rc3.d/S30sshd ln -sf ../init.d/apache /etc/rc.d/rc3.d/S32apache ln -sf ../init.d/fcron /etc/rc.d/rc3.d/S40fcron - ln -sf ../init.d/client175 /etc/rc.d/rc3.d/S66client175 ln -sf ../../sysconfig/rc.local /etc/rc.d/rc3.d/S98rc.local ln -sf ../init.d/sslh /etc/rc.d/rc3.d/S98sslh ln -sf ../init.d/imspetor /etc/rc.d/rc3.d/S99imspetor @@ -145,7 +143,6 @@ $(TARGET) : ln -sf ../init.d/fcron /etc/rc.d/rc6.d/K08fcron ln -sf ../init.d/apache /etc/rc.d/rc6.d/K28apache ln -sf ../init.d/sshd /etc/rc.d/rc6.d/K30sshd - ln -sf ../init.d/client175 /etc/rc.d/rc6.d/K34client175 ln -sf ../init.d/setclock /etc/rc.d/rc6.d/K47setclock ln -sf ../init.d/cyrus-sasl /etc/rc.d/rc6.d/K49cyrus-sasl ln -sf ../init.d/vnstat /etc/rc.d/rc6.d/K51vnstat From patchwork Tue May 23 17:23:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6902 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4X2SgQz3wlf for ; Tue, 23 May 2023 17:23:56 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4W1XQxz1YF; Tue, 23 May 2023 17:23:55 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4W0zfJz302K; Tue, 23 May 2023 17:23:55 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4T4pZHz2ydF for ; Tue, 23 May 2023 17:23:53 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4T3FxFzfB; Tue, 23 May 2023 17:23:53 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862633; 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=OqqrJVCGkTdfig6Fd4hMRKeiZFKzSlh/sdwjOMwXKt8=; b=q3Yaphk4k/mClxoEa8bNl4bodz1Kn82A+TfONVWzuaGPdrctEtC4lIBIODl+MEVLlBvyHt RIdyDAiiAG6qcdDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862633; 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=OqqrJVCGkTdfig6Fd4hMRKeiZFKzSlh/sdwjOMwXKt8=; b=eINn1H/ZkQBXDxso2nHa63kqcsnesEziim6ChDk89/hSQ96lyIF4cGIQ0faDI45zcfGQfR BQS5lyGs6pjzg7Q8NQHsFkbb4kMKKy4il5far1NbfwioGhJp7O13JgjsMCEc1ashJ2xLAZ Tj5jsaoSx5dsgIWHam77lioi1/VEtm8kOh38XW5y7l5yYSrNWCR/YnbrXOMTXuFFxvKQDa +Hymmhl/sfxzEUJKiKWdOjL/ZuaoRXEvC/M/i49Ohb1KE04jzNhjuhLWZZs7orz/qa6yMi /3zU44yEc/+efV6Q++eWmQSTDSEyskc1YNZEPslDdVPGtneWh8qKyfd1Q1u0zQ== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 03/15] Use bash as shebang in network initscripts Date: Tue, 23 May 2023 19:23:03 +0200 Message-Id: <20230523172314.7826-4-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" /bin/sh is a symlink to /bin/bash on ipfire systems. Using /bin/sh in the scripts as shebang hurts in two ways: 1. We use features which do not work with sh as shell. This is not really a problem but if we rely on features of a real bash we can state this clearly. 2. The syntay highlighting in vim does not work without a correct shebang. As I want and need correct syntax highlighting I propose to change the shebang. Signed-off-by: Jonatan Schlag --- src/initscripts/networking/any | 2 +- src/initscripts/networking/functions.network | 2 +- src/initscripts/networking/red | 2 +- src/initscripts/networking/red.up/99-pakfire-update | 2 +- src/initscripts/system/network | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/initscripts/networking/any b/src/initscripts/networking/any index 15197badb..dc4796e91 100644 --- a/src/initscripts/networking/any +++ b/src/initscripts/networking/any @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ############################################################################### # # # IPFire.org - A linux based firewall # diff --git a/src/initscripts/networking/functions.network b/src/initscripts/networking/functions.network index 0e2e5009e..4c7ad51d4 100644 --- a/src/initscripts/networking/functions.network +++ b/src/initscripts/networking/functions.network @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ############################################################################### # # # IPFire.org - A linux based firewall # diff --git a/src/initscripts/networking/red b/src/initscripts/networking/red index 16d48f3ac..8e41314b6 100644 --- a/src/initscripts/networking/red +++ b/src/initscripts/networking/red @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ############################################################################### # # # IPFire.org - A linux based firewall # diff --git a/src/initscripts/networking/red.up/99-pakfire-update b/src/initscripts/networking/red.up/99-pakfire-update index 3cc79a107..56cee66aa 100644 --- a/src/initscripts/networking/red.up/99-pakfire-update +++ b/src/initscripts/networking/red.up/99-pakfire-update @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash nice -n 10 /opt/pakfire/pakfire update >/dev/null 2>&1 & diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 7e457edfa..0d63b4e8b 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ############################################################################### # # # IPFire.org - A linux based firewall # From patchwork Tue May 23 17:23:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6903 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4Y3TvRz3wlf for ; Tue, 23 May 2023 17:23:57 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4X24lqz315; Tue, 23 May 2023 17:23:56 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4X1VzXz2ySG; Tue, 23 May 2023 17:23:56 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4V32XMz2ySG for ; Tue, 23 May 2023 17:23:54 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4V1nd2z4gy; Tue, 23 May 2023 17:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862634; 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=k6vUyLvBLOl2P1ze/IcGqig15OHuUHLx/C/GywljNZw=; b=LBge7Q7NT5opYUaZFfEADvQzu+kajtF6ZT+f/2UQsNQLjN+meSwSJvQZXPaztNn++bBcok h1XtQ6Sq6Ozyc86Ybq1CkmD+BSYSB+5t3SQf3WMcKsfSk9dug1bISN0b4uyUZSSyOHAhvp 2FpJUWHSp5PzfNKRdHO4MvzjjAsU7wENT6vKOZOKdTJR4G2eAMrQ04UFdfe41bfPoSf1eW h1oLGxASLHNtqGNyTMu4B9I70HH/zq+KQnLe0Yw1XMk4rWgLe4nQ/W6AvqXpPQQUOB76rd mFvwxWLB7qjGDpcdsFNL9U3SvRFKmR945Ck7H0YLu9pSTkOD10XEPvc1YZXooQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862634; 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=k6vUyLvBLOl2P1ze/IcGqig15OHuUHLx/C/GywljNZw=; b=U5yV7pqqfk5aubeYkWGtHvNDraxfvyhnKcKBcE20xHm7fQgOpZoQ+T7ExYRiSBVxj7pKbs pp9Oqk6O0fPvv8Bw== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 04/15] network initscripts: check if the zone in the current config exists Date: Tue, 23 May 2023 19:23:04 +0200 Message-Id: <20230523172314.7826-5-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" We check in /etc/init.d/network if the current Configuration (RED+GREEN or RED+GREEN+BLUE) contains the zone we want to start or stop. We do this not in /etc/init.d/networking/green,blue,orange As this checks make sense also there and as these scripts are called form /etc/init.d/network I moved the check to these scripts. As CONFIG_TYPE == 2 is unreadable I wrote functions to make things at least a litte bit prettier. Signed-off-by: Jonatan Schlag --- src/initscripts/networking/any | 27 +++++++++++++++++--- src/initscripts/networking/functions.network | 12 +++++++++ src/initscripts/system/network | 16 ++++-------- 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/initscripts/networking/any b/src/initscripts/networking/any index dc4796e91..6dba5bef9 100644 --- a/src/initscripts/networking/any +++ b/src/initscripts/networking/any @@ -21,23 +21,44 @@ . /etc/sysconfig/rc . ${rc_functions} +. /etc/init.d/networking/functions.network + eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) -if [ "$(basename $0)" == "green" ]; then +ZONE="$(basename $0)" + + +if [ "${ZONE}" == "green" ]; then + if ! is_green_used; then + boot_mesg "Green zone is not configured. No action can be taken on this zone." ${FAILURE} + echo_failure + exit 1 + fi + DEVICE="${GREEN_DEV}" ADDRESS="${GREEN_ADDRESS}" NETADDRESS="${GREEN_NETADDRESS}" NETMASK="${GREEN_NETMASK}" DEVICE="${GREEN_DEV}" MTU="${GREEN_MTU}" -elif [ "$(basename $0)" == "blue" ]; then +elif [ "${ZONE}" == "blue" ]; then + if ! is_blue_used; then + boot_mesg "Blue zone is not configured. No action can be taken on this zone." ${FAILURE} + echo_failure + exit 1 + fi DEVICE="${BLUE_DEV}" ADDRESS="${BLUE_ADDRESS}" NETADDRESS="${BLUE_NETADDRESS}" NETMASK="${BLUE_NETMASK}" DEVICE="${BLUE_DEV}" MTU="${BLUE_MTU}" -elif [ "$(basename $0)" == "orange" ]; then +elif [ "${ZONE}" == "orange" ]; then + if ! is_orange_used; then + boot_mesg "Orange zone is not configured. No action can be taken on this zone." ${FAILURE} + echo_failure + exit 1 + fi DEVICE="${ORANGE_DEV}" ADDRESS="${ORANGE_ADDRESS}" NETADDRESS="${ORANGE_NETADDRESS}" diff --git a/src/initscripts/networking/functions.network b/src/initscripts/networking/functions.network index 4c7ad51d4..9cc4da24b 100644 --- a/src/initscripts/networking/functions.network +++ b/src/initscripts/networking/functions.network @@ -285,3 +285,15 @@ qmi_assign_address() { # Change the MAC address ip link set "${intf}" address "${address}" } + +is_blue_used() { + [ "${CONFIG_TYPE}" = "3" ] || [ "${CONFIG_TYPE}" = "4" ] +} + +is_green_used() { + [ -n "${GREEN_DEV}" ] && [ -v "GREEN_DEV" ] +} + +is_orange_used() { + [ "${CONFIG_TYPE}" = "2" ] || [ "${CONFIG_TYPE}" = "4" ] +} diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 0d63b4e8b..fda16919d 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -54,12 +54,10 @@ case "${DO}" in [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green start # BLUE - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \ - /etc/rc.d/init.d/networking/blue start + [ "$blue" == "1" ] && /etc/rc.d/init.d/networking/blue start # ORANGE - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \ - /etc/rc.d/init.d/networking/orange start + [ "$orange" == "1" ] && /etc/rc.d/init.d/networking/orange start # RED if [ "$red" == "1" ]; then @@ -87,18 +85,14 @@ case "${DO}" in [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green stop # BLUE - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \ - /etc/rc.d/init.d/networking/blue stop + [ "$blue" == "1" ] && /etc/rc.d/init.d/networking/blue stop # ORANGE - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \ - /etc/rc.d/init.d/networking/orange stop + [ "$orange" == "1" ] && /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 - /etc/rc.d/init.d/networking/red stop - fi + /etc/rc.d/init.d/networking/red stop fi exit 0 From patchwork Tue May 23 17:23:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6904 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4Y6whcz3wls for ; Tue, 23 May 2023 17:23:57 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4X3c0rz9VX; Tue, 23 May 2023 17:23:56 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4X24dSz30Kd; Tue, 23 May 2023 17:23:56 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4W1FHxz30JK for ; Tue, 23 May 2023 17:23:55 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4W034Qz4gy; Tue, 23 May 2023 17:23:54 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862635; 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=A+rCdnbOTYs1MdPD98z3V7atqQNudqpTO5gHxTdAEUI=; b=wfCFUABRYoEHN1OTCgnaiRfJasoWtnLCrL2Gt5SPB8YF53SQgpGnOrtiKI1oOpb4DgaKI3 Y1s4gU3Azb2MnRBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862635; 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=A+rCdnbOTYs1MdPD98z3V7atqQNudqpTO5gHxTdAEUI=; b=Kyt8SUobACDv6q/VDPO9aqOuvbm5TqxzObu/DE43XTb2tviAzMcBesCfeTXcHaoCUsHuV/ QkV3tHkI7yEIq9g1uC2mmYI+AcOH23qNsUj5ebv6jT3tfHiK5atwBEHDzYm7xh8oe8yjg7 +iUk3Bp1PeV9GaiN782Kc58Uwqem08xXy9LAZ1ZX275hYLKlIG3p63CuRSn8MS9T9XcRnI 3tR9cVofdsBXkkDftkMWmKEdSIHJLrNfMLXJzfZFFtTJVlnt1g4C05K/jbdy+D1683MahG qiul320b0UntubSO+D1ZWagtgNq57zYKxE70ZYltosWDPxd3G5pYn3J8IXvGOQ== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 05/15] network initscripts: Remove code for old zone scheme Date: Tue, 23 May 2023 19:23:05 +0200 Message-Id: <20230523172314.7826-6-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" A long time ago (2007) there were more config types possible then 1, 2, 3 and 4. As our installer currently only accepts config type out of the set 1, 2, 3 and 4 we do not need to check if our CONFIG_TYPE is in this set. Signed-off-by: Jonatan Schlag --- src/initscripts/system/network | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/initscripts/system/network b/src/initscripts/system/network index fda16919d..146b3fda8 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -61,11 +61,9 @@ case "${DO}" in # RED if [ "$red" == "1" ]; then - if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then - # Remove possible leftover files - rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf} - [ "$AUTOCONNECT" == "off" ] || /etc/rc.d/init.d/networking/red start - fi + # Remove possible leftover files + rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf} + [ "$AUTOCONNECT" == "off" ] || /etc/rc.d/init.d/networking/red start fi /etc/rc.d/init.d/static-routes start From patchwork Tue May 23 17:23:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6905 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4b0nJpz3wlf for ; Tue, 23 May 2023 17:23:59 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4Z3TB4z6Lk; Tue, 23 May 2023 17:23:58 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4Z2phKz30Kd; Tue, 23 May 2023 17:23:58 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4X07k2z2ySG for ; Tue, 23 May 2023 17:23:56 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4W53srz9Tr; Tue, 23 May 2023 17:23:55 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862635; 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=3D269T2R+UWsS2P/0k9EPk7pIVAKVcT420fEOyqwVPU=; b=h4UNYW0djEv6k+b0650Li4N1rMcLg4MKbroS9wGSpWxR/cPNzmtGxLNMxnaOZaR9i5GfAY v53Qx9T+ToqQ04BQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862635; 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=3D269T2R+UWsS2P/0k9EPk7pIVAKVcT420fEOyqwVPU=; b=uki69sS5ZdtLZaAR7bJRsVrPG8o2gAi3MV3hxK0A1t3bc4hL0nCsMqXXYo100kDZUMkJcF pIcE84r1FCKR8sJYrZT0gPshEqB7YXyRbKbeQmQhgALWgAzWftAJZspizZJ7kKQq+oONNw FEo8gkHm//LnZZALiO/Fy+QUEHxwCGbQfdBc4zcd4C4lMzlBB8yvVgcm+YGvR38cg3m3hg RiZo9ZkQBir0m114ODoXX0lvEJ2G3xFKbzs5BGpKyT4lT/bQoS/M7DdUbiNpbaFPZZNAX6 I3lyAe1Eo9Ltj+fEpjj5Da1yOJiwxNWDOGQKemFQIA0FAhEAxFJ3T24bU7+V5Q== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 06/15] network scripts: remove check for AUTOCONNECT Date: Tue, 23 May 2023 19:23:06 +0200 Message-Id: <20230523172314.7826-7-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This setting is also old (2007) and cannot be set via the webinterface anymore. So why checking for something, which can only be true. Signed-off-by: Jonatan Schlag --- src/initscripts/system/network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 146b3fda8..6a47456f3 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -63,7 +63,7 @@ case "${DO}" in if [ "$red" == "1" ]; then # Remove possible leftover files rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf} - [ "$AUTOCONNECT" == "off" ] || /etc/rc.d/init.d/networking/red start + /etc/rc.d/init.d/networking/red start fi /etc/rc.d/init.d/static-routes start From patchwork Tue May 23 17:23:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6906 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4b3hHFz3wls for ; Tue, 23 May 2023 17:23:59 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4Z4Rdmz1CX; Tue, 23 May 2023 17:23:58 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4Z3NTJz30Kv; Tue, 23 May 2023 17:23:58 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4X5PT8z2ySG for ; Tue, 23 May 2023 17:23:56 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4X3Dykz9V2; Tue, 23 May 2023 17:23:56 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862636; 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=5SdfioiWDLlJ2+7zHo1ZWtJCDq+a5xpYdiiP08M27d4=; b=IrW00QYjy07OO/4EjjOD15I5VmS4GUm49bGd7n6Y7+rA4RCl48Z105QevIeEuhqAH9VyyC PS+Rb1ItFjn/ZODA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862636; 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=5SdfioiWDLlJ2+7zHo1ZWtJCDq+a5xpYdiiP08M27d4=; b=c2zaWMc++27q+dfu76WvbBU8XORDQmiOTliGDyv888ldfY8srmbrwsJ6g3myWonagDqr9m duUgdWe31KePn6y4LLK2Swhtg/P7qggR9rgu4WdaVd1EUJem0kd/v6gklCJzvWKl0D5z7c cIvksZ5P8ZMCHfOk3rhJDnuHviavlRDsEUGCfFR1FYX3z8UFQQcnyzLG/wX1120Mf0bKgi isR8K/602chPhNxDDyp0RUjHMvYnEfYl48MdvBB8Oid7YX5GMnhT4IjYY5Tj+FA6qWIqTN ssaS+0sy0bJT0EJ2VSy47O98P8Yi4rwv4A5aY/Bc2Xmvb5qG9CcWtH/SCe/FfQ== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 07/15] network startup: Reload routing informations for every interface Date: Tue, 23 May 2023 19:23:07 +0200 Message-Id: <20230523172314.7826-8-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This reload can and needs to be done when an interface is started. Not only when all interfaces are started. Signed-off-by: Jonatan Schlag --- src/initscripts/networking/any | 2 ++ src/initscripts/system/network | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/initscripts/networking/any b/src/initscripts/networking/any index 6dba5bef9..ec1321ad9 100644 --- a/src/initscripts/networking/any +++ b/src/initscripts/networking/any @@ -109,6 +109,8 @@ case "${1}" in ip addr add ${args} dev ${DEVICE} evaluate_retval fi + + /etc/rc.d/init.d/static-routes reload ;; stop) diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 6a47456f3..b346d487c 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -66,8 +66,6 @@ case "${DO}" in /etc/rc.d/init.d/networking/red start fi - /etc/rc.d/init.d/static-routes start - boot_mesg "Mounting network file systems..." mount -a -O _netdev evaluate_retval From patchwork Tue May 23 17:23:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6907 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4c4Qczz3wlf for ; Tue, 23 May 2023 17:24:00 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4Z6DTjz9Vt; Tue, 23 May 2023 17:23:58 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4Z3rfJz30L6; Tue, 23 May 2023 17:23:58 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4Y2cJkz2ySG for ; Tue, 23 May 2023 17:23:57 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4Y14f1z9Tr; Tue, 23 May 2023 17:23:57 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862637; 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=JDDZUdorWqHiD6OlcnO+URMPZC7+kMtre0wF3Qqb9u4=; b=ZKqtqcLXc4h/SxbbrAIgzEa2Em/KSU+WREk+7PUyUnKRsaiTWDENRUp9ZtpRO+KaRu/Wz/ EunVuEGWOu8N1qBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862637; 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=JDDZUdorWqHiD6OlcnO+URMPZC7+kMtre0wF3Qqb9u4=; b=lFl5TOSx4r+xX94mot8ccrzPt4ieUQNtytdFKReUs0v4I9MX1YsVHJ+yjXulqpvfnlMOC7 heADdQ/o1UpMJQayiDheiu4o0imWouhv9LxNmYimn7K8vrgv2i4LOpIxTWHZ5Vh1+5/T5B F7H5tUjoelu7L4g/fKCLEVY+dw510uckgYgZGn067QWlhV1eWnlVrxOKjigfKvv78HruEp Kf4aC97E60vi6DRs0hYjg33G1ZhHPzZZa3Y/HmxztWqgThYSyGrUBdAG1tHSvHb5ZqlKKG FDDsSE2yM6eGYc31r6x8jHqJXC+aZ2dNVqNqQFSKk5+b1QmJWU5SgXRlLDUxRA== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 08/15] network startup: Always cleanup before red gets started Date: Tue, 23 May 2023 19:23:08 +0200 Message-Id: <20230523172314.7826-9-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" There is no sense in doing this only in /etc/init.d/network and not in /etc/init.d/networking/red This files should be always deleted before a startup Signed-off-by: Jonatan Schlag --- src/initscripts/networking/red | 3 +++ src/initscripts/system/network | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/initscripts/networking/red b/src/initscripts/networking/red index 8e41314b6..3873974ea 100644 --- a/src/initscripts/networking/red +++ b/src/initscripts/networking/red @@ -80,6 +80,9 @@ fi case "${1}" in start) + # Remove possible leftover files + rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf} + if [ "${DEVICE}" != "${GREEN_DEV}" ] && [ "${DEVICE}" != "" ]; then boot_mesg "Bringing up the ${DEVICE} interface..." boot_mesg_flush diff --git a/src/initscripts/system/network b/src/initscripts/system/network index b346d487c..9694165f2 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -60,11 +60,7 @@ case "${DO}" in [ "$orange" == "1" ] && /etc/rc.d/init.d/networking/orange start # RED - if [ "$red" == "1" ]; then - # Remove possible leftover files - rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf} - /etc/rc.d/init.d/networking/red start - fi + [ "$red" == "1" ] && /etc/rc.d/init.d/networking/red start boot_mesg "Mounting network file systems..." mount -a -O _netdev From patchwork Tue May 23 17:23:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6908 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4d4jbHz3wls for ; Tue, 23 May 2023 17:24:01 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4c5ZPYz1bD; Tue, 23 May 2023 17:24:00 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4c4nbgz2ypP; Tue, 23 May 2023 17:24:00 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4Y6tkJz2ySG for ; Tue, 23 May 2023 17:23:57 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4Y5hkvzfB; Tue, 23 May 2023 17:23:57 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862637; 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=G0yFDW5kRyy3sg3bwM0t6wCsrMo6eodShJuBigH7wTQ=; b=Dn6OfRMRXNEw8UTTc2DkifcZF7LyQJrCOIsse2BSlwrVMxd3hZDmjgOUZa7jPLfiSuHoBk 1JigpV8i88NhjSDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862637; 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=G0yFDW5kRyy3sg3bwM0t6wCsrMo6eodShJuBigH7wTQ=; b=jY1wCoKmlrlxcaUFMs8lq+jdrk/m+Kq0Wk8O+pPAAP79NDs4iEPdptjFj4NBv7PKV2trEe tEzsHUXlhJSFD9Lj2u6JOVedZeBXC7I3AXP7VpfxKH6SDdy157Gar2Ns0L/JNZFTlPLlIp O/voZstv08oKDOE3wAlvBbb+mQs4n8wuA17GwOCE3NR8B2cY+YMr/xFfYjFFYi4T55b/KL 1POxQPlBUKCQZYZ6IgPQYn7n/XoLL6Olpo9uuLdyWhpNpYhYO1I0c4txugC4vp5aXZCUri nJIgCCfzPUV+UWnoI2SBSWXdiJFT1VIvKhChc50miXyEVC58/0r2BaC1Hq34iA== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 09/15] network startup: check for correct action at start Date: Tue, 23 May 2023 19:23:09 +0200 Message-Id: <20230523172314.7826-10-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" If we check this at the end, we already do some calculation in the next line. For example checking if the devices are correct. This is not necessary as we can already stop when we get an "stoop" or something like: /etc/init.d/network green stop This currently ends in an infinite loop, which gets fixed by this change. Signed-off-by: Jonatan Schlag --- src/initscripts/system/network | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 9694165f2..06240f53c 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -26,6 +26,11 @@ eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) DO="${1}" shift +if ! [[ "${DO}" == "start" || "${DO}" == "restart" || "${DO}" == "stop" ]]; then + echo "Usage: ${0} {start|stop|restart} [device(s)]" + exit 1 +fi + if [ -n "${1}" ]; then ALL=0 for i in green red blue orange; do @@ -100,9 +105,4 @@ case "${DO}" in sleep 1 ${0} start ${ARGS} ;; - - *) - echo "Usage: ${0} {start|stop|restart} [device(s)]" - exit 1 - ;; esac From patchwork Tue May 23 17:23:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6909 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4d74FPz3wlf for ; Tue, 23 May 2023 17:24:01 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4c6ByZz9WJ; Tue, 23 May 2023 17:24:00 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4c5dXTz30Kd; Tue, 23 May 2023 17:24:00 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4Z4lV7z2ypP for ; Tue, 23 May 2023 17:23:58 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4Z2ynSzfB; Tue, 23 May 2023 17:23:58 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862638; 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=l0WFUic92WrM648ZHJPvMYebbQv1b0HphHknhjodmiE=; b=d1LWJK4lhhH4A6oLf0zLedjTUd9Tx4KlCKhPlqG7SqLvMmFNZnC3cMqF1DXaBtY6wCK5AD TAk+c5N2kO5Z7dCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862638; 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=l0WFUic92WrM648ZHJPvMYebbQv1b0HphHknhjodmiE=; b=Qoj+BcAd5yticOQ3h1Vh7y8uFiVbNevfwguxzRnDn7VpzW7l1LaHpiU5X+zRgrE4hqtyxs JNsil/UUqZhBZ20z/c6fW+UXDgkZhZVzjf4iVel9pR63eDZ2ChORiVaaloF/eklmQUbAIK v1vhinjqXZUG1I5KiTK/rYIbZlqqxHoph161mRL4AkEgg78sbNBu0KQeCybeZm+MSODvuF xkFrJmGJAAAUnhcW9fK8a2FfQoHigXYHwhdXbx5WkaHswqPB3MaqJM5u9yvmCufpc0mOiE G9y3KpgkTIs/2Z5XqEgMU1utjSAa56TfMDZ7mf/4iK4M9Qu9iUl4O4pKg6YXaA== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 10/15] network startup: Refactor how cmd args are processed Date: Tue, 23 May 2023 19:23:10 +0200 Message-Id: <20230523172314.7826-11-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This avoids eval and all other sorts of things. We also now exit when we get an invalid zone name. Signed-off-by: Jonatan Schlag --- src/initscripts/system/network | 52 ++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 06240f53c..008fbbe2b 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -31,41 +31,51 @@ if ! [[ "${DO}" == "start" || "${DO}" == "restart" || "${DO}" == "stop" ]]; the exit 1 fi -if [ -n "${1}" ]; then - ALL=0 - for i in green red blue orange; do - eval "${i}=0" - done -else - ALL=1 - for i in green red blue orange; do - eval "${i}=1" - done +declare -A ZONE_ACTION + +ZONE_ACTION[blue]=false +ZONE_ACTION[green]=false +ZONE_ACTION[orange]=false +ZONE_ACTION[red]=false + +if [ $# -eq 0 ]; then + ZONE_ACTION[blue]=true + ZONE_ACTION[green]=true + ZONE_ACTION[orange]=true + ZONE_ACTION[red]=true fi -while [ ! $# = 0 ]; do +while [ $# -ne 0 ]; do + ZONE_VALID=false for i in green red blue orange; do if [ "${i}" == "${1}" ]; then - eval "${i}=1" + ZONE_ACTION[${i}]=true + ZONE_VALID=true shift + break fi done + + if ! ${ZONE_VALID}; then + echo "'${1}' is not a valid zone. Cannot go on." + exit 1 + fi done case "${DO}" in start) # Starting interfaces... # GREEN - [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green start + ${ZONE_ACTION[green]} && /etc/rc.d/init.d/networking/green start # BLUE - [ "$blue" == "1" ] && /etc/rc.d/init.d/networking/blue start + ${ZONE_ACTION[blue]} && /etc/rc.d/init.d/networking/blue start # ORANGE - [ "$orange" == "1" ] && /etc/rc.d/init.d/networking/orange start + ${ZONE_ACTION[orange]} && /etc/rc.d/init.d/networking/orange start # RED - [ "$red" == "1" ] && /etc/rc.d/init.d/networking/red start + ${ZONE_ACTION[red]} && /etc/rc.d/init.d/networking/red start boot_mesg "Mounting network file systems..." mount -a -O _netdev @@ -79,16 +89,16 @@ case "${DO}" in # Stopping interfaces... # GREEN - [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green stop + ${ZONE_ACTION[green]} && /etc/rc.d/init.d/networking/green stop # BLUE - [ "$blue" == "1" ] && /etc/rc.d/init.d/networking/blue stop + ${ZONE_ACTION[blue]} && /etc/rc.d/init.d/networking/blue stop # ORANGE - [ "$orange" == "1" ] && /etc/rc.d/init.d/networking/orange stop + ${ZONE_ACTION[orange]} && /etc/rc.d/init.d/networking/orange stop # RED - if [ "$red" == "1" ]; then + if ${ZONE_ACTION[red]}; then /etc/rc.d/init.d/networking/red stop fi @@ -97,7 +107,7 @@ case "${DO}" in restart) for i in green red blue orange; do - if [ "${!i}" == "1" ]; then + if {ZONE_ACTION[${i}]}; then ARGS+=" ${i}" fi done From patchwork Tue May 23 17:23:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6910 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4f6ghdz3wls for ; Tue, 23 May 2023 17:24:02 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4d1kyTz9Vp; Tue, 23 May 2023 17:24:01 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4c67r3z30Km; Tue, 23 May 2023 17:24:00 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4b6ksKz2xR4 for ; Tue, 23 May 2023 17:23:59 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4b0Hnlz9WJ; Tue, 23 May 2023 17:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862639; 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=5aAiS96RsV7mO7Nxbn4i+L36Y2w/Fl0nYmMqAeSywuc=; b=Z8RBiiuJEP5PsufOg2XRoO7gAOgpE0amB3qycasFpJ830a7iA90HSV/WK2LxeEHBSw3Nkc kcZMzgSBjOUU/04iN3hyHL8OTBYXjJEftxZuaJWIg61HPe3MP7uGtdx8bC9LtTnNxoMDvR EjYtREFxaJ4ZyG6ntAr+d31U4Kf9iKZzRJyFxYuG3++BHQTfWQcrxOkwA5A5Cy0ZCCNRiC b3nKE6u81HamIEU+1Zz8iWYFEKqcSaMpWpmYW47KFgF26N7DFpxGdP3sYWOtQXxjg91AtI 752O5aooviAae85vfcwSZyE4ztwddl81NWHhJWQ0e0+QkLeN064h1t6EU/cIxQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862639; 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=5aAiS96RsV7mO7Nxbn4i+L36Y2w/Fl0nYmMqAeSywuc=; b=6tzlwMtWTkU9XXKxsfuSm8figZltLj2oC9+0hdQifhJWhffKJZOkltx4x5FtYNYGa3vTYb zTJRH+hxH6bjEmCw== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 11/15] network startup: Clean up duplicated Code Date: Tue, 23 May 2023 19:23:11 +0200 Message-Id: <20230523172314.7826-12-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This gives us more flexibilty for future changes. Signed-off-by: Jonatan Schlag --- src/initscripts/system/network | 43 +++++++++++++--------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 008fbbe2b..0db64eaad 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -31,6 +31,13 @@ if ! [[ "${DO}" == "start" || "${DO}" == "restart" || "${DO}" == "stop" ]]; the exit 1 fi +declare -a VALID_ZONES + +VALID_ZONES+=("blue") +VALID_ZONES+=("green") +VALID_ZONES+=("orange") +VALID_ZONES+=("red") + declare -A ZONE_ACTION ZONE_ACTION[blue]=false @@ -47,7 +54,7 @@ fi while [ $# -ne 0 ]; do ZONE_VALID=false - for i in green red blue orange; do + for i in "${VALID_ZONES[@]}"; do if [ "${i}" == "${1}" ]; then ZONE_ACTION[${i}]=true ZONE_VALID=true @@ -65,17 +72,9 @@ done case "${DO}" in start) # Starting interfaces... - # GREEN - ${ZONE_ACTION[green]} && /etc/rc.d/init.d/networking/green start - - # BLUE - ${ZONE_ACTION[blue]} && /etc/rc.d/init.d/networking/blue start - - # ORANGE - ${ZONE_ACTION[orange]} && /etc/rc.d/init.d/networking/orange start - - # RED - ${ZONE_ACTION[red]} && /etc/rc.d/init.d/networking/red start + for i in "${VALID_ZONES[@]}"; do + ${ZONE_ACTION[${i}]} && /etc/rc.d/init.d/networking/${i} start + done boot_mesg "Mounting network file systems..." mount -a -O _netdev @@ -88,26 +87,16 @@ case "${DO}" in evaluate_retval # Stopping interfaces... - # GREEN - ${ZONE_ACTION[green]} && /etc/rc.d/init.d/networking/green stop - - # BLUE - ${ZONE_ACTION[blue]} && /etc/rc.d/init.d/networking/blue stop - - # ORANGE - ${ZONE_ACTION[orange]} && /etc/rc.d/init.d/networking/orange stop - - # RED - if ${ZONE_ACTION[red]}; then - /etc/rc.d/init.d/networking/red stop - fi + for i in "${VALID_ZONES[@]}"; do + ${ZONE_ACTION[${i}]} && /etc/rc.d/init.d/networking/${i} stop + done exit 0 ;; restart) - for i in green red blue orange; do - if {ZONE_ACTION[${i}]}; then + for i in "${VALID_ZONES[@]}"; do + if ${ZONE_ACTION[${i}]}; then ARGS+=" ${i}" fi done From patchwork Tue May 23 17:23:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6911 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4h54JRz3wlf for ; Tue, 23 May 2023 17:24:04 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4h03nHz1V2; Tue, 23 May 2023 17:24:04 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4g6cVbz30Kd; Tue, 23 May 2023 17:24:03 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4d1Vrdz2yTC for ; Tue, 23 May 2023 17:24:01 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4c6YgXz9WM; Tue, 23 May 2023 17:24:00 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862640; 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=uB1W/dX60tFKRUVUfnvFW076F0sO+PCSAxrzpqsT/7s=; b=KJ6LdmurMtcNL6KppiX6qaM0NqWJVFDD7ncG3bp/19qWHhuMT7xBZyX/Tuw3jKJrmyUjou YE1A0lt1/TTZ8kBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862640; 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=uB1W/dX60tFKRUVUfnvFW076F0sO+PCSAxrzpqsT/7s=; b=Wo4S8hdEyrl6I9/iDJzATG8Bu2Ss7VO1WK8HbYK36VC3MrgZqD5CBhjBkcXfuLO0h7tyv+ Yw/Bi1rznrKwfFj2h00N04HBfCuV5DKuwnMnKZ6jn+scTlRPxeSdsS6lqSJEURd8AgYHQ+ S8JMSrTOkFFiOUzgLmr5KgHd7HRiM/yZs2Fo84Jor/B7HV4y47xFFUdIigGDskFUog57br ruez3SeawVGKG1DVMwOJqzVS1SR63c8hHtcm9CMBldaj1uYf1GVacCY7aLqvHNy4+FfYKE 4/5DrEnlmVosx6pd3ODUPjqKARRlhDcF3w6N/Xr7WSqtUNKjTa/f8DhESXF3sg== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 12/15] network script: add extra scripts for action that depend on a network Date: Tue, 23 May 2023 19:23:12 +0200 Message-Id: <20230523172314.7826-13-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This allows us to split the network startup further up into seperate scripts. The mount of the network filesystems is now done after the startup of the network, but can be delayed further when the network is started through seperate scripts. Signed-off-by: Jonatan Schlag --- config/rootfiles/common/aarch64/initscripts | 4 +++ config/rootfiles/common/riscv64/initscripts | 4 +++ config/rootfiles/common/x86_64/initscripts | 4 +++ lfs/initscripts | 3 ++ src/initscripts/system/depends-on-network | 40 +++++++++++++++++++++ src/initscripts/system/network | 8 ----- 6 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 src/initscripts/system/depends-on-network diff --git a/config/rootfiles/common/aarch64/initscripts b/config/rootfiles/common/aarch64/initscripts index d9f80e6b2..506f616e6 100644 --- a/config/rootfiles/common/aarch64/initscripts +++ b/config/rootfiles/common/aarch64/initscripts @@ -18,6 +18,7 @@ etc/rc.d/init.d/collectd etc/rc.d/init.d/connectd etc/rc.d/init.d/conntrackd etc/rc.d/init.d/console +etc/rc.d/init.d/depends-on-network etc/rc.d/init.d/dhcp etc/rc.d/init.d/dhcrelay etc/rc.d/init.d/fcron @@ -105,6 +106,7 @@ etc/rc.d/rc0.d/K49cyrus-sasl etc/rc.d/rc0.d/K51vnstat etc/rc.d/rc0.d/K77conntrackd etc/rc.d/rc0.d/K78suricata +etc/rc.d/rc0.d/K79depends-on-network etc/rc.d/rc0.d/K79leds etc/rc.d/rc0.d/K80network etc/rc.d/rc0.d/K82wlanclient @@ -128,6 +130,7 @@ etc/rc.d/rc3.d/S15fireinfo etc/rc.d/rc3.d/S19smartenabler etc/rc.d/rc3.d/S19wlanclient etc/rc.d/rc3.d/S20network +etc/rc.d/rc3.d/S21depends-on-network etc/rc.d/rc3.d/S21leds etc/rc.d/rc3.d/S22conntrackd etc/rc.d/rc3.d/S24cyrus-sasl @@ -154,6 +157,7 @@ etc/rc.d/rc6.d/K49cyrus-sasl etc/rc.d/rc6.d/K51vnstat etc/rc.d/rc6.d/K77conntrackd etc/rc.d/rc6.d/K78suricata +etc/rc.d/rc6.d/K79depends-on-network etc/rc.d/rc6.d/K79leds etc/rc.d/rc6.d/K80network etc/rc.d/rc6.d/K82wlanclient diff --git a/config/rootfiles/common/riscv64/initscripts b/config/rootfiles/common/riscv64/initscripts index a4865aa29..e834cbfc3 100644 --- a/config/rootfiles/common/riscv64/initscripts +++ b/config/rootfiles/common/riscv64/initscripts @@ -18,6 +18,7 @@ etc/rc.d/init.d/collectd etc/rc.d/init.d/connectd etc/rc.d/init.d/conntrackd etc/rc.d/init.d/console +etc/rc.d/init.d/depends-on-network etc/rc.d/init.d/dhcp etc/rc.d/init.d/dhcrelay etc/rc.d/init.d/fcron @@ -104,6 +105,7 @@ etc/rc.d/rc0.d/K49cyrus-sasl etc/rc.d/rc0.d/K51vnstat etc/rc.d/rc0.d/K77conntrackd etc/rc.d/rc0.d/K78suricata +etc/rc.d/rc0.d/K79depends-on-network etc/rc.d/rc0.d/K79leds etc/rc.d/rc0.d/K80network etc/rc.d/rc0.d/K82wlanclient @@ -127,6 +129,7 @@ etc/rc.d/rc3.d/S15fireinfo etc/rc.d/rc3.d/S19smartenabler etc/rc.d/rc3.d/S19wlanclient etc/rc.d/rc3.d/S20network +etc/rc.d/rc3.d/S21depends-on-network etc/rc.d/rc3.d/S21leds etc/rc.d/rc3.d/S22conntrackd etc/rc.d/rc3.d/S24cyrus-sasl @@ -153,6 +156,7 @@ etc/rc.d/rc6.d/K49cyrus-sasl etc/rc.d/rc6.d/K51vnstat etc/rc.d/rc6.d/K77conntrackd etc/rc.d/rc6.d/K78suricata +etc/rc.d/rc6.d/K79depends-on-network etc/rc.d/rc6.d/K79leds etc/rc.d/rc6.d/K80network etc/rc.d/rc6.d/K82wlanclient diff --git a/config/rootfiles/common/x86_64/initscripts b/config/rootfiles/common/x86_64/initscripts index a4865aa29..e834cbfc3 100644 --- a/config/rootfiles/common/x86_64/initscripts +++ b/config/rootfiles/common/x86_64/initscripts @@ -18,6 +18,7 @@ etc/rc.d/init.d/collectd etc/rc.d/init.d/connectd etc/rc.d/init.d/conntrackd etc/rc.d/init.d/console +etc/rc.d/init.d/depends-on-network etc/rc.d/init.d/dhcp etc/rc.d/init.d/dhcrelay etc/rc.d/init.d/fcron @@ -104,6 +105,7 @@ etc/rc.d/rc0.d/K49cyrus-sasl etc/rc.d/rc0.d/K51vnstat etc/rc.d/rc0.d/K77conntrackd etc/rc.d/rc0.d/K78suricata +etc/rc.d/rc0.d/K79depends-on-network etc/rc.d/rc0.d/K79leds etc/rc.d/rc0.d/K80network etc/rc.d/rc0.d/K82wlanclient @@ -127,6 +129,7 @@ etc/rc.d/rc3.d/S15fireinfo etc/rc.d/rc3.d/S19smartenabler etc/rc.d/rc3.d/S19wlanclient etc/rc.d/rc3.d/S20network +etc/rc.d/rc3.d/S21depends-on-network etc/rc.d/rc3.d/S21leds etc/rc.d/rc3.d/S22conntrackd etc/rc.d/rc3.d/S24cyrus-sasl @@ -153,6 +156,7 @@ etc/rc.d/rc6.d/K49cyrus-sasl etc/rc.d/rc6.d/K51vnstat etc/rc.d/rc6.d/K77conntrackd etc/rc.d/rc6.d/K78suricata +etc/rc.d/rc6.d/K79depends-on-network etc/rc.d/rc6.d/K79leds etc/rc.d/rc6.d/K80network etc/rc.d/rc6.d/K82wlanclient diff --git a/lfs/initscripts b/lfs/initscripts index e078632ab..263292da9 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -103,6 +103,7 @@ $(TARGET) : ln -sf ../init.d/vnstat /etc/rc.d/rc0.d/K51vnstat ln -sf ../init.d/conntrackd /etc/rc.d/rc0.d/K77conntrackd ln -sf ../init.d/suricata /etc/rc.d/rc0.d/K78suricata + ln -sf ../init.d/depends-on-network /etc/rc.d/rc0.d/K79depends-on-network ln -sf ../init.d/leds /etc/rc.d/rc0.d/K79leds ln -sf ../init.d/network /etc/rc.d/rc0.d/K80network ln -sf ../init.d/wlanclient /etc/rc.d/rc0.d/K82wlanclient @@ -124,6 +125,7 @@ $(TARGET) : ln -sf ../init.d/smartenabler /etc/rc.d/rc3.d/S19smartenabler ln -sf ../init.d/wlanclient /etc/rc.d/rc3.d/S19wlanclient ln -sf ../init.d/network /etc/rc.d/rc3.d/S20network + ln -sf ../init.d/depends-on-network /etc/rc.d/rc3.d/S21depends-on-network ln -sf ../init.d/leds /etc/rc.d/rc3.d/S21leds ln -sf ../init.d/conntrackd /etc/rc.d/rc3.d/S22conntrackd ln -sf ../init.d/cyrus-sasl /etc/rc.d/rc3.d/S24cyrus-sasl @@ -148,6 +150,7 @@ $(TARGET) : ln -sf ../init.d/vnstat /etc/rc.d/rc6.d/K51vnstat ln -sf ../init.d/conntrackd /etc/rc.d/rc6.d/K77conntrackd ln -sf ../init.d/suricata /etc/rc.d/rc6.d/K78suricata + ln -sf ../init.d/depends-on-network /etc/rc.d/rc6.d/K79depends-on-network ln -sf ../init.d/leds /etc/rc.d/rc6.d/K79leds ln -sf ../init.d/network /etc/rc.d/rc6.d/K80network ln -sf ../init.d/wlanclient /etc/rc.d/rc6.d/K82wlanclient diff --git a/src/initscripts/system/depends-on-network b/src/initscripts/system/depends-on-network new file mode 100644 index 000000000..777a2dbd1 --- /dev/null +++ b/src/initscripts/system/depends-on-network @@ -0,0 +1,40 @@ +#!/bin/bash +######################################################################## +# Begin $rc_base/init.d/depends-on-network +# +# Description : Script to execute actions after complete network startup +# +# Notes : Written for IPFire by its team +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +DO="${1}" +shift + +case "${DO}" in + start) + boot_mesg "Mounting network file systems..." + mount -a -O _netdev + evaluate_retval + ;; + + stop) + boot_mesg "Umounting network file systems..." + umount -a -O _netdev + evaluate_retval + ;; + restart) + ${0} stop + sleep 1 + ${0} start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + +# End /etc/rc.d/init.d/depends-on-network diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 0db64eaad..e3fe47597 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -75,17 +75,9 @@ case "${DO}" in for i in "${VALID_ZONES[@]}"; do ${ZONE_ACTION[${i}]} && /etc/rc.d/init.d/networking/${i} start done - - boot_mesg "Mounting network file systems..." - mount -a -O _netdev - evaluate_retval ;; stop) - boot_mesg "Umounting network file systems..." - umount -a -O _netdev - evaluate_retval - # Stopping interfaces... for i in "${VALID_ZONES[@]}"; do ${ZONE_ACTION[${i}]} && /etc/rc.d/init.d/networking/${i} stop From patchwork Tue May 23 17:23:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6912 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4j2fqzz3wls for ; Tue, 23 May 2023 17:24:05 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4h17VNz9Tr; Tue, 23 May 2023 17:24:04 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4h017Hz30Kv; Tue, 23 May 2023 17:24:04 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4f06SZz2yTC for ; Tue, 23 May 2023 17:24:02 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4d4r7Cz67K; Tue, 23 May 2023 17:24:01 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862641; 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=5g0cFHZUVRtAAOJAjekeaHliuv981yXzbbINaXItEE4=; b=oV4cRpKI37qESkKEG3+lM3WEkYcmlG1z7sMa9lTSi9/ShvwEI6TG4+l8TNMhQYOnypKSIX 5pW5zNrMfZQhTmAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862641; 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=5g0cFHZUVRtAAOJAjekeaHliuv981yXzbbINaXItEE4=; b=VKjiIswneF0XadVK9zFovSjY5ULxTKI/CPRZLL4Om543RmaQkNJyjNHFiHHJEZTLeHZQIY cVxtr7Ndus5+tHzM6nG5RqdqwkBjFpipdFEryUqzrDGuZ1AnvBhVnwLZDZQhWAVPYh3acI XnkEReod3p+ipYVeMjoaYWyIVBUtTL/NakTlhb9n0AauIGxuj0TWFDtcGJfLamzhWdId3q kavKvswlK6zBuEhhp7RWOkwxfoUtEhqeb2HsQabocZp5F/iv1ns4CNZke3s7edK5iC2DeU XSOL6cYf7NlbmCPiTLuCIZNQqI9iAB5Lm8adLKiURaL5LX6blJVQIbUrxck+3A== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 13/15] network startup: Add scripts for local and uplink Date: Tue, 23 May 2023 19:23:13 +0200 Message-Id: <20230523172314.7826-14-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This allows us to start the local and uplink network independent of each other. The function of /etc/init.d/network remains unchangend to maintain backwards compatibility. Signed-off-by: Jonatan Schlag --- config/rootfiles/common/aarch64/initscripts | 2 ++ config/rootfiles/common/riscv64/initscripts | 2 ++ config/rootfiles/common/x86_64/initscripts | 2 ++ lfs/initscripts | 3 +++ src/initscripts/system/network | 22 ++++++++++++--------- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/config/rootfiles/common/aarch64/initscripts b/config/rootfiles/common/aarch64/initscripts index 506f616e6..739503ae6 100644 --- a/config/rootfiles/common/aarch64/initscripts +++ b/config/rootfiles/common/aarch64/initscripts @@ -36,6 +36,8 @@ etc/rc.d/init.d/mountfs etc/rc.d/init.d/mountkernfs etc/rc.d/init.d/mounttmpfs etc/rc.d/init.d/network +etc/rc.d/init.d/network-local +etc/rc.d/init.d/network-uplink #etc/rc.d/init.d/networking etc/rc.d/init.d/networking/any etc/rc.d/init.d/networking/blue diff --git a/config/rootfiles/common/riscv64/initscripts b/config/rootfiles/common/riscv64/initscripts index e834cbfc3..ed1eae904 100644 --- a/config/rootfiles/common/riscv64/initscripts +++ b/config/rootfiles/common/riscv64/initscripts @@ -36,6 +36,8 @@ etc/rc.d/init.d/mountfs etc/rc.d/init.d/mountkernfs etc/rc.d/init.d/mounttmpfs etc/rc.d/init.d/network +etc/rc.d/init.d/network-local +etc/rc.d/init.d/network-uplink #etc/rc.d/init.d/networking etc/rc.d/init.d/networking/any etc/rc.d/init.d/networking/blue diff --git a/config/rootfiles/common/x86_64/initscripts b/config/rootfiles/common/x86_64/initscripts index e834cbfc3..ed1eae904 100644 --- a/config/rootfiles/common/x86_64/initscripts +++ b/config/rootfiles/common/x86_64/initscripts @@ -36,6 +36,8 @@ etc/rc.d/init.d/mountfs etc/rc.d/init.d/mountkernfs etc/rc.d/init.d/mounttmpfs etc/rc.d/init.d/network +etc/rc.d/init.d/network-local +etc/rc.d/init.d/network-uplink #etc/rc.d/init.d/networking etc/rc.d/init.d/networking/any etc/rc.d/init.d/networking/blue diff --git a/lfs/initscripts b/lfs/initscripts index 263292da9..e8a2e4c6e 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -193,6 +193,9 @@ $(TARGET) : ln -sf any /etc/rc.d/init.d/networking/$$i; \ done + ln -sf /etc/rc.d/init.d/network /etc/rc.d/init.d/network-local + ln -sf /etc/rc.d/init.d/networking/red /etc/rc.d/init.d/network-uplink + # intel intel no swconfig ifeq "$(BUILD_PLATFORM)" "arm" ln -sf ../init.d/swconfig /etc/rc.d/rcsysinit.d/S73swconfig diff --git a/src/initscripts/system/network b/src/initscripts/system/network index e3fe47597..ff305e472 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -36,20 +36,24 @@ declare -a VALID_ZONES VALID_ZONES+=("blue") VALID_ZONES+=("green") VALID_ZONES+=("orange") -VALID_ZONES+=("red") + +# If we are called as /etc/init.d/network also red is a valid zone. +# Otherwise we are called as /etc/init.d/network-local where red +# is invalid. +if [[ "$(basename $0)" == "network" ]]; then + VALID_ZONES+=("red") +fi declare -A ZONE_ACTION -ZONE_ACTION[blue]=false -ZONE_ACTION[green]=false -ZONE_ACTION[orange]=false -ZONE_ACTION[red]=false +for i in "${VALID_ZONES[@]}"; do + ZONE_ACTION[${i}]=false +done if [ $# -eq 0 ]; then - ZONE_ACTION[blue]=true - ZONE_ACTION[green]=true - ZONE_ACTION[orange]=true - ZONE_ACTION[red]=true + for i in "${VALID_ZONES[@]}"; do + ZONE_ACTION[${i}]=true + done fi while [ $# -ne 0 ]; do From patchwork Tue May 23 17:23:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6913 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4j6dvwz3wlf for ; Tue, 23 May 2023 17:24:05 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4h2gsSz9W6; Tue, 23 May 2023 17:24:04 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4h0XMQz30L6; Tue, 23 May 2023 17:24:04 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4f5HYqz2yTC for ; Tue, 23 May 2023 17:24:02 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4f3fCPz1V2; Tue, 23 May 2023 17:24:02 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862642; 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=GpZay52aJmT6A66LmV1OKZeoyFXUlY2BUpXd+Rh7Y4A=; b=Oa4XZ97q5/zcBQCtFb9IXSqq8KMzQsHF8sS6BD+qVUEw9phxR0184PnO1u4RT4ynp/FwNk fM0YBC6L1CYAUzAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862642; 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=GpZay52aJmT6A66LmV1OKZeoyFXUlY2BUpXd+Rh7Y4A=; b=eXLPqZO214V1IkhGPVdgREeRYFbDQiKWxI8OYlzS36wXBeXFIahnDGtoNVfQa0pGWWFBvC 6GeMWNyA9xDUQ24JAfbbMIPUpHxNrpnR8OjVhAXIT8I8o8VevS6qXnKjW4cl+yiwedC5mL i0ctnKlKFFj/Zr9PTb/k1SqI65r8Du12j9zdXoSU25/4T5v9/bDGzUpUTIQRuJxUcW4tw/ jDFqxzhOgAADTJWQHH7AI/mvjrBgOGSbGRAegQVonPUe9m0ByTkVKlpjqdL4qUTb4vRBmK GBZth+xUyh6/X+8XBi4eNhhyU/5fs5HalDorkAgMzyIDlHWU4a+B35aasQSpTg== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 14/15] network startup: Start local and uplink network independent Date: Tue, 23 May 2023 19:23:14 +0200 Message-Id: <20230523172314.7826-15-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This allows us several things: 1. We can start apache and sshd earlier. This makes debugging and troubleshooting easier. When the startup hangs at red an admin can now at least login and search for what is wrong. 2. We can change the implementation of local and uplink network easier as both are a little bit more independent as before. Fixes: #11502 Signed-off-by: Jonatan Schlag --- config/rootfiles/common/aarch64/initscripts | 27 ++++++++++--------- config/rootfiles/common/riscv64/initscripts | 27 ++++++++++--------- config/rootfiles/common/x86_64/initscripts | 27 ++++++++++--------- lfs/initscripts | 29 ++++++++++++--------- 4 files changed, 61 insertions(+), 49 deletions(-) diff --git a/config/rootfiles/common/aarch64/initscripts b/config/rootfiles/common/aarch64/initscripts index 739503ae6..b3187fb45 100644 --- a/config/rootfiles/common/aarch64/initscripts +++ b/config/rootfiles/common/aarch64/initscripts @@ -110,8 +110,9 @@ etc/rc.d/rc0.d/K77conntrackd etc/rc.d/rc0.d/K78suricata etc/rc.d/rc0.d/K79depends-on-network etc/rc.d/rc0.d/K79leds -etc/rc.d/rc0.d/K80network -etc/rc.d/rc0.d/K82wlanclient +etc/rc.d/rc0.d/K80network-uplink +etc/rc.d/rc0.d/K81wlanclient +etc/rc.d/rc0.d/K82network-local #etc/rc.d/rc0.d/K85messagebus etc/rc.d/rc0.d/K86unbound etc/rc.d/rc0.d/K87acpid @@ -130,14 +131,15 @@ etc/rc.d/rc3.d/S15fireinfo #etc/rc.d/rc3.d/S15messagebus #etc/rc.d/rc3.d/S18cpufreq etc/rc.d/rc3.d/S19smartenabler -etc/rc.d/rc3.d/S19wlanclient -etc/rc.d/rc3.d/S20network -etc/rc.d/rc3.d/S21depends-on-network -etc/rc.d/rc3.d/S21leds -etc/rc.d/rc3.d/S22conntrackd -etc/rc.d/rc3.d/S24cyrus-sasl -etc/rc.d/rc3.d/S30sshd -etc/rc.d/rc3.d/S32apache +etc/rc.d/rc3.d/S20network-local +etc/rc.d/rc3.d/S21sshd +etc/rc.d/rc3.d/S22apache +etc/rc.d/rc3.d/S23wlanclient +etc/rc.d/rc3.d/S24network-uplink +etc/rc.d/rc3.d/S25depends-on-network +etc/rc.d/rc3.d/S25leds +etc/rc.d/rc3.d/S30conntrackd +etc/rc.d/rc3.d/S35cyrus-sasl etc/rc.d/rc3.d/S40fcron #etc/rc.d/rc3.d/S66client175 etc/rc.d/rc3.d/S98rc.local @@ -161,8 +163,9 @@ etc/rc.d/rc6.d/K77conntrackd etc/rc.d/rc6.d/K78suricata etc/rc.d/rc6.d/K79depends-on-network etc/rc.d/rc6.d/K79leds -etc/rc.d/rc6.d/K80network -etc/rc.d/rc6.d/K82wlanclient +etc/rc.d/rc6.d/K80network-uplink +etc/rc.d/rc6.d/K81wlanclient +etc/rc.d/rc6.d/K82network-local #etc/rc.d/rc6.d/K85messagebus etc/rc.d/rc6.d/K86unbound etc/rc.d/rc6.d/K87acpid diff --git a/config/rootfiles/common/riscv64/initscripts b/config/rootfiles/common/riscv64/initscripts index ed1eae904..cbb3f9118 100644 --- a/config/rootfiles/common/riscv64/initscripts +++ b/config/rootfiles/common/riscv64/initscripts @@ -109,8 +109,9 @@ etc/rc.d/rc0.d/K77conntrackd etc/rc.d/rc0.d/K78suricata etc/rc.d/rc0.d/K79depends-on-network etc/rc.d/rc0.d/K79leds -etc/rc.d/rc0.d/K80network -etc/rc.d/rc0.d/K82wlanclient +etc/rc.d/rc0.d/K80network-uplink +etc/rc.d/rc0.d/K81wlanclient +etc/rc.d/rc0.d/K82network-local #etc/rc.d/rc0.d/K85messagebus etc/rc.d/rc0.d/K86unbound etc/rc.d/rc0.d/K87acpid @@ -129,14 +130,15 @@ etc/rc.d/rc3.d/S15fireinfo #etc/rc.d/rc3.d/S15messagebus #etc/rc.d/rc3.d/S18cpufreq etc/rc.d/rc3.d/S19smartenabler -etc/rc.d/rc3.d/S19wlanclient -etc/rc.d/rc3.d/S20network -etc/rc.d/rc3.d/S21depends-on-network -etc/rc.d/rc3.d/S21leds -etc/rc.d/rc3.d/S22conntrackd -etc/rc.d/rc3.d/S24cyrus-sasl -etc/rc.d/rc3.d/S30sshd -etc/rc.d/rc3.d/S32apache +etc/rc.d/rc3.d/S20network-local +etc/rc.d/rc3.d/S21sshd +etc/rc.d/rc3.d/S22apache +etc/rc.d/rc3.d/S23wlanclient +etc/rc.d/rc3.d/S24network-uplink +etc/rc.d/rc3.d/S25depends-on-network +etc/rc.d/rc3.d/S25leds +etc/rc.d/rc3.d/S30conntrackd +etc/rc.d/rc3.d/S35cyrus-sasl etc/rc.d/rc3.d/S40fcron #etc/rc.d/rc3.d/S66client175 etc/rc.d/rc3.d/S98rc.local @@ -160,8 +162,9 @@ etc/rc.d/rc6.d/K77conntrackd etc/rc.d/rc6.d/K78suricata etc/rc.d/rc6.d/K79depends-on-network etc/rc.d/rc6.d/K79leds -etc/rc.d/rc6.d/K80network -etc/rc.d/rc6.d/K82wlanclient +etc/rc.d/rc6.d/K80network-uplink +etc/rc.d/rc6.d/K81wlanclient +etc/rc.d/rc6.d/K82network-local #etc/rc.d/rc6.d/K85messagebus etc/rc.d/rc6.d/K86unbound etc/rc.d/rc6.d/K87acpid diff --git a/config/rootfiles/common/x86_64/initscripts b/config/rootfiles/common/x86_64/initscripts index ed1eae904..cbb3f9118 100644 --- a/config/rootfiles/common/x86_64/initscripts +++ b/config/rootfiles/common/x86_64/initscripts @@ -109,8 +109,9 @@ etc/rc.d/rc0.d/K77conntrackd etc/rc.d/rc0.d/K78suricata etc/rc.d/rc0.d/K79depends-on-network etc/rc.d/rc0.d/K79leds -etc/rc.d/rc0.d/K80network -etc/rc.d/rc0.d/K82wlanclient +etc/rc.d/rc0.d/K80network-uplink +etc/rc.d/rc0.d/K81wlanclient +etc/rc.d/rc0.d/K82network-local #etc/rc.d/rc0.d/K85messagebus etc/rc.d/rc0.d/K86unbound etc/rc.d/rc0.d/K87acpid @@ -129,14 +130,15 @@ etc/rc.d/rc3.d/S15fireinfo #etc/rc.d/rc3.d/S15messagebus #etc/rc.d/rc3.d/S18cpufreq etc/rc.d/rc3.d/S19smartenabler -etc/rc.d/rc3.d/S19wlanclient -etc/rc.d/rc3.d/S20network -etc/rc.d/rc3.d/S21depends-on-network -etc/rc.d/rc3.d/S21leds -etc/rc.d/rc3.d/S22conntrackd -etc/rc.d/rc3.d/S24cyrus-sasl -etc/rc.d/rc3.d/S30sshd -etc/rc.d/rc3.d/S32apache +etc/rc.d/rc3.d/S20network-local +etc/rc.d/rc3.d/S21sshd +etc/rc.d/rc3.d/S22apache +etc/rc.d/rc3.d/S23wlanclient +etc/rc.d/rc3.d/S24network-uplink +etc/rc.d/rc3.d/S25depends-on-network +etc/rc.d/rc3.d/S25leds +etc/rc.d/rc3.d/S30conntrackd +etc/rc.d/rc3.d/S35cyrus-sasl etc/rc.d/rc3.d/S40fcron #etc/rc.d/rc3.d/S66client175 etc/rc.d/rc3.d/S98rc.local @@ -160,8 +162,9 @@ etc/rc.d/rc6.d/K77conntrackd etc/rc.d/rc6.d/K78suricata etc/rc.d/rc6.d/K79depends-on-network etc/rc.d/rc6.d/K79leds -etc/rc.d/rc6.d/K80network -etc/rc.d/rc6.d/K82wlanclient +etc/rc.d/rc6.d/K80network-uplink +etc/rc.d/rc6.d/K81wlanclient +etc/rc.d/rc6.d/K82network-local #etc/rc.d/rc6.d/K85messagebus etc/rc.d/rc6.d/K86unbound etc/rc.d/rc6.d/K87acpid diff --git a/lfs/initscripts b/lfs/initscripts index e8a2e4c6e..711f29632 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -104,9 +104,10 @@ $(TARGET) : ln -sf ../init.d/conntrackd /etc/rc.d/rc0.d/K77conntrackd ln -sf ../init.d/suricata /etc/rc.d/rc0.d/K78suricata ln -sf ../init.d/depends-on-network /etc/rc.d/rc0.d/K79depends-on-network - ln -sf ../init.d/leds /etc/rc.d/rc0.d/K79leds - ln -sf ../init.d/network /etc/rc.d/rc0.d/K80network - ln -sf ../init.d/wlanclient /etc/rc.d/rc0.d/K82wlanclient + ln -sf ../init.d/leds /etc/rc.d/rc0.d/K79leds + ln -sf ../init.d/network-uplink /etc/rc.d/rc0.d/K80network-uplink + ln -sf ../init.d/wlanclient /etc/rc.d/rc0.d/K81wlanclient + ln -sf ../init.d/network-local /etc/rc.d/rc0.d/K82network-local ln -sf ../init.d/messagebus /etc/rc.d/rc0.d/K85messagebus ln -sf ../init.d/unbound /etc/rc.d/rc0.d/K86unbound ln -sf ../init.d/sysklogd /etc/rc.d/rc0.d/K90sysklogd @@ -123,14 +124,15 @@ $(TARGET) : ln -sf ../init.d/messagebus /etc/rc.d/rc3.d/S15messagebus ln -sf ../init.d/cpufreq /etc/rc.d/rc3.d/S18cpufreq ln -sf ../init.d/smartenabler /etc/rc.d/rc3.d/S19smartenabler - ln -sf ../init.d/wlanclient /etc/rc.d/rc3.d/S19wlanclient - ln -sf ../init.d/network /etc/rc.d/rc3.d/S20network - ln -sf ../init.d/depends-on-network /etc/rc.d/rc3.d/S21depends-on-network - ln -sf ../init.d/leds /etc/rc.d/rc3.d/S21leds - ln -sf ../init.d/conntrackd /etc/rc.d/rc3.d/S22conntrackd - ln -sf ../init.d/cyrus-sasl /etc/rc.d/rc3.d/S24cyrus-sasl - ln -sf ../init.d/sshd /etc/rc.d/rc3.d/S30sshd - ln -sf ../init.d/apache /etc/rc.d/rc3.d/S32apache + ln -sf ../init.d/network-local /etc/rc.d/rc3.d/S20network-local + ln -sf ../init.d/sshd /etc/rc.d/rc3.d/S21sshd + ln -sf ../init.d/apache /etc/rc.d/rc3.d/S22apache + ln -sf ../init.d/wlanclient /etc/rc.d/rc3.d/S23wlanclient + ln -sf ../init.d/network-uplink /etc/rc.d/rc3.d/S24network-uplink + ln -sf ../init.d/depends-on-network /etc/rc.d/rc3.d/S25depends-on-network + ln -sf ../init.d/leds /etc/rc.d/rc3.d/S25leds + ln -sf ../init.d/conntrackd /etc/rc.d/rc3.d/S30conntrackd + ln -sf ../init.d/cyrus-sasl /etc/rc.d/rc3.d/S35cyrus-sasl ln -sf ../init.d/fcron /etc/rc.d/rc3.d/S40fcron ln -sf ../../sysconfig/rc.local /etc/rc.d/rc3.d/S98rc.local ln -sf ../init.d/sslh /etc/rc.d/rc3.d/S98sslh @@ -152,8 +154,9 @@ $(TARGET) : ln -sf ../init.d/suricata /etc/rc.d/rc6.d/K78suricata ln -sf ../init.d/depends-on-network /etc/rc.d/rc6.d/K79depends-on-network ln -sf ../init.d/leds /etc/rc.d/rc6.d/K79leds - ln -sf ../init.d/network /etc/rc.d/rc6.d/K80network - ln -sf ../init.d/wlanclient /etc/rc.d/rc6.d/K82wlanclient + ln -sf ../init.d/network-uplink /etc/rc.d/rc6.d/K80network-uplink + ln -sf ../init.d/wlanclient /etc/rc.d/rc6.d/K81wlanclient + ln -sf ../init.d/network-local /etc/rc.d/rc6.d/K82network-local ln -sf ../init.d/messagebus /etc/rc.d/rc6.d/K85messagebus ln -sf ../init.d/unbound /etc/rc.d/rc6.d/K86unbound ln -sf ../init.d/sysklogd /etc/rc.d/rc6.d/K90sysklogd From patchwork Tue May 23 17:23:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6914 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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4k5kK0z3wls for ; Tue, 23 May 2023 17:24:06 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4k299Vz67K; Tue, 23 May 2023 17:24:06 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4k1Tszz302K; Tue, 23 May 2023 17:24:06 +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 (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4g3y6xz302K for ; Tue, 23 May 2023 17:24:03 +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 (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4g2grwz1V2; Tue, 23 May 2023 17:24:03 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862643; 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=N7u0bJIlNLWekW7VTNnYHj6I5dd8Cfp5OhsyA61X6ys=; b=RZTtZGiXOAK2n7vSoR9+LLu7CaOz5Nb7sLu51nrTpG7gUoWhZyAPJQpFKzhlYau7Dpy8Ty 4cZCrx/RcvStpqBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862643; 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=N7u0bJIlNLWekW7VTNnYHj6I5dd8Cfp5OhsyA61X6ys=; b=WTIlQfyEfrb012rWFVFhr5FTxhwFF60eX74AR5Idff8BtKnAGg5vlPWOjIDIDhbk7ZghIg UXZ3DwPsKw1u0MiDo+cmpgK9i+LTJ7tpgHndZrYFil9gSa9FG4wr0pVOkeOXvYgvYIpMNU 1g4AA7anMr5uOSBFYN+/w2f3RpArQAIbfW1ttL50x2w4hn0x4xTTzibz31CdqSdmBRaVi/ gbOBdNLEMrsyT8Z9Pdc50JyOcoyHeq4KcOilfqiRXzx3r9lE+awReb6yR3oxt7biwOB88A gTdbJFlobWl5k0fU7ygKs9aoUrvUNwbdShBEuakyjopw5M+0U1aUsWLZonSjFw== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 15/15] network startup: Only work with configured zones Date: Tue, 23 May 2023 19:23:15 +0200 Message-Id: <20230523172314.7826-16-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Otherwise the called script fails with an failure message. This does not hurt but is ugly. I also changed my mind about the wording here. Because we only have four possible zones we could talk about valid zones. But I think it is easier and more future proof to talk about what is configured on the system. Should make further changes easier. Signed-off-by: Jonatan Schlag --- src/initscripts/system/network | 37 +++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/initscripts/system/network b/src/initscripts/system/network index ff305e472..abbd5bd88 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}" @@ -31,34 +33,37 @@ if ! [[ "${DO}" == "start" || "${DO}" == "restart" || "${DO}" == "stop" ]]; the exit 1 fi -declare -a VALID_ZONES +declare -a CONFIGURED_ZONES -VALID_ZONES+=("blue") -VALID_ZONES+=("green") -VALID_ZONES+=("orange") +for zone in blue green orange; do + if is_${zone}_used; then + CONFIGURED_ZONES+=("${zone}") + fi +done -# If we are called as /etc/init.d/network also red is a valid zone. -# Otherwise we are called as /etc/init.d/network-local where red -# is invalid. +# If we are called as /etc/init.d/network also red is a configured zone. +# Otherwise we are called as /etc/init.d/network-local where we do +# not need to take care of red if [[ "$(basename $0)" == "network" ]]; then - VALID_ZONES+=("red") + CONFIGURED_ZONES+=("red") fi declare -A ZONE_ACTION -for i in "${VALID_ZONES[@]}"; do +for i in "${CONFIGURED_ZONES[@]}"; do ZONE_ACTION[${i}]=false done if [ $# -eq 0 ]; then - for i in "${VALID_ZONES[@]}"; do - ZONE_ACTION[${i}]=true + for zone in "${CONFIGURED_ZONES[@]}"; do + ZONE_ACTION[${zone}]=true done fi + while [ $# -ne 0 ]; do ZONE_VALID=false - for i in "${VALID_ZONES[@]}"; do + for i in "${CONFIGURED_ZONES[@]}"; do if [ "${i}" == "${1}" ]; then ZONE_ACTION[${i}]=true ZONE_VALID=true @@ -68,7 +73,7 @@ while [ $# -ne 0 ]; do done if ! ${ZONE_VALID}; then - echo "'${1}' is not a valid zone. Cannot go on." + echo "'${1}' is not configured on this system. Cannot go on." exit 1 fi done @@ -76,14 +81,14 @@ done case "${DO}" in start) # Starting interfaces... - for i in "${VALID_ZONES[@]}"; do + for i in "${CONFIGURED_ZONES[@]}"; do ${ZONE_ACTION[${i}]} && /etc/rc.d/init.d/networking/${i} start done ;; stop) # Stopping interfaces... - for i in "${VALID_ZONES[@]}"; do + for i in "${CONFIGURED_ZONES[@]}"; do ${ZONE_ACTION[${i}]} && /etc/rc.d/init.d/networking/${i} stop done @@ -91,7 +96,7 @@ case "${DO}" in ;; restart) - for i in "${VALID_ZONES[@]}"; do + for i in "${CONFIGURED_ZONES[@]}"; do if ${ZONE_ACTION[${i}]}; then ARGS+=" ${i}" fi