ipconfig: Don't call IP bound ops when type does not match
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 8 Jul 2011 00:21:43 +0000 (02:21 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 8 Jul 2011 00:26:03 +0000 (02:26 +0200)
src/ipconfig.c
src/service.c

index 454d5d5261eb0db1952f3b240587dbceb9810947..9f73b6568e78d0f9ef5900b95887a46c028b619d 100644 (file)
@@ -708,6 +708,7 @@ void __connman_ipconfig_newaddr(int index, int family, const char *label,
 {
        struct connman_ipdevice *ipdevice;
        struct connman_ipaddress *ipaddress;
+       enum connman_ipconfig_type type;
        GList *list;
 
        DBG("index %d", index);
@@ -729,6 +730,13 @@ void __connman_ipconfig_newaddr(int index, int family, const char *label,
                return;
        }
 
+       if (family == AF_INET)
+               type = CONNMAN_IPCONFIG_TYPE_IPV4;
+       else if (family == AF_INET6)
+               type = CONNMAN_IPCONFIG_TYPE_IPV6;
+       else
+               return;
+
        ipdevice->address_list = g_slist_append(ipdevice->address_list,
                                                                ipaddress);
 
@@ -755,6 +763,9 @@ void __connman_ipconfig_newaddr(int index, int family, const char *label,
                if (index != ipconfig->index)
                        continue;
 
+               if (type != ipconfig->type)
+                       continue;
+
                if (ipconfig->ops == NULL)
                        continue;
 
@@ -768,6 +779,7 @@ void __connman_ipconfig_deladdr(int index, int family, const char *label,
 {
        struct connman_ipdevice *ipdevice;
        struct connman_ipaddress *ipaddress;
+       enum connman_ipconfig_type type;
        GList *list;
 
        DBG("index %d", index);
@@ -780,6 +792,13 @@ void __connman_ipconfig_deladdr(int index, int family, const char *label,
        if (ipaddress == NULL)
                return;
 
+       if (family == AF_INET)
+               type = CONNMAN_IPCONFIG_TYPE_IPV4;
+       else if (family == AF_INET6)
+               type = CONNMAN_IPCONFIG_TYPE_IPV6;
+       else
+               return;
+
        ipdevice->address_list = g_slist_remove(ipdevice->address_list,
                                                                ipaddress);
 
@@ -802,6 +821,9 @@ void __connman_ipconfig_deladdr(int index, int family, const char *label,
                if (index != ipconfig->index)
                        continue;
 
+               if (type != ipconfig->type)
+                       continue;
+
                if (ipconfig->ops == NULL)
                        continue;
 
@@ -825,8 +847,10 @@ void __connman_ipconfig_newroute(int index, int family, unsigned char scope,
                                                g_strcmp0(dst, "::") == 0)) {
                GSList *list;
                GList *config_list;
+               enum connman_ipconfig_type type;
 
                if (family == AF_INET6) {
+                       type = CONNMAN_IPCONFIG_TYPE_IPV6;
                        g_free(ipdevice->ipv6_gateway);
                        ipdevice->ipv6_gateway = g_strdup(gateway);
 
@@ -837,6 +861,7 @@ void __connman_ipconfig_newroute(int index, int family, unsigned char scope,
                                        g_strdup(gateway);
                        }
                } else if (family == AF_INET) {
+                       type = CONNMAN_IPCONFIG_TYPE_IPV4;
                        g_free(ipdevice->ipv4_gateway);
                        ipdevice->ipv4_gateway = g_strdup(gateway);
 
@@ -863,6 +888,9 @@ void __connman_ipconfig_newroute(int index, int family, unsigned char scope,
                        if (index != ipconfig->index)
                                continue;
 
+                       if (type != ipconfig->type)
+                               continue;
+
                        if (ipconfig->ops == NULL)
                                continue;
 
@@ -891,8 +919,10 @@ void __connman_ipconfig_delroute(int index, int family, unsigned char scope,
                                                g_strcmp0(dst, "::") == 0)) {
                GSList *list;
                GList *config_list;
+               enum connman_ipconfig_type type;
 
                if (family == AF_INET6) {
+                       type = CONNMAN_IPCONFIG_TYPE_IPV6;
                        g_free(ipdevice->ipv6_gateway);
                        ipdevice->ipv6_gateway = NULL;
 
@@ -902,6 +932,7 @@ void __connman_ipconfig_delroute(int index, int family, unsigned char scope,
                                ipdevice->config_ipv6->system->gateway = NULL;
                        }
                } else if (family == AF_INET) {
+                       type = CONNMAN_IPCONFIG_TYPE_IPV4;
                        g_free(ipdevice->ipv4_gateway);
                        ipdevice->ipv4_gateway = NULL;
 
@@ -927,6 +958,9 @@ void __connman_ipconfig_delroute(int index, int family, unsigned char scope,
                        if (index != ipconfig->index)
                                continue;
 
+                       if (type != ipconfig->type)
+                               continue;
+
                        if (ipconfig->ops == NULL)
                                continue;
 
index 6d4abfdeb507937925b8205acc1df05adfaaa59a..04bc51c9fd7643fc073cc6d956ae89612d04ae1e 100644 (file)
@@ -3488,6 +3488,7 @@ static int __connman_service_indicate_state(struct connman_service *service)
                g_get_current_time(&service->modified);
                __connman_storage_save_service(service);
 
+               update_nameservers(service);
                dns_changed(service);
                domain_changed(service);