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

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