summaryrefslogtreecommitdiff
path: root/src/resolver.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-09-17 16:43:53 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-09-26 12:32:57 +0300
commit5c0e208ba24937a7e3dd1bb363cd790a53f7d329 (patch)
treedb9d54604ee0521fe19dc4e9b46d36984daf48fa /src/resolver.c
parent050c33f6e0791dace69df206f1445ab8ce9ed96f (diff)
downloadconnman-5c0e208ba24937a7e3dd1bb363cd790a53f7d329.tar.gz
connman-5c0e208ba24937a7e3dd1bb363cd790a53f7d329.tar.bz2
connman-5c0e208ba24937a7e3dd1bb363cd790a53f7d329.zip
resolver: Do not touch IPv4 servers in redo case
The name server refresh should be only done for IPv6 nameservers.
Diffstat (limited to 'src/resolver.c')
-rw-r--r--src/resolver.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/resolver.c b/src/resolver.c
index 2d524573..009110f9 100644
--- a/src/resolver.c
+++ b/src/resolver.c
@@ -31,6 +31,7 @@
#include <string.h>
#include <sys/stat.h>
#include <resolv.h>
+#include <netdb.h>
#include "connman.h"
@@ -46,6 +47,7 @@ struct entry_data {
char *interface;
char *domain;
char *server;
+ int family;
unsigned int flags;
unsigned int lifetime;
guint timeout;
@@ -317,6 +319,10 @@ static int append_resolver(const char *interface, const char *domain,
entry->server = g_strdup(server);
entry->flags = flags;
entry->lifetime = lifetime;
+
+ if (server != NULL)
+ entry->family = connman_inet_check_ipaddress(server);
+
if (lifetime) {
int index;
interval = lifetime * RESOLVER_LIFETIME_REFRESH_THRESHOLD;
@@ -539,6 +545,13 @@ int __connman_resolver_redo_servers(const char *interface)
continue;
/*
+ * This function must only check IPv6 server addresses so
+ * do not remove IPv4 name servers unnecessarily.
+ */
+ if (entry->family != AF_INET6)
+ continue;
+
+ /*
* We remove the server, and then re-create so that it will
* use proper source addresses when sending DNS queries.
*/