DBG("interface %s domain %s server %s lifetime %d flags %d",
interface, domain, server, lifetime, flags);
- if (server == NULL)
+ if (server == NULL && domain == NULL)
return -EINVAL;
entry = g_try_new0(struct entry_data, 1);
content = g_string_new("# Generated by Connection Manager\n");
/*
- * Nameservers are added in reverse so that the most recently
- * appended entry is the primary nameserver. No more than MAXNS
- * nameservers are used.
+ * Domains and nameservers are added in reverse so that the most
+ * recently appended entry is the primary one. No more than
+ * MAXDNSRCH/MAXNS entries are used.
*/
+
+ for (count = 0, list = g_list_last(resolvfile_list);
+ list && (count < MAXDNSRCH);
+ list = g_list_previous(list)) {
+ struct resolvfile_entry *entry = list->data;
+
+ if (!entry->domain)
+ continue;
+
+ if (count == 0)
+ g_string_append_printf(content, "search ");
+
+ g_string_append_printf(content, "%s ", entry->domain);
+ count++;
+ }
+
+ if (count)
+ g_string_append_printf(content, "\n");
+
for (count = 0, list = g_list_last(resolvfile_list);
list && (count < MAXNS);
list = g_list_previous(list)) {
struct resolvfile_entry *entry = list->data;
+
+ if (!entry->server)
+ continue;
+
g_string_append_printf(content, "nameserver %s\n",
entry->server);
count++;
} else if (service->nameserver != NULL)
connman_resolver_append(ifname, NULL, service->nameserver);
+ if (service->domains != NULL) {
+ int i;
+
+ for (i = 0; service->domains[i]; i++)
+ connman_resolver_append(ifname, service->domains[i],
+ NULL);
+ } else if (service->domainname != NULL)
+ connman_resolver_append(ifname, service->domainname, NULL);
+
connman_resolver_flush();
}
if (service == NULL)
return NULL;
- return service->domainname;
+ if (service->domains != NULL)
+ return service->domains[0];
+ else
+ return service->domainname;
}
const char *connman_service_get_nameserver(struct connman_service *service)
g_string_free(str, TRUE);
- //update_domains(service);
+ update_nameservers(service);
domain_configuration_changed(service);
__connman_storage_save_service(service);
update_nameservers(service);
dns_changed(service);
+ domain_changed(service);
__connman_wpad_start(service);
update_nameservers(service);
dns_changed(service);
+ domain_changed(service);
__connman_notifier_disconnect(service->type);
}