]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
assume res_init() is always there.
authorGert Doering <gert@greenie.muc.de>
Mon, 27 Apr 2015 19:27:21 +0000 (21:27 +0200)
committerGert Doering <gert@greenie.muc.de>
Sat, 23 May 2015 19:35:59 +0000 (21:35 +0200)
Previously, the code tried to find res_init(), and on some systems
got it wrong in configure, silently not-using res_init(), leading
to unexpected failures to re-init the resolver.

We know that all supported OSes (except Windows) have res_init(), so
change the call to "#ifndef WIN32", and adjust configure.ac to just
find the library to link (if any).  With that, failures to find
res_init() are no longer "hidden" but clearly visible at link time.

AC_SEARCH_LIBS() bits inspired by CUPS' cups_network.m4 (GPLv2)

Fix (part of) trac #523

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Lazy-ACK-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1430162841-5840-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9614

configure.ac
src/openvpn/socket.c

index 5dccfbbc920964634c64737bd288b24a228ed21b..54fe4f53d99c2c111b7cc80a735b54544f2fc77e 100644 (file)
@@ -613,12 +613,6 @@ AC_SUBST([SOCKETS_LIBS])
 old_LIBS="${LIBS}"
 LIBS="${LIBS} ${SOCKETS_LIBS}"
 AC_CHECK_FUNCS([sendmsg recvmsg inet_ntop inet_pton])
-AC_CHECK_FUNCS(
-       [res_init],
-       ,
-       ,
-       [[#include <resolv.h>]]
-)
 # Windows use stdcall for winsock so we cannot auto detect these
 m4_define(
        [SOCKET_FUNCS],
@@ -646,6 +640,11 @@ else
 fi
 LIBS="${old_LIBS}"
 
+# we assume res_init() always exist, but need to find out *where*...
+AC_SEARCH_LIBS(__res_init, resolv bind, ,
+    AC_SEARCH_LIBS(res_9_init, resolv bind, ,
+       AC_SEARCH_LIBS(res_init, resolv bind, , )))
+
 AC_ARG_VAR([TAP_CFLAGS], [C compiler flags for tap])
 old_CFLAGS="${CFLAGS}"
 CFLAGS="${CFLAGS} ${TAP_CFLAGS}"
index afc1e60633564825e49541547f440a7de0ae715b..13ed98174242bfd5b04dc1b91d5b4c7746ebe801 100644 (file)
@@ -314,7 +314,7 @@ openvpn_getaddrinfo (unsigned int flags,
 
   ASSERT(res);
 
-#if defined(HAVE_RES_INIT)
+#ifndef WIN32
   res_init ();
 #endif