Update vconf for IPv6 address
[platform/core/connectivity/net-config.git] / src / network-state.c
index 37706cc..1a6b775 100755 (executable)
@@ -457,7 +457,7 @@ static void __netconfig_update_default_connection_info(void)
        if (profile == NULL)
                DBG("Reset network state configuration");
        else
-               DBG("%s: ip(%s) proxy(%s)", profile, ip_addr, proxy_addr);
+               DBG("%s: ip(%s) ip6(%s) proxy(%s)", profile, ip_addr, ip_addr6, proxy_addr);
 
        netconfig_vconf_get_int(VCONFKEY_NETWORK_STATUS, &old_network_status);
 
@@ -474,6 +474,7 @@ static void __netconfig_update_default_connection_info(void)
 
        } else if (profile != NULL) {
                char *old_ip = vconf_get_str(VCONFKEY_NETWORK_IP);
+               char *old_ip6 = vconf_get_str(VCONFKEY_NETWORK_IP6);
                char *old_proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
 
                if (netconfig_is_wifi_profile(profile) == TRUE) {
@@ -510,13 +511,19 @@ static void __netconfig_update_default_connection_info(void)
                if (g_strcmp0(old_ip, ip_addr) != 0 || old_ip == NULL) {
                        if (ip_addr != NULL)
                                netconfig_set_vconf_str(VCONFKEY_NETWORK_IP, ip_addr);
-                       else if (ip_addr6 != NULL)
-                               netconfig_set_vconf_str(VCONFKEY_NETWORK_IP, ip_addr6);
                        else
                                netconfig_set_vconf_str(VCONFKEY_NETWORK_IP, "");
                }
                g_free(old_ip);
 
+               if (g_strcmp0(old_ip6, ip_addr6) != 0 || old_ip6 == NULL) {
+                       if (ip_addr6 != NULL)
+                               netconfig_set_vconf_str(VCONFKEY_NETWORK_IP6, ip_addr6);
+                       else
+                               netconfig_set_vconf_str(VCONFKEY_NETWORK_IP6, "");
+               }
+               g_free(old_ip6);
+
                if (g_strcmp0(old_proxy, proxy_addr) != 0) {
                        if (proxy_addr == NULL)
                                netconfig_set_vconf_str(VCONFKEY_NETWORK_PROXY, "");