JDK-6373930 : javasoft.sqe.tests.api.java.net.InetAddress.isReachableTests fails on Windows Vista
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows
  • CPU: x86
  • Submitted: 2006-01-18
  • Updated: 2012-03-23
  • Resolved: 2006-02-01
Related Reports
Duplicate :  
Relates :  
Description
JCK            : JCK6.0 b15a
J2SE           : FAIL - mustang b67
Platform[s]    : FAIL - WinVista
switch/Mode    : FAIL - default

javasoft.sqe.tests.api.java.net.InetAddress.isReachableTests fails on Windows Vista. The possible reason is:

host "localhost" is reachable by InetAddress.isReachable(timeout), but unreachable via all particular network adapters. The following example:


/* Start of code */

import java.net.*;
import java.io.*;
import java.util.*;

public class net4{
    private static int HUGE_TIMEOUT = 60000;
static{
        int errors = 0;
        int passes = 0;
        InetAddress ia = null;
        try {
            ia = InetAddress.getByName("localhost");

	    if (!ia.isReachable(HUGE_TIMEOUT)) 
		System.out.println("Generally unreachable");else
		System.out.println("Generally reachable");

	    java.util.Enumeration ifs = null;	

            ifs = NetworkInterface.getNetworkInterfaces();

            int ttl = 10; // 10 hops is quite away
            


            for (; ifs.hasMoreElements(); ) {

            	NetworkInterface netif = (NetworkInterface)ifs.nextElement();

               	if (!ia.isReachable(netif, ttl, HUGE_TIMEOUT)) {
                  	System.out.print("Testing host " + ia);
                    	System.out.println("! Unreachable via interface " + netif + "(ttl="+ ttl + ").");
                    	errors++;

                } else {
			System.out.println("Reachable via interface " + netif + "(ttl="+ ttl + ").");
			passes++;
		}
	    }
            if ( errors > 0 )
            	System.out.println(errors + " errors during the test.");

            if (passes>0)System.out.println("OKAY");else System.out.println("Unreachable.");


            } catch (Exception e) {
            	e.printStackTrace();
		System.exit(0);
	    }
	System.exit(0);
}
}
 
/* End of code */

tries to analyse is the "localhost" reachable and is it reachable via all accessible network adapters. It results on Vista:

/* Start of output */

Generally reachable
Testing host localhost/127.0.0.1! Unreachable via interface name:eth0 (Teredo Tunneling Pseudo-Interface) index: 4 addresses:
/fe80:0:0:0:0:3210:aefc:61bb%4;
(ttl=10).
Testing host localhost/127.0.0.1! Unreachable via interface name:net0 (WAN Miniport (L2TP)) index: 5 addresses:
(ttl=10).
Testing host localhost/127.0.0.1! Unreachable via interface name:eth1 (WAN Miniport (IP)) index: 6 addresses:
(ttl=10).
Testing host localhost/127.0.0.1! Unreachable via interface name:ppp0 (WAN Miniport (PPPOE)) index: 7 addresses:
(ttl=10).
Testing host localhost/127.0.0.1! Unreachable via interface name:ppp1 (WAN Miniport (PPTP)) index: 8 addresses:
(ttl=10).
Testing host localhost/127.0.0.1! Unreachable via interface name:net1 (Direct Parallel) index: 9 addresses:
(ttl=10).
Testing host localhost/127.0.0.1! Unreachable via interface name:eth2 (NVIDIA nForce Networking Controller) index: 10 addresses:
/fe80:0:0:0:211:d8ff:fe69:4338%10;
/129.159.124.235;
(ttl=10).
Testing host localhost/127.0.0.1! Unreachable via interface name:ppp2 (RAS Async Adapter) index: 11 addresses:
(ttl=10).
Testing host localhost/127.0.0.1! Unreachable via interface name:net2 (Microsoft 6to4 Adapter) index: 12 addresses:
/2002:819f:7ceb:0:0:0:819f:7ceb;
/fe80:0:0:0:0:0:819f:7ceb%12;
(ttl=10).
Testing host localhost/127.0.0.1! Unreachable via interface name:net3 (isatap.) index: 13 addresses:
/fe80:0:0:0:0:5efe:0:0%13;
(ttl=10).
10 errors during the test.
Unreachable.

/* end of output */

So the host "localhost" is reachable, but no network interfaces can reach it. The test supposes _every_ network interface can reach "localhost"

.jtr is attached.

Comments
EVALUATION The new networking stack in Windows Vista creates compatibility issues like these
01-02-2006