Need reviewer for 6898234: (dc) Multicast tests fail on OpenSolaris with vboxnet0 adapter

Alan Bateman Alan.Bateman at Sun.COM
Wed Nov 4 14:08:44 PST 2009


Those on build-dev will know about Kelly's efforts to run the regression 
tests in jtreg samevm mode. Two of the tests on his ProblemList.html are:
  test/java/nio/channels/DatagramChannel/BasicMulticastTests.java
  test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java

These failures turn out not to be "samevm" related but rather the tests 
are tripping over pseudo adpaters that VirtualBox creates. The tests 
already ignore interfaces that aren't up or don't support multicasting. 
The proposed fix is to change the tests to ignore interfaces that appear 
to be plumbed with "any local address" (0.0.0.0 or ::0).  That seems to 
be good enough to filter these interfaces without resorting to native 
code. Both tests use the same class (NetworkConfiguration) to probe the 
interfaces and the fix is a one-line change to that test class.

Thanks,
Alan.


diff -r fe9db22a220f 
test/java/nio/channels/DatagramChannel/NetworkConfiguration.java
--- a/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java  
Fri Oct 30 21:31:02 2009 +0000
+++ b/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java  
Wed Nov 04 21:08:11 2009 +0000
@@ -73,22 +73,22 @@ class NetworkConfiguration {

             List<InetAddress> addrs = 
Collections.list(nif.getInetAddresses());
             for (InetAddress addr: addrs) {
-                if (addr instanceof Inet4Address) {
-                    List<InetAddress> list = ip4Interfaces.get(nif);
-                    if (list == null) {
-                        list = new LinkedList<InetAddress>();
+                if (!addr.isAnyLocalAddress()) {
+                    if (addr instanceof Inet4Address) {
+                        List<InetAddress> list = ip4Interfaces.get(nif);
+                        if (list == null) {
+                            list = new LinkedList<InetAddress>();
+                        }
+                        list.add(addr);
+                        ip4Interfaces.put(nif, list);
+                    } else if (addr instanceof Inet6Address) {
+                        List<InetAddress> list = ip6Interfaces.get(nif);
+                        if (list == null) {
+                            list = new LinkedList<InetAddress>();
+                        }
+                        list.add(addr);
+                        ip6Interfaces.put(nif, list);
                     }
-                    list.add(addr);
-                    ip4Interfaces.put(nif, list);
-                }
-                if (addr instanceof Inet6Address) {
-                    List<InetAddress> list = ip6Interfaces.get(nif);
-                    if (list == null) {
-                        list = new LinkedList<InetAddress>();
-                    }
-                    list.add(addr);
-                    ip6Interfaces.put(nif, list);
-
                 }
             }
         }








More information about the nio-dev mailing list