service: Properly handle nameservers and search domains
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 24 May 2012 13:25:00 +0000 (16:25 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 28 May 2012 14:00:44 +0000 (17:00 +0300)
Remove system added namservers in 'Nameservers' when setting
nameservers from a non-empty 'Nameservers.Config'. Also remove
system added domain name from search domains if 'Domains.Config'
is set.

src/service.c

index 9c06fe9..7d66a4b 100644 (file)
@@ -940,6 +940,8 @@ static void update_nameservers(struct connman_service *service)
        if (service->nameservers_config != NULL) {
                int i;
 
+               remove_nameservers(service, ifname, service->nameservers);
+
                for (i = 0; service->nameservers_config[i] != NULL; i++) {
                        connman_resolver_append(ifname, NULL,
                                                service->nameservers_config[i]);
@@ -954,8 +956,12 @@ static void update_nameservers(struct connman_service *service)
        }
 
        if (service->domains != NULL) {
+               char *searchdomains[2] = {NULL, NULL};
                int i;
 
+               searchdomains[0] = service->domainname;
+               remove_searchdomains(service, ifname, searchdomains);
+
                for (i = 0; service->domains[i]; i++)
                        connman_resolver_append(ifname, service->domains[i],
                                                NULL);