Subject: Re: Problem with IPv6 privacy addresses in 7.0

From: Beniamino Galvani <[email-masked]>
Date: Fri, 29 May 2026 10:40:29 +0200

On Thu, May 28, 2026 at 09:22:14PM +0200, Stefano Brivio wrote:
> > >>> about the source address selection is impacted. Indeed, the commit
> > >>> had effects on one of the selftests, which had to be modified to
> > >>> change the order of iproute2 invocations.
> > >>>  
> > >>>>>> If the fix must be in NetworkManager, we only need to parse
> > >>>>>> them in non-reverse order like IPv4, I guess.  
> > >>>>>
> > >>>>> But that would then require some form of detection, and, at
> > >>>>> least according to Fernando, isn't the most robust option
> > >>>>> anyway, as ideally NetworkManager shouldn't rely on the order
> > >>>>> at all.  
> > >>>>
> > >>>> True  
> > >>>
> > >>> Correct, if the new behavior is considered better, there should be
> > >>> a way to detect which order must be used. Otherwise userspace
> > >>> tools won't be able to maintain the same behavior with different
> > >>> kernels.  
> > >>
> > >> My remark here is about whether NetworkManager needs to detect this
> > >> at all. If it used timestamps to detect recent / older addresses, as 
> > >> Fernando mentioned, then you wouldn't need any detection at all,
> > >> right? Or is there something else we're missing?

The problem arises from how NetworkManager handles updates (e.g. after
receiving a Router Advertisement). At each update NM determines the
list of addresses to configure and checks if the addresses are already
in the right order in the kernel. If they aren't, NM removes and
re-adds them in reverse to achieve the desired order. Since kernel
7.0+, the order changed and the addresses always appear in the reverse
order.

This creates 2 negative effects. First, it breaks source preference:
if users configured a profile with addr1=A, addr2=B because they
wanted A to be preferred, now B is preferred. This is not
NetworkManager-specific, it affects also simple scripts that add two
addresses (like the selftest that had to be changed in the commit).

But most importantly, at each commit NM detects that the order is
wrong and constantly removes and re-adds the addresses. This
continuous cycle is what causes the bug that Chris reported.

BTW, NM doesn't touch the temporary addresses directly; they are
automatically removed when the corresponding SLAAC address is
removed. Since the problem is not only about temporary addresses we
can't rely on timestamps.

> > > Ohno. Now that Beniamino and Iñigo mentioned it, this will likely break
> > > many other environments. In essence, many tools relies on the previous 
> > > ordering to identify which address is the primary one.
> > > 
> > > E.g cloud tooling communicating with the metadata server via IMDS(v2) to 
> > > configure IPv6 primary and secondary addresses. They are likely relying 
> > > on the ordering for that.
> 
> I haven't seen any tool specifically relying on insertion order for
> this so far and I'm having a hard time believing this kind of tooling
> wouldn't rely explicitly on home / care-of addresses or different
> labels -- see RFC 5014 and RFC 6724 Section 5. (or, perhaps clearer,
> the examples in section 10.1, in particular rule 4. and rule 6.

I'm not familiar with home addresses, reading the RFC it seems that
setting the flag might have effect not only on source address
selection but also on other aspects?

> But I'll look for more convincing examples in a bit (maybe you have some
> at hand?)

I remember we had users reporting issues about the ordering of IPv6
addresses, I'll try to find links to them.

Beniamino