Module Name: src Committed By: christos Date: Mon Jun 26 22:03:01 UTC 2023
Modified Files: src/external/mpl/bind/dist: configure src/external/mpl/bind/dist/bin/dig: dighost.c src/external/mpl/bind/dist/bin/named: controlconf.c logconf.c main.c server.c zoneconf.c src/external/mpl/bind/dist/bin/nsupdate: nsupdate.c src/external/mpl/bind/dist/bin/rndc: rndc.c src/external/mpl/bind/dist/bin/tests/optional: ratelimiter_test.c rbt_test.c shutdown_test.c sock_test.c task_test.c timer_test.c src/external/mpl/bind/dist/bin/tests/system: feature-test.c src/external/mpl/bind/dist/fuzz: fuzz.h src/external/mpl/bind/dist/lib/dns: catz.c dnsrps.c hmac_link.c keymgr.c keytable.c master.c nsec3.c nta.c rbt.c rbtdb.c request.c resolver.c rpz.c validator.c view.c xfrin.c zone.c src/external/mpl/bind/dist/lib/dns/include/dns: view.h zt.h src/external/mpl/bind/dist/lib/irs: getaddrinfo.c resconf.c src/external/mpl/bind/dist/lib/isc: iterated_hash.c lib.c log.c mem.c ratelimiter.c task.c timer.c src/external/mpl/bind/dist/lib/isc/include/isc: task.h timer.h src/external/mpl/bind/dist/lib/isc/netmgr: netmgr.c src/external/mpl/bind/dist/lib/isc/tests: task_test.c timer_test.c src/external/mpl/bind/dist/lib/ns: query.c src/external/mpl/bind/lib/libisc: Makefile Removed Files: src/external/mpl/bind/dist: tsan-suppressions.txt src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1: controls.conf.in named.dirconf named.iso8601 named.iso8601-utc named.pipeconf named.plain named.plainconf named.symconf named.tsconf named.unlimited named.versconf rndc.conf.in root.db src/external/mpl/bind/dist/bin/tests/system/ttl: tests.sh src/external/mpl/bind/dist/doc/man: named-compilezone.1in Log Message: merge conflicts between 9.16.37 and 9.16.42 To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/external/mpl/bind/dist/configure cvs rdiff -u -r1.1.1.1 -r0 src/external/mpl/bind/dist/tsan-suppressions.txt cvs rdiff -u -r1.14 -r1.15 src/external/mpl/bind/dist/bin/dig/dighost.c cvs rdiff -u -r1.10 -r1.11 src/external/mpl/bind/dist/bin/named/controlconf.c cvs rdiff -u -r1.7 -r1.8 src/external/mpl/bind/dist/bin/named/logconf.c cvs rdiff -u -r1.14 -r1.15 src/external/mpl/bind/dist/bin/named/main.c cvs rdiff -u -r1.19 -r1.20 src/external/mpl/bind/dist/bin/named/server.c cvs rdiff -u -r1.13 -r1.14 src/external/mpl/bind/dist/bin/named/zoneconf.c cvs rdiff -u -r1.12 -r1.13 src/external/mpl/bind/dist/bin/nsupdate/nsupdate.c cvs rdiff -u -r1.9 -r1.10 src/external/mpl/bind/dist/bin/rndc/rndc.c cvs rdiff -u -r1.6 -r1.7 \ src/external/mpl/bind/dist/bin/tests/optional/ratelimiter_test.c \ src/external/mpl/bind/dist/bin/tests/optional/sock_test.c \ src/external/mpl/bind/dist/bin/tests/optional/task_test.c cvs rdiff -u -r1.7 -r1.8 \ src/external/mpl/bind/dist/bin/tests/optional/rbt_test.c \ src/external/mpl/bind/dist/bin/tests/optional/shutdown_test.c \ src/external/mpl/bind/dist/bin/tests/optional/timer_test.c cvs rdiff -u -r1.10 -r1.11 \ src/external/mpl/bind/dist/bin/tests/system/feature-test.c cvs rdiff -u -r1.1.1.2 -r0 \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/controls.conf.in \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/rndc.conf.in \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/root.db cvs rdiff -u -r1.1.1.3 -r0 \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/named.dirconf \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/named.iso8601 \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/named.iso8601-utc \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/named.pipeconf \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/named.plain \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/named.plainconf \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/named.symconf \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/named.tsconf \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/named.unlimited \ src/external/mpl/bind/dist/bin/tests/system/logfileconfig/ns1/named.versconf cvs rdiff -u -r1.1.1.3 -r0 \ src/external/mpl/bind/dist/bin/tests/system/ttl/tests.sh cvs rdiff -u -r1.1.1.1 -r0 \ src/external/mpl/bind/dist/doc/man/named-compilezone.1in cvs rdiff -u -r1.5 -r1.6 src/external/mpl/bind/dist/fuzz/fuzz.h cvs rdiff -u -r1.9 -r1.10 src/external/mpl/bind/dist/lib/dns/catz.c \ src/external/mpl/bind/dist/lib/dns/dnsrps.c \ src/external/mpl/bind/dist/lib/dns/keymgr.c cvs rdiff -u -r1.7 -r1.8 src/external/mpl/bind/dist/lib/dns/hmac_link.c \ src/external/mpl/bind/dist/lib/dns/request.c cvs rdiff -u -r1.8 -r1.9 src/external/mpl/bind/dist/lib/dns/keytable.c \ src/external/mpl/bind/dist/lib/dns/nta.c cvs rdiff -u -r1.10 -r1.11 src/external/mpl/bind/dist/lib/dns/master.c cvs rdiff -u -r1.11 -r1.12 src/external/mpl/bind/dist/lib/dns/nsec3.c cvs rdiff -u -r1.12 -r1.13 src/external/mpl/bind/dist/lib/dns/rbt.c \ src/external/mpl/bind/dist/lib/dns/rpz.c \ src/external/mpl/bind/dist/lib/dns/validator.c \ src/external/mpl/bind/dist/lib/dns/xfrin.c cvs rdiff -u -r1.16 -r1.17 src/external/mpl/bind/dist/lib/dns/rbtdb.c \ src/external/mpl/bind/dist/lib/dns/resolver.c cvs rdiff -u -r1.13 -r1.14 src/external/mpl/bind/dist/lib/dns/view.c cvs rdiff -u -r1.17 -r1.18 src/external/mpl/bind/dist/lib/dns/zone.c cvs rdiff -u -r1.8 -r1.9 \ src/external/mpl/bind/dist/lib/dns/include/dns/view.h cvs rdiff -u -r1.7 -r1.8 src/external/mpl/bind/dist/lib/dns/include/dns/zt.h cvs rdiff -u -r1.8 -r1.9 src/external/mpl/bind/dist/lib/irs/getaddrinfo.c cvs rdiff -u -r1.6 -r1.7 src/external/mpl/bind/dist/lib/irs/resconf.c cvs rdiff -u -r1.6 -r1.7 src/external/mpl/bind/dist/lib/isc/iterated_hash.c cvs rdiff -u -r1.9 -r1.10 src/external/mpl/bind/dist/lib/isc/lib.c cvs rdiff -u -r1.8 -r1.9 src/external/mpl/bind/dist/lib/isc/log.c cvs rdiff -u -r1.13 -r1.14 src/external/mpl/bind/dist/lib/isc/mem.c cvs rdiff -u -r1.7 -r1.8 src/external/mpl/bind/dist/lib/isc/ratelimiter.c cvs rdiff -u -r1.17 -r1.18 src/external/mpl/bind/dist/lib/isc/task.c cvs rdiff -u -r1.11 -r1.12 src/external/mpl/bind/dist/lib/isc/timer.c cvs rdiff -u -r1.7 -r1.8 \ src/external/mpl/bind/dist/lib/isc/include/isc/task.h \ src/external/mpl/bind/dist/lib/isc/include/isc/timer.h cvs rdiff -u -r1.9 -r1.10 src/external/mpl/bind/dist/lib/isc/netmgr/netmgr.c cvs rdiff -u -r1.11 -r1.12 \ src/external/mpl/bind/dist/lib/isc/tests/task_test.c cvs rdiff -u -r1.9 -r1.10 \ src/external/mpl/bind/dist/lib/isc/tests/timer_test.c cvs rdiff -u -r1.16 -r1.17 src/external/mpl/bind/dist/lib/ns/query.c cvs rdiff -u -r1.19 -r1.20 src/external/mpl/bind/lib/libisc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/mpl/bind/dist/configure diff -u src/external/mpl/bind/dist/configure:1.15 src/external/mpl/bind/dist/configure:1.16 --- src/external/mpl/bind/dist/configure:1.15 Wed Jan 25 16:43:22 2023 +++ src/external/mpl/bind/dist/configure Mon Jun 26 18:02:59 2023 @@ -686,6 +686,7 @@ PDFTARGET HTMLTARGET PDFLATEX RELEASE_DATE +BUILD_MANPAGES HAVE_XELATEX_FALSE HAVE_XELATEX_TRUE LATEXMK @@ -16140,23 +16141,21 @@ done # libuv -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libuv" >&5 -$as_echo_n "checking for libuv... " >&6; } pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libuv >= 1.0.0" >&5 -$as_echo_n "checking for libuv >= 1.0.0... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libuv >= 1.37.0" >&5 +printf %s "checking for libuv >= 1.37.0... " >&6; } if test -n "$LIBUV_CFLAGS"; then pkg_cv_LIBUV_CFLAGS="$LIBUV_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuv >= 1.0.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libuv >= 1.0.0") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuv >= 1.37.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libuv >= 1.37.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_LIBUV_CFLAGS=`$PKG_CONFIG --cflags "libuv >= 1.0.0" 2>/dev/null` + pkg_cv_LIBUV_CFLAGS=`$PKG_CONFIG --cflags "libuv >= 1.37.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -16168,12 +16167,12 @@ if test -n "$LIBUV_LIBS"; then pkg_cv_LIBUV_LIBS="$LIBUV_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuv >= 1.0.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libuv >= 1.0.0") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuv >= 1.37.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libuv >= 1.37.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_LIBUV_LIBS=`$PKG_CONFIG --libs "libuv >= 1.0.0" 2>/dev/null` + pkg_cv_LIBUV_LIBS=`$PKG_CONFIG --libs "libuv >= 1.37.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -16185,8 +16184,67 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBUV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libuv >= 1.37.0" 2>&1` + else + LIBUV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libuv >= 1.37.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBUV_PKG_ERRORS" >&5 + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libuv >= 1.0.0 libuv < 1.35.0" >&5 +printf %s "checking for libuv >= 1.0.0 libuv < 1.35.0... " >&6; } + +if test -n "$LIBUV_CFLAGS"; then + pkg_cv_LIBUV_CFLAGS="$LIBUV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuv >= 1.0.0 libuv < 1.35.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libuv >= 1.0.0 libuv < 1.35.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUV_CFLAGS=`$PKG_CONFIG --cflags "libuv >= 1.0.0 libuv < 1.35.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBUV_LIBS"; then + pkg_cv_LIBUV_LIBS="$LIBUV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuv >= 1.0.0 libuv < 1.35.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libuv >= 1.0.0 libuv < 1.35.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUV_LIBS=`$PKG_CONFIG --libs "libuv >= 1.0.0 libuv < 1.35.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -16194,23 +16252,104 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBUV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libuv >= 1.0.0" 2>&1` + LIBUV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libuv >= 1.0.0 libuv < 1.35.0" 2>&1` else - LIBUV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libuv >= 1.0.0" 2>&1` + LIBUV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libuv >= 1.0.0 libuv < 1.35.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBUV_PKG_ERRORS" >&5 - as_fn_error $? "libuv not found" "$LINENO" 5 + as_fn_error $? "libuv >= 1.0.0 (except 1.35.0 and 1.36.0) not found" "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "libuv not found" "$LINENO" 5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + as_fn_error $? "libuv >= 1.0.0 (except 1.35.0 and 1.36.0) not found" "$LINENO" 5 else LIBUV_CFLAGS=$pkg_cv_LIBUV_CFLAGS LIBUV_LIBS=$pkg_cv_LIBUV_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +fi +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libuv >= 1.0.0 libuv < 1.35.0" >&5 +printf %s "checking for libuv >= 1.0.0 libuv < 1.35.0... " >&6; } + +if test -n "$LIBUV_CFLAGS"; then + pkg_cv_LIBUV_CFLAGS="$LIBUV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuv >= 1.0.0 libuv < 1.35.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libuv >= 1.0.0 libuv < 1.35.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUV_CFLAGS=`$PKG_CONFIG --cflags "libuv >= 1.0.0 libuv < 1.35.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBUV_LIBS"; then + pkg_cv_LIBUV_LIBS="$LIBUV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuv >= 1.0.0 libuv < 1.35.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libuv >= 1.0.0 libuv < 1.35.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUV_LIBS=`$PKG_CONFIG --libs "libuv >= 1.0.0 libuv < 1.35.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBUV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libuv >= 1.0.0 libuv < 1.35.0" 2>&1` + else + LIBUV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libuv >= 1.0.0 libuv < 1.35.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBUV_PKG_ERRORS" >&5 + + as_fn_error $? "libuv >= 1.0.0 (except 1.35.0 and 1.36.0) not found" "$LINENO" 5 +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + as_fn_error $? "libuv >= 1.0.0 (except 1.35.0 and 1.36.0) not found" "$LINENO" 5 +else + LIBUV_CFLAGS=$pkg_cv_LIBUV_CFLAGS + LIBUV_LIBS=$pkg_cv_LIBUV_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +fi +else + LIBUV_CFLAGS=$pkg_cv_LIBUV_CFLAGS + LIBUV_LIBS=$pkg_cv_LIBUV_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } fi @@ -17511,7 +17650,12 @@ PKCS11_MANS= # # was --enable-native-pkcs11 specified? # -# [pairwise: --enable-native-pkcs11 --with-dlopen, --disable-native-pkcs11 --with-dlopen, --disable-native-pkcs11 --without-dlopen] +# DNSRPS builds are included in pairwise testing here and not later because both +# --enable-native-pkcs11 and --enable-dnsrps-dl require --with-dlopen and the +# ordering of the set of ./configure arguments generated during pairwise testing +# is random. +# +# [pairwise: --enable-native-pkcs11 --enable-dnsrps --enable-dnsrps-dl --with-dlopen, --disable-native-pkcs11 --enable-dnsrps --enable-dnsrps-dl --with-dlopen, --disable-native-pkcs11 --enable-dnsrps --enable-dnsrps-dl --with-dlopen, --disable-native-pkcs11 --disable-dnsrps --without-dlopen] # Check whether --enable-native-pkcs11 was given. if test "${enable_native_pkcs11+set}" = set; then : enableval=$enable_native_pkcs11; : @@ -21462,6 +21606,16 @@ fi # +# Build the man pages only if we have prebuilt manpages or we can build them from RST sources +# +BUILD_MANPAGES= +if test -e doc/man/named.conf.5in || test "$SPHINX_BUILD" != ":" +then : + BUILD_MANPAGES=man +fi + + +# # Pull release date from CHANGES file last modification date # for reproducible builds # @@ -22935,8 +23089,9 @@ $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# DNSRPS is not included in pairwise testing as the librpz library is not -# present in the relevant Docker image. +# DNSRPS builds are included in pairwise testing along --enable-native-pkcs11 +# tests above as both of these features require --with-dlopen (see also the +# relevant comment there). # # [pairwise: skip] # Check whether --enable-dnsrps-dl was given. Index: src/external/mpl/bind/dist/bin/dig/dighost.c diff -u src/external/mpl/bind/dist/bin/dig/dighost.c:1.14 src/external/mpl/bind/dist/bin/dig/dighost.c:1.15 --- src/external/mpl/bind/dist/bin/dig/dighost.c:1.14 Wed Jan 25 16:43:23 2023 +++ src/external/mpl/bind/dist/bin/dig/dighost.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dighost.c,v 1.14 2023/01/25 21:43:23 christos Exp $ */ +/* $NetBSD: dighost.c,v 1.15 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -1586,7 +1586,7 @@ clear_query(dig_query_t *query) { debug("clear_query(%p)", query); if (query->timer != NULL) { - isc_timer_detach(&query->timer); + isc_timer_destroy(&query->timer); } lookup = query->lookup; @@ -2702,7 +2702,7 @@ bringup_timer(dig_query_t *query, unsign debug("have local timeout of %d", local_timeout); isc_interval_set(&l->interval, local_timeout, 0); if (query->timer != NULL) { - isc_timer_detach(&query->timer); + isc_timer_destroy(&query->timer); } result = isc_timer_create(timermgr, isc_timertype_once, NULL, &l->interval, global_task, connect_timeout, @@ -2726,7 +2726,7 @@ force_timeout(dig_query_t *query) { * ourselves due to the duplicate events. */ if (query->timer != NULL) { - isc_timer_detach(&query->timer); + isc_timer_destroy(&query->timer); } } Index: src/external/mpl/bind/dist/bin/named/controlconf.c diff -u src/external/mpl/bind/dist/bin/named/controlconf.c:1.10 src/external/mpl/bind/dist/bin/named/controlconf.c:1.11 --- src/external/mpl/bind/dist/bin/named/controlconf.c:1.10 Wed Jan 25 16:43:23 2023 +++ src/external/mpl/bind/dist/bin/named/controlconf.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: controlconf.c,v 1.10 2023/01/25 21:43:23 christos Exp $ */ +/* $NetBSD: controlconf.c,v 1.11 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -179,7 +179,7 @@ maybe_free_connection(controlconnection_ } if (conn->timer != NULL) { - isc_timer_detach(&conn->timer); + isc_timer_destroy(&conn->timer); } if (conn->ccmsg_valid) { @@ -572,10 +572,10 @@ control_timeout(isc_task_t *task, isc_ev UNUSED(task); - isc_timer_detach(&conn->timer); - maybe_free_connection(conn); - isc_event_free(&event); + + isc_timer_destroy(&conn->timer); + maybe_free_connection(conn); } static isc_result_t @@ -623,7 +623,7 @@ cleanup: } isccc_ccmsg_invalidate(&conn->ccmsg); if (conn->timer != NULL) { - isc_timer_detach(&conn->timer); + isc_timer_destroy(&conn->timer); } isc_mem_put(listener->mctx, conn, sizeof(*conn)); #ifdef ENABLE_AFL Index: src/external/mpl/bind/dist/bin/named/logconf.c diff -u src/external/mpl/bind/dist/bin/named/logconf.c:1.7 src/external/mpl/bind/dist/bin/named/logconf.c:1.8 --- src/external/mpl/bind/dist/bin/named/logconf.c:1.7 Fri Sep 23 08:15:21 2022 +++ src/external/mpl/bind/dist/bin/named/logconf.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: logconf.c,v 1.7 2022/09/23 12:15:21 christos Exp $ */ +/* $NetBSD: logconf.c,v 1.8 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -302,10 +302,6 @@ channel_fromconf(const cfg_obj_t *channe dest.file.name, isc_result_totext(result)); } - fprintf(stderr, - "isc_stdio_open '%s' failed: %s\n", - dest.file.name, - isc_result_totext(result)); } else { (void)isc_stdio_close(fp); } @@ -315,8 +311,6 @@ channel_fromconf(const cfg_obj_t *channe syslog(LOG_ERR, "isc_file_isplainfile '%s' failed: %s", dest.file.name, isc_result_totext(result)); } - fprintf(stderr, "isc_file_isplainfile '%s' failed: %s\n", - dest.file.name, isc_result_totext(result)); } done: Index: src/external/mpl/bind/dist/bin/named/main.c diff -u src/external/mpl/bind/dist/bin/named/main.c:1.14 src/external/mpl/bind/dist/bin/named/main.c:1.15 --- src/external/mpl/bind/dist/bin/named/main.c:1.14 Wed Jan 25 16:43:23 2023 +++ src/external/mpl/bind/dist/bin/named/main.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.14 2023/01/25 21:43:23 christos Exp $ */ +/* $NetBSD: main.c,v 1.15 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -707,6 +707,7 @@ printversion(bool verbose) { isc_buffer_init(&b, buf, sizeof(buf)); format_supported_algorithms(printit); printf("\n"); + dst_lib_destroy(); } else { printf("DST initialization failure: %s\n", isc_result_totext(result)); @@ -1282,6 +1283,13 @@ setup(void) { "linked to OpenSSL version: %s", SSLeay_version(SSLEAY_VERSION)); #endif /* OPENSSL_VERSION_NUMBER >= 0x10100000L */ + isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, + NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, + "compiled with libuv version: %d.%d.%d", UV_VERSION_MAJOR, + UV_VERSION_MINOR, UV_VERSION_PATCH); + isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, + NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, + "linked to libuv version: %s", uv_version_string()); #ifdef HAVE_LIBXML2 isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, Index: src/external/mpl/bind/dist/bin/named/server.c diff -u src/external/mpl/bind/dist/bin/named/server.c:1.19 src/external/mpl/bind/dist/bin/named/server.c:1.20 --- src/external/mpl/bind/dist/bin/named/server.c:1.19 Wed Jan 25 16:43:23 2023 +++ src/external/mpl/bind/dist/bin/named/server.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: server.c,v 1.19 2023/01/25 21:43:23 christos Exp $ */ +/* $NetBSD: server.c,v 1.20 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -2673,6 +2673,7 @@ configure_rpz(dns_view_t *view, dns_view if (*old_rpz_okp) { dns_rpz_detach_rpzs(&view->rpzs); dns_rpz_attach_rpzs(pview->rpzs, &view->rpzs); + dns_rpz_detach_rpzs(&pview->rpzs); } else if (old != NULL && pview != NULL) { ++pview->rpzs->rpz_ver; view->rpzs->rpz_ver = pview->rpzs->rpz_ver; @@ -3175,6 +3176,7 @@ configure_catz(dns_view_t *view, dns_vie if (old != NULL) { dns_catz_catzs_detach(&view->catzs); dns_catz_catzs_attach(pview->catzs, &view->catzs); + dns_catz_catzs_detach(&pview->catzs); dns_catz_prereconfig(view->catzs); } @@ -3979,7 +3981,8 @@ configure_view(dns_view_t *view, dns_vie const cfg_obj_t *dyndb_list, *plugin_list; const cfg_obj_t *disabled; const cfg_obj_t *obj, *obj2; - const cfg_listelt_t *element; + const cfg_listelt_t *element = NULL; + const cfg_listelt_t *zone_element_latest = NULL; in_port_t port; dns_cache_t *cache = NULL; isc_result_t result; @@ -3996,7 +3999,6 @@ configure_view(dns_view_t *view, dns_vie dns_dispatch_t *dispatch6 = NULL; bool rpz_configured = false; bool catz_configured = false; - bool zones_configured = false; bool reused_cache = false; bool shared_cache = false; int i = 0, j = 0, k = 0; @@ -4100,8 +4102,8 @@ configure_view(dns_view_t *view, dns_vie CHECK(configure_zone(config, zconfig, vconfig, mctx, view, viewlist, kasplist, actx, false, old_rpz_ok, false)); + zone_element_latest = element; } - zones_configured = true; /* * Check that a master or slave zone was found for each @@ -5880,9 +5882,6 @@ cleanup: named_config_get(maps, "catalog-zones", &obj) == ISC_R_SUCCESS) { - if (pview->catzs != NULL) { - dns_catz_catzs_detach(&pview->catzs); - } /* * We are swapping the places of the `view` and * `pview` in the function's parameters list @@ -5910,7 +5909,7 @@ cleanup: dns_view_detach(&pview); } - if (zones_configured) { + if (zone_element_latest != NULL) { for (element = cfg_list_first(zonelist); element != NULL; element = cfg_list_next(element)) { @@ -5918,6 +5917,13 @@ cleanup: cfg_listelt_value(element); configure_zone_setviewcommit(result, zconfig, view); + if (element == zone_element_latest) { + /* + * This was the latest element that was + * successfully configured earlier. + */ + break; + } } } } @@ -6772,6 +6778,7 @@ add_keydata_zone(dns_view_t *view, const dns_zone_attach(pview->managed_keys, &view->managed_keys); dns_zone_setview(pview->managed_keys, view); + dns_zone_setviewcommit(pview->managed_keys); dns_view_detach(&pview); dns_zone_synckeyzone(view->managed_keys); return (ISC_R_SUCCESS); @@ -9291,8 +9298,8 @@ load_configuration(const char *filename, logobj = NULL; (void)cfg_map_get(config, "logging", &logobj); if (logobj != NULL) { - CHECKM(named_logconfig(logc, logobj), "configuring " - "logging"); + CHECKM(named_logconfig(logc, logobj), + "configuring logging"); } else { named_log_setdefaultchannels(logc); CHECKM(named_log_setunmatchedcategory(logc), @@ -9663,6 +9670,7 @@ view_loaded(void *arg) { if (isc_refcount_decrement(&zl->refs) == 1) { named_server_t *server = zl->server; bool reconfig = zl->reconfig; + dns_view_t *view = NULL; isc_refcount_destroy(&zl->refs); isc_mem_put(server->mctx, zl, sizeof(*zl)); @@ -9683,6 +9691,28 @@ view_loaded(void *arg) { "all zones loaded"); } + for (view = ISC_LIST_HEAD(server->viewlist); view != NULL; + view = ISC_LIST_NEXT(view, link)) + { + if (view->managed_keys != NULL) { + result = dns_zone_synckeyzone( + view->managed_keys); + if (result != ISC_R_SUCCESS) { + isc_log_write( + named_g_lctx, + DNS_LOGCATEGORY_DNSSEC, + DNS_LOGMODULE_DNSSEC, + ISC_LOG_ERROR, + "failed to initialize " + "managed-keys for view %s " + "(%s): DNSSEC validation is " + "at risk", + view->name, + isc_result_totext(result)); + } + } + } + CHECKFATAL(dns_zonemgr_forcemaint(server->zonemgr), "forcing zone maintenance"); @@ -9931,10 +9961,10 @@ shutdown_server(isc_task_t *task, isc_ev isc_mem_put(server->mctx, nsc, sizeof(*nsc)); } - isc_timer_detach(&server->interface_timer); - isc_timer_detach(&server->heartbeat_timer); - isc_timer_detach(&server->pps_timer); - isc_timer_detach(&server->tat_timer); + isc_timer_destroy(&server->interface_timer); + isc_timer_destroy(&server->heartbeat_timer); + isc_timer_destroy(&server->pps_timer); + isc_timer_destroy(&server->tat_timer); ns_interfacemgr_detach(&server->interfacemgr); Index: src/external/mpl/bind/dist/bin/named/zoneconf.c diff -u src/external/mpl/bind/dist/bin/named/zoneconf.c:1.13 src/external/mpl/bind/dist/bin/named/zoneconf.c:1.14 --- src/external/mpl/bind/dist/bin/named/zoneconf.c:1.13 Wed Jan 25 16:43:23 2023 +++ src/external/mpl/bind/dist/bin/named/zoneconf.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: zoneconf.c,v 1.13 2023/01/25 21:43:23 christos Exp $ */ +/* $NetBSD: zoneconf.c,v 1.14 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -927,8 +927,8 @@ named_zone_configure(const cfg_obj_t *co maps[i] = NULL; if (vconfig != NULL) { - RETERR(named_config_getclass(cfg_tuple_get(vconfig, "class"), - dns_rdataclass_in, &vclass)); + CHECK(named_config_getclass(cfg_tuple_get(vconfig, "class"), + dns_rdataclass_in, &vclass)); } else { vclass = dns_rdataclass_in; } @@ -939,8 +939,8 @@ named_zone_configure(const cfg_obj_t *co zname = cfg_obj_asstring(cfg_tuple_get(zconfig, "name")); - RETERR(named_config_getclass(cfg_tuple_get(zconfig, "class"), vclass, - &zclass)); + CHECK(named_config_getclass(cfg_tuple_get(zconfig, "class"), vclass, + &zclass)); dns_zone_setclass(zone, zclass); if (raw != NULL) { dns_zone_setclass(raw, zclass); @@ -960,7 +960,7 @@ named_zone_configure(const cfg_obj_t *co cpval = isc_mem_strdup(mctx, cfg_obj_asstring(obj)); } if (cpval == NULL) { - return (ISC_R_NOMEMORY); + CHECK(ISC_R_NOMEMORY); } obj = NULL; @@ -975,7 +975,7 @@ named_zone_configure(const cfg_obj_t *co "zone '%s': both 'database' and 'dlz' " "specified", zname); - return (ISC_R_FAILURE); + CHECK(ISC_R_FAILURE); } len = strlen(dlzname) + 5; @@ -986,7 +986,7 @@ named_zone_configure(const cfg_obj_t *co result = strtoargv(mctx, cpval, &dbargc, &dbargv); if (result != ISC_R_SUCCESS && cpval != default_dbtype) { isc_mem_free(mctx, cpval); - return (result); + CHECK(result); } /* @@ -1016,7 +1016,7 @@ named_zone_configure(const cfg_obj_t *co isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR, "zone '%s': 'file' not specified", zname); - return (ISC_R_FAILURE); + CHECK(ISC_R_FAILURE); } if (ztype == dns_zone_secondary || ztype == dns_zone_mirror) { @@ -1054,7 +1054,7 @@ named_zone_configure(const cfg_obj_t *co "can only be used with " "'masterfile-format text'", zname); - return (ISC_R_FAILURE); + CHECK(ISC_R_FAILURE); } if (strcasecmp(masterstylestr, "full") == 0) { @@ -1079,47 +1079,45 @@ named_zone_configure(const cfg_obj_t *co size_t signedlen = strlen(filename) + sizeof(SIGNED); char *signedname; - RETERR(dns_zone_setfile(raw, filename, masterformat, - masterstyle)); + CHECK(dns_zone_setfile(raw, filename, masterformat, + masterstyle)); signedname = isc_mem_get(mctx, signedlen); (void)snprintf(signedname, signedlen, "%s" SIGNED, filename); result = dns_zone_setfile(zone, signedname, dns_masterformat_raw, NULL); isc_mem_put(mctx, signedname, signedlen); - if (result != ISC_R_SUCCESS) { - return (result); - } + CHECK(result); } else { - RETERR(dns_zone_setfile(zone, filename, masterformat, - masterstyle)); + CHECK(dns_zone_setfile(zone, filename, masterformat, + masterstyle)); } obj = NULL; result = cfg_map_get(zoptions, "journal", &obj); if (result == ISC_R_SUCCESS) { - RETERR(dns_zone_setjournal(mayberaw, cfg_obj_asstring(obj))); + CHECK(dns_zone_setjournal(mayberaw, cfg_obj_asstring(obj))); } /* * Notify messages are processed by the raw zone if it exists. */ if (ztype == dns_zone_secondary || ztype == dns_zone_mirror) { - RETERR(configure_zone_acl( - zconfig, vconfig, config, allow_notify, ac, mayberaw, - dns_zone_setnotifyacl, dns_zone_clearnotifyacl)); + CHECK(configure_zone_acl(zconfig, vconfig, config, allow_notify, + ac, mayberaw, dns_zone_setnotifyacl, + dns_zone_clearnotifyacl)); } /* * XXXAG This probably does not make sense for stubs. */ - RETERR(configure_zone_acl(zconfig, vconfig, config, allow_query, ac, - zone, dns_zone_setqueryacl, - dns_zone_clearqueryacl)); - - RETERR(configure_zone_acl(zconfig, vconfig, config, allow_query_on, ac, - zone, dns_zone_setqueryonacl, - dns_zone_clearqueryonacl)); + CHECK(configure_zone_acl(zconfig, vconfig, config, allow_query, ac, + zone, dns_zone_setqueryacl, + dns_zone_clearqueryacl)); + + CHECK(configure_zone_acl(zconfig, vconfig, config, allow_query_on, ac, + zone, dns_zone_setqueryonacl, + dns_zone_clearqueryonacl)); obj = NULL; result = named_config_get(maps, "dialup", &obj); @@ -1176,10 +1174,10 @@ named_zone_configure(const cfg_obj_t *co rcvquerystats = NULL; dnssecsignstats = NULL; if (statlevel == dns_zonestat_full) { - RETERR(isc_stats_create(mctx, &zoneqrystats, - ns_statscounter_max)); - RETERR(dns_rdatatypestats_create(mctx, &rcvquerystats)); - RETERR(dns_dnssecsignstats_create(mctx, &dnssecsignstats)); + CHECK(isc_stats_create(mctx, &zoneqrystats, + ns_statscounter_max)); + CHECK(dns_rdatatypestats_create(mctx, &rcvquerystats)); + CHECK(dns_dnssecsignstats_create(mctx, &dnssecsignstats)); } dns_zone_setrequeststats(zone, zoneqrystats); dns_zone_setrcvquerystats(zone, rcvquerystats); @@ -1218,7 +1216,7 @@ named_zone_configure(const cfg_obj_t *co ISC_LOG_ERROR, "dnssec-policy '%s' not found ", kaspname); - RETERR(result); + CHECK(result); } dns_zone_setkasp(zone, kasp); use_kasp = true; @@ -1267,62 +1265,62 @@ named_zone_configure(const cfg_obj_t *co dns_ipkeylist_t ipkl; dns_ipkeylist_init(&ipkl); - RETERR(named_config_getipandkeylist(config, "primaries", - obj, mctx, &ipkl)); + CHECK(named_config_getipandkeylist(config, "primaries", + obj, mctx, &ipkl)); result = dns_zone_setalsonotifydscpkeys( zone, ipkl.addrs, ipkl.dscps, ipkl.keys, ipkl.count); dns_ipkeylist_clear(mctx, &ipkl); - RETERR(result); + CHECK(result); } else { - RETERR(dns_zone_setalsonotify(zone, NULL, 0)); + CHECK(dns_zone_setalsonotify(zone, NULL, 0)); } obj = NULL; result = named_config_get(maps, "parental-source", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); - RETERR(dns_zone_setparentalsrc4(zone, cfg_obj_assockaddr(obj))); + CHECK(dns_zone_setparentalsrc4(zone, cfg_obj_assockaddr(obj))); dscp = cfg_obj_getdscp(obj); if (dscp == -1) { dscp = named_g_dscp; } - RETERR(dns_zone_setparentalsrc4dscp(zone, dscp)); + CHECK(dns_zone_setparentalsrc4dscp(zone, dscp)); named_add_reserved_dispatch(named_g_server, cfg_obj_assockaddr(obj)); obj = NULL; result = named_config_get(maps, "parental-source-v6", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); - RETERR(dns_zone_setparentalsrc6(zone, cfg_obj_assockaddr(obj))); + CHECK(dns_zone_setparentalsrc6(zone, cfg_obj_assockaddr(obj))); dscp = cfg_obj_getdscp(obj); if (dscp == -1) { dscp = named_g_dscp; } - RETERR(dns_zone_setparentalsrc6dscp(zone, dscp)); + CHECK(dns_zone_setparentalsrc6dscp(zone, dscp)); named_add_reserved_dispatch(named_g_server, cfg_obj_assockaddr(obj)); obj = NULL; result = named_config_get(maps, "notify-source", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); - RETERR(dns_zone_setnotifysrc4(zone, cfg_obj_assockaddr(obj))); + CHECK(dns_zone_setnotifysrc4(zone, cfg_obj_assockaddr(obj))); dscp = cfg_obj_getdscp(obj); if (dscp == -1) { dscp = named_g_dscp; } - RETERR(dns_zone_setnotifysrc4dscp(zone, dscp)); + CHECK(dns_zone_setnotifysrc4dscp(zone, dscp)); named_add_reserved_dispatch(named_g_server, cfg_obj_assockaddr(obj)); obj = NULL; result = named_config_get(maps, "notify-source-v6", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); - RETERR(dns_zone_setnotifysrc6(zone, cfg_obj_assockaddr(obj))); + CHECK(dns_zone_setnotifysrc6(zone, cfg_obj_assockaddr(obj))); dscp = cfg_obj_getdscp(obj); if (dscp == -1) { dscp = named_g_dscp; } - RETERR(dns_zone_setnotifysrc6dscp(zone, dscp)); + CHECK(dns_zone_setnotifysrc6dscp(zone, dscp)); named_add_reserved_dispatch(named_g_server, cfg_obj_assockaddr(obj)); @@ -1334,7 +1332,7 @@ named_zone_configure(const cfg_obj_t *co dns_zone_setisself(zone, isself, named_g_server->interfacemgr); - RETERR(configure_zone_acl( + CHECK(configure_zone_acl( zconfig, vconfig, config, allow_transfer, ac, zone, dns_zone_setxfracl, dns_zone_clearxfracl)); @@ -1372,7 +1370,7 @@ named_zone_configure(const cfg_obj_t *co "%" PRId64 "' " "is too large", value); - RETERR(ISC_R_RANGE); + CHECK(ISC_R_RANGE); } journal_size = (uint32_t)value; } @@ -1512,7 +1510,7 @@ named_zone_configure(const cfg_obj_t *co "%" PRId64 "' " "is too large", value); - RETERR(ISC_R_RANGE); + CHECK(ISC_R_RANGE); } journal_size = (uint32_t)value; } @@ -1542,9 +1540,9 @@ named_zone_configure(const cfg_obj_t *co if (ztype == dns_zone_primary) { dns_acl_t *updateacl; - RETERR(configure_zone_acl( - zconfig, vconfig, config, allow_update, ac, mayberaw, - dns_zone_setupdateacl, dns_zone_clearupdateacl)); + CHECK(configure_zone_acl(zconfig, vconfig, config, allow_update, + ac, mayberaw, dns_zone_setupdateacl, + dns_zone_clearupdateacl)); updateacl = dns_zone_getupdateacl(mayberaw); if (updateacl != NULL && dns_acl_isinsecure(updateacl)) { @@ -1555,7 +1553,7 @@ named_zone_configure(const cfg_obj_t *co zname); } - RETERR(configure_zone_ssutable(zoptions, mayberaw, zname)); + CHECK(configure_zone_ssutable(zoptions, mayberaw, zname)); } /* @@ -1632,7 +1630,7 @@ named_zone_configure(const cfg_obj_t *co result = named_config_get(maps, "key-directory", &obj); if (result == ISC_R_SUCCESS) { filename = cfg_obj_asstring(obj); - RETERR(dns_zone_setkeydirectory(zone, filename)); + CHECK(dns_zone_setkeydirectory(zone, filename)); } obj = NULL; @@ -1674,8 +1672,8 @@ named_zone_configure(const cfg_obj_t *co result = named_config_get(maps, "dnssec-loadkeys-interval", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); - RETERR(dns_zone_setrefreshkeyinterval(zone, - cfg_obj_asuint32(obj))); + CHECK(dns_zone_setrefreshkeyinterval(zone, + cfg_obj_asuint32(obj))); obj = NULL; result = cfg_map_get(zoptions, "auto-dnssec", &obj); @@ -1703,10 +1701,10 @@ named_zone_configure(const cfg_obj_t *co } if (ztype == dns_zone_secondary || ztype == dns_zone_mirror) { - RETERR(configure_zone_acl(zconfig, vconfig, config, - allow_update_forwarding, ac, mayberaw, - dns_zone_setforwardacl, - dns_zone_clearforwardacl)); + CHECK(configure_zone_acl(zconfig, vconfig, config, + allow_update_forwarding, ac, mayberaw, + dns_zone_setforwardacl, + dns_zone_clearforwardacl)); } /*% @@ -1718,14 +1716,14 @@ named_zone_configure(const cfg_obj_t *co if (obj != NULL) { dns_ipkeylist_t ipkl; dns_ipkeylist_init(&ipkl); - RETERR(named_config_getipandkeylist( + CHECK(named_config_getipandkeylist( config, "parental-agents", obj, mctx, &ipkl)); result = dns_zone_setparentals(zone, ipkl.addrs, ipkl.keys, ipkl.count); dns_ipkeylist_clear(mctx, &ipkl); - RETERR(result); + CHECK(result); } else { - RETERR(dns_zone_setparentals(zone, NULL, NULL, 0)); + CHECK(dns_zone_setparentals(zone, NULL, NULL, 0)); } } @@ -1896,7 +1894,7 @@ named_zone_configure(const cfg_obj_t *co (void)cfg_map_get(zoptions, "allow-transfer", &obj); if (obj == NULL) { dns_acl_t *none; - RETERR(dns_acl_none(mctx, &none)); + CHECK(dns_acl_none(mctx, &none)); dns_zone_setxfracl(zone, none); dns_acl_detach(&none); } @@ -1921,23 +1919,23 @@ named_zone_configure(const cfg_obj_t *co result = named_config_getremotesdef( named_g_config, "primaries", DEFAULT_IANA_ROOT_ZONE_PRIMARIES, &obj); - RETERR(result); + CHECK(result); } if (obj != NULL) { dns_ipkeylist_t ipkl; dns_ipkeylist_init(&ipkl); - RETERR(named_config_getipandkeylist(config, "primaries", - obj, mctx, &ipkl)); + CHECK(named_config_getipandkeylist(config, "primaries", + obj, mctx, &ipkl)); result = dns_zone_setprimarieswithkeys( mayberaw, ipkl.addrs, ipkl.keys, ipkl.count); count = ipkl.count; dns_ipkeylist_clear(mctx, &ipkl); - RETERR(result); + CHECK(result); } else { result = dns_zone_setprimaries(mayberaw, NULL, 0); } - RETERR(result); + CHECK(result); multi = false; if (count > 1) { @@ -1981,50 +1979,50 @@ named_zone_configure(const cfg_obj_t *co obj = NULL; result = named_config_get(maps, "transfer-source", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); - RETERR(dns_zone_setxfrsource4(mayberaw, - cfg_obj_assockaddr(obj))); + CHECK(dns_zone_setxfrsource4(mayberaw, + cfg_obj_assockaddr(obj))); dscp = cfg_obj_getdscp(obj); if (dscp == -1) { dscp = named_g_dscp; } - RETERR(dns_zone_setxfrsource4dscp(mayberaw, dscp)); + CHECK(dns_zone_setxfrsource4dscp(mayberaw, dscp)); named_add_reserved_dispatch(named_g_server, cfg_obj_assockaddr(obj)); obj = NULL; result = named_config_get(maps, "transfer-source-v6", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); - RETERR(dns_zone_setxfrsource6(mayberaw, - cfg_obj_assockaddr(obj))); + CHECK(dns_zone_setxfrsource6(mayberaw, + cfg_obj_assockaddr(obj))); dscp = cfg_obj_getdscp(obj); if (dscp == -1) { dscp = named_g_dscp; } - RETERR(dns_zone_setxfrsource6dscp(mayberaw, dscp)); + CHECK(dns_zone_setxfrsource6dscp(mayberaw, dscp)); named_add_reserved_dispatch(named_g_server, cfg_obj_assockaddr(obj)); obj = NULL; result = named_config_get(maps, "alt-transfer-source", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); - RETERR(dns_zone_setaltxfrsource4(mayberaw, - cfg_obj_assockaddr(obj))); + CHECK(dns_zone_setaltxfrsource4(mayberaw, + cfg_obj_assockaddr(obj))); dscp = cfg_obj_getdscp(obj); if (dscp == -1) { dscp = named_g_dscp; } - RETERR(dns_zone_setaltxfrsource4dscp(mayberaw, dscp)); + CHECK(dns_zone_setaltxfrsource4dscp(mayberaw, dscp)); obj = NULL; result = named_config_get(maps, "alt-transfer-source-v6", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); - RETERR(dns_zone_setaltxfrsource6(mayberaw, - cfg_obj_assockaddr(obj))); + CHECK(dns_zone_setaltxfrsource6(mayberaw, + cfg_obj_assockaddr(obj))); dscp = cfg_obj_getdscp(obj); if (dscp == -1) { dscp = named_g_dscp; } - RETERR(dns_zone_setaltxfrsource6dscp(mayberaw, dscp)); + CHECK(dns_zone_setaltxfrsource6dscp(mayberaw, dscp)); obj = NULL; (void)named_config_get(maps, "use-alt-transfer-source", &obj); @@ -2052,15 +2050,21 @@ named_zone_configure(const cfg_obj_t *co break; case dns_zone_staticstub: - RETERR(configure_staticstub(zoptions, zone, zname, - default_dbtype)); + CHECK(configure_staticstub(zoptions, zone, zname, + default_dbtype)); break; default: break; } - return (ISC_R_SUCCESS); + result = ISC_R_SUCCESS; + +cleanup: + if (kasp != NULL) { + dns_kasp_detach(&kasp); + } + return (result); } /* Index: src/external/mpl/bind/dist/bin/nsupdate/nsupdate.c diff -u src/external/mpl/bind/dist/bin/nsupdate/nsupdate.c:1.12 src/external/mpl/bind/dist/bin/nsupdate/nsupdate.c:1.13 --- src/external/mpl/bind/dist/bin/nsupdate/nsupdate.c:1.12 Wed Jan 25 16:43:23 2023 +++ src/external/mpl/bind/dist/bin/nsupdate/nsupdate.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: nsupdate.c,v 1.12 2023/01/25 21:43:23 christos Exp $ */ +/* $NetBSD: nsupdate.c,v 1.13 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -2707,8 +2707,8 @@ recvsoa(isc_task_t *task, isc_event_t *e dns_request_destroy(&request); dns_message_detach(&soaquery); ddebug("Out of recvsoa"); - done_update(); seenerror = true; + done_update(); return; } @@ -2815,7 +2815,14 @@ lookforsoa: master_total = get_addresses(serverstr, dnsport, master_servers, master_alloc); if (master_total == 0) { - exit(1); + seenerror = true; + dns_rdata_freestruct(&soa); + dns_message_detach(&soaquery); + dns_request_destroy(&request); + dns_message_detach(&rcvmsg); + ddebug("Out of recvsoa"); + done_update(); + return; } master_inuse = 0; } else { Index: src/external/mpl/bind/dist/bin/rndc/rndc.c diff -u src/external/mpl/bind/dist/bin/rndc/rndc.c:1.9 src/external/mpl/bind/dist/bin/rndc/rndc.c:1.10 --- src/external/mpl/bind/dist/bin/rndc/rndc.c:1.9 Wed Jan 25 16:43:24 2023 +++ src/external/mpl/bind/dist/bin/rndc/rndc.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: rndc.c,v 1.9 2023/01/25 21:43:24 christos Exp $ */ +/* $NetBSD: rndc.c,v 1.10 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -123,7 +123,7 @@ command is one of the following:\n\ Requires the zone to have a dnssec-policy.\n\ dnstap -reopen\n\ Close, truncate and re-open the DNSTAP output file.\n\ - dnstap -roll count\n\ + dnstap -roll [count]\n\ Close, rename and re-open the DNSTAP output file(s).\n\ dumpdb [-all|-cache|-zones|-adb|-bad|-expired|-fail] [view ...]\n\ Dump cache(s) to the dump file (named_dump.db).\n\ Index: src/external/mpl/bind/dist/bin/tests/optional/ratelimiter_test.c diff -u src/external/mpl/bind/dist/bin/tests/optional/ratelimiter_test.c:1.6 src/external/mpl/bind/dist/bin/tests/optional/ratelimiter_test.c:1.7 --- src/external/mpl/bind/dist/bin/tests/optional/ratelimiter_test.c:1.6 Fri Sep 23 08:15:23 2022 +++ src/external/mpl/bind/dist/bin/tests/optional/ratelimiter_test.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ratelimiter_test.c,v 1.6 2022/09/23 12:15:23 christos Exp $ */ +/* $NetBSD: ratelimiter_test.c,v 1.7 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -88,7 +88,7 @@ shutdown_all(isc_task_t *task, isc_event UNUSED(event); printf("shutdown all\n"); for (i = 0; i < NEVENTS; i++) { - isc_timer_detach(&timers[i]); + isc_timer_destroy(&timers[i]); } isc_app_shutdown(); Index: src/external/mpl/bind/dist/bin/tests/optional/sock_test.c diff -u src/external/mpl/bind/dist/bin/tests/optional/sock_test.c:1.6 src/external/mpl/bind/dist/bin/tests/optional/sock_test.c:1.7 --- src/external/mpl/bind/dist/bin/tests/optional/sock_test.c:1.6 Fri Sep 23 08:15:23 2022 +++ src/external/mpl/bind/dist/bin/tests/optional/sock_test.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: sock_test.c,v 1.6 2022/09/23 12:15:23 christos Exp $ */ +/* $NetBSD: sock_test.c,v 1.7 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -247,7 +247,7 @@ timeout(isc_task_t *task, isc_event_t *e printf("Timeout, canceling IO on socket %p (task %p)\n", sock, task); isc_socket_cancel(sock, NULL, ISC_SOCKCANCEL_ALL); - isc_timer_detach((isc_timer_t **)&event->ev_sender); + isc_timer_destroy((isc_timer_t **)&event->ev_sender); isc_event_free(&event); } Index: src/external/mpl/bind/dist/bin/tests/optional/task_test.c diff -u src/external/mpl/bind/dist/bin/tests/optional/task_test.c:1.6 src/external/mpl/bind/dist/bin/tests/optional/task_test.c:1.7 --- src/external/mpl/bind/dist/bin/tests/optional/task_test.c:1.6 Fri Sep 23 08:15:23 2022 +++ src/external/mpl/bind/dist/bin/tests/optional/task_test.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: task_test.c,v 1.6 2022/09/23 12:15:23 christos Exp $ */ +/* $NetBSD: task_test.c,v 1.7 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -196,8 +196,8 @@ main(int argc, char *argv[]) { Sleep(10000); #endif /* ifndef WIN32 */ printf("destroy\n"); - isc_timer_detach(&ti1); - isc_timer_detach(&ti2); + isc_timer_destroy(&ti1); + isc_timer_destroy(&ti2); isc_timermgr_destroy(&timgr); isc_managers_destroy(&netmgr, &taskmgr); printf("destroyed\n"); Index: src/external/mpl/bind/dist/bin/tests/optional/rbt_test.c diff -u src/external/mpl/bind/dist/bin/tests/optional/rbt_test.c:1.7 src/external/mpl/bind/dist/bin/tests/optional/rbt_test.c:1.8 --- src/external/mpl/bind/dist/bin/tests/optional/rbt_test.c:1.7 Wed Jan 25 16:43:24 2023 +++ src/external/mpl/bind/dist/bin/tests/optional/rbt_test.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: rbt_test.c,v 1.7 2023/01/25 21:43:24 christos Exp $ */ +/* $NetBSD: rbt_test.c,v 1.8 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -186,8 +186,8 @@ iterate(dns_rbt_t *rbt, bool forward) { dns_rbtnodechain_t chain; dns_fixedname_t fixedorigin; isc_result_t result; - isc_result_t (*move)(dns_rbtnodechain_t * chain, dns_name_t * name, - dns_name_t * origin); + isc_result_t (*move)(dns_rbtnodechain_t *chain, dns_name_t *name, + dns_name_t *origin); dns_rbtnodechain_init(&chain); Index: src/external/mpl/bind/dist/bin/tests/optional/shutdown_test.c diff -u src/external/mpl/bind/dist/bin/tests/optional/shutdown_test.c:1.7 src/external/mpl/bind/dist/bin/tests/optional/shutdown_test.c:1.8 --- src/external/mpl/bind/dist/bin/tests/optional/shutdown_test.c:1.7 Fri Sep 23 08:15:23 2022 +++ src/external/mpl/bind/dist/bin/tests/optional/shutdown_test.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: shutdown_test.c,v 1.7 2022/09/23 12:15:23 christos Exp $ */ +/* $NetBSD: shutdown_test.c,v 1.8 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -75,7 +75,7 @@ shutdown_action(isc_task_t *task, isc_ev printf("task %s (%p) shutdown\n", info->name, task); if (strcmp(info->name, "0") == 0) { - isc_timer_detach(&info->timer); + isc_timer_destroy(&info->timer); nevent = isc_event_allocate(info->mctx, info, T2_SHUTDOWNOK, t2_shutdown, &tasks[1], sizeof(*event)); @@ -106,7 +106,7 @@ tick(isc_task_t *task, isc_event_t *even if (info->ticks == 10) { isc_app_shutdown(); } else if (info->ticks >= 15 && info->exiting) { - isc_timer_detach(&info->timer); + isc_timer_destroy(&info->timer); isc_task_detach(&info->task); nevent = isc_event_allocate( info->mctx, info, T2_SHUTDOWNDONE, t1_shutdown, @@ -116,7 +116,7 @@ tick(isc_task_t *task, isc_event_t *even isc_task_detach(&info->peer); } } else if (strcmp(info->name, "foo") == 0) { - isc_timer_detach(&info->timer); + isc_timer_destroy(&info->timer); nevent = isc_event_allocate(info->mctx, info, FOO_EVENT, foo_event, task, sizeof(*event)); RUNTIME_CHECK(nevent != NULL); Index: src/external/mpl/bind/dist/bin/tests/optional/timer_test.c diff -u src/external/mpl/bind/dist/bin/tests/optional/timer_test.c:1.7 src/external/mpl/bind/dist/bin/tests/optional/timer_test.c:1.8 --- src/external/mpl/bind/dist/bin/tests/optional/timer_test.c:1.7 Fri Sep 23 08:15:23 2022 +++ src/external/mpl/bind/dist/bin/tests/optional/timer_test.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: timer_test.c,v 1.7 2022/09/23 12:15:23 christos Exp $ */ +/* $NetBSD: timer_test.c,v 1.8 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -166,9 +166,9 @@ main(int argc, char *argv[]) { Sleep(15000); #endif /* ifndef WIN32 */ printf("destroy\n"); - isc_timer_detach(&ti1); - isc_timer_detach(&ti2); - isc_timer_detach(&ti3); + isc_timer_destroy(&ti1); + isc_timer_destroy(&ti2); + isc_timer_destroy(&ti3); #ifndef WIN32 sleep(2); #else /* ifndef WIN32 */ Index: src/external/mpl/bind/dist/bin/tests/system/feature-test.c diff -u src/external/mpl/bind/dist/bin/tests/system/feature-test.c:1.10 src/external/mpl/bind/dist/bin/tests/system/feature-test.c:1.11 --- src/external/mpl/bind/dist/bin/tests/system/feature-test.c:1.10 Wed Jan 25 16:43:24 2023 +++ src/external/mpl/bind/dist/bin/tests/system/feature-test.c Mon Jun 26 18:02:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: feature-test.c,v 1.10 2023/01/25 21:43:24 christos Exp $ */ +/* $NetBSD: feature-test.c,v 1.11 2023/06/26 22:02:59 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -19,6 +19,7 @@ #include <string.h> #include <unistd.h> +#include <isc/md.h> #include <isc/net.h> #include <isc/print.h> #include <isc/util.h> @@ -47,6 +48,7 @@ usage() { fprintf(stderr, "\t--have-json-c\n"); fprintf(stderr, "\t--have-libxml2\n"); fprintf(stderr, "\t--ipv6only=no\n"); + fprintf(stderr, "\t--md5\n"); fprintf(stderr, "\t--tsan\n"); fprintf(stderr, "\t--with-dlz-filesystem\n"); fprintf(stderr, "\t--with-idn\n"); @@ -176,6 +178,20 @@ main(int argc, char **argv) { #endif /* ifdef WIN32 */ } + if (strcmp(argv[1], "--md5") == 0) { + unsigned char digest[ISC_MAX_MD_SIZE]; + const unsigned char test[] = "test"; + unsigned int size = sizeof(digest); + + if (isc_md(ISC_MD_MD5, test, sizeof(test), digest, &size) == + ISC_R_SUCCESS) + { + return (0); + } else { + return (1); + } + } + if (strcmp(argv[1], "--tsan") == 0) { #if defined(__has_feature) #if __has_feature(thread_sanitizer) Index: src/external/mpl/bind/dist/fuzz/fuzz.h diff -u src/external/mpl/bind/dist/fuzz/fuzz.h:1.5 src/external/mpl/bind/dist/fuzz/fuzz.h:1.6 --- src/external/mpl/bind/dist/fuzz/fuzz.h:1.5 Fri Sep 23 08:15:29 2022 +++ src/external/mpl/bind/dist/fuzz/fuzz.h Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: fuzz.h,v 1.5 2022/09/23 12:15:29 christos Exp $ */ +/* $NetBSD: fuzz.h,v 1.6 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -32,16 +32,4 @@ extern bool debug; int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); -static isc_mem_t *mctx = NULL; - -static void __attribute__((constructor)) init(void) { - isc_mem_create(&mctx); - RUNTIME_CHECK(dst_lib_init(mctx, NULL) == ISC_R_SUCCESS); -} - -static void __attribute__((destructor)) deinit(void) { - dst_lib_destroy(); - isc_mem_destroy(&mctx); -} - ISC_LANG_ENDDECLS Index: src/external/mpl/bind/dist/lib/dns/catz.c diff -u src/external/mpl/bind/dist/lib/dns/catz.c:1.9 src/external/mpl/bind/dist/lib/dns/catz.c:1.10 --- src/external/mpl/bind/dist/lib/dns/catz.c:1.9 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/catz.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: catz.c,v 1.9 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: catz.c,v 1.10 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -632,7 +632,7 @@ cleanup_ht: isc_ht_destroy(&new_zones->zones); isc_refcount_destroy(&new_zones->refs); isc_mutex_destroy(&new_zones->lock); - isc_mem_put(mctx, new_zones, sizeof(*new_zones)); + isc_mem_putanddetach(&new_zones->mctx, new_zones, sizeof(*new_zones)); return (result); } @@ -754,8 +754,10 @@ dns_catz_get_zone(dns_catz_zones_t *catz REQUIRE(DNS_CATZ_ZONES_VALID(catzs)); REQUIRE(ISC_MAGIC_VALID(name, DNS_NAME_MAGIC)); + LOCK(&catzs->lock); result = isc_ht_find(catzs->zones, name->ndata, name->length, (void **)&found); + UNLOCK(&catzs->lock); if (result != ISC_R_SUCCESS) { return (NULL); } @@ -810,7 +812,7 @@ dns_catz_zone_detach(dns_catz_zone_t **z isc_ht_destroy(&zone->entries); } zone->magic = 0; - isc_timer_detach(&zone->updatetimer); + isc_timer_destroy(&zone->updatetimer); if (zone->db_registered) { dns_db_updatenotify_unregister( zone->db, dns_catz_dbupdate_callback, @@ -1763,6 +1765,8 @@ dns_catz_dbupdate_callback(dns_db_t *db, if (zone->dbversion != NULL) { dns_db_closeversion(zone->db, &zone->dbversion, false); } + dns_db_updatenotify_unregister( + zone->db, dns_catz_dbupdate_callback, zone->catzs); dns_db_detach(&zone->db); /* * We're not registering db update callback, it will be @@ -1860,6 +1864,14 @@ dns_catz_update_from_db(dns_db_t *db, dn return; } + if (!oldzone->active) { + /* This can happen during a reconfiguration. */ + isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, + DNS_LOGMODULE_MASTER, ISC_LOG_INFO, + "catz: zone '%s' is no longer active", bname); + return; + } + isc_buffer_init(&ibname, bname, DNS_NAME_FORMATSIZE); result = dns_name_totext(&db->origin, true, &ibname); INSIST(result == ISC_R_SUCCESS); @@ -2028,6 +2040,7 @@ dns_catz_prereconfig(dns_catz_zones_t *c REQUIRE(DNS_CATZ_ZONES_VALID(catzs)); + LOCK(&catzs->lock); isc_ht_iter_create(catzs->zones, &iter); for (result = isc_ht_iter_first(iter); result == ISC_R_SUCCESS; result = isc_ht_iter_next(iter)) @@ -2036,6 +2049,7 @@ dns_catz_prereconfig(dns_catz_zones_t *c isc_ht_iter_current(iter, (void **)&zone); zone->active = false; } + UNLOCK(&catzs->lock); INSIST(result == ISC_R_NOMORE); isc_ht_iter_destroy(&iter); } Index: src/external/mpl/bind/dist/lib/dns/dnsrps.c diff -u src/external/mpl/bind/dist/lib/dns/dnsrps.c:1.9 src/external/mpl/bind/dist/lib/dns/dnsrps.c:1.10 --- src/external/mpl/bind/dist/lib/dns/dnsrps.c:1.9 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/dnsrps.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dnsrps.c,v 1.9 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: dnsrps.c,v 1.10 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -640,6 +640,7 @@ rpsdb_allrdatasets(dns_db_t *db, dns_dbn rpsdb_iter->common.magic = DNS_RDATASETITER_MAGIC; rpsdb_iter->common.methods = &rpsdb_rdatasetiter_methods; rpsdb_iter->common.db = db; + rpsdb_iter->common.options = options; rpsdb_attachnode(db, node, &rpsdb_iter->common.node); *iteratorp = &rpsdb_iter->common; Index: src/external/mpl/bind/dist/lib/dns/keymgr.c diff -u src/external/mpl/bind/dist/lib/dns/keymgr.c:1.9 src/external/mpl/bind/dist/lib/dns/keymgr.c:1.10 --- src/external/mpl/bind/dist/lib/dns/keymgr.c:1.9 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/keymgr.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: keymgr.c,v 1.9 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: keymgr.c,v 1.10 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -2278,9 +2278,19 @@ keymgr_checkds(dns_kasp_t *kasp, dns_dns } if (dspublish) { + dst_key_state_t s; dst_key_settime(ksk_key->key, DST_TIME_DSPUBLISH, when); + result = dst_key_getstate(ksk_key->key, DST_KEY_DS, &s); + if (result != ISC_R_SUCCESS || s != RUMOURED) { + dst_key_setstate(ksk_key->key, DST_KEY_DS, RUMOURED); + } } else { + dst_key_state_t s; dst_key_settime(ksk_key->key, DST_TIME_DSDELETE, when); + result = dst_key_getstate(ksk_key->key, DST_KEY_DS, &s); + if (result != ISC_R_SUCCESS || s != UNRETENTIVE) { + dst_key_setstate(ksk_key->key, DST_KEY_DS, UNRETENTIVE); + } } if (isc_log_wouldlog(dns_lctx, ISC_LOG_NOTICE)) { Index: src/external/mpl/bind/dist/lib/dns/hmac_link.c diff -u src/external/mpl/bind/dist/lib/dns/hmac_link.c:1.7 src/external/mpl/bind/dist/lib/dns/hmac_link.c:1.8 --- src/external/mpl/bind/dist/lib/dns/hmac_link.c:1.7 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/hmac_link.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: hmac_link.c,v 1.7 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: hmac_link.c,v 1.8 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -172,6 +172,7 @@ hmac_createctx(const isc_md_type_t *type result = isc_hmac_init(ctx, hkey->key, isc_md_type_get_block_size(type), type); if (result != ISC_R_SUCCESS) { + isc_hmac_free(ctx); return (DST_R_UNSUPPORTEDALG); } Index: src/external/mpl/bind/dist/lib/dns/request.c diff -u src/external/mpl/bind/dist/lib/dns/request.c:1.7 src/external/mpl/bind/dist/lib/dns/request.c:1.8 --- src/external/mpl/bind/dist/lib/dns/request.c:1.7 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/request.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: request.c,v 1.7 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: request.c,v 1.8 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -1300,6 +1300,9 @@ req_connected(isc_task_t *task, isc_even req_log(ISC_LOG_DEBUG(3), "req_connected: request %p", request); + result = sevent->result; + isc_event_free(&event); + LOCK(&request->requestmgr->locks[request->hash]); request->flags &= ~DNS_REQUEST_F_CONNECTING; @@ -1314,7 +1317,6 @@ req_connected(isc_task_t *task, isc_even } } else { dns_dispatch_starttcp(request->dispatch); - result = sevent->result; if (result == ISC_R_SUCCESS) { result = req_send(request, task, NULL); } @@ -1325,13 +1327,13 @@ req_connected(isc_task_t *task, isc_even } } UNLOCK(&request->requestmgr->locks[request->hash]); - isc_event_free(&event); } static void req_senddone(isc_task_t *task, isc_event_t *event) { isc_socketevent_t *sevent = (isc_socketevent_t *)event; dns_request_t *request = event->ev_arg; + isc_result_t result = sevent->result; REQUIRE(event->ev_type == ISC_SOCKEVENT_SENDDONE); REQUIRE(VALID_REQUEST(request)); @@ -1341,6 +1343,8 @@ req_senddone(isc_task_t *task, isc_event UNUSED(task); + isc_event_free(&event); + LOCK(&request->requestmgr->locks[request->hash]); request->flags &= ~DNS_REQUEST_F_SENDING; @@ -1353,13 +1357,11 @@ req_senddone(isc_task_t *task, isc_event } else { send_if_done(request, ISC_R_CANCELED); } - } else if (sevent->result != ISC_R_SUCCESS) { + } else if (result != ISC_R_SUCCESS) { req_cancel(request); send_if_done(request, ISC_R_CANCELED); } UNLOCK(&request->requestmgr->locks[request->hash]); - - isc_event_free(&event); } static void @@ -1409,14 +1411,18 @@ static void req_timeout(isc_task_t *task, isc_event_t *event) { dns_request_t *request = event->ev_arg; isc_result_t result; + isc_eventtype_t ev_type = event->ev_type; REQUIRE(VALID_REQUEST(request)); req_log(ISC_LOG_DEBUG(3), "req_timeout: request %p", request); UNUSED(task); + + isc_event_free(&event); + LOCK(&request->requestmgr->locks[request->hash]); - if (event->ev_type == ISC_TIMEREVENT_TICK && request->udpcount-- != 0) { + if (ev_type == ISC_TIMEREVENT_TICK && request->udpcount-- != 0) { if (!DNS_REQUEST_SENDING(request)) { result = req_send(request, task, &request->destaddr); if (result != ISC_R_SUCCESS) { @@ -1430,7 +1436,6 @@ req_timeout(isc_task_t *task, isc_event_ send_if_done(request, ISC_R_TIMEDOUT); } UNLOCK(&request->requestmgr->locks[request->hash]); - isc_event_free(&event); } static void @@ -1473,7 +1478,7 @@ req_destroy(dns_request_t *request) { dns_dispatch_detach(&request->dispatch); } if (request->timer != NULL) { - isc_timer_detach(&request->timer); + isc_timer_destroy(&request->timer); } if (request->tsig != NULL) { isc_buffer_free(&request->tsig); @@ -1505,7 +1510,7 @@ req_cancel(dns_request_t *request) { request->flags |= DNS_REQUEST_F_CANCELED; if (request->timer != NULL) { - isc_timer_detach(&request->timer); + isc_timer_destroy(&request->timer); } dispattr = dns_dispatch_getattributes(request->dispatch); sock = NULL; Index: src/external/mpl/bind/dist/lib/dns/keytable.c diff -u src/external/mpl/bind/dist/lib/dns/keytable.c:1.8 src/external/mpl/bind/dist/lib/dns/keytable.c:1.9 --- src/external/mpl/bind/dist/lib/dns/keytable.c:1.8 Fri Sep 23 08:15:29 2022 +++ src/external/mpl/bind/dist/lib/dns/keytable.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: keytable.c,v 1.8 2022/09/23 12:15:29 christos Exp $ */ +/* $NetBSD: keytable.c,v 1.9 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -461,10 +461,6 @@ dns_keytable_deletekey(dns_keytable_t *k REQUIRE(VALID_KEYTABLE(keytable)); REQUIRE(dnskey != NULL); - isc_buffer_init(&b, data, sizeof(data)); - dns_rdata_fromstruct(&rdata, dnskey->common.rdclass, - dns_rdatatype_dnskey, dnskey, &b); - RWLOCK(&keytable->rwlock, isc_rwlocktype_write); result = dns_rbt_findnode(keytable->table, keyname, NULL, &node, NULL, DNS_RBTFIND_NOOPTIONS, NULL, NULL); @@ -491,6 +487,13 @@ dns_keytable_deletekey(dns_keytable_t *k } RWUNLOCK(&knode->rwlock, isc_rwlocktype_read); + isc_buffer_init(&b, data, sizeof(data)); + result = dns_rdata_fromstruct(&rdata, dnskey->common.rdclass, + dns_rdatatype_dnskey, dnskey, &b); + if (result != ISC_R_SUCCESS) { + goto finish; + } + result = dns_ds_fromkeyrdata(keyname, &rdata, DNS_DSDIGEST_SHA256, digest, &ds); if (result != ISC_R_SUCCESS) { Index: src/external/mpl/bind/dist/lib/dns/nta.c diff -u src/external/mpl/bind/dist/lib/dns/nta.c:1.8 src/external/mpl/bind/dist/lib/dns/nta.c:1.9 --- src/external/mpl/bind/dist/lib/dns/nta.c:1.8 Fri Sep 23 08:15:30 2022 +++ src/external/mpl/bind/dist/lib/dns/nta.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: nta.c,v 1.8 2022/09/23 12:15:30 christos Exp $ */ +/* $NetBSD: nta.c,v 1.9 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -79,7 +79,7 @@ nta_detach(isc_mem_t *mctx, dns_nta_t ** (void)isc_timer_reset(nta->timer, isc_timertype_inactive, NULL, NULL, true); - isc_timer_detach(&nta->timer); + isc_timer_destroy(&nta->timer); } if (dns_rdataset_isassociated(&nta->rdataset)) { dns_rdataset_disassociate(&nta->rdataset); @@ -295,6 +295,9 @@ settimer(dns_ntatable_t *ntatable, dns_n result = isc_timer_create(ntatable->timermgr, isc_timertype_ticker, NULL, &interval, ntatable->task, checkbogus, nta, &nta->timer); + if (result != ISC_R_SUCCESS) { + isc_timer_destroy(&nta->timer); + } return (result); } @@ -481,7 +484,7 @@ again: (void)isc_timer_reset(nta->timer, isc_timertype_inactive, NULL, NULL, true); - isc_timer_detach(&nta->timer); + isc_timer_destroy(&nta->timer); } result = deletenode(ntatable, foundname); Index: src/external/mpl/bind/dist/lib/dns/master.c diff -u src/external/mpl/bind/dist/lib/dns/master.c:1.10 src/external/mpl/bind/dist/lib/dns/master.c:1.11 --- src/external/mpl/bind/dist/lib/dns/master.c:1.10 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/master.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: master.c,v 1.10 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: master.c,v 1.11 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -1103,7 +1103,7 @@ load_text(dns_loadctx_t *lctx) { char *lhs = NULL; char *gtype = NULL; char *rhs = NULL; - const char *source = ""; + const char *source; unsigned long line = 0; bool explicit_ttl; char classname1[DNS_RDATACLASS_FORMATSIZE]; Index: src/external/mpl/bind/dist/lib/dns/nsec3.c diff -u src/external/mpl/bind/dist/lib/dns/nsec3.c:1.11 src/external/mpl/bind/dist/lib/dns/nsec3.c:1.12 --- src/external/mpl/bind/dist/lib/dns/nsec3.c:1.11 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/nsec3.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: nsec3.c,v 1.11 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: nsec3.c,v 1.12 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -1445,7 +1445,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbv result = dns_dbiterator_seek(dbit, hashname); if (result == ISC_R_NOTFOUND || result == DNS_R_PARTIALMATCH) { - goto success; + goto cleanup_orphaned_ents; } if (result != ISC_R_SUCCESS) { goto failure; @@ -1457,7 +1457,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbv (isc_stdtime_t)0, &rdataset, NULL); dns_db_detachnode(db, &node); if (result == ISC_R_NOTFOUND) { - goto success; + goto cleanup_orphaned_ents; } if (result != ISC_R_SUCCESS) { goto failure; @@ -1542,6 +1542,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbv /* * Delete NSEC3 records for now non active nodes. */ +cleanup_orphaned_ents: dns_name_init(&empty, NULL); dns_name_clone(name, &empty); do { Index: src/external/mpl/bind/dist/lib/dns/rbt.c diff -u src/external/mpl/bind/dist/lib/dns/rbt.c:1.12 src/external/mpl/bind/dist/lib/dns/rbt.c:1.13 --- src/external/mpl/bind/dist/lib/dns/rbt.c:1.12 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/rbt.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: rbt.c,v 1.12 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: rbt.c,v 1.13 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -37,6 +37,7 @@ * efficient macro calls instead of functions for a few operations. */ #define DNS_NAME_USEINLINE 1 +#define ALIGNMENT_SIZE 8U /* see lib/isc/mem.c */ #include <unistd.h> @@ -801,8 +802,12 @@ treefix(dns_rbt_t *rbt, void *base, size return (ISC_R_SUCCESS); } +#define CHECK_ALIGNMENT(n) \ + (((uintptr_t)n & ~((uintptr_t)ALIGNMENT_SIZE - 1)) == (uintptr_t)n) + CONFIRM((void *)n >= base); CONFIRM((size_t)((char *)n - (char *)base) <= nodemax); + CONFIRM(CHECK_ALIGNMENT(n)); CONFIRM(DNS_RBTNODE_VALID(n)); dns_name_init(&nodename, NULL); @@ -823,6 +828,7 @@ treefix(dns_rbt_t *rbt, void *base, size CONFIRM(n->left <= (dns_rbtnode_t *)nodemax); n->left = getleft(n, rbt->mmap_location); n->left_is_relative = 0; + CONFIRM(CHECK_ALIGNMENT(n->left)); CONFIRM(DNS_RBTNODE_VALID(n->left)); } else { CONFIRM(n->left == NULL); @@ -832,6 +838,7 @@ treefix(dns_rbt_t *rbt, void *base, size CONFIRM(n->right <= (dns_rbtnode_t *)nodemax); n->right = getright(n, rbt->mmap_location); n->right_is_relative = 0; + CONFIRM(CHECK_ALIGNMENT(n->right)); CONFIRM(DNS_RBTNODE_VALID(n->right)); } else { CONFIRM(n->right == NULL); @@ -842,6 +849,7 @@ treefix(dns_rbt_t *rbt, void *base, size n->down = getdown(n, rbt->mmap_location); n->down_is_relative = 0; CONFIRM(n->down > (dns_rbtnode_t *)n); + CONFIRM(CHECK_ALIGNMENT(n->down)); CONFIRM(DNS_RBTNODE_VALID(n->down)); } else { CONFIRM(n->down == NULL); @@ -852,6 +860,7 @@ treefix(dns_rbt_t *rbt, void *base, size n->parent = getparent(n, rbt->mmap_location); n->parent_is_relative = 0; CONFIRM(n->parent < (dns_rbtnode_t *)n); + CONFIRM(CHECK_ALIGNMENT(n->parent)); CONFIRM(DNS_RBTNODE_VALID(n->parent)); } else { CONFIRM(n->parent == NULL); @@ -862,6 +871,7 @@ treefix(dns_rbt_t *rbt, void *base, size n->data = getdata(n, rbt->mmap_location); n->data_is_relative = 0; CONFIRM(n->data > (void *)n); + CONFIRM(CHECK_ALIGNMENT(n->data)); } else { CONFIRM(n->data == NULL); } Index: src/external/mpl/bind/dist/lib/dns/rpz.c diff -u src/external/mpl/bind/dist/lib/dns/rpz.c:1.12 src/external/mpl/bind/dist/lib/dns/rpz.c:1.13 --- src/external/mpl/bind/dist/lib/dns/rpz.c:1.12 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/rpz.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: rpz.c,v 1.12 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: rpz.c,v 1.13 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -2232,7 +2232,7 @@ rpz_detach(dns_rpz_zone_t **rpzp) { isc_timer_reset(rpz->updatetimer, isc_timertype_inactive, NULL, NULL, true); - isc_timer_detach(&rpz->updatetimer); + isc_timer_destroy(&rpz->updatetimer); isc_ht_destroy(&rpz->nodes); Index: src/external/mpl/bind/dist/lib/dns/validator.c diff -u src/external/mpl/bind/dist/lib/dns/validator.c:1.12 src/external/mpl/bind/dist/lib/dns/validator.c:1.13 --- src/external/mpl/bind/dist/lib/dns/validator.c:1.12 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/validator.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: validator.c,v 1.12 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: validator.c,v 1.13 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -1399,26 +1399,50 @@ selfsigned_dnskey(dns_validator_t *val) continue; } - result = dns_dnssec_keyfromrdata(name, &keyrdata, mctx, - &dstkey); - if (result != ISC_R_SUCCESS) { + /* + * If the REVOKE bit is not set we have a + * theoretically self signed DNSKEY RRset. + * This will be verified later. + */ + if ((key.flags & DNS_KEYFLAG_REVOKE) == 0) { + answer = true; continue; } - result = dns_dnssec_verify(name, rdataset, dstkey, true, - val->view->maxbits, mctx, - &sigrdata, NULL); - dst_key_free(&dstkey); + result = dns_dnssec_keyfromrdata(name, &keyrdata, mctx, + &dstkey); if (result != ISC_R_SUCCESS) { continue; } - if ((key.flags & DNS_KEYFLAG_REVOKE) == 0) { - answer = true; - continue; + /* + * If this RRset is pending and it is trusted, + * see if it was self signed by this DNSKEY. + */ + if (DNS_TRUST_PENDING(rdataset->trust) && + dns_view_istrusted(val->view, name, &key)) + { + result = dns_dnssec_verify( + name, rdataset, dstkey, true, + val->view->maxbits, mctx, &sigrdata, + NULL); + if (result == ISC_R_SUCCESS) { + /* + * The key with the REVOKE flag has + * self signed the RRset so it is no + * good. + */ + dns_view_untrust(val->view, name, &key); + } + } else if (rdataset->trust >= dns_trust_secure) { + /* + * We trust this RRset so if the key is + * marked revoked remove it. + */ + dns_view_untrust(val->view, name, &key); } - dns_view_untrust(val->view, name, &key); + dst_key_free(&dstkey); } } Index: src/external/mpl/bind/dist/lib/dns/xfrin.c diff -u src/external/mpl/bind/dist/lib/dns/xfrin.c:1.12 src/external/mpl/bind/dist/lib/dns/xfrin.c:1.13 --- src/external/mpl/bind/dist/lib/dns/xfrin.c:1.12 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/xfrin.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xfrin.c,v 1.12 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: xfrin.c,v 1.13 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -952,7 +952,7 @@ xfrin_create(isc_mem_t *mctx, dns_zone_t failure: if (xfr->timer != NULL) { - isc_timer_detach(&xfr->timer); + isc_timer_destroy(&xfr->timer); } if (dns_name_dynamic(&xfr->name)) { dns_name_free(&xfr->name, xfr->mctx); @@ -1582,7 +1582,7 @@ maybe_free(dns_xfrin_ctx_t *xfr) { } if (xfr->timer != NULL) { - isc_timer_detach(&xfr->timer); + isc_timer_destroy(&xfr->timer); } if (xfr->task != NULL) { Index: src/external/mpl/bind/dist/lib/dns/rbtdb.c diff -u src/external/mpl/bind/dist/lib/dns/rbtdb.c:1.16 src/external/mpl/bind/dist/lib/dns/rbtdb.c:1.17 --- src/external/mpl/bind/dist/lib/dns/rbtdb.c:1.16 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/rbtdb.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: rbtdb.c,v 1.16 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: rbtdb.c,v 1.17 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -607,7 +607,7 @@ static void expire_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, bool tree_locked, expire_t reason); static void -overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, isc_stdtime_t now, +overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, size_t purgesize, bool tree_locked); static void resign_insert(dns_rbtdb_t *rbtdb, int idx, rdatasetheader_t *newheader); @@ -2787,7 +2787,7 @@ end: * tree_lock(write) must be held. */ static isc_result_t -add_wildcard_magic(dns_rbtdb_t *rbtdb, const dns_name_t *name) { +add_wildcard_magic(dns_rbtdb_t *rbtdb, const dns_name_t *name, bool lock) { isc_result_t result; dns_name_t foundname; dns_offsets_t offsets; @@ -2807,7 +2807,15 @@ add_wildcard_magic(dns_rbtdb_t *rbtdb, c node->nsec = DNS_RBT_NSEC_NORMAL; } node->find_callback = 1; + if (lock) { + NODE_LOCK(&rbtdb->node_locks[node->locknum].lock, + isc_rwlocktype_write); + } node->wild = 1; + if (lock) { + NODE_UNLOCK(&rbtdb->node_locks[node->locknum].lock, + isc_rwlocktype_write); + } return (ISC_R_SUCCESS); } @@ -2815,7 +2823,7 @@ add_wildcard_magic(dns_rbtdb_t *rbtdb, c * tree_lock(write) must be held. */ static isc_result_t -add_empty_wildcards(dns_rbtdb_t *rbtdb, const dns_name_t *name) { +add_empty_wildcards(dns_rbtdb_t *rbtdb, const dns_name_t *name, bool lock) { isc_result_t result; dns_name_t foundname; dns_offsets_t offsets; @@ -2829,7 +2837,7 @@ add_empty_wildcards(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node = NULL; /* dummy */ dns_name_getlabelsequence(name, n - i, i, &foundname); if (dns_name_iswildcard(&foundname)) { - result = add_wildcard_magic(rbtdb, &foundname); + result = add_wildcard_magic(rbtdb, &foundname, lock); if (result != ISC_R_SUCCESS) { return (result); } @@ -2881,11 +2889,11 @@ findnodeintree(dns_rbtdb_t *rbtdb, dns_r dns_rbt_namefromnode(node, &nodename); node->locknum = node->hashval % rbtdb->node_lock_count; if (tree == rbtdb->tree) { - add_empty_wildcards(rbtdb, name); + add_empty_wildcards(rbtdb, name, true); if (dns_name_iswildcard(name)) { - result = add_wildcard_magic(rbtdb, - name); + result = add_wildcard_magic(rbtdb, name, + true); if (result != ISC_R_SUCCESS) { RWUNLOCK(&rbtdb->tree_lock, locktype); @@ -6817,6 +6825,16 @@ cleanup: static dns_dbmethods_t zone_methods; +static size_t +rdataset_size(rdatasetheader_t *header) { + if (!NONEXISTENT(header)) { + return (dns_rdataslab_size((unsigned char *)header, + sizeof(*header))); + } + + return (sizeof(*header)); +} + static isc_result_t addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_stdtime_t now, dns_rdataset_t *rdataset, unsigned int options, @@ -6981,7 +6999,8 @@ addrdataset(dns_db_t *db, dns_dbnode_t * } if (cache_is_overmem) { - overmem_purge(rbtdb, rbtnode->locknum, now, tree_locked); + overmem_purge(rbtdb, rbtnode->locknum, rdataset_size(newheader), + tree_locked); } NODE_LOCK(&rbtdb->node_locks[rbtnode->locknum].lock, @@ -7000,10 +7019,18 @@ addrdataset(dns_db_t *db, dns_dbnode_t * } header = isc_heap_element(rbtdb->heaps[rbtnode->locknum], 1); - if (header != NULL && header->rdh_ttl + rbtdb->serve_stale_ttl < - now - RBTDB_VIRTUAL) - { - expire_header(rbtdb, header, tree_locked, expire_ttl); + if (header != NULL) { + dns_ttl_t rdh_ttl = header->rdh_ttl; + + /* Only account for stale TTL if cache is not overmem */ + if (!cache_is_overmem) { + rdh_ttl += rbtdb->serve_stale_ttl; + } + + if (rdh_ttl < now - RBTDB_VIRTUAL) { + expire_header(rbtdb, header, tree_locked, + expire_ttl); + } } /* @@ -7451,7 +7478,7 @@ loading_addrdataset(void *arg, const dns if (rdataset->type != dns_rdatatype_nsec3 && rdataset->covers != dns_rdatatype_nsec3) { - add_empty_wildcards(rbtdb, name); + add_empty_wildcards(rbtdb, name, false); } if (dns_name_iswildcard(name)) { @@ -7467,7 +7494,7 @@ loading_addrdataset(void *arg, const dns if (rdataset->type == dns_rdatatype_nsec3) { return (DNS_R_INVALIDNSEC3); } - result = add_wildcard_magic(rbtdb, name); + result = add_wildcard_magic(rbtdb, name, false); if (result != ISC_R_SUCCESS) { return (result); } @@ -10541,52 +10568,58 @@ update_header(dns_rbtdb_t *rbtdb, rdatas ISC_LIST_PREPEND(rbtdb->rdatasets[header->node->locknum], header, link); } +static size_t +expire_lru_headers(dns_rbtdb_t *rbtdb, unsigned int locknum, size_t purgesize, + bool tree_locked) { + rdatasetheader_t *header, *header_prev; + size_t purged = 0; + + for (header = ISC_LIST_TAIL(rbtdb->rdatasets[locknum]); + header != NULL && purged <= purgesize; header = header_prev) + { + header_prev = ISC_LIST_PREV(header, link); + /* + * Unlink the entry at this point to avoid checking it + * again even if it's currently used someone else and + * cannot be purged at this moment. This entry won't be + * referenced any more (so unlinking is safe) since the + * TTL was reset to 0. + */ + ISC_LIST_UNLINK(rbtdb->rdatasets[locknum], header, link); + size_t header_size = rdataset_size(header); + expire_header(rbtdb, header, tree_locked, expire_lru); + purged += header_size; + } + + return (purged); +} + /*% - * Purge some expired and/or stale (i.e. unused for some period) cache entries - * under an overmem condition. To recover from this condition quickly, up to - * 2 entries will be purged. This process is triggered while adding a new - * entry, and we specifically avoid purging entries in the same LRU bucket as - * the one to which the new entry will belong. Otherwise, we might purge - * entries of the same name of different RR types while adding RRsets from a - * single response (consider the case where we're adding A and AAAA glue records - * of the same NS name). + * Purge some stale (i.e. unused for some period - LRU based cleaning) cache + * entries under the overmem condition. To recover from this condition quickly, + * we cleanup entries up to the size of newly added rdata (passed as purgesize). + * + * This process is triggered while adding a new entry, and we specifically avoid + * purging entries in the same LRU bucket as the one to which the new entry will + * belong. Otherwise, we might purge entries of the same name of different RR + * types while adding RRsets from a single response (consider the case where + * we're adding A and AAAA glue records of the same NS name). */ static void -overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, isc_stdtime_t now, +overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, size_t purgesize, bool tree_locked) { - rdatasetheader_t *header, *header_prev; unsigned int locknum; - int purgecount = 2; + size_t purged = 0; for (locknum = (locknum_start + 1) % rbtdb->node_lock_count; - locknum != locknum_start && purgecount > 0; + locknum != locknum_start && purged <= purgesize; locknum = (locknum + 1) % rbtdb->node_lock_count) { NODE_LOCK(&rbtdb->node_locks[locknum].lock, isc_rwlocktype_write); - header = isc_heap_element(rbtdb->heaps[locknum], 1); - if (header && header->rdh_ttl < now - RBTDB_VIRTUAL) { - expire_header(rbtdb, header, tree_locked, expire_ttl); - purgecount--; - } - - for (header = ISC_LIST_TAIL(rbtdb->rdatasets[locknum]); - header != NULL && purgecount > 0; header = header_prev) - { - header_prev = ISC_LIST_PREV(header, link); - /* - * Unlink the entry at this point to avoid checking it - * again even if it's currently used someone else and - * cannot be purged at this moment. This entry won't be - * referenced any more (so unlinking is safe) since the - * TTL was reset to 0. - */ - ISC_LIST_UNLINK(rbtdb->rdatasets[locknum], header, - link); - expire_header(rbtdb, header, tree_locked, expire_lru); - purgecount--; - } + purged += expire_lru_headers(rbtdb, locknum, purgesize - purged, + tree_locked); NODE_UNLOCK(&rbtdb->node_locks[locknum].lock, isc_rwlocktype_write); Index: src/external/mpl/bind/dist/lib/dns/resolver.c diff -u src/external/mpl/bind/dist/lib/dns/resolver.c:1.16 src/external/mpl/bind/dist/lib/dns/resolver.c:1.17 --- src/external/mpl/bind/dist/lib/dns/resolver.c:1.16 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/resolver.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: resolver.c,v 1.16 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: resolver.c,v 1.17 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -4708,9 +4708,9 @@ fctx_destroy(fetchctx_t *fctx) { isc_counter_detach(&fctx->qc); fcount_decr(fctx); - isc_timer_detach(&fctx->timer); + isc_timer_destroy(&fctx->timer); if (fctx->timer_try_stale != NULL) { - isc_timer_detach(&fctx->timer_try_stale); + isc_timer_destroy(&fctx->timer_try_stale); } dns_message_detach(&fctx->qmessage); if (dns_name_countlabels(&fctx->domain) > 0) { @@ -5485,8 +5485,8 @@ cleanup_mctx: isc_mem_detach(&fctx->mctx); dns_adb_detach(&fctx->adb); dns_db_detach(&fctx->cache); - isc_timer_detach(&fctx->timer); - isc_timer_detach(&fctx->timer_try_stale); + isc_timer_destroy(&fctx->timer); + isc_timer_destroy(&fctx->timer_try_stale); cleanup_qmessage: dns_message_detach(&fctx->qmessage); @@ -10488,7 +10488,7 @@ destroy(dns_resolver_t *res) { #if USE_MBSLOCK isc_rwlock_destroy(&res->mbslock); #endif /* if USE_MBSLOCK */ - isc_timer_detach(&res->spillattimer); + isc_timer_destroy(&res->spillattimer); res->magic = 0; isc_mem_put(res->mctx, res, sizeof(*res)); } Index: src/external/mpl/bind/dist/lib/dns/view.c diff -u src/external/mpl/bind/dist/lib/dns/view.c:1.13 src/external/mpl/bind/dist/lib/dns/view.c:1.14 --- src/external/mpl/bind/dist/lib/dns/view.c:1.13 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/view.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: view.c,v 1.13 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: view.c,v 1.14 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -1994,26 +1994,28 @@ dns_view_issecuredomain(dns_view_t *view void dns_view_untrust(dns_view_t *view, const dns_name_t *keyname, - dns_rdata_dnskey_t *dnskey) { + const dns_rdata_dnskey_t *dnskey) { isc_result_t result; dns_keytable_t *sr = NULL; + dns_rdata_dnskey_t tmpkey; REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(keyname != NULL); REQUIRE(dnskey != NULL); - /* - * Clear the revoke bit, if set, so that the key will match what's - * in secroots now. - */ - dnskey->flags &= ~DNS_KEYFLAG_REVOKE; - result = dns_view_getsecroots(view, &sr); if (result != ISC_R_SUCCESS) { return; } - result = dns_keytable_deletekey(sr, keyname, dnskey); + /* + * Clear the revoke bit, if set, so that the key will match what's + * in secroots now. + */ + tmpkey = *dnskey; + tmpkey.flags &= ~DNS_KEYFLAG_REVOKE; + + result = dns_keytable_deletekey(sr, keyname, &tmpkey); if (result == ISC_R_SUCCESS) { /* * If key was found in secroots, then it was a @@ -2028,6 +2030,88 @@ dns_view_untrust(dns_view_t *view, const dns_keytable_detach(&sr); } +bool +dns_view_istrusted(dns_view_t *view, const dns_name_t *keyname, + const dns_rdata_dnskey_t *dnskey) { + isc_result_t result; + dns_keytable_t *sr = NULL; + dns_keynode_t *knode = NULL; + bool answer = false; + dns_rdataset_t dsset; + + REQUIRE(DNS_VIEW_VALID(view)); + REQUIRE(keyname != NULL); + REQUIRE(dnskey != NULL); + + result = dns_view_getsecroots(view, &sr); + if (result != ISC_R_SUCCESS) { + return (false); + } + + dns_rdataset_init(&dsset); + result = dns_keytable_find(sr, keyname, &knode); + if (result == ISC_R_SUCCESS) { + if (dns_keynode_dsset(knode, &dsset)) { + dns_rdata_t rdata = DNS_RDATA_INIT; + unsigned char data[4096], digest[DNS_DS_BUFFERSIZE]; + dns_rdata_dnskey_t tmpkey = *dnskey; + dns_rdata_ds_t ds; + isc_buffer_t b; + dns_rdataclass_t rdclass = tmpkey.common.rdclass; + + /* + * Clear the revoke bit, if set, so that the key + * will match what's in secroots now. + */ + tmpkey.flags &= ~DNS_KEYFLAG_REVOKE; + + isc_buffer_init(&b, data, sizeof(data)); + result = dns_rdata_fromstruct(&rdata, rdclass, + dns_rdatatype_dnskey, + &tmpkey, &b); + if (result != ISC_R_SUCCESS) { + goto finish; + } + + result = dns_ds_fromkeyrdata(keyname, &rdata, + DNS_DSDIGEST_SHA256, + digest, &ds); + if (result != ISC_R_SUCCESS) { + goto finish; + } + + dns_rdata_reset(&rdata); + isc_buffer_init(&b, data, sizeof(data)); + result = dns_rdata_fromstruct( + &rdata, rdclass, dns_rdatatype_ds, &ds, &b); + if (result != ISC_R_SUCCESS) { + goto finish; + } + + result = dns_rdataset_first(&dsset); + while (result == ISC_R_SUCCESS) { + dns_rdata_t this = DNS_RDATA_INIT; + dns_rdataset_current(&dsset, &this); + if (dns_rdata_compare(&rdata, &this) == 0) { + answer = true; + break; + } + result = dns_rdataset_next(&dsset); + } + } + } + +finish: + if (dns_rdataset_isassociated(&dsset)) { + dns_rdataset_disassociate(&dsset); + } + if (knode != NULL) { + dns_keytable_detachkeynode(sr, &knode); + } + dns_keytable_detach(&sr); + return (answer); +} + /* * Create path to a directory and a filename constructed from viewname. * This is a front-end to isc_file_sanitize(), allowing backward Index: src/external/mpl/bind/dist/lib/dns/zone.c diff -u src/external/mpl/bind/dist/lib/dns/zone.c:1.17 src/external/mpl/bind/dist/lib/dns/zone.c:1.18 --- src/external/mpl/bind/dist/lib/dns/zone.c:1.17 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/zone.c Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: zone.c,v 1.17 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: zone.c,v 1.18 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -1259,6 +1259,8 @@ zone_free(dns_zone_t *zone) { INSIST(zone->readio == NULL); INSIST(zone->statelist == NULL); INSIST(zone->writeio == NULL); + INSIST(zone->view == NULL); + INSIST(zone->prev_view == NULL); if (zone->task != NULL) { isc_task_detach(&zone->task); @@ -1266,12 +1268,6 @@ zone_free(dns_zone_t *zone) { if (zone->loadtask != NULL) { isc_task_detach(&zone->loadtask); } - if (zone->view != NULL) { - dns_view_weakdetach(&zone->view); - } - if (zone->prev_view != NULL) { - dns_view_weakdetach(&zone->prev_view); - } /* Unmanaged objects */ while (!ISC_LIST_EMPTY(zone->setnsec3param_queue)) { @@ -2421,6 +2417,9 @@ zone_asyncload(isc_task_t *task, isc_eve (asl->loaded)(asl->loaded_arg, zone, task); } + /* Reduce the quantum */ + isc_task_setquantum(zone->loadtask, 1); + isc_mem_put(zone->mctx, asl, sizeof(*asl)); dns_zone_idetach(&zone); } @@ -4744,8 +4743,7 @@ sync_keyzone(dns_zone_t *zone, dns_db_t } failure: - if (result != ISC_R_SUCCESS && !DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED)) - { + if (result != ISC_R_SUCCESS) { dnssec_log(zone, ISC_LOG_ERROR, "unable to synchronize managed keys: %s", dns_result_totext(result)); @@ -5210,10 +5208,7 @@ zone_postload(dns_zone_t *zone, dns_db_t break; case dns_zone_key: - result = sync_keyzone(zone, db); - if (result != ISC_R_SUCCESS) { - goto cleanup; - } + /* Nothing needs to be done now */ break; default: @@ -5371,13 +5366,6 @@ zone_postload(dns_zone_t *zone, dns_db_t goto done; cleanup: - if (zone->type == dns_zone_key && result != ISC_R_SUCCESS) { - dnssec_log(zone, ISC_LOG_ERROR, - "failed to initialize managed-keys (%s): " - "DNSSEC validation is at risk", - isc_result_totext(result)); - } - if (result != ISC_R_SUCCESS) { dns_zone_rpz_disable_db(zone, db); dns_zone_catz_disable_db(zone, db); @@ -5866,11 +5854,11 @@ dns_zone_setkasp(dns_zone_t *zone, dns_k LOCK_ZONE(zone); if (zone->kasp != NULL) { - dns_kasp_t *oldkasp = zone->kasp; - zone->kasp = NULL; - dns_kasp_detach(&oldkasp); + dns_kasp_detach(&zone->kasp); + } + if (kasp != NULL) { + dns_kasp_attach(kasp, &zone->kasp); } - zone->kasp = kasp; UNLOCK_ZONE(zone); } @@ -7361,8 +7349,14 @@ zone_resigninc(dns_zone_t *zone) { } ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_read); - dns_db_attach(zone->db, &db); + if (zone->db != NULL) { + dns_db_attach(zone->db, &db); + } ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_read); + if (db == NULL) { + result = ISC_R_FAILURE; + goto failure; + } result = dns_db_newversion(db, &version); if (result != ISC_R_SUCCESS) { @@ -9624,14 +9618,14 @@ zone_sign(dns_zone_t *zone) { use_kasp ? "yes" : "no"); /* Determine which type of chain to build */ - if (use_kasp) { - build_nsec3 = dns_kasp_nsec3(kasp); - build_nsec = !build_nsec3; - } else { - CHECK(dns_private_chains(db, version, zone->privatetype, - &build_nsec, &build_nsec3)); - /* If neither chain is found, default to NSEC */ - if (!build_nsec && !build_nsec3) { + CHECK(dns_private_chains(db, version, zone->privatetype, &build_nsec, + &build_nsec3)); + if (!build_nsec && !build_nsec3) { + if (use_kasp) { + build_nsec3 = dns_kasp_nsec3(kasp); + build_nsec = !build_nsec3; + } else { + /* If neither chain is found, default to NSEC */ build_nsec = true; } } @@ -11064,6 +11058,11 @@ retry_keyfetch(dns_keyfetch_t *kfetch, d isc_time_t timenow, timethen; dns_zone_t *zone = kfetch->zone; bool free_needed; + char namebuf[DNS_NAME_FORMATSIZE]; + + dns_name_format(kname, namebuf, sizeof(namebuf)); + dnssec_log(zone, ISC_LOG_WARNING, + "Failed to create fetch for %s DNSKEY update", namebuf); /* * Error during a key fetch; cancel and retry in an hour. @@ -11075,8 +11074,6 @@ retry_keyfetch(dns_keyfetch_t *kfetch, d dns_rdataset_disassociate(&kfetch->keydataset); dns_name_free(kname, zone->mctx); isc_mem_putanddetach(&kfetch->mctx, kfetch, sizeof(*kfetch)); - dnssec_log(zone, ISC_LOG_WARNING, - "Failed to create fetch for DNSKEY update"); if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) { /* Don't really retry if we are exiting */ @@ -14939,6 +14936,7 @@ zone_shutdown(isc_task_t *task, isc_even dns_zone_t *zone = (dns_zone_t *)event->ev_arg; bool free_needed, linked = false; dns_zone_t *raw = NULL, *secure = NULL; + dns_view_t *view = NULL, *prev_view = NULL; UNUSED(task); REQUIRE(DNS_ZONE_VALID(zone)); @@ -14984,6 +14982,17 @@ zone_shutdown(isc_task_t *task, isc_even LOCK_ZONE(zone); INSIST(zone != zone->raw); + + /* + * Detach the views early, we don't need them anymore. However, we need + * to detach them outside of the zone lock to break the lock loop + * between view, adb and zone locks. + */ + view = zone->view; + zone->view = NULL; + prev_view = zone->prev_view; + zone->prev_view = NULL; + if (linked) { isc_refcount_decrement(&zone->irefs); } @@ -15018,7 +15027,7 @@ zone_shutdown(isc_task_t *task, isc_even forward_cancel(zone); if (zone->timer != NULL) { - isc_timer_detach(&zone->timer); + isc_timer_destroy(&zone->timer); isc_refcount_decrement(&zone->irefs); } @@ -15044,6 +15053,14 @@ zone_shutdown(isc_task_t *task, isc_even zone->secure = NULL; } UNLOCK_ZONE(zone); + + if (view != NULL) { + dns_view_weakdetach(&view); + } + if (prev_view != NULL) { + dns_view_weakdetach(&prev_view); + } + if (raw != NULL) { dns_zone_detach(&raw); } @@ -19075,7 +19092,7 @@ dns_zonemgr_setsize(dns_zonemgr_t *zmgr, pool = NULL; if (zmgr->loadtasks == NULL) { result = isc_taskpool_create(zmgr->taskmgr, zmgr->mctx, ntasks, - 2, true, &pool); + UINT_MAX, true, &pool); } else { result = isc_taskpool_expand(&zmgr->loadtasks, ntasks, true, &pool); Index: src/external/mpl/bind/dist/lib/dns/include/dns/view.h diff -u src/external/mpl/bind/dist/lib/dns/include/dns/view.h:1.8 src/external/mpl/bind/dist/lib/dns/include/dns/view.h:1.9 --- src/external/mpl/bind/dist/lib/dns/include/dns/view.h:1.8 Fri Sep 23 08:15:30 2022 +++ src/external/mpl/bind/dist/lib/dns/include/dns/view.h Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: view.h,v 1.8 2022/09/23 12:15:30 christos Exp $ */ +/* $NetBSD: view.h,v 1.9 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -1199,7 +1199,7 @@ dns_view_ntacovers(dns_view_t *view, isc void dns_view_untrust(dns_view_t *view, const dns_name_t *keyname, - dns_rdata_dnskey_t *dnskey); + const dns_rdata_dnskey_t *dnskey); /*%< * Remove keys that match 'keyname' and 'dnskey' from the views trust * anchors. @@ -1216,6 +1216,19 @@ dns_view_untrust(dns_view_t *view, const * \li 'dnskey' is valid. */ +bool +dns_view_istrusted(dns_view_t *view, const dns_name_t *keyname, + const dns_rdata_dnskey_t *dnskey); +/*%< + * Determine if the key defined by 'keyname' and 'dnskey' is + * trusted by 'view'. + * + * Requires: + * \li 'view' is valid. + * \li 'keyname' is valid. + * \li 'dnskey' is valid. + */ + isc_result_t dns_view_setnewzones(dns_view_t *view, bool allow, void *cfgctx, void (*cfg_destroy)(void **), uint64_t mapsize); Index: src/external/mpl/bind/dist/lib/dns/include/dns/zt.h diff -u src/external/mpl/bind/dist/lib/dns/include/dns/zt.h:1.7 src/external/mpl/bind/dist/lib/dns/include/dns/zt.h:1.8 --- src/external/mpl/bind/dist/lib/dns/include/dns/zt.h:1.7 Wed Jan 25 16:43:30 2023 +++ src/external/mpl/bind/dist/lib/dns/include/dns/zt.h Mon Jun 26 18:03:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: zt.h,v 1.7 2023/01/25 21:43:30 christos Exp $ */ +/* $NetBSD: zt.h,v 1.8 2023/06/26 22:03:00 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -21,6 +21,7 @@ #include <stdbool.h> #include <isc/lang.h> +#include <isc/rwlock.h> #include <dns/types.h> Index: src/external/mpl/bind/dist/lib/irs/getaddrinfo.c diff -u src/external/mpl/bind/dist/lib/irs/getaddrinfo.c:1.8 src/external/mpl/bind/dist/lib/irs/getaddrinfo.c:1.9 --- src/external/mpl/bind/dist/lib/irs/getaddrinfo.c:1.8 Wed Jan 25 16:43:31 2023 +++ src/external/mpl/bind/dist/lib/irs/getaddrinfo.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: getaddrinfo.c,v 1.8 2023/01/25 21:43:31 christos Exp $ */ +/* $NetBSD: getaddrinfo.c,v 1.9 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -1358,7 +1358,8 @@ ai_concat(struct addrinfo *ai1, struct a for (ai_tmp = ai1; ai_tmp != NULL && ai_tmp->ai_next != NULL; ai_tmp = ai_tmp->ai_next) - {} + { + } ai_tmp->ai_next = ai2; Index: src/external/mpl/bind/dist/lib/irs/resconf.c diff -u src/external/mpl/bind/dist/lib/irs/resconf.c:1.6 src/external/mpl/bind/dist/lib/irs/resconf.c:1.7 --- src/external/mpl/bind/dist/lib/irs/resconf.c:1.6 Fri Sep 23 08:15:32 2022 +++ src/external/mpl/bind/dist/lib/irs/resconf.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: resconf.c,v 1.6 2022/09/23 12:15:32 christos Exp $ */ +/* $NetBSD: resconf.c,v 1.7 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -290,10 +290,6 @@ resconf_parsenameserver(irs_resconf_t *c int cp; isc_result_t result; - if (conf->numns == RESCONFMAXNAMESERVERS) { - return (ISC_R_SUCCESS); - } - cp = getword(fp, word, sizeof(word)); if (strlen(word) == 0U) { return (ISC_R_UNEXPECTEDEND); /* Nothing on line. */ @@ -305,6 +301,10 @@ resconf_parsenameserver(irs_resconf_t *c return (ISC_R_UNEXPECTEDTOKEN); /* Extra junk on line. */ } + if (conf->numns == RESCONFMAXNAMESERVERS) { + return (ISC_R_SUCCESS); + } + result = add_server(conf->mctx, word, &conf->nameservers); if (result != ISC_R_SUCCESS) { return (result); Index: src/external/mpl/bind/dist/lib/isc/iterated_hash.c diff -u src/external/mpl/bind/dist/lib/isc/iterated_hash.c:1.6 src/external/mpl/bind/dist/lib/isc/iterated_hash.c:1.7 --- src/external/mpl/bind/dist/lib/isc/iterated_hash.c:1.6 Fri Sep 23 08:15:33 2022 +++ src/external/mpl/bind/dist/lib/isc/iterated_hash.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: iterated_hash.c,v 1.6 2022/09/23 12:15:33 christos Exp $ */ +/* $NetBSD: iterated_hash.c,v 1.7 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -15,8 +15,11 @@ #include <stdio.h> +#include <openssl/opensslv.h> +#include <openssl/sha.h> + #include <isc/iterated_hash.h> -#include <isc/md.h> +#include <isc/thread.h> #include <isc/util.h> int @@ -24,55 +27,40 @@ isc_iterated_hash(unsigned char *out, co const int iterations, const unsigned char *salt, const int saltlength, const unsigned char *in, const int inlength) { - isc_md_t *md; - isc_result_t result; + REQUIRE(out != NULL); + int n = 0; - unsigned int outlength = 0; size_t len; const unsigned char *buf; - - REQUIRE(out != NULL); + SHA_CTX ctx; if (hashalg != 1) { return (0); } - if ((md = isc_md_new()) == NULL) { - return (0); - } - - len = inlength; buf = in; + len = inlength; + do { - result = isc_md_init(md, ISC_MD_SHA1); - if (result != ISC_R_SUCCESS) { - goto md_fail; + if (SHA1_Init(&ctx) != 1) { + return (0); } - result = isc_md_update(md, buf, len); - if (result != ISC_R_SUCCESS) { - goto md_fail; - } - result = isc_md_update(md, salt, saltlength); - if (result != ISC_R_SUCCESS) { - goto md_fail; + + if (SHA1_Update(&ctx, buf, len) != 1) { + return (0); } - result = isc_md_final(md, out, &outlength); - if (result != ISC_R_SUCCESS) { - goto md_fail; + + if (SHA1_Update(&ctx, salt, saltlength) != 1) { + return (0); } - result = isc_md_reset(md); - if (result != ISC_R_SUCCESS) { - goto md_fail; + + if (SHA1_Final(out, &ctx) != 1) { + return (0); } + buf = out; - len = outlength; + len = SHA_DIGEST_LENGTH; } while (n++ < iterations); - isc_md_free(md); - - return (outlength); -md_fail: - isc_md_free(md); - return (0); + return (SHA_DIGEST_LENGTH); } -#undef RETERR Index: src/external/mpl/bind/dist/lib/isc/lib.c diff -u src/external/mpl/bind/dist/lib/isc/lib.c:1.9 src/external/mpl/bind/dist/lib/isc/lib.c:1.10 --- src/external/mpl/bind/dist/lib/isc/lib.c:1.9 Fri Sep 23 08:15:33 2022 +++ src/external/mpl/bind/dist/lib/isc/lib.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lib.c,v 1.9 2022/09/23 12:15:33 christos Exp $ */ +/* $NetBSD: lib.c,v 1.10 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -16,6 +16,7 @@ /*! \file */ #include <isc/bind9.h> +#include <isc/iterated_hash.h> #include <isc/lib.h> #include <isc/mem.h> #include <isc/util.h> Index: src/external/mpl/bind/dist/lib/isc/log.c diff -u src/external/mpl/bind/dist/lib/isc/log.c:1.8 src/external/mpl/bind/dist/lib/isc/log.c:1.9 --- src/external/mpl/bind/dist/lib/isc/log.c:1.8 Wed Jan 25 16:43:31 2023 +++ src/external/mpl/bind/dist/lib/isc/log.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: log.c,v 1.8 2023/01/25 21:43:31 christos Exp $ */ +/* $NetBSD: log.c,v 1.9 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -1105,7 +1105,7 @@ greatest_version(isc_logfile_t *file, in } static void -insert_sort(int64_t to_keep[], int64_t versions, int version) { +insert_sort(int64_t to_keep[], int64_t versions, int64_t version) { int i = 0; while (i < versions && version < to_keep[i]) { i++; @@ -1122,12 +1122,13 @@ insert_sort(int64_t to_keep[], int64_t v static int64_t last_to_keep(int64_t versions, isc_dir_t *dirp, char *bname, size_t bnamelen) { + int64_t to_keep[ISC_LOG_MAX_VERSIONS] = { 0 }; + int64_t version = 0; + if (versions <= 0) { - return INT64_MAX; + return (INT64_MAX); } - int64_t to_keep[ISC_LOG_MAX_VERSIONS] = { 0 }; - int64_t version = 0; if (versions > ISC_LOG_MAX_VERSIONS) { versions = ISC_LOG_MAX_VERSIONS; } @@ -1136,6 +1137,9 @@ last_to_keep(int64_t versions, isc_dir_t */ memset(to_keep, 0, sizeof(to_keep)); while (isc_dir_read(dirp) == ISC_R_SUCCESS) { + char *digit_end = NULL; + char *ename = NULL; + if (dirp->entry.length <= bnamelen || strncmp(dirp->entry.name, bname, bnamelen) != 0 || dirp->entry.name[bnamelen] != '.') @@ -1143,8 +1147,7 @@ last_to_keep(int64_t versions, isc_dir_t continue; } - char *digit_end; - char *ename = &dirp->entry.name[bnamelen + 1]; + ename = &dirp->entry.name[bnamelen + 1]; version = strtoull(ename, &digit_end, 10); if (*digit_end == '\0') { insert_sort(to_keep, versions, version); @@ -1162,8 +1165,8 @@ last_to_keep(int64_t versions, isc_dir_t static isc_result_t remove_old_tsversions(isc_logfile_t *file, int versions) { isc_result_t result; - char *bname, *digit_end; - const char *dirname; + char *bname = NULL, *digit_end = NULL; + const char *dirname = NULL; int64_t version, last = INT64_MAX; size_t bnamelen; isc_dir_t dir; Index: src/external/mpl/bind/dist/lib/isc/mem.c diff -u src/external/mpl/bind/dist/lib/isc/mem.c:1.13 src/external/mpl/bind/dist/lib/isc/mem.c:1.14 --- src/external/mpl/bind/dist/lib/isc/mem.c:1.13 Wed Jan 25 16:43:31 2023 +++ src/external/mpl/bind/dist/lib/isc/mem.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.13 2023/01/25 21:43:31 christos Exp $ */ +/* $NetBSD: mem.c,v 1.14 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -60,9 +60,10 @@ LIBISC_EXTERNAL_DATA unsigned int isc_me * Constants. */ -#define DEF_MAX_SIZE 1100 -#define DEF_MEM_TARGET 4096 -#define ALIGNMENT_SIZE 8U /*%< must be a power of 2 */ +#define DEF_MAX_SIZE 1100 +#define DEF_MEM_TARGET 4096 +#define ALIGNMENT_SIZE \ + 8U /*%< must be a power of 2, also update lib/dns/rbt.c */ #define NUM_BASIC_BLOCKS 64 /*%< must be > 1 */ #define TABLE_INCREMENT 1024 #define DEBUG_TABLE_COUNT 512U Index: src/external/mpl/bind/dist/lib/isc/ratelimiter.c diff -u src/external/mpl/bind/dist/lib/isc/ratelimiter.c:1.7 src/external/mpl/bind/dist/lib/isc/ratelimiter.c:1.8 --- src/external/mpl/bind/dist/lib/isc/ratelimiter.c:1.7 Fri Sep 23 08:15:33 2022 +++ src/external/mpl/bind/dist/lib/isc/ratelimiter.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ratelimiter.c,v 1.7 2022/09/23 12:15:33 christos Exp $ */ +/* $NetBSD: ratelimiter.c,v 1.8 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -244,6 +244,7 @@ void isc_ratelimiter_shutdown(isc_ratelimiter_t *rl) { isc_event_t *ev; isc_task_t *task; + isc_result_t result; REQUIRE(rl != NULL); @@ -259,7 +260,11 @@ isc_ratelimiter_shutdown(isc_ratelimiter } task = NULL; isc_task_attach(rl->task, &task); - isc_timer_detach(&rl->timer); + + result = isc_timer_reset(rl->timer, isc_timertype_inactive, NULL, NULL, + false); + RUNTIME_CHECK(result == ISC_R_SUCCESS); + isc_timer_destroy(&rl->timer); /* * Send an event to our task. The delivery of this event Index: src/external/mpl/bind/dist/lib/isc/task.c diff -u src/external/mpl/bind/dist/lib/isc/task.c:1.17 src/external/mpl/bind/dist/lib/isc/task.c:1.18 --- src/external/mpl/bind/dist/lib/isc/task.c:1.17 Wed Jan 25 16:43:31 2023 +++ src/external/mpl/bind/dist/lib/isc/task.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: task.c,v 1.17 2023/01/25 21:43:31 christos Exp $ */ +/* $NetBSD: task.c,v 1.18 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -622,12 +622,10 @@ isc_task_purge(isc_task_t *task, void *s bool isc_task_purgeevent(isc_task_t *task, isc_event_t *event) { - isc_event_t *curr_event, *next_event; + bool found = false; /* * Purge 'event' from a task's event queue. - * - * XXXRTH: WARNING: This method may be removed before beta. */ REQUIRE(VALID_TASK(task)); @@ -643,23 +641,18 @@ isc_task_purgeevent(isc_task_t *task, is */ LOCK(&task->lock); - for (curr_event = HEAD(task->events); curr_event != NULL; - curr_event = next_event) - { - next_event = NEXT(curr_event, ev_link); - if (curr_event == event && PURGE_OK(event)) { - DEQUEUE(task->events, curr_event, ev_link); - task->nevents--; - break; - } + if (ISC_LINK_LINKED(event, ev_link)) { + DEQUEUE(task->events, event, ev_link); + task->nevents--; + found = true; } UNLOCK(&task->lock); - if (curr_event == NULL) { + if (!found) { return (false); } - isc_event_free(&curr_event); + isc_event_free(&event); return (true); } @@ -809,6 +802,16 @@ isc_task_getnetmgr(isc_task_t *task) { return (task->manager->netmgr); } +void +isc_task_setquantum(isc_task_t *task, unsigned int quantum) { + REQUIRE(VALID_TASK(task)); + + LOCK(&task->lock); + task->quantum = (quantum > 0) ? quantum + : task->manager->default_quantum; + UNLOCK(&task->lock); +} + /*** *** Task Manager. ***/ @@ -819,10 +822,13 @@ task_run(isc_task_t *task) { bool finished = false; isc_event_t *event = NULL; isc_result_t result = ISC_R_SUCCESS; + uint32_t quantum; REQUIRE(VALID_TASK(task)); LOCK(&task->lock); + quantum = task->quantum; + /* * It is possible because that we have a paused task in the queue - it * might have been paused in the meantime and we never hold both queue @@ -914,7 +920,7 @@ task_run(isc_task_t *task) { XTRACE("pausing"); task->state = task_state_paused; break; - } else if (dispatch_count >= task->quantum) { + } else if (dispatch_count >= quantum) { /* * Our quantum has expired, but there is more work to be * done. We'll requeue it to the ready queue later. Index: src/external/mpl/bind/dist/lib/isc/timer.c diff -u src/external/mpl/bind/dist/lib/isc/timer.c:1.11 src/external/mpl/bind/dist/lib/isc/timer.c:1.12 --- src/external/mpl/bind/dist/lib/isc/timer.c:1.11 Wed Jan 25 16:43:31 2023 +++ src/external/mpl/bind/dist/lib/isc/timer.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: timer.c,v 1.11 2023/01/25 21:43:31 christos Exp $ */ +/* $NetBSD: timer.c,v 1.12 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -64,9 +64,9 @@ struct isc_timer { unsigned int magic; isc_timermgr_t *manager; isc_mutex_t lock; - isc_refcount_t references; /*! Locked by timer lock. */ isc_time_t idle; + ISC_LIST(isc_timerevent_t) active; /*! Locked by manager lock. */ isc_timertype_t type; isc_time_t expires; @@ -210,26 +210,36 @@ deschedule(isc_timer_t *timer) { } static void -destroy(isc_timer_t *timer) { - isc_timermgr_t *manager = timer->manager; +timerevent_unlink(isc_timer_t *timer, isc_timerevent_t *event) { + REQUIRE(ISC_LINK_LINKED(event, ev_timerlink)); + ISC_LIST_UNLINK(timer->active, event, ev_timerlink); +} - /* - * The caller must ensure it is safe to destroy the timer. - */ +static void +timerevent_destroy(isc_event_t *event0) { + isc_timer_t *timer = event0->ev_destroy_arg; + isc_timerevent_t *event = (isc_timerevent_t *)event0; - LOCK(&manager->lock); + LOCK(&timer->lock); + if (ISC_LINK_LINKED(event, ev_timerlink)) { + /* The event was unlinked via timer_purge() */ + timerevent_unlink(timer, event); + } + UNLOCK(&timer->lock); - (void)isc_task_purgerange(timer->task, timer, ISC_TIMEREVENT_FIRSTEVENT, - ISC_TIMEREVENT_LASTEVENT, NULL); - deschedule(timer); - UNLINK(manager->timers, timer, link); + isc_mem_put(timer->manager->mctx, event, event0->ev_size); +} - UNLOCK(&manager->lock); +static void +timer_purge(isc_timer_t *timer) { + isc_timerevent_t *event = NULL; - isc_task_detach(&timer->task); - isc_mutex_destroy(&timer->lock); - timer->magic = 0; - isc_mem_put(manager->mctx, timer, sizeof(*timer)); + while ((event = ISC_LIST_HEAD(timer->active)) != NULL) { + timerevent_unlink(timer, event); + UNLOCK(&timer->lock); + (void)isc_task_purgeevent(timer->task, (isc_event_t *)event); + LOCK(&timer->lock); + } } isc_result_t @@ -281,7 +291,6 @@ isc_timer_create(isc_timermgr_t *manager timer = isc_mem_get(manager->mctx, sizeof(*timer)); timer->manager = manager; - isc_refcount_init(&timer->references, 1); if (type == isc_timertype_once && !isc_interval_iszero(interval)) { result = isc_time_add(&now, interval, &timer->idle); @@ -313,6 +322,9 @@ isc_timer_create(isc_timermgr_t *manager timer->index = 0; isc_mutex_init(&timer->lock); ISC_LINK_INIT(timer, link); + + ISC_LIST_INIT(timer->active); + timer->magic = TIMER_MAGIC; LOCK(&manager->lock); @@ -392,9 +404,7 @@ isc_timer_reset(isc_timer_t *timer, isc_ LOCK(&timer->lock); if (purge) { - (void)isc_task_purgerange(timer->task, timer, - ISC_TIMEREVENT_FIRSTEVENT, - ISC_TIMEREVENT_LASTEVENT, NULL); + timer_purge(timer); } timer->type = type; timer->expires = *expires; @@ -465,41 +475,60 @@ isc_timer_touch(isc_timer_t *timer) { } void -isc_timer_attach(isc_timer_t *timer, isc_timer_t **timerp) { - /* - * Attach *timerp to timer. - */ +isc_timer_destroy(isc_timer_t **timerp) { + isc_timer_t *timer = NULL; + isc_timermgr_t *manager = NULL; - REQUIRE(VALID_TIMER(timer)); - REQUIRE(timerp != NULL && *timerp == NULL); - isc_refcount_increment(&timer->references); + REQUIRE(timerp != NULL && VALID_TIMER(*timerp)); + + timer = *timerp; + *timerp = NULL; + + manager = timer->manager; + + LOCK(&manager->lock); + + LOCK(&timer->lock); + timer_purge(timer); + deschedule(timer); + UNLOCK(&timer->lock); + + UNLINK(manager->timers, timer, link); - *timerp = timer; + UNLOCK(&manager->lock); + + isc_task_detach(&timer->task); + isc_mutex_destroy(&timer->lock); + timer->magic = 0; + isc_mem_put(manager->mctx, timer, sizeof(*timer)); } -void -isc_timer_detach(isc_timer_t **timerp) { - isc_timer_t *timer; +static void +timer_post_event(isc_timermgr_t *manager, isc_timer_t *timer, + isc_eventtype_t type) { + isc_timerevent_t *event; + XTRACEID("posting", timer); - /* - * Detach *timerp from its timer. - */ + event = (isc_timerevent_t *)isc_event_allocate( + manager->mctx, timer, type, timer->action, timer->arg, + sizeof(*event)); - REQUIRE(timerp != NULL); - timer = *timerp; - REQUIRE(VALID_TIMER(timer)); + ISC_LINK_INIT(event, ev_timerlink); + ((isc_event_t *)event)->ev_destroy = timerevent_destroy; + ((isc_event_t *)event)->ev_destroy_arg = timer; - if (isc_refcount_decrement(&timer->references) == 1) { - destroy(timer); - } + event->due = timer->due; - *timerp = NULL; + LOCK(&timer->lock); + ISC_LIST_APPEND(timer->active, event, ev_timerlink); + UNLOCK(&timer->lock); + + isc_task_send(timer->task, ISC_EVENT_PTR(&event)); } static void dispatch(isc_timermgr_t *manager, isc_time_t *now) { bool done = false, post_event, need_schedule; - isc_timerevent_t *event; isc_eventtype_t type = 0; isc_timer_t *timer; isc_result_t result; @@ -561,25 +590,7 @@ dispatch(isc_timermgr_t *manager, isc_ti } if (post_event) { - XTRACEID("posting", timer); - /* - * XXX We could preallocate this event. - */ - event = (isc_timerevent_t *)isc_event_allocate( - manager->mctx, timer, type, - timer->action, timer->arg, - sizeof(*event)); - - if (event != NULL) { - event->due = timer->due; - isc_task_send(timer->task, - ISC_EVENT_PTR(&event)); - } else { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "%s", - "couldn't allocate " - "event"); - } + timer_post_event(manager, timer, type); } timer->index = 0; Index: src/external/mpl/bind/dist/lib/isc/include/isc/task.h diff -u src/external/mpl/bind/dist/lib/isc/include/isc/task.h:1.7 src/external/mpl/bind/dist/lib/isc/include/isc/task.h:1.8 --- src/external/mpl/bind/dist/lib/isc/include/isc/task.h:1.7 Fri Sep 23 08:15:33 2022 +++ src/external/mpl/bind/dist/lib/isc/include/isc/task.h Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: task.h,v 1.7 2022/09/23 12:15:33 christos Exp $ */ +/* $NetBSD: task.h,v 1.8 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -375,27 +375,27 @@ isc_task_unsend(isc_task_t *task, void * * * Notes: * - *\li This function is equivalent to + *\li This function is equivalent to * *\code - * isc_task_unsendrange(task, sender, type, type, tag, events); + * isc_task_unsendrange(task, sender, type, type, tag, events); *\endcode * * Requires: * - *\li 'task' is a valid task. + *\li 'task' is a valid task. * - *\li *events is a valid list. + *\li *events is a valid list. * * Ensures: * - *\li Events in the event queue of 'task' whose sender is 'sender', whose - * type is 'type', and whose tag is 'tag' will be dequeued and appended - * to *events. + *\li Events in the event queue of 'task' whose sender is 'sender', whose + * type is 'type', and whose tag is 'tag' will be dequeued and appended + * to *events. * * Returns: * - *\li The number of events unsent. + *\li The number of events unsent. */ isc_result_t @@ -530,6 +530,15 @@ isc_task_gettag(isc_task_t *task); *\li 'task' is a valid task. */ +void +isc_task_setquantum(isc_task_t *task, unsigned int quantum); +/*%< + * Set future 'task' quantum to 'quantum'. The current 'task' quantum will be + * kept for the current isc_task_run() loop, and will be changed for the next + * run. Therefore, the function is safe to use from the event callback as it + * will not affect the current event loop processing. + */ + isc_result_t isc_task_beginexclusive(isc_task_t *task); /*%< Index: src/external/mpl/bind/dist/lib/isc/include/isc/timer.h diff -u src/external/mpl/bind/dist/lib/isc/include/isc/timer.h:1.7 src/external/mpl/bind/dist/lib/isc/include/isc/timer.h:1.8 --- src/external/mpl/bind/dist/lib/isc/include/isc/timer.h:1.7 Fri Sep 23 08:15:33 2022 +++ src/external/mpl/bind/dist/lib/isc/include/isc/timer.h Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: timer.h,v 1.7 2022/09/23 12:15:33 christos Exp $ */ +/* $NetBSD: timer.h,v 1.8 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -90,10 +90,13 @@ typedef enum { isc_timertype_inactive = 3 /*%< Inactive */ } isc_timertype_t; -typedef struct isc_timerevent { +typedef struct isc_timerevent isc_timerevent_t; + +struct isc_timerevent { struct isc_event common; isc_time_t due; -} isc_timerevent_t; + ISC_LINK(isc_timerevent_t) ev_timerlink; +}; #define ISC_TIMEREVENT_FIRSTEVENT (ISC_EVENTCLASS_TIMER + 0) #define ISC_TIMEREVENT_TICK (ISC_EVENTCLASS_TIMER + 1) @@ -225,25 +228,9 @@ isc_timer_touch(isc_timer_t *timer); */ void -isc_timer_attach(isc_timer_t *timer, isc_timer_t **timerp); -/*%< - * Attach *timerp to timer. - * - * Requires: - * - *\li 'timer' is a valid timer. - * - *\li 'timerp' points to a NULL timer. - * - * Ensures: - * - *\li *timerp is attached to timer. - */ - -void -isc_timer_detach(isc_timer_t **timerp); +isc_timer_destroy(isc_timer_t **timerp); /*%< - * Detach *timerp from its timer. + * Destroy *timerp. * * Requires: * @@ -253,9 +240,6 @@ isc_timer_detach(isc_timer_t **timerp); * *\li *timerp is NULL. * - *\li If '*timerp' is the last reference to the timer, - * then: - * *\code * The timer will be shutdown * @@ -264,9 +248,13 @@ isc_timer_detach(isc_timer_t **timerp); * All resources used by the timer have been freed * * Any events already posted by the timer will be purged. - * Therefore, if isc_timer_detach() is called in the context + * Therefore, if isc_timer_destroy() is called in the context * of the timer's task, it is guaranteed that no more * timer event callbacks will run after the call. + * + * If this function is called from the timer event callback + * the event itself must be destroyed before the timer + * itself. *\endcode */ Index: src/external/mpl/bind/dist/lib/isc/netmgr/netmgr.c diff -u src/external/mpl/bind/dist/lib/isc/netmgr/netmgr.c:1.9 src/external/mpl/bind/dist/lib/isc/netmgr/netmgr.c:1.10 --- src/external/mpl/bind/dist/lib/isc/netmgr/netmgr.c:1.9 Wed Jan 25 16:43:31 2023 +++ src/external/mpl/bind/dist/lib/isc/netmgr/netmgr.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: netmgr.c,v 1.9 2023/01/25 21:43:31 christos Exp $ */ +/* $NetBSD: netmgr.c,v 1.10 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -243,15 +243,15 @@ isc__nm_threadpool_initialize(uint32_t w } } -#if HAVE_DECL_UV_UDP_LINUX_RECVERR -#define MINIMAL_UV_VERSION UV_VERSION(1, 42, 0) -#elif HAVE_DECL_UV_UDP_MMSG_FREE +#if HAVE_DECL_UV_UDP_MMSG_FREE #define MINIMAL_UV_VERSION UV_VERSION(1, 40, 0) #elif HAVE_DECL_UV_UDP_RECVMMSG +#define MAXIMAL_UV_VERSION UV_VERSION(1, 39, 99) #define MINIMAL_UV_VERSION UV_VERSION(1, 37, 0) -#elif HAVE_DECL_UV_UDP_MMSG_CHUNK -#define MINIMAL_UV_VERSION UV_VERSION(1, 35, 0) +#elif _WIN32 +#define MINIMAL_UV_VERSION UV_VERSION(1, 0, 0) #else +#define MAXIMAL_UV_VERSION UV_VERSION(1, 34, 99) #define MINIMAL_UV_VERSION UV_VERSION(1, 0, 0) #endif @@ -262,11 +262,21 @@ isc__netmgr_create(isc_mem_t *mctx, uint REQUIRE(workers > 0); +#ifdef MAXIMAL_UV_VERSION + if (uv_version() > MAXIMAL_UV_VERSION) { + isc_error_fatal(__FILE__, __LINE__, + "libuv version too new: running with libuv %s " + "when compiled with libuv %s will lead to " + "libuv failures", + uv_version_string(), UV_VERSION_STRING); + } +#endif /* MAXIMAL_UV_VERSION */ + if (uv_version() < MINIMAL_UV_VERSION) { isc_error_fatal(__FILE__, __LINE__, "libuv version too old: running with libuv %s " "when compiled with libuv %s will lead to " - "libuv failures because of unknown flags", + "libuv failures", uv_version_string(), UV_VERSION_STRING); } Index: src/external/mpl/bind/dist/lib/isc/tests/task_test.c diff -u src/external/mpl/bind/dist/lib/isc/tests/task_test.c:1.11 src/external/mpl/bind/dist/lib/isc/tests/task_test.c:1.12 --- src/external/mpl/bind/dist/lib/isc/tests/task_test.c:1.11 Wed Jan 25 16:43:31 2023 +++ src/external/mpl/bind/dist/lib/isc/tests/task_test.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: task_test.c,v 1.11 2023/01/25 21:43:31 christos Exp $ */ +/* $NetBSD: task_test.c,v 1.12 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -633,8 +633,8 @@ basic(void **state) { #else /* ifndef WIN32 */ Sleep(10000); #endif /* ifndef WIN32 */ - isc_timer_detach(&ti1); - isc_timer_detach(&ti2); + isc_timer_destroy(&ti1); + isc_timer_destroy(&ti2); } /* @@ -1521,20 +1521,6 @@ purgeevent(void **state) { try_purgeevent(true); } -/* - * Purge event not purgeable test: - * When the event is not marked as purgable, a call to - * isc_task_purgeevent(task, event) does not purge the event - * 'event' from the task's queue and returns false. - */ - -static void -purgeevent_notpurge(void **state) { - UNUSED(state); - - try_purgeevent(false); -} - int main(int argc, char **argv) { const struct CMUnitTest tests[] = { @@ -1552,8 +1538,6 @@ main(int argc, char **argv) { _teardown), cmocka_unit_test_setup_teardown(purge, _setup2, _teardown), cmocka_unit_test_setup_teardown(purgeevent, _setup2, _teardown), - cmocka_unit_test_setup_teardown(purgeevent_notpurge, _setup, - _teardown), cmocka_unit_test_setup_teardown(purgerange, _setup, _teardown), cmocka_unit_test_setup_teardown(task_shutdown, _setup4, _teardown), Index: src/external/mpl/bind/dist/lib/isc/tests/timer_test.c diff -u src/external/mpl/bind/dist/lib/isc/tests/timer_test.c:1.9 src/external/mpl/bind/dist/lib/isc/tests/timer_test.c:1.10 --- src/external/mpl/bind/dist/lib/isc/tests/timer_test.c:1.9 Fri Sep 23 08:15:34 2022 +++ src/external/mpl/bind/dist/lib/isc/tests/timer_test.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: timer_test.c,v 1.9 2022/09/23 12:15:34 christos Exp $ */ +/* $NetBSD: timer_test.c,v 1.10 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -246,14 +246,14 @@ ticktock(isc_task_t *task, isc_event_t * isc_mutex_unlock(&lasttime_mx); subthread_assert_result_equal(result, ISC_R_SUCCESS); + isc_event_free(&event); + if (atomic_load(&eventcnt) == nevents) { result = isc_time_now(&endtime); subthread_assert_result_equal(result, ISC_R_SUCCESS); - isc_timer_detach(&timer); + isc_timer_destroy(&timer); isc_task_shutdown(task); } - - isc_event_free(&event); } /* @@ -341,9 +341,10 @@ test_idle(isc_task_t *task, isc_event_t subthread_assert_int_equal(event->ev_type, ISC_TIMEREVENT_IDLE); - isc_timer_detach(&timer); - isc_task_shutdown(task); isc_event_free(&event); + + isc_timer_destroy(&timer); + isc_task_shutdown(task); } /* timer type once idles out */ @@ -428,14 +429,15 @@ test_reset(isc_task_t *task, isc_event_t &expires, &interval, false); subthread_assert_result_equal(result, ISC_R_SUCCESS); } + + isc_event_free(&event); } else { subthread_assert_int_equal(event->ev_type, ISC_TIMEREVENT_LIFE); - isc_timer_detach(&timer); + isc_event_free(&event); + isc_timer_destroy(&timer); isc_task_shutdown(task); } - - isc_event_free(&event); } static void @@ -593,8 +595,8 @@ purge(void **state) { assert_int_equal(atomic_load(&eventcnt), 1); - isc_timer_detach(&tickertimer); - isc_timer_detach(&oncetimer); + isc_timer_destroy(&tickertimer); + isc_timer_destroy(&oncetimer); isc_task_destroy(&task1); isc_task_destroy(&task2); } Index: src/external/mpl/bind/dist/lib/ns/query.c diff -u src/external/mpl/bind/dist/lib/ns/query.c:1.16 src/external/mpl/bind/dist/lib/ns/query.c:1.17 --- src/external/mpl/bind/dist/lib/ns/query.c:1.16 Wed Jan 25 16:43:32 2023 +++ src/external/mpl/bind/dist/lib/ns/query.c Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: query.c,v 1.16 2023/01/25 21:43:32 christos Exp $ */ +/* $NetBSD: query.c,v 1.17 2023/06/26 22:03:01 christos Exp $ */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") @@ -5726,6 +5726,7 @@ query_refresh_rrset(query_ctx_t *orig_qc qctx.client->query.dboptions &= ~(DNS_DBFIND_STALETIMEOUT | DNS_DBFIND_STALEOK | DNS_DBFIND_STALEENABLED); + qctx.client->nodetach = false; /* * We'll need some resources... @@ -5752,6 +5753,27 @@ query_refresh_rrset(query_ctx_t *orig_qc } /*% + * Depending on the db lookup result, we can respond to the + * client this stale answer. + */ +static bool +stale_client_answer(isc_result_t result) { + switch (result) { + case ISC_R_SUCCESS: + case DNS_R_EMPTYNAME: + case DNS_R_NXRRSET: + case DNS_R_NCACHENXRRSET: + case DNS_R_CNAME: + case DNS_R_DNAME: + return (true); + default: + return (false); + } + + UNREACHABLE(); +} + +/*% * Perform a local database lookup, in either an authoritative or * cache database. If unable to answer, call ns_query_done(); otherwise * hand off processing to query_gotanswer(). @@ -5880,7 +5902,6 @@ query_lookup(query_ctx_t *qctx) { { /* Found non-stale usable rdataset. */ answer_found = true; - goto gotanswer; } if (dbfind_stale || stale_refresh_window || stale_timeout) { @@ -5906,7 +5927,7 @@ query_lookup(query_ctx_t *qctx) { NS_LOGMODULE_QUERY, ISC_LOG_INFO, "%s resolver failure, stale answer %s", namebuf, stale_found ? "used" : "unavailable"); - if (!stale_found) { + if (!stale_found && !answer_found) { /* * Resolver failure, no stale data, nothing more we * can do, return SERVFAIL. @@ -5925,7 +5946,7 @@ query_lookup(query_ctx_t *qctx) { "answer %s", namebuf, stale_found ? "used" : "unavailable"); - if (!stale_found) { + if (!stale_found && !answer_found) { /* * During the stale refresh window explicitly do not try * to refresh the data, because a recent lookup failed. @@ -5935,7 +5956,7 @@ query_lookup(query_ctx_t *qctx) { } } else if (stale_timeout) { if ((qctx->options & DNS_GETDB_STALEFIRST) != 0) { - if (!stale_found) { + if (!stale_found && !answer_found) { /* * We have nothing useful in cache to return * immediately. @@ -5952,7 +5973,7 @@ query_lookup(query_ctx_t *qctx) { &qctx->client->query.fetch); } return (query_lookup(qctx)); - } else { + } else if (stale_client_answer(result)) { /* * Immediately return the stale answer, start a * resolver fetch to refresh the data in cache. @@ -5963,7 +5984,14 @@ query_lookup(query_ctx_t *qctx) { "%s stale answer used, an attempt to " "refresh the RRset will still be made", namebuf); + qctx->refresh_rrset = STALE(qctx->rdataset); + + /* + * If we are refreshing the RRSet, we must not + * detach from the client in query_send(). + */ + qctx->client->nodetach = qctx->refresh_rrset; } } else { /* @@ -5976,7 +6004,11 @@ query_lookup(query_ctx_t *qctx) { "%s client timeout, stale answer %s", namebuf, stale_found ? "used" : "unavailable"); - if (!stale_found) { + if (!stale_found && !answer_found) { + return (result); + } + + if (!stale_client_answer(result)) { return (result); } @@ -5989,7 +6021,6 @@ query_lookup(query_ctx_t *qctx) { } } -gotanswer: if (stale_timeout && (answer_found || stale_found)) { /* * Mark RRsets that we are adding to the client message on a @@ -6308,7 +6339,7 @@ ns_query_recurse(ns_client_t *client, dn if (recparam_match(&client->query.recparam, qtype, qname, qdomain)) { ns_client_log(client, NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_QUERY, ISC_LOG_INFO, "recursion loop detected"); - return (ISC_R_FAILURE); + return (ISC_R_ALREADYRUNNING); } recparam_update(&client->query.recparam, qtype, qname, qdomain); @@ -7272,10 +7303,21 @@ query_usestale(query_ctx_t *qctx, isc_re return (false); } - if (result == DNS_R_DUPLICATE || result == DNS_R_DROP) { + if (qctx->refresh_rrset) { + /* + * This is a refreshing query, we have already prioritized + * stale data, so don't enable serve-stale again. + */ + return (false); + } + + if (result == DNS_R_DUPLICATE || result == DNS_R_DROP || + result == ISC_R_ALREADYRUNNING) + { /* * Don't enable serve-stale if the result signals a duplicate - * query or query that is being dropped. + * query or a query that is being dropped or can't proceed + * because of a recursion loop. */ return (false); } @@ -11538,12 +11580,7 @@ ns_query_done(query_ctx_t *qctx) { /* * Client may have been detached after query_send(), so * we test and store the flag state here, for safety. - * If we are refreshing the RRSet, we must not detach from the client - * in the query_send(), so we need to override the flag. */ - if (qctx->refresh_rrset) { - qctx->client->nodetach = true; - } nodetach = qctx->client->nodetach; query_send(qctx->client); Index: src/external/mpl/bind/lib/libisc/Makefile diff -u src/external/mpl/bind/lib/libisc/Makefile:1.19 src/external/mpl/bind/lib/libisc/Makefile:1.20 --- src/external/mpl/bind/lib/libisc/Makefile:1.19 Tue May 9 10:08:18 2023 +++ src/external/mpl/bind/lib/libisc/Makefile Mon Jun 26 18:03:01 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.19 2023/05/09 14:08:18 christos Exp $ +# $NetBSD: Makefile,v 1.20 2023/06/26 22:03:01 christos Exp $ LIB=isc #USE_SHLIBDIR= yes @@ -67,6 +67,7 @@ LDADD+=-Wl,-Bdynamic LDADD+=-lz DPADD+=${LIBZ} +COPTS.iterated_hash.c+= -Wno-error=deprecated-declarations COPTS.hmac.c+= -Wno-error=deprecated-declarations COPTS.md.c+= -Wno-error=deprecated-declarations