From patchwork Tue Jul 29 14:42:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 8961 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) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4bryk55yjcz3wb0 for ; Tue, 29 Jul 2025 14:42:37 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryk26Z2mz6JX for ; Tue, 29 Jul 2025 14:42:34 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4bryk13462z36V1 for ; Tue, 29 Jul 2025 14:42:33 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4bryjy3WcDz32MN for ; Tue, 29 Jul 2025 14:42:30 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "michael.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryjx5jqKzM7; Tue, 29 Jul 2025 14:42:29 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4bryjx51sXzTgjc; Tue, 29 Jul 2025 14:42:29 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Cc: Michael Tremer Subject: [PATCH 1/6] linux: Don't create bond0 when bonding is being loaded Date: Tue, 29 Jul 2025 14:42:15 +0000 Message-ID: <20250729144220.1332214-1-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.47.2 Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 Signed-off-by: Michael Tremer --- config/rootfiles/common/aarch64/linux | 1 + config/rootfiles/common/riscv64/linux | 1 + config/rootfiles/common/x86_64/linux | 1 + lfs/linux | 3 +++ 4 files changed, 6 insertions(+) diff --git a/config/rootfiles/common/aarch64/linux b/config/rootfiles/common/aarch64/linux index c2b85c31a..08d3b06fd 100644 --- a/config/rootfiles/common/aarch64/linux +++ b/config/rootfiles/common/aarch64/linux @@ -573,6 +573,7 @@ boot/dtb-KVER #boot/dtb-KVER/synaptics/berlin4ct-stb.dtb boot/vmlinuz-KVER #etc/cpufreq-bench.conf +etc/modprobe.d/bonding.conf etc/modprobe.d/ipv6.conf #lib/modules #lib/modules/KVER diff --git a/config/rootfiles/common/riscv64/linux b/config/rootfiles/common/riscv64/linux index 67d1dd018..475fda152 100644 --- a/config/rootfiles/common/riscv64/linux +++ b/config/rootfiles/common/riscv64/linux @@ -13,6 +13,7 @@ boot/dtb-KVER #boot/dtb-KVER/starfive/jh7110-starfive-visionfive-2-v1.3b.dtb boot/vmlinuz-KVER #etc/cpufreq-bench.conf +etc/modprobe.d/bonding.conf etc/modprobe.d/ipv6.conf #lib/modules #lib/modules/KVER diff --git a/config/rootfiles/common/x86_64/linux b/config/rootfiles/common/x86_64/linux index a33704270..bd39739f0 100644 --- a/config/rootfiles/common/x86_64/linux +++ b/config/rootfiles/common/x86_64/linux @@ -2,6 +2,7 @@ boot/System.map-KVER boot/config-KVER boot/vmlinuz-KVER #etc/cpufreq-bench.conf +etc/modprobe.d/bonding.conf etc/modprobe.d/ipv6.conf #lib/modules #lib/modules/KVER diff --git a/lfs/linux b/lfs/linux index 122d3517e..a1e5a49dd 100644 --- a/lfs/linux +++ b/lfs/linux @@ -232,6 +232,9 @@ endif # Disable ipv6 at runtime echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf + # Do not automatically create bond0 when bonding is being loaded + echo "options bonding max_bonds=0" > /etc/modprobe.d/bonding.conf + # build cpupower utility cd $(DIR_APP)/tools/power/cpupower && make $(MAKETUNING) cd $(DIR_APP)/tools/power/cpupower && make install From patchwork Tue Jul 29 14:42:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 8965 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) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4bryk56dCsz3xPV for ; Tue, 29 Jul 2025 14:42:37 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryk30hJcz75Z for ; Tue, 29 Jul 2025 14:42:35 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4bryk1463lz34Nk for ; Tue, 29 Jul 2025 14:42:33 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4bryjy4Pbnz34Jr for ; Tue, 29 Jul 2025 14:42:30 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "michael.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryjx5w8zzmh; Tue, 29 Jul 2025 14:42:29 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4bryjx56xLzTghm; Tue, 29 Jul 2025 14:42:29 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Cc: Michael Tremer Subject: [PATCH 2/6] network: Add support for bonds Date: Tue, 29 Jul 2025 14:42:16 +0000 Message-ID: <20250729144220.1332214-2-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250729144220.1332214-1-michael.tremer@ipfire.org> References: <20250729144220.1332214-1-michael.tremer@ipfire.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 This is a bare-minimum implementation to realise this. It changes the bridge script because the two of them have quite a bit in common, so we should avoid further code duplication. Signed-off-by: Michael Tremer --- config/udev/network-hotplug-bridges | 97 +++++++++++++++++++++-------- config/udev/network-hotplug-rename | 2 +- 2 files changed, 71 insertions(+), 28 deletions(-) diff --git a/config/udev/network-hotplug-bridges b/config/udev/network-hotplug-bridges index 39faeb5a9..4fa1154c2 100644 --- a/config/udev/network-hotplug-bridges +++ b/config/udev/network-hotplug-bridges @@ -71,57 +71,86 @@ ZONE=$(detect_zone) # Cannot proceed if we could not find a zone if [ -z "${ZONE}" ]; then - logger "Could not find a bridged zone for ${INTERFACE}" + logger "Could not find a master zone for ${INTERFACE}" exit 0 fi # Determine the mode of this zone MODE="$(get_value "${ZONE}_MODE")" -# The name of the virtual bridge -BRIDGE="$(get_value "${ZONE}_DEV")" +# Exit if there is no MODE +if [ -z "${MODE}" ]; then + exit 0 +fi + +# The name of the virtual master interface +MASTER="$(get_value "${ZONE}_DEV")" + +# Fetch the MTU MTU="$(get_value "${ZONE}_MTU")" -STP="$(get_value "${ZONE}_STP")" -STP_PRIORITY="$(get_value "${ZONE}_STP_PRIORITY")" + +# Set default MTU if nothing is set +if [ -z "${MTU}" ]; then + MTU=1500 +fi + +# Fetch the MAC address of the master interface +ADDRESS="$(get_value "${ZONE}_MACADDR")" + +# If no address has been configured, generate a random one +if [ -z "${ADDRESS}" ]; then + ADDRESS="$(random_mac_address)" +fi case "${MODE}" in - bridge) - # Set default MTU if nothing is set - if [ -z "${MTU}" ]; then - MTU=1500 + # Bond + bond) + BOND_MODE="$(get_value "${ZONE}_BOND_MODE")" + if [ -z "${BOND_MODE}" ]; then + BOND_MODE="802.3ad" + fi + + # Check for some valid BOND_MODE + case "${BOND_MODE}" in + balance-rr|active-backup|balance-xor|broadcast|802.3ad|balance-tlb|balance-alb) + ;; + *) + logger "Invalid bond mode ${BOND_MODE} for ${MASTER}. Falling back to 802.3ad" + BOND_MODE="802.3ad" + ;; + esac + + # Create the master interface if it does not exist + if [ ! -d "/sys/class/net/${MASTER}" ]; then + if ! ip link add "${MASTER}" address "${ADDRESS}" mtu "${MTU}" \ + type bond mode "${BOND_MODE}"; then + logger "Failed to create bonding interface ${MASTER}" + exit 1 + fi fi + ;; + + # Bridge + bridge) + # Fetch spanning tree settings + STP="$(get_value "${ZONE}_STP")" + STP_PRIORITY="$(get_value "${ZONE}_STP_PRIORITY")" # We need to check if $STP_PRIORITY has a valid value if not set it if [ -z "${STP_PRIORITY}" ]; then STP_PRIORITY=16384 fi - ADDRESS="$(get_value "${ZONE}_MACADDR")" - [ -n "${ADDRESS}" ] || ADDRESS="$(random_mac_address)" - # We need to create the bridge if it doesn't exist, yet - if [ ! -d "/sys/class/net/${BRIDGE}" ]; then - ip link add "${BRIDGE}" address "${ADDRESS}" mtu "${MTU}" type bridge \ + if [ ! -d "/sys/class/net/${MASTER}" ]; then + ip link add "${MASTER}" address "${ADDRESS}" mtu "${MTU}" type bridge \ $([ "${STP}" = "on" ] && echo "stp_state 1 priority ${STP_PRIORITY}" ) - #ip link set "${BRIDGE}" up fi # Try setting wireless interfaces into master mode if [ -d "/sys/class/net/${INTERFACE}/phy80211" ]; then iw dev "${INTERFACE}" set type __ap fi - - # Attempt to set the MTU - ip link set dev "${INTERFACE}" mtu "${MTU}" - - # Attach the physical device - logger "Attach ${INTERFACE} to ${BRIDGE}" - ip link set dev "${INTERFACE}" master "${BRIDGE}" - ip link set dev "${INTERFACE}" up - ;; - - "") - exit 0 ;; *) @@ -129,3 +158,17 @@ case "${MODE}" in exit 1 ;; esac + +# Attempt to set the MTU +ip link set dev "${INTERFACE}" mtu "${MTU}" + +# Ensure the physical interface is down +ip link set dev "${INTERFACE}" down + +# Attach the physical device +logger "Attach ${INTERFACE} to ${MASTER}" +ip link set dev "${INTERFACE}" master "${MASTER}" +ip link set dev "${INTERFACE}" up + +# Done! +exit 0 diff --git a/config/udev/network-hotplug-rename b/config/udev/network-hotplug-rename index 7c81bdb78..f27eecae6 100644 --- a/config/udev/network-hotplug-rename +++ b/config/udev/network-hotplug-rename @@ -78,7 +78,7 @@ for zone in ${ZONES}; do # If a matching interface has been found we will # print the name to which udev will rename it. case "${!mode}" in - bridge) + bond|bridge) counter=0 for slave in ${!slaves}; do if [ "${slave,,}" = "${ADDRESS,,}" ]; then From patchwork Tue Jul 29 14:42:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 8963 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) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4bryk56QZ4z3xP7 for ; Tue, 29 Jul 2025 14:42:37 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryk26jZMz75w for ; Tue, 29 Jul 2025 14:42:34 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4bryk13jB9z34RT for ; Tue, 29 Jul 2025 14:42:33 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4bryjy4B8wz34BB for ; Tue, 29 Jul 2025 14:42:30 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "michael.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryjx66dHz1TH; Tue, 29 Jul 2025 14:42:29 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4bryjx5G6gzTgkJ; Tue, 29 Jul 2025 14:42:29 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Cc: Michael Tremer Subject: [PATCH 3/6] network: Rename the bridge hotplug script Date: Tue, 29 Jul 2025 14:42:17 +0000 Message-ID: <20250729144220.1332214-3-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250729144220.1332214-1-michael.tremer@ipfire.org> References: <20250729144220.1332214-1-michael.tremer@ipfire.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 Since it is now creating more than just bridges, this had to have a new name. Signed-off-by: Michael Tremer --- config/rootfiles/common/udev | 2 +- config/udev/60-net.rules | 4 ++-- .../udev/{network-hotplug-bridges => network-hotplug-master} | 0 lfs/udev | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) rename config/udev/{network-hotplug-bridges => network-hotplug-master} (100%) diff --git a/config/rootfiles/common/udev b/config/rootfiles/common/udev index 3eea43718..94da6f772 100644 --- a/config/rootfiles/common/udev +++ b/config/rootfiles/common/udev @@ -49,7 +49,7 @@ lib/udev/hwdb.d lib/udev/iocost lib/udev/mtd_probe lib/udev/network-aqm -lib/udev/network-hotplug-bridges +lib/udev/network-hotplug-master lib/udev/network-hotplug-rename lib/udev/network-hotplug-vlan lib/udev/network-offloading diff --git a/config/udev/60-net.rules b/config/udev/60-net.rules index fff7513bc..f4850b9dd 100644 --- a/config/udev/60-net.rules +++ b/config/udev/60-net.rules @@ -6,5 +6,5 @@ ACTION=="add", SUBSYSTEM=="net", PROGRAM="/lib/udev/network-hotplug-rename", RES # that has just come up. ACTION=="add", SUBSYSTEM=="net", RUN+="/lib/udev/network-hotplug-vlan" -# Call a script that will set up zones as bridges -ACTION=="add", SUBSYSTEM=="net", RUN+="/lib/udev/network-hotplug-bridges" +# Call a script that will set up interfaces that have a master interface (bridges, bonding, ..) +ACTION=="add", SUBSYSTEM=="net", RUN+="/lib/udev/network-hotplug-master" diff --git a/config/udev/network-hotplug-bridges b/config/udev/network-hotplug-master similarity index 100% rename from config/udev/network-hotplug-bridges rename to config/udev/network-hotplug-master diff --git a/lfs/udev b/lfs/udev index 19e0557a3..2b1be02cd 100644 --- a/lfs/udev +++ b/lfs/udev @@ -148,8 +148,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) /lib/udev/network-hotplug-rename install -v -m 755 $(DIR_SRC)/config/udev/network-hotplug-vlan \ /lib/udev/network-hotplug-vlan - install -v -m 755 $(DIR_SRC)/config/udev/network-hotplug-bridges \ - /lib/udev/network-hotplug-bridges + install -v -m 755 $(DIR_SRC)/config/udev/network-hotplug-master \ + /lib/udev/network-hotplug-master install -v -m 644 $(DIR_SRC)/config/udev/60-net.rules \ /lib/udev/rules.d From patchwork Tue Jul 29 14:42:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 8962 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) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4bryk56Bvzz3wjb for ; Tue, 29 Jul 2025 14:42:37 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryk26lYKz75y for ; Tue, 29 Jul 2025 14:42:34 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4bryk13jXWz34RW for ; Tue, 29 Jul 2025 14:42:33 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4bryjy3zfzz33B1 for ; Tue, 29 Jul 2025 14:42:30 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "michael.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryjx6M5lz2bg; Tue, 29 Jul 2025 14:42:29 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4bryjx5QQfzTgkL; Tue, 29 Jul 2025 14:42:29 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Cc: Michael Tremer Subject: [PATCH 4/6] network: Fail if no master device has been configured for slave zones Date: Tue, 29 Jul 2025 14:42:18 +0000 Message-ID: <20250729144220.1332214-4-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250729144220.1332214-1-michael.tremer@ipfire.org> References: <20250729144220.1332214-1-michael.tremer@ipfire.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 Signed-off-by: Michael Tremer --- config/udev/network-hotplug-master | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/udev/network-hotplug-master b/config/udev/network-hotplug-master index 4fa1154c2..b61b657bb 100644 --- a/config/udev/network-hotplug-master +++ b/config/udev/network-hotplug-master @@ -86,6 +86,12 @@ fi # The name of the virtual master interface MASTER="$(get_value "${ZONE}_DEV")" +# Fail if no master device has been configured +if [ -z "${MASTER}" ]; then + logger "No ${ZONE}_DEV configured" + exit 1 +fi + # Fetch the MTU MTU="$(get_value "${ZONE}_MTU")" From patchwork Tue Jul 29 14:42:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 8964 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) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4bryk56Wxbz3xPT for ; Tue, 29 Jul 2025 14:42:37 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryk26X25z2bb for ; Tue, 29 Jul 2025 14:42:34 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4bryk133D9z34RS for ; Tue, 29 Jul 2025 14:42:33 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4bryjy33jVz2xXb for ; Tue, 29 Jul 2025 14:42:30 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "michael.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryjy0M85z2th; Tue, 29 Jul 2025 14:42:30 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4bryjx5ZCDzTgnB; Tue, 29 Jul 2025 14:42:29 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Cc: Michael Tremer Subject: [PATCH 5/6] network: Add support for some more auxiliary zones Date: Tue, 29 Jul 2025 14:42:19 +0000 Message-ID: <20250729144220.1332214-5-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250729144220.1332214-1-michael.tremer@ipfire.org> References: <20250729144220.1332214-1-michael.tremer@ipfire.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 Signed-off-by: Michael Tremer --- config/udev/network-hotplug-master | 2 +- config/udev/network-hotplug-rename | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/udev/network-hotplug-master b/config/udev/network-hotplug-master index b61b657bb..34cec46a6 100644 --- a/config/udev/network-hotplug-master +++ b/config/udev/network-hotplug-master @@ -31,7 +31,7 @@ detect_zone() { intf="${intf^^}" local zone - for zone in GREEN BLUE ORANGE RED; do + for zone in GREEN BLUE ORANGE RED INTF0 INTF1 INTF2 INTF3; do # Try to find if INTERFACE is the *phys version of a zone if [ "${intf}" = "${zone}" ]; then echo "${zone}" diff --git a/config/udev/network-hotplug-rename b/config/udev/network-hotplug-rename index f27eecae6..b4e694ed3 100644 --- a/config/udev/network-hotplug-rename +++ b/config/udev/network-hotplug-rename @@ -57,7 +57,7 @@ fi eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) # Standard zones -ZONES="RED GREEN ORANGE BLUE" +ZONES="RED GREEN ORANGE BLUE INTF0 INTF1 INTF2 INTF3" # Determine the address of INTERFACE ADDRESS="$( X-Patchwork-Id: 8966 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) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4bryk8647gz3wb0 for ; Tue, 29 Jul 2025 14:42:40 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryk670MLz78t for ; Tue, 29 Jul 2025 14:42:38 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4bryk657Vlz33BX for ; Tue, 29 Jul 2025 14:42:38 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4bryjy4gt2z34LY for ; Tue, 29 Jul 2025 14:42:30 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "michael.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4bryjy2WSHz2bb; Tue, 29 Jul 2025 14:42:30 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4bryjx5j3RzTgnd; Tue, 29 Jul 2025 14:42:29 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Cc: Michael Tremer Subject: [PATCH 6/6] network: Ensure that we only run once at a time Date: Tue, 29 Jul 2025 14:42:20 +0000 Message-ID: <20250729144220.1332214-6-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250729144220.1332214-1-michael.tremer@ipfire.org> References: <20250729144220.1332214-1-michael.tremer@ipfire.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 Signed-off-by: Michael Tremer --- config/udev/network-hotplug-master | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/udev/network-hotplug-master b/config/udev/network-hotplug-master index 34cec46a6..ed9cd58c3 100644 --- a/config/udev/network-hotplug-master +++ b/config/udev/network-hotplug-master @@ -25,6 +25,12 @@ eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) +# Only run this script once at a time +if [ -z "${LOCKED}" ]; then + export LOCKED=1 + exec flock "${0}" "${0}" "$@" +fi + detect_zone() { local intf="${INTERFACE%?}" intf="${intf%phys}"