Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion network-scripts/ifdown
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ if [ ! -x ${OTHERSCRIPT} ]; then
fi

if [ ! -x ${OTHERSCRIPT} ]; then
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth"
if is_true "${PKEY}" && [ "${TYPE}" = "Infiniband" ] ; then
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-ib"
else
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth"
fi
fi

exec ${OTHERSCRIPT} ${CONFIG} $2
14 changes: 14 additions & 0 deletions network-scripts/ifdown-ib
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

cd /etc/sysconfig/network-scripts
. ./network-functions
CONFIG=${1}
source_config

if is_true "${PKEY}" && [ "${TYPE}" = "Infiniband" ] ; then
# IPoIB support
if [ -d /sys/devices/virtual/net/${DEVICE} ]; then
ip link del "${DEVICE}"
fi
fi
exit 0
23 changes: 23 additions & 0 deletions network-scripts/ifup
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,29 @@ if is_true "${VLAN}" && is_false "$ISALIAS" && [ -n "$DEVICE" ]; then
--prefix "/proc/sys/net/ipv6/conf/${DEVICE}"
fi

# IPoIB support
if is_true "${PKEY}" && [ "${TYPE}" = "Infiniband" ] ; then
MATCH='^.+\.[0-9]{1,4}$'
if [[ "${DEVICE}" =~ $MATCH ]]; then
PHYSDEV=${DEVICE%.*}
fi
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PHYSDEV extraction logic has a flaw: if the DEVICE doesn't match the regex pattern, PHYSDEV remains unset, but it's still used later in line 165. This will cause the ip link add command to fail with an empty link parameter.

Suggested change
fi
fi
if [ -z "${PHYSDEV}" ]; then
net_log $"ERROR: Could not extract physical device from DEVICE='${DEVICE}'"
exit 1
fi

Copilot uses AI. Check for mistakes.
if ! modprobe ib_ipoib >/dev/null 2>&1 ; then
net_log $"No IPoIB support available in kernel for device ${DEVICE}"
exit 1
fi
if [ -d /sys/devices/virtual/net/${DEVICE} ]; then
check_device_down ${DEVICE} && { ip -o link set dev ${DEVICE} up; }
else
ip link add dev ${DEVICE} link ${PHYSDEV} type ipoib pkey ${PKEY_ID} || {
(/usr/bin/logger -p daemon.info -t ifup \$"ERROR: could not add
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dollar sign before the double quote should not be escaped with a backslash. It should be $\" instead of \$\" to properly expand the localized string.

Suggested change
(/usr/bin/logger -p daemon.info -t ifup \$"ERROR: could not add
(/usr/bin/logger -p daemon.info -t ifup $"ERROR: could not add

Copilot uses AI. Check for mistakes.
pkey ${PKEY_ID} as ${DEVICE} on dev ${PHYSDEV}" &) &
net_log $"ERROR: could not add pkey ${PKEY_ID} as ${DEVICE} on dev ${PHYSDEV}"
exit 1
}
fi
exit 0
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unconditional exit prevents the rest of the ifup script from executing. IPoIB interfaces still need IP configuration, DHCP setup, and other standard network interface initialization that occurs after this block.

Suggested change
exit 0

Copilot uses AI. Check for mistakes.
fi

if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then
DYNCONFIG=true
fi
Expand Down