Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NetUtils: should be ignore link-local address #14793

Open
wants to merge 1 commit into
base: 3.3
Choose a base branch
from

Conversation

cyclinder
Copy link

@cyclinder cyclinder commented Oct 18, 2024

What is the purpose of the change?

NetUtils: should be ignore link-local address

Fixes #14792

Checklist

  • Make sure there is a GitHub_issue field for the change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Make sure gitHub actions can pass. Why the workflow is failing and how to fix it?

@heliang666s
Copy link
Contributor

LGTM

@cyclinder cyclinder changed the title Fix NetUtils: should be link-local address Fix NetUtils: should be ignore link-local address Oct 18, 2024
@@ -196,7 +196,7 @@ public static InetSocketAddress getLocalSocketAddress(String host, int port) {
}

static boolean isValidV4Address(InetAddress address) {
if (address == null || address.isLoopbackAddress()) {
if (address == null || address.isLoopbackAddress() || address.isLinkLocalAddress()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would happen if there is no any non-local interface

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there is no non-local address, address.isLinkLocalAddress() would return false, This function wouldn't return directly, Continue with the logic below, same as if it was a lookback address.

@@ -196,7 +196,7 @@ public static InetSocketAddress getLocalSocketAddress(String host, int port) {
}

static boolean isValidV4Address(InetAddress address) {
if (address == null || address.isLoopbackAddress()) {
if (address == null || address.isLoopbackAddress() || address.isLinkLocalAddress()) {
Copy link

@yunmaoQu yunmaoQu Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlbumenJ Just suggesstion:add a parameter called "allowLinkLocal(boolean)" in some related method( i find two extend point from original structure) .And user can config the value in system config file while it's default value is true to prevent the situation that though there is no any non-local interface and it also work , it's ok?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've done the work in local,if my idea is available and need my code ,i 'll push a request under this issue!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer to https://github.com/apache/dubbo/pull/14793/files#r1814182854, address.isLinkLocalAddress() shouldn't affect if there is no non-local address. I don't have a Dubbo environment locally, Can you help test the changes? thanks a lot.

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.

[Bug] NetUtils should ignore the local link address
4 participants