Merge pull request #129 from imran1008/bond-mtu

add 'mtu' parameter for bond options
master
Harald Hoyer 2017-03-30 11:03:04 +02:00 committed by GitHub
commit 25895a7769
2 changed files with 10 additions and 2 deletions

View File

@ -251,6 +251,9 @@ if [ -z "$NO_BOND_MASTER" ]; then
linkup $slave
done

# Set mtu on bond master
[ -n "$bondmtu" ] && ip link set mtu $bondmtu dev $netif

# add the bits to setup the needed post enslavement parameters
for arg in $bondoptions ; do
key=${arg%%=*};

View File

@ -1,7 +1,7 @@
#!/bin/sh
#
# Format:
# bond=<bondname>[:<bondslaves>:[:<options>]]
# bond=<bondname>[:<bondslaves>:[:<options>[:<mtu>]]]
#
# bondslaves is a comma-separated list of physical (ethernet) interfaces
# options is a comma-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts
@ -9,6 +9,8 @@
#
# bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
#
# if the mtu is specified, it will be set on the bond master
#

# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
# Ditto for bonding options
@ -25,15 +27,17 @@ parsebond() {
1) bondname=$1; bondslaves="eth0 eth1" ;;
2) bondname=$1; bondslaves=$(str_replace "$2" "," " ") ;;
3) bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " ") ;;
4) bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " "); bondmtu=$4;;
*) die "bond= requires zero to four parameters" ;;
esac
}

# Parse bond for bondname, bondslaves, bondmode and bondoptions
# Parse bond for bondname, bondslaves, bondmode, bondoptions and bondmtu
for bond in $(getargs bond=); do
unset bondname
unset bondslaves
unset bondoptions
unset bondmtu
if [ "$bond" != "bond" ]; then
parsebond "$bond"
fi
@ -47,4 +51,5 @@ for bond in $(getargs bond=); do
echo "bondname=$bondname" > /tmp/bond.${bondname}.info
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
echo "bondmtu=\"$bondmtu\"" >> /tmp/bond.${bondname}.info
done