From 2f46e82d4cf40ab0bb96adb7e3f35c446ffd2028 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 9 Jun 2004 04:45:30 +0000 Subject: bonding fixes --- sysconfig/network-scripts/ifup | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index bbd151bf..637dcda5 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -120,16 +120,20 @@ if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" -a \ ifconfig ${DEVICE} down echo $"Enslaving ${DEVICE} to ${MASTER}" - ifenslave ${RFLAG} "${MASTER}" "${DEVICE}" + ifenslave ${RFLAG} "${MASTER}" "${DEVICE}" >/dev/null 2>&1 exit 0 fi -# master device? +# Bonding initialization. For DHCP, we need to enslave the devices early, +# so it can actually get an IP. if [ "${TYPE}" = "Bonding" -o "$DEVICETYPE" = "bond" ] || ethtool -i $DEVICE 2>/dev/null| grep -q "driver: bonding" ; then - ifconfig ${DEVICE} up + /sbin/ip link set dev ${DEVICE} down + /sbin/ip link set dev ${DEVICE} up for device in `fgrep -l "MASTER=${DEVICE}" /etc/sysconfig/network-scripts/ifcfg-*` ; do - /sbin/ifup ${device##*/} + if [ "$BOOTPROTO" = "dhcp" ]; then + /sbin/ifup ${device##*/} + fi done fi @@ -263,6 +267,20 @@ else fi fi +# Bonding initialization part II - for static, enslave the devices. For +# DHCP, remove any routes for the slaves. +if [ "${TYPE}" = "Bonding" ] || ethtool -i $DEVICE 2>/dev/null| grep -q "driver: bonding" ; then + for device in `fgrep -l "MASTER=${DEVICE}" /etc/sysconfig/network-scripts/ifcfg-*` ; do + if [ "$BOOTPROTO" = "dhcp" ]; then + DEV=$DEVICE + eval $(LANG=C fgrep "DEVICE=" $device) + ifenslave -d $DEV DEVICE + DEVICE=$DEV + fi + /sbin/ifup ${device##*/} + done +fi + # IPv6 initialisation? if [ "${NETWORKING_IPV6}" = "yes" ]; then /etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG} -- cgit v1.2.1