Merge "Correcting labeled interfaces handling by networking.service"

This commit is contained in:
Zuul 2025-02-10 14:51:02 +00:00 committed by Gerrit Code Review
commit 3e196c451e
8 changed files with 157 additions and 0 deletions

View File

@ -87,6 +87,7 @@ ldap/openldap
networking/dpdk
networking/ifupdown
networking/ifupdown-extra
networking/ifenslave
networking/iputils
networking/lldpd
networking/net-tools

View File

@ -0,0 +1,67 @@
From 746894fb8cb7f0117519191b04e838b10c57ef79 Mon Sep 17 00:00:00 2001
From: Andre Kantek <andrefernandozanella.kantek@windriver.com>
Date: Mon, 30 Sep 2024 15:57:56 -0300
Subject: [PATCH] Skip script if it is a labeled interface
Labeled interface config files (format 'intf:label') only handle
interface addresses not the bonding itself. Skip scripts if this is
the case
Signed-off-by: Andre Kantek <andrefernandozanella.kantek@windriver.com>
---
debian/ifenslave.if-post-down | 5 +++++
debian/ifenslave.if-pre-up | 5 +++++
debian/ifenslave.if-up | 5 +++++
3 files changed, 15 insertions(+)
diff --git a/debian/ifenslave.if-post-down b/debian/ifenslave.if-post-down
index 177a06c..a3595a4 100755
--- a/debian/ifenslave.if-post-down
+++ b/debian/ifenslave.if-post-down
@@ -26,6 +26,11 @@ sysfs_remove_all()
done
}
+# If it is a labeled interface, skip
+if [[ "$IFACE" =~ ":" ]] ; then
+ exit 0
+fi
+
BOND_PARAMS="/sys/class/net/$IFACE/bonding"
# free $IFACE if it is currently enslaved to a bonding device.
diff --git a/debian/ifenslave.if-pre-up b/debian/ifenslave.if-pre-up
index 52336ab..2b87fcf 100755
--- a/debian/ifenslave.if-pre-up
+++ b/debian/ifenslave.if-pre-up
@@ -216,6 +216,11 @@ setup_slave_device() {
setup_primary
}
+# If it is a labeled interface, skip
+if [[ "$IFACE" =~ ":" ]] ; then
+ exit 0
+fi
+
# Option slaves deprecated, replaced by bond-slaves, but still supported for backward compatibility.
IF_BOND_SLAVES=${IF_BOND_SLAVES:-$IF_SLAVES}
diff --git a/debian/ifenslave.if-up b/debian/ifenslave.if-up
index 923b38f..bd9baa9 100755
--- a/debian/ifenslave.if-up
+++ b/debian/ifenslave.if-up
@@ -16,6 +16,11 @@ sysfs()
return 0
}
+# If it is a labeled interface, skip
+if [[ "$IFACE" =~ ":" ]] ; then
+ exit 0
+fi
+
# If the stanza bond-give-a-chance is set for a slave interface,
# then force $IFACE to be the primary for some time, then restore the primary to its previous value.
--
2.34.1

View File

@ -0,0 +1 @@
0001-Skip-script-if-it-is-a-labeled-interface.patch

View File

@ -0,0 +1,7 @@
---
debver: 2.13
debname: ifenslave
archive: https://snapshot.debian.org/archive/debian/20220519T084715Z/pool/main/i/ifenslave/
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

View File

@ -0,0 +1,37 @@
From da5950d5578aaed4719624400b59402fc335cd7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20Fernandez-Sanguino=20Pe=C3=B1a?= <jfs@debian.org>
Date: Tue, 1 Oct 2024 09:10:11 -0300
Subject: [PATCH] Only generate lack of address warning if method isn't manual
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script check-duplicate-ip is generating warning message about
lack of address config in the interface even if the method is manual.
The manual method does not provide address to be tested.
This change adds this logic to decide if generates a warning message.
Signed-off-by: Andre Kantek <andrefernandozanella.kantek@windriver.com>
---
if-up-scripts/check-duplicate-ip | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/if-up-scripts/check-duplicate-ip b/if-up-scripts/check-duplicate-ip
index ec9ff65..b51fa11 100755
--- a/if-up-scripts/check-duplicate-ip
+++ b/if-up-scripts/check-duplicate-ip
@@ -127,7 +127,9 @@ esac
[ -z "$IF_ADDRESS" ] && find_ip
# Still no IP? Bail out
if [ -z "$IF_ADDRESS" ] ; then
- $OUT_WARN "Cannot check for duplicate IPv4 address in the network as the script could not find the IPv4 address of $IFACE. You can disable this test by setting DO_ARPING to 'no' in $DEFAULT ."
+ if [[ "$METHOD" != 'manual' ]]; then
+ $OUT_WARN "Cannot check for duplicate IPv4 address in the network as the script could not find the IPv4 address of $IFACE. You can disable this test by setting DO_ARPING to 'no' in $DEFAULT ."
+ fi
exit 0
fi
--
2.34.1

View File

@ -3,3 +3,4 @@
0003-Handle-default-route-creation.patch
0004-Fix-DAD-and-gateway-detection-improve-logs.patch
0005-Correct-support-for-gateway-checking-in-dual-stack.patch
0006-Only-generate-lack-of-address-warning-if-method-isn-.patch

View File

@ -0,0 +1,42 @@
From ea9deacedf3e1421e3e20ee91ec34bbb9e5ff8f1 Mon Sep 17 00:00:00 2001
From: Andre Kantek <andrefernandozanella.kantek@windriver.com>
Date: Mon, 30 Sep 2024 16:14:59 -0300
Subject: [PATCH] filter out interface label when setting MTU
When ifupdown receives a labeled interface name (format intf:label)
it tries to cat the MTU value in /sys and that prints an error message
that pollutes the log and prevents the MTU setting.
This change filters out the label part from "%iface%" to correctly
query /sys
Signed-off-by: Andre Kantek <andrefernandozanella.kantek@windriver.com>
---
inet6.defn | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/inet6.defn b/inet6.defn
index cec6a17..9817560 100644
--- a/inet6.defn
+++ b/inet6.defn
@@ -86,7 +86,7 @@ method static
-[[/sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.use_tempaddr=%privext%]]
-[[/sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.accept_ra=%accept_ra%]]
-[[/sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.autoconf=%autoconf%]]
- -[[if [ "$(/bin/cat /sys/class/net/%iface%/mtu)" -lt %mtu% ]; then /sbin/ip link set dev %iface% mtu %mtu%; else /sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.mtu=%mtu%; fi]]
+ -intf=$(echo "%iface%"|/usr/bin/awk -F ':' '{print $1}');[[if [ "$(/bin/cat /sys/class/net/${intf}/mtu)" -lt %mtu% ]; then /sbin/ip link set dev %iface% mtu %mtu%; else /sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.mtu=%mtu%; fi]]
/sbin/ip addr flush dev %iface% mngtmpaddr \
if (var_set("accept_ra", ifd) && !var_true("accept_ra", ifd))
/sbin/ip link set dev %iface% [[address %hwaddress%]] up
@@ -119,7 +119,7 @@ method manual
hwaddress cleanup_hwaddress
up
- -[[if [ "$(/bin/cat /sys/class/net/%iface%/mtu)" -lt %mtu% ]; then /sbin/ip link set dev %iface% mtu %mtu%; else /sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.mtu=%mtu%; fi]]
+ -intf=$(echo "%iface%"|/usr/bin/awk -F ':' '{print $1}');[[if [ "$(/bin/cat /sys/class/net/${intf}/mtu)" -lt %mtu% ]; then /sbin/ip link set dev %iface% mtu %mtu%; else /sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.mtu=%mtu%; fi]]
[[/sbin/ip link set dev %iface% address %hwaddress%]]
/sbin/ip link set dev %iface% up 2>/dev/null || true
--
2.34.1

View File

@ -1,2 +1,3 @@
0001-Fix-detection-logic.patch
0002-Fix-long-labels-cause-command-to-fail.patch
0003-filter-out-interface-label-when-setting-MTU.patch