This commit is contained in:
Wouter Wijngaards 2026-02-05 17:12:11 +01:00 committed by GitHub
commit 9b319396d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 677 additions and 54202 deletions

View file

@ -175,8 +175,38 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: false
submodules: recursive
persist-credentials: false
- name: test_windows_configure
if: ${{ matrix.test_windows == 'yes' }}
shell: bash
run: |
# The run starts with mount points for /c, /d, and
# C:/Program Files/Git on /
# C:/Program Files/Git/usr/bin on /bin
# C:/Users/RUNNER~1/AppData/Local/Temp on /tmp
echo "mount"
mount || echo "ignored"
echo "mount -o bind /c/msys64/usr /usr"
mount -o bind /c/msys64/usr /usr || echo "ignored"
# Now there is:
# C:/msys64 on /
# C:/msys64/usr/bin on /bin
# And those mount points should go away for the next 'run:' shell.
echo "mount"
mount || echo "ignored"
# probably installs to C:\msys64\usr\bin\bash.exe
echo "pacman -S --noconfirm autotools"
C:/msys64/usr/bin/pacman -S --noconfirm autotools
echo "rm -f aclocal.m4"
rm -f aclocal.m4
# The paths are mounted, so that /c/msys64/usr/share/autoconf-..,
# /c/msys64/usr/share/aclocal-.., /c/msys64/usr/share/automake-..
# are in /usr. Also for /usr/bin, autoreconf is from
# /c/msys64/usr/bin.
echo "autoreconf -fi"
#PATH="/c/msys64/usr/bin:$PATH" autoreconf -fi || echo "ignored"
autoreconf -fi
- name: test_windows
if: ${{ matrix.test_windows == 'yes' }}
env:
@ -189,6 +219,9 @@ jobs:
cd ..
export prepath=`pwd`
echo prepath=${prepath}
# The mount should have the git directories.
echo "mount"
mount || echo "ignored"
echo "choco install winflexbison3"
choco install winflexbison3
echo 'LEX="win_flex"'
@ -206,7 +239,7 @@ jobs:
#sed -e 's/use Pod::Usage//' < Configure > Configure.fix
# ./Configure.fix no-shared no-asm -DOPENSSL_NO_CAPIENG mingw64 --prefix="$prepath/openssl"
# pacman is used to install for msys2, with
# C:/msys64/usr/bin/pacman -S perl
# C:/msys64/usr/bin/pacman -S --noconfirm perl
echo "C:/msys64/usr/bin/perl ./Configure no-shared no-asm -DOPENSSL_NO_CAPIENG mingw64 --prefix=\""$prepath/openssl"\" PERL=\"C:/msys64/usr/bin/perl\""
C:/msys64/usr/bin/perl ./Configure no-shared no-asm -DOPENSSL_NO_CAPIENG mingw64 --prefix="$prepath/openssl" PERL="C:/msys64/usr/bin/perl"
# make the libs only, build faster
@ -295,6 +328,8 @@ jobs:
./contrib/android/install_expat.sh
echo "::endgroup::"
echo "::group::configure"
echo "autoreconf -fi"
autoreconf -fi
echo "./configure ${CONFIG_OPTS}"
./configure ${CONFIG_OPTS}
echo "::endgroup::"
@ -314,6 +349,7 @@ jobs:
IOS_CPU: ${{ matrix.IOS_CPU }}
run: |
#(already installed) ./contrib/ios/install_tools.sh
brew install autoconf automake libtool make
export AUTOTOOLS_BUILD="$(./config.guess)"
echo AUTOTOOLS_BUILD=${AUTOTOOLS_BUILD}
export IOS_PREFIX="$HOME/$IOS_SDK-$IOS_CPU"
@ -335,6 +371,8 @@ jobs:
./contrib/ios/install_expat.sh
echo "::endgroup::"
echo "::group::configure"
echo "autoreconf -fi"
autoreconf -fi
echo "./configure ${CONFIG_OPTS}"
./configure ${CONFIG_OPTS}
echo "::endgroup::"
@ -360,10 +398,12 @@ jobs:
cpu_count: 2
run: |
set -e -x
if test "$CROSS_PLATFORM_OS" = "freebsd"; then sudo pkg install -y openssl libevent expat; fi
if test "$CROSS_PLATFORM_OS" = "openbsd"; then sudo pkg_add libevent; fi
if test "$CROSS_PLATFORM_OS" = "netbsd"; then sudo pkgin -y install libevent; fi
if test "$CROSS_PLATFORM_OS" = "freebsd"; then sudo pkg install -y autoconf automake libtool pkgconf openssl libevent expat; fi
if test "$CROSS_PLATFORM_OS" = "openbsd"; then sudo pkg_add autoconf-2.71 automake-1.16.5 libtool pkgconf libevent; export AUTOCONF_VERSION="2.71"; export AUTOMAKE_VERSION="1.16"; fi
if test "$CROSS_PLATFORM_OS" = "netbsd"; then sudo pkgin -y install autoconf automake libtool pkgconf libevent; export LDFLAGS="-Wl,--rpath=/usr/pkg/lib"; fi
echo "::group::configure"
rm -f aclocal.m4
autoreconf -fi
./configure ${{ matrix.cross_platform_config }}
echo "::endgroup::"
echo "::group::make"
@ -377,10 +417,15 @@ jobs:
run: sudo apt-get install libevent-dev
- name: install expat
if: ${{ matrix.install_expat == 'yes' }}
run: brew install expat
run: |
brew install expat
brew install autoconf automake libtool make
- name: configure
if: ${{ matrix.config != 'no' }}
run: ./configure ${{ matrix.config }}
run: |
if test `uname` = "Linux"; then sudo apt-get install autoconf automake libtool make; fi
autoreconf -fi
./configure ${{ matrix.config }}
- name: make
if: ${{ matrix.make != 'no' }}
run: make

View file

@ -14,9 +14,14 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: false
- name: install packages
run: sudo apt-get install autoconf automake libtool make
- name: configure
run: ./configure --enable-debug
run: |
autoreconf -fi
./configure --enable-debug
- name: make
run: make
- name: make test

8
.gitignore vendored
View file

@ -3,11 +3,17 @@
/.libs/
/.source
/Makefile
/aclocal.m4
/autom4te.cache/
/config.guess
/config.h
/config.h.in
/config.h.in~
/config.log
/config.status
/config.sub
/configure
/configure~
/dnstap/dnstap_config.h
/dnscrypt/dnscrypt_config.h
/util/configlexer.c
@ -22,8 +28,10 @@
/doc/unbound-host.1
/doc/unbound.8
/doc/unbound.conf.5
/install-sh
/libtool
/libunbound.la
/ltmain.sh
/_unbound.la
/smallapp/unbound-control-setup.sh
/unbound

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "simdzone"]
path = simdzone
url = https://github.com/NLnetLabs/simdzone.git

View file

@ -56,7 +56,7 @@ YACC=@YACC@
LEX=@LEX@
STRIP=@STRIP@
CC=@CC@
CPPFLAGS=-I. @CPPFLAGS@
CPPFLAGS=-I. @CPPFLAGS@ -Isimdzone/include -I@srcdir@/simdzone/include
PYTHON_CPPFLAGS=-I. -I$(srcdir) @PYTHON_CPPFLAGS@
CFLAGS=-DSRCDIR=$(srcdir) @CFLAGS@
LDFLAGS=@LDFLAGS@
@ -267,6 +267,7 @@ LIBUNBOUND_SRC=libunbound/context.c libunbound/libunbound.c \
libunbound/libworker.c
LIBUNBOUND_OBJ=context.lo libunbound.lo libworker.lo ub_event_pluggable.lo
LIBUNBOUND_OBJ_LINK=$(LIBUNBOUND_OBJ) $(COMMON_OBJ_WITHOUT_UB_EVENT) $(SLDNS_OBJ) $(COMPAT_OBJ)
SIMDZONE_OBJ=@SIMDZONE_OBJ@
# win apps or "" if not on windows
WINAPPS=@WINAPPS@
@ -364,19 +365,24 @@ longtest: tests
if test ! $(srcdir)/testdata -ef ./testdata; then rm -rf testcode testdata; mkdir testcode testdata; cp -R $(srcdir)/testdata/*.sh $(srcdir)/testdata/*.tdir $(srcdir)/testdata/*.rpl $(srcdir)/testdata/*.crpl testdata; cp $(srcdir)/testcode/*.sh testcode; if test ! -d util; then mkdir util; fi; cp $(srcdir)/util/iana_ports.inc util; fi
if test -x "`which bash`"; then bash testcode/do-tests.sh; else sh testcode/do-tests.sh; fi
simdzone/libzone.la:
$(MAKE) -C simdzone
simdzone/include/zone/export.h: simdzone/libzone.la
lib: libunbound.la unbound.h
libunbound.la: $(LIBUNBOUND_OBJ_LINK)
$(LINK_LIB) $(UBSYMS) -o $@ $(LIBUNBOUND_OBJ_LINK) -rpath $(libdir) $(SSLLIB) $(LIBS)
libunbound.la: simdzone/libzone.la $(LIBUNBOUND_OBJ_LINK)
$(LINK_LIB) $(UBSYMS) -o $@ $(LIBUNBOUND_OBJ_LINK) $(SIMDZONE_OBJ) -rpath $(libdir) $(SSLLIB) $(LIBS)
unbound$(EXEEXT): $(DAEMON_OBJ_LINK) libunbound.la
$(LINK) -o $@ $(DAEMON_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
$(LINK) -o $@ $(DAEMON_OBJ_LINK) $(EXTRALINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
unbound-checkconf$(EXEEXT): $(CHECKCONF_OBJ_LINK) libunbound.la
$(LINK) -o $@ $(CHECKCONF_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(CHECKCONF_OBJ_LINK) $(EXTRALINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
unbound-control$(EXEEXT): $(CONTROL_OBJ_LINK) libunbound.la
$(LINK) -o $@ $(CONTROL_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(CONTROL_OBJ_LINK) $(EXTRALINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
unbound-host$(EXEEXT): $(HOST_OBJ_LINK) libunbound.la
$(LINK) -o $@ $(HOST_OBJ_LINK) libunbound.la $(SSLLIB) $(LIBS)
@ -394,43 +400,43 @@ anchor-update$(EXEEXT): $(ANCHORUPD_OBJ_LINK) libunbound.la
$(LINK) -o $@ $(ANCHORUPD_OBJ_LINK) libunbound.la $(LIBS)
unittest$(EXEEXT): $(UNITTEST_OBJ_LINK)
$(LINK) -o $@ $(UNITTEST_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(UNITTEST_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
testbound$(EXEEXT): $(TESTBOUND_OBJ_LINK)
$(LINK) -o $@ $(TESTBOUND_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(TESTBOUND_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
lock-verify$(EXEEXT): $(LOCKVERIFY_OBJ_LINK)
$(LINK) -o $@ $(LOCKVERIFY_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(LOCKVERIFY_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
petal$(EXEEXT): $(PETAL_OBJ_LINK)
$(LINK) -o $@ $(PETAL_OBJ_LINK) $(SSLLIB) $(LIBS)
pktview$(EXEEXT): $(PKTVIEW_OBJ_LINK)
$(LINK) -o $@ $(PKTVIEW_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(PKTVIEW_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
memstats$(EXEEXT): $(MEMSTATS_OBJ_LINK)
$(LINK) -o $@ $(MEMSTATS_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(MEMSTATS_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
asynclook$(EXEEXT): $(ASYNCLOOK_OBJ_LINK) libunbound.la
$(LINK) -o $@ $(ASYNCLOOK_OBJ_LINK) libunbound.la $(SSLLIB) $(LIBS)
streamtcp$(EXEEXT): $(STREAMTCP_OBJ_LINK)
$(LINK) -o $@ $(STREAMTCP_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(STREAMTCP_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
dohclient$(EXEEXT): $(DOHCLIENT_OBJ_LINK)
$(LINK) -o $@ $(DOHCLIENT_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(DOHCLIENT_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
doqclient$(EXEEXT): $(DOQCLIENT_OBJ_LINK)
$(LINK) -o $@ $(DOQCLIENT_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(DOQCLIENT_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
perf$(EXEEXT): $(PERF_OBJ_LINK)
$(LINK) -o $@ $(PERF_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(PERF_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
delayer$(EXEEXT): $(DELAYER_OBJ_LINK)
$(LINK) -o $@ $(DELAYER_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(DELAYER_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
readzone$(EXEEXT): $(READZONE_OBJ_LINK)
$(LINK) -o $@ $(READZONE_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(READZONE_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
signit$(EXEEXT): testcode/signit.c
$(CC) $(CPPFLAGS) $(CFLAGS) @PTHREAD_CFLAGS_ONLY@ -o $@ testcode/signit.c $(LDFLAGS) -lldns $(SSLLIB) $(LIBS)
@ -458,7 +464,7 @@ dnstap/dnstap.pb-c.h: dnstap/dnstap.pb-c.c
touch $@
unbound-dnstap-socket$(EXEEXT): $(DNSTAP_SOCKET_OBJ_LINK)
$(LINK) -o $@ $(DNSTAP_SOCKET_OBJ_LINK) $(SSLLIB) $(LIBS)
$(LINK) -o $@ $(DNSTAP_SOCKET_OBJ_LINK) $(SIMDZONE_OBJ) $(SSLLIB) $(LIBS)
dnstap.pb-c.lo dnstap.pb-c.o: dnstap/dnstap.pb-c.c dnstap/dnstap.pb-c.h
dtstream.lo dtstream.o: $(srcdir)/dnstap/dtstream.c config.h $(srcdir)/dnstap/dtstream.h
@ -522,7 +528,9 @@ util/configparser.c: $(srcdir)/util/configparser.y
util/configparser.h: util/configparser.c
touch $@
clean:
.PHONY: .clean .distclean .maintainer-clean .realclean .devclean
.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 unbound.h
rm -f $(ALL_SRC:.c=.lint)
@ -530,19 +538,37 @@ clean:
rm -f libunbound.a
rm -rf autom4te.cache .libs build doc/html doc/xml
distclean: clean
.distclean: .clean
rm -f config.status config.log config.h
rm -f doc/example.conf doc/libunbound.3 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound-control.8 doc/unbound.8 doc/unbound.conf.5 doc/unbound-host.1
rm -f smallapp/unbound-control-setup.sh dnstap/dnstap_config.h dnscrypt/dnscrypt_config.h contrib/libunbound.pc contrib/unbound.socket contrib/unbound.service
rm -f $(TEST_BIN)
rm -f Makefile
maintainer-clean: distclean
.maintainer-clean: .distclean
rm -f util/configlexer.c util/configparser.c util/configparser.h
realclean: maintainer-clean
.realclean: .maintainer-clean
rm -f configure config.h.in config.sub config.guess ltmain.sh aclocal.m4 libtool
.devclean: .realclean
rm -f config.h.in configure
clean: .clean
$(MAKE) -C simdzone clean
distclean: .distclean
$(MAKE) -C simdzone distclean
realclean: .realclean
$(MAKE) -C simdzone realclean
maintainer-clean: .maintainer-clean
$(MAKE) -C simdzone maintainer-clean
devclean: .devclean
$(MAKE) -C simdzone devclean
.SUFFIXES: .lint
.c.lint:
$(LINT) $(LINTFLAGS) -I. -I$(srcdir) $<
@ -703,6 +729,7 @@ depend:
-e 's?$$(srcdir)/edns-subnet/subnetmod.h $$(srcdir)/edns-subnet/subnet-whitelist.h $$(srcdir)/edns-subnet/edns-subnet.h $$(srcdir)/edns-subnet/addrtree.h?$$(SUBNET_HEADER)?g' \
-e 's?$$(srcdir)/ipsecmod/ipsecmod.h $$(srcdir)/ipsecmod/ipsecmod-whitelist.h?$$(IPSECMOD_HEADER)?g' \
-e 's?$$(srcdir)/dynlibmod/dynlibmod.h?$$(DYNLIBMOD_HEADER)?g' \
-e 's?$$(srcdir)/simdzone/include/zone/export.h?simdzone/include/zone/export.h?g' \
-e 's!\(.*\)\.o[ :]*!\1.lo \1.o: !g' \
> $(DEPEND_TMP)
cp $(DEPEND_TARGET) $(DEPEND_TMP2)
@ -1000,7 +1027,9 @@ authzone.lo authzone.o: $(srcdir)/services/authzone.c config.h $(srcdir)/service
$(srcdir)/services/listen_dnsport.h $(srcdir)/daemon/acl_list.h \
$(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/keyraw.h \
$(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_nsec.h $(srcdir)/validator/val_secalgo.h \
$(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_anchor.h $(srcdir)/validator/val_utils.h
$(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_anchor.h $(srcdir)/validator/val_utils.h \
$(srcdir)/simdzone/include/zone.h $(srcdir)/simdzone/include/zone/attributes.h \
simdzone/include/zone/export.h
fptr_wlist.lo fptr_wlist.o: $(srcdir)/util/fptr_wlist.c config.h $(srcdir)/util/fptr_wlist.h \
$(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \
$(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \

1
README
View file

@ -1,4 +1,5 @@
Unbound README
* From source repository: git submodule update --init && autoreconf -fi
* ./configure && make && make install
* You can use libevent if you want. libevent is useful when using
many (10000) outgoing ports. By default max 256 ports are opened at

View file

@ -19,6 +19,14 @@ You can learn more about Unbound by reading our
Make sure you have the C toolchain, OpenSSL and its include files, and libexpat
installed.
If building from the repository source you also need flex and bison installed.
If building from the repository source, also init the git submodule and
create the configure script with:
```
git submodule update --init
autoreconf -fi
```
Unbound can be compiled and installed using:
```

9440
aclocal.m4 vendored

File diff suppressed because it is too large Load diff

1812
config.guess vendored

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

1971
config.sub vendored

File diff suppressed because it is too large Load diff

27537
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -177,6 +177,12 @@ else
else on_mingw="no"; fi
fi
dnl install the install-sh file with libtoolize -ci, and autoreconf -fi.
AC_REQUIRE_AUX_FILE([install-sh])
if test ! -f install-sh; then
AC_MSG_WARN([./install-sh is missing, use `libtoolize -ci` or `autoreconf -fi` to add it])
fi
#
# Determine configuration file
# the eval is to evaluate shell expansion twice
@ -2036,6 +2042,9 @@ dt_DNSTAP([$UNBOUND_RUN_DIR/dnstap.sock],
AC_SUBST([ENABLE_DNSTAP], [0])
]
)
dnstap_config="dnstap/dnstap_config.h.tmp:dnstap/dnstap_config.h.in"
dnstap_config_tmp="dnstap/dnstap_config.h.tmp"
dnstap_config_out="dnstap/dnstap_config.h"
# check for dnscrypt if requested
dnsc_DNSCRYPT([
@ -2490,6 +2499,34 @@ AC_SUBST(version, [VERSION_MAJOR.VERSION_MINOR.VERSION_MICRO])
AX_BUILD_DATE_EPOCH(date, [[%b %e, %Y]])
AC_SUBST(date)
AC_CONFIG_FILES([Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound.conf.5 doc/unbound-control.8 doc/unbound-host.1 smallapp/unbound-control-setup.sh dnstap/dnstap_config.h dnscrypt/dnscrypt_config.h contrib/libunbound.pc contrib/unbound.socket contrib/unbound.service contrib/unbound_portable.service])
AC_CONFIG_FILES([Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound.conf.5 doc/unbound-control.8 doc/unbound-host.1 smallapp/unbound-control-setup.sh $dnstap_config dnscrypt/dnscrypt_config.h contrib/libunbound.pc contrib/unbound.socket contrib/unbound.service contrib/unbound_portable.service])
AC_CONFIG_HEADERS([config.h])
# Arguments introduced specifically for simdzone.
AC_ARG_ENABLE(westmere, AS_HELP_STRING([--disable-westmere], [Disable Westmere (SSE4.2) parser kernel]))
AC_ARG_ENABLE(haswell, AS_HELP_STRING([--disable-haswell], [Disable Haswell (AVX2) parser kernel]))
if test ! -f simdzone/configure.ac; then AC_MSG_ERROR([There is no "simdzone/configure.ac" file. The simdzone directory has not been fetched, perhaps get it with 'git submodule update --init'.]); fi
if test ! -f simdzone/configure; then AC_MSG_ERROR([There is no "simdzone/configure" file. The simdzone directory has no configure script file, perhaps run 'autoreconf -fi'.]); fi
AC_CONFIG_SUBDIRS([simdzone])
AC_OUTPUT
# Pick up the objects for simdzone.
SIMDZONE_OBJ=`(cd simdzone; make list_objs) | sed -e 's?src?simdzone/src?g'`
AC_SUBST(SIMDZONE_OBJ)
sed -e 's?^SIMDZONE_OBJ=.*$?SIMDZONE_OBJ='"$SIMDZONE_OBJ"'?' < Makefile > Makefile.tmp.$$
mv -f Makefile.tmp.$$ Makefile
# If dnstap config has changed, overwrite it.
if test -n "$dnstap_config"; then
if test ! -f "$dnstap_config_out"; then
mv "$dnstap_config_tmp" "$dnstap_config_out" || AC_MSG_ERROR([Could not create $dnstap_config_out])
else if diff "$dnstap_config_out" "$dnstap_config_tmp" >/dev/null 2>&1; then
if test "x$opt_dnstap" != "xno"; then
AC_MSG_NOTICE([In $srcdir: $dnstap_config_out is unchanged])
fi
rm -f "$dnstap_config_tmp"
else
rm -f "$dnstap_config_out"
mv "$dnstap_config_tmp" "$dnstap_config_out" || AC_MSG_ERROR([Could not create $dnstap_config_out])
fi
fi
fi

View file

@ -1007,6 +1007,7 @@ EXCLUDE = ./build \
libunbound/python/doc \
libunbound/python/examples \
./ldns-src \
./simdzone \
README.md \
doc/control_proto_spec.txt \
doc/requirements.txt

View file

@ -1,501 +0,0 @@
#!/usr/bin/sh
# install - install a program, script, or datafile
scriptversion=2013-12-25.23; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

11149
ltmain.sh

File diff suppressed because it is too large Load diff

View file

@ -142,7 +142,7 @@ check_git_repo () {
create_temp_dir () {
# Creating temp directory
info "Creating temporary working directory"
temp_dir=`mktemp -d unbound-dist-XXXXXX`
temp_dir=`mktemp -t -d unbound-dist-XXXXXX`
info "Directory '$temp_dir' created."
cd $temp_dir
}
@ -409,7 +409,14 @@ if [ "$DOWIN" = "yes" ]; then
info "git clone --depth=1 --no-tags -b $GITBRANCH $GITREPO unbound"
git clone --depth=1 --no-tags -b $GITBRANCH $GITREPO unbound || error_cleanup "git clone failed"
cd unbound || error_cleanup "Unbound not exported correctly from git"
rm -rf .git .travis.yml .gitattributes .github .gitignore || error_cleanup "Failed to remove .git tracking and ci information"
git submodule update --init || error_cleanup "Could not fetch submodule"
rm -rf .git .travis.yml .gitattributes .gitmodules .github .gitignore || error_cleanup "Failed to remove .git tracking and ci information"
rm -rf simdzone/.git simdzone/.github simdzone/.gitignore \
simdzone/configure~ simdzone/config.h.in~ simdzone/autom4te.cache \
simdzone/cmake simdzone/CMakeLists.txt simdzone/simdzoneConfig.cmake.in \
simdzone/conanfile.txt simdzone/tests simdzone/.readthedocs.yaml \
simdzone/doc simdzone/scripts || \
error_cleanup "Failed to remove simdzone .git tracking and ci information"
# on a re-configure the cache may no longer be valid...
if test -f mingw32-config.cache; then rm mingw32-config.cache; fi
@ -436,11 +443,14 @@ if [ "$DOWIN" = "yes" ]; then
replace_version "configure.ac" "$version" "$version2"
version="$version2"
info "Rebuilding configure script (autoconf) snapshot."
autoconf -f || error_cleanup "Autoconf failed."
autoreconf -fi || error_cleanup "Autoconf failed."
autoheader -f || error_cleanup "Autoheader failed."
rm -r autom4te* || echo "ignored"
rm -f config.h.in~ || echo "ignore absence of config.h.in~ file."
rm -f configure~ || echo "ignore absence of configure~ file."
rm -r simdzone/autom4te* || echo "ignored"
rm -f simdzone/config.h.in~ || echo "ignore absence of simdzone/config.h.in~ file."
rm -f simdzone/configure~ || echo "ignore absence of simdzone/configure~ file."
fi
if test "`uname`" = "Linux"; then
@ -598,7 +608,15 @@ info "git clone --depth=1 --no-tags -b $GITBRANCH $GITREPO unbound"
git clone --depth=1 --no-tags -b $GITBRANCH $GITREPO unbound || error_cleanup "git clone failed"
cd unbound || error_cleanup "Unbound not exported correctly from git"
rm -rf .git .travis.yml .gitattributes .github .gitignore || error_cleanup "Failed to remove .git tracking and ci information"
git submodule update --init || error_cleanup "Could not fetch submodule"
rm -rf .git .travis.yml .gitattributes .gitmodules .github .gitignore || error_cleanup "Failed to remove .git tracking and ci information"
rm -rf simdzone/.git simdzone/.github simdzone/.gitignore \
simdzone/configure~ simdzone/config.h.in~ simdzone/autom4te.cache \
simdzone/cmake simdzone/CMakeLists.txt simdzone/simdzoneConfig.cmake.in \
simdzone/conanfile.txt simdzone/tests simdzone/.readthedocs.yaml \
simdzone/doc simdzone/scripts || \
error_cleanup "Failed to remove simdzone .git tracking and ci information"
info "Adding libtool utils (libtoolize)."
libtoolize -c --install || libtoolize -c || error_cleanup "Libtoolize failed."
@ -618,11 +636,14 @@ if [ `uname -s | grep -i -c darwin` -ne 0 ]; then
fi
info "Building configure script (autoreconf)."
autoreconf -f || error_cleanup "Autoconf failed."
autoreconf -fi || error_cleanup "Autoconf failed."
rm -r autom4te* || error_cleanup "Failed to remove autoconf cache directory."
rm -f config.h.in~ || echo "ignore absence of config.h.in~ file."
rm -f configure~ || echo "ignore absence of configure~ file."
rm -r simdzone/autom4te* || echo "ignored"
rm -f simdzone/config.h.in~ || echo "ignore absence of simdzone/config.h.in~ file."
rm -f simdzone/configure~ || echo "ignore absence of simdzone/configure~ file."
info "Building lexer and parser."
echo "#include \"config.h\"" > util/configlexer.c || error_cleanup "Failed to create configlexer"
@ -665,10 +686,13 @@ fi
if [ "$RECONFIGURE" = "yes" ]; then
info "Rebuilding configure script (autoconf) snapshot."
autoreconf -f || error_cleanup "Autoconf failed."
autoreconf -fi || error_cleanup "Autoconf failed."
rm -r autom4te* || error_cleanup "Failed to remove autoconf cache directory."
rm -f config.h.in~ || echo "ignore absence of config.h.in~ file."
rm -f configure~ || echo "ignore absence of configure~ file."
rm -r simdzone/autom4te* || echo "ignored"
rm -f simdzone/config.h.in~ || echo "ignore absence of simdzone/config.h.in~ file."
rm -f simdzone/configure~ || echo "ignore absence of simdzone/configure~ file."
fi
replace_all doc/README
@ -685,7 +709,7 @@ info "Renaming Unbound directory to unbound-$version."
cd ..
mv unbound unbound-$version || error_cleanup "Failed to rename unbound directory."
tarfile="../unbound-$version.tar.gz"
tarfile="$cwd/unbound-$version.tar.gz"
if [ -f $tarfile ]; then
(question "The file $tarfile already exists. Overwrite?" \
@ -693,7 +717,7 @@ if [ -f $tarfile ]; then
fi
info "Creating tar unbound-$version.tar.gz"
tar czf ../unbound-$version.tar.gz unbound-$version || error_cleanup "Failed to create tar file."
tar czf $tarfile unbound-$version || error_cleanup "Failed to create tar file."
cleanup

View file

@ -72,7 +72,11 @@
#include "validator/val_sigcrypt.h"
#include "validator/val_anchor.h"
#include "validator/val_utils.h"
#include "zone.h"
#include <ctype.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
/** bytes to use for NSEC3 hash buffer. 20 for sha1 */
#define N3HASHBUFLEN 32
@ -702,13 +706,15 @@ az_rrset_find_rrsig(struct packed_rrset_data* d, uint8_t* rdata, size_t len,
/** see if rdata is duplicate */
static int
rdata_duplicate(struct packed_rrset_data* d, uint8_t* rdata, size_t len)
rdata_duplicate(struct packed_rrset_data* d, uint8_t* rdata_wol, size_t len)
{
size_t i;
size_t i, rdatawl_len = len+2;
uint16_t len16 = htons(len);
for(i=0; i<d->count + d->rrsig_count; i++) {
if(d->rr_len[i] != len)
if(d->rr_len[i] != rdatawl_len)
continue;
if(memcmp(d->rr_data[i], rdata, len) == 0)
if(memcmp(d->rr_data[i], &len16, 2) == 0 &&
memcmp(d->rr_data[i]+2, rdata_wol, len) == 0)
return 1;
}
return 0;
@ -727,6 +733,19 @@ rrsig_rdata_get_type_covered(uint8_t* rdata, size_t rdatalen)
return sldns_read_uint16(rdata+2);
}
/** get rrsig type covered from rdata.
* @param rdata_wol: rdata in wireformat, without the prefix rdlength.
* @param rdatalen: length of rdata buffer.
* @return type covered (or 0).
*/
static uint16_t
rrsig_rdata_get_type_covered_wol(uint8_t* rdata_wol, size_t rdatalen)
{
if(rdatalen < 2)
return 0;
return sldns_read_uint16(rdata_wol);
}
/** remove RR from existing RRset. Also sig, if it is a signature.
* reallocates the packed rrset for a new one, false on alloc failure */
static int
@ -792,7 +811,7 @@ rrset_remove_rr(struct auth_rrset* rrset, size_t index)
/** add RR to existing RRset. If insert_sig is true, add to rrsigs.
* This reallocates the packed rrset for a new one */
static int
rrset_add_rr(struct auth_rrset* rrset, uint32_t rr_ttl, uint8_t* rdata,
rrset_add_rr(struct auth_rrset* rrset, uint32_t rr_ttl, uint8_t* rdata_wol,
size_t rdatalen, int insert_sig)
{
struct packed_rrset_data* d, *old = rrset->data;
@ -800,7 +819,7 @@ rrset_add_rr(struct auth_rrset* rrset, uint32_t rr_ttl, uint8_t* rdata,
d = (struct packed_rrset_data*)calloc(1, packed_rrset_sizeof(old)
+ sizeof(size_t) + sizeof(uint8_t*) + sizeof(time_t)
+ rdatalen);
+ 2 /* rdlen */ + rdatalen);
if(!d) {
log_err("out of memory");
return 0;
@ -823,8 +842,8 @@ rrset_add_rr(struct auth_rrset* rrset, uint32_t rr_ttl, uint8_t* rdata,
memmove(d->rr_len+d->count, old->rr_len+old->count,
old->rrsig_count*sizeof(size_t));
if(!insert_sig)
d->rr_len[d->count-1] = rdatalen;
else d->rr_len[total-1] = rdatalen;
d->rr_len[d->count-1] = rdatalen + 2;
else d->rr_len[total-1] = rdatalen + 2;
packed_rrset_ptr_fixup(d);
if((time_t)rr_ttl < d->ttl)
d->ttl = rr_ttl;
@ -849,10 +868,12 @@ rrset_add_rr(struct auth_rrset* rrset, uint32_t rr_ttl, uint8_t* rdata,
/* insert new value */
if(!insert_sig) {
d->rr_ttl[d->count-1] = rr_ttl;
memmove(d->rr_data[d->count-1], rdata, rdatalen);
sldns_write_uint16(d->rr_data[d->count-1], rdatalen);
memmove(d->rr_data[d->count-1]+2, rdata_wol, rdatalen);
} else {
d->rr_ttl[total-1] = rr_ttl;
memmove(d->rr_data[total-1], rdata, rdatalen);
sldns_write_uint16(d->rr_data[total-1], rdatalen);
memmove(d->rr_data[total-1]+2, rdata_wol, rdatalen);
}
rrset->data = d;
@ -860,10 +881,11 @@ rrset_add_rr(struct auth_rrset* rrset, uint32_t rr_ttl, uint8_t* rdata,
return 1;
}
/** Create new rrset for node with packed rrset with one RR element */
/** Create new rrset for node with packed rrset with one RR element.
* rdata_wol is the rdata without prefixed rdlength. */
static struct auth_rrset*
rrset_create(struct auth_data* node, uint16_t rr_type, uint32_t rr_ttl,
uint8_t* rdata, size_t rdatalen)
uint8_t* rdata_wol, size_t rdatalen)
{
struct auth_rrset* rrset = (struct auth_rrset*)calloc(1,
sizeof(*rrset));
@ -878,7 +900,7 @@ rrset_create(struct auth_data* node, uint16_t rr_type, uint32_t rr_ttl,
/* the rrset data structure, with one RR */
d = (struct packed_rrset_data*)calloc(1,
sizeof(struct packed_rrset_data) + sizeof(size_t) +
sizeof(uint8_t*) + sizeof(time_t) + rdatalen);
sizeof(uint8_t*) + sizeof(time_t) + 2 /* rdlen*/ + rdatalen);
if(!d) {
free(rrset);
log_err("out of memory");
@ -893,9 +915,10 @@ rrset_create(struct auth_data* node, uint16_t rr_type, uint32_t rr_ttl,
d->rr_data[0] = (uint8_t*)&(d->rr_ttl[1]);
/* insert the RR */
d->rr_len[0] = rdatalen;
d->rr_len[0] = rdatalen + 2;
d->rr_ttl[0] = rr_ttl;
memmove(d->rr_data[0], rdata, rdatalen);
sldns_write_uint16(d->rr_data[0], rdatalen);
memmove(d->rr_data[0]+2, rdata_wol, rdatalen);
d->count++;
/* insert rrset into linked list for domain */
@ -1079,14 +1102,14 @@ rrsigs_copy_from_rrset_to_rrsigset(struct auth_rrset* rrset,
* duplicates are ignored */
for(i=rrset->data->count;
i<rrset->data->count+rrset->data->rrsig_count; i++) {
uint8_t* rdata = rrset->data->rr_data[i];
size_t rdatalen = rrset->data->rr_len[i];
uint8_t* rdata_wol = rrset->data->rr_data[i]+2;
size_t rdatalen = rrset->data->rr_len[i]-2;
time_t rr_ttl = rrset->data->rr_ttl[i];
if(rdata_duplicate(rrsigset->data, rdata, rdatalen)) {
if(rdata_duplicate(rrsigset->data, rdata_wol, rdatalen)) {
continue;
}
if(!rrset_add_rr(rrsigset, rr_ttl, rdata, rdatalen, 0))
if(!rrset_add_rr(rrsigset, rr_ttl, rdata_wol, rdatalen, 0))
return 0;
}
return 1;
@ -1096,32 +1119,35 @@ rrsigs_copy_from_rrset_to_rrsigset(struct auth_rrset* rrset,
* rdata points to buffer with rdatalen octets, starts with 2bytelength. */
static int
az_domain_add_rr(struct auth_data* node, uint16_t rr_type, uint32_t rr_ttl,
uint8_t* rdata, size_t rdatalen, int* duplicate)
uint8_t* rdata_wol, size_t rdatalen, int* duplicate)
{
struct auth_rrset* rrset;
/* packed rrsets have their rrsigs along with them, sort them out */
if(rr_type == LDNS_RR_TYPE_RRSIG) {
uint16_t ctype = rrsig_rdata_get_type_covered(rdata, rdatalen);
uint16_t ctype = rrsig_rdata_get_type_covered_wol(rdata_wol,
rdatalen);
if((rrset=az_domain_rrset(node, ctype))!= NULL) {
/* a node of the correct type exists, add the RRSIG
* to the rrset of the covered data type */
if(rdata_duplicate(rrset->data, rdata, rdatalen)) {
if(rdata_duplicate(rrset->data, rdata_wol, rdatalen)) {
if(duplicate) *duplicate = 1;
return 1;
}
if(!rrset_add_rr(rrset, rr_ttl, rdata, rdatalen, 1))
if(!rrset_add_rr(rrset, rr_ttl, rdata_wol, rdatalen,
1))
return 0;
} else if((rrset=az_domain_rrset(node, rr_type))!= NULL) {
/* add RRSIG to rrset of type RRSIG */
if(rdata_duplicate(rrset->data, rdata, rdatalen)) {
if(rdata_duplicate(rrset->data, rdata_wol, rdatalen)) {
if(duplicate) *duplicate = 1;
return 1;
}
if(!rrset_add_rr(rrset, rr_ttl, rdata, rdatalen, 0))
if(!rrset_add_rr(rrset, rr_ttl, rdata_wol, rdatalen,
0))
return 0;
} else {
/* create rrset of type RRSIG */
if(!rrset_create(node, rr_type, rr_ttl, rdata,
if(!rrset_create(node, rr_type, rr_ttl, rdata_wol,
rdatalen))
return 0;
}
@ -1129,17 +1155,18 @@ az_domain_add_rr(struct auth_data* node, uint16_t rr_type, uint32_t rr_ttl,
/* normal RR type */
if((rrset=az_domain_rrset(node, rr_type))!= NULL) {
/* add data to existing node with data type */
if(rdata_duplicate(rrset->data, rdata, rdatalen)) {
if(rdata_duplicate(rrset->data, rdata_wol, rdatalen)) {
if(duplicate) *duplicate = 1;
return 1;
}
if(!rrset_add_rr(rrset, rr_ttl, rdata, rdatalen, 0))
if(!rrset_add_rr(rrset, rr_ttl, rdata_wol, rdatalen,
0))
return 0;
} else {
struct auth_rrset* rrsig;
/* create new node with data type */
if(!(rrset=rrset_create(node, rr_type, rr_ttl, rdata,
rdatalen)))
if(!(rrset=rrset_create(node, rr_type, rr_ttl,
rdata_wol, rdatalen)))
return 0;
/* see if node of type RRSIG has signatures that
@ -1156,21 +1183,16 @@ az_domain_add_rr(struct auth_data* node, uint16_t rr_type, uint32_t rr_ttl,
return 1;
}
/** insert RR into zone, ignore duplicates */
/** insert RR as name,rdata into zone, ignore duplicates.
* The rdata_wol is the rdata without the prefix rdlength, because simdzone
* returns that as the parsed rdata byte string. */
static int
az_insert_rr(struct auth_zone* z, uint8_t* rr, size_t rr_len,
size_t dname_len, int* duplicate)
az_insert_rr_as_rdata(struct auth_zone* z, uint8_t* dname, size_t dname_len,
uint16_t rr_type, uint16_t rr_class, uint32_t rr_ttl,
uint8_t* rdata_wol, size_t rdatalen, int* duplicate,
uint8_t* rr, size_t rr_len)
{
struct auth_data* node;
uint8_t* dname = rr;
uint16_t rr_type = sldns_wirerr_get_type(rr, rr_len, dname_len);
uint16_t rr_class = sldns_wirerr_get_class(rr, rr_len, dname_len);
uint32_t rr_ttl = sldns_wirerr_get_ttl(rr, rr_len, dname_len);
size_t rdatalen = ((size_t)sldns_wirerr_get_rdatalen(rr, rr_len,
dname_len))+2;
/* rdata points to rdata prefixed with uint16 rdatalength */
uint8_t* rdata = sldns_wirerr_get_rdatawl(rr, rr_len, dname_len);
if(rr_class != z->dclass) {
log_err("wrong class for RR");
return 0;
@ -1179,20 +1201,64 @@ az_insert_rr(struct auth_zone* z, uint8_t* rr, size_t rr_len,
log_err("cannot create domain");
return 0;
}
if(!az_domain_add_rr(node, rr_type, rr_ttl, rdata, rdatalen,
if(!az_domain_add_rr(node, rr_type, rr_ttl, rdata_wol, rdatalen,
duplicate)) {
log_err("cannot add RR to domain");
return 0;
}
if(z->rpz) {
uint8_t* rdata_wl;
uint8_t buf[65536];
if(rr == NULL) {
/* spool it into buffer. */
log_assert(dname);
if(dname_len + 10 /* type, class, ttl, rdlength */ +
rdatalen > sizeof(buf)) {
char dstr[LDNS_MAX_DOMAINLEN], t[16], c[16];
dname_str(dname, dstr);
sldns_wire2str_type_buf(rr_type, t, sizeof(t));
sldns_wire2str_class_buf(rr_class, c, sizeof(c));
log_err("record exceeds buffer length, %s %s %s", dstr, c, t);
return 0;
}
rr = buf;
rr_len = dname_len
+ 10 /* type, class, ttl, rdlength */ +
rdatalen;
memcpy(buf, dname, dname_len);
sldns_write_uint16(buf+dname_len, rr_type);
sldns_write_uint16(buf+dname_len+2, rr_class);
sldns_write_uint32(buf+dname_len+4, rr_ttl);
sldns_write_uint16(buf+dname_len+8, rdatalen);
memmove(buf+dname_len+10, rdata_wol, rdatalen);
}
rdata_wl = sldns_wirerr_get_rdatawl(rr, rr_len, dname_len);
if(!(rpz_insert_rr(z->rpz, z->name, z->namelen, dname,
dname_len, rr_type, rr_class, rr_ttl, rdata, rdatalen,
rr, rr_len)))
dname_len, rr_type, rr_class, rr_ttl, rdata_wl,
rdatalen+2, rr, rr_len)))
return 0;
}
return 1;
}
/** insert RR into zone, ignore duplicates */
static int
az_insert_rr(struct auth_zone* z, uint8_t* rr, size_t rr_len,
size_t dname_len, int* duplicate)
{
uint8_t* dname = rr;
uint16_t rr_type = sldns_wirerr_get_type(rr, rr_len, dname_len);
uint16_t rr_class = sldns_wirerr_get_class(rr, rr_len, dname_len);
uint32_t rr_ttl = sldns_wirerr_get_ttl(rr, rr_len, dname_len);
size_t rdatalen = ((size_t)sldns_wirerr_get_rdatalen(rr, rr_len,
dname_len));
/* rdata points to rdata without prefix rdlength. */
uint8_t* rdata_wol = sldns_wirerr_get_rdata(rr, rr_len, dname_len);
return az_insert_rr_as_rdata(z, dname, dname_len, rr_type, rr_class,
rr_ttl, rdata_wol, rdatalen, duplicate, rr, rr_len);
}
/** Remove rr from node, ignores nonexisting RRs,
* rdata points to buffer with rdatalen octets, starts with 2bytelength. */
static int
@ -1563,13 +1629,153 @@ az_parse_file(struct auth_zone* z, FILE* in, uint8_t* rr, size_t rrbuflen,
return 1;
}
/** Structure for simdzone parse state */
struct az_parse_state {
/** The zone that is processed. */
struct auth_zone* z;
/** number of errors, if 0 it was read successfully. */
int errors;
/** for http parse, chunk iterator. */
struct auth_chunk* chunk;
/** for http parse, position in chunk. */
size_t chunk_pos;
};
/** Callback for simdzone parse, log an error */
static void
az_parse_log(zone_parser_t *parser, uint32_t category,
const char *file, size_t line, const char *message, void *user_data)
{
struct az_parse_state* state = (struct az_parse_state*)user_data;
(void)parser;
switch (category) {
case ZONE_INFO:
if (file)
log_info("%s:%d: %s", file, (int)line, message);
else
log_info("%s", message);
break;
case ZONE_WARNING:
if (file)
log_warn("%s:%d: %s", file, (int)line, message);
else
log_warn("%s", message);
break;
default:
if (file)
log_err("%s:%d: %s", file, (int)line, message);
else
log_err("%s", message);
state->errors++;
break;
}
}
/** Callback for simdzone parse, accept an RR that has been read in. */
int32_t
az_parse_accept(zone_parser_t *parser, const zone_name_t *owner,
uint16_t type, uint16_t dclass, uint32_t ttl, uint16_t rdlength,
const uint8_t *rdata, void *user_data)
{
struct az_parse_state* state = (struct az_parse_state*)user_data;
if(verbosity >= 7) {
char dname[LDNS_MAX_DOMAINLEN], t[16], c[16];
dname_str((uint8_t*)owner->octets, dname);
sldns_wire2str_type_buf(type, t, sizeof(t));
sldns_wire2str_class_buf(dclass, c, sizeof(c));
verbose(7, "zone parse record %s %s %s", dname, c, t);
}
/* Duplicates can be ignored, do not insert them twice. */
if(!az_insert_rr_as_rdata(state->z, (uint8_t*)owner->octets,
owner->length, type, dclass, ttl, (uint8_t*)rdata, rdlength,
NULL, NULL, 0)) {
char dname[LDNS_MAX_DOMAINLEN], t[16], c[16];
dname_str((uint8_t*)owner->octets, dname);
sldns_wire2str_type_buf(type, t, sizeof(t));
sldns_wire2str_class_buf(dclass, c, sizeof(c));
log_err("record insert allocation failed, %s %s %s",
dname, c, t);
return ZONE_OUT_OF_MEMORY;
}
(void)parser;
return 0;
}
/**
* Callback for simdzone parse, include a zone file.
* It is called for every $INCLUDE entry. It could be used to save
* the file names, so that it can track if the files have changed, later.
*/
static int32_t
az_parse_include(zone_parser_t *parser, const char *file,
const char *path, void *user_data)
{
struct az_parse_state* state = (struct az_parse_state*)user_data;
(void)parser;
(void)state;
verbose(6, "zone parse descended into include file %s (full path %s)",
file, path);
return 0;
}
/**
* Parse file with simdzone.
*/
static int
az_parse_file_simdzone(struct auth_zone* z, char* zfilename,
struct config_file* cfg)
{
zone_parser_t parser;
zone_options_t options;
zone_name_buffer_t name_buffer;
zone_rdata_buffer_t rdata_buffer;
zone_buffers_t buffers = { 1, &name_buffer, &rdata_buffer };
struct az_parse_state state;
memset(&options, 0, sizeof(options));
options.origin.octets = z->name;
options.origin.length = z->namelen;
options.default_ttl = 3600;
options.default_class = LDNS_RR_CLASS_IN;
options.secondary = z->zone_is_slave;
options.pretty_ttls = true; /* non-standard, for backwards compatibility */
if(cfg->chrootdir && cfg->chrootdir[0])
options.chrootdir = cfg->chrootdir;
else options.chrootdir = NULL;
options.log.callback = &az_parse_log;
options.accept.callback = &az_parse_accept;
options.include.callback = &az_parse_include;
memset(&state, 0, sizeof(state));
state.z = z;
/* Parse and process all RRs. */
if (zone_parse(&parser, &options, &buffers, zfilename, &state) != 0) {
return 0;
}
return 1;
}
/** See if the file can be accessed, or if it does not exist. Look at errno. */
static int
file_exists(char* filename)
{
struct stat buf;
if(stat(filename, &buf) < 0) {
return 0;
}
return 1;
}
int
auth_zone_read_zonefile(struct auth_zone* z, struct config_file* cfg)
{
int use_simdzone = 1;
uint8_t rr[LDNS_RR_BUF_SIZE];
struct sldns_file_parse_state state;
char* zfilename;
FILE* in;
if(!z || !z->zonefile || z->zonefile[0]==0)
return 1; /* no file, or "", nothing to read */
@ -1582,8 +1788,7 @@ auth_zone_read_zonefile(struct auth_zone* z, struct config_file* cfg)
dname_str(z->name, nm);
verbose(VERB_ALGO, "read zonefile %s for %s", zfilename, nm);
}
in = fopen(zfilename, "r");
if(!in) {
if(!file_exists(zfilename)) {
char* n = sldns_wire2str_dname(z->name, z->namelen);
if(z->zone_is_slave && errno == ENOENT) {
/* we fetch the zone contents later, no file yet */
@ -1614,15 +1819,36 @@ auth_zone_read_zonefile(struct auth_zone* z, struct config_file* cfg)
state.origin_len = z->namelen;
}
/* parse the (toplevel) file */
if(!az_parse_file(z, in, rr, sizeof(rr), &state, zfilename, 0, cfg)) {
char* n = sldns_wire2str_dname(z->name, z->namelen);
log_err("error parsing zonefile %s for %s",
zfilename, n?n:"error");
free(n);
if(use_simdzone) {
/* Use simdzone. */
if(!az_parse_file_simdzone(z, zfilename, cfg)) {
char* n = sldns_wire2str_dname(z->name, z->namelen);
log_err("error parsing zonefile %s for %s",
zfilename, n?n:"error");
free(n);
return 0;
}
} else {
/* Read with sldns_str2wire functions. */
FILE* in;
in = fopen(zfilename, "r");
if(!in) {
char* n = sldns_wire2str_dname(z->name, z->namelen);
log_err("cannot open zonefile %s for %s: %s",
zfilename, n?n:"error", strerror(errno));
free(n);
return 0;
}
if(!az_parse_file(z, in, rr, sizeof(rr), &state, zfilename, 0, cfg)) {
char* n = sldns_wire2str_dname(z->name, z->namelen);
log_err("error parsing zonefile %s for %s",
zfilename, n?n:"error");
free(n);
fclose(in);
return 0;
}
fclose(in);
return 0;
}
fclose(in);
if(z->rpz)
rpz_finish_config(z->rpz);
@ -5097,14 +5323,11 @@ apply_axfr(struct auth_xfer* xfr, struct auth_zone* z,
return 1;
}
/** apply HTTP to zone in memory. z is locked. false on failure(mallocfail) */
/** parse http zone with sldns. */
static int
apply_http(struct auth_xfer* xfr, struct auth_zone* z,
parse_http_sldns(struct auth_xfer* xfr, struct auth_zone* z,
struct sldns_buffer* scratch_buffer)
{
/* parse data in chunks */
/* parse RR's and read into memory. ignore $INCLUDE from the
* downloaded file*/
struct sldns_file_parse_state pstate;
struct auth_chunk* chunk;
size_t chunk_pos;
@ -5116,6 +5339,184 @@ apply_http(struct auth_xfer* xfr, struct auth_zone* z,
memmove(pstate.origin, xfr->name, xfr->namelen);
}
chunk = xfr->task_transfer->chunks_first;
chunk_pos = 0;
pstate.lineno = 0;
while(chunkline_get_line_collated(&chunk, &chunk_pos, scratch_buffer)) {
/* process this line */
pstate.lineno++;
chunkline_newline_removal(scratch_buffer);
if(chunkline_is_comment_line_or_empty(scratch_buffer)) {
continue;
}
/* parse line and add RR */
if((ret=http_parse_origin(scratch_buffer, &pstate))!=0) {
if(ret == 2) {
verbose(VERB_ALGO, "error parsing ORIGIN on line [%s:%d] %s",
xfr->task_transfer->master->file,
pstate.lineno,
sldns_buffer_begin(scratch_buffer));
return 0;
}
continue; /* $ORIGIN has been handled */
}
if((ret=http_parse_ttl(scratch_buffer, &pstate))!=0) {
if(ret == 2) {
verbose(VERB_ALGO, "error parsing TTL on line [%s:%d] %s",
xfr->task_transfer->master->file,
pstate.lineno,
sldns_buffer_begin(scratch_buffer));
return 0;
}
continue; /* $TTL has been handled */
}
if(!http_parse_add_rr(xfr, z, scratch_buffer, &pstate)) {
verbose(VERB_ALGO, "error parsing line [%s:%d] %s",
xfr->task_transfer->master->file,
pstate.lineno,
sldns_buffer_begin(scratch_buffer));
return 0;
}
}
return 1;
}
/**
* Callback for simdzone parse of http, include a zone file.
* It is called for every $INCLUDE entry.
*/
static int32_t
az_http_parse_include(zone_parser_t *parser, const char *file,
const char *path, void *user_data)
{
struct az_parse_state* state = (struct az_parse_state*)user_data;
char dname[LDNS_MAX_DOMAINLEN];
(void)parser;
verbose(6, "zone parse has include file %s (full path %s)",
file, path);
dname_str(state->z->name, dname);
verbose(1, "zone parse for zonefile of %s has $INCLUDE %s, but $INCLUDE not followed",
dname, file);
/* Not expecting a secondary zone file with includes. */
return ZONE_SEMANTIC_ERROR;
}
int32_t az_http_read_data(zone_parser_t* parser, char* data, size_t len,
size_t* outlen, void* user_data)
{
struct az_parse_state* state = (struct az_parse_state*)user_data;
size_t written = 0;
(void)parser;
if(state->chunk == NULL) {
/* End of the chunk list */
*outlen = 0;
return 0;
}
if(state->chunk_pos == state->chunk->len) {
/* The end of the chunk list is reached, with 0 data. */
state->chunk = NULL;
*outlen = 0;
return 0;
}
if(len == 0) {
*outlen = 0;
return 0;
}
/* Fill up the data buffer with the requested amount. */
while(written < len) {
/* The amount that is wanted. */
size_t wanted = len - written;
/* That amount that is in this chunk. */
size_t avail = state->chunk->len - state->chunk_pos;
if(wanted < avail) {
/* Write a piece of this chunk. */
memmove(data+written,
state->chunk->data+state->chunk_pos, wanted);
state->chunk_pos += wanted;
*outlen = len;
return 0;
}
/* Write the entire chunk and continue on. */
if(avail > 0)
memmove(data+written,
state->chunk->data+state->chunk_pos, avail);
written += avail;
/* move to next chunk */
state->chunk = state->chunk->next;
state->chunk_pos = 0;
/* Is this the exact amount requested. */
if(written == len) {
/* continue later. */
*outlen = len;
return 0;
}
/* Is there no more data. */
if(state->chunk == NULL) {
/* End of data. */
*outlen = written;
return 0;
}
}
*outlen = written;
return 0;
}
/** parse http zone with simdzone. */
static int
parse_http_simdzone(struct auth_xfer* xfr, struct auth_zone* z)
{
zone_parser_t parser;
zone_options_t options;
zone_name_buffer_t name_buffer;
zone_rdata_buffer_t rdata_buffer;
zone_buffers_t buffers = { 1, &name_buffer, &rdata_buffer };
struct az_parse_state state;
memset(&options, 0, sizeof(options));
options.origin.octets = z->name;
options.origin.length = z->namelen;
options.default_ttl = 3600;
options.default_class = LDNS_RR_CLASS_IN;
options.secondary = z->zone_is_slave;
options.pretty_ttls = true; /* non-standard, for backwards compatibility */
options.no_includes = true; /* the secondary zone file transferred over https is not expected to have $INCLUDE files. */
/* The log callback for file read prints the error and can be used
* here too. */
options.log.callback = &az_parse_log;
/* The parse accept callback for file inserts the RR, and can be
* used here too. */
options.accept.callback = &az_parse_accept;
options.include.callback = &az_http_parse_include;
memset(&state, 0, sizeof(state));
state.z = z;
state.chunk = xfr->task_transfer->chunks_first;
state.chunk_pos = 0;
/* Parse and process all RRs. */
if (zone_parse_from_callback(&parser, &options, &buffers,
az_http_read_data, &state) != 0) {
return 0;
}
return 1;
}
/** apply HTTP to zone in memory. z is locked. false on failure(mallocfail) */
static int
apply_http(struct auth_xfer* xfr, struct auth_zone* z,
struct sldns_buffer* scratch_buffer)
{
int use_simdzone = 1;
/* parse data in chunks */
/* parse RR's and read into memory. ignore $INCLUDE from the
* downloaded file*/
if(verbosity >= VERB_ALGO)
verbose(VERB_ALGO, "http download %s of size %d",
xfr->task_transfer->master->file,
@ -5155,44 +5556,14 @@ apply_http(struct auth_xfer* xfr, struct auth_zone* z,
xfr->serial = 0;
xfr->soa_zone_acquired = 0;
chunk = xfr->task_transfer->chunks_first;
chunk_pos = 0;
pstate.lineno = 0;
while(chunkline_get_line_collated(&chunk, &chunk_pos, scratch_buffer)) {
/* process this line */
pstate.lineno++;
chunkline_newline_removal(scratch_buffer);
if(chunkline_is_comment_line_or_empty(scratch_buffer)) {
continue;
}
/* parse line and add RR */
if((ret=http_parse_origin(scratch_buffer, &pstate))!=0) {
if(ret == 2) {
verbose(VERB_ALGO, "error parsing ORIGIN on line [%s:%d] %s",
xfr->task_transfer->master->file,
pstate.lineno,
sldns_buffer_begin(scratch_buffer));
return 0;
}
continue; /* $ORIGIN has been handled */
}
if((ret=http_parse_ttl(scratch_buffer, &pstate))!=0) {
if(ret == 2) {
verbose(VERB_ALGO, "error parsing TTL on line [%s:%d] %s",
xfr->task_transfer->master->file,
pstate.lineno,
sldns_buffer_begin(scratch_buffer));
return 0;
}
continue; /* $TTL has been handled */
}
if(!http_parse_add_rr(xfr, z, scratch_buffer, &pstate)) {
verbose(VERB_ALGO, "error parsing line [%s:%d] %s",
xfr->task_transfer->master->file,
pstate.lineno,
sldns_buffer_begin(scratch_buffer));
if(use_simdzone) {
/* Use simdzone for parse. */
if(!parse_http_simdzone(xfr, z))
return 0;
} else {
/* Parse with sldns. */
if(!parse_http_sldns(xfr, z, scratch_buffer))
return 0;
}
}
return 1;
}

1
simdzone Submodule

@ -0,0 +1 @@
Subproject commit eca67807d02c74d1f01edbf7b3bc3475e56bf4d6

View file

@ -40,6 +40,8 @@ grep -F -v -e "dnstap" hlist > ilist; mv ilist hlist
grep -F -v -e "util/siphash.c" hlist > ilist; mv ilist hlist
# filter out compat
grep -F -v -e "compat/" hlist > ilist; mv ilist hlist
# filter out simdzone
grep -F -v -e "simdzone/" hlist > ilist; mv ilist hlist
for h in `cat hlist`; do
if grep -F "`basename $h`" $PRE/doc/html/files.html >/dev/null; then
: # ok

View file

@ -24,7 +24,11 @@ example. 86400 IN ZONEMD 2018031900 1 240 (
example. 86400 IN ZONEMD 2018031900 241 1 (
e1846540e33a9e41
89792d18d5d131f6
05fc283e )
05fc283e00000000
6792901f9f88e637
493daaf401c92c27
9dd10f0edb1c56f8
)
ns1.example. 3600 IN A 203.0.113.63
ns2.example. 86400 IN TXT "This example has multiple digests"
ns2.example. 3600 IN AAAA 2001:db8::63