RE: JDK-8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address

2018-04-16 Thread Langer, Christoph
Hi,

thanks, I've pushed it then: http://hg.openjdk.java.net/jdk/jdk/rev/bc1c7e41e285

Best regards
Christoph

> -Original Message-
> From: Chris Hegarty [mailto:chris.hega...@oracle.com]
> Sent: Freitag, 13. April 2018 16:07
> To: Langer, Christoph <christoph.lan...@sap.com>; Joel Peláez Jorge
> <joelpel...@gmail.com>; net-dev@openjdk.java.net
> Subject: Re: JDK-8200719: Cannot connect to IPv6 host when exists any active
> network interface without IPv6 address
> 
> On 13/04/18 14:57, Langer, Christoph wrote:
> > Hi Chris, Joel,
> >
> > testing went fine and did not show regressions. Same for the Oracle tests?
> 
> Yes. nothing untoward observed.
> 
> -Chris.
> 
> >
> > Best regards
> > Christoph
> >
> >> -Original Message-
> >> From: Chris Hegarty [mailto:chris.hega...@oracle.com]
> >> Sent: Mittwoch, 11. April 2018 18:11
> >> To: Langer, Christoph <christoph.lan...@sap.com>; Joel Peláez Jorge
> >> <joelpel...@gmail.com>; net-dev@openjdk.java.net
> >> Subject: Re: JDK-8200719: Cannot connect to IPv6 host when exists any
> active
> >> network interface without IPv6 address
> >>
> >> On 11/04/18 15:44, Langer, Christoph wrote:
> >>> 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.
> >>
> >> I will run it through the test system here in Oracle too.
> >>
> >>> @All: Could we please get another review?
> >>
> >> You have my Reviewed ( subject to successful testing ).
> >>
> >> -Chris.


Re: JDK-8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address

2018-04-13 Thread Chris Hegarty

On 13/04/18 14:57, Langer, Christoph wrote:

Hi Chris, Joel,

testing went fine and did not show regressions. Same for the Oracle tests?


Yes. nothing untoward observed.

-Chris.



Best regards
Christoph


-Original Message-
From: Chris Hegarty [mailto:chris.hega...@oracle.com]
Sent: Mittwoch, 11. April 2018 18:11
To: Langer, Christoph <christoph.lan...@sap.com>; Joel Peláez Jorge
<joelpel...@gmail.com>; net-dev@openjdk.java.net
Subject: Re: JDK-8200719: Cannot connect to IPv6 host when exists any active
network interface without IPv6 address

On 11/04/18 15:44, Langer, Christoph wrote:

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.


I will run it through the test system here in Oracle too.


@All: Could we please get another review?


You have my Reviewed ( subject to successful testing ).

-Chris.


RE: JDK-8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address

2018-04-13 Thread Langer, Christoph
Hi Chris, Joel,

testing went fine and did not show regressions. Same for the Oracle tests?

Best regards
Christoph

> -Original Message-
> From: Chris Hegarty [mailto:chris.hega...@oracle.com]
> Sent: Mittwoch, 11. April 2018 18:11
> To: Langer, Christoph <christoph.lan...@sap.com>; Joel Peláez Jorge
> <joelpel...@gmail.com>; net-dev@openjdk.java.net
> Subject: Re: JDK-8200719: Cannot connect to IPv6 host when exists any active
> network interface without IPv6 address
> 
> On 11/04/18 15:44, Langer, Christoph wrote:
> > 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.
> 
> I will run it through the test system here in Oracle too.
> 
> > @All: Could we please get another review?
> 
> You have my Reviewed ( subject to successful testing ).
> 
> -Chris.


Re: JDK-8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address

2018-04-11 Thread Joel Peláez Jorge

Hi Brend,

I don't want remove all code related to scope_id assignation because it can 
break compatibility with old software, the new code only allows unicast packets 
be routed by the OS. I couldn't find the reason to exists of that (old) code.

Linux has a filesystem than allow to applications read the state and features of all 
interfaces and select the best option, but in OS X the procedure is a plain selection of 
a "default" interface using only Java code using a simple criteria.

Sorry for reply in this way, I am not subscribed in the mailing list and I 
can't see message in my mailbox for a direct reply.

Joel.

El 11/04/2018 a las 09:44, Langer, Christoph escribió:

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



Re: JDK-8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address

2018-04-11 Thread Bernd Eckenfels
Hello,

Is this really correct? This seems to break for multi-homed hosts (old and new 
code). Does OS X not do proper interface autoselection (and if so, would the 
naive approach be any good?).

Shouldnt it at least try to look at the destination routes, the priorities and 
the lifetimes?

Gruss
Bernd

Gruss
Bernd
--
http://bernd.eckenfels.net

From: net-dev <net-dev-boun...@openjdk.java.net> on behalf of Chris Hegarty 
<chris.hega...@oracle.com>
Sent: Wednesday, April 11, 2018 6:10:37 PM
To: Langer, Christoph; Joel Pel?ez Jorge; net-dev@openjdk.java.net
Subject: Re: JDK-8200719: Cannot connect to IPv6 host when exists any active 
network interface without IPv6 address

On 11/04/18 15:44, Langer, Christoph wrote:
> 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.

I will run it through the test system here in Oracle too.

> @All: Could we please get another review?

You have my Reviewed ( subject to successful testing ).

-Chris.


Re: JDK-8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address

2018-04-11 Thread Chris Hegarty

On 11/04/18 15:44, Langer, Christoph wrote:

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.


I will run it through the test system here in Oracle too.


@All: Could we please get another review?


You have my Reviewed ( subject to successful testing ).

-Chris.


RE: JDK-8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address

2018-04-11 Thread Langer, Christoph
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:joelpel...@gmail.com]
> Sent: Mittwoch, 11. April 2018 12:54
> To: Langer, Christoph <christoph.lan...@sap.com>; net-
> d...@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-boun...@openjdk.java.net] On Behalf Of
> >> Joel Peláez Jorge
> >> Sent: Dienstag, 10. April 2018 00:37
> >> To: net-dev@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_addr) ||
> >> IN6_IS_ADDR_MULTICAST(>sin6_addr))) {
> >>defaultIndex = (*env)->GetStaticIntField(env, ni_class,
> >> ni_defaultIndexID);
> >>sin6->sin6_scope_id = defaultIndex;
> >>
> >>
> >> Thanks,
> >> Joel


Re: JDK-8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address

2018-04-11 Thread Joel Peláez Jorge

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-boun...@openjdk.java.net] On Behalf Of
Joel Peláez Jorge
Sent: Dienstag, 10. April 2018 00:37
To: net-dev@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_addr) ||
IN6_IS_ADDR_MULTICAST(>sin6_addr))) {
   defaultIndex = (*env)->GetStaticIntField(env, ni_class,
ni_defaultIndexID);
   sin6->sin6_scope_id = defaultIndex;


Thanks,
Joel


RE: JDK-8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address

2018-04-11 Thread Langer, Christoph
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-boun...@openjdk.java.net] On Behalf Of
> Joel Peláez Jorge
> Sent: Dienstag, 10. April 2018 00:37
> To: net-dev@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_addr) ||
> IN6_IS_ADDR_MULTICAST(>sin6_addr))) {
>   defaultIndex = (*env)->GetStaticIntField(env, ni_class,
>ni_defaultIndexID);
>   sin6->sin6_scope_id = defaultIndex;
> 
> 
> Thanks,
> Joel