Updated connman to version 1.35
[platform/upstream/connman.git] / src / resolver.c
old mode 100644 (file)
new mode 100755 (executable)
index 75ea5ba..d6c20cd
@@ -35,9 +35,6 @@
 
 #include "connman.h"
 
-#define RESOLV_CONF_STATEDIR STATEDIR"/resolv.conf"
-#define RESOLV_CONF_ETC "/etc/resolv.conf"
-
 #define RESOLVER_FLAG_PUBLIC (1 << 0)
 
 /*
@@ -133,19 +130,11 @@ static int resolvfile_export(void)
 
        old_umask = umask(022);
 
-       fd = open(RESOLV_CONF_STATEDIR, O_RDWR | O_CREAT | O_CLOEXEC,
+       fd = open("/etc/resolv.conf", O_RDWR | O_CREAT | O_CLOEXEC,
                                        S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
        if (fd < 0) {
-               connman_warn_once("Cannot create "RESOLV_CONF_STATEDIR" "
-                       "falling back to "RESOLV_CONF_ETC);
-
-               fd = open(RESOLV_CONF_ETC, O_RDWR | O_CREAT | O_CLOEXEC,
-                                       S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-
-               if (fd < 0) {
-                       err = -errno;
-                       goto done;
-               }
+               err = -errno;
+               goto done;
        }
 
        if (ftruncate(fd, 0) < 0) {
@@ -312,8 +301,14 @@ static gboolean resolver_expire_cb(gpointer user_data)
                struct connman_service *service;
                service = __connman_service_lookup_from_index(entry->index);
                if (service)
+#if defined TIZEN_EXT
+                       __connman_service_nameserver_remove(service,
+                                       entry->server, true,
+                                       CONNMAN_IPCONFIG_TYPE_ALL);
+#else
                        __connman_service_nameserver_remove(service,
                                                        entry->server, true);
+#endif
        }
 
        remove_entries(list);
@@ -367,6 +362,11 @@ static int append_resolver(int index, const char *domain,
        if (!server && !domain)
                return -EINVAL;
 
+#ifdef TIZEN_EXT
+       if (g_strcmp0(server, "0.0.0.0") == 0)
+               return -EINVAL;
+#endif
+
        entry = g_try_new0(struct entry_data, 1);
        if (!entry)
                return -ENOMEM;
@@ -409,8 +409,14 @@ static int append_resolver(int index, const char *domain,
                struct connman_service *service;
                service = __connman_service_lookup_from_index(entry->index);
                if (service)
+#if defined TIZEN_EXT
+                       __connman_service_nameserver_append(service,
+                                       server, true,
+                                       CONNMAN_IPCONFIG_TYPE_ALL);
+#else
                        __connman_service_nameserver_append(service,
                                                        server, true);
+#endif
        }
 
        return 0;