test/jdk/java/net/MulticastSocket/NoLoopbackPackets.java
changeset 57884 85fbdb87baad
parent 55649 ad8e3b295615
child 58679 9c3209ff7550
equal deleted inserted replaced
57881:c414c554b38b 57884:85fbdb87baad
    27  * @library /test/lib
    27  * @library /test/lib
    28  * @summary Re-test IPv6 (and specifically MulticastSocket) with latest Linux & USAGI code
    28  * @summary Re-test IPv6 (and specifically MulticastSocket) with latest Linux & USAGI code
    29  */
    29  */
    30 import java.util.*;
    30 import java.util.*;
    31 import java.net.*;
    31 import java.net.*;
       
    32 import jdk.test.lib.NetworkConfiguration;
    32 import jdk.test.lib.net.IPSupport;
    33 import jdk.test.lib.net.IPSupport;
    33 
    34 
    34 public class NoLoopbackPackets {
    35 public class NoLoopbackPackets {
    35     private static String osname;
    36     private static String osname;
    36 
    37 
    60             //
    61             //
    61             List<SocketAddress> groups = new ArrayList<SocketAddress>();
    62             List<SocketAddress> groups = new ArrayList<SocketAddress>();
    62             if (IPSupport.hasIPv4()) {
    63             if (IPSupport.hasIPv4()) {
    63                 groups.add(new InetSocketAddress(InetAddress.getByName("224.1.1.1"), port));
    64                 groups.add(new InetSocketAddress(InetAddress.getByName("224.1.1.1"), port));
    64             }
    65             }
    65             if (IPSupport.hasIPv6()) {
    66 
       
    67             NetworkConfiguration nc = NetworkConfiguration.probe();
       
    68             if (IPSupport.hasIPv6() && nc.hasTestableIPv6Address()) {
    66                 groups.add(new InetSocketAddress(InetAddress.getByName("::ffff:224.1.1.2"), port));
    69                 groups.add(new InetSocketAddress(InetAddress.getByName("::ffff:224.1.1.2"), port));
    67                 groups.add(new InetSocketAddress(InetAddress.getByName("ff02::1:1"), port));
    70                 groups.add(new InetSocketAddress(InetAddress.getByName("ff02::1:1"), port));
    68             }
    71             }
    69             if (groups.isEmpty()) {
    72             if (groups.isEmpty()) {
    70                 System.err.println("Nothing to test: there are no network interfaces");
    73                 System.err.println("Nothing to test: there are no network interfaces");