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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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.

return false;
}

Expand Down
Loading