mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
Merge branch 'master' into dnstap-log-local-addr
This commit is contained in:
commit
f5339ec7e5
46 changed files with 982 additions and 605 deletions
24
Makefile.in
24
Makefile.in
|
|
@ -349,10 +349,10 @@ unbound$(EXEEXT): $(DAEMON_OBJ_LINK) libunbound.la
|
|||
$(LINK) -o $@ $(DAEMON_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
unbound-checkconf$(EXEEXT): $(CHECKCONF_OBJ_LINK) libunbound.la
|
||||
$(LINK) -o $@ $(CHECKCONF_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(CHECKCONF_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
unbound-control$(EXEEXT): $(CONTROL_OBJ_LINK) libunbound.la
|
||||
$(LINK) -o $@ $(CONTROL_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(CONTROL_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
unbound-host$(EXEEXT): $(HOST_OBJ_LINK) libunbound.la
|
||||
$(LINK) -o $@ $(HOST_OBJ_LINK) -L. -L.libs -lunbound $(SSLLIB) $(LIBS)
|
||||
|
|
@ -370,37 +370,37 @@ anchor-update$(EXEEXT): $(ANCHORUPD_OBJ_LINK) libunbound.la
|
|||
$(LINK) -o $@ $(ANCHORUPD_OBJ_LINK) -L. -L.libs -lunbound $(LIBS)
|
||||
|
||||
unittest$(EXEEXT): $(UNITTEST_OBJ_LINK)
|
||||
$(LINK) -o $@ $(UNITTEST_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(UNITTEST_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
testbound$(EXEEXT): $(TESTBOUND_OBJ_LINK)
|
||||
$(LINK) -o $@ $(TESTBOUND_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(TESTBOUND_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
lock-verify$(EXEEXT): $(LOCKVERIFY_OBJ_LINK)
|
||||
$(LINK) -o $@ $(LOCKVERIFY_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(LOCKVERIFY_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
petal$(EXEEXT): $(PETAL_OBJ_LINK)
|
||||
$(LINK) -o $@ $(PETAL_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
pktview$(EXEEXT): $(PKTVIEW_OBJ_LINK)
|
||||
$(LINK) -o $@ $(PKTVIEW_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(PKTVIEW_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
memstats$(EXEEXT): $(MEMSTATS_OBJ_LINK)
|
||||
$(LINK) -o $@ $(MEMSTATS_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(MEMSTATS_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
asynclook$(EXEEXT): $(ASYNCLOOK_OBJ_LINK) libunbound.la
|
||||
$(LINK) -o $@ $(ASYNCLOOK_OBJ_LINK) -L. -L.libs -lunbound $(SSLLIB) $(LIBS)
|
||||
|
||||
streamtcp$(EXEEXT): $(STREAMTCP_OBJ_LINK)
|
||||
$(LINK) -o $@ $(STREAMTCP_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(STREAMTCP_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
dohclient$(EXEEXT): $(DOHCLIENT_OBJ_LINK)
|
||||
$(LINK) -o $@ $(DOHCLIENT_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(DOHCLIENT_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
perf$(EXEEXT): $(PERF_OBJ_LINK)
|
||||
$(LINK) -o $@ $(PERF_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(PERF_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
delayer$(EXEEXT): $(DELAYER_OBJ_LINK)
|
||||
$(LINK) -o $@ $(DELAYER_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(DELAYER_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
signit$(EXEEXT): testcode/signit.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) @PTHREAD_CFLAGS_ONLY@ -o $@ testcode/signit.c $(LDFLAGS) -lldns $(SSLLIB) $(LIBS)
|
||||
|
|
@ -423,7 +423,7 @@ dnstap/dnstap.pb-c.c dnstap/dnstap.pb-c.h: $(srcdir)/dnstap/dnstap.proto
|
|||
$(PROTOC_C) --c_out=. --proto_path=$(srcdir) $(srcdir)/dnstap/dnstap.proto
|
||||
|
||||
unbound-dnstap-socket$(EXEEXT): $(DNSTAP_SOCKET_OBJ_LINK)
|
||||
$(LINK) -o $@ $(DNSTAP_SOCKET_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
$(LINK) -o $@ $(DNSTAP_SOCKET_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
dnstap.pb-c.lo dnstap.pb-c.o: dnstap/dnstap.pb-c.c dnstap/dnstap.pb-c.h
|
||||
dtstream.lo dtstream.o: $(srcdir)/dnstap/dtstream.c config.h $(srcdir)/dnstap/dtstream.h
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
# Copyright 2009, Wouter Wijngaards, NLnet Labs.
|
||||
# BSD licensed.
|
||||
#
|
||||
# Version 35
|
||||
# Version 37
|
||||
# 2021-01-05 fix defun for aclocal
|
||||
# 2021-01-05 autoconf 2.70 autoupdate and fixes, no AC_TRY_COMPILE
|
||||
# 2020-08-24 Use EVP_sha256 instead of HMAC_Update (for openssl-3.0.0).
|
||||
# 2016-03-21 Check -ldl -pthread for libcrypto for ldns and openssl 1.1.0.
|
||||
# 2016-03-21 Use HMAC_Update instead of HMAC_CTX_Init (for openssl-1.1.0).
|
||||
|
|
@ -447,15 +449,12 @@ AC_DEFUN([ACX_CHECK_FORMAT_ATTRIBUTE],
|
|||
AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "format" attribute)
|
||||
AC_CACHE_VAL(ac_cv_c_format_attribute,
|
||||
[ac_cv_c_format_attribute=no
|
||||
AC_TRY_COMPILE(
|
||||
[#include <stdio.h>
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
|
||||
void f (char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
void (*pf) (char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
], [
|
||||
]], [[
|
||||
f ("%s", "str");
|
||||
],
|
||||
[ac_cv_c_format_attribute="yes"],
|
||||
[ac_cv_c_format_attribute="no"])
|
||||
]])],[ac_cv_c_format_attribute="yes"],[ac_cv_c_format_attribute="no"])
|
||||
])
|
||||
|
||||
AC_MSG_RESULT($ac_cv_c_format_attribute)
|
||||
|
|
@ -484,14 +483,11 @@ AC_DEFUN([ACX_CHECK_UNUSED_ATTRIBUTE],
|
|||
AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "unused" attribute)
|
||||
AC_CACHE_VAL(ac_cv_c_unused_attribute,
|
||||
[ac_cv_c_unused_attribute=no
|
||||
AC_TRY_COMPILE(
|
||||
[#include <stdio.h>
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
|
||||
void f (char *u __attribute__((unused)));
|
||||
], [
|
||||
]], [[
|
||||
f ("x");
|
||||
],
|
||||
[ac_cv_c_unused_attribute="yes"],
|
||||
[ac_cv_c_unused_attribute="no"])
|
||||
]])],[ac_cv_c_unused_attribute="yes"],[ac_cv_c_unused_attribute="no"])
|
||||
])
|
||||
|
||||
dnl Setup ATTR_UNUSED config.h parts.
|
||||
|
|
@ -548,7 +544,7 @@ dnl as a requirement so that is gets called before LIBTOOL
|
|||
dnl because libtools 'AC_REQUIRE' names are right after this one, before
|
||||
dnl this function contents.
|
||||
AC_REQUIRE([ACX_LIBTOOL_C_PRE])
|
||||
AC_PROG_LIBTOOL
|
||||
LT_INIT
|
||||
])
|
||||
|
||||
dnl Detect if u_char type is defined, otherwise define it.
|
||||
|
|
@ -677,14 +673,14 @@ AC_DEFUN([ACX_SSL_CHECKS], [
|
|||
AC_MSG_CHECKING([for EVP_sha256 in -lcrypto])
|
||||
LIBS="$LIBS -lcrypto"
|
||||
LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto"
|
||||
AC_TRY_LINK(, [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
int EVP_sha256(void);
|
||||
(void)EVP_sha256();
|
||||
], [
|
||||
]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_EVP_SHA256], 1,
|
||||
[If you have EVP_sha256])
|
||||
], [
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
# check if -lwsock32 or -lgdi32 are needed.
|
||||
BAKLIBS="$LIBS"
|
||||
|
|
@ -692,10 +688,10 @@ AC_DEFUN([ACX_SSL_CHECKS], [
|
|||
LIBS="$LIBS -lgdi32 -lws2_32"
|
||||
LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32 -lws2_32"
|
||||
AC_MSG_CHECKING([if -lcrypto needs -lgdi32])
|
||||
AC_TRY_LINK([], [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
int EVP_sha256(void);
|
||||
(void)EVP_sha256();
|
||||
],[
|
||||
]])],[
|
||||
AC_DEFINE([HAVE_EVP_SHA256], 1,
|
||||
[If you have EVP_sha256])
|
||||
AC_MSG_RESULT(yes)
|
||||
|
|
@ -706,10 +702,10 @@ AC_DEFUN([ACX_SSL_CHECKS], [
|
|||
LIBS="$LIBS -ldl"
|
||||
LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
|
||||
AC_MSG_CHECKING([if -lcrypto needs -ldl])
|
||||
AC_TRY_LINK([], [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
int EVP_sha256(void);
|
||||
(void)EVP_sha256();
|
||||
],[
|
||||
]])],[
|
||||
AC_DEFINE([HAVE_EVP_SHA256], 1,
|
||||
[If you have EVP_sha256])
|
||||
AC_MSG_RESULT(yes)
|
||||
|
|
@ -720,10 +716,10 @@ AC_DEFUN([ACX_SSL_CHECKS], [
|
|||
LIBS="$LIBS -ldl -pthread"
|
||||
LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread"
|
||||
AC_MSG_CHECKING([if -lcrypto needs -ldl -pthread])
|
||||
AC_TRY_LINK([], [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
int EVP_sha256(void);
|
||||
(void)EVP_sha256();
|
||||
],[
|
||||
]])],[
|
||||
AC_DEFINE([HAVE_EVP_SHA256], 1,
|
||||
[If you have EVP_sha256])
|
||||
AC_MSG_RESULT(yes)
|
||||
|
|
@ -750,8 +746,7 @@ dnl Checks main header files of SSL.
|
|||
dnl
|
||||
AC_DEFUN([ACX_WITH_SSL],
|
||||
[
|
||||
AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
|
||||
[enable SSL (will check /usr/local/ssl
|
||||
AC_ARG_WITH(ssl, AS_HELP_STRING([--with-ssl=pathname],[enable SSL (will check /usr/local/ssl
|
||||
/usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[
|
||||
],[
|
||||
withval="yes"
|
||||
|
|
@ -769,8 +764,7 @@ dnl Checks main header files of SSL.
|
|||
dnl
|
||||
AC_DEFUN([ACX_WITH_SSL_OPTIONAL],
|
||||
[
|
||||
AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
|
||||
[enable SSL (will check /usr/local/ssl
|
||||
AC_ARG_WITH(ssl, AS_HELP_STRING([--with-ssl=pathname],[enable SSL (will check /usr/local/ssl
|
||||
/usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[
|
||||
],[
|
||||
withval="yes"
|
||||
|
|
@ -1062,7 +1056,7 @@ dnl defines MKDIR_HAS_ONE_ARG
|
|||
AC_DEFUN([ACX_MKDIR_ONE_ARG],
|
||||
[
|
||||
AC_MSG_CHECKING([whether mkdir has one arg])
|
||||
AC_TRY_COMPILE([
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
|
|
@ -1071,14 +1065,12 @@ AC_TRY_COMPILE([
|
|||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
], [
|
||||
]], [[
|
||||
(void)mkdir("directory");
|
||||
],
|
||||
AC_MSG_RESULT(yes)
|
||||
]])],[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(MKDIR_HAS_ONE_ARG, 1, [Define if mkdir has one argument.])
|
||||
,
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
],[AC_MSG_RESULT(no)
|
||||
])
|
||||
])dnl end of ACX_MKDIR_ONE_ARG
|
||||
|
||||
dnl Check for ioctlsocket function. works on mingw32 too.
|
||||
|
|
|
|||
|
|
@ -85,11 +85,11 @@ $ac_distutils_result])
|
|||
|
||||
LIBS="$LIBS $PYTHON_LDFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
|
||||
AC_TRY_LINK([
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <Python.h>
|
||||
],[
|
||||
]],[[
|
||||
Py_Initialize();
|
||||
],[pythonexists=yes],[pythonexists=no])
|
||||
]])],[pythonexists=yes],[pythonexists=no])
|
||||
|
||||
AC_MSG_RESULT([$pythonexists])
|
||||
|
||||
|
|
|
|||
|
|
@ -747,7 +747,8 @@
|
|||
your system. */
|
||||
#undef PTHREAD_CREATE_JOINABLE
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
/* Return type of signal handlers, but autoconf 2.70 says 'your code may
|
||||
safely assume C89 semantics that RETSIGTYPE is void.' */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* if REUSEPORT is enabled by default */
|
||||
|
|
|
|||
45
configure
vendored
45
configure
vendored
|
|
@ -4177,7 +4177,6 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
|
|||
$as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
|
||||
|
||||
|
||||
|
||||
if test "$ac_cv_header_minix_config_h" = "yes"; then
|
||||
|
||||
$as_echo "#define _NETBSD_SOURCE 1" >>confdefs.h
|
||||
|
|
@ -15596,38 +15595,8 @@ $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
|
|||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
|
||||
$as_echo_n "checking return type of signal handlers... " >&6; }
|
||||
if ${ac_cv_type_signal+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return *(signal (0, 0)) (0) == 1;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
ac_cv_type_signal=int
|
||||
else
|
||||
ac_cv_type_signal=void
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
|
||||
$as_echo "$ac_cv_type_signal" >&6; }
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define RETSIGTYPE $ac_cv_type_signal
|
||||
_ACEOF
|
||||
|
||||
$as_echo "#define RETSIGTYPE void" >>confdefs.h
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
|
||||
$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
|
||||
|
|
@ -18288,17 +18257,13 @@ $as_echo_n "checking if libssl needs -lcrypt32... " >&6; }
|
|||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char EVP_sha256 ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return EVP_sha256 ();
|
||||
|
||||
int EVP_sha256(void);
|
||||
(void)EVP_sha256();
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
180
configure.ac
180
configure.ac
|
|
@ -1,6 +1,6 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.56)
|
||||
AC_PREREQ([2.56])
|
||||
sinclude(acx_nlnetlabs.m4)
|
||||
sinclude(ax_pthread.m4)
|
||||
sinclude(acx_python.m4)
|
||||
|
|
@ -12,7 +12,7 @@ sinclude(dnscrypt/dnscrypt.m4)
|
|||
m4_define([VERSION_MAJOR],[1])
|
||||
m4_define([VERSION_MINOR],[13])
|
||||
m4_define([VERSION_MICRO],[1])
|
||||
AC_INIT(unbound, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues, unbound)
|
||||
AC_INIT([unbound],m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]),[unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues],[unbound])
|
||||
AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
|
||||
AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
|
||||
AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
|
||||
|
|
@ -126,7 +126,7 @@ cmdln="`echo $@ | sed -e 's/\\\\/\\\\\\\\/g' | sed -e 's/"/\\\\"/'g`"
|
|||
AC_DEFINE_UNQUOTED(CONFCMDLINE, ["$cmdln"], [Command line arguments used with configure])
|
||||
|
||||
CFLAGS="$CFLAGS"
|
||||
AC_AIX
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
if test "$ac_cv_header_minix_config_h" = "yes"; then
|
||||
AC_DEFINE(_NETBSD_SOURCE,1, [Enable for compile on Minix])
|
||||
fi
|
||||
|
|
@ -167,8 +167,7 @@ else
|
|||
ub_conf_file="C:\\Program Files\\Unbound\\service.conf"
|
||||
fi
|
||||
AC_ARG_WITH([conf_file],
|
||||
AC_HELP_STRING([--with-conf-file=path],
|
||||
[Pathname to the Unbound configuration file]),
|
||||
AS_HELP_STRING([--with-conf-file=path],[Pathname to the Unbound configuration file]),
|
||||
[ub_conf_file="$withval"])
|
||||
AC_SUBST(ub_conf_file)
|
||||
ACX_ESCAPE_BACKSLASH($ub_conf_file, hdr_config)
|
||||
|
|
@ -178,8 +177,7 @@ AC_SUBST(ub_conf_dir)
|
|||
|
||||
# Determine run, chroot directory and pidfile locations
|
||||
AC_ARG_WITH(run-dir,
|
||||
AC_HELP_STRING([--with-run-dir=path],
|
||||
[set default directory to chdir to (by default dir part of cfg file)]),
|
||||
AS_HELP_STRING([--with-run-dir=path],[set default directory to chdir to (by default dir part of cfg file)]),
|
||||
UNBOUND_RUN_DIR="$withval",
|
||||
if test $on_mingw = no; then
|
||||
UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`
|
||||
|
|
@ -192,8 +190,7 @@ ACX_ESCAPE_BACKSLASH($UNBOUND_RUN_DIR, hdr_run)
|
|||
AC_DEFINE_UNQUOTED(RUN_DIR, ["$hdr_run"], [Directory to chdir to])
|
||||
|
||||
AC_ARG_WITH(chroot-dir,
|
||||
AC_HELP_STRING([--with-chroot-dir=path],
|
||||
[set default directory to chroot to (by default same as run-dir)]),
|
||||
AS_HELP_STRING([--with-chroot-dir=path],[set default directory to chroot to (by default same as run-dir)]),
|
||||
UNBOUND_CHROOT_DIR="$withval",
|
||||
if test $on_mingw = no; then
|
||||
UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR"
|
||||
|
|
@ -206,16 +203,14 @@ ACX_ESCAPE_BACKSLASH($UNBOUND_CHROOT_DIR, hdr_chroot)
|
|||
AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$hdr_chroot"], [Directory to chroot to])
|
||||
|
||||
AC_ARG_WITH(share-dir,
|
||||
AC_HELP_STRING([--with-share-dir=path],
|
||||
[set default directory with shared data (by default same as share/unbound)]),
|
||||
AS_HELP_STRING([--with-share-dir=path],[set default directory with shared data (by default same as share/unbound)]),
|
||||
UNBOUND_SHARE_DIR="$withval",
|
||||
UNBOUND_SHARE_DIR="$UNBOUND_RUN_DIR")
|
||||
AC_SUBST(UNBOUND_SHARE_DIR)
|
||||
AC_DEFINE_UNQUOTED(SHARE_DIR, ["$UNBOUND_SHARE_DIR"], [Shared data])
|
||||
|
||||
AC_ARG_WITH(pidfile,
|
||||
AC_HELP_STRING([--with-pidfile=filename],
|
||||
[set default pathname to unbound pidfile (default run-dir/unbound.pid)]),
|
||||
AS_HELP_STRING([--with-pidfile=filename],[set default pathname to unbound pidfile (default run-dir/unbound.pid)]),
|
||||
UNBOUND_PIDFILE="$withval",
|
||||
if test $on_mingw = no; then
|
||||
UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid"
|
||||
|
|
@ -228,8 +223,7 @@ ACX_ESCAPE_BACKSLASH($UNBOUND_PIDFILE, hdr_pid)
|
|||
AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location])
|
||||
|
||||
AC_ARG_WITH(rootkey-file,
|
||||
AC_HELP_STRING([--with-rootkey-file=filename],
|
||||
[set default pathname to root key file (default run-dir/root.key). This file is read and written.]),
|
||||
AS_HELP_STRING([--with-rootkey-file=filename],[set default pathname to root key file (default run-dir/root.key). This file is read and written.]),
|
||||
UNBOUND_ROOTKEY_FILE="$withval",
|
||||
if test $on_mingw = no; then
|
||||
UNBOUND_ROOTKEY_FILE="$UNBOUND_RUN_DIR/root.key"
|
||||
|
|
@ -242,8 +236,7 @@ ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTKEY_FILE, hdr_rkey)
|
|||
AC_DEFINE_UNQUOTED(ROOT_ANCHOR_FILE, ["$hdr_rkey"], [default rootkey location])
|
||||
|
||||
AC_ARG_WITH(rootcert-file,
|
||||
AC_HELP_STRING([--with-rootcert-file=filename],
|
||||
[set default pathname to root update certificate file (default run-dir/icannbundle.pem). This file need not exist if you are content with the builtin.]),
|
||||
AS_HELP_STRING([--with-rootcert-file=filename],[set default pathname to root update certificate file (default run-dir/icannbundle.pem). This file need not exist if you are content with the builtin.]),
|
||||
UNBOUND_ROOTCERT_FILE="$withval",
|
||||
if test $on_mingw = no; then
|
||||
UNBOUND_ROOTCERT_FILE="$UNBOUND_RUN_DIR/icannbundle.pem"
|
||||
|
|
@ -256,8 +249,7 @@ ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTCERT_FILE, hdr_rpem)
|
|||
AC_DEFINE_UNQUOTED(ROOT_CERT_FILE, ["$hdr_rpem"], [default rootcert location])
|
||||
|
||||
AC_ARG_WITH(username,
|
||||
AC_HELP_STRING([--with-username=user],
|
||||
[set default user that unbound changes to (default user is unbound)]),
|
||||
AS_HELP_STRING([--with-username=user],[set default user that unbound changes to (default user is unbound)]),
|
||||
UNBOUND_USERNAME="$withval",
|
||||
UNBOUND_USERNAME="unbound")
|
||||
AC_SUBST(UNBOUND_USERNAME)
|
||||
|
|
@ -269,7 +261,7 @@ AC_DEFINE_UNQUOTED(RSRC_PACKAGE_VERSION, [$wnvs], [version number for resource f
|
|||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_LANG_C
|
||||
AC_LANG([C])
|
||||
# allow user to override the -g -O2 flags.
|
||||
default_cflags=no
|
||||
if test "x$CFLAGS" = "x" ; then
|
||||
|
|
@ -282,8 +274,8 @@ ACX_DEPFLAG
|
|||
ACX_DETERMINE_EXT_FLAGS_UNBOUND
|
||||
|
||||
# debug mode flags warnings
|
||||
AC_ARG_ENABLE(checking, AC_HELP_STRING([--enable-checking], [Enable warnings, asserts, makefile-dependencies]))
|
||||
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [same as enable-checking]))
|
||||
AC_ARG_ENABLE(checking, AS_HELP_STRING([--enable-checking],[Enable warnings, asserts, makefile-dependencies]))
|
||||
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[same as enable-checking]))
|
||||
if test "$enable_debug" = "yes"; then debug_enabled="$enable_debug";
|
||||
else debug_enabled="$enable_checking"; fi
|
||||
AC_SUBST(debug_enabled)
|
||||
|
|
@ -317,14 +309,11 @@ AC_DEFUN([CHECK_WEAK_ATTRIBUTE],
|
|||
AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "weak" attribute)
|
||||
AC_CACHE_VAL(ac_cv_c_weak_attribute,
|
||||
[ac_cv_c_weak_attribute=no
|
||||
AC_TRY_COMPILE(
|
||||
[ #include <stdio.h>
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h>
|
||||
__attribute__((weak)) void f(int x) { printf("%d", x); }
|
||||
], [
|
||||
]], [[
|
||||
f(1);
|
||||
],
|
||||
[ac_cv_c_weak_attribute="yes"],
|
||||
[ac_cv_c_weak_attribute="no"])
|
||||
]])],[ac_cv_c_weak_attribute="yes"],[ac_cv_c_weak_attribute="no"])
|
||||
])
|
||||
|
||||
AC_MSG_RESULT($ac_cv_c_weak_attribute)
|
||||
|
|
@ -341,14 +330,11 @@ AC_DEFUN([CHECK_NORETURN_ATTRIBUTE],
|
|||
AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "noreturn" attribute)
|
||||
AC_CACHE_VAL(ac_cv_c_noreturn_attribute,
|
||||
[ac_cv_c_noreturn_attribute=no
|
||||
AC_TRY_COMPILE(
|
||||
[ #include <stdio.h>
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h>
|
||||
__attribute__((noreturn)) void f(int x) { printf("%d", x); }
|
||||
], [
|
||||
]], [[
|
||||
f(1);
|
||||
],
|
||||
[ac_cv_c_noreturn_attribute="yes"],
|
||||
[ac_cv_c_noreturn_attribute="no"])
|
||||
]])],[ac_cv_c_noreturn_attribute="yes"],[ac_cv_c_noreturn_attribute="no"])
|
||||
])
|
||||
|
||||
AC_MSG_RESULT($ac_cv_c_noreturn_attribute)
|
||||
|
|
@ -386,7 +372,7 @@ EOF
|
|||
fi
|
||||
])
|
||||
|
||||
AC_PROG_LEX
|
||||
AC_PROG_LEX([noyywrap])
|
||||
if test "$LEX" != "" -a "$LEX" != ":"; then
|
||||
ACX_YYLEX_DESTROY
|
||||
fi
|
||||
|
|
@ -495,7 +481,7 @@ fi
|
|||
# check some functions of the OS before linking libs (while still runnable).
|
||||
AC_FUNC_CHOWN
|
||||
AC_FUNC_FORK
|
||||
AC_TYPE_SIGNAL
|
||||
AC_DEFINE(RETSIGTYPE,void,[Return type of signal handlers, but autoconf 2.70 says 'your code may safely assume C89 semantics that RETSIGTYPE is void.'])
|
||||
AC_FUNC_FSEEKO
|
||||
ACX_SYS_LARGEFILE
|
||||
ACX_CHECK_NONBLOCKING_BROKEN
|
||||
|
|
@ -514,14 +500,11 @@ sinclude(systemd.m4)
|
|||
# Include systemd.m4 - end
|
||||
|
||||
# set memory allocation checking if requested
|
||||
AC_ARG_ENABLE(alloc-checks, AC_HELP_STRING([--enable-alloc-checks],
|
||||
[ enable to memory allocation statistics, for debug purposes ]),
|
||||
AC_ARG_ENABLE(alloc-checks, AS_HELP_STRING([--enable-alloc-checks],[ enable to memory allocation statistics, for debug purposes ]),
|
||||
, )
|
||||
AC_ARG_ENABLE(alloc-lite, AC_HELP_STRING([--enable-alloc-lite],
|
||||
[ enable for lightweight alloc assertions, for debug purposes ]),
|
||||
AC_ARG_ENABLE(alloc-lite, AS_HELP_STRING([--enable-alloc-lite],[ enable for lightweight alloc assertions, for debug purposes ]),
|
||||
, )
|
||||
AC_ARG_ENABLE(alloc-nonregional, AC_HELP_STRING([--enable-alloc-nonregional],
|
||||
[ enable nonregional allocs, slow but exposes regional allocations to other memory purifiers, for debug purposes ]),
|
||||
AC_ARG_ENABLE(alloc-nonregional, AS_HELP_STRING([--enable-alloc-nonregional],[ enable nonregional allocs, slow but exposes regional allocations to other memory purifiers, for debug purposes ]),
|
||||
, )
|
||||
if test x_$enable_alloc_nonregional = x_yes; then
|
||||
AC_DEFINE(UNBOUND_ALLOC_NONREGIONAL, 1, [use malloc not regions, for debug use])
|
||||
|
|
@ -565,8 +548,7 @@ else
|
|||
# check this first, so that the pthread lib does not get linked in via
|
||||
# libssl or libpython, and thus distorts the tests, and we end up using
|
||||
# the non-threadsafe C libraries.
|
||||
AC_ARG_WITH(pthreads, AC_HELP_STRING([--with-pthreads],
|
||||
[use pthreads library, or --without-pthreads to disable threading support.]),
|
||||
AC_ARG_WITH(pthreads, AS_HELP_STRING([--with-pthreads],[use pthreads library, or --without-pthreads to disable threading support.]),
|
||||
[ ],[ withval="yes" ])
|
||||
ub_have_pthreads=no
|
||||
if test x_$withval != x_no; then
|
||||
|
|
@ -613,12 +595,11 @@ int main(void) {return 0;}
|
|||
fi
|
||||
|
||||
# check solaris thread library
|
||||
AC_ARG_WITH(solaris-threads, AC_HELP_STRING([--with-solaris-threads],
|
||||
[use solaris native thread library.]), [ ],[ withval="no" ])
|
||||
AC_ARG_WITH(solaris-threads, AS_HELP_STRING([--with-solaris-threads],[use solaris native thread library.]), [ ],[ withval="no" ])
|
||||
ub_have_sol_threads=no
|
||||
if test x_$withval != x_no; then
|
||||
if test x_$ub_have_pthreads != x_no; then
|
||||
AC_WARN([Have pthreads already, ignoring --with-solaris-threads])
|
||||
AC_MSG_WARN([Have pthreads already, ignoring --with-solaris-threads])
|
||||
else
|
||||
AC_SEARCH_LIBS(thr_create, [thread],
|
||||
[
|
||||
|
|
@ -628,7 +609,7 @@ if test x_$withval != x_no; then
|
|||
[CFLAGS="$CFLAGS -D_REENTRANT"])
|
||||
ub_have_sol_threads=yes
|
||||
] , [
|
||||
AC_ERROR([no solaris threads found.])
|
||||
AC_MSG_ERROR([no solaris threads found.])
|
||||
])
|
||||
fi
|
||||
fi
|
||||
|
|
@ -636,7 +617,7 @@ fi
|
|||
fi # end of non-mingw check of thread libraries
|
||||
|
||||
# Check for SYSLOG_FACILITY
|
||||
AC_ARG_WITH(syslog-facility, AC_HELP_STRING([--with-syslog-facility=LOCAL0 - LOCAL7], [ set SYSLOG_FACILITY, default DAEMON ]),
|
||||
AC_ARG_WITH(syslog-facility, AS_HELP_STRING([--with-syslog-facility=LOCAL0 - LOCAL7],[ set SYSLOG_FACILITY, default DAEMON ]),
|
||||
[ UNBOUND_SYSLOG_FACILITY="$withval" ], [])
|
||||
case "${UNBOUND_SYSLOG_FACILITY}" in
|
||||
|
||||
|
|
@ -649,8 +630,7 @@ AC_DEFINE_UNQUOTED(UB_SYSLOG_FACILITY,${UNBOUND_SYSLOG_FACILITY},[the SYSLOG_FAC
|
|||
|
||||
# Check for dynamic library module
|
||||
AC_ARG_WITH(dynlibmodule,
|
||||
AC_HELP_STRING([--with-dynlibmodule],
|
||||
[build dynamic library module, or --without-dynlibmodule to disable it. (default=no)]),
|
||||
AS_HELP_STRING([--with-dynlibmodule],[build dynamic library module, or --without-dynlibmodule to disable it. (default=no)]),
|
||||
[], [ withval="no" ])
|
||||
|
||||
if test x_$withval != x_no; then
|
||||
|
|
@ -671,8 +651,7 @@ fi
|
|||
|
||||
# Check for PyUnbound
|
||||
AC_ARG_WITH(pyunbound,
|
||||
AC_HELP_STRING([--with-pyunbound],
|
||||
[build PyUnbound, or --without-pyunbound to skip it. (default=no)]),
|
||||
AS_HELP_STRING([--with-pyunbound],[build PyUnbound, or --without-pyunbound to skip it. (default=no)]),
|
||||
[], [ withval="no" ])
|
||||
|
||||
ub_test_python=no
|
||||
|
|
@ -684,8 +663,7 @@ fi
|
|||
|
||||
# Check for Python module
|
||||
AC_ARG_WITH(pythonmodule,
|
||||
AC_HELP_STRING([--with-pythonmodule],
|
||||
[build Python module, or --without-pythonmodule to disable script engine. (default=no)]),
|
||||
AS_HELP_STRING([--with-pythonmodule],[build Python module, or --without-pythonmodule to disable script engine. (default=no)]),
|
||||
[], [ withval="no" ])
|
||||
|
||||
ub_with_pythonmod=no
|
||||
|
|
@ -703,7 +681,7 @@ if test x_$ub_test_python != x_no; then
|
|||
AC_PYTHON_DEVEL
|
||||
if test ! -z "$PYTHON_VERSION"; then
|
||||
if test `$PYTHON -c "print('$PYTHON_VERSION' >= '2.4.0')"` = "False"; then
|
||||
AC_ERROR([Python version >= 2.4.0 is required])
|
||||
AC_MSG_ERROR([Python version >= 2.4.0 is required])
|
||||
fi
|
||||
|
||||
[PY_MAJOR_VERSION="`$PYTHON -c \"import sys; print(sys.version_info[0])\"`"]
|
||||
|
|
@ -731,7 +709,7 @@ if test x_$ub_test_python != x_no; then
|
|||
|
||||
# Check for SWIG
|
||||
ub_have_swig=no
|
||||
AC_ARG_ENABLE(swig-version-check, AC_HELP_STRING([--disable-swig-version-check], [Disable swig version check to build python modules with older swig even though that is unreliable]))
|
||||
AC_ARG_ENABLE(swig-version-check, AS_HELP_STRING([--disable-swig-version-check],[Disable swig version check to build python modules with older swig even though that is unreliable]))
|
||||
if test "$enable_swig_version_check" = "yes"; then
|
||||
AC_PROG_SWIG(2.0.1)
|
||||
else
|
||||
|
|
@ -739,7 +717,7 @@ if test x_$ub_test_python != x_no; then
|
|||
fi
|
||||
AC_MSG_CHECKING(SWIG)
|
||||
if test ! -x "$SWIG"; then
|
||||
AC_ERROR([failed to find swig tool, install it, or do not build Python module and PyUnbound])
|
||||
AC_MSG_ERROR([failed to find swig tool, install it, or do not build Python module and PyUnbound])
|
||||
else
|
||||
AC_DEFINE(HAVE_SWIG, 1, [Define if you have Swig libraries and header files.])
|
||||
AC_SUBST(swig, "$SWIG")
|
||||
|
|
@ -794,8 +772,7 @@ AC_SUBST(CONFIG_DATE)
|
|||
|
||||
# libnss
|
||||
USE_NSS="no"
|
||||
AC_ARG_WITH([nss], AC_HELP_STRING([--with-nss=path],
|
||||
[use libnss instead of openssl, installed at path.]),
|
||||
AC_ARG_WITH([nss], AS_HELP_STRING([--with-nss=path],[use libnss instead of openssl, installed at path.]),
|
||||
[
|
||||
USE_NSS="yes"
|
||||
AC_DEFINE(HAVE_NSS, 1, [Use libnss for crypto])
|
||||
|
|
@ -817,8 +794,7 @@ AC_ARG_WITH([nss], AC_HELP_STRING([--with-nss=path],
|
|||
|
||||
# libnettle
|
||||
USE_NETTLE="no"
|
||||
AC_ARG_WITH([nettle], AC_HELP_STRING([--with-nettle=path],
|
||||
[use libnettle as crypto library, installed at path.]),
|
||||
AC_ARG_WITH([nettle], AS_HELP_STRING([--with-nettle=path],[use libnettle as crypto library, installed at path.]),
|
||||
[
|
||||
USE_NETTLE="yes"
|
||||
AC_DEFINE(HAVE_NETTLE, 1, [Use libnettle for crypto])
|
||||
|
|
@ -850,7 +826,10 @@ AC_SUBST(PC_CRYPTO_DEPENDENCY)
|
|||
BAKLIBS="$LIBS"
|
||||
LIBS="-lssl $LIBS"
|
||||
AC_MSG_CHECKING([if libssl needs -lcrypt32])
|
||||
AC_TRY_LINK_FUNC([EVP_sha256], [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
int EVP_sha256(void);
|
||||
(void)EVP_sha256();
|
||||
]])], [
|
||||
AC_MSG_RESULT([no])
|
||||
LIBS="$BAKLIBS"
|
||||
], [
|
||||
|
|
@ -938,7 +917,7 @@ fi
|
|||
AC_SUBST(SSLLIB)
|
||||
|
||||
# libbsd
|
||||
AC_ARG_WITH([libbsd], AC_HELP_STRING([--with-libbsd], [Use portable libbsd functions]), [
|
||||
AC_ARG_WITH([libbsd], AS_HELP_STRING([--with-libbsd],[Use portable libbsd functions]), [
|
||||
AC_CHECK_HEADERS([bsd/string.h bsd/stdlib.h],,, [AC_INCLUDES_DEFAULT])
|
||||
if test "x$ac_cv_header_bsd_string_h" = xyes -a "x$ac_cv_header_bsd_stdlib_h" = xyes; then
|
||||
for func in strlcpy strlcat arc4random arc4random_uniform reallocarray; do
|
||||
|
|
@ -951,7 +930,7 @@ AC_ARG_WITH([libbsd], AC_HELP_STRING([--with-libbsd], [Use portable libbsd funct
|
|||
fi
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(sha1, AC_HELP_STRING([--disable-sha1], [Disable SHA1 RRSIG support, does not disable nsec3 support]))
|
||||
AC_ARG_ENABLE(sha1, AS_HELP_STRING([--disable-sha1],[Disable SHA1 RRSIG support, does not disable nsec3 support]))
|
||||
case "$enable_sha1" in
|
||||
no)
|
||||
;;
|
||||
|
|
@ -961,7 +940,7 @@ case "$enable_sha1" in
|
|||
esac
|
||||
|
||||
|
||||
AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support]))
|
||||
AC_ARG_ENABLE(sha2, AS_HELP_STRING([--disable-sha2],[Disable SHA256 and SHA512 RRSIG support]))
|
||||
case "$enable_sha2" in
|
||||
no)
|
||||
;;
|
||||
|
|
@ -970,7 +949,7 @@ case "$enable_sha2" in
|
|||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_ENABLE(subnet, AC_HELP_STRING([--enable-subnet], [Enable client subnet]))
|
||||
AC_ARG_ENABLE(subnet, AS_HELP_STRING([--enable-subnet],[Enable client subnet]))
|
||||
case "$enable_subnet" in
|
||||
yes)
|
||||
AC_DEFINE([CLIENT_SUBNET], [1], [Define this to enable client subnet option.])
|
||||
|
|
@ -1081,7 +1060,7 @@ fi
|
|||
AC_MSG_RESULT($ac_cv_c_gost_works)
|
||||
])dnl
|
||||
|
||||
AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support]))
|
||||
AC_ARG_ENABLE(gost, AS_HELP_STRING([--disable-gost],[Disable GOST support]))
|
||||
use_gost="no"
|
||||
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
|
||||
case "$enable_gost" in
|
||||
|
|
@ -1099,7 +1078,7 @@ case "$enable_gost" in
|
|||
esac
|
||||
fi dnl !USE_NSS && !USE_NETTLE
|
||||
|
||||
AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--disable-ecdsa], [Disable ECDSA support]))
|
||||
AC_ARG_ENABLE(ecdsa, AS_HELP_STRING([--disable-ecdsa],[Disable ECDSA support]))
|
||||
use_ecdsa="no"
|
||||
case "$enable_ecdsa" in
|
||||
no)
|
||||
|
|
@ -1131,7 +1110,7 @@ case "$enable_ecdsa" in
|
|||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_ENABLE(dsa, AC_HELP_STRING([--disable-dsa], [Disable DSA support]))
|
||||
AC_ARG_ENABLE(dsa, AS_HELP_STRING([--disable-dsa],[Disable DSA support]))
|
||||
use_dsa="no"
|
||||
case "$enable_dsa" in
|
||||
yes)
|
||||
|
|
@ -1171,7 +1150,7 @@ AC_INCLUDES_DEFAULT
|
|||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_ENABLE(ed25519, AC_HELP_STRING([--disable-ed25519], [Disable ED25519 support]))
|
||||
AC_ARG_ENABLE(ed25519, AS_HELP_STRING([--disable-ed25519],[Disable ED25519 support]))
|
||||
use_ed25519="no"
|
||||
case "$enable_ed25519" in
|
||||
no)
|
||||
|
|
@ -1194,7 +1173,7 @@ case "$enable_ed25519" in
|
|||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_ENABLE(ed448, AC_HELP_STRING([--disable-ed448], [Disable ED448 support]))
|
||||
AC_ARG_ENABLE(ed448, AS_HELP_STRING([--disable-ed448],[Disable ED448 support]))
|
||||
use_ed448="no"
|
||||
case "$enable_ed448" in
|
||||
no)
|
||||
|
|
@ -1214,7 +1193,7 @@ case "$enable_ed448" in
|
|||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_ENABLE(event-api, AC_HELP_STRING([--enable-event-api], [Enable (experimental) pluggable event base libunbound API installed to unbound-event.h]))
|
||||
AC_ARG_ENABLE(event-api, AS_HELP_STRING([--enable-event-api],[Enable (experimental) pluggable event base libunbound API installed to unbound-event.h]))
|
||||
case "$enable_event_api" in
|
||||
yes)
|
||||
AC_SUBST(UNBOUND_EVENT_INSTALL, [unbound-event-install])
|
||||
|
|
@ -1224,7 +1203,7 @@ case "$enable_event_api" in
|
|||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_ENABLE(tfo-client, AC_HELP_STRING([--enable-tfo-client], [Enable TCP Fast Open for client mode]))
|
||||
AC_ARG_ENABLE(tfo-client, AS_HELP_STRING([--enable-tfo-client],[Enable TCP Fast Open for client mode]))
|
||||
case "$enable_tfo_client" in
|
||||
yes)
|
||||
case `uname` in
|
||||
|
|
@ -1248,7 +1227,7 @@ case "$enable_tfo_client" in
|
|||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_ENABLE(tfo-server, AC_HELP_STRING([--enable-tfo-server], [Enable TCP Fast Open for server mode]))
|
||||
AC_ARG_ENABLE(tfo-server, AS_HELP_STRING([--enable-tfo-server],[Enable TCP Fast Open for server mode]))
|
||||
case "$enable_tfo_server" in
|
||||
yes)
|
||||
AC_CHECK_DECL([TCP_FASTOPEN], [AC_MSG_WARN([Check the platform specific TFO kernel parameters are correctly configured to support server mode TFO])], [AC_MSG_ERROR([TCP Fast Open is not available for server mode: please rerun without --enable-tfo-server])], [AC_INCLUDES_DEFAULT
|
||||
|
|
@ -1261,8 +1240,7 @@ case "$enable_tfo_server" in
|
|||
esac
|
||||
|
||||
# check for libevent
|
||||
AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname],
|
||||
[use libevent (will check /usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr or you can specify an explicit path). Slower, but allows use of large outgoing port ranges.]),
|
||||
AC_ARG_WITH(libevent, AS_HELP_STRING([--with-libevent=pathname],[use libevent (will check /usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr or you can specify an explicit path). Slower, but allows use of large outgoing port ranges.]),
|
||||
[ ],[ with_libevent="no" ])
|
||||
if test "x_$with_libevent" != x_no; then
|
||||
AC_DEFINE([USE_LIBEVENT], [1], [Define if you enable libevent])
|
||||
|
|
@ -1356,8 +1334,7 @@ else
|
|||
fi
|
||||
|
||||
# check for libexpat
|
||||
AC_ARG_WITH(libexpat, AC_HELP_STRING([--with-libexpat=path],
|
||||
[specify explicit path for libexpat.]),
|
||||
AC_ARG_WITH(libexpat, AS_HELP_STRING([--with-libexpat=path],[specify explicit path for libexpat.]),
|
||||
[ ],[ withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" ])
|
||||
AC_MSG_CHECKING(for libexpat)
|
||||
found_libexpat="no"
|
||||
|
|
@ -1374,7 +1351,7 @@ for dir in $withval ; do
|
|||
fi
|
||||
done
|
||||
if test x_$found_libexpat != x_yes; then
|
||||
AC_ERROR([Could not find libexpat, expat.h])
|
||||
AC_MSG_ERROR([Could not find libexpat, expat.h])
|
||||
fi
|
||||
AC_CHECK_HEADERS([expat.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_DECLS([XML_StopParser], [], [], [AC_INCLUDES_DEFAULT
|
||||
|
|
@ -1382,8 +1359,7 @@ AC_CHECK_DECLS([XML_StopParser], [], [], [AC_INCLUDES_DEFAULT
|
|||
])
|
||||
|
||||
# hiredis (redis C client for cachedb)
|
||||
AC_ARG_WITH(libhiredis, AC_HELP_STRING([--with-libhiredis=path],
|
||||
[specify explicit path for libhiredis.]),
|
||||
AC_ARG_WITH(libhiredis, AS_HELP_STRING([--with-libhiredis=path],[specify explicit path for libhiredis.]),
|
||||
[ ],[ withval="no" ])
|
||||
found_libhiredis="no"
|
||||
if test x_$withval = x_yes -o x_$withval != x_no; then
|
||||
|
|
@ -1406,7 +1382,7 @@ if test x_$withval = x_yes -o x_$withval != x_no; then
|
|||
fi
|
||||
done
|
||||
if test x_$found_libhiredis != x_yes; then
|
||||
AC_ERROR([Could not find libhiredis, hiredis.h])
|
||||
AC_MSG_ERROR([Could not find libhiredis, hiredis.h])
|
||||
fi
|
||||
AC_CHECK_HEADERS([hiredis/hiredis.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_DECLS([redisConnect], [], [], [AC_INCLUDES_DEFAULT
|
||||
|
|
@ -1415,8 +1391,7 @@ if test x_$withval = x_yes -o x_$withval != x_no; then
|
|||
fi
|
||||
|
||||
# nghttp2
|
||||
AC_ARG_WITH(libnghttp2, AC_HELP_STRING([--with-libnghttp2=path],
|
||||
[specify explicit path for libnghttp2.]),
|
||||
AC_ARG_WITH(libnghttp2, AS_HELP_STRING([--with-libnghttp2=path],[specify explicit path for libnghttp2.]),
|
||||
[ ],[ withval="no" ])
|
||||
found_libnghttp2="no"
|
||||
if test x_$withval = x_yes -o x_$withval != x_no; then
|
||||
|
|
@ -1439,7 +1414,7 @@ if test x_$withval = x_yes -o x_$withval != x_no; then
|
|||
fi
|
||||
done
|
||||
if test x_$found_libnghttp2 != x_yes; then
|
||||
AC_ERROR([Could not find libnghttp2, nghttp2.h])
|
||||
AC_MSG_ERROR([Could not find libnghttp2, nghttp2.h])
|
||||
fi
|
||||
AC_CHECK_HEADERS([nghttp2/nghttp2.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_DECLS([nghttp2_session_server_new], [], [], [AC_INCLUDES_DEFAULT
|
||||
|
|
@ -1450,8 +1425,7 @@ fi
|
|||
# set static linking for uninstalled libraries if requested
|
||||
AC_SUBST(staticexe)
|
||||
staticexe=""
|
||||
AC_ARG_ENABLE(static-exe, AC_HELP_STRING([--enable-static-exe],
|
||||
[ enable to compile executables statically against (event) uninstalled libs, for debug purposes ]),
|
||||
AC_ARG_ENABLE(static-exe, AS_HELP_STRING([--enable-static-exe],[ enable to compile executables statically against (event) uninstalled libs, for debug purposes ]),
|
||||
, )
|
||||
if test x_$enable_static_exe = x_yes; then
|
||||
staticexe="-static"
|
||||
|
|
@ -1468,8 +1442,7 @@ if test x_$enable_static_exe = x_yes; then
|
|||
fi
|
||||
|
||||
# set full static linking if requested
|
||||
AC_ARG_ENABLE(fully-static, AC_HELP_STRING([--enable-fully-static],
|
||||
[ enable to compile fully static ]),
|
||||
AC_ARG_ENABLE(fully-static, AS_HELP_STRING([--enable-fully-static],[ enable to compile fully static ]),
|
||||
, )
|
||||
if test x_$enable_fully_static = x_yes; then
|
||||
staticexe="-all-static"
|
||||
|
|
@ -1485,8 +1458,7 @@ if test x_$enable_fully_static = x_yes; then
|
|||
fi
|
||||
|
||||
# set lock checking if requested
|
||||
AC_ARG_ENABLE(lock_checks, AC_HELP_STRING([--enable-lock-checks],
|
||||
[ enable to check lock and unlock calls, for debug purposes ]),
|
||||
AC_ARG_ENABLE(lock_checks, AS_HELP_STRING([--enable-lock-checks],[ enable to check lock and unlock calls, for debug purposes ]),
|
||||
, )
|
||||
if test x_$enable_lock_checks = x_yes; then
|
||||
AC_DEFINE(ENABLE_LOCK_CHECKS, 1, [Define if you want to use debug lock checking (slow).])
|
||||
|
|
@ -1728,7 +1700,7 @@ AC_SUBST(LIBOBJ_WITHOUT_CTIME)
|
|||
AC_REPLACE_FUNCS(ctime_r)
|
||||
AC_REPLACE_FUNCS(strsep)
|
||||
|
||||
AC_ARG_ENABLE(allsymbols, AC_HELP_STRING([--enable-allsymbols], [export all symbols from libunbound and link binaries to it, smaller install size but libunbound export table is polluted by internal symbols]))
|
||||
AC_ARG_ENABLE(allsymbols, AS_HELP_STRING([--enable-allsymbols],[export all symbols from libunbound and link binaries to it, smaller install size but libunbound export table is polluted by internal symbols]))
|
||||
case "$enable_allsymbols" in
|
||||
yes)
|
||||
COMMON_OBJ_ALL_SYMBOLS=""
|
||||
|
|
@ -1794,7 +1766,7 @@ dnsc_DNSCRYPT([
|
|||
)
|
||||
|
||||
# check for cachedb if requested
|
||||
AC_ARG_ENABLE(cachedb, AC_HELP_STRING([--enable-cachedb], [enable cachedb module that can use external cache storage]))
|
||||
AC_ARG_ENABLE(cachedb, AS_HELP_STRING([--enable-cachedb],[enable cachedb module that can use external cache storage]))
|
||||
# turn on cachedb when hiredis support is enabled.
|
||||
if test "$found_libhiredis" = "yes"; then enable_cachedb="yes"; fi
|
||||
case "$enable_cachedb" in
|
||||
|
|
@ -1807,7 +1779,7 @@ case "$enable_cachedb" in
|
|||
esac
|
||||
|
||||
# check for ipsecmod if requested
|
||||
AC_ARG_ENABLE(ipsecmod, AC_HELP_STRING([--enable-ipsecmod], [Enable ipsecmod module that facilitates opportunistic IPsec]))
|
||||
AC_ARG_ENABLE(ipsecmod, AS_HELP_STRING([--enable-ipsecmod],[Enable ipsecmod module that facilitates opportunistic IPsec]))
|
||||
case "$enable_ipsecmod" in
|
||||
yes)
|
||||
AC_DEFINE([USE_IPSECMOD], [1], [Define to 1 to use ipsecmod support.])
|
||||
|
|
@ -1822,7 +1794,7 @@ case "$enable_ipsecmod" in
|
|||
esac
|
||||
|
||||
# check for ipset if requested
|
||||
AC_ARG_ENABLE(ipset, AC_HELP_STRING([--enable-ipset], [enable ipset module]))
|
||||
AC_ARG_ENABLE(ipset, AS_HELP_STRING([--enable-ipset],[enable ipset module]))
|
||||
case "$enable_ipset" in
|
||||
yes)
|
||||
AC_DEFINE([USE_IPSET], [1], [Define to 1 to use ipset support])
|
||||
|
|
@ -1832,8 +1804,7 @@ case "$enable_ipset" in
|
|||
AC_SUBST(IPSET_OBJ)
|
||||
|
||||
# mnl
|
||||
AC_ARG_WITH(libmnl, AC_HELP_STRING([--with-libmnl=path],
|
||||
[specify explicit path for libmnl.]),
|
||||
AC_ARG_WITH(libmnl, AS_HELP_STRING([--with-libmnl=path],[specify explicit path for libmnl.]),
|
||||
[ ],[ withval="yes" ])
|
||||
found_libmnl="no"
|
||||
AC_MSG_CHECKING(for libmnl)
|
||||
|
|
@ -1854,14 +1825,14 @@ case "$enable_ipset" in
|
|||
fi
|
||||
done
|
||||
if test x_$found_libmnl != x_yes; then
|
||||
AC_ERROR([Could not find libmnl, libmnl.h])
|
||||
AC_MSG_ERROR([Could not find libmnl, libmnl.h])
|
||||
fi
|
||||
;;
|
||||
no|*)
|
||||
# nothing
|
||||
;;
|
||||
esac
|
||||
AC_ARG_ENABLE(explicit-port-randomisation, AC_HELP_STRING([--disable-explicit-port-randomisation], [disable explicit source port randomisation and rely on the kernel to provide random source ports]))
|
||||
AC_ARG_ENABLE(explicit-port-randomisation, AS_HELP_STRING([--disable-explicit-port-randomisation],[disable explicit source port randomisation and rely on the kernel to provide random source ports]))
|
||||
case "$enable_explicit_port_randomisation" in
|
||||
no)
|
||||
AC_DEFINE([DISABLE_EXPLICIT_PORT_RANDOMISATION], [1], [Define this to enable kernel based UDP source port randomization.])
|
||||
|
|
@ -1909,8 +1880,7 @@ AC_SUBST(SOURCEFILE)
|
|||
# see if we want to build the library or everything
|
||||
ALLTARGET="alltargets"
|
||||
INSTALLTARGET="install-all"
|
||||
AC_ARG_WITH(libunbound-only, AC_HELP_STRING([--with-libunbound-only],
|
||||
[do not build daemon and tool programs]),
|
||||
AC_ARG_WITH(libunbound-only, AS_HELP_STRING([--with-libunbound-only],[do not build daemon and tool programs]),
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
ALLTARGET="lib"
|
||||
|
|
@ -1919,10 +1889,10 @@ AC_ARG_WITH(libunbound-only, AC_HELP_STRING([--with-libunbound-only],
|
|||
])
|
||||
if test $ALLTARGET = "alltargets"; then
|
||||
if test $USE_NSS = "yes"; then
|
||||
AC_ERROR([--with-nss can only be used in combination with --with-libunbound-only.])
|
||||
AC_MSG_ERROR([--with-nss can only be used in combination with --with-libunbound-only.])
|
||||
fi
|
||||
if test $USE_NETTLE = "yes"; then
|
||||
AC_ERROR([--with-nettle can only be used in combination with --with-libunbound-only.])
|
||||
AC_MSG_ERROR([--with-nettle can only be used in combination with --with-libunbound-only.])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
@ -2199,5 +2169,5 @@ AC_SUBST(version, [VERSION_MAJOR.VERSION_MINOR.VERSION_MICRO])
|
|||
AC_SUBST(date, [`date +'%b %e, %Y'`])
|
||||
|
||||
AC_CONFIG_FILES([Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound.conf.5 doc/unbound-control.8 doc/unbound-host.1 smallapp/unbound-control-setup.sh dnstap/dnstap_config.h dnscrypt/dnscrypt_config.h contrib/libunbound.pc contrib/unbound.socket contrib/unbound.service contrib/unbound_portable.service])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_OUTPUT
|
||||
|
|
|
|||
|
|
@ -2860,6 +2860,57 @@ do_ip_ratelimit_list(RES* ssl, struct worker* worker, char* arg)
|
|||
slabhash_traverse(a.infra->client_ip_rates, 0, ip_rate_list, &a);
|
||||
}
|
||||
|
||||
/** do the rpz_enable/disable command */
|
||||
static void
|
||||
do_rpz_enable_disable(RES* ssl, struct worker* worker, char* arg, int enable) {
|
||||
size_t nmlen;
|
||||
int nmlabs;
|
||||
uint8_t *nm = NULL;
|
||||
struct auth_zones *az = worker->env.auth_zones;
|
||||
struct auth_zone *z = NULL;
|
||||
if (!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs))
|
||||
return;
|
||||
if (az) {
|
||||
lock_rw_rdlock(&az->lock);
|
||||
z = auth_zone_find(az, nm, nmlen, LDNS_RR_CLASS_IN);
|
||||
if (z) {
|
||||
lock_rw_wrlock(&z->lock);
|
||||
}
|
||||
lock_rw_unlock(&az->lock);
|
||||
}
|
||||
free(nm);
|
||||
if (!z) {
|
||||
(void) ssl_printf(ssl, "error no auth-zone %s\n", arg);
|
||||
return;
|
||||
}
|
||||
if (!z->rpz) {
|
||||
(void) ssl_printf(ssl, "error auth-zone %s not RPZ\n", arg);
|
||||
lock_rw_unlock(&z->lock);
|
||||
return;
|
||||
}
|
||||
if (enable) {
|
||||
rpz_enable(z->rpz);
|
||||
} else {
|
||||
rpz_disable(z->rpz);
|
||||
}
|
||||
lock_rw_unlock(&z->lock);
|
||||
send_ok(ssl);
|
||||
}
|
||||
|
||||
/** do the rpz_enable command */
|
||||
static void
|
||||
do_rpz_enable(RES* ssl, struct worker* worker, char* arg)
|
||||
{
|
||||
do_rpz_enable_disable(ssl, worker, arg, 1);
|
||||
}
|
||||
|
||||
/** do the rpz_disable command */
|
||||
static void
|
||||
do_rpz_disable(RES* ssl, struct worker* worker, char* arg)
|
||||
{
|
||||
do_rpz_enable_disable(ssl, worker, arg, 0);
|
||||
}
|
||||
|
||||
/** tell other processes to execute the command */
|
||||
static void
|
||||
distribute_cmd(struct daemon_remote* rc, RES* ssl, char* cmd)
|
||||
|
|
@ -3060,6 +3111,10 @@ execute_cmd(struct daemon_remote* rc, RES* ssl, char* cmd,
|
|||
do_flush_bogus(ssl, worker);
|
||||
} else if(cmdcmp(p, "flush_negative", 14)) {
|
||||
do_flush_negative(ssl, worker);
|
||||
} else if(cmdcmp(p, "rpz_enable", 10)) {
|
||||
do_rpz_enable(ssl, worker, skipwhite(p+10));
|
||||
} else if(cmdcmp(p, "rpz_disable", 11)) {
|
||||
do_rpz_disable(ssl, worker, skipwhite(p+11));
|
||||
} else {
|
||||
(void)ssl_printf(ssl, "error unknown command '%s'\n", p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -513,7 +513,8 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
|
|||
edns->ext_rcode = 0;
|
||||
edns->bits &= EDNS_DO;
|
||||
if(!inplace_cb_reply_servfail_call(&worker->env, qinfo, NULL,
|
||||
msg->rep, LDNS_RCODE_SERVFAIL, edns, repinfo, worker->scratchpad))
|
||||
msg->rep, LDNS_RCODE_SERVFAIL, edns, repinfo, worker->scratchpad,
|
||||
worker->env.now_tv))
|
||||
return 0;
|
||||
error_encode(repinfo->c->buffer, LDNS_RCODE_SERVFAIL,
|
||||
&msg->qinfo, id, flags, edns);
|
||||
|
|
@ -544,7 +545,8 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
|
|||
edns->ext_rcode = 0;
|
||||
edns->bits &= EDNS_DO;
|
||||
if(!inplace_cb_reply_cache_call(&worker->env, qinfo, NULL, msg->rep,
|
||||
(int)(flags&LDNS_RCODE_MASK), edns, repinfo, worker->scratchpad))
|
||||
(int)(flags&LDNS_RCODE_MASK), edns, repinfo, worker->scratchpad,
|
||||
worker->env.now_tv))
|
||||
return 0;
|
||||
msg->rep->flags |= BIT_QR|BIT_RA;
|
||||
if(!apply_edns_options(edns, &edns_bak, worker->env.cfg,
|
||||
|
|
@ -553,7 +555,8 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
|
|||
repinfo->c->buffer, 0, 1, worker->scratchpad,
|
||||
udpsize, edns, (int)(edns->bits & EDNS_DO), secure)) {
|
||||
if(!inplace_cb_reply_servfail_call(&worker->env, qinfo, NULL, NULL,
|
||||
LDNS_RCODE_SERVFAIL, edns, repinfo, worker->scratchpad))
|
||||
LDNS_RCODE_SERVFAIL, edns, repinfo, worker->scratchpad,
|
||||
worker->env.now_tv))
|
||||
edns->opt_list = NULL;
|
||||
error_encode(repinfo->c->buffer, LDNS_RCODE_SERVFAIL,
|
||||
&msg->qinfo, id, flags, edns);
|
||||
|
|
@ -684,7 +687,8 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
|
|||
edns->ext_rcode = 0;
|
||||
edns->bits &= EDNS_DO;
|
||||
if(!inplace_cb_reply_servfail_call(&worker->env, qinfo, NULL, rep,
|
||||
LDNS_RCODE_SERVFAIL, edns, repinfo, worker->scratchpad))
|
||||
LDNS_RCODE_SERVFAIL, edns, repinfo, worker->scratchpad,
|
||||
worker->env.now_tv))
|
||||
goto bail_out;
|
||||
error_encode(repinfo->c->buffer, LDNS_RCODE_SERVFAIL,
|
||||
qinfo, id, flags, edns);
|
||||
|
|
@ -718,7 +722,8 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
|
|||
edns->ext_rcode = 0;
|
||||
edns->bits &= EDNS_DO;
|
||||
if(!inplace_cb_reply_cache_call(&worker->env, qinfo, NULL, rep,
|
||||
(int)(flags&LDNS_RCODE_MASK), edns, repinfo, worker->scratchpad))
|
||||
(int)(flags&LDNS_RCODE_MASK), edns, repinfo, worker->scratchpad,
|
||||
worker->env.now_tv))
|
||||
goto bail_out;
|
||||
*alias_rrset = NULL; /* avoid confusion if caller set it to non-NULL */
|
||||
if((worker->daemon->use_response_ip || worker->daemon->use_rpz) &&
|
||||
|
|
@ -754,7 +759,8 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
|
|||
repinfo->c->buffer, timenow, 1, worker->scratchpad,
|
||||
udpsize, edns, (int)(edns->bits & EDNS_DO), *is_secure_answer)) {
|
||||
if(!inplace_cb_reply_servfail_call(&worker->env, qinfo, NULL, NULL,
|
||||
LDNS_RCODE_SERVFAIL, edns, repinfo, worker->scratchpad))
|
||||
LDNS_RCODE_SERVFAIL, edns, repinfo, worker->scratchpad,
|
||||
worker->env.now_tv))
|
||||
edns->opt_list = NULL;
|
||||
error_encode(repinfo->c->buffer, LDNS_RCODE_SERVFAIL,
|
||||
qinfo, id, flags, edns);
|
||||
|
|
@ -842,7 +848,8 @@ chaos_replystr(sldns_buffer* pkt, char** str, int num, struct edns_data* edns,
|
|||
edns->udp_size = EDNS_ADVERTISED_SIZE;
|
||||
edns->bits &= EDNS_DO;
|
||||
if(!inplace_cb_reply_local_call(&worker->env, NULL, NULL, NULL,
|
||||
LDNS_RCODE_NOERROR, edns, repinfo, worker->scratchpad))
|
||||
LDNS_RCODE_NOERROR, edns, repinfo, worker->scratchpad,
|
||||
worker->env.now_tv))
|
||||
edns->opt_list = NULL;
|
||||
if(sldns_buffer_capacity(pkt) >=
|
||||
sldns_buffer_limit(pkt)+calc_edns_field_size(edns))
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ AC_DEFUN([dnsc_DNSCRYPT],
|
|||
[opt_dnscrypt=$enableval], [opt_dnscrypt=no])
|
||||
|
||||
if test "x$opt_dnscrypt" != "xno"; then
|
||||
AC_ARG_WITH([libsodium], AC_HELP_STRING([--with-libsodium=path],
|
||||
AC_ARG_WITH([libsodium], AS_HELP_STRING([--with-libsodium=path],
|
||||
[Path where libsodium is installed, for dnscrypt]), [
|
||||
CFLAGS="$CFLAGS -I$withval/include"
|
||||
LDFLAGS="$LDFLAGS -L$withval/lib"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ AC_DEFUN([dt_DNSTAP],
|
|||
if test -z "$PROTOC_C"; then
|
||||
AC_MSG_ERROR([The protoc-c program was not found. Please install protobuf-c!])
|
||||
fi
|
||||
AC_ARG_WITH([protobuf-c], AC_HELP_STRING([--with-protobuf-c=path],
|
||||
AC_ARG_WITH([protobuf-c], AS_HELP_STRING([--with-protobuf-c=path],
|
||||
[Path where protobuf-c is installed, for dnstap]), [
|
||||
# workaround for protobuf-c includes at old dir before protobuf-c-1.0.0
|
||||
if test -f $withval/include/google/protobuf-c/protobuf-c.h; then
|
||||
|
|
|
|||
|
|
@ -727,7 +727,7 @@ static ssize_t tap_receive(struct tap_data* data, void* buf, size_t len)
|
|||
}
|
||||
|
||||
/** delete the tap structure */
|
||||
void tap_data_free(struct tap_data* data)
|
||||
static void tap_data_free(struct tap_data* data)
|
||||
{
|
||||
ub_event_del(data->ev);
|
||||
ub_event_free(data->ev);
|
||||
|
|
@ -1355,6 +1355,10 @@ int main(int argc, char** argv)
|
|||
struct tube;
|
||||
struct query_info;
|
||||
#include "util/data/packed_rrset.h"
|
||||
#include "daemon/worker.h"
|
||||
#include "daemon/remote.h"
|
||||
#include "util/fptr_wlist.h"
|
||||
#include "libunbound/context.h"
|
||||
|
||||
void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
|
||||
uint8_t* ATTR_UNUSED(buffer), size_t ATTR_UNUSED(len),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,53 @@
|
|||
13 January 2021: Wouter
|
||||
- Merge #399 from xiangbao227: The lock of lruhash table should
|
||||
unlocked after markdel entry.
|
||||
- Fix for #93: dynlibmodule link fix for Windows.
|
||||
|
||||
12 January 2021: Wouter
|
||||
- Fix #397: [Feature request] add new type always_null to local-zone
|
||||
similar to always_nxdomain.
|
||||
- Fix so local zone types always_nodata and always_deny can be used
|
||||
from the config file.
|
||||
|
||||
8 January 2021: Wouter
|
||||
- Merge PR #391 from fhriley: Add start_time to reply callbacks so
|
||||
modules can compute the response time.
|
||||
- For #391: use struct timeval* start_time for callback information.
|
||||
- For #391: fix indentation.
|
||||
- For #391: more double casts in python start time calculation.
|
||||
- Add comment documentation.
|
||||
- Fix clang analysis warning.
|
||||
|
||||
6 January 2021: Wouter
|
||||
- Fix #379: zone loading over HTTP appears to have buffer issues.
|
||||
- Merge PR #395 from mptre: add missing null check.
|
||||
- Fix #387: client-subnet-always-forward seems to effectively bypass
|
||||
any caching?
|
||||
|
||||
5 January 2021: Wouter
|
||||
- Fix #385: autoconf 2.70 impacts unbound build
|
||||
- Merge PR #375 by fhriley: Add rpz_enable and rpz_disable commands
|
||||
to unbound-control.
|
||||
|
||||
4 January 2021: Wouter
|
||||
- For #376: Fix that comm point event is not double removed or double
|
||||
added to event map.
|
||||
- iana portlist updated.
|
||||
|
||||
16 December 2020: George
|
||||
- Fix error cases when udp-connect is set and send() returns an error
|
||||
(modified patch from Xin Li @delphij).
|
||||
|
||||
11 December 2020: Wouter
|
||||
- Fix #371: unbound-control timeout when Unbound is not running.
|
||||
- Fix to squelch permission denied and other errors from remote host,
|
||||
they are logged at higher verbosity but not on low verbosity.
|
||||
- Merge PR #335 from fobser: Sprinkle in some static to prevent
|
||||
missing prototype warnings.
|
||||
- Merge PR #373 from fobser: Warning: arithmetic on a pointer to void
|
||||
is a GNU extension.
|
||||
- Fix missing prototypes in the code.
|
||||
|
||||
3 December 2020: Wouter
|
||||
- make depend.
|
||||
- iana portlist updated.
|
||||
|
|
|
|||
|
|
@ -704,8 +704,10 @@ server:
|
|||
# o inform acts like transparent, but logs client IP address
|
||||
# o inform_deny drops queries and logs client IP address
|
||||
# o inform_redirect redirects queries and logs client IP address
|
||||
# o always_transparent, always_refuse, always_nxdomain, resolve in
|
||||
# that way but ignore local data for that name
|
||||
# o always_transparent, always_refuse, always_nxdomain, always_nodata,
|
||||
# always_deny resolve in that way but ignore local data for
|
||||
# that name
|
||||
# o always_null returns 0.0.0.0 or ::0 for any name in the zone.
|
||||
# o noview breaks out of that view towards global local-zones.
|
||||
#
|
||||
# defaults are localhost address, reverse for 127.0.0.1 and ::1
|
||||
|
|
|
|||
|
|
@ -305,6 +305,12 @@ Transfer the auth zone from master. The auth zone probe sequence is started,
|
|||
where the masters are probed to see if they have an updated zone (with the SOA
|
||||
serial check). And then the zone is transferred for a newer zone version.
|
||||
.TP
|
||||
.B rpz_enable \fIzone\fR
|
||||
Enable the RPZ zone if it had previously been disabled.
|
||||
.TP
|
||||
.B rpz_enable \fIzone\fR
|
||||
Disable the RPZ zone.
|
||||
.TP
|
||||
.B view_list_local_zones \fIview\fR
|
||||
\fIlist_local_zones\fR for given view.
|
||||
.TP
|
||||
|
|
|
|||
|
|
@ -1231,7 +1231,7 @@ address space are not validated. This is usually required whenever
|
|||
Configure a local zone. The type determines the answer to give if
|
||||
there is no match from local\-data. The types are deny, refuse, static,
|
||||
transparent, redirect, nodefault, typetransparent, inform, inform_deny,
|
||||
inform_redirect, always_transparent, always_refuse, always_nxdomain, noview,
|
||||
inform_redirect, always_transparent, always_refuse, always_nxdomain, always_null, noview,
|
||||
and are explained below. After that the default settings are listed. Use
|
||||
local\-data: to enter data into the local zone. Answers for local zones
|
||||
are authoritative DNS answers. By default the zones are class IN.
|
||||
|
|
@ -1305,6 +1305,17 @@ Like refuse, but ignores local data and refuses the query.
|
|||
\h'5'\fIalways_nxdomain\fR
|
||||
Like static, but ignores local data and returns nxdomain for the query.
|
||||
.TP 10
|
||||
\h'5'\fIalways_nodata\fR
|
||||
Like static, but ignores local data and returns nodata for the query.
|
||||
.TP 10
|
||||
\h'5'\fIalways_deny\fR
|
||||
Like deny, but ignores local data and drops the query.
|
||||
.TP 10
|
||||
\h'5'\fIalways_null\fR
|
||||
Always returns 0.0.0.0 or ::0 for every name in the zone. Like redirect
|
||||
with zero data for A and AAAA. Ignores local data in the zone. Used for
|
||||
some block lists.
|
||||
.TP 10
|
||||
\h'5'\fInoview\fR
|
||||
Breaks out of that view and moves towards the global local zones for answer
|
||||
to the query. If the view first is no, it'll resolve normally. If view first
|
||||
|
|
@ -2033,7 +2044,8 @@ Specify whether the ECS address check (configured using
|
|||
query contains an ECS record, or only for queries for which the ECS record is
|
||||
generated using the querier address (and therefore did not contain ECS data in
|
||||
the client query). If enabled, the address check is skipped when the client
|
||||
query contains an ECS record. Default is no.
|
||||
query contains an ECS record. And the lookup in the regular cache is skipped.
|
||||
Default is no.
|
||||
.TP
|
||||
.B max\-client\-subnet\-ipv6: \fI<number>\fR
|
||||
Specifies the maximum prefix length of the client source address we are willing
|
||||
|
|
|
|||
|
|
@ -5,16 +5,16 @@
|
|||
* module actions.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "dynlibmod/dynlibmod.h"
|
||||
#include "util/module.h"
|
||||
#include "util/config_file.h"
|
||||
#include "dynlibmod/dynlibmod.h"
|
||||
|
||||
#if HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#define __DYNMOD HMODULE
|
||||
#define __DYNSYM FARPROC
|
||||
#define __LOADSYM GetProcAddress
|
||||
void log_dlerror() {
|
||||
static void log_dlerror() {
|
||||
DWORD dwLastError = GetLastError();
|
||||
LPSTR MessageBuffer;
|
||||
DWORD dwBufferLength;
|
||||
|
|
@ -37,11 +37,11 @@ void log_dlerror() {
|
|||
|
||||
}
|
||||
|
||||
HMODULE open_library(const char* fname) {
|
||||
static HMODULE open_library(const char* fname) {
|
||||
return LoadLibrary(fname);
|
||||
}
|
||||
|
||||
void close_library(const char* fname, __DYNMOD handle) {
|
||||
static void close_library(const char* fname, __DYNMOD handle) {
|
||||
(void)fname;
|
||||
(void)handle;
|
||||
}
|
||||
|
|
@ -50,15 +50,15 @@ void close_library(const char* fname, __DYNMOD handle) {
|
|||
#define __DYNMOD void*
|
||||
#define __DYNSYM void*
|
||||
#define __LOADSYM dlsym
|
||||
void log_dlerror() {
|
||||
static void log_dlerror() {
|
||||
log_err("dynlibmod: %s", dlerror());
|
||||
}
|
||||
|
||||
void* open_library(const char* fname) {
|
||||
static void* open_library(const char* fname) {
|
||||
return dlopen(fname, RTLD_LAZY | RTLD_GLOBAL);
|
||||
}
|
||||
|
||||
void close_library(const char* fname, __DYNMOD handle) {
|
||||
static void close_library(const char* fname, __DYNMOD handle) {
|
||||
if(!handle) return;
|
||||
if(dlclose(handle) != 0) {
|
||||
log_err("dlclose %s: %s", fname, strerror(errno));
|
||||
|
|
@ -212,10 +212,10 @@ size_t dynlibmod_get_mem(struct module_env* env, int id) {
|
|||
int dynlib_inplace_cb_reply_generic(struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct edns_option** opt_list_out,
|
||||
struct comm_reply* repinfo, struct regional* region, int id,
|
||||
void* callback) {
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time, int id, void* callback) {
|
||||
struct cb_pair* cb_pair = (struct cb_pair*) callback;
|
||||
return ((inplace_cb_reply_func_type*) cb_pair->cb)(qinfo, qstate, rep, rcode, edns, opt_list_out, repinfo, region, id, cb_pair->cb_arg);
|
||||
return ((inplace_cb_reply_func_type*) cb_pair->cb)(qinfo, qstate, rep, rcode, edns, opt_list_out, repinfo, region, start_time, id, cb_pair->cb_arg);
|
||||
}
|
||||
|
||||
int dynlib_inplace_cb_query_generic(struct query_info* qinfo, uint16_t flags,
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ size_t dynlibmod_get_mem(struct module_env* env, int id);
|
|||
int dynlib_inplace_cb_reply_generic(struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct edns_option** opt_list_out,
|
||||
struct comm_reply* repinfo, struct regional* region, int id,
|
||||
void* callback);
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time, int id, void* callback);
|
||||
|
||||
int dynlib_inplace_cb_query_generic(struct query_info* qinfo, uint16_t flags,
|
||||
struct module_qstate* qstate, struct sockaddr_storage* addr,
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
int reply_callback(struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct edns_option** opt_list_out,
|
||||
struct comm_reply* repinfo, struct regional* region, int id,
|
||||
void* callback);
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time, int id, void* callback);
|
||||
|
||||
/* Init is called when the module is first loaded. It should be used to set up
|
||||
* the environment for this module and do any other initialisation required. */
|
||||
|
|
@ -116,8 +116,8 @@ EXPORT size_t get_mem(struct module_env* env, int id) {
|
|||
int reply_callback(struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct edns_option** opt_list_out,
|
||||
struct comm_reply* repinfo, struct regional* region, int id,
|
||||
void* callback) {
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time, int id, void* callback) {
|
||||
log_info("dynlib: hello world from callback");
|
||||
struct dynlibmod_env* env = qstate->env->modinfo[id];
|
||||
if (env->dyn_env != NULL) {
|
||||
|
|
|
|||
|
|
@ -73,6 +73,9 @@
|
|||
#include "iterator/iter_hints.h"
|
||||
#include "sldns/sbuffer.h"
|
||||
#include "sldns/str2wire.h"
|
||||
#ifdef USE_DNSTAP
|
||||
#include "dnstap/dtstream.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TARGETCONDITIONALS_H
|
||||
#include <TargetConditionals.h>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
* called to perform operations on queries.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
|
@ -696,6 +697,8 @@ struct edns_data {
|
|||
/* ************************************************************************************ *
|
||||
Structure module_env
|
||||
* ************************************************************************************ */
|
||||
%rename(_now) module_env::now;
|
||||
%rename(_now_tv) module_env::now_tv;
|
||||
struct module_env {
|
||||
struct config_file* cfg;
|
||||
struct slabhash* msg_cache;
|
||||
|
|
@ -739,6 +742,19 @@ struct module_env {
|
|||
size_t edns_known_options_num;
|
||||
};
|
||||
|
||||
%inline %{
|
||||
PyObject* _module_env_now_get(struct module_env* env) {
|
||||
double ts = env->now_tv->tv_sec + env->now_tv->tv_usec / 1e6;
|
||||
return PyFloat_FromDouble(ts);
|
||||
}
|
||||
%}
|
||||
%extend module_env {
|
||||
%pythoncode %{
|
||||
def _now_get(self): return _module_env_now_get(self)
|
||||
now = property(_now_get)
|
||||
%}
|
||||
}
|
||||
|
||||
/* ************************************************************************************ *
|
||||
Structure module_qstate
|
||||
* ************************************************************************************ */
|
||||
|
|
@ -1525,13 +1541,14 @@ int edns_opt_list_append(struct edns_option** list, uint16_t code, size_t len,
|
|||
int python_inplace_cb_reply_generic(struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct edns_option** opt_list_out,
|
||||
struct comm_reply* repinfo, struct regional* region, int id,
|
||||
void* python_callback)
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time, int id, void* python_callback)
|
||||
{
|
||||
PyObject *func, *py_edns, *py_qstate, *py_opt_list_out, *py_qinfo;
|
||||
PyObject *py_rep, *py_repinfo, *py_region;
|
||||
PyObject *py_args, *py_kwargs, *result;
|
||||
int res = 0;
|
||||
double py_start_time = ((double)start_time->tv_sec) + ((double)start_time->tv_usec) / 1.0e6;
|
||||
|
||||
PyGILState_STATE gstate = PyGILState_Ensure();
|
||||
func = (PyObject *) python_callback;
|
||||
|
|
@ -1546,7 +1563,8 @@ int edns_opt_list_append(struct edns_option** list, uint16_t code, size_t len,
|
|||
py_region = SWIG_NewPointerObj((void*) region, SWIGTYPE_p_regional, 0);
|
||||
py_args = Py_BuildValue("(OOOiOOO)", py_qinfo, py_qstate, py_rep,
|
||||
rcode, py_edns, py_opt_list_out, py_region);
|
||||
py_kwargs = Py_BuildValue("{s:O}", "repinfo", py_repinfo);
|
||||
py_kwargs = Py_BuildValue("{s:O,s:d}", "repinfo", py_repinfo, "start_time",
|
||||
py_start_time);
|
||||
result = PyObject_Call(func, py_args, py_kwargs);
|
||||
Py_XDECREF(py_edns);
|
||||
Py_XDECREF(py_qstate);
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ size_t pythonmod_get_mem(struct module_env* env, int id);
|
|||
int python_inplace_cb_reply_generic(struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct edns_option** opt_list_out,
|
||||
struct comm_reply* repinfo, struct regional* region, int id,
|
||||
void* python_callback);
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time, int id, void* python_callback);
|
||||
|
||||
/** Declared here for fptr_wlist access. The definition is in interface.i. */
|
||||
int python_inplace_cb_query_generic(
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
* conversions.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "pythonmod/pythonmod_utils.h"
|
||||
#include "util/module.h"
|
||||
#include "util/netevent.h"
|
||||
#include "util/net_help.h"
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
#include "util/module.h"
|
||||
struct delegpt_addr;
|
||||
struct sldns_buffer;
|
||||
|
||||
/**
|
||||
* Store the reply_info and query_info pair in message cache (qstate->msg_cache)
|
||||
|
|
@ -77,7 +78,7 @@ void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qin
|
|||
* @param pkt: a sldns_buffer which contains sldns_packet data
|
||||
* @return 0 on failure, out of memory or parse error.
|
||||
*/
|
||||
int createResponse(struct module_qstate* qstate, sldns_buffer* pkt);
|
||||
int createResponse(struct module_qstate* qstate, struct sldns_buffer* pkt);
|
||||
|
||||
/**
|
||||
* Convert reply->addr to string
|
||||
|
|
|
|||
|
|
@ -3286,7 +3286,7 @@ auth_answer_encode(struct query_info* qinfo, struct module_env* env,
|
|||
edns->bits &= EDNS_DO;
|
||||
|
||||
if(!inplace_cb_reply_local_call(env, qinfo, NULL, msg->rep,
|
||||
(int)FLAGS_GET_RCODE(msg->rep->flags), edns, repinfo, temp)
|
||||
(int)FLAGS_GET_RCODE(msg->rep->flags), edns, repinfo, temp, env->now_tv)
|
||||
|| !reply_info_answer_encode(qinfo, msg->rep,
|
||||
*(uint16_t*)sldns_buffer_begin(buf),
|
||||
sldns_buffer_read_u16_at(buf, 2),
|
||||
|
|
@ -3310,7 +3310,7 @@ auth_error_encode(struct query_info* qinfo, struct module_env* env,
|
|||
edns->bits &= EDNS_DO;
|
||||
|
||||
if(!inplace_cb_reply_local_call(env, qinfo, NULL, NULL,
|
||||
rcode, edns, repinfo, temp))
|
||||
rcode, edns, repinfo, temp, env->now_tv))
|
||||
edns->opt_list = NULL;
|
||||
error_encode(buf, rcode|BIT_AA, qinfo,
|
||||
*(uint16_t*)sldns_buffer_begin(buf),
|
||||
|
|
@ -6093,7 +6093,7 @@ xfr_probe_send_probe(struct auth_xfer* xfr, struct module_env* env,
|
|||
|
||||
/* send udp packet */
|
||||
if(!comm_point_send_udp_msg(xfr->task_probe->cp, env->scratch_buffer,
|
||||
(struct sockaddr*)&addr, addrlen)) {
|
||||
(struct sockaddr*)&addr, addrlen, 0)) {
|
||||
char zname[255+1], as[256];
|
||||
dname_str(xfr->name, zname);
|
||||
addr_to_str(&addr, addrlen, as, sizeof(as));
|
||||
|
|
|
|||
|
|
@ -2830,7 +2830,7 @@ void http2_req_stream_clear(struct http2_stream* h2_stream)
|
|||
}
|
||||
}
|
||||
|
||||
nghttp2_session_callbacks* http2_req_callbacks_create()
|
||||
nghttp2_session_callbacks* http2_req_callbacks_create(void)
|
||||
{
|
||||
nghttp2_session_callbacks *callbacks;
|
||||
if(nghttp2_session_callbacks_new(&callbacks) == NGHTTP2_ERR_NOMEM) {
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ size_t http2_get_response_buffer_size(void);
|
|||
* Create nghttp2 callbacks to handle HTTP2 requests.
|
||||
* @return malloc'ed struct, NULL on failure
|
||||
*/
|
||||
nghttp2_session_callbacks* http2_req_callbacks_create();
|
||||
nghttp2_session_callbacks* http2_req_callbacks_create(void);
|
||||
|
||||
/** Free http2 stream buffers and decrease buffer counters */
|
||||
void http2_req_stream_clear(struct http2_stream* h2_stream);
|
||||
|
|
|
|||
|
|
@ -1215,7 +1215,7 @@ local_encode(struct query_info* qinfo, struct module_env* env,
|
|||
edns->ext_rcode = 0;
|
||||
edns->bits &= EDNS_DO;
|
||||
if(!inplace_cb_reply_local_call(env, qinfo, NULL, &rep, rcode, edns,
|
||||
repinfo, temp) || !reply_info_answer_encode(qinfo, &rep,
|
||||
repinfo, temp, env->now_tv) || !reply_info_answer_encode(qinfo, &rep,
|
||||
*(uint16_t*)sldns_buffer_begin(buf), sldns_buffer_read_u16_at(buf, 2),
|
||||
buf, 0, 0, temp, udpsize, edns, (int)(edns->bits&EDNS_DO), 0)) {
|
||||
error_encode(buf, (LDNS_RCODE_SERVFAIL|BIT_AA), qinfo,
|
||||
|
|
@ -1237,7 +1237,7 @@ local_error_encode(struct query_info* qinfo, struct module_env* env,
|
|||
edns->bits &= EDNS_DO;
|
||||
|
||||
if(!inplace_cb_reply_local_call(env, qinfo, NULL, NULL,
|
||||
rcode, edns, repinfo, temp))
|
||||
rcode, edns, repinfo, temp, env->now_tv))
|
||||
edns->opt_list = NULL;
|
||||
error_encode(buf, r, qinfo, *(uint16_t*)sldns_buffer_begin(buf),
|
||||
sldns_buffer_read_u16_at(buf, 2), edns);
|
||||
|
|
@ -1558,6 +1558,46 @@ local_zones_zone_answer(struct local_zone* z, struct module_env* env,
|
|||
|| lz_type == local_zone_always_transparent) {
|
||||
/* no NODATA or NXDOMAINS for this zone type */
|
||||
return 0;
|
||||
} else if(lz_type == local_zone_always_null) {
|
||||
/* 0.0.0.0 or ::0 or noerror/nodata for this zone type,
|
||||
* used for blocklists. */
|
||||
if(qinfo->qtype == LDNS_RR_TYPE_A ||
|
||||
qinfo->qtype == LDNS_RR_TYPE_AAAA) {
|
||||
struct ub_packed_rrset_key lrr;
|
||||
struct packed_rrset_data d;
|
||||
time_t rr_ttl = 3600;
|
||||
size_t rr_len = 0;
|
||||
uint8_t rr_data[2+16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
uint8_t* rr_datas = rr_data;
|
||||
memset(&lrr, 0, sizeof(lrr));
|
||||
memset(&d, 0, sizeof(d));
|
||||
lrr.entry.data = &d;
|
||||
lrr.rk.dname = qinfo->qname;
|
||||
lrr.rk.dname_len = qinfo->qname_len;
|
||||
lrr.rk.type = htons(qinfo->qtype);
|
||||
lrr.rk.rrset_class = htons(qinfo->qclass);
|
||||
if(qinfo->qtype == LDNS_RR_TYPE_A) {
|
||||
rr_len = 4;
|
||||
sldns_write_uint16(rr_data, rr_len);
|
||||
rr_len += 2;
|
||||
} else {
|
||||
rr_len = 16;
|
||||
sldns_write_uint16(rr_data, rr_len);
|
||||
rr_len += 2;
|
||||
}
|
||||
d.ttl = rr_ttl;
|
||||
d.count = 1;
|
||||
d.rr_len = &rr_len;
|
||||
d.rr_data = &rr_datas;
|
||||
d.rr_ttl = &rr_ttl;
|
||||
return local_encode(qinfo, env, edns, repinfo, buf, temp,
|
||||
&lrr, 1, LDNS_RCODE_NOERROR);
|
||||
} else {
|
||||
local_error_encode(qinfo, env, edns, repinfo, buf,
|
||||
temp, LDNS_RCODE_NOERROR,
|
||||
(LDNS_RCODE_NOERROR|BIT_AA));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/* else lz_type == local_zone_transparent */
|
||||
|
||||
|
|
@ -1762,6 +1802,7 @@ const char* local_zone_type2str(enum localzone_type t)
|
|||
case local_zone_always_nxdomain: return "always_nxdomain";
|
||||
case local_zone_always_nodata: return "always_nodata";
|
||||
case local_zone_always_deny: return "always_deny";
|
||||
case local_zone_always_null: return "always_null";
|
||||
case local_zone_noview: return "noview";
|
||||
case local_zone_invalid: return "invalid";
|
||||
}
|
||||
|
|
@ -1798,6 +1839,8 @@ int local_zone_str2type(const char* type, enum localzone_type* t)
|
|||
*t = local_zone_always_nodata;
|
||||
else if(strcmp(type, "always_deny") == 0)
|
||||
*t = local_zone_always_deny;
|
||||
else if(strcmp(type, "always_null") == 0)
|
||||
*t = local_zone_always_null;
|
||||
else if(strcmp(type, "noview") == 0)
|
||||
*t = local_zone_noview;
|
||||
else if(strcmp(type, "nodefault") == 0)
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ enum localzone_type {
|
|||
local_zone_always_nodata,
|
||||
/** drop query, even when there is local data */
|
||||
local_zone_always_deny,
|
||||
/** answer with 0.0.0.0 or ::0 or noerror/nodata, even when there is
|
||||
* local data */
|
||||
local_zone_always_null,
|
||||
/** answer not from the view, but global or no-answer */
|
||||
local_zone_noview,
|
||||
/** Invalid type, cannot be used to generate answer */
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
|
|||
if(!s) {
|
||||
log_err("mesh_state_create: out of memory; SERVFAIL");
|
||||
if(!inplace_cb_reply_servfail_call(mesh->env, qinfo, NULL, NULL,
|
||||
LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch))
|
||||
LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch, mesh->env->now_tv))
|
||||
edns->opt_list = NULL;
|
||||
error_encode(r_buffer, LDNS_RCODE_SERVFAIL,
|
||||
qinfo, qid, qflags, edns);
|
||||
|
|
@ -514,7 +514,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
|
|||
if(!s->s.edns_opts_front_in) {
|
||||
log_err("mesh_state_create: out of memory; SERVFAIL");
|
||||
if(!inplace_cb_reply_servfail_call(mesh->env, qinfo, NULL,
|
||||
NULL, LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch))
|
||||
NULL, LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch, mesh->env->now_tv))
|
||||
edns->opt_list = NULL;
|
||||
error_encode(r_buffer, LDNS_RCODE_SERVFAIL,
|
||||
qinfo, qid, qflags, edns);
|
||||
|
|
@ -587,7 +587,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
|
|||
|
||||
servfail_mem:
|
||||
if(!inplace_cb_reply_servfail_call(mesh->env, qinfo, &s->s,
|
||||
NULL, LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch))
|
||||
NULL, LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch, mesh->env->now_tv))
|
||||
edns->opt_list = NULL;
|
||||
error_encode(r_buffer, LDNS_RCODE_SERVFAIL,
|
||||
qinfo, qid, qflags, edns);
|
||||
|
|
@ -1112,10 +1112,12 @@ int mesh_state_attachment(struct mesh_state* super, struct mesh_state* sub)
|
|||
* @param rcode: if not 0, error code.
|
||||
* @param rep: reply to send (or NULL if rcode is set).
|
||||
* @param r: callback entry
|
||||
* @param start_time: the time to pass to callback functions, it is 0 or
|
||||
* a value from one of the packets if the mesh state had packets.
|
||||
*/
|
||||
static void
|
||||
mesh_do_callback(struct mesh_state* m, int rcode, struct reply_info* rep,
|
||||
struct mesh_cb* r)
|
||||
struct mesh_cb* r, struct timeval* start_time)
|
||||
{
|
||||
int secure;
|
||||
char* reason = NULL;
|
||||
|
|
@ -1136,11 +1138,11 @@ mesh_do_callback(struct mesh_state* m, int rcode, struct reply_info* rep,
|
|||
if(rcode) {
|
||||
if(rcode == LDNS_RCODE_SERVFAIL) {
|
||||
if(!inplace_cb_reply_servfail_call(m->s.env, &m->s.qinfo, &m->s,
|
||||
rep, rcode, &r->edns, NULL, m->s.region))
|
||||
rep, rcode, &r->edns, NULL, m->s.region, start_time))
|
||||
r->edns.opt_list = NULL;
|
||||
} else {
|
||||
if(!inplace_cb_reply_call(m->s.env, &m->s.qinfo, &m->s, rep, rcode,
|
||||
&r->edns, NULL, m->s.region))
|
||||
&r->edns, NULL, m->s.region, start_time))
|
||||
r->edns.opt_list = NULL;
|
||||
}
|
||||
fptr_ok(fptr_whitelist_mesh_cb(r->cb));
|
||||
|
|
@ -1155,7 +1157,7 @@ mesh_do_callback(struct mesh_state* m, int rcode, struct reply_info* rep,
|
|||
r->edns.bits &= EDNS_DO;
|
||||
|
||||
if(!inplace_cb_reply_call(m->s.env, &m->s.qinfo, &m->s, rep,
|
||||
LDNS_RCODE_NOERROR, &r->edns, NULL, m->s.region) ||
|
||||
LDNS_RCODE_NOERROR, &r->edns, NULL, m->s.region, start_time) ||
|
||||
!reply_info_answer_encode(&m->s.qinfo, rep, r->qid,
|
||||
r->qflags, r->buf, 0, 1,
|
||||
m->s.env->scratch, udp_size, &r->edns,
|
||||
|
|
@ -1256,11 +1258,11 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep,
|
|||
m->s.qinfo.local_alias = r->local_alias;
|
||||
if(rcode == LDNS_RCODE_SERVFAIL) {
|
||||
if(!inplace_cb_reply_servfail_call(m->s.env, &m->s.qinfo, &m->s,
|
||||
rep, rcode, &r->edns, &r->query_reply, m->s.region))
|
||||
rep, rcode, &r->edns, &r->query_reply, m->s.region, &r->start_time))
|
||||
r->edns.opt_list = NULL;
|
||||
} else {
|
||||
if(!inplace_cb_reply_call(m->s.env, &m->s.qinfo, &m->s, rep, rcode,
|
||||
&r->edns, &r->query_reply, m->s.region))
|
||||
&r->edns, &r->query_reply, m->s.region, &r->start_time))
|
||||
r->edns.opt_list = NULL;
|
||||
}
|
||||
error_encode(r_buffer, rcode, &m->s.qinfo, r->qid,
|
||||
|
|
@ -1277,7 +1279,7 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep,
|
|||
m->s.qinfo.qname = r->qname;
|
||||
m->s.qinfo.local_alias = r->local_alias;
|
||||
if(!inplace_cb_reply_call(m->s.env, &m->s.qinfo, &m->s, rep,
|
||||
LDNS_RCODE_NOERROR, &r->edns, &r->query_reply, m->s.region) ||
|
||||
LDNS_RCODE_NOERROR, &r->edns, &r->query_reply, m->s.region, &r->start_time) ||
|
||||
!apply_edns_options(&r->edns, &edns_bak,
|
||||
m->s.env->cfg, r->query_reply.c,
|
||||
m->s.region) ||
|
||||
|
|
@ -1287,7 +1289,7 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep,
|
|||
secure))
|
||||
{
|
||||
if(!inplace_cb_reply_servfail_call(m->s.env, &m->s.qinfo, &m->s,
|
||||
rep, LDNS_RCODE_SERVFAIL, &r->edns, &r->query_reply, m->s.region))
|
||||
rep, LDNS_RCODE_SERVFAIL, &r->edns, &r->query_reply, m->s.region, &r->start_time))
|
||||
r->edns.opt_list = NULL;
|
||||
error_encode(r_buffer, LDNS_RCODE_SERVFAIL,
|
||||
&m->s.qinfo, r->qid, r->qflags, &r->edns);
|
||||
|
|
@ -1330,6 +1332,7 @@ void mesh_query_done(struct mesh_state* mstate)
|
|||
struct mesh_cb* c;
|
||||
struct reply_info* rep = (mstate->s.return_msg?
|
||||
mstate->s.return_msg->rep:NULL);
|
||||
struct timeval tv = {0, 0};
|
||||
/* No need for the serve expired timer anymore; we are going to reply. */
|
||||
if(mstate->s.serve_expired_data) {
|
||||
comm_timer_delete(mstate->s.serve_expired_data->timer);
|
||||
|
|
@ -1349,6 +1352,8 @@ void mesh_query_done(struct mesh_state* mstate)
|
|||
}
|
||||
}
|
||||
for(r = mstate->reply_list; r; r = r->next) {
|
||||
tv = r->start_time;
|
||||
|
||||
/* if a response-ip address block has been stored the
|
||||
* information should be logged for each client. */
|
||||
if(mstate->s.respip_action_info &&
|
||||
|
|
@ -1421,7 +1426,7 @@ void mesh_query_done(struct mesh_state* mstate)
|
|||
if(!mstate->reply_list && !mstate->cb_list &&
|
||||
mstate->super_set.count == 0)
|
||||
mstate->s.env->mesh->num_detached_states++;
|
||||
mesh_do_callback(mstate, mstate->s.return_rcode, rep, c);
|
||||
mesh_do_callback(mstate, mstate->s.return_rcode, rep, c, &tv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1917,6 +1922,7 @@ mesh_serve_expired_callback(void* arg)
|
|||
struct respip_action_info actinfo;
|
||||
struct query_info* lookup_qinfo = &qstate->qinfo;
|
||||
struct query_info qinfo_tmp;
|
||||
struct timeval tv = {0, 0};
|
||||
int must_validate = (!(qstate->query_flags&BIT_CD)
|
||||
|| qstate->env->cfg->ignore_cd) && qstate->env->need_to_validate;
|
||||
if(!qstate->serve_expired_data) return;
|
||||
|
|
@ -1988,6 +1994,8 @@ mesh_serve_expired_callback(void* arg)
|
|||
log_dns_msg("Serve expired lookup", &qstate->qinfo, msg->rep);
|
||||
|
||||
for(r = mstate->reply_list; r; r = r->next) {
|
||||
tv = r->start_time;
|
||||
|
||||
/* If address info is returned, it means the action should be an
|
||||
* 'inform' variant and the information should be logged. */
|
||||
if(actinfo.addrinfo) {
|
||||
|
|
@ -2042,6 +2050,6 @@ mesh_serve_expired_callback(void* arg)
|
|||
if(!mstate->reply_list && !mstate->cb_list &&
|
||||
mstate->super_set.count == 0)
|
||||
qstate->env->mesh->num_detached_states++;
|
||||
mesh_do_callback(mstate, LDNS_RCODE_NOERROR, msg->rep, c);
|
||||
mesh_do_callback(mstate, LDNS_RCODE_NOERROR, msg->rep, c, &tv);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1925,18 +1925,11 @@ randomize_and_send_udp(struct pending* pend, sldns_buffer* packet, int timeout)
|
|||
log_assert(pend->pc && pend->pc->cp);
|
||||
|
||||
/* send it over the commlink */
|
||||
if(outnet->udp_connect) {
|
||||
if(!comm_point_send_udp_msg(pend->pc->cp, packet, NULL, 0)) {
|
||||
portcomm_loweruse(outnet, pend->pc);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if(!comm_point_send_udp_msg(pend->pc->cp, packet,
|
||||
(struct sockaddr*)&pend->addr, pend->addrlen)) {
|
||||
(struct sockaddr*)&pend->addr, pend->addrlen, outnet->udp_connect)) {
|
||||
portcomm_loweruse(outnet, pend->pc);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* system calls to set timeout after sending UDP to make roundtrip
|
||||
smaller. */
|
||||
|
|
|
|||
|
|
@ -963,8 +963,8 @@ rpz_apply_qname_trigger(struct auth_zones* az, struct module_env* env,
|
|||
for(a = az->rpz_first; a; a = a->rpz_az_next) {
|
||||
lock_rw_rdlock(&a->lock);
|
||||
r = a->rpz;
|
||||
if(!r->taglist || taglist_intersect(r->taglist,
|
||||
r->taglistlen, taglist, taglen)) {
|
||||
if(!r->disabled && (!r->taglist || taglist_intersect(r->taglist,
|
||||
r->taglistlen, taglist, taglen))) {
|
||||
z = rpz_find_zone(r, qinfo->qname, qinfo->qname_len,
|
||||
qinfo->qclass, 0, 0, 0);
|
||||
if(z && r->action_override == RPZ_DISABLED_ACTION) {
|
||||
|
|
@ -1044,3 +1044,17 @@ rpz_apply_qname_trigger(struct auth_zones* az, struct module_env* env,
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rpz_enable(struct rpz* r)
|
||||
{
|
||||
if(!r)
|
||||
return;
|
||||
r->disabled = 0;
|
||||
}
|
||||
|
||||
void rpz_disable(struct rpz* r)
|
||||
{
|
||||
if(!r)
|
||||
return;
|
||||
r->disabled = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ struct rpz {
|
|||
int log;
|
||||
char* log_name;
|
||||
struct regional* region;
|
||||
int disabled;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -198,4 +199,16 @@ void rpz_finish_config(struct rpz* r);
|
|||
enum respip_action
|
||||
rpz_action_to_respip_action(enum rpz_action a);
|
||||
|
||||
/**
|
||||
* Enable RPZ
|
||||
* @param r: RPZ struct to enable
|
||||
*/
|
||||
void rpz_enable(struct rpz* r);
|
||||
|
||||
/**
|
||||
* Disable RPZ
|
||||
* @param r: RPZ struct to disable
|
||||
*/
|
||||
void rpz_disable(struct rpz* r);
|
||||
|
||||
#endif /* SERVICES_RPZ_H */
|
||||
|
|
|
|||
|
|
@ -82,6 +82,9 @@ static void usage(void) ATTR_NORETURN;
|
|||
static void ssl_err(const char* s) ATTR_NORETURN;
|
||||
static void ssl_path_err(const char* s, const char *path) ATTR_NORETURN;
|
||||
|
||||
/** timeout to wait for connection over stream, in msec */
|
||||
#define UNBOUND_CONTROL_CONNECT_TIMEOUT 5000
|
||||
|
||||
/** Give unbound-control usage, and exit (1). */
|
||||
static void
|
||||
usage(void)
|
||||
|
|
@ -164,6 +167,9 @@ usage(void)
|
|||
printf(" view_local_data_remove view name remove local-data in view\n");
|
||||
printf(" view_local_datas_remove view remove list of local-data from view\n");
|
||||
printf(" one entry per line read from stdin\n");
|
||||
printf(" rpz_enable zone Enable the RPZ zone if it had previously\n");
|
||||
printf(" been disabled\n");
|
||||
printf(" rpz_disable zone Disable the RPZ zone\n");
|
||||
printf("Version %s\n", PACKAGE_VERSION);
|
||||
printf("BSD licensed, see LICENSE in source package for details.\n");
|
||||
printf("Report bugs to %s\n", PACKAGE_BUGREPORT);
|
||||
|
|
@ -545,6 +551,30 @@ setup_ctx(struct config_file* cfg)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
/** check connect error */
|
||||
static void
|
||||
checkconnecterr(int err, const char* svr, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, int statuscmd, int useport)
|
||||
{
|
||||
#ifndef USE_WINSOCK
|
||||
if(!useport) log_err("connect: %s for %s", strerror(err), svr);
|
||||
else log_err_addr("connect", strerror(err), addr, addrlen);
|
||||
if(err == ECONNREFUSED && statuscmd) {
|
||||
printf("unbound is stopped\n");
|
||||
exit(3);
|
||||
}
|
||||
#else
|
||||
int wsaerr = err;
|
||||
if(!useport) log_err("connect: %s for %s", wsa_strerror(wsaerr), svr);
|
||||
else log_err_addr("connect", wsa_strerror(wsaerr), addr, addrlen);
|
||||
if(wsaerr == WSAECONNREFUSED && statuscmd) {
|
||||
printf("unbound is stopped\n");
|
||||
exit(3);
|
||||
}
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/** contact the server with TCP connect */
|
||||
static int
|
||||
contact_server(const char* svr, struct config_file* cfg, int statuscmd)
|
||||
|
|
@ -598,26 +628,75 @@ contact_server(const char* svr, struct config_file* cfg, int statuscmd)
|
|||
if(fd == -1) {
|
||||
fatal_exit("socket: %s", sock_strerror(errno));
|
||||
}
|
||||
fd_set_nonblock(fd);
|
||||
if(connect(fd, (struct sockaddr*)&addr, addrlen) < 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
int err = errno;
|
||||
if(!useport) log_err("connect: %s for %s", strerror(err), svr);
|
||||
else log_err_addr("connect", strerror(err), &addr, addrlen);
|
||||
if(err == ECONNREFUSED && statuscmd) {
|
||||
printf("unbound is stopped\n");
|
||||
exit(3);
|
||||
}
|
||||
#else
|
||||
int wsaerr = WSAGetLastError();
|
||||
if(!useport) log_err("connect: %s for %s", wsa_strerror(wsaerr), svr);
|
||||
else log_err_addr("connect", wsa_strerror(wsaerr), &addr, addrlen);
|
||||
if(wsaerr == WSAECONNREFUSED && statuscmd) {
|
||||
printf("unbound is stopped\n");
|
||||
exit(3);
|
||||
#ifdef EINPROGRESS
|
||||
if(errno != EINPROGRESS) {
|
||||
checkconnecterr(errno, svr, &addr,
|
||||
addrlen, statuscmd, useport);
|
||||
}
|
||||
#endif
|
||||
exit(1);
|
||||
#else
|
||||
if(WSAGetLastError() != WSAEINPROGRESS &&
|
||||
WSAGetLastError() != WSAEWOULDBLOCK) {
|
||||
checkconnecterr(WSAGetLastError(), svr, &addr,
|
||||
addrlen, statuscmd, useport);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
while(1) {
|
||||
fd_set rset, wset, eset;
|
||||
struct timeval tv;
|
||||
FD_ZERO(&rset);
|
||||
FD_SET(FD_SET_T fd, &rset);
|
||||
FD_ZERO(&wset);
|
||||
FD_SET(FD_SET_T fd, &wset);
|
||||
FD_ZERO(&eset);
|
||||
FD_SET(FD_SET_T fd, &eset);
|
||||
tv.tv_sec = UNBOUND_CONTROL_CONNECT_TIMEOUT/1000;
|
||||
tv.tv_usec= (UNBOUND_CONTROL_CONNECT_TIMEOUT%1000)*1000;
|
||||
if(select(fd+1, &rset, &wset, &eset, &tv) == -1) {
|
||||
fatal_exit("select: %s", sock_strerror(errno));
|
||||
}
|
||||
if(!FD_ISSET(fd, &rset) && !FD_ISSET(fd, &wset) &&
|
||||
!FD_ISSET(fd, &eset)) {
|
||||
fatal_exit("timeout: could not connect to server");
|
||||
} else {
|
||||
/* check nonblocking connect error */
|
||||
int error = 0;
|
||||
socklen_t len = (socklen_t)sizeof(error);
|
||||
if(getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&error,
|
||||
&len) < 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
error = errno; /* on solaris errno is error */
|
||||
#else
|
||||
error = WSAGetLastError();
|
||||
#endif
|
||||
}
|
||||
if(error != 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
#ifdef EINPROGRESS
|
||||
if(error == EINPROGRESS)
|
||||
continue; /* try again later */
|
||||
#endif
|
||||
#ifdef EWOULDBLOCK
|
||||
if(error == EWOULDBLOCK)
|
||||
continue; /* try again later */
|
||||
#endif
|
||||
#else
|
||||
if(error == WSAEINPROGRESS)
|
||||
continue; /* try again later */
|
||||
if(error == WSAEWOULDBLOCK)
|
||||
continue; /* try again later */
|
||||
#endif
|
||||
checkconnecterr(error, svr, &addr, addrlen,
|
||||
statuscmd, useport);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
fd_set_block(fd);
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@
|
|||
#include "util/fptr_wlist.h"
|
||||
#include "util/log.h"
|
||||
#include "services/mesh.h"
|
||||
#ifdef USE_DNSTAP
|
||||
#include "dnstap/dtstream.h"
|
||||
#endif
|
||||
|
||||
void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
|
||||
uint8_t* ATTR_UNUSED(buffer), size_t ATTR_UNUSED(len),
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@
|
|||
#include "sldns/sbuffer.h"
|
||||
#include "sldns/wire2str.h"
|
||||
#include "sldns/str2wire.h"
|
||||
#include "daemon/remote.h"
|
||||
#include <signal.h>
|
||||
struct worker;
|
||||
struct daemon_remote;
|
||||
|
|
@ -1766,7 +1767,7 @@ struct comm_point* outnet_comm_point_for_http(struct outside_network* outnet,
|
|||
}
|
||||
|
||||
int comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet,
|
||||
struct sockaddr* addr, socklen_t addrlen)
|
||||
struct sockaddr* addr, socklen_t addrlen, int ATTR_UNUSED(is_connected))
|
||||
{
|
||||
struct fake_commpoint* fc = (struct fake_commpoint*)c;
|
||||
struct replay_runtime* runtime = fc->runtime;
|
||||
|
|
|
|||
|
|
@ -42,16 +42,22 @@
|
|||
#ifdef HAVE_TIME_H
|
||||
# include <time.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include "testcode/testpkts.h"
|
||||
#include "testcode/replay.h"
|
||||
#include "testcode/fake_event.h"
|
||||
#include "daemon/remote.h"
|
||||
#include "libunbound/worker.h"
|
||||
#include "util/config_file.h"
|
||||
#include "sldns/keyraw.h"
|
||||
#include <ctype.h>
|
||||
#ifdef UB_ON_WINDOWS
|
||||
#include "winrc/win_svc.h"
|
||||
#endif
|
||||
|
||||
/** signal that this is a testbound compile */
|
||||
#define unbound_testbound 1
|
||||
/** renamed main routine */
|
||||
int daemon_main(int argc, char* argv[]);
|
||||
/**
|
||||
* include the main program from the unbound daemon.
|
||||
* rename main to daemon_main to call it
|
||||
|
|
@ -333,7 +339,7 @@ setup_playback(const char* filename, int* pass_argc, char* pass_argv[])
|
|||
}
|
||||
|
||||
/** remove config file at exit */
|
||||
void remove_configfile(void)
|
||||
static void remove_configfile(void)
|
||||
{
|
||||
struct config_strlist* p;
|
||||
for(p=cfgfiles; p; p=p->next)
|
||||
|
|
@ -551,22 +557,28 @@ void remote_get_opt_ssl(char* ATTR_UNUSED(str), void* ATTR_UNUSED(arg))
|
|||
log_assert(0);
|
||||
}
|
||||
|
||||
#ifdef UB_ON_WINDOWS
|
||||
void wsvc_command_option(const char* ATTR_UNUSED(wopt),
|
||||
const char* ATTR_UNUSED(cfgfile), int ATTR_UNUSED(v),
|
||||
int ATTR_UNUSED(c))
|
||||
{
|
||||
log_assert(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UB_ON_WINDOWS
|
||||
void wsvc_setup_worker(struct worker* ATTR_UNUSED(worker))
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UB_ON_WINDOWS
|
||||
void wsvc_desetup_worker(struct worker* ATTR_UNUSED(worker))
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UB_ON_WINDOWS
|
||||
void worker_win_stop_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
|
||||
|
|
|
|||
35
testdata/localdata.rpl
vendored
35
testdata/localdata.rpl
vendored
|
|
@ -35,6 +35,9 @@ server:
|
|||
local-zone: "redirect.top." redirect
|
||||
local-data: "redirect.top. A 20.30.40.54"
|
||||
|
||||
; null zone
|
||||
local-zone: "null.top." always_null
|
||||
|
||||
; create implicit data in the IN domain as well
|
||||
local-data: "a.a.implicit. A 20.30.41.50"
|
||||
local-data: "b.a.implicit. A 20.30.42.50"
|
||||
|
|
@ -355,4 +358,36 @@ SECTION ANSWER
|
|||
www.redirect.top. IN A 20.30.40.54
|
||||
ENTRY_END
|
||||
|
||||
; always_null zone
|
||||
STEP 60 QUERY
|
||||
ENTRY_BEGIN
|
||||
SECTION QUESTION
|
||||
null.top. IN A
|
||||
ENTRY_END
|
||||
STEP 61 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RA AA NOERROR
|
||||
SECTION QUESTION
|
||||
null.top. IN A
|
||||
SECTION ANSWER
|
||||
null.top. IN A 0.0.0.0
|
||||
ENTRY_END
|
||||
|
||||
; always_null zone AAAA
|
||||
STEP 62 QUERY
|
||||
ENTRY_BEGIN
|
||||
SECTION QUESTION
|
||||
foo.null.top. IN AAAA
|
||||
ENTRY_END
|
||||
STEP 63 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RA AA NOERROR
|
||||
SECTION QUESTION
|
||||
foo.null.top. IN AAAA
|
||||
SECTION ANSWER
|
||||
foo.null.top. IN AAAA ::0
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -2030,6 +2030,9 @@ server_local_zone: VAR_LOCAL_ZONE STRING_ARG STRING_ARG
|
|||
&& strcmp($3, "always_transparent")!=0
|
||||
&& strcmp($3, "always_refuse")!=0
|
||||
&& strcmp($3, "always_nxdomain")!=0
|
||||
&& strcmp($3, "always_nodata")!=0
|
||||
&& strcmp($3, "always_deny")!=0
|
||||
&& strcmp($3, "always_null")!=0
|
||||
&& strcmp($3, "noview")!=0
|
||||
&& strcmp($3, "inform")!=0 && strcmp($3, "inform_deny")!=0
|
||||
&& strcmp($3, "inform_redirect") != 0
|
||||
|
|
@ -2038,8 +2041,9 @@ server_local_zone: VAR_LOCAL_ZONE STRING_ARG STRING_ARG
|
|||
"refuse, redirect, transparent, "
|
||||
"typetransparent, inform, inform_deny, "
|
||||
"inform_redirect, always_transparent, "
|
||||
"always_refuse, always_nxdomain, noview "
|
||||
", nodefault or ipset");
|
||||
"always_refuse, always_nxdomain, "
|
||||
"always_nodata, always_deny, always_null, "
|
||||
"noview, nodefault or ipset");
|
||||
free($2);
|
||||
free($3);
|
||||
} else if(strcmp($3, "nodefault")==0) {
|
||||
|
|
|
|||
|
|
@ -1035,7 +1035,8 @@ static int inplace_cb_reply_call_generic(
|
|||
struct inplace_cb* callback_list, enum inplace_cb_list_type type,
|
||||
struct query_info* qinfo, struct module_qstate* qstate,
|
||||
struct reply_info* rep, int rcode, struct edns_data* edns,
|
||||
struct comm_reply* repinfo, struct regional* region)
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time)
|
||||
{
|
||||
struct inplace_cb* cb;
|
||||
struct edns_option* opt_list_out = NULL;
|
||||
|
|
@ -1048,7 +1049,7 @@ static int inplace_cb_reply_call_generic(
|
|||
fptr_ok(fptr_whitelist_inplace_cb_reply_generic(
|
||||
(inplace_cb_reply_func_type*)cb->cb, type));
|
||||
(void)(*(inplace_cb_reply_func_type*)cb->cb)(qinfo, qstate, rep,
|
||||
rcode, edns, &opt_list_out, repinfo, region, cb->id, cb->cb_arg);
|
||||
rcode, edns, &opt_list_out, repinfo, region, start_time, cb->id, cb->cb_arg);
|
||||
}
|
||||
edns->opt_list = opt_list_out;
|
||||
return 1;
|
||||
|
|
@ -1056,37 +1057,41 @@ static int inplace_cb_reply_call_generic(
|
|||
|
||||
int inplace_cb_reply_call(struct module_env* env, struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct comm_reply* repinfo, struct regional* region)
|
||||
struct edns_data* edns, struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time)
|
||||
{
|
||||
return inplace_cb_reply_call_generic(
|
||||
env->inplace_cb_lists[inplace_cb_reply], inplace_cb_reply, qinfo,
|
||||
qstate, rep, rcode, edns, repinfo, region);
|
||||
qstate, rep, rcode, edns, repinfo, region, start_time);
|
||||
}
|
||||
|
||||
int inplace_cb_reply_cache_call(struct module_env* env,
|
||||
struct query_info* qinfo, struct module_qstate* qstate,
|
||||
struct reply_info* rep, int rcode, struct edns_data* edns,
|
||||
struct comm_reply* repinfo, struct regional* region)
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time)
|
||||
{
|
||||
return inplace_cb_reply_call_generic(
|
||||
env->inplace_cb_lists[inplace_cb_reply_cache], inplace_cb_reply_cache,
|
||||
qinfo, qstate, rep, rcode, edns, repinfo, region);
|
||||
qinfo, qstate, rep, rcode, edns, repinfo, region, start_time);
|
||||
}
|
||||
|
||||
int inplace_cb_reply_local_call(struct module_env* env,
|
||||
struct query_info* qinfo, struct module_qstate* qstate,
|
||||
struct reply_info* rep, int rcode, struct edns_data* edns,
|
||||
struct comm_reply* repinfo, struct regional* region)
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time)
|
||||
{
|
||||
return inplace_cb_reply_call_generic(
|
||||
env->inplace_cb_lists[inplace_cb_reply_local], inplace_cb_reply_local,
|
||||
qinfo, qstate, rep, rcode, edns, repinfo, region);
|
||||
qinfo, qstate, rep, rcode, edns, repinfo, region, start_time);
|
||||
}
|
||||
|
||||
int inplace_cb_reply_servfail_call(struct module_env* env,
|
||||
struct query_info* qinfo, struct module_qstate* qstate,
|
||||
struct reply_info* rep, int rcode, struct edns_data* edns,
|
||||
struct comm_reply* repinfo, struct regional* region)
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time)
|
||||
{
|
||||
/* We are going to servfail. Remove any potential edns options. */
|
||||
if(qstate)
|
||||
|
|
@ -1094,7 +1099,7 @@ int inplace_cb_reply_servfail_call(struct module_env* env,
|
|||
return inplace_cb_reply_call_generic(
|
||||
env->inplace_cb_lists[inplace_cb_reply_servfail],
|
||||
inplace_cb_reply_servfail, qinfo, qstate, rep, rcode, edns, repinfo,
|
||||
region);
|
||||
region, start_time);
|
||||
}
|
||||
|
||||
int inplace_cb_query_call(struct module_env* env, struct query_info* qinfo,
|
||||
|
|
|
|||
|
|
@ -554,11 +554,14 @@ struct edns_option* edns_opt_list_find(struct edns_option* list, uint16_t code);
|
|||
* @param edns: edns data of the reply.
|
||||
* @param repinfo: comm_reply. Reply information for a communication point.
|
||||
* @param region: region to store data.
|
||||
* @param start_time: the start time of recursion, when the packet arrived,
|
||||
* or the current time for cache responses.
|
||||
* @return false on failure (a callback function returned an error).
|
||||
*/
|
||||
int inplace_cb_reply_call(struct module_env* env, struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct comm_reply* repinfo, struct regional* region);
|
||||
struct edns_data* edns, struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time);
|
||||
|
||||
/**
|
||||
* Call the registered functions in the inplace_cb_reply_cache linked list.
|
||||
|
|
@ -571,12 +574,15 @@ int inplace_cb_reply_call(struct module_env* env, struct query_info* qinfo,
|
|||
* @param edns: edns data of the reply. Edns input can be found here.
|
||||
* @param repinfo: comm_reply. Reply information for a communication point.
|
||||
* @param region: region to store data.
|
||||
* @param start_time: the start time of recursion, when the packet arrived,
|
||||
* or the current time for cache responses.
|
||||
* @return false on failure (a callback function returned an error).
|
||||
*/
|
||||
int inplace_cb_reply_cache_call(struct module_env* env,
|
||||
struct query_info* qinfo, struct module_qstate* qstate,
|
||||
struct reply_info* rep, int rcode, struct edns_data* edns,
|
||||
struct comm_reply* repinfo, struct regional* region);
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time);
|
||||
|
||||
/**
|
||||
* Call the registered functions in the inplace_cb_reply_local linked list.
|
||||
|
|
@ -589,12 +595,15 @@ int inplace_cb_reply_cache_call(struct module_env* env,
|
|||
* @param edns: edns data of the reply. Edns input can be found here.
|
||||
* @param repinfo: comm_reply. Reply information for a communication point.
|
||||
* @param region: region to store data.
|
||||
* @param start_time: the start time of recursion, when the packet arrived,
|
||||
* or the current time for cache responses.
|
||||
* @return false on failure (a callback function returned an error).
|
||||
*/
|
||||
int inplace_cb_reply_local_call(struct module_env* env,
|
||||
struct query_info* qinfo, struct module_qstate* qstate,
|
||||
struct reply_info* rep, int rcode, struct edns_data* edns,
|
||||
struct comm_reply* repinfo, struct regional* region);
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time);
|
||||
|
||||
/**
|
||||
* Call the registered functions in the inplace_cb_reply linked list.
|
||||
|
|
@ -608,12 +617,15 @@ int inplace_cb_reply_local_call(struct module_env* env,
|
|||
* is NULL.
|
||||
* @param repinfo: comm_reply. Reply information for a communication point.
|
||||
* @param region: region to store data.
|
||||
* @param start_time: the start time of recursion, when the packet arrived,
|
||||
* or the current time for cache responses.
|
||||
* @return false on failure (a callback function returned an error).
|
||||
*/
|
||||
int inplace_cb_reply_servfail_call(struct module_env* env,
|
||||
struct query_info* qinfo, struct module_qstate* qstate,
|
||||
struct reply_info* rep, int rcode, struct edns_data* edns,
|
||||
struct comm_reply* repinfo, struct regional* region);
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time);
|
||||
|
||||
/**
|
||||
* Call the registered functions in the inplace_cb_query linked list.
|
||||
|
|
|
|||
|
|
@ -3575,7 +3575,6 @@
|
|||
3977,
|
||||
3978,
|
||||
3979,
|
||||
3980,
|
||||
3981,
|
||||
3982,
|
||||
3983,
|
||||
|
|
|
|||
|
|
@ -257,8 +257,8 @@ struct inplace_cb {
|
|||
typedef int inplace_cb_reply_func_type(struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct edns_option** opt_list_out,
|
||||
struct comm_reply* repinfo, struct regional* region, int id,
|
||||
void* callback);
|
||||
struct comm_reply* repinfo, struct regional* region,
|
||||
struct timeval* start_time, int id, void* callback);
|
||||
|
||||
/**
|
||||
* Inplace callback function called before sending the query to a nameserver.
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ int tcp_connect_errno_needs_log(struct sockaddr* addr, socklen_t addrlen)
|
|||
/* send a UDP reply */
|
||||
int
|
||||
comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet,
|
||||
struct sockaddr* addr, socklen_t addrlen)
|
||||
struct sockaddr* addr, socklen_t addrlen, int is_connected)
|
||||
{
|
||||
ssize_t sent;
|
||||
log_assert(c->fd != -1);
|
||||
|
|
@ -351,8 +351,8 @@ comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet,
|
|||
if(sldns_buffer_remaining(packet) == 0)
|
||||
log_err("error: send empty UDP packet");
|
||||
#endif
|
||||
if(addr) {
|
||||
log_assert(addr && addrlen > 0);
|
||||
if(!is_connected) {
|
||||
sent = sendto(c->fd, (void*)sldns_buffer_begin(packet),
|
||||
sldns_buffer_remaining(packet), 0,
|
||||
addr, addrlen);
|
||||
|
|
@ -377,9 +377,14 @@ comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet,
|
|||
#endif
|
||||
int e;
|
||||
fd_set_block(c->fd);
|
||||
if (!is_connected) {
|
||||
sent = sendto(c->fd, (void*)sldns_buffer_begin(packet),
|
||||
sldns_buffer_remaining(packet), 0,
|
||||
addr, addrlen);
|
||||
} else {
|
||||
sent = send(c->fd, (void*)sldns_buffer_begin(packet),
|
||||
sldns_buffer_remaining(packet), 0);
|
||||
}
|
||||
e = errno;
|
||||
fd_set_nonblock(c->fd);
|
||||
errno = e;
|
||||
|
|
@ -388,7 +393,12 @@ comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet,
|
|||
if(sent == -1) {
|
||||
if(!udp_send_errno_needs_log(addr, addrlen))
|
||||
return 0;
|
||||
if (!is_connected) {
|
||||
verbose(VERB_OPS, "sendto failed: %s", sock_strerror(errno));
|
||||
} else {
|
||||
verbose(VERB_OPS, "send failed: %s", sock_strerror(errno));
|
||||
}
|
||||
if(addr)
|
||||
log_addr(VERB_OPS, "remote address is",
|
||||
(struct sockaddr_storage*)addr, addrlen);
|
||||
return 0;
|
||||
|
|
@ -596,6 +606,7 @@ comm_point_send_udp_msg_if(struct comm_point *c, sldns_buffer* packet,
|
|||
static int udp_recv_needs_log(int err)
|
||||
{
|
||||
switch(err) {
|
||||
case EACCES: /* some hosts send ICMP 'Permission Denied' */
|
||||
#ifndef USE_WINSOCK
|
||||
case ECONNREFUSED:
|
||||
# ifdef ENETUNREACH
|
||||
|
|
@ -776,7 +787,7 @@ comm_point_udp_callback(int fd, short event, void* arg)
|
|||
buffer = rep.c->buffer;
|
||||
#endif
|
||||
(void)comm_point_send_udp_msg(rep.c, buffer,
|
||||
(struct sockaddr*)&rep.addr, rep.addrlen);
|
||||
(struct sockaddr*)&rep.addr, rep.addrlen, 0);
|
||||
}
|
||||
if(!rep.c || rep.c->fd != fd) /* commpoint closed to -1 or reused for
|
||||
another UDP port. Note rep.c cannot be reused with TCP fd. */
|
||||
|
|
@ -1622,6 +1633,26 @@ comm_point_tcp_handle_read(int fd, struct comm_point* c, int short_ok)
|
|||
if(errno == ECONNRESET && verbosity < 2)
|
||||
return 0; /* silence reset by peer */
|
||||
#endif
|
||||
#ifdef ENETUNREACH
|
||||
if(errno == ENETUNREACH && verbosity < 2)
|
||||
return 0; /* silence it */
|
||||
#endif
|
||||
#ifdef EHOSTDOWN
|
||||
if(errno == EHOSTDOWN && verbosity < 2)
|
||||
return 0; /* silence it */
|
||||
#endif
|
||||
#ifdef EHOSTUNREACH
|
||||
if(errno == EHOSTUNREACH && verbosity < 2)
|
||||
return 0; /* silence it */
|
||||
#endif
|
||||
#ifdef ENETDOWN
|
||||
if(errno == ENETDOWN && verbosity < 2)
|
||||
return 0; /* silence it */
|
||||
#endif
|
||||
#ifdef EACCES
|
||||
if(errno == EACCES && verbosity < 2)
|
||||
return 0; /* silence it */
|
||||
#endif
|
||||
#ifdef ENOTCONN
|
||||
if(errno == ENOTCONN) {
|
||||
log_err_addr("read (in tcp s) failed and this could be because TCP Fast Open is enabled [--disable-tfo-client --disable-tfo-server] but does not work", sock_strerror(errno),
|
||||
|
|
@ -1927,7 +1958,7 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
|
|||
log_assert(c->tcp_write_and_read || sldns_buffer_remaining(buffer) > 0);
|
||||
log_assert(!c->tcp_write_and_read || c->tcp_write_byte_count < c->tcp_write_pkt_len + 2);
|
||||
if(c->tcp_write_and_read) {
|
||||
r = send(fd, (void*)c->tcp_write_pkt + c->tcp_write_byte_count - 2,
|
||||
r = send(fd, (void*)(c->tcp_write_pkt + c->tcp_write_byte_count - 2),
|
||||
c->tcp_write_pkt_len + 2 - c->tcp_write_byte_count, 0);
|
||||
} else {
|
||||
r = send(fd, (void*)sldns_buffer_current(buffer),
|
||||
|
|
@ -2395,7 +2426,7 @@ http_nonchunk_segment(struct comm_point* c)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/** handle nonchunked data segment, return 0=fail, 1=wait, 2=process more */
|
||||
/** handle chunked data segment, return 0=fail, 1=wait, 2=process more */
|
||||
static int
|
||||
http_chunked_segment(struct comm_point* c)
|
||||
{
|
||||
|
|
@ -2405,6 +2436,7 @@ http_chunked_segment(struct comm_point* c)
|
|||
*/
|
||||
size_t remainbufferlen;
|
||||
size_t got_now = sldns_buffer_limit(c->buffer) - c->http_stored;
|
||||
verbose(VERB_ALGO, "http_chunked_segment: got now %d, tcpbytcount %d, http_stored %d, buffer pos %d, buffer limit %d", (int)got_now, (int)c->tcp_byte_count, (int)c->http_stored, (int)sldns_buffer_position(c->buffer), (int)sldns_buffer_limit(c->buffer));
|
||||
if(c->tcp_byte_count <= got_now) {
|
||||
/* the chunk has completed (with perhaps some extra data
|
||||
* from next chunk header and next chunk) */
|
||||
|
|
@ -2472,7 +2504,7 @@ http_chunked_segment(struct comm_point* c)
|
|||
|
||||
#ifdef HAVE_NGHTTP2
|
||||
/** Create new http2 session. Called when creating handling comm point. */
|
||||
struct http2_session* http2_session_create(struct comm_point* c)
|
||||
static struct http2_session* http2_session_create(struct comm_point* c)
|
||||
{
|
||||
struct http2_session* session = calloc(1, sizeof(*session));
|
||||
if(!session) {
|
||||
|
|
@ -2486,7 +2518,7 @@ struct http2_session* http2_session_create(struct comm_point* c)
|
|||
#endif
|
||||
|
||||
/** Delete http2 session. After closing connection or on error */
|
||||
void http2_session_delete(struct http2_session* h2_session)
|
||||
static void http2_session_delete(struct http2_session* h2_session)
|
||||
{
|
||||
#ifdef HAVE_NGHTTP2
|
||||
if(h2_session->callbacks)
|
||||
|
|
@ -2562,7 +2594,7 @@ void http2_session_add_stream(struct http2_session* h2_session,
|
|||
|
||||
/** remove stream from session linked list. After stream close callback or
|
||||
* closing connection */
|
||||
void http2_session_remove_stream(struct http2_session* h2_session,
|
||||
static void http2_session_remove_stream(struct http2_session* h2_session,
|
||||
struct http2_stream* h2_stream)
|
||||
{
|
||||
if(h2_stream->prev)
|
||||
|
|
@ -2744,6 +2776,11 @@ comm_point_http_handle_read(int fd, struct comm_point* c)
|
|||
}
|
||||
|
||||
sldns_buffer_flip(c->buffer);
|
||||
/* if we are partway in a segment of data, position us at the point
|
||||
* where we left off previously */
|
||||
if(c->http_stored < sldns_buffer_limit(c->buffer))
|
||||
sldns_buffer_set_position(c->buffer, c->http_stored);
|
||||
else sldns_buffer_set_position(c->buffer, sldns_buffer_limit(c->buffer));
|
||||
|
||||
while(sldns_buffer_remaining(c->buffer) > 0) {
|
||||
/* Handle HTTP/1.x data */
|
||||
|
|
@ -3214,6 +3251,7 @@ comm_point_create_udp(struct comm_base *base, int fd, sldns_buffer* buffer,
|
|||
comm_point_delete(c);
|
||||
return NULL;
|
||||
}
|
||||
c->event_added = 1;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
@ -3274,6 +3312,7 @@ comm_point_create_udp_ancil(struct comm_base *base, int fd,
|
|||
comm_point_delete(c);
|
||||
return NULL;
|
||||
}
|
||||
c->event_added = 1;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
@ -3562,6 +3601,7 @@ comm_point_create_tcp(struct comm_base *base, int fd, int num,
|
|||
comm_point_delete(c);
|
||||
return NULL;
|
||||
}
|
||||
c->event_added = 1;
|
||||
/* now prealloc the handlers */
|
||||
for(i=0; i<num; i++) {
|
||||
if(port_type == listen_type_tcp ||
|
||||
|
|
@ -3785,6 +3825,7 @@ comm_point_create_local(struct comm_base *base, int fd, size_t bufsize,
|
|||
free(c);
|
||||
return NULL;
|
||||
}
|
||||
c->event_added = 1;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
@ -3847,6 +3888,7 @@ comm_point_create_raw(struct comm_base* base, int fd, int writing,
|
|||
free(c);
|
||||
return NULL;
|
||||
}
|
||||
c->event_added = 1;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
@ -3857,9 +3899,12 @@ comm_point_close(struct comm_point* c)
|
|||
return;
|
||||
if(c->fd != -1) {
|
||||
verbose(5, "comm_point_close of %d: event_del", c->fd);
|
||||
if(c->event_added) {
|
||||
if(ub_event_del(c->ev->ev) != 0) {
|
||||
log_err("could not event_del on close");
|
||||
}
|
||||
c->event_added = 0;
|
||||
}
|
||||
}
|
||||
tcl_close_connection(c->tcl_addr);
|
||||
if(c->tcp_req_info)
|
||||
|
|
@ -3942,7 +3987,7 @@ comm_point_send_reply(struct comm_reply *repinfo)
|
|||
repinfo->addrlen, repinfo);
|
||||
else
|
||||
comm_point_send_udp_msg(repinfo->c, buffer,
|
||||
(struct sockaddr*)&repinfo->addr, repinfo->addrlen);
|
||||
(struct sockaddr*)&repinfo->addr, repinfo->addrlen, 0);
|
||||
#ifdef USE_DNSTAP
|
||||
/*
|
||||
* sending src (client)/dst (local service) addresses over DNSTAP from udp callback
|
||||
|
|
@ -4013,9 +4058,12 @@ void
|
|||
comm_point_stop_listening(struct comm_point* c)
|
||||
{
|
||||
verbose(VERB_ALGO, "comm point stop listening %d", c->fd);
|
||||
if(c->event_added) {
|
||||
if(ub_event_del(c->ev->ev) != 0) {
|
||||
log_err("event_del error to stoplisten");
|
||||
}
|
||||
c->event_added = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -4027,6 +4075,12 @@ comm_point_start_listening(struct comm_point* c, int newfd, int msec)
|
|||
/* no use to start listening no free slots. */
|
||||
return;
|
||||
}
|
||||
if(c->event_added) {
|
||||
if(ub_event_del(c->ev->ev) != 0) {
|
||||
log_err("event_del error to startlisten");
|
||||
}
|
||||
c->event_added = 0;
|
||||
}
|
||||
if(msec != -1 && msec != 0) {
|
||||
if(!c->timeout) {
|
||||
c->timeout = (struct timeval*)malloc(sizeof(
|
||||
|
|
@ -4066,20 +4120,25 @@ comm_point_start_listening(struct comm_point* c, int newfd, int msec)
|
|||
if(ub_event_add(c->ev->ev, msec==0?NULL:c->timeout) != 0) {
|
||||
log_err("event_add failed. in cpsl.");
|
||||
}
|
||||
c->event_added = 1;
|
||||
}
|
||||
|
||||
void comm_point_listen_for_rw(struct comm_point* c, int rd, int wr)
|
||||
{
|
||||
verbose(VERB_ALGO, "comm point listen_for_rw %d %d", c->fd, wr);
|
||||
if(c->event_added) {
|
||||
if(ub_event_del(c->ev->ev) != 0) {
|
||||
log_err("event_del error to cplf");
|
||||
}
|
||||
c->event_added = 0;
|
||||
}
|
||||
ub_event_del_bits(c->ev->ev, UB_EV_READ|UB_EV_WRITE);
|
||||
if(rd) ub_event_add_bits(c->ev->ev, UB_EV_READ);
|
||||
if(wr) ub_event_add_bits(c->ev->ev, UB_EV_WRITE);
|
||||
if(ub_event_add(c->ev->ev, c->timeout) != 0) {
|
||||
log_err("event_add failed. in cplf.");
|
||||
}
|
||||
c->event_added = 1;
|
||||
}
|
||||
|
||||
size_t comm_point_get_mem(struct comm_point* c)
|
||||
|
|
|
|||
|
|
@ -167,6 +167,8 @@ struct comm_reply {
|
|||
struct comm_point {
|
||||
/** behind the scenes structure, with say libevent info. alloced. */
|
||||
struct internal_event* ev;
|
||||
/** if the event is added or not */
|
||||
int event_added;
|
||||
|
||||
struct unbound_socket* socket;
|
||||
|
||||
|
|
@ -639,10 +641,11 @@ void comm_point_drop_reply(struct comm_reply* repinfo);
|
|||
* @param addr: where to send it to. If NULL, send is performed,
|
||||
* for connected sockets, to the connected address.
|
||||
* @param addrlen: length of addr.
|
||||
* @param is_connected: if the UDP socket is connect()ed.
|
||||
* @return: false on a failure.
|
||||
*/
|
||||
int comm_point_send_udp_msg(struct comm_point* c, struct sldns_buffer* packet,
|
||||
struct sockaddr* addr, socklen_t addrlen);
|
||||
struct sockaddr* addr, socklen_t addrlen,int is_connected);
|
||||
|
||||
/**
|
||||
* Stop listening for input on the commpoint. No callbacks will happen.
|
||||
|
|
|
|||
|
|
@ -399,12 +399,12 @@ lruhash_remove(struct lruhash* table, hashvalue_type hash, void* key)
|
|||
}
|
||||
table->num--;
|
||||
table->space_used -= (*table->sizefunc)(entry->key, entry->data);
|
||||
lock_quick_unlock(&table->lock);
|
||||
lock_rw_wrlock(&entry->lock);
|
||||
if(table->markdelfunc)
|
||||
(*table->markdelfunc)(entry->key);
|
||||
lock_rw_unlock(&entry->lock);
|
||||
lock_quick_unlock(&bin->lock);
|
||||
lock_quick_unlock(&table->lock);
|
||||
/* finish removal */
|
||||
d = entry->data;
|
||||
(*table->delkeyfunc)(entry->key, table->cb_arg);
|
||||
|
|
|
|||
Loading…
Reference in a new issue