BUG702: RPC Router fails to acquire IP address of the host 86/5986/3
authorAbhishek Kumar <abhishk2@cisco.com>
Tue, 8 Apr 2014 22:58:15 +0000 (15:58 -0700)
committerAbhishek Kumar <abhishk2@cisco.com>
Wed, 9 Apr 2014 20:01:20 +0000 (20:01 +0000)
Removed the check that only picked private address space addresses. Now we pick IPv4 address belonging in any category that is not loopback address.

Change-Id: Idf98d1c64306059029bc4a6347d1ff952d45a6ba
Signed-off-by: Abhishek Kumar <abhishk2@cisco.com>
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/ServerImpl.java

index 722ca0687904f2c7f2e5c42572fc2d16c762936b..d256b998d4f8abd254fffea087778600a1b70051 100644 (file)
@@ -254,7 +254,6 @@ public class ServerImpl implements RemoteRpcServer {
       e = NetworkInterface.getNetworkInterfaces();
     } catch (SocketException e1) {
       _logger.error("Failed to get list of interfaces", e1);
-      //throw new RuntimeException("Failed to acquire list of interfaces", e1);
       return null;
     }
     while (e.hasMoreElements()) {
@@ -265,7 +264,7 @@ public class ServerImpl implements RemoteRpcServer {
       while (ee.hasMoreElements()) {
         InetAddress i = (InetAddress) ee.nextElement();
         _logger.debug("Trying address {}", i);
-        if ((i instanceof Inet4Address) && (i.isSiteLocalAddress())) {
+        if ((i instanceof Inet4Address) && (!i.isLoopbackAddress())) {
           String hostAddress = i.getHostAddress();
           _logger.debug("Settled on host address {}", hostAddress);
           return hostAddress;