reload /etc/resolv.conf in SIGALRM handler
authorArmin Fisslthaler <armin@fisslthaler.net>
Fri, 25 Apr 2014 12:44:06 +0000 (14:44 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 22 Jun 2014 15:20:55 +0000 (17:20 +0200)
configure.ac
src/net.c

index 4059f60..6ed4dd9 100644 (file)
@@ -163,7 +163,7 @@ AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param
 AC_CHECK_HEADERS([net/if.h net/if_types.h linux/if_tun.h net/if_tun.h net/tun/if_tun.h net/if_tap.h net/tap/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h time.h netpacket/packet.h],
   [], [], [#include "src/have.h"]
 )
-AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h],
+AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h resolv.h],
   [], [], [#include "src/have.h"]
 )
 AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h],
@@ -204,6 +204,11 @@ AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo],
   [], [], [#include "src/have.h"]
 )
 
+AC_CHECK_DECLS([res_init], [], [], [
+  #include <netinet/in.h>
+  #include <resolv.h>
+])
+
 AC_CACHE_SAVE
 
 dnl These are defined in files in m4/
index 92f6be8..1e6b4c6 100644 (file)
--- a/src/net.c
+++ b/src/net.c
 #include "subnet.h"
 #include "xalloc.h"
 
+#ifdef HAVE_RESOLV_H
+#include <resolv.h>
+#endif
+
 int contradicting_add_edge = 0;
 int contradicting_del_edge = 0;
 static int sleeptime = 10;
@@ -309,6 +313,9 @@ static void sighup_handler(void *data) {
 
 static void sigalrm_handler(void *data) {
        logger(DEBUG_ALWAYS, LOG_NOTICE, "Got %s signal", strsignal(((signal_t *)data)->signum));
+#ifdef HAVE_DECL_RES_INIT
+       res_init();
+#endif
        retry();
 }
 #endif