From cbfc72b6a0174c418929a5b8eb6665f8ea641807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sun, 30 Aug 2026 19:44:11 -0300 Subject: [PATCH] fix(genesis): configure eligible secondary NICs with DHCP Legacy Genesis excludes every secondary interface with IFF_UP, even when firmware only raised it and no address is configured. Let eligible interfaces join the existing secondary-interface DHCP path when they are physical, not enslaved, unaddressed, and not owned by the TSM or IMM management paths. Existing DOWN interfaces keep their prior path. Recovered from the unmerged lenovobuild branch (original 9a1381f6), adapted to leave preconfigured and management-owned interfaces untouched. Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> --- xCAT-genesis-scripts/usr/bin/doxcat | 47 ++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/usr/bin/doxcat b/xCAT-genesis-scripts/usr/bin/doxcat index 07fec50a6..53e83fea3 100755 --- a/xCAT-genesis-scripts/usr/bin/doxcat +++ b/xCAT-genesis-scripts/usr/bin/doxcat @@ -167,6 +167,44 @@ mask2prefix() { echo "$nbits" } +# Keep the legacy path for DOWN interfaces; ownership checks apply only to UP. +secondary_nic_needs_dhcp() { + local nic="$1" + local tsmnic="$2" + local sys_class_net="$3" + local link_output + local address_output + local usb_vendor + local usb_product + + link_output=$(ip -o link show dev "$nic") || return 1 + case "$link_output" in + *''*|*',UP,'*|*',UP>'*) ;; + *) return 0 ;; + esac + + [ "$nic" = "$tsmnic" ] && return 1 + [ -e "$sys_class_net/$nic/device" ] || return 1 + + # Exclude the management USB devices configured by the bundled udev rules. + if [ -r "$sys_class_net/$nic/device/../idVendor" ] && + [ -r "$sys_class_net/$nic/device/../idProduct" ]; then + read -r usb_vendor < "$sys_class_net/$nic/device/../idVendor" + read -r usb_product < "$sys_class_net/$nic/device/../idProduct" + case "$usb_vendor:$usb_product" in + 046b:ffb0|04b3:4010) return 1 ;; + esac + fi + + [ ! -e "$sys_class_net/$nic/master" ] || return 1 + + address_output=$(ip -o addr show dev "$nic") || return 1 + if printf '%s\n' "$address_output" | grep -v 'scope link' | grep -q ' inet'; then + return 1 + fi + return 0 +} + # see if they specified static ip info, otherwise use dhcp XCATPORT=3001 for parm in `cat /proc/cmdline`; do @@ -257,7 +295,14 @@ else #chances that we'll perform a partial discovery #in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases & - NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'` + NICCANDIDATES=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|awk -F: '{print $2}'` + TSMNIC=$(cat /tmp/tsmhostnic 2>/dev/null) + NICSTOBRINGUP= + for nic in $NICCANDIDATES; do + [ "$nic" = "$bootnic" ] && continue + secondary_nic_needs_dhcp "$nic" "$TSMNIC" /sys/class/net || continue + NICSTOBRINGUP="${NICSTOBRINGUP:+$NICSTOBRINGUP }$nic" + done export NICSTOBRINGUP for nic in $NICSTOBRINGUP; do (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null && [ ! -f /tmp/netinitted ]; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) &