From: Chengyi Zhao Date: Tue, 30 Dec 2014 09:41:13 +0000 (+0800) Subject: Get the IP address X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ad7f7611c451f01ee202cd34d22db3ae2f0e16d;p=platform%2Fcore%2Fapi%2Fconnection.git Get the IP address Change-Id: If8fb7c466881e38bd4ac3d43cbbf45e2d30a9784 Signed-off-by: Chengyi Zhao --- diff --git a/src/connection_profile.c b/src/connection_profile.c index 7d0eaae..8d65a51 100644 --- a/src/connection_profile.c +++ b/src/connection_profile.c @@ -480,19 +480,22 @@ EXPORT_API int connection_profile_get_ip_address(connection_profile_h profile, return CONNECTION_ERROR_INVALID_PARAMETER; } - /* - net_profile_info_t *profile_info = profile; - net_dev_info_t *net_info = __profile_get_net_info(profile_info); - if (net_info == NULL) - return CONNECTION_ERROR_OPERATION_FAILED; - if (address_family == CONNECTION_ADDRESS_FAMILY_IPV6) return CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; - *ip_address = __profile_convert_ip_to_string(&net_info->IpAddr); + const struct service_ipv4 *ipv4; + struct connman_service *service = + _connection_libnet_get_service_h(profile); + if (service == NULL) + return CONNECTION_ERROR_INVALID_PARAMETER; + + ipv4 = connman_service_get_ipv4_info(service); + if (ipv4 == NULL || ipv4->address == NULL) + return CONNECTION_ERROR_OPERATION_FAILED; + + *ip_address = g_strdup(ipv4->address); if (*ip_address == NULL) return CONNECTION_ERROR_OUT_OF_MEMORY; - */ return CONNECTION_ERROR_NONE; }