Blame SOURCES/0178-bonding-use-hwaddr-of-the-slave-rather-than-the-mast.patch

712866
From 5f5c07eca2bd44967e9043fefca3dae91db010f9 Mon Sep 17 00:00:00 2001
712866
From: Alex Harpin <development@landsofshadow.co.uk>
712866
Date: Tue, 6 May 2014 23:41:17 +0100
712866
Subject: [PATCH] bonding: use hwaddr of the slave rather than the master
712866
712866
When a bonded interface is brought up, any slaves included in the bond
712866
have their hardware address set to that of the bond master.  Although
712866
this allows an interface to be brought up on start up, when the
712866
configuration file is imported into the booted system it prevents
712866
the bonded interface being successfully restarted.
712866
712866
The fix involves obtaining the hardware address of the slaves before
712866
they are added to the bond and then using this value in the
712866
configuration file.
712866
712866
(cherry picked from commit 83c9ff7dbb465bedb10119bb2883d34266922180)
712866
---
712866
 modules.d/40network/ifup.sh      | 1 +
712866
 modules.d/45ifcfg/write-ifcfg.sh | 6 +++++-
712866
 2 files changed, 6 insertions(+), 1 deletion(-)
712866
712866
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
712866
index ede0188..fd84e4c 100755
712866
--- a/modules.d/40network/ifup.sh
712866
+++ b/modules.d/40network/ifup.sh
712866
@@ -188,6 +188,7 @@ if [ -e /tmp/bond.${netif}.info ]; then
712866
 
712866
         for slave in $bondslaves ; do
712866
             ip link set $slave down
712866
+            cat /sys/class/net/$slave/address > /tmp/net.${netif}.${slave}.hwaddr
712866
             echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
712866
             linkup $slave
712866
         done
712866
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
712866
index 7f997a2..fb388bc 100755
712866
--- a/modules.d/45ifcfg/write-ifcfg.sh
712866
+++ b/modules.d/45ifcfg/write-ifcfg.sh
712866
@@ -206,7 +206,11 @@ for netup in /tmp/net.*.did-setup ; do
712866
                 echo "TYPE=Ethernet"
712866
                 echo "ONBOOT=yes"
712866
                 echo "NETBOOT=yes"
712866
-                echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
712866
+                if [ -e /tmp/net.${netif}.${slave}.hwaddr ]; then
712866
+                   echo "HWADDR=\"$(cat /tmp/net.${netif}.${slave}.hwaddr)\""
712866
+                else
712866
+                   echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
712866
+                fi
712866
                 echo "SLAVE=yes"
712866
                 echo "MASTER=\"$netif\""
712866
                 echo "NAME=\"$slave\""