netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, Jay Vosburgh <jv@jvosburgh.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Simon Horman <horms@kernel.org>, Cosmin Ratiu <cratiu@nvidia.com>,
	linux-kernel@vger.kernel.org, Liang Li <liali@redhat.com>
Subject: Re: [PATCH net] bonding: use permanent address for MAC swapping if device address is same
Date: Mon, 7 Apr 2025 07:57:05 +0000	[thread overview]
Message-ID: <Z_OFUaeotDYJ31o7@fedora> (raw)
In-Reply-To: <d99b52d7-bdd7-4c67-9be5-f5c48edc8afa@redhat.com>

On Thu, Apr 03, 2025 at 04:02:33PM +0200, Paolo Abeni wrote:
> On 3/19/25 9:09 AM, Hangbin Liu wrote:
> > Similar with a951bc1e6ba5 ("bonding: correct the MAC address for "follow"
> > fail_over_mac policy"). The fail_over_mac follow mode requires the formerly
> > active slave to swap MAC addresses with the newly active slave during
> > failover. However, the slave's MAC address can be same under certain
> > conditions:
> > 
> > 1) ip link set eth0 master bond0
> >    bond0 adopts eth0's MAC address (MAC0).
> > 
> > 1) ip link set eth1 master bond0
> >    eth1 is added as a backup with its own MAC (MAC1).
> > 
> > 3) ip link set eth0 nomaster
> >    eth0 is released and restores its MAC (MAC0).
> >    eth1 becomes the active slave, and bond0 assigns MAC0 to eth1.
> 
> It was not immediately clear to me that the mac-dance in the code below
> happens only at failover time.
> 
> I second Jakub's doubt, I think it would be better to change eth0 mac
> address here (possibly to permanent eth1 mac, to preserve some consistency?)

I have talked about one of the duplicate mac issue with Jay before [1]. We
decided to print a warning for that. I will discuss with Jay for this one
in one new patch thread.

[1] https://lore.kernel.org/netdev/Z49yXz1dx2ZzqhC1@fedora

Thanks
Hangbin
> 
> Doing that in ndo_del_slave() should allow bonding to change the mac
> while still owning the old slave and avoid races with user-space.
> 
> WDYT?
> 
> Thanks,
> 
> Paolo
> 

      reply	other threads:[~2025-04-07  7:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19  8:09 [PATCH net] bonding: use permanent address for MAC swapping if device address is same Hangbin Liu
2025-03-20 19:13 ` Jay Vosburgh
2025-03-24  2:30   ` Hangbin Liu
2025-03-25 13:24 ` Jakub Kicinski
2025-03-26 10:22   ` Hangbin Liu
2025-03-26 11:32     ` Jakub Kicinski
2025-03-26 14:18       ` Hangbin Liu
2025-04-03 14:02 ` Paolo Abeni
2025-04-07  7:57   ` Hangbin Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z_OFUaeotDYJ31o7@fedora \
    --to=liuhangbin@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=cratiu@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=liali@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).