[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250219075515.1505887-1-liuhangbin@gmail.com>
Date: Wed, 19 Feb 2025 07:55:15 +0000
From: Hangbin Liu <liuhangbin@...il.com>
To: netdev@...r.kernel.org
Cc: Jay Vosburgh <jv@...sburgh.net>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Nikolay Aleksandrov <razor@...ckwall.org>,
Simon Horman <horms@...nel.org>,
linux-kernel@...r.kernel.org,
Hangbin Liu <liuhangbin@...il.com>
Subject: [PATCH net-next] bonding: report duplicate MAC address in all situations
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
in active-backup mode.
Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
---
drivers/net/bonding/bond_main.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index e45bba240cbc..ca66107776cc 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2551,13 +2551,11 @@ 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 ||
- BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)) {
- if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) &&
- bond_has_slaves(bond))
- slave_warn(bond_dev, slave_dev, "the permanent HWaddr of slave - %pM - is still in use by bond - set the HWaddr of slave to a different address to avoid conflicts\n",
- slave->perm_hwaddr);
- }
+ if (!all &&
+ ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) &&
+ bond_has_slaves(bond))
+ slave_warn(bond_dev, slave_dev, "the permanent HWaddr of slave - %pM - is still in use by bond - set the HWaddr of slave to a different address to avoid conflicts\n",
+ slave->perm_hwaddr);
if (rtnl_dereference(bond->primary_slave) == slave)
RCU_INIT_POINTER(bond->primary_slave, NULL);
--
2.39.5 (Apple Git-154)
Powered by blists - more mailing lists