From 3a2a6b0d819382e77775c3a3dda052be78910a77 Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Mon, 11 Dec 2017 14:33:38 +0900 Subject: [PATCH] Use preferred ipv6 address Change-Id: Idda6dbe52ac4211681d26b7da2507c7dd2464e45 --- packaging/capi-network-connection.spec | 2 +- src/connection_profile.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packaging/capi-network-connection.spec b/packaging/capi-network-connection.spec index b5f9f6e..d5b1e64 100755 --- a/packaging/capi-network-connection.spec +++ b/packaging/capi-network-connection.spec @@ -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 diff --git a/src/connection_profile.c b/src/connection_profile.c index 2779923..8f7f52c 100755 --- a/src/connection_profile.c +++ b/src/connection_profile.c @@ -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; -- 2.7.4