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

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