JDK-8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address
Joel Peláez Jorge
joelpelaez at gmail.com
Mon Apr 9 22:36:49 UTC 2018
Hi,
I am new in the OpenJDK Community and I contribute with a fix for the bug 8200719 related to networking in macOS system.
I wrote a minimal patch that only set the scope id when the address is link-local or multicast. This change avoid send IPv6 packets on a wrong interface.
Bug: https://bugs.openjdk.java.net/browse/JDK-8200719
Patch:
diff -r f088ec60bed5 src/java.base/unix/native/libnet/net_util_md.c
--- a/src/java.base/unix/native/libnet/net_util_md.c Mon Apr 09 10:39:29 2018 -0700
+++ b/src/java.base/unix/native/libnet/net_util_md.c Mon Apr 09 16:50:18 2018 -0500
@@ -89,7 +89,8 @@
}
int defaultIndex;
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)him;
- if (sin6->sin6_family == AF_INET6 && (sin6->sin6_scope_id == 0)) {
+ if (sin6->sin6_family == AF_INET6 && (sin6->sin6_scope_id == 0) &&
+ (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) || IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))) {
defaultIndex = (*env)->GetStaticIntField(env, ni_class,
ni_defaultIndexID);
sin6->sin6_scope_id = defaultIndex;
Thanks,
Joel
More information about the net-dev
mailing list