RFR: 8275640 (win) java.net.NetworkInterface issues with IPv6-only environments [v3]

Mark Sheppard msheppar at openjdk.java.net
Mon Jan 10 20:02:30 UTC 2022


On Mon, 10 Jan 2022 07:37:24 GMT, Daniel Jelinski <duke at openjdk.java.net> wrote:

>> src/java.base/windows/native/libnet/NetworkInterface_winXP.c line 256:
>> 
>>> 254: 
>>> 255:     ret = enumInterfaces(env, netifPP);
>>> 256:     if (ret == -1) {
>> 
>> this change is questionable: enumInterfaces returns -2  to allows processing to continue with IPv6 data ... this change will prohibit that policy
>
> In my experiments the `enumInterfaces` succeeded in IPv6-only environment. The function only fails with -2 when a new interface is added during enumeration.
> I could modify the function to stop returning -2 if you think it makes sense.

yes, that's what I have onserved also It looks like the error handling in enumInterfaces is cut and paste from lookupIPAddrTable, as per the comment

        // this different error code is to handle the case when we call
        // GetIpAddrTable in pure IPv6 environment
        return -2;
when in fact it is calling GetIfTable

and if that returns an error, it seems reasonable to terminate processing at that stage by throwing an appropriate exception ... I can't see how it can continue

So it would seems that enumInterfaces curennt return value -2 is misleading

-------------

PR: https://git.openjdk.java.net/jdk/pull/6090


More information about the net-dev mailing list