From: hyuna0213.jo Date: Tue, 16 Aug 2016 08:22:46 +0000 (+0900) Subject: Fixed wrong address conversion of ip information X-Git-Tag: 1.2.0+RC1~91 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d44902b6e2539b45afdf5187d9bacaeb90815bd;p=platform%2Fupstream%2Fiotivity.git Fixed wrong address conversion of ip information Fixed wrong address conversion of ip information Change-Id: I8c730ae9ca0efcef51d3e9f90e24f24d3a90bd8b Signed-off-by: hyuna0213.jo Reviewed-on: https://gerrit.iotivity.org/gerrit/10495 Tested-by: jenkins-iotivity Reviewed-by: jihwan seo Reviewed-by: Jaehong Jo Reviewed-by: Ashok Babu Channa --- diff --git a/resource/csdk/connectivity/src/ip_adapter/android/caipnwmonitor.c b/resource/csdk/connectivity/src/ip_adapter/android/caipnwmonitor.c index 64bc8aa..24c8224 100644 --- a/resource/csdk/connectivity/src/ip_adapter/android/caipnwmonitor.c +++ b/resource/csdk/connectivity/src/ip_adapter/android/caipnwmonitor.c @@ -123,8 +123,6 @@ CAInterface_t *CAFindInterfaceChange() { struct ifreq* item = &ifr[i]; char *name = item->ifr_name; - struct sockaddr_in *sa4 = (struct sockaddr_in *)&item->ifr_addr; - uint32_t ipv4addr = sa4->sin_addr.s_addr; if (ioctl(s, SIOCGIFFLAGS, item) < 0) { @@ -167,7 +165,12 @@ CAInterface_t *CAFindInterfaceChange() continue; } - foundNewInterface = CANewInterfaceItem(ifIndex, name, AF_INET, ipv4addr, flags); + // Get address of network interface. + char addr[MAX_ADDR_STR_SIZE_CA] = { 0 }; + struct sockaddr_in *sa = (struct sockaddr_in *)&item->ifr_addr; + inet_ntop(AF_INET, (void *)&(sa->sin_addr), addr, sizeof(addr)); + + foundNewInterface = CANewInterfaceItem(ifIndex, name, AF_INET, addr, flags); } OICFree(previous);