Re: RFR: 8211842 IPv6_supported wrongly returns false when unix domain socket is bound to fd 0

2018-11-29 Thread Chris Hegarty

> On 28 Nov 2018, at 15:50, Michael McMahon  
> wrote:
> 
> Could I get the following fix reviewed please?
> The fix is pretty simple, but the test a bit more involved
> since the issue occurs when the JVM is launched in unusual circumstances
> where its stdin,out,err are connected to a UNIX domain socket.
> This occurs when java is launched by a node.js or Python script.
> 
> http://cr.openjdk.java.net/~michaelm/8211842/webrev.1/ 
> 

Looks good to me Michael.

Trivially, maybe amend the copyright year on the new test file,
since it was created in 2018.

-Chris.



Re: RFR: 8211842 IPv6_supported wrongly returns false when unix domain socket is bound to fd 0

2018-11-29 Thread Alan Bateman

On 28/11/2018 15:50, Michael McMahon wrote:

Could I get the following fix reviewed please?
The fix is pretty simple, but the test a bit more involved
since the issue occurs when the JVM is launched in unusual circumstances
where its stdin,out,err are connected to a UNIX domain socket.
This occurs when java is launched by a node.js or Python script.

http://cr.openjdk.java.net/~michaelm/8211842/webrev.1/
Definitely an unusual way to launch the VM. The update to net_util_md.c 
looks okay.


For the test then can UnixSocketFile be moved into its own source file 
to make it clearer? Also I think we should move the static fields and 
CHECK macro to the top of libInheritedChannel.c so that the JNI methods 
are all together.


-Alan




Re: RFR: 8211842 IPv6_supported wrongly returns false when unix domain socket is bound to fd 0

2018-11-29 Thread Michael McMahon

On 29/11/2018, 17:19, Alan Bateman wrote:

On 28/11/2018 15:50, Michael McMahon wrote:

Could I get the following fix reviewed please?
The fix is pretty simple, but the test a bit more involved
since the issue occurs when the JVM is launched in unusual circumstances
where its stdin,out,err are connected to a UNIX domain socket.
This occurs when java is launched by a node.js or Python script.

http://cr.openjdk.java.net/~michaelm/8211842/webrev.1/
Definitely an unusual way to launch the VM. The update to 
net_util_md.c looks okay.


For the test then can UnixSocketFile be moved into its own source file 
to make it clearer? Also I think we should move the static fields and 
CHECK macro to the top of libInheritedChannel.c so that the JNI 
methods are all together.



Thanks Alan.

I assume you mean the UnixSocket class which is in Launcher.java 
currently. Okay, I will refactor

to do that, and fix the copyright header too.

- Michael.


-Alan




Re: 8211842 IPv6_supported wrongly returns false when unix domainsocket is bound to fd 0

2018-11-29 Thread Bernd Eckenfels
Hello,

I wonder if that conclusion „stdin = tcp4 -> disable tcp6“ is correct at all. 
The started program might serve a v4 connection but it still could want to do 
ipv6 client connections.

If somebody wants to disable v4 they can do it regularly with the System 
property.

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

Von: Michael McMahon
Gesendet: Mittwoch, 28. November 2018 17:22
An: OpenJDK Network Dev list
Betreff: RFR: 8211842 IPv6_supported wrongly returns false when unix 
domainsocket is bound to fd 0

Could I get the following fix reviewed please?
The fix is pretty simple, but the test a bit more involved
since the issue occurs when the JVM is launched in unusual circumstances
where its stdin,out,err are connected to a UNIX domain socket.
This occurs when java is launched by a node.js or Python script.

http://cr.openjdk.java.net/~michaelm/8211842/webrev.1/

Thanks,

Michael



Re: 8211842 IPv6_supported wrongly returns false when unix domainsocket is bound to fd 0

2018-11-29 Thread Alan Bateman

On 29/11/2018 18:04, Bernd Eckenfels wrote:


Hello,

I wonder if that conclusion „stdin = tcp4 -> disable tcp6“ is correct 
at all. The started program might serve a v4 connection but it still 
could want to do ipv6 client connections.


If somebody wants to disable v4 they can do it regularly with the 
System property.



The check is important because the JDK doesn't support having some 
Socket or SocketChannel objects be created with IPv4 sockets, and others 
with IPv6 sockets. The only exception to this is DatagramChannel where 
the protocol family is exposed in the API. The RDMA socket API under 
discussion on nio-dev will be another case.


-Alan


Re: 8211842 IPv6_supported wrongly returns false when unix domainsocket is bound to fd 0

2018-11-29 Thread Michael McMahon
Yes, as Alan said the way IPv6 is set up in the JDK means that either 
you have:


AF_INET sockets (which are IPv4 only) or
AF_INET6 sockets (which can be IPv4 or IPv6)

It's not possible to mix the two types. If inetd passes an AF_INET
socket on startup then the VM is stuck in IPv4 mode.

I've updated the webrev after the last comments:

http://cr.openjdk.java.net/~michaelm/8211842/webrev.2/

It's really just refactoring. So, unless anyone has a comment I will push
the fix shortly.

Thanks,
Michael

On 29/11/2018, 19:03, Alan Bateman wrote:

On 29/11/2018 18:04, Bernd Eckenfels wrote:


Hello,

I wonder if that conclusion „stdin = tcp4 -> disable tcp6“ is correct 
at all. The started program might serve a v4 connection but it still 
could want to do ipv6 client connections.


If somebody wants to disable v4 they can do it regularly with the 
System property.



The check is important because the JDK doesn't support having some 
Socket or SocketChannel objects be created with IPv4 sockets, and 
others with IPv6 sockets. The only exception to this is 
DatagramChannel where the protocol family is exposed in the API.  The 
RDMA socket API under discussion on nio-dev will be another case.


-Alan