[ITC][capi-network-inm][Non-ACR][Check state of IP v6 because IP v6 is not mantatory... 79/204279/3
authorYu <jiung.yu@samsung.com>
Tue, 23 Apr 2019 01:38:15 +0000 (10:38 +0900)
committerYu <jiung.yu@samsung.com>
Tue, 23 Apr 2019 04:43:10 +0000 (13:43 +0900)
Change-Id: I03687f12b28f0cc16c1d26e299937e5c54daa2e2
Signed-off-by: Yu Jiung <jiung.yu@samsung.com>
src/itc/capi-network-inm/ITs-capi-network-inm.c

index 73df7c224a2d517c19a2df5a725d7a05001298a5..363c7203f76bf50a5701f9a9ce8a96375694f86c 100755 (executable)
@@ -1449,6 +1449,7 @@ int ITc_inm_connection_get_ip_address_p(void)
 {
        START_TEST;
 
+       inm_connection_state_e eConnectionState;
        char *pszIpAddr = NULL;
        int nRet = INM_ERROR_NONE;
        inm_connection_h hProfile = NULL;
@@ -1465,10 +1466,14 @@ int ITc_inm_connection_get_ip_address_p(void)
        CHECK_HANDLE_CLEANUP(pszIpAddr, "inm_connection_get_ip_address", inm_connection_destroy(&hProfile));
        FREE_MEMORY_TC(pszIpAddr);
 
-       nRet = inm_connection_get_ip_address(hProfile, INM_ADDRESS_FAMILY_IPV6, &pszIpAddr);
-       PRINT_RESULT_CLEANUP(nRet, INM_ERROR_NONE, "inm_connection_get_ip_address", InmGetError(nRet),inm_connection_destroy(&hProfile));
-       CHECK_HANDLE_CLEANUP(pszIpAddr, "inm_connection_get_ip_address", inm_connection_destroy(&hProfile));
-       FREE_MEMORY_TC(pszIpAddr);
+       nRet = inm_connection_get_ipv6_state(hProfile, &eConnectionState);
+       PRINT_RESULT_CLEANUP(nRet, INM_ERROR_NONE, "inm_connection_get_ipv6_state", InmGetError(nRet), inm_connection_destroy(&hProfile));
+       if (eConnectionState == INM_CONNECTION_STATE_CONNECTED) {
+               nRet = inm_connection_get_ip_address(hProfile, INM_ADDRESS_FAMILY_IPV6, &pszIpAddr);
+               PRINT_RESULT_CLEANUP(nRet, INM_ERROR_NONE, "inm_connection_get_ip_address", InmGetError(nRet),inm_connection_destroy(&hProfile));
+               CHECK_HANDLE_CLEANUP(pszIpAddr, "inm_connection_get_ip_address", inm_connection_destroy(&hProfile));
+               FREE_MEMORY_TC(pszIpAddr);
+       }
 
        nRet = inm_connection_destroy(&hProfile);
        PRINT_RESULT_NORETURN(nRet, INM_ERROR_NONE, "inm_connection_destroy", InmGetError(nRet));
@@ -1538,6 +1543,7 @@ int ITc_inm_connection_get_gateway_address_p(void)
 {
        START_TEST;
 
+       inm_connection_state_e eConnectionState;
        char *pszIpAddr = NULL;
        int nRet = INM_ERROR_NONE;
        inm_connection_h hProfile = NULL;
@@ -1553,11 +1559,14 @@ int ITc_inm_connection_get_gateway_address_p(void)
        PRINT_RESULT_CLEANUP(nRet, INM_ERROR_NONE, "inm_connection_get_gateway_address", InmGetError(nRet), inm_connection_destroy(&hProfile));
        CHECK_HANDLE_CLEANUP(pszIpAddr, "inm_connection_get_gateway_address", inm_connection_destroy(&hProfile));
        FREE_MEMORY_TC(pszIpAddr);
-
-       nRet = inm_connection_get_gateway_address(hProfile, INM_ADDRESS_FAMILY_IPV6, &pszIpAddr);
-       PRINT_RESULT_CLEANUP(nRet, INM_ERROR_NONE, "inm_connection_get_gateway_address", InmGetError(nRet), inm_connection_destroy(&hProfile));
-       CHECK_HANDLE_CLEANUP(pszIpAddr, "inm_connection_get_gateway_address", inm_connection_destroy(&hProfile));
-       FREE_MEMORY_TC(pszIpAddr);
+       nRet = inm_connection_get_ipv6_state(hProfile, &eConnectionState);
+       PRINT_RESULT_CLEANUP(nRet, INM_ERROR_NONE, "inm_connection_get_ipv6_state", InmGetError(nRet), inm_connection_destroy(&hProfile));
+       if (eConnectionState == INM_CONNECTION_STATE_CONNECTED) {
+               nRet = inm_connection_get_gateway_address(hProfile, INM_ADDRESS_FAMILY_IPV6, &pszIpAddr);
+               PRINT_RESULT_CLEANUP(nRet, INM_ERROR_NONE, "inm_connection_get_gateway_address", InmGetError(nRet), inm_connection_destroy(&hProfile));
+               CHECK_HANDLE_CLEANUP(pszIpAddr, "inm_connection_get_gateway_address", inm_connection_destroy(&hProfile));
+               FREE_MEMORY_TC(pszIpAddr);
+       }
 
        nRet = inm_connection_destroy(&hProfile);
        PRINT_RESULT_NORETURN(nRet, INM_ERROR_NONE, "inm_connection_destroy", InmGetError(nRet));