Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Stefano Brivio <sbrivio@redhat.com>,
	Fernando Fernandez Mancera <fmancera@suse.de>,
	netdev@vger.kernel.org, yuhuang@redhat.com,
	justin.iurman@gmail.com, horms@kernel.org, pabeni@redhat.com,
	kuba@kernel.org, edumazet@google.com, davem@davemloft.net,
	dsahern@kernel.org, Chris Adams <linux@cmadams.net>,
	Beniamino Galvani <bgalvani@redhat.com>,
	Thorsten Leemhuis <regressions@leemhuis.info>,
	Andrew Lunn <andrew@lunn.ch>,
	ihuguet@redhat.com, regressions@lists.linux.dev
Subject: Re: IPv6 address insertion order (was Re: [PATCH net v2] Revert "ipv6: preserve insertion order for same-scope addresses")
Date: Tue, 2 Jun 2026 16:21:18 +0300	[thread overview]
Message-ID: <20260602132118.GA508395@shredder> (raw)
In-Reply-To: <ah57wxGjL7JBORR1@zatzit>

On Tue, Jun 02, 2026 at 04:44:19PM +1000, David Gibson wrote:
> I get the impression there's a rough consensus that the best we can do
> now is revert this change (already done), and make a new patch which
> changes the insertion order to the "correct" one conditional on a new
> flag.
> 
> Stefano has enough other fires to fight, so I'm taking a look at
> implementing that.  Some initial thoughts, that I'm soliciting
> feedback on:
> 
> 1) I'm assuming the idea here is to add the new flag to nlmsg_flags in
>    nlmsghdr
> 
> ifa_flags in ifaddrmsg would be the other candidate, but it looks like
> it's encoding properties of the address itself, not about the action
> of inserting it.  Plus all its bits are allocated, anyway.
> 
> 2) Could we re-use NLM_F_APPEND?
> 
> The short description of this existing flag in linux/uapi/netlink.h is
> "Add to end of list" which sounds like the right thing.  Looking
> closer, however, it seems like what is' used for so far is things
> where the entity added with the NEW<whatever> operation is itself a
> list, and NLM_F_APPEND causes it to be added to rather than replaced.
> It's not used for addresses at present, AFAICT the list of addresses
> is a semantic level above the address entity itself.
> 
> So maybe re-using it for the thing I tentatively called
> NLM_F_INSERT_LAST would be confusing?
> 
> On the other hand, it's not used for addresses at the moment, so
> AFAICT there's nothing actually preventing us reusing it for this
> purpose. That would save a bit - we only have 2 general and 4 NEW
> specific bits left, by the looks of it.

This is not really viable. Even if the kernel is not using NLM_F_APPEND
for RTM_NEWADDR, but not rejecting its presence either, then we can
create a change in behavior for a user space that is currently setting
it (intentionally or not).

Example:

https://lore.kernel.org/netdev/27c249d80c346a258cfbf32f1d131ad4fe64e77c.camel@debian.org/

> 
> 3) What other things might need changing to take advantage of the
>    kernel change
> 
> My innitial testing suggests that unknown nlmsg_flags bits are
> currently ignored by the kernel.

Which is a problem... From the looks of it, the same is true for
ifa_flags.

> That means that tools for which the new behviour is desirable, but not
> essential may be able to avoid probing - they can set the bit and
> hope.  I think that includes passt/pasta and also iproute's
> save/restore functionality.
> 
> That said, things which might want updating:
>  - iproute2 to use this for save/restore
>  - netlink(7) man page to detail the new flag / new flag semantics
>  - passt/pasta
>  - network-manager, here we require the exact behaviour be maintained,
>    so it would have to attempt the new flag, then apply the existing
>    workaround (reversing the order itself) if that fails.  Maybe more
>    trouble that it's worth?
> 
> Any others people can think of?

The safest route is probably a new attribute and a corresponding keyword
in iproute2. Note that new iproute2 versions need to be able to work
with old kernels, so iproute2 cannot use the new attribute by default
(it will be rejected by old kernels).

  parent reply	other threads:[~2026-06-02 13:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 11:23 [PATCH net v2] Revert "ipv6: preserve insertion order for same-scope addresses" Fernando Fernandez Mancera
2026-05-29 11:41 ` Stefano Brivio
2026-05-29 11:45   ` Fernando Fernandez Mancera
2026-05-29 12:06   ` Chris Adams
2026-06-01  2:03   ` Matthieu Baerts
2026-06-01 13:35     ` Stefano Brivio
2026-06-01 14:01       ` Íñigo Huguet
2026-06-01 14:22         ` Thorsten Leemhuis
2026-06-02  6:44   ` IPv6 address insertion order (was Re: [PATCH net v2] Revert "ipv6: preserve insertion order for same-scope addresses") David Gibson
2026-06-02 12:46     ` Andrew Lunn
2026-06-02 13:21     ` Ido Schimmel [this message]
2026-05-29 20:20 ` [PATCH net v2] Revert "ipv6: preserve insertion order for same-scope addresses" patchwork-bot+netdevbpf

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=20260602132118.GA508395@shredder \
    --to=idosch@nvidia.com \
    --cc=andrew@lunn.ch \
    --cc=bgalvani@redhat.com \
    --cc=davem@davemloft.net \
    --cc=david@gibson.dropbear.id.au \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=fmancera@suse.de \
    --cc=horms@kernel.org \
    --cc=ihuguet@redhat.com \
    --cc=justin.iurman@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@cmadams.net \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    --cc=sbrivio@redhat.com \
    --cc=yuhuang@redhat.com \
    /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