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