bonding: use hwaddr of the slave rather than the master

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.
master
Alex Harpin 2014-05-06 23:41:17 +01:00 committed by Harald Hoyer
parent 827ec27a9c
commit 83c9ff7dbb
2 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -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\""