JDK-8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address
Langer, Christoph
christoph.langer at sap.com
Wed Apr 11 14:44:59 UTC 2018
Hi Joel,
Sounds good to me then. I created a webrev and uploaded it: http://cr.openjdk.java.net/~clanger/webrevs/8200719.0/
I will run it through the tests here at SAP and check the results.
@All: Could we please get another review?
Thanks
Christoph
> -----Original Message-----
> From: Joel Peláez Jorge [mailto:joelpelaez at gmail.com]
> Sent: Mittwoch, 11. April 2018 12:54
> To: Langer, Christoph <christoph.langer at sap.com>; net-
> dev at openjdk.java.net
> Subject: Re: JDK-8200719: Cannot connect to IPv6 host when exists any active
> network interface without IPv6 address
>
> Hi Christoph,
>
> OS X has a issue that needs "always" add a sin6_scope_id a multicast packet, I
> check that exists a old issue that logged it and add that piece of code:
> https://bugs.openjdk.java.net/browse/JDK-7144274
>
> The DefaultInterface class in OS X is a plain Java class that list all interfaces
> and discards loopback and ppp interfaces, and prefers multistack interfaces
> than ones with only IPv4. I think that this class must use the network
> interface order defined in System Configuration but I don't find a way to use
> it.
>
> I already signed the OCA, then I would like to have your help.
>
> El 11/04/2018 a las 04:42, Langer, Christoph escribió:
> > Hi Joel,
> >
> > your fix sounds reasonable. In fact, I'm not even sure if the sin6_scope_id
> should be set for multicast. Maybe it should be done only for link local
> addresses.
> >
> > Additionally, I guess the selection of the default interface (for IPv6) should
> be improved because I still can imagine a scenario where the first interface
> only has IPv4 but you want to do an IPv6 link local connect where you need a
> scope.
> >
> > Do you have signed an OCA as per [1], section "0. Become a Contributor"?
> Then I can help you with sponsoring this...
> >
> > Best regards
> > Christoph
> >
> > [1] http://openjdk.java.net/contribute/
> >
> >> -----Original Message-----
> >> From: net-dev [mailto:net-dev-bounces at openjdk.java.net] On Behalf Of
> >> Joel Peláez Jorge
> >> Sent: Dienstag, 10. April 2018 00:37
> >> To: net-dev at openjdk.java.net
> >> Subject: JDK-8200719: Cannot connect to IPv6 host when exists any active
> >> network interface without IPv6 address
> >>
> >> 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