* [PATCH] ipv6: preserve insertion order for same-scope addresses
@ 2025-11-26 8:37 Yumei Huang
2025-11-26 14:58 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Yumei Huang @ 2025-11-26 8:37 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: sbrivio, david, yuhuang, davem, dsahern, edumazet, kuba, pabeni,
horms
IPv6 addresses with the same scope were returned in reverse insertion
order, unlike IPv4. For example, when adding a -> b -> c, the list was
reported as c -> b -> a, while IPv4 preserved the original order.
This patch aligns IPv6 address ordering with IPv4 for consistency.
Signed-off-by: Yumei Huang <yuhuang@redhat.com>
---
net/ipv6/addrconf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 40e9c336f6c5..ca998bf46863 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;
}
--
2.51.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv6: preserve insertion order for same-scope addresses
2025-11-26 8:37 [PATCH] ipv6: preserve insertion order for same-scope addresses Yumei Huang
@ 2025-11-26 14:58 ` Jakub Kicinski
2025-11-28 6:38 ` Yumei Huang
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2025-11-26 14:58 UTC (permalink / raw)
To: Yumei Huang
Cc: netdev, linux-kernel, sbrivio, david, davem, dsahern, edumazet,
pabeni, horms
On Wed, 26 Nov 2025 16:37:14 +0800 Yumei Huang wrote:
> IPv6 addresses with the same scope were returned in reverse insertion
> order, unlike IPv4. For example, when adding a -> b -> c, the list was
> reported as c -> b -> a, while IPv4 preserved the original order.
>
> This patch aligns IPv6 address ordering with IPv4 for consistency.
This breaks the ioam6.sh test:
https://netdev-3.bots.linux.dev/vmksft-net-dbg/results/402461/16-ioam6-sh/stdout
https://netdev-3.bots.linux.dev/vmksft-net/results/402461/14-ioam6-sh/stdout
--
pw-bot: cr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv6: preserve insertion order for same-scope addresses
2025-11-26 14:58 ` Jakub Kicinski
@ 2025-11-28 6:38 ` Yumei Huang
0 siblings, 0 replies; 3+ messages in thread
From: Yumei Huang @ 2025-11-28 6:38 UTC (permalink / raw)
To: Jakub Kicinski
Cc: netdev, linux-kernel, sbrivio, david, davem, dsahern, edumazet,
pabeni, horms
On Wed, Nov 26, 2025 at 10:58 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Wed, 26 Nov 2025 16:37:14 +0800 Yumei Huang wrote:
> > IPv6 addresses with the same scope were returned in reverse insertion
> > order, unlike IPv4. For example, when adding a -> b -> c, the list was
> > reported as c -> b -> a, while IPv4 preserved the original order.
> >
> > This patch aligns IPv6 address ordering with IPv4 for consistency.
>
> This breaks the ioam6.sh test:
> https://netdev-3.bots.linux.dev/vmksft-net-dbg/results/402461/16-ioam6-sh/stdout
> https://netdev-3.bots.linux.dev/vmksft-net/results/402461/14-ioam6-sh/stdout
Thanks for catching this. The error can be fixed by just swaping the
two lines of adding addresses for veth0 in ioam_node_alpha netns. I
will fix it in v2. Thanks!
> --
> pw-bot: cr
>
--
Thanks,
Yumei Huang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-28 6:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-26 8:37 [PATCH] ipv6: preserve insertion order for same-scope addresses Yumei Huang
2025-11-26 14:58 ` Jakub Kicinski
2025-11-28 6:38 ` Yumei Huang
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).