From a15c1c5e372f18fb023733265ceb9a1ced9528d5 Mon Sep 17 00:00:00 2001 From: Andre Kantek Date: Mon, 30 Sep 2024 16:16:12 -0300 Subject: [PATCH] Correcting labeled interfaces handling by networking.service This change corrects some behaviors observed in the packages ifupdown, ifupdown-extra, and ifenslave. Just as a reminder in StarlingX labeled interfaces are used to set the address using static or dhcp methods, the actual device interface config file is set as manual. ifupdown: - Correct the MTU configuration, if a labeled interface is provided execute the cat command in /sys using only the device name, removing the label before querying ifenslave: - do not process labeled interfaces, the bonding configuration is done via the device's interface config file ifupdown-extra: - 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. Test Plan: ========== [PASS] Install an AIO-DX with bonding and verify the messages do not show up anymore but the network config is correctly applied Story: 2011324 Task: 51533 Change-Id: I8855fb8d9c6d8d1753183d70bdc2c2a55e9637ef Signed-off-by: Andre Kantek --- debian_pkg_dirs | 1 + ...-script-if-it-is-a-labeled-interface.patch | 67 +++++++++++++++++++ .../ifenslave/debian/deb_patches/series | 1 + networking/ifenslave/debian/meta_data.yaml | 7 ++ ...ck-of-address-warning-if-method-isn-.patch | 37 ++++++++++ .../ifupdown-extra/debian/deb_patches/series | 1 + ...out-interface-label-when-setting-MTU.patch | 42 ++++++++++++ networking/ifupdown/debian/deb_patches/series | 1 + 8 files changed, 157 insertions(+) create mode 100644 networking/ifenslave/debian/deb_patches/0001-Skip-script-if-it-is-a-labeled-interface.patch create mode 100644 networking/ifenslave/debian/deb_patches/series create mode 100644 networking/ifenslave/debian/meta_data.yaml create mode 100644 networking/ifupdown-extra/debian/deb_patches/0006-Only-generate-lack-of-address-warning-if-method-isn-.patch create mode 100644 networking/ifupdown/debian/deb_patches/0003-filter-out-interface-label-when-setting-MTU.patch diff --git a/debian_pkg_dirs b/debian_pkg_dirs index 566b4021b..fe9c131b7 100644 --- a/debian_pkg_dirs +++ b/debian_pkg_dirs @@ -86,6 +86,7 @@ ldap/openldap networking/dpdk networking/ifupdown networking/ifupdown-extra +networking/ifenslave networking/iputils networking/lldpd networking/net-tools diff --git a/networking/ifenslave/debian/deb_patches/0001-Skip-script-if-it-is-a-labeled-interface.patch b/networking/ifenslave/debian/deb_patches/0001-Skip-script-if-it-is-a-labeled-interface.patch new file mode 100644 index 000000000..6b49d8de9 --- /dev/null +++ b/networking/ifenslave/debian/deb_patches/0001-Skip-script-if-it-is-a-labeled-interface.patch @@ -0,0 +1,67 @@ +From 746894fb8cb7f0117519191b04e838b10c57ef79 Mon Sep 17 00:00:00 2001 +From: Andre Kantek +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 +--- + 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 + diff --git a/networking/ifenslave/debian/deb_patches/series b/networking/ifenslave/debian/deb_patches/series new file mode 100644 index 000000000..f4d4150f4 --- /dev/null +++ b/networking/ifenslave/debian/deb_patches/series @@ -0,0 +1 @@ +0001-Skip-script-if-it-is-a-labeled-interface.patch diff --git a/networking/ifenslave/debian/meta_data.yaml b/networking/ifenslave/debian/meta_data.yaml new file mode 100644 index 000000000..2b2ea3fb7 --- /dev/null +++ b/networking/ifenslave/debian/meta_data.yaml @@ -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 diff --git a/networking/ifupdown-extra/debian/deb_patches/0006-Only-generate-lack-of-address-warning-if-method-isn-.patch b/networking/ifupdown-extra/debian/deb_patches/0006-Only-generate-lack-of-address-warning-if-method-isn-.patch new file mode 100644 index 000000000..0a666ca9b --- /dev/null +++ b/networking/ifupdown-extra/debian/deb_patches/0006-Only-generate-lack-of-address-warning-if-method-isn-.patch @@ -0,0 +1,37 @@ +From da5950d5578aaed4719624400b59402fc335cd7a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Javier=20Fernandez-Sanguino=20Pe=C3=B1a?= +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 +--- + 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 + diff --git a/networking/ifupdown-extra/debian/deb_patches/series b/networking/ifupdown-extra/debian/deb_patches/series index 9d9c3819c..23e898e9a 100644 --- a/networking/ifupdown-extra/debian/deb_patches/series +++ b/networking/ifupdown-extra/debian/deb_patches/series @@ -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 diff --git a/networking/ifupdown/debian/deb_patches/0003-filter-out-interface-label-when-setting-MTU.patch b/networking/ifupdown/debian/deb_patches/0003-filter-out-interface-label-when-setting-MTU.patch new file mode 100644 index 000000000..c0a795def --- /dev/null +++ b/networking/ifupdown/debian/deb_patches/0003-filter-out-interface-label-when-setting-MTU.patch @@ -0,0 +1,42 @@ +From ea9deacedf3e1421e3e20ee91ec34bbb9e5ff8f1 Mon Sep 17 00:00:00 2001 +From: Andre Kantek +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 +--- + 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 + diff --git a/networking/ifupdown/debian/deb_patches/series b/networking/ifupdown/debian/deb_patches/series index 6add11a54..6803c6429 100644 --- a/networking/ifupdown/debian/deb_patches/series +++ b/networking/ifupdown/debian/deb_patches/series @@ -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