You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

75 lines
2.9 KiB

From 50d75a50fbebf96fe2937352aa2ea10e467b7ebd Mon Sep 17 00:00:00 2001
From: Imran Haider <imran1008@gmail.com>
Date: Mon, 16 May 2016 00:14:58 -0400
Subject: [PATCH] add 'mtu' parameter for bond options
Signed-off-by: Imran Haider <imran1008@gmail.com>
Cherry-picked from: 292548be6ec8e701dab1a532ca072707e890b12e
Resolves: #1494265
---
modules.d/40network/ifup.sh | 3 +++
modules.d/40network/parse-bond.sh | 9 +++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index f2b5894d..38c7b709 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -249,6 +249,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%%=*};
diff --git a/modules.d/40network/parse-bond.sh b/modules.d/40network/parse-bond.sh
index 80b3b077..48e548b9 100755
--- a/modules.d/40network/parse-bond.sh
+++ b/modules.d/40network/parse-bond.sh
@@ -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