import unbound 1.4.21
This commit is contained in:
parent
697291b66c
commit
f61d78fb42
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/unbound/dist/; revision=266075 svn path=/vendor/unbound/1.4.21/; revision=266076; tag=vendor/unbound/1.4.21
19
Makefile.in
19
Makefile.in
@ -30,6 +30,9 @@ PYTHONMOD_INSTALL=@PYTHONMOD_INSTALL@
|
||||
PYTHONMOD_UNINSTALL=@PYTHONMOD_UNINSTALL@
|
||||
PYUNBOUND_INSTALL=@PYUNBOUND_INSTALL@
|
||||
PYUNBOUND_UNINSTALL=@PYUNBOUND_UNINSTALL@
|
||||
UNBOUND_VERSION_MAJOR=@UNBOUND_VERSION_MAJOR@
|
||||
UNBOUND_VERSION_MINOR=@UNBOUND_VERSION_MINOR@
|
||||
UNBOUND_VERSION_MICRO=@UNBOUND_VERSION_MICRO@
|
||||
ALLTARGET=@ALLTARGET@
|
||||
|
||||
# _unbound.la if pyunbound enabled.
|
||||
@ -275,7 +278,7 @@ test: unittest$(EXEEXT) testbound$(EXEEXT)
|
||||
longtest: tests
|
||||
if test -x "`which bash`"; then bash testcode/do-tests.sh; else sh testcode/do-tests.sh; fi
|
||||
|
||||
lib: libunbound.la
|
||||
lib: libunbound.la unbound.h
|
||||
|
||||
libunbound.la: $(LIBUNBOUND_OBJ_LINK)
|
||||
$(LINK_LIB) $(UBSYMS) -o $@ $(LIBUNBOUND_OBJ_LINK) -rpath $(libdir) -lssl $(LIBS)
|
||||
@ -340,6 +343,9 @@ delayer$(EXEEXT): $(DELAYER_OBJ_LINK)
|
||||
harvest$(EXEEXT): $(HARVEST_OBJ_LINK) libunbound.la
|
||||
$(LINK) -o $@ $(HARVEST_OBJ_LINK) $(LIBS) -L. -L.libs -lunbound
|
||||
|
||||
unbound.h: $(srcdir)/libunbound/unbound.h
|
||||
sed -e 's/@''UNBOUND_VERSION_MAJOR@/$(UNBOUND_VERSION_MAJOR)/' -e 's/@''UNBOUND_VERSION_MINOR@/$(UNBOUND_VERSION_MINOR)/' -e 's/@''UNBOUND_VERSION_MICRO@/$(UNBOUND_VERSION_MICRO)/' < $(srcdir)/libunbound/unbound.h > $@
|
||||
|
||||
unbound-control-setup: $(srcdir)/smallapp/unbound-control-setup.sh
|
||||
sed -e 's:^DESTDIR=.*$$:DESTDIR=$(UNBOUND_RUN_DIR):' < $(srcdir)/smallapp/unbound-control-setup.sh > $@
|
||||
-chmod +x $@
|
||||
@ -367,8 +373,8 @@ pythonmod/interface.h: $(srcdir)/pythonmod/interface.i config.h
|
||||
$(SWIG) $(CPPFLAGS) -o $@ -python $(srcdir)/pythonmod/interface.i
|
||||
|
||||
libunbound_wrap.lo libunbound_wrap.o: libunbound/python/libunbound_wrap.c \
|
||||
$(srcdir)/libunbound/unbound.h
|
||||
libunbound/python/libunbound_wrap.c: $(srcdir)/libunbound/python/libunbound.i $(srcdir)/libunbound/unbound.h
|
||||
unbound.h
|
||||
libunbound/python/libunbound_wrap.c: $(srcdir)/libunbound/python/libunbound.i unbound.h
|
||||
@-if test ! -d libunbound/python; then $(INSTALL) -d libunbound/python; fi
|
||||
$(SWIG) -python -o $@ $(CPPFLAGS) $(srcdir)/libunbound/python/libunbound.i
|
||||
|
||||
@ -391,7 +397,7 @@ util/configparser.c util/configparser.h: $(srcdir)/util/configparser.y
|
||||
|
||||
clean:
|
||||
rm -f *.o *.d *.lo *~ tags
|
||||
rm -f unbound$(EXEEXT) unbound-checkconf$(EXEEXT) unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-anchor$(EXEEXT) unbound-control-setup libunbound.la
|
||||
rm -f unbound$(EXEEXT) unbound-checkconf$(EXEEXT) unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-anchor$(EXEEXT) unbound-control-setup libunbound.la unbound.h
|
||||
rm -f $(ALL_SRC:.c=.lint)
|
||||
rm -f _unbound.la libunbound/python/libunbound_wrap.c libunbound/python/unbound.py pythonmod/interface.h pythonmod/unboundmodule.py
|
||||
rm -rf autom4te.cache .libs build doc/html doc/xml
|
||||
@ -466,6 +472,7 @@ install: all $(PYTHONMOD_INSTALL) $(PYUNBOUND_INSTALL)
|
||||
$(INSTALL) -c -m 644 doc/unbound.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 doc/unbound-checkconf.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 doc/unbound-control.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 doc/unbound-control.8 $(DESTDIR)$(mandir)/man8/unbound-control-setup.8
|
||||
$(INSTALL) -c -m 644 doc/unbound-anchor.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 doc/unbound.conf.5 $(DESTDIR)$(mandir)/man5
|
||||
$(INSTALL) -c -m 644 $(srcdir)/doc/unbound-host.1 $(DESTDIR)$(mandir)/man1
|
||||
@ -482,7 +489,7 @@ install: all $(PYTHONMOD_INSTALL) $(PYUNBOUND_INSTALL)
|
||||
done
|
||||
$(INSTALL) -c -m 755 unbound-control-setup $(DESTDIR)$(sbindir)/unbound-control-setup
|
||||
if test ! -e $(DESTDIR)$(configfile); then $(INSTALL) -d `dirname $(DESTDIR)$(configfile)`; $(INSTALL) -c -m 644 doc/example.conf $(DESTDIR)$(configfile); fi
|
||||
$(LIBTOOL) --mode=install cp $(srcdir)/libunbound/unbound.h $(DESTDIR)$(includedir)/unbound.h
|
||||
$(LIBTOOL) --mode=install cp unbound.h $(DESTDIR)$(includedir)/unbound.h
|
||||
$(LIBTOOL) --mode=install cp libunbound.la $(DESTDIR)$(libdir)
|
||||
$(LIBTOOL) --mode=finish $(DESTDIR)$(libdir)
|
||||
|
||||
@ -495,7 +502,7 @@ pyunbound-uninstall:
|
||||
|
||||
uninstall: $(PYTHONMOD_UNINSTALL) $(PYUNBOUND_UNINSTALL)
|
||||
rm -f -- $(DESTDIR)$(sbindir)/unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-anchor$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control-setup
|
||||
rm -f -- $(DESTDIR)$(mandir)/man8/unbound.8 $(DESTDIR)$(mandir)/man8/unbound-checkconf.8 $(DESTDIR)$(mandir)/man5/unbound.conf.5 $(DESTDIR)$(mandir)/man8/unbound-control.8 $(DESTDIR)$(mandir)/man8/unbound-anchor.8
|
||||
rm -f -- $(DESTDIR)$(mandir)/man8/unbound.8 $(DESTDIR)$(mandir)/man8/unbound-checkconf.8 $(DESTDIR)$(mandir)/man5/unbound.conf.5 $(DESTDIR)$(mandir)/man8/unbound-control.8 $(DESTDIR)$(mandir)/man8/unbound-anchor.8 $(DESTDIR)$(mandir)/man8/unbound-control-setup.8
|
||||
rm -f -- $(DESTDIR)$(mandir)/man1/unbound-host.1 $(DESTDIR)$(mandir)/man3/libunbound.3
|
||||
for mpage in ub_ctx ub_result ub_ctx_create ub_ctx_delete \
|
||||
ub_ctx_set_option ub_ctx_get_option ub_ctx_config ub_ctx_set_fwd \
|
||||
|
@ -2,7 +2,11 @@
|
||||
# Copyright 2009, Wouter Wijngaards, NLnet Labs.
|
||||
# BSD licensed.
|
||||
#
|
||||
# Version 21
|
||||
# Version 25
|
||||
# 2013-07-18 Enable ACX_CHECK_COMPILER_FLAG to test for -Wstrict-prototypes
|
||||
# 2013-06-25 FLTO has --disable-flto option.
|
||||
# 2013-05-03 Update W32_SLEEP for newer mingw that links but not defines it.
|
||||
# 2013-03-22 Fix ACX_RSRC_VERSION for long version numbers.
|
||||
# 2012-02-09 Fix AHX_MEMCMP_BROKEN with undef in compat/memcmp.h.
|
||||
# 2012-01-20 Fix COMPILER_FLAGS_UNBOUND for gcc 4.6.2 assigned-not-used-warns.
|
||||
# 2011-12-05 Fix getaddrinfowithincludes on windows with fedora16 mingw32-gcc.
|
||||
@ -101,7 +105,7 @@ dnl Calculate comma separated windows-resource numbers from package version.
|
||||
dnl Picks the first three(,0) or four numbers out of the name.
|
||||
dnl $1: variable for the result
|
||||
AC_DEFUN([ACX_RSRC_VERSION],
|
||||
[$1=[`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*$/\1,\2,\3,0/' `]
|
||||
[$1=[`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9]*$/\1,\2,\3,0/' `]
|
||||
])
|
||||
|
||||
dnl Routine to help check for compiler flags.
|
||||
@ -116,7 +120,7 @@ AC_MSG_CHECKING(whether $CC supports -$1)
|
||||
cache=`echo $1 | sed 'y%.=/+-%___p_%'`
|
||||
AC_CACHE_VAL(cv_prog_cc_flag_$cache,
|
||||
[
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -$1 -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -405,19 +409,22 @@ int test() {
|
||||
dnl Check if CC supports -flto.
|
||||
dnl in a way that supports clang and suncc (that flag does something else,
|
||||
dnl but fails to link). It sets it in CFLAGS if it works.
|
||||
AC_DEFUN([ACX_CHECK_FLTO],
|
||||
[AC_MSG_CHECKING([if $CC supports -flto])
|
||||
BAKCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -flto"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
|
||||
if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then
|
||||
CFLAGS="$BAKCFLAGS"
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
rm -f conftest conftest.c conftest.o
|
||||
], [CFLAGS="$BAKCFLAGS" ; AC_MSG_RESULT(no)])
|
||||
AC_DEFUN([ACX_CHECK_FLTO], [
|
||||
AC_ARG_ENABLE([flto], AS_HELP_STRING([--disable-flto], [Disable link-time optimization]))
|
||||
AS_IF([test "x$enable_flto" != "xno"], [
|
||||
AC_MSG_CHECKING([if $CC supports -flto])
|
||||
BAKCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -flto"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
|
||||
if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then
|
||||
CFLAGS="$BAKCFLAGS"
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
rm -f conftest conftest.c conftest.o
|
||||
], [CFLAGS="$BAKCFLAGS" ; AC_MSG_RESULT(no)])
|
||||
])
|
||||
])
|
||||
|
||||
dnl Check the printf-format attribute (if any)
|
||||
@ -1208,7 +1215,7 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result);
|
||||
dnl provide w32 compat definition for sleep
|
||||
AC_DEFUN([AHX_CONFIG_W32_SLEEP],
|
||||
[
|
||||
#ifndef HAVE_SLEEP
|
||||
#if !defined(HAVE_SLEEP) || defined(HAVE_WINDOWS_H)
|
||||
#define sleep(x) Sleep((x)*1000) /* on win32 */
|
||||
#endif /* HAVE_SLEEP */
|
||||
])
|
||||
|
280
acx_pthread.m4
280
acx_pthread.m4
@ -1,280 +0,0 @@
|
||||
##### http://autoconf-archive.cryp.to/acx_pthread.html
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro figures out how to build C programs using POSIX threads.
|
||||
# It sets the PTHREAD_LIBS output variable to the threads library and
|
||||
# linker flags, and the PTHREAD_CFLAGS output variable to any special
|
||||
# C compiler flags that are needed. (The user can also force certain
|
||||
# compiler flags/libs to be tested by setting these environment
|
||||
# variables.)
|
||||
#
|
||||
# Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||
# multi-threaded programs (defaults to the value of CC otherwise).
|
||||
# (This is necessary on AIX to use the special cc_r compiler alias.)
|
||||
#
|
||||
# NOTE: You are assumed to not only compile your program with these
|
||||
# flags, but also link it with them as well. e.g. you should link
|
||||
# with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
|
||||
# $LIBS
|
||||
#
|
||||
# If you are only building threads programs, you may wish to use
|
||||
# these variables in your default LIBS, CFLAGS, and CC:
|
||||
#
|
||||
# LIBS="$PTHREAD_LIBS $LIBS"
|
||||
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
# CC="$PTHREAD_CC"
|
||||
#
|
||||
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
|
||||
# constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
|
||||
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||
#
|
||||
# ACTION-IF-FOUND is a list of shell commands to run if a threads
|
||||
# library is found, and ACTION-IF-NOT-FOUND is a list of commands to
|
||||
# run it if it is not found. If ACTION-IF-FOUND is not specified, the
|
||||
# default action will define HAVE_PTHREAD.
|
||||
#
|
||||
# Please let the authors know if this macro fails on any platform, or
|
||||
# if you have any other suggestions or comments. This macro was based
|
||||
# on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
|
||||
# (with help from M. Frigo), as well as ac_pthread and hb_pthread
|
||||
# macros posted by Alejandro Forero Cuervo to the autoconf macro
|
||||
# repository. We are also grateful for the helpful feedback of
|
||||
# numerous users.
|
||||
#
|
||||
# LAST MODIFICATION
|
||||
#
|
||||
# 2006-05-29
|
||||
#
|
||||
# COPYLEFT
|
||||
#
|
||||
# Copyright (c) 2006 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright
|
||||
# owner gives unlimited permission to copy, distribute and modify the
|
||||
# configure scripts that are the output of Autoconf when processing
|
||||
# the Macro. You need not follow the terms of the GNU General Public
|
||||
# License when using or distributing such scripts, even though
|
||||
# portions of the text of the Macro appear in them. The GNU General
|
||||
# Public License (GPL) does govern all other use of the material that
|
||||
# constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the
|
||||
# Autoconf Macro released by the Autoconf Macro Archive. When you
|
||||
# make and distribute a modified version of the Autoconf Macro, you
|
||||
# may extend this special exception to the GPL to apply to your
|
||||
# modified version as well.
|
||||
|
||||
AC_DEFUN([ACX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
acx_pthread_ok=no
|
||||
|
||||
# We used to check for pthread.h first, but this fails if pthread.h
|
||||
# requires special compiler flags (e.g. on True64 or Sequent).
|
||||
# It gets checked for in the link test anyway.
|
||||
|
||||
# First of all, check if the user has set any of the PTHREAD_LIBS,
|
||||
# etcetera environment variables, and if threads linking works using
|
||||
# them:
|
||||
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
|
||||
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
|
||||
AC_MSG_RESULT($acx_pthread_ok)
|
||||
if test x"$acx_pthread_ok" = xno; then
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
fi
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
fi
|
||||
|
||||
# We must check for the threads library under a number of different
|
||||
# names; the ordering is very important because some systems
|
||||
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
|
||||
# libraries is broken (non-POSIX).
|
||||
|
||||
# Create a list of thread flags to try. Items starting with a "-" are
|
||||
# C compiler flags, and other items are library names, except for "none"
|
||||
# which indicates that we try without any flags at all, and "pthread-config"
|
||||
# which is a program returning the flags for the Pth emulation library.
|
||||
|
||||
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||
|
||||
# The ordering *is* (sometimes) important. Some notes on the
|
||||
# individual items follow:
|
||||
|
||||
# pthreads: AIX (must check this before -lpthread)
|
||||
# none: in case threads are in libc; should be tried before -Kthread and
|
||||
# other compiler flags to prevent continual compiler warnings
|
||||
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
|
||||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
||||
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
||||
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
|
||||
# -pthreads: Solaris/gcc
|
||||
# -mthreads: Mingw32/gcc, Lynx/gcc
|
||||
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
|
||||
# doesn't hurt to check since this sometimes defines pthreads too;
|
||||
# also defines -D_REENTRANT)
|
||||
# ... -mt is also the pthreads flag for HP/aCC
|
||||
# pthread: Linux, etcetera
|
||||
# --thread-safe: KAI C++
|
||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*solaris*)
|
||||
|
||||
# On Solaris (at least, for some versions), libc contains stubbed
|
||||
# (non-functional) versions of the pthreads routines, so link-based
|
||||
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
|
||||
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
|
||||
# a function called by this macro, so we could check for that, but
|
||||
# who knows whether they'll stub that too in a future libc.) So,
|
||||
# we'll just look for -pthreads and -lpthread first:
|
||||
|
||||
acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x"$acx_pthread_ok" = xno; then
|
||||
for flag in $acx_pthread_flags; do
|
||||
|
||||
case $flag in
|
||||
none)
|
||||
AC_MSG_CHECKING([whether pthreads work without any flags])
|
||||
;;
|
||||
|
||||
-*)
|
||||
AC_MSG_CHECKING([whether pthreads work with $flag])
|
||||
PTHREAD_CFLAGS="$flag"
|
||||
;;
|
||||
|
||||
pthread-config)
|
||||
AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
|
||||
if test x"$acx_pthread_config" = xno; then continue; fi
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_CHECKING([for the pthreads library -l$flag])
|
||||
PTHREAD_LIBS="-l$flag"
|
||||
;;
|
||||
esac
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Check for various functions. We must include pthread.h,
|
||||
# since some functions may be macros. (On the Sequent, we
|
||||
# need a special flag -Kthread to make this header compile.)
|
||||
# We check for pthread_join because it is in -lpthread on IRIX
|
||||
# while pthread_create is in libc. We check for pthread_attr_init
|
||||
# due to DEC craziness with -lpthreads. We check for
|
||||
# pthread_cleanup_push because it is one of the few pthread
|
||||
# functions on Solaris that doesn't have a non-functional libc stub.
|
||||
# We try pthread_create on general principles.
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[pthread_t th; pthread_join(th, 0);
|
||||
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
||||
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
||||
[acx_pthread_ok=yes])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
AC_MSG_RESULT($acx_pthread_ok)
|
||||
if test "x$acx_pthread_ok" = xyes; then
|
||||
break;
|
||||
fi
|
||||
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
done
|
||||
fi
|
||||
|
||||
# Various other checks:
|
||||
if test "x$acx_pthread_ok" = xyes; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
attr_name=unknown
|
||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
|
||||
[attr_name=$attr; break])
|
||||
done
|
||||
AC_MSG_RESULT($attr_name)
|
||||
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
|
||||
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
|
||||
[Define to necessary symbol if this constant
|
||||
uses a non-standard name on your system.])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||
flag=no
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
|
||||
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
|
||||
esac
|
||||
AC_MSG_RESULT(${flag})
|
||||
if test "x$flag" != xno; then
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# More AIX lossage: must compile with xlc_r or cc_r
|
||||
if test x"$GCC" != xyes; then
|
||||
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
|
||||
else
|
||||
PTHREAD_CC=$CC
|
||||
fi
|
||||
else
|
||||
PTHREAD_CC="$CC"
|
||||
fi
|
||||
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
AC_SUBST(PTHREAD_CFLAGS)
|
||||
AC_SUBST(PTHREAD_CC)
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$acx_pthread_ok" = xyes; then
|
||||
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
|
||||
:
|
||||
else
|
||||
acx_pthread_ok=no
|
||||
$2
|
||||
fi
|
||||
AC_LANG_RESTORE
|
||||
])dnl ACX_PTHREAD
|
317
ax_pthread.m4
Normal file
317
ax_pthread.m4
Normal file
@ -0,0 +1,317 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro figures out how to build C programs using POSIX threads. It
|
||||
# sets the PTHREAD_LIBS output variable to the threads library and linker
|
||||
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
|
||||
# flags that are needed. (The user can also force certain compiler
|
||||
# flags/libs to be tested by setting these environment variables.)
|
||||
#
|
||||
# Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||
# multi-threaded programs (defaults to the value of CC otherwise). (This
|
||||
# is necessary on AIX to use the special cc_r compiler alias.)
|
||||
#
|
||||
# NOTE: You are assumed to not only compile your program with these flags,
|
||||
# but also link it with them as well. e.g. you should link with
|
||||
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
|
||||
#
|
||||
# If you are only building threads programs, you may wish to use these
|
||||
# variables in your default LIBS, CFLAGS, and CC:
|
||||
#
|
||||
# LIBS="$PTHREAD_LIBS $LIBS"
|
||||
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
# CC="$PTHREAD_CC"
|
||||
#
|
||||
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
|
||||
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
|
||||
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||
#
|
||||
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
|
||||
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
|
||||
# PTHREAD_CFLAGS.
|
||||
#
|
||||
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
|
||||
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
|
||||
# is not found. If ACTION-IF-FOUND is not specified, the default action
|
||||
# will define HAVE_PTHREAD.
|
||||
#
|
||||
# Please let the authors know if this macro fails on any platform, or if
|
||||
# you have any other suggestions or comments. This macro was based on work
|
||||
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
|
||||
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
|
||||
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
|
||||
# grateful for the helpful feedback of numerous users.
|
||||
#
|
||||
# Updated for Autoconf 2.68 by Daniel Richard G.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 20
|
||||
|
||||
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
||||
AC_DEFUN([AX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_LANG_PUSH([C])
|
||||
ax_pthread_ok=no
|
||||
|
||||
# We used to check for pthread.h first, but this fails if pthread.h
|
||||
# requires special compiler flags (e.g. on True64 or Sequent).
|
||||
# It gets checked for in the link test anyway.
|
||||
|
||||
# First of all, check if the user has set any of the PTHREAD_LIBS,
|
||||
# etcetera environment variables, and if threads linking works using
|
||||
# them:
|
||||
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
|
||||
AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
|
||||
AC_MSG_RESULT($ax_pthread_ok)
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
fi
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
fi
|
||||
|
||||
# We must check for the threads library under a number of different
|
||||
# names; the ordering is very important because some systems
|
||||
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
|
||||
# libraries is broken (non-POSIX).
|
||||
|
||||
# Create a list of thread flags to try. Items starting with a "-" are
|
||||
# C compiler flags, and other items are library names, except for "none"
|
||||
# which indicates that we try without any flags at all, and "pthread-config"
|
||||
# which is a program returning the flags for the Pth emulation library.
|
||||
|
||||
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||
|
||||
# The ordering *is* (sometimes) important. Some notes on the
|
||||
# individual items follow:
|
||||
|
||||
# pthreads: AIX (must check this before -lpthread)
|
||||
# none: in case threads are in libc; should be tried before -Kthread and
|
||||
# other compiler flags to prevent continual compiler warnings
|
||||
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
|
||||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
||||
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
||||
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
|
||||
# -pthreads: Solaris/gcc
|
||||
# -mthreads: Mingw32/gcc, Lynx/gcc
|
||||
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
|
||||
# doesn't hurt to check since this sometimes defines pthreads too;
|
||||
# also defines -D_REENTRANT)
|
||||
# ... -mt is also the pthreads flag for HP/aCC
|
||||
# pthread: Linux, etcetera
|
||||
# --thread-safe: KAI C++
|
||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||
|
||||
case ${host_os} in
|
||||
solaris*)
|
||||
|
||||
# On Solaris (at least, for some versions), libc contains stubbed
|
||||
# (non-functional) versions of the pthreads routines, so link-based
|
||||
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
|
||||
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
|
||||
# a function called by this macro, so we could check for that, but
|
||||
# who knows whether they'll stub that too in a future libc.) So,
|
||||
# we'll just look for -pthreads and -lpthread first:
|
||||
|
||||
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
|
||||
;;
|
||||
|
||||
darwin*)
|
||||
ax_pthread_flags="-pthread $ax_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
for flag in $ax_pthread_flags; do
|
||||
|
||||
case $flag in
|
||||
none)
|
||||
AC_MSG_CHECKING([whether pthreads work without any flags])
|
||||
;;
|
||||
|
||||
-*)
|
||||
AC_MSG_CHECKING([whether pthreads work with $flag])
|
||||
PTHREAD_CFLAGS="$flag"
|
||||
;;
|
||||
|
||||
pthread-config)
|
||||
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
|
||||
if test x"$ax_pthread_config" = xno; then continue; fi
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_CHECKING([for the pthreads library -l$flag])
|
||||
PTHREAD_LIBS="-l$flag"
|
||||
;;
|
||||
esac
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Check for various functions. We must include pthread.h,
|
||||
# since some functions may be macros. (On the Sequent, we
|
||||
# need a special flag -Kthread to make this header compile.)
|
||||
# We check for pthread_join because it is in -lpthread on IRIX
|
||||
# while pthread_create is in libc. We check for pthread_attr_init
|
||||
# due to DEC craziness with -lpthreads. We check for
|
||||
# pthread_cleanup_push because it is one of the few pthread
|
||||
# functions on Solaris that doesn't have a non-functional libc stub.
|
||||
# We try pthread_create on general principles.
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
|
||||
static void routine(void *a) { *((int*)a) = 0; }
|
||||
static void *start_routine(void *a) { return a; }],
|
||||
[pthread_t th; pthread_attr_t attr;
|
||||
pthread_create(&th, 0, start_routine, 0);
|
||||
pthread_join(th, 0);
|
||||
pthread_attr_init(&attr);
|
||||
pthread_cleanup_push(routine, 0);
|
||||
pthread_cleanup_pop(0) /* ; */])],
|
||||
[ax_pthread_ok=yes],
|
||||
[])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
AC_MSG_RESULT($ax_pthread_ok)
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
break;
|
||||
fi
|
||||
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
done
|
||||
fi
|
||||
|
||||
# Various other checks:
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
attr_name=unknown
|
||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
|
||||
[int attr = $attr; return attr /* ; */])],
|
||||
[attr_name=$attr; break],
|
||||
[])
|
||||
done
|
||||
AC_MSG_RESULT($attr_name)
|
||||
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
|
||||
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
|
||||
[Define to necessary symbol if this constant
|
||||
uses a non-standard name on your system.])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||
flag=no
|
||||
case ${host_os} in
|
||||
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
|
||||
osf* | hpux*) flag="-D_REENTRANT";;
|
||||
solaris*)
|
||||
if test "$GCC" = "yes"; then
|
||||
flag="-D_REENTRANT"
|
||||
else
|
||||
flag="-mt -D_REENTRANT"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT(${flag})
|
||||
if test "x$flag" != xno; then
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
|
||||
ax_cv_PTHREAD_PRIO_INHERIT, [
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=no])
|
||||
])
|
||||
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
|
||||
AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# More AIX lossage: compile with *_r variant
|
||||
if test "x$GCC" != xyes; then
|
||||
case $host_os in
|
||||
aix*)
|
||||
AS_CASE(["x/$CC"],
|
||||
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
||||
[#handle absolute path differently from PATH based program lookup
|
||||
AS_CASE(["x$CC"],
|
||||
[x/*],
|
||||
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
|
||||
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
|
||||
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
AC_SUBST(PTHREAD_CFLAGS)
|
||||
AC_SUBST(PTHREAD_CC)
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$ax_pthread_ok" = xyes; then
|
||||
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
|
||||
:
|
||||
else
|
||||
ax_pthread_ok=no
|
||||
$2
|
||||
fi
|
||||
AC_LANG_POP
|
||||
])dnl AX_PTHREAD
|
1812
compat/snprintf.c
1812
compat/snprintf.c
File diff suppressed because it is too large
Load Diff
@ -220,6 +220,9 @@
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#undef HAVE_PTHREAD
|
||||
|
||||
/* Have PTHREAD_PRIO_INHERIT. */
|
||||
#undef HAVE_PTHREAD_PRIO_INHERIT
|
||||
|
||||
/* Define to 1 if the system has the type `pthread_rwlock_t'. */
|
||||
#undef HAVE_PTHREAD_RWLOCK_T
|
||||
|
||||
@ -805,7 +808,7 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_SLEEP
|
||||
#if !defined(HAVE_SLEEP) || defined(HAVE_WINDOWS_H)
|
||||
#define sleep(x) Sleep((x)*1000) /* on win32 */
|
||||
#endif /* HAVE_SLEEP */
|
||||
|
||||
@ -871,8 +874,6 @@ char *strptime(const char *s, const char *format, struct tm *tm);
|
||||
# endif
|
||||
#endif /* CHECKED_INET6 */
|
||||
|
||||
/* maximum nesting of included files */
|
||||
#define MAXINCLUDES 10
|
||||
#ifndef HAVE_GETADDRINFO
|
||||
struct sockaddr_storage;
|
||||
#include "compat/fake-rfc2553.h"
|
||||
|
273
configure
vendored
273
configure
vendored
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for unbound 1.4.20.
|
||||
# Generated by GNU Autoconf 2.69 for unbound 1.4.21.
|
||||
#
|
||||
# Report bugs to <unbound-bugs@nlnetlabs.nl>.
|
||||
#
|
||||
@ -590,8 +590,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='unbound'
|
||||
PACKAGE_TARNAME='unbound'
|
||||
PACKAGE_VERSION='1.4.20'
|
||||
PACKAGE_STRING='unbound 1.4.20'
|
||||
PACKAGE_VERSION='1.4.21'
|
||||
PACKAGE_STRING='unbound 1.4.21'
|
||||
PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl'
|
||||
PACKAGE_URL=''
|
||||
|
||||
@ -677,7 +677,7 @@ PYTHON_VERSION
|
||||
PTHREAD_CFLAGS
|
||||
PTHREAD_LIBS
|
||||
PTHREAD_CC
|
||||
acx_pthread_config
|
||||
ax_pthread_config
|
||||
RUNTIME_PATH
|
||||
LIBOBJS
|
||||
OTOOL64
|
||||
@ -743,6 +743,9 @@ build
|
||||
LIBUNBOUND_AGE
|
||||
LIBUNBOUND_REVISION
|
||||
LIBUNBOUND_CURRENT
|
||||
UNBOUND_VERSION_MICRO
|
||||
UNBOUND_VERSION_MINOR
|
||||
UNBOUND_VERSION_MAJOR
|
||||
target_alias
|
||||
host_alias
|
||||
build_alias
|
||||
@ -794,6 +797,7 @@ with_rootcert_file
|
||||
with_username
|
||||
enable_checking
|
||||
enable_debug
|
||||
enable_flto
|
||||
enable_shared
|
||||
enable_static
|
||||
with_pic
|
||||
@ -1375,7 +1379,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures unbound 1.4.20 to adapt to many kinds of systems.
|
||||
\`configure' configures unbound 1.4.21 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@ -1441,7 +1445,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of unbound 1.4.20:";;
|
||||
short | recursive ) echo "Configuration of unbound 1.4.21:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@ -1451,6 +1455,7 @@ Optional Features:
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--enable-checking Enable warnings, asserts, makefile-dependencies
|
||||
--enable-debug same as enable-checking
|
||||
--disable-flto Disable link-time optimization
|
||||
--enable-shared[=PKGS] build shared libraries [default=yes]
|
||||
--enable-static[=PKGS] build static libraries [default=yes]
|
||||
--enable-fast-install[=PKGS]
|
||||
@ -1609,7 +1614,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
unbound configure 1.4.20
|
||||
unbound configure 1.4.21
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
@ -2135,7 +2140,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by unbound $as_me 1.4.20, which was
|
||||
It was created by unbound $as_me 1.4.21, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@ -2483,10 +2488,16 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
UNBOUND_VERSION_MAJOR=1
|
||||
|
||||
LIBUNBOUND_CURRENT=3
|
||||
LIBUNBOUND_REVISION=5
|
||||
LIBUNBOUND_AGE=1
|
||||
UNBOUND_VERSION_MINOR=4
|
||||
|
||||
UNBOUND_VERSION_MICRO=21
|
||||
|
||||
|
||||
LIBUNBOUND_CURRENT=4
|
||||
LIBUNBOUND_REVISION=1
|
||||
LIBUNBOUND_AGE=2
|
||||
# 1.0.0 had 0:12:0
|
||||
# 1.0.1 had 0:13:0
|
||||
# 1.0.2 had 0:14:0
|
||||
@ -2521,7 +2532,8 @@ LIBUNBOUND_AGE=1
|
||||
# 1.4.17 had 3:2:1
|
||||
# 1.4.18 had 3:3:1
|
||||
# 1.4.19 had 3:4:1
|
||||
# 1.4.20 had 4:0:2 # adds libunbound.ttl
|
||||
# 1.4.20 had 4:0:2 # adds libunbound.ttl # but shipped 3:5:1
|
||||
# 1.4.21 had 4:1:2
|
||||
|
||||
# Current -- the number of the binary API that we're implementing
|
||||
# Revision -- which iteration of the implementation of the binary
|
||||
@ -4139,7 +4151,7 @@ _ACEOF
|
||||
|
||||
$as_echo "#define WINVER 0x0502" >>confdefs.h
|
||||
|
||||
wnvs=`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*$/\1,\2,\3,0/' `
|
||||
wnvs=`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9]*$/\1,\2,\3,0/' `
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@ -4246,7 +4258,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -g -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -4277,7 +4289,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -4867,7 +4879,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -4898,7 +4910,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -4931,7 +4943,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -4962,7 +4974,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -5629,7 +5641,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -W -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -5660,7 +5672,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -5691,7 +5703,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -Wextra -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -5722,7 +5734,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -Wdeclaration-after-statement -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -5752,11 +5764,19 @@ $as_echo "#define UNBOUND_DEBUG /**/" >>confdefs.h
|
||||
# nothing to do.
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -flto" >&5
|
||||
|
||||
# Check whether --enable-flto was given.
|
||||
if test "${enable_flto+set}" = set; then :
|
||||
enableval=$enable_flto;
|
||||
fi
|
||||
|
||||
if test "x$enable_flto" != "xno"; then :
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -flto" >&5
|
||||
$as_echo_n "checking if $CC supports -flto... " >&6; }
|
||||
BAKCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -flto"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
BAKCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -flto"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
@ -5769,15 +5789,15 @@ main ()
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
|
||||
if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then
|
||||
CFLAGS="$BAKCFLAGS"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then
|
||||
CFLAGS="$BAKCFLAGS"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
fi
|
||||
rm -f conftest conftest.c conftest.o
|
||||
fi
|
||||
rm -f conftest conftest.c conftest.o
|
||||
|
||||
else
|
||||
CFLAGS="$BAKCFLAGS" ; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
@ -5786,6 +5806,8 @@ fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
|
||||
$as_echo_n "checking for inline... " >&6; }
|
||||
@ -15070,14 +15092,13 @@ ub_have_pthreads=no
|
||||
if test x_$withval != x_no; then
|
||||
|
||||
|
||||
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
acx_pthread_ok=no
|
||||
ax_pthread_ok=no
|
||||
|
||||
# We used to check for pthread.h first, but this fails if pthread.h
|
||||
# requires special compiler flags (e.g. on True64 or Sequent).
|
||||
@ -15112,13 +15133,13 @@ return pthread_join ();
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
acx_pthread_ok=yes
|
||||
ax_pthread_ok=yes
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5
|
||||
$as_echo "$acx_pthread_ok" >&6; }
|
||||
if test x"$acx_pthread_ok" = xno; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
|
||||
$as_echo "$ax_pthread_ok" >&6; }
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
fi
|
||||
@ -15136,7 +15157,7 @@ fi
|
||||
# which indicates that we try without any flags at all, and "pthread-config"
|
||||
# which is a program returning the flags for the Pth emulation library.
|
||||
|
||||
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||
|
||||
# The ordering *is* (sometimes) important. Some notes on the
|
||||
# individual items follow:
|
||||
@ -15158,8 +15179,8 @@ acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -m
|
||||
# --thread-safe: KAI C++
|
||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*solaris*)
|
||||
case ${host_os} in
|
||||
solaris*)
|
||||
|
||||
# On Solaris (at least, for some versions), libc contains stubbed
|
||||
# (non-functional) versions of the pthreads routines, so link-based
|
||||
@ -15169,12 +15190,16 @@ case "${host_cpu}-${host_os}" in
|
||||
# who knows whether they'll stub that too in a future libc.) So,
|
||||
# we'll just look for -pthreads and -lpthread first:
|
||||
|
||||
acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
|
||||
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
|
||||
;;
|
||||
|
||||
darwin*)
|
||||
ax_pthread_flags="-pthread $ax_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x"$acx_pthread_ok" = xno; then
|
||||
for flag in $acx_pthread_flags; do
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
for flag in $ax_pthread_flags; do
|
||||
|
||||
case $flag in
|
||||
none)
|
||||
@ -15188,16 +15213,16 @@ $as_echo_n "checking whether pthreads work with $flag... " >&6; }
|
||||
PTHREAD_CFLAGS="$flag"
|
||||
;;
|
||||
|
||||
pthread-config)
|
||||
# Extract the first word of "pthread-config", so it can be a program name with args.
|
||||
pthread-config)
|
||||
# Extract the first word of "pthread-config", so it can be a program name with args.
|
||||
set dummy pthread-config; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_acx_pthread_config+:} false; then :
|
||||
if ${ac_cv_prog_ax_pthread_config+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$acx_pthread_config"; then
|
||||
ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test.
|
||||
if test -n "$ax_pthread_config"; then
|
||||
ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
@ -15206,7 +15231,7 @@ do
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_acx_pthread_config="yes"
|
||||
ac_cv_prog_ax_pthread_config="yes"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
@ -15214,23 +15239,23 @@ done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no"
|
||||
test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no"
|
||||
fi
|
||||
fi
|
||||
acx_pthread_config=$ac_cv_prog_acx_pthread_config
|
||||
if test -n "$acx_pthread_config"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5
|
||||
$as_echo "$acx_pthread_config" >&6; }
|
||||
ax_pthread_config=$ac_cv_prog_ax_pthread_config
|
||||
if test -n "$ax_pthread_config"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5
|
||||
$as_echo "$ax_pthread_config" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
if test x"$acx_pthread_config" = xno; then continue; fi
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
if test x"$ax_pthread_config" = xno; then continue; fi
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
|
||||
*)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5
|
||||
@ -15256,18 +15281,23 @@ $as_echo_n "checking for the pthreads library -l$flag... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <pthread.h>
|
||||
static void routine(void *a) { *((int*)a) = 0; }
|
||||
static void *start_routine(void *a) { return a; }
|
||||
int
|
||||
main ()
|
||||
{
|
||||
pthread_t th; pthread_join(th, 0);
|
||||
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
||||
pthread_create(0,0,0,0); pthread_cleanup_pop(0);
|
||||
pthread_t th; pthread_attr_t attr;
|
||||
pthread_create(&th, 0, start_routine, 0);
|
||||
pthread_join(th, 0);
|
||||
pthread_attr_init(&attr);
|
||||
pthread_cleanup_push(routine, 0);
|
||||
pthread_cleanup_pop(0) /* ; */
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
acx_pthread_ok=yes
|
||||
ax_pthread_ok=yes
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
@ -15275,9 +15305,9 @@ rm -f core conftest.err conftest.$ac_objext \
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5
|
||||
$as_echo "$acx_pthread_ok" >&6; }
|
||||
if test "x$acx_pthread_ok" = xyes; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
|
||||
$as_echo "$ax_pthread_ok" >&6; }
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
break;
|
||||
fi
|
||||
|
||||
@ -15287,24 +15317,24 @@ done
|
||||
fi
|
||||
|
||||
# Various other checks:
|
||||
if test "x$acx_pthread_ok" = xyes; then
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
|
||||
$as_echo_n "checking for joinable pthread attribute... " >&6; }
|
||||
attr_name=unknown
|
||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
attr_name=unknown
|
||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <pthread.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int attr=$attr; return attr;
|
||||
int attr = $attr; return attr /* ; */
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@ -15314,7 +15344,7 @@ if ac_fn_c_try_link "$LINENO"; then :
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
done
|
||||
done
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5
|
||||
$as_echo "$attr_name" >&6; }
|
||||
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
|
||||
@ -15328,9 +15358,16 @@ _ACEOF
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5
|
||||
$as_echo_n "checking if more special flags are required for pthreads... " >&6; }
|
||||
flag=no
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
|
||||
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
|
||||
case ${host_os} in
|
||||
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
|
||||
osf* | hpux*) flag="-D_REENTRANT";;
|
||||
solaris*)
|
||||
if test "$GCC" = "yes"; then
|
||||
flag="-D_REENTRANT"
|
||||
else
|
||||
flag="-mt -D_REENTRANT"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5
|
||||
$as_echo "${flag}" >&6; }
|
||||
@ -15338,12 +15375,58 @@ $as_echo "${flag}" >&6; }
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5
|
||||
$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; }
|
||||
if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <pthread.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int i = PTHREAD_PRIO_INHERIT;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ax_cv_PTHREAD_PRIO_INHERIT=yes
|
||||
else
|
||||
ax_cv_PTHREAD_PRIO_INHERIT=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5
|
||||
$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; }
|
||||
if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"; then :
|
||||
|
||||
$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# More AIX lossage: must compile with xlc_r or cc_r
|
||||
if test x"$GCC" != xyes; then
|
||||
for ac_prog in xlc_r cc_r
|
||||
# More AIX lossage: compile with *_r variant
|
||||
if test "x$GCC" != xyes; then
|
||||
case $host_os in
|
||||
aix*)
|
||||
case "x/$CC" in #(
|
||||
x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) :
|
||||
#handle absolute path differently from PATH based program lookup
|
||||
case "x$CC" in #(
|
||||
x/*) :
|
||||
if as_fn_executable_p ${CC}_r; then :
|
||||
PTHREAD_CC="${CC}_r"
|
||||
fi ;; #(
|
||||
*) :
|
||||
for ac_prog in ${CC}_r
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
@ -15384,21 +15467,25 @@ fi
|
||||
|
||||
test -n "$PTHREAD_CC" && break
|
||||
done
|
||||
test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}"
|
||||
|
||||
else
|
||||
PTHREAD_CC=$CC
|
||||
fi
|
||||
else
|
||||
PTHREAD_CC="$CC"
|
||||
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
|
||||
;;
|
||||
esac ;; #(
|
||||
*) :
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$acx_pthread_ok" = xyes; then
|
||||
if test x"$ax_pthread_ok" = xyes; then
|
||||
|
||||
|
||||
$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h
|
||||
@ -15431,7 +15518,7 @@ fi
|
||||
|
||||
:
|
||||
else
|
||||
acx_pthread_ok=no
|
||||
ax_pthread_ok=no
|
||||
|
||||
fi
|
||||
ac_ext=c
|
||||
@ -15525,7 +15612,7 @@ if eval \${cv_prog_cc_flag_$cache+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
echo 'void f(){}' >conftest.c
|
||||
echo 'void f(void){}' >conftest.c
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -mt -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
@ -18690,7 +18777,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by unbound $as_me 1.4.20, which was
|
||||
This file was extended by unbound $as_me 1.4.21, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@ -18756,7 +18843,7 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
unbound config.status 1.4.20
|
||||
unbound config.status 1.4.21
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
24
configure.ac
24
configure.ac
@ -2,15 +2,22 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.56)
|
||||
sinclude(acx_nlnetlabs.m4)
|
||||
sinclude(acx_pthread.m4)
|
||||
sinclude(ax_pthread.m4)
|
||||
sinclude(acx_python.m4)
|
||||
sinclude(ac_pkg_swig.m4)
|
||||
|
||||
AC_INIT(unbound, 1.4.20, unbound-bugs@nlnetlabs.nl, unbound)
|
||||
# must be numbers. ac_defun because of later processing
|
||||
m4_define([VERSION_MAJOR],[1])
|
||||
m4_define([VERSION_MINOR],[4])
|
||||
m4_define([VERSION_MICRO],[21])
|
||||
AC_INIT(unbound, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), unbound-bugs@nlnetlabs.nl, unbound)
|
||||
AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
|
||||
AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
|
||||
AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
|
||||
|
||||
LIBUNBOUND_CURRENT=3
|
||||
LIBUNBOUND_REVISION=5
|
||||
LIBUNBOUND_AGE=1
|
||||
LIBUNBOUND_CURRENT=4
|
||||
LIBUNBOUND_REVISION=1
|
||||
LIBUNBOUND_AGE=2
|
||||
# 1.0.0 had 0:12:0
|
||||
# 1.0.1 had 0:13:0
|
||||
# 1.0.2 had 0:14:0
|
||||
@ -45,7 +52,8 @@ LIBUNBOUND_AGE=1
|
||||
# 1.4.17 had 3:2:1
|
||||
# 1.4.18 had 3:3:1
|
||||
# 1.4.19 had 3:4:1
|
||||
# 1.4.20 had 4:0:2 # adds libunbound.ttl
|
||||
# 1.4.20 had 4:0:2 # adds libunbound.ttl # but shipped 3:5:1
|
||||
# 1.4.21 had 4:1:2
|
||||
|
||||
# Current -- the number of the binary API that we're implementing
|
||||
# Revision -- which iteration of the implementation of the binary
|
||||
@ -384,7 +392,7 @@ AC_ARG_WITH(pthreads, AC_HELP_STRING([--with-pthreads],
|
||||
[ ],[ withval="yes" ])
|
||||
ub_have_pthreads=no
|
||||
if test x_$withval != x_no; then
|
||||
ACX_PTHREAD([
|
||||
AX_PTHREAD([
|
||||
AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
@ -1206,8 +1214,6 @@ char *strptime(const char *s, const char *format, struct tm *tm);
|
||||
# endif
|
||||
#endif /* CHECKED_INET6 */
|
||||
|
||||
/* maximum nesting of included files */
|
||||
#define MAXINCLUDES 10
|
||||
#ifndef HAVE_GETADDRINFO
|
||||
struct sockaddr_storage;
|
||||
#include "compat/fake-rfc2553.h"
|
||||
|
@ -60,7 +60,7 @@
|
||||
/** convert to ldns rr */
|
||||
static ldns_rr*
|
||||
to_rr(struct ub_packed_rrset_key* k, struct packed_rrset_data* d,
|
||||
uint32_t now, size_t i, uint16_t type)
|
||||
time_t now, size_t i, uint16_t type)
|
||||
{
|
||||
ldns_rr* rr = ldns_rr_new();
|
||||
ldns_rdf* rdf;
|
||||
@ -96,7 +96,7 @@ to_rr(struct ub_packed_rrset_key* k, struct packed_rrset_data* d,
|
||||
/** dump one rrset zonefile line */
|
||||
static int
|
||||
dump_rrset_line(SSL* ssl, struct ub_packed_rrset_key* k,
|
||||
struct packed_rrset_data* d, uint32_t now, size_t i, uint16_t type)
|
||||
struct packed_rrset_data* d, time_t now, size_t i, uint16_t type)
|
||||
{
|
||||
char* s;
|
||||
ldns_rr* rr = to_rr(k, d, now, i, type);
|
||||
@ -119,7 +119,7 @@ dump_rrset_line(SSL* ssl, struct ub_packed_rrset_key* k,
|
||||
/** dump rrset key and data info */
|
||||
static int
|
||||
dump_rrset(SSL* ssl, struct ub_packed_rrset_key* k,
|
||||
struct packed_rrset_data* d, uint32_t now)
|
||||
struct packed_rrset_data* d, time_t now)
|
||||
{
|
||||
size_t i;
|
||||
/* rd lock held by caller */
|
||||
@ -127,9 +127,9 @@ dump_rrset(SSL* ssl, struct ub_packed_rrset_key* k,
|
||||
if(d->ttl < now) return 1; /* expired */
|
||||
|
||||
/* meta line */
|
||||
if(!ssl_printf(ssl, ";rrset%s %u %u %u %d %d\n",
|
||||
if(!ssl_printf(ssl, ";rrset%s %lld %u %u %d %d\n",
|
||||
(k->rk.flags & PACKED_RRSET_NSEC_AT_APEX)?" nsec_apex":"",
|
||||
(unsigned)(d->ttl - now),
|
||||
(long long)(d->ttl - now),
|
||||
(unsigned)d->count, (unsigned)d->rrsig_count,
|
||||
(int)d->trust, (int)d->security
|
||||
))
|
||||
@ -149,7 +149,7 @@ dump_rrset(SSL* ssl, struct ub_packed_rrset_key* k,
|
||||
|
||||
/** dump lruhash rrset cache */
|
||||
static int
|
||||
dump_rrset_lruhash(SSL* ssl, struct lruhash* h, uint32_t now)
|
||||
dump_rrset_lruhash(SSL* ssl, struct lruhash* h, time_t now)
|
||||
{
|
||||
struct lruhash_entry* e;
|
||||
/* lruhash already locked by caller */
|
||||
@ -225,7 +225,7 @@ dump_msg_ref(SSL* ssl, struct ub_packed_rrset_key* k)
|
||||
/** dump message entry */
|
||||
static int
|
||||
dump_msg(SSL* ssl, struct query_info* k, struct reply_info* d,
|
||||
uint32_t now)
|
||||
time_t now)
|
||||
{
|
||||
size_t i;
|
||||
char* nm, *tp, *cl;
|
||||
@ -259,10 +259,10 @@ dump_msg(SSL* ssl, struct query_info* k, struct reply_info* d,
|
||||
}
|
||||
|
||||
/* meta line */
|
||||
if(!ssl_printf(ssl, "msg %s %s %s %d %d %u %d %u %u %u\n",
|
||||
if(!ssl_printf(ssl, "msg %s %s %s %d %d %lld %d %u %u %u\n",
|
||||
nm, cl, tp,
|
||||
(int)d->flags, (int)d->qdcount,
|
||||
(unsigned)(d->ttl-now), (int)d->security,
|
||||
(long long)(d->ttl-now), (int)d->security,
|
||||
(unsigned)d->an_numrrsets,
|
||||
(unsigned)d->ns_numrrsets,
|
||||
(unsigned)d->ar_numrrsets)) {
|
||||
@ -387,7 +387,7 @@ read_fixed(SSL* ssl, ldns_buffer* buf, const char* str)
|
||||
static int
|
||||
load_rr(SSL* ssl, ldns_buffer* buf, struct regional* region,
|
||||
struct ub_packed_rrset_key* rk, struct packed_rrset_data* d,
|
||||
unsigned int i, int is_rrsig, int* go_on, uint32_t now)
|
||||
unsigned int i, int is_rrsig, int* go_on, time_t now)
|
||||
{
|
||||
ldns_rr* rr;
|
||||
ldns_status status;
|
||||
@ -489,7 +489,7 @@ move_into_cache(struct ub_packed_rrset_key* k,
|
||||
return 0;
|
||||
}
|
||||
s = sizeof(*ad) + (sizeof(size_t) + sizeof(uint8_t*) +
|
||||
sizeof(uint32_t))* num;
|
||||
sizeof(time_t))* num;
|
||||
for(i=0; i<num; i++)
|
||||
s += d->rr_len[i];
|
||||
ad = (struct packed_rrset_data*)malloc(s);
|
||||
@ -505,8 +505,8 @@ move_into_cache(struct ub_packed_rrset_key* k,
|
||||
p += sizeof(size_t)*num;
|
||||
memmove(p, &d->rr_data[0], sizeof(uint8_t*)*num);
|
||||
p += sizeof(uint8_t*)*num;
|
||||
memmove(p, &d->rr_ttl[0], sizeof(uint32_t)*num);
|
||||
p += sizeof(uint32_t)*num;
|
||||
memmove(p, &d->rr_ttl[0], sizeof(time_t)*num);
|
||||
p += sizeof(time_t)*num;
|
||||
for(i=0; i<num; i++) {
|
||||
memmove(p, d->rr_data[i], d->rr_len[i]);
|
||||
p += d->rr_len[i];
|
||||
@ -530,7 +530,8 @@ load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker)
|
||||
struct regional* region = worker->scratchpad;
|
||||
struct ub_packed_rrset_key* rk;
|
||||
struct packed_rrset_data* d;
|
||||
unsigned int ttl, rr_count, rrsig_count, trust, security;
|
||||
unsigned int rr_count, rrsig_count, trust, security;
|
||||
long long ttl;
|
||||
unsigned int i;
|
||||
int go_on = 1;
|
||||
regional_free_all(region);
|
||||
@ -552,7 +553,7 @@ load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker)
|
||||
s += 10;
|
||||
rk->rk.flags |= PACKED_RRSET_NSEC_AT_APEX;
|
||||
}
|
||||
if(sscanf(s, " %u %u %u %u %u", &ttl, &rr_count, &rrsig_count,
|
||||
if(sscanf(s, " %lld %u %u %u %u", &ttl, &rr_count, &rrsig_count,
|
||||
&trust, &security) != 5) {
|
||||
log_warn("error bad rrset spec %s", s);
|
||||
return 0;
|
||||
@ -565,12 +566,12 @@ load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker)
|
||||
d->rrsig_count = (size_t)rrsig_count;
|
||||
d->security = (enum sec_status)security;
|
||||
d->trust = (enum rrset_trust)trust;
|
||||
d->ttl = (uint32_t)ttl + *worker->env.now;
|
||||
d->ttl = (time_t)ttl + *worker->env.now;
|
||||
|
||||
d->rr_len = regional_alloc_zero(region,
|
||||
sizeof(size_t)*(d->count+d->rrsig_count));
|
||||
d->rr_ttl = regional_alloc_zero(region,
|
||||
sizeof(uint32_t)*(d->count+d->rrsig_count));
|
||||
sizeof(time_t)*(d->count+d->rrsig_count));
|
||||
d->rr_data = regional_alloc_zero(region,
|
||||
sizeof(uint8_t*)*(d->count+d->rrsig_count));
|
||||
if(!d->rr_len || !d->rr_ttl || !d->rr_data) {
|
||||
@ -718,7 +719,8 @@ load_msg(SSL* ssl, ldns_buffer* buf, struct worker* worker)
|
||||
struct query_info qinf;
|
||||
struct reply_info rep;
|
||||
char* s = (char*)ldns_buffer_begin(buf);
|
||||
unsigned int flags, qdcount, ttl, security, an, ns, ar;
|
||||
unsigned int flags, qdcount, security, an, ns, ar;
|
||||
long long ttl;
|
||||
size_t i;
|
||||
int go_on = 1;
|
||||
|
||||
@ -735,14 +737,14 @@ load_msg(SSL* ssl, ldns_buffer* buf, struct worker* worker)
|
||||
}
|
||||
|
||||
/* read remainder of line */
|
||||
if(sscanf(s, " %u %u %u %u %u %u %u", &flags, &qdcount, &ttl,
|
||||
if(sscanf(s, " %u %u %lld %u %u %u %u", &flags, &qdcount, &ttl,
|
||||
&security, &an, &ns, &ar) != 7) {
|
||||
log_warn("error cannot parse numbers: %s", s);
|
||||
return 0;
|
||||
}
|
||||
rep.flags = (uint16_t)flags;
|
||||
rep.qdcount = (uint16_t)qdcount;
|
||||
rep.ttl = (uint32_t)ttl;
|
||||
rep.ttl = (time_t)ttl;
|
||||
rep.prefetch_ttl = PREFETCH_TTL_CALC(rep.ttl);
|
||||
rep.security = (enum sec_status)security;
|
||||
rep.an_numrrsets = (size_t)an;
|
||||
@ -800,8 +802,9 @@ print_dp_details(SSL* ssl, struct worker* worker, struct delegpt* dp)
|
||||
{
|
||||
char buf[257];
|
||||
struct delegpt_addr* a;
|
||||
int lame, dlame, rlame, rto, edns_vs, to, delay, entry_ttl,
|
||||
int lame, dlame, rlame, rto, edns_vs, to, delay,
|
||||
tA = 0, tAAAA = 0, tother = 0;
|
||||
long long entry_ttl;
|
||||
struct rtt_info ri;
|
||||
uint8_t edns_lame_known;
|
||||
for(a = dp->target_list; a; a = a->next_target) {
|
||||
@ -840,7 +843,7 @@ print_dp_details(SSL* ssl, struct worker* worker, struct delegpt* dp)
|
||||
return;
|
||||
continue; /* skip stuff not in infra cache */
|
||||
}
|
||||
if(!ssl_printf(ssl, "%s%s%s%srto %d msec, ttl %d, ping %d "
|
||||
if(!ssl_printf(ssl, "%s%s%s%srto %d msec, ttl %lld, ping %d "
|
||||
"var %d rtt %d, tA %d, tAAAA %d, tother %d",
|
||||
lame?"LAME ":"", dlame?"NoDNSSEC ":"",
|
||||
a->lame?"AddrWasParentSide ":"",
|
||||
|
@ -629,8 +629,8 @@ print_stats(SSL* ssl, const char* nm, struct stats_info* s)
|
||||
if(!ssl_printf(ssl, "%s.requestlist.current.user"SQ"%u\n", nm,
|
||||
(unsigned)s->mesh_num_reply_states)) return 0;
|
||||
timeval_divide(&avg, &s->mesh_replies_sum_wait, s->mesh_replies_sent);
|
||||
if(!ssl_printf(ssl, "%s.recursion.time.avg"SQ"%d.%6.6d\n", nm,
|
||||
(int)avg.tv_sec, (int)avg.tv_usec)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.recursion.time.avg"SQ"%lld.%6.6d\n", nm,
|
||||
(long long)avg.tv_sec, (int)avg.tv_usec)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.recursion.time.median"SQ"%g\n", nm,
|
||||
s->mesh_time_median)) return 0;
|
||||
return 1;
|
||||
@ -713,12 +713,12 @@ print_uptime(SSL* ssl, struct worker* worker, int reset)
|
||||
timeval_subtract(&dt, &now, &worker->daemon->time_last_stat);
|
||||
if(reset)
|
||||
worker->daemon->time_last_stat = now;
|
||||
if(!ssl_printf(ssl, "time.now"SQ"%d.%6.6d\n",
|
||||
(unsigned)now.tv_sec, (unsigned)now.tv_usec)) return 0;
|
||||
if(!ssl_printf(ssl, "time.up"SQ"%d.%6.6d\n",
|
||||
(unsigned)up.tv_sec, (unsigned)up.tv_usec)) return 0;
|
||||
if(!ssl_printf(ssl, "time.elapsed"SQ"%d.%6.6d\n",
|
||||
(unsigned)dt.tv_sec, (unsigned)dt.tv_usec)) return 0;
|
||||
if(!ssl_printf(ssl, "time.now"SQ"%lld.%6.6d\n",
|
||||
(long long)now.tv_sec, (unsigned)now.tv_usec)) return 0;
|
||||
if(!ssl_printf(ssl, "time.up"SQ"%lld.%6.6d\n",
|
||||
(long long)up.tv_sec, (unsigned)up.tv_usec)) return 0;
|
||||
if(!ssl_printf(ssl, "time.elapsed"SQ"%lld.%6.6d\n",
|
||||
(long long)dt.tv_sec, (unsigned)dt.tv_usec)) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1118,9 +1118,9 @@ struct del_info {
|
||||
/** labels */
|
||||
int labs;
|
||||
/** now */
|
||||
uint32_t now;
|
||||
time_t now;
|
||||
/** time to invalidate to */
|
||||
uint32_t expired;
|
||||
time_t expired;
|
||||
/** number of rrsets removed */
|
||||
size_t num_rrsets;
|
||||
/** number of msgs removed */
|
||||
@ -1663,6 +1663,38 @@ do_stub_remove(SSL* ssl, struct worker* worker, char* args)
|
||||
send_ok(ssl);
|
||||
}
|
||||
|
||||
/** do the insecure_add command */
|
||||
static void
|
||||
do_insecure_add(SSL* ssl, struct worker* worker, char* arg)
|
||||
{
|
||||
size_t nmlen;
|
||||
int nmlabs;
|
||||
uint8_t* nm = NULL;
|
||||
if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs))
|
||||
return;
|
||||
if(!anchors_add_insecure(worker->env.anchors, LDNS_RR_CLASS_IN, nm)) {
|
||||
(void)ssl_printf(ssl, "error out of memory\n");
|
||||
free(nm);
|
||||
return;
|
||||
}
|
||||
free(nm);
|
||||
send_ok(ssl);
|
||||
}
|
||||
|
||||
/** do the insecure_remove command */
|
||||
static void
|
||||
do_insecure_remove(SSL* ssl, struct worker* worker, char* arg)
|
||||
{
|
||||
size_t nmlen;
|
||||
int nmlabs;
|
||||
uint8_t* nm = NULL;
|
||||
if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs))
|
||||
return;
|
||||
anchors_delete_insecure(worker->env.anchors, LDNS_RR_CLASS_IN, nm);
|
||||
free(nm);
|
||||
send_ok(ssl);
|
||||
}
|
||||
|
||||
/** do the status command */
|
||||
static void
|
||||
do_status(SSL* ssl, struct worker* worker)
|
||||
@ -1684,7 +1716,7 @@ do_status(SSL* ssl, struct worker* worker)
|
||||
if(!ssl_printf(ssl, " ]\n"))
|
||||
return;
|
||||
uptime = (time_t)time(NULL) - (time_t)worker->daemon->time_boot.tv_sec;
|
||||
if(!ssl_printf(ssl, "uptime: %u seconds\n", (unsigned)uptime))
|
||||
if(!ssl_printf(ssl, "uptime: %lld seconds\n", (long long)uptime))
|
||||
return;
|
||||
if(!ssl_printf(ssl, "unbound (pid %d) is running...\n",
|
||||
(int)getpid()))
|
||||
@ -1703,7 +1735,7 @@ get_mesh_age(struct mesh_state* m, char* buf, size_t len,
|
||||
while(r && r->next)
|
||||
r = r->next;
|
||||
timeval_subtract(&d, env->now_tv, &r->start_time);
|
||||
snprintf(buf, len, "%d.%6.6d", (int)d.tv_sec, (int)d.tv_usec);
|
||||
snprintf(buf, len, "%lld.%6.6d", (long long)d.tv_sec, (int)d.tv_usec);
|
||||
} else {
|
||||
snprintf(buf, len, "-");
|
||||
}
|
||||
@ -1804,7 +1836,7 @@ struct infra_arg {
|
||||
/** the SSL connection */
|
||||
SSL* ssl;
|
||||
/** the time now */
|
||||
uint32_t now;
|
||||
time_t now;
|
||||
};
|
||||
|
||||
/** callback for every host element in the infra cache */
|
||||
@ -2050,6 +2082,16 @@ execute_cmd(struct daemon_remote* rc, SSL* ssl, char* cmd,
|
||||
if(rc) distribute_cmd(rc, ssl, cmd);
|
||||
do_forward_remove(ssl, worker, skipwhite(p+14));
|
||||
return;
|
||||
} else if(cmdcmp(p, "insecure_add", 12)) {
|
||||
/* must always distribute this cmd */
|
||||
if(rc) distribute_cmd(rc, ssl, cmd);
|
||||
do_insecure_add(ssl, worker, skipwhite(p+12));
|
||||
return;
|
||||
} else if(cmdcmp(p, "insecure_remove", 15)) {
|
||||
/* must always distribute this cmd */
|
||||
if(rc) distribute_cmd(rc, ssl, cmd);
|
||||
do_insecure_remove(ssl, worker, skipwhite(p+15));
|
||||
return;
|
||||
} else if(cmdcmp(p, "forward", 7)) {
|
||||
/* must always distribute this cmd */
|
||||
if(rc) distribute_cmd(rc, ssl, cmd);
|
||||
|
@ -521,7 +521,7 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
|
||||
/* setusercontext does initgroups, setuid, setgid, and
|
||||
* also resource limits from login config, but we
|
||||
* still call setresuid, setresgid to be sure to set all uid*/
|
||||
if(setusercontext(NULL, pwd, uid,
|
||||
if(setusercontext(NULL, pwd, uid, (unsigned)
|
||||
LOGIN_SETALL & ~LOGIN_SETUSER & ~LOGIN_SETGROUP) != 0)
|
||||
log_warn("unable to setusercontext %s: %s",
|
||||
cfg->username, strerror(errno));
|
||||
@ -714,6 +714,7 @@ main(int argc, char* argv[])
|
||||
#endif
|
||||
|
||||
log_init(NULL, 0, NULL);
|
||||
log_ident_set(strrchr(argv[0],'/')?strrchr(argv[0],'/')+1:argv[0]);
|
||||
/* parse the options */
|
||||
while( (c=getopt(argc, argv, "c:dhvw:")) != -1) {
|
||||
switch(c) {
|
||||
|
@ -449,7 +449,7 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
|
||||
*/
|
||||
uint16_t udpsize = edns->udp_size;
|
||||
int secure = 0;
|
||||
uint32_t timenow = *worker->env.now;
|
||||
time_t timenow = *worker->env.now;
|
||||
int must_validate = (!(flags&BIT_CD) || worker->env.cfg->ignore_cd)
|
||||
&& worker->env.need_to_validate;
|
||||
struct dns_msg *msg = NULL;
|
||||
@ -524,7 +524,7 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
|
||||
struct reply_info* rep, uint16_t id, uint16_t flags,
|
||||
struct comm_reply* repinfo, struct edns_data* edns)
|
||||
{
|
||||
uint32_t timenow = *worker->env.now;
|
||||
time_t timenow = *worker->env.now;
|
||||
uint16_t udpsize = edns->udp_size;
|
||||
int secure;
|
||||
int must_validate = (!(flags&BIT_CD) || worker->env.cfg->ignore_cd)
|
||||
@ -614,7 +614,7 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
|
||||
/** Reply to client and perform prefetch to keep cache up to date */
|
||||
static void
|
||||
reply_and_prefetch(struct worker* worker, struct query_info* qinfo,
|
||||
uint16_t flags, struct comm_reply* repinfo, uint32_t leeway)
|
||||
uint16_t flags, struct comm_reply* repinfo, time_t leeway)
|
||||
{
|
||||
/* first send answer to client to keep its latency
|
||||
* as small as a cachereply */
|
||||
@ -831,7 +831,15 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||
log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
|
||||
edns.udp_size = NORMAL_UDP_SIZE;
|
||||
}
|
||||
if(edns.edns_present && edns.udp_size < LDNS_HEADER_SIZE) {
|
||||
if(edns.udp_size > worker->daemon->cfg->max_udp_size &&
|
||||
c->type == comm_udp) {
|
||||
verbose(VERB_QUERY,
|
||||
"worker request: max UDP reply size modified"
|
||||
" (%d to max-udp-size)", (int)edns.udp_size);
|
||||
log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
|
||||
edns.udp_size = worker->daemon->cfg->max_udp_size;
|
||||
}
|
||||
if(edns.udp_size < LDNS_HEADER_SIZE) {
|
||||
verbose(VERB_ALGO, "worker request: edns is too small.");
|
||||
log_addr(VERB_CLIENT, "from", &repinfo->addr, repinfo->addrlen);
|
||||
LDNS_QR_SET(ldns_buffer_begin(c->buffer));
|
||||
@ -889,7 +897,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||
/* prefetch it if the prefetch TTL expired */
|
||||
if(worker->env.cfg->prefetch && *worker->env.now >=
|
||||
((struct reply_info*)e->data)->prefetch_ttl) {
|
||||
uint32_t leeway = ((struct reply_info*)e->
|
||||
time_t leeway = ((struct reply_info*)e->
|
||||
data)->ttl - *worker->env.now;
|
||||
lock_rw_unlock(&e->lock);
|
||||
reply_and_prefetch(worker, &qinfo,
|
||||
|
153
doc/Changelog
153
doc/Changelog
@ -1,5 +1,158 @@
|
||||
16 Sep 2013: Wouter
|
||||
- Fix#524: max-udp-size not effective to non-EDNS0 queries, from
|
||||
Daisuke HIGASHI.
|
||||
|
||||
10 Sep 2013: Wouter
|
||||
- MIN_TTL and MAX_TTL also in time_t.
|
||||
- tag 1.4.21rc1 made again.
|
||||
|
||||
26 Aug 2013: Wouter
|
||||
- More fixes for bug#519: for the threaded case test if the bg
|
||||
thread has been killed, on ub_ctx_delete, to avoid hangs.
|
||||
|
||||
22 Aug 2013: Wouter
|
||||
- more fixes that I overlooked.
|
||||
- review fixes from Willem.
|
||||
|
||||
21 Aug 2013: Wouter
|
||||
- Fix#520: Errors found by static analysis from Tomas Hozza(redhat).
|
||||
|
||||
20 Aug 2013: Wouter
|
||||
- Fix for 2038, with time_t instead of uint32_t.
|
||||
|
||||
19 Aug 2013: Wouter
|
||||
- Fix#519 ub_ctx_delete may hang in some scenarios (libunbound).
|
||||
|
||||
14 Aug 2013: Wouter
|
||||
- Fix uninit variable in fix#516.
|
||||
|
||||
8 Aug 2013: Wouter
|
||||
- Fix#516 dnssec lameness detection for answers that are improper.
|
||||
|
||||
30 Jun 2013: Wouter
|
||||
- tag 1.4.21rc1
|
||||
|
||||
29 Jun 2013: Wouter
|
||||
- Fix#512 memleak in testcode for testbound (if it fails).
|
||||
- Fix#512 NSS returned arrays out of setup function to be statics.
|
||||
|
||||
26 Jun 2013: Wouter
|
||||
- max include of 100.000 files (depth and globbed at one time).
|
||||
This is to preserve system memory in bug cases, or endless cases.
|
||||
- iana portlist updated.
|
||||
|
||||
19 Jun 2013: Wouter
|
||||
- streamtcp man page, contributed by Tomas Hozza.
|
||||
- iana portlist updated.
|
||||
- libunbound documentation on how to avoid openssl race conditions.
|
||||
|
||||
25 Jun 2013: Wouter
|
||||
- Squelch sendto-permission denied errors when the network is
|
||||
not connected, to avoid spamming syslog.
|
||||
- configure --disable-flto option (from Robert Edmonds).
|
||||
|
||||
18 Jun 2013: Wouter
|
||||
- Fix for const string literals in C++ for libunbound, from Karel
|
||||
Slany.
|
||||
- iana portlist updated.
|
||||
|
||||
17 Jun 2013: Wouter
|
||||
- Fixup manpage syntax.
|
||||
|
||||
14 Jun 2013: Wouter
|
||||
- get_option and set_option support for log-time-ascii, python-script
|
||||
val-sig-skew-min and val-sig-skew-max. log-time-ascii takes effect
|
||||
immediately. The others are mostly useful for libunbound users.
|
||||
|
||||
13 Jun 2013: Wouter
|
||||
- get_option, set_option, unbound-checkconf -o and libunbound
|
||||
getoption and setoption support cache-min-ttl and cache-max-ttl.
|
||||
|
||||
10 Jun 2013: Wouter
|
||||
- Fix#501: forward-first does not recurse, when forward name is ".".
|
||||
- iana portlist update.
|
||||
- Max include depth is unlimited.
|
||||
|
||||
27 May 2013: Wouter
|
||||
- Update acx_pthreads.m4 to ax_pthreads.4 (2013-03-29), and apply
|
||||
patch to it to not fail when -Werror is also specified, from the
|
||||
autoconf-archives.
|
||||
- iana portlist update.
|
||||
|
||||
21 May 2013: Wouter
|
||||
- Explain bogus and secure flags in libunbound more.
|
||||
|
||||
16 May 2013: Wouter
|
||||
- Fix#499 use-after-free in out-of-memory handling code (thanks Jake
|
||||
Montgomery).
|
||||
- Fix#500 use on non-initialised values on socket bind failures.
|
||||
|
||||
15 May 2013: Wouter
|
||||
- Fix round-robin doesn't work with some Windows clients (from Ilya
|
||||
Bakulin).
|
||||
|
||||
3 May 2013: Wouter
|
||||
- update acx_nlnetlabs.m4 to v23, sleep w32 fix.
|
||||
|
||||
26 April 2013: Wouter
|
||||
- add unbound-control insecure_add and insecure_remove for the
|
||||
administration of negative trust anchors.
|
||||
|
||||
25 April 2013: Wouter
|
||||
- Implement max-udp-size config option, default 4096 (thanks
|
||||
Daisuke Higashi).
|
||||
- Robust checks on dname validity from rdata for dname compare.
|
||||
- updated iana portlist.
|
||||
|
||||
19 April 2013: Wouter
|
||||
- Fixup snprintf return value usage, fixed libunbound_get_option.
|
||||
|
||||
18 April 2013: Wouter
|
||||
- fix bug #491: pick program name (0th argument) as syslog identity.
|
||||
- own implementation of compat/snprintf.c.
|
||||
|
||||
15 April 2013: Wouter
|
||||
- Fix so that for a configuration line of include: "*.conf" it is not
|
||||
an error if there are no files matching the glob pattern.
|
||||
- unbound-anchor review: BIO_write can return 0 successfully if it
|
||||
has successfully appended a zero length string.
|
||||
|
||||
11 April 2013: Wouter
|
||||
- Fix queries leaking up for stubs and forwards, if the configured
|
||||
nameservers all fail to answer.
|
||||
|
||||
10 April 2013: Wouter
|
||||
- code improve for minimal responses, small speed increase.
|
||||
|
||||
9 April 2013: Wouter
|
||||
- updated iana portlist.
|
||||
- Fix crash in previous private address fixup of 22 March.
|
||||
|
||||
28 March 2013: Wouter
|
||||
- Make reverse zones easier by documenting the nodefault statements
|
||||
commented-out in the example config file.
|
||||
|
||||
26 March 2013: Wouter
|
||||
- more fixes to lookup3.c endianness detection.
|
||||
|
||||
25 March 2013: Wouter
|
||||
- #492: Fix endianness detection, revert to older lookup3.c detection
|
||||
and put new detect lines after previous tests, to avoid regressions
|
||||
but allow new detections to succeed.
|
||||
And add detection for machine/endian.h to it.
|
||||
|
||||
22 March 2013: Wouter
|
||||
- Fix resolve of names that use a mix of public and private addresses.
|
||||
- iana portlist update.
|
||||
- Fix makedist for new svn for -d option.
|
||||
- unbound.h header file has UNBOUND_VERSION_MAJOR define.
|
||||
- Fix windows RSRC version for long version numbers.
|
||||
|
||||
21 March 2013: Wouter
|
||||
- release 1.4.20
|
||||
- trunk has 1.4.21
|
||||
- committed libunbound version 4:1:2 for binary API updated in 1.4.20
|
||||
- install copy of unbound-control.8 man page for unbound-control-setup
|
||||
|
||||
14 March 2013: Wouter
|
||||
- iana portlist update.
|
||||
|
@ -99,4 +99,5 @@ SSHFP type
|
||||
4701: DHCID
|
||||
5155: NSEC3, NSEC3PARAM
|
||||
4408: SPF
|
||||
6944: DNSKEY algorithm status
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
README for Unbound 1.4.20
|
||||
README for Unbound 1.4.21
|
||||
Copyright 2007 NLnet Labs
|
||||
http://unbound.net
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Example configuration file.
|
||||
#
|
||||
# See unbound.conf(5) man page, version 1.4.20.
|
||||
# See unbound.conf(5) man page, version 1.4.21.
|
||||
#
|
||||
# this is a comment.
|
||||
|
||||
@ -89,6 +89,10 @@ server:
|
||||
# is set with msg-buffer-size). 1480 can solve fragmentation (timeouts).
|
||||
# edns-buffer-size: 4096
|
||||
|
||||
# Maximum UDP response size (not applied to TCP response).
|
||||
# Suggested values are 512 to 4096. Default is 4096. 65536 disables it.
|
||||
# max-udp-size: 4096
|
||||
|
||||
# buffer size for handling DNS data. No messages larger than this
|
||||
# size can be sent or received, by UDP or TCP. In bytes.
|
||||
# msg-buffer-size: 65552
|
||||
@ -426,6 +430,47 @@ server:
|
||||
# plain value in bytes or you can append k, m or G. default is "1Mb".
|
||||
# neg-cache-size: 1m
|
||||
|
||||
# By default, for a number of zones a small default 'nothing here'
|
||||
# reply is built-in. Query traffic is thus blocked. If you
|
||||
# wish to serve such zone you can unblock them by uncommenting one
|
||||
# of the nodefault statements below.
|
||||
# You may also have to use domain-insecure: zone to make DNSSEC work,
|
||||
# unless you have your own trust anchors for this zone.
|
||||
# local-zone: "localhost." nodefault
|
||||
# local-zone: "127.in-addr.arpa." nodefault
|
||||
# local-zone: "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa." nodefault
|
||||
# local-zone: "10.in-addr.arpa." nodefault
|
||||
# local-zone: "16.172.in-addr.arpa." nodefault
|
||||
# local-zone: "17.172.in-addr.arpa." nodefault
|
||||
# local-zone: "18.172.in-addr.arpa." nodefault
|
||||
# local-zone: "19.172.in-addr.arpa." nodefault
|
||||
# local-zone: "20.172.in-addr.arpa." nodefault
|
||||
# local-zone: "21.172.in-addr.arpa." nodefault
|
||||
# local-zone: "22.172.in-addr.arpa." nodefault
|
||||
# local-zone: "23.172.in-addr.arpa." nodefault
|
||||
# local-zone: "24.172.in-addr.arpa." nodefault
|
||||
# local-zone: "25.172.in-addr.arpa." nodefault
|
||||
# local-zone: "26.172.in-addr.arpa." nodefault
|
||||
# local-zone: "27.172.in-addr.arpa." nodefault
|
||||
# local-zone: "28.172.in-addr.arpa." nodefault
|
||||
# local-zone: "29.172.in-addr.arpa." nodefault
|
||||
# local-zone: "30.172.in-addr.arpa." nodefault
|
||||
# local-zone: "31.172.in-addr.arpa." nodefault
|
||||
# local-zone: "168.192.in-addr.arpa." nodefault
|
||||
# local-zone: "0.in-addr.arpa." nodefault
|
||||
# local-zone: "254.169.in-addr.arpa." nodefault
|
||||
# local-zone: "2.0.192.in-addr.arpa." nodefault
|
||||
# local-zone: "100.51.198.in-addr.arpa." nodefault
|
||||
# local-zone: "113.0.203.in-addr.arpa." nodefault
|
||||
# local-zone: "255.255.255.255.in-addr.arpa." nodefault
|
||||
# local-zone: "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa." nodefault
|
||||
# local-zone: "d.f.ip6.arpa." nodefault
|
||||
# local-zone: "8.e.f.ip6.arpa." nodefault
|
||||
# local-zone: "9.e.f.ip6.arpa." nodefault
|
||||
# local-zone: "a.e.f.ip6.arpa." nodefault
|
||||
# local-zone: "b.e.f.ip6.arpa." nodefault
|
||||
# local-zone: "8.b.d.0.1.0.0.2.ip6.arpa." nodefault
|
||||
|
||||
# a number of locally served zones can be configured.
|
||||
# local-zone: <zone> <type>
|
||||
# local-data: "<resource record string>"
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH "libunbound" "3" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20"
|
||||
.TH "libunbound" "3" "Sep 19, 2013" "NLnet Labs" "unbound 1.4.21"
|
||||
.\"
|
||||
.\" libunbound.3 -- unbound library functions manual
|
||||
.\"
|
||||
@ -42,7 +42,7 @@
|
||||
.B ub_ctx_zone_remove,
|
||||
.B ub_ctx_data_add,
|
||||
.B ub_ctx_data_remove
|
||||
\- Unbound DNS validating resolver 1.4.20 functions.
|
||||
\- Unbound DNS validating resolver 1.4.21 functions.
|
||||
.SH "SYNOPSIS"
|
||||
.LP
|
||||
.B #include <unbound.h>
|
||||
@ -171,6 +171,9 @@ by default. Use
|
||||
and
|
||||
.B ub_ctx_hosts
|
||||
to read them.
|
||||
Before you call this, use the openssl functions CRYPTO_set_id_callback and
|
||||
CRYPTO_set_locking_callback to set up asyncronous operation if you use
|
||||
lib openssl (the application calls these functions once for initialisation).
|
||||
.TP
|
||||
.B ub_ctx_delete
|
||||
Delete validation context and free associated resources.
|
||||
@ -364,7 +367,7 @@ The result of the DNS resolution and validation is returned as
|
||||
.fi
|
||||
.P
|
||||
If both secure and bogus are false, security was not enabled for the
|
||||
domain of the query.
|
||||
domain of the query. Else, they are not both true, one of them is true.
|
||||
.SH "RETURN VALUES"
|
||||
Many routines return an error code. The value 0 (zero) denotes no error
|
||||
happened. Other values can be passed to
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH "unbound-anchor" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20"
|
||||
.TH "unbound-anchor" "8" "Sep 19, 2013" "NLnet Labs" "unbound 1.4.21"
|
||||
.\"
|
||||
.\" unbound-anchor.8 -- unbound anchor maintenance utility manual
|
||||
.\"
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH "unbound-checkconf" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20"
|
||||
.TH "unbound-checkconf" "8" "Sep 19, 2013" "NLnet Labs" "unbound 1.4.21"
|
||||
.\"
|
||||
.\" unbound-checkconf.8 -- unbound configuration checker manual
|
||||
.\"
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH "unbound-control" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20"
|
||||
.TH "unbound-control" "8" "Sep 19, 2013" "NLnet Labs" "unbound 1.4.21"
|
||||
.\"
|
||||
.\" unbound-control.8 -- unbound remote control manual
|
||||
.\"
|
||||
@ -170,7 +170,7 @@ harden\-glue, harden\-dnssec\-stripped, harden\-below\-nxdomain,
|
||||
harden\-referral\-path, prefetch, prefetch\-key, log\-queries,
|
||||
hide\-identity, hide\-version, identity, version, val\-log\-level,
|
||||
val\-log\-squelch, ignore\-cd\-flag, add\-holddown, del\-holddown,
|
||||
keep\-missing, tcp\-upstream, ssl\-upstream.
|
||||
keep\-missing, tcp\-upstream, ssl\-upstream, max\-udp\-size.
|
||||
.TP
|
||||
.B get_option \fIopt
|
||||
Get the value of the option. Give the option name without a trailing ':'.
|
||||
@ -196,6 +196,14 @@ List the local zones in use. These are printed one per line with zone type.
|
||||
.B list_local_data
|
||||
List the local data RRs in use. The resource records are printed.
|
||||
.TP
|
||||
.B insecure_add \fIzone
|
||||
Add a \fBdomain\-insecure\fR for the given zone, like the statement in unbound.conf.
|
||||
Adds to the running unbound without affecting the cache contents (which may
|
||||
still be bogus, use \fBflush_zone\fR to remove it), does not affect the config file.
|
||||
.TP
|
||||
.B insecure_remove \fIzone
|
||||
Removes domain\-insecure for the given zone.
|
||||
.TP
|
||||
.B forward_add \fR[\fI+i\fR] \fIzone addr ...
|
||||
Add a new forward zone to running unbound. With +i option also adds a
|
||||
\fIdomain\-insecure\fR for the zone (so it can resolve insecurely if you have
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH "unbound\-host" "1" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20"
|
||||
.TH "unbound\-host" "1" "Sep 19, 2013" "NLnet Labs" "unbound 1.4.21"
|
||||
.\"
|
||||
.\" unbound-host.1 -- unbound DNS lookup utility
|
||||
.\"
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH "unbound" "8" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20"
|
||||
.TH "unbound" "8" "Sep 19, 2013" "NLnet Labs" "unbound 1.4.21"
|
||||
.\"
|
||||
.\" unbound.8 -- unbound manual
|
||||
.\"
|
||||
@ -10,7 +10,7 @@
|
||||
.SH "NAME"
|
||||
.LP
|
||||
.B unbound
|
||||
\- Unbound DNS validating resolver 1.4.20.
|
||||
\- Unbound DNS validating resolver 1.4.21.
|
||||
.SH "SYNOPSIS"
|
||||
.LP
|
||||
.B unbound
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH "unbound.conf" "5" "Mar 21, 2013" "NLnet Labs" "unbound 1.4.20"
|
||||
.TH "unbound.conf" "5" "Sep 19, 2013" "NLnet Labs" "unbound 1.4.21"
|
||||
.\"
|
||||
.\" unbound.conf.5 -- unbound.conf manual
|
||||
.\"
|
||||
@ -183,6 +183,11 @@ stringent path MTU problems, but is seen as extreme, since the amount
|
||||
of TCP fallback generated is excessive (probably also for this resolver,
|
||||
consider tuning the outgoing tcp number).
|
||||
.TP
|
||||
.B max\-udp\-size: \fI<number>
|
||||
Maximum UDP response size (not applied to TCP response). 65536 disables the
|
||||
udp response size maximum, and uses the choice from the client, always.
|
||||
Suggested values are 512 to 4096. Default is 4096.
|
||||
.TP
|
||||
.B msg\-buffer\-size: \fI<number>
|
||||
Number of bytes size of the message buffers. Default is 65552 bytes, enough
|
||||
for 64 Kb packets, the maximum DNS message size. No message larger than this
|
||||
@ -492,7 +497,7 @@ unsigned to badly signed often. If turned off you run the risk of a
|
||||
downgrade attack that disables security for a zone. Default is on.
|
||||
.TP
|
||||
.B harden\-below\-nxdomain: \fI<yes or no>
|
||||
From draft-vixie-dnsext-resimprove, returns nxdomain to queries for a name
|
||||
From draft\-vixie\-dnsext\-resimprove, returns nxdomain to queries for a name
|
||||
below another name that is already known to be nxdomain. DNSSEC mandates
|
||||
noerror for empty nonterminals, hence this is possible. Very old software
|
||||
might return nxdomain for empty nonterminals (that usually happen for reverse
|
||||
|
@ -71,7 +71,7 @@ struct delegpt* delegpt_copy(struct delegpt* dp, struct regional* region)
|
||||
copy->bogus = dp->bogus;
|
||||
copy->has_parent_side_NS = dp->has_parent_side_NS;
|
||||
for(ns = dp->nslist; ns; ns = ns->next) {
|
||||
if(!delegpt_add_ns(copy, region, ns->name, (int)ns->lame))
|
||||
if(!delegpt_add_ns(copy, region, ns->name, ns->lame))
|
||||
return NULL;
|
||||
copy->nslist->resolved = ns->resolved;
|
||||
copy->nslist->got4 = ns->got4;
|
||||
@ -98,7 +98,7 @@ delegpt_set_name(struct delegpt* dp, struct regional* region, uint8_t* name)
|
||||
|
||||
int
|
||||
delegpt_add_ns(struct delegpt* dp, struct regional* region, uint8_t* name,
|
||||
int lame)
|
||||
uint8_t lame)
|
||||
{
|
||||
struct delegpt_ns* ns;
|
||||
size_t len;
|
||||
@ -119,7 +119,7 @@ delegpt_add_ns(struct delegpt* dp, struct regional* region, uint8_t* name,
|
||||
ns->resolved = 0;
|
||||
ns->got4 = 0;
|
||||
ns->got6 = 0;
|
||||
ns->lame = (uint8_t)lame;
|
||||
ns->lame = lame;
|
||||
ns->done_pside4 = 0;
|
||||
ns->done_pside6 = 0;
|
||||
return ns->name != 0;
|
||||
@ -156,7 +156,7 @@ delegpt_find_addr(struct delegpt* dp, struct sockaddr_storage* addr,
|
||||
int
|
||||
delegpt_add_target(struct delegpt* dp, struct regional* region,
|
||||
uint8_t* name, size_t namelen, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, int bogus, int lame)
|
||||
socklen_t addrlen, uint8_t bogus, uint8_t lame)
|
||||
{
|
||||
struct delegpt_ns* ns = delegpt_find_ns(dp, name, namelen);
|
||||
log_assert(!dp->dp_type_mlc);
|
||||
@ -176,8 +176,8 @@ delegpt_add_target(struct delegpt* dp, struct regional* region,
|
||||
|
||||
int
|
||||
delegpt_add_addr(struct delegpt* dp, struct regional* region,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, int bogus,
|
||||
int lame)
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, uint8_t bogus,
|
||||
uint8_t lame)
|
||||
{
|
||||
struct delegpt_addr* a;
|
||||
log_assert(!dp->dp_type_mlc);
|
||||
@ -204,6 +204,7 @@ delegpt_add_addr(struct delegpt* dp, struct regional* region,
|
||||
a->attempts = 0;
|
||||
a->bogus = bogus;
|
||||
a->lame = lame;
|
||||
a->dnsseclame = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -376,7 +377,7 @@ delegpt_from_message(struct dns_msg* msg, struct regional* region)
|
||||
|
||||
int
|
||||
delegpt_rrset_add_ns(struct delegpt* dp, struct regional* region,
|
||||
struct ub_packed_rrset_key* ns_rrset, int lame)
|
||||
struct ub_packed_rrset_key* ns_rrset, uint8_t lame)
|
||||
{
|
||||
struct packed_rrset_data* nsdata = (struct packed_rrset_data*)
|
||||
ns_rrset->entry.data;
|
||||
@ -398,7 +399,7 @@ delegpt_rrset_add_ns(struct delegpt* dp, struct regional* region,
|
||||
|
||||
int
|
||||
delegpt_add_rrset_A(struct delegpt* dp, struct regional* region,
|
||||
struct ub_packed_rrset_key* ak, int lame)
|
||||
struct ub_packed_rrset_key* ak, uint8_t lame)
|
||||
{
|
||||
struct packed_rrset_data* d=(struct packed_rrset_data*)ak->entry.data;
|
||||
size_t i;
|
||||
@ -422,7 +423,7 @@ delegpt_add_rrset_A(struct delegpt* dp, struct regional* region,
|
||||
|
||||
int
|
||||
delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* region,
|
||||
struct ub_packed_rrset_key* ak, int lame)
|
||||
struct ub_packed_rrset_key* ak, uint8_t lame)
|
||||
{
|
||||
struct packed_rrset_data* d=(struct packed_rrset_data*)ak->entry.data;
|
||||
size_t i;
|
||||
@ -446,7 +447,7 @@ delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* region,
|
||||
|
||||
int
|
||||
delegpt_add_rrset(struct delegpt* dp, struct regional* region,
|
||||
struct ub_packed_rrset_key* rrset, int lame)
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame)
|
||||
{
|
||||
if(!rrset)
|
||||
return 1;
|
||||
@ -548,7 +549,7 @@ int delegpt_set_name_mlc(struct delegpt* dp, uint8_t* name)
|
||||
return (dp->name != NULL);
|
||||
}
|
||||
|
||||
int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, int lame)
|
||||
int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, uint8_t lame)
|
||||
{
|
||||
struct delegpt_ns* ns;
|
||||
size_t len;
|
||||
@ -579,7 +580,7 @@ int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, int lame)
|
||||
}
|
||||
|
||||
int delegpt_add_addr_mlc(struct delegpt* dp, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, int bogus, int lame)
|
||||
socklen_t addrlen, uint8_t bogus, uint8_t lame)
|
||||
{
|
||||
struct delegpt_addr* a;
|
||||
log_assert(dp->dp_type_mlc);
|
||||
@ -605,11 +606,13 @@ int delegpt_add_addr_mlc(struct delegpt* dp, struct sockaddr_storage* addr,
|
||||
a->attempts = 0;
|
||||
a->bogus = bogus;
|
||||
a->lame = lame;
|
||||
a->dnsseclame = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int delegpt_add_target_mlc(struct delegpt* dp, uint8_t* name, size_t namelen,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, int bogus, int lame)
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, uint8_t bogus,
|
||||
uint8_t lame)
|
||||
{
|
||||
struct delegpt_ns* ns = delegpt_find_ns(dp, name, namelen);
|
||||
log_assert(dp->dp_type_mlc);
|
||||
|
@ -140,9 +140,13 @@ struct delegpt_addr {
|
||||
int sel_rtt;
|
||||
/** if true, the A or AAAA RR was bogus, so this address is bad.
|
||||
* Also check the dp->bogus to see if everything is bogus. */
|
||||
int bogus;
|
||||
uint8_t bogus;
|
||||
/** if true, this address is dispreferred: it is a lame IP address */
|
||||
int lame;
|
||||
uint8_t lame;
|
||||
/** if the address is dnsseclame, but this cannot be cached, this
|
||||
* option is useful to mark the address dnsseclame.
|
||||
* This value is not copied in addr-copy and dp-copy. */
|
||||
uint8_t dnsseclame;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -179,7 +183,7 @@ int delegpt_set_name(struct delegpt* dp, struct regional* regional,
|
||||
* @return false on error.
|
||||
*/
|
||||
int delegpt_add_ns(struct delegpt* dp, struct regional* regional,
|
||||
uint8_t* name, int lame);
|
||||
uint8_t* name, uint8_t lame);
|
||||
|
||||
/**
|
||||
* Add NS rrset; calls add_ns repeatedly.
|
||||
@ -190,7 +194,7 @@ int delegpt_add_ns(struct delegpt* dp, struct regional* regional,
|
||||
* @return 0 on alloc error.
|
||||
*/
|
||||
int delegpt_rrset_add_ns(struct delegpt* dp, struct regional* regional,
|
||||
struct ub_packed_rrset_key* ns_rrset, int lame);
|
||||
struct ub_packed_rrset_key* ns_rrset, uint8_t lame);
|
||||
|
||||
/**
|
||||
* Add target address to the delegation point.
|
||||
@ -207,7 +211,7 @@ int delegpt_rrset_add_ns(struct delegpt* dp, struct regional* regional,
|
||||
*/
|
||||
int delegpt_add_target(struct delegpt* dp, struct regional* regional,
|
||||
uint8_t* name, size_t namelen, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, int bogus, int lame);
|
||||
socklen_t addrlen, uint8_t bogus, uint8_t lame);
|
||||
|
||||
/**
|
||||
* Add A RRset to delegpt.
|
||||
@ -218,7 +222,7 @@ int delegpt_add_target(struct delegpt* dp, struct regional* regional,
|
||||
* @return 0 on alloc error.
|
||||
*/
|
||||
int delegpt_add_rrset_A(struct delegpt* dp, struct regional* regional,
|
||||
struct ub_packed_rrset_key* rrset, int lame);
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame);
|
||||
|
||||
/**
|
||||
* Add AAAA RRset to delegpt.
|
||||
@ -229,7 +233,7 @@ int delegpt_add_rrset_A(struct delegpt* dp, struct regional* regional,
|
||||
* @return 0 on alloc error.
|
||||
*/
|
||||
int delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* regional,
|
||||
struct ub_packed_rrset_key* rrset, int lame);
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame);
|
||||
|
||||
/**
|
||||
* Add any RRset to delegpt.
|
||||
@ -241,7 +245,7 @@ int delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* regional,
|
||||
* @return 0 on alloc error.
|
||||
*/
|
||||
int delegpt_add_rrset(struct delegpt* dp, struct regional* regional,
|
||||
struct ub_packed_rrset_key* rrset, int lame);
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame);
|
||||
|
||||
/**
|
||||
* Add address to the delegation point. No servername is associated or checked.
|
||||
@ -254,7 +258,8 @@ int delegpt_add_rrset(struct delegpt* dp, struct regional* regional,
|
||||
* @return false on error.
|
||||
*/
|
||||
int delegpt_add_addr(struct delegpt* dp, struct regional* regional,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, int bogus, int lame);
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t bogus, uint8_t lame);
|
||||
|
||||
/**
|
||||
* Find NS record in name list of delegation point.
|
||||
@ -376,7 +381,7 @@ int delegpt_set_name_mlc(struct delegpt* dp, uint8_t* name);
|
||||
* @param lame: the name is lame, disprefer.
|
||||
* @return false on error.
|
||||
*/
|
||||
int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, int lame);
|
||||
int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, uint8_t lame);
|
||||
|
||||
/**
|
||||
* add an address to a malloced delegation point.
|
||||
@ -388,7 +393,7 @@ int delegpt_add_ns_mlc(struct delegpt* dp, uint8_t* name, int lame);
|
||||
* @return false on error.
|
||||
*/
|
||||
int delegpt_add_addr_mlc(struct delegpt* dp, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, int bogus, int lame);
|
||||
socklen_t addrlen, uint8_t bogus, uint8_t lame);
|
||||
|
||||
/**
|
||||
* Add target address to the delegation point.
|
||||
@ -403,7 +408,8 @@ int delegpt_add_addr_mlc(struct delegpt* dp, struct sockaddr_storage* addr,
|
||||
* @return false on error.
|
||||
*/
|
||||
int delegpt_add_target_mlc(struct delegpt* dp, uint8_t* name, size_t namelen,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, int bogus, int lame);
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, uint8_t bogus,
|
||||
uint8_t lame);
|
||||
|
||||
/** get memory in use by dp */
|
||||
size_t delegpt_get_mem(struct delegpt* dp);
|
||||
|
@ -324,6 +324,20 @@ forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg)
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct delegpt*
|
||||
forwards_find(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass)
|
||||
{
|
||||
rbnode_t* res = NULL;
|
||||
struct iter_forward_zone key;
|
||||
key.node.key = &key;
|
||||
key.dclass = qclass;
|
||||
key.name = qname;
|
||||
key.namelabs = dname_count_size_labels(qname, &key.namelen);
|
||||
res = rbtree_search(fwd->tree, &key);
|
||||
if(res) return ((struct iter_forward_zone*)res)->dp;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct delegpt*
|
||||
forwards_lookup(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass)
|
||||
{
|
||||
|
@ -104,6 +104,16 @@ void forwards_delete(struct iter_forwards* fwd);
|
||||
*/
|
||||
int forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg);
|
||||
|
||||
/**
|
||||
* Find forward zone exactly by name
|
||||
* @param fwd: forward storage.
|
||||
* @param qname: The qname of the query.
|
||||
* @param qclass: The qclass of the query.
|
||||
* @return: A delegation point or null.
|
||||
*/
|
||||
struct delegpt* forwards_find(struct iter_forwards* fwd, uint8_t* qname,
|
||||
uint16_t qclass);
|
||||
|
||||
/**
|
||||
* Find forward zone information
|
||||
* For this qname/qclass find forward zone information, returns delegation
|
||||
|
@ -208,6 +208,28 @@ size_t priv_get_mem(struct iter_priv* priv)
|
||||
return sizeof(*priv) + regional_get_mem(priv->region);
|
||||
}
|
||||
|
||||
/** remove RR from msgparse RRset, return true if rrset is entirely bad */
|
||||
static int
|
||||
remove_rr(const char* str, ldns_buffer* pkt, struct rrset_parse* rrset,
|
||||
struct rr_parse* prev, struct rr_parse** rr, struct sockaddr_storage* addr, socklen_t addrlen)
|
||||
{
|
||||
if(verbosity >= VERB_QUERY && rrset->dname_len <= LDNS_MAX_DOMAINLEN && str) {
|
||||
uint8_t buf[LDNS_MAX_DOMAINLEN+1];
|
||||
dname_pkt_copy(pkt, buf, rrset->dname);
|
||||
log_name_addr(VERB_QUERY, str, buf, addr, addrlen);
|
||||
}
|
||||
if(prev)
|
||||
prev->next = (*rr)->next;
|
||||
else rrset->rr_first = (*rr)->next;
|
||||
if(rrset->rr_last == *rr)
|
||||
rrset->rr_last = prev;
|
||||
rrset->rr_count --;
|
||||
rrset->size -= (*rr)->size;
|
||||
/* rr struct still exists, but is unlinked, so that in the for loop
|
||||
* the rr->next works fine to continue. */
|
||||
return rrset->rr_count == 0;
|
||||
}
|
||||
|
||||
int priv_rrset_bad(struct iter_priv* priv, ldns_buffer* pkt,
|
||||
struct rrset_parse* rrset)
|
||||
{
|
||||
@ -221,7 +243,7 @@ int priv_rrset_bad(struct iter_priv* priv, ldns_buffer* pkt,
|
||||
} else {
|
||||
/* so its a public name, check the address */
|
||||
socklen_t len;
|
||||
struct rr_parse* rr;
|
||||
struct rr_parse* rr, *prev = NULL;
|
||||
if(rrset->type == LDNS_RR_TYPE_A) {
|
||||
struct sockaddr_storage addr;
|
||||
struct sockaddr_in sa;
|
||||
@ -232,13 +254,19 @@ int priv_rrset_bad(struct iter_priv* priv, ldns_buffer* pkt,
|
||||
sa.sin_port = (in_port_t)htons(UNBOUND_DNS_PORT);
|
||||
for(rr = rrset->rr_first; rr; rr = rr->next) {
|
||||
if(ldns_read_uint16(rr->ttl_data+4)
|
||||
!= INET_SIZE)
|
||||
!= INET_SIZE) {
|
||||
prev = rr;
|
||||
continue;
|
||||
}
|
||||
memmove(&sa.sin_addr, rr->ttl_data+4+2,
|
||||
INET_SIZE);
|
||||
memmove(&addr, &sa, len);
|
||||
if(priv_lookup_addr(priv, &addr, len))
|
||||
return 1;
|
||||
if(priv_lookup_addr(priv, &addr, len)) {
|
||||
if(remove_rr("sanitize: removing public name with private address", pkt, rrset, prev, &rr, &addr, len))
|
||||
return 1;
|
||||
continue;
|
||||
}
|
||||
prev = rr;
|
||||
}
|
||||
} else if(rrset->type == LDNS_RR_TYPE_AAAA) {
|
||||
struct sockaddr_storage addr;
|
||||
@ -249,13 +277,19 @@ int priv_rrset_bad(struct iter_priv* priv, ldns_buffer* pkt,
|
||||
sa.sin6_port = (in_port_t)htons(UNBOUND_DNS_PORT);
|
||||
for(rr = rrset->rr_first; rr; rr = rr->next) {
|
||||
if(ldns_read_uint16(rr->ttl_data+4)
|
||||
!= INET6_SIZE)
|
||||
!= INET6_SIZE) {
|
||||
prev = rr;
|
||||
continue;
|
||||
}
|
||||
memmove(&sa.sin6_addr, rr->ttl_data+4+2,
|
||||
INET6_SIZE);
|
||||
memmove(&addr, &sa, len);
|
||||
if(priv_lookup_addr(priv, &addr, len))
|
||||
return 1;
|
||||
if(priv_lookup_addr(priv, &addr, len)) {
|
||||
if(remove_rr("sanitize: removing public name with private address", pkt, rrset, prev, &rr, &addr, len))
|
||||
return 1;
|
||||
continue;
|
||||
}
|
||||
prev = rr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,8 @@ int priv_apply_cfg(struct iter_priv* priv, struct config_file* cfg);
|
||||
|
||||
/**
|
||||
* See if rrset is bad.
|
||||
* Will remove individual RRs that are bad (if possible) to
|
||||
* sanitize the RRset without removing it completely.
|
||||
* @param priv: structure for private address storage.
|
||||
* @param pkt: packet to decompress rrset name in.
|
||||
* @param rrset: the rrset to examine, A or AAAA.
|
||||
|
@ -62,7 +62,7 @@ static void
|
||||
remove_rrset(const char* str, ldns_buffer* pkt, struct msg_parse* msg,
|
||||
struct rrset_parse* prev, struct rrset_parse** rrset)
|
||||
{
|
||||
if(verbosity >= VERB_QUERY
|
||||
if(verbosity >= VERB_QUERY && str
|
||||
&& (*rrset)->dname_len <= LDNS_MAX_DOMAINLEN) {
|
||||
uint8_t buf[LDNS_MAX_DOMAINLEN+1];
|
||||
dname_pkt_copy(pkt, buf, (*rrset)->dname);
|
||||
@ -520,7 +520,7 @@ store_rrset(ldns_buffer* pkt, struct msg_parse* msg, struct module_env* env,
|
||||
struct ub_packed_rrset_key* k;
|
||||
struct packed_rrset_data* d;
|
||||
struct rrset_ref ref;
|
||||
uint32_t now = *env->now;
|
||||
time_t now = *env->now;
|
||||
|
||||
k = alloc_special_obtain(env->alloc);
|
||||
if(!k)
|
||||
@ -646,14 +646,16 @@ scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
|
||||
/* remove private addresses */
|
||||
if( (rrset->type == LDNS_RR_TYPE_A ||
|
||||
rrset->type == LDNS_RR_TYPE_AAAA) &&
|
||||
priv_rrset_bad(ie->priv, pkt, rrset)) {
|
||||
rrset->type == LDNS_RR_TYPE_AAAA)) {
|
||||
|
||||
/* do not set servfail since this leads to too
|
||||
* many drops of other people using rfc1918 space */
|
||||
remove_rrset("sanitize: removing public name with "
|
||||
"private address", pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
/* also do not remove entire rrset, unless all records
|
||||
* in it are bad */
|
||||
if(priv_rrset_bad(ie->priv, pkt, rrset)) {
|
||||
remove_rrset(NULL, pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* skip DNAME records -- they will always be followed by a
|
||||
|
@ -177,7 +177,7 @@ iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
|
||||
*/
|
||||
static int
|
||||
iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, time_t now,
|
||||
struct delegpt_addr* a)
|
||||
{
|
||||
int rtt, lame, reclame, dnsseclame;
|
||||
@ -217,14 +217,16 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
|
||||
/* select remainder from worst to best */
|
||||
else if(reclame)
|
||||
return rtt+USEFUL_SERVER_TOP_TIMEOUT*3; /* nonpref */
|
||||
else if(dnsseclame )
|
||||
else if(dnsseclame || a->dnsseclame)
|
||||
return rtt+USEFUL_SERVER_TOP_TIMEOUT*2; /* nonpref */
|
||||
else if(a->lame)
|
||||
return rtt+USEFUL_SERVER_TOP_TIMEOUT+1; /* nonpref */
|
||||
else return rtt;
|
||||
}
|
||||
/* no server information present */
|
||||
if(a->lame)
|
||||
if(a->dnsseclame)
|
||||
return UNKNOWN_SERVER_NICENESS+USEFUL_SERVER_TOP_TIMEOUT*2; /* nonpref */
|
||||
else if(a->lame)
|
||||
return USEFUL_SERVER_TOP_TIMEOUT+1+UNKNOWN_SERVER_NICENESS; /* nonpref */
|
||||
return UNKNOWN_SERVER_NICENESS;
|
||||
}
|
||||
@ -232,7 +234,7 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
|
||||
/** lookup RTT information, and also store fastest rtt (if any) */
|
||||
static int
|
||||
iter_fill_rtt(struct iter_env* iter_env, struct module_env* env,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, time_t now,
|
||||
struct delegpt* dp, int* best_rtt, struct sock_list* blacklist)
|
||||
{
|
||||
int got_it = 0;
|
||||
@ -261,7 +263,7 @@ iter_fill_rtt(struct iter_env* iter_env, struct module_env* env,
|
||||
* returns number of best targets (or 0, no suitable targets) */
|
||||
static int
|
||||
iter_filter_order(struct iter_env* iter_env, struct module_env* env,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, time_t now,
|
||||
struct delegpt* dp, int* selected_rtt, int open_target,
|
||||
struct sock_list* blacklist)
|
||||
{
|
||||
@ -420,7 +422,7 @@ dns_copy_msg(struct dns_msg* from, struct regional* region)
|
||||
|
||||
void
|
||||
iter_dns_store(struct module_env* env, struct query_info* msgqinf,
|
||||
struct reply_info* msgrep, int is_referral, uint32_t leeway, int pside,
|
||||
struct reply_info* msgrep, int is_referral, time_t leeway, int pside,
|
||||
struct regional* region)
|
||||
{
|
||||
if(!dns_cache_store(env, msgqinf, msgrep, is_referral, leeway,
|
||||
@ -768,7 +770,7 @@ void iter_store_parentside_neg(struct module_env* env,
|
||||
/* TTL: NS from referral in iq->deleg_msg,
|
||||
* or first RR from iq->response,
|
||||
* or servfail5secs if !iq->response */
|
||||
uint32_t ttl = NORR_TTL;
|
||||
time_t ttl = NORR_TTL;
|
||||
struct ub_packed_rrset_key* neg;
|
||||
struct packed_rrset_data* newd;
|
||||
if(rep) {
|
||||
@ -798,7 +800,7 @@ void iter_store_parentside_neg(struct module_env* env,
|
||||
neg->entry.hash = rrset_key_hash(&neg->rk);
|
||||
newd = (struct packed_rrset_data*)regional_alloc_zero(env->scratch,
|
||||
sizeof(struct packed_rrset_data) + sizeof(size_t) +
|
||||
sizeof(uint8_t*) + sizeof(uint32_t) + sizeof(uint16_t));
|
||||
sizeof(uint8_t*) + sizeof(time_t) + sizeof(uint16_t));
|
||||
if(!newd) {
|
||||
log_err("out of memory in store_parentside_neg");
|
||||
return;
|
||||
|
@ -131,7 +131,7 @@ struct dns_msg* dns_copy_msg(struct dns_msg* from, struct regional* regional);
|
||||
* but the query resolution can continue without cache storage.
|
||||
*/
|
||||
void iter_dns_store(struct module_env* env, struct query_info* qinf,
|
||||
struct reply_info* rep, int is_referral, uint32_t leeway, int pside,
|
||||
struct reply_info* rep, int is_referral, time_t leeway, int pside,
|
||||
struct regional* region);
|
||||
|
||||
/**
|
||||
|
@ -1409,6 +1409,35 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** see if last resort is possible - does config allow queries to parent */
|
||||
static int
|
||||
can_have_last_resort(struct module_env* env, struct delegpt* dp,
|
||||
struct iter_qstate* iq)
|
||||
{
|
||||
struct delegpt* fwddp;
|
||||
struct iter_hints_stub* stub;
|
||||
/* do not process a last resort (the parent side) if a stub
|
||||
* or forward is configured, because we do not want to go 'above'
|
||||
* the configured servers */
|
||||
if(!dname_is_root(dp->name) && (stub = (struct iter_hints_stub*)
|
||||
name_tree_find(&env->hints->tree, dp->name, dp->namelen,
|
||||
dp->namelabs, iq->qchase.qclass)) &&
|
||||
/* has_parent side is turned off for stub_first, where we
|
||||
* are allowed to go to the parent */
|
||||
stub->dp->has_parent_side_NS) {
|
||||
verbose(VERB_QUERY, "configured stub servers failed -- returning SERVFAIL");
|
||||
return 0;
|
||||
}
|
||||
if((fwddp = forwards_find(env->fwds, dp->name, iq->qchase.qclass)) &&
|
||||
/* has_parent_side is turned off for forward_first, where
|
||||
* we are allowed to go to the parent */
|
||||
fwddp->has_parent_side_NS) {
|
||||
verbose(VERB_QUERY, "configured forward servers failed -- returning SERVFAIL");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by processQueryTargets when it would like extra targets to query
|
||||
* but it seems to be out of options. At last resort some less appealing
|
||||
@ -1430,6 +1459,11 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
verbose(VERB_ALGO, "No more query targets, attempting last resort");
|
||||
log_assert(iq->dp);
|
||||
|
||||
if(!can_have_last_resort(qstate->env, iq->dp, iq)) {
|
||||
/* fail -- no more targets, no more hope of targets, no hope
|
||||
* of a response. */
|
||||
return error_response_cache(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
if(!iq->dp->has_parent_side_NS && dname_is_root(iq->dp->name)) {
|
||||
struct delegpt* p = hints_lookup_root(qstate->env->hints,
|
||||
iq->qchase.qclass);
|
||||
@ -1439,7 +1473,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
iq->chase_flags &= ~BIT_RD; /* go to authorities */
|
||||
for(ns = p->nslist; ns; ns=ns->next) {
|
||||
(void)delegpt_add_ns(iq->dp, qstate->region,
|
||||
ns->name, (int)ns->lame);
|
||||
ns->name, ns->lame);
|
||||
}
|
||||
for(a = p->target_list; a; a=a->next_target) {
|
||||
(void)delegpt_add_addr(iq->dp, qstate->region,
|
||||
@ -1880,12 +1914,23 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
&& type != RESPONSE_TYPE_UNTYPED) {
|
||||
/* a possible answer, see if it is missing DNSSEC */
|
||||
/* but not when forwarding, so we dont mark fwder lame */
|
||||
/* also make sure the answer is from the zone we expected,
|
||||
* otherwise, (due to parent,child on same server), we
|
||||
* might mark the server,zone lame inappropriately */
|
||||
if(!iter_msg_has_dnssec(iq->response) &&
|
||||
iter_msg_from_zone(iq->response, iq->dp, type,
|
||||
iq->qchase.qclass)) {
|
||||
if(!iter_msg_has_dnssec(iq->response)) {
|
||||
/* Mark this address as dnsseclame in this dp,
|
||||
* because that will make serverselection disprefer
|
||||
* it, but also, once it is the only final option,
|
||||
* use dnssec-lame-bypass if it needs to query there.*/
|
||||
if(qstate->reply) {
|
||||
struct delegpt_addr* a = delegpt_find_addr(
|
||||
iq->dp, &qstate->reply->addr,
|
||||
qstate->reply->addrlen);
|
||||
if(a) a->dnsseclame = 1;
|
||||
}
|
||||
/* test the answer is from the zone we expected,
|
||||
* otherwise, (due to parent,child on same server), we
|
||||
* might mark the server,zone lame inappropriately */
|
||||
if(!iter_msg_from_zone(iq->response, iq->dp, type,
|
||||
iq->qchase.qclass))
|
||||
qstate->reply = NULL;
|
||||
type = RESPONSE_TYPE_LAME;
|
||||
dnsseclame = 1;
|
||||
}
|
||||
@ -2117,8 +2162,7 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
*qstate->env->now, dnsseclame, 0,
|
||||
iq->qchase.qtype))
|
||||
log_err("mark host lame: out of memory");
|
||||
} else log_err("%slame response from cache",
|
||||
dnsseclame?"DNSSEC ":"");
|
||||
}
|
||||
} else if(type == RESPONSE_TYPE_REC_LAME) {
|
||||
/* Cache the LAMEness. */
|
||||
verbose(VERB_DETAIL, "query response REC_LAME: "
|
||||
@ -2326,12 +2370,12 @@ processTargetResponse(struct module_qstate* qstate, int id,
|
||||
rrset->rk.dname_len)) {
|
||||
/* if dpns->lame then set newcname ns lame too */
|
||||
if(!delegpt_add_ns(foriq->dp, forq->region,
|
||||
rrset->rk.dname, (int)dpns->lame))
|
||||
rrset->rk.dname, dpns->lame))
|
||||
log_err("out of memory adding cnamed-ns");
|
||||
}
|
||||
/* if dpns->lame then set the address(es) lame too */
|
||||
if(!delegpt_add_rrset(foriq->dp, forq->region, rrset,
|
||||
(int)dpns->lame))
|
||||
dpns->lame))
|
||||
log_err("out of memory adding targets");
|
||||
verbose(VERB_ALGO, "added target response");
|
||||
delegpt_log(VERB_ALGO, foriq->dp);
|
||||
|
@ -124,7 +124,7 @@ find_id(struct ub_ctx* ctx, int* id)
|
||||
}
|
||||
|
||||
struct ctx_query*
|
||||
context_new(struct ub_ctx* ctx, char* name, int rrtype, int rrclass,
|
||||
context_new(struct ub_ctx* ctx, const char* name, int rrtype, int rrclass,
|
||||
ub_callback_t cb, void* cbarg)
|
||||
{
|
||||
struct ctx_query* q = (struct ctx_query*)calloc(1, sizeof(*q));
|
||||
|
@ -234,7 +234,7 @@ void context_query_delete(struct ctx_query* q);
|
||||
* @param cbarg: user arg for async queries.
|
||||
* @return new ctx_query or NULL for malloc failure.
|
||||
*/
|
||||
struct ctx_query* context_new(struct ub_ctx* ctx, char* name, int rrtype,
|
||||
struct ctx_query* context_new(struct ub_ctx* ctx, const char* name, int rrtype,
|
||||
int rrclass, ub_callback_t cb, void* cbarg);
|
||||
|
||||
/**
|
||||
|
@ -60,6 +60,9 @@
|
||||
#include "services/localzone.h"
|
||||
#include "services/cache/infra.h"
|
||||
#include "services/cache/rrset.h"
|
||||
#ifdef HAVE_PTHREAD
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#if defined(UB_ON_WINDOWS) && defined (HAVE_WINDOWS_H)
|
||||
#include <windows.h>
|
||||
@ -155,11 +158,9 @@ delq(rbnode_t* n, void* ATTR_UNUSED(arg))
|
||||
context_query_delete(q);
|
||||
}
|
||||
|
||||
void
|
||||
ub_ctx_delete(struct ub_ctx* ctx)
|
||||
/** stop the bg thread */
|
||||
static void ub_stop_bg(struct ub_ctx* ctx)
|
||||
{
|
||||
struct alloc_cache* a, *na;
|
||||
if(!ctx) return;
|
||||
/* stop the bg thread */
|
||||
lock_basic_lock(&ctx->cfglock);
|
||||
if(ctx->created_bg) {
|
||||
@ -195,7 +196,28 @@ ub_ctx_delete(struct ub_ctx* ctx)
|
||||
else {
|
||||
lock_basic_unlock(&ctx->cfglock);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ub_ctx_delete(struct ub_ctx* ctx)
|
||||
{
|
||||
struct alloc_cache* a, *na;
|
||||
int do_stop = 1;
|
||||
if(!ctx) return;
|
||||
|
||||
/* see if bg thread is created and if threads have been killed */
|
||||
/* no locks, because those may be held by terminated threads */
|
||||
/* for processes the read pipe is closed and we see that on read */
|
||||
#ifdef HAVE_PTHREAD
|
||||
if(ctx->created_bg && ctx->dothread) {
|
||||
if(pthread_kill(ctx->bg_tid, 0) == ESRCH) {
|
||||
/* thread has been killed */
|
||||
do_stop = 0;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_PTHREAD */
|
||||
if(do_stop)
|
||||
ub_stop_bg(ctx);
|
||||
|
||||
modstack_desetup(&ctx->mods, ctx->env);
|
||||
a = ctx->alloc_list;
|
||||
@ -229,7 +251,7 @@ ub_ctx_delete(struct ub_ctx* ctx)
|
||||
}
|
||||
|
||||
int
|
||||
ub_ctx_set_option(struct ub_ctx* ctx, char* opt, char* val)
|
||||
ub_ctx_set_option(struct ub_ctx* ctx, const char* opt, const char* val)
|
||||
{
|
||||
lock_basic_lock(&ctx->cfglock);
|
||||
if(ctx->finalized) {
|
||||
@ -245,7 +267,7 @@ ub_ctx_set_option(struct ub_ctx* ctx, char* opt, char* val)
|
||||
}
|
||||
|
||||
int
|
||||
ub_ctx_get_option(struct ub_ctx* ctx, char* opt, char** str)
|
||||
ub_ctx_get_option(struct ub_ctx* ctx, const char* opt, char** str)
|
||||
{
|
||||
int r;
|
||||
lock_basic_lock(&ctx->cfglock);
|
||||
@ -258,7 +280,7 @@ ub_ctx_get_option(struct ub_ctx* ctx, char* opt, char** str)
|
||||
}
|
||||
|
||||
int
|
||||
ub_ctx_config(struct ub_ctx* ctx, char* fname)
|
||||
ub_ctx_config(struct ub_ctx* ctx, const char* fname)
|
||||
{
|
||||
lock_basic_lock(&ctx->cfglock);
|
||||
if(ctx->finalized) {
|
||||
@ -274,7 +296,7 @@ ub_ctx_config(struct ub_ctx* ctx, char* fname)
|
||||
}
|
||||
|
||||
int
|
||||
ub_ctx_add_ta(struct ub_ctx* ctx, char* ta)
|
||||
ub_ctx_add_ta(struct ub_ctx* ctx, const char* ta)
|
||||
{
|
||||
char* dup = strdup(ta);
|
||||
if(!dup) return UB_NOMEM;
|
||||
@ -294,7 +316,7 @@ ub_ctx_add_ta(struct ub_ctx* ctx, char* ta)
|
||||
}
|
||||
|
||||
int
|
||||
ub_ctx_add_ta_file(struct ub_ctx* ctx, char* fname)
|
||||
ub_ctx_add_ta_file(struct ub_ctx* ctx, const char* fname)
|
||||
{
|
||||
char* dup = strdup(fname);
|
||||
if(!dup) return UB_NOMEM;
|
||||
@ -314,7 +336,7 @@ ub_ctx_add_ta_file(struct ub_ctx* ctx, char* fname)
|
||||
}
|
||||
|
||||
int
|
||||
ub_ctx_trustedkeys(struct ub_ctx* ctx, char* fname)
|
||||
ub_ctx_trustedkeys(struct ub_ctx* ctx, const char* fname)
|
||||
{
|
||||
char* dup = strdup(fname);
|
||||
if(!dup) return UB_NOMEM;
|
||||
@ -547,7 +569,7 @@ ub_wait(struct ub_ctx* ctx)
|
||||
}
|
||||
|
||||
int
|
||||
ub_resolve(struct ub_ctx* ctx, char* name, int rrtype,
|
||||
ub_resolve(struct ub_ctx* ctx, const char* name, int rrtype,
|
||||
int rrclass, struct ub_result** result)
|
||||
{
|
||||
struct ctx_query* q;
|
||||
@ -591,7 +613,7 @@ ub_resolve(struct ub_ctx* ctx, char* name, int rrtype,
|
||||
}
|
||||
|
||||
int
|
||||
ub_resolve_async(struct ub_ctx* ctx, char* name, int rrtype,
|
||||
ub_resolve_async(struct ub_ctx* ctx, const char* name, int rrtype,
|
||||
int rrclass, void* mydata, ub_callback_t callback, int* async_id)
|
||||
{
|
||||
struct ctx_query* q;
|
||||
@ -732,7 +754,7 @@ ub_strerror(int err)
|
||||
}
|
||||
|
||||
int
|
||||
ub_ctx_set_fwd(struct ub_ctx* ctx, char* addr)
|
||||
ub_ctx_set_fwd(struct ub_ctx* ctx, const char* addr)
|
||||
{
|
||||
struct sockaddr_storage storage;
|
||||
socklen_t stlen;
|
||||
@ -804,7 +826,7 @@ ub_ctx_set_fwd(struct ub_ctx* ctx, char* addr)
|
||||
}
|
||||
|
||||
int
|
||||
ub_ctx_resolvconf(struct ub_ctx* ctx, char* fname)
|
||||
ub_ctx_resolvconf(struct ub_ctx* ctx, const char* fname)
|
||||
{
|
||||
FILE* in;
|
||||
int numserv = 0;
|
||||
@ -890,7 +912,7 @@ ub_ctx_resolvconf(struct ub_ctx* ctx, char* fname)
|
||||
}
|
||||
|
||||
int
|
||||
ub_ctx_hosts(struct ub_ctx* ctx, char* fname)
|
||||
ub_ctx_hosts(struct ub_ctx* ctx, const char* fname)
|
||||
{
|
||||
FILE* in;
|
||||
char buf[1024], ldata[1024];
|
||||
@ -1016,7 +1038,8 @@ int ub_ctx_print_local_zones(struct ub_ctx* ctx)
|
||||
}
|
||||
|
||||
/* Add a new zone */
|
||||
int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type)
|
||||
int ub_ctx_zone_add(struct ub_ctx* ctx, const char *zone_name,
|
||||
const char *zone_type)
|
||||
{
|
||||
enum localzone_type t;
|
||||
struct local_zone* z;
|
||||
@ -1056,7 +1079,7 @@ int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type)
|
||||
}
|
||||
|
||||
/* Remove zone */
|
||||
int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name)
|
||||
int ub_ctx_zone_remove(struct ub_ctx* ctx, const char *zone_name)
|
||||
{
|
||||
struct local_zone* z;
|
||||
uint8_t* nm;
|
||||
@ -1082,7 +1105,7 @@ int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name)
|
||||
}
|
||||
|
||||
/* Add new RR data */
|
||||
int ub_ctx_data_add(struct ub_ctx* ctx, char *data)
|
||||
int ub_ctx_data_add(struct ub_ctx* ctx, const char *data)
|
||||
{
|
||||
ldns_buffer* buf;
|
||||
int res = ub_ctx_finalize(ctx);
|
||||
@ -1100,7 +1123,7 @@ int ub_ctx_data_add(struct ub_ctx* ctx, char *data)
|
||||
}
|
||||
|
||||
/* Remove RR data */
|
||||
int ub_ctx_data_remove(struct ub_ctx* ctx, char *data)
|
||||
int ub_ctx_data_remove(struct ub_ctx* ctx, const char *data)
|
||||
{
|
||||
uint8_t* nm;
|
||||
int nmlabs;
|
||||
|
@ -198,7 +198,10 @@ libworker_setup(struct ub_ctx* ctx, int is_bg)
|
||||
}
|
||||
numports = cfg_condense_ports(cfg, &ports);
|
||||
if(numports == 0) {
|
||||
int locked = !w->is_bg || w->is_bg_thread;
|
||||
libworker_delete(w);
|
||||
if(locked)
|
||||
lock_basic_unlock(&ctx->cfglock);
|
||||
return NULL;
|
||||
}
|
||||
w->back = outside_network_create(w->base, cfg->msg_buffer_size,
|
||||
@ -372,6 +375,11 @@ int libworker_bg(struct ub_ctx* ctx)
|
||||
case -1:
|
||||
return UB_FORKFAIL;
|
||||
default:
|
||||
/* close non-used parts, so that the worker
|
||||
* bgprocess gets 'pipe closed' when the
|
||||
* main process exits */
|
||||
tube_close_read(ctx->qq_pipe);
|
||||
tube_close_write(ctx->rr_pipe);
|
||||
break;
|
||||
}
|
||||
#endif /* HAVE_FORK */
|
||||
|
@ -78,6 +78,10 @@
|
||||
* ... same as async for non-threaded
|
||||
* ... the callbacks are called in the thread that calls process(ctx)
|
||||
*
|
||||
* Openssl needs to have locking in place, and the application must set
|
||||
* it up, because a mere library cannot do this, use the calls
|
||||
* CRYPTO_set_id_callback and CRYPTO_set_locking_callback.
|
||||
*
|
||||
* If no threading is compiled in, the above async example uses fork(2) to
|
||||
* create a process to perform the work. The forked process exits when the
|
||||
* calling process exits, or ctx_delete() is called.
|
||||
@ -97,6 +101,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** the version of this header file */
|
||||
#define UNBOUND_VERSION_MAJOR @UNBOUND_VERSION_MAJOR@
|
||||
#define UNBOUND_VERSION_MINOR @UNBOUND_VERSION_MINOR@
|
||||
#define UNBOUND_VERSION_MICRO @UNBOUND_VERSION_MICRO@
|
||||
|
||||
/**
|
||||
* The validation context is created to hold the resolver status,
|
||||
* validation keys and a small cache (containing messages, rrsets,
|
||||
@ -245,7 +254,7 @@ void ub_ctx_delete(struct ub_ctx* ctx);
|
||||
* @param val: value of the option.
|
||||
* @return: 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_set_option(struct ub_ctx* ctx, char* opt, char* val);
|
||||
int ub_ctx_set_option(struct ub_ctx* ctx, const char* opt, const char* val);
|
||||
|
||||
/**
|
||||
* Get an option from the context.
|
||||
@ -261,7 +270,7 @@ int ub_ctx_set_option(struct ub_ctx* ctx, char* opt, char* val);
|
||||
* returned in the string.
|
||||
* @return 0 if OK else an error code (malloc failure, syntax error).
|
||||
*/
|
||||
int ub_ctx_get_option(struct ub_ctx* ctx, char* opt, char** str);
|
||||
int ub_ctx_get_option(struct ub_ctx* ctx, const char* opt, char** str);
|
||||
|
||||
/**
|
||||
* setup configuration for the given context.
|
||||
@ -273,7 +282,7 @@ int ub_ctx_get_option(struct ub_ctx* ctx, char* opt, char** str);
|
||||
* routines exist.
|
||||
* @return: 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_config(struct ub_ctx* ctx, char* fname);
|
||||
int ub_ctx_config(struct ub_ctx* ctx, const char* fname);
|
||||
|
||||
/**
|
||||
* Set machine to forward DNS queries to, the caching resolver to use.
|
||||
@ -292,7 +301,7 @@ int ub_ctx_config(struct ub_ctx* ctx, char* fname);
|
||||
* If the addr is NULL, forwarding is disabled.
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_set_fwd(struct ub_ctx* ctx, char* addr);
|
||||
int ub_ctx_set_fwd(struct ub_ctx* ctx, const char* addr);
|
||||
|
||||
/**
|
||||
* Read list of nameservers to use from the filename given.
|
||||
@ -308,7 +317,7 @@ int ub_ctx_set_fwd(struct ub_ctx* ctx, char* addr);
|
||||
* @param fname: file name string. If NULL "/etc/resolv.conf" is used.
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_resolvconf(struct ub_ctx* ctx, char* fname);
|
||||
int ub_ctx_resolvconf(struct ub_ctx* ctx, const char* fname);
|
||||
|
||||
/**
|
||||
* Read list of hosts from the filename given.
|
||||
@ -321,7 +330,7 @@ int ub_ctx_resolvconf(struct ub_ctx* ctx, char* fname);
|
||||
* @param fname: file name string. If NULL "/etc/hosts" is used.
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_hosts(struct ub_ctx* ctx, char* fname);
|
||||
int ub_ctx_hosts(struct ub_ctx* ctx, const char* fname);
|
||||
|
||||
/**
|
||||
* Add a trust anchor to the given context.
|
||||
@ -334,7 +343,7 @@ int ub_ctx_hosts(struct ub_ctx* ctx, char* fname);
|
||||
* [domainname] [TTL optional] [type] [class optional] [rdata contents]
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_add_ta(struct ub_ctx* ctx, char* ta);
|
||||
int ub_ctx_add_ta(struct ub_ctx* ctx, const char* ta);
|
||||
|
||||
/**
|
||||
* Add trust anchors to the given context.
|
||||
@ -345,7 +354,7 @@ int ub_ctx_add_ta(struct ub_ctx* ctx, char* ta);
|
||||
* @param fname: filename of file with keyfile with trust anchors.
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_add_ta_file(struct ub_ctx* ctx, char* fname);
|
||||
int ub_ctx_add_ta_file(struct ub_ctx* ctx, const char* fname);
|
||||
|
||||
/**
|
||||
* Add trust anchors to the given context.
|
||||
@ -357,7 +366,7 @@ int ub_ctx_add_ta_file(struct ub_ctx* ctx, char* fname);
|
||||
* anchors.
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_trustedkeys(struct ub_ctx* ctx, char* fname);
|
||||
int ub_ctx_trustedkeys(struct ub_ctx* ctx, const char* fname);
|
||||
|
||||
/**
|
||||
* Set debug output (and error output) to the specified stream.
|
||||
@ -442,7 +451,7 @@ int ub_process(struct ub_ctx* ctx);
|
||||
* in that case (out of memory).
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_resolve(struct ub_ctx* ctx, char* name, int rrtype,
|
||||
int ub_resolve(struct ub_ctx* ctx, const char* name, int rrtype,
|
||||
int rrclass, struct ub_result** result);
|
||||
|
||||
/**
|
||||
@ -473,7 +482,7 @@ int ub_resolve(struct ub_ctx* ctx, char* name, int rrtype,
|
||||
* cancel the query.
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_resolve_async(struct ub_ctx* ctx, char* name, int rrtype,
|
||||
int ub_resolve_async(struct ub_ctx* ctx, const char* name, int rrtype,
|
||||
int rrclass, void* mydata, ub_callback_t callback, int* async_id);
|
||||
|
||||
/**
|
||||
@ -520,7 +529,8 @@ int ub_ctx_print_local_zones(struct ub_ctx* ctx);
|
||||
* @param zone_type: type of the zone (like for unbound.conf) in text.
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type);
|
||||
int ub_ctx_zone_add(struct ub_ctx* ctx, const char *zone_name,
|
||||
const char *zone_type);
|
||||
|
||||
/**
|
||||
* Remove zone from local authority info of the library.
|
||||
@ -529,7 +539,7 @@ int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type);
|
||||
* If it does not exist, nothing happens.
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name);
|
||||
int ub_ctx_zone_remove(struct ub_ctx* ctx, const char *zone_name);
|
||||
|
||||
/**
|
||||
* Add localdata to the library local authority info.
|
||||
@ -539,7 +549,7 @@ int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name);
|
||||
* "www.example.com IN A 127.0.0.1"
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_data_add(struct ub_ctx* ctx, char *data);
|
||||
int ub_ctx_data_add(struct ub_ctx* ctx, const char *data);
|
||||
|
||||
/**
|
||||
* Remove localdata from the library local authority info.
|
||||
@ -547,7 +557,7 @@ int ub_ctx_data_add(struct ub_ctx* ctx, char *data);
|
||||
* @param data: the name to delete all data from, like "www.example.com".
|
||||
* @return 0 if OK, else error.
|
||||
*/
|
||||
int ub_ctx_data_remove(struct ub_ctx* ctx, char *data);
|
||||
int ub_ctx_data_remove(struct ub_ctx* ctx, const char *data);
|
||||
|
||||
/**
|
||||
* Get a version string from the libunbound implementation.
|
||||
|
40
services/cache/dns.c
vendored
40
services/cache/dns.c
vendored
@ -66,8 +66,8 @@
|
||||
* @param region: for qrep allocs.
|
||||
*/
|
||||
static void
|
||||
store_rrsets(struct module_env* env, struct reply_info* rep, uint32_t now,
|
||||
uint32_t leeway, int pside, struct reply_info* qrep,
|
||||
store_rrsets(struct module_env* env, struct reply_info* rep, time_t now,
|
||||
time_t leeway, int pside, struct reply_info* qrep,
|
||||
struct regional* region)
|
||||
{
|
||||
size_t i;
|
||||
@ -105,11 +105,11 @@ store_rrsets(struct module_env* env, struct reply_info* rep, uint32_t now,
|
||||
|
||||
void
|
||||
dns_cache_store_msg(struct module_env* env, struct query_info* qinfo,
|
||||
hashvalue_t hash, struct reply_info* rep, uint32_t leeway, int pside,
|
||||
hashvalue_t hash, struct reply_info* rep, time_t leeway, int pside,
|
||||
struct reply_info* qrep, struct regional* region)
|
||||
{
|
||||
struct msgreply_entry* e;
|
||||
uint32_t ttl = rep->ttl;
|
||||
time_t ttl = rep->ttl;
|
||||
size_t i;
|
||||
|
||||
/* store RRsets */
|
||||
@ -142,7 +142,7 @@ dns_cache_store_msg(struct module_env* env, struct query_info* qinfo,
|
||||
/** find closest NS or DNAME and returns the rrset (locked) */
|
||||
static struct ub_packed_rrset_key*
|
||||
find_closest_of_type(struct module_env* env, uint8_t* qname, size_t qnamelen,
|
||||
uint16_t qclass, uint32_t now, uint16_t searchtype, int stripfront)
|
||||
uint16_t qclass, time_t now, uint16_t searchtype, int stripfront)
|
||||
{
|
||||
struct ub_packed_rrset_key *rrset;
|
||||
uint8_t lablen;
|
||||
@ -171,7 +171,7 @@ find_closest_of_type(struct module_env* env, uint8_t* qname, size_t qnamelen,
|
||||
/** add addr to additional section */
|
||||
static void
|
||||
addr_to_additional(struct ub_packed_rrset_key* rrset, struct regional* region,
|
||||
struct dns_msg* msg, uint32_t now)
|
||||
struct dns_msg* msg, time_t now)
|
||||
{
|
||||
if((msg->rep->rrsets[msg->rep->rrset_count] =
|
||||
packed_rrset_copy_region(rrset, region, now))) {
|
||||
@ -183,7 +183,7 @@ addr_to_additional(struct ub_packed_rrset_key* rrset, struct regional* region,
|
||||
/** lookup message in message cache */
|
||||
static struct msgreply_entry*
|
||||
msg_cache_lookup(struct module_env* env, uint8_t* qname, size_t qnamelen,
|
||||
uint16_t qtype, uint16_t qclass, uint32_t now, int wr)
|
||||
uint16_t qtype, uint16_t qclass, time_t now, int wr)
|
||||
{
|
||||
struct lruhash_entry* e;
|
||||
struct query_info k;
|
||||
@ -207,7 +207,7 @@ msg_cache_lookup(struct module_env* env, uint8_t* qname, size_t qnamelen,
|
||||
/** find and add A and AAAA records for nameservers in delegpt */
|
||||
static int
|
||||
find_add_addrs(struct module_env* env, uint16_t qclass,
|
||||
struct regional* region, struct delegpt* dp, uint32_t now,
|
||||
struct regional* region, struct delegpt* dp, time_t now,
|
||||
struct dns_msg** msg)
|
||||
{
|
||||
struct delegpt_ns* ns;
|
||||
@ -262,12 +262,12 @@ cache_fill_missing(struct module_env* env, uint16_t qclass,
|
||||
struct delegpt_ns* ns;
|
||||
struct msgreply_entry* neg;
|
||||
struct ub_packed_rrset_key* akey;
|
||||
uint32_t now = *env->now;
|
||||
time_t now = *env->now;
|
||||
for(ns = dp->nslist; ns; ns = ns->next) {
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_A, qclass, 0, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, (int)ns->lame)) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, ns->lame)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
@ -285,7 +285,7 @@ cache_fill_missing(struct module_env* env, uint16_t qclass,
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_AAAA, qclass, 0, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, (int)ns->lame)) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, ns->lame)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
@ -307,7 +307,7 @@ cache_fill_missing(struct module_env* env, uint16_t qclass,
|
||||
/** find and add DS or NSEC to delegation msg */
|
||||
static void
|
||||
find_add_ds(struct module_env* env, struct regional* region,
|
||||
struct dns_msg* msg, struct delegpt* dp, uint32_t now)
|
||||
struct dns_msg* msg, struct delegpt* dp, time_t now)
|
||||
{
|
||||
/* Lookup the DS or NSEC at the delegation point. */
|
||||
struct ub_packed_rrset_key* rrset = rrset_cache_lookup(
|
||||
@ -369,7 +369,7 @@ dns_msg_create(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
||||
|
||||
int
|
||||
dns_msg_authadd(struct dns_msg* msg, struct regional* region,
|
||||
struct ub_packed_rrset_key* rrset, uint32_t now)
|
||||
struct ub_packed_rrset_key* rrset, time_t now)
|
||||
{
|
||||
if(!(msg->rep->rrsets[msg->rep->rrset_count++] =
|
||||
packed_rrset_copy_region(rrset, region, now)))
|
||||
@ -381,7 +381,7 @@ dns_msg_authadd(struct dns_msg* msg, struct regional* region,
|
||||
struct delegpt*
|
||||
dns_cache_find_delegation(struct module_env* env, uint8_t* qname,
|
||||
size_t qnamelen, uint16_t qtype, uint16_t qclass,
|
||||
struct regional* region, struct dns_msg** msg, uint32_t now)
|
||||
struct regional* region, struct dns_msg** msg, time_t now)
|
||||
{
|
||||
/* try to find closest NS rrset */
|
||||
struct ub_packed_rrset_key* nskey;
|
||||
@ -455,7 +455,7 @@ gen_dns_msg(struct regional* region, struct query_info* q, size_t num)
|
||||
/** generate dns_msg from cached message */
|
||||
static struct dns_msg*
|
||||
tomsg(struct module_env* env, struct query_info* q, struct reply_info* r,
|
||||
struct regional* region, uint32_t now, struct regional* scratch)
|
||||
struct regional* region, time_t now, struct regional* scratch)
|
||||
{
|
||||
struct dns_msg* msg;
|
||||
size_t i;
|
||||
@ -506,7 +506,7 @@ tomsg(struct module_env* env, struct query_info* q, struct reply_info* r,
|
||||
/** synthesize RRset-only response from cached RRset item */
|
||||
static struct dns_msg*
|
||||
rrset_msg(struct ub_packed_rrset_key* rrset, struct regional* region,
|
||||
uint32_t now, struct query_info* q)
|
||||
time_t now, struct query_info* q)
|
||||
{
|
||||
struct dns_msg* msg;
|
||||
struct packed_rrset_data* d = (struct packed_rrset_data*)
|
||||
@ -535,7 +535,7 @@ rrset_msg(struct ub_packed_rrset_key* rrset, struct regional* region,
|
||||
/** synthesize DNAME+CNAME response from cached DNAME item */
|
||||
static struct dns_msg*
|
||||
synth_dname_msg(struct ub_packed_rrset_key* rrset, struct regional* region,
|
||||
uint32_t now, struct query_info* q)
|
||||
time_t now, struct query_info* q)
|
||||
{
|
||||
struct dns_msg* msg;
|
||||
struct ub_packed_rrset_key* ck;
|
||||
@ -599,7 +599,7 @@ synth_dname_msg(struct ub_packed_rrset_key* rrset, struct regional* region,
|
||||
ck->entry.hash = rrset_key_hash(&ck->rk);
|
||||
newd = (struct packed_rrset_data*)regional_alloc_zero(region,
|
||||
sizeof(struct packed_rrset_data) + sizeof(size_t) +
|
||||
sizeof(uint8_t*) + sizeof(uint32_t) + sizeof(uint16_t)
|
||||
sizeof(uint8_t*) + sizeof(time_t) + sizeof(uint16_t)
|
||||
+ newlen);
|
||||
if(!newd)
|
||||
return NULL;
|
||||
@ -630,7 +630,7 @@ dns_cache_lookup(struct module_env* env,
|
||||
struct lruhash_entry* e;
|
||||
struct query_info k;
|
||||
hashvalue_t h;
|
||||
uint32_t now = *env->now;
|
||||
time_t now = *env->now;
|
||||
struct ub_packed_rrset_key* rrset;
|
||||
|
||||
/* lookup first, this has both NXdomains and ANSWER responses */
|
||||
@ -739,7 +739,7 @@ dns_cache_lookup(struct module_env* env,
|
||||
|
||||
int
|
||||
dns_cache_store(struct module_env* env, struct query_info* msgqinf,
|
||||
struct reply_info* msgrep, int is_referral, uint32_t leeway, int pside,
|
||||
struct reply_info* msgrep, int is_referral, time_t leeway, int pside,
|
||||
struct regional* region)
|
||||
{
|
||||
struct reply_info* rep = NULL;
|
||||
|
8
services/cache/dns.h
vendored
8
services/cache/dns.h
vendored
@ -82,7 +82,7 @@ struct dns_msg {
|
||||
* @return 0 on alloc error (out of memory).
|
||||
*/
|
||||
int dns_cache_store(struct module_env* env, struct query_info* qinf,
|
||||
struct reply_info* rep, int is_referral, uint32_t leeway, int pside,
|
||||
struct reply_info* rep, int is_referral, time_t leeway, int pside,
|
||||
struct regional* region);
|
||||
|
||||
/**
|
||||
@ -105,7 +105,7 @@ int dns_cache_store(struct module_env* env, struct query_info* qinf,
|
||||
* @param region: to allocate into for qmsg.
|
||||
*/
|
||||
void dns_cache_store_msg(struct module_env* env, struct query_info* qinfo,
|
||||
hashvalue_t hash, struct reply_info* rep, uint32_t leeway, int pside,
|
||||
hashvalue_t hash, struct reply_info* rep, time_t leeway, int pside,
|
||||
struct reply_info* qrep, struct regional* region);
|
||||
|
||||
/**
|
||||
@ -123,7 +123,7 @@ void dns_cache_store_msg(struct module_env* env, struct query_info* qinfo,
|
||||
*/
|
||||
struct delegpt* dns_cache_find_delegation(struct module_env* env,
|
||||
uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
|
||||
struct regional* region, struct dns_msg** msg, uint32_t timenow);
|
||||
struct regional* region, struct dns_msg** msg, time_t timenow);
|
||||
|
||||
/**
|
||||
* Find cached message
|
||||
@ -177,6 +177,6 @@ struct dns_msg* dns_msg_create(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
||||
* @return true if worked, false on fail
|
||||
*/
|
||||
int dns_msg_authadd(struct dns_msg* msg, struct regional* region,
|
||||
struct ub_packed_rrset_key* rrset, uint32_t now);
|
||||
struct ub_packed_rrset_key* rrset, time_t now);
|
||||
|
||||
#endif /* SERVICES_CACHE_DNS_H */
|
||||
|
22
services/cache/infra.c
vendored
22
services/cache/infra.c
vendored
@ -189,7 +189,7 @@ infra_lookup_nottl(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
/** init the data elements */
|
||||
static void
|
||||
data_entry_init(struct infra_cache* infra, struct lruhash_entry* e,
|
||||
uint32_t timenow)
|
||||
time_t timenow)
|
||||
{
|
||||
struct infra_data* data = (struct infra_data*)e->data;
|
||||
data->ttl = timenow + infra->host_ttl;
|
||||
@ -218,7 +218,7 @@ data_entry_init(struct infra_cache* infra, struct lruhash_entry* e,
|
||||
*/
|
||||
static struct lruhash_entry*
|
||||
new_entry(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t* name, size_t namelen, uint32_t tm)
|
||||
socklen_t addrlen, uint8_t* name, size_t namelen, time_t tm)
|
||||
{
|
||||
struct infra_data* data;
|
||||
struct infra_key* key = (struct infra_key*)malloc(sizeof(*key));
|
||||
@ -248,7 +248,7 @@ new_entry(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
|
||||
int
|
||||
infra_host(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t* nm, size_t nmlen, uint32_t timenow,
|
||||
socklen_t addrlen, uint8_t* nm, size_t nmlen, time_t timenow,
|
||||
int* edns_vs, uint8_t* edns_lame_known, int* to)
|
||||
{
|
||||
struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen,
|
||||
@ -317,7 +317,7 @@ infra_host(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
|
||||
int
|
||||
infra_set_lame(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t* nm, size_t nmlen, uint32_t timenow,
|
||||
socklen_t addrlen, uint8_t* nm, size_t nmlen, time_t timenow,
|
||||
int dnsseclame, int reclame, uint16_t qtype)
|
||||
{
|
||||
struct infra_data* data;
|
||||
@ -374,7 +374,7 @@ infra_update_tcp_works(struct infra_cache* infra,
|
||||
int
|
||||
infra_rtt_update(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t* nm, size_t nmlen, int qtype,
|
||||
int roundtrip, int orig_rtt, uint32_t timenow)
|
||||
int roundtrip, int orig_rtt, time_t timenow)
|
||||
{
|
||||
struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen,
|
||||
nm, nmlen, 1);
|
||||
@ -425,19 +425,19 @@ infra_rtt_update(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
return rto;
|
||||
}
|
||||
|
||||
int infra_get_host_rto(struct infra_cache* infra,
|
||||
long long infra_get_host_rto(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* nm,
|
||||
size_t nmlen, struct rtt_info* rtt, int* delay, uint32_t timenow,
|
||||
size_t nmlen, struct rtt_info* rtt, int* delay, time_t timenow,
|
||||
int* tA, int* tAAAA, int* tother)
|
||||
{
|
||||
struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen,
|
||||
nm, nmlen, 0);
|
||||
struct infra_data* data;
|
||||
int ttl = -2;
|
||||
long long ttl = -2;
|
||||
if(!e) return -1;
|
||||
data = (struct infra_data*)e->data;
|
||||
if(data->ttl >= timenow) {
|
||||
ttl = (int)(data->ttl - timenow);
|
||||
ttl = (long long)(data->ttl - timenow);
|
||||
memmove(rtt, &data->rtt, sizeof(*rtt));
|
||||
if(timenow < data->probedelay)
|
||||
*delay = (int)(data->probedelay - timenow);
|
||||
@ -453,7 +453,7 @@ int infra_get_host_rto(struct infra_cache* infra,
|
||||
int
|
||||
infra_edns_update(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t* nm, size_t nmlen, int edns_version,
|
||||
uint32_t timenow)
|
||||
time_t timenow)
|
||||
{
|
||||
struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen,
|
||||
nm, nmlen, 1);
|
||||
@ -485,7 +485,7 @@ int
|
||||
infra_get_lame_rtt(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype,
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, uint32_t timenow)
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, time_t timenow)
|
||||
{
|
||||
struct infra_data* host;
|
||||
struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen,
|
||||
|
18
services/cache/infra.h
vendored
18
services/cache/infra.h
vendored
@ -68,10 +68,10 @@ struct infra_key {
|
||||
*/
|
||||
struct infra_data {
|
||||
/** TTL value for this entry. absolute time. */
|
||||
uint32_t ttl;
|
||||
time_t ttl;
|
||||
|
||||
/** time in seconds (absolute) when probing re-commences, 0 disabled */
|
||||
uint32_t probedelay;
|
||||
time_t probedelay;
|
||||
/** round trip times for timeout calculation */
|
||||
struct rtt_info rtt;
|
||||
|
||||
@ -173,7 +173,7 @@ struct lruhash_entry* infra_lookup_nottl(struct infra_cache* infra,
|
||||
*/
|
||||
int infra_host(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t* name, size_t namelen,
|
||||
uint32_t timenow, int* edns_vs, uint8_t* edns_lame_known, int* to);
|
||||
time_t timenow, int* edns_vs, uint8_t* edns_lame_known, int* to);
|
||||
|
||||
/**
|
||||
* Set a host to be lame for the given zone.
|
||||
@ -192,7 +192,7 @@ int infra_host(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
*/
|
||||
int infra_set_lame(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, uint32_t timenow, int dnsseclame,
|
||||
uint8_t* name, size_t namelen, time_t timenow, int dnsseclame,
|
||||
int reclame, uint16_t qtype);
|
||||
|
||||
/**
|
||||
@ -212,7 +212,7 @@ int infra_set_lame(struct infra_cache* infra,
|
||||
*/
|
||||
int infra_rtt_update(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t* name, size_t namelen, int qtype,
|
||||
int roundtrip, int orig_rtt, uint32_t timenow);
|
||||
int roundtrip, int orig_rtt, time_t timenow);
|
||||
|
||||
/**
|
||||
* Update information for the host, store that a TCP transaction works.
|
||||
@ -240,7 +240,7 @@ void infra_update_tcp_works(struct infra_cache* infra,
|
||||
*/
|
||||
int infra_edns_update(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, int edns_version, uint32_t timenow);
|
||||
uint8_t* name, size_t namelen, int edns_version, time_t timenow);
|
||||
|
||||
/**
|
||||
* Get Lameness information and average RTT if host is in the cache.
|
||||
@ -263,7 +263,7 @@ int infra_edns_update(struct infra_cache* infra,
|
||||
int infra_get_lame_rtt(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype,
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, uint32_t timenow);
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, time_t timenow);
|
||||
|
||||
/**
|
||||
* Get additional (debug) info on timing.
|
||||
@ -281,9 +281,9 @@ int infra_get_lame_rtt(struct infra_cache* infra,
|
||||
* @return TTL the infra host element is valid for. If -1: not found in cache.
|
||||
* TTL -2: found but expired.
|
||||
*/
|
||||
int infra_get_host_rto(struct infra_cache* infra,
|
||||
long long infra_get_host_rto(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* name,
|
||||
size_t namelen, struct rtt_info* rtt, int* delay, uint32_t timenow,
|
||||
size_t namelen, struct rtt_info* rtt, int* delay, time_t timenow,
|
||||
int* tA, int* tAAAA, int* tother);
|
||||
|
||||
/**
|
||||
|
12
services/cache/rrset.c
vendored
12
services/cache/rrset.c
vendored
@ -120,7 +120,7 @@ rrset_cache_touch(struct rrset_cache* r, struct ub_packed_rrset_key* key,
|
||||
|
||||
/** see if rrset needs to be updated in the cache */
|
||||
static int
|
||||
need_to_update_rrset(void* nd, void* cd, uint32_t timenow, int equal, int ns)
|
||||
need_to_update_rrset(void* nd, void* cd, time_t timenow, int equal, int ns)
|
||||
{
|
||||
struct packed_rrset_data* newd = (struct packed_rrset_data*)nd;
|
||||
struct packed_rrset_data* cached = (struct packed_rrset_data*)cd;
|
||||
@ -181,7 +181,7 @@ rrset_update_id(struct rrset_ref* ref, struct alloc_cache* alloc)
|
||||
|
||||
int
|
||||
rrset_cache_update(struct rrset_cache* r, struct rrset_ref* ref,
|
||||
struct alloc_cache* alloc, uint32_t timenow)
|
||||
struct alloc_cache* alloc, time_t timenow)
|
||||
{
|
||||
struct lruhash_entry* e;
|
||||
struct ub_packed_rrset_key* k = ref->key;
|
||||
@ -237,7 +237,7 @@ rrset_cache_update(struct rrset_cache* r, struct rrset_ref* ref,
|
||||
|
||||
struct ub_packed_rrset_key*
|
||||
rrset_cache_lookup(struct rrset_cache* r, uint8_t* qname, size_t qnamelen,
|
||||
uint16_t qtype, uint16_t qclass, uint32_t flags, uint32_t timenow,
|
||||
uint16_t qtype, uint16_t qclass, uint32_t flags, time_t timenow,
|
||||
int wr)
|
||||
{
|
||||
struct lruhash_entry* e;
|
||||
@ -268,7 +268,7 @@ rrset_cache_lookup(struct rrset_cache* r, uint8_t* qname, size_t qnamelen,
|
||||
}
|
||||
|
||||
int
|
||||
rrset_array_lock(struct rrset_ref* ref, size_t count, uint32_t timenow)
|
||||
rrset_array_lock(struct rrset_ref* ref, size_t count, time_t timenow)
|
||||
{
|
||||
size_t i;
|
||||
for(i=0; i<count; i++) {
|
||||
@ -327,7 +327,7 @@ rrset_array_unlock_touch(struct rrset_cache* r, struct regional* scratch,
|
||||
|
||||
void
|
||||
rrset_update_sec_status(struct rrset_cache* r,
|
||||
struct ub_packed_rrset_key* rrset, uint32_t now)
|
||||
struct ub_packed_rrset_key* rrset, time_t now)
|
||||
{
|
||||
struct packed_rrset_data* updata =
|
||||
(struct packed_rrset_data*)rrset->entry.data;
|
||||
@ -366,7 +366,7 @@ rrset_update_sec_status(struct rrset_cache* r,
|
||||
|
||||
void
|
||||
rrset_check_sec_status(struct rrset_cache* r,
|
||||
struct ub_packed_rrset_key* rrset, uint32_t now)
|
||||
struct ub_packed_rrset_key* rrset, time_t now)
|
||||
{
|
||||
struct packed_rrset_data* updata =
|
||||
(struct packed_rrset_data*)rrset->entry.data;
|
||||
|
10
services/cache/rrset.h
vendored
10
services/cache/rrset.h
vendored
@ -131,7 +131,7 @@ void rrset_cache_touch(struct rrset_cache* r, struct ub_packed_rrset_key* key,
|
||||
* also the rdata is equal (but other parameters in cache are superior).
|
||||
*/
|
||||
int rrset_cache_update(struct rrset_cache* r, struct rrset_ref* ref,
|
||||
struct alloc_cache* alloc, uint32_t timenow);
|
||||
struct alloc_cache* alloc, time_t timenow);
|
||||
|
||||
/**
|
||||
* Lookup rrset. You obtain read/write lock. You must unlock before lookup
|
||||
@ -149,7 +149,7 @@ int rrset_cache_update(struct rrset_cache* r, struct rrset_ref* ref,
|
||||
*/
|
||||
struct ub_packed_rrset_key* rrset_cache_lookup(struct rrset_cache* r,
|
||||
uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
|
||||
uint32_t flags, uint32_t timenow, int wr);
|
||||
uint32_t flags, time_t timenow, int wr);
|
||||
|
||||
/**
|
||||
* Obtain readlock on a (sorted) list of rrset references.
|
||||
@ -163,7 +163,7 @@ struct ub_packed_rrset_key* rrset_cache_lookup(struct rrset_cache* r,
|
||||
* RRsets have been purged from the cache.
|
||||
* If true, you hold readlocks on all the ref items.
|
||||
*/
|
||||
int rrset_array_lock(struct rrset_ref* ref, size_t count, uint32_t timenow);
|
||||
int rrset_array_lock(struct rrset_ref* ref, size_t count, time_t timenow);
|
||||
|
||||
/**
|
||||
* Unlock array (sorted) of rrset references.
|
||||
@ -199,7 +199,7 @@ void rrset_array_unlock_touch(struct rrset_cache* r, struct regional* scratch,
|
||||
* @param now: current time.
|
||||
*/
|
||||
void rrset_update_sec_status(struct rrset_cache* r,
|
||||
struct ub_packed_rrset_key* rrset, uint32_t now);
|
||||
struct ub_packed_rrset_key* rrset, time_t now);
|
||||
|
||||
/**
|
||||
* Looks up security status of an rrset. Looks up the rrset.
|
||||
@ -211,7 +211,7 @@ void rrset_update_sec_status(struct rrset_cache* r,
|
||||
* @param now: current time.
|
||||
*/
|
||||
void rrset_check_sec_status(struct rrset_cache* r,
|
||||
struct ub_packed_rrset_key* rrset, uint32_t now);
|
||||
struct ub_packed_rrset_key* rrset, time_t now);
|
||||
|
||||
/**
|
||||
* Remove an rrset from the cache, by name and type and flags
|
||||
|
@ -328,6 +328,8 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
# else
|
||||
closesocket(s);
|
||||
# endif
|
||||
*noproto = 0;
|
||||
*inuse = 0;
|
||||
return -1;
|
||||
}
|
||||
# elif defined(IP_DONTFRAG)
|
||||
@ -341,12 +343,15 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
# else
|
||||
closesocket(s);
|
||||
# endif
|
||||
*noproto = 0;
|
||||
*inuse = 0;
|
||||
return -1;
|
||||
}
|
||||
# endif /* IPv4 MTU */
|
||||
}
|
||||
if(bind(s, (struct sockaddr*)addr, addrlen) != 0) {
|
||||
*noproto = 0;
|
||||
*inuse = 0;
|
||||
#ifndef USE_WINSOCK
|
||||
#ifdef EADDRINUSE
|
||||
*inuse = (errno == EADDRINUSE);
|
||||
|
@ -225,7 +225,7 @@ lz_enter_zone(struct local_zones* zones, const char* name, const char* type,
|
||||
/** return name and class and rdata of rr; parses string */
|
||||
static int
|
||||
get_rr_content(const char* str, uint8_t** nm, uint16_t* type,
|
||||
uint16_t* dclass, uint32_t* ttl, ldns_buffer* rdata)
|
||||
uint16_t* dclass, time_t* ttl, ldns_buffer* rdata)
|
||||
{
|
||||
ldns_rr* rr = NULL;
|
||||
ldns_status status = ldns_rr_new_frm_str(&rr, str, 3600, NULL, NULL);
|
||||
@ -244,7 +244,7 @@ get_rr_content(const char* str, uint8_t** nm, uint16_t* type,
|
||||
}
|
||||
*dclass = ldns_rr_get_class(rr);
|
||||
*type = ldns_rr_get_type(rr);
|
||||
*ttl = (uint32_t)ldns_rr_ttl(rr);
|
||||
*ttl = (time_t)ldns_rr_ttl(rr);
|
||||
ldns_buffer_clear(rdata);
|
||||
ldns_buffer_skip(rdata, 2);
|
||||
status = ldns_rr_rdata2buffer_wire(rdata, rr);
|
||||
@ -356,10 +356,10 @@ new_local_rrset(struct regional* region, struct local_data* node,
|
||||
/** insert RR into RRset data structure; Wastes a couple of bytes */
|
||||
static int
|
||||
insert_rr(struct regional* region, struct packed_rrset_data* pd,
|
||||
ldns_buffer* buf, uint32_t ttl)
|
||||
ldns_buffer* buf, time_t ttl)
|
||||
{
|
||||
size_t* oldlen = pd->rr_len;
|
||||
uint32_t* oldttl = pd->rr_ttl;
|
||||
time_t* oldttl = pd->rr_ttl;
|
||||
uint8_t** olddata = pd->rr_data;
|
||||
|
||||
/* add RR to rrset */
|
||||
@ -450,7 +450,7 @@ lz_enter_rr_into_zone(struct local_zone* z, ldns_buffer* buf,
|
||||
struct local_rrset* rrset;
|
||||
struct packed_rrset_data* pd;
|
||||
uint16_t rrtype = 0, rrclass = 0;
|
||||
uint32_t ttl = 0;
|
||||
time_t ttl = 0;
|
||||
if(!get_rr_content(rrstr, &nm, &rrtype, &rrclass, &ttl, buf)) {
|
||||
log_err("bad local-data: %s", rrstr);
|
||||
return 0;
|
||||
|
@ -321,6 +321,8 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
}
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
rbtree_insert(&mesh->all, &s->node);
|
||||
log_assert(n != NULL);
|
||||
@ -390,6 +392,8 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
}
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
rbtree_insert(&mesh->all, &s->node);
|
||||
log_assert(n != NULL);
|
||||
@ -422,7 +426,7 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
}
|
||||
|
||||
void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
uint16_t qflags, uint32_t leeway)
|
||||
uint16_t qflags, time_t leeway)
|
||||
{
|
||||
struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&BIT_RD, 0);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
@ -450,6 +454,8 @@ void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
}
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
rbtree_insert(&mesh->all, &s->node);
|
||||
log_assert(n != NULL);
|
||||
@ -657,6 +663,8 @@ void mesh_detach_subs(struct module_qstate* qstate)
|
||||
RBTREE_FOR(ref, struct mesh_state_ref*, &qstate->mesh_info->sub_set) {
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
rbtree_delete(&ref->s->super_set, &lookup);
|
||||
log_assert(n != NULL); /* must have been present */
|
||||
@ -693,6 +701,8 @@ int mesh_attach_sub(struct module_qstate* qstate, struct query_info* qinfo,
|
||||
}
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
rbtree_insert(&mesh->all, &sub->node);
|
||||
log_assert(n != NULL);
|
||||
@ -701,6 +711,8 @@ int mesh_attach_sub(struct module_qstate* qstate, struct query_info* qinfo,
|
||||
/* set new query state to run */
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
rbtree_insert(&mesh->run, &sub->run_node);
|
||||
log_assert(n != NULL);
|
||||
@ -749,6 +761,8 @@ int mesh_state_attachment(struct mesh_state* super, struct mesh_state* sub)
|
||||
}
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
rbtree_insert(&super->sub_set, &subref->node);
|
||||
log_assert(n != NULL); /* we checked above if statement, the reverse
|
||||
@ -878,8 +892,8 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep,
|
||||
m->s.env->mesh->num_reply_addrs--;
|
||||
end_time = *m->s.env->now_tv;
|
||||
timeval_subtract(&duration, &end_time, &r->start_time);
|
||||
verbose(VERB_ALGO, "query took %d.%6.6d sec",
|
||||
(int)duration.tv_sec, (int)duration.tv_usec);
|
||||
verbose(VERB_ALGO, "query took %lld.%6.6d sec",
|
||||
(long long)duration.tv_sec, (int)duration.tv_usec);
|
||||
m->s.env->mesh->replies_sent++;
|
||||
timeval_add(&m->s.env->mesh->replies_sum_wait, &duration);
|
||||
timehist_insert(m->s.env->mesh->histogram, &duration);
|
||||
@ -1124,7 +1138,7 @@ mesh_stats(struct mesh_area* mesh, const char* str)
|
||||
timeval_divide(&avg, &mesh->replies_sum_wait,
|
||||
mesh->replies_sent);
|
||||
log_info("average recursion processing time "
|
||||
"%d.%6.6d sec", (int)avg.tv_sec, (int)avg.tv_usec);
|
||||
"%lld.%6.6d sec", (long long)avg.tv_sec, (int)avg.tv_usec);
|
||||
log_info("histogram of recursion processing times");
|
||||
timehist_log(mesh->histogram, "recursions");
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ int mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
* @param leeway: TTL leeway what to expire earlier for this update.
|
||||
*/
|
||||
void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
uint16_t qflags, uint32_t leeway);
|
||||
uint16_t qflags, time_t leeway);
|
||||
|
||||
/**
|
||||
* Handle new event from the wire. A serviced query has returned.
|
||||
|
@ -1210,6 +1210,8 @@ serviced_create(struct outside_network* outnet, ldns_buffer* buff, int dnssec,
|
||||
sq->to_be_deleted = 0;
|
||||
#ifdef UNBOUND_DEBUG
|
||||
ins =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
rbtree_insert(outnet->serviced, &sq->node);
|
||||
log_assert(ins != NULL); /* must not be already present */
|
||||
@ -1361,7 +1363,7 @@ serviced_udp_send(struct serviced_query* sq, ldns_buffer* buff)
|
||||
{
|
||||
int rtt, vs;
|
||||
uint8_t edns_lame_known;
|
||||
uint32_t now = *sq->outnet->now_secs;
|
||||
time_t now = *sq->outnet->now_secs;
|
||||
|
||||
if(!infra_host(sq->outnet->infra, &sq->addr, sq->addrlen, sq->zone,
|
||||
sq->zonelen, now, &vs, &edns_lame_known, &rtt))
|
||||
@ -1449,6 +1451,8 @@ serviced_callbacks(struct serviced_query* sq, int error, struct comm_point* c,
|
||||
size_t backlen = 0;
|
||||
#ifdef UNBOUND_DEBUG
|
||||
rbnode_t* rem =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
/* remove from tree, and schedule for deletion, so that callbacks
|
||||
* can safely deregister themselves and even create new serviced
|
||||
@ -1567,7 +1571,7 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error,
|
||||
(now.tv_sec == sq->last_sent_time.tv_sec &&
|
||||
now.tv_usec > sq->last_sent_time.tv_usec)) {
|
||||
/* convert from microseconds to milliseconds */
|
||||
int roundtime = ((int)now.tv_sec - (int)sq->last_sent_time.tv_sec)*1000
|
||||
int roundtime = ((int)(now.tv_sec - sq->last_sent_time.tv_sec))*1000
|
||||
+ ((int)now.tv_usec - (int)sq->last_sent_time.tv_usec)/1000;
|
||||
verbose(VERB_ALGO, "measured TCP-time at %d msec", roundtime);
|
||||
log_assert(roundtime >= 0);
|
||||
@ -1576,7 +1580,7 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error,
|
||||
if(roundtime < TCP_AUTH_QUERY_TIMEOUT*1000) {
|
||||
if(!infra_rtt_update(sq->outnet->infra, &sq->addr,
|
||||
sq->addrlen, sq->zone, sq->zonelen, sq->qtype,
|
||||
roundtime, sq->last_rtt, (uint32_t)now.tv_sec))
|
||||
roundtime, sq->last_rtt, (time_t)now.tv_sec))
|
||||
log_err("out of memory noting rtt.");
|
||||
}
|
||||
}
|
||||
@ -1668,7 +1672,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
|
||||
sq->retry++;
|
||||
if(!(rto=infra_rtt_update(outnet->infra, &sq->addr, sq->addrlen,
|
||||
sq->zone, sq->zonelen, sq->qtype, -1, sq->last_rtt,
|
||||
(uint32_t)now.tv_sec)))
|
||||
(time_t)now.tv_sec)))
|
||||
log_err("out of memory in UDP exponential backoff");
|
||||
if(sq->retry < OUTBOUND_UDP_RETRY) {
|
||||
log_name_addr(VERB_ALGO, "retry query", sq->qbuf+10,
|
||||
@ -1712,7 +1716,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
|
||||
/* only store noEDNS in cache if domain is noDNSSEC */
|
||||
if(!sq->want_dnssec)
|
||||
if(!infra_edns_update(outnet->infra, &sq->addr, sq->addrlen,
|
||||
sq->zone, sq->zonelen, -1, (uint32_t)now.tv_sec)) {
|
||||
sq->zone, sq->zonelen, -1, (time_t)now.tv_sec)) {
|
||||
log_err("Out of memory caching no edns for host");
|
||||
}
|
||||
sq->status = serviced_query_UDP;
|
||||
@ -1722,7 +1726,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
|
||||
log_addr(VERB_ALGO, "serviced query: EDNS works for",
|
||||
&sq->addr, sq->addrlen);
|
||||
if(!infra_edns_update(outnet->infra, &sq->addr, sq->addrlen,
|
||||
sq->zone, sq->zonelen, 0, (uint32_t)now.tv_sec)) {
|
||||
sq->zone, sq->zonelen, 0, (time_t)now.tv_sec)) {
|
||||
log_err("Out of memory caching edns works");
|
||||
}
|
||||
sq->edns_lame_known = 1;
|
||||
@ -1739,7 +1743,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
|
||||
log_addr(VERB_ALGO, "serviced query: EDNS fails for",
|
||||
&sq->addr, sq->addrlen);
|
||||
if(!infra_edns_update(outnet->infra, &sq->addr, sq->addrlen,
|
||||
sq->zone, sq->zonelen, -1, (uint32_t)now.tv_sec)) {
|
||||
sq->zone, sq->zonelen, -1, (time_t)now.tv_sec)) {
|
||||
log_err("Out of memory caching no edns for host");
|
||||
}
|
||||
} else {
|
||||
@ -1753,7 +1757,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
|
||||
(now.tv_sec == sq->last_sent_time.tv_sec &&
|
||||
now.tv_usec > sq->last_sent_time.tv_usec)) {
|
||||
/* convert from microseconds to milliseconds */
|
||||
int roundtime = ((int)now.tv_sec - (int)sq->last_sent_time.tv_sec)*1000
|
||||
int roundtime = ((int)(now.tv_sec - sq->last_sent_time.tv_sec))*1000
|
||||
+ ((int)now.tv_usec - (int)sq->last_sent_time.tv_usec)/1000;
|
||||
verbose(VERB_ALGO, "measured roundtrip at %d msec", roundtime);
|
||||
log_assert(roundtime >= 0);
|
||||
@ -1762,7 +1766,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
|
||||
if(roundtime < 60000) {
|
||||
if(!infra_rtt_update(outnet->infra, &sq->addr, sq->addrlen,
|
||||
sq->zone, sq->zonelen, sq->qtype, roundtime,
|
||||
sq->last_rtt, (uint32_t)now.tv_sec))
|
||||
sq->last_rtt, (time_t)now.tv_sec))
|
||||
log_err("out of memory noting rtt.");
|
||||
}
|
||||
}
|
||||
@ -1866,6 +1870,8 @@ void outnet_serviced_query_stop(struct serviced_query* sq, void* cb_arg)
|
||||
if(!sq->cblist && !sq->to_be_deleted) {
|
||||
#ifdef UNBOUND_DEBUG
|
||||
rbnode_t* rem =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
rbtree_delete(sq->outnet->serviced, sq);
|
||||
log_assert(rem); /* should be present */
|
||||
|
@ -63,7 +63,7 @@ struct outside_network {
|
||||
/** Base for select calls */
|
||||
struct comm_base* base;
|
||||
/** pointer to time in seconds */
|
||||
uint32_t* now_secs;
|
||||
time_t* now_secs;
|
||||
/** pointer to time in microseconds */
|
||||
struct timeval* now_tv;
|
||||
|
||||
|
@ -1231,7 +1231,7 @@ xml_charhandle(void *userData, const XML_Char *s, int len)
|
||||
printf("'\n");
|
||||
}
|
||||
if(strcasecmp(data->tag, "Zone") == 0) {
|
||||
if(BIO_write(data->czone, s, len) <= 0) {
|
||||
if(BIO_write(data->czone, s, len) < 0) {
|
||||
if(verb) printf("out of memory in BIO_write\n");
|
||||
exit(0);
|
||||
}
|
||||
@ -1242,7 +1242,7 @@ xml_charhandle(void *userData, const XML_Char *s, int len)
|
||||
return;
|
||||
b = xml_selectbio(data, data->tag);
|
||||
if(b) {
|
||||
if(BIO_write(b, s, len) <= 0) {
|
||||
if(BIO_write(b, s, len) < 0) {
|
||||
if(verb) printf("out of memory in BIO_write\n");
|
||||
exit(0);
|
||||
}
|
||||
@ -1435,7 +1435,7 @@ xml_startelem(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
static void
|
||||
xml_append_str(BIO* b, const char* s)
|
||||
{
|
||||
if(BIO_write(b, s, (int)strlen(s)) <= 0) {
|
||||
if(BIO_write(b, s, (int)strlen(s)) < 0) {
|
||||
if(verb) printf("out of memory in BIO_write\n");
|
||||
exit(0);
|
||||
}
|
||||
@ -1459,7 +1459,7 @@ xml_append_bio(BIO* b, BIO* a)
|
||||
z[i] = ' ';
|
||||
}
|
||||
/* write to BIO */
|
||||
if(BIO_write(b, z, len) <= 0) {
|
||||
if(BIO_write(b, z, len) < 0) {
|
||||
if(verb) printf("out of memory in BIO_write\n");
|
||||
exit(0);
|
||||
}
|
||||
@ -1545,7 +1545,7 @@ xml_parse_setup(XML_Parser parser, struct xml_data* data, time_t now)
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "; created by unbound-anchor on %s",
|
||||
ctime(&now));
|
||||
if(BIO_write(data->ds, buf, (int)strlen(buf)) <= 0) {
|
||||
if(BIO_write(data->ds, buf, (int)strlen(buf)) < 0) {
|
||||
if(verb) printf("out of memory\n");
|
||||
exit(0);
|
||||
}
|
||||
|
@ -106,6 +106,8 @@ usage()
|
||||
printf(" list_forwards list forward-zones in use\n");
|
||||
printf(" list_local_zones list local-zones in use\n");
|
||||
printf(" list_local_data list local-data RRs in use\n");
|
||||
printf(" insecure_add zone add domain-insecure zone\n");
|
||||
printf(" insecure_remove zone remove domain-insecure zone\n");
|
||||
printf(" forward_add [+i] zone addr.. add forward-zone with servers\n");
|
||||
printf(" forward_remove [+i] zone remove forward zone\n");
|
||||
printf(" stub_add [+ip] zone addr.. add stub-zone with servers\n");
|
||||
|
@ -478,7 +478,7 @@ time_passes(struct replay_runtime* runtime, struct replay_moment* mom)
|
||||
#endif
|
||||
}
|
||||
timeval_add(&runtime->now_tv, &tv);
|
||||
runtime->now_secs = (uint32_t)runtime->now_tv.tv_sec;
|
||||
runtime->now_secs = (time_t)runtime->now_tv.tv_sec;
|
||||
#ifndef S_SPLINT_S
|
||||
log_info("elapsed %d.%6.6d now %d.%6.6d",
|
||||
(int)tv.tv_sec, (int)tv.tv_usec,
|
||||
@ -801,7 +801,7 @@ comm_base_delete(struct comm_base* b)
|
||||
}
|
||||
|
||||
void
|
||||
comm_base_timept(struct comm_base* b, uint32_t** tt, struct timeval** tv)
|
||||
comm_base_timept(struct comm_base* b, time_t** tt, struct timeval** tv)
|
||||
{
|
||||
struct replay_runtime* runtime = (struct replay_runtime*)b;
|
||||
*tt = &runtime->now_secs;
|
||||
@ -909,8 +909,10 @@ outside_network_create(struct comm_base* base, size_t bufsize,
|
||||
runtime->infra = infra;
|
||||
outnet->base = base;
|
||||
outnet->udp_buff = ldns_buffer_new(bufsize);
|
||||
if(!outnet->udp_buff)
|
||||
if(!outnet->udp_buff) {
|
||||
free(outnet);
|
||||
return NULL;
|
||||
}
|
||||
return outnet;
|
||||
}
|
||||
|
||||
|
@ -349,13 +349,14 @@ provide_file_10(SSL* ssl, char* fname)
|
||||
"rb"
|
||||
#endif
|
||||
);
|
||||
int r;
|
||||
size_t r;
|
||||
const char* rcode = "200 OK";
|
||||
if(!in) {
|
||||
char hdr[1024];
|
||||
rcode = "404 File not found";
|
||||
r = snprintf(hdr, sizeof(hdr), "HTTP/1.1 %s\r\n\r\n", rcode);
|
||||
if(SSL_write(ssl, hdr, r) <= 0) {
|
||||
snprintf(hdr, sizeof(hdr), "HTTP/1.1 %s\r\n\r\n", rcode);
|
||||
r = strlen(hdr);
|
||||
if(SSL_write(ssl, hdr, (int)r) <= 0) {
|
||||
/* write failure */
|
||||
}
|
||||
return;
|
||||
@ -371,16 +372,20 @@ provide_file_10(SSL* ssl, char* fname)
|
||||
}
|
||||
avail = len+header_reserve;
|
||||
at = buf;
|
||||
r = snprintf(at, avail, "HTTP/1.1 %s\r\n", rcode);
|
||||
snprintf(at, avail, "HTTP/1.1 %s\r\n", rcode);
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
r = snprintf(at, avail, "Server: petal/%s\r\n", PACKAGE_VERSION);
|
||||
snprintf(at, avail, "Server: petal/%s\r\n", PACKAGE_VERSION);
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
r = snprintf(at, avail, "Content-Length: %u\r\n", (unsigned)len);
|
||||
snprintf(at, avail, "Content-Length: %u\r\n", (unsigned)len);
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
r = snprintf(at, avail, "\r\n");
|
||||
snprintf(at, avail, "\r\n");
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
if(avail < len) { /* robust */
|
||||
@ -409,7 +414,7 @@ provide_file_chunked(SSL* ssl, char* fname)
|
||||
char buf[16384];
|
||||
char* at = buf;
|
||||
size_t avail = sizeof(buf);
|
||||
int r;
|
||||
size_t r;
|
||||
FILE* in = fopen(fname,
|
||||
#ifndef USE_WINSOCK
|
||||
"r"
|
||||
@ -423,19 +428,24 @@ provide_file_chunked(SSL* ssl, char* fname)
|
||||
}
|
||||
|
||||
/* print headers */
|
||||
r = snprintf(at, avail, "HTTP/1.1 %s\r\n", rcode);
|
||||
snprintf(at, avail, "HTTP/1.1 %s\r\n", rcode);
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
r = snprintf(at, avail, "Server: petal/%s\r\n", PACKAGE_VERSION);
|
||||
snprintf(at, avail, "Server: petal/%s\r\n", PACKAGE_VERSION);
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
r = snprintf(at, avail, "Transfer-Encoding: chunked\r\n");
|
||||
snprintf(at, avail, "Transfer-Encoding: chunked\r\n");
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
r = snprintf(at, avail, "Connection: close\r\n");
|
||||
snprintf(at, avail, "Connection: close\r\n");
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
r = snprintf(at, avail, "\r\n");
|
||||
snprintf(at, avail, "\r\n");
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
if(avail < 16) { /* robust */
|
||||
@ -448,7 +458,8 @@ provide_file_chunked(SSL* ssl, char* fname)
|
||||
/* read chunk; space-16 for xxxxCRLF..CRLF0CRLFCRLF (3 spare)*/
|
||||
size_t red = in?fread(tmpbuf, 1, avail-16, in):0;
|
||||
/* prepare chunk */
|
||||
r = snprintf(at, avail, "%x\r\n", (unsigned)red);
|
||||
snprintf(at, avail, "%x\r\n", (unsigned)red);
|
||||
r = strlen(at);
|
||||
if(verb >= 3)
|
||||
{printf("chunk len %x\n", (unsigned)red); fflush(stdout);}
|
||||
at += r;
|
||||
@ -458,17 +469,20 @@ provide_file_chunked(SSL* ssl, char* fname)
|
||||
memmove(at, tmpbuf, red);
|
||||
at += red;
|
||||
avail -= red;
|
||||
r = snprintf(at, avail, "\r\n");
|
||||
snprintf(at, avail, "\r\n");
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
}
|
||||
if(in && feof(in) && red != 0) {
|
||||
r = snprintf(at, avail, "0\r\n");
|
||||
snprintf(at, avail, "0\r\n");
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
}
|
||||
if(!in || feof(in)) {
|
||||
r = snprintf(at, avail, "\r\n");
|
||||
snprintf(at, avail, "\r\n");
|
||||
r = strlen(at);
|
||||
at += r;
|
||||
avail -= r;
|
||||
}
|
||||
|
@ -792,15 +792,15 @@ macro_expand(rbtree_t* store, struct replay_runtime* runtime, char** text)
|
||||
|
||||
/* check for functions */
|
||||
if(strcmp(buf, "time") == 0) {
|
||||
snprintf(buf, sizeof(buf), "%u", (unsigned)runtime->now_secs);
|
||||
snprintf(buf, sizeof(buf), "%lld", (long long)runtime->now_secs);
|
||||
*text += len;
|
||||
return strdup(buf);
|
||||
} else if(strcmp(buf, "timeout") == 0) {
|
||||
uint32_t res = 0;
|
||||
time_t res = 0;
|
||||
struct fake_timer* t = first_timer(runtime);
|
||||
if(t && (uint32_t)t->tv.tv_sec >= runtime->now_secs)
|
||||
res = (uint32_t)t->tv.tv_sec - runtime->now_secs;
|
||||
snprintf(buf, sizeof(buf), "%u", (unsigned)res);
|
||||
if(t && (time_t)t->tv.tv_sec >= runtime->now_secs)
|
||||
res = (time_t)t->tv.tv_sec - runtime->now_secs;
|
||||
snprintf(buf, sizeof(buf), "%lld", (long long)res);
|
||||
*text += len;
|
||||
return strdup(buf);
|
||||
} else if(strncmp(buf, "ctime ", 6) == 0 ||
|
||||
|
@ -293,7 +293,7 @@ struct replay_runtime {
|
||||
struct infra_cache* infra;
|
||||
|
||||
/** the current time in seconds */
|
||||
uint32_t now_secs;
|
||||
time_t now_secs;
|
||||
/** the current time in microseconds */
|
||||
struct timeval now_tv;
|
||||
|
||||
|
66
testcode/streamtcp.1
Normal file
66
testcode/streamtcp.1
Normal file
@ -0,0 +1,66 @@
|
||||
.TH "unbound\-streamtcp" "1" "Mar 21, 2013" "NLnet Labs" "unbound"
|
||||
.\"
|
||||
.\" unbound-streamtcp.1 -- unbound DNS lookup utility
|
||||
.\"
|
||||
.SH "NAME"
|
||||
.LP
|
||||
.B unbound\-streamtcp
|
||||
\- unbound DNS lookup utility
|
||||
.SH "SYNOPSIS"
|
||||
.LP
|
||||
.B unbound\-streamtcp
|
||||
.RB [ \-unsh ]
|
||||
.RB [ \-f
|
||||
.IR ipaddr[@port] ]
|
||||
.I name
|
||||
.I type
|
||||
.I class
|
||||
.SH "DESCRIPTION"
|
||||
.LP
|
||||
.B unbound\-streamtcp
|
||||
sends a DNS Query of the given \fBtype\fR and \fBclass\fR for the given \fBname\fR
|
||||
to the DNS server over TCP and displays the response.
|
||||
.P
|
||||
If the server to query is not given using the \fB\-f\fR option then localhost
|
||||
(127.0.0.1) is used. More queries can be given on one commandline, they
|
||||
are resolved in sequence.
|
||||
.P
|
||||
The available options are:
|
||||
.TP
|
||||
.I name
|
||||
This name is resolved (looked up in the DNS).
|
||||
.TP
|
||||
.I type
|
||||
Specify the type of data to lookup.
|
||||
.TP
|
||||
.I class
|
||||
Specify the class to lookup for.
|
||||
.TP
|
||||
.B \-u
|
||||
Use UDP instead of TCP. No retries are attempted.
|
||||
.TP
|
||||
.B \-n
|
||||
Do not wait for the answer.
|
||||
.TP
|
||||
.B \-s
|
||||
Use SSL.
|
||||
.TP
|
||||
.B \-h
|
||||
Print program usage.
|
||||
.TP
|
||||
.B \-f \fIipaddr[@port]
|
||||
Specify the server to send the queries to. If not specified localhost (127.0.0.1) is used.
|
||||
.SH "EXAMPLES"
|
||||
.LP
|
||||
Some examples of use.
|
||||
.P
|
||||
$ unbound\-streamtcp www.example.com A IN
|
||||
.P
|
||||
$ unbound\-streamtcp \-f 192.168.1.1 www.example.com SOA IN
|
||||
.P
|
||||
$ unbound\-streamtcp \-f 192.168.1.1@1234 153.1.168.192.in\-addr.arpa. PTR IN
|
||||
.SH "EXIT CODE"
|
||||
The unbound\-streamtcp program exits with status code 1 on error,
|
||||
0 on no error.
|
||||
.SH "AUTHOR"
|
||||
This manual page was written by Tomas Hozza <thozza@redhat.com>.
|
@ -121,9 +121,9 @@ write_q(int fd, int udp, SSL* ssl, ldns_buffer* buf, uint16_t id,
|
||||
exit(1);
|
||||
}
|
||||
qinfo.qname = memdup(ldns_rdf_data(rdf), ldns_rdf_size(rdf));
|
||||
if(!qinfo.qname) fatal_exit("out of memory");
|
||||
(void)dname_count_size_labels(qinfo.qname, &qinfo.qname_len);
|
||||
ldns_rdf_deep_free(rdf);
|
||||
if(!qinfo.qname) fatal_exit("out of memory");
|
||||
|
||||
/* qtype and qclass */
|
||||
qinfo.qtype = ldns_get_rr_type_by_name(strtype);
|
||||
|
@ -411,7 +411,7 @@ rtt_test(void)
|
||||
/* lookup and get key and data structs easily */
|
||||
static struct infra_data* infra_lookup_host(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* zone,
|
||||
size_t zonelen, int wr, uint32_t now, struct infra_key** k)
|
||||
size_t zonelen, int wr, time_t now, struct infra_key** k)
|
||||
{
|
||||
struct infra_data* d;
|
||||
struct lruhash_entry* e = infra_lookup_nottl(infra, addr, addrlen,
|
||||
@ -436,7 +436,7 @@ infra_test(void)
|
||||
size_t zonelen = 13;
|
||||
struct infra_cache* slab;
|
||||
struct config_file* cfg = config_create();
|
||||
uint32_t now = 0;
|
||||
time_t now = 0;
|
||||
uint8_t edns_lame;
|
||||
int vs, to;
|
||||
struct infra_key* k;
|
||||
|
@ -258,7 +258,7 @@ checkformerr(ldns_buffer* pkt)
|
||||
/** performance test message encoding */
|
||||
static void
|
||||
perf_encode(struct query_info* qi, struct reply_info* rep, uint16_t id,
|
||||
uint16_t flags, ldns_buffer* out, uint32_t timenow,
|
||||
uint16_t flags, ldns_buffer* out, time_t timenow,
|
||||
struct edns_data* edns)
|
||||
{
|
||||
static int num = 0;
|
||||
@ -299,7 +299,7 @@ perftestpkt(ldns_buffer* pkt, struct alloc_cache* alloc, ldns_buffer* out,
|
||||
int ret;
|
||||
uint16_t id;
|
||||
uint16_t flags;
|
||||
uint32_t timenow = 0;
|
||||
time_t timenow = 0;
|
||||
struct regional* region = regional_create();
|
||||
struct edns_data edns;
|
||||
|
||||
|
@ -195,7 +195,7 @@ static void add_item(struct val_neg_cache* neg)
|
||||
struct packed_rrset_data rd;
|
||||
struct ub_packed_rrset_key nsec;
|
||||
size_t rr_len;
|
||||
uint32_t rr_ttl;
|
||||
time_t rr_ttl;
|
||||
uint8_t* rr_data;
|
||||
char* zname = get_random_zone();
|
||||
char* from, *to;
|
||||
|
@ -301,7 +301,7 @@ verifytest_file(const char* fname, const char* at_date)
|
||||
struct entry* list = read_datafile(fname, 1);
|
||||
struct module_env env;
|
||||
struct val_env ve;
|
||||
uint32_t now = time(NULL);
|
||||
time_t now = time(NULL);
|
||||
|
||||
if(!list)
|
||||
fatal_exit("could not read %s: %s", fname, strerror(errno));
|
||||
@ -422,7 +422,7 @@ nsec3_hash_test_entry(struct entry* e, rbtree_t* ct,
|
||||
struct query_info qinfo;
|
||||
struct reply_info* rep = NULL;
|
||||
struct ub_packed_rrset_key* answer, *nsec3;
|
||||
struct nsec3_cached_hash* hash;
|
||||
struct nsec3_cached_hash* hash = NULL;
|
||||
int ret;
|
||||
uint8_t* qname;
|
||||
|
||||
|
12
testdata/autotrust_revtp_use.rpl
vendored
12
testdata/autotrust_revtp_use.rpl
vendored
@ -89,7 +89,7 @@ example.com. 10800 IN RRSIG DNSKEY 5 2 10800 20091124111500 20091018111500 16614
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode subdomain
|
||||
MATCH opcode qname qtype
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR
|
||||
SECTION QUESTION
|
||||
@ -97,8 +97,16 @@ www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qname qtype
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR
|
||||
SECTION QUESTION
|
||||
ns.example.com. IN AAAA
|
||||
SECTION ANSWER
|
||||
; no AAAA
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
STEP 20 QUERY
|
||||
|
157
testdata/iter_fwdfirstequal.rpl
vendored
Normal file
157
testdata/iter_fwdfirstequal.rpl
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
; config options
|
||||
server:
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
|
||||
forward-zone:
|
||||
name: "."
|
||||
forward-addr: 1.2.3.6 # failing resolver
|
||||
forward-first: yes
|
||||
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test forward-first directive with equal stub name configured.
|
||||
|
||||
; K.ROOT-SERVERS.NET.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 193.0.14.129
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode subdomain
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
com. IN A
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; a.gtld-servers.net.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 192.5.6.30
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
com. IN NS
|
||||
SECTION ANSWER
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode subdomain
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.4
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN NS
|
||||
SECTION ANSWER
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; local resolver (that fails a lot)
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.6
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR RA SERVFAIL
|
||||
SECTION QUESTION
|
||||
example.com. IN NS
|
||||
SECTION ANSWER
|
||||
;example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
;ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR RA SERVFAIL
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
;www.example.com. IN A 10.20.30.50
|
||||
SECTION AUTHORITY
|
||||
;example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
;ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
; recursion happens here.
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
39
testdata/iter_privaddr.rpl
vendored
39
testdata/iter_privaddr.rpl
vendored
@ -163,6 +163,22 @@ example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
toss.example.com. IN A
|
||||
SECTION ANSWER
|
||||
toss.example.com. IN A 10.20.30.40
|
||||
toss.example.com. IN A 1.2.3.4
|
||||
toss.example.com. IN A 10.20.30.41
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; public address is not scrubbed
|
||||
@ -243,4 +259,27 @@ SECTION ANSWER
|
||||
mail.example.net. IN A 10.20.30.40
|
||||
ENTRY_END
|
||||
|
||||
; rest of RRset intact, only 10/8 tossed away.
|
||||
STEP 60 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
toss.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
STEP 70 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
toss.example.com. IN A
|
||||
SECTION ANSWER
|
||||
; toss.example.com. IN A 10.20.30.40
|
||||
toss.example.com. IN A 1.2.3.4
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
|
259
testdata/iter_stublastresort.rpl
vendored
Normal file
259
testdata/iter_stublastresort.rpl
vendored
Normal file
@ -0,0 +1,259 @@
|
||||
; config options
|
||||
server:
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
|
||||
stub-zone:
|
||||
name: "example.com"
|
||||
stub-addr: 1.2.3.6
|
||||
stub-prime: yes
|
||||
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test stub with stub-prime and last resort fallback
|
||||
; the last resort fallback should not activate, as the
|
||||
; configured stub must be used for this data, or its primed data.
|
||||
|
||||
; K.ROOT-SERVERS.NET.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 193.0.14.129
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode subdomain
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
com. IN A
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; a.gtld-servers.net.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 192.5.6.30
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
com. IN NS
|
||||
SECTION ANSWER
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode subdomain
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.4
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN NS
|
||||
SECTION ANSWER
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
ns.example.com. IN A
|
||||
SECTION ANSWER
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
ns.example.com. IN AAAA
|
||||
SECTION ANSWER
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; the stub-prime server.
|
||||
; local authority (that fails a lot)
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.6
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA
|
||||
SECTION QUESTION
|
||||
example.com. IN NS
|
||||
SECTION ANSWER
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.7
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA SERVFAIL
|
||||
SECTION QUESTION
|
||||
ns.example.com. IN A
|
||||
SECTION ANSWER
|
||||
;ns.example.com. IN A 1.2.3.7
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA SERVFAIL
|
||||
SECTION QUESTION
|
||||
ns.example.com. IN AAAA
|
||||
SECTION ANSWER
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA SERVFAIL
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
;www.example.com. IN A 10.20.30.70
|
||||
SECTION AUTHORITY
|
||||
SECTION ADDITIONAL
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; the primed server
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.7
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA
|
||||
SECTION QUESTION
|
||||
example.com. IN NS
|
||||
SECTION ANSWER
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.8
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA
|
||||
SECTION QUESTION
|
||||
ns.example.com. IN A
|
||||
SECTION ANSWER
|
||||
ns.example.com. IN A 1.2.3.8
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA
|
||||
SECTION QUESTION
|
||||
ns.example.com. IN AAAA
|
||||
SECTION ANSWER
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA SERVFAIL
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
;www.example.com. IN A 10.20.30.80
|
||||
SECTION AUTHORITY
|
||||
SECTION ADDITIONAL
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; crap server that the primed server refers to.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.8
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR SERVFAIL
|
||||
SECTION QUESTION
|
||||
example.com. IN NS
|
||||
SECTION ANSWER
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
; recursion happens here.
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA SERVFAIL
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
;www.example.com. IN A 10.20.30.50
|
||||
SECTION AUTHORITY
|
||||
;example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
;ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
BIN
testdata/nss_compile.tpkg
vendored
BIN
testdata/nss_compile.tpkg
vendored
Binary file not shown.
36
testdata/val_cnametonsec.rpl
vendored
36
testdata/val_cnametonsec.rpl
vendored
@ -56,11 +56,11 @@ a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
MATCH opcode subdomain
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
@ -85,6 +85,36 @@ ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
ns.example.com. IN AAAA
|
||||
SECTION ANSWER
|
||||
; no NSECs to prove this, not needed in test, but could be there
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
ns.example.com. IN A
|
||||
SECTION ANSWER
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
; response to DNSKEY priming query
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
|
36
testdata/val_cnametooptin.rpl
vendored
36
testdata/val_cnametooptin.rpl
vendored
@ -56,11 +56,11 @@ a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
MATCH opcode subdomain
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
@ -85,6 +85,36 @@ ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
ns.example.com. IN AAAA
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
ns.example.com. IN A
|
||||
SECTION ANSWER
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ENTRY_END
|
||||
|
||||
; response to DNSKEY priming query
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
|
@ -69,6 +69,8 @@ int ub_c_parse(void);
|
||||
int ub_c_lex(void);
|
||||
/** wrap function */
|
||||
int ub_c_wrap(void);
|
||||
/** init lex state */
|
||||
void init_cfg_parse(void);
|
||||
|
||||
/** init ports possible for use */
|
||||
static void init_outgoing_availports(int* array, int num);
|
||||
@ -201,6 +203,7 @@ config_create(void)
|
||||
cfg->control_port = UNBOUND_CONTROL_PORT;
|
||||
cfg->minimal_responses = 0;
|
||||
cfg->rrset_roundrobin = 0;
|
||||
cfg->max_udp_size = 4096;
|
||||
if(!(cfg->server_key_file = strdup(RUN_DIR"/unbound_server.key")))
|
||||
goto error_exit;
|
||||
if(!(cfg->server_cert_file = strdup(RUN_DIR"/unbound_server.pem")))
|
||||
@ -327,7 +330,11 @@ int config_set_option(struct config_file* cfg, const char* opt,
|
||||
cfg->use_syslog = 0;
|
||||
free(cfg->logfile);
|
||||
return (cfg->logfile = strdup(val)) != NULL;
|
||||
}
|
||||
}
|
||||
else if(strcmp(opt, "log-time-ascii:") == 0)
|
||||
{ IS_YES_OR_NO; cfg->log_time_ascii = (strcmp(val, "yes") == 0);
|
||||
log_set_time_asc(cfg->log_time_ascii); }
|
||||
else S_SIZET_NONZERO("max-udp-size:", max_udp_size)
|
||||
else S_YNO("use-syslog:", use_syslog)
|
||||
else S_YNO("extended-statistics:", stat_extended)
|
||||
else S_YNO("statistics-cumulative:", stat_cumulative)
|
||||
@ -358,7 +365,10 @@ int config_set_option(struct config_file* cfg, const char* opt,
|
||||
else S_POW2("rrset-cache-slabs:", rrset_cache_slabs)
|
||||
else S_YNO("prefetch:", prefetch)
|
||||
else S_YNO("prefetch-key:", prefetch_key)
|
||||
else S_NUMBER_OR_ZERO("cache-max-ttl:", max_ttl)
|
||||
else if(strcmp(opt, "cache-max-ttl:") == 0)
|
||||
{ IS_NUMBER_OR_ZERO; cfg->max_ttl = atoi(val); MAX_TTL=(time_t)cfg->max_ttl;}
|
||||
else if(strcmp(opt, "cache-min-ttl:") == 0)
|
||||
{ IS_NUMBER_OR_ZERO; cfg->min_ttl = atoi(val); MIN_TTL=(time_t)cfg->min_ttl;}
|
||||
else S_NUMBER_OR_ZERO("infra-host-ttl:", host_ttl)
|
||||
else S_POW2("infra-cache-slabs:", infra_cache_slabs)
|
||||
else S_SIZET_NONZERO("infra-cache-numhosts:", infra_cache_numhosts)
|
||||
@ -417,6 +427,12 @@ int config_set_option(struct config_file* cfg, const char* opt,
|
||||
else S_STR("control-cert-file:", control_cert_file)
|
||||
else S_STR("module-config:", module_conf)
|
||||
else S_STR("python-script:", python_script)
|
||||
/* val_sig_skew_min and max are copied into val_env during init,
|
||||
* so this does not update val_env with set_option */
|
||||
else if(strcmp(opt, "val-sig-skew-min:") == 0)
|
||||
{ IS_NUMBER_OR_ZERO; cfg->val_sig_skew_min = (int32_t)atoi(val); }
|
||||
else if(strcmp(opt, "val-sig-skew-max:") == 0)
|
||||
{ IS_NUMBER_OR_ZERO; cfg->val_sig_skew_max = (int32_t)atoi(val); }
|
||||
else if (strcmp(opt, "outgoing-interface:") == 0) {
|
||||
char* d = strdup(val);
|
||||
char** oi = (char**)malloc((cfg->num_out_ifs+1)*sizeof(char*));
|
||||
@ -516,8 +532,9 @@ config_collate_cat(struct config_strlist* list)
|
||||
return NULL;
|
||||
}
|
||||
snprintf(w, left, "%s\n", s->str);
|
||||
w += this+1;
|
||||
left -= this+1;
|
||||
this = strlen(w);
|
||||
w += this;
|
||||
left -= this;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@ -572,6 +589,7 @@ config_get_option(struct config_file* cfg, const char* opt,
|
||||
else O_YNO(opt, "statistics-cumulative", stat_cumulative)
|
||||
else O_YNO(opt, "extended-statistics", stat_extended)
|
||||
else O_YNO(opt, "use-syslog", use_syslog)
|
||||
else O_YNO(opt, "log-time-ascii", log_time_ascii)
|
||||
else O_DEC(opt, "num-threads", num_threads)
|
||||
else O_IFC(opt, "interface", num_ifs, ifs)
|
||||
else O_IFC(opt, "outgoing-interface", num_out_ifs, out_ifs)
|
||||
@ -593,6 +611,7 @@ config_get_option(struct config_file* cfg, const char* opt,
|
||||
else O_YNO(opt, "prefetch-key", prefetch_key)
|
||||
else O_YNO(opt, "prefetch", prefetch)
|
||||
else O_DEC(opt, "cache-max-ttl", max_ttl)
|
||||
else O_DEC(opt, "cache-min-ttl", min_ttl)
|
||||
else O_DEC(opt, "infra-host-ttl", host_ttl)
|
||||
else O_DEC(opt, "infra-cache-slabs", infra_cache_slabs)
|
||||
else O_MEM(opt, "infra-cache-numhosts", infra_cache_numhosts)
|
||||
@ -661,6 +680,10 @@ config_get_option(struct config_file* cfg, const char* opt,
|
||||
else O_UNS(opt, "val-override-date", val_date_override)
|
||||
else O_YNO(opt, "minimal-responses", minimal_responses)
|
||||
else O_YNO(opt, "rrset-roundrobin", rrset_roundrobin)
|
||||
else O_DEC(opt, "max-udp-size", max_udp_size)
|
||||
else O_STR(opt, "python-script", python_script)
|
||||
else O_DEC(opt, "val-sig-skew-min", val_sig_skew_min)
|
||||
else O_DEC(opt, "val-sig-skew-max", val_sig_skew_max)
|
||||
/* not here:
|
||||
* outgoing-permit, outgoing-avoid - have list of ports
|
||||
* local-zone - zones and nodefault variables
|
||||
@ -684,6 +707,7 @@ create_cfg_parser(struct config_file* cfg, char* filename, const char* chroot)
|
||||
cfg_parser->errors = 0;
|
||||
cfg_parser->cfg = cfg;
|
||||
cfg_parser->chroot = chroot;
|
||||
init_cfg_parse();
|
||||
}
|
||||
|
||||
int
|
||||
@ -1040,10 +1064,10 @@ cfg_str2list_insert(struct config_str2list** head, char* item, char* i2)
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
time_t
|
||||
cfg_convert_timeval(const char* str)
|
||||
{
|
||||
uint32_t t;
|
||||
time_t t;
|
||||
struct tm tm;
|
||||
memset(&tm, 0, sizeof(tm));
|
||||
if(strlen(str) < 14)
|
||||
@ -1147,8 +1171,8 @@ cfg_parse_memsize(const char* str, size_t* res)
|
||||
void
|
||||
config_apply(struct config_file* config)
|
||||
{
|
||||
MAX_TTL = (uint32_t)config->max_ttl;
|
||||
MIN_TTL = (uint32_t)config->min_ttl;
|
||||
MAX_TTL = (time_t)config->max_ttl;
|
||||
MIN_TTL = (time_t)config->min_ttl;
|
||||
EDNS_ADVERTISED_SIZE = (uint16_t)config->edns_buffer_size;
|
||||
MINIMAL_RESPONSES = config->minimal_responses;
|
||||
RRSET_ROUNDROBIN = config->rrset_roundrobin;
|
||||
|
@ -296,6 +296,9 @@ struct config_file {
|
||||
|
||||
/* RRSet roundrobin */
|
||||
int rrset_roundrobin;
|
||||
|
||||
/* maximum UDP response size */
|
||||
size_t max_udp_size;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -493,7 +496,7 @@ void config_delstubs(struct config_stub* list);
|
||||
* @param str: string of 14 digits
|
||||
* @return time value or 0 for error.
|
||||
*/
|
||||
uint32_t cfg_convert_timeval(const char* str);
|
||||
time_t cfg_convert_timeval(const char* str);
|
||||
|
||||
/**
|
||||
* Count number of values in the string.
|
||||
|
2797
util/configlexer.c
2797
util/configlexer.c
File diff suppressed because it is too large
Load Diff
@ -39,43 +39,67 @@ void ub_c_error(const char *message);
|
||||
struct inc_state {
|
||||
char* filename;
|
||||
int line;
|
||||
YY_BUFFER_STATE buffer;
|
||||
struct inc_state* next;
|
||||
};
|
||||
static struct inc_state parse_stack[MAXINCLUDES];
|
||||
static YY_BUFFER_STATE include_stack[MAXINCLUDES];
|
||||
static int config_include_stack_ptr = 0;
|
||||
static struct inc_state* config_include_stack = NULL;
|
||||
static int inc_depth = 0;
|
||||
static int inc_prev = 0;
|
||||
static int num_args = 0;
|
||||
|
||||
void init_cfg_parse(void)
|
||||
{
|
||||
config_include_stack = NULL;
|
||||
inc_depth = 0;
|
||||
inc_prev = 0;
|
||||
num_args = 0;
|
||||
}
|
||||
|
||||
static void config_start_include(const char* filename)
|
||||
{
|
||||
FILE *input;
|
||||
struct inc_state* s;
|
||||
char* nm;
|
||||
if(inc_depth++ > 100000) {
|
||||
ub_c_error_msg("too many include files");
|
||||
return;
|
||||
}
|
||||
if(strlen(filename) == 0) {
|
||||
ub_c_error_msg("empty include file name");
|
||||
return;
|
||||
}
|
||||
if(config_include_stack_ptr >= MAXINCLUDES) {
|
||||
ub_c_error_msg("includes nested too deeply, skipped (>%d)", MAXINCLUDES);
|
||||
s = (struct inc_state*)malloc(sizeof(*s));
|
||||
if(!s) {
|
||||
ub_c_error_msg("include %s: malloc failure", filename);
|
||||
return;
|
||||
}
|
||||
if(cfg_parser->chroot && strncmp(filename, cfg_parser->chroot,
|
||||
strlen(cfg_parser->chroot)) == 0) {
|
||||
filename += strlen(cfg_parser->chroot);
|
||||
}
|
||||
nm = strdup(filename);
|
||||
if(!nm) {
|
||||
ub_c_error_msg("include %s: strdup failure", filename);
|
||||
free(s);
|
||||
return;
|
||||
}
|
||||
input = fopen(filename, "r");
|
||||
if(!input) {
|
||||
ub_c_error_msg("cannot open include file '%s': %s",
|
||||
filename, strerror(errno));
|
||||
free(s);
|
||||
free(nm);
|
||||
return;
|
||||
}
|
||||
LEXOUT(("switch_to_include_file(%s) ", filename));
|
||||
parse_stack[config_include_stack_ptr].filename = cfg_parser->filename;
|
||||
parse_stack[config_include_stack_ptr].line = cfg_parser->line;
|
||||
include_stack[config_include_stack_ptr] = YY_CURRENT_BUFFER;
|
||||
cfg_parser->filename = strdup(filename);
|
||||
LEXOUT(("switch_to_include_file(%s)\n", filename));
|
||||
s->filename = cfg_parser->filename;
|
||||
s->line = cfg_parser->line;
|
||||
s->buffer = YY_CURRENT_BUFFER;
|
||||
s->next = config_include_stack;
|
||||
config_include_stack = s;
|
||||
cfg_parser->filename = nm;
|
||||
cfg_parser->line = 1;
|
||||
yy_switch_to_buffer(yy_create_buffer(input, YY_BUF_SIZE));
|
||||
++config_include_stack_ptr;
|
||||
}
|
||||
|
||||
static void config_start_include_glob(const char* filename)
|
||||
@ -107,6 +131,8 @@ static void config_start_include_glob(const char* filename)
|
||||
if(r) {
|
||||
/* some error */
|
||||
globfree(&g);
|
||||
if(r == GLOB_NOMATCH)
|
||||
return; /* no matches for pattern */
|
||||
config_start_include(filename); /* let original deal with it */
|
||||
return;
|
||||
}
|
||||
@ -124,12 +150,16 @@ static void config_start_include_glob(const char* filename)
|
||||
|
||||
static void config_end_include(void)
|
||||
{
|
||||
--config_include_stack_ptr;
|
||||
struct inc_state* s = config_include_stack;
|
||||
--inc_depth;
|
||||
if(!s) return;
|
||||
free(cfg_parser->filename);
|
||||
cfg_parser->filename = parse_stack[config_include_stack_ptr].filename;
|
||||
cfg_parser->line = parse_stack[config_include_stack_ptr].line;
|
||||
cfg_parser->filename = s->filename;
|
||||
cfg_parser->line = s->line;
|
||||
yy_delete_buffer(YY_CURRENT_BUFFER);
|
||||
yy_switch_to_buffer(include_stack[config_include_stack_ptr]);
|
||||
yy_switch_to_buffer(s->buffer);
|
||||
config_include_stack = s->next;
|
||||
free(s);
|
||||
}
|
||||
|
||||
#ifndef yy_set_bol /* compat definition, for flex 2.4.6 */
|
||||
@ -291,6 +321,7 @@ python{COLON} { YDVAR(0, VAR_PYTHON) }
|
||||
domain-insecure{COLON} { YDVAR(1, VAR_DOMAIN_INSECURE) }
|
||||
minimal-responses{COLON} { YDVAR(1, VAR_MINIMAL_RESPONSES) }
|
||||
rrset-roundrobin{COLON} { YDVAR(1, VAR_RRSET_ROUNDROBIN) }
|
||||
max-udp-size{COLON} { YDVAR(1, VAR_MAX_UDP_SIZE) }
|
||||
<INITIAL,val>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++; }
|
||||
|
||||
/* Quoted strings. Strip leading and ending quotes */
|
||||
@ -364,8 +395,9 @@ rrset-roundrobin{COLON} { YDVAR(1, VAR_RRSET_ROUNDROBIN) }
|
||||
BEGIN(inc_prev);
|
||||
}
|
||||
<INITIAL,val><<EOF>> {
|
||||
LEXOUT(("LEXEOF "));
|
||||
yy_set_bol(1); /* Set beginning of line, so "^" rules match. */
|
||||
if (config_include_stack_ptr == 0) {
|
||||
if (!config_include_stack) {
|
||||
yyterminate();
|
||||
} else {
|
||||
fclose(yyin);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -172,7 +172,8 @@ extern int yydebug;
|
||||
VAR_FORWARD_FIRST = 381,
|
||||
VAR_STUB_FIRST = 382,
|
||||
VAR_MINIMAL_RESPONSES = 383,
|
||||
VAR_RRSET_ROUNDROBIN = 384
|
||||
VAR_RRSET_ROUNDROBIN = 384,
|
||||
VAR_MAX_UDP_SIZE = 385
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
@ -303,6 +304,7 @@ extern int yydebug;
|
||||
#define VAR_STUB_FIRST 382
|
||||
#define VAR_MINIMAL_RESPONSES 383
|
||||
#define VAR_RRSET_ROUNDROBIN 384
|
||||
#define VAR_MAX_UDP_SIZE 385
|
||||
|
||||
|
||||
|
||||
@ -316,7 +318,7 @@ typedef union YYSTYPE
|
||||
|
||||
|
||||
/* Line 2049 of yacc.c */
|
||||
#line 320 "util/configparser.h"
|
||||
#line 322 "util/configparser.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
|
@ -105,6 +105,7 @@ extern struct config_parser_state* cfg_parser;
|
||||
%token VAR_IGNORE_CD_FLAG VAR_LOG_QUERIES VAR_TCP_UPSTREAM VAR_SSL_UPSTREAM
|
||||
%token VAR_SSL_SERVICE_KEY VAR_SSL_SERVICE_PEM VAR_SSL_PORT VAR_FORWARD_FIRST
|
||||
%token VAR_STUB_FIRST VAR_MINIMAL_RESPONSES VAR_RRSET_ROUNDROBIN
|
||||
%token VAR_MAX_UDP_SIZE
|
||||
|
||||
%%
|
||||
toplevelvars: /* empty */ | toplevelvars toplevelvar ;
|
||||
@ -161,7 +162,7 @@ content_server: server_num_threads | server_verbosity | server_port |
|
||||
server_so_sndbuf | server_harden_below_nxdomain | server_ignore_cd_flag |
|
||||
server_log_queries | server_tcp_upstream | server_ssl_upstream |
|
||||
server_ssl_service_key | server_ssl_service_pem | server_ssl_port |
|
||||
server_minimal_responses | server_rrset_roundrobin
|
||||
server_minimal_responses | server_rrset_roundrobin | server_max_udp_size
|
||||
;
|
||||
stubstart: VAR_STUB_ZONE
|
||||
{
|
||||
@ -1117,6 +1118,13 @@ server_rrset_roundrobin: VAR_RRSET_ROUNDROBIN STRING_ARG
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
server_max_udp_size: VAR_MAX_UDP_SIZE STRING_ARG
|
||||
{
|
||||
OUTYY(("P(server_max_udp_size:%s)\n", $2));
|
||||
cfg_parser->cfg->max_udp_size = atoi($2);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
stub_name: VAR_NAME STRING_ARG
|
||||
{
|
||||
OUTYY(("P(name:%s)\n", $2));
|
||||
|
@ -441,7 +441,7 @@ rrset_belongs_in_reply(ldns_pkt_section s, uint16_t rrtype, uint16_t qtype,
|
||||
/** store rrset in buffer in wireformat, return RETVAL_* */
|
||||
static int
|
||||
packed_rrset_encode(struct ub_packed_rrset_key* key, ldns_buffer* pkt,
|
||||
uint16_t* num_rrs, uint32_t timenow, struct regional* region,
|
||||
uint16_t* num_rrs, time_t timenow, struct regional* region,
|
||||
int do_data, int do_sig, struct compress_tree_node** tree,
|
||||
ldns_pkt_section s, uint16_t qtype, int dnssec, size_t rr_offset)
|
||||
{
|
||||
@ -528,7 +528,7 @@ packed_rrset_encode(struct ub_packed_rrset_key* key, ldns_buffer* pkt,
|
||||
/** store msg section in wireformat buffer, return RETVAL_* */
|
||||
static int
|
||||
insert_section(struct reply_info* rep, size_t num_rrsets, uint16_t* num_rrs,
|
||||
ldns_buffer* pkt, size_t rrsets_before, uint32_t timenow,
|
||||
ldns_buffer* pkt, size_t rrsets_before, time_t timenow,
|
||||
struct regional* region, struct compress_tree_node** tree,
|
||||
ldns_pkt_section s, uint16_t qtype, int dnssec, size_t rr_offset)
|
||||
{
|
||||
@ -624,7 +624,7 @@ positive_answer(struct reply_info* rep, uint16_t qtype) {
|
||||
|
||||
int
|
||||
reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
|
||||
uint16_t id, uint16_t flags, ldns_buffer* buffer, uint32_t timenow,
|
||||
uint16_t id, uint16_t flags, ldns_buffer* buffer, time_t timenow,
|
||||
struct regional* region, uint16_t udpsize, int dnssec)
|
||||
{
|
||||
uint16_t ancount=0, nscount=0, arcount=0;
|
||||
@ -658,8 +658,9 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* roundrobin offset. using query id for random number */
|
||||
rr_offset = RRSET_ROUNDROBIN?id:0;
|
||||
/* roundrobin offset. using query id for random number. With ntohs
|
||||
* for different roundrobins for sequential id client senders. */
|
||||
rr_offset = RRSET_ROUNDROBIN?ntohs(id):0;
|
||||
|
||||
/* insert answer section */
|
||||
if((r=insert_section(rep, rep->an_numrrsets, &ancount, buffer,
|
||||
@ -708,9 +709,6 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
|
||||
return 0;
|
||||
}
|
||||
ldns_buffer_write_u16_at(buffer, 10, arcount);
|
||||
} else {
|
||||
ldns_buffer_write_u16_at(buffer, 8, nscount);
|
||||
ldns_buffer_write_u16_at(buffer, 10, arcount);
|
||||
}
|
||||
ldns_buffer_flip(buffer);
|
||||
return 1;
|
||||
@ -750,7 +748,7 @@ attach_edns_record(ldns_buffer* pkt, struct edns_data* edns)
|
||||
|
||||
int
|
||||
reply_info_answer_encode(struct query_info* qinf, struct reply_info* rep,
|
||||
uint16_t id, uint16_t qflags, ldns_buffer* pkt, uint32_t timenow,
|
||||
uint16_t id, uint16_t qflags, ldns_buffer* pkt, time_t timenow,
|
||||
int cached, struct regional* region, uint16_t udpsize,
|
||||
struct edns_data* edns, int dnssec, int secure)
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ struct edns_data;
|
||||
* @return: 0 on error (server failure).
|
||||
*/
|
||||
int reply_info_answer_encode(struct query_info* qinf, struct reply_info* rep,
|
||||
uint16_t id, uint16_t qflags, ldns_buffer* dest, uint32_t timenow,
|
||||
uint16_t id, uint16_t qflags, ldns_buffer* dest, time_t timenow,
|
||||
int cached, struct regional* region, uint16_t udpsize,
|
||||
struct edns_data* edns, int dnssec, int secure);
|
||||
|
||||
@ -88,7 +88,7 @@ int reply_info_answer_encode(struct query_info* qinf, struct reply_info* rep,
|
||||
* 0 on error: malloc failure (no log_err has been done).
|
||||
*/
|
||||
int reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
|
||||
uint16_t id, uint16_t flags, ldns_buffer* buffer, uint32_t timenow,
|
||||
uint16_t id, uint16_t flags, ldns_buffer* buffer, time_t timenow,
|
||||
struct regional* region, uint16_t udpsize, int dnssec);
|
||||
|
||||
/**
|
||||
|
@ -71,9 +71,9 @@ struct regional;
|
||||
/** number of buckets in parse rrset hash table. Must be power of 2. */
|
||||
#define PARSE_TABLE_SIZE 32
|
||||
/** Maximum TTL that is allowed. */
|
||||
extern uint32_t MAX_TTL;
|
||||
extern time_t MAX_TTL;
|
||||
/** Minimum TTL that is allowed. */
|
||||
extern uint32_t MIN_TTL;
|
||||
extern time_t MIN_TTL;
|
||||
/** Negative cache time (for entries without any RRs.) */
|
||||
#define NORR_TTL 5 /* seconds */
|
||||
|
||||
|
@ -53,9 +53,9 @@
|
||||
#include "util/data/msgencode.h"
|
||||
|
||||
/** MAX TTL default for messages and rrsets */
|
||||
uint32_t MAX_TTL = 3600 * 24 * 10; /* ten days */
|
||||
time_t MAX_TTL = 3600 * 24 * 10; /* ten days */
|
||||
/** MIN TTL default for messages and rrsets */
|
||||
uint32_t MIN_TTL = 0;
|
||||
time_t MIN_TTL = 0;
|
||||
|
||||
/** allocate qinfo, return 0 on error */
|
||||
static int
|
||||
@ -79,7 +79,7 @@ parse_create_qinfo(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
/** constructor for replyinfo */
|
||||
static struct reply_info*
|
||||
construct_reply_info_base(struct regional* region, uint16_t flags, size_t qd,
|
||||
uint32_t ttl, uint32_t prettl, size_t an, size_t ns, size_t ar,
|
||||
time_t ttl, time_t prettl, size_t an, size_t ns, size_t ar,
|
||||
size_t total, enum sec_status sec)
|
||||
{
|
||||
struct reply_info* rep;
|
||||
@ -154,7 +154,7 @@ repinfo_alloc_rrset_keys(struct reply_info* rep, struct alloc_cache* alloc,
|
||||
/** do the rdata copy */
|
||||
static int
|
||||
rdata_copy(ldns_buffer* pkt, struct packed_rrset_data* data, uint8_t* to,
|
||||
struct rr_parse* rr, uint32_t* rr_ttl, uint16_t type)
|
||||
struct rr_parse* rr, time_t* rr_ttl, uint16_t type)
|
||||
{
|
||||
uint16_t pkt_len;
|
||||
const ldns_rr_descriptor* desc;
|
||||
@ -245,7 +245,7 @@ parse_rr_copy(ldns_buffer* pkt, struct rrset_parse* pset,
|
||||
data->rr_len = (size_t*)((uint8_t*)data +
|
||||
sizeof(struct packed_rrset_data));
|
||||
data->rr_data = (uint8_t**)&(data->rr_len[total]);
|
||||
data->rr_ttl = (uint32_t*)&(data->rr_data[total]);
|
||||
data->rr_ttl = (time_t*)&(data->rr_data[total]);
|
||||
nextrdata = (uint8_t*)&(data->rr_ttl[total]);
|
||||
for(i=0; i<data->count; i++) {
|
||||
data->rr_len[i] = rr->size;
|
||||
@ -278,7 +278,7 @@ parse_create_rrset(ldns_buffer* pkt, struct rrset_parse* pset,
|
||||
/* allocate */
|
||||
size_t s = sizeof(struct packed_rrset_data) +
|
||||
(pset->rr_count + pset->rrsig_count) *
|
||||
(sizeof(size_t)+sizeof(uint8_t*)+sizeof(uint32_t)) +
|
||||
(sizeof(size_t)+sizeof(uint8_t*)+sizeof(time_t)) +
|
||||
pset->size;
|
||||
if(region)
|
||||
*data = regional_alloc(region, s);
|
||||
@ -465,7 +465,7 @@ reply_info_sortref(struct reply_info* rep)
|
||||
}
|
||||
|
||||
void
|
||||
reply_info_set_ttls(struct reply_info* rep, uint32_t timenow)
|
||||
reply_info_set_ttls(struct reply_info* rep, time_t timenow)
|
||||
{
|
||||
size_t i, j;
|
||||
rep->ttl += timenow;
|
||||
|
@ -116,21 +116,21 @@ struct reply_info {
|
||||
*/
|
||||
uint8_t qdcount;
|
||||
|
||||
/** 32 bit padding to pad struct member alignment to 64 bits. */
|
||||
uint32_t padding;
|
||||
|
||||
/**
|
||||
* TTL of the entire reply (for negative caching).
|
||||
* only for use when there are 0 RRsets in this message.
|
||||
* if there are RRsets, check those instead.
|
||||
*/
|
||||
uint32_t ttl;
|
||||
time_t ttl;
|
||||
|
||||
/**
|
||||
* TTL for prefetch. After it has expired, a prefetch is suitable.
|
||||
* Smaller than the TTL, otherwise the prefetch would not happen.
|
||||
*/
|
||||
uint32_t prefetch_ttl;
|
||||
|
||||
/** 32 bit padding to pad struct member alignment to 64 bits. */
|
||||
uint32_t padding;
|
||||
time_t prefetch_ttl;
|
||||
|
||||
/**
|
||||
* The security status from DNSSEC validation of this message.
|
||||
@ -253,7 +253,7 @@ void reply_info_sortref(struct reply_info* rep);
|
||||
* Also refs must be filled in.
|
||||
* @param timenow: the current time.
|
||||
*/
|
||||
void reply_info_set_ttls(struct reply_info* rep, uint32_t timenow);
|
||||
void reply_info_set_ttls(struct reply_info* rep, time_t timenow);
|
||||
|
||||
/**
|
||||
* Delete reply_info and packed_rrsets (while they are not yet added to the
|
||||
|
@ -183,7 +183,7 @@ packed_rrset_ptr_fixup(struct packed_rrset_data* data)
|
||||
data->rr_len = (size_t*)((uint8_t*)data +
|
||||
sizeof(struct packed_rrset_data));
|
||||
data->rr_data = (uint8_t**)&(data->rr_len[total]);
|
||||
data->rr_ttl = (uint32_t*)&(data->rr_data[total]);
|
||||
data->rr_ttl = (time_t*)&(data->rr_data[total]);
|
||||
nextrdata = (uint8_t*)&(data->rr_ttl[total]);
|
||||
for(i=0; i<total; i++) {
|
||||
data->rr_data[i] = nextrdata;
|
||||
@ -215,7 +215,7 @@ get_cname_target(struct ub_packed_rrset_key* rrset, uint8_t** dname,
|
||||
}
|
||||
|
||||
void
|
||||
packed_rrset_ttl_add(struct packed_rrset_data* data, uint32_t add)
|
||||
packed_rrset_ttl_add(struct packed_rrset_data* data, time_t add)
|
||||
{
|
||||
size_t i;
|
||||
size_t total = data->count + data->rrsig_count;
|
||||
@ -266,7 +266,7 @@ void log_rrset_key(enum verbosity_value v, const char* str,
|
||||
ntohs(rrset->rk.type), ntohs(rrset->rk.rrset_class));
|
||||
}
|
||||
|
||||
uint32_t
|
||||
time_t
|
||||
ub_packed_rrset_ttl(struct ub_packed_rrset_key* key)
|
||||
{
|
||||
struct packed_rrset_data* d = (struct packed_rrset_data*)key->
|
||||
@ -276,7 +276,7 @@ ub_packed_rrset_ttl(struct ub_packed_rrset_key* key)
|
||||
|
||||
struct ub_packed_rrset_key*
|
||||
packed_rrset_copy_region(struct ub_packed_rrset_key* key,
|
||||
struct regional* region, uint32_t now)
|
||||
struct regional* region, time_t now)
|
||||
{
|
||||
struct ub_packed_rrset_key* ck = regional_alloc(region,
|
||||
sizeof(struct ub_packed_rrset_key));
|
||||
@ -315,7 +315,7 @@ packed_rrset_copy_region(struct ub_packed_rrset_key* key,
|
||||
|
||||
struct ub_packed_rrset_key*
|
||||
packed_rrset_copy_alloc(struct ub_packed_rrset_key* key,
|
||||
struct alloc_cache* alloc, uint32_t now)
|
||||
struct alloc_cache* alloc, time_t now)
|
||||
{
|
||||
struct packed_rrset_data* fd, *dd;
|
||||
struct ub_packed_rrset_key* dk = alloc_special_obtain(alloc);
|
||||
@ -386,7 +386,7 @@ packed_rrset_heap_data(ldns_rr_list* rrset)
|
||||
|
||||
/* allocate */
|
||||
total = count + rrsig_count;
|
||||
len += sizeof(*data) + total*(sizeof(size_t) + sizeof(uint32_t) +
|
||||
len += sizeof(*data) + total*(sizeof(size_t) + sizeof(time_t) +
|
||||
sizeof(uint8_t*));
|
||||
data = (struct packed_rrset_data*)calloc(1, len);
|
||||
if(!data)
|
||||
@ -399,7 +399,7 @@ packed_rrset_heap_data(ldns_rr_list* rrset)
|
||||
data->rr_len = (size_t*)((uint8_t*)data +
|
||||
sizeof(struct packed_rrset_data));
|
||||
data->rr_data = (uint8_t**)&(data->rr_len[total]);
|
||||
data->rr_ttl = (uint32_t*)&(data->rr_data[total]);
|
||||
data->rr_ttl = (time_t*)&(data->rr_data[total]);
|
||||
nextrdata = (uint8_t*)&(data->rr_ttl[total]);
|
||||
|
||||
/* fill out len, ttl, fields */
|
||||
|
@ -215,7 +215,7 @@ enum sec_status {
|
||||
struct packed_rrset_data {
|
||||
/** TTL (in seconds like time()) of the rrset.
|
||||
* Same for all RRs see rfc2181(5.2). */
|
||||
uint32_t ttl;
|
||||
time_t ttl;
|
||||
/** number of rrs. */
|
||||
size_t count;
|
||||
/** number of rrsigs, if 0 no rrsigs */
|
||||
@ -227,7 +227,7 @@ struct packed_rrset_data {
|
||||
/** length of every rr's rdata, rr_len[i] is size of rr_data[i]. */
|
||||
size_t* rr_len;
|
||||
/** ttl of every rr. rr_ttl[i] ttl of rr i. */
|
||||
uint32_t *rr_ttl;
|
||||
time_t *rr_ttl;
|
||||
/**
|
||||
* Array of pointers to every rr's rdata.
|
||||
* The rr_data[i] rdata is stored in uncompressed wireformat.
|
||||
@ -281,7 +281,7 @@ size_t packed_rrset_sizeof(struct packed_rrset_data* data);
|
||||
* @param key: rrset key, with data to examine.
|
||||
* @return ttl value.
|
||||
*/
|
||||
uint32_t ub_packed_rrset_ttl(struct ub_packed_rrset_key* key);
|
||||
time_t ub_packed_rrset_ttl(struct ub_packed_rrset_key* key);
|
||||
|
||||
/**
|
||||
* Calculate memory size of rrset entry. For hash table usage.
|
||||
@ -343,7 +343,7 @@ void packed_rrset_ptr_fixup(struct packed_rrset_data* data);
|
||||
* @param data: rrset data structure. Otherwise correctly filled in.
|
||||
* @param add: how many seconds to add, pass time(0) for example.
|
||||
*/
|
||||
void packed_rrset_ttl_add(struct packed_rrset_data* data, uint32_t add);
|
||||
void packed_rrset_ttl_add(struct packed_rrset_data* data, time_t add);
|
||||
|
||||
/**
|
||||
* Utility procedure to extract CNAME target name from its rdata.
|
||||
@ -392,7 +392,7 @@ void log_rrset_key(enum verbosity_value v, const char* str,
|
||||
*/
|
||||
struct ub_packed_rrset_key* packed_rrset_copy_region(
|
||||
struct ub_packed_rrset_key* key, struct regional* region,
|
||||
uint32_t now);
|
||||
time_t now);
|
||||
|
||||
/**
|
||||
* Allocate rrset with malloc (from region or you are holding the lock).
|
||||
@ -403,7 +403,7 @@ struct ub_packed_rrset_key* packed_rrset_copy_region(
|
||||
*/
|
||||
struct ub_packed_rrset_key* packed_rrset_copy_alloc(
|
||||
struct ub_packed_rrset_key* key, struct alloc_cache* alloc,
|
||||
uint32_t now);
|
||||
time_t now);
|
||||
|
||||
/**
|
||||
* Create a ub_packed_rrset_key allocated on the heap.
|
||||
|
@ -33,7 +33,6 @@
|
||||
48,
|
||||
49,
|
||||
50,
|
||||
51,
|
||||
52,
|
||||
53,
|
||||
54,
|
||||
@ -694,9 +693,6 @@
|
||||
1026,
|
||||
1027,
|
||||
1029,
|
||||
1030,
|
||||
1031,
|
||||
1032,
|
||||
1033,
|
||||
1034,
|
||||
1035,
|
||||
@ -3968,6 +3964,7 @@
|
||||
4753,
|
||||
4784,
|
||||
4785,
|
||||
4789,
|
||||
4800,
|
||||
4801,
|
||||
4802,
|
||||
@ -4095,6 +4092,7 @@
|
||||
5111,
|
||||
5112,
|
||||
5116,
|
||||
5120,
|
||||
5133,
|
||||
5136,
|
||||
5137,
|
||||
@ -4173,6 +4171,7 @@
|
||||
5361,
|
||||
5362,
|
||||
5363,
|
||||
5364,
|
||||
5397,
|
||||
5398,
|
||||
5399,
|
||||
@ -4276,6 +4275,7 @@
|
||||
5681,
|
||||
5682,
|
||||
5683,
|
||||
5684,
|
||||
5688,
|
||||
5689,
|
||||
5713,
|
||||
@ -4479,6 +4479,7 @@
|
||||
6627,
|
||||
6628,
|
||||
6633,
|
||||
6653,
|
||||
6657,
|
||||
6670,
|
||||
6671,
|
||||
@ -4599,6 +4600,7 @@
|
||||
7401,
|
||||
7402,
|
||||
7410,
|
||||
7411,
|
||||
7421,
|
||||
7426,
|
||||
7427,
|
||||
@ -4794,7 +4796,6 @@
|
||||
8614,
|
||||
8675,
|
||||
8686,
|
||||
8699,
|
||||
8732,
|
||||
8733,
|
||||
8763,
|
||||
@ -5026,6 +5027,7 @@
|
||||
11000,
|
||||
11001,
|
||||
11106,
|
||||
11108,
|
||||
11111,
|
||||
11112,
|
||||
11161,
|
||||
@ -5285,7 +5287,10 @@
|
||||
29167,
|
||||
30001,
|
||||
30002,
|
||||
30003,
|
||||
30004,
|
||||
30260,
|
||||
30832,
|
||||
30999,
|
||||
31029,
|
||||
31416,
|
||||
@ -5371,6 +5376,7 @@
|
||||
47624,
|
||||
47806,
|
||||
47808,
|
||||
47809,
|
||||
48000,
|
||||
48001,
|
||||
48002,
|
||||
|
@ -73,7 +73,7 @@ static const char* ident="unbound";
|
||||
static int logging_to_syslog = 0;
|
||||
#endif /* HAVE_SYSLOG_H */
|
||||
/** time to print in log, if NULL, use time(2) */
|
||||
static uint32_t* log_now = NULL;
|
||||
static time_t* log_now = NULL;
|
||||
/** print time in UTC or in secondsfrom1970 */
|
||||
static int log_time_asc = 0;
|
||||
|
||||
@ -151,7 +151,7 @@ void log_ident_set(const char* id)
|
||||
ident = id;
|
||||
}
|
||||
|
||||
void log_set_time(uint32_t* t)
|
||||
void log_set_time(time_t* t)
|
||||
{
|
||||
log_now = t;
|
||||
}
|
||||
@ -228,7 +228,7 @@ log_vmsg(int pri, const char* type,
|
||||
ident, (int)getpid(), tid?*tid:0, type, message);
|
||||
} else
|
||||
#endif
|
||||
fprintf(logfile, "[%u] %s[%d:%x] %s: %s\n", (unsigned)now,
|
||||
fprintf(logfile, "[%lld] %s[%d:%x] %s: %s\n", (long long)now,
|
||||
ident, (int)getpid(), tid?*tid:0, type, message);
|
||||
#ifdef UB_ON_WINDOWS
|
||||
/* line buffering does not work on windows */
|
||||
|
@ -108,7 +108,7 @@ void log_ident_set(const char* id);
|
||||
* @param t: the point is copied and used to find the time.
|
||||
* if NULL, time(2) is used.
|
||||
*/
|
||||
void log_set_time(uint32_t* t);
|
||||
void log_set_time(time_t* t);
|
||||
|
||||
/**
|
||||
* Set if the time value is printed ascii or decimal in log entries.
|
||||
|
@ -79,13 +79,13 @@ settime(struct event_base* base)
|
||||
return -1;
|
||||
}
|
||||
#ifndef S_SPLINT_S
|
||||
*base->time_secs = (uint32_t)base->time_tv->tv_sec;
|
||||
*base->time_secs = (time_t)base->time_tv->tv_sec;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** create event base */
|
||||
void *event_init(uint32_t* time_secs, struct timeval* time_tv)
|
||||
void *event_init(time_t* time_secs, struct timeval* time_tv)
|
||||
{
|
||||
struct event_base* base = (struct event_base*)malloc(
|
||||
sizeof(struct event_base));
|
||||
|
@ -103,7 +103,7 @@ struct event_base
|
||||
/** if we need to exit */
|
||||
int need_to_exit;
|
||||
/** where to store time in seconds */
|
||||
uint32_t* time_secs;
|
||||
time_t* time_secs;
|
||||
/** where to store time in microseconds */
|
||||
struct timeval* time_tv;
|
||||
};
|
||||
@ -134,7 +134,7 @@ struct event {
|
||||
|
||||
/* function prototypes (some are as they appear in event.h) */
|
||||
/** create event base */
|
||||
void *event_init(uint32_t* time_secs, struct timeval* time_tv);
|
||||
void *event_init(time_t* time_secs, struct timeval* time_tv);
|
||||
/** get version */
|
||||
const char *event_get_version(void);
|
||||
/** get polling method, select */
|
||||
|
@ -186,7 +186,7 @@ struct module_env {
|
||||
/** random table to generate random numbers */
|
||||
struct ub_randstate* rnd;
|
||||
/** time in seconds, converted to integer */
|
||||
uint32_t* now;
|
||||
time_t* now;
|
||||
/** time in microseconds. Relatively recent. */
|
||||
struct timeval* now_tv;
|
||||
/** is validation required for messages, controls client-facing
|
||||
@ -309,7 +309,7 @@ struct module_qstate {
|
||||
/** mesh related information for this query */
|
||||
struct mesh_state* mesh_info;
|
||||
/** how many seconds before expiry is this prefetched (0 if not) */
|
||||
uint32_t prefetch_leeway;
|
||||
time_t prefetch_leeway;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -122,7 +122,7 @@ struct internal_base {
|
||||
/** libevent event_base type. */
|
||||
struct event_base* base;
|
||||
/** seconds time pointer points here */
|
||||
uint32_t secs;
|
||||
time_t secs;
|
||||
/** timeval with current time */
|
||||
struct timeval now;
|
||||
/** the event used for slow_accept timeouts */
|
||||
@ -171,7 +171,7 @@ comm_base_now(struct comm_base* b)
|
||||
if(gettimeofday(&b->eb->now, NULL) < 0) {
|
||||
log_err("gettimeofday: %s", strerror(errno));
|
||||
}
|
||||
b->eb->secs = (uint32_t)b->eb->now.tv_sec;
|
||||
b->eb->secs = (time_t)b->eb->now.tv_sec;
|
||||
}
|
||||
#endif /* USE_MINI_EVENT */
|
||||
|
||||
@ -258,7 +258,7 @@ comm_base_delete(struct comm_base* b)
|
||||
}
|
||||
|
||||
void
|
||||
comm_base_timept(struct comm_base* b, uint32_t** tt, struct timeval** tv)
|
||||
comm_base_timept(struct comm_base* b, time_t** tt, struct timeval** tv)
|
||||
{
|
||||
*tt = &b->eb->secs;
|
||||
*tv = &b->eb->now;
|
||||
@ -320,6 +320,10 @@ udp_send_errno_needs_log(struct sockaddr* addr, socklen_t addrlen)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
/* permission denied is gotten for every send if the
|
||||
* network is disconnected (on some OS), squelch it */
|
||||
if(errno == EPERM && verbosity < VERB_DETAIL)
|
||||
return 0;
|
||||
/* squelch errors where people deploy AAAA ::ffff:bla for
|
||||
* authority servers, which we try for intranets. */
|
||||
if(errno == EINVAL && addr_is_ip4mapped(
|
||||
|
@ -308,7 +308,7 @@ void comm_base_delete(struct comm_base* b);
|
||||
* @param tt: pointer to time in seconds is returned.
|
||||
* @param tv: pointer to time in microseconds is returned.
|
||||
*/
|
||||
void comm_base_timept(struct comm_base* b, uint32_t** tt, struct timeval** tv);
|
||||
void comm_base_timept(struct comm_base* b, time_t** tt, struct timeval** tv);
|
||||
|
||||
/**
|
||||
* Dispatch the comm base events.
|
||||
|
@ -50,6 +50,9 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
|
||||
#include <time.h> /* defines time_t for timings in the test */
|
||||
/*#include <stdint.h> defines uint32_t etc (from config.h) */
|
||||
#include <sys/param.h> /* attempt to define endianness */
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h> /* attempt to define endianness (solaris) */
|
||||
#endif
|
||||
#ifdef linux
|
||||
# include <endian.h> /* attempt to define endianness */
|
||||
#endif
|
||||
@ -61,7 +64,7 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
|
||||
#endif
|
||||
|
||||
/* random initial value */
|
||||
static uint32_t raninit = 0xdeadbeef;
|
||||
static uint32_t raninit = (uint32_t)0xdeadbeef;
|
||||
|
||||
void
|
||||
hash_set_raninit(uint32_t v)
|
||||
@ -75,22 +78,25 @@ hash_set_raninit(uint32_t v)
|
||||
*/
|
||||
#if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \
|
||||
__BYTE_ORDER == __LITTLE_ENDIAN) || \
|
||||
(defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && \
|
||||
_BYTE_ORDER == _LITTLE_ENDIAN) || \
|
||||
(defined(i386) || defined(__i386__) || defined(__i486__) || \
|
||||
defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL))
|
||||
defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL) || defined(__x86))
|
||||
# define HASH_LITTLE_ENDIAN 1
|
||||
# define HASH_BIG_ENDIAN 0
|
||||
#elif (!defined(_BYTE_ORDER) && !defined(__BYTE_ORDER) && defined(_BIG_ENDIAN))
|
||||
# define HASH_LITTLE_ENDIAN 0
|
||||
# define HASH_BIG_ENDIAN 1
|
||||
#elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \
|
||||
__BYTE_ORDER == __BIG_ENDIAN) || \
|
||||
(defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && \
|
||||
_BYTE_ORDER == _BIG_ENDIAN) || \
|
||||
(defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel))
|
||||
(defined(sparc) || defined(__sparc) || defined(__sparc__) || defined(POWERPC) || defined(mc68000) || defined(sel))
|
||||
# define HASH_LITTLE_ENDIAN 0
|
||||
# define HASH_BIG_ENDIAN 1
|
||||
#elif defined(_MACHINE_ENDIAN_H_)
|
||||
/* test for machine_endian_h protects failure if some are empty strings */
|
||||
# if defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && _BYTE_ORDER == _BIG_ENDIAN
|
||||
# define HASH_LITTLE_ENDIAN 0
|
||||
# define HASH_BIG_ENDIAN 1
|
||||
# endif
|
||||
# if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define HASH_LITTLE_ENDIAN 1
|
||||
# define HASH_BIG_ENDIAN 0
|
||||
# endif /* _MACHINE_ENDIAN_H_ */
|
||||
#else
|
||||
# define HASH_LITTLE_ENDIAN 0
|
||||
# define HASH_BIG_ENDIAN 0
|
||||
|
@ -368,7 +368,7 @@ int tube_read_msg(struct tube* tube, uint8_t** buf, uint32_t* len,
|
||||
return 0;
|
||||
}
|
||||
d = 0;
|
||||
while(d != (ssize_t)*len) {
|
||||
while(d < (ssize_t)*len) {
|
||||
if((r=read(fd, (*buf)+d, (size_t)((ssize_t)*len)-d)) == -1) {
|
||||
log_err("tube msg read failed: %s", strerror(errno));
|
||||
(void)fd_set_nonblock(fd);
|
||||
|
@ -71,7 +71,7 @@ settime(struct event_base* base)
|
||||
return -1;
|
||||
}
|
||||
#ifndef S_SPLINT_S
|
||||
*base->time_secs = (uint32_t)base->time_tv->tv_sec;
|
||||
*base->time_secs = (time_t)base->time_tv->tv_sec;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -108,7 +108,7 @@ zero_waitfor(WSAEVENT waitfor[], WSAEVENT x)
|
||||
}
|
||||
}
|
||||
|
||||
void *event_init(uint32_t* time_secs, struct timeval* time_tv)
|
||||
void *event_init(time_t* time_secs, struct timeval* time_tv)
|
||||
{
|
||||
struct event_base* base = (struct event_base*)malloc(
|
||||
sizeof(struct event_base));
|
||||
@ -181,8 +181,8 @@ static void handle_timeouts(struct event_base* base, struct timeval* now,
|
||||
wait->tv_usec = p->ev_timeout.tv_usec
|
||||
- now->tv_usec;
|
||||
}
|
||||
verbose(VERB_CLIENT, "winsock_event wait=%d.%6.6d",
|
||||
(int)wait->tv_sec, (int)wait->tv_usec);
|
||||
verbose(VERB_CLIENT, "winsock_event wait=%lld.%6.6d",
|
||||
(long long)wait->tv_sec, (int)wait->tv_usec);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -488,9 +488,9 @@ int event_base_set(struct event_base *base, struct event *ev)
|
||||
|
||||
int event_add(struct event *ev, struct timeval *tv)
|
||||
{
|
||||
verbose(VERB_ALGO, "event_add %p added=%d fd=%d tv=%d %s%s%s",
|
||||
verbose(VERB_ALGO, "event_add %p added=%d fd=%d tv=%lld %s%s%s",
|
||||
ev, ev->added, ev->ev_fd,
|
||||
(tv?(int)tv->tv_sec*1000+(int)tv->tv_usec/1000:-1),
|
||||
(tv?(long long)tv->tv_sec*1000+(long long)tv->tv_usec/1000:-1),
|
||||
(ev->ev_events&EV_READ)?" EV_READ":"",
|
||||
(ev->ev_events&EV_WRITE)?" EV_WRITE":"",
|
||||
(ev->ev_events&EV_TIMEOUT)?" EV_TIMEOUT":"");
|
||||
@ -569,10 +569,10 @@ int event_add(struct event *ev, struct timeval *tv)
|
||||
|
||||
int event_del(struct event *ev)
|
||||
{
|
||||
verbose(VERB_ALGO, "event_del %p added=%d fd=%d tv=%d %s%s%s",
|
||||
verbose(VERB_ALGO, "event_del %p added=%d fd=%d tv=%lld %s%s%s",
|
||||
ev, ev->added, ev->ev_fd,
|
||||
(ev->ev_events&EV_TIMEOUT)?(int)ev->ev_timeout.tv_sec*1000+
|
||||
(int)ev->ev_timeout.tv_usec/1000:-1,
|
||||
(ev->ev_events&EV_TIMEOUT)?(long long)ev->ev_timeout.tv_sec*1000+
|
||||
(long long)ev->ev_timeout.tv_usec/1000:-1,
|
||||
(ev->ev_events&EV_READ)?" EV_READ":"",
|
||||
(ev->ev_events&EV_WRITE)?" EV_WRITE":"",
|
||||
(ev->ev_events&EV_TIMEOUT)?" EV_TIMEOUT":"");
|
||||
|
@ -129,7 +129,7 @@ struct event_base
|
||||
/** if we need to exit */
|
||||
int need_to_exit;
|
||||
/** where to store time in seconds */
|
||||
uint32_t* time_secs;
|
||||
time_t* time_secs;
|
||||
/** where to store time in microseconds */
|
||||
struct timeval* time_tv;
|
||||
/**
|
||||
@ -194,7 +194,7 @@ struct event {
|
||||
};
|
||||
|
||||
/** create event base */
|
||||
void *event_init(uint32_t* time_secs, struct timeval* time_tv);
|
||||
void *event_init(time_t* time_secs, struct timeval* time_tv);
|
||||
/** get version */
|
||||
const char *event_get_version(void);
|
||||
/** get polling method (select,epoll) */
|
||||
|
@ -242,7 +242,7 @@ parse_comments(char* str, struct autr_ta* ta)
|
||||
if (pos < 0 || !timestamp)
|
||||
ta->last_change = 0;
|
||||
else
|
||||
ta->last_change = (uint32_t)timestamp;
|
||||
ta->last_change = (time_t)timestamp;
|
||||
|
||||
free(comment);
|
||||
return 1;
|
||||
@ -677,12 +677,12 @@ parse_var_line(char* line, struct val_anchors* anchors,
|
||||
} else if(strncmp(line, ";;query_interval: ", 18) == 0) {
|
||||
if(!tp) return -1;
|
||||
lock_basic_lock(&tp->lock);
|
||||
tp->autr->query_interval = (uint32_t)parse_int(line+18, &r);
|
||||
tp->autr->query_interval = (time_t)parse_int(line+18, &r);
|
||||
lock_basic_unlock(&tp->lock);
|
||||
} else if(strncmp(line, ";;retry_time: ", 14) == 0) {
|
||||
if(!tp) return -1;
|
||||
lock_basic_lock(&tp->lock);
|
||||
tp->autr->retry_time = (uint32_t)parse_int(line+14, &r);
|
||||
tp->autr->retry_time = (time_t)parse_int(line+14, &r);
|
||||
lock_basic_unlock(&tp->lock);
|
||||
}
|
||||
return r;
|
||||
@ -881,6 +881,8 @@ print_id(FILE* out, char* fname, struct module_env* env,
|
||||
ldns_buffer_clear(env->scratch_buffer);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
s =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
ldns_rdf2buffer_str_dname(env->scratch_buffer, &rdf);
|
||||
log_assert(s == LDNS_STATUS_OK);
|
||||
@ -976,9 +978,13 @@ void autr_write_file(struct module_env* env, struct trust_anchor* tp)
|
||||
char* fname = tp->autr->file;
|
||||
char tempf[2048];
|
||||
log_assert(tp->autr);
|
||||
if(!env) {
|
||||
log_err("autr_write_file: Module environment is NULL.");
|
||||
return;
|
||||
}
|
||||
/* unique name with pid number and thread number */
|
||||
snprintf(tempf, sizeof(tempf), "%s.%d-%d", fname, (int)getpid(),
|
||||
env&&env->worker?*(int*)env->worker:0);
|
||||
env->worker?*(int*)env->worker:0);
|
||||
verbose(VERB_ALGO, "autotrust: write to disk: %s", tempf);
|
||||
out = fopen(tempf, "w");
|
||||
if(!out) {
|
||||
@ -1031,23 +1037,23 @@ verify_dnskey(struct module_env* env, struct val_env* ve,
|
||||
}
|
||||
|
||||
/** Find minimum expiration interval from signatures */
|
||||
static uint32_t
|
||||
static time_t
|
||||
min_expiry(struct module_env* env, ldns_rr_list* rrset)
|
||||
{
|
||||
size_t i;
|
||||
uint32_t t, r = 15 * 24 * 3600; /* 15 days max */
|
||||
int32_t t, r = 15 * 24 * 3600; /* 15 days max */
|
||||
for(i=0; i<ldns_rr_list_rr_count(rrset); i++) {
|
||||
ldns_rr* rr = ldns_rr_list_rr(rrset, i);
|
||||
if(ldns_rr_get_type(rr) != LDNS_RR_TYPE_RRSIG)
|
||||
continue;
|
||||
t = ldns_rdf2native_int32(ldns_rr_rrsig_expiration(rr));
|
||||
if(t - *env->now > 0) {
|
||||
if((int32_t)t - (int32_t)*env->now > 0) {
|
||||
t -= *env->now;
|
||||
if(t < r)
|
||||
r = t;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
return (time_t)r;
|
||||
}
|
||||
|
||||
/** Is rr self-signed revoked key */
|
||||
@ -1239,7 +1245,7 @@ add_key(struct trust_anchor* tp, ldns_rr* rr)
|
||||
}
|
||||
|
||||
/** get TTL from DNSKEY rrset */
|
||||
static uint32_t
|
||||
static time_t
|
||||
key_ttl(struct ub_packed_rrset_key* k)
|
||||
{
|
||||
struct packed_rrset_data* d = (struct packed_rrset_data*)k->entry.data;
|
||||
@ -1248,10 +1254,10 @@ key_ttl(struct ub_packed_rrset_key* k)
|
||||
|
||||
/** update the time values for the trustpoint */
|
||||
static void
|
||||
set_tp_times(struct trust_anchor* tp, uint32_t rrsig_exp_interval,
|
||||
uint32_t origttl, int* changed)
|
||||
set_tp_times(struct trust_anchor* tp, time_t rrsig_exp_interval,
|
||||
time_t origttl, int* changed)
|
||||
{
|
||||
uint32_t x, qi = tp->autr->query_interval, rt = tp->autr->retry_time;
|
||||
time_t x, qi = tp->autr->query_interval, rt = tp->autr->retry_time;
|
||||
|
||||
/* x = MIN(15days, ttl/2, expire/2) */
|
||||
x = 15 * 24 * 3600;
|
||||
@ -1444,21 +1450,21 @@ update_events(struct module_env* env, struct val_env* ve,
|
||||
* @param holddown: the timer value
|
||||
* @return number of seconds the holddown has passed.
|
||||
*/
|
||||
static int
|
||||
check_holddown(struct module_env* env, struct autr_ta* ta,
|
||||
static time_t
|
||||
check_holddown(struct module_env* env, struct autr_ta* ta,
|
||||
unsigned int holddown)
|
||||
{
|
||||
unsigned int elapsed;
|
||||
if((unsigned)*env->now < (unsigned)ta->last_change) {
|
||||
time_t elapsed;
|
||||
if(*env->now < ta->last_change) {
|
||||
log_warn("time goes backwards. delaying key holddown");
|
||||
return 0;
|
||||
}
|
||||
elapsed = (unsigned)*env->now - (unsigned)ta->last_change;
|
||||
if (elapsed > holddown) {
|
||||
return (int) (elapsed-holddown);
|
||||
elapsed = *env->now - ta->last_change;
|
||||
if (elapsed > (time_t)holddown) {
|
||||
return elapsed-(time_t)holddown;
|
||||
}
|
||||
verbose_key(ta, VERB_ALGO, "holddown time %d seconds to go",
|
||||
(int) (holddown-elapsed));
|
||||
verbose_key(ta, VERB_ALGO, "holddown time %lld seconds to go",
|
||||
(long long) ((time_t)holddown-elapsed));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1498,11 +1504,11 @@ do_addtime(struct module_env* env, struct autr_ta* anchor, int* c)
|
||||
/* This not according to RFC, this is 30 days, but the RFC demands
|
||||
* MAX(30days, TTL expire time of first DNSKEY set with this key),
|
||||
* The value may be too small if a very large TTL was used. */
|
||||
int exceeded = check_holddown(env, anchor, env->cfg->add_holddown);
|
||||
time_t exceeded = check_holddown(env, anchor, env->cfg->add_holddown);
|
||||
if (exceeded && anchor->s == AUTR_STATE_ADDPEND) {
|
||||
verbose_key(anchor, VERB_ALGO, "add-holddown time exceeded "
|
||||
"%d seconds ago, and pending-count %d", exceeded,
|
||||
anchor->pending_count);
|
||||
"%lld seconds ago, and pending-count %d",
|
||||
(long long)exceeded, anchor->pending_count);
|
||||
if(anchor->pending_count >= MIN_PENDINGCOUNT) {
|
||||
set_trustanchor_state(env, anchor, c, AUTR_STATE_VALID);
|
||||
anchor->pending_count = 0;
|
||||
@ -1517,10 +1523,10 @@ do_addtime(struct module_env* env, struct autr_ta* anchor, int* c)
|
||||
static void
|
||||
do_remtime(struct module_env* env, struct autr_ta* anchor, int* c)
|
||||
{
|
||||
int exceeded = check_holddown(env, anchor, env->cfg->del_holddown);
|
||||
time_t exceeded = check_holddown(env, anchor, env->cfg->del_holddown);
|
||||
if(exceeded && anchor->s == AUTR_STATE_REVOKED) {
|
||||
verbose_key(anchor, VERB_ALGO, "del-holddown time exceeded "
|
||||
"%d seconds ago", exceeded);
|
||||
"%lld seconds ago", (long long)exceeded);
|
||||
set_trustanchor_state(env, anchor, c, AUTR_STATE_REMOVED);
|
||||
}
|
||||
}
|
||||
@ -1649,7 +1655,7 @@ remove_missing_trustanchors(struct module_env* env, struct trust_anchor* tp,
|
||||
int* changed)
|
||||
{
|
||||
struct autr_ta* anchor;
|
||||
int exceeded;
|
||||
time_t exceeded;
|
||||
int valid = 0;
|
||||
/* see if we have anchors that are valid */
|
||||
for(anchor = tp->autr->keys; anchor; anchor = anchor->next) {
|
||||
@ -1697,8 +1703,8 @@ remove_missing_trustanchors(struct module_env* env, struct trust_anchor* tp,
|
||||
* one valid KSK: remove missing trust anchor */
|
||||
if (exceeded && valid > 0) {
|
||||
verbose_key(anchor, VERB_ALGO, "keep-missing time "
|
||||
"exceeded %d seconds ago, [%d key(s) VALID]",
|
||||
exceeded, valid);
|
||||
"exceeded %lld seconds ago, [%d key(s) VALID]",
|
||||
(long long)exceeded, valid);
|
||||
set_trustanchor_state(env, anchor, changed,
|
||||
AUTR_STATE_REMOVED);
|
||||
}
|
||||
@ -1762,15 +1768,15 @@ autr_cleanup_keys(struct trust_anchor* tp)
|
||||
|
||||
/** calculate next probe time */
|
||||
static time_t
|
||||
calc_next_probe(struct module_env* env, uint32_t wait)
|
||||
calc_next_probe(struct module_env* env, time_t wait)
|
||||
{
|
||||
/* make it random, 90-100% */
|
||||
uint32_t rnd, rest;
|
||||
time_t rnd, rest;
|
||||
if(wait < 3600)
|
||||
wait = 3600;
|
||||
rnd = wait/10;
|
||||
rest = wait-rnd;
|
||||
rnd = (uint32_t)ub_random_max(env->rnd, (long int)rnd);
|
||||
rnd = (time_t)ub_random_max(env->rnd, (long int)rnd);
|
||||
return (time_t)(*env->now + rest + rnd);
|
||||
}
|
||||
|
||||
@ -1790,7 +1796,7 @@ reset_worker_timer(struct module_env* env)
|
||||
{
|
||||
struct timeval tv;
|
||||
#ifndef S_SPLINT_S
|
||||
uint32_t next = (uint32_t)wait_probe_time(env->anchors);
|
||||
time_t next = (time_t)wait_probe_time(env->anchors);
|
||||
/* in case this is libunbound, no timer */
|
||||
if(!env->probe_timer)
|
||||
return;
|
||||
@ -1800,7 +1806,7 @@ reset_worker_timer(struct module_env* env)
|
||||
#endif
|
||||
tv.tv_usec = 0;
|
||||
comm_timer_set(env->probe_timer, &tv);
|
||||
verbose(VERB_ALGO, "scheduled next probe in %d sec", (int)tv.tv_sec);
|
||||
verbose(VERB_ALGO, "scheduled next probe in %lld sec", (long long)tv.tv_sec);
|
||||
}
|
||||
|
||||
/** set next probe for trust anchor */
|
||||
@ -2156,7 +2162,7 @@ probe_anchor(struct module_env* env, struct trust_anchor* tp)
|
||||
|
||||
/** fetch first to-probe trust-anchor and lock it and set retrytime */
|
||||
static struct trust_anchor*
|
||||
todo_probe(struct module_env* env, uint32_t* next)
|
||||
todo_probe(struct module_env* env, time_t* next)
|
||||
{
|
||||
struct trust_anchor* tp;
|
||||
rbnode_t* el;
|
||||
@ -2171,9 +2177,9 @@ todo_probe(struct module_env* env, uint32_t* next)
|
||||
lock_basic_lock(&tp->lock);
|
||||
|
||||
/* is it eligible? */
|
||||
if((uint32_t)tp->autr->next_probe_time > *env->now) {
|
||||
if((time_t)tp->autr->next_probe_time > *env->now) {
|
||||
/* no more to probe */
|
||||
*next = (uint32_t)tp->autr->next_probe_time - *env->now;
|
||||
*next = (time_t)tp->autr->next_probe_time - *env->now;
|
||||
lock_basic_unlock(&tp->lock);
|
||||
lock_basic_unlock(&env->anchors->lock);
|
||||
return NULL;
|
||||
@ -2188,11 +2194,11 @@ todo_probe(struct module_env* env, uint32_t* next)
|
||||
return tp;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
time_t
|
||||
autr_probe_timer(struct module_env* env)
|
||||
{
|
||||
struct trust_anchor* tp;
|
||||
uint32_t next_probe = 3600;
|
||||
time_t next_probe = 3600;
|
||||
int num = 0;
|
||||
verbose(VERB_ALGO, "autotrust probe timer callback");
|
||||
/* while there are still anchors to probe */
|
||||
|
@ -104,9 +104,9 @@ struct autr_point_data {
|
||||
time_t next_probe_time;
|
||||
|
||||
/** when to query if !failed */
|
||||
uint32_t query_interval;
|
||||
time_t query_interval;
|
||||
/** when to retry if failed */
|
||||
uint32_t retry_time;
|
||||
time_t retry_time;
|
||||
|
||||
/**
|
||||
* How many times did it fail. diagnostic only (has no effect).
|
||||
@ -151,7 +151,7 @@ size_t autr_get_num_anchors(struct val_anchors* anchors);
|
||||
* @return time of next probe (in seconds from now).
|
||||
* If 0, then there is no next probe anymore (trust points deleted).
|
||||
*/
|
||||
uint32_t autr_probe_timer(struct module_env* env);
|
||||
time_t autr_probe_timer(struct module_env* env);
|
||||
|
||||
/** probe tree compare function */
|
||||
int probetree_cmp(const void* x, const void* y);
|
||||
|
@ -242,6 +242,8 @@ anchor_new_ta(struct val_anchors* anchors, uint8_t* name, int namelabs,
|
||||
}
|
||||
#ifdef UNBOUND_DEBUG
|
||||
r =
|
||||
#else
|
||||
(void)
|
||||
#endif
|
||||
rbtree_insert(anchors->tree, &ta->node);
|
||||
if(lockit) {
|
||||
@ -900,7 +902,7 @@ assemble_it(struct trust_anchor* ta, size_t num, uint16_t type)
|
||||
free(pkey);
|
||||
return NULL;
|
||||
}
|
||||
pd->rr_ttl = (uint32_t*)malloc(num*sizeof(uint32_t));
|
||||
pd->rr_ttl = (time_t*)malloc(num*sizeof(time_t));
|
||||
if(!pd->rr_ttl) {
|
||||
free(pd->rr_len);
|
||||
free(pd);
|
||||
|
@ -126,7 +126,7 @@ key_cache_search(struct key_cache* kcache, uint8_t* name, size_t namelen,
|
||||
|
||||
struct key_entry_key*
|
||||
key_cache_obtain(struct key_cache* kcache, uint8_t* name, size_t namelen,
|
||||
uint16_t key_class, struct regional* region, uint32_t now)
|
||||
uint16_t key_class, struct regional* region, time_t now)
|
||||
{
|
||||
/* keep looking until we find a nonexpired entry */
|
||||
while(1) {
|
||||
|
@ -106,7 +106,7 @@ void key_cache_remove(struct key_cache* kcache,
|
||||
*/
|
||||
struct key_entry_key* key_cache_obtain(struct key_cache* kcache,
|
||||
uint8_t* name, size_t namelen, uint16_t key_class,
|
||||
struct regional* region, uint32_t now);
|
||||
struct regional* region, time_t now);
|
||||
|
||||
/**
|
||||
* Get memory in use by the key cache.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user