From: Samuel Ortiz Date: Fri, 8 Jul 2011 00:21:43 +0000 (+0200) Subject: ipconfig: Don't call IP bound ops when type does not match X-Git-Tag: 2.0_alpha~1335 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ce93388b0f7a092f5855ac37db8fb30cf0c453e;p=framework%2Fconnectivity%2Fconnman.git ipconfig: Don't call IP bound ops when type does not match --- diff --git a/src/ipconfig.c b/src/ipconfig.c index 454d5d5..9f73b65 100644 --- a/src/ipconfig.c +++ b/src/ipconfig.c @@ -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; diff --git a/src/service.c b/src/service.c index 6d4abfd..04bc51c 100644 --- a/src/service.c +++ b/src/service.c @@ -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);