mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
bonding: set random address only when slaves already exist
After commit5c3bf6cba7("bonding: assign random address if device address is same as bond"), bonding will erroneously randomize the MAC address of the first interface added to the bond if fail_over_mac = follow. Correct this by additionally testing for the bond being empty before randomizing the MAC. Fixes:5c3bf6cba7("bonding: assign random address if device address is same as bond") Reported-by: Qiuling Ren <qren@redhat.com> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Link: https://patch.msgid.link/20250910024336.400253-1-liuhangbin@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
4351ca3fcb
commit
35ae4e8629
@@ -2132,6 +2132,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
|
||||
memcpy(ss.__data, bond_dev->dev_addr, bond_dev->addr_len);
|
||||
} else if (bond->params.fail_over_mac == BOND_FOM_FOLLOW &&
|
||||
BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP &&
|
||||
bond_has_slaves(bond) &&
|
||||
memcmp(slave_dev->dev_addr, bond_dev->dev_addr, bond_dev->addr_len) == 0) {
|
||||
/* Set slave to random address to avoid duplicate mac
|
||||
* address in later fail over.
|
||||
|
||||
Reference in New Issue
Block a user