aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2006-10-18 20:51:30 +0000
committerBill Nottingham <notting@redhat.com>2006-10-18 20:51:30 +0000
commit4ca7339fd0b96d4a26f04395c668f88c2015937d (patch)
tree2886c58be0fa0c06468df8da7931b9586dba7f45
parent1c7bb9d0af3934db9d2761c64ae8745f999ac4dd (diff)
downloadinitscripts-4ca7339fd0b96d4a26f04395c668f88c2015937d.tar
initscripts-4ca7339fd0b96d4a26f04395c668f88c2015937d.tar.gz
initscripts-4ca7339fd0b96d4a26f04395c668f88c2015937d.tar.bz2
initscripts-4ca7339fd0b96d4a26f04395c668f88c2015937d.tar.xz
initscripts-4ca7339fd0b96d4a26f04395c668f88c2015937d.zip
use sysfs interface for bonding (#202443, <agospoda@redhat.com>)
-rwxr-xr-xsysconfig/network-scripts/ifdown-eth2
-rwxr-xr-xsysconfig/network-scripts/ifup-eth19
-rw-r--r--sysconfig/network-scripts/network-functions13
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