Release tizen_2.0_beta
[framework/connectivity/connman.git] / src / ipconfig.c
index 94c0c2d..e26f209 100644 (file)
@@ -506,14 +506,6 @@ void __connman_ipconfig_unset_rp_filter(int old_value)
        connman_info("rp_filter restored to %d", old_value);
 }
 
-gboolean __connman_ipconfig_ipv6_privacy_enabled(struct connman_ipconfig *ipconfig)
-{
-       if (ipconfig == NULL)
-               return FALSE;
-
-       return ipconfig->ipv6_privacy_config == 0 ? FALSE : TRUE;
-}
-
 static void free_ipdevice(gpointer data)
 {
        struct connman_ipdevice *ipdevice = data;
@@ -713,6 +705,13 @@ update:
                        ipconfig->ops->down(ipconfig);
        }
 
+#if defined TIZEN_EXT
+       if (g_strcmp0(ipdevice->address, address) != 0) {
+               g_free(ipdevice->address);
+               ipdevice->address = g_strdup(address);
+       }
+#endif
+
        if (lower_up)
                __connman_ipconfig_lower_up(ipdevice);
        if (lower_down)
@@ -908,6 +907,7 @@ void __connman_ipconfig_newroute(int index, int family, unsigned char scope,
 
        if (scope == 0 && (g_strcmp0(dst, "0.0.0.0") == 0 ||
                                                g_strcmp0(dst, "::") == 0)) {
+               GSList *list;
                GList *config_list;
                enum connman_ipconfig_type type;
 
@@ -936,6 +936,13 @@ void __connman_ipconfig_newroute(int index, int family, unsigned char scope,
                } else
                        return;
 
+               for (list = ipdevice->address_list; list; list = list->next) {
+                       struct connman_ipaddress *ipaddress = list->data;
+
+                       g_free(ipaddress->gateway);
+                       ipaddress->gateway = g_strdup(gateway);
+               }
+
                for (config_list = g_list_first(ipconfig_list); config_list;
                                        config_list = g_list_next(config_list)) {
                        struct connman_ipconfig *ipconfig = config_list->data;
@@ -949,8 +956,8 @@ void __connman_ipconfig_newroute(int index, int family, unsigned char scope,
                        if (ipconfig->ops == NULL)
                                continue;
 
-                       if (ipconfig->ops->route_set)
-                               ipconfig->ops->route_set(ipconfig);
+                       if (ipconfig->ops->ip_bound)
+                               ipconfig->ops->ip_bound(ipconfig);
                }
        }
 
@@ -972,6 +979,7 @@ void __connman_ipconfig_delroute(int index, int family, unsigned char scope,
 
        if (scope == 0 && (g_strcmp0(dst, "0.0.0.0") == 0 ||
                                                g_strcmp0(dst, "::") == 0)) {
+               GSList *list;
                GList *config_list;
                enum connman_ipconfig_type type;
 
@@ -998,6 +1006,13 @@ void __connman_ipconfig_delroute(int index, int family, unsigned char scope,
                } else
                        return;
 
+               for (list = ipdevice->address_list; list; list = list->next) {
+                       struct connman_ipaddress *ipaddress = list->data;
+
+                       g_free(ipaddress->gateway);
+                       ipaddress->gateway = NULL;
+               }
+
                for (config_list = g_list_first(ipconfig_list); config_list;
                                        config_list = g_list_next(config_list)) {
                        struct connman_ipconfig *ipconfig = config_list->data;
@@ -1011,8 +1026,8 @@ void __connman_ipconfig_delroute(int index, int family, unsigned char scope,
                        if (ipconfig->ops == NULL)
                                continue;
 
-                       if (ipconfig->ops->route_unset)
-                               ipconfig->ops->route_unset(ipconfig);
+                       if (ipconfig->ops->ip_release)
+                               ipconfig->ops->ip_release(ipconfig);
                }
        }
 
@@ -1166,16 +1181,27 @@ void __connman_ipconfig_set_gateway(struct connman_ipconfig *ipconfig, const cha
        ipconfig->address->gateway = g_strdup(gateway);
 }
 
+#if defined TIZEN_EXT
+/*
+ * Description: __connman_service_lookup_from_index cannot find correct service
+ */
+int __connman_ipconfig_gateway_add(struct connman_ipconfig *ipconfig, struct connman_service *service)
+#else
 int __connman_ipconfig_gateway_add(struct connman_ipconfig *ipconfig)
+#endif
 {
+#if !defined TIZEN_EXT
        struct connman_service *service;
+#endif
 
        DBG("");
 
        if (ipconfig->address == NULL)
                return -EINVAL;
 
+#if !defined TIZEN_EXT
        service = __connman_service_lookup_from_index(ipconfig->index);
+#endif
        if (service == NULL)
                return -EINVAL;
 
@@ -2153,17 +2179,10 @@ int __connman_ipconfig_load(struct connman_ipconfig *ipconfig,
        key = g_strdup_printf("%smethod", prefix);
        method = g_key_file_get_string(keyfile, identifier, key, NULL);
        if (method == NULL) {
-               switch (ipconfig->type) {
-               case CONNMAN_IPCONFIG_TYPE_IPV4:
+               if (ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV4)
                        ipconfig->method = CONNMAN_IPCONFIG_METHOD_DHCP;
-                       break;
-               case CONNMAN_IPCONFIG_TYPE_IPV6:
-                       ipconfig->method = CONNMAN_IPCONFIG_METHOD_AUTO;
-                       break;
-               case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
+               else
                        ipconfig->method = CONNMAN_IPCONFIG_METHOD_OFF;
-                       break;
-               }
        } else
                ipconfig->method = __connman_ipconfig_string2method(method);