JDK-8168840 : InetAddress.getByName() throws java.net.UnknownHostException no such interface when used with virtual interfaces on Solaris
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_11
  • CPU: sparc
  • Submitted: 2016-10-20
  • Updated: 2017-01-05
  • Resolved: 2016-12-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b151Fixed
Description
FULL PRODUCT VERSION :
[hudson@dev33 java]$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
[

ADDITIONAL OS VERSION INFORMATION :
$ uname -a
SunOS dev33 5.11 11.2 sun4v sparc sun4v


EXTRA RELEVANT SYSTEM CONFIGURATION :
The network interfaces defined on the Solaris host: 
$ ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000 
net0: flags=100001000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,PHYSRUNNING> mtu 1500 index 2
        inet 10.16.89.239 netmask fffff800 broadcast 10.16.95.255
net0:1: flags=100001000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,PHYSRUNNING> mtu 1500 index 2
        inet 10.16.92.95 netmask fffff800 broadcast 10.16.95.255
net0:2: flags=100001000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,PHYSRUNNING> mtu 1500 index 2
        inet 10.16.92.96 netmask fffff800 broadcast 10.16.95.255
net0:3: flags=100001000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,PHYSRUNNING> mtu 1500 index 2
        inet 10.16.92.97 netmask fffff800 broadcast 10.16.95.255
net0:4: flags=100001000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,PHYSRUNNING> mtu 1500 index 2
        inet 10.16.92.98 netmask fffff800 broadcast 10.16.95.255
net4: flags=100001000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,PHYSRUNNING> mtu 1500 index 4
        inet 169.254.182.77 netmask ffffff00 broadcast 169.254.182.255
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
        inet6 ::1/128 
net0: flags=120002000841<UP,RUNNING,MULTICAST,IPv6,PHYSRUNNING> mtu 1500 index 2
        inet6 fe80::ffff:188/10 
net0:1: flags=120002000841<UP,RUNNING,MULTICAST,IPv6,PHYSRUNNING> mtu 1500 index 2
        inet6 fe80::ffff:189/10 
net0:2: flags=120002000841<UP,RUNNING,MULTICAST,IPv6,PHYSRUNNING> mtu 1500 index 2
        inet6 fe80::221:28ff:feb3:20f2/10 
net0:3: flags=120002000841<UP,RUNNING,MULTICAST,IPv6,PHYSRUNNING> mtu 1500 index 2
        inet6 2620:52:0:105f::ffff:188/64 
net0:4: flags=120002000841<UP,RUNNING,MULTICAST,IPv6,PHYSRUNNING> mtu 1500 index 2
        inet6 2620:52:0:105f::ffff:189/64 
net0:5: flags=120002000841<UP,RUNNING,MULTICAST,IPv6,PHYSRUNNING> mtu 1500 index 2
        inet6 2620:52:0:105f::ffff:190/64 
net0:6: flags=120002000841<UP,RUNNING,MULTICAST,IPv6,PHYSRUNNING> mtu 1500 index 2
        inet6 2620:52:0:105f::ffff:191/64 
net0:7: flags=120002080841<UP,RUNNING,MULTICAST,ADDRCONF,IPv6,PHYSRUNNING> mtu 1500 index 2
        inet6 2620:52:0:105f:221:28ff:feb3:20f2/64 
net4: flags=120002000840<RUNNING,MULTICAST,IPv6,PHYSRUNNING> mtu 1500 index 4
        inet6 ::/0 

A DESCRIPTION OF THE PROBLEM :
Given a NetworkInterface on a Solaris host which has subinterfaces defined on it, if we then obtain an enumeration of those sub-interfaces, then the following code throws an UnknownHostException:

try {
    Enumeration intfs = NetworkInterface.getNetworkInterfaces() ;	    
    while (intfs != null && intfs.hasMoreElements()) {
        NetworkInterface intf = (NetworkInterface) intfs.nextElement() ;   
 	Enumeration<NetworkInterface> subInterfaces = intf.getSubInterfaces() ;
	while (subInterfaces != null && subInterfaces.hasMoreElements()) {
	    Enumeration<InetAddress> subInetAddresses = subInterface.getInetAddresses() ;
            while (subInetAddresses != null && subInetAddresses.hasMoreElements()) {
 	        InetAddress inetAddress = (InetAddress) subInetAddresses.nextElement() ;
	        boolean ipv6 = inetAddress instanceof Inet6Address;
	        if (ipv6) {
	            try {
                        // inet6Address should equal reversal
		        String reversalString = inet6Address.getHostAddress();
		        InetAddress reversal = InetAddress.getByName(reversalString) ;
                    } catch(UnknownHostException uhe) {
                          // UnknownHostException occurs here
                    }
                }
	    }
        }
    }
}

In other words, when dealing with an IPv6 InetAddress obtained from a sub-interface on Solaris 11 (when the sub-interface is virtual), calling InetAddress.getHostByName() to generate a string representation of the name, followed by a call to IentAddress.getByName() to generate an InetAddress from the string representation results in an UnknownHostException.

This happens on JDK8, but not on JDK7 nor JDK 6.

REGRESSION.  Last worked in version 7u79

ADDITIONAL REGRESSION INFORMATION: 
Here is the version in which the test works and the results of running the test program:

$ /qa/tools/opt/solaris11_sparc/jdk1.7.0.unlimited_last/bin/java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) Server VM (build 24.79-b02, mixed mode)
[hudson@dev33 java]$ /qa/tools/opt/solaris11_sparc/jdk1.7.0.unlimited_last/bin/java TestGetNetworkInterfaces
Network interface: name = net4, display name = net4
        Inet addresses:
                Inet address.getHostAddress() =0:0:0:0:0:0:0:0%4
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 0:0:0:0:0:0:0:0%4
                Result of reverse lookup on address: 0:0:0:0:0:0:0:0%4
                Inet address.getHostAddress() =169.254.182.77
                IsIpv6Address? = false
        Sub interfaces:
Network interface: name = net0, display name = net0
        Inet addresses:
                Inet address.getHostAddress() =2620:52:0:105f:221:28ff:feb3:20f2%2
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 2620:52:0:105f:221:28ff:feb3:20f2%2
                Result of reverse lookup on address: 2620:52:0:105f:221:28ff:feb3:20f2%2
                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:191%2
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:191%2
                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:191%2
                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:190%2
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:190%2
                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:190%2
                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:189%2
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:189%2
                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:189%2
                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:188%2
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:188%2
                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:188%2
                Inet address.getHostAddress() =fe80:0:0:0:221:28ff:feb3:20f2%2
                IsIpv6Address? = true, type = Link Local Address, scoped interface = name:net0 (net0), scopeid = 2
                Doing reverse lookup on address: fe80:0:0:0:221:28ff:feb3:20f2%2
                Result of reverse lookup on address: fe80:0:0:0:221:28ff:feb3:20f2%2
                Inet address.getHostAddress() =fe80:0:0:0:0:0:ffff:189%2
                IsIpv6Address? = true, type = Link Local Address, scoped interface = name:net0 (net0), scopeid = 2
                Doing reverse lookup on address: fe80:0:0:0:0:0:ffff:189%2
                Result of reverse lookup on address: fe80:0:0:0:0:0:ffff:189%2
                Inet address.getHostAddress() =fe80:0:0:0:0:0:ffff:188%2
                IsIpv6Address? = true, type = Link Local Address, scoped interface = name:net0 (net0), scopeid = 2
                Doing reverse lookup on address: fe80:0:0:0:0:0:ffff:188%2
                Result of reverse lookup on address: fe80:0:0:0:0:0:ffff:188%2
                Inet address.getHostAddress() =10.16.92.98
                IsIpv6Address? = false
                Inet address.getHostAddress() =10.16.92.97
                IsIpv6Address? = false
                Inet address.getHostAddress() =10.16.92.96
                IsIpv6Address? = false
                Inet address.getHostAddress() =10.16.92.95
                IsIpv6Address? = false
                Inet address.getHostAddress() =10.16.89.239
                IsIpv6Address? = false
        Sub interfaces:
                Sub interface =name:net0:7 (net0:7)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =2620:52:0:105f:221:28ff:feb3:20f2%2
                                IsIpv6Address? = true, type = Global Address
                                Doing reverse lookup on address: 2620:52:0:105f:221:28ff:feb3:20f2%2
                                Result of reverse lookup on address: 2620:52:0:105f:221:28ff:feb3:20f2%2
                Sub interface =name:net0:6 (net0:6)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:191%2
                                IsIpv6Address? = true, type = Global Address
                                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:191%2
                                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:191%2
                Sub interface =name:net0:5 (net0:5)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:190%2
                                IsIpv6Address? = true, type = Global Address
                                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:190%2
                                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:190%2
                Sub interface =name:net0:4 (net0:4)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:189%2
                                IsIpv6Address? = true, type = Global Address
                                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:189%2
                                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:189%2
                                Inet address.getHostAddress() =10.16.92.98
                                IsIpv6Address? = false
                Sub interface =name:net0:3 (net0:3)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:188%2
                                IsIpv6Address? = true, type = Global Address
                                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:188%2
                                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:188%2
                                Inet address.getHostAddress() =10.16.92.97
                                IsIpv6Address? = false
                Sub interface =name:net0:2 (net0:2)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =fe80:0:0:0:221:28ff:feb3:20f2%2
                                IsIpv6Address? = true, type = Link Local Address, scoped interface = name:net0:2 (net0:2), scopeid = 2
                                Doing reverse lookup on address: fe80:0:0:0:221:28ff:feb3:20f2%2
                                Result of reverse lookup on address: fe80:0:0:0:221:28ff:feb3:20f2%2
                                Inet address.getHostAddress() =10.16.92.96
                                IsIpv6Address? = false
                Sub interface =name:net0:1 (net0:1)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =fe80:0:0:0:0:0:ffff:189%2
                                IsIpv6Address? = true, type = Link Local Address, scoped interface = name:net0:1 (net0:1), scopeid = 2
                                Doing reverse lookup on address: fe80:0:0:0:0:0:ffff:189%2
                                Result of reverse lookup on address: fe80:0:0:0:0:0:ffff:189%2
                                Inet address.getHostAddress() =10.16.92.95
                                IsIpv6Address? = false
Network interface: name = lo0, display name = lo0
        Inet addresses:
                Inet address.getHostAddress() =0:0:0:0:0:0:0:1%1
                IsIpv6Address? = true, type = Loopback Address
                Doing reverse lookup on address: 0:0:0:0:0:0:0:1%1
                Result of reverse lookup on address: 0:0:0:0:0:0:0:1%1
                Inet address.getHostAddress() =127.0.0.1
                IsIpv6Address? = false
        Sub interfaces:

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test program provided below on a Solaris 11 Sparc host with virtual interfaces defined.



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The results expected are the same as the Actual Result below, except that there should be no problem doing the "reverse lookup" on the InetAddress; in other words, we should be able to take an Inet6Address, create a String representation, and then return to the Inet6Address using the String representation and the method getByName. 
ACTUAL -
Here are the results in which the exception occurs:

[hudson@dev33 java]$ java TestGetNetworkInterfaces
Network interface: name = net4, display name = net4
        Inet addresses:
                Inet address.getHostAddress() =0:0:0:0:0:0:0:0%net4
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 0:0:0:0:0:0:0:0%net4
                Result of reverse lookup on address: 0:0:0:0:0:0:0:0%net4
                Inet address.getHostAddress() =169.254.182.77
                IsIpv6Address? = false
        Sub interfaces:
Network interface: name = net0, display name = net0
        Inet addresses:
                Inet address.getHostAddress() =2620:52:0:105f:221:28ff:feb3:20f2%net0
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 2620:52:0:105f:221:28ff:feb3:20f2%net0
                Result of reverse lookup on address: 2620:52:0:105f:221:28ff:feb3:20f2%net0
                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:191%net0
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:191%net0
                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:191%net0
                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:190%net0
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:190%net0
                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:190%net0
                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:189%net0
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:189%net0
                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:189%net0
                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:188%net0
                IsIpv6Address? = true, type = Global Address
                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:188%net0
                Result of reverse lookup on address: 2620:52:0:105f:0:0:ffff:188%net0
                Inet address.getHostAddress() =fe80:0:0:0:221:28ff:feb3:20f2%net0
                IsIpv6Address? = true, type = Link Local Address, scoped interface = name:net0 (net0), scopeid = 2
                Doing reverse lookup on address: fe80:0:0:0:221:28ff:feb3:20f2%net0
                Result of reverse lookup on address: fe80:0:0:0:221:28ff:feb3:20f2%net0
                Inet address.getHostAddress() =fe80:0:0:0:0:0:ffff:189%net0
                IsIpv6Address? = true, type = Link Local Address, scoped interface = name:net0 (net0), scopeid = 2
                Doing reverse lookup on address: fe80:0:0:0:0:0:ffff:189%net0
                Result of reverse lookup on address: fe80:0:0:0:0:0:ffff:189%net0
                Inet address.getHostAddress() =fe80:0:0:0:0:0:ffff:188%net0
                IsIpv6Address? = true, type = Link Local Address, scoped interface = name:net0 (net0), scopeid = 2
                Doing reverse lookup on address: fe80:0:0:0:0:0:ffff:188%net0
                Result of reverse lookup on address: fe80:0:0:0:0:0:ffff:188%net0
                Inet address.getHostAddress() =10.16.92.98
                IsIpv6Address? = false
                Inet address.getHostAddress() =10.16.92.97
                IsIpv6Address? = false
                Inet address.getHostAddress() =10.16.92.96
                IsIpv6Address? = false
                Inet address.getHostAddress() =10.16.92.95
                IsIpv6Address? = false
                Inet address.getHostAddress() =10.16.89.239
                IsIpv6Address? = false
        Sub interfaces:
                Sub interface =name:net0:7 (net0:7)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =2620:52:0:105f:221:28ff:feb3:20f2%net0:7
                                IsIpv6Address? = true, type = Global Address
                                Doing reverse lookup on address: 2620:52:0:105f:221:28ff:feb3:20f2%net0:7
                                problem computing reversal: exception = java.net.UnknownHostException: no such interface net0:7
                Sub interface =name:net0:6 (net0:6)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:191%net0:6
                                IsIpv6Address? = true, type = Global Address
                                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:191%net0:6
                                problem computing reversal: exception = java.net.UnknownHostException: no such interface net0:6
                Sub interface =name:net0:5 (net0:5)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:190%net0:5
                                IsIpv6Address? = true, type = Global Address
                                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:190%net0:5
                                problem computing reversal: exception = java.net.UnknownHostException: no such interface net0:5
                Sub interface =name:net0:4 (net0:4)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:189%net0:4
                                IsIpv6Address? = true, type = Global Address
                                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:189%net0:4
                                problem computing reversal: exception = java.net.UnknownHostException: no such interface net0:4
                                Inet address.getHostAddress() =10.16.92.98
                                IsIpv6Address? = false
                Sub interface =name:net0:3 (net0:3)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =2620:52:0:105f:0:0:ffff:188%net0:3
                                IsIpv6Address? = true, type = Global Address
                                Doing reverse lookup on address: 2620:52:0:105f:0:0:ffff:188%net0:3
                                problem computing reversal: exception = java.net.UnknownHostException: no such interface net0:3
                                Inet address.getHostAddress() =10.16.92.97
                                IsIpv6Address? = false
                Sub interface =name:net0:2 (net0:2)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =fe80:0:0:0:221:28ff:feb3:20f2%net0:2
                                IsIpv6Address? = true, type = Link Local Address, scoped interface = name:net0:2 (net0:2), scopeid = 2
                                Doing reverse lookup on address: fe80:0:0:0:221:28ff:feb3:20f2%net0:2
                                problem computing reversal: exception = java.net.UnknownHostException: no such interface net0:2
                                Inet address.getHostAddress() =10.16.92.96
                                IsIpv6Address? = false
                Sub interface =name:net0:1 (net0:1)
                        Subinterface Inet addresses:
                                Inet address.getHostAddress() =fe80:0:0:0:0:0:ffff:189%net0:1
                                IsIpv6Address? = true, type = Link Local Address, scoped interface = name:net0:1 (net0:1), scopeid = 2
                                Doing reverse lookup on address: fe80:0:0:0:0:0:ffff:189%net0:1
                                problem computing reversal: exception = java.net.UnknownHostException: no such interface net0:1
                                Inet address.getHostAddress() =10.16.92.95
                                IsIpv6Address? = false
Network interface: name = lo0, display name = lo0
        Inet addresses:
                Inet address.getHostAddress() =0:0:0:0:0:0:0:1%lo0
                IsIpv6Address? = true, type = Loopback Address
                Doing reverse lookup on address: 0:0:0:0:0:0:0:1%lo0
                Result of reverse lookup on address: 0:0:0:0:0:0:0:1%lo0
                Inet address.getHostAddress() =127.0.0.1
                IsIpv6Address? = false
        Sub interfaces:

ERROR MESSAGES/STACK TRACES THAT OCCUR :
ava.net.UnknownHostException: no such interface net0:2

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
The test program below can be run as follows:
java -cp . TestGetNetworkInterfaces

-----------------------------------------------------------------------------------------------------------------------------------------
import java.util.Enumeration ;
import java.util.List ;
import java.util.NoSuchElementException ;
import java.net.NetworkInterface ;
import java.net.InterfaceAddress ;
import java.net.InetAddress ;
import java.net.Inet6Address ;
import java.net.Inet4Address ;
import java.net.SocketException ;
import java.net.UnknownHostException;

class TestGetNetworkInterfaces {

    public static void main(String[] args) {

	try {
	    // get all the network interfaces on this machine
	    Enumeration intfs = NetworkInterface.getNetworkInterfaces() ;	    
	    while (intfs != null && intfs.hasMoreElements()) {
		// get the next interface
		NetworkInterface intf = (NetworkInterface) intfs.nextElement() ;
		System.out.println("Network interface: name = " + intf.getName() + ", display name = " + intf.getDisplayName());

                // interface address (IP address, subnet, broadcast address)
                List<InterfaceAddress> interfaceAddresses = intf.getInterfaceAddresses(); 

		// get all the InetAddresses defined on the interface
		Enumeration<InetAddress> inetAddresses = intf.getInetAddresses() ;
		System.out.println("\tInet addresses:");
		while (inetAddresses != null && inetAddresses.hasMoreElements()) {		    
		    // get the next InetAddress for the current interface
		    InetAddress inetAddress = (InetAddress) inetAddresses.nextElement() ;
		    displayInetAddressDetails(inetAddress, "\t\t");
		}

		// get all the SubInterfaces defined on the interface
		Enumeration<NetworkInterface> subInterfaces = intf.getSubInterfaces() ;
		System.out.println("\tSub interfaces:");
		while (subInterfaces != null && subInterfaces.hasMoreElements()) {		    
		    // get the next SubInterface for the current interface
		    NetworkInterface subInterface = (NetworkInterface) subInterfaces.nextElement() ;
		    System.out.println("\t\tSub interface =" + subInterface.toString()) ;
		    
		    // get all the InetAddresses defined on the interface
		    Enumeration<InetAddress> subInetAddresses = subInterface.getInetAddresses() ;
		    System.out.println("\t\t\tSubinterface Inet addresses:");
		    while (subInetAddresses != null && subInetAddresses.hasMoreElements()) {		    
			// get the next InetAddress for the current interface
			InetAddress inetAddress = (InetAddress) subInetAddresses.nextElement() ;
			displayInetAddressDetails(inetAddress, "\t\t\t\t");
		    }
		}
	    }
	}
	catch(SocketException e) {
	    // NetworkInterface.getNetworkInterfaces() -> java.net.SocketException
	}
	catch(NoSuchElementException e) {
	    // Enumeration.nextElement() -> java.util.NoSuchElementException
	}
    }

    private static void displayInetAddressDetails(InetAddress inetAddress, String indent) {
	// this just prints out the inet address part, in the form <IP address>%<interface name>
	String hostAddress = inetAddress.getHostAddress();
	System.out.println(indent + "Inet address.getHostAddress() =" + hostAddress) ;
	boolean ipv6 = inetAddress instanceof Inet6Address;
	if (ipv6) {
	    System.out.print(indent + "IsIpv6Address? = true");
	    Inet6Address inet6Address = (Inet6Address) inetAddress;
	    if (inet6Address.isSiteLocalAddress()) {
		System.out.println(", type = Site Local Address");
	    } else if (inet6Address.isLinkLocalAddress()) {
		System.out.print(", type = Link Local Address");
		System.out.print(", scoped interface = " + inet6Address.getScopedInterface());
		System.out.println(", scopeid = " + inet6Address.getScopeId());
	    } else if (inet6Address.isLoopbackAddress()) {
		System.out.println(", type = Loopback Address");
	    } else {
		System.out.println(", type = Global Address");
	    }

	    // check that we can do a reverse lookup
	    try {
		String reversalString = inet6Address.getHostAddress();
		System.out.println(indent + "Doing reverse lookup on address: " + reversalString);
		InetAddress reversal = InetAddress.getByName(reversalString) ;
		System.out.println(indent + "Result of reverse lookup on address: " + reversal.getHostAddress());		
	    } catch(UnknownHostException uhe) {
		System.out.println(indent + "problem computing reversal: exception = " + uhe.toString());
	    }
	} else {
	    System.out.println(indent + "IsIpv6Address? = false");
	}	
    }
}

-----------------------------------------------------------------------------------------------------------------------------------------
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Don't use virtual interfaces with Solaris 11 Sparc.


Comments
The NetworkInterface implementation lists virtual interfaces ( interfaces with a ':' in their name ) as subinterfaces of their relevant parent. NetworkInterface::getByName iterates over all parent interfaces when trying to locate the given interface name. This is incorrect, as it will not locate virtual interfaces. The solution is, when given a virtual interface, first find its parent then search within that interfaces subinterface list. The connection in this issue with Inet6Address is that the constructor that accepts a String interface name, Inet6Address(String hostName, byte addr[], String ifname), passes that interface name to NetworkInterface::getByName to locate the actual NetworkInterface. Review thread: http://mail.openjdk.java.net/pipermail/net-dev/2016-December/010543.html
23-12-2016

I'll try to find time to look at this. I'm currently thinking there could be things not working with virtual interfaces or something can be improved in the NetworkInterface coding for that, also on Linux. Unfortunately I have no environment so far for testing this but I'll try to get something set up.
27-10-2016