You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #4355 has been merged into 2025.1.x and fixes the overly permissive IPv6 network-interface filtering reported in #4354.
However, the latest 2025.0.x branch at the time of verification (b8403af4b2d94460e54dd53552d2e87c7f6265c0) still contains the same condition in InetIPv6Utils.findFirstValidIPv6Address():
if (ifc.isUp() || !ifc.isVirtual() || !ifc.isLoopback()) {
Because these predicates are joined with logical OR, an interface is processed whenever any one of them is true:
isUp()
isVirtual()
isLoopback()
Current result
false
false
false
true
true
true
false
true
true
false
true
true
Consequently, a down, virtual, or loopback network interface may still supply the IPv6 address selected by InetIPv6Utils when it contains an otherwise usable global IPv6 address.
This issue tracks the backport of #4355 to 2025.0.x.
Simplest demo
The focused regression test added in #4355 provides a deterministic reproduction:
Which Component
Nacos Discovery (
spring-cloud-starter-alibaba-nacos-discovery),InetIPv6UtilsDescribe the bug
PR #4355 has been merged into
2025.1.xand fixes the overly permissive IPv6 network-interface filtering reported in #4354.However, the latest
2025.0.xbranch at the time of verification (b8403af4b2d94460e54dd53552d2e87c7f6265c0) still contains the same condition inInetIPv6Utils.findFirstValidIPv6Address():Because these predicates are joined with logical OR, an interface is processed whenever any one of them is true:
Consequently, a down, virtual, or loopback network interface may still supply the IPv6 address selected by
InetIPv6Utilswhen it contains an otherwise usable global IPv6 address.This issue tracks the backport of #4355 to
2025.0.x.Simplest demo
The focused regression test added in #4355 provides a deterministic reproduction:
https://github.com/alibaba/spring-cloud-alibaba/blob/18cf2a06c94b4b16fd58fd3ec13791542d26aba6/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-discovery/src/test/java/com/alibaba/cloud/nacos/util/InetIPv6UtilsTests.java
The test mocks
NetworkInterface.getNetworkInterfaces()and verifies that:No Nacos Server is required.
To Reproduce
2025.0.xatb8403af4b2d94460e54dd53552d2e87c7f6265c0.InetIPv6UtilsTestsfrom fix(nacos): correct network interface filter logic in InetIPv6Utils #4355 without changing the production code../mvnw \ -pl spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-discovery \ -am \ -Dtest=InetIPv6UtilsTests \ -Dsurefire.failIfNoSpecifiedTests=false \ testThe down, virtual, and loopback cases each return
[2001:db8:0:0:0:0:0:1]instead ofnull; the valid-interface case passes.Expected behavior
Only active, non-virtual, and non-loopback network interfaces should be considered when searching for a usable IPv6 address:
Addresses from down, virtual, or loopback interfaces should be ignored, while a valid IPv6 address from a normal interface should still be selected.
Suggested implementation
Please use the merged PR #4355 as the reference:
2025.0.x.InetIPv6UtilsTestsregression coverage.2025.0.xand link this issue.Contributions are welcome. If you would like to work on this issue, please leave a comment first to avoid duplicated effort.
Screenshots
Not applicable. The focused regression test demonstrates the problem deterministically.
Additional context
2025.0.xb8403af4b2d94460e54dd53552d2e87c7f6265c02025.0.0.1-SNAPSHOT2025.0.03.5.017.0.102025.1.x: fix(nacos): correct network interface filter logic in InetIPv6Utils #43552025.0.xbackport issue or PR for thisInetIPv6Utilsproblem was found before creating this issue.