[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251126083714.115172-1-yuhuang@redhat.com>
Date: Wed, 26 Nov 2025 16:37:14 +0800
From: Yumei Huang <yuhuang@...hat.com>
To: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: sbrivio@...hat.com,
david@...son.dropbear.id.au,
yuhuang@...hat.com,
davem@...emloft.net,
dsahern@...nel.org,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
horms@...nel.org
Subject: [PATCH] ipv6: preserve insertion order for same-scope addresses
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@...hat.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
Powered by blists - more mailing lists