Skip to content

Commit 9a95880

Browse files
liuhangbingregkh
authored andcommitted
bonding: set random address only when slaves already exist
[ Upstream commit 35ae4e8 ] After commit 5c3bf6c ("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: 5c3bf6c ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 660b2a8 commit 9a95880

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
21172117
memcpy(ss.__data, bond_dev->dev_addr, bond_dev->addr_len);
21182118
} else if (bond->params.fail_over_mac == BOND_FOM_FOLLOW &&
21192119
BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP &&
2120+
bond_has_slaves(bond) &&
21202121
memcmp(slave_dev->dev_addr, bond_dev->dev_addr, bond_dev->addr_len) == 0) {
21212122
/* Set slave to random address to avoid duplicate mac
21222123
* address in later fail over.

0 commit comments

Comments
 (0)