resolver: Append fallback nameservers
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 11 Apr 2012 13:29:02 +0000 (16:29 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 12 Apr 2012 10:55:13 +0000 (13:55 +0300)
Append fallback nameservers, if any. Remove functions for adding
removing public nameservers since they are not used anymore.

include/resolver.h
src/resolver.c

index c7c6b53356828e95bb99cd525b48eb049b8ce69a..0ada1b1bbd866575a42007e98228ae23563c3a70 100644 (file)
@@ -40,9 +40,6 @@ int connman_resolver_remove(const char *interface, const char *domain,
                                                        const char *server);
 int connman_resolver_remove_all(const char *interface);
 
-int connman_resolver_append_public_server(const char *server);
-int connman_resolver_remove_public_server(const char *server);
-
 void connman_resolver_flush(void);
 
 #ifdef __cplusplus
index 53ccf90b510c2202b12bfbbe36ced4faebae3a6b..9796717f362c086b55d1512bd786e12fb7a2af16 100644 (file)
@@ -455,32 +455,6 @@ int connman_resolver_remove_all(const char *interface)
        return 0;
 }
 
-/**
- * connman_resolver_append_public_server:
- * @server: server address
- *
- * Append public resolver server address to current list
- */
-int connman_resolver_append_public_server(const char *server)
-{
-       DBG("server %s", server);
-
-       return append_resolver(NULL, NULL, server, 0, RESOLVER_FLAG_PUBLIC);
-}
-
-/**
- * connman_resolver_remove_public_server:
- * @server: server address
- *
- * Remove public resolver server address to current list
- */
-int connman_resolver_remove_public_server(const char *server)
-{
-       DBG("server %s", server);
-
-       return connman_resolver_remove(NULL, NULL, server);
-}
-
 /**
  * connman_resolver_flush:
  *
@@ -514,6 +488,9 @@ static void free_resolvfile(gpointer data)
 
 int __connman_resolver_init(connman_bool_t dnsproxy)
 {
+       int i;
+       char **ns;
+
        DBG("dnsproxy %d", dnsproxy);
 
        if (dnsproxy == FALSE)
@@ -526,6 +503,12 @@ int __connman_resolver_init(connman_bool_t dnsproxy)
 
        dnsproxy_enabled = TRUE;
 
+       ns = connman_setting_get_string_list("FallbackNameservers");
+       for (i = 0; ns != NULL && ns[i] != NULL; i += 1) {
+               DBG("server %s", ns[i]);
+               append_resolver(NULL, NULL, ns[i], 0, RESOLVER_FLAG_PUBLIC);
+       }
+
        return 0;
 }