Blame SOURCES/0515-add-mtu-parameter-for-bond-options.patch

1755ca
From 50d75a50fbebf96fe2937352aa2ea10e467b7ebd Mon Sep 17 00:00:00 2001
1755ca
From: Imran Haider <imran1008@gmail.com>
1755ca
Date: Mon, 16 May 2016 00:14:58 -0400
1755ca
Subject: [PATCH] add 'mtu' parameter for bond options
1755ca
1755ca
Signed-off-by: Imran Haider <imran1008@gmail.com>
1755ca
1755ca
Cherry-picked from: 292548be6ec8e701dab1a532ca072707e890b12e
1755ca
Resolves: #1494265
1755ca
---
1755ca
 modules.d/40network/ifup.sh       | 3 +++
1755ca
 modules.d/40network/parse-bond.sh | 9 +++++++--
1755ca
 2 files changed, 10 insertions(+), 2 deletions(-)
1755ca
1755ca
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
1755ca
index f2b5894d..38c7b709 100755
1755ca
--- a/modules.d/40network/ifup.sh
1755ca
+++ b/modules.d/40network/ifup.sh
1755ca
@@ -249,6 +249,9 @@ if [ -z "$NO_BOND_MASTER" ]; then
1755ca
                 linkup $slave
1755ca
             done
1755ca
 
1755ca
+            # Set mtu on bond master
1755ca
+            [ -n "$bondmtu" ] && ip link set mtu $bondmtu dev $netif
1755ca
+
1755ca
             # add the bits to setup the needed post enslavement parameters
1755ca
             for arg in $bondoptions ; do
1755ca
                 key=${arg%%=*};
1755ca
diff --git a/modules.d/40network/parse-bond.sh b/modules.d/40network/parse-bond.sh
1755ca
index 80b3b077..48e548b9 100755
1755ca
--- a/modules.d/40network/parse-bond.sh
1755ca
+++ b/modules.d/40network/parse-bond.sh
1755ca
@@ -1,7 +1,7 @@
1755ca
 #!/bin/sh
1755ca
 #
1755ca
 # Format:
1755ca
-#       bond=<bondname>[:<bondslaves>:[:<options>]]
1755ca
+#       bond=<bondname>[:<bondslaves>:[:<options>[:<mtu>]]]
1755ca
 #
1755ca
 #       bondslaves is a comma-separated list of physical (ethernet) interfaces
1755ca
 #       options is a comma-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts
1755ca
@@ -9,6 +9,8 @@
1755ca
 #
1755ca
 #       bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
1755ca
 #
1755ca
+#       if the mtu is specified, it will be set on the bond master
1755ca
+#
1755ca
 
1755ca
 # We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
1755ca
 # Ditto for bonding options
1755ca
@@ -25,15 +27,17 @@ parsebond() {
1755ca
     1)  bondname=$1; bondslaves="eth0 eth1" ;;
1755ca
     2)  bondname=$1; bondslaves=$(str_replace "$2" "," " ") ;;
1755ca
     3)  bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " ") ;;
1755ca
+    4)  bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " "); bondmtu=$4;;
1755ca
     *)  die "bond= requires zero to four parameters" ;;
1755ca
     esac
1755ca
 }
1755ca
 
1755ca
-# Parse bond for bondname, bondslaves, bondmode and bondoptions
1755ca
+# Parse bond for bondname, bondslaves, bondmode, bondoptions and bondmtu
1755ca
 for bond in $(getargs bond=); do
1755ca
     unset bondname
1755ca
     unset bondslaves
1755ca
     unset bondoptions
1755ca
+    unset bondmtu
1755ca
     if [ "$bond" != "bond" ]; then
1755ca
         parsebond "$bond"
1755ca
     fi
1755ca
@@ -47,4 +51,5 @@ for bond in $(getargs bond=); do
1755ca
     echo "bondname=$bondname" > /tmp/bond.${bondname}.info
1755ca
     echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
1755ca
     echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
1755ca
+    echo "bondmtu=\"$bondmtu\"" >> /tmp/bond.${bondname}.info
1755ca
 done