[ipv6] RFR: 8223532: Don't try creating IPv4 sockets in NetworkInterface.c if IPv4 is not supported

Chris Hegarty chris.hegarty at oracle.com
Wed May 8 11:51:38 UTC 2019


Arthur, Daniel,

On 08/05/2019 11:45, Daniel Fuchs wrote:
> Hi Arthur,
> 
> The idea looks reasonable to me - I believe the changes in
> NetworkInterface.c should be OK.

I agree.

Now that I look at this again, I think it may also be reasonable to
consider EAFNOSUPPORT in a similar way to that of EPROTONOSUPPORT. To
me it is really a matter of interpretation by the Kernel developer which
gets thrown and at which point ( protocol / family /type compiled out
of the Kernel or disabled by the System Administrator ). Anyway, what
Arthur is proposing for NetworkInterface is fine.

> However - I don't think the changes in net_util.c::DEF_JNI_OnLoad
> are acceptable.

Agree.

> I'll question whether this is the right place to bail
> out. I agree it would be nice to have some diagnostic
> that tells us that the native library is non-functioning
> because both IPv4 & IPv6 where not available, but I'd rather
> have this check at the place where the code actually tries
> to e.g. open an IP/TCP socket, and where throwing a regular exception
> with a better detailed message is possible, rather than
> having the VM fail to start with some cryptic UnsatisfiedLinkError.

The cryptic error message ( generated by returning a JNI version that is
not supported by the VM ) indicates that this is not the right place.

> ...
> On 08/05/2019 06:52, Arthur Eubanks wrote:
>> ...
>> Since previously the code assumed that we have at least IPv4, now when 
>> initializing ipv4/6_available(), make sure that at least one of them 
>> is available, or else bail. One problem I have with this is that the 
>> error message when neither is present is not descriptive:
>> Error occurred during initialization of boot layer
>> java.lang.UnsatisfiedLinkError: unsupported JNI version 0xFFFFFFFF 
>> required by path/to/jdk/build/jdk/lib/libnet.so

While the vast majority of libnet.so is devoted to socket related
implementation, not all is. There are a small number of low-level pieces
of functionality that can be used with support for either IPv4 or IPv6
being present. The NIO implementation also uses some shared common
functionality from libnet.so. It seems overly restricting to disallow
libnet.so from loading if neither IPv4 or IPv6 are present.

I'm just not sure that this is needed at all.

-Chris.



More information about the net-dev mailing list