]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
bonding: use hwaddr of the slave rather than the master
authorAlex Harpin <development@landsofshadow.co.uk>
Tue, 6 May 2014 22:41:17 +0000 (23:41 +0100)
committerHarald Hoyer <harald@redhat.com>
Tue, 3 Jun 2014 10:26:01 +0000 (12:26 +0200)
When a bonded interface is brought up, any slaves included in the bond
have their hardware address set to that of the bond master.  Although
this allows an interface to be brought up on start up, when the
configuration file is imported into the booted system it prevents
the bonded interface being successfully restarted.

The fix involves obtaining the hardware address of the slaves before
they are added to the bond and then using this value in the
configuration file.

modules.d/40network/ifup.sh
modules.d/45ifcfg/write-ifcfg.sh

index 7740be5a164567f112911decf3890bacad3f3b51..2e762ac9a188370a5416e7e3cf158925031209dd 100755 (executable)
@@ -188,6 +188,7 @@ if [ -e /tmp/bond.${netif}.info ]; then
 
         for slave in $bondslaves ; do
             ip link set $slave down
+            cat /sys/class/net/$slave/address > /tmp/net.${netif}.${slave}.hwaddr
             echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
             linkup $slave
         done
index 6756c3f8a709290f64d26d9243b55629480f12f4..803ae8e212860927373a85712955e53ef185d283 100755 (executable)
@@ -206,7 +206,11 @@ for netup in /tmp/net.*.did-setup ; do
                 echo "TYPE=Ethernet"
                 echo "ONBOOT=yes"
                 echo "NETBOOT=yes"
-                echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
+                if [ -e /tmp/net.${netif}.${slave}.hwaddr ]; then
+                   echo "HWADDR=\"$(cat /tmp/net.${netif}.${slave}.hwaddr)\""
+                else
+                   echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
+                fi
                 echo "SLAVE=yes"
                 echo "MASTER=\"$netif\""
                 echo "NAME=\"$slave\""