Update of /cvsroot/devil-linux/build/config/etc/init.d
In directory vz-cvs-3.sog:/tmp/cvs-serv5324/config/etc/init.d
Modified Files:
network
Log Message:
closed bug #97 - multiple bond devices with different configuration
Index: network
===================================================================
RCS file: /cvsroot/devil-linux/build/config/etc/init.d/network,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- network 16 Sep 2010 07:43:50 -0000 1.54
+++ network 16 Apr 2011 05:01:49 -0000 1.55
@@ -221,8 +221,35 @@
#
# Bonding
if [ "$BONDING_MASTER" = "yes" ]; then
+
+ SYS="/sys/class/net" # sysfs root
+
+ if [ -e "$SYS/$DEVICE" ]; then
+ for i in "$MODULE_OPTS"; do
+ tmp=$(echo $i | awk -F'=' '{print $1,$2}') # param=arg
+ set -- $tmp
+ PARAM=$1; ARG=$2;
+
+ if [ "$PARAM" == "max_bonds" ]; then # we cannot redefine it for the loaded module
+ continue
+ fi
+
+ if [ -e "$SYS/$DEVICE/bonding/$PARAM" ]; then
+ echo "$ARG" > $SYS/$DEVICE/bonding/$PARAM
+ if [ $? -ne 0 ]; then
+ echo "Failed to set $PARAM for $DEVICE"
+ fi
+ else
+ echo "Parameter $PARAM doesn't exist for $DEVICE"
+ fi
+ done
+ else
+ "Device $DEVICE doesn't exist. Check 'max_bonds=' parameter for 'bonding' module"
+ fi
+
ip link set $DEVICE up $MTU
ifenslave $DEVICE $BONDING_SLAVES $BONDING_OPTS
+
fi
if [ "$DHCP" = "yes" ]; then
|