<net-dev> Java_java_net_Inet6AddressImpl_isReachable0 is returning false for InetAdress 0.0.0.0
Michael McMahon
michael.x.mcmahon at oracle.com
Mon Apr 23 02:56:42 PDT 2012
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/net-dev/attachments/20120423/c6d24d29/attachment.html
More information about the net-dev
mailing list