<net-dev> Java_java_net_Inet6AddressImpl_isReachable0 is returning false for InetAdress 0.0.0.0

Deven You youdwei at linux.vnet.ibm.com
Thu Apr 26 18:35:53 PDT 2012


Hi Alan,

I have modified the test case[1] according to your comments.

For the ::0 (or ::) I have found InetAddress.isReachable will go to ipv6 
branch rather than ipv4 branch which is the path for 0.0.0.0.

Path for ::0
     InetAddress.isReachable -> (Inet6AddressImpl.c) 
Java_java_net_Inet6AddressImpl_isReachable0

Path for 0.0.0.0
     InetAddress.isReachable -> (Inet6AddressImpl.c) 
Java_java_net_Inet6AddressImpl_isReachable0 -> (Inet4AddressImpl.c) 
Java_java_net_Inet4AddressImpl_isReachable0

And the ::0  passes the test case[1] so there is no problem with current 
implementation for ::0.

[2] http://cr.openjdk.java.net/~littlee/OJDK-217/webrev.02/


Thanks a lot!

On 04/25/2012 05:15 PM, Alan Bateman wrote:
> On 25/04/2012 07:18, Deven You wrote:
>> Hi Michael,
>>
>> I also add the bug number into the test case[1], please review it:
>>
>> [1] http://cr.openjdk.java.net/~youdwei/inet4adr/webrev.01/
> It's in the bug database as:
>
> 7163874: InetAddress.isReachable should support pinging 0.0.0.0
>
> My take on this is that this is not really a bug as it's going to 
> platform specific as to whether the native ping tool will special-case 
> this address. However I don't object to handling special-casing this 
> address. Have you thought about ::0 too and have you thought about 
> clarifying the javadoc so that developers have some expectation as to 
> how this method should behave when invoked on this address?
>
> A couple of comments on the test:
>
> - how about changing it to PingThis.java? (Javanet.java is a bit too 
> generic).
>
> - I think Chris mentioned this already but the indent is a bit odd too.
>
> - I would suggest changing " 
> Java_java_net_Inet6AddressImpl_isReachable0" in the @summary to 
> "InetAddress.isReachable".
>
> - I'd suggest renaming "b" to "isReachable" and then you can do "if 
> (isReachable) ..." which is more readable than "if (b == true) ..."
>
> -Alan


-- 
Best Regards,

Deven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/net-dev/attachments/20120427/ad778c06/attachment.html 


More information about the net-dev mailing list