mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-18 18:25:10 -05:00
Merge branch 'master' into hackathon/poisonlicious-update
This commit is contained in:
commit
4f245e0e5b
206 changed files with 28110 additions and 4626 deletions
13
.github/workflows/analysis_ports.yml
vendored
13
.github/workflows/analysis_ports.yml
vendored
|
|
@ -31,12 +31,12 @@ jobs:
|
|||
clang_analysis: "yes"
|
||||
- name: OS X
|
||||
os: macos-latest
|
||||
install_expat: "yes"
|
||||
install_expat: "no"
|
||||
config: "--enable-debug --disable-flto --with-ssl=/opt/homebrew/opt/openssl --with-libexpat=/opt/homebrew/opt/expat"
|
||||
make_test: "yes"
|
||||
- name: Clang on OS X
|
||||
os: macos-latest
|
||||
install_expat: "yes"
|
||||
install_expat: "no"
|
||||
config: "CC=clang --enable-debug --disable-flto --with-ssl=/opt/homebrew/opt/openssl --with-libexpat=/opt/homebrew/opt/expat --disable-static"
|
||||
make_test: "yes"
|
||||
clang_analysis: "yes"
|
||||
|
|
@ -196,6 +196,9 @@ jobs:
|
|||
persist-credentials: false
|
||||
- name: test_windows
|
||||
if: ${{ matrix.test_windows == 'yes' }}
|
||||
env:
|
||||
LIBEXPAT_FNAME: expat-2.7.0
|
||||
LIBEXPAT_VERSION_DIR: R_2_7_0
|
||||
shell: bash
|
||||
run: |
|
||||
export unboundpath=`pwd`
|
||||
|
|
@ -238,9 +241,9 @@ jobs:
|
|||
cd ..
|
||||
mkdir expat
|
||||
echo "curl expat"
|
||||
curl -L -k -s -S -o expat-2.2.10.tar.gz https://github.com/libexpat/libexpat/releases/download/R_2_2_10/expat-2.2.10.tar.gz
|
||||
tar xzf expat-2.2.10.tar.gz
|
||||
cd expat-2.2.10
|
||||
curl -L -k -s -S -o $LIBEXPAT_FNAME.tar.gz https://github.com/libexpat/libexpat/releases/download/$LIBEXPAT_VERSION_DIR/$LIBEXPAT_FNAME.tar.gz
|
||||
tar xzf $LIBEXPAT_FNAME.tar.gz
|
||||
cd $LIBEXPAT_FNAME
|
||||
echo "./configure SHELL=/usr/bin/bash CONFIG_SHELL=/usr/bin/bash --prefix=\"$prepath/expat\" --exec-prefix=\"$prepath/expat\" --bindir=\"$prepath/expat/bin\" --includedir=\"$prepath/expat/include\" --mandir=\"$prepath/expat/man\" --libdir=\"$prepath/expat/lib\""
|
||||
./configure SHELL=/usr/bin/bash CONFIG_SHELL=/usr/bin/bash --prefix="$prepath/expat" --exec-prefix="$prepath/expat" --bindir="$prepath/expat/bin" --includedir="$prepath/expat/include" --mandir="$prepath/expat/man" --libdir="$prepath/expat/lib"
|
||||
# fixup SHELL is treated specially, but SHELZZ is not by make.
|
||||
|
|
|
|||
81
Makefile.in
81
Makefile.in
|
|
@ -449,9 +449,13 @@ dnstap.lo dnstap.o: $(srcdir)/dnstap/dnstap.c config.h dnstap/dnstap_config.h \
|
|||
$(srcdir)/util/netevent.h $(srcdir)/util/net_help.h \
|
||||
$(srcdir)/util/locks.h
|
||||
|
||||
dnstap/dnstap.pb-c.c dnstap/dnstap.pb-c.h: $(srcdir)/dnstap/dnstap.proto
|
||||
# Builds both dnstap/dnstap.pb-c.c and dnstap/dnstap.pb-c.h.
|
||||
# To avoid double-building we split one target out.
|
||||
dnstap/dnstap.pb-c.c: $(srcdir)/dnstap/dnstap.proto
|
||||
@-if test ! -d dnstap; then $(INSTALL) -d dnstap; fi
|
||||
$(PROTOC_C) --c_out=. --proto_path=$(srcdir) $(srcdir)/dnstap/dnstap.proto
|
||||
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)
|
||||
|
|
@ -894,7 +898,7 @@ view.lo view.o: $(srcdir)/services/view.c config.h $(srcdir)/services/view.h $(s
|
|||
$(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h \
|
||||
$(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/msgreply.h \
|
||||
$(srcdir)/util/data/packed_rrset.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgparse.h \
|
||||
$(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h
|
||||
$(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h $(srcdir)/respip/respip.h
|
||||
rpz.lo rpz.o: $(srcdir)/services/rpz.c config.h $(srcdir)/services/rpz.h $(srcdir)/services/localzone.h \
|
||||
$(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/dnstree.h \
|
||||
$(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/msgreply.h \
|
||||
|
|
@ -998,7 +1002,7 @@ fptr_wlist.lo fptr_wlist.o: $(srcdir)/util/fptr_wlist.c config.h $(srcdir)/util/
|
|||
$(srcdir)/validator/val_utils.h $(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_anchor.h \
|
||||
$(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_kentry.h $(srcdir)/validator/val_neg.h \
|
||||
$(srcdir)/validator/autotrust.h $(srcdir)/libunbound/libworker.h $(srcdir)/libunbound/context.h \
|
||||
$(srcdir)/libunbound/unbound-event.h $(srcdir)/libunbound/worker.h
|
||||
$(srcdir)/libunbound/unbound-event.h $(srcdir)/libunbound/worker.h $(srcdir)/daemon/remote.h
|
||||
locks.lo locks.o: $(srcdir)/util/locks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h
|
||||
log.lo log.o: $(srcdir)/util/log.c config.h $(srcdir)/util/log.h $(srcdir)/util/locks.h $(srcdir)/sldns/sbuffer.h
|
||||
mini_event.lo mini_event.o: $(srcdir)/util/mini_event.c config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \
|
||||
|
|
@ -1091,7 +1095,7 @@ proxy_protocol.lo proxy_protocol.o: $(srcdir)/util/proxy_protocol.c $(srcdir)/ut
|
|||
timeval_func.lo timeval_func.o: $(srcdir)/util/timeval_func.c config.h $(srcdir)/util/timeval_func.h
|
||||
ub_event.lo ub_event.o: $(srcdir)/util/ub_event.c config.h $(srcdir)/util/ub_event.h $(srcdir)/util/log.h \
|
||||
$(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \
|
||||
$(srcdir)/util/tube.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h
|
||||
$(srcdir)/util/tube.h $(srcdir)/daemon/remote.h $(srcdir)/util/locks.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h
|
||||
ub_event_pluggable.lo ub_event_pluggable.o: $(srcdir)/util/ub_event_pluggable.c config.h $(srcdir)/util/ub_event.h \
|
||||
$(srcdir)/libunbound/unbound-event.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \
|
||||
$(srcdir)/util/log.h $(srcdir)/util/fptr_wlist.h \
|
||||
|
|
@ -1176,7 +1180,12 @@ val_sigcrypt.lo val_sigcrypt.o: $(srcdir)/validator/val_sigcrypt.c config.h \
|
|||
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/validator/val_utils.h \
|
||||
$(srcdir)/validator/val_nsec3.h $(srcdir)/util/rbtree.h $(srcdir)/util/data/dname.h $(srcdir)/util/rfc_1982.h \
|
||||
$(srcdir)/util/net_help.h $(srcdir)/util/random.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h \
|
||||
$(srcdir)/sldns/keyraw.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h
|
||||
$(srcdir)/sldns/keyraw.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h \
|
||||
$(srcdir)/services/mesh.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \
|
||||
$(srcdir)/services/modstack.h $(srcdir)/services/rpz.h \
|
||||
$(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h $(srcdir)/services/view.h \
|
||||
$(srcdir)/services/authzone.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h \
|
||||
$(srcdir)/respip/respip.h
|
||||
val_utils.lo val_utils.o: $(srcdir)/validator/val_utils.c config.h $(srcdir)/validator/val_utils.h \
|
||||
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
|
||||
$(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/validator/validator.h $(srcdir)/util/module.h \
|
||||
|
|
@ -1218,7 +1227,9 @@ checklocks.lo checklocks.o: $(srcdir)/testcode/checklocks.c config.h $(srcdir)/u
|
|||
$(srcdir)/testcode/checklocks.h
|
||||
ipsecmod.lo ipsecmod.o: $(srcdir)/ipsecmod/ipsecmod.c config.h
|
||||
ipsecmod-whitelist.lo ipsecmod-whitelist.o: $(srcdir)/ipsecmod/ipsecmod-whitelist.c config.h
|
||||
tsig.lo tsig.o: $(srcdir)/util/tsig.c $(srcdir)/util/tsig.h $(srcdir)/sldns/sbuffer.h
|
||||
tsig.lo tsig.o: $(srcdir)/util/tsig.c $(srcdir)/util/tsig.h config.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/log.h \
|
||||
$(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h \
|
||||
$(srcdir)/util/locks.h $(srcdir)/util/data/dname.h
|
||||
unitanchor.lo unitanchor.o: $(srcdir)/testcode/unitanchor.c config.h $(srcdir)/util/log.h $(srcdir)/util/data/dname.h \
|
||||
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/testcode/unitmain.h \
|
||||
$(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h
|
||||
|
|
@ -1310,19 +1321,19 @@ acl_list.lo acl_list.o: $(srcdir)/daemon/acl_list.c config.h $(srcdir)/daemon/ac
|
|||
$(srcdir)/services/listen_dnsport.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \
|
||||
$(srcdir)/sldns/str2wire.h
|
||||
cachedump.lo cachedump.o: $(srcdir)/daemon/cachedump.c config.h $(srcdir)/daemon/cachedump.h \
|
||||
$(srcdir)/daemon/remote.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
|
||||
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
|
||||
$(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \
|
||||
$(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgparse.h \
|
||||
$(srcdir)/sldns/pkthdr.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h \
|
||||
$(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \
|
||||
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/dns.h \
|
||||
$(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h \
|
||||
$(srcdir)/services/outside_network.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h $(srcdir)/util/random.h \
|
||||
$(srcdir)/util/data/dname.h $(srcdir)/util/config_file.h $(srcdir)/iterator/iterator.h \
|
||||
$(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/iterator/iter_utils.h \
|
||||
$(srcdir)/iterator/iter_resptype.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h \
|
||||
$(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h
|
||||
$(srcdir)/daemon/remote.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/daemon/worker.h \
|
||||
$(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h \
|
||||
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \
|
||||
$(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h \
|
||||
$(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/daemon/stats.h \
|
||||
$(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \
|
||||
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \
|
||||
$(srcdir)/services/cache/dns.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \
|
||||
$(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/services/outside_network.h $(srcdir)/util/regional.h \
|
||||
$(srcdir)/util/net_help.h $(srcdir)/util/random.h $(srcdir)/util/data/dname.h $(srcdir)/util/config_file.h \
|
||||
$(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_delegpt.h \
|
||||
$(srcdir)/iterator/iter_utils.h $(srcdir)/iterator/iter_resptype.h $(srcdir)/iterator/iter_fwd.h \
|
||||
$(srcdir)/iterator/iter_hints.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h
|
||||
daemon.lo daemon.o: $(srcdir)/daemon/daemon.c config.h $(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h \
|
||||
$(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \
|
||||
$(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h \
|
||||
|
|
@ -1337,25 +1348,27 @@ daemon.lo daemon.o: $(srcdir)/daemon/daemon.c config.h $(srcdir)/daemon/daemon.h
|
|||
$(srcdir)/util/rtt.h $(srcdir)/services/localzone.h $(srcdir)/services/authzone.h $(srcdir)/services/mesh.h \
|
||||
$(srcdir)/services/rpz.h $(srcdir)/respip/respip.h $(srcdir)/util/random.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h \
|
||||
$(srcdir)/sldns/keyraw.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h
|
||||
remote.lo remote.o: $(srcdir)/daemon/remote.c config.h $(srcdir)/daemon/remote.h $(srcdir)/daemon/worker.h \
|
||||
$(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h \
|
||||
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/netevent.h \
|
||||
remote.lo remote.o: $(srcdir)/daemon/remote.c config.h $(srcdir)/daemon/remote.h $(srcdir)/util/locks.h \
|
||||
$(srcdir)/util/log.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
|
||||
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/netevent.h \
|
||||
$(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/util/alloc.h \
|
||||
$(srcdir)/util/data/msgreply.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
|
||||
$(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h $(srcdir)/util/module.h \
|
||||
$(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/daemon.h \
|
||||
$(srcdir)/services/modstack.h $(srcdir)/daemon/cachedump.h $(srcdir)/util/config_file.h \
|
||||
$(srcdir)/util/net_help.h $(srcdir)/util/random.h $(srcdir)/services/listen_dnsport.h $(srcdir)/util/rbtree.h \
|
||||
$(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/services/view.h \
|
||||
$(srcdir)/util/net_help.h $(srcdir)/util/random.h $(srcdir)/util/ub_event.h $(srcdir)/services/listen_dnsport.h \
|
||||
$(srcdir)/util/rbtree.h $(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/services/view.h \
|
||||
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h \
|
||||
$(srcdir)/util/rtt.h $(srcdir)/services/mesh.h $(srcdir)/services/rpz.h $(srcdir)/services/localzone.h \
|
||||
$(srcdir)/services/authzone.h $(srcdir)/respip/respip.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h \
|
||||
$(srcdir)/util/data/dname.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h \
|
||||
$(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_kcache.h $(srcdir)/validator/val_kentry.h \
|
||||
$(srcdir)/validator/val_anchor.h $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h \
|
||||
$(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h $(srcdir)/iterator/iter_delegpt.h \
|
||||
$(srcdir)/services/outside_network.h $(srcdir)/util/regional.h $(srcdir)/sldns/str2wire.h \
|
||||
$(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h $(srcdir)/util/timeval_func.h $(srcdir)/util/edns.h
|
||||
$(srcdir)/validator/val_anchor.h $(srcdir)/validator/val_neg.h $(srcdir)/iterator/iterator.h \
|
||||
$(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h \
|
||||
$(srcdir)/iterator/iter_delegpt.h $(srcdir)/iterator/iter_utils.h $(srcdir)/iterator/iter_resptype.h \
|
||||
$(srcdir)/iterator/iter_donotq.h $(srcdir)/iterator/iter_priv.h $(srcdir)/services/outside_network.h \
|
||||
$(srcdir)/util/regional.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h \
|
||||
$(srcdir)/util/timeval_func.h $(srcdir)/util/tcp_conn_limit.h $(srcdir)/util/edns.h
|
||||
stats.lo stats.o: $(srcdir)/daemon/stats.c config.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \
|
||||
$(srcdir)/libunbound/unbound.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
|
||||
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
|
||||
|
|
@ -1402,13 +1415,13 @@ worker.lo worker.o: $(srcdir)/daemon/worker.c config.h $(srcdir)/util/log.h $(sr
|
|||
$(srcdir)/util/edns.h $(srcdir)/util/timeval_func.h $(srcdir)/iterator/iter_fwd.h \
|
||||
$(srcdir)/iterator/iter_hints.h $(srcdir)/iterator/iter_utils.h $(srcdir)/iterator/iter_resptype.h \
|
||||
$(srcdir)/validator/autotrust.h $(srcdir)/validator/val_anchor.h $(srcdir)/libunbound/context.h \
|
||||
$(srcdir)/libunbound/unbound-event.h $(srcdir)/libunbound/libworker.h $(srcdir)/sldns/wire2str.h \
|
||||
$(srcdir)/util/shm_side/shm_main.h $(srcdir)/dnstap/dtstream.h
|
||||
$(srcdir)/libunbound/unbound-event.h $(srcdir)/libunbound/libworker.h $(srcdir)/sldns/parseutil.h \
|
||||
$(srcdir)/sldns/wire2str.h $(srcdir)/util/shm_side/shm_main.h $(srcdir)/dnstap/dtstream.h
|
||||
testbound.lo testbound.o: $(srcdir)/testcode/testbound.c config.h $(srcdir)/testcode/testpkts.h \
|
||||
$(srcdir)/testcode/replay.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \
|
||||
$(srcdir)/util/rbtree.h $(srcdir)/testcode/fake_event.h \
|
||||
$(srcdir)/daemon/remote.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
|
||||
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
|
||||
$(srcdir)/daemon/remote.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/libunbound/worker.h \
|
||||
$(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
|
||||
$(srcdir)/daemon/worker.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/sldns/rrdef.h \
|
||||
$(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \
|
||||
$(srcdir)/libunbound/unbound.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \
|
||||
|
|
@ -1441,8 +1454,8 @@ worker.lo worker.o: $(srcdir)/daemon/worker.c config.h $(srcdir)/util/log.h $(sr
|
|||
$(srcdir)/util/edns.h $(srcdir)/util/timeval_func.h $(srcdir)/iterator/iter_fwd.h \
|
||||
$(srcdir)/iterator/iter_hints.h $(srcdir)/iterator/iter_utils.h $(srcdir)/iterator/iter_resptype.h \
|
||||
$(srcdir)/validator/autotrust.h $(srcdir)/validator/val_anchor.h $(srcdir)/libunbound/context.h \
|
||||
$(srcdir)/libunbound/unbound-event.h $(srcdir)/libunbound/libworker.h $(srcdir)/sldns/wire2str.h \
|
||||
$(srcdir)/util/shm_side/shm_main.h $(srcdir)/dnstap/dtstream.h
|
||||
$(srcdir)/libunbound/unbound-event.h $(srcdir)/libunbound/libworker.h $(srcdir)/sldns/parseutil.h \
|
||||
$(srcdir)/sldns/wire2str.h $(srcdir)/util/shm_side/shm_main.h $(srcdir)/dnstap/dtstream.h
|
||||
acl_list.lo acl_list.o: $(srcdir)/daemon/acl_list.c config.h $(srcdir)/daemon/acl_list.h \
|
||||
$(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/services/view.h $(srcdir)/util/locks.h \
|
||||
$(srcdir)/util/log.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/sldns/rrdef.h \
|
||||
|
|
|
|||
263
cachedb/redis.c
263
cachedb/redis.c
|
|
@ -52,20 +52,38 @@
|
|||
#include "hiredis/hiredis.h"
|
||||
|
||||
struct redis_moddata {
|
||||
redisContext** ctxs; /* thread-specific redis contexts */
|
||||
int numctxs; /* number of ctx entries */
|
||||
const char* server_host; /* server's IP address or host name */
|
||||
int server_port; /* server's TCP port */
|
||||
const char* server_path; /* server's unix path, or "", NULL if unused */
|
||||
const char* server_password; /* server's AUTH password, or "", NULL if unused */
|
||||
struct timeval command_timeout; /* timeout for commands */
|
||||
struct timeval connect_timeout; /* timeout for connect */
|
||||
int logical_db; /* the redis logical database to use */
|
||||
int setex_available; /* if the SETEX command is supported */
|
||||
/* thread-specific redis contexts */
|
||||
redisContext** ctxs;
|
||||
redisContext** replica_ctxs;
|
||||
/* number of ctx entries */
|
||||
int numctxs;
|
||||
/* server's IP address or host name */
|
||||
const char* server_host;
|
||||
const char* replica_server_host;
|
||||
/* server's TCP port */
|
||||
int server_port;
|
||||
int replica_server_port;
|
||||
/* server's unix path, or "", NULL if unused */
|
||||
const char* server_path;
|
||||
const char* replica_server_path;
|
||||
/* server's AUTH password, or "", NULL if unused */
|
||||
const char* server_password;
|
||||
const char* replica_server_password;
|
||||
/* timeout for commands */
|
||||
struct timeval command_timeout;
|
||||
struct timeval replica_command_timeout;
|
||||
/* timeout for connection setup */
|
||||
struct timeval connect_timeout;
|
||||
struct timeval replica_connect_timeout;
|
||||
/* the redis logical database to use */
|
||||
int logical_db;
|
||||
int replica_logical_db;
|
||||
/* if the SET with EX command is supported */
|
||||
int set_with_ex_available;
|
||||
};
|
||||
|
||||
static redisReply* redis_command(struct module_env*, struct cachedb_env*,
|
||||
const char*, const uint8_t*, size_t);
|
||||
const char*, const uint8_t*, size_t, int);
|
||||
|
||||
static void
|
||||
moddata_clean(struct redis_moddata** moddata) {
|
||||
|
|
@ -79,21 +97,30 @@ moddata_clean(struct redis_moddata** moddata) {
|
|||
}
|
||||
free((*moddata)->ctxs);
|
||||
}
|
||||
if((*moddata)->replica_ctxs) {
|
||||
int i;
|
||||
for(i = 0; i < (*moddata)->numctxs; i++) {
|
||||
if((*moddata)->replica_ctxs[i])
|
||||
redisFree((*moddata)->replica_ctxs[i]);
|
||||
}
|
||||
free((*moddata)->replica_ctxs);
|
||||
}
|
||||
free(*moddata);
|
||||
*moddata = NULL;
|
||||
}
|
||||
|
||||
static redisContext*
|
||||
redis_connect(const struct redis_moddata* moddata)
|
||||
redis_connect(const char* host, int port, const char* path,
|
||||
const char* password, int logical_db,
|
||||
const struct timeval connect_timeout,
|
||||
const struct timeval command_timeout)
|
||||
{
|
||||
redisContext* ctx;
|
||||
|
||||
if(moddata->server_path && moddata->server_path[0]!=0) {
|
||||
ctx = redisConnectUnixWithTimeout(moddata->server_path,
|
||||
moddata->connect_timeout);
|
||||
if(path && path[0]!=0) {
|
||||
ctx = redisConnectUnixWithTimeout(path, connect_timeout);
|
||||
} else {
|
||||
ctx = redisConnectWithTimeout(moddata->server_host,
|
||||
moddata->server_port, moddata->connect_timeout);
|
||||
ctx = redisConnectWithTimeout(host, port, connect_timeout);
|
||||
}
|
||||
if(!ctx || ctx->err) {
|
||||
const char *errstr = "out of memory";
|
||||
|
|
@ -102,13 +129,13 @@ redis_connect(const struct redis_moddata* moddata)
|
|||
log_err("failed to connect to redis server: %s", errstr);
|
||||
goto fail;
|
||||
}
|
||||
if(redisSetTimeout(ctx, moddata->command_timeout) != REDIS_OK) {
|
||||
if(redisSetTimeout(ctx, command_timeout) != REDIS_OK) {
|
||||
log_err("failed to set redis timeout, %s", ctx->errstr);
|
||||
goto fail;
|
||||
}
|
||||
if(moddata->server_password && moddata->server_password[0]!=0) {
|
||||
if(password && password[0]!=0) {
|
||||
redisReply* rep;
|
||||
rep = redisCommand(ctx, "AUTH %s", moddata->server_password);
|
||||
rep = redisCommand(ctx, "AUTH %s", password);
|
||||
if(!rep || rep->type == REDIS_REPLY_ERROR) {
|
||||
log_err("failed to authenticate with password");
|
||||
freeReplyObject(rep);
|
||||
|
|
@ -116,18 +143,25 @@ redis_connect(const struct redis_moddata* moddata)
|
|||
}
|
||||
freeReplyObject(rep);
|
||||
}
|
||||
if(moddata->logical_db > 0) {
|
||||
if(logical_db > 0) {
|
||||
redisReply* rep;
|
||||
rep = redisCommand(ctx, "SELECT %d", moddata->logical_db);
|
||||
rep = redisCommand(ctx, "SELECT %d", logical_db);
|
||||
if(!rep || rep->type == REDIS_REPLY_ERROR) {
|
||||
log_err("failed to set logical database (%d)",
|
||||
moddata->logical_db);
|
||||
logical_db);
|
||||
freeReplyObject(rep);
|
||||
goto fail;
|
||||
}
|
||||
freeReplyObject(rep);
|
||||
}
|
||||
verbose(VERB_OPS, "Connection to Redis established");
|
||||
if(verbosity >= VERB_OPS) {
|
||||
char port_str[6+1];
|
||||
port_str[0] = ' ';
|
||||
(void)snprintf(port_str+1, sizeof(port_str)-1, "%d", port);
|
||||
verbose(VERB_OPS, "Connection to Redis established (%s%s)",
|
||||
path&&path[0]!=0?path:host,
|
||||
path&&path[0]!=0?"":port_str);
|
||||
}
|
||||
return ctx;
|
||||
|
||||
fail:
|
||||
|
|
@ -136,6 +170,14 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
set_timeout(struct timeval* timeout, int value, int explicit_value)
|
||||
{
|
||||
int v = explicit_value != 0 ? explicit_value : value;
|
||||
timeout->tv_sec = v / 1000;
|
||||
timeout->tv_usec = (v % 1000) * 1000;
|
||||
}
|
||||
|
||||
static int
|
||||
redis_init(struct module_env* env, struct cachedb_env* cachedb_env)
|
||||
{
|
||||
|
|
@ -150,38 +192,60 @@ redis_init(struct module_env* env, struct cachedb_env* cachedb_env)
|
|||
goto fail;
|
||||
}
|
||||
moddata->numctxs = env->cfg->num_threads;
|
||||
/* note: server_host and similar string configuration options are
|
||||
* shallow references to configured strings; we don't have to free them
|
||||
* in this module. */
|
||||
moddata->server_host = env->cfg->redis_server_host;
|
||||
moddata->replica_server_host = env->cfg->redis_replica_server_host;
|
||||
|
||||
moddata->server_port = env->cfg->redis_server_port;
|
||||
moddata->replica_server_port = env->cfg->redis_replica_server_port;
|
||||
|
||||
moddata->server_path = env->cfg->redis_server_path;
|
||||
moddata->replica_server_path = env->cfg->redis_replica_server_path;
|
||||
|
||||
moddata->server_password = env->cfg->redis_server_password;
|
||||
moddata->replica_server_password = env->cfg->redis_replica_server_password;
|
||||
|
||||
set_timeout(&moddata->command_timeout,
|
||||
env->cfg->redis_timeout,
|
||||
env->cfg->redis_command_timeout);
|
||||
set_timeout(&moddata->replica_command_timeout,
|
||||
env->cfg->redis_replica_timeout,
|
||||
env->cfg->redis_replica_command_timeout);
|
||||
set_timeout(&moddata->connect_timeout,
|
||||
env->cfg->redis_timeout,
|
||||
env->cfg->redis_connect_timeout);
|
||||
set_timeout(&moddata->replica_connect_timeout,
|
||||
env->cfg->redis_replica_timeout,
|
||||
env->cfg->redis_replica_connect_timeout);
|
||||
|
||||
moddata->logical_db = env->cfg->redis_logical_db;
|
||||
moddata->replica_logical_db = env->cfg->redis_replica_logical_db;
|
||||
|
||||
moddata->ctxs = calloc(env->cfg->num_threads, sizeof(redisContext*));
|
||||
if(!moddata->ctxs) {
|
||||
log_err("out of memory");
|
||||
goto fail;
|
||||
}
|
||||
/* note: server_host is a shallow reference to configured string.
|
||||
* we don't have to free it in this module. */
|
||||
moddata->server_host = env->cfg->redis_server_host;
|
||||
moddata->server_port = env->cfg->redis_server_port;
|
||||
moddata->server_path = env->cfg->redis_server_path;
|
||||
moddata->server_password = env->cfg->redis_server_password;
|
||||
moddata->command_timeout.tv_sec = env->cfg->redis_timeout / 1000;
|
||||
moddata->command_timeout.tv_usec =
|
||||
(env->cfg->redis_timeout % 1000) * 1000;
|
||||
moddata->connect_timeout.tv_sec = env->cfg->redis_timeout / 1000;
|
||||
moddata->connect_timeout.tv_usec =
|
||||
(env->cfg->redis_timeout % 1000) * 1000;
|
||||
if(env->cfg->redis_command_timeout != 0) {
|
||||
moddata->command_timeout.tv_sec =
|
||||
env->cfg->redis_command_timeout / 1000;
|
||||
moddata->command_timeout.tv_usec =
|
||||
(env->cfg->redis_command_timeout % 1000) * 1000;
|
||||
if((moddata->replica_server_host && moddata->replica_server_host[0]!=0)
|
||||
|| (moddata->replica_server_path && moddata->replica_server_path[0]!=0)) {
|
||||
/* There is a replica configured, allocate ctxs */
|
||||
moddata->replica_ctxs = calloc(env->cfg->num_threads, sizeof(redisContext*));
|
||||
if(!moddata->replica_ctxs) {
|
||||
log_err("out of memory");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
if(env->cfg->redis_connect_timeout != 0) {
|
||||
moddata->connect_timeout.tv_sec =
|
||||
env->cfg->redis_connect_timeout / 1000;
|
||||
moddata->connect_timeout.tv_usec =
|
||||
(env->cfg->redis_connect_timeout % 1000) * 1000;
|
||||
}
|
||||
moddata->logical_db = env->cfg->redis_logical_db;
|
||||
for(i = 0; i < moddata->numctxs; i++) {
|
||||
redisContext* ctx = redis_connect(moddata);
|
||||
redisContext* ctx = redis_connect(
|
||||
moddata->server_host,
|
||||
moddata->server_port,
|
||||
moddata->server_path,
|
||||
moddata->server_password,
|
||||
moddata->logical_db,
|
||||
moddata->connect_timeout,
|
||||
moddata->command_timeout);
|
||||
if(!ctx) {
|
||||
log_err("redis_init: failed to init redis "
|
||||
"(for thread %d)", i);
|
||||
|
|
@ -190,17 +254,36 @@ redis_init(struct module_env* env, struct cachedb_env* cachedb_env)
|
|||
}
|
||||
moddata->ctxs[i] = ctx;
|
||||
}
|
||||
if(moddata->replica_ctxs) {
|
||||
for(i = 0; i < moddata->numctxs; i++) {
|
||||
redisContext* ctx = redis_connect(
|
||||
moddata->replica_server_host,
|
||||
moddata->replica_server_port,
|
||||
moddata->replica_server_path,
|
||||
moddata->replica_server_password,
|
||||
moddata->replica_logical_db,
|
||||
moddata->replica_connect_timeout,
|
||||
moddata->replica_command_timeout);
|
||||
if(!ctx) {
|
||||
log_err("redis_init: failed to init redis "
|
||||
"replica (for thread %d)", i);
|
||||
/* And continue, the context can be established
|
||||
* later, just like after a disconnect. */
|
||||
}
|
||||
moddata->replica_ctxs[i] = ctx;
|
||||
}
|
||||
}
|
||||
cachedb_env->backend_data = moddata;
|
||||
if(env->cfg->redis_expire_records &&
|
||||
moddata->ctxs[env->alloc->thread_num] != NULL) {
|
||||
redisReply* rep = NULL;
|
||||
int redis_reply_type = 0;
|
||||
/** check if setex command is supported */
|
||||
/** check if set with ex command is supported */
|
||||
rep = redis_command(env, cachedb_env,
|
||||
"SETEX __UNBOUND_REDIS_CHECK__ 1 none", NULL, 0);
|
||||
"SET __UNBOUND_REDIS_CHECK__ none EX 1", NULL, 0, 1);
|
||||
if(!rep) {
|
||||
/** init failed, no response from redis server*/
|
||||
goto setex_fail;
|
||||
goto set_with_ex_fail;
|
||||
}
|
||||
redis_reply_type = rep->type;
|
||||
freeReplyObject(rep);
|
||||
|
|
@ -208,17 +291,17 @@ redis_init(struct module_env* env, struct cachedb_env* cachedb_env)
|
|||
case REDIS_REPLY_STATUS:
|
||||
break;
|
||||
default:
|
||||
/** init failed, setex command not supported */
|
||||
goto setex_fail;
|
||||
/** init failed, set_with_ex command not supported */
|
||||
goto set_with_ex_fail;
|
||||
}
|
||||
moddata->setex_available = 1;
|
||||
moddata->set_with_ex_available = 1;
|
||||
}
|
||||
return 1;
|
||||
|
||||
setex_fail:
|
||||
set_with_ex_fail:
|
||||
log_err("redis_init: failure during redis_init, the "
|
||||
"redis-expire-records option requires the SETEX command "
|
||||
"(redis >= 2.0.0)");
|
||||
"redis-expire-records option requires the SET with EX command "
|
||||
"(redis >= 2.6.2)");
|
||||
return 1;
|
||||
fail:
|
||||
moddata_clean(&moddata);
|
||||
|
|
@ -250,9 +333,9 @@ redis_deinit(struct module_env* env, struct cachedb_env* cachedb_env)
|
|||
*/
|
||||
static redisReply*
|
||||
redis_command(struct module_env* env, struct cachedb_env* cachedb_env,
|
||||
const char* command, const uint8_t* data, size_t data_len)
|
||||
const char* command, const uint8_t* data, size_t data_len, int write)
|
||||
{
|
||||
redisContext* ctx;
|
||||
redisContext* ctx, **ctx_selector;
|
||||
redisReply* rep;
|
||||
struct redis_moddata* d = (struct redis_moddata*)
|
||||
cachedb_env->backend_data;
|
||||
|
|
@ -263,17 +346,38 @@ redis_command(struct module_env* env, struct cachedb_env* cachedb_env,
|
|||
* assumption throughout the unbound architecture, so we simply assert
|
||||
* it. */
|
||||
log_assert(env->alloc->thread_num < d->numctxs);
|
||||
ctx = d->ctxs[env->alloc->thread_num];
|
||||
|
||||
ctx_selector = !write && d->replica_ctxs
|
||||
?d->replica_ctxs
|
||||
:d->ctxs;
|
||||
ctx = ctx_selector[env->alloc->thread_num];
|
||||
|
||||
/* If we've not established a connection to the server or we've closed
|
||||
* it on a failure, try to re-establish a new one. Failures will be
|
||||
* logged in redis_connect(). */
|
||||
if(!ctx) {
|
||||
ctx = redis_connect(d);
|
||||
d->ctxs[env->alloc->thread_num] = ctx;
|
||||
if(!write && d->replica_ctxs) {
|
||||
ctx = redis_connect(
|
||||
d->replica_server_host,
|
||||
d->replica_server_port,
|
||||
d->replica_server_path,
|
||||
d->replica_server_password,
|
||||
d->replica_logical_db,
|
||||
d->replica_connect_timeout,
|
||||
d->replica_command_timeout);
|
||||
} else {
|
||||
ctx = redis_connect(
|
||||
d->server_host,
|
||||
d->server_port,
|
||||
d->server_path,
|
||||
d->server_password,
|
||||
d->logical_db,
|
||||
d->connect_timeout,
|
||||
d->command_timeout);
|
||||
}
|
||||
ctx_selector[env->alloc->thread_num] = ctx;
|
||||
}
|
||||
if(!ctx)
|
||||
return NULL;
|
||||
if(!ctx) return NULL;
|
||||
|
||||
/* Send the command and get a reply, synchronously. */
|
||||
rep = (redisReply*)redisCommand(ctx, command, data, data_len);
|
||||
|
|
@ -283,7 +387,7 @@ redis_command(struct module_env* env, struct cachedb_env* cachedb_env,
|
|||
log_err("redis_command: failed to receive a reply, "
|
||||
"closing connection: %s", ctx->errstr);
|
||||
redisFree(ctx);
|
||||
d->ctxs[env->alloc->thread_num] = NULL;
|
||||
ctx_selector[env->alloc->thread_num] = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -313,7 +417,7 @@ redis_lookup(struct module_env* env, struct cachedb_env* cachedb_env,
|
|||
return 0;
|
||||
}
|
||||
|
||||
rep = redis_command(env, cachedb_env, cmdbuf, NULL, 0);
|
||||
rep = redis_command(env, cachedb_env, cmdbuf, NULL, 0, 0);
|
||||
if(!rep)
|
||||
return 0;
|
||||
switch(rep->type) {
|
||||
|
|
@ -352,12 +456,14 @@ redis_store(struct module_env* env, struct cachedb_env* cachedb_env,
|
|||
int n;
|
||||
struct redis_moddata* moddata = (struct redis_moddata*)
|
||||
cachedb_env->backend_data;
|
||||
int set_ttl = (moddata->setex_available &&
|
||||
int set_ttl = (moddata->set_with_ex_available &&
|
||||
env->cfg->redis_expire_records &&
|
||||
(!env->cfg->serve_expired || env->cfg->serve_expired_ttl > 0));
|
||||
/* Supported commands:
|
||||
* - "SET " + key + " %b"
|
||||
* - "SETEX " + key + " " + ttl + " %b"
|
||||
* - "SET " + key + " %b EX " + ttl
|
||||
* older redis 2.0.0 was "SETEX " + key + " " + ttl + " %b"
|
||||
* - "EXPIRE " + key + " 0"
|
||||
*/
|
||||
char cmdbuf[6+(CACHEDB_HASHSIZE/8)*2+11+3+1];
|
||||
|
||||
|
|
@ -365,14 +471,22 @@ redis_store(struct module_env* env, struct cachedb_env* cachedb_env,
|
|||
verbose(VERB_ALGO, "redis_store %s (%d bytes)", key, (int)data_len);
|
||||
/* build command to set to a binary safe string */
|
||||
n = snprintf(cmdbuf, sizeof(cmdbuf), "SET %s %%b", key);
|
||||
} else if(ttl == 0) {
|
||||
/* use the EXPIRE command, SET with EX 0 is an invalid time. */
|
||||
/* Replies with REDIS_REPLY_INTEGER of 1. */
|
||||
verbose(VERB_ALGO, "redis_store expire %s (%d bytes)",
|
||||
key, (int)data_len);
|
||||
n = snprintf(cmdbuf, sizeof(cmdbuf), "EXPIRE %s 0", key);
|
||||
data = NULL;
|
||||
data_len = 0;
|
||||
} else {
|
||||
/* add expired ttl time to redis ttl to avoid premature eviction of key */
|
||||
ttl += env->cfg->serve_expired_ttl;
|
||||
verbose(VERB_ALGO, "redis_store %s (%d bytes) with ttl %u",
|
||||
key, (int)data_len, (uint32_t)ttl);
|
||||
key, (int)data_len, (unsigned)(uint32_t)ttl);
|
||||
/* build command to set to a binary safe string */
|
||||
n = snprintf(cmdbuf, sizeof(cmdbuf), "SETEX %s %u %%b", key,
|
||||
(uint32_t)ttl);
|
||||
n = snprintf(cmdbuf, sizeof(cmdbuf), "SET %s %%b EX %u", key,
|
||||
(unsigned)(uint32_t)ttl);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -381,11 +495,12 @@ redis_store(struct module_env* env, struct cachedb_env* cachedb_env,
|
|||
return;
|
||||
}
|
||||
|
||||
rep = redis_command(env, cachedb_env, cmdbuf, data, data_len);
|
||||
rep = redis_command(env, cachedb_env, cmdbuf, data, data_len, 1);
|
||||
if(rep) {
|
||||
verbose(VERB_ALGO, "redis_store set completed");
|
||||
if(rep->type != REDIS_REPLY_STATUS &&
|
||||
rep->type != REDIS_REPLY_ERROR) {
|
||||
rep->type != REDIS_REPLY_ERROR &&
|
||||
rep->type != REDIS_REPLY_INTEGER) {
|
||||
log_err("redis_store: unexpected type of reply (%d)",
|
||||
rep->type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ int getnameinfo(const struct sockaddr *sa, size_t ATTR_UNUSED(salen), char *host
|
|||
}
|
||||
|
||||
if (host != NULL) {
|
||||
if (flags & NI_NUMERICHOST) {
|
||||
if ((flags & NI_NUMERICHOST)) {
|
||||
if (strlcpy(host, inet_ntoa(sin->sin_addr),
|
||||
hostlen) >= hostlen)
|
||||
return (EAI_MEMORY);
|
||||
|
|
@ -168,7 +168,7 @@ getaddrinfo(const char *hostname, const char *servname,
|
|||
port = 0;
|
||||
}
|
||||
|
||||
if (hints && hints->ai_flags & AI_PASSIVE) {
|
||||
if (hints && (hints->ai_flags & AI_PASSIVE)) {
|
||||
addr = htonl(0x00000000);
|
||||
if (hostname && inet_aton(hostname, &in) != 0)
|
||||
addr = in.s_addr;
|
||||
|
|
@ -193,7 +193,7 @@ getaddrinfo(const char *hostname, const char *servname,
|
|||
}
|
||||
|
||||
/* Don't try DNS if AI_NUMERICHOST is set */
|
||||
if (hints && hints->ai_flags & AI_NUMERICHOST)
|
||||
if (hints && (hints->ai_flags & AI_NUMERICHOST))
|
||||
return (EAI_NONAME);
|
||||
|
||||
hp = gethostbyname(hostname);
|
||||
|
|
|
|||
|
|
@ -5,12 +5,8 @@
|
|||
#undef malloc
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef USE_WINSOCK
|
||||
void *malloc ();
|
||||
#else
|
||||
/* provide a prototype */
|
||||
void *malloc (size_t n);
|
||||
#endif
|
||||
|
||||
/* Allocate an N-byte block of memory from the heap.
|
||||
If N is zero, allocate a 1-byte block. */
|
||||
|
|
|
|||
22
config.h.in
22
config.h.in
|
|
@ -173,6 +173,10 @@
|
|||
0 if you don't. */
|
||||
#undef HAVE_DECL_SSL_CTX_SET_ECDH_AUTO
|
||||
|
||||
/* Define to 1 if you have the declaration of `SSL_CTX_set_tmp_ecdh', and to 0
|
||||
if you don't. */
|
||||
#undef HAVE_DECL_SSL_CTX_SET_TMP_ECDH
|
||||
|
||||
/* Define to 1 if you have the declaration of `strlcat', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRLCAT
|
||||
|
|
@ -378,6 +382,9 @@
|
|||
/* Define if we have LibreSSL */
|
||||
#undef HAVE_LIBRESSL
|
||||
|
||||
/* If we have atomic_store */
|
||||
#undef HAVE_LINK_ATOMIC_STORE
|
||||
|
||||
/* Define to 1 if you have the <linux/net_tstamp.h> header file. */
|
||||
#undef HAVE_LINUX_NET_TSTAMP_H
|
||||
|
||||
|
|
@ -474,6 +481,9 @@
|
|||
`ngtcp2_crypto_quictls_from_ossl_encryption_level' function. */
|
||||
#undef HAVE_NGTCP2_CRYPTO_QUICTLS_FROM_OSSL_ENCRYPTION_LEVEL
|
||||
|
||||
/* Define to 1 if you have the `ngtcp2_crypto_quictls_init' function. */
|
||||
#undef HAVE_NGTCP2_CRYPTO_QUICTLS_INIT
|
||||
|
||||
/* Define to 1 if the system has the type `ngtcp2_encryption_level'. */
|
||||
#undef HAVE_NGTCP2_ENCRYPTION_LEVEL
|
||||
|
||||
|
|
@ -481,6 +491,9 @@
|
|||
*/
|
||||
#undef HAVE_NGTCP2_NGTCP2_CRYPTO_OPENSSL_H
|
||||
|
||||
/* Define to 1 if you have the <ngtcp2/ngtcp2_crypto_ossl.h> header file. */
|
||||
#undef HAVE_NGTCP2_NGTCP2_CRYPTO_OSSL_H
|
||||
|
||||
/* Define to 1 if you have the <ngtcp2/ngtcp2_crypto_quictls.h> header file.
|
||||
*/
|
||||
#undef HAVE_NGTCP2_NGTCP2_CRYPTO_QUICTLS_H
|
||||
|
|
@ -642,9 +655,6 @@
|
|||
function. */
|
||||
#undef HAVE_SSL_CTX_SET_TLSEXT_TICKET_KEY_EVP_CB
|
||||
|
||||
/* Define to 1 if you have the `SSL_CTX_set_tmp_ecdh' function. */
|
||||
#undef HAVE_SSL_CTX_SET_TMP_ECDH
|
||||
|
||||
/* Define to 1 if you have the `SSL_get0_alpn_selected' function. */
|
||||
#undef HAVE_SSL_GET0_ALPN_SELECTED
|
||||
|
||||
|
|
@ -663,6 +673,9 @@
|
|||
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||
#undef HAVE_STDARG_H
|
||||
|
||||
/* Define to 1 if you have the <stdatomic.h> header file. */
|
||||
#undef HAVE_STDATOMIC_H
|
||||
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */
|
||||
#undef HAVE_STDBOOL_H
|
||||
|
||||
|
|
@ -1017,6 +1030,9 @@
|
|||
/* Define this to enable client TCP Fast Open. */
|
||||
#undef USE_MSG_FASTOPEN
|
||||
|
||||
/* Define this to use ngtcp2_crypto_ossl. */
|
||||
#undef USE_NGTCP2_CRYPTO_OSSL
|
||||
|
||||
/* Define this to enable client TCP Fast Open. */
|
||||
#undef USE_OSX_MSG_FASTOPEN
|
||||
|
||||
|
|
|
|||
322
configure
vendored
322
configure
vendored
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.71 for unbound 1.22.1.
|
||||
# Generated by GNU Autoconf 2.71 for unbound 1.23.2.
|
||||
#
|
||||
# Report bugs to <unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues>.
|
||||
#
|
||||
|
|
@ -622,8 +622,8 @@ MAKEFLAGS=
|
|||
# Identity of this package.
|
||||
PACKAGE_NAME='unbound'
|
||||
PACKAGE_TARNAME='unbound'
|
||||
PACKAGE_VERSION='1.22.1'
|
||||
PACKAGE_STRING='unbound 1.22.1'
|
||||
PACKAGE_VERSION='1.23.2'
|
||||
PACKAGE_STRING='unbound 1.23.2'
|
||||
PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues'
|
||||
PACKAGE_URL=''
|
||||
|
||||
|
|
@ -685,7 +685,9 @@ opt_dnstap_socket_path
|
|||
ENABLE_DNSTAP
|
||||
PROTOBUFC_LIBS
|
||||
PROTOBUFC_CFLAGS
|
||||
PROTOC_GEN_C
|
||||
PROTOC_C
|
||||
PROTOC
|
||||
UBSYMS
|
||||
EXTRALINK
|
||||
COMMON_OBJ_ALL_SYMBOLS
|
||||
|
|
@ -1511,7 +1513,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.22.1 to adapt to many kinds of systems.
|
||||
\`configure' configures unbound 1.23.2 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
|
@ -1577,7 +1579,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of unbound 1.22.1:";;
|
||||
short | recursive ) echo "Configuration of unbound 1.23.2:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
|
@ -1830,7 +1832,7 @@ fi
|
|||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
unbound configure 1.22.1
|
||||
unbound configure 1.23.2
|
||||
generated by GNU Autoconf 2.71
|
||||
|
||||
Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
|
|
@ -2487,7 +2489,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.22.1, which was
|
||||
It was created by unbound $as_me 1.23.2, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
$ $0$ac_configure_args_raw
|
||||
|
|
@ -3249,13 +3251,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|||
|
||||
UNBOUND_VERSION_MAJOR=1
|
||||
|
||||
UNBOUND_VERSION_MINOR=22
|
||||
UNBOUND_VERSION_MINOR=23
|
||||
|
||||
UNBOUND_VERSION_MICRO=1
|
||||
UNBOUND_VERSION_MICRO=2
|
||||
|
||||
|
||||
LIBUNBOUND_CURRENT=9
|
||||
LIBUNBOUND_REVISION=31
|
||||
LIBUNBOUND_REVISION=33
|
||||
LIBUNBOUND_AGE=1
|
||||
# 1.0.0 had 0:12:0
|
||||
# 1.0.1 had 0:13:0
|
||||
|
|
@ -3353,7 +3355,9 @@ LIBUNBOUND_AGE=1
|
|||
# 1.21.0 had 9:28:1
|
||||
# 1.21.1 had 9:29:1
|
||||
# 1.22.0 had 9:30:1
|
||||
# 1.22.1 had 9:31:1
|
||||
# 1.23.0 had 9:31:1
|
||||
# 1.23.1 had 9:32:1
|
||||
# 1.23.2 had 9:33:1
|
||||
|
||||
# Current -- the number of the binary API that we're implementing
|
||||
# Revision -- which iteration of the implementation of the binary
|
||||
|
|
@ -16100,6 +16104,14 @@ then :
|
|||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_header_compile "$LINENO" "stdatomic.h" "ac_cv_header_stdatomic_h" "$ac_includes_default
|
||||
"
|
||||
if test "x$ac_cv_header_stdatomic_h" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_STDATOMIC_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# check for types.
|
||||
# Using own tests for int64* because autoconf builtin only give 32bit.
|
||||
|
|
@ -20808,12 +20820,6 @@ then :
|
|||
printf "%s\n" "#define HAVE_BIO_SET_CALLBACK_EX 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_func "$LINENO" "SSL_CTX_set_tmp_ecdh" "ac_cv_func_SSL_CTX_set_tmp_ecdh"
|
||||
if test "x$ac_cv_func_SSL_CTX_set_tmp_ecdh" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_SSL_CTX_SET_TMP_ECDH 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# these check_funcs need -lssl
|
||||
|
|
@ -20972,6 +20978,34 @@ else $as_nop
|
|||
ac_have_decl=0
|
||||
fi
|
||||
printf "%s\n" "#define HAVE_DECL_SSL_CTX_SET_ECDH_AUTO $ac_have_decl" >>confdefs.h
|
||||
ac_fn_check_decl "$LINENO" "SSL_CTX_set_tmp_ecdh" "ac_cv_have_decl_SSL_CTX_set_tmp_ecdh" "
|
||||
$ac_includes_default
|
||||
#ifdef HAVE_OPENSSL_ERR_H
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_RAND_H
|
||||
#include <openssl/rand.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_CONF_H
|
||||
#include <openssl/conf.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_ENGINE_H
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/evp.h>
|
||||
|
||||
" "$ac_c_undeclared_builtin_options" "CFLAGS"
|
||||
if test "x$ac_cv_have_decl_SSL_CTX_set_tmp_ecdh" = xyes
|
||||
then :
|
||||
ac_have_decl=1
|
||||
else $as_nop
|
||||
ac_have_decl=0
|
||||
fi
|
||||
printf "%s\n" "#define HAVE_DECL_SSL_CTX_SET_TMP_ECDH $ac_have_decl" >>confdefs.h
|
||||
|
||||
|
||||
if test "$ac_cv_func_HMAC_Init_ex" = "yes"; then
|
||||
|
|
@ -22275,6 +22309,13 @@ if test "x$ac_cv_header_ngtcp2_ngtcp2_h" = xyes
|
|||
then :
|
||||
printf "%s\n" "#define HAVE_NGTCP2_NGTCP2_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_header_compile "$LINENO" "ngtcp2/ngtcp2_crypto_ossl.h" "ac_cv_header_ngtcp2_ngtcp2_crypto_ossl_h" "$ac_includes_default
|
||||
"
|
||||
if test "x$ac_cv_header_ngtcp2_ngtcp2_crypto_ossl_h" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_NGTCP2_NGTCP2_CRYPTO_OSSL_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_header_compile "$LINENO" "ngtcp2/ngtcp2_crypto_openssl.h" "ac_cv_header_ngtcp2_ngtcp2_crypto_openssl_h" "$ac_includes_default
|
||||
"
|
||||
|
|
@ -22315,7 +22356,52 @@ else $as_nop
|
|||
fi
|
||||
printf "%s\n" "#define HAVE_DECL_NGTCP2_CRYPTO_ENCRYPT_CB $ac_have_decl" >>confdefs.h
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ngtcp2_crypto_encrypt_cb in -lngtcp2_crypto_openssl" >&5
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ngtcp2_crypto_encrypt_cb in -lngtcp2_crypto_ossl" >&5
|
||||
printf %s "checking for ngtcp2_crypto_encrypt_cb in -lngtcp2_crypto_ossl... " >&6; }
|
||||
if test ${ac_cv_lib_ngtcp2_crypto_ossl_ngtcp2_crypto_encrypt_cb+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lngtcp2_crypto_ossl $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char ngtcp2_crypto_encrypt_cb ();
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return ngtcp2_crypto_encrypt_cb ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
ac_cv_lib_ngtcp2_crypto_ossl_ngtcp2_crypto_encrypt_cb=yes
|
||||
else $as_nop
|
||||
ac_cv_lib_ngtcp2_crypto_ossl_ngtcp2_crypto_encrypt_cb=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ngtcp2_crypto_ossl_ngtcp2_crypto_encrypt_cb" >&5
|
||||
printf "%s\n" "$ac_cv_lib_ngtcp2_crypto_ossl_ngtcp2_crypto_encrypt_cb" >&6; }
|
||||
if test "x$ac_cv_lib_ngtcp2_crypto_ossl_ngtcp2_crypto_encrypt_cb" = xyes
|
||||
then :
|
||||
|
||||
LIBS="$LIBS -lngtcp2_crypto_ossl"
|
||||
|
||||
printf "%s\n" "#define USE_NGTCP2_CRYPTO_OSSL 1" >>confdefs.h
|
||||
|
||||
|
||||
else $as_nop
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ngtcp2_crypto_encrypt_cb in -lngtcp2_crypto_openssl" >&5
|
||||
printf %s "checking for ngtcp2_crypto_encrypt_cb in -lngtcp2_crypto_openssl... " >&6; }
|
||||
if test ${ac_cv_lib_ngtcp2_crypto_openssl_ngtcp2_crypto_encrypt_cb+y}
|
||||
then :
|
||||
|
|
@ -22353,9 +22439,9 @@ printf "%s\n" "$ac_cv_lib_ngtcp2_crypto_openssl_ngtcp2_crypto_encrypt_cb" >&6; }
|
|||
if test "x$ac_cv_lib_ngtcp2_crypto_openssl_ngtcp2_crypto_encrypt_cb" = xyes
|
||||
then :
|
||||
LIBS="$LIBS -lngtcp2_crypto_openssl"
|
||||
fi
|
||||
else $as_nop
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ngtcp2_crypto_encrypt_cb in -lngtcp2_crypto_quictls" >&5
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ngtcp2_crypto_encrypt_cb in -lngtcp2_crypto_quictls" >&5
|
||||
printf %s "checking for ngtcp2_crypto_encrypt_cb in -lngtcp2_crypto_quictls... " >&6; }
|
||||
if test ${ac_cv_lib_ngtcp2_crypto_quictls_ngtcp2_crypto_encrypt_cb+y}
|
||||
then :
|
||||
|
|
@ -22393,6 +22479,12 @@ printf "%s\n" "$ac_cv_lib_ngtcp2_crypto_quictls_ngtcp2_crypto_encrypt_cb" >&6; }
|
|||
if test "x$ac_cv_lib_ngtcp2_crypto_quictls_ngtcp2_crypto_encrypt_cb" = xyes
|
||||
then :
|
||||
LIBS="$LIBS -lngtcp2_crypto_quictls"
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "ngtcp2_crypto_encrypt_cb" "ac_cv_func_ngtcp2_crypto_encrypt_cb"
|
||||
|
|
@ -22442,6 +22534,12 @@ if test "x$ac_cv_func_ngtcp2_crypto_quictls_configure_client_context" = xyes
|
|||
then :
|
||||
printf "%s\n" "#define HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_func "$LINENO" "ngtcp2_crypto_quictls_init" "ac_cv_func_ngtcp2_crypto_quictls_init"
|
||||
if test "x$ac_cv_func_ngtcp2_crypto_quictls_init" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_NGTCP2_CRYPTO_QUICTLS_INIT 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_func "$LINENO" "ngtcp2_conn_get_num_scid" "ac_cv_func_ngtcp2_conn_get_num_scid"
|
||||
if test "x$ac_cv_func_ngtcp2_conn_get_num_scid" = xyes
|
||||
|
|
@ -22463,6 +22561,10 @@ then :
|
|||
fi
|
||||
|
||||
|
||||
# these check_funcs need -lssl
|
||||
BAKLIBS="$LIBS"
|
||||
LIBS="-lssl $LIBS"
|
||||
|
||||
for ac_func in SSL_is_quic
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "SSL_is_quic" "ac_cv_func_SSL_is_quic"
|
||||
|
|
@ -22475,6 +22577,8 @@ else $as_nop
|
|||
fi
|
||||
|
||||
done
|
||||
LIBS="$BAKLIBS"
|
||||
|
||||
ac_fn_c_check_type "$LINENO" "struct ngtcp2_version_cid" "ac_cv_type_struct_ngtcp2_version_cid" "$ac_includes_default
|
||||
#include <ngtcp2/ngtcp2.h>
|
||||
|
||||
|
|
@ -23522,6 +23626,48 @@ if echo $host_os | grep darwin8 > /dev/null; then
|
|||
printf "%s\n" "#define DARWIN_BROKEN_SETREUID 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for atomic_store" >&5
|
||||
printf %s "checking for atomic_store... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#ifdef HAVE_STDATOMIC_H
|
||||
#include <stdatomic.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
int newvar = 5, var = 0;
|
||||
atomic_store((_Atomic int*)&var, newvar);
|
||||
newvar = 0;
|
||||
/* condition to use the variables. */
|
||||
if(var == newvar) return 1;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
|
||||
printf "%s\n" "#define HAVE_LINK_ATOMIC_STORE 1" >>confdefs.h
|
||||
|
||||
|
||||
else $as_nop
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
|
||||
ac_fn_check_decl "$LINENO" "inet_pton" "ac_cv_have_decl_inet_pton" "
|
||||
$ac_includes_default
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
|
|
@ -24198,7 +24344,55 @@ fi
|
|||
|
||||
|
||||
if test "x$opt_dnstap" != "xno"; then
|
||||
# Extract the first word of "protoc-c", so it can be a program name with args.
|
||||
# Extract the first word of "protoc", so it can be a program name with args.
|
||||
set dummy protoc; ac_word=$2
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
printf %s "checking for $ac_word... " >&6; }
|
||||
if test ${ac_cv_path_PROTOC+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
case $PROTOC in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_PROTOC="$PROTOC" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
case $as_dir in #(((
|
||||
'') as_dir=./ ;;
|
||||
*/) ;;
|
||||
*) as_dir=$as_dir/ ;;
|
||||
esac
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_PROTOC="$as_dir$ac_word$ac_exec_ext"
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
PROTOC=$ac_cv_path_PROTOC
|
||||
if test -n "$PROTOC"; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PROTOC" >&5
|
||||
printf "%s\n" "$PROTOC" >&6; }
|
||||
else
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
# 'protoc-c' is deprecated. We use 'protoc' instead. If it can not be
|
||||
# found, try 'protoc-c'.
|
||||
if test -z "$PROTOC"; then
|
||||
# Extract the first word of "protoc-c", so it can be a program name with args.
|
||||
set dummy protoc-c; ac_word=$2
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
printf %s "checking for $ac_word... " >&6; }
|
||||
|
|
@ -24243,9 +24437,83 @@ printf "%s\n" "no" >&6; }
|
|||
fi
|
||||
|
||||
|
||||
if test -z "$PROTOC_C"; then
|
||||
as_fn_error $? "The protoc-c program was not found. Please install protobuf-c!" "$LINENO" 5
|
||||
fi
|
||||
else
|
||||
PROTOC_C="$PROTOC"
|
||||
fi
|
||||
if test -z "$PROTOC_C"; then
|
||||
as_fn_error $? "The protoc or protoc-c program was not found. It is needed for dnstap, use --disable-dnstap, or install protobuf-c to provide protoc or protoc-c" "$LINENO" 5
|
||||
fi
|
||||
|
||||
# Check for protoc-gen-c plugin
|
||||
# Extract the first word of "protoc-gen-c", so it can be a program name with args.
|
||||
set dummy protoc-gen-c; ac_word=$2
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
printf %s "checking for $ac_word... " >&6; }
|
||||
if test ${ac_cv_path_PROTOC_GEN_C+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
case $PROTOC_GEN_C in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_PROTOC_GEN_C="$PROTOC_GEN_C" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
case $as_dir in #(((
|
||||
'') as_dir=./ ;;
|
||||
*/) ;;
|
||||
*) as_dir=$as_dir/ ;;
|
||||
esac
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_PROTOC_GEN_C="$as_dir$ac_word$ac_exec_ext"
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
PROTOC_GEN_C=$ac_cv_path_PROTOC_GEN_C
|
||||
if test -n "$PROTOC_GEN_C"; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PROTOC_GEN_C" >&5
|
||||
printf "%s\n" "$PROTOC_GEN_C" >&6; }
|
||||
else
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
if test -z "$PROTOC_GEN_C"; then
|
||||
as_fn_error $? "The protoc-gen-c plugin was not found. It is needed for dnstap, use --disable-dnstap, or install protobuf-c-compiler to provide protoc-gen-c" "$LINENO" 5
|
||||
fi
|
||||
|
||||
# Test that protoc-gen-c actually works
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if protoc-gen-c plugin works" >&5
|
||||
printf %s "checking if protoc-gen-c plugin works... " >&6; }
|
||||
cat > conftest.proto << EOF
|
||||
syntax = "proto2";
|
||||
message TestMessage {
|
||||
optional string test_field = 1;
|
||||
}
|
||||
EOF
|
||||
if $PROTOC_C --c_out=. conftest.proto >/dev/null 2>&1; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
rm -f conftest.proto conftest.pb-c.c conftest.pb-c.h
|
||||
else
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
rm -f conftest.proto conftest.pb-c.c conftest.pb-c.h
|
||||
as_fn_error $? "The protoc-gen-c plugin is not working properly. Please ensure protobuf-c-compiler is properly installed" "$LINENO" 5
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-protobuf-c was given.
|
||||
if test ${with_protobuf_c+y}
|
||||
|
|
@ -25023,7 +25291,7 @@ printf "%s\n" "#define MAXSYSLOGMSGLEN 10240" >>confdefs.h
|
|||
|
||||
|
||||
|
||||
version=1.22.1
|
||||
version=1.23.2
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build time" >&5
|
||||
printf %s "checking for build time... " >&6; }
|
||||
|
|
@ -25553,7 +25821,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.22.1, which was
|
||||
This file was extended by unbound $as_me 1.23.2, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
|
@ -25621,7 +25889,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
|||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config='$ac_cs_config_escaped'
|
||||
ac_cs_version="\\
|
||||
unbound config.status 1.22.1
|
||||
unbound config.status 1.23.2
|
||||
configured by $0, generated by GNU Autoconf 2.71,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
|
|
|||
54
configure.ac
54
configure.ac
|
|
@ -11,15 +11,15 @@ sinclude(dnscrypt/dnscrypt.m4)
|
|||
|
||||
# must be numbers. ac_defun because of later processing
|
||||
m4_define([VERSION_MAJOR],[1])
|
||||
m4_define([VERSION_MINOR],[22])
|
||||
m4_define([VERSION_MICRO],[1])
|
||||
m4_define([VERSION_MINOR],[23])
|
||||
m4_define([VERSION_MICRO],[2])
|
||||
AC_INIT([unbound],m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]),[unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues],[unbound])
|
||||
AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
|
||||
AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
|
||||
AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
|
||||
|
||||
LIBUNBOUND_CURRENT=9
|
||||
LIBUNBOUND_REVISION=31
|
||||
LIBUNBOUND_REVISION=33
|
||||
LIBUNBOUND_AGE=1
|
||||
# 1.0.0 had 0:12:0
|
||||
# 1.0.1 had 0:13:0
|
||||
|
|
@ -117,7 +117,9 @@ LIBUNBOUND_AGE=1
|
|||
# 1.21.0 had 9:28:1
|
||||
# 1.21.1 had 9:29:1
|
||||
# 1.22.0 had 9:30:1
|
||||
# 1.22.1 had 9:31:1
|
||||
# 1.23.0 had 9:31:1
|
||||
# 1.23.1 had 9:32:1
|
||||
# 1.23.2 had 9:33:1
|
||||
|
||||
# Current -- the number of the binary API that we're implementing
|
||||
# Revision -- which iteration of the implementation of the binary
|
||||
|
|
@ -524,6 +526,7 @@ AC_CHECK_HEADERS([netioapi.h],,, [AC_INCLUDES_DEFAULT
|
|||
|
||||
# Check for Linux timestamping headers
|
||||
AC_CHECK_HEADERS([linux/net_tstamp.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_HEADERS([stdatomic.h],,, [AC_INCLUDES_DEFAULT])
|
||||
|
||||
# check for types.
|
||||
# Using own tests for int64* because autoconf builtin only give 32bit.
|
||||
|
|
@ -994,7 +997,7 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
AC_CHECK_HEADERS([openssl/conf.h openssl/engine.h openssl/bn.h openssl/dh.h openssl/dsa.h openssl/rsa.h openssl/core_names.h openssl/param_build.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode EVP_default_properties_is_fips_enabled EVP_MD_CTX_new OpenSSL_add_all_digests OPENSSL_init_crypto EVP_cleanup ENGINE_cleanup ERR_load_crypto_strings CRYPTO_cleanup_all_ex_data ERR_free_strings RAND_cleanup DSA_SIG_set0 EVP_dss1 EVP_DigestVerify EVP_aes_256_cbc EVP_EncryptInit_ex HMAC_Init_ex CRYPTO_THREADID_set_callback EVP_MAC_CTX_set_params OSSL_PARAM_BLD_new BIO_set_callback_ex SSL_CTX_set_tmp_ecdh])
|
||||
AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode EVP_default_properties_is_fips_enabled EVP_MD_CTX_new OpenSSL_add_all_digests OPENSSL_init_crypto EVP_cleanup ENGINE_cleanup ERR_load_crypto_strings CRYPTO_cleanup_all_ex_data ERR_free_strings RAND_cleanup DSA_SIG_set0 EVP_dss1 EVP_DigestVerify EVP_aes_256_cbc EVP_EncryptInit_ex HMAC_Init_ex CRYPTO_THREADID_set_callback EVP_MAC_CTX_set_params OSSL_PARAM_BLD_new BIO_set_callback_ex])
|
||||
|
||||
# these check_funcs need -lssl
|
||||
BAKLIBS="$LIBS"
|
||||
|
|
@ -1002,7 +1005,7 @@ LIBS="-lssl $LIBS"
|
|||
AC_CHECK_FUNCS([OPENSSL_init_ssl SSL_CTX_set_security_level SSL_set1_host SSL_get0_peername X509_VERIFY_PARAM_set1_host SSL_CTX_set_ciphersuites SSL_CTX_set_tlsext_ticket_key_evp_cb SSL_CTX_set_alpn_select_cb SSL_get0_alpn_selected SSL_CTX_set_alpn_protos SSL_get1_peer_certificate])
|
||||
LIBS="$BAKLIBS"
|
||||
|
||||
AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free,SSL_CTX_set_ecdh_auto], [], [], [
|
||||
AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free,SSL_CTX_set_ecdh_auto,SSL_CTX_set_tmp_ecdh], [], [], [
|
||||
AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_OPENSSL_ERR_H
|
||||
#include <openssl/err.h>
|
||||
|
|
@ -1608,17 +1611,29 @@ if test x_$withval = x_yes -o x_$withval != x_no; then
|
|||
if test x_$found_libngtcp2 != x_yes; then
|
||||
AC_MSG_ERROR([Could not find libngtcp2, ngtcp2.h])
|
||||
fi
|
||||
AC_CHECK_HEADERS([ngtcp2/ngtcp2.h ngtcp2/ngtcp2_crypto_openssl.h ngtcp2/ngtcp2_crypto_quictls.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_HEADERS([ngtcp2/ngtcp2.h ngtcp2/ngtcp2_crypto_ossl.h ngtcp2/ngtcp2_crypto_openssl.h ngtcp2/ngtcp2_crypto_quictls.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_DECLS([ngtcp2_conn_server_new], [], [], [AC_INCLUDES_DEFAULT
|
||||
#include <ngtcp2/ngtcp2.h>
|
||||
])
|
||||
AC_CHECK_DECLS([ngtcp2_crypto_encrypt_cb], [], [], [AC_INCLUDES_DEFAULT
|
||||
#include <ngtcp2/ngtcp2_crypto.h>
|
||||
])
|
||||
AC_CHECK_LIB([ngtcp2_crypto_openssl], [ngtcp2_crypto_encrypt_cb], [ LIBS="$LIBS -lngtcp2_crypto_openssl" ])
|
||||
AC_CHECK_LIB([ngtcp2_crypto_quictls], [ngtcp2_crypto_encrypt_cb], [ LIBS="$LIBS -lngtcp2_crypto_quictls" ])
|
||||
AC_CHECK_FUNCS([ngtcp2_crypto_encrypt_cb ngtcp2_ccerr_default ngtcp2_conn_in_closing_period ngtcp2_conn_in_draining_period ngtcp2_conn_get_max_local_streams_uni ngtcp2_crypto_quictls_from_ossl_encryption_level ngtcp2_crypto_quictls_configure_server_context ngtcp2_crypto_quictls_configure_client_context ngtcp2_conn_get_num_scid ngtcp2_conn_tls_early_data_rejected ngtcp2_conn_encode_0rtt_transport_params])
|
||||
AC_CHECK_LIB([ngtcp2_crypto_ossl], [ngtcp2_crypto_encrypt_cb], [
|
||||
LIBS="$LIBS -lngtcp2_crypto_ossl"
|
||||
AC_DEFINE(USE_NGTCP2_CRYPTO_OSSL, 1, [Define this to use ngtcp2_crypto_ossl.])
|
||||
], [
|
||||
AC_CHECK_LIB([ngtcp2_crypto_openssl], [ngtcp2_crypto_encrypt_cb], [ LIBS="$LIBS -lngtcp2_crypto_openssl" ], [
|
||||
AC_CHECK_LIB([ngtcp2_crypto_quictls], [ngtcp2_crypto_encrypt_cb], [ LIBS="$LIBS -lngtcp2_crypto_quictls" ])
|
||||
])
|
||||
])
|
||||
AC_CHECK_FUNCS([ngtcp2_crypto_encrypt_cb ngtcp2_ccerr_default ngtcp2_conn_in_closing_period ngtcp2_conn_in_draining_period ngtcp2_conn_get_max_local_streams_uni ngtcp2_crypto_quictls_from_ossl_encryption_level ngtcp2_crypto_quictls_configure_server_context ngtcp2_crypto_quictls_configure_client_context ngtcp2_crypto_quictls_init ngtcp2_conn_get_num_scid ngtcp2_conn_tls_early_data_rejected ngtcp2_conn_encode_0rtt_transport_params])
|
||||
|
||||
# these check_funcs need -lssl
|
||||
BAKLIBS="$LIBS"
|
||||
LIBS="-lssl $LIBS"
|
||||
AC_CHECK_FUNCS([SSL_is_quic], [], [AC_MSG_ERROR([No QUIC support detected in OpenSSL. Need OpenSSL version with QUIC support to enable DNS over QUIC with libngtcp2.])])
|
||||
LIBS="$BAKLIBS"
|
||||
|
||||
AC_CHECK_TYPES([struct ngtcp2_version_cid, ngtcp2_encryption_level],,,[AC_INCLUDES_DEFAULT
|
||||
#include <ngtcp2/ngtcp2.h>
|
||||
])
|
||||
|
|
@ -1817,6 +1832,25 @@ AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])])
|
|||
if echo $host_os | grep darwin8 > /dev/null; then
|
||||
AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for atomic_store])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM(AC_INCLUDES_DEFAULT [[
|
||||
#ifdef HAVE_STDATOMIC_H
|
||||
#include <stdatomic.h>
|
||||
#endif
|
||||
]], [[
|
||||
int newvar = 5, var = 0;
|
||||
atomic_store((_Atomic int*)&var, newvar);
|
||||
newvar = 0;
|
||||
/* condition to use the variables. */
|
||||
if(var == newvar) return 1;
|
||||
]])], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_LINK_ATOMIC_STORE, 1, [If we have atomic_store])
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
|
||||
AC_CHECK_DECLS([inet_pton,inet_ntop], [], [], [
|
||||
AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
|
|
|
|||
|
|
@ -1,21 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
LIBEXPAT_FNAME=expat-2.7.0
|
||||
LIBEXPAT_VERSION_DIR=R_2_7_0
|
||||
|
||||
echo "Downloading Expat"
|
||||
if ! curl -L -k -s -o expat-2.2.9.tar.gz https://github.com/libexpat/libexpat/releases/download/R_2_2_9/expat-2.2.9.tar.gz;
|
||||
if ! curl -L -k -s -o $LIBEXPAT_FNAME.tar.gz https://github.com/libexpat/libexpat/releases/download/$LIBEXPAT_VERSION_DIR/$LIBEXPAT_FNAME.tar.gz;
|
||||
then
|
||||
echo "Failed to download Expat"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Unpacking Expat"
|
||||
rm -rf ./expat-2.2.9
|
||||
if ! tar -xf expat-2.2.9.tar.gz;
|
||||
rm -rf ./$LIBEXPAT_FNAME
|
||||
if ! tar -xf $LIBEXPAT_FNAME.tar.gz;
|
||||
then
|
||||
echo "Failed to unpack Expat"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd expat-2.2.9 || exit 1
|
||||
cd $LIBEXPAT_FNAME || exit 1
|
||||
|
||||
echo "Configuring Expat"
|
||||
if ! ./configure --build="$AUTOTOOLS_BUILD" --host="$AUTOTOOLS_HOST" --prefix="$ANDROID_PREFIX"; then
|
||||
|
|
|
|||
|
|
@ -1,28 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
LIBEXPAT_FNAME=expat-2.7.0
|
||||
LIBEXPAT_VERSION_DIR=R_2_7_0
|
||||
|
||||
echo "Downloading Expat"
|
||||
if ! curl -L -k -s -o expat-2.2.9.tar.gz https://github.com/libexpat/libexpat/releases/download/R_2_2_9/expat-2.2.9.tar.gz;
|
||||
if ! curl -L -k -s -o $LIBEXPAT_FNAME.tar.gz https://github.com/libexpat/libexpat/releases/download/$LIBEXPAT_VERSION_DIR/$LIBEXPAT_FNAME.tar.gz;
|
||||
then
|
||||
echo "Failed to download Expat"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Unpacking Expat"
|
||||
rm -rf ./expat-2.2.9
|
||||
if ! tar -xf expat-2.2.9.tar.gz;
|
||||
rm -rf ./$LIBEXPAT_FNAME
|
||||
if ! tar -xf $LIBEXPAT_FNAME.tar.gz;
|
||||
then
|
||||
echo "Failed to unpack Expat"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd expat-2.2.9 || exit 1
|
||||
cd $LIBEXPAT_FNAME || exit 1
|
||||
|
||||
export PKG_CONFIG_PATH="$IOS_PREFIX/lib/pkgconfig"
|
||||
|
||||
echo "Configuring Expat"
|
||||
if ! ./configure \
|
||||
--build="$AUTOTOOLS_BUILD" --host="$AUTOTOOLS_HOST" \
|
||||
--prefix="$IOS_PREFIX" ; then
|
||||
if ! ./configure --without-tests \
|
||||
--build="$AUTOTOOLS_BUILD" --host="$AUTOTOOLS_HOST" \
|
||||
--prefix="$IOS_PREFIX" ;
|
||||
then
|
||||
echo "Error: Failed to configure Expat"
|
||||
cat config.log
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -816,3 +816,14 @@ log_acl_action(const char* action, struct sockaddr_storage* addr,
|
|||
(int)port);
|
||||
}
|
||||
}
|
||||
|
||||
void acl_list_swap_tree(struct acl_list* acl, struct acl_list* data)
|
||||
{
|
||||
/* swap tree and region */
|
||||
rbtree_type oldtree = acl->tree;
|
||||
struct regional* oldregion = acl->region;
|
||||
acl->tree = data->tree;
|
||||
acl->region = data->region;
|
||||
data->tree = oldtree;
|
||||
data->region = oldregion;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,4 +201,12 @@ const char* acl_access_to_str(enum acl_access acl);
|
|||
void log_acl_action(const char* action, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, enum acl_access acl, struct acl_addr* acladdr);
|
||||
|
||||
/**
|
||||
* Swap internal tree with preallocated entries.
|
||||
* @param acl: the acl structure.
|
||||
* @param data: the data structure used to take elements from. This contains
|
||||
* the old elements on return.
|
||||
*/
|
||||
void acl_list_swap_tree(struct acl_list* acl, struct acl_list* data);
|
||||
|
||||
#endif /* DAEMON_ACL_LIST_H */
|
||||
|
|
|
|||
|
|
@ -323,8 +323,7 @@ daemon_init(void)
|
|||
return daemon;
|
||||
}
|
||||
|
||||
static int setup_acl_for_ports(struct acl_list* list,
|
||||
struct listen_port* port_list)
|
||||
int setup_acl_for_ports(struct acl_list* list, struct listen_port* port_list)
|
||||
{
|
||||
struct acl_addr* acl_node;
|
||||
for(; port_list; port_list=port_list->next) {
|
||||
|
|
@ -717,16 +716,16 @@ daemon_fork(struct daemon* daemon)
|
|||
#endif
|
||||
|
||||
log_assert(daemon);
|
||||
if(!(daemon->views = views_create()))
|
||||
if(!(daemon->env->views = views_create()))
|
||||
fatal_exit("Could not create views: out of memory");
|
||||
/* create individual views and their localzone/data trees */
|
||||
if(!views_apply_cfg(daemon->views, daemon->cfg))
|
||||
if(!views_apply_cfg(daemon->env->views, daemon->cfg))
|
||||
fatal_exit("Could not set up views");
|
||||
|
||||
if(!acl_list_apply_cfg(daemon->acl, daemon->cfg, daemon->views))
|
||||
if(!acl_list_apply_cfg(daemon->acl, daemon->cfg, daemon->env->views))
|
||||
fatal_exit("Could not setup access control list");
|
||||
if(!acl_interface_apply_cfg(daemon->acl_interface, daemon->cfg,
|
||||
daemon->views))
|
||||
daemon->env->views))
|
||||
fatal_exit("Could not setup interface control list");
|
||||
if(!tcl_list_apply_cfg(daemon->tcl, daemon->cfg))
|
||||
fatal_exit("Could not setup TCP connection limits");
|
||||
|
|
@ -762,15 +761,15 @@ daemon_fork(struct daemon* daemon)
|
|||
fatal_exit("Could not set root or stub hints");
|
||||
|
||||
/* process raw response-ip configuration data */
|
||||
if(!(daemon->respip_set = respip_set_create()))
|
||||
if(!(daemon->env->respip_set = respip_set_create()))
|
||||
fatal_exit("Could not create response IP set");
|
||||
if(!respip_global_apply_cfg(daemon->respip_set, daemon->cfg))
|
||||
if(!respip_global_apply_cfg(daemon->env->respip_set, daemon->cfg))
|
||||
fatal_exit("Could not set up response IP set");
|
||||
if(!respip_views_apply_cfg(daemon->views, daemon->cfg,
|
||||
if(!respip_views_apply_cfg(daemon->env->views, daemon->cfg,
|
||||
&have_view_respip_cfg))
|
||||
fatal_exit("Could not set up per-view response IP sets");
|
||||
daemon->use_response_ip = !respip_set_is_empty(daemon->respip_set) ||
|
||||
have_view_respip_cfg;
|
||||
daemon->use_response_ip = !respip_set_is_empty(
|
||||
daemon->env->respip_set) || have_view_respip_cfg;
|
||||
|
||||
/* setup modules */
|
||||
daemon_setup_modules(daemon);
|
||||
|
|
@ -886,14 +885,18 @@ daemon_cleanup(struct daemon* daemon)
|
|||
daemon->env->hints = NULL;
|
||||
local_zones_delete(daemon->local_zones);
|
||||
daemon->local_zones = NULL;
|
||||
respip_set_delete(daemon->respip_set);
|
||||
daemon->respip_set = NULL;
|
||||
views_delete(daemon->views);
|
||||
daemon->views = NULL;
|
||||
respip_set_delete(daemon->env->respip_set);
|
||||
daemon->env->respip_set = NULL;
|
||||
views_delete(daemon->env->views);
|
||||
daemon->env->views = NULL;
|
||||
if(daemon->env->auth_zones)
|
||||
auth_zones_cleanup(daemon->env->auth_zones);
|
||||
/* key cache is cleared by module deinit during next daemon_fork() */
|
||||
daemon_remote_clear(daemon->rc);
|
||||
if(daemon->fast_reload_thread)
|
||||
fast_reload_thread_stop(daemon->fast_reload_thread);
|
||||
if(daemon->fast_reload_printq_list)
|
||||
fast_reload_printq_list_delete(daemon->fast_reload_printq_list);
|
||||
for(i=0; i<daemon->num; i++)
|
||||
worker_delete(daemon->workers[i]);
|
||||
free(daemon->workers);
|
||||
|
|
@ -951,6 +954,7 @@ daemon_delete(struct daemon* daemon)
|
|||
listen_desetup_locks();
|
||||
free(daemon->chroot);
|
||||
free(daemon->pidfile);
|
||||
free(daemon->cfgfile);
|
||||
free(daemon->env);
|
||||
#ifdef HAVE_SSL
|
||||
listen_sslctx_delete_ticket_keys();
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ struct respip_set;
|
|||
struct shm_main_info;
|
||||
struct doq_table;
|
||||
struct cookie_secrets;
|
||||
struct fast_reload_thread;
|
||||
struct fast_reload_printq;
|
||||
|
||||
#include "dnstap/dnstap_config.h"
|
||||
#ifdef USE_DNSTAP
|
||||
|
|
@ -137,15 +139,11 @@ struct daemon {
|
|||
struct timeval time_last_stat;
|
||||
/** time when daemon started */
|
||||
struct timeval time_boot;
|
||||
/** views structure containing view tree */
|
||||
struct views* views;
|
||||
#ifdef USE_DNSTAP
|
||||
/** the dnstap environment master value, copied and changed by threads*/
|
||||
struct dt_env* dtenv;
|
||||
#endif
|
||||
struct shm_main_info* shm_info;
|
||||
/** response-ip set with associated actions and tags. */
|
||||
struct respip_set* respip_set;
|
||||
/** some response-ip tags or actions are configured if true */
|
||||
int use_response_ip;
|
||||
/** some RPZ policies are configured */
|
||||
|
|
@ -160,6 +158,17 @@ struct daemon {
|
|||
int reuse_cache;
|
||||
/** the EDNS cookie secrets from the cookie-secret-file */
|
||||
struct cookie_secrets* cookie_secrets;
|
||||
/** the fast reload thread, or NULL */
|
||||
struct fast_reload_thread* fast_reload_thread;
|
||||
/** the fast reload printq list */
|
||||
struct fast_reload_printq* fast_reload_printq_list;
|
||||
/** the fast reload option to drop mesh queries, true if so. */
|
||||
int fast_reload_drop_mesh;
|
||||
/** for fast reload, if the tcl, tcp connection limits, has
|
||||
* changes for workers */
|
||||
int fast_reload_tcl_has_changes;
|
||||
/** config file name */
|
||||
char* cfgfile;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -212,4 +221,12 @@ void daemon_delete(struct daemon* daemon);
|
|||
*/
|
||||
void daemon_apply_cfg(struct daemon* daemon, struct config_file* cfg);
|
||||
|
||||
/**
|
||||
* Setup acl list to have entries for the port list.
|
||||
* @param list: the acl interface
|
||||
* @param port_list: list of open ports, or none.
|
||||
* @return false on failure
|
||||
*/
|
||||
int setup_acl_for_ports(struct acl_list* list, struct listen_port* port_list);
|
||||
|
||||
#endif /* DAEMON_H */
|
||||
|
|
|
|||
4063
daemon/remote.c
4063
daemon/remote.c
File diff suppressed because it is too large
Load diff
167
daemon/remote.h
167
daemon/remote.h
|
|
@ -48,6 +48,7 @@
|
|||
#ifdef HAVE_OPENSSL_SSL_H
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
#include "util/locks.h"
|
||||
struct config_file;
|
||||
struct listen_list;
|
||||
struct listen_port;
|
||||
|
|
@ -55,6 +56,7 @@ struct worker;
|
|||
struct comm_reply;
|
||||
struct comm_point;
|
||||
struct daemon_remote;
|
||||
struct config_strlist_head;
|
||||
|
||||
/** number of milliseconds timeout on incoming remote control handshake */
|
||||
#define REMOTE_CONTROL_TCP_TIMEOUT 120000
|
||||
|
|
@ -118,6 +120,137 @@ struct remote_stream {
|
|||
};
|
||||
typedef struct remote_stream RES;
|
||||
|
||||
/**
|
||||
* Notification status. This is exchanged between the fast reload thread
|
||||
* and the server thread, over the commpair sockets.
|
||||
*/
|
||||
enum fast_reload_notification {
|
||||
/** nothing, not used */
|
||||
fast_reload_notification_none = 0,
|
||||
/** the fast reload thread is done */
|
||||
fast_reload_notification_done = 1,
|
||||
/** the fast reload thread is done but with an error, it failed */
|
||||
fast_reload_notification_done_error = 2,
|
||||
/** the fast reload thread is told to exit by the server thread.
|
||||
* Sent on server quit while the reload is running. */
|
||||
fast_reload_notification_exit = 3,
|
||||
/** the fast reload thread has exited, after being told to exit */
|
||||
fast_reload_notification_exited = 4,
|
||||
/** the fast reload thread has information to print out */
|
||||
fast_reload_notification_printout = 5,
|
||||
/** stop as part of the reload the thread and other threads */
|
||||
fast_reload_notification_reload_stop = 6,
|
||||
/** ack the stop as part of the reload, and also ack start */
|
||||
fast_reload_notification_reload_ack = 7,
|
||||
/** resume from stop as part of the reload */
|
||||
fast_reload_notification_reload_start = 8,
|
||||
/** the fast reload thread wants the mainthread to poll workers,
|
||||
* after the reload, sent when nopause is used */
|
||||
fast_reload_notification_reload_nopause_poll = 9
|
||||
};
|
||||
|
||||
/**
|
||||
* Fast reload printout queue. Contains a list of strings, that need to be
|
||||
* printed over the file descriptor.
|
||||
*/
|
||||
struct fast_reload_printq {
|
||||
/** if this item is in a list, the previous and next */
|
||||
struct fast_reload_printq *prev, *next;
|
||||
/** if this item is in a list, it is true. */
|
||||
int in_list;
|
||||
/** list of strings to printout */
|
||||
struct config_strlist_head* to_print;
|
||||
/** the current item to print. It is malloced. NULL if none. */
|
||||
char* client_item;
|
||||
/** The length, strlen, of the client_item, that has to be sent. */
|
||||
int client_len;
|
||||
/** The number of bytes sent of client_item. */
|
||||
int client_byte_count;
|
||||
/** the comm point for the client connection, the remote control
|
||||
* client. */
|
||||
struct comm_point* client_cp;
|
||||
/** the remote control connection to print output to. */
|
||||
struct remote_stream remote;
|
||||
/** the worker that the event is added in */
|
||||
struct worker* worker;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fast reload auth zone change. Keeps track if an auth zone was removed,
|
||||
* added or changed. This is needed because workers can have events for
|
||||
* dealing with auth zones, like transfers, and those have to be removed
|
||||
* too, not just the auth zone structure from the tree. */
|
||||
struct fast_reload_auth_change {
|
||||
/** next in the list of auth zone changes. */
|
||||
struct fast_reload_auth_change* next;
|
||||
/** the zone in the old config */
|
||||
struct auth_zone* old_z;
|
||||
/** the zone in the new config */
|
||||
struct auth_zone* new_z;
|
||||
/** if the zone was deleted */
|
||||
int is_deleted;
|
||||
/** if the zone was added */
|
||||
int is_added;
|
||||
/** if the zone has been changed */
|
||||
int is_changed;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fast reload thread structure
|
||||
*/
|
||||
struct fast_reload_thread {
|
||||
/** the thread number for the dtio thread,
|
||||
* must be first to cast thread arg to int* in checklock code. */
|
||||
int threadnum;
|
||||
/** communication socket pair, that sends commands */
|
||||
int commpair[2];
|
||||
/** thread id, of the io thread */
|
||||
ub_thread_type tid;
|
||||
/** if the io processing has started */
|
||||
int started;
|
||||
/** if the thread has to quit */
|
||||
int need_to_quit;
|
||||
/** verbosity of the fast_reload command, the number of +v options */
|
||||
int fr_verb;
|
||||
/** option to not pause threads during reload */
|
||||
int fr_nopause;
|
||||
/** option to drop mesh queries */
|
||||
int fr_drop_mesh;
|
||||
|
||||
/** the event that listens on the remote service worker to the
|
||||
* commpair, it receives content from the fast reload thread. */
|
||||
void* service_event;
|
||||
/** if the event that listens on the remote service worker has
|
||||
* been added to the comm base. */
|
||||
int service_event_is_added;
|
||||
/** the service event can read a cmd, nonblocking, so it can
|
||||
* save the partial read cmd here */
|
||||
uint32_t service_read_cmd;
|
||||
/** the number of bytes in service_read_cmd */
|
||||
int service_read_cmd_count;
|
||||
/** the worker that the service_event is added in */
|
||||
struct worker* worker;
|
||||
|
||||
/** the printout of output to the remote client. */
|
||||
struct fast_reload_printq *printq;
|
||||
|
||||
/** lock on fr_output, to stop race when both remote control thread
|
||||
* and fast reload thread use fr_output list. */
|
||||
lock_basic_type fr_output_lock;
|
||||
/** list of strings, that the fast reload thread produces that have
|
||||
* to be printed. The remote control thread can pick them up with
|
||||
* the lock. */
|
||||
struct config_strlist_head* fr_output;
|
||||
|
||||
/** communication socket pair, to respond to the reload request */
|
||||
int commreload[2];
|
||||
|
||||
/** the list of auth zone changes. */
|
||||
struct fast_reload_auth_change* auth_zone_change_list;
|
||||
/** the old tree of auth zones, to lookup. */
|
||||
struct auth_zones* old_auth_zones;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create new remote control state for the daemon.
|
||||
* @param cfg: config file with key file settings.
|
||||
|
|
@ -203,4 +336,38 @@ int ssl_printf(RES* ssl, const char* format, ...)
|
|||
int ssl_read_line(RES* ssl, char* buf, size_t max);
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
/**
|
||||
* Start fast reload thread
|
||||
* @param ssl: the RES connection to print to.
|
||||
* @param worker: the remote servicing worker.
|
||||
* @param s: the rc_state that is servicing the remote control connection to
|
||||
* the remote control client. It needs to be moved away to stay connected
|
||||
* while the fast reload is running.
|
||||
* @param fr_verb: verbosity to print output at. 0 is nothing, 1 is some
|
||||
* and 2 is more detail.
|
||||
* @param fr_nopause: option to not pause threads during reload.
|
||||
* @param fr_drop_mesh: option to drop mesh queries.
|
||||
*/
|
||||
void fast_reload_thread_start(RES* ssl, struct worker* worker,
|
||||
struct rc_state* s, int fr_verb, int fr_nopause, int fr_drop_mesh);
|
||||
|
||||
/**
|
||||
* Stop fast reload thread
|
||||
* @param fast_reload_thread: the thread struct.
|
||||
*/
|
||||
void fast_reload_thread_stop(struct fast_reload_thread* fast_reload_thread);
|
||||
|
||||
/** fast reload thread commands to remote service thread event callback */
|
||||
void fast_reload_service_cb(int fd, short bits, void* arg);
|
||||
|
||||
/** fast reload callback for the remote control client connection */
|
||||
int fast_reload_client_callback(struct comm_point* c, void* arg, int err,
|
||||
struct comm_reply* rep);
|
||||
|
||||
/** fast reload printq delete list */
|
||||
void fast_reload_printq_list_delete(struct fast_reload_printq* list);
|
||||
|
||||
/** Pick up per worker changes after a fast reload. */
|
||||
void fast_reload_worker_pickup_changes(struct worker* worker);
|
||||
|
||||
#endif /* DAEMON_REMOTE_H */
|
||||
|
|
|
|||
|
|
@ -273,6 +273,7 @@ server_stats_compile(struct worker* worker, struct ub_stats_info* s, int reset)
|
|||
/* add in the values from the mesh */
|
||||
s->svr.ans_secure += (long long)worker->env.mesh->ans_secure;
|
||||
s->svr.ans_bogus += (long long)worker->env.mesh->ans_bogus;
|
||||
s->svr.val_ops += (long long)worker->env.mesh->val_ops;
|
||||
s->svr.ans_rcode_nodata += (long long)worker->env.mesh->ans_nodata;
|
||||
s->svr.ans_expired += (long long)worker->env.mesh->ans_expired;
|
||||
for(i=0; i<UB_STATS_RCODE_NUM; i++)
|
||||
|
|
@ -285,6 +286,8 @@ server_stats_compile(struct worker* worker, struct ub_stats_info* s, int reset)
|
|||
(long long)worker->env.mesh->num_queries_discard_timeout;
|
||||
s->svr.num_queries_wait_limit +=
|
||||
(long long)worker->env.mesh->num_queries_wait_limit;
|
||||
s->svr.num_dns_error_reports +=
|
||||
(long long)worker->env.mesh->num_dns_error_reports;
|
||||
/* values from outside network */
|
||||
s->svr.unwanted_replies = (long long)worker->back->unwanted_replies;
|
||||
s->svr.qtcp_outgoing = (long long)worker->back->num_tcp_outgoing;
|
||||
|
|
@ -446,6 +449,7 @@ void server_stats_add(struct ub_stats_info* total, struct ub_stats_info* a)
|
|||
total->svr.num_queries_discard_timeout +=
|
||||
a->svr.num_queries_discard_timeout;
|
||||
total->svr.num_queries_wait_limit += a->svr.num_queries_wait_limit;
|
||||
total->svr.num_dns_error_reports += a->svr.num_dns_error_reports;
|
||||
total->svr.num_queries_missed_cache += a->svr.num_queries_missed_cache;
|
||||
total->svr.num_queries_prefetch += a->svr.num_queries_prefetch;
|
||||
total->svr.num_queries_timed_out += a->svr.num_queries_timed_out;
|
||||
|
|
@ -458,9 +462,9 @@ void server_stats_add(struct ub_stats_info* total, struct ub_stats_info* a)
|
|||
#ifdef USE_DNSCRYPT
|
||||
total->svr.num_query_dnscrypt_crypted += a->svr.num_query_dnscrypt_crypted;
|
||||
total->svr.num_query_dnscrypt_cert += a->svr.num_query_dnscrypt_cert;
|
||||
total->svr.num_query_dnscrypt_cleartext += \
|
||||
total->svr.num_query_dnscrypt_cleartext +=
|
||||
a->svr.num_query_dnscrypt_cleartext;
|
||||
total->svr.num_query_dnscrypt_crypted_malformed += \
|
||||
total->svr.num_query_dnscrypt_crypted_malformed +=
|
||||
a->svr.num_query_dnscrypt_crypted_malformed;
|
||||
#endif /* USE_DNSCRYPT */
|
||||
/* the max size reached is upped to higher of both */
|
||||
|
|
@ -492,6 +496,7 @@ void server_stats_add(struct ub_stats_info* total, struct ub_stats_info* a)
|
|||
total->svr.ans_rcode_nodata += a->svr.ans_rcode_nodata;
|
||||
total->svr.ans_secure += a->svr.ans_secure;
|
||||
total->svr.ans_bogus += a->svr.ans_bogus;
|
||||
total->svr.val_ops += a->svr.val_ops;
|
||||
total->svr.unwanted_replies += a->svr.unwanted_replies;
|
||||
total->svr.unwanted_queries += a->svr.unwanted_queries;
|
||||
total->svr.tcp_accept_usage += a->svr.tcp_accept_usage;
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ static void
|
|||
checkrlimits(struct config_file* cfg)
|
||||
{
|
||||
#ifndef S_SPLINT_S
|
||||
#ifdef HAVE_GETRLIMIT
|
||||
#if defined(HAVE_GETRLIMIT) && !defined(unbound_testbound)
|
||||
/* list has number of ports to listen to, ifs number addresses */
|
||||
int list = ((cfg->do_udp?1:0) + (cfg->do_tcp?1 +
|
||||
(int)cfg->incoming_num_tcp:0));
|
||||
|
|
@ -710,6 +710,9 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
|
|||
* it would succeed on SIGHUP as well */
|
||||
if(!cfg->use_syslog)
|
||||
log_init(cfg->logfile, cfg->use_syslog, cfg->chrootdir);
|
||||
daemon->cfgfile = strdup(*cfgfile);
|
||||
if(!daemon->cfgfile)
|
||||
fatal_exit("out of memory in daemon cfgfile strdup");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -744,6 +747,7 @@ run_daemon(const char* cfgfile, int cmdline_verbose, int debug_mode, int need_pi
|
|||
"the commandline to see more errors, "
|
||||
"or unbound-checkconf", cfgfile);
|
||||
log_warn("Continuing with default config settings");
|
||||
config_auto_slab_values(cfg);
|
||||
}
|
||||
apply_settings(daemon, cfg, cmdline_verbose, debug_mode);
|
||||
if(!done_setup)
|
||||
|
|
|
|||
117
daemon/worker.c
117
daemon/worker.c
|
|
@ -410,6 +410,84 @@ worker_check_response(sldns_buffer* pkt, struct worker* worker)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send fast-reload acknowledgement to the mainthread in one byte.
|
||||
* This signals that this worker has received the previous command.
|
||||
* The worker is waiting if that is after a reload_stop command.
|
||||
* Or the worker has briefly processed the event itself, and in doing so
|
||||
* released data pointers to old config, after a reload_poll command.
|
||||
*/
|
||||
static void
|
||||
worker_send_reload_ack(struct worker* worker)
|
||||
{
|
||||
/* If this is clipped to 8 bits because thread_num>255, then that
|
||||
* is not a problem, the receiver counts the number of bytes received.
|
||||
* The number is informative only. */
|
||||
uint8_t c = (uint8_t)worker->thread_num;
|
||||
ssize_t ret;
|
||||
while(1) {
|
||||
ret = send(worker->daemon->fast_reload_thread->commreload[1],
|
||||
(void*)&c, 1, 0);
|
||||
if(ret == -1) {
|
||||
if(
|
||||
#ifndef USE_WINSOCK
|
||||
errno == EINTR || errno == EAGAIN
|
||||
# ifdef EWOULDBLOCK
|
||||
|| errno == EWOULDBLOCK
|
||||
# endif
|
||||
#else
|
||||
WSAGetLastError() == WSAEINTR ||
|
||||
WSAGetLastError() == WSAEINPROGRESS ||
|
||||
WSAGetLastError() == WSAEWOULDBLOCK
|
||||
#endif
|
||||
)
|
||||
continue; /* Try again. */
|
||||
log_err("worker reload ack reply: send failed: %s",
|
||||
sock_strerror(errno));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** stop and wait to resume the worker */
|
||||
static void
|
||||
worker_stop_and_wait(struct worker* worker)
|
||||
{
|
||||
uint8_t* buf = NULL;
|
||||
uint32_t len = 0, cmd;
|
||||
worker_send_reload_ack(worker);
|
||||
/* wait for reload */
|
||||
if(!tube_read_msg(worker->cmd, &buf, &len, 0)) {
|
||||
log_err("worker reload read reply failed");
|
||||
return;
|
||||
}
|
||||
if(len != sizeof(uint32_t)) {
|
||||
log_err("worker reload reply, bad control msg length %d",
|
||||
(int)len);
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
cmd = sldns_read_uint32(buf);
|
||||
free(buf);
|
||||
if(cmd == worker_cmd_quit) {
|
||||
/* quit anyway */
|
||||
verbose(VERB_ALGO, "reload reply, control cmd quit");
|
||||
comm_base_exit(worker->base);
|
||||
return;
|
||||
}
|
||||
if(cmd != worker_cmd_reload_start) {
|
||||
log_err("worker reload reply, wrong reply command");
|
||||
}
|
||||
if(worker->daemon->fast_reload_drop_mesh) {
|
||||
verbose(VERB_ALGO, "worker: drop mesh queries after reload");
|
||||
mesh_delete_all(worker->env.mesh);
|
||||
}
|
||||
fast_reload_worker_pickup_changes(worker);
|
||||
worker_send_reload_ack(worker);
|
||||
verbose(VERB_ALGO, "worker resume after reload");
|
||||
}
|
||||
|
||||
void
|
||||
worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube), uint8_t* msg,
|
||||
size_t len, int error, void* arg)
|
||||
|
|
@ -445,6 +523,15 @@ worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube), uint8_t* msg,
|
|||
verbose(VERB_ALGO, "got control cmd remote");
|
||||
daemon_remote_exec(worker);
|
||||
break;
|
||||
case worker_cmd_reload_stop:
|
||||
verbose(VERB_ALGO, "got control cmd reload_stop");
|
||||
worker_stop_and_wait(worker);
|
||||
break;
|
||||
case worker_cmd_reload_poll:
|
||||
verbose(VERB_ALGO, "got control cmd reload_poll");
|
||||
fast_reload_worker_pickup_changes(worker);
|
||||
worker_send_reload_ack(worker);
|
||||
break;
|
||||
default:
|
||||
log_err("bad command %d", (int)cmd);
|
||||
break;
|
||||
|
|
@ -639,7 +726,8 @@ apply_respip_action(struct worker* worker, const struct query_info* qinfo,
|
|||
return 1;
|
||||
|
||||
if(!respip_rewrite_reply(qinfo, cinfo, rep, encode_repp, &actinfo,
|
||||
alias_rrset, 0, worker->scratchpad, az, NULL))
|
||||
alias_rrset, 0, worker->scratchpad, az, NULL,
|
||||
worker->env.views, worker->env.respip_set))
|
||||
return 0;
|
||||
|
||||
/* xxx_deny actions mean dropping the reply, unless the original reply
|
||||
|
|
@ -800,7 +888,8 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
|
|||
} else if(partial_rep &&
|
||||
!respip_merge_cname(partial_rep, qinfo, rep, cinfo,
|
||||
must_validate, &encode_rep, worker->scratchpad,
|
||||
worker->env.auth_zones)) {
|
||||
worker->env.auth_zones, worker->env.views,
|
||||
worker->env.respip_set)) {
|
||||
goto bail_out;
|
||||
}
|
||||
if(encode_rep != rep) {
|
||||
|
|
@ -1807,8 +1896,9 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
|||
goto send_reply;
|
||||
}
|
||||
if(worker->env.auth_zones &&
|
||||
auth_zones_answer(worker->env.auth_zones, &worker->env,
|
||||
&qinfo, &edns, repinfo, c->buffer, worker->scratchpad)) {
|
||||
auth_zones_downstream_answer(worker->env.auth_zones,
|
||||
&worker->env, &qinfo, &edns, repinfo, c->buffer,
|
||||
worker->scratchpad)) {
|
||||
regional_free_all(worker->scratchpad);
|
||||
if(sldns_buffer_limit(c->buffer) == 0) {
|
||||
comm_point_drop_reply(repinfo);
|
||||
|
|
@ -1861,20 +1951,11 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
|||
/* If we've found a local alias, replace the qname with the alias
|
||||
* target before resolving it. */
|
||||
if(qinfo.local_alias) {
|
||||
struct ub_packed_rrset_key* rrset = qinfo.local_alias->rrset;
|
||||
struct packed_rrset_data* d = rrset->entry.data;
|
||||
|
||||
/* Sanity check: our current implementation only supports
|
||||
* a single CNAME RRset as a local alias. */
|
||||
if(qinfo.local_alias->next ||
|
||||
rrset->rk.type != htons(LDNS_RR_TYPE_CNAME) ||
|
||||
d->count != 1) {
|
||||
log_err("assumption failure: unexpected local alias");
|
||||
if(!local_alias_shallow_copy_qname(qinfo.local_alias, &qinfo.qname,
|
||||
&qinfo.qname_len)) {
|
||||
regional_free_all(worker->scratchpad);
|
||||
return 0; /* drop it */
|
||||
}
|
||||
qinfo.qname = d->rr_data[0] + 2;
|
||||
qinfo.qname_len = d->rr_len[0] - 2;
|
||||
}
|
||||
|
||||
/* If we may apply IP-based actions to the answer, build the client
|
||||
|
|
@ -1891,7 +1972,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
|||
cinfo_tmp.tag_datas = acladdr->tag_datas;
|
||||
cinfo_tmp.tag_datas_size = acladdr->tag_datas_size;
|
||||
cinfo_tmp.view = acladdr->view;
|
||||
cinfo_tmp.respip_set = worker->daemon->respip_set;
|
||||
cinfo_tmp.view_name = NULL;
|
||||
cinfo = &cinfo_tmp;
|
||||
}
|
||||
|
||||
|
|
@ -2044,13 +2125,13 @@ send_reply_rc:
|
|||
&repinfo->client_addr, repinfo->client_addrlen,
|
||||
tv, 1, c->buffer,
|
||||
(worker->env.cfg->log_destaddr?(void*)repinfo->c->socket->addr:NULL),
|
||||
c->type);
|
||||
c->type, c->ssl);
|
||||
} else {
|
||||
log_reply_info(NO_VERBOSE, &qinfo,
|
||||
&repinfo->client_addr, repinfo->client_addrlen,
|
||||
tv, 1, c->buffer,
|
||||
(worker->env.cfg->log_destaddr?(void*)repinfo->c->socket->addr:NULL),
|
||||
c->type);
|
||||
c->type, c->ssl);
|
||||
}
|
||||
}
|
||||
#ifdef USE_DNSCRYPT
|
||||
|
|
|
|||
|
|
@ -72,7 +72,13 @@ enum worker_commands {
|
|||
/** obtain statistics without statsclear */
|
||||
worker_cmd_stats_noreset,
|
||||
/** execute remote control command */
|
||||
worker_cmd_remote
|
||||
worker_cmd_remote,
|
||||
/** for fast-reload, perform stop */
|
||||
worker_cmd_reload_stop,
|
||||
/** for fast-reload, start again */
|
||||
worker_cmd_reload_start,
|
||||
/** for fast-reload, poll to make sure worker has released data */
|
||||
worker_cmd_reload_poll
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -631,7 +631,7 @@ handle_event_moddone(struct module_qstate* qstate, int id)
|
|||
|
||||
/* When an AAAA query completes check if we want to perform DNS64
|
||||
* synthesis. We skip queries with DNSSEC enabled (!CD) and
|
||||
* ones generated by us to retrive the A/PTR record to use for
|
||||
* ones generated by us to retrieve the A/PTR record to use for
|
||||
* synth. */
|
||||
int could_synth =
|
||||
qstate->qinfo.qtype == LDNS_RR_TYPE_AAAA &&
|
||||
|
|
|
|||
|
|
@ -192,8 +192,11 @@ static void
|
|||
dt_apply_identity(struct dt_env *env, struct config_file *cfg)
|
||||
{
|
||||
char buf[MAXHOSTNAMELEN+1];
|
||||
if (!cfg->dnstap_send_identity)
|
||||
if (!cfg->dnstap_send_identity) {
|
||||
free(env->identity);
|
||||
env->identity = NULL;
|
||||
return;
|
||||
}
|
||||
free(env->identity);
|
||||
if (cfg->dnstap_identity == NULL || cfg->dnstap_identity[0] == 0) {
|
||||
if (gethostname(buf, MAXHOSTNAMELEN) == 0) {
|
||||
|
|
@ -215,8 +218,11 @@ dt_apply_identity(struct dt_env *env, struct config_file *cfg)
|
|||
static void
|
||||
dt_apply_version(struct dt_env *env, struct config_file *cfg)
|
||||
{
|
||||
if (!cfg->dnstap_send_version)
|
||||
if (!cfg->dnstap_send_version) {
|
||||
free(env->version);
|
||||
env->version = NULL;
|
||||
return;
|
||||
}
|
||||
free(env->version);
|
||||
if (cfg->dnstap_version == NULL || cfg->dnstap_version[0] == 0)
|
||||
env->version = strdup(PACKAGE_STRING);
|
||||
|
|
@ -230,13 +236,8 @@ dt_apply_version(struct dt_env *env, struct config_file *cfg)
|
|||
}
|
||||
|
||||
void
|
||||
dt_apply_cfg(struct dt_env *env, struct config_file *cfg)
|
||||
dt_apply_logcfg(struct dt_env *env, struct config_file *cfg)
|
||||
{
|
||||
if (!cfg->dnstap)
|
||||
return;
|
||||
|
||||
dt_apply_identity(env, cfg);
|
||||
dt_apply_version(env, cfg);
|
||||
if ((env->log_resolver_query_messages = (unsigned int)
|
||||
cfg->dnstap_log_resolver_query_messages))
|
||||
{
|
||||
|
|
@ -275,6 +276,17 @@ dt_apply_cfg(struct dt_env *env, struct config_file *cfg)
|
|||
lock_basic_unlock(&env->sample_lock);
|
||||
}
|
||||
|
||||
void
|
||||
dt_apply_cfg(struct dt_env *env, struct config_file *cfg)
|
||||
{
|
||||
if (!cfg->dnstap)
|
||||
return;
|
||||
|
||||
dt_apply_identity(env, cfg);
|
||||
dt_apply_version(env, cfg);
|
||||
dt_apply_logcfg(env, cfg);
|
||||
}
|
||||
|
||||
int
|
||||
dt_init(struct dt_env *env, struct comm_base* base)
|
||||
{
|
||||
|
|
@ -530,7 +542,7 @@ dt_msg_send_outside_query(struct dt_env *env,
|
|||
qflags = sldns_buffer_read_u16_at(qmsg, 2);
|
||||
|
||||
/* type */
|
||||
if (qflags & BIT_RD) {
|
||||
if ((qflags & BIT_RD)) {
|
||||
if (!env->log_forwarder_query_messages)
|
||||
return;
|
||||
dt_msg_init(env, &dm, DNSTAP__MESSAGE__TYPE__FORWARDER_QUERY);
|
||||
|
|
@ -587,7 +599,7 @@ dt_msg_send_outside_response(struct dt_env *env,
|
|||
qflags = ntohs(qflags);
|
||||
|
||||
/* type */
|
||||
if (qflags & BIT_RD) {
|
||||
if ((qflags & BIT_RD)) {
|
||||
if (!env->log_forwarder_response_messages)
|
||||
return;
|
||||
dt_msg_init(env, &dm, DNSTAP__MESSAGE__TYPE__FORWARDER_RESPONSE);
|
||||
|
|
|
|||
|
|
@ -106,6 +106,13 @@ dt_create(struct config_file* cfg);
|
|||
void
|
||||
dt_apply_cfg(struct dt_env *env, struct config_file *cfg);
|
||||
|
||||
/**
|
||||
* Apply config settings for log enable for message types.
|
||||
* @param env: dnstap environment object.
|
||||
* @param cfg: new config settings.
|
||||
*/
|
||||
void dt_apply_logcfg(struct dt_env *env, struct config_file *cfg);
|
||||
|
||||
/**
|
||||
* Initialize per-worker state in dnstap environment object.
|
||||
* @param env: dnstap environment object to initialize, created with dt_create().
|
||||
|
|
|
|||
|
|
@ -18,10 +18,41 @@ AC_DEFUN([dt_DNSTAP],
|
|||
[opt_dnstap_socket_path="$1"])
|
||||
|
||||
if test "x$opt_dnstap" != "xno"; then
|
||||
AC_PATH_PROG([PROTOC_C], [protoc-c])
|
||||
if test -z "$PROTOC_C"; then
|
||||
AC_MSG_ERROR([The protoc-c program was not found. Please install protobuf-c!])
|
||||
fi
|
||||
AC_PATH_PROG([PROTOC], [protoc])
|
||||
# 'protoc-c' is deprecated. We use 'protoc' instead. If it can not be
|
||||
# found, try 'protoc-c'.
|
||||
if test -z "$PROTOC"; then
|
||||
AC_PATH_PROG([PROTOC_C], [protoc-c])
|
||||
else
|
||||
PROTOC_C="$PROTOC"
|
||||
fi
|
||||
if test -z "$PROTOC_C"; then
|
||||
AC_MSG_ERROR([[The protoc or protoc-c program was not found. It is needed for dnstap, use --disable-dnstap, or install protobuf-c to provide protoc or protoc-c]])
|
||||
fi
|
||||
|
||||
# Check for protoc-gen-c plugin
|
||||
AC_PATH_PROG([PROTOC_GEN_C], [protoc-gen-c])
|
||||
if test -z "$PROTOC_GEN_C"; then
|
||||
AC_MSG_ERROR([[The protoc-gen-c plugin was not found. It is needed for dnstap, use --disable-dnstap, or install protobuf-c-compiler to provide protoc-gen-c]])
|
||||
fi
|
||||
|
||||
# Test that protoc-gen-c actually works
|
||||
AC_MSG_CHECKING([if protoc-gen-c plugin works])
|
||||
cat > conftest.proto << EOF
|
||||
syntax = "proto2";
|
||||
message TestMessage {
|
||||
optional string test_field = 1;
|
||||
}
|
||||
EOF
|
||||
if $PROTOC_C --c_out=. conftest.proto >/dev/null 2>&1; then
|
||||
AC_MSG_RESULT([yes])
|
||||
rm -f conftest.proto conftest.pb-c.c conftest.pb-c.h
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
rm -f conftest.proto conftest.pb-c.c conftest.pb-c.h
|
||||
AC_MSG_ERROR([[The protoc-gen-c plugin is not working properly. Please ensure protobuf-c-compiler is properly installed]])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH([protobuf-c],
|
||||
AS_HELP_STRING([--with-protobuf-c=path], [Path where protobuf-c is installed, for dnstap]),
|
||||
[
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ message Policy {
|
|||
// rule: the rule matched by the message.
|
||||
//
|
||||
// In a RPZ context, this is the owner name of the rule in
|
||||
// the Reponse Policy Zone in wire format.
|
||||
// the Response Policy Zone in wire format.
|
||||
optional bytes rule = 2;
|
||||
|
||||
// action: the policy action taken in response to the
|
||||
|
|
|
|||
|
|
@ -1509,7 +1509,7 @@ void dtio_output_cb(int ATTR_UNUSED(fd), short bits, void* arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
if((bits&UB_EV_READ || dtio->ssl_brief_write)) {
|
||||
if((bits&UB_EV_READ) || dtio->ssl_brief_write) {
|
||||
#ifdef HAVE_SSL
|
||||
if(dtio->ssl_brief_write)
|
||||
(void)dtio_disable_brief_write(dtio);
|
||||
|
|
|
|||
|
|
@ -1787,6 +1787,20 @@ void remote_get_opt_ssl(char* ATTR_UNUSED(str), void* ATTR_UNUSED(arg))
|
|||
log_assert(0);
|
||||
}
|
||||
|
||||
void fast_reload_service_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
|
||||
void* ATTR_UNUSED(arg))
|
||||
{
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
int fast_reload_client_callback(struct comm_point* ATTR_UNUSED(c),
|
||||
void* ATTR_UNUSED(arg), int ATTR_UNUSED(error),
|
||||
struct comm_reply* ATTR_UNUSED(repinfo))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NGTCP2
|
||||
void doq_client_event_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
|
||||
void* ATTR_UNUSED(arg))
|
||||
|
|
|
|||
297
doc/Changelog
297
doc/Changelog
|
|
@ -1,3 +1,256 @@
|
|||
17 July 2025: Wouter
|
||||
- Fix to not set rlimits in the unit tests.
|
||||
- Fix #1303: [FR] Disable TLSv1.2.
|
||||
- iana portlist updated.
|
||||
|
||||
16 July 2025: Wouter
|
||||
- Fix for RebirthDay Attack CVE-2025-5994, reported by Xiang Li
|
||||
from AOSP Lab Nankai University.
|
||||
- Tag for 1.23.1 with the release of 1.23.0 and the CVE fix, the
|
||||
repository continues with the previous fixes, with 1.23.2.
|
||||
- Add unit tests for non-ecs aggregation.
|
||||
|
||||
12 July 2025: Yorgos
|
||||
- Merge #1289 from Roland van Rijswijk-Deij: Add extra statistic to
|
||||
track the number of signature validation operations.
|
||||
Adds 'num.valops' to extended statistics.
|
||||
- For #1289: test num.valops in existing stat_values.tdir.
|
||||
- For #1289: add num.valops in the unbound-control man page.
|
||||
|
||||
11 July 2025: Wouter
|
||||
- Fix detection of SSL_CTX_set_tmp_ecdh function.
|
||||
- For #1301: configure cant find SSL_is_quic in OpenSSL 3.5.1.
|
||||
|
||||
8 July 2025: Wouter
|
||||
- Fix to improve dnstap discovery on Fedora.
|
||||
|
||||
3 July 2025: Wouter
|
||||
- Fix #1300: Is 'sock-queue-timeout' a linux only feature.
|
||||
- For #1300: implement sock-queue-timeout for FreeBSD as well.
|
||||
- Fix layout of comm_point_udp_ancil_callback.
|
||||
|
||||
2 July 2025: Wouter
|
||||
- Merge #1299: Fix typos.
|
||||
- Generate ltmain.sh and configure again.
|
||||
|
||||
25 June 2025: Yorgos
|
||||
- Fix #1247: forward-first: ssl handshake failed on root nameservers.
|
||||
- For #1247, turn off fetch-policy for delegation when looking into
|
||||
parent side name servers that may not update the addresses and hit
|
||||
NXNS limits.
|
||||
- For #1247, replay test (added tcp_transport to
|
||||
outnet_serviced_query).
|
||||
|
||||
20 June 2025: Yorgos
|
||||
- Fix #1293: EDE 6 is attached to insecure cached answers when client
|
||||
sends the CD bit.
|
||||
|
||||
19 June 2025: Wouter
|
||||
- Fix #1296: DNS over QUIC depends on a very outdated version of
|
||||
ngtcp2. Fixed so it works with ngtcp2 1.13.0 and OpenSSL 3.5.0.
|
||||
- Merge #1297: edns-subnet: fix NULL_AFTER_DEREF on subnetmod.
|
||||
- Fix rrset cache create allocation failure case.
|
||||
|
||||
17 June 2025: Yorgos
|
||||
- Fix for consistent use of local zone CNAME alias for configured auth
|
||||
zones. Now it also applies to downstream configured auth zones.
|
||||
|
||||
16 June 2025: Wouter
|
||||
- Fix to check control-interface addresses in unbound-checkconf.
|
||||
- Fix #1295: Windows 32-bit binaries download seems to be missing dll
|
||||
dependency.
|
||||
|
||||
12 June 2025: Wouter
|
||||
- Fix header return value description for skip_pkt_rrs and
|
||||
parse_edns_from_query_pkt.
|
||||
|
||||
11 June 2025: Wouter
|
||||
- Fix bitwise operators in conditional expressions with parentheses.
|
||||
- Fix conditional expressions with parentheses for bitwise and.
|
||||
|
||||
5 June 2025: Wouter
|
||||
- Fix unbound-anchor certificate file read for line ends and end of
|
||||
file.
|
||||
- Fix comment for the dname_remove_label_limit_len function.
|
||||
- iana portlist updated.
|
||||
|
||||
3 June 2025: Yorgos
|
||||
- Small manpage corrections for the 'disable-dnssec-lame-check' option.
|
||||
|
||||
21 May 2025: Wouter
|
||||
- Fix #1288: [FR] Improve fuzzing of unbound by adapting the netbound
|
||||
program.
|
||||
|
||||
20 May 2025: Yorgos
|
||||
- Merge #1285: RST man pages. It introduces restructuredText man pages
|
||||
to sync the online and source code man page documentation.
|
||||
The templated man pages (*.in) are still part of the repo but
|
||||
generated with docutils from their .rst counterpart.
|
||||
Documentation on how to generate those (mainly for core developers)
|
||||
is in README.man.
|
||||
- Add more checks about respip in unbound-checkconf.
|
||||
Also fixes #310: unbound-checkconf not reporting RPZ configuration
|
||||
error.
|
||||
|
||||
19 May 2025: Wouter
|
||||
- Fix for cname chain length with qtype ANY and qname minimisation.
|
||||
Thanks to Jim Greenwood from Nominet for the report.
|
||||
|
||||
15 May 2025: Wouter
|
||||
- Fix config of slab values when there is no config file.
|
||||
|
||||
13 May 2025: Yorgos
|
||||
- Fix #1284: NULL pointer deref in az_find_nsec_cover() (latent bug)
|
||||
by adding a log_assert() to safeguard future development.
|
||||
- Fix #1282: log-destaddr fail on long ipv6 addresses.
|
||||
|
||||
13 May 2025: Wouter
|
||||
- Change default for so-sndbuf to 1m, to mitigate a cross-layer
|
||||
issue where the UDP socket send buffers are exhausted waiting
|
||||
for ARP/NDP resolution. Thanks to Reflyable for the report.
|
||||
- Adjusted so-sndbuf default to 4m.
|
||||
|
||||
12 May 2025: Yorgos
|
||||
- Merge #1280: Fix auth nsec3 code. Fixes NSEC3 code to not break on
|
||||
broken auth zones that include unsigned out of zone (above apex)
|
||||
data. Could lead to hang while trying to prove a wildcard answer.
|
||||
|
||||
12 May 2025: Wouter
|
||||
- Fix #1283: Unsafe usage of atoi() while parsing the configuration
|
||||
file.
|
||||
|
||||
9 May 2025: Wouter
|
||||
- Fix #1281: forward-zone "name: ." conflicts with auth-zone "name: ."
|
||||
in 1.23.0, but worked in 1.22.0.
|
||||
|
||||
5 May 2025: Yorgos
|
||||
- Sync unbound and unbound-checkconf log output for unknown modules.
|
||||
|
||||
29 April 2025: Wouter
|
||||
- Fix for parallel build of dnstap protoc-c output.
|
||||
- Fix dnstap to use protoc.
|
||||
|
||||
29 April 2025: Yorgos
|
||||
- Merge #1276: Auto-configure '-slabs' values.
|
||||
|
||||
28 April 2025: Yorgos
|
||||
- Merge #1275: Use macros for the fr_check_changed* functions.
|
||||
|
||||
25 April 2025: Wouter
|
||||
- Fix #1272: assertion failure testcode/unitverify.c:202.
|
||||
|
||||
16 April 2025: Wouter
|
||||
- Increase default to `num-queries-per-thread: 2048`, when unbound is
|
||||
compiled with libevent. It makes saturation of the task queue more
|
||||
resource intensive and less practical. Thanks to Shiming Liu,
|
||||
Network and Information Security Lab, Tsinghua University for the
|
||||
report.
|
||||
|
||||
11 April 2025: Wouter
|
||||
- Tag for 1.23.0rc2. This became the release of 1.23.0 on 24 April
|
||||
2025. The code repository continues with 1.23.1 in development.
|
||||
|
||||
11 April 2025: Yorgos
|
||||
- Merge #1265: Fix WSAPoll.
|
||||
|
||||
10 April 2025: Wouter
|
||||
- Fix for print of connection type in log-replies for dot and doh.
|
||||
|
||||
9 April 2025: Wouter
|
||||
- Fix to detect if atomic_store links in configure.
|
||||
- Fix #1264: unbound 1.22.0 leaks memory when doing DoH.
|
||||
|
||||
8 April 2025: Wouter
|
||||
- Tag for 1.23.0rc1.
|
||||
- Fix fast_reload to print chroot with config file name.
|
||||
|
||||
7 April 2025: Yorgos
|
||||
- Merge #902: DNS Error Reporting (RFC 9567). Introduces new
|
||||
configuration option 'dns-error-reporting' and new statistics for
|
||||
'num.dns_error_reports'.
|
||||
|
||||
4 April 2025: Wouter
|
||||
- Fix mesh_copy_client_info to omit null contents from copy.
|
||||
- Fix comment name in the rpz nsdname test.
|
||||
- Fix nettle compile for warnings and ticket keys.
|
||||
- Fix redis_replica test for unused option defaults and log printout.
|
||||
- Fix test to speed up common.sh script kill_pid.
|
||||
- Fix to update common.sh for speed of kill_pid.
|
||||
|
||||
4 April 2025: Yorgos
|
||||
- Merge #1019: Redis read-only replica support.
|
||||
Introduces new 'redis-replica-*' options for the Redis cache backend.
|
||||
|
||||
3 April 2025: Wouter
|
||||
- Fix #1263: Exempt loopback addresses from wait-limit.
|
||||
- Fix wait-limit-netblock and wait-limit-cookie-netblock config parse
|
||||
to allow two arguments.
|
||||
- Fix ub_event and include dnstap and win_svc headers.
|
||||
- Fix test for stat_values for wait limit defaults for localhost.
|
||||
- Fix parameter unused warning in net_help.c.
|
||||
|
||||
2 April 2025: Yorgos
|
||||
- Merge #1262 from markyang92, fix build with
|
||||
'gcc-15 -Wbuiltin-declaration-mismatch' error in compat/malloc.c.
|
||||
- For #1262, ifdef is no longer needed.
|
||||
|
||||
2 April 2025: Wouter
|
||||
- Fix unbound-control test so it counts the new flush_negative output,
|
||||
also answers the _ta probe from testns and prints command output
|
||||
and skip a thread specific test when no threads are available.
|
||||
- Fix that ub_event has the facility to deal with callbacks for
|
||||
fast reload, doq, windows-stop and dnstap.
|
||||
- Fix fast reload test to check if pid exists before acting on it.
|
||||
|
||||
1 April 2025: Wouter
|
||||
- Fix escape more characters when printing an RR type with an unquoted
|
||||
string.
|
||||
- Enable the auth_tls.tdir and auth_tls_failcert.tdir tests.
|
||||
|
||||
31 March 2025: Wouter
|
||||
- iana portlist update.
|
||||
- Merge #1042: Fast Reload. The unbound-control fast_reload is added.
|
||||
It reads changed config in a thread, then only briefly pauses the
|
||||
service threads, that keep running. DNS service is only interrupted
|
||||
briefly, less than a second.
|
||||
- Skip the unit tests for auth_tls.tdir and auth_tls_failcert.tdir.
|
||||
|
||||
27 March 2025: Wouter
|
||||
- Fix unit test dname log printout typecast.
|
||||
- Fix for ci test, expat is installed on the osx image.
|
||||
|
||||
26 March 2025: Yorgos
|
||||
- Fix #1255: Multiple pinnings to vulnerable copies of libexpat.
|
||||
- For #1255, for ios use an older expat version that does not require
|
||||
C++11 language features.
|
||||
- For #1255, for ios disable building tests that require C++11.
|
||||
- For #1255, for ios try the latest expat version again.
|
||||
|
||||
24 March 2025: Wouter
|
||||
- Fix #1254: `send failed: Socket is not connected` and
|
||||
`remote address is 0.0.0.0 port 53`.
|
||||
|
||||
21 March 2025: Wouter
|
||||
- Fix #1253: Cache entries fail to be removed from Redis cachedb
|
||||
backend with unbound-control flush* +c.
|
||||
- Fix for #1253: Fix for redis cachedb backend to expect an integer
|
||||
reply for the EXPIRE command.
|
||||
|
||||
20 March 2025: Wouter
|
||||
- Fix print of RR type NSAP-PTR, it is an unquoted string.
|
||||
|
||||
18 March 2025: Wouter
|
||||
- Fix #1251: WSAPoll first argument cannot be NULL.
|
||||
- Fix for windows compile create ssl contexts.
|
||||
|
||||
17 March 2025: Wouter
|
||||
- Fix representation of types GPOS and RESINFO, add rdf type for
|
||||
unquoted str.
|
||||
|
||||
16 March 2025: Yorgos
|
||||
- Fix 'unbound-control flush_negative' when reporting removed data;
|
||||
reported by David 'eqvinox' Lamparter.
|
||||
|
||||
28 February 2025: Wouter
|
||||
- Merge #1238: Prefer SOURCE_DATE_EPOCH over actual time.
|
||||
Add --help output description for the SOURCE_DATE_EPOCH variable.
|
||||
|
|
@ -550,7 +803,7 @@
|
|||
now checks both single and multi process/thread operation.
|
||||
|
||||
16 May 2024: Yorgos
|
||||
- Merge #1070: Fix rtt assignement for low values of
|
||||
- Merge #1070: Fix rtt assignment for low values of
|
||||
infra-cache-max-rtt.
|
||||
|
||||
16 May 2024: Wouter
|
||||
|
|
@ -958,7 +1211,7 @@
|
|||
13 October 2023: George
|
||||
- Better fix for infinite loop when reading multiple lines of input on
|
||||
a broken remote control socket, by treating a zero byte line the
|
||||
same as transmission end. Addesses #947 and #948.
|
||||
same as transmission end. Addresses #947 and #948.
|
||||
|
||||
12 October 2023: Wouter
|
||||
- Merge #944: Disable EDNS DO.
|
||||
|
|
@ -981,7 +1234,7 @@
|
|||
|
||||
10 October 2023: George
|
||||
- Fix infinite loop when reading multiple lines of input on a broken
|
||||
remote control socket. Addesses #947 and #948.
|
||||
remote control socket. Addresses #947 and #948.
|
||||
|
||||
9 October 2023: Wouter
|
||||
- Fix edns subnet so that queries with a source prefix of zero cause
|
||||
|
|
@ -1414,7 +1667,7 @@
|
|||
- Ignore expired error responses.
|
||||
|
||||
11 November 2022: Wouter
|
||||
- Fix #779: [doc] Missing documention in ub_resolve_event() for
|
||||
- Fix #779: [doc] Missing documentation in ub_resolve_event() for
|
||||
callback parameter was_ratelimited.
|
||||
|
||||
9 November 2022: George
|
||||
|
|
@ -2378,7 +2631,7 @@
|
|||
not hang. removed trailing slashes from configure paths. Moved iOS
|
||||
tests to allow-failure.
|
||||
- travis, analyzer disabled on test without debug, that does not
|
||||
run anway. Turn off failing tests except one. Update iOS test
|
||||
run anyway. Turn off failing tests except one. Update iOS test
|
||||
to xcode image 12.2.
|
||||
|
||||
22 March 2021: George
|
||||
|
|
@ -2467,7 +2720,7 @@
|
|||
- Fix build on Python 3.10.
|
||||
|
||||
10 February 2021: Wouter
|
||||
- Merge PR #420 from dyunwei: DOH not responsing with
|
||||
- Merge PR #420 from dyunwei: DOH not responding with
|
||||
"http2_query_read_done failure" logged.
|
||||
|
||||
9 February 2021: Wouter
|
||||
|
|
@ -2867,7 +3120,7 @@
|
|||
|
||||
6 August 2020: Wouter
|
||||
- Merge PR #284 and Fix #246: Remove DLV entirely from Unbound.
|
||||
The DLV has been decommisioned and in unbound 1.5.4, in 2015, there
|
||||
The DLV has been decommissioned and in unbound 1.5.4, in 2015, there
|
||||
was advise to stop using it. The current code base does not contain
|
||||
DLV code any more. The use of dlv options displays a warning.
|
||||
|
||||
|
|
@ -3416,7 +3669,7 @@
|
|||
3 December 2019: Wouter
|
||||
- Merge pull request #124 from rmetrich: Changed log lock
|
||||
from 'quick' to 'basic' because this is an I/O lock.
|
||||
- Fix text around serial arithmatic used for RRSIG times to refer
|
||||
- Fix text around serial arithmetic used for RRSIG times to refer
|
||||
to correct RFC number.
|
||||
- Fix Assert Causing DoS in synth_cname(),
|
||||
reported by X41 D-Sec.
|
||||
|
|
@ -3679,7 +3932,7 @@
|
|||
- For #52 #53, second context does not close logfile override.
|
||||
- Fix #52 #53, fix for example fail program.
|
||||
- Fix to return after failed auth zone http chunk write.
|
||||
- Fix to remove unused test for task_probe existance.
|
||||
- Fix to remove unused test for task_probe existence.
|
||||
- Fix to timeval_add for remaining second in microseconds.
|
||||
- Check repinfo in worker_handle_request, if null, drop it.
|
||||
|
||||
|
|
@ -4936,7 +5189,7 @@
|
|||
|
||||
1 February 2018: Wouter
|
||||
- fix unaligned structure making a false positive in checklock
|
||||
unitialised memory.
|
||||
uninitialised memory.
|
||||
|
||||
29 January 2018: Ralph
|
||||
- Use NSEC with longest ce to prove wildcard absence.
|
||||
|
|
@ -5539,8 +5792,8 @@
|
|||
- Remove (now unused) event2 include from dnscrypt code.
|
||||
|
||||
24 March 2017: George
|
||||
- Fix to prevent non-referal query from being cached as referal when the
|
||||
no_cache_store flag was set.
|
||||
- Fix to prevent non-referral query from being cached as referral when
|
||||
the no_cache_store flag was set.
|
||||
|
||||
23 March 2017: Wouter
|
||||
- Fix #1239: configure fails to find python distutils if python
|
||||
|
|
@ -5603,7 +5856,7 @@
|
|||
|
||||
7 March 2017: Wouter
|
||||
- Fix #1230: swig version 2.0.0 is required for pythonmod, with
|
||||
1.3.40 it crashes when running repeatly unbound-control reload.
|
||||
1.3.40 it crashes when running repeatedly unbound-control reload.
|
||||
- Response actions based on IP address from Jinmei Tatuya (Infoblox).
|
||||
|
||||
6 March 2017: Wouter
|
||||
|
|
@ -5619,7 +5872,7 @@
|
|||
known vulns.
|
||||
|
||||
27 February 2017: Wouter
|
||||
- Fix #1227: Fix that Unbound control allows weak ciphersuits.
|
||||
- Fix #1227: Fix that Unbound control allows weak ciphersuites.
|
||||
- Fix #1226: provide official 32bit binary for windows.
|
||||
|
||||
24 February 2017: Wouter
|
||||
|
|
@ -6608,7 +6861,7 @@
|
|||
- Fix #674: Do not free pointers given by getenv.
|
||||
|
||||
29 May 2015: Wouter
|
||||
- Fix that unparseable error responses are ratelimited.
|
||||
- Fix that unparsable error responses are ratelimited.
|
||||
- SOA negative TTL is capped at minimumttl in its rdata section.
|
||||
- cache-max-negative-ttl config option, default 3600.
|
||||
|
||||
|
|
@ -6626,7 +6879,7 @@
|
|||
|
||||
10 May 2015: Wouter
|
||||
- Change syntax of particular validator error to be easier for
|
||||
machine parse, swap rrset and ip adres info so it looks like:
|
||||
machine parse, swap rrset and ip address info so it looks like:
|
||||
validation failure <www.example.nl. TXT IN>: signature crypto
|
||||
failed from 2001:DB8:7:bba4::53 for <*.example.nl. NSEC IN>
|
||||
|
||||
|
|
@ -8206,7 +8459,7 @@
|
|||
- fix that --enable-static-exe does not complain about it unknown.
|
||||
|
||||
30 June 2011: Wouter
|
||||
- tag relase 1.4.11, trunk is 1.4.12 development.
|
||||
- tag release 1.4.11, trunk is 1.4.12 development.
|
||||
- iana portlist updated.
|
||||
- fix bug#395: id bits of other query may leak out under conditions
|
||||
- fix replyaddr count wrong after jostled queries, which leads to
|
||||
|
|
@ -9536,7 +9789,7 @@
|
|||
|
||||
8 June 2009: Wouter
|
||||
- Removed RFC5011 REVOKE flag support. Partial 5011 support may cause
|
||||
inadvertant behaviour.
|
||||
inadvertent behaviour.
|
||||
- 1.3.0 tarball for release created.
|
||||
- 1.3.1 development in svn trunk.
|
||||
- iana portlist updated.
|
||||
|
|
@ -9885,7 +10138,7 @@
|
|||
- initgroups(3) is called to drop secondary group permissions, if
|
||||
applicable.
|
||||
- configure option --with-ldns-builtin forces the use of the
|
||||
inluded ldns package with the unbound source. The -I include
|
||||
included ldns package with the unbound source. The -I include
|
||||
is put before the others, so it avoids bad include files from
|
||||
an older ldns install.
|
||||
- daemon(3) posix call is used when available.
|
||||
|
|
@ -10190,7 +10443,7 @@
|
|||
please ranlib, stop file without symbols warning.
|
||||
- harden referral path now also validates the root after priming.
|
||||
It looks up the root NS authoritatively as well as the root servers
|
||||
and attemps to validate the entries.
|
||||
and attempts to validate the entries.
|
||||
|
||||
16 October 2008: Wouter
|
||||
- Fixup negative TTL values appearing (reported by Attila Nagy).
|
||||
|
|
@ -10969,7 +11222,7 @@
|
|||
- please doxygen, put doxygen comment in one place.
|
||||
- asynclook -b blocking mode and test.
|
||||
- refactor asynclook, nicer code.
|
||||
- fixup race problems from opensll in rand init from library, with
|
||||
- fixup race problems from openssl in rand init from library, with
|
||||
a mutex around the rand init.
|
||||
- fix pass async_id=NULL to _async resolve().
|
||||
- rewrote _wait() routine, so that it is threadsafe.
|
||||
|
|
@ -11942,7 +12195,7 @@
|
|||
11 June 2007: Wouter
|
||||
- replies on TCP queries have the address field set in replyinfo,
|
||||
for serviced queries, because the initiator does not know that
|
||||
a TCP fallback has occured.
|
||||
a TCP fallback has occurred.
|
||||
- omit DNSSEC types from nonDO replies, except if qtype is ANY or
|
||||
if qtype directly queries for the type (and then only show that
|
||||
'unknown type' in the answer section).
|
||||
|
|
|
|||
16
doc/README.man
Normal file
16
doc/README.man
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
After Unbound 1.23.0, the source of the man pages is in reStructuredText format.
|
||||
|
||||
This helps with the online documentation at https://unbound.docs.nlnetlabs.nl
|
||||
and makes it easier to maintain and contribute to the documentation.
|
||||
|
||||
The templated man pages (*.in) are still part of the code repository as to not
|
||||
alter current procedures that could be in place by users/packagers.
|
||||
|
||||
The templated man pages (*.in) are generated by Sphinx (used for the online
|
||||
documentation).
|
||||
The online documentation has its own repository at
|
||||
https://github.com/NLnetLabs/unbound-manual.
|
||||
|
||||
In the README.md there (branch test-auto for now), there are further simple
|
||||
instructions on how to generate the templated man pages there and update them
|
||||
in this repository.
|
||||
|
|
@ -116,8 +116,8 @@ server:
|
|||
# so-rcvbuf: 0
|
||||
|
||||
# buffer size for UDP port 53 outgoing (SO_SNDBUF socket option).
|
||||
# 0 is system default. Use 4m to handle spikes on very busy servers.
|
||||
# so-sndbuf: 0
|
||||
# 0 is system default. Set larger to handle spikes on very busy servers.
|
||||
# so-sndbuf: 4m
|
||||
|
||||
# use SO_REUSEPORT to distribute queries over threads.
|
||||
# at extreme load it could be better to turn it off to distribute even.
|
||||
|
|
@ -163,7 +163,7 @@ server:
|
|||
# msg-cache-slabs: 4
|
||||
|
||||
# the number of queries that a thread gets to service.
|
||||
# num-queries-per-thread: 1024
|
||||
# num-queries-per-thread: 2048
|
||||
|
||||
# if very busy, 50% queries run to completion, 50% get timeout in msec
|
||||
# jostle-timeout: 200
|
||||
|
|
@ -215,6 +215,12 @@ server:
|
|||
# Apart from the default, the wait limit with cookie can be adjusted.
|
||||
# wait-limit-cookie-netblock: 192.0.2.0/24 50000
|
||||
|
||||
# Defaults for loopback, it has no wait limit.
|
||||
# wait-limit-netblock: 127.0.0.0/8 -1
|
||||
# wait-limit-netblock: ::1/128 -1
|
||||
# wait-limit-cookie-netblock: 127.0.0.0/8 -1
|
||||
# wait-limit-cookie-netblock: ::1/128 -1
|
||||
|
||||
# the amount of memory to use for the RRset cache.
|
||||
# plain value in bytes or you can append k, m or G. default is "4Mb".
|
||||
# rrset-cache-size: 4m
|
||||
|
|
@ -273,7 +279,7 @@ server:
|
|||
# do-ip6: yes
|
||||
|
||||
# If running unbound on an IPv6-only host, domains that only have
|
||||
# IPv4 servers would become unresolveable. If NAT64 is available in
|
||||
# IPv4 servers would become unresolvable. If NAT64 is available in
|
||||
# the network, unbound can use NAT64 to reach these servers with
|
||||
# the following option. This is NOT needed for enabling DNS64 on a
|
||||
# system that has IPv4 connectivity.
|
||||
|
|
@ -1080,6 +1086,11 @@ server:
|
|||
# Note that the ede option above needs to be enabled for this to work.
|
||||
# ede-serve-expired: no
|
||||
|
||||
# Enable DNS Error Reporting (RFC9567).
|
||||
# qname-minimisation is advised to be turned on as well to increase
|
||||
# privacy on the outgoing reports.
|
||||
# dns-error-reporting: no
|
||||
|
||||
# Specific options for ipsecmod. Unbound needs to be configured with
|
||||
# --enable-ipsecmod for these to take effect.
|
||||
#
|
||||
|
|
@ -1307,9 +1318,9 @@ remote-control:
|
|||
# # redis server's TCP port
|
||||
# redis-server-port: 6379
|
||||
# # if the server uses a unix socket, set its path, or "" when not used.
|
||||
# # redis-server-path: "/var/lib/redis/redis-server.sock"
|
||||
# redis-server-path: "/var/lib/redis/redis-server.sock"
|
||||
# # if the server uses an AUTH password, specify here, or "" when not used.
|
||||
# # redis-server-password: ""
|
||||
# redis-server-password: ""
|
||||
# # timeout (in ms) for communication with the redis server
|
||||
# redis-timeout: 100
|
||||
# # timeout (in ms) for commands, if 0, uses redis-timeout.
|
||||
|
|
@ -1320,6 +1331,22 @@ remote-control:
|
|||
# redis-expire-records: no
|
||||
# # redis logical database to use, 0 is the default database.
|
||||
# redis-logical-db: 0
|
||||
# # redis replica server's IP address or host name
|
||||
# redis-replica-server-host: 127.0.0.1
|
||||
# # redis replica server's TCP port
|
||||
# redis-replica-server-port: 6379
|
||||
# # if the replica server uses a unix socket, set its path, or "" when not used.
|
||||
# redis-replica-server-path: "/var/lib/redis/redis-server.sock"
|
||||
# # if the replica server uses an AUTH password, specify here, or "" when not used.
|
||||
# redis-replica-server-password: ""
|
||||
# # timeout (in ms) for communication with the redis replica server
|
||||
# redis-replica-timeout: 100
|
||||
# # timeout (in ms) for redis replica commands, if 0, uses redis-replica-timeout.
|
||||
# redis-replica-command-timeout: 0
|
||||
# # timeout (in ms) for redis replica connection set up, if 0, uses redis-replica-timeout.
|
||||
# redis-replica-connect-timeout: 0
|
||||
# # redis logical database to use for the replica server, 0 is the default database.
|
||||
# redis-replica-logical-db: 0
|
||||
|
||||
# IPSet
|
||||
# Add specify domain into set via ipset.
|
||||
|
|
|
|||
|
|
@ -1,335 +1,306 @@
|
|||
.TH "libunbound" "3" "@date@" "NLnet Labs" "unbound @version@"
|
||||
.\"
|
||||
.\" libunbound.3 -- unbound library functions manual
|
||||
.\"
|
||||
.\" Copyright (c) 2007, NLnet Labs. All rights reserved.
|
||||
.\"
|
||||
.\" See LICENSE for the license.
|
||||
.\"
|
||||
.\"
|
||||
.SH "NAME"
|
||||
.B libunbound,
|
||||
.B unbound.h,
|
||||
.B ub_ctx,
|
||||
.B ub_result,
|
||||
.B ub_callback_type,
|
||||
.B ub_ctx_create,
|
||||
.B ub_ctx_delete,
|
||||
.B ub_ctx_set_option,
|
||||
.B ub_ctx_get_option,
|
||||
.B ub_ctx_config,
|
||||
.B ub_ctx_set_fwd,
|
||||
.B ub_ctx_set_stub,
|
||||
.B ub_ctx_set_tls,
|
||||
.B ub_ctx_resolvconf,
|
||||
.B ub_ctx_hosts,
|
||||
.B ub_ctx_add_ta,
|
||||
.B ub_ctx_add_ta_autr,
|
||||
.B ub_ctx_add_ta_file,
|
||||
.B ub_ctx_trustedkeys,
|
||||
.B ub_ctx_debugout,
|
||||
.B ub_ctx_debuglevel,
|
||||
.B ub_ctx_async,
|
||||
.B ub_poll,
|
||||
.B ub_wait,
|
||||
.B ub_fd,
|
||||
.B ub_process,
|
||||
.B ub_resolve,
|
||||
.B ub_resolve_async,
|
||||
.B ub_cancel,
|
||||
.B ub_resolve_free,
|
||||
.B ub_strerror,
|
||||
.B ub_ctx_print_local_zones,
|
||||
.B ub_ctx_zone_add,
|
||||
.B ub_ctx_zone_remove,
|
||||
.B ub_ctx_data_add,
|
||||
.B ub_ctx_data_remove
|
||||
\- Unbound DNS validating resolver @version@ functions.
|
||||
.SH "SYNOPSIS"
|
||||
.B #include <unbound.h>
|
||||
.LP
|
||||
\fIstruct ub_ctx *\fR
|
||||
\fBub_ctx_create\fR(\fIvoid\fR);
|
||||
.LP
|
||||
\fIvoid\fR
|
||||
\fBub_ctx_delete\fR(\fIstruct ub_ctx*\fR ctx);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_set_option\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR opt, \fIchar*\fR val);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_get_option\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR opt, \fIchar**\fR val);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_config\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR fname);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_set_fwd\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR addr);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_set_stub\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR zone,
|
||||
\fIchar*\fR addr,
|
||||
.br
|
||||
\fIint\fR isprime);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_set_tls\fR(\fIstruct ub_ctx*\fR ctx, \fIint\fR tls);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_resolvconf\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR fname);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_hosts\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR fname);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_add_ta\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR ta);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_add_ta_autr\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR fname);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_add_ta_file\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR fname);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_trustedkeys\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR fname);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_debugout\fR(\fIstruct ub_ctx*\fR ctx, \fIFILE*\fR out);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_debuglevel\fR(\fIstruct ub_ctx*\fR ctx, \fIint\fR d);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_async\fR(\fIstruct ub_ctx*\fR ctx, \fIint\fR dothread);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_poll\fR(\fIstruct ub_ctx*\fR ctx);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_wait\fR(\fIstruct ub_ctx*\fR ctx);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_fd\fR(\fIstruct ub_ctx*\fR ctx);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_process\fR(\fIstruct ub_ctx*\fR ctx);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_resolve\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR name,
|
||||
.br
|
||||
\fIint\fR rrtype, \fIint\fR rrclass, \fIstruct ub_result**\fR result);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_resolve_async\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR name,
|
||||
.br
|
||||
\fIint\fR rrtype, \fIint\fR rrclass, \fIvoid*\fR mydata,
|
||||
.br
|
||||
\fIub_callback_type\fR callback, \fIint*\fR async_id);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_cancel\fR(\fIstruct ub_ctx*\fR ctx, \fIint\fR async_id);
|
||||
.LP
|
||||
\fIvoid\fR
|
||||
\fBub_resolve_free\fR(\fIstruct ub_result*\fR result);
|
||||
.LP
|
||||
\fIconst char *\fR
|
||||
\fBub_strerror\fR(\fIint\fR err);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_print_local_zones\fR(\fIstruct ub_ctx*\fR ctx);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_zone_add\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR zone_name, \fIchar*\fR zone_type);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_zone_remove\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR zone_name);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_data_add\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR data);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_data_remove\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR data);
|
||||
.SH "DESCRIPTION"
|
||||
.B Unbound
|
||||
is an implementation of a DNS resolver, that does caching and
|
||||
DNSSEC validation. This is the library API, for using the \-lunbound library.
|
||||
The server daemon is described in \fIunbound\fR(8).
|
||||
The library works independent from a running unbound server, and
|
||||
can be used to convert hostnames to ip addresses, and back,
|
||||
and obtain other information from the DNS. The library performs public\-key
|
||||
validation of results with DNSSEC.
|
||||
.P
|
||||
The library uses a variable of type \fIstruct ub_ctx\fR to keep context
|
||||
between calls. The user must maintain it, creating it with
|
||||
.B ub_ctx_create
|
||||
and deleting it with
|
||||
.B ub_ctx_delete\fR.
|
||||
It can be created and deleted at any time. Creating it anew removes any
|
||||
previous configuration (such as trusted keys) and clears any cached results.
|
||||
.P
|
||||
The functions are thread\-safe, and a context can be used in a threaded (as
|
||||
well as in a non\-threaded) environment. Also resolution (and validation)
|
||||
can be performed blocking and non\-blocking (also called asynchronous).
|
||||
The async method returns from the call immediately, so that processing
|
||||
can go on, while the results become available later.
|
||||
.P
|
||||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.
|
||||
.nr rst2man-indent-level 0
|
||||
.
|
||||
.de1 rstReportMargin
|
||||
\\$1 \\n[an-margin]
|
||||
level \\n[rst2man-indent-level]
|
||||
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
-
|
||||
\\n[rst2man-indent0]
|
||||
\\n[rst2man-indent1]
|
||||
\\n[rst2man-indent2]
|
||||
..
|
||||
.de1 INDENT
|
||||
.\" .rstReportMargin pre:
|
||||
. RS \\$1
|
||||
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
||||
. nr rst2man-indent-level +1
|
||||
.\" .rstReportMargin post:
|
||||
..
|
||||
.de UNINDENT
|
||||
. RE
|
||||
.\" indent \\n[an-margin]
|
||||
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.nr rst2man-indent-level -1
|
||||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||
..
|
||||
.TH "LIBUNBOUND" "3" "@date@" "@version@" "Unbound"
|
||||
.SH NAME
|
||||
libunbound \- Unbound DNS validating resolver @version@ functions.
|
||||
.SH SYNOPSIS
|
||||
.sp
|
||||
\fB#include <unbound.h>\fP
|
||||
.sp
|
||||
struct ub_ctx * \fBub_ctx_create\fP(void);
|
||||
.sp
|
||||
void \fBub_ctx_delete\fP(struct ub_ctx* ctx);
|
||||
.sp
|
||||
int \fBub_ctx_set_option\fP(struct ub_ctx* ctx, char* opt, char* val);
|
||||
.sp
|
||||
int \fBub_ctx_get_option\fP(struct ub_ctx* ctx, char* opt, char** val);
|
||||
.sp
|
||||
int \fBub_ctx_config\fP(struct ub_ctx* ctx, char* fname);
|
||||
.sp
|
||||
int \fBub_ctx_set_fwd\fP(struct ub_ctx* ctx, char* addr);
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
int \fBub_ctx_set_stub\fP(struct ub_ctx* ctx, char* zone, char* addr,
|
||||
int isprime);
|
||||
.UNINDENT
|
||||
.sp
|
||||
int \fBub_ctx_set_tls\fP(struct ub_ctx* ctx, int tls);
|
||||
.sp
|
||||
int \fBub_ctx_resolvconf\fP(struct ub_ctx* ctx, char* fname);
|
||||
.sp
|
||||
int \fBub_ctx_hosts\fP(struct ub_ctx* ctx, char* fname);
|
||||
.sp
|
||||
int \fBub_ctx_add_ta\fP(struct ub_ctx* ctx, char* ta);
|
||||
.sp
|
||||
int \fBub_ctx_add_ta_autr\fP(struct ub_ctx* ctx, char* fname);
|
||||
.sp
|
||||
int \fBub_ctx_add_ta_file\fP(struct ub_ctx* ctx, char* fname);
|
||||
.sp
|
||||
int \fBub_ctx_trustedkeys\fP(struct ub_ctx* ctx, char* fname);
|
||||
.sp
|
||||
int \fBub_ctx_debugout\fP(struct ub_ctx* ctx, FILE* out);
|
||||
.sp
|
||||
int \fBub_ctx_debuglevel\fP(struct ub_ctx* ctx, int d);
|
||||
.sp
|
||||
int \fBub_ctx_async\fP(struct ub_ctx* ctx, int dothread);
|
||||
.sp
|
||||
int \fBub_poll\fP(struct ub_ctx* ctx);
|
||||
.sp
|
||||
int \fBub_wait\fP(struct ub_ctx* ctx);
|
||||
.sp
|
||||
int \fBub_fd\fP(struct ub_ctx* ctx);
|
||||
.sp
|
||||
int \fBub_process\fP(struct ub_ctx* ctx);
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
int \fBub_resolve\fP(struct ub_ctx* ctx, char* name,
|
||||
int rrtype, int rrclass, struct ub_result** result);
|
||||
.TP
|
||||
int \fBub_resolve_async\fP(struct ub_ctx* ctx, char* name,
|
||||
int rrtype, int rrclass, void* mydata,
|
||||
ub_callback_type* callback, int* async_id);
|
||||
.UNINDENT
|
||||
.sp
|
||||
int \fBub_cancel\fP(struct ub_ctx* ctx, int async_id);
|
||||
.sp
|
||||
void \fBub_resolve_free\fP(struct ub_result* result);
|
||||
.sp
|
||||
const char * \fBub_strerror\fP(int err);
|
||||
.sp
|
||||
int \fBub_ctx_print_local_zones\fP(struct ub_ctx* ctx);
|
||||
.sp
|
||||
int \fBub_ctx_zone_add\fP(struct ub_ctx* ctx, char* zone_name, char* zone_type);
|
||||
.sp
|
||||
int \fBub_ctx_zone_remove\fP(struct ub_ctx* ctx, char* zone_name);
|
||||
.sp
|
||||
int \fBub_ctx_data_add\fP(struct ub_ctx* ctx, char* data);
|
||||
.sp
|
||||
int \fBub_ctx_data_remove\fP(struct ub_ctx* ctx, char* data);
|
||||
.SH DESCRIPTION
|
||||
.sp
|
||||
Unbound is an implementation of a DNS resolver, that does caching and DNSSEC
|
||||
validation.
|
||||
This is the library API, for using the \fB\-lunbound\fP library.
|
||||
The server daemon is described in \fI\%unbound(8)\fP\&.
|
||||
The library works independent from a running unbound server, and can be used to
|
||||
convert hostnames to ip addresses, and back, and obtain other information from
|
||||
the DNS.
|
||||
The library performs public\-key validation of results with DNSSEC.
|
||||
.sp
|
||||
The library uses a variable of type \fIstruct ub_ctx\fP to keep context between
|
||||
calls.
|
||||
The user must maintain it, creating it with \fBub_ctx_create\fP and deleting it
|
||||
with \fBub_ctx_delete\fP\&.
|
||||
It can be created and deleted at any time.
|
||||
Creating it anew removes any previous configuration (such as trusted keys) and
|
||||
clears any cached results.
|
||||
.sp
|
||||
The functions are thread\-safe, and a context can be used in a threaded (as well
|
||||
as in a non\-threaded) environment.
|
||||
Also resolution (and validation) can be performed blocking and non\-blocking
|
||||
(also called asynchronous).
|
||||
The async method returns from the call immediately, so that processing can go
|
||||
on, while the results become available later.
|
||||
.sp
|
||||
The functions are discussed in turn below.
|
||||
.SH "FUNCTIONS"
|
||||
.TP
|
||||
.SH FUNCTIONS
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B ub_ctx_create
|
||||
Create a new context, initialised with defaults.
|
||||
The information from /etc/resolv.conf and /etc/hosts is not utilised
|
||||
by default. Use
|
||||
.B ub_ctx_resolvconf
|
||||
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 asynchronous operation if you use
|
||||
lib openssl (the application calls these functions once for initialisation).
|
||||
Openssl 1.0.0 or later uses the CRYPTO_THREADID_set_callback function.
|
||||
The information from \fB/etc/resolv.conf\fP and \fB/etc/hosts\fP is
|
||||
not utilised by default.
|
||||
Use \fBub_ctx_resolvconf\fP and \fBub_ctx_hosts\fP to read them.
|
||||
Before you call this, use the openssl functions
|
||||
\fBCRYPTO_set_id_callback\fP and \fBCRYPTO_set_locking_callback\fP to set
|
||||
up asynchronous operation if you use lib openssl (the application calls
|
||||
these functions once for initialisation).
|
||||
Openssl 1.0.0 or later uses the \fBCRYPTO_THREADID_set_callback\fP
|
||||
function.
|
||||
.TP
|
||||
.B ub_ctx_delete
|
||||
Delete validation context and free associated resources.
|
||||
Outstanding async queries are killed and callbacks are not called for them.
|
||||
Outstanding async queries are killed and callbacks are not called for
|
||||
them.
|
||||
.TP
|
||||
.B ub_ctx_set_option
|
||||
A power\-user interface that lets you specify one of the options from the
|
||||
config file format, see \fIunbound.conf\fR(5). Not all options are
|
||||
relevant. For some specific options, such as adding trust anchors, special
|
||||
routines exist. Pass the option name with the trailing ':'.
|
||||
A power\-user interface that lets you specify one of the options from
|
||||
the config file format, see \fI\%unbound.conf(5)\fP\&.
|
||||
Not all options are relevant.
|
||||
For some specific options, such as adding trust anchors, special
|
||||
routines exist.
|
||||
Pass the option name with the trailing \fB\(aq:\(aq\fP\&.
|
||||
.TP
|
||||
.B ub_ctx_get_option
|
||||
A power\-user interface that gets an option value. Some options cannot be
|
||||
gotten, and others return a newline separated list. Pass the option name
|
||||
without trailing ':'. The returned value must be free(2)d by the caller.
|
||||
A power\-user interface that gets an option value.
|
||||
Some options cannot be gotten, and others return a newline separated
|
||||
list.
|
||||
Pass the option name without trailing \fB\(aq:\(aq\fP\&.
|
||||
The returned value must be free(2)d by the caller.
|
||||
.TP
|
||||
.B ub_ctx_config
|
||||
A power\-user interface that lets you specify an unbound config file, see
|
||||
\fIunbound.conf\fR(5), which is read for configuration. Not all options are
|
||||
relevant. For some specific options, such as adding trust anchors, special
|
||||
routines exist. This function is thread\-safe only if a single instance of
|
||||
ub_ctx* exists in the application. If several instances exist the
|
||||
application has to ensure that ub_ctx_config is not called in parallel by
|
||||
the different instances.
|
||||
A power\-user interface that lets you specify an unbound config file,
|
||||
see \fI\%unbound.conf(5)\fP, which is read for
|
||||
configuration.
|
||||
Not all options are relevant.
|
||||
For some specific options, such as adding trust anchors, special
|
||||
routines exist.
|
||||
This function is thread\-safe only if a single instance of \fBub_ctx\fP*
|
||||
exists in the application.
|
||||
If several instances exist the application has to ensure that
|
||||
\fBub_ctx_config\fP is not called in parallel by the different instances.
|
||||
.TP
|
||||
.B ub_ctx_set_fwd
|
||||
Set machine to forward DNS queries to, the caching resolver to use.
|
||||
IP4 or IP6 address. Forwards all DNS requests to that machine, which
|
||||
is expected to run a recursive resolver. If the proxy is not
|
||||
DNSSEC capable, validation may fail. Can be called several times, in
|
||||
that case the addresses are used as backup servers.
|
||||
At this time it is only possible to set configuration before the
|
||||
first resolve is done.
|
||||
Set machine to forward DNS queries to, the caching resolver to use.
|
||||
IP4 or IP6 address.
|
||||
Forwards all DNS requests to that machine, which is expected to run a
|
||||
recursive resolver.
|
||||
If the proxy is not DNSSEC capable, validation may fail.
|
||||
Can be called several times, in that case the addresses are used as
|
||||
backup servers.
|
||||
At this time it is only possible to set configuration before the first
|
||||
resolve is done.
|
||||
.TP
|
||||
.B ub_ctx_set_stub
|
||||
Set a stub zone, authoritative dns servers to use for a particular zone.
|
||||
IP4 or IP6 address. If the address is NULL the stub entry is removed.
|
||||
Set isprime true if you configure root hints with it. Otherwise similar to
|
||||
the stub zone item from unbound's config file. Can be called several times,
|
||||
for different zones, or to add multiple addresses for a particular zone.
|
||||
At this time it is only possible to set configuration before the
|
||||
first resolve is done.
|
||||
Set a stub zone, authoritative dns servers to use for a particular
|
||||
zone.
|
||||
IP4 or IP6 address.
|
||||
If the address is NULL the stub entry is removed.
|
||||
Set isprime true if you configure root hints with it.
|
||||
Otherwise similar to the stub zone item from unbound\(aqs config file.
|
||||
Can be called several times, for different zones, or to add multiple
|
||||
addresses for a particular zone.
|
||||
At this time it is only possible to set configuration before the first
|
||||
resolve is done.
|
||||
.TP
|
||||
.B ub_ctx_set_tls
|
||||
Enable DNS over TLS (DoT) for machines set with
|
||||
.B ub_ctx_set_fwd.
|
||||
At this time it is only possible to set configuration before the
|
||||
first resolve is done.
|
||||
Enable DNS over TLS (DoT) for machines set with \fBub_ctx_set_fwd\fP\&.
|
||||
At this time it is only possible to set configuration before the first
|
||||
resolve is done.
|
||||
.TP
|
||||
.B ub_ctx_resolvconf
|
||||
By default the root servers are queried and full resolver mode is used, but
|
||||
you can use this call to read the list of nameservers to use from the
|
||||
filename given.
|
||||
Usually "/etc/resolv.conf". Uses those nameservers as caching proxies.
|
||||
By default the root servers are queried and full resolver mode is used,
|
||||
but you can use this call to read the list of nameservers to use from
|
||||
the filename given.
|
||||
Usually \fB\(dq/etc/resolv.conf\(dq\fP\&.
|
||||
Uses those nameservers as caching proxies.
|
||||
If they do not support DNSSEC, validation may fail.
|
||||
Only nameservers are picked up, the searchdomain, ndots and other
|
||||
settings from \fIresolv.conf\fR(5) are ignored.
|
||||
If fname NULL is passed, "/etc/resolv.conf" is used (if on Windows,
|
||||
the system\-wide configured nameserver is picked instead).
|
||||
At this time it is only possible to set configuration before the
|
||||
first resolve is done.
|
||||
settings from \fIresolv.conf(5)\fP are ignored.
|
||||
If fname NULL is passed, \fB\(dq/etc/resolv.conf\(dq\fP is used (if on
|
||||
Windows, the system\-wide configured nameserver is picked instead).
|
||||
At this time it is only possible to set configuration before the first
|
||||
resolve is done.
|
||||
.TP
|
||||
.B ub_ctx_hosts
|
||||
Read list of hosts from the filename given.
|
||||
Usually "/etc/hosts". When queried for, these addresses are not marked
|
||||
DNSSEC secure. If fname NULL is passed, "/etc/hosts" is used
|
||||
(if on Windows, etc/hosts from WINDIR is picked instead).
|
||||
At this time it is only possible to set configuration before the
|
||||
first resolve is done.
|
||||
Usually \fB\(dq/etc/hosts\(dq\fP\&.
|
||||
When queried for, these addresses are not marked DNSSEC secure.
|
||||
If fname NULL is passed, \fB\(dq/etc/hosts\(dq\fP is used (if on Windows,
|
||||
\fBetc/hosts\fP from WINDIR is picked instead).
|
||||
At this time it is only possible to set configuration before the first
|
||||
resolve is done.
|
||||
.TP
|
||||
.B
|
||||
ub_ctx_add_ta
|
||||
.B ub_ctx_add_ta
|
||||
Add a trust anchor to the given context.
|
||||
At this time it is only possible to add trusted keys before the
|
||||
first resolve is done.
|
||||
At this time it is only possible to add trusted keys before the first
|
||||
resolve is done.
|
||||
The format is a string, similar to the zone\-file format,
|
||||
[domainname] [type] [rdata contents]. Both DS and DNSKEY records are accepted.
|
||||
\fB[domainname]\fP \fB[type]\fP \fB[rdata contents]\fP\&.
|
||||
Both DS and DNSKEY records are accepted.
|
||||
.TP
|
||||
.B ub_ctx_add_ta_autr
|
||||
Add filename with automatically tracked trust anchor to the given context.
|
||||
Pass name of a file with the managed trust anchor. You can create this
|
||||
file with \fIunbound\-anchor\fR(8) for the root anchor. You can also
|
||||
create it with an initial file with one line with a DNSKEY or DS record.
|
||||
Add filename with automatically tracked trust anchor to the given
|
||||
context.
|
||||
Pass name of a file with the managed trust anchor.
|
||||
You can create this file with
|
||||
\fI\%unbound\-anchor(8)\fP for the root anchor.
|
||||
You can also create it with an initial file with one line with a DNSKEY
|
||||
or DS record.
|
||||
If the file is writable, it is updated when the trust anchor changes.
|
||||
At this time it is only possible to add trusted keys before the
|
||||
first resolve is done.
|
||||
At this time it is only possible to add trusted keys before the first
|
||||
resolve is done.
|
||||
.TP
|
||||
.B ub_ctx_add_ta_file
|
||||
Add trust anchors to the given context.
|
||||
Pass name of a file with DS and DNSKEY records in zone file format.
|
||||
At this time it is only possible to add trusted keys before the
|
||||
first resolve is done.
|
||||
At this time it is only possible to add trusted keys before the first
|
||||
resolve is done.
|
||||
.TP
|
||||
.B ub_ctx_trustedkeys
|
||||
Add trust anchors to the given context.
|
||||
Pass the name of a bind\-style config file with trusted\-keys{}.
|
||||
At this time it is only possible to add trusted keys before the
|
||||
first resolve is done.
|
||||
Pass the name of a bind\-style config file with \fBtrusted\-keys{}\fP\&.
|
||||
At this time it is only possible to add trusted keys before the first
|
||||
resolve is done.
|
||||
.TP
|
||||
.B ub_ctx_debugout
|
||||
Set debug and error log output to the given stream. Pass NULL to disable
|
||||
output. Default is stderr. File\-names or using syslog can be enabled
|
||||
using config options, this routine is for using your own stream.
|
||||
Set debug and error log output to the given stream.
|
||||
Pass NULL to disable output.
|
||||
Default is stderr.
|
||||
File\-names or using syslog can be enabled using config options, this
|
||||
routine is for using your own stream.
|
||||
.TP
|
||||
.B ub_ctx_debuglevel
|
||||
Set debug verbosity for the context. Output is directed to stderr.
|
||||
Set debug verbosity for the context.
|
||||
Output is directed to stderr.
|
||||
Higher debug level gives more output.
|
||||
.TP
|
||||
.B ub_ctx_async
|
||||
Set a context behaviour for asynchronous action.
|
||||
if set to true, enables threading and a call to
|
||||
.B ub_resolve_async
|
||||
if set to true, enables threading and a call to \fBub_resolve_async\fP
|
||||
creates a thread to handle work in the background.
|
||||
If false, a process is forked to handle work in the background.
|
||||
Changes to this setting after
|
||||
.B ub_resolve_async
|
||||
calls have been made have no effect (delete and re\-create the context
|
||||
to change).
|
||||
Changes to this setting after \fBub_resolve_async\fP calls have been made
|
||||
have no effect (delete and re\-create the context to change).
|
||||
.TP
|
||||
.B ub_poll
|
||||
Poll a context to see if it has any new results.
|
||||
Do not poll in a loop, instead extract the fd below to poll for readiness,
|
||||
and then check, or wait using the wait routine.
|
||||
Do not poll in a loop, instead extract the \fBfd\fP below to poll for
|
||||
readiness, and then check, or wait using the wait routine.
|
||||
Returns 0 if nothing to read, or nonzero if a result is available.
|
||||
If nonzero, call
|
||||
.B ub_process
|
||||
to do callbacks.
|
||||
If nonzero, call \fBub_process\fP to do callbacks.
|
||||
.TP
|
||||
.B ub_wait
|
||||
Wait for a context to finish with results. Calls
|
||||
.B ub_process
|
||||
after the wait for you. After the wait, there are no more outstanding
|
||||
asynchronous queries.
|
||||
Wait for a context to finish with results.
|
||||
Calls \fBub_process\fP after the wait for you.
|
||||
After the wait, there are no more outstanding asynchronous queries.
|
||||
.TP
|
||||
.B ub_fd
|
||||
Get file descriptor. Wait for it to become readable, at this point
|
||||
answers are returned from the asynchronous validating resolver.
|
||||
Then call the \fBub_process\fR to continue processing.
|
||||
Get file descriptor.
|
||||
Wait for it to become readable, at this point answers are returned from
|
||||
the asynchronous validating resolver.
|
||||
Then call the \fBub_process\fP to continue processing.
|
||||
.TP
|
||||
.B ub_process
|
||||
Call this routine to continue processing results from the validating
|
||||
resolver (when the fd becomes readable).
|
||||
resolver (when the \fBfd\fP becomes readable).
|
||||
Will perform necessary callbacks.
|
||||
.TP
|
||||
.B ub_resolve
|
||||
|
|
@ -340,95 +311,111 @@ The result structure is newly allocated with the resulting data.
|
|||
.TP
|
||||
.B ub_resolve_async
|
||||
Perform asynchronous resolution and validation of the target name.
|
||||
Arguments mean the same as for \fBub_resolve\fR except no
|
||||
data is returned immediately, instead a callback is called later.
|
||||
The callback receives a copy of the mydata pointer, that you can use to pass
|
||||
information to the callback. The callback type is a function pointer to
|
||||
a function declared as
|
||||
.IP
|
||||
void my_callback_function(void* my_arg, int err,
|
||||
.br
|
||||
struct ub_result* result);
|
||||
.IP
|
||||
The async_id is returned so you can (at your option) decide to track it
|
||||
and cancel the request if needed. If you pass a NULL pointer the async_id
|
||||
is not returned.
|
||||
Arguments mean the same as for \fBub_resolve\fP except no data is
|
||||
returned immediately, instead a callback is called later.
|
||||
The callback receives a copy of the mydata pointer, that you can use to
|
||||
pass information to the callback.
|
||||
The callback type is a function pointer to a function declared as:
|
||||
.INDENT 7.0
|
||||
.INDENT 3.5
|
||||
.sp
|
||||
.nf
|
||||
.ft C
|
||||
void my_callback_function(void* my_arg, int err,
|
||||
struct ub_result* result);
|
||||
.ft P
|
||||
.fi
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.sp
|
||||
The \fBasync_id\fP is returned so you can (at your option) decide to
|
||||
track it and cancel the request if needed.
|
||||
If you pass a NULL pointer the \fBasync_id\fP is not returned.
|
||||
.TP
|
||||
.B ub_cancel
|
||||
Cancel an async query in progress. This may return an error if the query
|
||||
does not exist, or the query is already being delivered, in that case you
|
||||
may still get a callback for the query.
|
||||
Cancel an async query in progress.
|
||||
This may return an error if the query does not exist, or the query is
|
||||
already being delivered, in that case you may still get a callback for
|
||||
the query.
|
||||
.TP
|
||||
.B ub_resolve_free
|
||||
Free struct ub_result contents after use.
|
||||
Free struct \fBub_result\fP contents after use.
|
||||
.TP
|
||||
.B ub_strerror
|
||||
Convert error value from one of the unbound library functions
|
||||
to a human readable string.
|
||||
Convert error value from one of the unbound library functions to a
|
||||
human readable string.
|
||||
.TP
|
||||
.B ub_ctx_print_local_zones
|
||||
Debug printout the local authority information to debug output.
|
||||
.TP
|
||||
.B ub_ctx_zone_add
|
||||
Add new zone to local authority info, like local\-zone \fIunbound.conf\fR(5)
|
||||
statement.
|
||||
Add new zone to local authority info, like local\-zone
|
||||
\fI\%unbound.conf(5)\fP statement.
|
||||
.TP
|
||||
.B ub_ctx_zone_remove
|
||||
Delete zone from local authority info.
|
||||
.TP
|
||||
.B ub_ctx_data_add
|
||||
Add resource record data to local authority info, like local\-data
|
||||
\fIunbound.conf\fR(5) statement.
|
||||
\fI\%unbound.conf(5)\fP statement.
|
||||
.TP
|
||||
.B ub_ctx_data_remove
|
||||
Delete local authority data from the name given.
|
||||
.SH "RESULT DATA STRUCTURE"
|
||||
The result of the DNS resolution and validation is returned as
|
||||
\fIstruct ub_result\fR. The result structure contains the following entries.
|
||||
.P
|
||||
.UNINDENT
|
||||
.SH RESULT DATA STRUCTURE
|
||||
.sp
|
||||
The result of the DNS resolution and validation is returned as \fIstruct
|
||||
ub_result\fP\&.
|
||||
The result structure contains the following entries:
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
.sp
|
||||
.nf
|
||||
struct ub_result {
|
||||
char* qname; /* text string, original question */
|
||||
int qtype; /* type code asked for */
|
||||
int qclass; /* class code asked for */
|
||||
char** data; /* array of rdata items, NULL terminated*/
|
||||
int* len; /* array with lengths of rdata items */
|
||||
char* canonname; /* canonical name of result */
|
||||
int rcode; /* additional error code in case of no data */
|
||||
void* answer_packet; /* full network format answer packet */
|
||||
int answer_len; /* length of packet in octets */
|
||||
int havedata; /* true if there is data */
|
||||
int nxdomain; /* true if nodata because name does not exist */
|
||||
int secure; /* true if result is secure */
|
||||
int bogus; /* true if a security failure happened */
|
||||
char* why_bogus; /* string with error if bogus */
|
||||
int was_ratelimited; /* true if the query was ratelimited (SERVFAIL) by unbound */
|
||||
int ttl; /* number of seconds the result is valid */
|
||||
};
|
||||
.ft C
|
||||
struct ub_result {
|
||||
char* qname; /* text string, original question */
|
||||
int qtype; /* type code asked for */
|
||||
int qclass; /* class code asked for */
|
||||
char** data; /* array of rdata items, NULL terminated*/
|
||||
int* len; /* array with lengths of rdata items */
|
||||
char* canonname; /* canonical name of result */
|
||||
int rcode; /* additional error code in case of no data */
|
||||
void* answer_packet; /* full network format answer packet */
|
||||
int answer_len; /* length of packet in octets */
|
||||
int havedata; /* true if there is data */
|
||||
int nxdomain; /* true if nodata because name does not exist */
|
||||
int secure; /* true if result is secure */
|
||||
int bogus; /* true if a security failure happened */
|
||||
char* why_bogus; /* string with error if bogus */
|
||||
int was_ratelimited; /* true if the query was ratelimited (SERVFAIL) by unbound */
|
||||
int ttl; /* number of seconds the result is valid */
|
||||
};
|
||||
.ft P
|
||||
.fi
|
||||
.P
|
||||
If both secure and bogus are false, security was not enabled for the
|
||||
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
|
||||
.B ub_strerror
|
||||
to obtain a readable error string.
|
||||
.B ub_strerror
|
||||
returns a zero terminated string.
|
||||
.B ub_ctx_create
|
||||
returns NULL on an error (a malloc failure).
|
||||
.B ub_poll
|
||||
returns true if some information may be available, false otherwise.
|
||||
.B ub_fd
|
||||
returns a file descriptor or \-1 on error.
|
||||
.B ub_ctx_config
|
||||
and
|
||||
.B ub_ctx_resolvconf
|
||||
attempt to leave errno informative on a function return with file read failure.
|
||||
.SH "SEE ALSO"
|
||||
\fIunbound.conf\fR(5),
|
||||
\fIunbound\fR(8).
|
||||
.SH "AUTHORS"
|
||||
.B Unbound
|
||||
developers are mentioned in the CREDITS file in the distribution.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.sp
|
||||
If both secure and bogus are false, security was not enabled for the domain of
|
||||
the query.
|
||||
Else, they are not both true, one of them is true.
|
||||
.SH RETURN VALUES
|
||||
.sp
|
||||
Many routines return an error code.
|
||||
The value 0 (zero) denotes no error happened.
|
||||
Other values can be passed to \fBub_strerror\fP to obtain a readable error
|
||||
string.
|
||||
\fBub_strerror\fP returns a zero terminated string.
|
||||
\fBub_ctx_create\fP returns NULL on an error (a malloc failure).
|
||||
\fBub_poll\fP returns true if some information may be available, false otherwise.
|
||||
\fBub_fd\fP returns a file descriptor or \-1 on error.
|
||||
\fBub_ctx_config\fP and \fBub_ctx_resolvconf\fP attempt to leave errno informative
|
||||
on a function return with file read failure.
|
||||
.SH SEE ALSO
|
||||
.sp
|
||||
\fI\%unbound.conf(5)\fP, \fI\%unbound(8)\fP\&.
|
||||
.SH AUTHOR
|
||||
Unbound developers are mentioned in the CREDITS file in the distribution.
|
||||
.SH COPYRIGHT
|
||||
1999-2025, NLnet Labs
|
||||
.\" Generated by docutils manpage writer.
|
||||
.
|
||||
|
|
|
|||
491
doc/libunbound.rst
Normal file
491
doc/libunbound.rst
Normal file
|
|
@ -0,0 +1,491 @@
|
|||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
libunbound(3)
|
||||
=============
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
||||
.. only:: html
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
#include <unbound.h>
|
||||
|
||||
struct ub_ctx * ub_ctx_create(void);
|
||||
|
||||
void ub_ctx_delete(struct ub_ctx* ctx);
|
||||
|
||||
int ub_ctx_set_option(struct ub_ctx* ctx, char* opt, char* val);
|
||||
|
||||
int ub_ctx_get_option(struct ub_ctx* ctx, char* opt, char** val);
|
||||
|
||||
int ub_ctx_config(struct ub_ctx* ctx, char* fname);
|
||||
|
||||
int ub_ctx_set_fwd(struct ub_ctx* ctx, char* addr);
|
||||
|
||||
int ub_ctx_set_stub(struct ub_ctx* ctx, char* zone, char* addr,
|
||||
int isprime);
|
||||
|
||||
int ub_ctx_set_tls(struct ub_ctx* ctx, int tls);
|
||||
|
||||
int ub_ctx_resolvconf(struct ub_ctx* ctx, char* fname);
|
||||
|
||||
int ub_ctx_hosts(struct ub_ctx* ctx, char* fname);
|
||||
|
||||
int ub_ctx_add_ta(struct ub_ctx* ctx, char* ta);
|
||||
|
||||
int ub_ctx_add_ta_autr(struct ub_ctx* ctx, char* fname);
|
||||
|
||||
int ub_ctx_add_ta_file(struct ub_ctx* ctx, char* fname);
|
||||
|
||||
int ub_ctx_trustedkeys(struct ub_ctx* ctx, char* fname);
|
||||
|
||||
int ub_ctx_debugout(struct ub_ctx* ctx, FILE* out);
|
||||
|
||||
int ub_ctx_debuglevel(struct ub_ctx* ctx, int d);
|
||||
|
||||
int ub_ctx_async(struct ub_ctx* ctx, int dothread);
|
||||
|
||||
int ub_poll(struct ub_ctx* ctx);
|
||||
|
||||
int ub_wait(struct ub_ctx* ctx);
|
||||
|
||||
int ub_fd(struct ub_ctx* ctx);
|
||||
|
||||
int ub_process(struct ub_ctx* ctx);
|
||||
|
||||
int ub_resolve(struct ub_ctx* ctx, char* name, int rrtype,
|
||||
int rrclass, struct ub_result** result);
|
||||
|
||||
int ub_resolve_async(struct ub_ctx* ctx, char* name, int rrtype,
|
||||
int rrclass, void* mydata, ub_callback_type callback,
|
||||
int* async_id);
|
||||
|
||||
int ub_cancel(struct ub_ctx* ctx, int async_id);
|
||||
|
||||
void ub_resolve_free(struct ub_result* result);
|
||||
|
||||
const char * ub_strerror(int err);
|
||||
|
||||
int ub_ctx_print_local_zones(struct ub_ctx* ctx);
|
||||
|
||||
int ub_ctx_zone_add(struct ub_ctx* ctx, char* zone_name, char* zone_type);
|
||||
|
||||
int ub_ctx_zone_remove(struct ub_ctx* ctx, char* zone_name);
|
||||
|
||||
int ub_ctx_data_add(struct ub_ctx* ctx, char* data);
|
||||
|
||||
int ub_ctx_data_remove(struct ub_ctx* ctx, char* data);
|
||||
|
||||
.. only:: man
|
||||
|
||||
**#include <unbound.h>**
|
||||
|
||||
struct ub_ctx \* **ub_ctx_create**\ (void);
|
||||
|
||||
void **ub_ctx_delete**\ (struct ub_ctx\* ctx);
|
||||
|
||||
int **ub_ctx_set_option**\ (struct ub_ctx\* ctx, char\* opt, char\* val);
|
||||
|
||||
int **ub_ctx_get_option**\ (struct ub_ctx\* ctx, char\* opt, char\*\* val);
|
||||
|
||||
int **ub_ctx_config**\ (struct ub_ctx\* ctx, char* fname);
|
||||
|
||||
int **ub_ctx_set_fwd**\ (struct ub_ctx\* ctx, char\* addr);
|
||||
|
||||
int **ub_ctx_set_stub**\ (struct ub_ctx\* ctx, char\* zone, char\* addr,
|
||||
int isprime);
|
||||
|
||||
int **ub_ctx_set_tls**\ (struct ub_ctx\* ctx, int tls);
|
||||
|
||||
int **ub_ctx_resolvconf**\ (struct ub_ctx\* ctx, char\* fname);
|
||||
|
||||
int **ub_ctx_hosts**\ (struct ub_ctx\* ctx, char\* fname);
|
||||
|
||||
int **ub_ctx_add_ta**\ (struct ub_ctx\* ctx, char\* ta);
|
||||
|
||||
int **ub_ctx_add_ta_autr**\ (struct ub_ctx\* ctx, char\* fname);
|
||||
|
||||
int **ub_ctx_add_ta_file**\ (struct ub_ctx\* ctx, char\* fname);
|
||||
|
||||
int **ub_ctx_trustedkeys**\ (struct ub_ctx\* ctx, char\* fname);
|
||||
|
||||
int **ub_ctx_debugout**\ (struct ub_ctx\* ctx, FILE\* out);
|
||||
|
||||
int **ub_ctx_debuglevel**\ (struct ub_ctx\* ctx, int d);
|
||||
|
||||
int **ub_ctx_async**\ (struct ub_ctx\* ctx, int dothread);
|
||||
|
||||
int **ub_poll**\ (struct ub_ctx\* ctx);
|
||||
|
||||
int **ub_wait**\ (struct ub_ctx\* ctx);
|
||||
|
||||
int **ub_fd**\ (struct ub_ctx\* ctx);
|
||||
|
||||
int **ub_process**\ (struct ub_ctx\* ctx);
|
||||
|
||||
int **ub_resolve**\ (struct ub_ctx\* ctx, char\* name,
|
||||
int rrtype, int rrclass, struct ub_result\*\* result);
|
||||
|
||||
int **ub_resolve_async**\ (struct ub_ctx\* ctx, char\* name,
|
||||
int rrtype, int rrclass, void\* mydata,
|
||||
ub_callback_type\* callback, int\* async_id);
|
||||
|
||||
int **ub_cancel**\ (struct ub_ctx\* ctx, int async_id);
|
||||
|
||||
void **ub_resolve_free**\ (struct ub_result\* result);
|
||||
|
||||
const char \* **ub_strerror**\ (int err);
|
||||
|
||||
int **ub_ctx_print_local_zones**\ (struct ub_ctx\* ctx);
|
||||
|
||||
int **ub_ctx_zone_add**\ (struct ub_ctx\* ctx, char\* zone_name, char\* zone_type);
|
||||
|
||||
int **ub_ctx_zone_remove**\ (struct ub_ctx\* ctx, char\* zone_name);
|
||||
|
||||
int **ub_ctx_data_add**\ (struct ub_ctx\* ctx, char\* data);
|
||||
|
||||
int **ub_ctx_data_remove**\ (struct ub_ctx\* ctx, char\* data);
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
Unbound is an implementation of a DNS resolver, that does caching and DNSSEC
|
||||
validation.
|
||||
This is the library API, for using the ``-lunbound`` library.
|
||||
The server daemon is described in :doc:`unbound(8)</manpages/unbound>`.
|
||||
The library works independent from a running unbound server, and can be used to
|
||||
convert hostnames to ip addresses, and back, and obtain other information from
|
||||
the DNS.
|
||||
The library performs public-key validation of results with DNSSEC.
|
||||
|
||||
The library uses a variable of type *struct ub_ctx* to keep context between
|
||||
calls.
|
||||
The user must maintain it, creating it with **ub_ctx_create** and deleting it
|
||||
with **ub_ctx_delete**.
|
||||
It can be created and deleted at any time.
|
||||
Creating it anew removes any previous configuration (such as trusted keys) and
|
||||
clears any cached results.
|
||||
|
||||
The functions are thread-safe, and a context can be used in a threaded (as well
|
||||
as in a non-threaded) environment.
|
||||
Also resolution (and validation) can be performed blocking and non-blocking
|
||||
(also called asynchronous).
|
||||
The async method returns from the call immediately, so that processing can go
|
||||
on, while the results become available later.
|
||||
|
||||
The functions are discussed in turn below.
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
.. glossary::
|
||||
|
||||
ub_ctx_create
|
||||
Create a new context, initialised with defaults.
|
||||
The information from :file:`/etc/resolv.conf` and :file:`/etc/hosts` is
|
||||
not utilised by default.
|
||||
Use **ub_ctx_resolvconf** and **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 asynchronous operation if you use lib openssl (the application calls
|
||||
these functions once for initialisation).
|
||||
Openssl 1.0.0 or later uses the **CRYPTO_THREADID_set_callback**
|
||||
function.
|
||||
|
||||
ub_ctx_delete
|
||||
Delete validation context and free associated resources.
|
||||
Outstanding async queries are killed and callbacks are not called for
|
||||
them.
|
||||
|
||||
ub_ctx_set_option
|
||||
A power-user interface that lets you specify one of the options from
|
||||
the config file format, see :doc:`unbound.conf(5)</manpages/unbound.conf>`.
|
||||
Not all options are relevant.
|
||||
For some specific options, such as adding trust anchors, special
|
||||
routines exist.
|
||||
Pass the option name with the trailing ``':'``.
|
||||
|
||||
ub_ctx_get_option
|
||||
A power-user interface that gets an option value.
|
||||
Some options cannot be gotten, and others return a newline separated
|
||||
list.
|
||||
Pass the option name without trailing ``':'``.
|
||||
The returned value must be free(2)d by the caller.
|
||||
|
||||
ub_ctx_config
|
||||
A power-user interface that lets you specify an unbound config file,
|
||||
see :doc:`unbound.conf(5)</manpages/unbound.conf>`, which is read for
|
||||
configuration.
|
||||
Not all options are relevant.
|
||||
For some specific options, such as adding trust anchors, special
|
||||
routines exist.
|
||||
This function is thread-safe only if a single instance of **ub_ctx**\*
|
||||
exists in the application.
|
||||
If several instances exist the application has to ensure that
|
||||
**ub_ctx_config** is not called in parallel by the different instances.
|
||||
|
||||
ub_ctx_set_fwd
|
||||
Set machine to forward DNS queries to, the caching resolver to use.
|
||||
IP4 or IP6 address.
|
||||
Forwards all DNS requests to that machine, which is expected to run a
|
||||
recursive resolver.
|
||||
If the proxy is not DNSSEC capable, validation may fail.
|
||||
Can be called several times, in that case the addresses are used as
|
||||
backup servers.
|
||||
At this time it is only possible to set configuration before the first
|
||||
resolve is done.
|
||||
|
||||
ub_ctx_set_stub
|
||||
Set a stub zone, authoritative dns servers to use for a particular
|
||||
zone.
|
||||
IP4 or IP6 address.
|
||||
If the address is NULL the stub entry is removed.
|
||||
Set isprime true if you configure root hints with it.
|
||||
Otherwise similar to the stub zone item from unbound's config file.
|
||||
Can be called several times, for different zones, or to add multiple
|
||||
addresses for a particular zone.
|
||||
At this time it is only possible to set configuration before the first
|
||||
resolve is done.
|
||||
|
||||
ub_ctx_set_tls
|
||||
Enable DNS over TLS (DoT) for machines set with **ub_ctx_set_fwd**.
|
||||
At this time it is only possible to set configuration before the first
|
||||
resolve is done.
|
||||
|
||||
ub_ctx_resolvconf
|
||||
By default the root servers are queried and full resolver mode is used,
|
||||
but you can use this call to read the list of nameservers to use from
|
||||
the filename given.
|
||||
Usually :file:`"/etc/resolv.conf"`.
|
||||
Uses those nameservers as caching proxies.
|
||||
If they do not support DNSSEC, validation may fail.
|
||||
Only nameservers are picked up, the searchdomain, ndots and other
|
||||
settings from *resolv.conf(5)* are ignored.
|
||||
If fname NULL is passed, :file:`"/etc/resolv.conf"` is used (if on
|
||||
Windows, the system-wide configured nameserver is picked instead).
|
||||
At this time it is only possible to set configuration before the first
|
||||
resolve is done.
|
||||
|
||||
ub_ctx_hosts
|
||||
Read list of hosts from the filename given.
|
||||
Usually :file:`"/etc/hosts"`.
|
||||
When queried for, these addresses are not marked DNSSEC secure.
|
||||
If fname NULL is passed, :file:`"/etc/hosts"` is used (if on Windows,
|
||||
:file:`etc/hosts` from WINDIR is picked instead).
|
||||
At this time it is only possible to set configuration before the first
|
||||
resolve is done.
|
||||
|
||||
ub_ctx_add_ta
|
||||
Add a trust anchor to the given context.
|
||||
At this time it is only possible to add trusted keys before the first
|
||||
resolve is done.
|
||||
The format is a string, similar to the zone-file format,
|
||||
**[domainname]** **[type]** **[rdata contents]**.
|
||||
Both DS and DNSKEY records are accepted.
|
||||
|
||||
ub_ctx_add_ta_autr
|
||||
Add filename with automatically tracked trust anchor to the given
|
||||
context.
|
||||
Pass name of a file with the managed trust anchor.
|
||||
You can create this file with
|
||||
:doc:`unbound-anchor(8)</manpages/unbound-anchor>` for the root anchor.
|
||||
You can also create it with an initial file with one line with a DNSKEY
|
||||
or DS record.
|
||||
If the file is writable, it is updated when the trust anchor changes.
|
||||
At this time it is only possible to add trusted keys before the first
|
||||
resolve is done.
|
||||
|
||||
ub_ctx_add_ta_file
|
||||
Add trust anchors to the given context.
|
||||
Pass name of a file with DS and DNSKEY records in zone file format.
|
||||
At this time it is only possible to add trusted keys before the first
|
||||
resolve is done.
|
||||
|
||||
ub_ctx_trustedkeys
|
||||
Add trust anchors to the given context.
|
||||
Pass the name of a bind-style config file with ``trusted-keys{}``.
|
||||
At this time it is only possible to add trusted keys before the first
|
||||
resolve is done.
|
||||
|
||||
ub_ctx_debugout
|
||||
Set debug and error log output to the given stream.
|
||||
Pass NULL to disable output.
|
||||
Default is stderr.
|
||||
File-names or using syslog can be enabled using config options, this
|
||||
routine is for using your own stream.
|
||||
|
||||
ub_ctx_debuglevel
|
||||
Set debug verbosity for the context.
|
||||
Output is directed to stderr.
|
||||
Higher debug level gives more output.
|
||||
|
||||
ub_ctx_async
|
||||
Set a context behaviour for asynchronous action.
|
||||
if set to true, enables threading and a call to **ub_resolve_async**
|
||||
creates a thread to handle work in the background.
|
||||
If false, a process is forked to handle work in the background.
|
||||
Changes to this setting after **ub_resolve_async** calls have been made
|
||||
have no effect (delete and re-create the context to change).
|
||||
|
||||
ub_poll
|
||||
Poll a context to see if it has any new results.
|
||||
Do not poll in a loop, instead extract the **fd** below to poll for
|
||||
readiness, and then check, or wait using the wait routine.
|
||||
Returns 0 if nothing to read, or nonzero if a result is available.
|
||||
If nonzero, call **ub_process** to do callbacks.
|
||||
|
||||
ub_wait
|
||||
Wait for a context to finish with results.
|
||||
Calls **ub_process** after the wait for you.
|
||||
After the wait, there are no more outstanding asynchronous queries.
|
||||
|
||||
ub_fd
|
||||
Get file descriptor.
|
||||
Wait for it to become readable, at this point answers are returned from
|
||||
the asynchronous validating resolver.
|
||||
Then call the **ub_process** to continue processing.
|
||||
|
||||
ub_process
|
||||
Call this routine to continue processing results from the validating
|
||||
resolver (when the **fd** becomes readable).
|
||||
Will perform necessary callbacks.
|
||||
|
||||
ub_resolve
|
||||
Perform resolution and validation of the target name.
|
||||
The name is a domain name in a zero terminated text string.
|
||||
The rrtype and rrclass are DNS type and class codes.
|
||||
The result structure is newly allocated with the resulting data.
|
||||
|
||||
ub_resolve_async
|
||||
Perform asynchronous resolution and validation of the target name.
|
||||
Arguments mean the same as for **ub_resolve** except no data is
|
||||
returned immediately, instead a callback is called later.
|
||||
The callback receives a copy of the mydata pointer, that you can use to
|
||||
pass information to the callback.
|
||||
The callback type is a function pointer to a function declared as:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
void my_callback_function(void* my_arg, int err,
|
||||
struct ub_result* result);
|
||||
|
||||
The **async_id** is returned so you can (at your option) decide to
|
||||
track it and cancel the request if needed.
|
||||
If you pass a NULL pointer the **async_id** is not returned.
|
||||
|
||||
ub_cancel
|
||||
Cancel an async query in progress.
|
||||
This may return an error if the query does not exist, or the query is
|
||||
already being delivered, in that case you may still get a callback for
|
||||
the query.
|
||||
|
||||
ub_resolve_free
|
||||
Free struct **ub_result** contents after use.
|
||||
|
||||
ub_strerror
|
||||
Convert error value from one of the unbound library functions to a
|
||||
human readable string.
|
||||
|
||||
ub_ctx_print_local_zones
|
||||
Debug printout the local authority information to debug output.
|
||||
|
||||
ub_ctx_zone_add
|
||||
Add new zone to local authority info, like local-zone
|
||||
:doc:`unbound.conf(5)</manpages/unbound.conf>` statement.
|
||||
|
||||
ub_ctx_zone_remove
|
||||
Delete zone from local authority info.
|
||||
|
||||
ub_ctx_data_add
|
||||
Add resource record data to local authority info, like local-data
|
||||
:doc:`unbound.conf(5)</manpages/unbound.conf>` statement.
|
||||
|
||||
ub_ctx_data_remove
|
||||
Delete local authority data from the name given.
|
||||
|
||||
Result Data structure
|
||||
---------------------
|
||||
|
||||
The result of the DNS resolution and validation is returned as *struct
|
||||
ub_result*.
|
||||
The result structure contains the following entries:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
struct ub_result {
|
||||
char* qname; /* text string, original question */
|
||||
int qtype; /* type code asked for */
|
||||
int qclass; /* class code asked for */
|
||||
char** data; /* array of rdata items, NULL terminated*/
|
||||
int* len; /* array with lengths of rdata items */
|
||||
char* canonname; /* canonical name of result */
|
||||
int rcode; /* additional error code in case of no data */
|
||||
void* answer_packet; /* full network format answer packet */
|
||||
int answer_len; /* length of packet in octets */
|
||||
int havedata; /* true if there is data */
|
||||
int nxdomain; /* true if nodata because name does not exist */
|
||||
int secure; /* true if result is secure */
|
||||
int bogus; /* true if a security failure happened */
|
||||
char* why_bogus; /* string with error if bogus */
|
||||
int was_ratelimited; /* true if the query was ratelimited (SERVFAIL) by unbound */
|
||||
int ttl; /* number of seconds the result is valid */
|
||||
};
|
||||
|
||||
If both secure and bogus are false, security was not enabled for the domain of
|
||||
the query.
|
||||
Else, they are not both true, one of them is true.
|
||||
|
||||
Return Values
|
||||
-------------
|
||||
|
||||
Many routines return an error code.
|
||||
The value 0 (zero) denotes no error happened.
|
||||
Other values can be passed to **ub_strerror** to obtain a readable error
|
||||
string.
|
||||
**ub_strerror** returns a zero terminated string.
|
||||
**ub_ctx_create** returns NULL on an error (a malloc failure).
|
||||
**ub_poll** returns true if some information may be available, false otherwise.
|
||||
**ub_fd** returns a file descriptor or -1 on error.
|
||||
**ub_ctx_config** and **ub_ctx_resolvconf** attempt to leave errno informative
|
||||
on a function return with file read failure.
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
:doc:`unbound.conf(5)</manpages/unbound.conf>`, :doc:`unbound(8)</manpages/unbound>`.
|
||||
|
|
@ -1,189 +1,300 @@
|
|||
.TH "unbound-anchor" "8" "@date@" "NLnet Labs" "unbound @version@"
|
||||
.\"
|
||||
.\" unbound-anchor.8 -- unbound anchor maintenance utility manual
|
||||
.\"
|
||||
.\" Copyright (c) 2008, NLnet Labs. All rights reserved.
|
||||
.\"
|
||||
.\" See LICENSE for the license.
|
||||
.\"
|
||||
.\"
|
||||
.SH "NAME"
|
||||
.B unbound\-anchor
|
||||
\- Unbound anchor utility.
|
||||
.SH "SYNOPSIS"
|
||||
.B unbound\-anchor
|
||||
.RB [ opts ]
|
||||
.SH "DESCRIPTION"
|
||||
.B Unbound\-anchor
|
||||
performs setup or update of the root trust anchor for DNSSEC validation.
|
||||
The program fetches the trust anchor with the method from RFC7958 when
|
||||
regular RFC5011 update fails to bring it up to date.
|
||||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.
|
||||
.nr rst2man-indent-level 0
|
||||
.
|
||||
.de1 rstReportMargin
|
||||
\\$1 \\n[an-margin]
|
||||
level \\n[rst2man-indent-level]
|
||||
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
-
|
||||
\\n[rst2man-indent0]
|
||||
\\n[rst2man-indent1]
|
||||
\\n[rst2man-indent2]
|
||||
..
|
||||
.de1 INDENT
|
||||
.\" .rstReportMargin pre:
|
||||
. RS \\$1
|
||||
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
||||
. nr rst2man-indent-level +1
|
||||
.\" .rstReportMargin post:
|
||||
..
|
||||
.de UNINDENT
|
||||
. RE
|
||||
.\" indent \\n[an-margin]
|
||||
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.nr rst2man-indent-level -1
|
||||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||
..
|
||||
.TH "UNBOUND-ANCHOR" "8" "@date@" "@version@" "Unbound"
|
||||
.SH NAME
|
||||
unbound-anchor \- Unbound @version@ anchor utility.
|
||||
.SH SYNOPSIS
|
||||
.sp
|
||||
\fBunbound\-anchor\fP [\fBopts\fP]
|
||||
.SH DESCRIPTION
|
||||
.sp
|
||||
\fBunbound\-anchor\fP performs setup or update of the root trust anchor for DNSSEC
|
||||
validation.
|
||||
The program fetches the trust anchor with the method from \fI\%RFC 7958\fP when
|
||||
regular \fI\%RFC 5011\fP update fails to bring it up to date.
|
||||
It can be run (as root) from the commandline, or run as part of startup
|
||||
scripts. Before you start the \fIunbound\fR(8) DNS server.
|
||||
.P
|
||||
scripts.
|
||||
Before you start the \fI\%unbound(8)\fP DNS server.
|
||||
.sp
|
||||
Suggested usage:
|
||||
.P
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
.sp
|
||||
.nf
|
||||
# in the init scripts.
|
||||
# provide or update the root anchor (if necessary)
|
||||
unbound-anchor \-a "@UNBOUND_ROOTKEY_FILE@"
|
||||
# Please note usage of this root anchor is at your own risk
|
||||
# and under the terms of our LICENSE (see source).
|
||||
#
|
||||
# start validating resolver
|
||||
# the unbound.conf contains:
|
||||
# auto-trust-anchor-file: "@UNBOUND_ROOTKEY_FILE@"
|
||||
unbound \-c unbound.conf
|
||||
.ft C
|
||||
# in the init scripts.
|
||||
# provide or update the root anchor (if necessary)
|
||||
unbound\-anchor \-a \(dq@UNBOUND_ROOTKEY_FILE@\(dq
|
||||
# Please note usage of this root anchor is at your own risk
|
||||
# and under the terms of our LICENSE (see source).
|
||||
#
|
||||
# start validating resolver
|
||||
# the unbound.conf contains:
|
||||
# auto\-trust\-anchor\-file: \(dq@UNBOUND_ROOTKEY_FILE@\(dq
|
||||
unbound \-c unbound.conf
|
||||
.ft P
|
||||
.fi
|
||||
.P
|
||||
This tool provides builtin default contents for the root anchor and root
|
||||
update certificate files.
|
||||
.P
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.sp
|
||||
This tool provides builtin default contents for the root anchor and root update
|
||||
certificate files.
|
||||
.sp
|
||||
It tests if the root anchor file works, and if not, and an update is possible,
|
||||
attempts to update the root anchor using the root update certificate.
|
||||
It performs a https fetch of root-anchors.xml and checks the results (RFC7958),
|
||||
if all checks are successful, it updates the root anchor file. Otherwise
|
||||
the root anchor file is unchanged. It performs RFC5011 tracking if the
|
||||
DNSSEC information available via the DNS makes that possible.
|
||||
.P
|
||||
It does not perform an update if the certificate is expired, if the network
|
||||
is down or other errors occur.
|
||||
.P
|
||||
It performs a https fetch of
|
||||
\fI\%root\-anchors.xml\fP
|
||||
and checks the results (\fI\%RFC 7958\fP); if all checks are successful, it updates
|
||||
the root anchor file.
|
||||
Otherwise the root anchor file is unchanged.
|
||||
It performs \fI\%RFC 5011\fP tracking if the DNSSEC information available via the
|
||||
DNS makes that possible.
|
||||
.sp
|
||||
It does not perform an update if the certificate is expired, if the network is
|
||||
down or other errors occur.
|
||||
.sp
|
||||
The available options are:
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-a \fIfile
|
||||
.B \-a <file>
|
||||
The root anchor key file, that is read in and written out.
|
||||
Default is @UNBOUND_ROOTKEY_FILE@.
|
||||
If the file does not exist, or is empty, a builtin root key is written to it.
|
||||
Default is \fB@UNBOUND_ROOTKEY_FILE@\fP\&.
|
||||
If the file does not exist, or is empty, a builtin root key is written
|
||||
to it.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-c \fIfile
|
||||
.B \-c <file>
|
||||
The root update certificate file, that is read in.
|
||||
Default is @UNBOUND_ROOTCERT_FILE@.
|
||||
Default is \fB@UNBOUND_ROOTCERT_FILE@\fP\&.
|
||||
If the file does not exist, or is empty, a builtin certificate is used.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-l
|
||||
List the builtin root key and builtin root update certificate on stdout.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-u \fIname
|
||||
The server name, it connects to https://name. Specify without https:// prefix.
|
||||
The default is "data.iana.org". It connects to the port specified with \-P.
|
||||
.B \-u <name>
|
||||
The server name, it connects to \fBhttps://name\fP\&.
|
||||
Specify without \fBhttps://\fP prefix.
|
||||
The default is \fB\(dqdata.iana.org\(dq\fP\&.
|
||||
It connects to the port specified with \fI\%\-P\fP\&.
|
||||
You can pass an IPv4 address or IPv6 address (no brackets) if you want.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-S
|
||||
Do not use SNI for the HTTPS connection. Default is to use SNI.
|
||||
Do not use SNI for the HTTPS connection.
|
||||
Default is to use SNI.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-b \fIaddress
|
||||
The source address to bind to for domain resolution and contacting the server
|
||||
on https. May be either an IPv4 address or IPv6 address (no brackets).
|
||||
.B \-b <address>
|
||||
The source address to bind to for domain resolution and contacting the
|
||||
server on https.
|
||||
May be either an IPv4 address or IPv6 address (no brackets).
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-x \fIpath
|
||||
The pathname to the root\-anchors.xml file on the server. (forms URL with \-u).
|
||||
The default is /root\-anchors/root\-anchors.xml.
|
||||
.B \-x <path>
|
||||
The pathname to the root\-anchors.xml file on the server.
|
||||
(forms URL with \fI\%\-u\fP).
|
||||
The default is \fB/root\-anchors/root\-anchors.xml\fP\&.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-s \fIpath
|
||||
The pathname to the root\-anchors.p7s file on the server. (forms URL with \-u).
|
||||
The default is /root\-anchors/root\-anchors.p7s. This file has to be a PKCS7
|
||||
signature over the xml file, using the pem file (\-c) as trust anchor.
|
||||
.B \-s <path>
|
||||
The pathname to the root\-anchors.p7s file on the server.
|
||||
(forms URL with \fI\%\-u\fP).
|
||||
The default is \fB/root\-anchors/root\-anchors.p7s\fP\&.
|
||||
This file has to be a PKCS7 signature over the xml file, using the pem
|
||||
file (\fI\%\-c\fP) as trust anchor.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-n \fIname
|
||||
The emailAddress for the Subject of the signer's certificate from the p7s
|
||||
signature file. Only signatures from this name are allowed. default is
|
||||
dnssec@iana.org. If you pass "" then the emailAddress is not checked.
|
||||
.B \-n <name>
|
||||
The emailAddress for the Subject of the signer\(aqs certificate from the
|
||||
p7s signature file.
|
||||
Only signatures from this name are allowed.
|
||||
The default is \fBdnssec@iana.org\fP\&.
|
||||
If you pass \fB\(dq\(dq\fP then the emailAddress is not checked.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-4
|
||||
Use IPv4 for domain resolution and contacting the server on https. Default is
|
||||
to use IPv4 and IPv6 where appropriate.
|
||||
Use IPv4 for domain resolution and contacting the server on
|
||||
https.
|
||||
Default is to use IPv4 and IPv6 where appropriate.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-6
|
||||
Use IPv6 for domain resolution and contacting the server on https. Default is
|
||||
to use IPv4 and IPv6 where appropriate.
|
||||
Use IPv6 for domain resolution and contacting the server on https.
|
||||
Default is to use IPv4 and IPv6 where appropriate.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-f \fIresolv.conf
|
||||
Use the given resolv.conf file. Not enabled by default, but you could try to
|
||||
pass /etc/resolv.conf on some systems. It contains the IP addresses of the
|
||||
recursive nameservers to use. However, since this tool could be used to
|
||||
bootstrap that very recursive nameserver, it would not be useful (since
|
||||
that server is not up yet, since we are bootstrapping it). It could be
|
||||
useful in a situation where you know an upstream cache is deployed (and
|
||||
running) and in captive portal situations.
|
||||
.B \-f <resolv.conf>
|
||||
Use the given resolv.conf file.
|
||||
Not enabled by default, but you could try to pass
|
||||
\fB/etc/resolv.conf\fP on some systems.
|
||||
It contains the IP addresses of the recursive nameservers to use.
|
||||
However, since this tool could be used to bootstrap that very recursive
|
||||
nameserver, it would not be useful (since that server is not up yet,
|
||||
since we are bootstrapping it).
|
||||
It could be useful in a situation where you know an upstream cache is
|
||||
deployed (and running) and in captive portal situations.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-r \fIroot.hints
|
||||
Use the given root.hints file (same syntax as the BIND and Unbound root hints
|
||||
file) to bootstrap domain resolution. By default a list of builtin root
|
||||
hints is used. Unbound\-anchor goes to the network itself for these roots,
|
||||
to resolve the server (\-u option) and to check the root DNSKEY records.
|
||||
.B \-r <root.hints>
|
||||
Use the given root.hints file (same syntax as the BIND and Unbound root
|
||||
hints file) to bootstrap domain resolution.
|
||||
By default a list of builtin root hints is used.
|
||||
unbound\-anchor goes to the network itself for these roots, to resolve
|
||||
the server (\fI\%\-u\fP option) and to check the root DNSKEY records.
|
||||
It does so, because the tool when used for bootstrapping the recursive
|
||||
resolver, cannot use that recursive resolver itself because it is bootstrapping
|
||||
that server.
|
||||
resolver, cannot use that recursive resolver itself because it is
|
||||
bootstrapping that server.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-R
|
||||
Allow fallback from \-f resolv.conf file to direct root servers query.
|
||||
It allows you to prefer local resolvers, but fallback automatically
|
||||
to direct root query if they do not respond or do not support DNSSEC.
|
||||
Allow fallback from \fI\%\-f\fP \fB<resolv.conf>\fP file to direct root
|
||||
servers query.
|
||||
It allows you to prefer local resolvers, but fallback automatically to
|
||||
direct root query if they do not respond or do not support DNSSEC.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-v
|
||||
More verbose. Once prints informational messages, multiple times may enable
|
||||
large debug amounts (such as full certificates or byte\-dumps of downloaded
|
||||
files). By default it prints almost nothing. It also prints nothing on
|
||||
errors by default; in that case the original root anchor file is simply
|
||||
left undisturbed, so that a recursive server can start right after it.
|
||||
More verbose.
|
||||
Once prints informational messages, multiple times may enable large
|
||||
debug amounts (such as full certificates or byte\-dumps of downloaded
|
||||
files).
|
||||
By default it prints almost nothing.
|
||||
It also prints nothing on errors by default; in that case the original
|
||||
root anchor file is simply left undisturbed, so that a recursive server
|
||||
can start right after it.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-C \fIunbound.conf
|
||||
Debug option to read unbound.conf into the resolver process used.
|
||||
.B \-C <unbound.conf>
|
||||
Debug option to read \fB<unbound.conf>\fP into the resolver process
|
||||
used.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-P \fIport
|
||||
Set the port number to use for the https connection. The default is 443.
|
||||
.B \-P <port>
|
||||
Set the port number to use for the https connection.
|
||||
The default is 443.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-F
|
||||
Debug option to force update of the root anchor through downloading the xml
|
||||
file and verifying it with the certificate. By default it first tries to
|
||||
update by contacting the DNS, which uses much less bandwidth, is much
|
||||
faster (200 msec not 2 sec), and is nicer to the deployed infrastructure.
|
||||
With this option, it still attempts to do so (and may verbosely tell you),
|
||||
but then ignores the result and goes on to use the xml fallback method.
|
||||
Debug option to force update of the root anchor through downloading the
|
||||
xml file and verifying it with the certificate.
|
||||
By default it first tries to update by contacting the DNS, which uses
|
||||
much less bandwidth, is much faster (200 msec not 2 sec), and is nicer
|
||||
to the deployed infrastructure.
|
||||
With this option, it still attempts to do so (and may verbosely tell
|
||||
you), but then ignores the result and goes on to use the xml fallback
|
||||
method.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-h
|
||||
Show the version and commandline option help.
|
||||
.SH "EXIT CODE"
|
||||
.UNINDENT
|
||||
.SH EXIT CODE
|
||||
.sp
|
||||
This tool exits with value 1 if the root anchor was updated using the
|
||||
certificate or if the builtin root-anchor was used. It exits with code
|
||||
0 if no update was necessary, if the update was possible with RFC5011
|
||||
tracking, or if an error occurred.
|
||||
.P
|
||||
certificate or if the builtin root\-anchor was used.
|
||||
It exits with code 0 if no update was necessary, if the update was possible
|
||||
with \fI\%RFC 5011\fP tracking, or if an error occurred.
|
||||
.sp
|
||||
You can check the exit value in this manner:
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
.sp
|
||||
.nf
|
||||
unbound-anchor \-a "root.key" || logger "Please check root.key"
|
||||
.ft C
|
||||
unbound\-anchor \-a \(dqroot.key\(dq || logger \(dqPlease check root.key\(dq
|
||||
.ft P
|
||||
.fi
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.sp
|
||||
Or something more suitable for your operational environment.
|
||||
.SH "TRUST"
|
||||
The root keys and update certificate included in this tool
|
||||
are provided for convenience and under the terms of our
|
||||
license (see the LICENSE file in the source distribution or
|
||||
https://github.com/NLnetLabs/unbound/blob/master/LICENSE) and might be stale or
|
||||
not suitable to your purpose.
|
||||
.P
|
||||
By running "unbound\-anchor \-l" the keys and certificate that are
|
||||
.SH TRUST
|
||||
.sp
|
||||
The root keys and update certificate included in this tool are provided for
|
||||
convenience and under the terms of our license (see the LICENSE file in the
|
||||
source distribution or \fI\%https://github.com/NLnetLabs/unbound/blob/master/LICENSE\fP
|
||||
and might be stale or not suitable to your purpose.
|
||||
.sp
|
||||
By running \fI\%unbound\-anchor \-l\fP the keys and certificate that are
|
||||
configured in the code are printed for your convenience.
|
||||
.P
|
||||
The build\-in configuration can be overridden by providing a root\-cert
|
||||
file and a rootkey file.
|
||||
.SH "FILES"
|
||||
.sp
|
||||
The built\-in configuration can be overridden by providing a root\-cert file and
|
||||
a rootkey file.
|
||||
.SH FILES
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.I @UNBOUND_ROOTKEY_FILE@
|
||||
The root anchor file, updated with 5011 tracking, and read and written to.
|
||||
.B @UNBOUND_ROOTKEY_FILE@
|
||||
The root anchor file, updated with 5011 tracking, and read and written
|
||||
to.
|
||||
The file is created if it does not exist.
|
||||
.TP
|
||||
.I @UNBOUND_ROOTCERT_FILE@
|
||||
The trusted self\-signed certificate that is used to verify the downloaded
|
||||
DNSSEC root trust anchor. You can update it by fetching it from
|
||||
https://data.iana.org/root\-anchors/icannbundle.pem (and validate it).
|
||||
.B @UNBOUND_ROOTCERT_FILE@
|
||||
The trusted self\-signed certificate that is used to verify the
|
||||
downloaded DNSSEC root trust anchor.
|
||||
You can update it by fetching it from
|
||||
\fI\%https://data.iana.org/root\-anchors/icannbundle.pem\fP (and validate it).
|
||||
If the file does not exist or is empty, a builtin version is used.
|
||||
.TP
|
||||
.I https://data.iana.org/root\-anchors/root\-anchors.xml
|
||||
.B \fI\%https://data.iana.org/root\-anchors/root\-anchors.xml\fP
|
||||
Source for the root key information.
|
||||
.TP
|
||||
.I https://data.iana.org/root\-anchors/root\-anchors.p7s
|
||||
.B \fI\%https://data.iana.org/root\-anchors/root\-anchors.p7s\fP
|
||||
Signature on the root key information.
|
||||
.SH "SEE ALSO"
|
||||
\fIunbound.conf\fR(5),
|
||||
\fIunbound\fR(8).
|
||||
.UNINDENT
|
||||
.SH SEE ALSO
|
||||
.sp
|
||||
\fI\%unbound.conf(5)\fP,
|
||||
\fI\%unbound(8)\fP\&.
|
||||
.SH AUTHOR
|
||||
Unbound developers are mentioned in the CREDITS file in the distribution.
|
||||
.SH COPYRIGHT
|
||||
1999-2025, NLnet Labs
|
||||
.\" Generated by docutils manpage writer.
|
||||
.
|
||||
|
|
|
|||
281
doc/unbound-anchor.rst
Normal file
281
doc/unbound-anchor.rst
Normal file
|
|
@ -0,0 +1,281 @@
|
|||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
.. program:: unbound-anchor
|
||||
|
||||
unbound-anchor(8)
|
||||
=================
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
||||
**unbound-anchor** [``opts``]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``unbound-anchor`` performs setup or update of the root trust anchor for DNSSEC
|
||||
validation.
|
||||
The program fetches the trust anchor with the method from :rfc:`7958` when
|
||||
regular :rfc:`5011` update fails to bring it up to date.
|
||||
It can be run (as root) from the commandline, or run as part of startup
|
||||
scripts.
|
||||
Before you start the :doc:`unbound(8)</manpages/unbound>` DNS server.
|
||||
|
||||
Suggested usage:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
# in the init scripts.
|
||||
# provide or update the root anchor (if necessary)
|
||||
unbound-anchor -a "@UNBOUND_ROOTKEY_FILE@"
|
||||
# Please note usage of this root anchor is at your own risk
|
||||
# and under the terms of our LICENSE (see source).
|
||||
#
|
||||
# start validating resolver
|
||||
# the unbound.conf contains:
|
||||
# auto-trust-anchor-file: "@UNBOUND_ROOTKEY_FILE@"
|
||||
unbound -c unbound.conf
|
||||
|
||||
This tool provides builtin default contents for the root anchor and root update
|
||||
certificate files.
|
||||
|
||||
It tests if the root anchor file works, and if not, and an update is possible,
|
||||
attempts to update the root anchor using the root update certificate.
|
||||
It performs a https fetch of
|
||||
`root-anchors.xml <http://data.iana.org/root-anchors/root-anchors.xml>`__
|
||||
and checks the results (:rfc:`7958`); if all checks are successful, it updates
|
||||
the root anchor file.
|
||||
Otherwise the root anchor file is unchanged.
|
||||
It performs :rfc:`5011` tracking if the DNSSEC information available via the
|
||||
DNS makes that possible.
|
||||
|
||||
It does not perform an update if the certificate is expired, if the network is
|
||||
down or other errors occur.
|
||||
|
||||
The available options are:
|
||||
|
||||
.. option:: -a <file>
|
||||
|
||||
The root anchor key file, that is read in and written out.
|
||||
Default is :file:`@UNBOUND_ROOTKEY_FILE@`.
|
||||
If the file does not exist, or is empty, a builtin root key is written
|
||||
to it.
|
||||
|
||||
.. option:: -c <file>
|
||||
|
||||
The root update certificate file, that is read in.
|
||||
Default is :file:`@UNBOUND_ROOTCERT_FILE@`.
|
||||
If the file does not exist, or is empty, a builtin certificate is used.
|
||||
|
||||
.. option:: -l
|
||||
|
||||
List the builtin root key and builtin root update certificate on stdout.
|
||||
|
||||
.. option:: -u <name>
|
||||
|
||||
The server name, it connects to ``https://name``.
|
||||
Specify without ``https://`` prefix.
|
||||
The default is ``"data.iana.org"``.
|
||||
It connects to the port specified with :option:`-P`.
|
||||
You can pass an IPv4 address or IPv6 address (no brackets) if you want.
|
||||
|
||||
.. option:: -S
|
||||
|
||||
Do not use SNI for the HTTPS connection.
|
||||
Default is to use SNI.
|
||||
|
||||
.. option:: -b <address>
|
||||
|
||||
The source address to bind to for domain resolution and contacting the
|
||||
server on https.
|
||||
May be either an IPv4 address or IPv6 address (no brackets).
|
||||
|
||||
.. option:: -x <path>
|
||||
|
||||
The pathname to the root-anchors.xml file on the server.
|
||||
(forms URL with :option:`-u`).
|
||||
The default is :file:`/root-anchors/root-anchors.xml`.
|
||||
|
||||
.. option:: -s <path>
|
||||
|
||||
The pathname to the root-anchors.p7s file on the server.
|
||||
(forms URL with :option:`-u`).
|
||||
The default is :file:`/root-anchors/root-anchors.p7s`.
|
||||
This file has to be a PKCS7 signature over the xml file, using the pem
|
||||
file (:option:`-c`) as trust anchor.
|
||||
|
||||
.. option:: -n <name>
|
||||
|
||||
The emailAddress for the Subject of the signer's certificate from the
|
||||
p7s signature file.
|
||||
Only signatures from this name are allowed.
|
||||
The default is ``dnssec@iana.org``.
|
||||
If you pass ``""`` then the emailAddress is not checked.
|
||||
|
||||
.. option:: -4
|
||||
|
||||
Use IPv4 for domain resolution and contacting the server on
|
||||
https.
|
||||
Default is to use IPv4 and IPv6 where appropriate.
|
||||
|
||||
.. option:: -6
|
||||
|
||||
Use IPv6 for domain resolution and contacting the server on https.
|
||||
Default is to use IPv4 and IPv6 where appropriate.
|
||||
|
||||
.. option:: -f <resolv.conf>
|
||||
|
||||
Use the given resolv.conf file.
|
||||
Not enabled by default, but you could try to pass
|
||||
:file:`/etc/resolv.conf` on some systems.
|
||||
It contains the IP addresses of the recursive nameservers to use.
|
||||
However, since this tool could be used to bootstrap that very recursive
|
||||
nameserver, it would not be useful (since that server is not up yet,
|
||||
since we are bootstrapping it).
|
||||
It could be useful in a situation where you know an upstream cache is
|
||||
deployed (and running) and in captive portal situations.
|
||||
|
||||
.. option:: -r <root.hints>
|
||||
|
||||
Use the given root.hints file (same syntax as the BIND and Unbound root
|
||||
hints file) to bootstrap domain resolution.
|
||||
By default a list of builtin root hints is used.
|
||||
unbound-anchor goes to the network itself for these roots, to resolve
|
||||
the server (:option:`-u` option) and to check the root DNSKEY records.
|
||||
It does so, because the tool when used for bootstrapping the recursive
|
||||
resolver, cannot use that recursive resolver itself because it is
|
||||
bootstrapping that server.
|
||||
|
||||
.. option:: -R
|
||||
|
||||
Allow fallback from :option:`-f` ``<resolv.conf>`` file to direct root
|
||||
servers query.
|
||||
It allows you to prefer local resolvers, but fallback automatically to
|
||||
direct root query if they do not respond or do not support DNSSEC.
|
||||
|
||||
.. option:: -v
|
||||
|
||||
More verbose.
|
||||
Once prints informational messages, multiple times may enable large
|
||||
debug amounts (such as full certificates or byte-dumps of downloaded
|
||||
files).
|
||||
By default it prints almost nothing.
|
||||
It also prints nothing on errors by default; in that case the original
|
||||
root anchor file is simply left undisturbed, so that a recursive server
|
||||
can start right after it.
|
||||
|
||||
.. option:: -C <unbound.conf>
|
||||
|
||||
Debug option to read :file:`<unbound.conf>` into the resolver process
|
||||
used.
|
||||
|
||||
.. option:: -P <port>
|
||||
|
||||
Set the port number to use for the https connection.
|
||||
The default is 443.
|
||||
|
||||
.. option:: -F
|
||||
|
||||
Debug option to force update of the root anchor through downloading the
|
||||
xml file and verifying it with the certificate.
|
||||
By default it first tries to update by contacting the DNS, which uses
|
||||
much less bandwidth, is much faster (200 msec not 2 sec), and is nicer
|
||||
to the deployed infrastructure.
|
||||
With this option, it still attempts to do so (and may verbosely tell
|
||||
you), but then ignores the result and goes on to use the xml fallback
|
||||
method.
|
||||
|
||||
.. option:: -h
|
||||
|
||||
Show the version and commandline option help.
|
||||
|
||||
Exit Code
|
||||
---------
|
||||
|
||||
This tool exits with value 1 if the root anchor was updated using the
|
||||
certificate or if the builtin root-anchor was used.
|
||||
It exits with code 0 if no update was necessary, if the update was possible
|
||||
with :rfc:`5011` tracking, or if an error occurred.
|
||||
|
||||
You can check the exit value in this manner:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
unbound-anchor -a "root.key" || logger "Please check root.key"
|
||||
|
||||
Or something more suitable for your operational environment.
|
||||
|
||||
Trust
|
||||
-----
|
||||
|
||||
The root keys and update certificate included in this tool are provided for
|
||||
convenience and under the terms of our license (see the LICENSE file in the
|
||||
source distribution or https://github.com/NLnetLabs/unbound/blob/master/LICENSE
|
||||
and might be stale or not suitable to your purpose.
|
||||
|
||||
By running :option:`unbound-anchor -l` the keys and certificate that are
|
||||
configured in the code are printed for your convenience.
|
||||
|
||||
The built-in configuration can be overridden by providing a root-cert file and
|
||||
a rootkey file.
|
||||
|
||||
Files
|
||||
-----
|
||||
|
||||
@UNBOUND_ROOTKEY_FILE@
|
||||
The root anchor file, updated with 5011 tracking, and read and written
|
||||
to.
|
||||
The file is created if it does not exist.
|
||||
|
||||
@UNBOUND_ROOTCERT_FILE@
|
||||
The trusted self-signed certificate that is used to verify the
|
||||
downloaded DNSSEC root trust anchor.
|
||||
You can update it by fetching it from
|
||||
https://data.iana.org/root-anchors/icannbundle.pem (and validate it).
|
||||
If the file does not exist or is empty, a builtin version is used.
|
||||
|
||||
https://data.iana.org/root-anchors/root-anchors.xml
|
||||
Source for the root key information.
|
||||
|
||||
https://data.iana.org/root-anchors/root-anchors.p7s
|
||||
Signature on the root key information.
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
:doc:`unbound.conf(5)</manpages/unbound.conf>`,
|
||||
:doc:`unbound(8)</manpages/unbound>`.
|
||||
|
|
@ -1,56 +1,93 @@
|
|||
.TH "unbound-checkconf" "8" "@date@" "NLnet Labs" "unbound @version@"
|
||||
.\"
|
||||
.\" unbound-checkconf.8 -- unbound configuration checker manual
|
||||
.\"
|
||||
.\" Copyright (c) 2007, NLnet Labs. All rights reserved.
|
||||
.\"
|
||||
.\" See LICENSE for the license.
|
||||
.\"
|
||||
.\"
|
||||
.SH "NAME"
|
||||
unbound\-checkconf
|
||||
\- Check Unbound configuration file for errors.
|
||||
.SH "SYNOPSIS"
|
||||
.B unbound\-checkconf
|
||||
.RB [ \-h ]
|
||||
.RB [ \-f ]
|
||||
.RB [ \-q ]
|
||||
.RB [ \-o
|
||||
.IR option ]
|
||||
.RI [ cfgfile ]
|
||||
.SH "DESCRIPTION"
|
||||
.B Unbound\-checkconf
|
||||
checks the configuration file for the
|
||||
\fIunbound\fR(8)
|
||||
DNS resolver for syntax and other errors.
|
||||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.
|
||||
.nr rst2man-indent-level 0
|
||||
.
|
||||
.de1 rstReportMargin
|
||||
\\$1 \\n[an-margin]
|
||||
level \\n[rst2man-indent-level]
|
||||
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
-
|
||||
\\n[rst2man-indent0]
|
||||
\\n[rst2man-indent1]
|
||||
\\n[rst2man-indent2]
|
||||
..
|
||||
.de1 INDENT
|
||||
.\" .rstReportMargin pre:
|
||||
. RS \\$1
|
||||
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
||||
. nr rst2man-indent-level +1
|
||||
.\" .rstReportMargin post:
|
||||
..
|
||||
.de UNINDENT
|
||||
. RE
|
||||
.\" indent \\n[an-margin]
|
||||
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.nr rst2man-indent-level -1
|
||||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||
..
|
||||
.TH "UNBOUND-CHECKCONF" "8" "@date@" "@version@" "Unbound"
|
||||
.SH NAME
|
||||
unbound-checkconf \- Check Unbound @version@ configuration file for errors.
|
||||
.SH SYNOPSIS
|
||||
.sp
|
||||
\fBunbound\-checkconf\fP [\fB\-hf\fP] [\fB\-o option\fP] [cfgfile]
|
||||
.SH DESCRIPTION
|
||||
.sp
|
||||
\fBunbound\-checkconf\fP checks the configuration file for the
|
||||
\fI\%unbound(8)\fP DNS resolver for syntax and other errors.
|
||||
The config file syntax is described in
|
||||
\fIunbound.conf\fR(5).
|
||||
.P
|
||||
\fI\%unbound.conf(5)\fP\&.
|
||||
.sp
|
||||
The available options are:
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-h
|
||||
Show the version and commandline option help.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-f
|
||||
Print full pathname, with chroot applied to it. Use with the \-o option.
|
||||
.TP
|
||||
.B \-o\fI option
|
||||
If given, after checking the config file the value of this option is
|
||||
printed to stdout. For "" (disabled) options an empty line is printed.
|
||||
Print full pathname, with chroot applied to it.
|
||||
Use with the \fI\%\-o\fP option.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-q
|
||||
Make the operation quiet, suppress output on success.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.I cfgfile
|
||||
The config file to read with settings for Unbound. It is checked.
|
||||
.B \-o <option>
|
||||
If given, after checking the config file the value of this option is
|
||||
printed to stdout.
|
||||
For \fB\(dq\(dq\fP (disabled) options an empty line is printed.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B cfgfile
|
||||
The config file to read with settings for Unbound.
|
||||
It is checked.
|
||||
If omitted, the config file at the default location is checked.
|
||||
.SH "EXIT CODE"
|
||||
The unbound\-checkconf program exits with status code 1 on error,
|
||||
0 for a correct config file.
|
||||
.SH "FILES"
|
||||
.UNINDENT
|
||||
.SH EXIT CODE
|
||||
.sp
|
||||
The \fBunbound\-checkconf\fP program exits with status code 1 on error, 0 for a
|
||||
correct config file.
|
||||
.SH FILES
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.I @ub_conf_file@
|
||||
.B @ub_conf_file@
|
||||
Unbound configuration file.
|
||||
.SH "SEE ALSO"
|
||||
\fIunbound.conf\fR(5),
|
||||
\fIunbound\fR(8).
|
||||
.UNINDENT
|
||||
.SH SEE ALSO
|
||||
.sp
|
||||
\fI\%unbound.conf(5)\fP,
|
||||
\fI\%unbound(8)\fP\&.
|
||||
.SH AUTHOR
|
||||
Unbound developers are mentioned in the CREDITS file in the distribution.
|
||||
.SH COPYRIGHT
|
||||
1999-2025, NLnet Labs
|
||||
.\" Generated by docutils manpage writer.
|
||||
.
|
||||
|
|
|
|||
98
doc/unbound-checkconf.rst
Normal file
98
doc/unbound-checkconf.rst
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
.. program:: unbound-checkconf
|
||||
|
||||
unbound-checkconf(8)
|
||||
====================
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
||||
**unbound-checkconf** [``-hf``] [``-o option``] [cfgfile]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``unbound-checkconf`` checks the configuration file for the
|
||||
:doc:`unbound(8)</manpages/unbound>` DNS resolver for syntax and other errors.
|
||||
The config file syntax is described in
|
||||
:doc:`unbound.conf(5)</manpages/unbound.conf>`.
|
||||
|
||||
The available options are:
|
||||
|
||||
.. option:: -h
|
||||
|
||||
Show the version and commandline option help.
|
||||
|
||||
.. option:: -f
|
||||
|
||||
Print full pathname, with chroot applied to it.
|
||||
Use with the :option:`-o` option.
|
||||
|
||||
.. option:: -q
|
||||
|
||||
Make the operation quiet, suppress output on success.
|
||||
|
||||
.. option:: -o <option>
|
||||
|
||||
If given, after checking the config file the value of this option is
|
||||
printed to stdout.
|
||||
For ``""`` (disabled) options an empty line is printed.
|
||||
|
||||
.. option:: cfgfile
|
||||
|
||||
The config file to read with settings for Unbound.
|
||||
It is checked.
|
||||
If omitted, the config file at the default location is checked.
|
||||
|
||||
Exit Code
|
||||
---------
|
||||
|
||||
The ``unbound-checkconf`` program exits with status code 1 on error, 0 for a
|
||||
correct config file.
|
||||
|
||||
Files
|
||||
-----
|
||||
|
||||
@ub_conf_file@
|
||||
Unbound configuration file.
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
:doc:`unbound.conf(5)</manpages/unbound.conf>`,
|
||||
:doc:`unbound(8)</manpages/unbound>`.
|
||||
File diff suppressed because it is too large
Load diff
1362
doc/unbound-control.rst
Normal file
1362
doc/unbound-control.rst
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,118 +1,190 @@
|
|||
.TH "unbound\-host" "1" "@date@" "NLnet Labs" "unbound @version@"
|
||||
.\"
|
||||
.\" unbound-host.1 -- unbound DNS lookup utility
|
||||
.\"
|
||||
.\" Copyright (c) 2007, NLnet Labs. All rights reserved.
|
||||
.\"
|
||||
.\" See LICENSE for the license.
|
||||
.\"
|
||||
.\"
|
||||
.SH "NAME"
|
||||
.B unbound\-host
|
||||
\- unbound DNS lookup utility
|
||||
.SH "SYNOPSIS"
|
||||
.B unbound\-host
|
||||
.RB [ \-C
|
||||
.IR configfile ]
|
||||
.RB [ \-vdhr46D ]
|
||||
.RB [ \-c
|
||||
.IR class ]
|
||||
.RB [ \-t
|
||||
.IR type ]
|
||||
.RB [ \-y
|
||||
.IR key ]
|
||||
.RB [ \-f
|
||||
.IR keyfile ]
|
||||
.RB [ \-F
|
||||
.IR namedkeyfile ]
|
||||
.I hostname
|
||||
.SH "DESCRIPTION"
|
||||
.B Unbound\-host
|
||||
uses the Unbound validating resolver to query for the hostname and display
|
||||
results. With the \fB\-v\fR option it displays validation
|
||||
status: secure, insecure, bogus (security failure).
|
||||
.P
|
||||
By default it reads no configuration file whatsoever. It attempts to reach
|
||||
the internet root servers. With \fB\-C\fR an Unbound config file and with
|
||||
\fB\-r\fR resolv.conf can be read.
|
||||
.P
|
||||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.
|
||||
.nr rst2man-indent-level 0
|
||||
.
|
||||
.de1 rstReportMargin
|
||||
\\$1 \\n[an-margin]
|
||||
level \\n[rst2man-indent-level]
|
||||
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
-
|
||||
\\n[rst2man-indent0]
|
||||
\\n[rst2man-indent1]
|
||||
\\n[rst2man-indent2]
|
||||
..
|
||||
.de1 INDENT
|
||||
.\" .rstReportMargin pre:
|
||||
. RS \\$1
|
||||
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
||||
. nr rst2man-indent-level +1
|
||||
.\" .rstReportMargin post:
|
||||
..
|
||||
.de UNINDENT
|
||||
. RE
|
||||
.\" indent \\n[an-margin]
|
||||
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.nr rst2man-indent-level -1
|
||||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||
..
|
||||
.TH "UNBOUND-HOST" "1" "@date@" "@version@" "Unbound"
|
||||
.SH NAME
|
||||
unbound-host \- Unbound @version@ DNS lookup utility.
|
||||
.SH SYNOPSIS
|
||||
.sp
|
||||
\fBunbound\-host\fP [\fB\-C configfile\fP] [\fB\-vdhr46D\fP] [\fB\-c class\fP]
|
||||
[\fB\-t type\fP] [\fB\-y key\fP] [\fB\-f keyfile\fP] [\fB\-F namedkeyfile\fP] hostname
|
||||
.SH DESCRIPTION
|
||||
.sp
|
||||
\fBunbound\-host\fP uses the Unbound validating resolver to query for the hostname
|
||||
and display results.
|
||||
With the \fI\%\-v\fP option it displays validation status: secure, insecure,
|
||||
bogus (security failure).
|
||||
.sp
|
||||
By default it reads no configuration file whatsoever.
|
||||
It attempts to reach the internet root servers.
|
||||
With \fI\%\-C\fP an unbound config file and with \fI\%\-r\fP \fBresolv.conf\fP
|
||||
can be read.
|
||||
.sp
|
||||
The available options are:
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.I hostname
|
||||
.B hostname
|
||||
This name is resolved (looked up in the DNS).
|
||||
If a IPv4 or IPv6 address is given, a reverse lookup is performed.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-h
|
||||
Show the version and commandline option help.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-v
|
||||
Enable verbose output and it shows validation results, on every line.
|
||||
Secure means that the NXDOMAIN (no such domain name), nodata (no such data)
|
||||
or positive data response validated correctly with one of the keys.
|
||||
Secure means that the NXDOMAIN (no such domain name), nodata (no such
|
||||
data) or positive data response validated correctly with one of the
|
||||
keys.
|
||||
Insecure means that that domain name has no security set up for it.
|
||||
Bogus (security failure) means that the response failed one or more checks,
|
||||
it is likely wrong, outdated, tampered with, or broken.
|
||||
Bogus (security failure) means that the response failed one or more
|
||||
checks, it is likely wrong, outdated, tampered with, or broken.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-d
|
||||
Enable debug output to stderr. One \-d shows what the resolver and validator
|
||||
are doing and may tell you what is going on. More times, \-d \-d, gives a
|
||||
lot of output, with every packet sent and received.
|
||||
Enable debug output to stderr.
|
||||
One \fI\%\-d\fP shows what the resolver and validator are doing and may
|
||||
tell you what is going on.
|
||||
More times, \fI\%\-d\fP \fI\%\-d\fP, gives a lot of output, with every
|
||||
packet sent and received.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-c \fIclass
|
||||
Specify the class to lookup for, the default is IN the internet class.
|
||||
.B \-c <class>
|
||||
Specify the class to lookup for, the default is IN the internet
|
||||
class.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-t \fItype
|
||||
Specify the type of data to lookup. The default looks for IPv4, IPv6 and
|
||||
mail handler data, or domain name pointers for reverse queries.
|
||||
.B \-t <type>
|
||||
Specify the type of data to lookup.
|
||||
The default looks for IPv4, IPv6 and mail handler data, or domain name
|
||||
pointers for reverse queries.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-y \fIkey
|
||||
Specify a public key to use as trust anchor. This is the base for a chain
|
||||
of trust that is built up from the trust anchor to the response, in order
|
||||
to validate the response message. Can be given as a DS or DNSKEY record.
|
||||
For example \-y "example.com DS 31560 5 1 1CFED84787E6E19CCF9372C1187325972FE546CD".
|
||||
.B \-y <key>
|
||||
Specify a public key to use as trust anchor.
|
||||
This is the base for a chain of trust that is built up from the trust
|
||||
anchor to the response, in order to validate the response message.
|
||||
Can be given as a DS or DNSKEY record.
|
||||
For example:
|
||||
.INDENT 7.0
|
||||
.INDENT 3.5
|
||||
.sp
|
||||
.nf
|
||||
.ft C
|
||||
\-y \(dqexample.com DS 31560 5 1 1CFED84787E6E19CCF9372C1187325972FE546CD\(dq
|
||||
.ft P
|
||||
.fi
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-D
|
||||
Enables DNSSEC validation. Reads the root anchor from the default configured
|
||||
root anchor at the default location, \fI@UNBOUND_ROOTKEY_FILE@\fR.
|
||||
Enables DNSSEC validation.
|
||||
Reads the root anchor from the default configured root anchor at the
|
||||
default location, \fB@UNBOUND_ROOTKEY_FILE@\fP\&.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-f \fIkeyfile
|
||||
Reads keys from a file. Every line has a DS or DNSKEY record, in the format
|
||||
as for \-y. The zone file format, the same as dig and drill produce.
|
||||
.B \-f <keyfile>
|
||||
Reads keys from a file.
|
||||
Every line has a DS or DNSKEY record, in the format as for \fI\%\-y\fP\&.
|
||||
The zone file format, the same as \fBdig\fP and \fBdrill\fP produce.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-F \fInamedkeyfile
|
||||
Reads keys from a BIND\-style named.conf file. Only the trusted\-key {}; entries
|
||||
are read.
|
||||
.B \-F <namedkeyfile>
|
||||
Reads keys from a BIND\-style \fBnamed.conf\fP file.
|
||||
Only the \fBtrusted\-key {};\fP entries are read.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-C \fIconfigfile
|
||||
Uses the specified unbound.conf to prime
|
||||
.IR libunbound (3).
|
||||
.B \-C <configfile>
|
||||
Uses the specified unbound.conf to prime \fI\%libunbound(3)\fP\&.
|
||||
Pass it as first argument if you want to override some options from the
|
||||
config file with further arguments on the commandline.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-r
|
||||
Read /etc/resolv.conf, and use the forward DNS servers from there (those could
|
||||
have been set by DHCP). More info in
|
||||
.IR resolv.conf (5).
|
||||
Read \fB/etc/resolv.conf\fP, and use the forward DNS servers from
|
||||
there (those could have been set by DHCP).
|
||||
More info in \fIresolv.conf(5)\fP\&.
|
||||
Breaks validation if those servers do not support DNSSEC.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-4
|
||||
Use solely the IPv4 network for sending packets.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-6
|
||||
Use solely the IPv6 network for sending packets.
|
||||
.SH "EXAMPLES"
|
||||
Some examples of use. The keys shown below are fakes, thus a security failure
|
||||
is encountered.
|
||||
.P
|
||||
.UNINDENT
|
||||
.SH EXAMPLES
|
||||
.sp
|
||||
Some examples of use.
|
||||
The keys shown below are fakes, thus a security failure is encountered.
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
.sp
|
||||
.nf
|
||||
.ft C
|
||||
$ unbound\-host www.example.com
|
||||
.P
|
||||
$ unbound\-host \-v \-y "example.com DS 31560 5 1 1CFED84787E6E19CCF9372C1187325972FE546CD" www.example.com
|
||||
.P
|
||||
$ unbound\-host \-v \-y "example.com DS 31560 5 1 1CFED84787E6E19CCF9372C1187325972FE546CD" 192.0.2.153
|
||||
.SH "EXIT CODE"
|
||||
The unbound\-host program exits with status code 1 on error,
|
||||
0 on no error. The data may not be available on exit code 0, exit code 1
|
||||
means the lookup encountered a fatal error.
|
||||
.SH "SEE ALSO"
|
||||
\fIunbound.conf\fR(5),
|
||||
\fIunbound\fR(8).
|
||||
|
||||
$ unbound\-host \-v \-y \(dqexample.com DS 31560 5 1 1CFED84787E6E19CCF9372C1187325972FE546CD\(dq www.example.com
|
||||
|
||||
$ unbound\-host \-v \-y \(dqexample.com DS 31560 5 1 1CFED84787E6E19CCF9372C1187325972FE546CD\(dq 192.0.2.153
|
||||
.ft P
|
||||
.fi
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.SH EXIT CODE
|
||||
.sp
|
||||
The \fBunbound\-host\fP program exits with status code 1 on error, 0 on no error.
|
||||
The data may not be available on exit code 0, exit code 1 means the lookup
|
||||
encountered a fatal error.
|
||||
.SH SEE ALSO
|
||||
.sp
|
||||
\fI\%unbound.conf(5)\fP,
|
||||
\fI\%unbound(8)\fP\&.
|
||||
.SH AUTHOR
|
||||
Unbound developers are mentioned in the CREDITS file in the distribution.
|
||||
.SH COPYRIGHT
|
||||
1999-2025, NLnet Labs
|
||||
.\" Generated by docutils manpage writer.
|
||||
.
|
||||
|
|
|
|||
176
doc/unbound-host.rst
Normal file
176
doc/unbound-host.rst
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
.. program:: unbound-host
|
||||
|
||||
unbound-host(1)
|
||||
===============
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
||||
**unbound-host** [``-C configfile``] [``-vdhr46D``] [``-c class``]
|
||||
[``-t type``] [``-y key``] [``-f keyfile``] [``-F namedkeyfile``] hostname
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``unbound-host`` uses the Unbound validating resolver to query for the hostname
|
||||
and display results.
|
||||
With the :option:`-v` option it displays validation status: secure, insecure,
|
||||
bogus (security failure).
|
||||
|
||||
By default it reads no configuration file whatsoever.
|
||||
It attempts to reach the internet root servers.
|
||||
With :option:`-C` an unbound config file and with :option:`-r` ``resolv.conf``
|
||||
can be read.
|
||||
|
||||
The available options are:
|
||||
|
||||
.. option:: hostname
|
||||
|
||||
This name is resolved (looked up in the DNS).
|
||||
If a IPv4 or IPv6 address is given, a reverse lookup is performed.
|
||||
|
||||
.. option:: -h
|
||||
|
||||
Show the version and commandline option help.
|
||||
|
||||
.. option:: -v
|
||||
|
||||
Enable verbose output and it shows validation results, on every line.
|
||||
Secure means that the NXDOMAIN (no such domain name), nodata (no such
|
||||
data) or positive data response validated correctly with one of the
|
||||
keys.
|
||||
Insecure means that that domain name has no security set up for it.
|
||||
Bogus (security failure) means that the response failed one or more
|
||||
checks, it is likely wrong, outdated, tampered with, or broken.
|
||||
|
||||
.. option:: -d
|
||||
|
||||
Enable debug output to stderr.
|
||||
One :option:`-d` shows what the resolver and validator are doing and may
|
||||
tell you what is going on.
|
||||
More times, :option:`-d` :option:`-d`, gives a lot of output, with every
|
||||
packet sent and received.
|
||||
|
||||
.. option:: -c <class>
|
||||
|
||||
Specify the class to lookup for, the default is IN the internet
|
||||
class.
|
||||
|
||||
.. option:: -t <type>
|
||||
|
||||
Specify the type of data to lookup.
|
||||
The default looks for IPv4, IPv6 and mail handler data, or domain name
|
||||
pointers for reverse queries.
|
||||
|
||||
.. option:: -y <key>
|
||||
|
||||
Specify a public key to use as trust anchor.
|
||||
This is the base for a chain of trust that is built up from the trust
|
||||
anchor to the response, in order to validate the response message.
|
||||
Can be given as a DS or DNSKEY record.
|
||||
For example:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
-y "example.com DS 31560 5 1 1CFED84787E6E19CCF9372C1187325972FE546CD"
|
||||
|
||||
.. option:: -D
|
||||
|
||||
Enables DNSSEC validation.
|
||||
Reads the root anchor from the default configured root anchor at the
|
||||
default location, :file:`@UNBOUND_ROOTKEY_FILE@`.
|
||||
|
||||
.. option:: -f <keyfile>
|
||||
|
||||
Reads keys from a file.
|
||||
Every line has a DS or DNSKEY record, in the format as for :option:`-y`.
|
||||
The zone file format, the same as ``dig`` and ``drill`` produce.
|
||||
|
||||
.. option:: -F <namedkeyfile>
|
||||
|
||||
Reads keys from a BIND-style :file:`named.conf` file.
|
||||
Only the ``trusted-key {};`` entries are read.
|
||||
|
||||
.. option:: -C <configfile>
|
||||
|
||||
Uses the specified unbound.conf to prime :doc:`libunbound(3)</manpages/libunbound>`.
|
||||
Pass it as first argument if you want to override some options from the
|
||||
config file with further arguments on the commandline.
|
||||
|
||||
.. option:: -r
|
||||
|
||||
Read :file:`/etc/resolv.conf`, and use the forward DNS servers from
|
||||
there (those could have been set by DHCP).
|
||||
More info in *resolv.conf(5)*.
|
||||
Breaks validation if those servers do not support DNSSEC.
|
||||
|
||||
.. option:: -4
|
||||
|
||||
Use solely the IPv4 network for sending packets.
|
||||
|
||||
.. option:: -6
|
||||
|
||||
Use solely the IPv6 network for sending packets.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Some examples of use.
|
||||
The keys shown below are fakes, thus a security failure is encountered.
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ unbound-host www.example.com
|
||||
|
||||
$ unbound-host -v -y "example.com DS 31560 5 1 1CFED84787E6E19CCF9372C1187325972FE546CD" www.example.com
|
||||
|
||||
$ unbound-host -v -y "example.com DS 31560 5 1 1CFED84787E6E19CCF9372C1187325972FE546CD" 192.0.2.153
|
||||
|
||||
Exit Code
|
||||
---------
|
||||
|
||||
The ``unbound-host`` program exits with status code 1 on error, 0 on no error.
|
||||
The data may not be available on exit code 0, exit code 1 means the lookup
|
||||
encountered a fatal error.
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
:doc:`unbound.conf(5)</manpages/unbound.conf>`,
|
||||
:doc:`unbound(8)</manpages/unbound>`.
|
||||
169
doc/unbound.8.in
169
doc/unbound.8.in
|
|
@ -1,88 +1,123 @@
|
|||
.TH "unbound" "8" "@date@" "NLnet Labs" "unbound @version@"
|
||||
.\"
|
||||
.\" unbound.8 -- unbound manual
|
||||
.\"
|
||||
.\" Copyright (c) 2007, NLnet Labs. All rights reserved.
|
||||
.\"
|
||||
.\" See LICENSE for the license.
|
||||
.\"
|
||||
.\"
|
||||
.SH "NAME"
|
||||
.B unbound
|
||||
\- Unbound DNS validating resolver @version@.
|
||||
.SH "SYNOPSIS"
|
||||
.B unbound
|
||||
.RB [ \-h ]
|
||||
.RB [ \-d ]
|
||||
.RB [ \-p ]
|
||||
.RB [ \-v ]
|
||||
.RB [ \-c
|
||||
.IR cfgfile ]
|
||||
.SH "DESCRIPTION"
|
||||
.B Unbound
|
||||
is a caching DNS resolver.
|
||||
.P
|
||||
It uses a built in list of authoritative nameservers for the root zone (.),
|
||||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.
|
||||
.nr rst2man-indent-level 0
|
||||
.
|
||||
.de1 rstReportMargin
|
||||
\\$1 \\n[an-margin]
|
||||
level \\n[rst2man-indent-level]
|
||||
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
-
|
||||
\\n[rst2man-indent0]
|
||||
\\n[rst2man-indent1]
|
||||
\\n[rst2man-indent2]
|
||||
..
|
||||
.de1 INDENT
|
||||
.\" .rstReportMargin pre:
|
||||
. RS \\$1
|
||||
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
||||
. nr rst2man-indent-level +1
|
||||
.\" .rstReportMargin post:
|
||||
..
|
||||
.de UNINDENT
|
||||
. RE
|
||||
.\" indent \\n[an-margin]
|
||||
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.nr rst2man-indent-level -1
|
||||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||
..
|
||||
.TH "UNBOUND" "8" "@date@" "@version@" "Unbound"
|
||||
.SH NAME
|
||||
unbound \- Unbound DNS validating resolver @version@.
|
||||
.SH SYNOPSIS
|
||||
.sp
|
||||
\fBunbound\fP [\fB\-hdpv\fP] [\fB\-c <cfgfile>\fP]
|
||||
.SH DESCRIPTION
|
||||
.sp
|
||||
\fBunbound\fP is a caching DNS resolver.
|
||||
.sp
|
||||
It uses a built in list of authoritative nameservers for the root zone (\fB\&.\fP),
|
||||
the so called root hints.
|
||||
On receiving a DNS query it will ask the root nameservers for
|
||||
an answer and will in almost all cases receive a delegation to a top level
|
||||
domain (TLD) authoritative nameserver.
|
||||
On receiving a DNS query it will ask the root nameservers for an answer and
|
||||
will in almost all cases receive a delegation to a top level domain (TLD)
|
||||
authoritative nameserver.
|
||||
It will then ask that nameserver for an answer.
|
||||
It will recursively continue until an answer is found or no answer is
|
||||
available (NXDOMAIN).
|
||||
For performance and efficiency reasons that answer is cached for a
|
||||
certain time (the answer's time\-to\-live or TTL).
|
||||
It will recursively continue until an answer is found or no answer is available
|
||||
(NXDOMAIN).
|
||||
For performance and efficiency reasons that answer is cached for a certain time
|
||||
(the answer\(aqs time\-to\-live or TTL).
|
||||
A second query for the same name will then be answered from the cache.
|
||||
Unbound can also do DNSSEC validation.
|
||||
.P
|
||||
To use a locally running
|
||||
.B Unbound
|
||||
for resolving put
|
||||
.sp
|
||||
.RS 6n
|
||||
To use a locally running Unbound for resolving put:
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
.sp
|
||||
.nf
|
||||
.ft C
|
||||
nameserver 127.0.0.1
|
||||
.RE
|
||||
.ft P
|
||||
.fi
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.sp
|
||||
into \fIresolv.conf(5)\fP\&.
|
||||
.sp
|
||||
If authoritative DNS is needed as well using \fI\%nsd(8)\fP,
|
||||
careful setup is required because authoritative nameservers and resolvers are
|
||||
using the same port number (53).
|
||||
.sp
|
||||
into
|
||||
.IR resolv.conf (5).
|
||||
.P
|
||||
If authoritative DNS is needed as well using
|
||||
.IR nsd (8),
|
||||
careful setup is required because authoritative nameservers and
|
||||
resolvers are using the same port number (53).
|
||||
.P
|
||||
The available options are:
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-h
|
||||
Show the version number and commandline option help, and exit.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-c\fI cfgfile
|
||||
Set the config file with settings for Unbound to read instead of reading the
|
||||
file at the default location, @ub_conf_file@. The syntax is
|
||||
described in \fIunbound.conf\fR(5).
|
||||
.B \-c <cfgfile>
|
||||
Set the config file with settings for unbound to read instead of reading the
|
||||
file at the default location, \fB@ub_conf_file@\fP\&.
|
||||
The syntax is described in \fI\%unbound.conf(5)\fP\&.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-d
|
||||
Debug flag: do not fork into the background, but stay attached to
|
||||
the console. This flag will also delay writing to the log file until
|
||||
the thread\-spawn time, so that most config and setup errors appear on
|
||||
stderr. If given twice or more, logging does not switch to the log file
|
||||
or to syslog, but the log messages are printed to stderr all the time.
|
||||
Debug flag: do not fork into the background, but stay attached to the
|
||||
console.
|
||||
This flag will also delay writing to the log file until the thread\-spawn
|
||||
time, so that most config and setup errors appear on stderr.
|
||||
If given twice or more, logging does not switch to the log file or to
|
||||
syslog, but the log messages are printed to stderr all the time.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-p
|
||||
Don't use a pidfile. This argument should only be used by supervision
|
||||
systems which can ensure that only one instance of Unbound will run
|
||||
concurrently.
|
||||
Don\(aqt use a pidfile.
|
||||
This argument should only be used by supervision systems which can ensure
|
||||
that only one instance of Unbound will run concurrently.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-v
|
||||
Increase verbosity. If given multiple times, more information is logged.
|
||||
This is added to the verbosity (if any) from the config file.
|
||||
Increase verbosity.
|
||||
If given multiple times, more information is logged.
|
||||
This is in addition to the verbosity (if any) from the config file.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-V
|
||||
Show the version number and build options, and exit.
|
||||
.SH "SEE ALSO"
|
||||
\fIunbound.conf\fR(5),
|
||||
\fIunbound\-checkconf\fR(8),
|
||||
\fInsd\fR(8).
|
||||
.SH "AUTHORS"
|
||||
.B Unbound
|
||||
developers are mentioned in the CREDITS file in the distribution.
|
||||
.UNINDENT
|
||||
.SH SEE ALSO
|
||||
.sp
|
||||
\fI\%unbound.conf(5)\fP,
|
||||
\fI\%unbound\-checkconf(8)\fP,
|
||||
\fI\%nsd(8)\fP\&.
|
||||
.SH AUTHOR
|
||||
Unbound developers are mentioned in the CREDITS file in the distribution.
|
||||
.SH COPYRIGHT
|
||||
1999-2025, NLnet Labs
|
||||
.\" Generated by docutils manpage writer.
|
||||
.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
4997
doc/unbound.conf.rst
Normal file
4997
doc/unbound.conf.rst
Normal file
File diff suppressed because it is too large
Load diff
119
doc/unbound.rst
Normal file
119
doc/unbound.rst
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
..
|
||||
WHEN EDITING MAKE SURE EACH SENTENCE STARTS ON A NEW LINE
|
||||
|
||||
..
|
||||
IT HELPS RENDERERS TO DO THE RIGHT THING WRT SPACE
|
||||
|
||||
..
|
||||
IT HELPS PEOPLE DIFFING THE CHANGES
|
||||
|
||||
.. program:: unbound
|
||||
|
||||
unbound(8)
|
||||
==========
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
||||
**unbound** [``-hdpv``] [``-c <cfgfile>``]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``unbound`` is a caching DNS resolver.
|
||||
|
||||
It uses a built in list of authoritative nameservers for the root zone (``.``),
|
||||
the so called root hints.
|
||||
On receiving a DNS query it will ask the root nameservers for an answer and
|
||||
will in almost all cases receive a delegation to a top level domain (TLD)
|
||||
authoritative nameserver.
|
||||
It will then ask that nameserver for an answer.
|
||||
It will recursively continue until an answer is found or no answer is available
|
||||
(NXDOMAIN).
|
||||
For performance and efficiency reasons that answer is cached for a certain time
|
||||
(the answer's time-to-live or TTL).
|
||||
A second query for the same name will then be answered from the cache.
|
||||
Unbound can also do DNSSEC validation.
|
||||
|
||||
To use a locally running Unbound for resolving put:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
nameserver 127.0.0.1
|
||||
|
||||
into *resolv.conf(5)*.
|
||||
|
||||
If authoritative DNS is needed as well using :external+nsd:doc:`manpages/nsd`,
|
||||
careful setup is required because authoritative nameservers and resolvers are
|
||||
using the same port number (53).
|
||||
|
||||
The available options are:
|
||||
|
||||
.. option:: -h
|
||||
|
||||
Show the version number and commandline option help, and exit.
|
||||
|
||||
.. option:: -c <cfgfile>
|
||||
|
||||
Set the config file with settings for unbound to read instead of reading the
|
||||
file at the default location, :file:`@ub_conf_file@`.
|
||||
The syntax is described in :doc:`unbound.conf(5)</manpages/unbound.conf>`.
|
||||
|
||||
.. option:: -d
|
||||
|
||||
Debug flag: do not fork into the background, but stay attached to the
|
||||
console.
|
||||
This flag will also delay writing to the log file until the thread-spawn
|
||||
time, so that most config and setup errors appear on stderr.
|
||||
If given twice or more, logging does not switch to the log file or to
|
||||
syslog, but the log messages are printed to stderr all the time.
|
||||
|
||||
.. option:: -p
|
||||
|
||||
Don't use a pidfile.
|
||||
This argument should only be used by supervision systems which can ensure
|
||||
that only one instance of Unbound will run concurrently.
|
||||
|
||||
.. option:: -v
|
||||
|
||||
Increase verbosity.
|
||||
If given multiple times, more information is logged.
|
||||
This is in addition to the verbosity (if any) from the config file.
|
||||
|
||||
.. option:: -V
|
||||
|
||||
Show the version number and build options, and exit.
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
:doc:`unbound.conf(5)</manpages/unbound.conf>`,
|
||||
:doc:`unbound-checkconf(8)</manpages/unbound-checkconf>`,
|
||||
:external+nsd:doc:`manpages/nsd`.
|
||||
|
|
@ -116,7 +116,7 @@ struct addredge {
|
|||
addrlen_t len;
|
||||
/** child node this edge is connected to */
|
||||
struct addrnode *node;
|
||||
/** Parent node this ege is connected to */
|
||||
/** Parent node this edge is connected to */
|
||||
struct addrnode *parent_node;
|
||||
/** Index of this edge in parent_node */
|
||||
int parent_index;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
#include "services/cache/dns.h"
|
||||
#include "util/module.h"
|
||||
#include "util/regional.h"
|
||||
#include "util/fptr_wlist.h"
|
||||
#include "util/storage/slabhash.h"
|
||||
#include "util/config_file.h"
|
||||
#include "util/data/msgreply.h"
|
||||
|
|
@ -155,7 +156,8 @@ int ecs_whitelist_check(struct query_info* qinfo,
|
|||
|
||||
/* Cache by default, might be disabled after parsing EDNS option
|
||||
* received from nameserver. */
|
||||
if(!iter_stub_fwd_no_cache(qstate, &qstate->qinfo, NULL, NULL, NULL, 0)) {
|
||||
if(!iter_stub_fwd_no_cache(qstate, &qstate->qinfo, NULL, NULL, NULL, 0)
|
||||
&& sq->ecs_client_in.subnet_validdata) {
|
||||
qstate->no_cache_store = 0;
|
||||
}
|
||||
|
||||
|
|
@ -232,13 +234,13 @@ subnetmod_init(struct module_env *env, int id)
|
|||
HASH_DEFAULT_STARTARRAY, env->cfg->msg_cache_size,
|
||||
msg_cache_sizefunc, query_info_compare, query_entry_delete,
|
||||
subnet_data_delete, NULL);
|
||||
slabhash_setmarkdel(sn_env->subnet_msg_cache, &subnet_markdel);
|
||||
if(!sn_env->subnet_msg_cache) {
|
||||
log_err("subnetcache: could not create cache");
|
||||
free(sn_env);
|
||||
env->modinfo[id] = NULL;
|
||||
return 0;
|
||||
}
|
||||
slabhash_setmarkdel(sn_env->subnet_msg_cache, &subnet_markdel);
|
||||
/* whitelist for edns subnet capable servers */
|
||||
sn_env->whitelist = ecs_whitelist_create();
|
||||
if(!sn_env->whitelist ||
|
||||
|
|
@ -522,6 +524,69 @@ common_prefix(uint8_t *a, uint8_t *b, uint8_t net)
|
|||
return !memcmp(a, b, n) && ((net % 8) == 0 || a[n] == b[n]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create sub request that looks up the query.
|
||||
* @param qstate: query state
|
||||
* @param sq: subnet qstate
|
||||
* @return false on failure.
|
||||
*/
|
||||
static int
|
||||
generate_sub_request(struct module_qstate *qstate, struct subnet_qstate* sq)
|
||||
{
|
||||
struct module_qstate* subq = NULL;
|
||||
uint16_t qflags = 0; /* OPCODE QUERY, no flags */
|
||||
int prime = 0;
|
||||
int valrec = 0;
|
||||
struct query_info qinf;
|
||||
qinf.qname = qstate->qinfo.qname;
|
||||
qinf.qname_len = qstate->qinfo.qname_len;
|
||||
qinf.qtype = qstate->qinfo.qtype;
|
||||
qinf.qclass = qstate->qinfo.qclass;
|
||||
qinf.local_alias = NULL;
|
||||
|
||||
qflags |= BIT_RD;
|
||||
if((qstate->query_flags & BIT_CD)!=0) {
|
||||
qflags |= BIT_CD;
|
||||
valrec = 1;
|
||||
}
|
||||
|
||||
fptr_ok(fptr_whitelist_modenv_attach_sub(qstate->env->attach_sub));
|
||||
if(!(*qstate->env->attach_sub)(qstate, &qinf, qflags, prime, valrec,
|
||||
&subq)) {
|
||||
return 0;
|
||||
}
|
||||
if(subq) {
|
||||
/* It is possible to access the subquery module state. */
|
||||
if(sq->ecs_client_in.subnet_source_mask == 0 &&
|
||||
edns_opt_list_find(qstate->edns_opts_front_in,
|
||||
qstate->env->cfg->client_subnet_opcode)) {
|
||||
subq->no_cache_store = 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the query without subnet
|
||||
* @param qstate: query state
|
||||
* @param sq: subnet qstate
|
||||
* @return module state
|
||||
*/
|
||||
static enum module_ext_state
|
||||
generate_lookup_without_subnet(struct module_qstate *qstate,
|
||||
struct subnet_qstate* sq)
|
||||
{
|
||||
verbose(VERB_ALGO, "subnetcache: make subquery to look up without subnet");
|
||||
if(!generate_sub_request(qstate, sq)) {
|
||||
verbose(VERB_ALGO, "Could not generate sub query");
|
||||
qstate->return_rcode = LDNS_RCODE_FORMERR;
|
||||
qstate->return_msg = NULL;
|
||||
return module_finished;
|
||||
}
|
||||
sq->wait_subquery = 1;
|
||||
return module_wait_subquery;
|
||||
}
|
||||
|
||||
static enum module_ext_state
|
||||
eval_response(struct module_qstate *qstate, int id, struct subnet_qstate *sq)
|
||||
{
|
||||
|
|
@ -557,14 +622,7 @@ eval_response(struct module_qstate *qstate, int id, struct subnet_qstate *sq)
|
|||
* is still useful to put it in the edns subnet cache for
|
||||
* when a client explicitly asks for subnet specific answer. */
|
||||
verbose(VERB_QUERY, "subnetcache: Authority indicates no support");
|
||||
if(!sq->started_no_cache_store) {
|
||||
lock_rw_wrlock(&sne->biglock);
|
||||
update_cache(qstate, id);
|
||||
lock_rw_unlock(&sne->biglock);
|
||||
}
|
||||
if (sq->subnet_downstream)
|
||||
cp_edns_bad_response(c_out, c_in);
|
||||
return module_finished;
|
||||
return generate_lookup_without_subnet(qstate, sq);
|
||||
}
|
||||
|
||||
/* Purposefully there was no sent subnet, and there is consequently
|
||||
|
|
@ -589,14 +647,14 @@ eval_response(struct module_qstate *qstate, int id, struct subnet_qstate *sq)
|
|||
!common_prefix(s_out->subnet_addr, s_in->subnet_addr,
|
||||
s_out->subnet_source_mask))
|
||||
{
|
||||
/* we can not accept, restart query without option */
|
||||
/* we can not accept, perform query without option */
|
||||
verbose(VERB_QUERY, "subnetcache: forged data");
|
||||
s_out->subnet_validdata = 0;
|
||||
(void)edns_opt_list_remove(&qstate->edns_opts_back_out,
|
||||
qstate->env->cfg->client_subnet_opcode);
|
||||
sq->subnet_sent = 0;
|
||||
sq->subnet_sent_no_subnet = 0;
|
||||
return module_restart_next;
|
||||
return generate_lookup_without_subnet(qstate, sq);
|
||||
}
|
||||
|
||||
lock_rw_wrlock(&sne->biglock);
|
||||
|
|
@ -795,6 +853,9 @@ ecs_edns_back_parsed(struct module_qstate* qstate, int id,
|
|||
} else if(sq->subnet_sent_no_subnet) {
|
||||
/* The answer can be stored as scope 0, not in global cache. */
|
||||
qstate->no_cache_store = 1;
|
||||
} else if(sq->subnet_sent) {
|
||||
/* Need another query to be able to store in global cache. */
|
||||
qstate->no_cache_store = 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
@ -812,6 +873,32 @@ subnetmod_operate(struct module_qstate *qstate, enum module_ev event,
|
|||
strmodulevent(event));
|
||||
log_query_info(VERB_QUERY, "subnetcache operate: query", &qstate->qinfo);
|
||||
|
||||
if(sq && sq->wait_subquery_done) {
|
||||
/* The subquery lookup returned. */
|
||||
if(sq->ecs_client_in.subnet_source_mask == 0 &&
|
||||
edns_opt_list_find(qstate->edns_opts_front_in,
|
||||
qstate->env->cfg->client_subnet_opcode)) {
|
||||
if(!sq->started_no_cache_store &&
|
||||
qstate->return_msg) {
|
||||
lock_rw_wrlock(&sne->biglock);
|
||||
update_cache(qstate, id);
|
||||
lock_rw_unlock(&sne->biglock);
|
||||
}
|
||||
if (sq->subnet_downstream)
|
||||
cp_edns_bad_response(&sq->ecs_client_out,
|
||||
&sq->ecs_client_in);
|
||||
/* It is a scope zero lookup, append edns subnet
|
||||
* option to the querier. */
|
||||
subnet_ecs_opt_list_append(&sq->ecs_client_out,
|
||||
&qstate->edns_opts_front_out, qstate,
|
||||
qstate->region);
|
||||
}
|
||||
sq->wait_subquery_done = 0;
|
||||
qstate->ext_state[id] = module_finished;
|
||||
qstate->no_cache_store = sq->started_no_cache_store;
|
||||
qstate->no_cache_lookup = sq->started_no_cache_lookup;
|
||||
return;
|
||||
}
|
||||
if((event == module_event_new || event == module_event_pass) &&
|
||||
sq == NULL) {
|
||||
struct edns_option* ecs_opt;
|
||||
|
|
@ -822,6 +909,8 @@ subnetmod_operate(struct module_qstate *qstate, enum module_ev event,
|
|||
}
|
||||
|
||||
sq = (struct subnet_qstate*)qstate->minfo[id];
|
||||
if(sq->wait_subquery)
|
||||
return; /* Wait for that subquery to return */
|
||||
|
||||
if((ecs_opt = edns_opt_list_find(
|
||||
qstate->edns_opts_front_in,
|
||||
|
|
@ -851,6 +940,14 @@ subnetmod_operate(struct module_qstate *qstate, enum module_ev event,
|
|||
/* No clients are interested in result or we could not
|
||||
* parse it, we don't do client subnet */
|
||||
sq->ecs_server_out.subnet_validdata = 0;
|
||||
if(edns_opt_list_find(qstate->edns_opts_front_in,
|
||||
qstate->env->cfg->client_subnet_opcode)) {
|
||||
/* aggregated this deaggregated state */
|
||||
qstate->ext_state[id] =
|
||||
generate_lookup_without_subnet(
|
||||
qstate, sq);
|
||||
return;
|
||||
}
|
||||
verbose(VERB_ALGO, "subnetcache: pass to next module");
|
||||
qstate->ext_state[id] = module_wait_module;
|
||||
return;
|
||||
|
|
@ -891,6 +988,14 @@ subnetmod_operate(struct module_qstate *qstate, enum module_ev event,
|
|||
}
|
||||
lock_rw_unlock(&sne->biglock);
|
||||
}
|
||||
if(sq->ecs_client_in.subnet_source_mask == 0 &&
|
||||
edns_opt_list_find(qstate->edns_opts_front_in,
|
||||
qstate->env->cfg->client_subnet_opcode)) {
|
||||
/* client asked for resolution without edns subnet */
|
||||
qstate->ext_state[id] = generate_lookup_without_subnet(
|
||||
qstate, sq);
|
||||
return;
|
||||
}
|
||||
|
||||
sq->ecs_server_out.subnet_addr_fam =
|
||||
sq->ecs_client_in.subnet_addr_fam;
|
||||
|
|
@ -927,6 +1032,8 @@ subnetmod_operate(struct module_qstate *qstate, enum module_ev event,
|
|||
qstate->ext_state[id] = module_wait_module;
|
||||
return;
|
||||
}
|
||||
if(sq && sq->wait_subquery)
|
||||
return; /* Wait for that subquery to return */
|
||||
/* Query handed back by next module, we have a 'final' answer */
|
||||
if(sq && event == module_event_moddone) {
|
||||
qstate->ext_state[id] = eval_response(qstate, id, sq);
|
||||
|
|
@ -975,10 +1082,27 @@ subnetmod_clear(struct module_qstate *ATTR_UNUSED(qstate),
|
|||
}
|
||||
|
||||
void
|
||||
subnetmod_inform_super(struct module_qstate *ATTR_UNUSED(qstate),
|
||||
int ATTR_UNUSED(id), struct module_qstate *ATTR_UNUSED(super))
|
||||
subnetmod_inform_super(struct module_qstate *qstate, int id,
|
||||
struct module_qstate *super)
|
||||
{
|
||||
/* Not used */
|
||||
struct subnet_qstate* super_sq =
|
||||
(struct subnet_qstate*)super->minfo[id];
|
||||
log_query_info(VERB_ALGO, "subnetcache inform_super: query",
|
||||
&super->qinfo);
|
||||
super_sq->wait_subquery = 0;
|
||||
super_sq->wait_subquery_done = 1;
|
||||
if(qstate->return_rcode != LDNS_RCODE_NOERROR ||
|
||||
!qstate->return_msg) {
|
||||
super->return_msg = NULL;
|
||||
super->return_rcode = LDNS_RCODE_SERVFAIL;
|
||||
return;
|
||||
}
|
||||
super->return_rcode = LDNS_RCODE_NOERROR;
|
||||
super->return_msg = dns_copy_msg(qstate->return_msg, super->region);
|
||||
if(!super->return_msg) {
|
||||
log_err("subnetcache: copy response, out of memory");
|
||||
super->return_rcode = LDNS_RCODE_SERVFAIL;
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
|
|||
|
|
@ -102,6 +102,10 @@ struct subnet_qstate {
|
|||
int started_no_cache_store;
|
||||
/** has the subnet module been started with no_cache_lookup? */
|
||||
int started_no_cache_lookup;
|
||||
/** Wait for subquery that has been started for nonsubnet lookup. */
|
||||
int wait_subquery;
|
||||
/** The subquery waited for is done. */
|
||||
int wait_subquery_done;
|
||||
};
|
||||
|
||||
void subnet_data_delete(void* d, void* ATTR_UNUSED(arg));
|
||||
|
|
|
|||
|
|
@ -79,6 +79,16 @@ struct delegpt {
|
|||
* Also true if the delegationpoint was created from a delegation
|
||||
* message and thus contains the parent-side-info already. */
|
||||
uint8_t has_parent_side_NS;
|
||||
/** if true, the delegation point has reached last resort processing
|
||||
* and the parent side information has been possibly added to the
|
||||
* delegation point.
|
||||
* For now this signals that further target lookups will ignore
|
||||
* the configured target-fetch-policy and only resolve on
|
||||
* demand to try and avoid triggering limits at this stage (.i.e, it
|
||||
* is very likely that the A/AAAA queries for the newly added name
|
||||
* servers will not yield new IP addresses and trigger NXNS
|
||||
* countermeasures. */
|
||||
uint8_t fallback_to_parent_side_NS;
|
||||
/** for assertions on type of delegpt */
|
||||
uint8_t dp_type_mlc;
|
||||
/** use SSL for upstream query */
|
||||
|
|
|
|||
|
|
@ -139,6 +139,17 @@ forwards_insert_data(struct iter_forwards* fwd, uint16_t c, uint8_t* nm,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static struct iter_forward_zone*
|
||||
fwd_zone_find(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
|
||||
{
|
||||
struct iter_forward_zone key;
|
||||
key.node.key = &key;
|
||||
key.dclass = c;
|
||||
key.name = nm;
|
||||
key.namelabs = dname_count_size_labels(nm, &key.namelen);
|
||||
return (struct iter_forward_zone*)rbtree_search(fwd->tree, &key);
|
||||
}
|
||||
|
||||
/** insert new info into forward structure given dp */
|
||||
static int
|
||||
forwards_insert(struct iter_forwards* fwd, uint16_t c, struct delegpt* dp)
|
||||
|
|
@ -321,6 +332,11 @@ make_stub_holes(struct iter_forwards* fwd, struct config_file* cfg)
|
|||
log_err("cannot parse stub name '%s'", s->name);
|
||||
return 0;
|
||||
}
|
||||
if(fwd_zone_find(fwd, LDNS_RR_CLASS_IN, dname) != NULL) {
|
||||
/* Already a forward zone there. */
|
||||
free(dname);
|
||||
continue;
|
||||
}
|
||||
if(!fwd_add_stub_hole(fwd, LDNS_RR_CLASS_IN, dname)) {
|
||||
free(dname);
|
||||
log_err("out of memory");
|
||||
|
|
@ -345,6 +361,11 @@ make_auth_holes(struct iter_forwards* fwd, struct config_file* cfg)
|
|||
log_err("cannot parse auth name '%s'", a->name);
|
||||
return 0;
|
||||
}
|
||||
if(fwd_zone_find(fwd, LDNS_RR_CLASS_IN, dname) != NULL) {
|
||||
/* Already a forward zone there. */
|
||||
free(dname);
|
||||
continue;
|
||||
}
|
||||
if(!fwd_add_stub_hole(fwd, LDNS_RR_CLASS_IN, dname)) {
|
||||
free(dname);
|
||||
log_err("out of memory");
|
||||
|
|
@ -537,17 +558,6 @@ forwards_get_mem(struct iter_forwards* fwd)
|
|||
return s;
|
||||
}
|
||||
|
||||
static struct iter_forward_zone*
|
||||
fwd_zone_find(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
|
||||
{
|
||||
struct iter_forward_zone key;
|
||||
key.node.key = &key;
|
||||
key.dclass = c;
|
||||
key.name = nm;
|
||||
key.namelabs = dname_count_size_labels(nm, &key.namelen);
|
||||
return (struct iter_forward_zone*)rbtree_search(fwd->tree, &key);
|
||||
}
|
||||
|
||||
int
|
||||
forwards_add_zone(struct iter_forwards* fwd, uint16_t c, struct delegpt* dp,
|
||||
int nolock)
|
||||
|
|
@ -624,3 +634,19 @@ forwards_delete_stub_hole(struct iter_forwards* fwd, uint16_t c,
|
|||
fwd_init_parents(fwd);
|
||||
if(!nolock) { lock_rw_unlock(&fwd->lock); }
|
||||
}
|
||||
|
||||
void
|
||||
forwards_swap_tree(struct iter_forwards* fwd, struct iter_forwards* data)
|
||||
{
|
||||
rbtree_type* oldtree = fwd->tree;
|
||||
if(oldtree) {
|
||||
lock_unprotect(&fwd->lock, oldtree);
|
||||
}
|
||||
if(data->tree) {
|
||||
lock_unprotect(&data->lock, data->tree);
|
||||
}
|
||||
fwd->tree = data->tree;
|
||||
data->tree = oldtree;
|
||||
lock_protect(&fwd->lock, fwd->tree, sizeof(*fwd->tree));
|
||||
lock_protect(&data->lock, data->tree, sizeof(*data->tree));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,4 +234,13 @@ int forwards_add_stub_hole(struct iter_forwards* fwd, uint16_t c,
|
|||
void forwards_delete_stub_hole(struct iter_forwards* fwd, uint16_t c,
|
||||
uint8_t* nm, int nolock);
|
||||
|
||||
/**
|
||||
* Swap internal tree with preallocated entries. Caller should manage
|
||||
* the locks.
|
||||
* @param fwd: the forward data structure.
|
||||
* @param data: the data structure used to take elements from. This contains
|
||||
* the old elements on return.
|
||||
*/
|
||||
void forwards_swap_tree(struct iter_forwards* fwd, struct iter_forwards* data);
|
||||
|
||||
#endif /* ITERATOR_ITER_FWD_H */
|
||||
|
|
|
|||
|
|
@ -611,3 +611,14 @@ hints_delete_stub(struct iter_hints* hints, uint16_t c, uint8_t* nm,
|
|||
name_tree_init_parents(&hints->tree);
|
||||
if(!nolock) { lock_rw_unlock(&hints->lock); }
|
||||
}
|
||||
|
||||
void
|
||||
hints_swap_tree(struct iter_hints* hints, struct iter_hints* data)
|
||||
{
|
||||
rbnode_type* oldroot = hints->tree.root;
|
||||
size_t oldcount = hints->tree.count;
|
||||
hints->tree.root = data->tree.root;
|
||||
hints->tree.count = data->tree.count;
|
||||
data->tree.root = oldroot;
|
||||
data->tree.count = oldcount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,4 +198,13 @@ int hints_add_stub(struct iter_hints* hints, uint16_t c, struct delegpt* dp,
|
|||
void hints_delete_stub(struct iter_hints* hints, uint16_t c,
|
||||
uint8_t* nm, int nolock);
|
||||
|
||||
/**
|
||||
* Swap internal tree with preallocated entries. Caller should manage
|
||||
* the locks.
|
||||
* @param hints: the hints data structure.
|
||||
* @param data: the data structure used to take elements from. This contains
|
||||
* the old elements on return.
|
||||
*/
|
||||
void hints_swap_tree(struct iter_hints* hints, struct iter_hints* data);
|
||||
|
||||
#endif /* ITERATOR_ITER_HINTS_H */
|
||||
|
|
|
|||
|
|
@ -77,41 +77,73 @@
|
|||
static const char DEFAULT_NAT64_PREFIX[] = "64:ff9b::/96";
|
||||
|
||||
/** fillup fetch policy array */
|
||||
static void
|
||||
fetch_fill(struct iter_env* ie, const char* str)
|
||||
static int
|
||||
fetch_fill(int* target_fetch_policy, int max_dependency_depth, const char* str)
|
||||
{
|
||||
char* s = (char*)str, *e;
|
||||
int i;
|
||||
for(i=0; i<ie->max_dependency_depth+1; i++) {
|
||||
ie->target_fetch_policy[i] = strtol(s, &e, 10);
|
||||
if(s == e)
|
||||
fatal_exit("cannot parse fetch policy number %s", s);
|
||||
for(i=0; i<max_dependency_depth+1; i++) {
|
||||
target_fetch_policy[i] = strtol(s, &e, 10);
|
||||
if(s == e) {
|
||||
log_err("cannot parse fetch policy number %s", s);
|
||||
return 0;
|
||||
}
|
||||
s = e;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Read config string that represents the target fetch policy */
|
||||
static int
|
||||
read_fetch_policy(struct iter_env* ie, const char* str)
|
||||
int
|
||||
read_fetch_policy(int** target_fetch_policy, int* max_dependency_depth,
|
||||
const char* str)
|
||||
{
|
||||
int count = cfg_count_numbers(str);
|
||||
if(count < 1) {
|
||||
log_err("Cannot parse target fetch policy: \"%s\"", str);
|
||||
return 0;
|
||||
}
|
||||
ie->max_dependency_depth = count - 1;
|
||||
ie->target_fetch_policy = (int*)calloc(
|
||||
(size_t)ie->max_dependency_depth+1, sizeof(int));
|
||||
if(!ie->target_fetch_policy) {
|
||||
*max_dependency_depth = count - 1;
|
||||
*target_fetch_policy = (int*)calloc(
|
||||
(size_t)(*max_dependency_depth)+1, sizeof(int));
|
||||
if(!*target_fetch_policy) {
|
||||
log_err("alloc fetch policy: out of memory");
|
||||
return 0;
|
||||
}
|
||||
fetch_fill(ie, str);
|
||||
if(!fetch_fill(*target_fetch_policy, *max_dependency_depth, str))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** apply config caps whitelist items to name tree */
|
||||
static int
|
||||
struct rbtree_type*
|
||||
caps_white_create(void)
|
||||
{
|
||||
struct rbtree_type* caps_white = rbtree_create(name_tree_compare);
|
||||
if(!caps_white)
|
||||
log_err("out of memory");
|
||||
return caps_white;
|
||||
}
|
||||
|
||||
/** delete caps_whitelist element */
|
||||
static void
|
||||
caps_free(struct rbnode_type* n, void* ATTR_UNUSED(d))
|
||||
{
|
||||
if(n) {
|
||||
free(((struct name_tree_node*)n)->name);
|
||||
free(n);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
caps_white_delete(struct rbtree_type* caps_white)
|
||||
{
|
||||
if(!caps_white)
|
||||
return;
|
||||
traverse_postorder(caps_white, caps_free, NULL);
|
||||
free(caps_white);
|
||||
}
|
||||
|
||||
int
|
||||
caps_white_apply_cfg(rbtree_type* ntree, struct config_file* cfg)
|
||||
{
|
||||
struct config_strlist* p;
|
||||
|
|
@ -145,12 +177,41 @@ caps_white_apply_cfg(rbtree_type* ntree, struct config_file* cfg)
|
|||
}
|
||||
|
||||
int
|
||||
iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
|
||||
nat64_apply_cfg(struct iter_nat64* nat64, struct config_file* cfg)
|
||||
{
|
||||
const char *nat64_prefix;
|
||||
|
||||
nat64_prefix = cfg->nat64_prefix;
|
||||
if(!nat64_prefix)
|
||||
nat64_prefix = cfg->dns64_prefix;
|
||||
if(!nat64_prefix)
|
||||
nat64_prefix = DEFAULT_NAT64_PREFIX;
|
||||
if(!netblockstrtoaddr(nat64_prefix, 0, &nat64->nat64_prefix_addr,
|
||||
&nat64->nat64_prefix_addrlen, &nat64->nat64_prefix_net)) {
|
||||
log_err("cannot parse nat64-prefix netblock: %s", nat64_prefix);
|
||||
return 0;
|
||||
}
|
||||
if(!addr_is_ip6(&nat64->nat64_prefix_addr,
|
||||
nat64->nat64_prefix_addrlen)) {
|
||||
log_err("nat64-prefix is not IPv6: %s", cfg->nat64_prefix);
|
||||
return 0;
|
||||
}
|
||||
if(!prefixnet_is_nat64(nat64->nat64_prefix_net)) {
|
||||
log_err("nat64-prefix length it not 32, 40, 48, 56, 64 or 96: %s",
|
||||
nat64_prefix);
|
||||
return 0;
|
||||
}
|
||||
nat64->use_nat64 = cfg->do_nat64;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
|
||||
{
|
||||
int i;
|
||||
/* target fetch policy */
|
||||
if(!read_fetch_policy(iter_env, cfg->target_fetch_policy))
|
||||
if(!read_fetch_policy(&iter_env->target_fetch_policy,
|
||||
&iter_env->max_dependency_depth, cfg->target_fetch_policy))
|
||||
return 0;
|
||||
for(i=0; i<iter_env->max_dependency_depth+1; i++)
|
||||
verbose(VERB_QUERY, "target fetch policy for level %d is %d",
|
||||
|
|
@ -170,7 +231,7 @@ iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
|
|||
}
|
||||
if(cfg->caps_whitelist) {
|
||||
if(!iter_env->caps_white)
|
||||
iter_env->caps_white = rbtree_create(name_tree_compare);
|
||||
iter_env->caps_white = caps_white_create();
|
||||
if(!iter_env->caps_white || !caps_white_apply_cfg(
|
||||
iter_env->caps_white, cfg)) {
|
||||
log_err("Could not set capsforid whitelist");
|
||||
|
|
@ -179,31 +240,13 @@ iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
|
|||
|
||||
}
|
||||
|
||||
nat64_prefix = cfg->nat64_prefix;
|
||||
if(!nat64_prefix)
|
||||
nat64_prefix = cfg->dns64_prefix;
|
||||
if(!nat64_prefix)
|
||||
nat64_prefix = DEFAULT_NAT64_PREFIX;
|
||||
if(!netblockstrtoaddr(nat64_prefix, 0, &iter_env->nat64_prefix_addr,
|
||||
&iter_env->nat64_prefix_addrlen,
|
||||
&iter_env->nat64_prefix_net)) {
|
||||
log_err("cannot parse nat64-prefix netblock: %s", nat64_prefix);
|
||||
return 0;
|
||||
}
|
||||
if(!addr_is_ip6(&iter_env->nat64_prefix_addr,
|
||||
iter_env->nat64_prefix_addrlen)) {
|
||||
log_err("nat64-prefix is not IPv6: %s", cfg->nat64_prefix);
|
||||
return 0;
|
||||
}
|
||||
if(!prefixnet_is_nat64(iter_env->nat64_prefix_net)) {
|
||||
log_err("nat64-prefix length it not 32, 40, 48, 56, 64 or 96: %s",
|
||||
nat64_prefix);
|
||||
if(!nat64_apply_cfg(&iter_env->nat64, cfg)) {
|
||||
log_err("Could not setup nat64");
|
||||
return 0;
|
||||
}
|
||||
|
||||
iter_env->supports_ipv6 = cfg->do_ip6;
|
||||
iter_env->supports_ipv4 = cfg->do_ip4;
|
||||
iter_env->use_nat64 = cfg->do_nat64;
|
||||
iter_env->outbound_msg_retry = cfg->outbound_msg_retry;
|
||||
iter_env->max_sent_count = cfg->max_sent_count;
|
||||
iter_env->max_query_restarts = cfg->max_query_restarts;
|
||||
|
|
@ -270,7 +313,7 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
|
|||
if(!iter_env->supports_ipv6 && addr_is_ip6(&a->addr, a->addrlen)) {
|
||||
return -1; /* there is no ip6 available */
|
||||
}
|
||||
if(!iter_env->supports_ipv4 && !iter_env->use_nat64 &&
|
||||
if(!iter_env->supports_ipv4 && !iter_env->nat64.use_nat64 &&
|
||||
!addr_is_ip6(&a->addr, a->addrlen)) {
|
||||
return -1; /* there is no ip4 available */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ struct sock_list;
|
|||
struct ub_packed_rrset_key;
|
||||
struct module_stack;
|
||||
struct outside_network;
|
||||
struct iter_nat64;
|
||||
|
||||
/* max number of lookups in the cache for target nameserver names.
|
||||
* This stops, for large delegations, N*N lookups in the cache. */
|
||||
|
|
@ -430,6 +431,43 @@ int iter_stub_fwd_no_cache(struct module_qstate *qstate,
|
|||
void iterator_set_ip46_support(struct module_stack* mods,
|
||||
struct module_env* env, struct outside_network* outnet);
|
||||
|
||||
/**
|
||||
* Read config string that represents the target fetch policy.
|
||||
* @param target_fetch_policy: alloced on return.
|
||||
* @param max_dependency_depth: set on return.
|
||||
* @param str: the config string
|
||||
* @return false on failure.
|
||||
*/
|
||||
int read_fetch_policy(int** target_fetch_policy, int* max_dependency_depth,
|
||||
const char* str);
|
||||
|
||||
/**
|
||||
* Create caps exempt data structure.
|
||||
* @return NULL on failure.
|
||||
*/
|
||||
struct rbtree_type* caps_white_create(void);
|
||||
|
||||
/**
|
||||
* Delete caps exempt data structure.
|
||||
* @param caps_white: caps exempt tree.
|
||||
*/
|
||||
void caps_white_delete(struct rbtree_type* caps_white);
|
||||
|
||||
/**
|
||||
* Apply config caps whitelist items to name tree
|
||||
* @param ntree: caps exempt tree.
|
||||
* @param cfg: config with options.
|
||||
*/
|
||||
int caps_white_apply_cfg(struct rbtree_type* ntree, struct config_file* cfg);
|
||||
|
||||
/**
|
||||
* Apply config for nat64
|
||||
* @param nat64: the nat64 state.
|
||||
* @param cfg: config with options.
|
||||
* @return false on failure.
|
||||
*/
|
||||
int nat64_apply_cfg(struct iter_nat64* nat64, struct config_file* cfg);
|
||||
|
||||
/**
|
||||
* Limit NSEC and NSEC3 TTL in response, RFC9077
|
||||
* @param msg: dns message, the SOA record ttl is used to restrict ttls
|
||||
|
|
|
|||
|
|
@ -107,16 +107,6 @@ iter_init(struct module_env* env, int id)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/** delete caps_whitelist element */
|
||||
static void
|
||||
caps_free(struct rbnode_type* n, void* ATTR_UNUSED(d))
|
||||
{
|
||||
if(n) {
|
||||
free(((struct name_tree_node*)n)->name);
|
||||
free(n);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
iter_deinit(struct module_env* env, int id)
|
||||
{
|
||||
|
|
@ -128,10 +118,7 @@ iter_deinit(struct module_env* env, int id)
|
|||
free(iter_env->target_fetch_policy);
|
||||
priv_delete(iter_env->priv);
|
||||
donotq_delete(iter_env->donotq);
|
||||
if(iter_env->caps_white) {
|
||||
traverse_postorder(iter_env->caps_white, caps_free, NULL);
|
||||
free(iter_env->caps_white);
|
||||
}
|
||||
caps_white_delete(iter_env->caps_white);
|
||||
free(iter_env);
|
||||
env->modinfo[id] = NULL;
|
||||
}
|
||||
|
|
@ -260,7 +247,7 @@ error_supers(struct module_qstate* qstate, int id, struct module_qstate* super)
|
|||
log_err("out of memory adding missing");
|
||||
}
|
||||
delegpt_mark_neg(dpns, qstate->qinfo.qtype);
|
||||
if((dpns->got4 == 2 || (!ie->supports_ipv4 && !ie->use_nat64)) &&
|
||||
if((dpns->got4 == 2 || (!ie->supports_ipv4 && !ie->nat64.use_nat64)) &&
|
||||
(dpns->got6 == 2 || !ie->supports_ipv6)) {
|
||||
dpns->resolved = 1; /* mark as failed */
|
||||
target_count_increase_nx(super_iq, 1);
|
||||
|
|
@ -1725,7 +1712,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
*/
|
||||
if(iter_dp_is_useless(&qstate->qinfo, qstate->query_flags,
|
||||
iq->dp, ie->supports_ipv4, ie->supports_ipv6,
|
||||
ie->use_nat64)) {
|
||||
ie->nat64.use_nat64)) {
|
||||
int have_dp = 0;
|
||||
if(!can_have_last_resort(qstate->env, iq->dp->name, iq->dp->namelen, iq->qchase.qclass, &have_dp, &iq->dp, qstate->region)) {
|
||||
if(have_dp) {
|
||||
|
|
@ -2089,7 +2076,7 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
if(mesh_jostle_exceeded(qstate->env->mesh)) {
|
||||
/* If no ip4 query is possible, that makes
|
||||
* this ns resolved. */
|
||||
if(!((ie->supports_ipv4 || ie->use_nat64) &&
|
||||
if(!((ie->supports_ipv4 || ie->nat64.use_nat64) &&
|
||||
((ns->lame && !ns->done_pside4) ||
|
||||
(!ns->lame && !ns->got4)))) {
|
||||
ns->resolved = 1;
|
||||
|
|
@ -2098,7 +2085,7 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
}
|
||||
}
|
||||
/* Send the A request. */
|
||||
if((ie->supports_ipv4 || ie->use_nat64) &&
|
||||
if((ie->supports_ipv4 || ie->nat64.use_nat64) &&
|
||||
((ns->lame && !ns->done_pside4) ||
|
||||
(!ns->lame && !ns->got4))) {
|
||||
if(!generate_target_query(qstate, iq, id,
|
||||
|
|
@ -2165,6 +2152,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
verbose(VERB_QUERY, "configured stub or forward servers failed -- returning SERVFAIL");
|
||||
return error_response_cache(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
iq->dp->fallback_to_parent_side_NS = 1;
|
||||
if(qstate->env->cfg->harden_unverified_glue) {
|
||||
if(!cache_fill_missing(qstate->env, iq->qchase.qclass,
|
||||
qstate->region, iq->dp, PACKED_RRSET_UNVERIFIED_GLUE))
|
||||
|
|
@ -2193,6 +2181,10 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
a->lame, a->tls_auth_name, -1, NULL);
|
||||
}
|
||||
lock_rw_unlock(&qstate->env->hints->lock);
|
||||
/* copy over some configuration since we update the
|
||||
* delegation point in place */
|
||||
iq->dp->tcp_upstream = dp->tcp_upstream;
|
||||
iq->dp->ssl_upstream = dp->ssl_upstream;
|
||||
}
|
||||
iq->dp->has_parent_side_NS = 1;
|
||||
} else if(!iq->dp->has_parent_side_NS) {
|
||||
|
|
@ -2270,14 +2262,14 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
/* if this nameserver is at a delegation point, but that
|
||||
* delegation point is a stub and we cannot go higher, skip*/
|
||||
if( ((ie->supports_ipv6 && !ns->done_pside6) ||
|
||||
((ie->supports_ipv4 || ie->use_nat64) && !ns->done_pside4)) &&
|
||||
((ie->supports_ipv4 || ie->nat64.use_nat64) && !ns->done_pside4)) &&
|
||||
!can_have_last_resort(qstate->env, ns->name, ns->namelen,
|
||||
iq->qchase.qclass, NULL, NULL, NULL)) {
|
||||
log_nametypeclass(VERB_ALGO, "cannot pside lookup ns "
|
||||
"because it is also a stub/forward,",
|
||||
ns->name, LDNS_RR_TYPE_NS, iq->qchase.qclass);
|
||||
if(ie->supports_ipv6) ns->done_pside6 = 1;
|
||||
if(ie->supports_ipv4 || ie->use_nat64) ns->done_pside4 = 1;
|
||||
if(ie->supports_ipv4 || ie->nat64.use_nat64) ns->done_pside4 = 1;
|
||||
continue;
|
||||
}
|
||||
/* query for parent-side A and AAAA for nameservers */
|
||||
|
|
@ -2302,7 +2294,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
if((ie->supports_ipv4 || ie->use_nat64) && !ns->done_pside4) {
|
||||
if((ie->supports_ipv4 || ie->nat64.use_nat64) && !ns->done_pside4) {
|
||||
/* Send the A request. */
|
||||
if(!generate_parentside_target_query(qstate, iq, id,
|
||||
ns->name, ns->namelen,
|
||||
|
|
@ -2571,7 +2563,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
}
|
||||
if(!ie->supports_ipv6)
|
||||
delegpt_no_ipv6(iq->dp);
|
||||
if(!ie->supports_ipv4 && !ie->use_nat64)
|
||||
if(!ie->supports_ipv4 && !ie->nat64.use_nat64)
|
||||
delegpt_no_ipv4(iq->dp);
|
||||
delegpt_log(VERB_ALGO, iq->dp);
|
||||
|
||||
|
|
@ -2781,7 +2773,8 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
}
|
||||
/* if the mesh query list is full, then do not waste cpu and sockets to
|
||||
* fetch promiscuous targets. They can be looked up when needed. */
|
||||
if(can_do_promisc && !mesh_jostle_exceeded(qstate->env->mesh)) {
|
||||
if(!iq->dp->fallback_to_parent_side_NS && can_do_promisc
|
||||
&& !mesh_jostle_exceeded(qstate->env->mesh)) {
|
||||
tf_policy = ie->target_fetch_policy[iq->depth];
|
||||
}
|
||||
|
||||
|
|
@ -3070,9 +3063,9 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
real_addr = target->addr;
|
||||
real_addrlen = target->addrlen;
|
||||
|
||||
if(ie->use_nat64 && target->addr.ss_family == AF_INET) {
|
||||
addr_to_nat64(&target->addr, &ie->nat64_prefix_addr,
|
||||
ie->nat64_prefix_addrlen, ie->nat64_prefix_net,
|
||||
if(ie->nat64.use_nat64 && target->addr.ss_family == AF_INET) {
|
||||
addr_to_nat64(&target->addr, &ie->nat64.nat64_prefix_addr,
|
||||
ie->nat64.nat64_prefix_addrlen, ie->nat64.nat64_prefix_net,
|
||||
&real_addr, &real_addrlen);
|
||||
log_name_addr(VERB_QUERY, "applied NAT64:",
|
||||
iq->dp->name, &real_addr, real_addrlen);
|
||||
|
|
@ -3260,13 +3253,19 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
}
|
||||
}
|
||||
if(type == RESPONSE_TYPE_CNAME &&
|
||||
iq->qchase.qtype == LDNS_RR_TYPE_CNAME &&
|
||||
(iq->qchase.qtype == LDNS_RR_TYPE_CNAME ||
|
||||
iq->qchase.qtype == LDNS_RR_TYPE_ANY) &&
|
||||
iq->minimisation_state == MINIMISE_STATE &&
|
||||
query_dname_compare(iq->qchase.qname, iq->qinfo_out.qname) == 0) {
|
||||
/* The minimised query for full QTYPE and hidden QTYPE can be
|
||||
* classified as CNAME response type, even when the original
|
||||
* QTYPE=CNAME. This should be treated as answer response type.
|
||||
*/
|
||||
/* For QTYPE=ANY, it is also considered the response, that
|
||||
* is what the classifier would say, if it saw qtype ANY,
|
||||
* and this same response was returned for that. The response
|
||||
* can already be treated as such an answer, without having
|
||||
* to send another query with a new qtype. */
|
||||
type = RESPONSE_TYPE_ANSWER;
|
||||
}
|
||||
|
||||
|
|
@ -3523,6 +3522,15 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
iq->num_target_queries = 0;
|
||||
return processDSNSFind(qstate, iq, id);
|
||||
}
|
||||
if(iq->minimisation_state == MINIMISE_STATE &&
|
||||
query_dname_compare(iq->qchase.qname,
|
||||
iq->qinfo_out.qname) != 0) {
|
||||
verbose(VERB_ALGO, "continue query minimisation, "
|
||||
"downwards, after CNAME response for "
|
||||
"intermediate label");
|
||||
/* continue query minimisation, downwards */
|
||||
return next_state(iq, QUERYTARGETS_STATE);
|
||||
}
|
||||
/* Process the CNAME response. */
|
||||
if(!handle_cname_response(qstate, iq, iq->response,
|
||||
&sname, &snamelen)) {
|
||||
|
|
@ -3585,10 +3593,7 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
iq->auth_zone_response = 0;
|
||||
iq->sent_count = 0;
|
||||
iq->dp_target_count = 0;
|
||||
if(iq->minimisation_state != MINIMISE_STATE)
|
||||
/* Only count as query restart when it is not an extra
|
||||
* query as result of qname minimisation. */
|
||||
iq->query_restart_count++;
|
||||
iq->query_restart_count++;
|
||||
if(qstate->env->cfg->qname_minimisation)
|
||||
iq->minimisation_state = INIT_MINIMISE_STATE;
|
||||
|
||||
|
|
@ -3882,7 +3887,7 @@ processTargetResponse(struct module_qstate* qstate, int id,
|
|||
} else {
|
||||
verbose(VERB_ALGO, "iterator TargetResponse failed");
|
||||
delegpt_mark_neg(dpns, qstate->qinfo.qtype);
|
||||
if((dpns->got4 == 2 || (!ie->supports_ipv4 && !ie->use_nat64)) &&
|
||||
if((dpns->got4 == 2 || (!ie->supports_ipv4 && !ie->nat64.use_nat64)) &&
|
||||
(dpns->got6 == 2 || !ie->supports_ipv6)) {
|
||||
dpns->resolved = 1; /* fail the target */
|
||||
/* do not count cached answers */
|
||||
|
|
@ -4160,7 +4165,7 @@ processFinished(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
/* store message with the finished prepended items,
|
||||
* but only if we did recursion. The nonrecursion referral
|
||||
* from cache does not need to be stored in the msg cache. */
|
||||
if(!qstate->no_cache_store && qstate->query_flags&BIT_RD) {
|
||||
if(!qstate->no_cache_store && (qstate->query_flags&BIT_RD)) {
|
||||
iter_dns_store(qstate->env, &qstate->qinfo,
|
||||
iq->response->rep, 0, qstate->prefetch_leeway,
|
||||
iq->dp&&iq->dp->has_parent_side_NS,
|
||||
|
|
@ -4345,6 +4350,7 @@ process_response(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
}
|
||||
|
||||
/* Copy the edns options we may got from the back end */
|
||||
qstate->edns_opts_back_in = NULL;
|
||||
if(edns.opt_list_in) {
|
||||
qstate->edns_opts_back_in = edns_opt_copy_region(edns.opt_list_in,
|
||||
qstate->region);
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@
|
|||
#include "util/data/msgreply.h"
|
||||
#include "util/module.h"
|
||||
struct delegpt;
|
||||
struct iter_hints;
|
||||
struct iter_forwards;
|
||||
struct iter_donotq;
|
||||
struct iter_prep_list;
|
||||
struct iter_priv;
|
||||
|
|
@ -108,15 +106,9 @@ extern int BLACKLIST_PENALTY;
|
|||
#define EMPTY_NODATA_RETRY_COUNT 2
|
||||
|
||||
/**
|
||||
* Global state for the iterator.
|
||||
* Iterator global state for nat64.
|
||||
*/
|
||||
struct iter_env {
|
||||
/** A flag to indicate whether or not we have an IPv6 route */
|
||||
int supports_ipv6;
|
||||
|
||||
/** A flag to indicate whether or not we have an IPv4 route */
|
||||
int supports_ipv4;
|
||||
|
||||
struct iter_nat64 {
|
||||
/** A flag to locally apply NAT64 to make IPv4 addrs into IPv6 */
|
||||
int use_nat64;
|
||||
|
||||
|
|
@ -128,6 +120,20 @@ struct iter_env {
|
|||
|
||||
/** CIDR mask length of NAT64 prefix */
|
||||
int nat64_prefix_net;
|
||||
};
|
||||
|
||||
/**
|
||||
* Global state for the iterator.
|
||||
*/
|
||||
struct iter_env {
|
||||
/** A flag to indicate whether or not we have an IPv6 route */
|
||||
int supports_ipv6;
|
||||
|
||||
/** A flag to indicate whether or not we have an IPv4 route */
|
||||
int supports_ipv4;
|
||||
|
||||
/** State for nat64 */
|
||||
struct iter_nat64 nat64;
|
||||
|
||||
/** A set of inetaddrs that should never be queried. */
|
||||
struct iter_donotq* donotq;
|
||||
|
|
|
|||
|
|
@ -630,8 +630,9 @@ int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q)
|
|||
free(qinfo.qname);
|
||||
return UB_NOERROR;
|
||||
}
|
||||
if(ctx->env->auth_zones && auth_zones_answer(ctx->env->auth_zones,
|
||||
w->env, &qinfo, &edns, NULL, w->back->udp_buff, w->env->scratch)) {
|
||||
if(ctx->env->auth_zones && auth_zones_downstream_answer(
|
||||
ctx->env->auth_zones, w->env, &qinfo, &edns, NULL,
|
||||
w->back->udp_buff, w->env->scratch)) {
|
||||
regional_free_all(w->env->scratch);
|
||||
libworker_fillup_fg(q, LDNS_RCODE_NOERROR,
|
||||
w->back->udp_buff, sec_status_insecure, NULL, 0);
|
||||
|
|
@ -709,8 +710,9 @@ int libworker_attach_mesh(struct ub_ctx* ctx, struct ctx_query* q,
|
|||
w->back->udp_buff, sec_status_insecure, NULL, 0);
|
||||
return UB_NOERROR;
|
||||
}
|
||||
if(ctx->env->auth_zones && auth_zones_answer(ctx->env->auth_zones,
|
||||
w->env, &qinfo, &edns, NULL, w->back->udp_buff, w->env->scratch)) {
|
||||
if(ctx->env->auth_zones && auth_zones_downstream_answer(
|
||||
ctx->env->auth_zones, w->env, &qinfo, &edns, NULL,
|
||||
w->back->udp_buff, w->env->scratch)) {
|
||||
regional_free_all(w->env->scratch);
|
||||
free(qinfo.qname);
|
||||
libworker_event_done_cb(q, LDNS_RCODE_NOERROR,
|
||||
|
|
@ -847,8 +849,9 @@ handle_newq(struct libworker* w, uint8_t* buf, uint32_t len)
|
|||
free(qinfo.qname);
|
||||
return;
|
||||
}
|
||||
if(w->ctx->env->auth_zones && auth_zones_answer(w->ctx->env->auth_zones,
|
||||
w->env, &qinfo, &edns, NULL, w->back->udp_buff, w->env->scratch)) {
|
||||
if(w->ctx->env->auth_zones && auth_zones_downstream_answer(
|
||||
w->ctx->env->auth_zones, w->env, &qinfo, &edns, NULL,
|
||||
w->back->udp_buff, w->env->scratch)) {
|
||||
regional_free_all(w->env->scratch);
|
||||
q->msg_security = sec_status_insecure;
|
||||
add_bg_result(w, q, w->back->udp_buff, UB_NOERROR, NULL, 0);
|
||||
|
|
@ -1059,6 +1062,20 @@ void dtio_mainfdcallback(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
|
|||
}
|
||||
#endif
|
||||
|
||||
void fast_reload_service_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
|
||||
void* ATTR_UNUSED(arg))
|
||||
{
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
int fast_reload_client_callback(struct comm_point* ATTR_UNUSED(c),
|
||||
void* ATTR_UNUSED(arg), int ATTR_UNUSED(error),
|
||||
struct comm_reply* ATTR_UNUSED(repinfo))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NGTCP2
|
||||
void doq_client_event_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
|
||||
void* ATTR_UNUSED(arg))
|
||||
|
|
|
|||
|
|
@ -772,6 +772,8 @@ struct ub_server_stats {
|
|||
long long ans_bogus;
|
||||
/** rrsets marked bogus by validator */
|
||||
long long rrset_bogus;
|
||||
/** number of signature validation operations performed by validator */
|
||||
long long val_ops;
|
||||
/** number of queries that have been ratelimited by domain recursion. */
|
||||
long long queries_ratelimited;
|
||||
/** unwanted traffic received on server-facing ports */
|
||||
|
|
@ -853,6 +855,8 @@ struct ub_server_stats {
|
|||
long long num_queries_discard_timeout;
|
||||
/** number of queries removed due to wait-limit */
|
||||
long long num_queries_wait_limit;
|
||||
/** number of dns error reports generated */
|
||||
long long num_dns_error_reports;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ Generate a distribution tar file for unbound.
|
|||
-wxp expat.xx.tar.gz Also build expat from tarball for windows dist.
|
||||
-wdir directory Build openssl and expat in a persistent directory for
|
||||
windows dist. If builds are already in that directory
|
||||
they are used right away. Useful when debuggin windows
|
||||
they are used right away. Useful when debugging windows
|
||||
builds.
|
||||
-w32 32bit windows compile.
|
||||
-w ... Build windows binary dist. last args passed to configure.
|
||||
|
|
@ -539,6 +539,12 @@ if [ "$DOWIN" = "yes" ]; then
|
|||
if test -f "$sspdll"; then
|
||||
cp "$sspdll" libunbound/.
|
||||
fi
|
||||
if test "$W64" = "no"; then
|
||||
# This could be solved with -static -static-libgcc -static-libstdc++.
|
||||
# The dependency on c++ is probably due to libexpat. But the copy
|
||||
# of the dll should work too. It may be needed for the libunbound.dll.
|
||||
cp /usr/i686-w64-mingw32/sys-root/mingw/bin/libgcc_s_dw2-1.dll libunbound/.
|
||||
fi
|
||||
# zipfile
|
||||
zip -r ../$file LICENSE README.txt unbound.exe unbound-anchor.exe unbound-host.exe unbound-control.exe unbound-checkconf.exe unbound-service-install.exe unbound-service-remove.exe unbound-control-setup.cmd example.conf service.conf root.key unbound-website.url create_unbound_ad_servers.cmd warmup.cmd unbound_cache.cmd Changelog libunbound
|
||||
info "Testing $file"
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ respip_sockaddr_find_or_create(struct respip_set* set, struct sockaddr_storage*
|
|||
socklen_t addrlen, int net, int create, const char* ipstr)
|
||||
{
|
||||
struct resp_addr* node;
|
||||
log_assert(set);
|
||||
node = (struct resp_addr*)addr_tree_find(&set->ip_tree, addr, addrlen, net);
|
||||
if(!node && create) {
|
||||
node = regional_alloc_zero(set->region, sizeof(*node));
|
||||
|
|
@ -128,6 +129,7 @@ void
|
|||
respip_sockaddr_delete(struct respip_set* set, struct resp_addr* node)
|
||||
{
|
||||
struct resp_addr* prev;
|
||||
log_assert(set);
|
||||
prev = (struct resp_addr*)rbtree_previous((struct rbnode_type*)node);
|
||||
lock_rw_destroy(&node->lock);
|
||||
(void)rbtree_delete(&set->ip_tree, node);
|
||||
|
|
@ -146,6 +148,7 @@ respip_find_or_create(struct respip_set* set, const char* ipstr, int create)
|
|||
struct sockaddr_storage addr;
|
||||
int net;
|
||||
socklen_t addrlen;
|
||||
log_assert(set);
|
||||
|
||||
if(!netblockstrtoaddr(ipstr, 0, &addr, &addrlen, &net)) {
|
||||
log_err("cannot parse netblock: '%s'", ipstr);
|
||||
|
|
@ -160,6 +163,7 @@ respip_tag_cfg(struct respip_set* set, const char* ipstr,
|
|||
const uint8_t* taglist, size_t taglen)
|
||||
{
|
||||
struct resp_addr* node;
|
||||
log_assert(set);
|
||||
|
||||
if(!(node=respip_find_or_create(set, ipstr, 1)))
|
||||
return 0;
|
||||
|
|
@ -183,6 +187,7 @@ respip_action_cfg(struct respip_set* set, const char* ipstr,
|
|||
{
|
||||
struct resp_addr* node;
|
||||
enum respip_action action;
|
||||
log_assert(set);
|
||||
|
||||
if(!(node=respip_find_or_create(set, ipstr, 1)))
|
||||
return 0;
|
||||
|
|
@ -325,6 +330,7 @@ static int
|
|||
respip_data_cfg(struct respip_set* set, const char* ipstr, const char* rrstr)
|
||||
{
|
||||
struct resp_addr* node;
|
||||
log_assert(set);
|
||||
|
||||
node=respip_find_or_create(set, ipstr, 0);
|
||||
if(!node || node->action == respip_none) {
|
||||
|
|
@ -344,6 +350,7 @@ respip_set_apply_cfg(struct respip_set* set, char* const* tagname, int num_tags,
|
|||
struct config_strbytelist* p;
|
||||
struct config_str2list* pa;
|
||||
struct config_str2list* pd;
|
||||
log_assert(set);
|
||||
|
||||
set->tagname = tagname;
|
||||
set->num_tags = num_tags;
|
||||
|
|
@ -609,6 +616,7 @@ respip_addr_lookup(const struct reply_info *rep, struct respip_set* rs,
|
|||
struct resp_addr* ra;
|
||||
struct sockaddr_storage ss;
|
||||
socklen_t addrlen;
|
||||
log_assert(rs);
|
||||
|
||||
lock_rw_rdlock(&rs->lock);
|
||||
for(i=0; i<rep->an_numrrsets; i++) {
|
||||
|
|
@ -867,7 +875,8 @@ respip_rewrite_reply(const struct query_info* qinfo,
|
|||
const struct respip_client_info* cinfo, const struct reply_info* rep,
|
||||
struct reply_info** new_repp, struct respip_action_info* actinfo,
|
||||
struct ub_packed_rrset_key** alias_rrset, int search_only,
|
||||
struct regional* region, struct auth_zones* az, int* rpz_passthru)
|
||||
struct regional* region, struct auth_zones* az, int* rpz_passthru,
|
||||
struct views* views, struct respip_set* ipset)
|
||||
{
|
||||
const uint8_t* ctaglist;
|
||||
size_t ctaglen;
|
||||
|
|
@ -876,7 +885,6 @@ respip_rewrite_reply(const struct query_info* qinfo,
|
|||
struct config_strlist** tag_datas;
|
||||
size_t tag_datas_size;
|
||||
struct view* view = NULL;
|
||||
struct respip_set* ipset = NULL;
|
||||
size_t rrset_id = 0, rr_id = 0;
|
||||
enum respip_action action = respip_none;
|
||||
int tag = -1;
|
||||
|
|
@ -899,8 +907,20 @@ respip_rewrite_reply(const struct query_info* qinfo,
|
|||
tag_actions_size = cinfo->tag_actions_size;
|
||||
tag_datas = cinfo->tag_datas;
|
||||
tag_datas_size = cinfo->tag_datas_size;
|
||||
view = cinfo->view;
|
||||
ipset = cinfo->respip_set;
|
||||
if(cinfo->view) {
|
||||
view = cinfo->view;
|
||||
lock_rw_rdlock(&view->lock);
|
||||
} else if(cinfo->view_name) {
|
||||
view = views_find_view(views, cinfo->view_name, 0);
|
||||
if(!view) {
|
||||
/* If the view no longer exists, the rewrite can not
|
||||
* be processed further. */
|
||||
verbose(VERB_ALGO, "respip: failed because view %s no "
|
||||
"longer exists", cinfo->view_name);
|
||||
return 0;
|
||||
}
|
||||
/* The view is rdlocked by views_find_view. */
|
||||
}
|
||||
|
||||
log_assert(ipset);
|
||||
|
||||
|
|
@ -915,7 +935,6 @@ respip_rewrite_reply(const struct query_info* qinfo,
|
|||
* Note also that we assume 'view' is valid in this function, which
|
||||
* should be safe (see unbound bug #1191) */
|
||||
if(view) {
|
||||
lock_rw_rdlock(&view->lock);
|
||||
if(view->respip_set) {
|
||||
if((raddr = respip_addr_lookup(rep,
|
||||
view->respip_set, &rrset_id, &rr_id))) {
|
||||
|
|
@ -1101,7 +1120,8 @@ respip_operate(struct module_qstate* qstate, enum module_ev event, int id,
|
|||
qstate->client_info, qstate->return_msg->rep,
|
||||
&new_rep, &actinfo, &alias_rrset, 0,
|
||||
qstate->region, qstate->env->auth_zones,
|
||||
&qstate->rpz_passthru)) {
|
||||
&qstate->rpz_passthru, qstate->env->views,
|
||||
qstate->env->respip_set)) {
|
||||
goto servfail;
|
||||
}
|
||||
if(actinfo.action != respip_none) {
|
||||
|
|
@ -1149,7 +1169,8 @@ respip_merge_cname(struct reply_info* base_rep,
|
|||
const struct query_info* qinfo, const struct reply_info* tgt_rep,
|
||||
const struct respip_client_info* cinfo, int must_validate,
|
||||
struct reply_info** new_repp, struct regional* region,
|
||||
struct auth_zones* az)
|
||||
struct auth_zones* az, struct views* views,
|
||||
struct respip_set* respip_set)
|
||||
{
|
||||
struct reply_info* new_rep;
|
||||
struct reply_info* tmp_rep = NULL; /* just a placeholder */
|
||||
|
|
@ -1176,7 +1197,7 @@ respip_merge_cname(struct reply_info* base_rep,
|
|||
|
||||
/* see if the target reply would be subject to a response-ip action. */
|
||||
if(!respip_rewrite_reply(qinfo, cinfo, tgt_rep, &tmp_rep, &actinfo,
|
||||
&alias_rrset, 1, region, az, NULL))
|
||||
&alias_rrset, 1, region, az, NULL, views, respip_set))
|
||||
return 0;
|
||||
if(actinfo.action != respip_none) {
|
||||
log_info("CNAME target of redirect response-ip action would "
|
||||
|
|
@ -1229,7 +1250,8 @@ respip_inform_super(struct module_qstate* qstate, int id,
|
|||
if(!respip_merge_cname(super->return_msg->rep, &qstate->qinfo,
|
||||
qstate->return_msg->rep, super->client_info,
|
||||
super->env->need_to_validate, &new_rep, super->region,
|
||||
qstate->env->auth_zones))
|
||||
qstate->env->auth_zones, qstate->env->views,
|
||||
qstate->env->respip_set))
|
||||
goto fail;
|
||||
super->return_msg->rep = new_rep;
|
||||
return;
|
||||
|
|
@ -1326,3 +1348,35 @@ respip_inform_print(struct respip_action_info* respip_actinfo, uint8_t* qname,
|
|||
(actionstr) ? actionstr : "inform", srcip, port);
|
||||
log_nametypeclass(NO_VERBOSE, txt, qname, qtype, qclass);
|
||||
}
|
||||
|
||||
size_t respip_set_get_mem(struct respip_set* set)
|
||||
{
|
||||
size_t m;
|
||||
if(!set) return 0;
|
||||
m = sizeof(*set);
|
||||
lock_rw_rdlock(&set->lock);
|
||||
m += regional_get_mem(set->region);
|
||||
lock_rw_unlock(&set->lock);
|
||||
return m;
|
||||
}
|
||||
|
||||
void
|
||||
respip_set_swap_tree(struct respip_set* respip_set,
|
||||
struct respip_set* data)
|
||||
{
|
||||
rbnode_type* oldroot = respip_set->ip_tree.root;
|
||||
size_t oldcount = respip_set->ip_tree.count;
|
||||
struct regional* oldregion = respip_set->region;
|
||||
char* const* oldtagname = respip_set->tagname;
|
||||
int oldnum_tags = respip_set->num_tags;
|
||||
respip_set->ip_tree.root = data->ip_tree.root;
|
||||
respip_set->ip_tree.count = data->ip_tree.count;
|
||||
respip_set->region = data->region;
|
||||
respip_set->tagname = data->tagname;
|
||||
respip_set->num_tags = data->num_tags;
|
||||
data->ip_tree.root = oldroot;
|
||||
data->ip_tree.count = oldcount;
|
||||
data->region = oldregion;
|
||||
data->tagname = oldtagname;
|
||||
data->num_tags = oldnum_tags;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
struct respip_set {
|
||||
struct regional* region;
|
||||
struct rbtree_type ip_tree;
|
||||
lock_rw_type lock; /* lock on the respip tree */
|
||||
lock_rw_type lock; /* lock on the respip tree. It is ordered
|
||||
after views and before hints, stubs and local zones. */
|
||||
char* const* tagname; /* shallow copy of tag names, for logging */
|
||||
int num_tags; /* number of tagname entries */
|
||||
};
|
||||
|
|
@ -59,7 +60,6 @@ struct respip_addr_info;
|
|||
* This is essentially a subset of acl_addr (except for respip_set) but
|
||||
* defined as a separate structure to avoid dependency on the daemon-specific
|
||||
* structure.
|
||||
* respip_set is supposed to refer to the response-ip set for the global view.
|
||||
*/
|
||||
struct respip_client_info {
|
||||
uint8_t* taglist;
|
||||
|
|
@ -68,8 +68,12 @@ struct respip_client_info {
|
|||
size_t tag_actions_size;
|
||||
struct config_strlist** tag_datas;
|
||||
size_t tag_datas_size;
|
||||
/** The view for the action, during cache callback that is by
|
||||
* pointer. */
|
||||
struct view* view;
|
||||
struct respip_set* respip_set;
|
||||
/** If from module query state, the view pointer is NULL, but the
|
||||
* name is stored in reference to the view. */
|
||||
char* view_name;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -149,13 +153,16 @@ int respip_views_apply_cfg(struct views* vs, struct config_file* cfg,
|
|||
* on error.
|
||||
* @param region: allocator to build *new_repp.
|
||||
* @param az: auth zones containing RPZ information.
|
||||
* @param views: views tree to lookup view used.
|
||||
* @param respip_set: the respip set for the global view.
|
||||
* @return 1 on success, 0 on error.
|
||||
*/
|
||||
int respip_merge_cname(struct reply_info* base_rep,
|
||||
const struct query_info* qinfo, const struct reply_info* tgt_rep,
|
||||
const struct respip_client_info* cinfo, int must_validate,
|
||||
struct reply_info** new_repp, struct regional* region,
|
||||
struct auth_zones* az);
|
||||
struct auth_zones* az, struct views* views,
|
||||
struct respip_set* respip_set);
|
||||
|
||||
/**
|
||||
* See if any IP-based action should apply to any IP address of AAAA/A answer
|
||||
|
|
@ -178,6 +185,8 @@ int respip_merge_cname(struct reply_info* base_rep,
|
|||
* @param region: allocator to build *new_repp.
|
||||
* @param rpz_passthru: keeps track of query state can have passthru that
|
||||
* stops further rpz processing. Or NULL for cached answer processing.
|
||||
* @param views: views tree to lookup view used.
|
||||
* @param ipset: the respip set for the global view.
|
||||
* @return 1 on success, 0 on error.
|
||||
*/
|
||||
int respip_rewrite_reply(const struct query_info* qinfo,
|
||||
|
|
@ -186,7 +195,7 @@ int respip_rewrite_reply(const struct query_info* qinfo,
|
|||
struct respip_action_info* actinfo,
|
||||
struct ub_packed_rrset_key** alias_rrset,
|
||||
int search_only, struct regional* region, struct auth_zones* az,
|
||||
int* rpz_passthru);
|
||||
int* rpz_passthru, struct views* views, struct respip_set* ipset);
|
||||
|
||||
/**
|
||||
* Get the response-ip function block.
|
||||
|
|
@ -267,7 +276,7 @@ void respip_inform_print(struct respip_action_info* respip_actinfo,
|
|||
* @param addrlen: length of addr.
|
||||
* @param net: netblock to lookup.
|
||||
* @param create: create node if it does not exist when 1.
|
||||
* @param ipstr: human redable ip string, for logging.
|
||||
* @param ipstr: human readable ip string, for logging.
|
||||
* @return newly created of found node, not holding lock.
|
||||
*/
|
||||
struct resp_addr*
|
||||
|
|
@ -302,4 +311,18 @@ respip_sockaddr_delete(struct respip_set* set, struct resp_addr* node);
|
|||
|
||||
struct ub_packed_rrset_key*
|
||||
respip_copy_rrset(const struct ub_packed_rrset_key* key, struct regional* region);
|
||||
|
||||
/** Get memory usage of respip set tree. The routine locks and unlocks the
|
||||
* set for reading. */
|
||||
size_t respip_set_get_mem(struct respip_set* set);
|
||||
|
||||
/**
|
||||
* Swap internal tree with preallocated entries. Caller should manage
|
||||
* the locks.
|
||||
* @param respip_set: response ip tree
|
||||
* @param data: preallocated information.
|
||||
*/
|
||||
void respip_set_swap_tree(struct respip_set* respip_set,
|
||||
struct respip_set* data);
|
||||
|
||||
#endif /* RESPIP_RESPIP_H */
|
||||
|
|
|
|||
|
|
@ -2317,9 +2317,6 @@ auth_free_masters(struct auth_master* list)
|
|||
}
|
||||
}
|
||||
|
||||
/** delete auth xfer structure
|
||||
* @param xfr: delete this xfer and its tasks.
|
||||
*/
|
||||
void
|
||||
auth_xfer_delete(struct auth_xfer* xfr)
|
||||
{
|
||||
|
|
@ -2416,14 +2413,12 @@ az_find_wildcard(struct auth_zone* z, struct query_info* qinfo,
|
|||
if(!dname_subdomain_c(nm, z->name))
|
||||
return NULL; /* out of zone */
|
||||
while((node=az_find_wildcard_domain(z, nm, nmlen))==NULL) {
|
||||
/* see if we can go up to find the wildcard */
|
||||
if(nmlen == z->namelen)
|
||||
return NULL; /* top of zone reached */
|
||||
if(ce && nmlen == ce->namelen)
|
||||
return NULL; /* ce reached */
|
||||
if(dname_is_root(nm))
|
||||
return NULL; /* cannot go up */
|
||||
dname_remove_label(&nm, &nmlen);
|
||||
if(!dname_remove_label_limit_len(&nm, &nmlen, z->namelen))
|
||||
return NULL; /* can't go up */
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
|
@ -2445,9 +2440,8 @@ az_find_candidate_ce(struct auth_zone* z, struct query_info* qinfo,
|
|||
n = az_find_name(z, nm, nmlen);
|
||||
/* delete labels and go up on name */
|
||||
while(!n) {
|
||||
if(dname_is_root(nm))
|
||||
return NULL; /* cannot go up */
|
||||
dname_remove_label(&nm, &nmlen);
|
||||
if(!dname_remove_label_limit_len(&nm, &nmlen, z->namelen))
|
||||
return NULL; /* can't go up */
|
||||
n = az_find_name(z, nm, nmlen);
|
||||
}
|
||||
return n;
|
||||
|
|
@ -2459,8 +2453,7 @@ az_domain_go_up(struct auth_zone* z, struct auth_data* n)
|
|||
{
|
||||
uint8_t* nm = n->name;
|
||||
size_t nmlen = n->namelen;
|
||||
while(!dname_is_root(nm)) {
|
||||
dname_remove_label(&nm, &nmlen);
|
||||
while(dname_remove_label_limit_len(&nm, &nmlen, z->namelen)) {
|
||||
if((n=az_find_name(z, nm, nmlen)) != NULL)
|
||||
return n;
|
||||
}
|
||||
|
|
@ -2774,26 +2767,23 @@ az_change_dnames(struct dns_msg* msg, uint8_t* oldname, uint8_t* newname,
|
|||
}
|
||||
}
|
||||
|
||||
/** find NSEC record covering the query */
|
||||
/** find NSEC record covering the query, with the given node in the zone */
|
||||
static struct auth_rrset*
|
||||
az_find_nsec_cover(struct auth_zone* z, struct auth_data** node)
|
||||
{
|
||||
uint8_t* nm = (*node)->name;
|
||||
size_t nmlen = (*node)->namelen;
|
||||
uint8_t* nm;
|
||||
size_t nmlen;
|
||||
struct auth_rrset* rrset;
|
||||
log_assert(*node); /* we already have a node when calling this */
|
||||
nm = (*node)->name;
|
||||
nmlen = (*node)->namelen;
|
||||
/* find the NSEC for the smallest-or-equal node */
|
||||
/* if node == NULL, we did not find a smaller name. But the zone
|
||||
* name is the smallest name and should have an NSEC. So there is
|
||||
* no NSEC to return (for a properly signed zone) */
|
||||
/* for empty nonterminals, the auth-data node should not exist,
|
||||
* and thus we don't need to go rbtree_previous here to find
|
||||
* a domain with an NSEC record */
|
||||
/* but there could be glue, and if this is node, then it has no NSEC.
|
||||
/* But there could be glue, and then it has no NSEC.
|
||||
* Go up to find nonglue (previous) NSEC-holding nodes */
|
||||
while((rrset=az_domain_rrset(*node, LDNS_RR_TYPE_NSEC)) == NULL) {
|
||||
if(dname_is_root(nm)) return NULL;
|
||||
if(nmlen == z->namelen) return NULL;
|
||||
dname_remove_label(&nm, &nmlen);
|
||||
if(!dname_remove_label_limit_len(&nm, &nmlen, z->namelen))
|
||||
return NULL; /* can't go up */
|
||||
/* adjust *node for the nsec rrset to find in */
|
||||
*node = az_find_name(z, nm, nmlen);
|
||||
}
|
||||
|
|
@ -3021,12 +3011,9 @@ az_nsec3_find_ce(struct auth_zone* z, uint8_t** cenm, size_t* cenmlen,
|
|||
struct auth_data* node;
|
||||
while((node = az_nsec3_find_exact(z, *cenm, *cenmlen,
|
||||
algo, iter, salt, saltlen)) == NULL) {
|
||||
if(*cenmlen == z->namelen) {
|
||||
/* next step up would take us out of the zone. fail */
|
||||
return NULL;
|
||||
}
|
||||
if(!dname_remove_label_limit_len(cenm, cenmlen, z->namelen))
|
||||
return NULL; /* can't go up */
|
||||
*no_exact_ce = 1;
|
||||
dname_remove_label(cenm, cenmlen);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
|
@ -3343,7 +3330,8 @@ az_generate_wildcard_answer(struct auth_zone* z, struct query_info* qinfo,
|
|||
} else if(ce) {
|
||||
uint8_t* wildup = wildcard->name;
|
||||
size_t wilduplen= wildcard->namelen;
|
||||
dname_remove_label(&wildup, &wilduplen);
|
||||
if(!dname_remove_label_limit_len(&wildup, &wilduplen, z->namelen))
|
||||
return 0; /* can't go up */
|
||||
if(!az_add_nsec3_proof(z, region, msg, wildup,
|
||||
wilduplen, msg->qinfo.qname,
|
||||
msg->qinfo.qname_len, 0, insert_ce, 1, 0))
|
||||
|
|
@ -3402,7 +3390,7 @@ az_generate_answer_with_node(struct auth_zone* z, struct query_info* qinfo,
|
|||
}
|
||||
|
||||
/** Generate answer without an existing-node that we can use.
|
||||
* So it'll be a referral, DNAME or nxdomain */
|
||||
* So it'll be a referral, DNAME, notype, wildcard or nxdomain */
|
||||
static int
|
||||
az_generate_answer_nonexistnode(struct auth_zone* z, struct query_info* qinfo,
|
||||
struct regional* region, struct dns_msg* msg, struct auth_data* ce,
|
||||
|
|
@ -3568,14 +3556,17 @@ auth_error_encode(struct query_info* qinfo, struct module_env* env,
|
|||
sldns_buffer_read_u16_at(buf, 2), edns);
|
||||
}
|
||||
|
||||
int auth_zones_answer(struct auth_zones* az, struct module_env* env,
|
||||
int auth_zones_downstream_answer(struct auth_zones* az, struct module_env* env,
|
||||
struct query_info* qinfo, struct edns_data* edns,
|
||||
struct comm_reply* repinfo, struct sldns_buffer* buf, struct regional* temp)
|
||||
struct comm_reply* repinfo, struct sldns_buffer* buf,
|
||||
struct regional* temp)
|
||||
{
|
||||
struct dns_msg* msg = NULL;
|
||||
struct auth_zone* z;
|
||||
int r;
|
||||
int fallback = 0;
|
||||
/* Copy the qinfo in case of cname aliasing from local-zone */
|
||||
struct query_info zqinfo = *qinfo;
|
||||
|
||||
lock_rw_rdlock(&az->lock);
|
||||
if(!az->have_downstream) {
|
||||
|
|
@ -3583,6 +3574,7 @@ int auth_zones_answer(struct auth_zones* az, struct module_env* env,
|
|||
lock_rw_unlock(&az->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(qinfo->qtype == LDNS_RR_TYPE_DS) {
|
||||
uint8_t* delname = qinfo->qname;
|
||||
size_t delnamelen = qinfo->qname_len;
|
||||
|
|
@ -3590,8 +3582,14 @@ int auth_zones_answer(struct auth_zones* az, struct module_env* env,
|
|||
z = auth_zones_find_zone(az, delname, delnamelen,
|
||||
qinfo->qclass);
|
||||
} else {
|
||||
z = auth_zones_find_zone(az, qinfo->qname, qinfo->qname_len,
|
||||
qinfo->qclass);
|
||||
if(zqinfo.local_alias && !local_alias_shallow_copy_qname(
|
||||
zqinfo.local_alias, &zqinfo.qname,
|
||||
&zqinfo.qname_len)) {
|
||||
lock_rw_unlock(&az->lock);
|
||||
return 0;
|
||||
}
|
||||
z = auth_zones_find_zone(az, zqinfo.qname, zqinfo.qname_len,
|
||||
zqinfo.qclass);
|
||||
}
|
||||
if(!z) {
|
||||
/* no zone above it */
|
||||
|
|
@ -3617,7 +3615,7 @@ int auth_zones_answer(struct auth_zones* az, struct module_env* env,
|
|||
}
|
||||
|
||||
/* answer it from zone z */
|
||||
r = auth_zone_generate_answer(z, qinfo, temp, &msg, &fallback);
|
||||
r = auth_zone_generate_answer(z, &zqinfo, temp, &msg, &fallback);
|
||||
lock_rw_unlock(&z->lock);
|
||||
if(!r && fallback) {
|
||||
/* fallback to regular answering (recursive) */
|
||||
|
|
@ -7006,6 +7004,18 @@ xfr_set_timeout(struct auth_xfer* xfr, struct module_env* env,
|
|||
comm_timer_set(xfr->task_nextprobe->timer, &tv);
|
||||
}
|
||||
|
||||
void auth_xfer_pickup_initial_zone(struct auth_xfer* x, struct module_env* env)
|
||||
{
|
||||
/* set lease_time, because we now have timestamp in env,
|
||||
* (not earlier during startup and apply_cfg), and this
|
||||
* notes the start time when the data was acquired */
|
||||
if(x->have_zone)
|
||||
x->lease_time = *env->now;
|
||||
if(x->task_nextprobe && x->task_nextprobe->worker == NULL) {
|
||||
xfr_set_timeout(x, env, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/** initial pick up of worker timeouts, ties events to worker event loop */
|
||||
void
|
||||
auth_xfer_pickup_initial(struct auth_zones* az, struct module_env* env)
|
||||
|
|
@ -7014,14 +7024,7 @@ auth_xfer_pickup_initial(struct auth_zones* az, struct module_env* env)
|
|||
lock_rw_wrlock(&az->lock);
|
||||
RBTREE_FOR(x, struct auth_xfer*, &az->xtree) {
|
||||
lock_basic_lock(&x->lock);
|
||||
/* set lease_time, because we now have timestamp in env,
|
||||
* (not earlier during startup and apply_cfg), and this
|
||||
* notes the start time when the data was acquired */
|
||||
if(x->have_zone)
|
||||
x->lease_time = *env->now;
|
||||
if(x->task_nextprobe && x->task_nextprobe->worker == NULL) {
|
||||
xfr_set_timeout(x, env, 0, 1);
|
||||
}
|
||||
auth_xfer_pickup_initial_zone(x, env);
|
||||
lock_basic_unlock(&x->lock);
|
||||
}
|
||||
lock_rw_unlock(&az->lock);
|
||||
|
|
@ -8580,3 +8583,161 @@ void auth_zones_pickup_zonemd_verify(struct auth_zones* az,
|
|||
}
|
||||
lock_rw_unlock(&az->lock);
|
||||
}
|
||||
|
||||
/** Get memory usage of auth rrset */
|
||||
static size_t
|
||||
auth_rrset_get_mem(struct auth_rrset* rrset)
|
||||
{
|
||||
size_t m = sizeof(*rrset) + packed_rrset_sizeof(rrset->data);
|
||||
return m;
|
||||
}
|
||||
|
||||
/** Get memory usage of auth data */
|
||||
static size_t
|
||||
auth_data_get_mem(struct auth_data* node)
|
||||
{
|
||||
size_t m = sizeof(*node) + node->namelen;
|
||||
struct auth_rrset* rrset;
|
||||
for(rrset = node->rrsets; rrset; rrset = rrset->next) {
|
||||
m += auth_rrset_get_mem(rrset);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
/** Get memory usage of auth zone */
|
||||
static size_t
|
||||
auth_zone_get_mem(struct auth_zone* z)
|
||||
{
|
||||
size_t m = sizeof(*z) + z->namelen;
|
||||
struct auth_data* node;
|
||||
if(z->zonefile)
|
||||
m += strlen(z->zonefile)+1;
|
||||
RBTREE_FOR(node, struct auth_data*, &z->data) {
|
||||
m += auth_data_get_mem(node);
|
||||
}
|
||||
if(z->rpz)
|
||||
m += rpz_get_mem(z->rpz);
|
||||
return m;
|
||||
}
|
||||
|
||||
/** Get memory usage of list of auth addr */
|
||||
static size_t
|
||||
auth_addrs_get_mem(struct auth_addr* list)
|
||||
{
|
||||
size_t m = 0;
|
||||
struct auth_addr* a;
|
||||
for(a = list; a; a = a->next) {
|
||||
m += sizeof(*a);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
/** Get memory usage of list of primaries for auth xfer */
|
||||
static size_t
|
||||
auth_primaries_get_mem(struct auth_master* list)
|
||||
{
|
||||
size_t m = 0;
|
||||
struct auth_master* n;
|
||||
for(n = list; n; n = n->next) {
|
||||
m += sizeof(*n);
|
||||
m += auth_addrs_get_mem(n->list);
|
||||
if(n->host)
|
||||
m += strlen(n->host)+1;
|
||||
if(n->file)
|
||||
m += strlen(n->file)+1;
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
/** Get memory usage or list of auth chunks */
|
||||
static size_t
|
||||
auth_chunks_get_mem(struct auth_chunk* list)
|
||||
{
|
||||
size_t m = 0;
|
||||
struct auth_chunk* chunk;
|
||||
for(chunk = list; chunk; chunk = chunk->next) {
|
||||
m += sizeof(*chunk) + chunk->len;
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
/** Get memory usage of auth xfer */
|
||||
static size_t
|
||||
auth_xfer_get_mem(struct auth_xfer* xfr)
|
||||
{
|
||||
size_t m = sizeof(*xfr) + xfr->namelen;
|
||||
|
||||
/* auth_nextprobe */
|
||||
m += comm_timer_get_mem(xfr->task_nextprobe->timer);
|
||||
|
||||
/* auth_probe */
|
||||
m += auth_primaries_get_mem(xfr->task_probe->masters);
|
||||
m += comm_point_get_mem(xfr->task_probe->cp);
|
||||
m += comm_timer_get_mem(xfr->task_probe->timer);
|
||||
|
||||
/* auth_transfer */
|
||||
m += auth_chunks_get_mem(xfr->task_transfer->chunks_first);
|
||||
m += auth_primaries_get_mem(xfr->task_transfer->masters);
|
||||
m += comm_point_get_mem(xfr->task_transfer->cp);
|
||||
m += comm_timer_get_mem(xfr->task_transfer->timer);
|
||||
|
||||
/* allow_notify_list */
|
||||
m += auth_primaries_get_mem(xfr->allow_notify_list);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
/** Get memory usage of auth zones ztree */
|
||||
static size_t
|
||||
az_ztree_get_mem(struct auth_zones* az)
|
||||
{
|
||||
size_t m = 0;
|
||||
struct auth_zone* z;
|
||||
RBTREE_FOR(z, struct auth_zone*, &az->ztree) {
|
||||
lock_rw_rdlock(&z->lock);
|
||||
m += auth_zone_get_mem(z);
|
||||
lock_rw_unlock(&z->lock);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
/** Get memory usage of auth zones xtree */
|
||||
static size_t
|
||||
az_xtree_get_mem(struct auth_zones* az)
|
||||
{
|
||||
size_t m = 0;
|
||||
struct auth_xfer* xfr;
|
||||
RBTREE_FOR(xfr, struct auth_xfer*, &az->xtree) {
|
||||
lock_basic_lock(&xfr->lock);
|
||||
m += auth_xfer_get_mem(xfr);
|
||||
lock_basic_unlock(&xfr->lock);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
size_t auth_zones_get_mem(struct auth_zones* zones)
|
||||
{
|
||||
size_t m;
|
||||
if(!zones) return 0;
|
||||
m = sizeof(*zones);
|
||||
lock_rw_rdlock(&zones->rpz_lock);
|
||||
lock_rw_rdlock(&zones->lock);
|
||||
m += az_ztree_get_mem(zones);
|
||||
m += az_xtree_get_mem(zones);
|
||||
lock_rw_unlock(&zones->lock);
|
||||
lock_rw_unlock(&zones->rpz_lock);
|
||||
return m;
|
||||
}
|
||||
|
||||
void xfr_disown_tasks(struct auth_xfer* xfr, struct worker* worker)
|
||||
{
|
||||
if(xfr->task_nextprobe->worker == worker) {
|
||||
xfr_nextprobe_disown(xfr);
|
||||
}
|
||||
if(xfr->task_probe->worker == worker) {
|
||||
xfr_probe_disown(xfr);
|
||||
}
|
||||
if(xfr->task_transfer->worker == worker) {
|
||||
xfr_transfer_disown(xfr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ struct auth_chunk;
|
|||
* Authoritative zones, shared.
|
||||
*/
|
||||
struct auth_zones {
|
||||
/** lock on the authzone trees */
|
||||
/** lock on the authzone trees. It is locked after views, respip,
|
||||
* local_zones and before fwds and stubs. */
|
||||
lock_rw_type lock;
|
||||
/** rbtree of struct auth_zone */
|
||||
rbtree_type ztree;
|
||||
|
|
@ -207,7 +208,9 @@ struct auth_xfer {
|
|||
* one of the tasks.
|
||||
* Once it has the task assigned to it, the worker can access the
|
||||
* other elements of the task structure without a lock, because that
|
||||
* is necessary for the eventloop and callbacks from that. */
|
||||
* is necessary for the eventloop and callbacks from that.
|
||||
* The auth_zone->lock is locked before this lock.
|
||||
*/
|
||||
lock_basic_type lock;
|
||||
|
||||
/** zone name, in uncompressed wireformat */
|
||||
|
|
@ -547,9 +550,10 @@ int auth_zones_lookup(struct auth_zones* az, struct query_info* qinfo,
|
|||
* @param temp: temporary storage region.
|
||||
* @return false if not answered
|
||||
*/
|
||||
int auth_zones_answer(struct auth_zones* az, struct module_env* env,
|
||||
int auth_zones_downstream_answer(struct auth_zones* az, struct module_env* env,
|
||||
struct query_info* qinfo, struct edns_data* edns,
|
||||
struct comm_reply* repinfo, struct sldns_buffer* buf, struct regional* temp);
|
||||
struct comm_reply* repinfo, struct sldns_buffer* buf,
|
||||
struct regional* temp);
|
||||
|
||||
/**
|
||||
* Find the auth zone that is above the given qname.
|
||||
|
|
@ -783,4 +787,33 @@ void auth_zonemd_dnskey_lookup_callback(void* arg, int rcode,
|
|||
void auth_zones_pickup_zonemd_verify(struct auth_zones* az,
|
||||
struct module_env* env);
|
||||
|
||||
/** Get memory usage for auth zones. The routine locks and unlocks
|
||||
* for reading. */
|
||||
size_t auth_zones_get_mem(struct auth_zones* zones);
|
||||
|
||||
/**
|
||||
* Initial pick up of the auth zone nextprobe timeout and that turns
|
||||
* into further zone transfer work, if any. Also sets the lease time.
|
||||
* @param x: xfer structure, locked by caller.
|
||||
* @param env: environment of the worker that picks up the task.
|
||||
*/
|
||||
void auth_xfer_pickup_initial_zone(struct auth_xfer* x,
|
||||
struct module_env* env);
|
||||
|
||||
/**
|
||||
* Delete auth xfer structure
|
||||
* @param xfr: delete this xfer and its tasks.
|
||||
*/
|
||||
void auth_xfer_delete(struct auth_xfer* xfr);
|
||||
|
||||
/**
|
||||
* Disown tasks from the xfr that belong to this worker.
|
||||
* Only tasks for the worker in question, the comm point and timer
|
||||
* delete functions need to run in the thread of that worker to be
|
||||
* able to delete the callback from the event base.
|
||||
* @param xfr: xfr structure
|
||||
* @param worker: the worker for which to stop tasks.
|
||||
*/
|
||||
void xfr_disown_tasks(struct auth_xfer* xfr, struct worker* worker);
|
||||
|
||||
#endif /* SERVICES_AUTHZONE_H */
|
||||
|
|
|
|||
123
services/cache/infra.c
vendored
123
services/cache/infra.c
vendored
|
|
@ -161,7 +161,7 @@ rate_deldatafunc(void* d, void* ATTR_UNUSED(arg))
|
|||
|
||||
/** find or create element in domainlimit tree */
|
||||
static struct domain_limit_data* domain_limit_findcreate(
|
||||
struct infra_cache* infra, char* name)
|
||||
struct rbtree_type* domain_limits, char* name)
|
||||
{
|
||||
uint8_t* nm;
|
||||
int labs;
|
||||
|
|
@ -177,8 +177,8 @@ static struct domain_limit_data* domain_limit_findcreate(
|
|||
labs = dname_count_labels(nm);
|
||||
|
||||
/* can we find it? */
|
||||
d = (struct domain_limit_data*)name_tree_find(&infra->domain_limits,
|
||||
nm, nmlen, labs, LDNS_RR_CLASS_IN);
|
||||
d = (struct domain_limit_data*)name_tree_find(domain_limits, nm,
|
||||
nmlen, labs, LDNS_RR_CLASS_IN);
|
||||
if(d) {
|
||||
free(nm);
|
||||
return d;
|
||||
|
|
@ -197,8 +197,8 @@ static struct domain_limit_data* domain_limit_findcreate(
|
|||
d->node.dclass = LDNS_RR_CLASS_IN;
|
||||
d->lim = -1;
|
||||
d->below = -1;
|
||||
if(!name_tree_insert(&infra->domain_limits, &d->node, nm, nmlen,
|
||||
labs, LDNS_RR_CLASS_IN)) {
|
||||
if(!name_tree_insert(domain_limits, &d->node, nm, nmlen, labs,
|
||||
LDNS_RR_CLASS_IN)) {
|
||||
log_err("duplicate element in domainlimit tree");
|
||||
free(nm);
|
||||
free(d);
|
||||
|
|
@ -208,19 +208,19 @@ static struct domain_limit_data* domain_limit_findcreate(
|
|||
}
|
||||
|
||||
/** insert rate limit configuration into lookup tree */
|
||||
static int infra_ratelimit_cfg_insert(struct infra_cache* infra,
|
||||
static int infra_ratelimit_cfg_insert(struct rbtree_type* domain_limits,
|
||||
struct config_file* cfg)
|
||||
{
|
||||
struct config_str2list* p;
|
||||
struct domain_limit_data* d;
|
||||
for(p = cfg->ratelimit_for_domain; p; p = p->next) {
|
||||
d = domain_limit_findcreate(infra, p->str);
|
||||
d = domain_limit_findcreate(domain_limits, p->str);
|
||||
if(!d)
|
||||
return 0;
|
||||
d->lim = atoi(p->str2);
|
||||
}
|
||||
for(p = cfg->ratelimit_below_domain; p; p = p->next) {
|
||||
d = domain_limit_findcreate(infra, p->str);
|
||||
d = domain_limit_findcreate(domain_limits, p->str);
|
||||
if(!d)
|
||||
return 0;
|
||||
d->below = atoi(p->str2);
|
||||
|
|
@ -228,24 +228,21 @@ static int infra_ratelimit_cfg_insert(struct infra_cache* infra,
|
|||
return 1;
|
||||
}
|
||||
|
||||
/** setup domain limits tree (0 on failure) */
|
||||
static int
|
||||
setup_domain_limits(struct infra_cache* infra, struct config_file* cfg)
|
||||
int
|
||||
setup_domain_limits(struct rbtree_type* domain_limits, struct config_file* cfg)
|
||||
{
|
||||
name_tree_init(&infra->domain_limits);
|
||||
if(!infra_ratelimit_cfg_insert(infra, cfg)) {
|
||||
name_tree_init(domain_limits);
|
||||
if(!infra_ratelimit_cfg_insert(domain_limits, cfg)) {
|
||||
return 0;
|
||||
}
|
||||
name_tree_init_parents(&infra->domain_limits);
|
||||
name_tree_init_parents(domain_limits);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** find or create element in wait limit netblock tree */
|
||||
static struct wait_limit_netblock_info*
|
||||
wait_limit_netblock_findcreate(struct infra_cache* infra, char* str,
|
||||
int cookie)
|
||||
wait_limit_netblock_findcreate(struct rbtree_type* tree, char* str)
|
||||
{
|
||||
rbtree_type* tree;
|
||||
struct sockaddr_storage addr;
|
||||
int net;
|
||||
socklen_t addrlen;
|
||||
|
|
@ -257,10 +254,6 @@ wait_limit_netblock_findcreate(struct infra_cache* infra, char* str,
|
|||
}
|
||||
|
||||
/* can we find it? */
|
||||
if(cookie)
|
||||
tree = &infra->wait_limits_cookie_netblock;
|
||||
else
|
||||
tree = &infra->wait_limits_netblock;
|
||||
d = (struct wait_limit_netblock_info*)addr_tree_find(tree, &addr,
|
||||
addrlen, net);
|
||||
if(d)
|
||||
|
|
@ -282,19 +275,21 @@ wait_limit_netblock_findcreate(struct infra_cache* infra, char* str,
|
|||
|
||||
/** insert wait limit information into lookup tree */
|
||||
static int
|
||||
infra_wait_limit_netblock_insert(struct infra_cache* infra,
|
||||
struct config_file* cfg)
|
||||
infra_wait_limit_netblock_insert(rbtree_type* wait_limits_netblock,
|
||||
rbtree_type* wait_limits_cookie_netblock, struct config_file* cfg)
|
||||
{
|
||||
struct config_str2list* p;
|
||||
struct wait_limit_netblock_info* d;
|
||||
for(p = cfg->wait_limit_netblock; p; p = p->next) {
|
||||
d = wait_limit_netblock_findcreate(infra, p->str, 0);
|
||||
d = wait_limit_netblock_findcreate(wait_limits_netblock,
|
||||
p->str);
|
||||
if(!d)
|
||||
return 0;
|
||||
d->limit = atoi(p->str2);
|
||||
}
|
||||
for(p = cfg->wait_limit_cookie_netblock; p; p = p->next) {
|
||||
d = wait_limit_netblock_findcreate(infra, p->str, 1);
|
||||
d = wait_limit_netblock_findcreate(wait_limits_cookie_netblock,
|
||||
p->str);
|
||||
if(!d)
|
||||
return 0;
|
||||
d->limit = atoi(p->str2);
|
||||
|
|
@ -302,16 +297,48 @@ infra_wait_limit_netblock_insert(struct infra_cache* infra,
|
|||
return 1;
|
||||
}
|
||||
|
||||
/** setup wait limits tree (0 on failure) */
|
||||
/** Add a default wait limit netblock */
|
||||
static int
|
||||
setup_wait_limits(struct infra_cache* infra, struct config_file* cfg)
|
||||
wait_limit_netblock_default(struct rbtree_type* tree, char* str, int limit)
|
||||
{
|
||||
addr_tree_init(&infra->wait_limits_netblock);
|
||||
addr_tree_init(&infra->wait_limits_cookie_netblock);
|
||||
if(!infra_wait_limit_netblock_insert(infra, cfg))
|
||||
struct wait_limit_netblock_info* d;
|
||||
d = wait_limit_netblock_findcreate(tree, str);
|
||||
if(!d)
|
||||
return 0;
|
||||
addr_tree_init_parents(&infra->wait_limits_netblock);
|
||||
addr_tree_init_parents(&infra->wait_limits_cookie_netblock);
|
||||
d->limit = limit;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
setup_wait_limits(rbtree_type* wait_limits_netblock,
|
||||
rbtree_type* wait_limits_cookie_netblock, struct config_file* cfg)
|
||||
{
|
||||
addr_tree_init(wait_limits_netblock);
|
||||
addr_tree_init(wait_limits_cookie_netblock);
|
||||
|
||||
/* Insert defaults */
|
||||
/* The loopback address is separated from the rest of the network. */
|
||||
/* wait-limit-netblock: 127.0.0.0/8 -1 */
|
||||
if(!wait_limit_netblock_default(wait_limits_netblock, "127.0.0.0/8",
|
||||
-1))
|
||||
return 0;
|
||||
/* wait-limit-netblock: ::1/128 -1 */
|
||||
if(!wait_limit_netblock_default(wait_limits_netblock, "::1/128", -1))
|
||||
return 0;
|
||||
/* wait-limit-cookie-netblock: 127.0.0.0/8 -1 */
|
||||
if(!wait_limit_netblock_default(wait_limits_cookie_netblock,
|
||||
"127.0.0.0/8", -1))
|
||||
return 0;
|
||||
/* wait-limit-cookie-netblock: ::1/128 -1 */
|
||||
if(!wait_limit_netblock_default(wait_limits_cookie_netblock,
|
||||
"::1/128", -1))
|
||||
return 0;
|
||||
|
||||
if(!infra_wait_limit_netblock_insert(wait_limits_netblock,
|
||||
wait_limits_cookie_netblock, cfg))
|
||||
return 0;
|
||||
addr_tree_init_parents(wait_limits_netblock);
|
||||
addr_tree_init_parents(wait_limits_cookie_netblock);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -344,11 +371,12 @@ infra_create(struct config_file* cfg)
|
|||
return NULL;
|
||||
}
|
||||
/* insert config data into ratelimits */
|
||||
if(!setup_domain_limits(infra, cfg)) {
|
||||
if(!setup_domain_limits(&infra->domain_limits, cfg)) {
|
||||
infra_delete(infra);
|
||||
return NULL;
|
||||
}
|
||||
if(!setup_wait_limits(infra, cfg)) {
|
||||
if(!setup_wait_limits(&infra->wait_limits_netblock,
|
||||
&infra->wait_limits_cookie_netblock, cfg)) {
|
||||
infra_delete(infra);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -373,12 +401,29 @@ static void domain_limit_free(rbnode_type* n, void* ATTR_UNUSED(arg))
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
domain_limits_free(struct rbtree_type* domain_limits)
|
||||
{
|
||||
if(!domain_limits)
|
||||
return;
|
||||
traverse_postorder(domain_limits, domain_limit_free, NULL);
|
||||
}
|
||||
|
||||
/** delete wait_limit_netblock_info entries */
|
||||
static void wait_limit_netblock_del(rbnode_type* n, void* ATTR_UNUSED(arg))
|
||||
{
|
||||
free(n);
|
||||
}
|
||||
|
||||
void
|
||||
wait_limits_free(struct rbtree_type* wait_limits_tree)
|
||||
{
|
||||
if(!wait_limits_tree)
|
||||
return;
|
||||
traverse_postorder(wait_limits_tree, wait_limit_netblock_del,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
infra_delete(struct infra_cache* infra)
|
||||
{
|
||||
|
|
@ -386,12 +431,10 @@ infra_delete(struct infra_cache* infra)
|
|||
return;
|
||||
slabhash_delete(infra->hosts);
|
||||
slabhash_delete(infra->domain_rates);
|
||||
traverse_postorder(&infra->domain_limits, domain_limit_free, NULL);
|
||||
domain_limits_free(&infra->domain_limits);
|
||||
slabhash_delete(infra->client_ip_rates);
|
||||
traverse_postorder(&infra->wait_limits_netblock,
|
||||
wait_limit_netblock_del, NULL);
|
||||
traverse_postorder(&infra->wait_limits_cookie_netblock,
|
||||
wait_limit_netblock_del, NULL);
|
||||
wait_limits_free(&infra->wait_limits_netblock);
|
||||
wait_limits_free(&infra->wait_limits_cookie_netblock);
|
||||
free(infra);
|
||||
}
|
||||
|
||||
|
|
@ -422,7 +465,7 @@ infra_adjust(struct infra_cache* infra, struct config_file* cfg)
|
|||
/* reapply domain limits */
|
||||
traverse_postorder(&infra->domain_limits, domain_limit_free,
|
||||
NULL);
|
||||
if(!setup_domain_limits(infra, cfg)) {
|
||||
if(!setup_domain_limits(&infra->domain_limits, cfg)) {
|
||||
infra_delete(infra);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
15
services/cache/infra.h
vendored
15
services/cache/infra.h
vendored
|
|
@ -515,6 +515,21 @@ void infra_wait_limit_inc(struct infra_cache* infra, struct comm_reply* rep,
|
|||
void infra_wait_limit_dec(struct infra_cache* infra, struct comm_reply* rep,
|
||||
struct config_file* cfg);
|
||||
|
||||
/** setup wait limits tree (0 on failure) */
|
||||
int setup_wait_limits(struct rbtree_type* wait_limits_netblock,
|
||||
struct rbtree_type* wait_limits_cookie_netblock,
|
||||
struct config_file* cfg);
|
||||
|
||||
/** Free the wait limits and wait cookie limits tree. */
|
||||
void wait_limits_free(struct rbtree_type* wait_limits_tree);
|
||||
|
||||
/** setup domain limits tree (0 on failure) */
|
||||
int setup_domain_limits(struct rbtree_type* domain_limits,
|
||||
struct config_file* cfg);
|
||||
|
||||
/** Free the domain limits tree. */
|
||||
void domain_limits_free(struct rbtree_type* domain_limits);
|
||||
|
||||
/** exported for unit test */
|
||||
int still_useful_timeout();
|
||||
|
||||
|
|
|
|||
2
services/cache/rrset.c
vendored
2
services/cache/rrset.c
vendored
|
|
@ -68,6 +68,8 @@ struct rrset_cache* rrset_cache_create(struct config_file* cfg,
|
|||
struct rrset_cache *r = (struct rrset_cache*)slabhash_create(slabs,
|
||||
startarray, maxmem, ub_rrset_sizefunc, ub_rrset_compare,
|
||||
ub_rrset_key_delete, rrset_data_delete, alloc);
|
||||
if(!r)
|
||||
return NULL;
|
||||
slabhash_setmarkdel(&r->table, &rrset_markdel);
|
||||
return r;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,10 +90,13 @@
|
|||
#ifdef HAVE_NGTCP2
|
||||
#include <ngtcp2/ngtcp2.h>
|
||||
#include <ngtcp2/ngtcp2_crypto.h>
|
||||
#ifdef HAVE_NGTCP2_NGTCP2_CRYPTO_QUICTLS_H
|
||||
#ifdef HAVE_NGTCP2_NGTCP2_CRYPTO_OSSL_H
|
||||
#include <ngtcp2/ngtcp2_crypto_ossl.h>
|
||||
#elif defined(HAVE_NGTCP2_NGTCP2_CRYPTO_QUICTLS_H)
|
||||
#include <ngtcp2/ngtcp2_crypto_quictls.h>
|
||||
#else
|
||||
#elif defined(HAVE_NGTCP2_NGTCP2_CRYPTO_OPENSSL_H)
|
||||
#include <ngtcp2/ngtcp2_crypto_openssl.h>
|
||||
#define MAKE_QUIC_METHOD 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -473,7 +476,8 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
|||
"Got %u. To fix: start with "
|
||||
"root permissions(linux) or sysctl "
|
||||
"bigger net.core.wmem_max(linux) or "
|
||||
"kern.ipc.maxsockbuf(bsd) values.",
|
||||
"kern.ipc.maxsockbuf(bsd) values. or "
|
||||
"set so-sndbuf: 0 (use system value).",
|
||||
(unsigned)snd, (unsigned)got);
|
||||
}
|
||||
# ifdef SO_SNDBUFFORCE
|
||||
|
|
@ -902,7 +906,7 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto,
|
|||
against IP spoofing attacks as suggested in RFC7413 */
|
||||
#ifdef __APPLE__
|
||||
/* OS X implementation only supports qlen of 1 via this call. Actual
|
||||
value is configured by the net.inet.tcp.fastopen_backlog kernel parm. */
|
||||
value is configured by the net.inet.tcp.fastopen_backlog kernel param. */
|
||||
qlen = 1;
|
||||
#else
|
||||
/* 5 is recommended on linux */
|
||||
|
|
@ -1179,6 +1183,15 @@ set_recvtimestamp(int s)
|
|||
return 0;
|
||||
}
|
||||
return 1;
|
||||
#elif defined(SO_TIMESTAMP) && defined(SCM_TIMESTAMP)
|
||||
int on = 1;
|
||||
/* FreeBSD and also Linux. */
|
||||
if (setsockopt(s, SOL_SOCKET, SO_TIMESTAMP, (void*)&on, (socklen_t)sizeof(on)) < 0) {
|
||||
log_err("setsockopt(..., SO_TIMESTAMP, ...) failed: %s",
|
||||
strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
#else
|
||||
log_err("packets timestamping is not supported on this platform");
|
||||
(void)s;
|
||||
|
|
@ -1598,7 +1611,7 @@ listen_create(struct comm_base* base, struct listen_port* ports,
|
|||
front->udp_buff, ports->pp2_enabled, cb,
|
||||
cb_arg, ports->socket);
|
||||
#else
|
||||
log_warn("This system does not support UDP ancilliary data.");
|
||||
log_warn("This system does not support UDP ancillary data.");
|
||||
#endif
|
||||
}
|
||||
if(!cp) {
|
||||
|
|
@ -3099,7 +3112,7 @@ static int http2_req_header_cb(nghttp2_session* session,
|
|||
return 0;
|
||||
}
|
||||
/* Content type is a SHOULD (rfc7231#section-3.1.1.5) when using POST,
|
||||
* and not needed when using GET. Don't enfore.
|
||||
* and not needed when using GET. Don't enforce.
|
||||
* If set only allow lowercase "application/dns-message".
|
||||
*
|
||||
* Clients SHOULD (rfc8484#section-4.1) set an accept header, but MUST
|
||||
|
|
@ -3161,7 +3174,7 @@ static int http2_req_data_chunk_recv_cb(nghttp2_session* ATTR_UNUSED(session),
|
|||
qlen = h2_stream->content_length;
|
||||
} else if(len <= h2_session->c->http2_stream_max_qbuffer_size) {
|
||||
/* setting this to msg-buffer-size can result in a lot
|
||||
* of memory consuption. Most queries should fit in a
|
||||
* of memory consumption. Most queries should fit in a
|
||||
* single DATA frame, and most POST queries will
|
||||
* contain content-length which does not impose this
|
||||
* limit. */
|
||||
|
|
@ -3187,7 +3200,7 @@ static int http2_req_data_chunk_recv_cb(nghttp2_session* ATTR_UNUSED(session),
|
|||
|
||||
if(!h2_stream->qbuffer ||
|
||||
sldns_buffer_remaining(h2_stream->qbuffer) < len) {
|
||||
verbose(VERB_ALGO, "http2 data_chunck_recv failed. Not enough "
|
||||
verbose(VERB_ALGO, "http2 data_chunk_recv failed. Not enough "
|
||||
"buffer space for POST query. Can happen on multi "
|
||||
"frame requests without content-length header");
|
||||
h2_stream->query_too_large = 1;
|
||||
|
|
@ -3257,6 +3270,21 @@ doq_table_create(struct config_file* cfg, struct ub_randstate* rnd)
|
|||
struct doq_table* table = calloc(1, sizeof(*table));
|
||||
if(!table)
|
||||
return NULL;
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
/* Initialize the ossl crypto, it is harmless to call twice,
|
||||
* and this is before use of doq connections. */
|
||||
if(ngtcp2_crypto_ossl_init() != 0) {
|
||||
log_err("ngtcp2_crypto_oss_init failed");
|
||||
free(table);
|
||||
return NULL;
|
||||
}
|
||||
#elif defined(HAVE_NGTCP2_CRYPTO_QUICTLS_INIT)
|
||||
if(ngtcp2_crypto_quictls_init() != 0) {
|
||||
log_err("ngtcp2_crypto_quictls_init failed");
|
||||
free(table);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
table->idle_timeout = ((uint64_t)cfg->tcp_idle_timeout)*
|
||||
NGTCP2_MILLISECONDS;
|
||||
table->sv_scidlen = 16;
|
||||
|
|
@ -3596,12 +3624,18 @@ doq_conn_delete(struct doq_conn* conn, struct doq_table* table)
|
|||
lock_rw_wrlock(&conn->table->conid_lock);
|
||||
doq_conn_clear_conids(conn);
|
||||
lock_rw_unlock(&conn->table->conid_lock);
|
||||
ngtcp2_conn_del(conn->conn);
|
||||
/* Remove the app data from ngtcp2 before SSL_free of conn->ssl,
|
||||
* because the ngtcp2 conn is deleted. */
|
||||
SSL_set_app_data(conn->ssl, NULL);
|
||||
if(conn->stream_tree.count != 0) {
|
||||
traverse_postorder(&conn->stream_tree, stream_tree_del, table);
|
||||
}
|
||||
free(conn->key.dcid);
|
||||
SSL_free(conn->ssl);
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
ngtcp2_crypto_ossl_ctx_del(conn->ossl_ctx);
|
||||
#endif
|
||||
ngtcp2_conn_del(conn->conn);
|
||||
free(conn->close_pkt);
|
||||
free(conn);
|
||||
}
|
||||
|
|
@ -4459,7 +4493,7 @@ doq_log_printf_cb(void* ATTR_UNUSED(user_data), const char* fmt, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
#ifndef HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_SERVER_CONTEXT
|
||||
#ifdef MAKE_QUIC_METHOD
|
||||
/** the doq application tx key callback, false on failure */
|
||||
static int
|
||||
doq_application_tx_key_cb(struct doq_conn* conn)
|
||||
|
|
@ -4493,7 +4527,9 @@ doq_set_encryption_secrets(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level,
|
|||
ngtcp2_crypto_level
|
||||
#endif
|
||||
level =
|
||||
#ifdef HAVE_NGTCP2_CRYPTO_QUICTLS_FROM_OSSL_ENCRYPTION_LEVEL
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
ngtcp2_crypto_ossl_from_ossl_encryption_level(ossl_level);
|
||||
#elif defined(HAVE_NGTCP2_CRYPTO_QUICTLS_FROM_OSSL_ENCRYPTION_LEVEL)
|
||||
ngtcp2_crypto_quictls_from_ossl_encryption_level(ossl_level);
|
||||
#else
|
||||
ngtcp2_crypto_openssl_from_ossl_encryption_level(ossl_level);
|
||||
|
|
@ -4539,7 +4575,9 @@ doq_add_handshake_data(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level,
|
|||
ngtcp2_crypto_level
|
||||
#endif
|
||||
level =
|
||||
#ifdef HAVE_NGTCP2_CRYPTO_QUICTLS_FROM_OSSL_ENCRYPTION_LEVEL
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
ngtcp2_crypto_ossl_from_ossl_encryption_level(ossl_level);
|
||||
#elif defined(HAVE_NGTCP2_CRYPTO_QUICTLS_FROM_OSSL_ENCRYPTION_LEVEL)
|
||||
ngtcp2_crypto_quictls_from_ossl_encryption_level(ossl_level);
|
||||
#else
|
||||
ngtcp2_crypto_openssl_from_ossl_encryption_level(ossl_level);
|
||||
|
|
@ -4574,7 +4612,7 @@ doq_send_alert(SSL *ssl, enum ssl_encryption_level_t ATTR_UNUSED(level),
|
|||
doq_conn->tls_alert = alert;
|
||||
return 1;
|
||||
}
|
||||
#endif /* HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_SERVER_CONTEXT */
|
||||
#endif /* MAKE_QUIC_METHOD */
|
||||
|
||||
/** ALPN select callback for the doq SSL context */
|
||||
static int
|
||||
|
|
@ -4596,7 +4634,7 @@ void* quic_sslctx_create(char* key, char* pem, char* verifypem)
|
|||
{
|
||||
#ifdef HAVE_NGTCP2
|
||||
char* sid_ctx = "unbound server";
|
||||
#ifndef HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_SERVER_CONTEXT
|
||||
#ifdef MAKE_QUIC_METHOD
|
||||
SSL_QUIC_METHOD* quic_method;
|
||||
#endif
|
||||
SSL_CTX* ctx = SSL_CTX_new(TLS_server_method());
|
||||
|
|
@ -4669,7 +4707,7 @@ void* quic_sslctx_create(char* key, char* pem, char* verifypem)
|
|||
SSL_CTX_free(ctx);
|
||||
return NULL;
|
||||
}
|
||||
#else /* HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_SERVER_CONTEXT */
|
||||
#elif defined(MAKE_QUIC_METHOD)
|
||||
/* The quic_method needs to remain valid during the SSL_CTX
|
||||
* lifetime, so we allocate it. It is freed with the
|
||||
* doq_server_socket. */
|
||||
|
|
@ -4704,12 +4742,29 @@ static ngtcp2_conn* doq_conn_ref_get_conn(ngtcp2_crypto_conn_ref* conn_ref)
|
|||
static SSL*
|
||||
doq_ssl_server_setup(SSL_CTX* ctx, struct doq_conn* conn)
|
||||
{
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
int ret;
|
||||
#endif
|
||||
SSL* ssl = SSL_new(ctx);
|
||||
if(!ssl) {
|
||||
log_crypto_err("doq: SSL_new failed");
|
||||
return NULL;
|
||||
}
|
||||
#ifdef HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_SERVER_CONTEXT
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
if((ret=ngtcp2_crypto_ossl_ctx_new(&conn->ossl_ctx, NULL)) != 0) {
|
||||
log_err("doq: ngtcp2_crypto_ossl_ctx_new failed: %s",
|
||||
ngtcp2_strerror(ret));
|
||||
SSL_free(ssl);
|
||||
return NULL;
|
||||
}
|
||||
ngtcp2_crypto_ossl_ctx_set_ssl(conn->ossl_ctx, ssl);
|
||||
if(ngtcp2_crypto_ossl_configure_server_session(ssl) != 0) {
|
||||
log_err("doq: ngtcp2_crypto_ossl_configure_server_session failed");
|
||||
SSL_free(ssl);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
#if defined(USE_NGTCP2_CRYPTO_OSSL) || defined(HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_SERVER_CONTEXT)
|
||||
conn->conn_ref.get_conn = &doq_conn_ref_get_conn;
|
||||
conn->conn_ref.user_data = conn;
|
||||
SSL_set_app_data(ssl, &conn->conn_ref);
|
||||
|
|
@ -4717,7 +4772,11 @@ doq_ssl_server_setup(SSL_CTX* ctx, struct doq_conn* conn)
|
|||
SSL_set_app_data(ssl, conn);
|
||||
#endif
|
||||
SSL_set_accept_state(ssl);
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
SSL_set_quic_tls_early_data_enabled(ssl, 1);
|
||||
#else
|
||||
SSL_set_quic_early_data_enabled(ssl, 1);
|
||||
#endif
|
||||
return ssl;
|
||||
}
|
||||
|
||||
|
|
@ -4838,7 +4897,11 @@ doq_conn_setup(struct doq_conn* conn, uint8_t* scid, size_t scidlen,
|
|||
log_err("doq_ssl_server_setup failed");
|
||||
return 0;
|
||||
}
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
ngtcp2_conn_set_tls_native_handle(conn->conn, conn->ossl_ctx);
|
||||
#else
|
||||
ngtcp2_conn_set_tls_native_handle(conn->conn, conn->ssl);
|
||||
#endif
|
||||
doq_conn_write_enable(conn);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@
|
|||
#ifdef HAVE_NGTCP2
|
||||
#include <ngtcp2/ngtcp2.h>
|
||||
#include <ngtcp2/ngtcp2_crypto.h>
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
struct ngtcp2_crypto_ossl_ctx;
|
||||
#endif
|
||||
#endif
|
||||
struct listen_list;
|
||||
struct config_file;
|
||||
|
|
@ -606,9 +609,13 @@ struct doq_conn {
|
|||
uint8_t tls_alert;
|
||||
/** the ssl context, SSL* */
|
||||
void* ssl;
|
||||
#ifdef HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_SERVER_CONTEXT
|
||||
#if defined(USE_NGTCP2_CRYPTO_OSSL) || defined(HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_SERVER_CONTEXT)
|
||||
/** the connection reference for ngtcp2_conn and userdata in ssl */
|
||||
struct ngtcp2_crypto_conn_ref conn_ref;
|
||||
#endif
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
/** the per-connection state for ngtcp2_crypto_ossl */
|
||||
struct ngtcp2_crypto_ossl_ctx* ossl_ctx;
|
||||
#endif
|
||||
/** closure packet, if any */
|
||||
uint8_t* close_pkt;
|
||||
|
|
|
|||
|
|
@ -2220,3 +2220,35 @@ void local_zones_del_data(struct local_zones* zones,
|
|||
|
||||
lock_rw_unlock(&z->lock);
|
||||
}
|
||||
|
||||
/** Get memory usage for local_zone */
|
||||
static size_t
|
||||
local_zone_get_mem(struct local_zone* z)
|
||||
{
|
||||
size_t m = sizeof(*z);
|
||||
lock_rw_rdlock(&z->lock);
|
||||
m += z->namelen + z->taglen + regional_get_mem(z->region);
|
||||
lock_rw_unlock(&z->lock);
|
||||
return m;
|
||||
}
|
||||
|
||||
size_t local_zones_get_mem(struct local_zones* zones)
|
||||
{
|
||||
struct local_zone* z;
|
||||
size_t m;
|
||||
if(!zones) return 0;
|
||||
m = sizeof(*zones);
|
||||
lock_rw_rdlock(&zones->lock);
|
||||
RBTREE_FOR(z, struct local_zone*, &zones->ztree) {
|
||||
m += local_zone_get_mem(z);
|
||||
}
|
||||
lock_rw_unlock(&zones->lock);
|
||||
return m;
|
||||
}
|
||||
|
||||
void local_zones_swap_tree(struct local_zones* zones, struct local_zones* data)
|
||||
{
|
||||
rbtree_type oldtree = zones->ztree;
|
||||
zones->ztree = data->ztree;
|
||||
data->ztree = oldtree;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -642,6 +642,20 @@ local_zone_enter_rr(struct local_zone* z, uint8_t* nm, size_t nmlen,
|
|||
struct local_data*
|
||||
local_zone_find_data(struct local_zone* z, uint8_t* nm, size_t nmlen, int nmlabs);
|
||||
|
||||
/** Get memory usage for local_zones tree. The routine locks and unlocks
|
||||
* the tree for reading. */
|
||||
size_t local_zones_get_mem(struct local_zones* zones);
|
||||
|
||||
/**
|
||||
* Swap internal tree with preallocated entries. Caller should manage
|
||||
* the locks.
|
||||
* @param zones: the local zones structure.
|
||||
* @param data: the data structure used to take elements from. This contains
|
||||
* the old elements on return.
|
||||
*/
|
||||
void local_zones_swap_tree(struct local_zones* zones,
|
||||
struct local_zones* data);
|
||||
|
||||
/** Enter a new zone; returns with WRlock
|
||||
* Made public for unit testing
|
||||
* @param zones: the local zones tree
|
||||
|
|
|
|||
269
services/mesh.c
269
services/mesh.c
|
|
@ -78,6 +78,20 @@
|
|||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
/** Compare two views by name */
|
||||
static int
|
||||
view_name_compare(const char* v_a, const char* v_b)
|
||||
{
|
||||
if(v_a == NULL && v_b == NULL)
|
||||
return 0;
|
||||
/* The NULL name is smaller than if the name is set. */
|
||||
if(v_a == NULL)
|
||||
return -1;
|
||||
if(v_b == NULL)
|
||||
return 1;
|
||||
return strcmp(v_a, v_b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two response-ip client info entries for the purpose of mesh state
|
||||
* compare. It returns 0 if ci_a and ci_b are considered equal; otherwise
|
||||
|
|
@ -133,12 +147,14 @@ client_info_compare(const struct respip_client_info* ci_a,
|
|||
}
|
||||
if(ci_a->tag_datas != ci_b->tag_datas)
|
||||
return ci_a->tag_datas < ci_b->tag_datas ? -1 : 1;
|
||||
if(ci_a->view != ci_b->view)
|
||||
return ci_a->view < ci_b->view ? -1 : 1;
|
||||
/* For the unbound daemon these should be non-NULL and identical,
|
||||
* but we check that just in case. */
|
||||
if(ci_a->respip_set != ci_b->respip_set)
|
||||
return ci_a->respip_set < ci_b->respip_set ? -1 : 1;
|
||||
if(ci_a->view || ci_a->view_name || ci_b->view || ci_b->view_name) {
|
||||
/* Compare the views by name. */
|
||||
cmp = view_name_compare(
|
||||
(ci_a->view?ci_a->view->name:ci_a->view_name),
|
||||
(ci_b->view?ci_b->view->name:ci_b->view_name));
|
||||
if(cmp != 0)
|
||||
return cmp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -217,6 +233,7 @@ mesh_create(struct module_stack* stack, struct module_env* env)
|
|||
mesh->ans_cachedb = 0;
|
||||
mesh->num_queries_discard_timeout = 0;
|
||||
mesh->num_queries_wait_limit = 0;
|
||||
mesh->num_dns_error_reports = 0;
|
||||
mesh->max_reply_states = env->cfg->num_queries_per_thread;
|
||||
mesh->max_forever_states = (mesh->max_reply_states+1)/2;
|
||||
#ifndef S_SPLINT_S
|
||||
|
|
@ -871,6 +888,78 @@ void mesh_report_reply(struct mesh_area* mesh, struct outbound_entry* e,
|
|||
mesh_run(mesh, e->qstate->mesh_info, event, e);
|
||||
}
|
||||
|
||||
/** copy strlist to region */
|
||||
static struct config_strlist*
|
||||
cfg_region_strlist_copy(struct regional* region, struct config_strlist* list)
|
||||
{
|
||||
struct config_strlist* result = NULL, *last = NULL, *s = list;
|
||||
while(s) {
|
||||
struct config_strlist* n = regional_alloc_zero(region,
|
||||
sizeof(*n));
|
||||
if(!n)
|
||||
return NULL;
|
||||
n->str = regional_strdup(region, s->str);
|
||||
if(!n->str)
|
||||
return NULL;
|
||||
if(last)
|
||||
last->next = n;
|
||||
else result = n;
|
||||
last = n;
|
||||
s = s->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Copy the client info to the query region. */
|
||||
static struct respip_client_info*
|
||||
mesh_copy_client_info(struct regional* region, struct respip_client_info* cinfo)
|
||||
{
|
||||
size_t i;
|
||||
struct respip_client_info* client_info;
|
||||
client_info = regional_alloc_init(region, cinfo, sizeof(*cinfo));
|
||||
if(!client_info)
|
||||
return NULL;
|
||||
/* Copy the client_info so that if the configuration changes,
|
||||
* then the data stays valid. */
|
||||
if(cinfo->taglist) {
|
||||
client_info->taglist = regional_alloc_init(region, cinfo->taglist,
|
||||
cinfo->taglen);
|
||||
if(!client_info->taglist)
|
||||
return NULL;
|
||||
}
|
||||
if(cinfo->tag_actions) {
|
||||
client_info->tag_actions = regional_alloc_init(region, cinfo->tag_actions,
|
||||
cinfo->tag_actions_size);
|
||||
if(!client_info->tag_actions)
|
||||
return NULL;
|
||||
}
|
||||
if(cinfo->tag_datas) {
|
||||
client_info->tag_datas = regional_alloc_zero(region,
|
||||
sizeof(struct config_strlist*)*cinfo->tag_datas_size);
|
||||
if(!client_info->tag_datas)
|
||||
return NULL;
|
||||
for(i=0; i<cinfo->tag_datas_size; i++) {
|
||||
if(cinfo->tag_datas[i]) {
|
||||
client_info->tag_datas[i] = cfg_region_strlist_copy(
|
||||
region, cinfo->tag_datas[i]);
|
||||
if(!client_info->tag_datas[i])
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cinfo->view) {
|
||||
/* Do not copy the view pointer but store a name instead.
|
||||
* The name is looked up later when done, this means that
|
||||
* the view tree can be changed, by reloads. */
|
||||
client_info->view = NULL;
|
||||
client_info->view_name = regional_strdup(region,
|
||||
cinfo->view->name);
|
||||
if(!client_info->view_name)
|
||||
return NULL;
|
||||
}
|
||||
return client_info;
|
||||
}
|
||||
|
||||
struct mesh_state*
|
||||
mesh_state_create(struct module_env* env, struct query_info* qinfo,
|
||||
struct respip_client_info* cinfo, uint16_t qflags, int prime,
|
||||
|
|
@ -911,8 +1000,7 @@ mesh_state_create(struct module_env* env, struct query_info* qinfo,
|
|||
return NULL;
|
||||
}
|
||||
if(cinfo) {
|
||||
mstate->s.client_info = regional_alloc_init(region, cinfo,
|
||||
sizeof(*cinfo));
|
||||
mstate->s.client_info = mesh_copy_client_info(region, cinfo);
|
||||
if(!mstate->s.client_info) {
|
||||
alloc_reg_release(env->alloc, region);
|
||||
return NULL;
|
||||
|
|
@ -1492,10 +1580,121 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep,
|
|||
&r->query_reply.client_addr,
|
||||
r->query_reply.client_addrlen, duration, 0, r_buffer,
|
||||
(m->s.env->cfg->log_destaddr?(void*)r->query_reply.c->socket->addr:NULL),
|
||||
r->query_reply.c->type);
|
||||
r->query_reply.c->type, r->query_reply.c->ssl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the DNS Error Report (RFC9567).
|
||||
* If there is an EDE attached for this reply and there was a Report-Channel
|
||||
* EDNS0 option from the upstream, fire up a report query.
|
||||
* @param qstate: module qstate.
|
||||
* @param rep: prepared reply to be sent.
|
||||
*/
|
||||
static void dns_error_reporting(struct module_qstate* qstate,
|
||||
struct reply_info* rep)
|
||||
{
|
||||
struct query_info qinfo;
|
||||
struct mesh_state* sub;
|
||||
struct module_qstate* newq;
|
||||
uint8_t buf[LDNS_MAX_DOMAINLEN];
|
||||
size_t count = 0;
|
||||
int written;
|
||||
size_t expected_length;
|
||||
struct edns_option* opt;
|
||||
sldns_ede_code reason_bogus = LDNS_EDE_NONE;
|
||||
sldns_rr_type qtype = qstate->qinfo.qtype;
|
||||
uint8_t* qname = qstate->qinfo.qname;
|
||||
size_t qname_len = qstate->qinfo.qname_len-1; /* skip the trailing \0 */
|
||||
uint8_t* agent_domain;
|
||||
size_t agent_domain_len;
|
||||
|
||||
/* We need a valid reporting agent;
|
||||
* this is based on qstate->edns_opts_back_in that will probably have
|
||||
* the latest reporting agent we found while iterating */
|
||||
opt = edns_opt_list_find(qstate->edns_opts_back_in,
|
||||
LDNS_EDNS_REPORT_CHANNEL);
|
||||
if(!opt) return;
|
||||
agent_domain_len = opt->opt_len;
|
||||
agent_domain = opt->opt_data;
|
||||
if(dname_valid(agent_domain, agent_domain_len) < 3) {
|
||||
/* The agent domain needs to be a valid dname that is not the
|
||||
* root; from RFC9567. */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the EDE generated from the mesh state, these are mostly
|
||||
* validator errors. If other errors are produced in the future (e.g.,
|
||||
* RPZ) we would not want them to result in error reports. */
|
||||
reason_bogus = errinf_to_reason_bogus(qstate);
|
||||
if(rep && ((reason_bogus == LDNS_EDE_DNSSEC_BOGUS &&
|
||||
rep->reason_bogus != LDNS_EDE_NONE) ||
|
||||
reason_bogus == LDNS_EDE_NONE)) {
|
||||
reason_bogus = rep->reason_bogus;
|
||||
}
|
||||
if(reason_bogus == LDNS_EDE_NONE ||
|
||||
/* other, does not make sense without the text that comes
|
||||
* with it */
|
||||
reason_bogus == LDNS_EDE_OTHER) return;
|
||||
|
||||
/* Synthesize the error report query in the format:
|
||||
* "_er.$qtype.$qname.$ede._er.$reporting-agent-domain" */
|
||||
/* First check if the static length parts fit in the buffer.
|
||||
* That is everything except for qtype and ede that need to be
|
||||
* converted to decimal and checked further on. */
|
||||
expected_length = 4/*_er*/+qname_len+4/*_er*/+agent_domain_len;
|
||||
if(expected_length > LDNS_MAX_DOMAINLEN) goto skip;
|
||||
|
||||
memmove(buf+count, "\3_er", 4);
|
||||
count += 4;
|
||||
|
||||
written = snprintf((char*)buf+count, LDNS_MAX_DOMAINLEN-count,
|
||||
"X%d", qtype);
|
||||
expected_length += written;
|
||||
/* Skip on error, truncation or long expected length */
|
||||
if(written < 0 || (size_t)written >= LDNS_MAX_DOMAINLEN-count ||
|
||||
expected_length > LDNS_MAX_DOMAINLEN ) goto skip;
|
||||
/* Put in the label length */
|
||||
*(buf+count) = (char)(written - 1);
|
||||
count += written;
|
||||
|
||||
memmove(buf+count, qname, qname_len);
|
||||
count += qname_len;
|
||||
|
||||
written = snprintf((char*)buf+count, LDNS_MAX_DOMAINLEN-count,
|
||||
"X%d", reason_bogus);
|
||||
expected_length += written;
|
||||
/* Skip on error, truncation or long expected length */
|
||||
if(written < 0 || (size_t)written >= LDNS_MAX_DOMAINLEN-count ||
|
||||
expected_length > LDNS_MAX_DOMAINLEN ) goto skip;
|
||||
*(buf+count) = (char)(written - 1);
|
||||
count += written;
|
||||
|
||||
memmove(buf+count, "\3_er", 4);
|
||||
count += 4;
|
||||
|
||||
/* Copy the agent domain */
|
||||
memmove(buf+count, agent_domain, agent_domain_len);
|
||||
count += agent_domain_len;
|
||||
|
||||
qinfo.qname = buf;
|
||||
qinfo.qname_len = count;
|
||||
qinfo.qtype = LDNS_RR_TYPE_TXT;
|
||||
qinfo.qclass = qstate->qinfo.qclass;
|
||||
qinfo.local_alias = NULL;
|
||||
|
||||
log_query_info(VERB_ALGO, "DNS Error Reporting: generating report "
|
||||
"query for", &qinfo);
|
||||
if(mesh_add_sub(qstate, &qinfo, BIT_RD, 0, 0, &newq, &sub)) {
|
||||
qstate->env->mesh->num_dns_error_reports++;
|
||||
}
|
||||
return;
|
||||
skip:
|
||||
verbose(VERB_ALGO, "DNS Error Reporting: report query qname too long; "
|
||||
"skip");
|
||||
return;
|
||||
}
|
||||
|
||||
void mesh_query_done(struct mesh_state* mstate)
|
||||
{
|
||||
struct mesh_reply* r;
|
||||
|
|
@ -1544,6 +1743,9 @@ void mesh_query_done(struct mesh_state* mstate)
|
|||
}
|
||||
|
||||
}
|
||||
if(mstate->reply_list && mstate->s.env->cfg->dns_error_reporting)
|
||||
dns_error_reporting(&mstate->s, rep);
|
||||
|
||||
for(r = mstate->reply_list; r; r = r->next) {
|
||||
struct timeval old;
|
||||
timeval_subtract(&old, mstate->s.env->now_tv, &r->start_time);
|
||||
|
|
@ -1707,6 +1909,25 @@ struct mesh_state* mesh_area_find(struct mesh_area* mesh,
|
|||
return result;
|
||||
}
|
||||
|
||||
/** remove mesh state callback */
|
||||
int mesh_state_del_cb(struct mesh_state* s, mesh_cb_func_type cb, void* cb_arg)
|
||||
{
|
||||
struct mesh_cb* r, *prev = NULL;
|
||||
r = s->cb_list;
|
||||
while(r) {
|
||||
if(r->cb == cb && r->cb_arg == cb_arg) {
|
||||
/* Delete this entry. */
|
||||
/* It was allocated in the s.region, so no free. */
|
||||
if(prev) prev->next = r->next;
|
||||
else s->cb_list = r->next;
|
||||
return 1;
|
||||
}
|
||||
prev = r;
|
||||
r = r->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mesh_state_add_cb(struct mesh_state* s, struct edns_data* edns,
|
||||
sldns_buffer* buf, mesh_cb_func_type cb, void* cb_arg,
|
||||
uint16_t qid, uint16_t qflags)
|
||||
|
|
@ -2064,6 +2285,7 @@ mesh_stats_clear(struct mesh_area* mesh)
|
|||
timehist_clear(mesh->histogram);
|
||||
mesh->ans_secure = 0;
|
||||
mesh->ans_bogus = 0;
|
||||
mesh->val_ops = 0;
|
||||
mesh->ans_expired = 0;
|
||||
mesh->ans_cachedb = 0;
|
||||
memset(&mesh->ans_rcode[0], 0, sizeof(size_t)*UB_STATS_RCODE_NUM);
|
||||
|
|
@ -2071,6 +2293,7 @@ mesh_stats_clear(struct mesh_area* mesh)
|
|||
mesh->ans_nodata = 0;
|
||||
mesh->num_queries_discard_timeout = 0;
|
||||
mesh->num_queries_wait_limit = 0;
|
||||
mesh->num_dns_error_reports = 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
@ -2172,7 +2395,8 @@ apply_respip_action(struct module_qstate* qstate,
|
|||
return 1;
|
||||
|
||||
if(!respip_rewrite_reply(qinfo, cinfo, rep, encode_repp, actinfo,
|
||||
alias_rrset, 0, qstate->region, az, NULL))
|
||||
alias_rrset, 0, qstate->region, az, NULL, qstate->env->views,
|
||||
qstate->env->respip_set))
|
||||
return 0;
|
||||
|
||||
/* xxx_deny actions mean dropping the reply, unless the original reply
|
||||
|
|
@ -2247,7 +2471,8 @@ mesh_serve_expired_callback(void* arg)
|
|||
} else if(partial_rep &&
|
||||
!respip_merge_cname(partial_rep, &qstate->qinfo, msg->rep,
|
||||
qstate->client_info, must_validate, &encode_rep, qstate->region,
|
||||
qstate->env->auth_zones)) {
|
||||
qstate->env->auth_zones, qstate->env->views,
|
||||
qstate->env->respip_set)) {
|
||||
return;
|
||||
}
|
||||
if(!encode_rep || alias_rrset) {
|
||||
|
|
@ -2401,3 +2626,25 @@ int mesh_jostle_exceeded(struct mesh_area* mesh)
|
|||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void mesh_remove_callback(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
uint16_t qflags, mesh_cb_func_type cb, void* cb_arg)
|
||||
{
|
||||
struct mesh_state* s = NULL;
|
||||
s = mesh_area_find(mesh, NULL, qinfo, qflags&(BIT_RD|BIT_CD), 0, 0);
|
||||
if(!s) return;
|
||||
if(!mesh_state_del_cb(s, cb, cb_arg)) return;
|
||||
|
||||
/* It was in the list and removed. */
|
||||
log_assert(mesh->num_reply_addrs > 0);
|
||||
mesh->num_reply_addrs--;
|
||||
if(!s->reply_list && !s->cb_list) {
|
||||
/* was a reply state, not anymore */
|
||||
log_assert(mesh->num_reply_states > 0);
|
||||
mesh->num_reply_states--;
|
||||
}
|
||||
if(!s->reply_list && !s->cb_list &&
|
||||
s->super_set.count == 0) {
|
||||
mesh->num_detached_states++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ struct mesh_area {
|
|||
size_t ans_secure;
|
||||
/** (extended stats) bogus replies */
|
||||
size_t ans_bogus;
|
||||
/** (extended stats) number of validation operations */
|
||||
size_t val_ops;
|
||||
/** (extended stats) rcodes in replies */
|
||||
size_t ans_rcode[UB_STATS_RCODE_NUM];
|
||||
/** (extended stats) rcode nodata in replies */
|
||||
|
|
@ -141,6 +143,8 @@ struct mesh_area {
|
|||
size_t num_queries_discard_timeout;
|
||||
/** stats, number of queries removed due to wait-limit */
|
||||
size_t num_queries_wait_limit;
|
||||
/** stats, number of dns error reports generated */
|
||||
size_t num_dns_error_reports;
|
||||
|
||||
/** backup of query if other operations recurse and need the
|
||||
* network buffers */
|
||||
|
|
@ -706,4 +710,17 @@ int mesh_jostle_exceeded(struct mesh_area* mesh);
|
|||
*/
|
||||
void mesh_respond_serve_expired(struct mesh_state* mstate);
|
||||
|
||||
/**
|
||||
* Remove callback from mesh. Removes the callback from the state.
|
||||
* The state itself is left to run. Searches for the pointer values.
|
||||
*
|
||||
* @param mesh: the mesh.
|
||||
* @param qinfo: query from client.
|
||||
* @param qflags: flags from client query.
|
||||
* @param cb: callback function.
|
||||
* @param cb_arg: callback user arg.
|
||||
*/
|
||||
void mesh_remove_callback(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
uint16_t qflags, mesh_cb_func_type cb, void* cb_arg);
|
||||
|
||||
#endif /* SERVICES_MESH_H */
|
||||
|
|
|
|||
|
|
@ -138,8 +138,8 @@ modstack_config(struct module_stack* stack, const char* module_conf)
|
|||
if(strchr(s, ' ')) *(strchr(s, ' ')) = 0;
|
||||
if(strchr(s, '\t')) *(strchr(s, '\t')) = 0;
|
||||
log_err("Unknown value in module-config, module: '%s'."
|
||||
" This module is not present (not compiled in),"
|
||||
" See the list of linked modules with unbound -V", s);
|
||||
" This module is not present (not compiled in);"
|
||||
" see the list of linked modules with unbound -V", s);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void modstack_init(struct module_stack* stack);
|
|||
void modstack_free(struct module_stack* stack);
|
||||
|
||||
/**
|
||||
* Initialises modules and assignes ids. Calls module_startup().
|
||||
* Initialises modules and assigns ids. Calls module_startup().
|
||||
* @param stack: Expected empty, filled according to module_conf
|
||||
* @param module_conf: string what modules to initialize
|
||||
* @param env: module environment which is inited by the modules.
|
||||
|
|
|
|||
|
|
@ -2848,7 +2848,7 @@ serviced_perturb_qname(struct ub_randstate* rnd, uint8_t* qbuf, size_t len)
|
|||
random = ub_random(rnd);
|
||||
bits = 30;
|
||||
}
|
||||
if(random & 0x1) {
|
||||
if((random & 0x1)) {
|
||||
*d = (uint8_t)toupper((unsigned char)*d);
|
||||
} else {
|
||||
*d = (uint8_t)tolower((unsigned char)*d);
|
||||
|
|
@ -2911,9 +2911,9 @@ serviced_encode(struct serviced_query* sq, sldns_buffer* buff, int with_edns)
|
|||
edns.opt_list_inplace_cb_out = NULL;
|
||||
edns.udp_size = serviced_query_udp_size(sq, sq->status);
|
||||
edns.bits = 0;
|
||||
if(sq->dnssec & EDNS_DO)
|
||||
if((sq->dnssec & EDNS_DO))
|
||||
edns.bits = EDNS_DO;
|
||||
if(sq->dnssec & BIT_CD)
|
||||
if((sq->dnssec & BIT_CD))
|
||||
LDNS_CD_SET(sldns_buffer_begin(buff));
|
||||
if (sq->ssl_upstream && sq->padding_block_size) {
|
||||
padding_option.opt_code = LDNS_EDNS_PADDING;
|
||||
|
|
|
|||
|
|
@ -2792,3 +2792,31 @@ void rpz_disable(struct rpz* r)
|
|||
return;
|
||||
r->disabled = 1;
|
||||
}
|
||||
|
||||
/** Get memory usage for clientip_synthesized_rrset. Ignores memory usage
|
||||
* of locks. */
|
||||
static size_t
|
||||
rpz_clientip_synthesized_set_get_mem(struct clientip_synthesized_rrset* set)
|
||||
{
|
||||
size_t m = sizeof(*set);
|
||||
lock_rw_rdlock(&set->lock);
|
||||
m += regional_get_mem(set->region);
|
||||
lock_rw_unlock(&set->lock);
|
||||
return m;
|
||||
}
|
||||
|
||||
size_t rpz_get_mem(struct rpz* r)
|
||||
{
|
||||
size_t m = sizeof(*r);
|
||||
if(r->taglist)
|
||||
m += r->taglistlen;
|
||||
if(r->log_name)
|
||||
m += strlen(r->log_name) + 1;
|
||||
m += regional_get_mem(r->region);
|
||||
m += local_zones_get_mem(r->local_zones);
|
||||
m += local_zones_get_mem(r->nsdname_zones);
|
||||
m += respip_set_get_mem(r->respip_set);
|
||||
m += rpz_clientip_synthesized_set_get_mem(r->client_set);
|
||||
m += rpz_clientip_synthesized_set_get_mem(r->ns_set);
|
||||
return m;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,4 +269,11 @@ void rpz_enable(struct rpz* r);
|
|||
*/
|
||||
void rpz_disable(struct rpz* r);
|
||||
|
||||
/**
|
||||
* Get memory usage of rpz. Caller must manage locks.
|
||||
* @param r: RPZ struct.
|
||||
* @return memory usage.
|
||||
*/
|
||||
size_t rpz_get_mem(struct rpz* r);
|
||||
|
||||
#endif /* SERVICES_RPZ_H */
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "services/view.h"
|
||||
#include "services/localzone.h"
|
||||
#include "util/config_file.h"
|
||||
#include "respip/respip.h"
|
||||
|
||||
int
|
||||
view_cmp(const void* v1, const void* v2)
|
||||
|
|
@ -66,11 +67,6 @@ views_create(void)
|
|||
return v;
|
||||
}
|
||||
|
||||
/* \noop (ignore this comment for doxygen)
|
||||
* This prototype is defined in in respip.h, but we want to avoid
|
||||
* unnecessary dependencies */
|
||||
void respip_set_delete(struct respip_set *set);
|
||||
|
||||
void
|
||||
view_delete(struct view* v)
|
||||
{
|
||||
|
|
@ -247,3 +243,38 @@ void views_print(struct views* v)
|
|||
/* TODO implement print */
|
||||
(void)v;
|
||||
}
|
||||
|
||||
size_t views_get_mem(struct views* vs)
|
||||
{
|
||||
struct view* v;
|
||||
size_t m;
|
||||
if(!vs) return 0;
|
||||
m = sizeof(struct views);
|
||||
lock_rw_rdlock(&vs->lock);
|
||||
RBTREE_FOR(v, struct view*, &vs->vtree) {
|
||||
m += view_get_mem(v);
|
||||
}
|
||||
lock_rw_unlock(&vs->lock);
|
||||
return m;
|
||||
}
|
||||
|
||||
size_t view_get_mem(struct view* v)
|
||||
{
|
||||
size_t m = sizeof(*v);
|
||||
lock_rw_rdlock(&v->lock);
|
||||
m += getmem_str(v->name);
|
||||
m += local_zones_get_mem(v->local_zones);
|
||||
m += respip_set_get_mem(v->respip_set);
|
||||
lock_rw_unlock(&v->lock);
|
||||
return m;
|
||||
}
|
||||
|
||||
void views_swap_tree(struct views* vs, struct views* data)
|
||||
{
|
||||
rbnode_type* oldroot = vs->vtree.root;
|
||||
size_t oldcount = vs->vtree.count;
|
||||
vs->vtree.root = data->vtree.root;
|
||||
vs->vtree.count = data->vtree.count;
|
||||
data->vtree.root = oldroot;
|
||||
data->vtree.count = oldcount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ struct respip_set;
|
|||
* Views storage, shared.
|
||||
*/
|
||||
struct views {
|
||||
/** lock on the view tree */
|
||||
/** lock on the view tree. When locking order, the views lock
|
||||
* is before the forwards,hints,anchors,localzones lock. */
|
||||
lock_rw_type lock;
|
||||
/** rbtree of struct view */
|
||||
rbtree_type vtree;
|
||||
|
|
@ -135,4 +136,27 @@ void views_print(struct views* v);
|
|||
*/
|
||||
struct view* views_find_view(struct views* vs, const char* name, int write);
|
||||
|
||||
/**
|
||||
* Calculate memory usage of views.
|
||||
* @param vs: the views tree. The routine locks and unlocks the structure
|
||||
* for reading.
|
||||
* @return memory in bytes.
|
||||
*/
|
||||
size_t views_get_mem(struct views* vs);
|
||||
|
||||
/**
|
||||
* Calculate memory usage of view.
|
||||
* @param v: the view. The routine locks and unlocks the structure for reading.
|
||||
* @return memory in bytes.
|
||||
*/
|
||||
size_t view_get_mem(struct view* v);
|
||||
|
||||
/**
|
||||
* Swap internal tree with preallocated entries. Caller should manage
|
||||
* the locks.
|
||||
* @param vs: views tree
|
||||
* @param data: preallocated information.
|
||||
*/
|
||||
void views_swap_tree(struct views* vs, struct views* data);
|
||||
|
||||
#endif /* SERVICES_VIEW_H */
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ uint16_t sldns_calc_keytag_raw(uint8_t* key, size_t keysize)
|
|||
size_t i;
|
||||
uint32_t ac32 = 0;
|
||||
for (i = 0; i < keysize; ++i) {
|
||||
ac32 += (i & 1) ? key[i] : key[i] << 8;
|
||||
ac32 += ((i & 1)) ? key[i] : key[i] << 8;
|
||||
}
|
||||
ac32 += (ac32 >> 16) & 0xFFFF;
|
||||
return (uint16_t) (ac32 & 0xFFFF);
|
||||
|
|
@ -272,7 +272,7 @@ sldns_key_buf2dsa_raw(unsigned char* key, size_t len)
|
|||
return NULL;
|
||||
}
|
||||
if (!DSA_set0_key(dsa, Y, NULL)) {
|
||||
/* QPG attached, cleaned up by DSA_fre() */
|
||||
/* QPG attached, cleaned up by DSA_free() */
|
||||
DSA_free(dsa);
|
||||
BN_free(Y);
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ static const sldns_rdf_type type_nsap_wireformat[] = {
|
|||
LDNS_RDF_TYPE_NSAP
|
||||
};
|
||||
static const sldns_rdf_type type_nsap_ptr_wireformat[] = {
|
||||
LDNS_RDF_TYPE_STR
|
||||
LDNS_RDF_TYPE_UNQUOTED
|
||||
};
|
||||
static const sldns_rdf_type type_sig_wireformat[] = {
|
||||
LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32,
|
||||
|
|
@ -86,7 +86,7 @@ static const sldns_rdf_type type_px_wireformat[] = {
|
|||
LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME
|
||||
};
|
||||
static const sldns_rdf_type type_gpos_wireformat[] = {
|
||||
LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR
|
||||
LDNS_RDF_TYPE_UNQUOTED, LDNS_RDF_TYPE_UNQUOTED, LDNS_RDF_TYPE_UNQUOTED
|
||||
};
|
||||
static const sldns_rdf_type type_aaaa_wireformat[] = { LDNS_RDF_TYPE_AAAA };
|
||||
static const sldns_rdf_type type_loc_wireformat[] = { LDNS_RDF_TYPE_LOC };
|
||||
|
|
@ -621,7 +621,7 @@ static sldns_rr_descriptor rdata_field_descriptors[] = {
|
|||
{(enum sldns_enum_rr_type)0, "TYPE260", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
|
||||
|
||||
/* 261 */
|
||||
{LDNS_RR_TYPE_RESINFO, "RESINFO", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 },
|
||||
{LDNS_RR_TYPE_RESINFO, "RESINFO", 1, 0, NULL, LDNS_RDF_TYPE_UNQUOTED, LDNS_RR_NO_COMPRESS, 0 },
|
||||
|
||||
/* split in array, no longer contiguous */
|
||||
|
||||
|
|
|
|||
|
|
@ -343,6 +343,9 @@ enum sldns_enum_rdf_type
|
|||
/** 8 * 8 bit hex numbers separated by dashes. For EUI64. */
|
||||
LDNS_RDF_TYPE_EUI64,
|
||||
|
||||
/** Character string without quotes. */
|
||||
LDNS_RDF_TYPE_UNQUOTED,
|
||||
|
||||
/** A non-zero sequence of US-ASCII letters and numbers in lower case.
|
||||
* For CAA.
|
||||
*/
|
||||
|
|
@ -440,6 +443,7 @@ enum sldns_enum_edns_option
|
|||
LDNS_EDNS_PADDING = 12, /* RFC7830 */
|
||||
LDNS_EDNS_EDE = 15, /* RFC8914 */
|
||||
LDNS_EDNS_CLIENT_TAG = 16, /* draft-bellis-dnsop-edns-tags-01 */
|
||||
LDNS_EDNS_REPORT_CHANNEL = 18, /* RFC9567 */
|
||||
LDNS_EDNS_UNBOUND_CACHEDB_TESTFRAME_TEST = 65534
|
||||
};
|
||||
typedef enum sldns_enum_edns_option sldns_edns_option;
|
||||
|
|
|
|||
|
|
@ -365,7 +365,8 @@ static int
|
|||
sldns_rdf_type_maybe_quoted(sldns_rdf_type rdf_type)
|
||||
{
|
||||
return rdf_type == LDNS_RDF_TYPE_STR ||
|
||||
rdf_type == LDNS_RDF_TYPE_LONG_STR;
|
||||
rdf_type == LDNS_RDF_TYPE_LONG_STR ||
|
||||
rdf_type == LDNS_RDF_TYPE_UNQUOTED;
|
||||
}
|
||||
|
||||
/** see if rdata is quoted */
|
||||
|
|
@ -856,7 +857,7 @@ rrinternal_parse_rdata(sldns_buffer* strbuf, char* token, size_t token_len,
|
|||
while (rdata_len && *rdata != 0) {
|
||||
uint8_t label_len;
|
||||
|
||||
if (*rdata & 0xC0)
|
||||
if ((*rdata & 0xC0))
|
||||
return LDNS_WIREPARSE_ERR_OK;
|
||||
|
||||
label_len = *rdata + 1;
|
||||
|
|
@ -1719,6 +1720,8 @@ int sldns_str2wire_rdf_buf(const char* str, uint8_t* rd, size_t* len,
|
|||
return sldns_str2wire_eui48_buf(str, rd, len);
|
||||
case LDNS_RDF_TYPE_EUI64:
|
||||
return sldns_str2wire_eui64_buf(str, rd, len);
|
||||
case LDNS_RDF_TYPE_UNQUOTED:
|
||||
return sldns_str2wire_unquoted_buf(str, rd, len);
|
||||
case LDNS_RDF_TYPE_TAG:
|
||||
return sldns_str2wire_tag_buf(str, rd, len);
|
||||
case LDNS_RDF_TYPE_LONG_STR:
|
||||
|
|
@ -2776,6 +2779,11 @@ int sldns_str2wire_eui64_buf(const char* str, uint8_t* rd, size_t* len)
|
|||
return LDNS_WIREPARSE_ERR_OK;
|
||||
}
|
||||
|
||||
int sldns_str2wire_unquoted_buf(const char* str, uint8_t* rd, size_t* len)
|
||||
{
|
||||
return sldns_str2wire_str_buf(str, rd, len);
|
||||
}
|
||||
|
||||
int sldns_str2wire_tag_buf(const char* str, uint8_t* rd, size_t* len)
|
||||
{
|
||||
size_t slen = strlen(str);
|
||||
|
|
|
|||
|
|
@ -551,6 +551,15 @@ int sldns_str2wire_eui48_buf(const char* str, uint8_t* rd, size_t* len);
|
|||
*/
|
||||
int sldns_str2wire_eui64_buf(const char* str, uint8_t* rd, size_t* len);
|
||||
|
||||
/**
|
||||
* Convert rdf of type LDNS_RDF_TYPE_UNQUOTED from string to wireformat.
|
||||
* @param str: the text to convert for this rdata element.
|
||||
* @param rd: rdata buffer for the wireformat.
|
||||
* @param len: length of rd buffer on input, used length on output.
|
||||
* @return 0 on success, error on failure.
|
||||
*/
|
||||
int sldns_str2wire_unquoted_buf(const char* str, uint8_t* rd, size_t* len);
|
||||
|
||||
/**
|
||||
* Convert rdf of type LDNS_RDF_TYPE_TAG from string to wireformat.
|
||||
* @param str: the text to convert for this rdata element.
|
||||
|
|
|
|||
|
|
@ -1344,6 +1344,8 @@ int sldns_wire2str_rdf_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen,
|
|||
return sldns_wire2str_eui48_scan(d, dlen, s, slen);
|
||||
case LDNS_RDF_TYPE_EUI64:
|
||||
return sldns_wire2str_eui64_scan(d, dlen, s, slen);
|
||||
case LDNS_RDF_TYPE_UNQUOTED:
|
||||
return sldns_wire2str_unquoted_scan(d, dlen, s, slen);
|
||||
case LDNS_RDF_TYPE_TAG:
|
||||
return sldns_wire2str_tag_scan(d, dlen, s, slen);
|
||||
case LDNS_RDF_TYPE_LONG_STR:
|
||||
|
|
@ -2047,6 +2049,26 @@ int sldns_wire2str_eui64_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
|
|||
return w;
|
||||
}
|
||||
|
||||
int sldns_wire2str_unquoted_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
|
||||
{
|
||||
int w = 0;
|
||||
size_t i, len;
|
||||
if(*dl < 1) return -1;
|
||||
len = **d;
|
||||
if(*dl < 1+len) return -1;
|
||||
(*d)++;
|
||||
(*dl)--;
|
||||
for(i=0; i<len; i++) {
|
||||
if(isspace((unsigned char)(*d)[i]) || (*d)[i] == '(' ||
|
||||
(*d)[i] == ')' || (*d)[i] == '\'')
|
||||
w += sldns_str_print(s, sl, "\\%c", (char)(*d)[i]);
|
||||
else w += str_char_print(s, sl, (*d)[i]);
|
||||
}
|
||||
(*d)+=len;
|
||||
(*dl)-=len;
|
||||
return w;
|
||||
}
|
||||
|
||||
int sldns_wire2str_tag_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
|
||||
{
|
||||
size_t i, n;
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ int sldns_wire2str_rdata_unknown_scan(uint8_t** data, size_t* data_len,
|
|||
* @param pkt: packet for decompression, if NULL no decompression.
|
||||
* @param pktlen: length of packet buffer.
|
||||
* @param comprloop: inout bool, that is set true if compression loop failure
|
||||
* happens. Pass in 0, if passsed in as true, a lower bound is set
|
||||
* happens. Pass in 0, if passed in as true, a lower bound is set
|
||||
* on compression loops to stop arbitrary long packet parse times.
|
||||
* This is meant so you can set it to 0 at the start of a list of dnames,
|
||||
* and then scan all of them in sequence, if a loop happens, it becomes
|
||||
|
|
@ -919,6 +919,19 @@ int sldns_wire2str_eui48_scan(uint8_t** data, size_t* data_len, char** str,
|
|||
int sldns_wire2str_eui64_scan(uint8_t** data, size_t* data_len, char** str,
|
||||
size_t* str_len);
|
||||
|
||||
/**
|
||||
* Scan wireformat UNQUOTED field to string, with user buffers.
|
||||
* It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
|
||||
* @param data: wireformat data.
|
||||
* @param data_len: length of data buffer.
|
||||
* @param str: string buffer.
|
||||
* @param str_len: length of string buffer.
|
||||
* @return number of characters (except null) needed to print.
|
||||
* Can return -1 on failure.
|
||||
*/
|
||||
int sldns_wire2str_unquoted_scan(uint8_t** data, size_t* data_len, char** str,
|
||||
size_t* str_len);
|
||||
|
||||
/**
|
||||
* Scan wireformat TAG field to string, with user buffers.
|
||||
* It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ read_cert_file(const char* file)
|
|||
STACK_OF(X509)* sk;
|
||||
FILE* in;
|
||||
int content = 0;
|
||||
char buf[128];
|
||||
long flen;
|
||||
if(file == NULL || strcmp(file, "") == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -399,6 +399,11 @@ read_cert_file(const char* file)
|
|||
#endif
|
||||
return NULL;
|
||||
}
|
||||
if(fseek(in, 0, SEEK_END) < 0)
|
||||
printf("%s fseek: %s\n", file, strerror(errno));
|
||||
flen = ftell(in);
|
||||
if(fseek(in, 0, SEEK_SET) < 0)
|
||||
printf("%s fseek: %s\n", file, strerror(errno));
|
||||
while(!feof(in)) {
|
||||
X509* x = PEM_read_X509(in, NULL, NULL, NULL);
|
||||
if(x == NULL) {
|
||||
|
|
@ -414,8 +419,9 @@ read_cert_file(const char* file)
|
|||
exit(0);
|
||||
}
|
||||
content = 1;
|
||||
/* read away newline after --END CERT-- */
|
||||
if(!fgets(buf, (int)sizeof(buf), in))
|
||||
/* feof may not be true yet, but if the position is
|
||||
* at end of file, stop reading more certificates. */
|
||||
if(ftell(in) == flen)
|
||||
break;
|
||||
}
|
||||
fclose(in);
|
||||
|
|
|
|||
|
|
@ -294,7 +294,8 @@ view_and_respipchecks(struct config_file* cfg)
|
|||
{
|
||||
struct views* views = NULL;
|
||||
struct respip_set* respip = NULL;
|
||||
int ignored = 0;
|
||||
int have_view_respip_cfg = 0;
|
||||
int use_response_ip = 0;
|
||||
if(!(views = views_create()))
|
||||
fatal_exit("Could not create views: out of memory");
|
||||
if(!(respip = respip_set_create()))
|
||||
|
|
@ -303,8 +304,11 @@ view_and_respipchecks(struct config_file* cfg)
|
|||
fatal_exit("Could not set up views");
|
||||
if(!respip_global_apply_cfg(respip, cfg))
|
||||
fatal_exit("Could not setup respip set");
|
||||
if(!respip_views_apply_cfg(views, cfg, &ignored))
|
||||
if(!respip_views_apply_cfg(views, cfg, &have_view_respip_cfg))
|
||||
fatal_exit("Could not setup per-view respip sets");
|
||||
use_response_ip = !respip_set_is_empty(respip) || have_view_respip_cfg;
|
||||
if(use_response_ip && !strstr(cfg->module_conf, "respip"))
|
||||
fatal_exit("response-ip options require respip module");
|
||||
acl_view_tag_checks(cfg, views);
|
||||
views_delete(views);
|
||||
respip_set_delete(respip);
|
||||
|
|
@ -450,6 +454,39 @@ ifautomaticportschecks(char* ifautomaticports)
|
|||
}
|
||||
}
|
||||
|
||||
/** check control interface strings */
|
||||
static void
|
||||
controlinterfacechecks(struct config_file* cfg)
|
||||
{
|
||||
struct config_strlist* p;
|
||||
for(p = cfg->control_ifs.first; p; p = p->next) {
|
||||
struct sockaddr_storage a;
|
||||
socklen_t alen;
|
||||
char** rcif = NULL;
|
||||
int i, num_rcif = 0;
|
||||
/* See if it is a local socket, starts with a '/'. */
|
||||
if(p->str && p->str[0] == '/')
|
||||
continue;
|
||||
if(!resolve_interface_names(&p->str, 1, NULL, &rcif,
|
||||
&num_rcif)) {
|
||||
fatal_exit("could not resolve interface names, for control-interface: %s",
|
||||
p->str);
|
||||
}
|
||||
for(i=0; i<num_rcif; i++) {
|
||||
if(!extstrtoaddr(rcif[i], &a, &alen,
|
||||
cfg->control_port)) {
|
||||
if(strcmp(p->str, rcif[i])!=0)
|
||||
fatal_exit("cannot parse control-interface address '%s' from the control-interface specified as '%s'",
|
||||
rcif[i], p->str);
|
||||
else
|
||||
fatal_exit("cannot parse control-interface specified as '%s'",
|
||||
p->str);
|
||||
}
|
||||
}
|
||||
config_del_strarray(rcif, num_rcif);
|
||||
}
|
||||
}
|
||||
|
||||
/** check acl ips */
|
||||
static void
|
||||
aclchecks(struct config_file* cfg)
|
||||
|
|
@ -636,8 +673,10 @@ check_modules_exist(const char* module_conf)
|
|||
}
|
||||
n[j] = s[j];
|
||||
}
|
||||
fatal_exit("module_conf lists module '%s' but that "
|
||||
"module is not available.", n);
|
||||
fatal_exit("Unknown value in module-config, module: "
|
||||
"'%s'. This module is not present (not "
|
||||
"compiled in); see the list of linked modules "
|
||||
"with unbound -V", n);
|
||||
}
|
||||
s += strlen(names[i]);
|
||||
}
|
||||
|
|
@ -926,6 +965,8 @@ morechecks(struct config_file* cfg)
|
|||
fatal_exit("control-cert-file: \"%s\" does not exist",
|
||||
cfg->control_cert_file);
|
||||
}
|
||||
if(cfg->remote_control_enable)
|
||||
controlinterfacechecks(cfg);
|
||||
|
||||
donotquerylocalhostcheck(cfg);
|
||||
localzonechecks(cfg);
|
||||
|
|
@ -966,6 +1007,8 @@ check_auth(struct config_file* cfg)
|
|||
if(!az || !auth_zones_apply_cfg(az, cfg, 0, &is_rpz, NULL, NULL)) {
|
||||
fatal_exit("Could not setup authority zones");
|
||||
}
|
||||
if(is_rpz && !strstr(cfg->module_conf, "respip"))
|
||||
fatal_exit("RPZ requires the respip module");
|
||||
auth_zones_delete(az);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,6 +109,16 @@ usage(void)
|
|||
printf(" That means the caches sizes and\n");
|
||||
printf(" the number of threads must not\n");
|
||||
printf(" change between reloads.\n");
|
||||
printf(" fast_reload [+dpv] reloads the server but only briefly stops\n");
|
||||
printf(" server processing, keeps cache, and changes\n");
|
||||
printf(" most options; check unbound-control(8).\n");
|
||||
printf(" +d drops running queries to keep consistency\n");
|
||||
printf(" on changed options while reloading.\n");
|
||||
printf(" +p does not pause threads for even faster\n");
|
||||
printf(" reload but less options are supported\n");
|
||||
printf(" ; check unbound-control(8).\n");
|
||||
printf(" +v verbose output, it will include duration needed.\n");
|
||||
printf(" +vv more verbose output, it will include memory needed.\n");
|
||||
printf(" stats print statistics\n");
|
||||
printf(" stats_noreset peek at statistics\n");
|
||||
#ifdef HAVE_SHMGET
|
||||
|
|
@ -234,12 +244,13 @@ static void pr_stats(const char* nm, struct ub_stats_info* s)
|
|||
PR_UL_NM("num.expired", s->svr.ans_expired);
|
||||
PR_UL_NM("num.recursivereplies", s->mesh_replies_sent);
|
||||
#ifdef USE_DNSCRYPT
|
||||
PR_UL_NM("num.dnscrypt.crypted", s->svr.num_query_dnscrypt_crypted);
|
||||
PR_UL_NM("num.dnscrypt.cert", s->svr.num_query_dnscrypt_cert);
|
||||
PR_UL_NM("num.dnscrypt.cleartext", s->svr.num_query_dnscrypt_cleartext);
|
||||
PR_UL_NM("num.dnscrypt.malformed",
|
||||
s->svr.num_query_dnscrypt_crypted_malformed);
|
||||
PR_UL_NM("num.dnscrypt.crypted", s->svr.num_query_dnscrypt_crypted);
|
||||
PR_UL_NM("num.dnscrypt.cert", s->svr.num_query_dnscrypt_cert);
|
||||
PR_UL_NM("num.dnscrypt.cleartext", s->svr.num_query_dnscrypt_cleartext);
|
||||
PR_UL_NM("num.dnscrypt.malformed",
|
||||
s->svr.num_query_dnscrypt_crypted_malformed);
|
||||
#endif /* USE_DNSCRYPT */
|
||||
PR_UL_NM("num.dns_error_reports", s->svr.num_dns_error_reports);
|
||||
printf("%s.requestlist.avg"SQ"%g\n", nm,
|
||||
(s->svr.num_queries_missed_cache+s->svr.num_queries_prefetch)?
|
||||
(double)s->svr.sum_query_list_size/
|
||||
|
|
@ -398,6 +409,7 @@ static void print_extended(struct ub_stats_info* s, int inhibit_zero)
|
|||
PR_UL("num.answer.secure", s->svr.ans_secure);
|
||||
PR_UL("num.answer.bogus", s->svr.ans_bogus);
|
||||
PR_UL("num.rrset.bogus", s->svr.rrset_bogus);
|
||||
PR_UL("num.valops", s->svr.val_ops);
|
||||
PR_UL("num.query.aggressive.NOERROR", s->svr.num_neg_cache_noerror);
|
||||
PR_UL("num.query.aggressive.NXDOMAIN", s->svr.num_neg_cache_nxdomain);
|
||||
/* threat detection */
|
||||
|
|
|
|||
|
|
@ -256,6 +256,20 @@ void dtio_mainfdcallback(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
|
|||
}
|
||||
#endif
|
||||
|
||||
void fast_reload_service_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
|
||||
void* ATTR_UNUSED(arg))
|
||||
{
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
int fast_reload_client_callback(struct comm_point* ATTR_UNUSED(c),
|
||||
void* ATTR_UNUSED(arg), int ATTR_UNUSED(error),
|
||||
struct comm_reply* ATTR_UNUSED(repinfo))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NGTCP2
|
||||
void doq_client_event_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
|
||||
void* ATTR_UNUSED(arg))
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ static int key_deleted = 0;
|
|||
static ub_thread_key_type thr_debug_key;
|
||||
/** the list of threads, so all threads can be examined. NULL if unused. */
|
||||
static struct thr_check* thread_infos[THRDEBUG_MAX_THREADS];
|
||||
/** stored maximum lock number for threads, when a thread is restarted the
|
||||
* number is kept track of, because the new locks get new id numbers. */
|
||||
static int thread_lockcount[THRDEBUG_MAX_THREADS];
|
||||
/** do we check locking order */
|
||||
int check_locking_order = 1;
|
||||
/** the pid of this runset, reasonably unique. */
|
||||
|
|
@ -698,10 +701,20 @@ open_lockorder(struct thr_check* thr)
|
|||
char buf[24];
|
||||
time_t t;
|
||||
snprintf(buf, sizeof(buf), "%s.%d", output_name, thr->num);
|
||||
thr->order_info = fopen(buf, "w");
|
||||
if(!thr->order_info)
|
||||
fatal_exit("could not open %s: %s", buf, strerror(errno));
|
||||
thr->locks_created = 0;
|
||||
thr->locks_created = thread_lockcount[thr->num];
|
||||
if(thr->locks_created == 0) {
|
||||
thr->order_info = fopen(buf, "w");
|
||||
if(!thr->order_info)
|
||||
fatal_exit("could not open %s: %s", buf, strerror(errno));
|
||||
} else {
|
||||
/* There is already a file to append on with the previous
|
||||
* thread information. */
|
||||
thr->order_info = fopen(buf, "a");
|
||||
if(!thr->order_info)
|
||||
fatal_exit("could not open for append %s: %s", buf, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
t = time(NULL);
|
||||
/* write: <time_stamp> <runpid> <thread_num> */
|
||||
if(fwrite(&t, sizeof(t), 1, thr->order_info) != 1 ||
|
||||
|
|
@ -728,6 +741,7 @@ static void* checklock_main(void* arg)
|
|||
if(check_locking_order)
|
||||
open_lockorder(thr);
|
||||
ret = thr->func(thr->arg);
|
||||
thread_lockcount[thr->num] = thr->locks_created;
|
||||
thread_infos[thr->num] = NULL;
|
||||
if(check_locking_order)
|
||||
fclose(thr->order_info);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ NEED_IPV6='fwd_ancil.tdir fwd_tcp_tc6.tdir stub_udp6.tdir edns_cache.tdir'
|
|||
NEED_NOMINGW='tcp_sigpipe.tdir 07-confroot.tdir 08-host-lib.tdir fwd_ancil.tdir'
|
||||
NEED_DNSCRYPT_PROXY='dnscrypt_queries.tdir dnscrypt_queries_chacha.tdir'
|
||||
NEED_UNSHARE='acl_interface.tdir proxy_protocol.tdir'
|
||||
NEED_REDIS_SERVER='redis_replica.tdir'
|
||||
|
||||
# test if dig and ldns-testns are available.
|
||||
test_tool_avail "dig"
|
||||
|
|
@ -52,6 +53,7 @@ for test in `ls -d *.tdir`; do
|
|||
skip_if_in_list $test "$NEED_WHOAMI" "whoami"
|
||||
skip_if_in_list $test "$NEED_DNSCRYPT_PROXY" "dnscrypt-proxy"
|
||||
skip_if_in_list $test "$NEED_UNSHARE" "unshare"
|
||||
skip_if_in_list $test "$NEED_REDIS_SERVER" "redis-server"
|
||||
|
||||
if echo $NEED_IPV6 | grep $test >/dev/null; then
|
||||
if test "$HAVE_IPV6" = no; then
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ static int http2_frame_recv_cb(nghttp2_session *session,
|
|||
}
|
||||
if(((frame->hd.type != NGHTTP2_DATA &&
|
||||
frame->hd.type != NGHTTP2_HEADERS) ||
|
||||
frame->hd.flags & NGHTTP2_FLAG_END_STREAM) &&
|
||||
(frame->hd.flags & NGHTTP2_FLAG_END_STREAM)) &&
|
||||
h2_stream->res_status == 200) {
|
||||
char* pktstr;
|
||||
sldns_buffer_flip(h2_stream->buf);
|
||||
|
|
|
|||
|
|
@ -48,10 +48,13 @@
|
|||
#ifdef HAVE_NGTCP2
|
||||
#include <ngtcp2/ngtcp2.h>
|
||||
#include <ngtcp2/ngtcp2_crypto.h>
|
||||
#ifdef HAVE_NGTCP2_NGTCP2_CRYPTO_QUICTLS_H
|
||||
#ifdef HAVE_NGTCP2_NGTCP2_CRYPTO_OSSL_H
|
||||
#include <ngtcp2/ngtcp2_crypto_ossl.h>
|
||||
#elif defined(HAVE_NGTCP2_NGTCP2_CRYPTO_QUICTLS_H)
|
||||
#include <ngtcp2/ngtcp2_crypto_quictls.h>
|
||||
#else
|
||||
#elif defined(HAVE_NGTCP2_NGTCP2_CRYPTO_OPENSSL_H)
|
||||
#include <ngtcp2/ngtcp2_crypto_openssl.h>
|
||||
#define MAKE_QUIC_METHOD 1
|
||||
#endif
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/rand.h>
|
||||
|
|
@ -107,9 +110,13 @@ struct doq_client_data {
|
|||
SSL_CTX* ctx;
|
||||
/** SSL object */
|
||||
SSL* ssl;
|
||||
#ifdef HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT
|
||||
#if defined(USE_NGTCP2_CRYPTO_OSSL) || defined(HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT)
|
||||
/** the connection reference for ngtcp2_conn and userdata in ssl */
|
||||
struct ngtcp2_crypto_conn_ref conn_ref;
|
||||
#endif
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
/** the per-connection state for ngtcp2_crypto_ossl */
|
||||
struct ngtcp2_crypto_ossl_ctx* ossl_ctx;
|
||||
#endif
|
||||
/** the quic version to use */
|
||||
uint32_t quic_version;
|
||||
|
|
@ -197,11 +204,12 @@ struct doq_client_stream {
|
|||
int query_is_done;
|
||||
};
|
||||
|
||||
#ifndef HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT
|
||||
#ifdef MAKE_QUIC_METHOD
|
||||
/** the quic method struct, must remain valid during the QUIC connection. */
|
||||
static SSL_QUIC_METHOD quic_method;
|
||||
#endif
|
||||
|
||||
#if defined(USE_NGTCP2_CRYPTO_OSSL) || defined(HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT)
|
||||
/** Get the connection ngtcp2_conn from the ssl app data
|
||||
* ngtcp2_crypto_conn_ref */
|
||||
static ngtcp2_conn* conn_ref_get_conn(ngtcp2_crypto_conn_ref* conn_ref)
|
||||
|
|
@ -210,11 +218,12 @@ static ngtcp2_conn* conn_ref_get_conn(ngtcp2_crypto_conn_ref* conn_ref)
|
|||
conn_ref->user_data;
|
||||
return data->conn;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
set_app_data(SSL* ssl, struct doq_client_data* data)
|
||||
{
|
||||
#ifdef HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT
|
||||
#if defined(USE_NGTCP2_CRYPTO_OSSL) || defined(HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT)
|
||||
data->conn_ref.get_conn = &conn_ref_get_conn;
|
||||
data->conn_ref.user_data = data;
|
||||
SSL_set_app_data(ssl, &data->conn_ref);
|
||||
|
|
@ -227,7 +236,7 @@ static struct doq_client_data*
|
|||
get_app_data(SSL* ssl)
|
||||
{
|
||||
struct doq_client_data* data;
|
||||
#ifdef HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT
|
||||
#if defined(USE_NGTCP2_CRYPTO_OSSL) || defined(HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT)
|
||||
data = (struct doq_client_data*)((struct ngtcp2_crypto_conn_ref*)
|
||||
SSL_get_app_data(ssl))->user_data;
|
||||
#else
|
||||
|
|
@ -893,7 +902,7 @@ handshake_completed(ngtcp2_conn* ATTR_UNUSED(conn), void* user_data)
|
|||
verbose(1, "early data was accepted by the server");
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT
|
||||
#if defined(USE_NGTCP2_CRYPTO_OSSL) || defined(HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT)
|
||||
if(data->transport_file) {
|
||||
early_data_write_transport(data);
|
||||
}
|
||||
|
|
@ -1207,7 +1216,7 @@ early_data_write_transport(struct doq_client_data* data)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifndef HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT
|
||||
#ifdef MAKE_QUIC_METHOD
|
||||
/** applicatation rx key callback, this is where the rx key is set,
|
||||
* and streams can be opened, like http3 unidirectional streams, like
|
||||
* the http3 control and http3 qpack encode and decoder streams. */
|
||||
|
|
@ -1317,7 +1326,7 @@ send_alert(SSL *ssl, enum ssl_encryption_level_t ATTR_UNUSED(level),
|
|||
data->tls_alert = alert;
|
||||
return 1;
|
||||
}
|
||||
#endif /* HAVE_NGTCP2_CRYPTO_QUICTLS_CONFIGURE_CLIENT_CONTEXT */
|
||||
#endif /* MAKE_QUIC_METHOD */
|
||||
|
||||
/** new session callback. We can write it to file for resumption later. */
|
||||
static int
|
||||
|
|
@ -1357,7 +1366,7 @@ ctx_client_setup(void)
|
|||
log_err("ngtcp2_crypto_quictls_configure_client_context failed");
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
#elif defined(MAKE_QUIC_METHOD)
|
||||
memset(&quic_method, 0, sizeof(quic_method));
|
||||
quic_method.set_encryption_secrets = &set_encryption_secrets;
|
||||
quic_method.add_handshake_data = &add_handshake_data;
|
||||
|
|
@ -1373,22 +1382,39 @@ ctx_client_setup(void)
|
|||
static SSL*
|
||||
ssl_client_setup(struct doq_client_data* data)
|
||||
{
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
int ret;
|
||||
#endif
|
||||
SSL* ssl = SSL_new(data->ctx);
|
||||
if(!ssl) {
|
||||
log_crypto_err("Could not SSL_new");
|
||||
exit(1);
|
||||
}
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
if((ret=ngtcp2_crypto_ossl_ctx_new(&data->ossl_ctx, NULL)) != 0) {
|
||||
log_err("ngtcp2_crypto_ossl_ctx_new failed: %s",
|
||||
ngtcp2_strerror(ret));
|
||||
exit(1);
|
||||
}
|
||||
ngtcp2_crypto_ossl_ctx_set_ssl(data->ossl_ctx, ssl);
|
||||
if(ngtcp2_crypto_ossl_configure_client_session(ssl) != 0) {
|
||||
log_err("ngtcp2_crypto_ossl_configure_client_session failed");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
set_app_data(ssl, data);
|
||||
SSL_set_connect_state(ssl);
|
||||
if(!SSL_set_fd(ssl, data->fd)) {
|
||||
log_crypto_err("Could not SSL_set_fd");
|
||||
exit(1);
|
||||
}
|
||||
#ifndef USE_NGTCP2_CRYPTO_OSSL
|
||||
if((data->quic_version & 0xff000000) == 0xff000000) {
|
||||
SSL_set_quic_use_legacy_codepoint(ssl, 1);
|
||||
} else {
|
||||
SSL_set_quic_use_legacy_codepoint(ssl, 0);
|
||||
}
|
||||
#endif
|
||||
SSL_set_alpn_protos(ssl, (const unsigned char *)"\x03""doq", 4);
|
||||
/* send the SNI host name */
|
||||
SSL_set_tlsext_host_name(ssl, "localhost");
|
||||
|
|
@ -2072,7 +2098,11 @@ early_data_setup_session(struct doq_client_data* data)
|
|||
SSL_SESSION_free(session);
|
||||
return 0;
|
||||
}
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
SSL_set_quic_tls_early_data_enabled(data->ssl, 1);
|
||||
#else
|
||||
SSL_set_quic_early_data_enabled(data->ssl, 1);
|
||||
#endif
|
||||
SSL_SESSION_free(session);
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -2221,6 +2251,15 @@ create_doq_client_data(const char* svr, int port, struct ub_event_base* base,
|
|||
data = calloc(1, sizeof(*data));
|
||||
if(!data) fatal_exit("calloc failed: out of memory");
|
||||
data->base = base;
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
/* Initialize the ossl crypto, it is harmless to call twice,
|
||||
* and this is before use of doq connections. */
|
||||
if(ngtcp2_crypto_ossl_init() != 0)
|
||||
fatal_exit("ngtcp2_crypto_oss_init failed");
|
||||
#elif defined(HAVE_NGTCP2_CRYPTO_QUICTLS_INIT)
|
||||
if(ngtcp2_crypto_quictls_init() != 0)
|
||||
fatal_exit("ngtcp2_crypto_quictls_init failed");
|
||||
#endif
|
||||
data->rnd = ub_initstate(NULL);
|
||||
if(!data->rnd) fatal_exit("ub_initstate failed: out of memory");
|
||||
data->svr = svr;
|
||||
|
|
@ -2255,7 +2294,11 @@ create_doq_client_data(const char* svr, int port, struct ub_event_base* base,
|
|||
SSL_CTX_sess_set_new_cb(data->ctx, new_session_cb);
|
||||
}
|
||||
data->ssl = ssl_client_setup(data);
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
ngtcp2_conn_set_tls_native_handle(data->conn, data->ossl_ctx);
|
||||
#else
|
||||
ngtcp2_conn_set_tls_native_handle(data->conn, data->ssl);
|
||||
#endif
|
||||
if(data->early_data_enabled)
|
||||
early_data_setup(data);
|
||||
|
||||
|
|
@ -2301,8 +2344,14 @@ delete_doq_client_data(struct doq_client_data* data)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
ngtcp2_conn_del(data->conn);
|
||||
/* Remove the app data from ngtcp2 before SSL_free of conn->ssl,
|
||||
* because the ngtcp2 conn is deleted. */
|
||||
SSL_set_app_data(data->ssl, NULL);
|
||||
SSL_free(data->ssl);
|
||||
#ifdef USE_NGTCP2_CRYPTO_OSSL
|
||||
ngtcp2_crypto_ossl_ctx_del(data->ossl_ctx);
|
||||
#endif
|
||||
ngtcp2_conn_del(data->conn);
|
||||
sldns_buffer_free(data->pkt_buf);
|
||||
sldns_buffer_free(data->blocked_pkt);
|
||||
if(data->fd != -1)
|
||||
|
|
@ -2699,3 +2748,17 @@ void dtio_mainfdcallback(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
|
|||
log_assert(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void fast_reload_service_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
|
||||
void* ATTR_UNUSED(arg))
|
||||
{
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
int fast_reload_client_callback(struct comm_point* ATTR_UNUSED(c),
|
||||
void* ATTR_UNUSED(arg), int ATTR_UNUSED(error),
|
||||
struct comm_reply* ATTR_UNUSED(repinfo))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -900,8 +900,10 @@ run_scenario(struct replay_runtime* runtime)
|
|||
runtime->now->evt_type == repevt_front_reply) {
|
||||
answer_check_it(runtime);
|
||||
advance_moment(runtime);
|
||||
} else if(pending_matches_range(runtime, &entry, &pending)) {
|
||||
answer_callback_from_entry(runtime, entry, pending);
|
||||
} else if(runtime->now && pending_matches_range(runtime,
|
||||
&entry, &pending)) {
|
||||
if(entry)
|
||||
answer_callback_from_entry(runtime, entry, pending);
|
||||
} else {
|
||||
do_moment_and_advance(runtime);
|
||||
}
|
||||
|
|
@ -1255,7 +1257,7 @@ struct serviced_query* outnet_serviced_query(struct outside_network* outnet,
|
|||
struct query_info* qinfo, uint16_t flags, int dnssec,
|
||||
int ATTR_UNUSED(want_dnssec), int ATTR_UNUSED(nocaps),
|
||||
int ATTR_UNUSED(check_ratelimit),
|
||||
int ATTR_UNUSED(tcp_upstream), int ATTR_UNUSED(ssl_upstream),
|
||||
int tcp_upstream, int ATTR_UNUSED(ssl_upstream),
|
||||
char* ATTR_UNUSED(tls_auth_name), struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t* zone, size_t zonelen,
|
||||
struct module_qstate* qstate, comm_point_callback_type* callback,
|
||||
|
|
@ -1275,7 +1277,7 @@ struct serviced_query* outnet_serviced_query(struct outside_network* outnet,
|
|||
(flags&~(BIT_RD|BIT_CD))?" MORE":"", (dnssec)?" DO":"");
|
||||
|
||||
/* create packet with EDNS */
|
||||
pend->buffer = sldns_buffer_new(512);
|
||||
pend->buffer = sldns_buffer_new(4096);
|
||||
log_assert(pend->buffer);
|
||||
sldns_buffer_write_u16(pend->buffer, 0); /* id */
|
||||
sldns_buffer_write_u16(pend->buffer, flags);
|
||||
|
|
@ -1335,7 +1337,13 @@ struct serviced_query* outnet_serviced_query(struct outside_network* outnet,
|
|||
edns.opt_list_in = NULL;
|
||||
edns.opt_list_out = per_upstream_opt_list;
|
||||
edns.opt_list_inplace_cb_out = NULL;
|
||||
attach_edns_record(pend->buffer, &edns);
|
||||
if(sldns_buffer_capacity(pend->buffer) >=
|
||||
sldns_buffer_limit(pend->buffer)
|
||||
+calc_edns_field_size(&edns)) {
|
||||
attach_edns_record(pend->buffer, &edns);
|
||||
} else {
|
||||
verbose(VERB_ALGO, "edns field too large to fit");
|
||||
}
|
||||
}
|
||||
memcpy(&pend->addr, addr, addrlen);
|
||||
pend->addrlen = addrlen;
|
||||
|
|
@ -1346,7 +1354,7 @@ struct serviced_query* outnet_serviced_query(struct outside_network* outnet,
|
|||
pend->callback = callback;
|
||||
pend->cb_arg = callback_arg;
|
||||
pend->timeout = UDP_AUTH_QUERY_TIMEOUT/1000;
|
||||
pend->transport = transport_udp; /* pretend UDP */
|
||||
pend->transport = tcp_upstream?transport_tcp:transport_udp;
|
||||
pend->pkt = NULL;
|
||||
pend->runtime = runtime;
|
||||
pend->serviced = 1;
|
||||
|
|
@ -1485,6 +1493,11 @@ size_t comm_point_get_mem(struct comm_point* ATTR_UNUSED(c))
|
|||
return 0;
|
||||
}
|
||||
|
||||
size_t comm_timer_get_mem(struct comm_timer* ATTR_UNUSED(timer))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t serviced_get_mem(struct serviced_query* ATTR_UNUSED(c))
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -1995,4 +2008,24 @@ void http2_stream_remove_mesh_state(struct http2_stream* ATTR_UNUSED(h2_stream))
|
|||
{
|
||||
}
|
||||
|
||||
void fast_reload_service_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(event),
|
||||
void* ATTR_UNUSED(arg))
|
||||
{
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
void fast_reload_thread_stop(
|
||||
struct fast_reload_thread* ATTR_UNUSED(fast_reload_thread))
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
int fast_reload_client_callback(struct comm_point* ATTR_UNUSED(c),
|
||||
void* ATTR_UNUSED(arg), int ATTR_UNUSED(error),
|
||||
struct comm_reply* ATTR_UNUSED(repinfo))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*********** End of Dummy routines ***********/
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ setup_ctx(char* key, char* cert)
|
|||
#if HAVE_DECL_SSL_CTX_SET_ECDH_AUTO
|
||||
if (!SSL_CTX_set_ecdh_auto(ctx,1))
|
||||
if(verb>=1) printf("failed to set_ecdh_auto, not enabling ECDHE\n");
|
||||
#elif defined(USE_ECDSA) && defined(HAVE_SSL_CTX_SET_TMP_ECDH)
|
||||
#elif defined(USE_ECDSA) && HAVE_DECL_SSL_CTX_SET_TMP_ECDH
|
||||
if(1) {
|
||||
EC_KEY *ecdh = EC_KEY_new_by_curve_name (NID_X9_62_prime256v1);
|
||||
if (!ecdh) {
|
||||
|
|
|
|||
|
|
@ -795,7 +795,7 @@ macro_expand(rbtree_type* store, struct replay_runtime* runtime, char** text)
|
|||
char buf[10240];
|
||||
char* at = *text;
|
||||
size_t len = macro_length(at);
|
||||
int dofunc = 0;
|
||||
int tries = 0, dofunc = 0;
|
||||
char* arithstart = NULL;
|
||||
if(len >= sizeof(buf))
|
||||
return NULL; /* too long */
|
||||
|
|
@ -834,6 +834,8 @@ macro_expand(rbtree_type* store, struct replay_runtime* runtime, char** text)
|
|||
/* actual macro text expansion */
|
||||
while(*at) {
|
||||
size_t remain = sizeof(buf)-strlen(buf);
|
||||
if(tries++ > 10000)
|
||||
return NULL; /* looks like got into an infinite loop, bail out */
|
||||
if(strncmp(at, "${", 2) == 0) {
|
||||
at = do_macro_recursion(store, runtime, at, remain);
|
||||
} else if(*at == '$') {
|
||||
|
|
|
|||
|
|
@ -293,6 +293,12 @@ setup_config(FILE* in, int* lineno, int* pass_argc, char* pass_argv[])
|
|||
fclose(cfg);
|
||||
return;
|
||||
}
|
||||
if(strncmp(parse, "fake-sha1: yes", 14) == 0) {
|
||||
/* Allow the use of SHA1 signatures for the test,
|
||||
* in case that OpenSSL disallows use of RSASHA1
|
||||
* with rh-allow-sha1-signatures disabled. */
|
||||
setenv("OPENSSL_ENABLE_SHA1_SIGNATURES", "1", 0);
|
||||
}
|
||||
fputs(line, cfg);
|
||||
}
|
||||
fatal_exit("No CONFIG_END in input file");
|
||||
|
|
@ -333,6 +339,35 @@ static void remove_configfile(void)
|
|||
cfgfiles = NULL;
|
||||
}
|
||||
|
||||
/** perform the playback on the playback_file with the args. */
|
||||
static int
|
||||
perform_playback(char* playback_file, int pass_argc, char** pass_argv)
|
||||
{
|
||||
struct replay_scenario* scen = NULL;
|
||||
int c, res;
|
||||
|
||||
/* setup test environment */
|
||||
scen = setup_playback(playback_file, &pass_argc, pass_argv);
|
||||
/* init fake event backend */
|
||||
fake_event_init(scen);
|
||||
|
||||
pass_argv[pass_argc] = NULL;
|
||||
echo_cmdline(pass_argc, pass_argv);
|
||||
|
||||
/* run the normal daemon */
|
||||
res = daemon_main(pass_argc, pass_argv);
|
||||
|
||||
fake_event_cleanup();
|
||||
for(c=1; c<pass_argc; c++)
|
||||
free(pass_argv[c]);
|
||||
return res;
|
||||
}
|
||||
|
||||
/* For fuzzing the main routine is replaced with
|
||||
* LLVMFuzzerTestOneInput. */
|
||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
#define main dummy_main
|
||||
#endif
|
||||
/**
|
||||
* Main fake event test program. Setup, teardown and report errors.
|
||||
* @param argc: arg count.
|
||||
|
|
@ -348,7 +383,6 @@ main(int argc, char* argv[])
|
|||
char* playback_file = NULL;
|
||||
int init_optind = optind;
|
||||
char* init_optarg = optarg;
|
||||
struct replay_scenario* scen = NULL;
|
||||
|
||||
/* we do not want the test to depend on the timezone */
|
||||
(void)putenv("TZ=UTC");
|
||||
|
|
@ -456,24 +490,11 @@ main(int argc, char* argv[])
|
|||
if(atexit(&remove_configfile) != 0)
|
||||
fatal_exit("atexit() failed: %s", strerror(errno));
|
||||
|
||||
/* setup test environment */
|
||||
scen = setup_playback(playback_file, &pass_argc, pass_argv);
|
||||
/* init fake event backend */
|
||||
fake_event_init(scen);
|
||||
|
||||
pass_argv[pass_argc] = NULL;
|
||||
echo_cmdline(pass_argc, pass_argv);
|
||||
|
||||
/* reset getopt processing */
|
||||
optind = init_optind;
|
||||
optarg = init_optarg;
|
||||
|
||||
/* run the normal daemon */
|
||||
res = daemon_main(pass_argc, pass_argv);
|
||||
|
||||
fake_event_cleanup();
|
||||
for(c=1; c<pass_argc; c++)
|
||||
free(pass_argv[c]);
|
||||
res = perform_playback(playback_file, pass_argc, pass_argv);
|
||||
if(res == 0) {
|
||||
log_info("Testbound Exit Success\n");
|
||||
/* remove configfile from here, the atexit() is for when
|
||||
|
|
@ -493,6 +514,101 @@ main(int argc, char* argv[])
|
|||
return res;
|
||||
}
|
||||
|
||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
static int delete_file(const char *pathname) {
|
||||
int ret = unlink(pathname);
|
||||
free((void *)pathname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *buf_to_file(const uint8_t *buf, size_t size) {
|
||||
int fd;
|
||||
size_t pos;
|
||||
char *pathname = strdup("/tmp/fuzz-XXXXXX");
|
||||
if (pathname == NULL)
|
||||
return NULL;
|
||||
|
||||
fd = mkstemp(pathname);
|
||||
if (fd == -1) {
|
||||
log_err("mkstemp of file %s failed: %s", pathname, strerror(errno));
|
||||
free(pathname);
|
||||
return NULL;
|
||||
}
|
||||
pos = 0;
|
||||
while (pos < size) {
|
||||
int nbytes = write(fd, &buf[pos], size - pos);
|
||||
if (nbytes <= 0) {
|
||||
if (nbytes == -1 && errno == EINTR)
|
||||
continue;
|
||||
log_err("write to file %s failed: %s", pathname, strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
pos += nbytes;
|
||||
}
|
||||
|
||||
if (close(fd) == -1) {
|
||||
log_err("close of file %s failed: %s", pathname, strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
|
||||
return pathname;
|
||||
err:
|
||||
delete_file(pathname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* based on main() above, but with: hard-coded passed args, file created from fuzz input */
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
||||
{
|
||||
int c, res;
|
||||
int pass_argc = 0;
|
||||
char* pass_argv[MAXARG];
|
||||
char* playback_file = NULL;
|
||||
|
||||
/* we do not want the test to depend on the timezone */
|
||||
(void)putenv("TZ=UTC");
|
||||
memset(pass_argv, 0, sizeof(pass_argv));
|
||||
#ifdef HAVE_SYSTEMD
|
||||
/* we do not want the test to use systemd daemon startup notification*/
|
||||
(void)unsetenv("NOTIFY_SOCKET");
|
||||
#endif /* HAVE_SYSTEMD */
|
||||
|
||||
checklock_start();
|
||||
log_init(NULL, 0, NULL);
|
||||
/* determine commandline options for the daemon */
|
||||
pass_argc = 1;
|
||||
pass_argv[0] = "unbound";
|
||||
add_opts("-d", &pass_argc, pass_argv);
|
||||
|
||||
playback_file = buf_to_file(Data, Size);
|
||||
if (playback_file) {
|
||||
log_info("Start of %s testbound program.", PACKAGE_STRING);
|
||||
|
||||
res = perform_playback(playback_file, pass_argc, pass_argv);
|
||||
if(res == 0) {
|
||||
log_info("Testbound Exit Success\n");
|
||||
/* remove configfile from here, the atexit() is for when
|
||||
* there is a crash to remove the tmpdir file.
|
||||
* This one removes the file while alloc and log locks are
|
||||
* still valid, and can be logged (for memory calculation),
|
||||
* it leaves the ptr NULL so the atexit does nothing. */
|
||||
remove_configfile();
|
||||
#ifdef HAVE_PTHREAD
|
||||
/* dlopen frees its thread state (dlopen of gost engine) */
|
||||
pthread_exit(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
delete_file(playback_file);
|
||||
}
|
||||
|
||||
if(log_get_lock()) {
|
||||
lock_basic_destroy((lock_basic_type*)log_get_lock());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
#endif /* FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */
|
||||
|
||||
/* fake remote control */
|
||||
struct listen_port* daemon_remote_open_ports(struct config_file*
|
||||
ATTR_UNUSED(cfg))
|
||||
|
|
@ -601,6 +717,17 @@ void listen_desetup_locks(void)
|
|||
/* nothing */
|
||||
}
|
||||
|
||||
void fast_reload_printq_list_delete(
|
||||
struct fast_reload_printq* ATTR_UNUSED(list))
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
void fast_reload_worker_pickup_changes(struct worker* ATTR_UNUSED(worker))
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
#ifdef HAVE_NGTCP2
|
||||
void* quic_sslctx_create(char* ATTR_UNUSED(key), char* ATTR_UNUSED(pem),
|
||||
char* ATTR_UNUSED(verifypem))
|
||||
|
|
|
|||
|
|
@ -923,10 +923,14 @@ pkt_snip_edns_option(uint8_t* pkt, size_t len, sldns_edns_option code,
|
|||
if(!pkt_find_edns_opt(&opt_position, &remaining)) return 0;
|
||||
if(remaining < 8) return -1; /* malformed */
|
||||
rdlen = sldns_read_uint16(opt_position+6);
|
||||
if(remaining < ((size_t)rdlen)+8)
|
||||
return -1; /* malformed */
|
||||
rdata = opt_position + 8;
|
||||
while(rdlen > 0) {
|
||||
if(rdlen < 4) return -1; /* malformed */
|
||||
optlen = sldns_read_uint16(rdata+2);
|
||||
if((size_t)rdlen < 4+((size_t)optlen))
|
||||
return -1; /* malformed */
|
||||
if(sldns_read_uint16(rdata) == code) {
|
||||
/* save data to buf for caller inspection */
|
||||
memmove(buf, rdata+4, optlen);
|
||||
|
|
@ -1134,8 +1138,9 @@ static void lowercase_dname(uint8_t** p, size_t* remain)
|
|||
while(**p != 0) {
|
||||
/* compressed? */
|
||||
if((**p & 0xc0) == 0xc0) {
|
||||
*p += 2;
|
||||
*remain -= 2;
|
||||
llen = *remain < 2 ? (unsigned int)*remain : 2;
|
||||
*p += llen;
|
||||
*remain -= llen;
|
||||
return;
|
||||
}
|
||||
llen = (unsigned int)**p;
|
||||
|
|
@ -1178,6 +1183,12 @@ static void lowercase_rdata(uint8_t** p, size_t* remain,
|
|||
uint8_t len;
|
||||
if(rdataremain == 0) return;
|
||||
len = **p;
|
||||
if(rdataremain < ((size_t)len)+1) {
|
||||
/* malformed LDNS_RDF_TYPE_STR, skip remainder */
|
||||
*p += rdataremain;
|
||||
*remain -= rdatalen;
|
||||
return;
|
||||
}
|
||||
*p += len+1;
|
||||
rdataremain -= len+1;
|
||||
} else {
|
||||
|
|
@ -1207,6 +1218,12 @@ static void lowercase_rdata(uint8_t** p, size_t* remain,
|
|||
break;
|
||||
default: error("bad rdf type in lowercase %d", (int)f);
|
||||
}
|
||||
if (rdataremain < (size_t)len) {
|
||||
/* malformed RDF, skip remainder */
|
||||
*p += rdataremain;
|
||||
*remain -= rdatalen;
|
||||
return;
|
||||
}
|
||||
*p += len;
|
||||
rdataremain -= len;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -670,6 +670,7 @@ authtest_addzone(struct auth_zones* az, const char* name, char* fname)
|
|||
auth_zone_set_zonefile(z, fname);
|
||||
z->for_upstream = 1;
|
||||
cfg = config_create();
|
||||
config_auto_slab_values(cfg);
|
||||
free(cfg->chrootdir);
|
||||
cfg->chrootdir = NULL;
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue