diff options
author | Bill Nottingham <notting@redhat.com> | 2006-10-18 20:52:02 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2006-10-18 20:52:02 +0000 |
commit | ee8269c53d600cc20dfb90d4c061ca61559e10ac (patch) | |
tree | 75dd43fc57222a2550719096d4740a41caa2ac23 /sysconfig/network-scripts | |
parent | 29ab1c774b9b615c3d5c6f8cd801a2d6fa531d78 (diff) | |
download | initscripts-ee8269c53d600cc20dfb90d4c061ca61559e10ac.tar initscripts-ee8269c53d600cc20dfb90d4c061ca61559e10ac.tar.gz initscripts-ee8269c53d600cc20dfb90d4c061ca61559e10ac.tar.bz2 initscripts-ee8269c53d600cc20dfb90d4c061ca61559e10ac.tar.xz initscripts-ee8269c53d600cc20dfb90d4c061ca61559e10ac.zip |
use sysfs interface for bonding (#202443, <agospoda@redhat.com>)
Diffstat (limited to 'sysconfig/network-scripts')
-rwxr-xr-x | sysconfig/network-scripts/ifdown-eth | 2 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 19 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 13 |
3 files changed, 26 insertions, 8 deletions
diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index 826fd309..efcd13d8 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -96,7 +96,7 @@ if [ -d "/sys/class/net/${REALDEVICE}" ]; then fi if [ "${SLAVE}" = "yes" -a -n "${MASTER}" ]; then - /sbin/ifenslave -d ${MASTER} ${DEVICE} 2>/dev/null + echo "-${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null fi if [ "${REALDEVICE}" = "${DEVICE}" ]; then diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index f421060e..fd0d4bc2 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -97,13 +97,9 @@ if [ -n "${BRIDGE}" -a -x /usr/sbin/brctl ]; then fi # slave device? -if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" -a \ - -x /sbin/ifenslave ]; then - RFLAG="" ; [ "${RECEIVEONLY}" = yes ] && RFLAG="-r" - +if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" ]; then /sbin/ip link set dev ${DEVICE} down - echo $"Enslaving ${DEVICE} to ${MASTER}" - ifenslave ${RFLAG} "${MASTER}" "${DEVICE}" >/dev/null 2>&1 + echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null if [ -n "$ETHTOOL_OPTS" ] ; then /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS @@ -115,7 +111,16 @@ fi # Bonding initialization. For DHCP, we need to enslave the devices early, # so it can actually get an IP. if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then + /sbin/ip link set dev ${DEVICE} down + + # add the bits to setup driver parameters here + for arg in $BONDING_OPTS ; do + key=${arg%%=*}; + value=${arg##*=}; + echo $value > /sys/class/net/${DEVICE}/bonding/$key + done + /sbin/ip link set dev ${DEVICE} up [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} if [ "$BOOTPROTO" = "dhcp" ]; then @@ -283,7 +288,7 @@ if is_bonding_device ${DEVICE} ; then if [ "$BOOTPROTO" = "dhcp" ]; then DEV=$DEVICE (. $device - ifenslave -d $DEV $DEVICE + echo "-${DEVICE}" > /sys/class/net/${DEV}/bonding/slaves 2>/dev/null ) fi /sbin/ifup ${device##*/} diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 5e1fa2a5..3fe8b73f 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -240,6 +240,11 @@ END { fi rename_device "$1" "$HWADDR" "$curdev" fi + + if [ ${alias} == "bonding" ]; then + install_bonding_driver $1 + fi + LC_ALL= LANG= ip -o link | grep -q $1 return $? } @@ -383,6 +388,14 @@ is_wireless_device () return 1 } +install_bonding_driver () +{ + ethtool -i $1 2>/dev/null | grep -q "driver: bonding" && return 0 + [ ! -f /sys/class/net/bonding_masters ] && modprobe bonding || return 1 + echo "+$1" > /sys/class/net/bonding_masters + return 0 +} + is_bonding_device () { [ "${TYPE}" = "Bonding" ] && return 0 |