* [PATCH net v2] Revert "ipv6: preserve insertion order for same-scope addresses"
@ 2026-05-29 11:23 Fernando Fernandez Mancera
2026-05-29 11:41 ` Stefano Brivio
2026-05-29 20:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Fernando Fernandez Mancera @ 2026-05-29 11:23 UTC (permalink / raw)
To: netdev
Cc: yuhuang, justin.iurman, horms, pabeni, kuba, edumazet, davem,
idosch, dsahern, sbrivio, Fernando Fernandez Mancera, Chris Adams
Chris Adams reported that preserving insertion order for same-scope
addresses is causing SSH connections to be dropped after stopping a VM
while running NetworkManager.
NetworkManager caches the IPv6 address configuration, when a RA arrives,
it 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,
NetworkManager removes and re-adds them to achieve the desired order.
As the order changes, NetworkManager is confused and reconfigures the
addresses on every update. In addition, this would also affect to cloud
tooling that relies on IPv6 addresses order to identify primary and
secondaries addresses.
This reverts commit cb3de96eea66f5e4a580086c6a1be46e765f97f4.
Fixes: cb3de96eea66 ("ipv6: preserve insertion order for same-scope addresses")
Reported-by: Chris Adams <linux@cmadams.net>
Closes: https://lore.kernel.org/netdev/20260521135310.GC977@cmadams.net/
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
---
v2: updated commit description to make it more accurate
---
net/ipv6/addrconf.c | 2 +-
tools/testing/selftests/net/ioam6.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5476b6536eb7..bb84a78b80f6 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1013,7 +1013,7 @@ ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp)
list_for_each(p, &idev->addr_list) {
struct inet6_ifaddr *ifa
= list_entry(p, struct inet6_ifaddr, if_list);
- if (ifp_scope > ipv6_addr_src_scope(&ifa->addr))
+ if (ifp_scope >= ipv6_addr_src_scope(&ifa->addr))
break;
}
diff --git a/tools/testing/selftests/net/ioam6.sh b/tools/testing/selftests/net/ioam6.sh
index b2b99889942f..845c26dd01a9 100755
--- a/tools/testing/selftests/net/ioam6.sh
+++ b/tools/testing/selftests/net/ioam6.sh
@@ -273,8 +273,8 @@ setup()
ip -netns $ioam_node_beta link set ioam-veth-betaR name veth1 &>/dev/null
ip -netns $ioam_node_gamma link set ioam-veth-gamma name veth0 &>/dev/null
- ip -netns $ioam_node_alpha addr add 2001:db8:1::2/64 dev veth0 &>/dev/null
ip -netns $ioam_node_alpha addr add 2001:db8:1::50/64 dev veth0 &>/dev/null
+ ip -netns $ioam_node_alpha addr add 2001:db8:1::2/64 dev veth0 &>/dev/null
ip -netns $ioam_node_alpha link set veth0 up &>/dev/null
ip -netns $ioam_node_alpha link set lo up &>/dev/null
ip -netns $ioam_node_alpha route add 2001:db8:2::/64 \
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] Revert "ipv6: preserve insertion order for same-scope addresses"
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-05-29 20:20 ` patchwork-bot+netdevbpf
1 sibling, 2 replies; 5+ messages in thread
From: Stefano Brivio @ 2026-05-29 11:41 UTC (permalink / raw)
To: Fernando Fernandez Mancera
Cc: netdev, yuhuang, justin.iurman, horms, pabeni, kuba, edumazet,
davem, idosch, dsahern, Chris Adams, David Gibson,
Beniamino Galvani, Thorsten Leemhuis, Andrew Lunn, ihuguet,
regressions
On Fri, 29 May 2026 13:23:57 +0200
Fernando Fernandez Mancera <fmancera@suse.de> wrote:
> Chris Adams reported that preserving insertion order for same-scope
> addresses is causing SSH connections to be dropped after stopping a VM
> while running NetworkManager.
>
> NetworkManager caches the IPv6 address configuration, when a RA arrives,
> it 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,
> NetworkManager removes and re-adds them to achieve the desired order.
>
> As the order changes, NetworkManager is confused and reconfigures the
> addresses on every update. In addition, this would also affect to cloud
> tooling that relies on IPv6 addresses order to identify primary and
> secondaries addresses.
By the way, I'm still looking into this part, trying to find
"problematic" examples.
And I couldn't find any, yet, because it looks like there's always a
_single_ IPv6 address being used as a secondary for a primary IPv4
address.
>
> This reverts commit cb3de96eea66f5e4a580086c6a1be46e765f97f4.
>
> Fixes: cb3de96eea66 ("ipv6: preserve insertion order for same-scope addresses")
> Reported-by: Chris Adams <linux@cmadams.net>
> Closes: https://lore.kernel.org/netdev/20260521135310.GC977@cmadams.net/
> Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
> ---
> v2: updated commit description to make it more accurate
> ---
> net/ipv6/addrconf.c | 2 +-
> tools/testing/selftests/net/ioam6.sh | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 5476b6536eb7..bb84a78b80f6 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -1013,7 +1013,7 @@ ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp)
> list_for_each(p, &idev->addr_list) {
> struct inet6_ifaddr *ifa
> = list_entry(p, struct inet6_ifaddr, if_list);
> - if (ifp_scope > ipv6_addr_src_scope(&ifa->addr))
> + if (ifp_scope >= ipv6_addr_src_scope(&ifa->addr))
> break;
> }
>
> diff --git a/tools/testing/selftests/net/ioam6.sh b/tools/testing/selftests/net/ioam6.sh
> index b2b99889942f..845c26dd01a9 100755
> --- a/tools/testing/selftests/net/ioam6.sh
> +++ b/tools/testing/selftests/net/ioam6.sh
> @@ -273,8 +273,8 @@ setup()
> ip -netns $ioam_node_beta link set ioam-veth-betaR name veth1 &>/dev/null
> ip -netns $ioam_node_gamma link set ioam-veth-gamma name veth0 &>/dev/null
>
> - ip -netns $ioam_node_alpha addr add 2001:db8:1::2/64 dev veth0 &>/dev/null
> ip -netns $ioam_node_alpha addr add 2001:db8:1::50/64 dev veth0 &>/dev/null
> + ip -netns $ioam_node_alpha addr add 2001:db8:1::2/64 dev veth0 &>/dev/null
> ip -netns $ioam_node_alpha link set veth0 up &>/dev/null
> ip -netns $ioam_node_alpha link set lo up &>/dev/null
> ip -netns $ioam_node_alpha route add 2001:db8:2::/64 \
--
Stefano
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] Revert "ipv6: preserve insertion order for same-scope addresses"
2026-05-29 11:41 ` Stefano Brivio
@ 2026-05-29 11:45 ` Fernando Fernandez Mancera
2026-05-29 12:06 ` Chris Adams
1 sibling, 0 replies; 5+ messages in thread
From: Fernando Fernandez Mancera @ 2026-05-29 11:45 UTC (permalink / raw)
To: Stefano Brivio
Cc: netdev, yuhuang, justin.iurman, horms, pabeni, kuba, edumazet,
davem, idosch, dsahern, Chris Adams, David Gibson,
Beniamino Galvani, Thorsten Leemhuis, Andrew Lunn, ihuguet,
regressions
On 5/29/26 1:41 PM, Stefano Brivio wrote:
> On Fri, 29 May 2026 13:23:57 +0200
> Fernando Fernandez Mancera <fmancera@suse.de> wrote:
>
>> Chris Adams reported that preserving insertion order for same-scope
>> addresses is causing SSH connections to be dropped after stopping a VM
>> while running NetworkManager.
>>
>> NetworkManager caches the IPv6 address configuration, when a RA arrives,
>> it 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,
>> NetworkManager removes and re-adds them to achieve the desired order.
>>
>> As the order changes, NetworkManager is confused and reconfigures the
>> addresses on every update. In addition, this would also affect to cloud
>> tooling that relies on IPv6 addresses order to identify primary and
>> secondaries addresses.
>
> By the way, I'm still looking into this part, trying to find
> "problematic" examples.
>
> And I couldn't find any, yet, because it looks like there's always a
> _single_ IPv6 address being used as a secondary for a primary IPv4
> address.
>
IIRC, Azure cloud should be one of them. I do not have an account there
to test it.. but some years ago I did some work supporting configuring
IPV6 primary and secondary addresses via IMDSv2.
If someone with an account could test it I would appreciate it.
>>
>> This reverts commit cb3de96eea66f5e4a580086c6a1be46e765f97f4.
>>
>> Fixes: cb3de96eea66 ("ipv6: preserve insertion order for same-scope addresses")
>> Reported-by: Chris Adams <linux@cmadams.net>
>> Closes: https://lore.kernel.org/netdev/20260521135310.GC977@cmadams.net/
>> Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
>> ---
>> v2: updated commit description to make it more accurate
>> ---
>> net/ipv6/addrconf.c | 2 +-
>> tools/testing/selftests/net/ioam6.sh | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
>> index 5476b6536eb7..bb84a78b80f6 100644
>> --- a/net/ipv6/addrconf.c
>> +++ b/net/ipv6/addrconf.c
>> @@ -1013,7 +1013,7 @@ ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp)
>> list_for_each(p, &idev->addr_list) {
>> struct inet6_ifaddr *ifa
>> = list_entry(p, struct inet6_ifaddr, if_list);
>> - if (ifp_scope > ipv6_addr_src_scope(&ifa->addr))
>> + if (ifp_scope >= ipv6_addr_src_scope(&ifa->addr))
>> break;
>> }
>>
>> diff --git a/tools/testing/selftests/net/ioam6.sh b/tools/testing/selftests/net/ioam6.sh
>> index b2b99889942f..845c26dd01a9 100755
>> --- a/tools/testing/selftests/net/ioam6.sh
>> +++ b/tools/testing/selftests/net/ioam6.sh
>> @@ -273,8 +273,8 @@ setup()
>> ip -netns $ioam_node_beta link set ioam-veth-betaR name veth1 &>/dev/null
>> ip -netns $ioam_node_gamma link set ioam-veth-gamma name veth0 &>/dev/null
>>
>> - ip -netns $ioam_node_alpha addr add 2001:db8:1::2/64 dev veth0 &>/dev/null
>> ip -netns $ioam_node_alpha addr add 2001:db8:1::50/64 dev veth0 &>/dev/null
>> + ip -netns $ioam_node_alpha addr add 2001:db8:1::2/64 dev veth0 &>/dev/null
>> ip -netns $ioam_node_alpha link set veth0 up &>/dev/null
>> ip -netns $ioam_node_alpha link set lo up &>/dev/null
>> ip -netns $ioam_node_alpha route add 2001:db8:2::/64 \
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] Revert "ipv6: preserve insertion order for same-scope addresses"
2026-05-29 11:41 ` Stefano Brivio
2026-05-29 11:45 ` Fernando Fernandez Mancera
@ 2026-05-29 12:06 ` Chris Adams
1 sibling, 0 replies; 5+ messages in thread
From: Chris Adams @ 2026-05-29 12:06 UTC (permalink / raw)
To: Stefano Brivio
Cc: Fernando Fernandez Mancera, netdev, yuhuang, justin.iurman, horms,
pabeni, kuba, edumazet, davem, idosch, dsahern, David Gibson,
Beniamino Galvani, Thorsten Leemhuis, Andrew Lunn, ihuguet,
regressions
Once upon a time, Stefano Brivio <sbrivio@redhat.com> said:
> On Fri, 29 May 2026 13:23:57 +0200
> Fernando Fernandez Mancera <fmancera@suse.de> wrote:
>
> > Chris Adams reported that preserving insertion order for same-scope
> > addresses is causing SSH connections to be dropped after stopping a VM
> > while running NetworkManager.
> >
> > NetworkManager caches the IPv6 address configuration, when a RA arrives,
> > it 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,
> > NetworkManager removes and re-adds them to achieve the desired order.
> >
> > As the order changes, NetworkManager is confused and reconfigures the
> > addresses on every update. In addition, this would also affect to cloud
> > tooling that relies on IPv6 addresses order to identify primary and
> > secondaries addresses.
>
> By the way, I'm still looking into this part, trying to find
> "problematic" examples.
>
> And I couldn't find any, yet, because it looks like there's always a
> _single_ IPv6 address being used as a secondary for a primary IPv4
> address.
I hit two cases that triggered the behavior:
- after an overnight suspend/resume cycle (not sure if there's a minimum
time suspended)
- with a bridge NIC, after stopping a VM with a NIC on the bridge (which
removed an fe80:: link-local address); this is the case I used to
bisect since it was easy to script
In both cases, the next IPv6 router-advertisement received was what
triggered NetworkManager to replace the current privacy addresses. This
could be 2-3 minutes after the trigger.
> > This reverts commit cb3de96eea66f5e4a580086c6a1be46e765f97f4.
> >
> > Fixes: cb3de96eea66 ("ipv6: preserve insertion order for same-scope addresses")
> > Reported-by: Chris Adams <linux@cmadams.net>
> > Closes: https://lore.kernel.org/netdev/20260521135310.GC977@cmadams.net/
> > Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
> > ---
> > v2: updated commit description to make it more accurate
> > ---
> > net/ipv6/addrconf.c | 2 +-
> > tools/testing/selftests/net/ioam6.sh | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> > index 5476b6536eb7..bb84a78b80f6 100644
> > --- a/net/ipv6/addrconf.c
> > +++ b/net/ipv6/addrconf.c
> > @@ -1013,7 +1013,7 @@ ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp)
> > list_for_each(p, &idev->addr_list) {
> > struct inet6_ifaddr *ifa
> > = list_entry(p, struct inet6_ifaddr, if_list);
> > - if (ifp_scope > ipv6_addr_src_scope(&ifa->addr))
> > + if (ifp_scope >= ipv6_addr_src_scope(&ifa->addr))
> > break;
> > }
> >
> > diff --git a/tools/testing/selftests/net/ioam6.sh b/tools/testing/selftests/net/ioam6.sh
> > index b2b99889942f..845c26dd01a9 100755
> > --- a/tools/testing/selftests/net/ioam6.sh
> > +++ b/tools/testing/selftests/net/ioam6.sh
> > @@ -273,8 +273,8 @@ setup()
> > ip -netns $ioam_node_beta link set ioam-veth-betaR name veth1 &>/dev/null
> > ip -netns $ioam_node_gamma link set ioam-veth-gamma name veth0 &>/dev/null
> >
> > - ip -netns $ioam_node_alpha addr add 2001:db8:1::2/64 dev veth0 &>/dev/null
> > ip -netns $ioam_node_alpha addr add 2001:db8:1::50/64 dev veth0 &>/dev/null
> > + ip -netns $ioam_node_alpha addr add 2001:db8:1::2/64 dev veth0 &>/dev/null
> > ip -netns $ioam_node_alpha link set veth0 up &>/dev/null
> > ip -netns $ioam_node_alpha link set lo up &>/dev/null
> > ip -netns $ioam_node_alpha route add 2001:db8:2::/64 \
>
> --
> Stefano
--
Chris Adams <linux@cmadams.net>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] Revert "ipv6: preserve insertion order for same-scope addresses"
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 20:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-29 20:20 UTC (permalink / raw)
To: Fernando Fernandez Mancera
Cc: netdev, yuhuang, justin.iurman, horms, pabeni, kuba, edumazet,
davem, idosch, dsahern, sbrivio, linux
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 29 May 2026 13:23:57 +0200 you wrote:
> Chris Adams reported that preserving insertion order for same-scope
> addresses is causing SSH connections to be dropped after stopping a VM
> while running NetworkManager.
>
> NetworkManager caches the IPv6 address configuration, when a RA arrives,
> it 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,
> NetworkManager removes and re-adds them to achieve the desired order.
>
> [...]
Here is the summary with links:
- [net,v2] Revert "ipv6: preserve insertion order for same-scope addresses"
https://git.kernel.org/netdev/net/c/072aa0f5c3d8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-29 20:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-05-29 20:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox