From: Jaemin Ahn Date: Wed, 8 May 2013 10:52:21 +0000 (+0900) Subject: Fix DNS address setting. X-Git-Tag: accepted/tizen/20130520.101509~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fframework%2Fnative%2Fconnectivity-service.git;a=commitdiff_plain;h=038a75f287355b2dbe0733e26efb0a97900c311a Fix DNS address setting. Change-Id: I2514be67c911c14d4f689fcab0b433e2b3d57c72 Signed-off-by: Jaemin Ahn --- diff --git a/src/NetService.cpp b/src/NetService.cpp index 8925e39..7d8fa9a 100644 --- a/src/NetService.cpp +++ b/src/NetService.cpp @@ -417,33 +417,6 @@ NetService::ConvertToProfileInfo(void* pProfileHandle, const NetAccountInfo& net if (ipConfigType != CONNECTION_IP_CONFIG_TYPE_FIXED) { - if (netAccountInfo.GetDnsAddressScheme() == NET_ADDRESS_SCHEME_STATIC) - { - if (netAccountInfo.GetPrimaryDnsAddress() != null) - { - pDnsAddr = _StringConverter::CopyToCharArrayN(netAccountInfo.GetPrimaryDnsAddress()->ToString()); - SysTryCatch(NID_NET, pDnsAddr != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, - "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - - ret = connection_profile_set_dns_address(profileHandle, 1, CONNECTION_ADDRESS_FAMILY_IPV4, pDnsAddr); - delete[] pDnsAddr; - SysTryCatch(NID_NET, ret == CONNECTION_ERROR_NONE, r = E_SYSTEM, E_SYSTEM, - "[%s] A system error has been occurred. The return value from connection_profile_set_dns_address() is %d", GetErrorMessage(E_SYSTEM), ret); - } - - if (netAccountInfo.GetSecondaryDnsAddress() != null) - { - pDnsAddr = _StringConverter::CopyToCharArrayN(netAccountInfo.GetSecondaryDnsAddress()->ToString()); - SysTryCatch(NID_NET, pDnsAddr != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, - "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - - ret = connection_profile_set_dns_address(profileHandle, 2, CONNECTION_ADDRESS_FAMILY_IPV4, pDnsAddr); - delete[] pDnsAddr; - SysTryCatch(NID_NET, ret == CONNECTION_ERROR_NONE, r = E_SYSTEM, E_SYSTEM, - "[%s] A system error has been occurred. The return value from connection_profile_set_dns_address() is %d", GetErrorMessage(E_SYSTEM), ret); - } - } - if (netAccountInfo.GetLocalAddressScheme() == NET_ADDRESS_SCHEME_STATIC) { ret = connection_profile_set_ip_config_type(profileHandle, CONNECTION_ADDRESS_FAMILY_IPV4, CONNECTION_IP_CONFIG_TYPE_STATIC); @@ -470,6 +443,34 @@ NetService::ConvertToProfileInfo(void* pProfileHandle, const NetAccountInfo& net } } + if (netAccountInfo.GetDnsAddressScheme() == NET_ADDRESS_SCHEME_STATIC) + { + if (netAccountInfo.GetPrimaryDnsAddress() != null) + { + pDnsAddr = _StringConverter::CopyToCharArrayN(netAccountInfo.GetPrimaryDnsAddress()->ToString()); + SysTryCatch(NID_NET, pDnsAddr != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, + "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + + ret = connection_profile_set_dns_address(profileHandle, 1, CONNECTION_ADDRESS_FAMILY_IPV4, pDnsAddr); + delete[] pDnsAddr; + pDnsAddr = null; + SysTryCatch(NID_NET, ret == CONNECTION_ERROR_NONE, r = E_SYSTEM, E_SYSTEM, + "[%s] A system error has been occurred. The return value from connection_profile_set_dns_address() is %d", GetErrorMessage(E_SYSTEM), ret); + } + + if (netAccountInfo.GetSecondaryDnsAddress() != null) + { + pDnsAddr = _StringConverter::CopyToCharArrayN(netAccountInfo.GetSecondaryDnsAddress()->ToString()); + SysTryCatch(NID_NET, pDnsAddr != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, + "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + + ret = connection_profile_set_dns_address(profileHandle, 2, CONNECTION_ADDRESS_FAMILY_IPV4, pDnsAddr); + delete[] pDnsAddr; + SysTryCatch(NID_NET, ret == CONNECTION_ERROR_NONE, r = E_SYSTEM, E_SYSTEM, + "[%s] A system error has been occurred. The return value from connection_profile_set_dns_address() is %d", GetErrorMessage(E_SYSTEM), ret); + } + } + if (netAccountInfo.GetProxyAddress() != null) { proxyAddr = netAccountInfo.GetProxyAddress()->GetNetEndPoint();