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

Deven You youdwei at linux.vnet.ibm.com
Tue Apr 24 22:40:28 PDT 2012


Hi Michael,

I have done some search with google, there is an introduction says when 
sending a socket bound with INADDR_ANY, it will be sent to the default 
IP address (default address is the one has the lowest-numbered interface).

I guess most Unix like OS should support the ping command, I also 
already tested the ping on Linux and AIX, they are working fine. I can 
test zos when I get a machine.

Thanks a lot!

On 04/23/2012 05:56 PM, Michael McMahon wrote:
> Deven,
>
> The change looks benign enough, but my only concern is that not all
> operating systems appear to support pinging 0.0.0.0. What is the official
> position on 0.0.0.0 as a destination address?
>
> - Michael.
>
> On 23/04/12 06:57, Deven You wrote:
>> On 04/09/2012 03:57 PM, Deven You wrote:
>>> Hi net-devs,
>>>
>>> There is a test case [1] can reproduce this problem. Please use root 
>>> privilege to run this test case(create raw socket need root privilege).
>>>
>>> Test results:
>>>
>>> sudo ~/jdks/oracle/jdk1.7.0_03/bin/java Javanet
>>> The target ip is 0.0.0.0
>>> the target is reachable: false
>>> Test failed
>>> Exception in thread "main" java.lang.Exception: address 0.0.0.0 can 
>>> not be reachable!
>>>     at Javanet.main(Javanet.java:40)
>>>
>>> The root cause is that ping4 method in Inet4AddressImpl.c does a 
>>> check of sending and receiving address.
>>> (him->sin_addr.s_addr == sa_recv.sin_addr.s_addr)
>>>
>>> This is not true for InetAddress 0.0.0.0. We can using ping command 
>>> on Linux to confirm it:
>>>
>>> ping 0.0.0.0
>>> ING 0.0.0.0 (127.0.0.1) 56(84) bytes of data.
>>> 64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.024 ms
>>> 64 bytes from 127.0.0.1: icmp_req=2 ttl=64 time=0.025 ms
>>>
>>> So for 0.0.0.0, we can remove the (him->sin_addr.s_addr == 
>>> sa_recv.sin_addr.s_addr).
>>>
>>> I have made a patch[1] to solve this issue.
>>>
>>> Thanks a lot!
>>>
>>> [1] http://cr.openjdk.java.net/~youdwei/inet4adr/webrev.00/ 
>>> <http://cr.openjdk.java.net/%7Eyoudwei/inet4adr/webrev.00/>
>>> -- 
>>> Best Regards,
>>>
>>> Deven
>> Hi All,
>>
>> Is there anyone could review this patch, thanks a lot!
>>
>> -- 
>> Best Regards,
>>
>> Deven
>


-- 
Best Regards,

Deven

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


More information about the net-dev mailing list