-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
This is part of a series of diagnostic output updates to java.net tests to assist in the analysis of failures in IPv6 only environments
for Linux there is not IPv4 configuration but the IPv4 stack remains enabled
For macOS, and windows the IPv4 stacks are disabled, and IPv4 configuration removed
add IPSupport::printPlatformSupport(System.out);
to the start of main
public class IPv4Only {
public static void main(String[] args) throws Exception {
IPSupport::printPlatformSupport(System.out); -
if (IPSupport.hasIPv4()) {
System.out.println("Testing IPv4");
Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
while (nifs.hasMoreElements()) {
NetworkInterface nif = nifs.nextElement();
Enumeration<InetAddress> addrs = nif.getInetAddresses();
while (addrs.hasMoreElements()) {
InetAddress hostAddr = addrs.nextElement();
if ( hostAddr instanceof Inet6Address ){
throw new RuntimeException( "NetworkInterfaceV6List failed - found v6 address " + hostAddr.getHostAddress() );
}
}
}
for Linux there is not IPv4 configuration but the IPv4 stack remains enabled
For macOS, and windows the IPv4 stacks are disabled, and IPv4 configuration removed
add IPSupport::printPlatformSupport(System.out);
to the start of main
public class IPv4Only {
public static void main(String[] args) throws Exception {
IPSupport::printPlatformSupport(System.out); -
if (IPSupport.hasIPv4()) {
System.out.println("Testing IPv4");
Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
while (nifs.hasMoreElements()) {
NetworkInterface nif = nifs.nextElement();
Enumeration<InetAddress> addrs = nif.getInetAddresses();
while (addrs.hasMoreElements()) {
InetAddress hostAddr = addrs.nextElement();
if ( hostAddr instanceof Inet6Address ){
throw new RuntimeException( "NetworkInterfaceV6List failed - found v6 address " + hostAddr.getHostAddress() );
}
}
}