netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Question] Bonding: change bond dev_addr when fail_over_mac=2
@ 2025-01-21 10:09 Hangbin Liu
  2025-01-22  0:32 ` Jay Vosburgh
  0 siblings, 1 reply; 3+ messages in thread
From: Hangbin Liu @ 2025-01-21 10:09 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev, Liang Li

Hi Jay,

Our QE reported that, when setup bonding with fail_over_mac=2. Then release
the first enslaved device. The bond and other slave's mac address with
conflicts with the release device. e.g.

# modprobe bonding mode=1 miimon=100 max_bonds=1 fail_over_mac=2
# ip link set bond0 up
# ifenslave bond0 eth0 eth1
# ifenslave -d bond0 eth0

Then we can see the bond0 and eth1 both still using eth0's address.

I saw in __bond_release_one() we have 

        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);
        }

So why not just change the bond_dev->dev_addr to another slave's perm_hwaddr
instead of keep using the released one?

Thanks
Hangbin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Question] Bonding: change bond dev_addr when fail_over_mac=2
  2025-01-21 10:09 [Question] Bonding: change bond dev_addr when fail_over_mac=2 Hangbin Liu
@ 2025-01-22  0:32 ` Jay Vosburgh
  2025-01-22  1:50   ` Hangbin Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Jay Vosburgh @ 2025-01-22  0:32 UTC (permalink / raw)
  To: Hangbin Liu; +Cc: netdev, Liang Li

Hangbin Liu <liuhangbin@gmail.com> wrote:

>Hi Jay,
>
>Our QE reported that, when setup bonding with fail_over_mac=2. Then release
>the first enslaved device. The bond and other slave's mac address with
>conflicts with the release device. e.g.
>
># modprobe bonding mode=1 miimon=100 max_bonds=1 fail_over_mac=2
># ip link set bond0 up
># ifenslave bond0 eth0 eth1
># ifenslave -d bond0 eth0
>
>Then we can see the bond0 and eth1 both still using eth0's address.
>
>I saw in __bond_release_one() we have 
>
>        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 I'm reading it right, I don't think the above will trigger
the message for your example, as "!bond->params.fail_over_mac" and
"BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP" are both false.

>So why not just change the bond_dev->dev_addr to another slave's perm_hwaddr
>instead of keep using the released one?

	That would cause the MAC of the bond itself to change without
user intervention, and the active-backup mode won't change the bond's
MAC except for the case of fail_over_mac=1.  It's not uncommon for the
network to have dependencies on the MAC address itself, e.g., MAC based
permission rules.  There's also an cost associated with changing the
MAC, requiring a gratuitous ARP and some propagation time.

	What you describe is also the behavior for active-backup with
fail_over_mac=0, in that the bond will keep using the MAC gleaned from
the first interface even if that interface is removed from the bond, so
it's not really something specific to fail_over_mac=2.

	I don't think bonding should automatically adopt a new MAC
address in this case, but loosening the logic on the warning message
would be ok.

	-J

---
	-Jay Vosburgh, jv@jvosburgh.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Question] Bonding: change bond dev_addr when fail_over_mac=2
  2025-01-22  0:32 ` Jay Vosburgh
@ 2025-01-22  1:50   ` Hangbin Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Hangbin Liu @ 2025-01-22  1:50 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev, Liang Li

On Tue, Jan 21, 2025 at 04:32:30PM -0800, Jay Vosburgh wrote:
> Hangbin Liu <liuhangbin@gmail.com> wrote:
> >I saw in __bond_release_one() we have 
> >
> >        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 I'm reading it right, I don't think the above will trigger
> the message for your example, as "!bond->params.fail_over_mac" and
> "BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP" are both false.

Ah, yes. I need to read carefully.

> 
> >So why not just change the bond_dev->dev_addr to another slave's perm_hwaddr
> >instead of keep using the released one?
> 
> 	That would cause the MAC of the bond itself to change without
> user intervention, and the active-backup mode won't change the bond's
> MAC except for the case of fail_over_mac=1.  It's not uncommon for the
> network to have dependencies on the MAC address itself, e.g., MAC based
> permission rules.  There's also an cost associated with changing the
> MAC, requiring a gratuitous ARP and some propagation time.
> 
> 	What you describe is also the behavior for active-backup with
> fail_over_mac=0, in that the bond will keep using the MAC gleaned from
> the first interface even if that interface is removed from the bond, so
> it's not really something specific to fail_over_mac=2.

Thanks for your explanation.
> 
> 	I don't think bonding should automatically adopt a new MAC
> address in this case, but loosening the logic on the warning message
> would be ok.

OK, I will try add a warning for this issue.

Thanks
Hangbin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-22  1:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-21 10:09 [Question] Bonding: change bond dev_addr when fail_over_mac=2 Hangbin Liu
2025-01-22  0:32 ` Jay Vosburgh
2025-01-22  1:50   ` Hangbin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).