FULL PRODUCT VERSION : openjdk version "1.8.0-internal-fastdebug" OpenJDK Runtime Environment (build 1.8.0-internal-fastdebug-deven_2012_04_23_17_22-b00) OpenJDK Server VM (build 24.0-b07-fastdebug, mixed mode) ADDITIONAL OS VERSION INFORMATION : Linux deven 3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 17:34:21 UTC 2012 i686 i686 i386 GNU/Linux A DESCRIPTION OF THE PROBLEM : There is a test case Javanet.java can reproduce this problem. Please use root privilege to run this test case(create raw socket need root privilege). 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 REGRESSION. Last worked in version 7 STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Run Javanet.java with root previlege. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The target ip is 0.0.0.0 the target is reachable: true Test passed ACTUAL - 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) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public class Javanet { public static void main(String args[]) throws Exception { InetAddress inetAddress = InetAddress.getByName("0.0.0.0"); System.out.println("The target ip is " + inetAddress.getHostAddress()); boolean b = inetAddress.isReachable(3000); System.out.println("the target is reachable: " + b); if (b == true) { System.out.println("Test passed "); } else { System.out.println("Test failed "); throw new Exception("address " + inetAddress.getHostAddress() + " can not be reachable!"); } } } ---------- END SOURCE ----------
|