ipconfig: Address list for duplicates does not need gateway info.
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Tue, 3 Jan 2012 12:31:28 +0000 (14:31 +0200)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 5 Jan 2012 10:08:19 +0000 (11:08 +0100)
The ipdevice address list is only used for detecting duplicate
addresses so there is no need to copy the gateway information
into the list. The same gateway data was actually used in every
list element which is not a correct thing to do as there would
be different gateways in IPv4 and IPv6 anyway.

src/ipconfig.c

index 4a83efb..20207a1 100644 (file)
@@ -900,7 +900,6 @@ 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;
 
@@ -929,13 +928,6 @@ 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;
@@ -972,7 +964,6 @@ 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;
 
@@ -999,13 +990,6 @@ 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;