[Jira] IOT-529, Fix to support multiple IP networks in Android
authorjnashok <jn.ashok@samsung.com>
Tue, 26 May 2015 07:32:51 +0000 (16:32 +0900)
committerErich Keane <erich.keane@intel.com>
Tue, 26 May 2015 17:05:51 +0000 (17:05 +0000)
currently only one IP network is enabled due to the bug

Change-Id: I878dec13ec7e4da6a5b2867d8b3c28fb99d85530
Signed-off-by: jnashok <jn.ashok@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1107
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Reviewed-by: John Light <john.j.light@intel.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/connectivity/src/ip_adapter/android/caipnwmonitor.c

index 4272e65..85795f4 100644 (file)
@@ -241,6 +241,12 @@ static CAResult_t CAIPUpdateInterfaceInformation(u_arraylist_t **netInterfaceLis
 
     OIC_LOG_V(DEBUG, IP_MONITOR_TAG, "CAIPUpdateInterfaceInformation : %d", interfaces);
 
+    if(0 == interfaces)
+    {
+        OIC_LOG(ERROR, IP_MONITOR_TAG, "no interfaces");
+        return CA_STATUS_FAILED;
+    }
+
     for (int32_t i = 0; i < interfaces; i++)
     {
         struct ifreq temp_ifr = { 0 };
@@ -263,6 +269,8 @@ static CAResult_t CAIPUpdateInterfaceInformation(u_arraylist_t **netInterfaceLis
         if ((temp_ifr.ifr_flags & IFF_LOOPBACK)
             || !(temp_ifr.ifr_flags & IFF_UP) || !(temp_ifr.ifr_flags & IFF_RUNNING))
         {
+            OIC_LOG_V(ERROR, IP_MONITOR_TAG,
+                      "interface is not up or not running or loopback = %x", temp_ifr.ifr_flags);
             continue;
         }
 
@@ -326,15 +334,11 @@ static CAResult_t CAIPUpdateInterfaceInformation(u_arraylist_t **netInterfaceLis
 
         OIC_LOG_V(DEBUG, IP_MONITOR_TAG, "ipAddress : %s, interfaceName : %s, subnetmask : %s",
                 netInfo->ipAddress, netInfo->interfaceName, netInfo->subnetMask);
-        close(sck);
-        return CA_STATUS_OK;
-
-        break;
     }
 
     close(sck);
     OIC_LOG(DEBUG, IP_MONITOR_TAG, "OUT");
-    return CA_STATUS_FAILED;
+    return CA_STATUS_OK;
 }
 
 static bool CACheckIsAnyInterfaceDown(const u_arraylist_t *netInterfaceList,