Use preferred ipv6 address 13/163413/1 accepted/tizen/unified/20171212.064751 submit/tizen/20171211.062320
authorSeonah Moon <seonah1.moon@samsung.com>
Mon, 11 Dec 2017 05:33:38 +0000 (14:33 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Mon, 11 Dec 2017 05:33:38 +0000 (14:33 +0900)
Change-Id: Idda6dbe52ac4211681d26b7da2507c7dd2464e45

packaging/capi-network-connection.spec
src/connection_profile.c

index b5f9f6e..d5b1e64 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          capi-network-connection
 Summary:       Network Connection library in TIZEN C API
-Version:       1.0.106
+Version:       1.0.107
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index 2779923..8f7f52c 100755 (executable)
@@ -572,12 +572,16 @@ EXPORT_API int connection_profile_get_ip_address(connection_profile_h profile,
        if (net_info == NULL)
                return CONNECTION_ERROR_OPERATION_FAILED;
 
-       if (address_family == CONNECTION_ADDRESS_FAMILY_IPV6)
+       if (address_family == CONNECTION_ADDRESS_FAMILY_IPV6) {
                *ip_address = __profile_convert_ip_to_string(&net_info->IpAddr6,
                                address_family);
-       else
-               *ip_address = __profile_convert_ip_to_string(&net_info->IpAddr,
-                               address_family);
+       } else {
+               if (net_get_preferred_ipv6_address(net_info->ProfileName, ip_address) != NET_ERR_NONE) {
+                       CONNECTION_LOG(CONNECTION_ERROR, "Failed to get preferred ipv6 address");
+                       *ip_address = __profile_convert_ip_to_string(&net_info->IpAddr,
+                                       address_family);
+               }
+       }
 
        if (*ip_address == NULL)
                return CONNECTION_ERROR_OUT_OF_MEMORY;