* [PATCHv2 net-next] bonding: report duplicate MAC address in all situations
@ 2025-02-25 3:39 Hangbin Liu
2025-02-25 9:47 ` Nikolay Aleksandrov
2025-02-27 4:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Hangbin Liu @ 2025-02-25 3:39 UTC (permalink / raw)
To: netdev
Cc: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Nikolay Aleksandrov, Simon Horman,
linux-kernel, Hangbin Liu
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>
---
v2: add fail_over_mac != BOND_FOM_ACTIVE to condition (Jakub Kicinski)
---
drivers/net/bonding/bond_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7d716e90a84c..7d98fee5a27f 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -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))
--
2.46.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCHv2 net-next] bonding: report duplicate MAC address in all situations
2025-02-25 3:39 [PATCHv2 net-next] bonding: report duplicate MAC address in all situations Hangbin Liu
@ 2025-02-25 9:47 ` Nikolay Aleksandrov
2025-02-27 4:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2025-02-25 9:47 UTC (permalink / raw)
To: Hangbin Liu, netdev
Cc: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, linux-kernel
On 2/25/25 05:39, Hangbin Liu wrote:
> 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>
> ---
>
> v2: add fail_over_mac != BOND_FOM_ACTIVE to condition (Jakub Kicinski)
>
> ---
> drivers/net/bonding/bond_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 7d716e90a84c..7d98fee5a27f 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -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))
LGTM,
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCHv2 net-next] bonding: report duplicate MAC address in all situations
2025-02-25 3:39 [PATCHv2 net-next] bonding: report duplicate MAC address in all situations Hangbin Liu
2025-02-25 9:47 ` Nikolay Aleksandrov
@ 2025-02-27 4:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-27 4:00 UTC (permalink / raw)
To: Hangbin Liu
Cc: netdev, jv, andrew+netdev, davem, edumazet, kuba, pabeni, razor,
horms, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 25 Feb 2025 03:39:14 +0000 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [PATCHv2,net-next] bonding: report duplicate MAC address in all situations
https://git.kernel.org/netdev/net-next/c/28d68d396a1c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-27 4:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25 3:39 [PATCHv2 net-next] bonding: report duplicate MAC address in all situations Hangbin Liu
2025-02-25 9:47 ` Nikolay Aleksandrov
2025-02-27 4:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox