]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bonding: report duplicate MAC address in all situations
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 25 Feb 2025 03:39:14 +0000 (03:39 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 27 Feb 2025 03:27:17 +0000 (19:27 -0800)
Normally, a bond uses the MAC address of the first added slave as the bond’s
MAC address. And the bond will set active slave’s MAC address to bond’s
address if fail_over_mac is set to none (0) or follow (2).

When the first slave is removed, the bond will still use the removed slave’s
MAC address, which can lead to a duplicate MAC address and potentially cause
issues with the switch. To avoid confusion, let's warn the user in all
situations, including when fail_over_mac is set to 2 or not in active-backup
mode.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/20250225033914.18617-1-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/bonding/bond_main.c

index 7d716e90a84c3b0f4dcbe50e0b355792fb500bbd..7d98fee5a27f9eba57f864ba9a2d0e8d930b5119 100644 (file)
@@ -2548,7 +2548,7 @@ static int __bond_release_one(struct net_device *bond_dev,
 
        RCU_INIT_POINTER(bond->current_arp_slave, NULL);
 
-       if (!all && (!bond->params.fail_over_mac ||
+       if (!all && (bond->params.fail_over_mac != BOND_FOM_ACTIVE ||
                     BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)) {
                if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) &&
                    bond_has_slaves(bond))