-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
base: 3.3
Are you sure you want to change the base?
Conversation
Signed-off-by: cyclinder <[email protected]>
LGTM |
@@ -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()) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
What is the purpose of the change?
NetUtils: should be ignore link-local address
Fixes #14792
Checklist