Skip to content

fix(nacos): backport loopback address filtering to 2025.0.x - #4363

Draft
coyaSONG wants to merge 1 commit into
alibaba:2025.0.xfrom
coyaSONG:fix/4362-backport-loopback
Draft

fix(nacos): backport loopback address filtering to 2025.0.x#4363
coyaSONG wants to merge 1 commit into
alibaba:2025.0.xfrom
coyaSONG:fix/4362-backport-loopback

Conversation

@coyaSONG

Copy link
Copy Markdown

Describe what this PR does / why we need it

Backports #4350 to 2025.0.x so a configured Nacos discovery network interface cannot select an IPv4 loopback address before a usable address.

Java previously parsed the condition as IPv4 || (IPv6 && !loopback), which left IPv4 addresses outside the loopback check. The corrected grouping applies !isLoopbackAddress() to both address families.

Does this pull request fix one issue?

Fixes #4362

Describe how you did it

Describe how to verify it

Using JDK 17.0.19:

  • red-first proof: the new focused test failed on untouched production code with expected 192.168.1.10 but actual 127.0.0.1
  • focused regression: 1 test passed after the fix
  • directly affected classes: 8 tests passed
  • complete affected module: 45 tests passed with zero failures
  • Maven checkstyle: zero violations
  • git diff --check passed

Commands:

./mvnw -pl spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-discovery -am -Dtest=NacosDiscoveryPropertiesTests#initShouldSkipLoopbackAddressFromNetworkInterface -Dsurefire.failIfNoSpecifiedTests=false test
./mvnw -pl spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-discovery -am -Dtest=NacosDiscoveryPropertiesTests,NacosAutoServiceRegistrationIpNetworkInterfaceTests -Dsurefire.failIfNoSpecifiedTests=false test
./mvnw -pl spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-discovery -am test

Special notes for reviews

This is a focused backport of the already merged 2025.1.x fix in #4350. Implementation and validation were assisted by OpenAI Codex; no human review is claimed.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@xuxiaowei-com-cn

Copy link
Copy Markdown
Collaborator

@coyaSONG

Thank you for your first contribution. Please sign the CLA agreement above.

@xuxiaowei-com-cn

Copy link
Copy Markdown
Collaborator

@coyaSONG

Thank you for your first contribution. Please sign the CLA agreement above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants