Subject: Re: [PATCHv2 net] bonding: use permanent address for MAC swapping if device address is same

From: Hangbin Liu <[email-masked]>
Date: Fri, 18 Apr 2025 07:39:24 +0000

On Thu, Apr 17, 2025 at 09:16:33PM -0700, Jay Vosburgh wrote:
> >Hmm, then how about use bond_for_each_slave() and find out the link
> >that has same MAC address with bond/new_slave?
> 
> 	But even if we find it, aren't we stuck at that point?  The
> situation would be that the bond and one backup interface have MAC#1.
> MAC#1 may or may not be that backup interface's permanent MAC address,
> and we're adding another interface, also with MAC#1, which might be the
> newly added interface's permanent MAC.  The MAC swap gyrations to
> guarantee this would work correctly in all cases seem to be rather
> involved.
> 
> 	Wouldn't it be equally effective to, when the conflicting
> interface is added, give it a random MAC to avoid the conflict?  That
> random MAC shouldn't end up as the bond's MAC, so it would exist only as
> a placeholder of sorts.

This looks good to me. Thanks for your suggestion.

Regards
Hangbin
> 
> 	I'm unsure if there are many (any?) devices in common use today
> that actually have issues with multiple ports using the same MAC, so I
> don't think we need an overly complicated solution.
> 
> 	-J
> 
> ---
> 	-Jay Vosburgh, [email-masked]