mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-11 14:54:27 -05:00
Merge branch 'master' into infra-keep-probing
Remade yacc and lex files.
This commit is contained in:
commit
4fe2122890
85 changed files with 5275 additions and 3858 deletions
105
Makefile.in
105
Makefile.in
|
|
@ -25,6 +25,7 @@ DNSTAP_SRC=@DNSTAP_SRC@
|
|||
DNSTAP_OBJ=@DNSTAP_OBJ@
|
||||
DNSCRYPT_SRC=@DNSCRYPT_SRC@
|
||||
DNSCRYPT_OBJ=@DNSCRYPT_OBJ@
|
||||
WITH_DYNLIBMODULE=@WITH_DYNLIBMODULE@
|
||||
WITH_PYTHONMODULE=@WITH_PYTHONMODULE@
|
||||
WITH_PYUNBOUND=@WITH_PYUNBOUND@
|
||||
PY_MAJOR_VERSION=@PY_MAJOR_VERSION@
|
||||
|
|
@ -87,6 +88,12 @@ LINTFLAGS+="-D__uint16_t=uint16_t" "-DEVP_PKEY_ASN1_METHOD=int" "-D_RuneLocale=i
|
|||
|
||||
INSTALL=$(SHELL) $(srcdir)/install-sh
|
||||
|
||||
DYNLIBMOD_SRC=dynlibmod/dynlibmod.c
|
||||
DYNLIBMOD_OBJ=@DYNLIBMOD_OBJ@
|
||||
DYNLIBMOD_HEADER=@DYNLIBMOD_HEADER@
|
||||
DYNLIBMOD_EXTRALIBS=@DYNLIBMOD_EXTRALIBS@
|
||||
|
||||
|
||||
#pythonmod.c is not here, it is mentioned by itself in its own rules,
|
||||
#makedepend fails on missing interface.h otherwise.
|
||||
PYTHONMOD_SRC=pythonmod/pythonmod_utils.c
|
||||
|
|
@ -140,7 +147,7 @@ autotrust.lo val_anchor.lo rpz.lo \
|
|||
validator.lo val_kcache.lo val_kentry.lo val_neg.lo val_nsec3.lo val_nsec.lo \
|
||||
val_secalgo.lo val_sigcrypt.lo val_utils.lo dns64.lo cachedb.lo redis.lo authzone.lo \
|
||||
$(SUBNET_OBJ) $(PYTHONMOD_OBJ) $(CHECKLOCK_OBJ) $(DNSTAP_OBJ) $(DNSCRYPT_OBJ) \
|
||||
$(IPSECMOD_OBJ) $(IPSET_OBJ) respip.lo
|
||||
$(IPSECMOD_OBJ) $(IPSET_OBJ) $(DYNLIBMOD_OBJ) respip.lo
|
||||
COMMON_OBJ_WITHOUT_UB_EVENT=$(COMMON_OBJ_WITHOUT_NETCALL) netevent.lo listen_dnsport.lo \
|
||||
outside_network.lo
|
||||
COMMON_OBJ=$(COMMON_OBJ_WITHOUT_UB_EVENT) ub_event.lo
|
||||
|
|
@ -333,13 +340,13 @@ libunbound.la: $(LIBUNBOUND_OBJ_LINK)
|
|||
$(LINK_LIB) $(UBSYMS) -o $@ $(LIBUNBOUND_OBJ_LINK) -rpath $(libdir) $(SSLLIB) $(LIBS)
|
||||
|
||||
unbound$(EXEEXT): $(DAEMON_OBJ_LINK) libunbound.la
|
||||
$(LINK) -o $@ $(DAEMON_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(DAEMON_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
unbound-checkconf$(EXEEXT): $(CHECKCONF_OBJ_LINK) libunbound.la
|
||||
$(LINK) -o $@ $(CHECKCONF_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(CHECKCONF_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
unbound-control$(EXEEXT): $(CONTROL_OBJ_LINK) libunbound.la
|
||||
$(LINK) -o $@ $(CONTROL_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(CONTROL_OBJ_LINK) $(EXTRALINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
unbound-host$(EXEEXT): $(HOST_OBJ_LINK) libunbound.la
|
||||
$(LINK) -o $@ $(HOST_OBJ_LINK) -L. -L.libs -lunbound $(SSLLIB) $(LIBS)
|
||||
|
|
@ -357,34 +364,34 @@ anchor-update$(EXEEXT): $(ANCHORUPD_OBJ_LINK) libunbound.la
|
|||
$(LINK) -o $@ $(ANCHORUPD_OBJ_LINK) -L. -L.libs -lunbound $(LIBS)
|
||||
|
||||
unittest$(EXEEXT): $(UNITTEST_OBJ_LINK)
|
||||
$(LINK) -o $@ $(UNITTEST_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(UNITTEST_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
testbound$(EXEEXT): $(TESTBOUND_OBJ_LINK)
|
||||
$(LINK) -o $@ $(TESTBOUND_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(TESTBOUND_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
lock-verify$(EXEEXT): $(LOCKVERIFY_OBJ_LINK)
|
||||
$(LINK) -o $@ $(LOCKVERIFY_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(LOCKVERIFY_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
petal$(EXEEXT): $(PETAL_OBJ_LINK)
|
||||
$(LINK) -o $@ $(PETAL_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
|
||||
pktview$(EXEEXT): $(PKTVIEW_OBJ_LINK)
|
||||
$(LINK) -o $@ $(PKTVIEW_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(PKTVIEW_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
memstats$(EXEEXT): $(MEMSTATS_OBJ_LINK)
|
||||
$(LINK) -o $@ $(MEMSTATS_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(MEMSTATS_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
asynclook$(EXEEXT): $(ASYNCLOOK_OBJ_LINK) libunbound.la
|
||||
$(LINK) -o $@ $(ASYNCLOOK_OBJ_LINK) -L. -L.libs -lunbound $(SSLLIB) $(LIBS)
|
||||
|
||||
streamtcp$(EXEEXT): $(STREAMTCP_OBJ_LINK)
|
||||
$(LINK) -o $@ $(STREAMTCP_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(STREAMTCP_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
perf$(EXEEXT): $(PERF_OBJ_LINK)
|
||||
$(LINK) -o $@ $(PERF_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(PERF_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
delayer$(EXEEXT): $(DELAYER_OBJ_LINK)
|
||||
$(LINK) -o $@ $(DELAYER_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(DELAYER_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
signit$(EXEEXT): testcode/signit.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) @PTHREAD_CFLAGS_ONLY@ -o $@ testcode/signit.c $(LDFLAGS) -lldns $(SSLLIB) $(LIBS)
|
||||
|
|
@ -407,7 +414,7 @@ dnstap/dnstap.pb-c.c dnstap/dnstap.pb-c.h: $(srcdir)/dnstap/dnstap.proto
|
|||
$(PROTOC_C) --c_out=. --proto_path=$(srcdir) $(srcdir)/dnstap/dnstap.proto
|
||||
|
||||
unbound-dnstap-socket$(EXEEXT): $(DNSTAP_SOCKET_OBJ_LINK)
|
||||
$(LINK) -o $@ $(DNSTAP_SOCKET_OBJ_LINK) $(SSLLIB) $(LIBS)
|
||||
$(LINK) -o $@ $(DNSTAP_SOCKET_OBJ_LINK) $(SSLLIB) $(LIBS) $(DYNLIBMOD_EXTRALIBS)
|
||||
|
||||
dnstap.pb-c.lo dnstap.pb-c.o: dnstap/dnstap.pb-c.c dnstap/dnstap.pb-c.h
|
||||
dtstream.lo dtstream.o: $(srcdir)/dnstap/dtstream.c config.h $(srcdir)/dnstap/dtstream.h
|
||||
|
|
@ -466,6 +473,7 @@ clean:
|
|||
rm -f unbound$(EXEEXT) unbound-checkconf$(EXEEXT) unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-anchor$(EXEEXT) unbound-control-setup libunbound.la unbound.h
|
||||
rm -f $(ALL_SRC:.c=.lint)
|
||||
rm -f _unbound.la libunbound/python/libunbound_wrap.c libunbound/python/unbound.py pythonmod/interface.h pythonmod/unboundmodule.py
|
||||
rm -f libunbound.a
|
||||
rm -rf autom4te.cache .libs build doc/html doc/xml
|
||||
|
||||
distclean: clean
|
||||
|
|
@ -640,6 +648,7 @@ depend:
|
|||
-e 's?$$(srcdir)/pythonmod/pythonmod.h?$$(PYTHONMOD_HEADER)?g' \
|
||||
-e 's?$$(srcdir)/edns-subnet/subnetmod.h $$(srcdir)/edns-subnet/subnet-whitelist.h $$(srcdir)/edns-subnet/edns-subnet.h $$(srcdir)/edns-subnet/addrtree.h?$$(SUBNET_HEADER)?g' \
|
||||
-e 's?$$(srcdir)/ipsecmod/ipsecmod.h $$(srcdir)/ipsecmod/ipsecmod-whitelist.h?$$(IPSECMOD_HEADER)?g' \
|
||||
-e 's?$$(srcdir)/dynlibmod/dynlibmod.h?$$(DYNLIBMOD_HEADER)?g' \
|
||||
-e 's!\(.*\)\.o[ :]*!\1.lo \1.o: !g' \
|
||||
> $(DEPEND_TMP)
|
||||
cp $(DEPEND_TARGET) $(DEPEND_TMP2)
|
||||
|
|
@ -807,12 +816,13 @@ modstack.lo modstack.o: $(srcdir)/services/modstack.c config.h $(srcdir)/service
|
|||
$(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
|
||||
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \
|
||||
$(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h \
|
||||
$(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/util/tube.h \
|
||||
$(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/rpz.h $(srcdir)/services/localzone.h \
|
||||
$(srcdir)/util/storage/dnstree.h $(srcdir)/services/view.h $(srcdir)/sldns/sbuffer.h \
|
||||
$(srcdir)/util/config_file.h $(srcdir)/services/authzone.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \
|
||||
$(srcdir)/libunbound/unbound.h $(srcdir)/respip/respip.h $(srcdir)/dns64/dns64.h $(srcdir)/iterator/iterator.h \
|
||||
$(srcdir)/services/outbound_list.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h
|
||||
$(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \
|
||||
$(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/dns64/dns64.h \
|
||||
$(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/validator/validator.h \
|
||||
$(srcdir)/validator/val_utils.h $(srcdir)/respip/respip.h $(srcdir)/services/localzone.h \
|
||||
$(srcdir)/util/storage/dnstree.h $(srcdir)/services/view.h $(PYTHONMOD_HEADER) $(srcdir)/ipsecmod/ipsecmod.h \
|
||||
$(srcdir)/util/storage/slabhash.h $(srcdir)/edns-subnet/addrtree.h $(srcdir)/edns-subnet/edns-subnet.h \
|
||||
$(srcdir)/ipset/ipset.h $(srcdir)/dynlibmod/dynlibmod.h
|
||||
view.lo view.o: $(srcdir)/services/view.c config.h $(srcdir)/services/view.h $(srcdir)/util/rbtree.h \
|
||||
$(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 \
|
||||
|
|
@ -897,21 +907,23 @@ authzone.lo authzone.o: $(srcdir)/services/authzone.c config.h $(srcdir)/service
|
|||
$(srcdir)/validator/val_secalgo.h
|
||||
fptr_wlist.lo fptr_wlist.o: $(srcdir)/util/fptr_wlist.c config.h $(srcdir)/util/fptr_wlist.h \
|
||||
$(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \
|
||||
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/module.h \
|
||||
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \
|
||||
$(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \
|
||||
$(srcdir)/services/modstack.h $(srcdir)/services/rpz.h $(srcdir)/services/localzone.h \
|
||||
$(srcdir)/util/storage/dnstree.h $(srcdir)/services/view.h $(srcdir)/sldns/sbuffer.h \
|
||||
$(srcdir)/util/config_file.h $(srcdir)/services/authzone.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \
|
||||
$(srcdir)/libunbound/unbound.h $(srcdir)/respip/respip.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \
|
||||
$(srcdir)/services/outside_network.h $(srcdir)/services/cache/infra.h \
|
||||
$(srcdir)/util/rtt.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/dns64/dns64.h \
|
||||
$(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_fwd.h \
|
||||
$(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_anchor.h \
|
||||
$(srcdir)/validator/val_nsec3.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)/util/alloc.h $(srcdir)/libunbound/unbound-event.h \
|
||||
$(srcdir)/libunbound/worker.h
|
||||
$(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/lruhash.h \
|
||||
$(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \
|
||||
$(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \
|
||||
$(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/mini_event.h \
|
||||
$(srcdir)/services/outside_network.h $(srcdir)/services/localzone.h \
|
||||
$(srcdir)/util/storage/dnstree.h $(srcdir)/services/view.h $(srcdir)/services/authzone.h \
|
||||
$(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/services/cache/rrset.h \
|
||||
$(srcdir)/util/storage/slabhash.h $(srcdir)/dns64/dns64.h $(srcdir)/iterator/iterator.h \
|
||||
$(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/validator/validator.h \
|
||||
$(srcdir)/validator/val_utils.h $(srcdir)/validator/val_anchor.h $(srcdir)/validator/val_nsec3.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)/util/alloc.h $(srcdir)/libunbound/unbound.h $(srcdir)/libunbound/unbound-event.h \
|
||||
$(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h $(srcdir)/respip/respip.h \
|
||||
$(PYTHONMOD_HEADER) $(srcdir)/ipsecmod/ipsecmod.h $(srcdir)/edns-subnet/subnetmod.h $(srcdir)/util/net_help.h \
|
||||
$(srcdir)/edns-subnet/addrtree.h $(srcdir)/edns-subnet/edns-subnet.h $(srcdir)/ipset/ipset.h \
|
||||
$(srcdir)/dynlibmod/dynlibmod.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 \
|
||||
|
|
@ -1119,7 +1131,32 @@ respip.lo respip.o: $(srcdir)/respip/respip.c config.h $(srcdir)/services/localz
|
|||
$(srcdir)/util/regional.h
|
||||
checklocks.lo checklocks.o: $(srcdir)/testcode/checklocks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
|
||||
$(srcdir)/testcode/checklocks.h
|
||||
dnstap.lo dnstap.o: $(srcdir)/dnstap/dnstap.c config.h $(srcdir)/sldns/sbuffer.h \
|
||||
$(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/util/netevent.h \
|
||||
$(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \
|
||||
$(srcdir)/util/locks.h $(srcdir)/dnstap/dnstap.h \
|
||||
dnstap/dnstap.pb-c.h
|
||||
dnstap.pb-c.lo dnstap.pb-c.o: dnstap/dnstap.pb-c.c dnstap/dnstap.pb-c.h \
|
||||
|
||||
dynlibmod.lo dynlibmod.o: $(srcdir)/dynlibmod/dynlibmod.c config.h $(srcdir)/dynlibmod/dynlibmod.h \
|
||||
$(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
|
||||
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \
|
||||
$(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/rbtree.h\
|
||||
$(srcdir)/util/storage/dnstree.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h \
|
||||
$(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/util/tube.h \
|
||||
$(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h \
|
||||
$(srcdir)/util/config_file.h $(srcdir)/services/cache/dns.h $(srcdir)/sldns/wire2str.h
|
||||
dnscrypt.lo dnscrypt.o: $(srcdir)/dnscrypt/dnscrypt.c config.h $(srcdir)/sldns/sbuffer.h \
|
||||
$(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/util/netevent.h \
|
||||
$(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \
|
||||
$(srcdir)/util/locks.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h \
|
||||
$(srcdir)/util/storage/lookup3.h
|
||||
ipsecmod.lo ipsecmod.o: $(srcdir)/ipsecmod/ipsecmod.c config.h
|
||||
ipset.lo ipset.o: $(srcdir)/ipset/ipset.c config.h $(srcdir)/ipset/ipset.h $(srcdir)/util/module.h \
|
||||
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \
|
||||
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
|
||||
$(srcdir)/sldns/rrdef.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/services/cache/dns.h \
|
||||
$(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/parseutil.h
|
||||
ipsecmod-whitelist.lo ipsecmod-whitelist.o: $(srcdir)/ipsecmod/ipsecmod-whitelist.c config.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 \
|
||||
|
|
|
|||
|
|
@ -866,6 +866,9 @@
|
|||
/* the version of the windows API enabled */
|
||||
#undef WINVER
|
||||
|
||||
/* Define if you want dynlib module. */
|
||||
#undef WITH_DYNLIBMODULE
|
||||
|
||||
/* Define if you want Python module. */
|
||||
#undef WITH_PYTHONMODULE
|
||||
|
||||
|
|
|
|||
60
configure
vendored
60
configure
vendored
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for unbound 1.10.1.
|
||||
# Generated by GNU Autoconf 2.69 for unbound 1.10.2.
|
||||
#
|
||||
# Report bugs to <unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues>.
|
||||
#
|
||||
|
|
@ -591,8 +591,8 @@ MAKEFLAGS=
|
|||
# Identity of this package.
|
||||
PACKAGE_NAME='unbound'
|
||||
PACKAGE_TARNAME='unbound'
|
||||
PACKAGE_VERSION='1.10.1'
|
||||
PACKAGE_STRING='unbound 1.10.1'
|
||||
PACKAGE_VERSION='1.10.2'
|
||||
PACKAGE_STRING='unbound 1.10.2'
|
||||
PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues'
|
||||
PACKAGE_URL=''
|
||||
|
||||
|
|
@ -700,6 +700,10 @@ PYTHON_LDFLAGS
|
|||
PYTHON_CPPFLAGS
|
||||
PYTHON
|
||||
PYTHON_VERSION
|
||||
DYNLIBMOD_EXTRALIBS
|
||||
DYNLIBMOD_HEADER
|
||||
DYNLIBMOD_OBJ
|
||||
WITH_DYNLIBMODULE
|
||||
PTHREAD_CFLAGS_ONLY
|
||||
PTHREAD_CFLAGS
|
||||
PTHREAD_LIBS
|
||||
|
|
@ -856,6 +860,7 @@ enable_alloc_nonregional
|
|||
with_pthreads
|
||||
with_solaris_threads
|
||||
with_syslog_facility
|
||||
with_dynlibmodule
|
||||
with_pyunbound
|
||||
with_pythonmodule
|
||||
enable_swig_version_check
|
||||
|
|
@ -1453,7 +1458,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.10.1 to adapt to many kinds of systems.
|
||||
\`configure' configures unbound 1.10.2 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
|
@ -1518,7 +1523,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of unbound 1.10.1:";;
|
||||
short | recursive ) echo "Configuration of unbound 1.10.2:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
|
@ -1618,6 +1623,8 @@ Optional Packages:
|
|||
--with-solaris-threads use solaris native thread library.
|
||||
--with-syslog-facility=LOCAL0 - LOCAL7
|
||||
set SYSLOG_FACILITY, default DAEMON
|
||||
--with-dynlibmodule build dynamic library module, or
|
||||
--without-dynlibmodule to disable it. (default=no)
|
||||
--with-pyunbound build PyUnbound, or --without-pyunbound to skip it.
|
||||
(default=no)
|
||||
--with-pythonmodule build Python module, or --without-pythonmodule to
|
||||
|
|
@ -1743,7 +1750,7 @@ fi
|
|||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
unbound configure 1.10.1
|
||||
unbound configure 1.10.2
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
|
|
@ -2452,7 +2459,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.10.1, which was
|
||||
It was created by unbound $as_me 1.10.2, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
|
|
@ -2804,11 +2811,11 @@ UNBOUND_VERSION_MAJOR=1
|
|||
|
||||
UNBOUND_VERSION_MINOR=10
|
||||
|
||||
UNBOUND_VERSION_MICRO=1
|
||||
UNBOUND_VERSION_MICRO=2
|
||||
|
||||
|
||||
LIBUNBOUND_CURRENT=9
|
||||
LIBUNBOUND_REVISION=8
|
||||
LIBUNBOUND_REVISION=9
|
||||
LIBUNBOUND_AGE=1
|
||||
# 1.0.0 had 0:12:0
|
||||
# 1.0.1 had 0:13:0
|
||||
|
|
@ -2884,6 +2891,7 @@ LIBUNBOUND_AGE=1
|
|||
# 1.9.6 had 9:6:1
|
||||
# 1.10.0 had 9:7:1
|
||||
# 1.10.1 had 9:8:1
|
||||
# 1.10.2 had 9:9:1
|
||||
|
||||
# Current -- the number of the binary API that we're implementing
|
||||
# Revision -- which iteration of the implementation of the binary
|
||||
|
|
@ -17188,6 +17196,34 @@ cat >>confdefs.h <<_ACEOF
|
|||
_ACEOF
|
||||
|
||||
|
||||
# Check for dynamic library module
|
||||
|
||||
# Check whether --with-dynlibmodule was given.
|
||||
if test "${with_dynlibmodule+set}" = set; then :
|
||||
withval=$with_dynlibmodule;
|
||||
else
|
||||
withval="no"
|
||||
fi
|
||||
|
||||
|
||||
if test x_$withval != x_no; then
|
||||
|
||||
$as_echo "#define WITH_DYNLIBMODULE 1" >>confdefs.h
|
||||
|
||||
WITH_DYNLIBMODULE=yes
|
||||
|
||||
DYNLIBMOD_OBJ="dynlibmod.lo"
|
||||
|
||||
DYNLIBMOD_HEADER='$(srcdir)/dynlibmod/dynlibmod.h'
|
||||
|
||||
if test $on_mingw = "no"; then
|
||||
DYNLIBMOD_EXTRALIBS="-ldl -export-dynamic"
|
||||
else
|
||||
DYNLIBMOD_EXTRALIBS="-Wl,--export-all-symbols,--out-implib,libunbound.a"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Check for PyUnbound
|
||||
|
||||
# Check whether --with-pyunbound was given.
|
||||
|
|
@ -21583,7 +21619,7 @@ _ACEOF
|
|||
|
||||
|
||||
|
||||
version=1.10.1
|
||||
version=1.10.2
|
||||
|
||||
date=`date +'%b %e, %Y'`
|
||||
|
||||
|
|
@ -22102,7 +22138,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.10.1, which was
|
||||
This file was extended by unbound $as_me 1.10.2, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
|
@ -22168,7 +22204,7 @@ _ACEOF
|
|||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
unbound config.status 1.10.1
|
||||
unbound config.status 1.10.2
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
|
|
|||
27
configure.ac
27
configure.ac
|
|
@ -11,14 +11,14 @@ sinclude(dnscrypt/dnscrypt.m4)
|
|||
# must be numbers. ac_defun because of later processing
|
||||
m4_define([VERSION_MAJOR],[1])
|
||||
m4_define([VERSION_MINOR],[10])
|
||||
m4_define([VERSION_MICRO],[1])
|
||||
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=8
|
||||
LIBUNBOUND_REVISION=9
|
||||
LIBUNBOUND_AGE=1
|
||||
# 1.0.0 had 0:12:0
|
||||
# 1.0.1 had 0:13:0
|
||||
|
|
@ -94,6 +94,7 @@ LIBUNBOUND_AGE=1
|
|||
# 1.9.6 had 9:6:1
|
||||
# 1.10.0 had 9:7:1
|
||||
# 1.10.1 had 9:8:1
|
||||
# 1.10.2 had 9:9:1
|
||||
|
||||
# Current -- the number of the binary API that we're implementing
|
||||
# Revision -- which iteration of the implementation of the binary
|
||||
|
|
@ -627,6 +628,28 @@ case "${UNBOUND_SYSLOG_FACILITY}" in
|
|||
esac
|
||||
AC_DEFINE_UNQUOTED(UB_SYSLOG_FACILITY,${UNBOUND_SYSLOG_FACILITY},[the SYSLOG_FACILITY to use, default LOG_DAEMON])
|
||||
|
||||
# Check for dynamic library module
|
||||
AC_ARG_WITH(dynlibmodule,
|
||||
AC_HELP_STRING([--with-dynlibmodule],
|
||||
[build dynamic library module, or --without-dynlibmodule to disable it. (default=no)]),
|
||||
[], [ withval="no" ])
|
||||
|
||||
if test x_$withval != x_no; then
|
||||
AC_DEFINE(WITH_DYNLIBMODULE, 1, [Define if you want dynlib module.])
|
||||
WITH_DYNLIBMODULE=yes
|
||||
AC_SUBST(WITH_DYNLIBMODULE)
|
||||
DYNLIBMOD_OBJ="dynlibmod.lo"
|
||||
AC_SUBST(DYNLIBMOD_OBJ)
|
||||
DYNLIBMOD_HEADER='$(srcdir)/dynlibmod/dynlibmod.h'
|
||||
AC_SUBST(DYNLIBMOD_HEADER)
|
||||
if test $on_mingw = "no"; then
|
||||
DYNLIBMOD_EXTRALIBS="-ldl -export-dynamic"
|
||||
else
|
||||
DYNLIBMOD_EXTRALIBS="-Wl,--export-all-symbols,--out-implib,libunbound.a"
|
||||
fi
|
||||
AC_SUBST(DYNLIBMOD_EXTRALIBS)
|
||||
fi
|
||||
|
||||
# Check for PyUnbound
|
||||
AC_ARG_WITH(pyunbound,
|
||||
AC_HELP_STRING([--with-pyunbound],
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ Index: trunk/doc/unbound.conf.5.in
|
|||
+This also causes an additional A query to be sent for each AAAA query.
|
||||
+This breaks DNSSEC!
|
||||
+.TP
|
||||
.B private\-address: \fI<IP address or subnet>
|
||||
Give IPv4 of IPv6 addresses or classless subnets. These are addresses
|
||||
on your private network, and are not allowed to be returned for
|
||||
.B aggressive\-nsec: \fI<yes or no>
|
||||
Aggressive NSEC uses the DNSSEC NSEC chain to synthesize NXDOMAIN
|
||||
and other denials, using information from previous NXDOMAINs answers.
|
||||
Index: trunk/iterator/iter_scrub.c
|
||||
===================================================================
|
||||
--- trunk/iterator/iter_scrub.c (revision 4357)
|
||||
|
|
@ -125,7 +125,7 @@ Index: trunk/iterator/iterator.c
|
|||
+ * ASN: This event state was added as an intermediary step between
|
||||
+ * QUERYTARGETS_STATE and the next step, in order to cast a subquery for the
|
||||
+ * purpose of caching A records for the queried name.
|
||||
+ *
|
||||
+ *
|
||||
+ * @param qstate: query state.
|
||||
+ * @param iq: iterator query state.
|
||||
+ * @param ie: iterator shared global environment.
|
||||
|
|
@ -147,9 +147,9 @@ Index: trunk/iterator/iterator.c
|
|||
+
|
||||
+ /* re-throw same query, but with a different type */
|
||||
+ if(!generate_sub_request(iq->qchase.qname,
|
||||
+ iq->qchase.qname_len, LDNS_RR_TYPE_A,
|
||||
+ iq->qchase.qname_len, LDNS_RR_TYPE_A,
|
||||
+ iq->qchase.qclass, qstate, id, iq,
|
||||
+ INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1)) {
|
||||
+ INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1, 0)) {
|
||||
+ log_nametypeclass(VERB_ALGO, "ASN-AAAA-filter: failed "
|
||||
+ "preloading of A record for",
|
||||
+ iq->qchase.qname, LDNS_RR_TYPE_A,
|
||||
|
|
@ -188,7 +188,7 @@ Index: trunk/iterator/iterator.c
|
|||
return 0;
|
||||
}
|
||||
|
||||
+/**
|
||||
+/**
|
||||
+ * ASN: Do final processing on responses to A queries originated from AAAA
|
||||
+ * queries. Events reach this state after the iterative resolution algorithm
|
||||
+ * terminates.
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ Name: unbound
|
|||
Description: Library with validating, recursive, and caching DNS resolver
|
||||
URL: http://www.unbound.net
|
||||
Version: @PACKAGE_VERSION@
|
||||
Requires: @PC_CRYPTO_DEPENDENCY@ @PC_LIBEVENT_DEPENDENCY@
|
||||
Requires.private: @PC_PY_DEPENDENCY@ @PC_LIBBSD_DEPENDENCY@
|
||||
Requires.private: @PC_PY_DEPENDENCY@ @PC_LIBBSD_DEPENDENCY@ @PC_CRYPTO_DEPENDENCY@ @PC_LIBEVENT_DEPENDENCY@
|
||||
Libs: -L${libdir} -lunbound
|
||||
Libs.private: @SSLLIB@ @LIBS@
|
||||
Cflags: -I${includedir}
|
||||
|
|
|
|||
|
|
@ -804,6 +804,9 @@ print_mem(RES* ssl, struct worker* worker, struct daemon* daemon,
|
|||
size_t dnscrypt_shared_secret = 0;
|
||||
size_t dnscrypt_nonce = 0;
|
||||
#endif /* USE_DNSCRYPT */
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
size_t dynlib = 0;
|
||||
#endif /* WITH_DYNLIBMODULE */
|
||||
msg = slabhash_get_mem(daemon->env->msg_cache);
|
||||
rrset = slabhash_get_mem(&daemon->env->rrset_cache->table);
|
||||
val = mod_get_mem(&worker->env, "validator");
|
||||
|
|
@ -822,6 +825,9 @@ print_mem(RES* ssl, struct worker* worker, struct daemon* daemon,
|
|||
dnscrypt_nonce = slabhash_get_mem(daemon->dnscenv->nonces_cache);
|
||||
}
|
||||
#endif /* USE_DNSCRYPT */
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
dynlib = mod_get_mem(&worker->env, "dynlib");
|
||||
#endif /* WITH_DYNLIBMODULE */
|
||||
|
||||
if(!print_longnum(ssl, "mem.cache.rrset"SQ, rrset))
|
||||
return 0;
|
||||
|
|
@ -849,6 +855,10 @@ print_mem(RES* ssl, struct worker* worker, struct daemon* daemon,
|
|||
dnscrypt_nonce))
|
||||
return 0;
|
||||
#endif /* USE_DNSCRYPT */
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
if(!print_longnum(ssl, "mem.mod.dynlibmod"SQ, dynlib))
|
||||
return 0;
|
||||
#endif /* WITH_DYNLIBMODULE */
|
||||
if(!print_longnum(ssl, "mem.streamwait"SQ,
|
||||
(size_t)s->svr.mem_stream_wait))
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,57 @@
|
|||
17 June 2020: Wouter
|
||||
- Fix default explanation in man page for qname-minimisation-strict.
|
||||
- Fix display of event loop method with libev.
|
||||
|
||||
8 June 2020: Wouter
|
||||
- Mention tls name possible when tls is enabled for stub-addr in the
|
||||
man page.
|
||||
|
||||
27 May 2020: George
|
||||
- Merge PR #241 by Robert Edmonds: contrib/libunbound.pc.in: Do not use
|
||||
"Requires:".
|
||||
|
||||
25 May 2020: George
|
||||
- Update contrib/aaaa-filter-iterator.patch for the recent
|
||||
generate_sub_request() change and to apply cleanly.
|
||||
|
||||
21 May 2020: George
|
||||
- Fix for integer overflow when printing RDF_TYPE_TIME.
|
||||
|
||||
19 May 2020: Wouter
|
||||
- CVE-2020-12662 Unbound can be tricked into amplifying an incoming
|
||||
query into a large number of queries directed to a target.
|
||||
- CVE-2020-12663 Malformed answers from upstream name servers can be
|
||||
used to make Unbound unresponsive.
|
||||
- Release 1.10.1 is 1.10.0 with fixes, code repository continues,
|
||||
including those fixes, towards the next release. Configure has
|
||||
version 1.10.2 version number in it.
|
||||
- For PR #93: windows compile warnings removal
|
||||
- windows compile warnings removal for ip dscp option code.
|
||||
- For PR #93: unit test for dynlib module.
|
||||
|
||||
18 May 2020: Wouter
|
||||
- For PR #93: dynlibmod can handle reloads and deinit and inits again,
|
||||
with dlclose and dlopen of the library again. Also for multiple
|
||||
modules. Fix memory leak by not closing dlopened content. Fix
|
||||
to allow one dynlibmod instance by unbound-checkconf.
|
||||
- For PR #93: checkconf allows multiple dynlib in module-config, for
|
||||
a couple cases.
|
||||
- For PR #93: checkconf allows python dynlib in module-config, for
|
||||
a couple cases.
|
||||
- For PR #93: man page spelling reference fix.
|
||||
- For PR #93: fix link of other executables for dynlibmod dependency.
|
||||
|
||||
15 May 2020: Wouter
|
||||
- Merge PR #93: Add dynamic library support.
|
||||
- Fixed conflicts for PR #93 and make configure, yacc, lex.
|
||||
- For PR #93: Fix warnings for dynlibmodule.
|
||||
|
||||
15 May 2020: Ralph
|
||||
- Cache ECS answers with longest scope of CNAME chain.
|
||||
|
||||
22 April 2020: George
|
||||
- Explicitly use 'rrset-roundrobin: no' for test cases.
|
||||
|
||||
21 April 2020: Wouter
|
||||
- Merge #225 from akhait: KSK-2010 has been revoked. It removes the
|
||||
KSK-2010 from the default list in unbound-anchor, now that the
|
||||
|
|
|
|||
|
|
@ -862,6 +862,17 @@ python:
|
|||
# Script file to load
|
||||
# python-script: "@UNBOUND_SHARE_DIR@/ubmodule-tst.py"
|
||||
|
||||
# Dynamic library config section. To enable:
|
||||
# o use --with-dynlibmodule to configure before compiling.
|
||||
# o list dynlib in the module-config string (above) to enable.
|
||||
# It can be placed anywhere, the dynlib module is only a very thin wrapper
|
||||
# to load modules dynamically.
|
||||
# o and give a dynlib-file to run. If more than one dynlib entry is listed in
|
||||
# the module-config then you need one dynlib-file per instance.
|
||||
dynlib:
|
||||
# Script file to load
|
||||
# dynlib-file: "@UNBOUND_SHARE_DIR@/dynlib.so"
|
||||
|
||||
# Remote control config section.
|
||||
remote-control:
|
||||
# Enable remote control with unbound-control(8) here.
|
||||
|
|
|
|||
|
|
@ -870,7 +870,7 @@ NXDOMAIN from a DNSSEC signed zone. Default is yes.
|
|||
QNAME minimisation in strict mode. Do not fall-back to sending full QNAME to
|
||||
potentially broken nameservers. A lot of domains will not be resolvable when
|
||||
this option in enabled. Only use if you know what you are doing.
|
||||
This option only has effect when qname-minimisation is enabled. Default is off.
|
||||
This option only has effect when qname-minimisation is enabled. Default is no.
|
||||
.TP
|
||||
.B aggressive\-nsec: \fI<yes or no>
|
||||
Aggressive NSEC uses the DNSSEC NSEC chain to synthesize NXDOMAIN
|
||||
|
|
@ -969,7 +969,9 @@ EDNS client subnet support the default is "subnetcache validator iterator".
|
|||
Most modules that need to be listed here have to be listed at the beginning
|
||||
of the line. The cachedb module has to be listed just before the iterator.
|
||||
The python module can be listed in different places, it then processes the
|
||||
output of the module it is just before.
|
||||
output of the module it is just before. The dynlib module can be listed pretty
|
||||
much anywhere, it is only a very thin wrapper that allows dynamic libraries to
|
||||
run in its place.
|
||||
.TP
|
||||
.B trust\-anchor\-file: \fI<filename>
|
||||
File with trusted keys for validation. Both DS and DNSKEY entries can appear
|
||||
|
|
@ -1618,6 +1620,9 @@ Name of stub zone nameserver. Is itself resolved before it is used.
|
|||
.B stub\-addr: \fI<IP address>
|
||||
IP address of stub zone nameserver. Can be IP 4 or IP 6.
|
||||
To use a nondefault port for DNS communication append '@' with the port number.
|
||||
If tls is enabled, then you can append a '#' and a name, then it'll check
|
||||
the tls authentication certificates with that name. If you combine
|
||||
the '@' and '#', the '@' comes first.
|
||||
.TP
|
||||
.B stub\-prime: \fI<yes or no>
|
||||
This option is by default no. If enabled it performs NS set priming,
|
||||
|
|
@ -1836,6 +1841,24 @@ directory.
|
|||
.B python\-script: \fI<python file>\fR
|
||||
The script file to load. Repeat this option for every python module instance
|
||||
added to the \fBmodule\-config:\fR option.
|
||||
.SS "Dynamic Library Module Options"
|
||||
.LP
|
||||
The
|
||||
.B dynlib:
|
||||
clause gives the settings for the \fIdynlib\fR module. This module is only
|
||||
a very small wrapper that allows dynamic modules to be loaded on runtime
|
||||
instead of being compiled into the application. To enable the dynlib module it
|
||||
has to be compiled into the daemon, and the word "dynlib" has to be put in the
|
||||
\fBmodule\-config:\fR option. Multiple instances of dynamic libraries are
|
||||
supported by adding the word "dynlib" more than once.
|
||||
.LP
|
||||
The \fBdynlib\-file:\fR path should be specified as an absolute path relative
|
||||
to the new path set by \fBchroot:\fR option, or as a relative path to the
|
||||
working directory.
|
||||
.TP
|
||||
.B dynlib\-file: \fI<dynlib file>\fR
|
||||
The dynamic library file to load. Repeat this option for every dynlib module
|
||||
instance added to the \fBmodule\-config:\fR option.
|
||||
.SS "DNS64 Module Options"
|
||||
.LP
|
||||
The dns64 module must be configured in the \fBmodule\-config:\fR "dns64
|
||||
|
|
|
|||
295
dynlibmod/dynlibmod.c
Normal file
295
dynlibmod/dynlibmod.c
Normal file
|
|
@ -0,0 +1,295 @@
|
|||
#include "config.h"
|
||||
#include "util/module.h"
|
||||
#include "util/config_file.h"
|
||||
#include "dynlibmod/dynlibmod.h"
|
||||
|
||||
#if HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#define __DYNMOD HMODULE
|
||||
#define __DYNSYM FARPROC
|
||||
#define __LOADSYM GetProcAddress
|
||||
void log_dlerror() {
|
||||
DWORD dwLastError = GetLastError();
|
||||
LPSTR MessageBuffer;
|
||||
DWORD dwBufferLength;
|
||||
DWORD dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM ;
|
||||
if((dwBufferLength = FormatMessageA(
|
||||
dwFormatFlags,
|
||||
NULL, // module to get message from (NULL == system)
|
||||
dwLastError,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
|
||||
(LPSTR) &MessageBuffer,
|
||||
0,
|
||||
NULL
|
||||
)))
|
||||
{
|
||||
log_err("dynlibmod: %s (%ld)", MessageBuffer, dwLastError);
|
||||
LocalFree(MessageBuffer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HMODULE open_library(const char* fname) {
|
||||
return LoadLibrary(fname);
|
||||
}
|
||||
|
||||
void close_library(const char* fname, __DYNMOD handle) {
|
||||
(void)fname;
|
||||
(void)handle;
|
||||
}
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#define __DYNMOD void*
|
||||
#define __DYNSYM void*
|
||||
#define __LOADSYM dlsym
|
||||
void log_dlerror() {
|
||||
log_err("dynlibmod: %s", dlerror());
|
||||
}
|
||||
|
||||
void* open_library(const char* fname) {
|
||||
return dlopen(fname, RTLD_LAZY | RTLD_GLOBAL);
|
||||
}
|
||||
|
||||
void close_library(const char* fname, __DYNMOD handle) {
|
||||
if(!handle) return;
|
||||
if(dlclose(handle) != 0) {
|
||||
log_err("dlclose %s: %s", fname, strerror(errno));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/** module counter for multiple dynlib modules */
|
||||
static int dynlib_mod_count = 0;
|
||||
|
||||
/** dynlib module init */
|
||||
int dynlibmod_init(struct module_env* env, int id) {
|
||||
int dynlib_mod_idx = dynlib_mod_count++;
|
||||
struct config_strlist* cfg_item = env->cfg->dynlib_file;
|
||||
struct dynlibmod_env* de = (struct dynlibmod_env*)calloc(1, sizeof(struct dynlibmod_env));
|
||||
__DYNMOD dynamic_library;
|
||||
if (!de)
|
||||
{
|
||||
log_err("dynlibmod[%d]: malloc failure", dynlib_mod_idx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
env->modinfo[id] = (void*) de;
|
||||
|
||||
de->fname = NULL;
|
||||
for(int i = dynlib_mod_idx;
|
||||
i != 0 && cfg_item != NULL;
|
||||
i--, cfg_item = cfg_item->next) {}
|
||||
|
||||
if (cfg_item == NULL || cfg_item->str == NULL || cfg_item->str[0] == 0) {
|
||||
log_err("dynlibmod[%d]: no dynamic library given.", dynlib_mod_idx);
|
||||
return 0;
|
||||
} else {
|
||||
de->fname = cfg_item->str;
|
||||
}
|
||||
verbose(VERB_ALGO, "dynlibmod[%d]: Trying to load library %s", dynlib_mod_idx, de->fname);
|
||||
dynamic_library = open_library(de->fname);
|
||||
de->dynamic_library = (void*)dynamic_library;
|
||||
if (dynamic_library == NULL) {
|
||||
log_dlerror();
|
||||
log_err("dynlibmod[%d]: unable to load dynamic library \"%s\".", dynlib_mod_idx, de->fname);
|
||||
return 0;
|
||||
} else {
|
||||
__DYNSYM initializer;
|
||||
__DYNSYM deinitializer;
|
||||
__DYNSYM operate;
|
||||
__DYNSYM inform;
|
||||
__DYNSYM clear;
|
||||
__DYNSYM get_mem;
|
||||
initializer = __LOADSYM(dynamic_library,"init");
|
||||
if (initializer == NULL) {
|
||||
log_dlerror();
|
||||
log_err("dynlibmod[%d]: unable to load init procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
|
||||
return 0;
|
||||
} else {
|
||||
de->func_init = (func_init_t)(void*)initializer;
|
||||
}
|
||||
deinitializer = __LOADSYM(dynamic_library,"deinit");
|
||||
if (deinitializer == NULL) {
|
||||
log_dlerror();
|
||||
log_err("dynlibmod[%d]: unable to load deinit procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
|
||||
return 0;
|
||||
} else {
|
||||
de->func_deinit = (func_deinit_t)(void*)deinitializer;
|
||||
}
|
||||
operate = __LOADSYM(dynamic_library,"operate");
|
||||
if (operate == NULL) {
|
||||
log_dlerror();
|
||||
log_err("dynlibmod[%d]: unable to load operate procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
|
||||
return 0;
|
||||
} else {
|
||||
de->func_operate = (func_operate_t)(void*)operate;
|
||||
}
|
||||
inform = __LOADSYM(dynamic_library,"inform_super");
|
||||
if (inform == NULL) {
|
||||
log_dlerror();
|
||||
log_err("dynlibmod[%d]: unable to load inform_super procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
|
||||
return 0;
|
||||
} else {
|
||||
de->func_inform = (func_inform_t)(void*)inform;
|
||||
}
|
||||
clear = __LOADSYM(dynamic_library,"clear");
|
||||
if (clear == NULL) {
|
||||
log_dlerror();
|
||||
log_err("dynlibmod[%d]: unable to load clear procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
|
||||
return 0;
|
||||
} else {
|
||||
de->func_clear = (func_clear_t)(void*)clear;
|
||||
}
|
||||
get_mem = __LOADSYM(dynamic_library,"get_mem");
|
||||
if (get_mem == NULL) {
|
||||
log_dlerror();
|
||||
log_err("dynlibmod[%d]: unable to load get_mem procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
|
||||
return 0;
|
||||
} else {
|
||||
de->func_get_mem = (func_get_mem_t)(void*)get_mem;
|
||||
}
|
||||
}
|
||||
de->inplace_cb_delete_wrapped = &inplace_cb_delete_wrapped;
|
||||
de->inplace_cb_register_wrapped = &inplace_cb_register_wrapped;
|
||||
return de->func_init(env, id);
|
||||
}
|
||||
|
||||
/** dynlib module deinit */
|
||||
void dynlibmod_deinit(struct module_env* env, int id) {
|
||||
struct dynlibmod_env* de = env->modinfo[id];
|
||||
if(de == NULL)
|
||||
return;
|
||||
de->func_deinit(env, id);
|
||||
close_library(de->fname, (__DYNMOD)de->dynamic_library);
|
||||
dynlib_mod_count--;
|
||||
de->fname = NULL;
|
||||
free(de);
|
||||
}
|
||||
|
||||
/** dynlib module operate on a query */
|
||||
void dynlibmod_operate(struct module_qstate* qstate, enum module_ev event,
|
||||
int id, struct outbound_entry* outbound) {
|
||||
struct dynlibmod_env* de = qstate->env->modinfo[id];
|
||||
|
||||
de->func_operate(qstate, event, id, outbound);
|
||||
}
|
||||
|
||||
/** dynlib module */
|
||||
void dynlibmod_inform_super(struct module_qstate* qstate, int id,
|
||||
struct module_qstate* super) {
|
||||
struct dynlibmod_env* de = qstate->env->modinfo[id];
|
||||
|
||||
de->func_inform(qstate, id, super);
|
||||
}
|
||||
|
||||
/** dynlib module cleanup query state */
|
||||
void dynlibmod_clear(struct module_qstate* qstate, int id) {
|
||||
struct dynlibmod_env* de = qstate->env->modinfo[id];
|
||||
|
||||
de->func_clear(qstate, id);
|
||||
}
|
||||
|
||||
/** dynlib module alloc size routine */
|
||||
size_t dynlibmod_get_mem(struct module_env* env, int id) {
|
||||
struct dynlibmod_env* de = (struct dynlibmod_env*)env->modinfo[id];
|
||||
size_t size;
|
||||
verbose(VERB_ALGO, "dynlibmod: get_mem, id: %d, de:%p", id, de);
|
||||
if(!de)
|
||||
return 0;
|
||||
|
||||
size = de->func_get_mem(env, id);
|
||||
return size + sizeof(*de);
|
||||
}
|
||||
|
||||
int dynlib_inplace_cb_reply_generic(struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct edns_option** opt_list_out,
|
||||
struct comm_reply* repinfo, struct regional* region, int id,
|
||||
void* callback) {
|
||||
struct cb_pair* cb_pair = (struct cb_pair*) callback;
|
||||
return ((inplace_cb_reply_func_type*) cb_pair->cb)(qinfo, qstate, rep, rcode, edns, opt_list_out, repinfo, region, id, cb_pair->cb_arg);
|
||||
}
|
||||
|
||||
int dynlib_inplace_cb_query_generic(struct query_info* qinfo, uint16_t flags,
|
||||
struct module_qstate* qstate, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t* zone, size_t zonelen, struct regional* region,
|
||||
int id, void* callback) {
|
||||
struct cb_pair* cb_pair = (struct cb_pair*) callback;
|
||||
return ((inplace_cb_query_func_type*) cb_pair->cb)(qinfo, flags, qstate, addr, addrlen, zone, zonelen, region, id, cb_pair->cb_arg);
|
||||
}
|
||||
|
||||
int dynlib_inplace_cb_edns_back_parsed(struct module_qstate* qstate,
|
||||
int id, void* cb_args) {
|
||||
struct cb_pair* cb_pair = (struct cb_pair*) cb_args;
|
||||
return ((inplace_cb_edns_back_parsed_func_type*) cb_pair->cb)(qstate, id, cb_pair->cb_arg);
|
||||
}
|
||||
|
||||
int dynlib_inplace_cb_query_response(struct module_qstate* qstate,
|
||||
struct dns_msg* response, int id, void* cb_args) {
|
||||
struct cb_pair* cb_pair = (struct cb_pair*) cb_args;
|
||||
return ((inplace_cb_query_response_func_type*) cb_pair->cb)(qstate, response, id, cb_pair->cb_arg);
|
||||
}
|
||||
|
||||
int
|
||||
inplace_cb_register_wrapped(void* cb, enum inplace_cb_list_type type, void* cbarg,
|
||||
struct module_env* env, int id) {
|
||||
struct cb_pair* cb_pair = malloc(sizeof(struct cb_pair));
|
||||
cb_pair->cb = cb;
|
||||
cb_pair->cb_arg = cbarg;
|
||||
if(type >= inplace_cb_reply && type <= inplace_cb_reply_servfail) {
|
||||
return inplace_cb_register(&dynlib_inplace_cb_reply_generic, type, (void*) cb_pair, env, id);
|
||||
} else if(type == inplace_cb_query) {
|
||||
return inplace_cb_register(&dynlib_inplace_cb_query_generic, type, (void*) cb_pair, env, id);
|
||||
} else if(type == inplace_cb_query_response) {
|
||||
return inplace_cb_register(&dynlib_inplace_cb_query_response, type, (void*) cb_pair, env, id);
|
||||
} else if(type == inplace_cb_edns_back_parsed) {
|
||||
return inplace_cb_register(&dynlib_inplace_cb_edns_back_parsed, type, (void*) cb_pair, env, id);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
inplace_cb_delete_wrapped(struct module_env* env, enum inplace_cb_list_type type,
|
||||
int id) {
|
||||
struct inplace_cb* temp = env->inplace_cb_lists[type];
|
||||
struct inplace_cb* prev = NULL;
|
||||
|
||||
while(temp) {
|
||||
if(temp->id == id) {
|
||||
if(!prev) {
|
||||
env->inplace_cb_lists[type] = temp->next;
|
||||
free(temp->cb_arg);
|
||||
free(temp);
|
||||
temp = env->inplace_cb_lists[type];
|
||||
}
|
||||
else {
|
||||
prev->next = temp->next;
|
||||
free(temp->cb_arg);
|
||||
free(temp);
|
||||
temp = prev->next;
|
||||
}
|
||||
}
|
||||
else {
|
||||
prev = temp;
|
||||
temp = temp->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The module function block
|
||||
*/
|
||||
static struct module_func_block dynlibmod_block = {
|
||||
"dynlib",
|
||||
&dynlibmod_init, &dynlibmod_deinit, &dynlibmod_operate, &dynlibmod_inform_super,
|
||||
&dynlibmod_clear, &dynlibmod_get_mem
|
||||
};
|
||||
|
||||
struct module_func_block* dynlibmod_get_funcblock(void)
|
||||
{
|
||||
return &dynlibmod_block;
|
||||
}
|
||||
139
dynlibmod/dynlibmod.h
Normal file
139
dynlibmod/dynlibmod.h
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* dynlibmod.h: module header file
|
||||
*
|
||||
* Copyright (c) 2019, Peter Munch-Ellingsen (peterme AT peterme.net)
|
||||
*
|
||||
* This software is open source.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the organization nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
* \file
|
||||
* Dynamic loading module for unbound. Loads dynamic library.
|
||||
*/
|
||||
#ifndef DYNLIBMOD_H
|
||||
#define DYNLIBMOD_H
|
||||
#include "util/module.h"
|
||||
#include "services/outbound_list.h"
|
||||
|
||||
/**
|
||||
* Get the module function block.
|
||||
* @return: function block with function pointers to module methods.
|
||||
*/
|
||||
struct module_func_block* dynlibmod_get_funcblock(void);
|
||||
|
||||
/** dynlib module init */
|
||||
int dynlibmod_init(struct module_env* env, int id);
|
||||
|
||||
/** dynlib module deinit */
|
||||
void dynlibmod_deinit(struct module_env* env, int id);
|
||||
|
||||
/** dynlib module operate on a query */
|
||||
void dynlibmod_operate(struct module_qstate* qstate, enum module_ev event,
|
||||
int id, struct outbound_entry* outbound);
|
||||
|
||||
/** dynlib module */
|
||||
void dynlibmod_inform_super(struct module_qstate* qstate, int id,
|
||||
struct module_qstate* super);
|
||||
|
||||
/** dynlib module cleanup query state */
|
||||
void dynlibmod_clear(struct module_qstate* qstate, int id);
|
||||
|
||||
/** dynlib module alloc size routine */
|
||||
size_t dynlibmod_get_mem(struct module_env* env, int id);
|
||||
|
||||
int dynlib_inplace_cb_reply_generic(struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct edns_option** opt_list_out,
|
||||
struct comm_reply* repinfo, struct regional* region, int id,
|
||||
void* callback);
|
||||
|
||||
int dynlib_inplace_cb_query_generic(struct query_info* qinfo, uint16_t flags,
|
||||
struct module_qstate* qstate, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t* zone, size_t zonelen, struct regional* region,
|
||||
int id, void* callback);
|
||||
|
||||
int dynlib_inplace_cb_edns_back_parsed(struct module_qstate* qstate,
|
||||
int id, void* cb_args);
|
||||
|
||||
int dynlib_inplace_cb_query_response(struct module_qstate* qstate,
|
||||
struct dns_msg* response, int id, void* cb_args);
|
||||
|
||||
int
|
||||
inplace_cb_register_wrapped(void* cb, enum inplace_cb_list_type type, void* cbarg,
|
||||
struct module_env* env, int id);
|
||||
|
||||
void
|
||||
inplace_cb_delete_wrapped(struct module_env* env, enum inplace_cb_list_type type,
|
||||
int id);
|
||||
|
||||
struct cb_pair {
|
||||
void *cb;
|
||||
void *cb_arg;
|
||||
};
|
||||
|
||||
/**
|
||||
* Global state for the module.
|
||||
*/
|
||||
|
||||
typedef int (*func_init_t)(struct module_env*, int);
|
||||
typedef void (*func_deinit_t)(struct module_env*, int);
|
||||
typedef void (*func_operate_t)(struct module_qstate*, enum module_ev, int, struct outbound_entry*);
|
||||
typedef void (*func_inform_t)(struct module_qstate*, int, struct module_qstate*);
|
||||
typedef void (*func_clear_t)(struct module_qstate*, int);
|
||||
typedef size_t (*func_get_mem_t)(struct module_env*, int);
|
||||
typedef void (*inplace_cb_delete_wrapped_t)(struct module_env*, enum inplace_cb_list_type, int);
|
||||
typedef int (*inplace_cb_register_wrapped_t)(void*, enum inplace_cb_list_type, void*, struct module_env*, int);
|
||||
|
||||
|
||||
struct dynlibmod_env {
|
||||
/** Dynamic library filename. */
|
||||
const char* fname;
|
||||
/** dynamic library handle */
|
||||
void* dynamic_library;
|
||||
/** Module init function */
|
||||
func_init_t func_init;
|
||||
/** Module deinit function */
|
||||
func_deinit_t func_deinit;
|
||||
/** Module operate function */
|
||||
func_operate_t func_operate;
|
||||
/** Module super_inform function */
|
||||
func_inform_t func_inform;
|
||||
/** Module clear function */
|
||||
func_clear_t func_clear;
|
||||
/** Module get_mem function */
|
||||
func_get_mem_t func_get_mem;
|
||||
/** Wrapped inplace callback functions to circumvent callback whitelisting */
|
||||
inplace_cb_delete_wrapped_t inplace_cb_delete_wrapped;
|
||||
inplace_cb_register_wrapped_t inplace_cb_register_wrapped;
|
||||
/** Pointer to any data the dynamic library might want to keep */
|
||||
void *dyn_env;
|
||||
};
|
||||
|
||||
|
||||
#endif /* DYNLIBMOD_H */
|
||||
128
dynlibmod/examples/helloworld.c
Normal file
128
dynlibmod/examples/helloworld.c
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* This is an example to show how dynamic libraries can be made to work with
|
||||
* unbound. To build a .so file simply run:
|
||||
* gcc -I../.. -shared -Wall -Werror -fpic -o helloworld.so helloworld.c
|
||||
* And to build for windows, first make unbound with the --with-dynlibmod
|
||||
* switch, then use this command:
|
||||
* x86_64-w64-mingw32-gcc -m64 -I../.. -shared -Wall -Werror -fpic
|
||||
* -o helloworld.dll helloworld.c -L../.. -l:libunbound.a
|
||||
* to cross-compile a 64-bit Windows DLL.
|
||||
*/
|
||||
|
||||
#include "../../config.h"
|
||||
#include "../../util/module.h"
|
||||
#include "../../sldns/parseutil.h"
|
||||
#include "../dynlibmod.h"
|
||||
|
||||
/* Declare the EXPORT macro that expands to exporting the symbol for DLLs when
|
||||
* compiling for Windows. All procedures marked with EXPORT in this example are
|
||||
* called directly by the dynlib module and must be present for the module to
|
||||
* load correctly. */
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define EXPORT
|
||||
#endif
|
||||
|
||||
/* Forward declare a callback, implemented at the bottom of this file */
|
||||
int reply_callback(struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct edns_option** opt_list_out,
|
||||
struct comm_reply* repinfo, struct regional* region, int id,
|
||||
void* callback);
|
||||
|
||||
/* Init is called when the module is first loaded. It should be used to set up
|
||||
* the environment for this module and do any other initialisation required. */
|
||||
EXPORT int init(struct module_env* env, int id) {
|
||||
log_info("dynlib: hello world from init");
|
||||
struct dynlibmod_env* de = (struct dynlibmod_env*) env->modinfo[id];
|
||||
de->inplace_cb_register_wrapped(&reply_callback,
|
||||
inplace_cb_reply,
|
||||
NULL, env, id);
|
||||
struct dynlibmod_env* local_env = env->modinfo[id];
|
||||
local_env->dyn_env = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Deinit is run as the program is shutting down. It should be used to clean up
|
||||
* the environment and any left over data. */
|
||||
EXPORT void deinit(struct module_env* env, int id) {
|
||||
log_info("dynlib: hello world from deinit");
|
||||
struct dynlibmod_env* de = (struct dynlibmod_env*) env->modinfo[id];
|
||||
de->inplace_cb_delete_wrapped(env, inplace_cb_reply, id);
|
||||
if (de->dyn_env != NULL) free(de->dyn_env);
|
||||
}
|
||||
|
||||
/* Operate is called every time a query passes by this module. The event can be
|
||||
* used to determine which direction in the module chain it came from. */
|
||||
EXPORT void operate(struct module_qstate* qstate, enum module_ev event,
|
||||
int id, struct outbound_entry* entry) {
|
||||
log_info("dynlib: hello world from operate");
|
||||
log_info("dynlib: incoming query: %s %s(%d) %s(%d)",
|
||||
qstate->qinfo.qname,
|
||||
sldns_lookup_by_id(sldns_rr_classes, qstate->qinfo.qclass)->name,
|
||||
qstate->qinfo.qclass,
|
||||
sldns_rr_descript(qstate->qinfo.qtype)->_name,
|
||||
qstate->qinfo.qtype);
|
||||
if (event == module_event_new || event == module_event_pass) {
|
||||
qstate->ext_state[id] = module_wait_module;
|
||||
struct dynlibmod_env* env = qstate->env->modinfo[id];
|
||||
if (env->dyn_env == NULL) {
|
||||
env->dyn_env = calloc(3, sizeof(int));
|
||||
((int *)env->dyn_env)[0] = 42;
|
||||
((int *)env->dyn_env)[1] = 102;
|
||||
((int *)env->dyn_env)[2] = 192;
|
||||
} else {
|
||||
log_err("dynlib: already has data!");
|
||||
qstate->ext_state[id] = module_error;
|
||||
}
|
||||
} else if (event == module_event_moddone) {
|
||||
qstate->ext_state[id] = module_finished;
|
||||
} else {
|
||||
qstate->ext_state[id] = module_error;
|
||||
}
|
||||
}
|
||||
|
||||
/* Inform super is called when a query is completed or errors out, but only if
|
||||
* a sub-query has been registered to it by this module. Look at
|
||||
* mesh_attach_sub in services/mesh.h to see how this is done. */
|
||||
EXPORT void inform_super(struct module_qstate* qstate, int id,
|
||||
struct module_qstate* super) {
|
||||
log_info("dynlib: hello world from inform_super");
|
||||
}
|
||||
|
||||
/* Clear is called once a query is complete and the response has been sent
|
||||
* back. It is used to clear up any per-query allocations. */
|
||||
EXPORT void clear(struct module_qstate* qstate, int id) {
|
||||
log_info("dynlib: hello world from clear");
|
||||
struct dynlibmod_env* env = qstate->env->modinfo[id];
|
||||
if (env->dyn_env != NULL) {
|
||||
free(env->dyn_env);
|
||||
env->dyn_env = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get mem is called when Unbound is printing performance information. This
|
||||
* only happens explicitly and is only used to show memory usage to the user. */
|
||||
EXPORT size_t get_mem(struct module_env* env, int id) {
|
||||
log_info("dynlib: hello world from get_mem");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The callback that was forward declared earlier. It is registered in the init
|
||||
* procedure to run when a query is being replied to. */
|
||||
int reply_callback(struct query_info* qinfo,
|
||||
struct module_qstate* qstate, struct reply_info* rep, int rcode,
|
||||
struct edns_data* edns, struct edns_option** opt_list_out,
|
||||
struct comm_reply* repinfo, struct regional* region, int id,
|
||||
void* callback) {
|
||||
log_info("dynlib: hello world from callback");
|
||||
struct dynlibmod_env* env = qstate->env->modinfo[id];
|
||||
if (env->dyn_env != NULL) {
|
||||
log_info("dynlib: numbers gotten from query: %d, %d, and %d",
|
||||
((int *)env->dyn_env)[0],
|
||||
((int *)env->dyn_env)[1],
|
||||
((int *)env->dyn_env)[2]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -386,8 +386,7 @@ update_cache(struct module_qstate *qstate, int id)
|
|||
rep->flags |= (BIT_RA | BIT_QR); /* fix flags to be sensible for */
|
||||
rep->flags &= ~(BIT_AA | BIT_CD);/* a reply based on the cache */
|
||||
addrtree_insert(tree, (addrkey_t*)edns->subnet_addr,
|
||||
edns->subnet_source_mask,
|
||||
sq->ecs_server_in.subnet_scope_mask, rep,
|
||||
edns->subnet_source_mask, sq->max_scope, rep,
|
||||
rep->ttl, *qstate->env->now);
|
||||
|
||||
lock_rw_unlock(&lru_entry->lock);
|
||||
|
|
@ -543,7 +542,7 @@ eval_response(struct module_qstate *qstate, int id, struct subnet_qstate *sq)
|
|||
c_out->subnet_addr_fam = c_in->subnet_addr_fam;
|
||||
c_out->subnet_source_mask = c_in->subnet_source_mask;
|
||||
memcpy(&c_out->subnet_addr, &c_in->subnet_addr, INET6_SIZE);
|
||||
c_out->subnet_scope_mask = s_in->subnet_scope_mask;
|
||||
c_out->subnet_scope_mask = sq->max_scope;
|
||||
/* Limit scope returned to client to scope used for caching. */
|
||||
if(c_out->subnet_addr_fam == EDNSSUBNET_ADDRFAM_IP4) {
|
||||
if(c_out->subnet_scope_mask >
|
||||
|
|
@ -648,6 +647,19 @@ ecs_query_response(struct module_qstate* qstate, struct dns_msg* response,
|
|||
qstate->env->cfg->client_subnet_opcode);
|
||||
sq->subnet_sent = 0;
|
||||
memset(&sq->ecs_server_out, 0, sizeof(sq->ecs_server_out));
|
||||
} else if (!sq->track_max_scope &&
|
||||
FLAGS_GET_RCODE(response->rep->flags) == LDNS_RCODE_NOERROR &&
|
||||
response->rep->an_numrrsets > 0
|
||||
) {
|
||||
struct ub_packed_rrset_key* s = response->rep->rrsets[0];
|
||||
if(ntohs(s->rk.type) == LDNS_RR_TYPE_CNAME &&
|
||||
query_dname_compare(qstate->qinfo.qname,
|
||||
s->rk.dname) == 0) {
|
||||
/* CNAME response for QNAME. From now on keep track of
|
||||
* longest received ECS prefix for all queries on this
|
||||
* qstate. */
|
||||
sq->track_max_scope = 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -663,16 +675,19 @@ ecs_edns_back_parsed(struct module_qstate* qstate, int id,
|
|||
return 1;
|
||||
if((ecs_opt = edns_opt_list_find(
|
||||
qstate->edns_opts_back_in,
|
||||
qstate->env->cfg->client_subnet_opcode))) {
|
||||
if(parse_subnet_option(ecs_opt, &sq->ecs_server_in) &&
|
||||
sq->subnet_sent &&
|
||||
sq->ecs_server_in.subnet_validdata)
|
||||
qstate->env->cfg->client_subnet_opcode)) &&
|
||||
parse_subnet_option(ecs_opt, &sq->ecs_server_in) &&
|
||||
sq->subnet_sent && sq->ecs_server_in.subnet_validdata) {
|
||||
/* Only skip global cache store if we sent an ECS option
|
||||
* and received one back. Answers from non-whitelisted
|
||||
* servers will end up in global cache. Answers for
|
||||
* queries with 0 source will not (unless nameserver
|
||||
* does not support ECS). */
|
||||
qstate->no_cache_store = 1;
|
||||
if(!sq->track_max_scope || (sq->track_max_scope &&
|
||||
sq->ecs_server_in.subnet_scope_mask >
|
||||
sq->max_scope))
|
||||
sq->max_scope = sq->ecs_server_in.subnet_scope_mask;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include "util/alloc.h"
|
||||
#include "util/net_help.h"
|
||||
#include "util/storage/slabhash.h"
|
||||
#include "util/data/dname.h"
|
||||
#include "edns-subnet/addrtree.h"
|
||||
#include "edns-subnet/edns-subnet.h"
|
||||
|
||||
|
|
@ -83,6 +84,12 @@ struct subnet_qstate {
|
|||
struct ecs_data ecs_server_out;
|
||||
int subnet_downstream;
|
||||
int subnet_sent;
|
||||
/** keep track of longest received scope, set after receiving CNAME for
|
||||
* incoming QNAME. */
|
||||
int track_max_scope;
|
||||
/** longest received scope mask since track_max_scope is set. This value
|
||||
* is used for caching and answereing to client. */
|
||||
uint8_t max_scope;
|
||||
/** has the subnet module been started with no_cache_store? */
|
||||
int started_no_cache_store;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ struct delegpt* delegpt_copy(struct delegpt* dp, struct regional* region)
|
|||
}
|
||||
for(a = dp->target_list; a; a = a->next_target) {
|
||||
if(!delegpt_add_addr(copy, region, &a->addr, a->addrlen,
|
||||
a->bogus, a->lame, a->tls_auth_name))
|
||||
a->bogus, a->lame, a->tls_auth_name, NULL))
|
||||
return NULL;
|
||||
}
|
||||
return copy;
|
||||
|
|
@ -161,7 +161,7 @@ delegpt_find_addr(struct delegpt* dp, struct sockaddr_storage* addr,
|
|||
int
|
||||
delegpt_add_target(struct delegpt* dp, struct regional* region,
|
||||
uint8_t* name, size_t namelen, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t bogus, uint8_t lame)
|
||||
socklen_t addrlen, uint8_t bogus, uint8_t lame, int* additions)
|
||||
{
|
||||
struct delegpt_ns* ns = delegpt_find_ns(dp, name, namelen);
|
||||
log_assert(!dp->dp_type_mlc);
|
||||
|
|
@ -176,13 +176,14 @@ delegpt_add_target(struct delegpt* dp, struct regional* region,
|
|||
if(ns->got4 && ns->got6)
|
||||
ns->resolved = 1;
|
||||
}
|
||||
return delegpt_add_addr(dp, region, addr, addrlen, bogus, lame, NULL);
|
||||
return delegpt_add_addr(dp, region, addr, addrlen, bogus, lame, NULL,
|
||||
additions);
|
||||
}
|
||||
|
||||
int
|
||||
delegpt_add_addr(struct delegpt* dp, struct regional* region,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, uint8_t bogus,
|
||||
uint8_t lame, char* tls_auth_name)
|
||||
uint8_t lame, char* tls_auth_name, int* additions)
|
||||
{
|
||||
struct delegpt_addr* a;
|
||||
log_assert(!dp->dp_type_mlc);
|
||||
|
|
@ -194,6 +195,8 @@ delegpt_add_addr(struct delegpt* dp, struct regional* region,
|
|||
a->lame = 0;
|
||||
return 1;
|
||||
}
|
||||
if(additions)
|
||||
*additions = 1;
|
||||
|
||||
a = (struct delegpt_addr*)regional_alloc(region,
|
||||
sizeof(struct delegpt_addr));
|
||||
|
|
@ -382,10 +385,10 @@ delegpt_from_message(struct dns_msg* msg, struct regional* region)
|
|||
continue;
|
||||
|
||||
if(ntohs(s->rk.type) == LDNS_RR_TYPE_A) {
|
||||
if(!delegpt_add_rrset_A(dp, region, s, 0))
|
||||
if(!delegpt_add_rrset_A(dp, region, s, 0, NULL))
|
||||
return NULL;
|
||||
} else if(ntohs(s->rk.type) == LDNS_RR_TYPE_AAAA) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, s, 0))
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, s, 0, NULL))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -416,7 +419,7 @@ delegpt_rrset_add_ns(struct delegpt* dp, struct regional* region,
|
|||
|
||||
int
|
||||
delegpt_add_rrset_A(struct delegpt* dp, struct regional* region,
|
||||
struct ub_packed_rrset_key* ak, uint8_t lame)
|
||||
struct ub_packed_rrset_key* ak, uint8_t lame, int* additions)
|
||||
{
|
||||
struct packed_rrset_data* d=(struct packed_rrset_data*)ak->entry.data;
|
||||
size_t i;
|
||||
|
|
@ -432,7 +435,7 @@ delegpt_add_rrset_A(struct delegpt* dp, struct regional* region,
|
|||
memmove(&sa.sin_addr, d->rr_data[i]+2, INET_SIZE);
|
||||
if(!delegpt_add_target(dp, region, ak->rk.dname,
|
||||
ak->rk.dname_len, (struct sockaddr_storage*)&sa,
|
||||
len, (d->security==sec_status_bogus), lame))
|
||||
len, (d->security==sec_status_bogus), lame, additions))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -440,7 +443,7 @@ delegpt_add_rrset_A(struct delegpt* dp, struct regional* region,
|
|||
|
||||
int
|
||||
delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* region,
|
||||
struct ub_packed_rrset_key* ak, uint8_t lame)
|
||||
struct ub_packed_rrset_key* ak, uint8_t lame, int* additions)
|
||||
{
|
||||
struct packed_rrset_data* d=(struct packed_rrset_data*)ak->entry.data;
|
||||
size_t i;
|
||||
|
|
@ -456,7 +459,7 @@ delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* region,
|
|||
memmove(&sa.sin6_addr, d->rr_data[i]+2, INET6_SIZE);
|
||||
if(!delegpt_add_target(dp, region, ak->rk.dname,
|
||||
ak->rk.dname_len, (struct sockaddr_storage*)&sa,
|
||||
len, (d->security==sec_status_bogus), lame))
|
||||
len, (d->security==sec_status_bogus), lame, additions))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -464,20 +467,33 @@ delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* region,
|
|||
|
||||
int
|
||||
delegpt_add_rrset(struct delegpt* dp, struct regional* region,
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame)
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame, int* additions)
|
||||
{
|
||||
if(!rrset)
|
||||
return 1;
|
||||
if(ntohs(rrset->rk.type) == LDNS_RR_TYPE_NS)
|
||||
return delegpt_rrset_add_ns(dp, region, rrset, lame);
|
||||
else if(ntohs(rrset->rk.type) == LDNS_RR_TYPE_A)
|
||||
return delegpt_add_rrset_A(dp, region, rrset, lame);
|
||||
return delegpt_add_rrset_A(dp, region, rrset, lame, additions);
|
||||
else if(ntohs(rrset->rk.type) == LDNS_RR_TYPE_AAAA)
|
||||
return delegpt_add_rrset_AAAA(dp, region, rrset, lame);
|
||||
return delegpt_add_rrset_AAAA(dp, region, rrset, lame,
|
||||
additions);
|
||||
log_warn("Unknown rrset type added to delegpt");
|
||||
return 1;
|
||||
}
|
||||
|
||||
void delegpt_mark_neg(struct delegpt_ns* ns, uint16_t qtype)
|
||||
{
|
||||
if(ns) {
|
||||
if(qtype == LDNS_RR_TYPE_A)
|
||||
ns->got4 = 2;
|
||||
else if(qtype == LDNS_RR_TYPE_AAAA)
|
||||
ns->got6 = 2;
|
||||
if(ns->got4 && ns->got6)
|
||||
ns->resolved = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void delegpt_add_neg_msg(struct delegpt* dp, struct msgreply_entry* msg)
|
||||
{
|
||||
struct reply_info* rep = (struct reply_info*)msg->entry.data;
|
||||
|
|
@ -487,14 +503,7 @@ void delegpt_add_neg_msg(struct delegpt* dp, struct msgreply_entry* msg)
|
|||
if(FLAGS_GET_RCODE(rep->flags) != 0 || rep->an_numrrsets == 0) {
|
||||
struct delegpt_ns* ns = delegpt_find_ns(dp, msg->key.qname,
|
||||
msg->key.qname_len);
|
||||
if(ns) {
|
||||
if(msg->key.qtype == LDNS_RR_TYPE_A)
|
||||
ns->got4 = 1;
|
||||
else if(msg->key.qtype == LDNS_RR_TYPE_AAAA)
|
||||
ns->got6 = 1;
|
||||
if(ns->got4 && ns->got6)
|
||||
ns->resolved = 1;
|
||||
}
|
||||
delegpt_mark_neg(ns, msg->key.qtype);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,9 +106,10 @@ struct delegpt_ns {
|
|||
* and marked true if got4 and got6 are both true.
|
||||
*/
|
||||
int resolved;
|
||||
/** if the ipv4 address is in the delegpt */
|
||||
/** if the ipv4 address is in the delegpt, 0=not, 1=yes 2=negative,
|
||||
* negative means it was done, but no content. */
|
||||
uint8_t got4;
|
||||
/** if the ipv6 address is in the delegpt */
|
||||
/** if the ipv6 address is in the delegpt, 0=not, 1=yes 2=negative */
|
||||
uint8_t got6;
|
||||
/**
|
||||
* If the name is parent-side only and thus dispreferred.
|
||||
|
|
@ -215,11 +216,12 @@ int delegpt_rrset_add_ns(struct delegpt* dp, struct regional* regional,
|
|||
* @param addrlen: the length of addr.
|
||||
* @param bogus: security status for the address, pass true if bogus.
|
||||
* @param lame: address is lame.
|
||||
* @param additions: will be set to 1 if a new address is added
|
||||
* @return false on error.
|
||||
*/
|
||||
int delegpt_add_target(struct delegpt* dp, struct regional* regional,
|
||||
uint8_t* name, size_t namelen, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, uint8_t bogus, uint8_t lame);
|
||||
socklen_t addrlen, uint8_t bogus, uint8_t lame, int* additions);
|
||||
|
||||
/**
|
||||
* Add A RRset to delegpt.
|
||||
|
|
@ -227,10 +229,11 @@ int delegpt_add_target(struct delegpt* dp, struct regional* regional,
|
|||
* @param regional: where to allocate the info.
|
||||
* @param rrset: RRset A to add.
|
||||
* @param lame: rrset is lame, disprefer it.
|
||||
* @param additions: will be set to 1 if a new address is added
|
||||
* @return 0 on alloc error.
|
||||
*/
|
||||
int delegpt_add_rrset_A(struct delegpt* dp, struct regional* regional,
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame);
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame, int* additions);
|
||||
|
||||
/**
|
||||
* Add AAAA RRset to delegpt.
|
||||
|
|
@ -238,10 +241,11 @@ int delegpt_add_rrset_A(struct delegpt* dp, struct regional* regional,
|
|||
* @param regional: where to allocate the info.
|
||||
* @param rrset: RRset AAAA to add.
|
||||
* @param lame: rrset is lame, disprefer it.
|
||||
* @param additions: will be set to 1 if a new address is added
|
||||
* @return 0 on alloc error.
|
||||
*/
|
||||
int delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* regional,
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame);
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame, int* additions);
|
||||
|
||||
/**
|
||||
* Add any RRset to delegpt.
|
||||
|
|
@ -250,10 +254,11 @@ int delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* regional,
|
|||
* @param regional: where to allocate the info.
|
||||
* @param rrset: RRset to add, NS, A, AAAA.
|
||||
* @param lame: rrset is lame, disprefer it.
|
||||
* @param additions: will be set to 1 if a new address is added
|
||||
* @return 0 on alloc error.
|
||||
*/
|
||||
int delegpt_add_rrset(struct delegpt* dp, struct regional* regional,
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame);
|
||||
struct ub_packed_rrset_key* rrset, uint8_t lame, int* additions);
|
||||
|
||||
/**
|
||||
* Add address to the delegation point. No servername is associated or checked.
|
||||
|
|
@ -264,11 +269,12 @@ int delegpt_add_rrset(struct delegpt* dp, struct regional* regional,
|
|||
* @param bogus: if address is bogus.
|
||||
* @param lame: if address is lame.
|
||||
* @param tls_auth_name: TLS authentication name (or NULL).
|
||||
* @param additions: will be set to 1 if a new address is added
|
||||
* @return false on error.
|
||||
*/
|
||||
int delegpt_add_addr(struct delegpt* dp, struct regional* regional,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t bogus, uint8_t lame, char* tls_auth_name);
|
||||
uint8_t bogus, uint8_t lame, char* tls_auth_name, int* additions);
|
||||
|
||||
/**
|
||||
* Find NS record in name list of delegation point.
|
||||
|
|
@ -341,6 +347,14 @@ size_t delegpt_count_targets(struct delegpt* dp);
|
|||
struct delegpt* delegpt_from_message(struct dns_msg* msg,
|
||||
struct regional* regional);
|
||||
|
||||
/**
|
||||
* Mark negative return in delegation point for specific nameserver.
|
||||
* sets the got4 or got6 to negative, updates the ns->resolved.
|
||||
* @param ns: the nameserver in the delegpt.
|
||||
* @param qtype: A or AAAA (host order).
|
||||
*/
|
||||
void delegpt_mark_neg(struct delegpt_ns* ns, uint16_t qtype);
|
||||
|
||||
/**
|
||||
* Add negative message to delegation point.
|
||||
* @param dp: delegation point.
|
||||
|
|
|
|||
|
|
@ -185,8 +185,9 @@ mark_additional_rrset(sldns_buffer* pkt, struct msg_parse* msg,
|
|||
/** Get target name of a CNAME */
|
||||
static int
|
||||
parse_get_cname_target(struct rrset_parse* rrset, uint8_t** sname,
|
||||
size_t* snamelen)
|
||||
size_t* snamelen, sldns_buffer* pkt)
|
||||
{
|
||||
size_t oldpos, dlen;
|
||||
if(rrset->rr_count != 1) {
|
||||
struct rr_parse* sig;
|
||||
verbose(VERB_ALGO, "Found CNAME rrset with "
|
||||
|
|
@ -204,6 +205,19 @@ parse_get_cname_target(struct rrset_parse* rrset, uint8_t** sname,
|
|||
*sname = rrset->rr_first->ttl_data + sizeof(uint32_t)
|
||||
+ sizeof(uint16_t); /* skip ttl, rdatalen */
|
||||
*snamelen = rrset->rr_first->size - sizeof(uint16_t);
|
||||
|
||||
if(rrset->rr_first->outside_packet) {
|
||||
if(!dname_valid(*sname, *snamelen))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
oldpos = sldns_buffer_position(pkt);
|
||||
sldns_buffer_set_position(pkt, (size_t)(*sname - sldns_buffer_begin(pkt)));
|
||||
dlen = pkt_dname_len(pkt);
|
||||
sldns_buffer_set_position(pkt, oldpos);
|
||||
if(dlen == 0)
|
||||
return 0; /* parse fail on the rdata name */
|
||||
*snamelen = dlen;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +229,7 @@ synth_cname(uint8_t* qname, size_t qnamelen, struct rrset_parse* dname_rrset,
|
|||
/* we already know that sname is a strict subdomain of DNAME owner */
|
||||
uint8_t* dtarg = NULL;
|
||||
size_t dtarglen;
|
||||
if(!parse_get_cname_target(dname_rrset, &dtarg, &dtarglen))
|
||||
if(!parse_get_cname_target(dname_rrset, &dtarg, &dtarglen, pkt))
|
||||
return 0;
|
||||
if(qnamelen <= dname_rrset->dname_len)
|
||||
return 0;
|
||||
|
|
@ -388,7 +402,7 @@ scrub_normalize(sldns_buffer* pkt, struct msg_parse* msg,
|
|||
/* check next cname */
|
||||
uint8_t* t = NULL;
|
||||
size_t tlen = 0;
|
||||
if(!parse_get_cname_target(nx, &t, &tlen))
|
||||
if(!parse_get_cname_target(nx, &t, &tlen, pkt))
|
||||
return 0;
|
||||
if(dname_pkt_compare(pkt, alias, t) == 0) {
|
||||
/* it's OK and better capitalized */
|
||||
|
|
@ -439,7 +453,7 @@ scrub_normalize(sldns_buffer* pkt, struct msg_parse* msg,
|
|||
size_t tlen = 0;
|
||||
if(synth_cname(sname, snamelen, nx, alias,
|
||||
&aliaslen, pkt) &&
|
||||
parse_get_cname_target(rrset, &t, &tlen) &&
|
||||
parse_get_cname_target(rrset, &t, &tlen, pkt) &&
|
||||
dname_pkt_compare(pkt, alias, t) == 0) {
|
||||
/* the synthesized CNAME equals the
|
||||
* current CNAME. This CNAME is the
|
||||
|
|
@ -460,7 +474,7 @@ scrub_normalize(sldns_buffer* pkt, struct msg_parse* msg,
|
|||
}
|
||||
|
||||
/* move to next name in CNAME chain */
|
||||
if(!parse_get_cname_target(rrset, &sname, &snamelen))
|
||||
if(!parse_get_cname_target(rrset, &sname, &snamelen, pkt))
|
||||
return 0;
|
||||
prev = rrset;
|
||||
rrset = rrset->rrset_all_next;
|
||||
|
|
|
|||
|
|
@ -1199,7 +1199,7 @@ int iter_lookup_parent_glue_from_cache(struct module_env* env,
|
|||
log_rrset_key(VERB_ALGO, "found parent-side", akey);
|
||||
ns->done_pside4 = 1;
|
||||
/* a negative-cache-element has no addresses it adds */
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, 1))
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, 1, NULL))
|
||||
log_err("malloc failure in lookup_parent_glue");
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
}
|
||||
|
|
@ -1211,7 +1211,7 @@ int iter_lookup_parent_glue_from_cache(struct module_env* env,
|
|||
log_rrset_key(VERB_ALGO, "found parent-side", akey);
|
||||
ns->done_pside6 = 1;
|
||||
/* a negative-cache-element has no addresses it adds */
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, 1))
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, 1, NULL))
|
||||
log_err("malloc failure in lookup_parent_glue");
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@
|
|||
/* in msec */
|
||||
int UNKNOWN_SERVER_NICENESS = 376;
|
||||
|
||||
static void target_count_increase_nx(struct iter_qstate* iq, int num);
|
||||
|
||||
int
|
||||
iter_init(struct module_env* env, int id)
|
||||
{
|
||||
|
|
@ -150,6 +152,7 @@ iter_new(struct module_qstate* qstate, int id)
|
|||
iq->sent_count = 0;
|
||||
iq->ratelimit_ok = 0;
|
||||
iq->target_count = NULL;
|
||||
iq->dp_target_count = 0;
|
||||
iq->wait_priming_stub = 0;
|
||||
iq->refetch_glue = 0;
|
||||
iq->dnssec_expected = 0;
|
||||
|
|
@ -221,6 +224,7 @@ final_state(struct iter_qstate* iq)
|
|||
static void
|
||||
error_supers(struct module_qstate* qstate, int id, struct module_qstate* super)
|
||||
{
|
||||
struct iter_env* ie = (struct iter_env*)qstate->env->modinfo[id];
|
||||
struct iter_qstate* super_iq = (struct iter_qstate*)super->minfo[id];
|
||||
|
||||
if(qstate->qinfo.qtype == LDNS_RR_TYPE_A ||
|
||||
|
|
@ -246,7 +250,11 @@ error_supers(struct module_qstate* qstate, int id, struct module_qstate* super)
|
|||
super->region, super_iq->dp))
|
||||
log_err("out of memory adding missing");
|
||||
}
|
||||
delegpt_mark_neg(dpns, qstate->qinfo.qtype);
|
||||
dpns->resolved = 1; /* mark as failed */
|
||||
if((dpns->got4 == 2 || !ie->supports_ipv4) &&
|
||||
(dpns->got6 == 2 || !ie->supports_ipv6))
|
||||
target_count_increase_nx(super_iq, 1);
|
||||
}
|
||||
if(qstate->qinfo.qtype == LDNS_RR_TYPE_NS) {
|
||||
/* prime failed to get delegation */
|
||||
|
|
@ -621,7 +629,7 @@ static void
|
|||
target_count_create(struct iter_qstate* iq)
|
||||
{
|
||||
if(!iq->target_count) {
|
||||
iq->target_count = (int*)calloc(2, sizeof(int));
|
||||
iq->target_count = (int*)calloc(3, sizeof(int));
|
||||
/* if calloc fails we simply do not track this number */
|
||||
if(iq->target_count)
|
||||
iq->target_count[0] = 1;
|
||||
|
|
@ -634,6 +642,15 @@ target_count_increase(struct iter_qstate* iq, int num)
|
|||
target_count_create(iq);
|
||||
if(iq->target_count)
|
||||
iq->target_count[1] += num;
|
||||
iq->dp_target_count++;
|
||||
}
|
||||
|
||||
static void
|
||||
target_count_increase_nx(struct iter_qstate* iq, int num)
|
||||
{
|
||||
target_count_create(iq);
|
||||
if(iq->target_count)
|
||||
iq->target_count[2] += num;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -656,13 +673,15 @@ target_count_increase(struct iter_qstate* iq, int num)
|
|||
* @param subq_ret: if newly allocated, the subquerystate, or NULL if it does
|
||||
* not need initialisation.
|
||||
* @param v: if true, validation is done on the subquery.
|
||||
* @param detached: true if this qstate should not attach to the subquery
|
||||
* @return false on error (malloc).
|
||||
*/
|
||||
static int
|
||||
generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
||||
uint16_t qclass, struct module_qstate* qstate, int id,
|
||||
struct iter_qstate* iq, enum iter_state initial_state,
|
||||
enum iter_state finalstate, struct module_qstate** subq_ret, int v)
|
||||
enum iter_state finalstate, struct module_qstate** subq_ret, int v,
|
||||
int detached)
|
||||
{
|
||||
struct module_qstate* subq = NULL;
|
||||
struct iter_qstate* subiq = NULL;
|
||||
|
|
@ -689,11 +708,23 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
|||
valrec = 1;
|
||||
}
|
||||
|
||||
/* attach subquery, lookup existing or make a new one */
|
||||
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(detached) {
|
||||
struct mesh_state* sub = NULL;
|
||||
fptr_ok(fptr_whitelist_modenv_add_sub(
|
||||
qstate->env->add_sub));
|
||||
if(!(*qstate->env->add_sub)(qstate, &qinf,
|
||||
qflags, prime, valrec, &subq, &sub)){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* attach subquery, lookup existing or make a new one */
|
||||
fptr_ok(fptr_whitelist_modenv_attach_sub(
|
||||
qstate->env->attach_sub));
|
||||
if(!(*qstate->env->attach_sub)(qstate, &qinf, qflags, prime,
|
||||
valrec, &subq)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*subq_ret = subq;
|
||||
if(subq) {
|
||||
|
|
@ -716,6 +747,7 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
|||
subiq->target_count = iq->target_count;
|
||||
if(iq->target_count)
|
||||
iq->target_count[0] ++; /* extra reference */
|
||||
subiq->dp_target_count = 0;
|
||||
subiq->num_current_queries = 0;
|
||||
subiq->depth = iq->depth+1;
|
||||
outbound_list_init(&subiq->outlist);
|
||||
|
|
@ -759,7 +791,7 @@ prime_root(struct module_qstate* qstate, struct iter_qstate* iq, int id,
|
|||
* the normal INIT state logic (which would cause an infloop). */
|
||||
if(!generate_sub_request((uint8_t*)"\000", 1, LDNS_RR_TYPE_NS,
|
||||
qclass, qstate, id, iq, QUERYTARGETS_STATE, PRIME_RESP_STATE,
|
||||
&subq, 0)) {
|
||||
&subq, 0, 0)) {
|
||||
verbose(VERB_ALGO, "could not prime root");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -850,7 +882,7 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq, int id,
|
|||
* redundant INIT state processing. */
|
||||
if(!generate_sub_request(stub_dp->name, stub_dp->namelen,
|
||||
LDNS_RR_TYPE_NS, qclass, qstate, id, iq,
|
||||
QUERYTARGETS_STATE, PRIME_RESP_STATE, &subq, 0)) {
|
||||
QUERYTARGETS_STATE, PRIME_RESP_STATE, &subq, 0, 0)) {
|
||||
verbose(VERB_ALGO, "could not prime stub");
|
||||
errinf(qstate, "could not generate lookup for stub prime");
|
||||
(void)error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
|
|
@ -1025,7 +1057,7 @@ generate_a_aaaa_check(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
if(!generate_sub_request(s->rk.dname, s->rk.dname_len,
|
||||
ntohs(s->rk.type), ntohs(s->rk.rrset_class),
|
||||
qstate, id, iq,
|
||||
INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1)) {
|
||||
INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1, 0)) {
|
||||
verbose(VERB_ALGO, "could not generate addr check");
|
||||
return;
|
||||
}
|
||||
|
|
@ -1069,7 +1101,7 @@ generate_ns_check(struct module_qstate* qstate, struct iter_qstate* iq, int id)
|
|||
iq->dp->name, LDNS_RR_TYPE_NS, iq->qchase.qclass);
|
||||
if(!generate_sub_request(iq->dp->name, iq->dp->namelen,
|
||||
LDNS_RR_TYPE_NS, iq->qchase.qclass, qstate, id, iq,
|
||||
INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1)) {
|
||||
INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1, 0)) {
|
||||
verbose(VERB_ALGO, "could not generate ns check");
|
||||
return;
|
||||
}
|
||||
|
|
@ -1126,7 +1158,7 @@ generate_dnskey_prefetch(struct module_qstate* qstate,
|
|||
iq->dp->name, LDNS_RR_TYPE_DNSKEY, iq->qchase.qclass);
|
||||
if(!generate_sub_request(iq->dp->name, iq->dp->namelen,
|
||||
LDNS_RR_TYPE_DNSKEY, iq->qchase.qclass, qstate, id, iq,
|
||||
INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0)) {
|
||||
INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0, 0)) {
|
||||
/* we'll be slower, but it'll work */
|
||||
verbose(VERB_ALGO, "could not generate dnskey prefetch");
|
||||
return;
|
||||
|
|
@ -1315,6 +1347,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
iq->refetch_glue = 0;
|
||||
iq->query_restart_count++;
|
||||
iq->sent_count = 0;
|
||||
iq->dp_target_count = 0;
|
||||
sock_list_insert(&qstate->reply_origin, NULL, 0, qstate->region);
|
||||
if(qstate->env->cfg->qname_minimisation)
|
||||
iq->minimisation_state = INIT_MINIMISE_STATE;
|
||||
|
|
@ -1693,7 +1726,7 @@ generate_parentside_target_query(struct module_qstate* qstate,
|
|||
{
|
||||
struct module_qstate* subq;
|
||||
if(!generate_sub_request(name, namelen, qtype, qclass, qstate,
|
||||
id, iq, INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0))
|
||||
id, iq, INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0, 0))
|
||||
return 0;
|
||||
if(subq) {
|
||||
struct iter_qstate* subiq =
|
||||
|
|
@ -1744,7 +1777,7 @@ generate_target_query(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
{
|
||||
struct module_qstate* subq;
|
||||
if(!generate_sub_request(name, namelen, qtype, qclass, qstate,
|
||||
id, iq, INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0))
|
||||
id, iq, INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0, 0))
|
||||
return 0;
|
||||
log_nametypeclass(VERB_QUERY, "new target", name, qtype, qclass);
|
||||
return 1;
|
||||
|
|
@ -1783,6 +1816,14 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
"number of glue fetches %d", s, iq->target_count[1]);
|
||||
return 0;
|
||||
}
|
||||
if(iq->dp_target_count > MAX_DP_TARGET_COUNT) {
|
||||
char s[LDNS_MAX_DOMAINLEN+1];
|
||||
dname_str(qstate->qinfo.qname, s);
|
||||
verbose(VERB_QUERY, "request %s has exceeded the maximum "
|
||||
"number of glue fetches %d to a single delegation point",
|
||||
s, iq->dp_target_count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
iter_mark_cycle_targets(qstate, iq->dp);
|
||||
missing = (int)delegpt_count_missing_targets(iq->dp);
|
||||
|
|
@ -1896,7 +1937,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
for(a = p->target_list; a; a=a->next_target) {
|
||||
(void)delegpt_add_addr(iq->dp, qstate->region,
|
||||
&a->addr, a->addrlen, a->bogus,
|
||||
a->lame, a->tls_auth_name);
|
||||
a->lame, a->tls_auth_name, NULL);
|
||||
}
|
||||
}
|
||||
iq->dp->has_parent_side_NS = 1;
|
||||
|
|
@ -1913,6 +1954,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
iq->refetch_glue = 1;
|
||||
iq->query_restart_count++;
|
||||
iq->sent_count = 0;
|
||||
iq->dp_target_count = 0;
|
||||
if(qstate->env->cfg->qname_minimisation)
|
||||
iq->minimisation_state = INIT_MINIMISE_STATE;
|
||||
return next_state(iq, INIT_REQUEST_STATE);
|
||||
|
|
@ -2078,7 +2120,7 @@ processDSNSFind(struct module_qstate* qstate, struct iter_qstate* iq, int id)
|
|||
iq->dsns_point, LDNS_RR_TYPE_NS, iq->qchase.qclass);
|
||||
if(!generate_sub_request(iq->dsns_point, iq->dsns_point_len,
|
||||
LDNS_RR_TYPE_NS, iq->qchase.qclass, qstate, id, iq,
|
||||
INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0)) {
|
||||
INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0, 0)) {
|
||||
errinf_dname(qstate, "for DS query parent-child nameserver search, could not generate NS lookup for", iq->dsns_point);
|
||||
return error_response_cache(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
|
|
@ -2136,6 +2178,13 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
errinf(qstate, "exceeded the maximum number of sends");
|
||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
if(iq->target_count && iq->target_count[2] > MAX_TARGET_NX) {
|
||||
verbose(VERB_QUERY, "request has exceeded the maximum "
|
||||
" number of nxdomain nameserver lookups with %d",
|
||||
iq->target_count[2]);
|
||||
errinf(qstate, "exceeded the maximum nameserver nxdomains");
|
||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
|
||||
/* Make sure we have a delegation point, otherwise priming failed
|
||||
* or another failure occurred */
|
||||
|
|
@ -2240,12 +2289,41 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
iq->qinfo_out.qtype, iq->qinfo_out.qclass,
|
||||
qstate->query_flags, qstate->region,
|
||||
qstate->env->scratch, 0);
|
||||
if(msg && msg->rep->an_numrrsets == 0
|
||||
&& FLAGS_GET_RCODE(msg->rep->flags) ==
|
||||
if(msg && FLAGS_GET_RCODE(msg->rep->flags) ==
|
||||
LDNS_RCODE_NOERROR)
|
||||
/* no need to send query if it is already
|
||||
* cached as NOERROR/NODATA */
|
||||
* cached as NOERROR */
|
||||
return 1;
|
||||
if(msg && FLAGS_GET_RCODE(msg->rep->flags) ==
|
||||
LDNS_RCODE_NXDOMAIN &&
|
||||
qstate->env->need_to_validate &&
|
||||
qstate->env->cfg->harden_below_nxdomain) {
|
||||
if(msg->rep->security == sec_status_secure) {
|
||||
iq->response = msg;
|
||||
return final_state(iq);
|
||||
}
|
||||
if(msg->rep->security == sec_status_unchecked) {
|
||||
struct module_qstate* subq = NULL;
|
||||
if(!generate_sub_request(
|
||||
iq->qinfo_out.qname,
|
||||
iq->qinfo_out.qname_len,
|
||||
iq->qinfo_out.qtype,
|
||||
iq->qinfo_out.qclass,
|
||||
qstate, id, iq,
|
||||
INIT_REQUEST_STATE,
|
||||
FINISHED_STATE, &subq, 1, 1))
|
||||
verbose(VERB_ALGO,
|
||||
"could not validate NXDOMAIN "
|
||||
"response");
|
||||
}
|
||||
}
|
||||
if(msg && FLAGS_GET_RCODE(msg->rep->flags) ==
|
||||
LDNS_RCODE_NXDOMAIN) {
|
||||
/* return and add a label in the next
|
||||
* minimisation iteration.
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(iq->minimisation_state == SKIP_MINIMISE_STATE) {
|
||||
|
|
@ -2321,6 +2399,8 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
* generated query will immediately be discarded due to depth and
|
||||
* that servfail is cached, which is not good as opportunism goes. */
|
||||
if(iq->depth < ie->max_dependency_depth
|
||||
&& iq->num_target_queries == 0
|
||||
&& (!iq->target_count || iq->target_count[2]==0)
|
||||
&& iq->sent_count < TARGET_FETCH_STOP) {
|
||||
tf_policy = ie->target_fetch_policy[iq->depth];
|
||||
}
|
||||
|
|
@ -2366,6 +2446,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
iq->num_current_queries++; /* RespState decrements it*/
|
||||
iq->referral_count++; /* make sure we don't loop */
|
||||
iq->sent_count = 0;
|
||||
iq->dp_target_count = 0;
|
||||
iq->state = QUERY_RESP_STATE;
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -2453,6 +2534,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
iq->num_current_queries++; /* RespState decrements it*/
|
||||
iq->referral_count++; /* make sure we don't loop */
|
||||
iq->sent_count = 0;
|
||||
iq->dp_target_count = 0;
|
||||
iq->state = QUERY_RESP_STATE;
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -2748,7 +2830,8 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
/* Make subrequest to validate intermediate
|
||||
* NXDOMAIN if harden-below-nxdomain is
|
||||
* enabled. */
|
||||
if(qstate->env->cfg->harden_below_nxdomain) {
|
||||
if(qstate->env->cfg->harden_below_nxdomain &&
|
||||
qstate->env->need_to_validate) {
|
||||
struct module_qstate* subq = NULL;
|
||||
log_query_info(VERB_QUERY,
|
||||
"schedule NXDOMAIN validation:",
|
||||
|
|
@ -2760,16 +2843,10 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
iq->response->qinfo.qclass,
|
||||
qstate, id, iq,
|
||||
INIT_REQUEST_STATE,
|
||||
FINISHED_STATE, &subq, 1))
|
||||
FINISHED_STATE, &subq, 1, 1))
|
||||
verbose(VERB_ALGO,
|
||||
"could not validate NXDOMAIN "
|
||||
"response");
|
||||
outbound_list_clear(&iq->outlist);
|
||||
iq->num_current_queries = 0;
|
||||
fptr_ok(fptr_whitelist_modenv_detach_subs(
|
||||
qstate->env->detach_subs));
|
||||
(*qstate->env->detach_subs)(qstate);
|
||||
iq->num_target_queries = 0;
|
||||
}
|
||||
}
|
||||
return next_state(iq, QUERYTARGETS_STATE);
|
||||
|
|
@ -2853,6 +2930,7 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
/* Count this as a referral. */
|
||||
iq->referral_count++;
|
||||
iq->sent_count = 0;
|
||||
iq->dp_target_count = 0;
|
||||
/* see if the next dp is a trust anchor, or a DS was sent
|
||||
* along, indicating dnssec is expected for next zone */
|
||||
iq->dnssec_expected = iter_indicates_dnssec(qstate->env,
|
||||
|
|
@ -2929,6 +3007,7 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
iq->dsns_point = NULL;
|
||||
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. */
|
||||
|
|
@ -3121,7 +3200,7 @@ processPrimeResponse(struct module_qstate* qstate, int id)
|
|||
if(!generate_sub_request(qstate->qinfo.qname,
|
||||
qstate->qinfo.qname_len, qstate->qinfo.qtype,
|
||||
qstate->qinfo.qclass, qstate, id, iq,
|
||||
INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1)) {
|
||||
INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1, 0)) {
|
||||
verbose(VERB_ALGO, "could not generate prime check");
|
||||
}
|
||||
generate_a_aaaa_check(qstate, iq, id);
|
||||
|
|
@ -3149,6 +3228,7 @@ static void
|
|||
processTargetResponse(struct module_qstate* qstate, int id,
|
||||
struct module_qstate* forq)
|
||||
{
|
||||
struct iter_env* ie = (struct iter_env*)qstate->env->modinfo[id];
|
||||
struct iter_qstate* iq = (struct iter_qstate*)qstate->minfo[id];
|
||||
struct iter_qstate* foriq = (struct iter_qstate*)forq->minfo[id];
|
||||
struct ub_packed_rrset_key* rrset;
|
||||
|
|
@ -3186,7 +3266,7 @@ processTargetResponse(struct module_qstate* qstate, int id,
|
|||
log_rrset_key(VERB_ALGO, "add parentside glue to dp",
|
||||
iq->pside_glue);
|
||||
if(!delegpt_add_rrset(foriq->dp, forq->region,
|
||||
iq->pside_glue, 1))
|
||||
iq->pside_glue, 1, NULL))
|
||||
log_err("out of memory adding pside glue");
|
||||
}
|
||||
|
||||
|
|
@ -3197,6 +3277,7 @@ processTargetResponse(struct module_qstate* qstate, int id,
|
|||
* response type was ANSWER. */
|
||||
rrset = reply_find_answer_rrset(&iq->qchase, qstate->return_msg->rep);
|
||||
if(rrset) {
|
||||
int additions = 0;
|
||||
/* if CNAMEs have been followed - add new NS to delegpt. */
|
||||
/* BTW. RFC 1918 says NS should not have got CNAMEs. Robust. */
|
||||
if(!delegpt_find_ns(foriq->dp, rrset->rk.dname,
|
||||
|
|
@ -3208,13 +3289,23 @@ processTargetResponse(struct module_qstate* qstate, int id,
|
|||
}
|
||||
/* if dpns->lame then set the address(es) lame too */
|
||||
if(!delegpt_add_rrset(foriq->dp, forq->region, rrset,
|
||||
dpns->lame))
|
||||
dpns->lame, &additions))
|
||||
log_err("out of memory adding targets");
|
||||
if(!additions) {
|
||||
/* no new addresses, increase the nxns counter, like
|
||||
* this could be a list of wildcards with no new
|
||||
* addresses */
|
||||
target_count_increase_nx(foriq, 1);
|
||||
}
|
||||
verbose(VERB_ALGO, "added target response");
|
||||
delegpt_log(VERB_ALGO, foriq->dp);
|
||||
} else {
|
||||
verbose(VERB_ALGO, "iterator TargetResponse failed");
|
||||
delegpt_mark_neg(dpns, qstate->qinfo.qtype);
|
||||
dpns->resolved = 1; /* fail the target */
|
||||
if((dpns->got4 == 2 || !ie->supports_ipv4) &&
|
||||
(dpns->got6 == 2 || !ie->supports_ipv6))
|
||||
target_count_increase_nx(foriq, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3388,7 +3479,7 @@ processCollectClass(struct module_qstate* qstate, int id)
|
|||
qstate->qinfo.qname_len, qstate->qinfo.qtype,
|
||||
c, qstate, id, iq, INIT_REQUEST_STATE,
|
||||
FINISHED_STATE, &subq,
|
||||
(int)!(qstate->query_flags&BIT_CD))) {
|
||||
(int)!(qstate->query_flags&BIT_CD), 0)) {
|
||||
errinf(qstate, "could not generate class ANY"
|
||||
" lookup query");
|
||||
return error_response(qstate, id,
|
||||
|
|
|
|||
|
|
@ -55,6 +55,11 @@ struct rbtree_type;
|
|||
|
||||
/** max number of targets spawned for a query and its subqueries */
|
||||
#define MAX_TARGET_COUNT 64
|
||||
/** max number of target lookups per qstate, per delegation point */
|
||||
#define MAX_DP_TARGET_COUNT 16
|
||||
/** max number of nxdomains allowed for target lookups for a query and
|
||||
* its subqueries */
|
||||
#define MAX_TARGET_NX 5
|
||||
/** max number of query restarts. Determines max number of CNAME chain. */
|
||||
#define MAX_RESTART_COUNT 8
|
||||
/** max number of referrals. Makes sure resolver does not run away */
|
||||
|
|
@ -305,9 +310,14 @@ struct iter_qstate {
|
|||
int sent_count;
|
||||
|
||||
/** number of target queries spawned in [1], for this query and its
|
||||
* subqueries, the malloced-array is shared, [0] refcount. */
|
||||
* subqueries, the malloced-array is shared, [0] refcount.
|
||||
* in [2] the number of nxdomains is counted. */
|
||||
int* target_count;
|
||||
|
||||
/** number of target lookups per delegation point. Reset to 0 after
|
||||
* receiving referral answer. Not shared with subqueries. */
|
||||
int dp_target_count;
|
||||
|
||||
/** if true, already tested for ratelimiting and passed the test */
|
||||
int ratelimit_ok;
|
||||
|
||||
|
|
|
|||
|
|
@ -642,6 +642,7 @@ struct ub_shm_stat_info {
|
|||
long long respip;
|
||||
long long dnscrypt_shared_secret;
|
||||
long long dnscrypt_nonce;
|
||||
long long dynlib;
|
||||
} mem;
|
||||
};
|
||||
|
||||
|
|
|
|||
10
services/cache/dns.c
vendored
10
services/cache/dns.c
vendored
|
|
@ -273,7 +273,7 @@ find_add_addrs(struct module_env* env, uint16_t qclass,
|
|||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_A, qclass, 0, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, 0)) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, 0, NULL)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -293,7 +293,7 @@ find_add_addrs(struct module_env* env, uint16_t qclass,
|
|||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_AAAA, qclass, 0, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, 0)) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, 0, NULL)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -327,7 +327,8 @@ cache_fill_missing(struct module_env* env, uint16_t qclass,
|
|||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_A, qclass, 0, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, ns->lame)) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, ns->lame,
|
||||
NULL)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -347,7 +348,8 @@ cache_fill_missing(struct module_env* env, uint16_t qclass,
|
|||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_AAAA, qclass, 0, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, ns->lame)) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, ns->lame,
|
||||
NULL)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -884,11 +884,11 @@ set_ip_dscp(int socket, int addrfamily, int dscp)
|
|||
ds = dscp << 2;
|
||||
switch(addrfamily) {
|
||||
case AF_INET6:
|
||||
if(setsockopt(socket, IPPROTO_IPV6, IPV6_TCLASS, &ds, sizeof(ds)) < 0)
|
||||
if(setsockopt(socket, IPPROTO_IPV6, IPV6_TCLASS, (void*)&ds, sizeof(ds)) < 0)
|
||||
return sock_strerror(errno);
|
||||
break;
|
||||
default:
|
||||
if(setsockopt(socket, IPPROTO_IP, IP_TOS, &ds, sizeof(ds)) < 0)
|
||||
if(setsockopt(socket, IPPROTO_IP, IP_TOS, (void*)&ds, sizeof(ds)) < 0)
|
||||
return sock_strerror(errno);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@
|
|||
#ifdef WITH_PYTHONMODULE
|
||||
#include "pythonmod/pythonmod.h"
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
#include "dynlibmod/dynlibmod.h"
|
||||
#endif
|
||||
#ifdef USE_CACHEDB
|
||||
#include "cachedb/cachedb.h"
|
||||
#endif
|
||||
|
|
@ -140,6 +143,9 @@ module_list_avail(void)
|
|||
#ifdef WITH_PYTHONMODULE
|
||||
"python",
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
"dynlib",
|
||||
#endif
|
||||
#ifdef USE_CACHEDB
|
||||
"cachedb",
|
||||
#endif
|
||||
|
|
@ -171,6 +177,9 @@ module_funcs_avail(void)
|
|||
#ifdef WITH_PYTHONMODULE
|
||||
&pythonmod_get_funcblock,
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
&dynlibmod_get_funcblock,
|
||||
#endif
|
||||
#ifdef USE_CACHEDB
|
||||
&cachedb_get_funcblock,
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ sldns_gmtime64_r(int64_t clock, struct tm *result)
|
|||
static int64_t
|
||||
sldns_serial_arithmetics_time(int32_t time, time_t now)
|
||||
{
|
||||
int32_t offset = time - (int32_t) now;
|
||||
int32_t offset = (int32_t)((uint32_t) time - (uint32_t) now);
|
||||
return (int64_t) now + offset;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -569,6 +569,64 @@ morechecks(struct config_file* cfg)
|
|||
&& strcmp(cfg->module_conf, "python dns64 iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "python dns64 validator iterator") != 0
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
&& strcmp(cfg->module_conf, "dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib dynlib dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "python dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "python dynlib dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "python dynlib dynlib dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib respip iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib dynlib validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib dynlib dynlib validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "python dynlib validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "python dynlib dynlib validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "python dynlib dynlib dynlib validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib respip validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "validator dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dns64 dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dns64 dynlib validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dns64 validator dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib dns64 iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib dns64 validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib dns64 cachedb iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib dns64 validator cachedb iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dns64 dynlib cachedb iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dns64 dynlib validator cachedb iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib cachedb iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib respip cachedb iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib validator cachedb iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib respip validator cachedb iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "cachedb dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "respip cachedb dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "validator cachedb dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "respip validator cachedb dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "validator dynlib cachedb iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "respip validator dynlib cachedb iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib subnetcache iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib respip subnetcache iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "subnetcache dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "respip subnetcache dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib subnetcache validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib respip subnetcache validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "subnetcache dynlib validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "respip subnetcache dynlib validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "subnetcache validator dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "respip subnetcache validator dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib ipsecmod iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib ipsecmod respip iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "ipsecmod dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "ipsecmod dynlib respip iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "ipsecmod validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "ipsecmod respip validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib ipsecmod validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "dynlib ipsecmod respip validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "ipsecmod dynlib validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "ipsecmod dynlib respip validator iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "ipsecmod validator dynlib iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "ipsecmod respip validator dynlib iterator") != 0
|
||||
#endif
|
||||
#ifdef USE_CACHEDB
|
||||
&& strcmp(cfg->module_conf, "validator cachedb iterator") != 0
|
||||
&& strcmp(cfg->module_conf, "respip validator cachedb iterator") != 0
|
||||
|
|
|
|||
|
|
@ -268,6 +268,9 @@ static void print_mem(struct ub_shm_stat_info* shm_stat,
|
|||
#ifdef USE_IPSECMOD
|
||||
PR_LL("mem.mod.ipsecmod", shm_stat->mem.ipsecmod);
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
PR_LL("mem.mod.dynlib", shm_stat->mem.dynlib);
|
||||
#endif
|
||||
#ifdef USE_DNSCRYPT
|
||||
PR_LL("mem.cache.dnscrypt_shared_secret",
|
||||
shm_stat->mem.dnscrypt_shared_secret);
|
||||
|
|
|
|||
|
|
@ -274,8 +274,6 @@ setup_config(FILE* in, int* lineno, int* pass_argc, char* pass_argv[])
|
|||
fprintf(cfg, " pidfile: \"\"\n");
|
||||
fprintf(cfg, " val-log-level: 2\n");
|
||||
fprintf(cfg, "remote-control: control-enable: no\n");
|
||||
/* some basic settings to facilitate testing */
|
||||
fprintf(cfg, "server: rrset-roundrobin: no\n");
|
||||
while(fgets(line, MAX_LINE_LEN-1, in)) {
|
||||
parse = line;
|
||||
(*lineno)++;
|
||||
|
|
|
|||
1
testdata/autotrust_10key.rpl
vendored
1
testdata/autotrust_10key.rpl
vendored
|
|
@ -106,7 +106,6 @@ www.example.com. IN A
|
|||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
RANGE_END
|
||||
|
||||
|
|
|
|||
1
testdata/autotrust_revtp.rpl
vendored
1
testdata/autotrust_revtp.rpl
vendored
|
|
@ -97,7 +97,6 @@ www.example.com. IN A
|
|||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
RANGE_END
|
||||
|
||||
|
|
|
|||
1
testdata/autotrust_revtp_read.rpl
vendored
1
testdata/autotrust_revtp_read.rpl
vendored
|
|
@ -85,7 +85,6 @@ www.example.com. IN A
|
|||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
RANGE_END
|
||||
|
||||
|
|
|
|||
1
testdata/black_data.rpl
vendored
1
testdata/black_data.rpl
vendored
|
|
@ -8,6 +8,7 @@ server:
|
|||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/black_prime.rpl
vendored
1
testdata/black_prime.rpl
vendored
|
|
@ -8,6 +8,7 @@ server:
|
|||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
32
testdata/dynlibmod.tdir/dynlibmod.conf
vendored
Normal file
32
testdata/dynlibmod.tdir/dynlibmod.conf
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
server:
|
||||
verbosity: 2
|
||||
num-threads: 3
|
||||
outgoing-range: 16
|
||||
interface: 127.0.0.1
|
||||
port: @PORT@
|
||||
use-syslog: no
|
||||
directory: ""
|
||||
pidfile: "unbound.pid"
|
||||
chroot: ""
|
||||
username: ""
|
||||
do-not-query-localhost: no
|
||||
local-zone: "example.net." redirect
|
||||
local-data: "example.net. IN A 10.20.30.41"
|
||||
module-config: "dynlib iterator"
|
||||
|
||||
dynlib:
|
||||
dynlib-file: "@DLL_FILE@"
|
||||
|
||||
remote-control:
|
||||
control-enable: yes
|
||||
control-interface: 127.0.0.1
|
||||
# control-interface: ::1
|
||||
control-port: @CONTROL_PORT@
|
||||
server-key-file: "unbound_server.key"
|
||||
server-cert-file: "unbound_server.pem"
|
||||
control-key-file: "unbound_control.key"
|
||||
control-cert-file: "unbound_control.pem"
|
||||
|
||||
forward-zone:
|
||||
name: "."
|
||||
forward-addr: "127.0.0.1@@TOPORT@"
|
||||
16
testdata/dynlibmod.tdir/dynlibmod.dsc
vendored
Normal file
16
testdata/dynlibmod.tdir/dynlibmod.dsc
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
BaseName: dynlibmod
|
||||
Version: 1.0
|
||||
Description: test dynlibmod module
|
||||
CreationDate: Tue May 19 15:00:38 CET 2020
|
||||
Maintainer: dr. W.C.A. Wijngaards
|
||||
Category:
|
||||
Component:
|
||||
CmdDepends:
|
||||
Depends:
|
||||
Help:
|
||||
Pre: dynlibmod.pre
|
||||
Post: dynlibmod.post
|
||||
Test: dynlibmod.test
|
||||
AuxFiles:
|
||||
Passed:
|
||||
Failure:
|
||||
15
testdata/dynlibmod.tdir/dynlibmod.post
vendored
Normal file
15
testdata/dynlibmod.tdir/dynlibmod.post
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# #-- dynlibmod.post --#
|
||||
# source the master var file when it's there
|
||||
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
||||
# source the test var file when it's there
|
||||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||
#
|
||||
# do your teardown here
|
||||
. ../common.sh
|
||||
PRE="../.."
|
||||
if grep "define WITH_DYNLIBMODULE 1" $PRE/config.h; then echo test enabled; else echo test skipped; exit 0; fi
|
||||
kill_pid $FWD_PID
|
||||
kill $UNBOUND_PID
|
||||
kill $UNBOUND_PID >/dev/null 2>&1
|
||||
cat unbound.log
|
||||
exit 0
|
||||
35
testdata/dynlibmod.tdir/dynlibmod.pre
vendored
Normal file
35
testdata/dynlibmod.tdir/dynlibmod.pre
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# #-- dynlibmod.pre--#
|
||||
# source the master var file when it's there
|
||||
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
||||
# use .tpkg.var.test for in test variable passing
|
||||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||
|
||||
. ../common.sh
|
||||
|
||||
PRE="../.."
|
||||
if grep "define WITH_DYNLIBMODULE 1" $PRE/config.h; then echo test enabled; else echo test skipped; exit 0; fi
|
||||
|
||||
get_random_port 3
|
||||
UNBOUND_PORT=$RND_PORT
|
||||
FWD_PORT=$(($RND_PORT + 1))
|
||||
CONTROL_PORT=$(($RND_PORT + 2))
|
||||
echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
|
||||
echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
|
||||
echo "CONTROL_PORT=$CONTROL_PORT" >> .tpkg.var.test
|
||||
|
||||
# start forwarder
|
||||
get_ldns_testns
|
||||
$LDNS_TESTNS -p $FWD_PORT dynlibmod.testns >fwd.log 2>&1 &
|
||||
FWD_PID=$!
|
||||
echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
|
||||
|
||||
# make config file
|
||||
if grep "define USE_WINSOCK 1" $PRE/config.h; then
|
||||
DLL_FILE="helloworld.dll"
|
||||
else
|
||||
DLL_FILE="helloworld.so"
|
||||
fi
|
||||
sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' -e 's/@CONTROL_PORT\@/'$CONTROL_PORT'/' -e 's/@DLL_FILE\@/'$DLL_FILE'/' < dynlibmod.conf > ub.conf
|
||||
|
||||
cat .tpkg.var.test
|
||||
wait_ldns_testns_up fwd.log
|
||||
74
testdata/dynlibmod.tdir/dynlibmod.test
vendored
Normal file
74
testdata/dynlibmod.tdir/dynlibmod.test
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# #-- dynlibmod.test --#
|
||||
# source the master var file when it's there
|
||||
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
||||
# use .tpkg.var.test for in test variable passing
|
||||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||
|
||||
. ../common.sh
|
||||
PRE="../.."
|
||||
if grep "define WITH_DYNLIBMODULE 1" $PRE/config.h; then echo test enabled; else echo test skipped; exit 0; fi
|
||||
|
||||
# compile the dynamic library module
|
||||
if grep "define USE_WINSOCK 1" $PRE/config.h; then
|
||||
echo "compile dynamic library dll for mingw"
|
||||
echo "x86_64-w64-mingw32-gcc -m64 -I$PRE -shared -Wall -fpic -o helloworld.dll $PRE/dynlibmod/examples/helloworld.c -L../.. -l:libunbound.a"
|
||||
x86_64-w64-mingw32-gcc -m64 -I$PRE -shared -Wall -fpic -o helloworld.dll $PRE/dynlibmod/examples/helloworld.c -L../.. -l:libunbound.a
|
||||
if test $? != 0; then
|
||||
echo "compile failure"
|
||||
exit 1;
|
||||
fi
|
||||
else
|
||||
echo "compile dynamic library"
|
||||
echo "gcc -I$PRE -shared -Wall -fpic -o helloworld.so $PRE/dynlibmod/examples/helloworld.c"
|
||||
gcc -I$PRE -shared -Wall -fpic -o helloworld.so $PRE/dynlibmod/examples/helloworld.c
|
||||
if test $? != 0; then
|
||||
echo "compile failure"
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
# start unbound in the background
|
||||
LD_LIBRARY_PATH="." $PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
|
||||
UNBOUND_PID=$!
|
||||
echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
|
||||
wait_unbound_up unbound.log
|
||||
|
||||
# test if the server is up.
|
||||
echo "> dig www.example.com."
|
||||
dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. | tee outfile
|
||||
echo "> check answer"
|
||||
if grep "10.20.30.40" outfile; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "> cat logfiles"
|
||||
cat fwd.log
|
||||
cat unbound.log
|
||||
echo "Not OK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "> check log for dynlibmod info"
|
||||
# wait for a moment for filesystem to catch up.
|
||||
if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
|
||||
if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
|
||||
if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
|
||||
if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
|
||||
if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
|
||||
if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 1; fi
|
||||
if grep "hello world from operate" unbound.log >/dev/null; then :; else sleep 10; fi
|
||||
if grep "hello world from operate" unbound.log; then echo "yes it is in unbound.log";
|
||||
else
|
||||
echo "information not in unbound.log"
|
||||
echo "failed"
|
||||
echo "> cat logfiles"
|
||||
cat fwd.log
|
||||
cat unbound.log
|
||||
echo "Not OK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "> cat logfiles"
|
||||
cat fwd.log
|
||||
cat unbound.log
|
||||
echo "> OK"
|
||||
exit 0
|
||||
22
testdata/dynlibmod.tdir/dynlibmod.testns
vendored
Normal file
22
testdata/dynlibmod.tdir/dynlibmod.testns
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
; nameserver test file
|
||||
$ORIGIN example.com.
|
||||
$TTL 3600
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
REPLY QR AA NOERROR
|
||||
ADJUST copy_id
|
||||
SECTION QUESTION
|
||||
www IN A
|
||||
SECTION ANSWER
|
||||
www IN A 10.20.30.40
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
REPLY QR AA SERVFAIL
|
||||
ADJUST copy_id
|
||||
SECTION QUESTION
|
||||
www.example.net. IN A
|
||||
ENTRY_END
|
||||
|
||||
15
testdata/dynlibmod.tdir/unbound_control.key
vendored
Normal file
15
testdata/dynlibmod.tdir/unbound_control.key
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXAIBAAKBgQDD6DogNCsSeEa1u99+6PUVbGzjMzzei9MIK6s94+zcpp7OAOBa
|
||||
rzPA0vlyuNtUsEN3qwPomQQQmIgbT7OXkzC1wqioxwa609xoL8oW/I7e336rEyvH
|
||||
ST6JwUdIg0Lzg/USJ81eTwMnzYSd4Bpsqr9eP33ubaR7Gh/6o76loLOlcQIDAQAB
|
||||
AoGAFT3e35MIgI4uDJJ8X0RfHp2NCO2LUg4TKbWical/C0W9vlR1/x80G1pE1d2Z
|
||||
WotqJVWTrOq6eBox19RCgtLg2wPGk9uD62+9SDT37heWFlUCElWq50pQG6k9ThiG
|
||||
DDypkZyZ/52+DdWybiaQJkuK6O5qQXuNAtVJMpghu4GnHAECQQDsupnZUQDpapzr
|
||||
4FC4MSkL2+A1PRt6g4VhwoqOpJXaHfVnH6F7AwUuOLNwGdR5Cvv70pfJ7Jqg8L2m
|
||||
Kxyl5bORAkEA09rn34YQ0pHJdHidbl2kInIuYTz09+TO3LWwan17nISH9aaYvVDr
|
||||
p9x1B4Qzw9qyxT9oll7ze/5Rw/7C3AQj4QJAT2B2a+b8bkgAXBs4FbruL3rHoDJg
|
||||
P2FQXSpVOWU4lg2LlsuFYvDtUMVUbZdLplanjZXcral3Y9W1Ub2M+ped8QJAYQN+
|
||||
aRpge7ys7vwIw7B36Bo3aOncF+ScYe+FkM5Tm7II/JHEofT7ZQwMP1vnxIlSkgbe
|
||||
YvWqNB6a3NC99LikoQJBAM4UhDdRg63Tr6Idky6CQaH///zAN7nArJfffKGWFdw9
|
||||
DKrWpNqvYZtX/cfEJucKcRCm5YL8CKFYbQy4VoCxUcE=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
11
testdata/dynlibmod.tdir/unbound_control.pem
vendored
Normal file
11
testdata/dynlibmod.tdir/unbound_control.pem
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIBozCCAQwCCQD6XaN6FzW/4DANBgkqhkiG9w0BAQUFADASMRAwDgYDVQQDEwd1
|
||||
bmJvdW5kMB4XDTA4MDkxMTA5MDk0MFoXDTI4MDUyOTA5MDk0MFowGjEYMBYGA1UE
|
||||
AxMPdW5ib3VuZC1jb250cm9sMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDD
|
||||
6DogNCsSeEa1u99+6PUVbGzjMzzei9MIK6s94+zcpp7OAOBarzPA0vlyuNtUsEN3
|
||||
qwPomQQQmIgbT7OXkzC1wqioxwa609xoL8oW/I7e336rEyvHST6JwUdIg0Lzg/US
|
||||
J81eTwMnzYSd4Bpsqr9eP33ubaR7Gh/6o76loLOlcQIDAQABMA0GCSqGSIb3DQEB
|
||||
BQUAA4GBAGFAXmaQHuFgAuc6HVhYZJdToxLBhfxGpot4oZNjcb1Cdoz3OL34MU1B
|
||||
9E5psj2PpGPIi8/RwoqBtAJHJ+J5cWngo03o4ZmdwKNSzaxlp141z/3rUtFqEHEC
|
||||
iO6gPCT3U7dt6MyC7r6vdMqyW6aldP3CtwD0gQziKAMoj+TAfAcq
|
||||
-----END CERTIFICATE-----
|
||||
15
testdata/dynlibmod.tdir/unbound_server.key
vendored
Normal file
15
testdata/dynlibmod.tdir/unbound_server.key
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICWwIBAAKBgQC3F7Jsv2u01pLL9rFnjsMU/IaCFUIz/624DcaE84Z4gjMl5kWA
|
||||
3axQcqul1wlwSrbKwrony+d9hH/+MX0tZwvl8w3OmhmOAiaQ+SHCsIuOjVwQjX0s
|
||||
RLB61Pz5+PAiVvnPa9JIYB5QrK6DVEsxIHj8MOc5JKORrnESsFDh6yeMeQIDAQAB
|
||||
AoGAAuWoGBprTOA8UGfl5LqYkaNxSWumsYXxLMFjC8WCsjN1NbtQDDr1uAwodSZS
|
||||
6ujzvX+ZTHnofs7y64XC8k34HTOCD2zlW7kijWbT8YjRYFU6o9F5zUGD9RCan0ds
|
||||
sVscT2psLSzfdsmFAcbmnGdxYkXk2PC1FHtaqExxehralGUCQQDcqrg9uQKXlhQi
|
||||
XAaPr8SiWvtRm2a9IMMZkRfUWZclPHq6fCWNuUaCD+cTat4wAuqeknAz33VEosw3
|
||||
fXGsok//AkEA1GjIHXrOcSlpfVJb6NeOBugjRtZ7ZDT5gbtnMS9ob0qntKV6saaL
|
||||
CNmJwuD9Q3XkU5j1+uHvYGP2NzcJd2CjhwJACV0hNlVMe9w9fHvFN4Gw6WbM9ViP
|
||||
0oS6YrJafYNTu5vGZXVxLoNnL4u3NYa6aPUmuZXjNwBLfJ8f5VboZPf6RwJAINd2
|
||||
oYA8bSi/A755MX4qmozH74r4Fx1Nuq5UHTm8RwDe/0Javx8F/j9MWpJY9lZDEF3l
|
||||
In5OebPa/NyInSmW/wJAZuP9aRn0nDBkHYri++1A7NykMiJ/nH0mDECbnk+wxx0S
|
||||
LwqIetBhxb8eQwMg45+iAH7CHAMQ8BQuF/nFE6eotg==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
11
testdata/dynlibmod.tdir/unbound_server.pem
vendored
Normal file
11
testdata/dynlibmod.tdir/unbound_server.pem
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIBmzCCAQQCCQDsNJ1UmphEFzANBgkqhkiG9w0BAQUFADASMRAwDgYDVQQDEwd1
|
||||
bmJvdW5kMB4XDTA4MDkxMTA5MDk0MFoXDTI4MDUyOTA5MDk0MFowEjEQMA4GA1UE
|
||||
AxMHdW5ib3VuZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtxeybL9rtNaS
|
||||
y/axZ47DFPyGghVCM/+tuA3GhPOGeIIzJeZFgN2sUHKrpdcJcEq2ysK6J8vnfYR/
|
||||
/jF9LWcL5fMNzpoZjgImkPkhwrCLjo1cEI19LESwetT8+fjwIlb5z2vSSGAeUKyu
|
||||
g1RLMSB4/DDnOSSjka5xErBQ4esnjHkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQAZ
|
||||
9N0lnLENs4JMvPS+mn8C5m9bkkFITd32IiLjf0zgYpIUbFXH6XaEr9GNZBUG8feG
|
||||
l/6WRXnbnVSblI5odQ4XxGZ9inYY6qtW30uv76HvoKp+QZ1c3460ddR8NauhcCHH
|
||||
Z7S+QbLXi+r2JAhpPozZCjBHlRD0ixzA1mKQTJhJZg==
|
||||
-----END CERTIFICATE-----
|
||||
|
|
@ -10,6 +10,7 @@ server:
|
|||
username: ""
|
||||
do-not-query-localhost: no
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
forward-zone:
|
||||
name: "."
|
||||
forward-addr: "127.0.0.1@@TOPORT@"
|
||||
|
|
|
|||
1
testdata/iter_lame_noaa.rpl
vendored
1
testdata/iter_lame_noaa.rpl
vendored
|
|
@ -4,6 +4,7 @@ server:
|
|||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: "no"
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/iter_lame_nosoa.rpl
vendored
1
testdata/iter_lame_nosoa.rpl
vendored
|
|
@ -2,6 +2,7 @@
|
|||
server:
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/iter_ns_badip.rpl
vendored
1
testdata/iter_ns_badip.rpl
vendored
|
|
@ -3,6 +3,7 @@ server:
|
|||
target-fetch-policy: "3 2 1 0 0"
|
||||
qname-minimisation: "no"
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/iter_pcnamech.rpl
vendored
1
testdata/iter_pcnamech.rpl
vendored
|
|
@ -2,6 +2,7 @@
|
|||
server:
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/iter_pcnamechrec.rpl
vendored
1
testdata/iter_pcnamechrec.rpl
vendored
|
|
@ -2,6 +2,7 @@
|
|||
server:
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/iter_ranoaa_lame.rpl
vendored
1
testdata/iter_ranoaa_lame.rpl
vendored
|
|
@ -2,6 +2,7 @@
|
|||
server:
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/iter_reclame_one.rpl
vendored
1
testdata/iter_reclame_one.rpl
vendored
|
|
@ -3,6 +3,7 @@ server:
|
|||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: "no"
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/iter_reclame_two.rpl
vendored
1
testdata/iter_reclame_two.rpl
vendored
|
|
@ -2,6 +2,7 @@
|
|||
server:
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/localdata.rpl
vendored
1
testdata/localdata.rpl
vendored
|
|
@ -4,6 +4,7 @@ server:
|
|||
hide-version: no
|
||||
identity: "test-identity"
|
||||
version: "test-version"
|
||||
rrset-roundrobin: no
|
||||
|
||||
; implicit transparent zone should not block id.server
|
||||
local-data: "mydata.server. CH A 10.11.12.13"
|
||||
|
|
|
|||
1
testdata/rpz_axfr.rpl
vendored
1
testdata/rpz_axfr.rpl
vendored
|
|
@ -3,6 +3,7 @@ server:
|
|||
module-config: "respip validator iterator"
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
rpz:
|
||||
name: "rpz.example.com."
|
||||
|
|
|
|||
1
testdata/rpz_ixfr.rpl
vendored
1
testdata/rpz_ixfr.rpl
vendored
|
|
@ -3,6 +3,7 @@ server:
|
|||
module-config: "respip validator iterator"
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
rpz:
|
||||
name: "rpz.example.com."
|
||||
|
|
|
|||
1
testdata/rrset_updated.rpl
vendored
1
testdata/rrset_updated.rpl
vendored
|
|
@ -2,6 +2,7 @@
|
|||
; config options go here.
|
||||
server:
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
forward-zone: name: "." forward-addr: 216.0.0.1
|
||||
CONFIG_END
|
||||
|
||||
|
|
|
|||
1
testdata/val_any.rpl
vendored
1
testdata/val_any.rpl
vendored
|
|
@ -7,6 +7,7 @@ server:
|
|||
qname-minimisation: "no"
|
||||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/val_any_dname.rpl
vendored
1
testdata/val_any_dname.rpl
vendored
|
|
@ -7,6 +7,7 @@ server:
|
|||
qname-minimisation: "no"
|
||||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
3
testdata/val_nsec3_b3_optout.rpl
vendored
3
testdata/val_nsec3_b3_optout.rpl
vendored
|
|
@ -1,12 +1,13 @@
|
|||
; config options
|
||||
server:
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
val-override-date: "20120420235959"
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: "no"
|
||||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
3
testdata/val_nsec3_b3_optout_negcache.rpl
vendored
3
testdata/val_nsec3_b3_optout_negcache.rpl
vendored
|
|
@ -1,12 +1,13 @@
|
|||
; config options
|
||||
server:
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
val-override-date: "20120420235959"
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: "no"
|
||||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
3
testdata/val_nsec3_b3_optout_noce.rpl
vendored
3
testdata/val_nsec3_b3_optout_noce.rpl
vendored
|
|
@ -1,11 +1,12 @@
|
|||
; config options
|
||||
server:
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
val-override-date: "20120420235959"
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: "no"
|
||||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
2
testdata/val_nsec3_b3_optout_nonc.rpl
vendored
2
testdata/val_nsec3_b3_optout_nonc.rpl
vendored
|
|
@ -1,6 +1,6 @@
|
|||
; config options
|
||||
server:
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
val-override-date: "20120420235959"
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: "no"
|
||||
|
|
|
|||
3
testdata/val_nsec3_b4_wild.rpl
vendored
3
testdata/val_nsec3_b4_wild.rpl
vendored
|
|
@ -1,11 +1,12 @@
|
|||
; config options
|
||||
server:
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
val-override-date: "20120420235959"
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: "no"
|
||||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
2
testdata/val_nsec3_b5_wcnodata.rpl
vendored
2
testdata/val_nsec3_b5_wcnodata.rpl
vendored
|
|
@ -1,6 +1,6 @@
|
|||
; config options
|
||||
server:
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
val-override-date: "20120420235959"
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: "no"
|
||||
|
|
|
|||
2
testdata/val_nsec3_b5_wcnodata_noce.rpl
vendored
2
testdata/val_nsec3_b5_wcnodata_noce.rpl
vendored
|
|
@ -1,6 +1,6 @@
|
|||
; config options
|
||||
server:
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
val-override-date: "20120420235959"
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: "no"
|
||||
|
|
|
|||
2
testdata/val_nsec3_b5_wcnodata_nonc.rpl
vendored
2
testdata/val_nsec3_b5_wcnodata_nonc.rpl
vendored
|
|
@ -1,6 +1,6 @@
|
|||
; config options
|
||||
server:
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
val-override-date: "20120420235959"
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: "no"
|
||||
|
|
|
|||
2
testdata/val_nsec3_b5_wcnodata_nowc.rpl
vendored
2
testdata/val_nsec3_b5_wcnodata_nowc.rpl
vendored
|
|
@ -1,6 +1,6 @@
|
|||
; config options
|
||||
server:
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
trust-anchor: "example. DNSKEY 257 3 7 AwEAAcUlFV1vhmqx6NSOUOq2R/dsR7Xm3upJ ( j7IommWSpJABVfW8Q0rOvXdM6kzt+TAu92L9 AbsUdblMFin8CVF3n4s= )"
|
||||
val-override-date: "20120420235959"
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
qname-minimisation: "no"
|
||||
|
|
|
|||
1
testdata/val_nsec3_wcany.rpl
vendored
1
testdata/val_nsec3_wcany.rpl
vendored
|
|
@ -7,6 +7,7 @@ server:
|
|||
qname-minimisation: "no"
|
||||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/val_nx_nsec3_collision.rpl
vendored
1
testdata/val_nx_nsec3_collision.rpl
vendored
|
|
@ -7,6 +7,7 @@ server:
|
|||
qname-minimisation: "no"
|
||||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/val_refer_unsignadd.rpl
vendored
1
testdata/val_refer_unsignadd.rpl
vendored
|
|
@ -9,6 +9,7 @@ server:
|
|||
qname-minimisation: "no"
|
||||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/val_referglue.rpl
vendored
1
testdata/val_referglue.rpl
vendored
|
|
@ -10,6 +10,7 @@ server:
|
|||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
|
|
|
|||
1
testdata/val_twocname.rpl
vendored
1
testdata/val_twocname.rpl
vendored
|
|
@ -5,6 +5,7 @@ server:
|
|||
fake-sha1: yes
|
||||
trust-anchor-signaling: no
|
||||
minimal-responses: no
|
||||
rrset-roundrobin: no
|
||||
|
||||
forward-zone:
|
||||
name: "."
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@ config_create(void)
|
|||
cfg->unblock_lan_zones = 0;
|
||||
cfg->insecure_lan_zones = 0;
|
||||
cfg->python_script = NULL;
|
||||
cfg->dynlib_file = NULL;
|
||||
cfg->remote_control_enable = 0;
|
||||
cfg->control_ifs.first = NULL;
|
||||
cfg->control_ifs.last = NULL;
|
||||
|
|
@ -630,6 +631,7 @@ int config_set_option(struct config_file* cfg, const char* opt,
|
|||
else S_STR("control-cert-file:", control_cert_file)
|
||||
else S_STR("module-config:", module_conf)
|
||||
else S_STRLIST("python-script:", python_script)
|
||||
else S_STRLIST("dynlib-file:", dynlib_file)
|
||||
else S_YNO("disable-dnssec-lame-check:", disable_dnssec_lame_check)
|
||||
#ifdef CLIENT_SUBNET
|
||||
/* Can't set max subnet prefix here, since that value is used when
|
||||
|
|
@ -1102,6 +1104,7 @@ config_get_option(struct config_file* cfg, const char* opt,
|
|||
else O_YNO(opt, "insecure-lan-zones", insecure_lan_zones)
|
||||
else O_DEC(opt, "max-udp-size", max_udp_size)
|
||||
else O_LST(opt, "python-script", python_script)
|
||||
else O_LST(opt, "dynlib-file", dynlib_file)
|
||||
else O_YNO(opt, "disable-dnssec-lame-check", disable_dnssec_lame_check)
|
||||
else O_DEC(opt, "ip-ratelimit", ip_ratelimit)
|
||||
else O_DEC(opt, "ratelimit", ratelimit)
|
||||
|
|
@ -1495,6 +1498,7 @@ config_delete(struct config_file* cfg)
|
|||
config_deldblstrlist(cfg->ratelimit_for_domain);
|
||||
config_deldblstrlist(cfg->ratelimit_below_domain);
|
||||
config_delstrlist(cfg->python_script);
|
||||
config_delstrlist(cfg->dynlib_file);
|
||||
#ifdef USE_IPSECMOD
|
||||
free(cfg->ipsecmod_hook);
|
||||
config_delstrlist(cfg->ipsecmod_whitelist);
|
||||
|
|
|
|||
|
|
@ -452,6 +452,9 @@ struct config_file {
|
|||
/** Python script file */
|
||||
struct config_strlist* python_script;
|
||||
|
||||
/** Dynamic library file */
|
||||
struct config_strlist* dynlib_file;
|
||||
|
||||
/** Use systemd socket activation. */
|
||||
int use_systemd;
|
||||
|
||||
|
|
|
|||
4600
util/configlexer.c
4600
util/configlexer.c
File diff suppressed because it is too large
Load diff
|
|
@ -416,6 +416,8 @@ control-key-file{COLON} { YDVAR(1, VAR_CONTROL_KEY_FILE) }
|
|||
control-cert-file{COLON} { YDVAR(1, VAR_CONTROL_CERT_FILE) }
|
||||
python-script{COLON} { YDVAR(1, VAR_PYTHON_SCRIPT) }
|
||||
python{COLON} { YDVAR(0, VAR_PYTHON) }
|
||||
dynlib-file{COLON} { YDVAR(1, VAR_DYNLIB_FILE) }
|
||||
dynlib{COLON} { YDVAR(0, VAR_DYNLIB) }
|
||||
domain-insecure{COLON} { YDVAR(1, VAR_DOMAIN_INSECURE) }
|
||||
minimal-responses{COLON} { YDVAR(1, VAR_MINIMAL_RESPONSES) }
|
||||
rrset-roundrobin{COLON} { YDVAR(1, VAR_RRSET_ROUNDROBIN) }
|
||||
|
|
|
|||
2843
util/configparser.c
2843
util/configparser.c
File diff suppressed because it is too large
Load diff
|
|
@ -334,7 +334,9 @@ extern int yydebug;
|
|||
VAR_RPZ_ACTION_OVERRIDE = 540,
|
||||
VAR_RPZ_CNAME_OVERRIDE = 541,
|
||||
VAR_RPZ_LOG = 542,
|
||||
VAR_RPZ_LOG_NAME = 543
|
||||
VAR_RPZ_LOG_NAME = 543,
|
||||
VAR_DYNLIB = 544,
|
||||
VAR_DYNLIB_FILE = 545
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
|
|
@ -624,6 +626,8 @@ extern int yydebug;
|
|||
#define VAR_RPZ_CNAME_OVERRIDE 541
|
||||
#define VAR_RPZ_LOG 542
|
||||
#define VAR_RPZ_LOG_NAME 543
|
||||
#define VAR_DYNLIB 544
|
||||
#define VAR_DYNLIB_FILE 545
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
|
|
@ -633,7 +637,7 @@ union YYSTYPE
|
|||
|
||||
char* str;
|
||||
|
||||
#line 637 "util/configparser.h"
|
||||
#line 641 "util/configparser.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ extern struct config_parser_state* cfg_parser;
|
|||
%token VAR_IPSET VAR_IPSET_NAME_V4 VAR_IPSET_NAME_V6
|
||||
%token VAR_TLS_SESSION_TICKET_KEYS VAR_RPZ VAR_TAGS VAR_RPZ_ACTION_OVERRIDE
|
||||
%token VAR_RPZ_CNAME_OVERRIDE VAR_RPZ_LOG VAR_RPZ_LOG_NAME
|
||||
%token VAR_DYNLIB VAR_DYNLIB_FILE
|
||||
|
||||
%%
|
||||
toplevelvars: /* empty */ | toplevelvars toplevelvar ;
|
||||
|
|
@ -182,7 +183,7 @@ toplevelvar: serverstart contents_server | stubstart contents_stub |
|
|||
rcstart contents_rc | dtstart contents_dt | viewstart contents_view |
|
||||
dnscstart contents_dnsc | cachedbstart contents_cachedb |
|
||||
ipsetstart contents_ipset | authstart contents_auth |
|
||||
rpzstart contents_rpz
|
||||
rpzstart contents_rpz | dynlibstart contents_dl
|
||||
;
|
||||
|
||||
/* server: declaration */
|
||||
|
|
@ -2947,6 +2948,21 @@ py_script: VAR_PYTHON_SCRIPT STRING_ARG
|
|||
if(!cfg_strlist_append_ex(&cfg_parser->cfg->python_script, $2))
|
||||
yyerror("out of memory");
|
||||
}
|
||||
dynlibstart: VAR_DYNLIB
|
||||
{
|
||||
OUTYY(("\nP(dynlib:)\n"));
|
||||
}
|
||||
;
|
||||
contents_dl: contents_dl content_dl
|
||||
| ;
|
||||
content_dl: dl_file
|
||||
;
|
||||
dl_file: VAR_DYNLIB_FILE STRING_ARG
|
||||
{
|
||||
OUTYY(("P(dynlib-file:%s)\n", $2));
|
||||
if(!cfg_strlist_append_ex(&cfg_parser->cfg->dynlib_file, $2))
|
||||
yyerror("out of memory");
|
||||
}
|
||||
server_disable_dnssec_lame_check: VAR_DISABLE_DNSSEC_LAME_CHECK STRING_ARG
|
||||
{
|
||||
OUTYY(("P(disable_dnssec_lame_check:%s)\n", $2));
|
||||
|
|
|
|||
|
|
@ -233,17 +233,28 @@ int
|
|||
dname_pkt_compare(sldns_buffer* pkt, uint8_t* d1, uint8_t* d2)
|
||||
{
|
||||
uint8_t len1, len2;
|
||||
int count1 = 0, count2 = 0;
|
||||
log_assert(pkt && d1 && d2);
|
||||
len1 = *d1++;
|
||||
len2 = *d2++;
|
||||
while( len1 != 0 || len2 != 0 ) {
|
||||
/* resolve ptrs */
|
||||
if(LABEL_IS_PTR(len1)) {
|
||||
if((size_t)PTR_OFFSET(len1, *d1)
|
||||
>= sldns_buffer_limit(pkt))
|
||||
return -1;
|
||||
if(count1++ > MAX_COMPRESS_PTRS)
|
||||
return -1;
|
||||
d1 = sldns_buffer_at(pkt, PTR_OFFSET(len1, *d1));
|
||||
len1 = *d1++;
|
||||
continue;
|
||||
}
|
||||
if(LABEL_IS_PTR(len2)) {
|
||||
if((size_t)PTR_OFFSET(len2, *d2)
|
||||
>= sldns_buffer_limit(pkt))
|
||||
return 1;
|
||||
if(count2++ > MAX_COMPRESS_PTRS)
|
||||
return 1;
|
||||
d2 = sldns_buffer_at(pkt, PTR_OFFSET(len2, *d2));
|
||||
len2 = *d2++;
|
||||
continue;
|
||||
|
|
@ -302,12 +313,18 @@ dname_pkt_hash(sldns_buffer* pkt, uint8_t* dname, hashvalue_type h)
|
|||
uint8_t labuf[LDNS_MAX_LABELLEN+1];
|
||||
uint8_t lablen;
|
||||
int i;
|
||||
int count = 0;
|
||||
|
||||
/* preserve case of query, make hash label by label */
|
||||
lablen = *dname++;
|
||||
while(lablen) {
|
||||
if(LABEL_IS_PTR(lablen)) {
|
||||
/* follow pointer */
|
||||
if((size_t)PTR_OFFSET(lablen, *dname)
|
||||
>= sldns_buffer_limit(pkt))
|
||||
return h;
|
||||
if(count++ > MAX_COMPRESS_PTRS)
|
||||
return h;
|
||||
dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
|
||||
lablen = *dname++;
|
||||
continue;
|
||||
|
|
@ -341,6 +358,9 @@ void dname_pkt_copy(sldns_buffer* pkt, uint8_t* to, uint8_t* dname)
|
|||
return;
|
||||
}
|
||||
/* follow pointer */
|
||||
if((size_t)PTR_OFFSET(lablen, *dname)
|
||||
>= sldns_buffer_limit(pkt))
|
||||
return;
|
||||
dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
|
||||
lablen = *dname++;
|
||||
continue;
|
||||
|
|
@ -369,6 +389,7 @@ void dname_pkt_copy(sldns_buffer* pkt, uint8_t* to, uint8_t* dname)
|
|||
void dname_print(FILE* out, struct sldns_buffer* pkt, uint8_t* dname)
|
||||
{
|
||||
uint8_t lablen;
|
||||
int count = 0;
|
||||
if(!out) out = stdout;
|
||||
if(!dname) return;
|
||||
|
||||
|
|
@ -382,6 +403,15 @@ void dname_print(FILE* out, struct sldns_buffer* pkt, uint8_t* dname)
|
|||
fputs("??compressionptr??", out);
|
||||
return;
|
||||
}
|
||||
if((size_t)PTR_OFFSET(lablen, *dname)
|
||||
>= sldns_buffer_limit(pkt)) {
|
||||
fputs("??compressionptr??", out);
|
||||
return;
|
||||
}
|
||||
if(count++ > MAX_COMPRESS_PTRS) {
|
||||
fputs("??compressionptr??", out);
|
||||
return;
|
||||
}
|
||||
dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
|
||||
lablen = *dname++;
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,11 @@ smart_compare(sldns_buffer* pkt, uint8_t* dnow,
|
|||
{
|
||||
if(LABEL_IS_PTR(*dnow)) {
|
||||
/* ptr points to a previous dname */
|
||||
uint8_t* p = sldns_buffer_at(pkt, PTR_OFFSET(dnow[0], dnow[1]));
|
||||
uint8_t* p;
|
||||
if((size_t)PTR_OFFSET(dnow[0], dnow[1])
|
||||
>= sldns_buffer_limit(pkt))
|
||||
return -1;
|
||||
p = sldns_buffer_at(pkt, PTR_OFFSET(dnow[0], dnow[1]));
|
||||
if( p == dprfirst || p == dprlast )
|
||||
return 0;
|
||||
/* prev dname is also a ptr, both ptrs are the same. */
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@
|
|||
#ifdef WITH_PYTHONMODULE
|
||||
#include "pythonmod/pythonmod.h"
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
#include "dynlibmod/dynlibmod.h"
|
||||
#endif
|
||||
#ifdef USE_CACHEDB
|
||||
#include "cachedb/cachedb.h"
|
||||
#endif
|
||||
|
|
@ -392,6 +395,9 @@ fptr_whitelist_mod_init(int (*fptr)(struct module_env* env, int id))
|
|||
#ifdef WITH_PYTHONMODULE
|
||||
else if(fptr == &pythonmod_init) return 1;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
else if(fptr == &dynlibmod_init) return 1;
|
||||
#endif
|
||||
#ifdef USE_CACHEDB
|
||||
else if(fptr == &cachedb_init) return 1;
|
||||
#endif
|
||||
|
|
@ -417,6 +423,9 @@ fptr_whitelist_mod_deinit(void (*fptr)(struct module_env* env, int id))
|
|||
#ifdef WITH_PYTHONMODULE
|
||||
else if(fptr == &pythonmod_deinit) return 1;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
else if(fptr == &dynlibmod_deinit) return 1;
|
||||
#endif
|
||||
#ifdef USE_CACHEDB
|
||||
else if(fptr == &cachedb_deinit) return 1;
|
||||
#endif
|
||||
|
|
@ -443,6 +452,9 @@ fptr_whitelist_mod_operate(void (*fptr)(struct module_qstate* qstate,
|
|||
#ifdef WITH_PYTHONMODULE
|
||||
else if(fptr == &pythonmod_operate) return 1;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
else if(fptr == &dynlibmod_operate) return 1;
|
||||
#endif
|
||||
#ifdef USE_CACHEDB
|
||||
else if(fptr == &cachedb_operate) return 1;
|
||||
#endif
|
||||
|
|
@ -469,6 +481,9 @@ fptr_whitelist_mod_inform_super(void (*fptr)(
|
|||
#ifdef WITH_PYTHONMODULE
|
||||
else if(fptr == &pythonmod_inform_super) return 1;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
else if(fptr == &dynlibmod_inform_super) return 1;
|
||||
#endif
|
||||
#ifdef USE_CACHEDB
|
||||
else if(fptr == &cachedb_inform_super) return 1;
|
||||
#endif
|
||||
|
|
@ -495,6 +510,9 @@ fptr_whitelist_mod_clear(void (*fptr)(struct module_qstate* qstate,
|
|||
#ifdef WITH_PYTHONMODULE
|
||||
else if(fptr == &pythonmod_clear) return 1;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
else if(fptr == &dynlibmod_clear) return 1;
|
||||
#endif
|
||||
#ifdef USE_CACHEDB
|
||||
else if(fptr == &cachedb_clear) return 1;
|
||||
#endif
|
||||
|
|
@ -520,6 +538,9 @@ fptr_whitelist_mod_get_mem(size_t (*fptr)(struct module_env* env, int id))
|
|||
#ifdef WITH_PYTHONMODULE
|
||||
else if(fptr == &pythonmod_get_mem) return 1;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
else if(fptr == &dynlibmod_get_mem) return 1;
|
||||
#endif
|
||||
#ifdef USE_CACHEDB
|
||||
else if(fptr == &cachedb_get_mem) return 1;
|
||||
#endif
|
||||
|
|
@ -577,18 +598,30 @@ int fptr_whitelist_inplace_cb_reply_generic(inplace_cb_reply_func_type* fptr,
|
|||
if(type == inplace_cb_reply) {
|
||||
#ifdef WITH_PYTHONMODULE
|
||||
if(fptr == &python_inplace_cb_reply_generic) return 1;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
|
||||
#endif
|
||||
} else if(type == inplace_cb_reply_cache) {
|
||||
#ifdef WITH_PYTHONMODULE
|
||||
if(fptr == &python_inplace_cb_reply_generic) return 1;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
|
||||
#endif
|
||||
} else if(type == inplace_cb_reply_local) {
|
||||
#ifdef WITH_PYTHONMODULE
|
||||
if(fptr == &python_inplace_cb_reply_generic) return 1;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
|
||||
#endif
|
||||
} else if(type == inplace_cb_reply_servfail) {
|
||||
#ifdef WITH_PYTHONMODULE
|
||||
if(fptr == &python_inplace_cb_reply_generic) return 1;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -603,6 +636,10 @@ int fptr_whitelist_inplace_cb_query(inplace_cb_query_func_type* fptr)
|
|||
#ifdef WITH_PYTHONMODULE
|
||||
if(fptr == &python_inplace_cb_query_generic)
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
if(fptr == &dynlib_inplace_cb_query_generic)
|
||||
return 1;
|
||||
#endif
|
||||
(void)fptr;
|
||||
return 0;
|
||||
|
|
@ -616,6 +653,10 @@ int fptr_whitelist_inplace_cb_edns_back_parsed(
|
|||
return 1;
|
||||
#else
|
||||
(void)fptr;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
if(fptr == &dynlib_inplace_cb_edns_back_parsed)
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -628,6 +669,10 @@ int fptr_whitelist_inplace_cb_query_response(
|
|||
return 1;
|
||||
#else
|
||||
(void)fptr;
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
if(fptr == &dynlib_inplace_cb_query_response)
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -284,6 +284,10 @@ void shm_main_run(struct worker *worker)
|
|||
#ifdef USE_IPSECMOD
|
||||
shm_stat->mem.ipsecmod = (long long)mod_get_mem(&worker->env,
|
||||
"ipsecmod");
|
||||
#endif
|
||||
#ifdef WITH_DYNLIBMODULE
|
||||
shm_stat->mem.dynlib = (long long)mod_get_mem(&worker->env,
|
||||
"dynlib");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ const char* ub_event_get_version(void)
|
|||
return event_get_version();
|
||||
}
|
||||
|
||||
#if (defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && defined(EVBACKEND_SELECT)
|
||||
#if (defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && defined(EV_FEATURE_BACKENDS)
|
||||
static const char* ub_ev_backend2str(int b)
|
||||
{
|
||||
switch(b) {
|
||||
|
|
@ -184,7 +184,7 @@ ub_get_event_sys(struct ub_event_base* base, const char** n, const char** s,
|
|||
*n = "libev";
|
||||
if (!b)
|
||||
b = (struct event_base*)ev_default_loop(EVFLAG_AUTO);
|
||||
# ifdef EVBACKEND_SELECT
|
||||
# ifdef EV_FEATURE_BACKENDS
|
||||
*m = ub_ev_backend2str(ev_backend((struct ev_loop*)b));
|
||||
# else
|
||||
*m = "not obtainable";
|
||||
|
|
|
|||
Loading…
Reference in a new issue