From: Yumei Huang <yuhuang@redhat.com>
To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: sbrivio@redhat.com, david@gibson.dropbear.id.au,
yuhuang@redhat.com, davem@davemloft.net, dsahern@kernel.org,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org
Subject: [PATCH] ipv6: preserve insertion order for same-scope addresses
Date: Wed, 26 Nov 2025 16:37:14 +0800 [thread overview]
Message-ID: <20251126083714.115172-1-yuhuang@redhat.com> (raw)
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
next reply other threads:[~2025-11-26 8:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 8:37 Yumei Huang [this message]
2025-11-26 14:58 ` Jakub Kicinski
2025-11-28 6:38 ` Yumei Huang
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=20251126083714.115172-1-yuhuang@redhat.com \
--to=yuhuang@redhat.com \
--cc=davem@davemloft.net \
--cc=david@gibson.dropbear.id.au \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sbrivio@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
all inboxes | Powered by JetHome®