]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agomark max-zone-ttl deprecated in options and zone
Evan Hunt [Mon, 11 Jul 2022 20:38:51 +0000 (13:38 -0700)] 
mark max-zone-ttl deprecated in options and zone

The "max-zone-ttl" option should now be configured as part of
"dnssec-policy". The option with the same name in "zone" and
"options" is hereby flagged as deprecated, and its functionality
will be removed in a future release.

3 years agoMerge branch 'marka-placeholder' into 'main'
Mark Andrews [Tue, 19 Jul 2022 02:45:11 +0000 (02:45 +0000)] 
Merge branch 'marka-placeholder' into 'main'

Add placeholder for [GL #3460]

See merge request isc-projects/bind9!6594

3 years agoAdd placeholder for [GL #3460]
Mark Andrews [Tue, 19 Jul 2022 02:39:29 +0000 (12:39 +1000)] 
Add placeholder for [GL #3460]

3 years agoMerge branch 'ron-server' into 'main'
Petr Špaček [Mon, 18 Jul 2022 16:26:16 +0000 (16:26 +0000)] 
Merge branch 'ron-server' into 'main'

ARM tagging: logging, server, view, zone

See merge request isc-projects/bind9!6535

3 years agoDocument qname-minimization off equals disabled
Greg Choules [Tue, 12 Jul 2022 13:34:43 +0000 (13:34 +0000)] 
Document qname-minimization off equals disabled

3 years agoFix http block short description
Suzanne Goldlust [Fri, 8 Jul 2022 16:09:11 +0000 (16:09 +0000)] 
Fix http block short description

3 years agoAdd headings for server, logging, zone, and view statements
Suzanne Goldlust [Thu, 7 Jul 2022 14:25:42 +0000 (14:25 +0000)] 
Add headings for server, logging, zone, and view statements

3 years agoAdd tags/short descriptions for the "view" category
Suzanne Goldlust [Wed, 6 Jul 2022 18:15:54 +0000 (18:15 +0000)] 
Add tags/short descriptions for the "view" category

3 years agoAdd tags/short descriptions for "zone" category
Suzanne Goldlust [Wed, 6 Jul 2022 16:57:05 +0000 (16:57 +0000)] 
Add tags/short descriptions for "zone" category

3 years agoAdd tags/short descriptions for "logging" category
Suzanne Goldlust [Wed, 6 Jul 2022 15:54:08 +0000 (15:54 +0000)] 
Add tags/short descriptions for "logging" category

3 years agoAdd tags and short descriptions for tag "server"
Suzanne Goldlust [Tue, 5 Jul 2022 20:20:08 +0000 (20:20 +0000)] 
Add tags and short descriptions for tag "server"

3 years agoMerge branch 'michal/run-a-short-respdiff-test-for-all-merge-requests' into 'main'
Michał Kępień [Mon, 18 Jul 2022 13:16:01 +0000 (13:16 +0000)] 
Merge branch 'michal/run-a-short-respdiff-test-for-all-merge-requests' into 'main'

Run a short respdiff test for all merge requests

See merge request isc-projects/bind9!6585

3 years agoRun a short respdiff test for all merge requests
Michał Kępień [Mon, 18 Jul 2022 12:39:02 +0000 (14:39 +0200)] 
Run a short respdiff test for all merge requests

Now that the respdiff tests can detect memory leaks, it is worth running
them for every merge request.  However, the existing respdiff-based
tests take a while to complete (about half an hour with our current CI
infrastructure), which does not make them a good fit for this purpose.
Add a new GitLab CI job, "respdiff-short", which uses a smaller query
set that gets processed within a couple of minutes on our current CI
infrastructure.  Rename the existing respdiff-based jobs to make
distinguishing them easier.

3 years agoExtract respdiff job definition to a YAML anchor
Michał Kępień [Mon, 18 Jul 2022 12:39:02 +0000 (14:39 +0200)] 
Extract respdiff job definition to a YAML anchor

Ensure the common parts of all jobs using respdiff are available in the
form of a reusable YAML anchor, to reduce code duplication and to
simplify adding more respdiff-based jobs to GitLab CI.

3 years agoUse a pre-built executable as the reference named
Michał Kępień [Mon, 18 Jul 2022 12:39:02 +0000 (14:39 +0200)] 
Use a pre-built executable as the reference named

The "respdiff" GitLab CI job compares DNS responses produced by the
current version of named with those produced by a reference version.
The latter is built from source in each "respdiff" job, despite the fact
that the reference version changes very rarely.  Use a pre-built named
executable as the reference version instead, assuming it is available in
the OS image used for "respdiff" tests.

3 years agoMerge branch 'ossl-fixes' into 'main'
Ondřej Surý [Mon, 18 Jul 2022 12:14:34 +0000 (12:14 +0000)] 
Merge branch 'ossl-fixes' into 'main'

Clean up OpenSSL usage a bit

See merge request isc-projects/bind9!6436

3 years agoRemove DH_clear_flags call
David Benjamin [Tue, 14 Jun 2022 03:37:55 +0000 (23:37 -0400)] 
Remove DH_clear_flags call

These calls have not been needed since OpenSSL 0.9.7h.

This dates to commit 704d6eeab1d8d6a2aeb99c37fa5a97322d9340fc, "Work
around non-reentrancy in openssl by disabling precomputation in keys".
This was in the bundled OpenSSL 0.9.3a era and made two changes. First,
it registered a locking callback because, in those days, OpenSSL needed
a callback to support locks. Second, it set flags to disable various
bits of cached state on DH, DSA, and RSA objects.

Looking back in OpenSSL 0.9.3a, that cached state was not protected by a
lock:
https://github.com/openssl/openssl/blob/OpenSSL_0_9_3a/crypto/rsa/rsa_eay.c#L137-L142

However, this was fixed in OpenSSL 0.9.7h:
https://github.com/openssl/openssl/commit/6ec8e63af6c1835a8b222350dbabf7bb2ace094f

The other flags (DSA and RSA) have since fallen away, DSA with the
removal of DSA altogether (3994b1f9c2bd4438586523fb2e49b0fb847b487b) and
RSA with 3a8d4a316eae09966c85e7e5befc682bd4744b34, "openssl 0.9.6a and
higher don't have the RSA locking bug [...] other algorithms still don't
do locking when performing precomputation [...]".

That seems to be referring to this OpenSSL change, which indeed fixed it
for RSA but not others:
https://github.com/openssl/openssl/commit/bb617a9646d95d0454edda995518f370172390e9

The 0.9.7h change above fixed it across the board, but there was never a
similar update to the workaround for DSA and DH. With such OpenSSL
versions long since out of support, the last remains of this workaround
can finally be removed.

3 years agoSimplify BN_GENCB handling
David Benjamin [Tue, 14 Jun 2022 03:29:07 +0000 (23:29 -0400)] 
Simplify BN_GENCB handling

When callback was NULL, bind9 would use BN_GENCB_set_old to set a NULL
callback because OpenSSL happened to allow a NULL "old" callback, but
not a NULL "new" callback. Instead, the way to turn off the callback is
to pass a NULL BN_GENCB itself.

Switch to doing that.

3 years agoMerge branch '3453-cope-with-too-small-BUFSIZ' into 'main'
Ondřej Surý [Fri, 15 Jul 2022 17:30:03 +0000 (17:30 +0000)] 
Merge branch '3453-cope-with-too-small-BUFSIZ' into 'main'

Increase the BUFSIZ-long buffers

Closes #3453

See merge request isc-projects/bind9!6579

3 years agoIncrease the BUFSIZ-long buffers
Ondřej Surý [Thu, 14 Jul 2022 11:48:45 +0000 (13:48 +0200)] 
Increase the BUFSIZ-long buffers

The BUFSIZ value varies between platforms, it could be 8K on Linux and
512 bytes on mingw.  Make sure the buffers are always big enough for the
output data to prevent truncation of the output by appropriately
enlarging or sizing the buffers.

3 years agoMerge branch '3443-memory-related-cleanups' into 'main'
Michał Kępień [Fri, 15 Jul 2022 08:31:23 +0000 (08:31 +0000)] 
Merge branch '3443-memory-related-cleanups' into 'main'

Memory-related cleanups

Closes #3443

See merge request isc-projects/bind9!6567

3 years agoUpdate documentation for named's -M option
Michał Kępień [Fri, 15 Jul 2022 08:23:03 +0000 (10:23 +0200)] 
Update documentation for named's -M option

Remove "external" from the list of legal values for the -M command-line
option as it has not been allowed since the internal memory allocator
was removed by commit 55ace5d3aa4cb8c1b70a94679e1dd6d716dfd8bb.

Make the style of the relevant paragraph more in line with the next one
and split its contents up into an unordered list of options for improved
readability.

3 years agoMerge branch '3456-dispatch-connect-race' into 'main'
Evan Hunt [Fri, 15 Jul 2022 02:26:41 +0000 (02:26 +0000)] 
Merge branch '3456-dispatch-connect-race' into 'main'

remove unnecessary assertion in dns_dispatch_connect()

Closes #3456

See merge request isc-projects/bind9!6573

3 years agoremove unnecessary assertion in dns_dispatch_connect()
Evan Hunt [Wed, 13 Jul 2022 19:38:55 +0000 (12:38 -0700)] 
remove unnecessary assertion in dns_dispatch_connect()

When a thread calls dns_dispatch_connect() on an unconnected TCP socket
it sets `tcpstate` from `DNS_DISPATCHSTATE_NONE` to `_CONNECTING`.
Previously, it then INSISTed that there were no pending connections
before calling isc_nm_tcpdnsconnect().

If a second thread called dns_dispatch_connect() during that window
of time, it could add a pending connection to the list, and trigger
an assertion failure.

This commit removes the INSIST since the condition is actually
harmless.

3 years agoMerge branch 'ondrej-fix-timing-error-in-statistics-system-test' into 'main'
Ondřej Surý [Thu, 14 Jul 2022 20:33:16 +0000 (20:33 +0000)] 
Merge branch 'ondrej-fix-timing-error-in-statistics-system-test' into 'main'

Wait for TCP connection refused in the statistics system test

See merge request isc-projects/bind9!6580

3 years agoWait for TCP connection refused in the statistics system test
Ondřej Surý [Thu, 14 Jul 2022 13:37:32 +0000 (15:37 +0200)] 
Wait for TCP connection refused in the statistics system test

The statistics system test makes a query to foo.info to check for the
pending connections because the ans4 doesn't respond to the query.

This might or might not (depending on exact timing) increment the failed
TCP connection counter when the query is retried over TCP because ans4
doesn't listen on the TCP.

Wait for the 'connection refused' in the ns3 log file to be able to
count the exactly 1 failed TCP connection.

3 years agoMerge branch '3451-handle-transient-TCP-connect-EADDRINUSE-on-BSDs' into 'main'
Ondřej Surý [Thu, 14 Jul 2022 19:38:33 +0000 (19:38 +0000)] 
Merge branch '3451-handle-transient-TCP-connect-EADDRINUSE-on-BSDs' into 'main'

Handle the transient TCP connect() failures on FreeBSD

Closes #3451 and #3452

See merge request isc-projects/bind9!6562

3 years agoAdd CHANGES note for [GL #3451]
Ondřej Surý [Wed, 13 Jul 2022 07:43:00 +0000 (09:43 +0200)] 
Add CHANGES note for [GL #3451]

3 years agoCleanup the STATID_CONNECT and STATID_CONNECTFAIL stat counters
Ondřej Surý [Thu, 14 Jul 2022 11:22:34 +0000 (13:22 +0200)] 
Cleanup the STATID_CONNECT and STATID_CONNECTFAIL stat counters

The STATID_CONNECT and STATID_CONNECTFAIL statistics were used
incorrectly. The STATID_CONNECT was incremented twice (once in
the *_connect_direct() and once in the callback) and STATID_CONNECTFAIL
would not be incremented at all if the failure happened in the callback.

Closes: #3452
3 years agoHandle the transient TCP connect() failures on FreeBSD
Ondřej Surý [Wed, 13 Jul 2022 07:34:47 +0000 (09:34 +0200)] 
Handle the transient TCP connect() failures on FreeBSD

On FreeBSD (and perhaps other *BSD) systems, the TCP connect() call (via
uv_tcp_connect()) can fail with transient UV_EADDRINUSE error.  The UDP
code already handles this by trying three times (is a charm) before
giving up.  Add a code for the TCP, TCPDNS and TLSDNS layers to also try
three times before giving up by calling uv_tcp_connect() from the
callback two more time on UV_EADDRINUSE error.

Additionally, stop the timer only if we succeed or on hard error via
isc__nm_failed_connect_cb().

3 years agoMerge branch '3448-redundant-assignment-of-clistenon-in-bin-named-server-c' into...
Mark Andrews [Thu, 14 Jul 2022 01:14:14 +0000 (01:14 +0000)] 
Merge branch '3448-redundant-assignment-of-clistenon-in-bin-named-server-c' into 'main'

Resolve "Redundant assignment of clistenon in bin/named/server.c"

Closes #3448

See merge request isc-projects/bind9!6560

3 years agoRemove redundant assignment of 'clistenon = NULL'
Mark Andrews [Tue, 4 Jan 2022 00:51:56 +0000 (11:51 +1100)] 
Remove redundant assignment of 'clistenon = NULL'

3 years agoMerge branch '3454-check-putstr' into 'main'
Evan Hunt [Thu, 14 Jul 2022 00:23:17 +0000 (00:23 +0000)] 
Merge branch '3454-check-putstr' into 'main'

check putstr return values

Closes #3454

See merge request isc-projects/bind9!6574

3 years agocheck putstr return values
Evan Hunt [Wed, 13 Jul 2022 23:15:53 +0000 (16:15 -0700)] 
check putstr return values

The calls to putstr() in named_server_fetchlimit() were not checked
for failure.

3 years agoMerge branch '3447-lib-dns-tkey-c-free_namelist-should-be-disassociating-associated...
Mark Andrews [Thu, 14 Jul 2022 00:03:38 +0000 (00:03 +0000)] 
Merge branch '3447-lib-dns-tkey-c-free_namelist-should-be-disassociating-associated-rdatatsets' into 'main'

Resolve "lib/dns/tkey.c:free_namelist should be disassociating associated rdatatsets"

Closes #3447

See merge request isc-projects/bind9!6556

3 years agodisassociate rdatasets when cleaning up
Mark Andrews [Tue, 21 Dec 2021 01:44:17 +0000 (12:44 +1100)] 
disassociate rdatasets when cleaning up

free_namelist could be passed names with associated rdatasets
when handling errors.  These need to be disassociated before
calling dns_message_puttemprdataset.

3 years agoMerge branch '3449-kasp-system-test-failed-to-log-some-zones-during-setup' into ...
Mark Andrews [Wed, 13 Jul 2022 23:42:38 +0000 (23:42 +0000)] 
Merge branch '3449-kasp-system-test-failed-to-log-some-zones-during-setup' into 'main'

Resolve "kasp system test failed to log some zones during setup"

Closes #3449

See merge request isc-projects/bind9!6561

3 years agokasp: add missing logging during setup
Mark Andrews [Wed, 22 Dec 2021 04:13:27 +0000 (15:13 +1100)] 
kasp: add missing logging during setup

Some zones where not being logged when just DNSSEC keys where being
generated in system test setup phase.  Add logging for these zones.

3 years agoMerge branch '3054-3-improve-reporting-for-pthreads-errors' into 'main'
Michał Kępień [Wed, 13 Jul 2022 13:05:11 +0000 (13:05 +0000)] 
Merge branch '3054-3-improve-reporting-for-pthreads-errors' into 'main'

[3/3] Improve reporting for pthreads errors

Closes #3054

See merge request isc-projects/bind9!6572

3 years agoMerge branch '3054-2-enable-tracking-pthreads-objects' into 'main'
Michał Kępień [Wed, 13 Jul 2022 13:03:59 +0000 (13:03 +0000)] 
Merge branch '3054-2-enable-tracking-pthreads-objects' into 'main'

[2/3] Enable tracking pthreads objects

See merge request isc-projects/bind9!6571

3 years agoMerge branch '3054-1-misc-pthreads-cleanups' into 'main'
Michał Kępień [Wed, 13 Jul 2022 13:01:32 +0000 (13:01 +0000)] 
Merge branch '3054-1-misc-pthreads-cleanups' into 'main'

[1/3] Miscellaneous pthreads cleanups

See merge request isc-projects/bind9!6570

3 years agoImprove reporting for barrier errors
Michał Kępień [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Improve reporting for barrier errors

uv_barrier_init() errors are currently ignored.  Use UV_RUNTIME_CHECK()
to catch them and to improve error reporting for any uv_barrier_init()
run-time failures (by augmenting error messages with file/line
information and the error string corresponding to the value returned).

3 years agoDetect pthreads object leaks during respdiff tests
Michał Kępień [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Detect pthreads object leaks during respdiff tests

Set the ISC_TRACK_PTHREADS_OBJECTS preprocessor macro when preparing a
build of BIND 9 for respdiff testing and pass the -m command-line option
to respdiff.sh in order to enable automatic identification of memory
leaks during respdiff tests.

3 years agoDirectly cause assertion failure on pthreads primitives failure
Ondřej Surý [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Directly cause assertion failure on pthreads primitives failure

Instead of returning error values from isc_rwlock_*(), isc_mutex_*(),
and isc_condition_*() macros/functions and subsequently carrying out
runtime assertion checks on the return values in the calling code,
trigger assertion failures directly in those macros/functions whenever
any pthread function returns an error, as there is no point in
continuing execution in such a case anyway.

3 years agoImprove reporting for read-write lock errors
Michał Kępień [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Improve reporting for read-write lock errors

Replace direct uses of implementation-specific rwlock functions in
lib/isc/include/isc/rwlock.h with preprocessor macros that use
ERRNO_CHECK(), in order to augment rwlock-related error messages with
file/line/caller information and the error string corresponding to
errno.  Adjust the implementation-specific functions for pthreads-based
rwlocks so that they return any errors encountered to the caller instead
of aborting execution immediately using RUNTIME_CHECK().

To keep code modifications simple, make the non-pthreads-based
implementation-specific rwlock functions always return 0; these
functions continue to handle errors using less verbose run-time
assertions as they do not set errno anyway.

3 years agoEnable tracking of pthreads barriers
Michał Kępień [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Enable tracking of pthreads barriers

Some POSIX threads implementations (e.g. FreeBSD's libthr) allocate
memory on the heap when pthread_barrier_init() is called.  Every call to
that function must be accompanied by a corresponding call to
pthread_barrier_destroy() or else the memory allocated for the barrier
will leak.

jemalloc can be used for detecting memory allocations which are not
released by a process when it exits.  Unfortunately, since jemalloc is
also the system allocator on FreeBSD and a special (profiling-enabled)
build of jemalloc is required for memory leak detection, this method
cannot be used for detecting leaked memory allocated by libthr on a
stock FreeBSD installation.

However, libthr's behavior can be emulated on any platform by
implementing alternative versions of libisc functions for creating and
destroying barriers that allocate memory using malloc() and release it
using free().  This enables using jemalloc for detecting missing
pthread_barrier_destroy() calls on any platform on which it works
reliably.

When the newly introduced ISC_TRACK_PTHREADS_OBJECTS preprocessor macro
is set, allocate isc_barrier_t structures on the heap in
isc_barrier_init() and free them in isc_barrier_destroy().  Reuse
existing barrier macros (after renaming them appropriately) for other
operations.

3 years agoUse library constructor to create default mutex attr once
Ondřej Surý [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Use library constructor to create default mutex attr once

Instead of using isc_once_do() on every isc_mutex_init() call, use the
global library constructor to initialize the default mutex attr
object (optionally with PTHREAD_MUTEX_ADAPTIVE_NP if supported) just
once when the library is loaded.

3 years agoImprove reporting for condition variable errors
Michał Kępień [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Improve reporting for condition variable errors

Replace all uses of RUNTIME_CHECK() in lib/isc/include/isc/condition.h
with ERRNO_CHECK(), in order to improve error reporting for any
condition-variable-related run-time failures (by augmenting error
messages with file/line/caller information and the error string
corresponding to errno).

3 years agoEnable tracking of pthreads rwlocks
Ondřej Surý [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Enable tracking of pthreads rwlocks

Some POSIX threads implementations (e.g. FreeBSD's libthr) allocate
memory on the heap when pthread_rwlock_init() is called.  Every call to
that function must be accompanied by a corresponding call to
pthread_rwlock_destroy() or else the memory allocated for the rwlock
will leak.

jemalloc can be used for detecting memory allocations which are not
released by a process when it exits.  Unfortunately, since jemalloc is
also the system allocator on FreeBSD and a special (profiling-enabled)
build of jemalloc is required for memory leak detection, this method
cannot be used for detecting leaked memory allocated by libthr on a
stock FreeBSD installation.

However, libthr's behavior can be emulated on any platform by
implementing alternative versions of libisc functions for creating and
destroying rwlocks that allocate memory using malloc() and release it
using free().  This enables using jemalloc for detecting missing
pthread_rwlock_destroy() calls on any platform on which it works
reliably.

When the newly introduced ISC_TRACK_PTHREADS_OBJECTS preprocessor macro
is set (and --enable-pthread-rwlock is used), allocate isc_rwlock_t
structures on the heap in isc_rwlock_init() and free them in
isc_rwlock_destroy().  Reuse existing functions defined in
lib/isc/rwlock.c for other operations, but rename them first, so that
they contain triple underscores (to indicate that these functions are
implementation-specific, unlike their mutex and condition variable
counterparts, which always use the pthreads implementation).  Define the
isc__rwlock_init() macro so that it is a logical counterpart of
isc__mutex_init() and isc__condition_init(); adjust isc___rwlock_init()
accordingly.  Remove a redundant function prototype for
isc__rwlock_lock() and rename that (static) function to rwlock_lock() in
order to avoid having to use quadruple underscores.

3 years agoHandle pthread_*_init() failures consistently
Michał Kępień [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Handle pthread_*_init() failures consistently

isc_rwlock_init() currently detects pthread_rwlock_init() failures using
a REQUIRE() assertion.  Use the ERRNO_CHECK() macro for that purpose
instead, so that read-write lock initialization failures are handled
identically as condition variable (pthread_cond_init()) and mutex
(pthread_mutex_init()) initialization failures.

3 years agoImprove reporting for mutex errors
Michał Kępień [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Improve reporting for mutex errors

Replace all uses of RUNTIME_CHECK() in lib/isc/include/isc/mutex.h with
ERRNO_CHECK(), in order to improve error reporting for any mutex-related
run-time failures (by augmenting error messages with file/line/caller
information and the error string corresponding to errno).

3 years agoEnable tracking of pthreads condition variables
Ondřej Surý [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Enable tracking of pthreads condition variables

Some POSIX threads implementations (e.g. FreeBSD's libthr) allocate
memory on the heap when pthread_cond_init() is called.  Every call to
that function must be accompanied by a corresponding call to
pthread_cond_destroy() or else the memory allocated for the condition
variable will leak.

jemalloc can be used for detecting memory allocations which are not
released by a process when it exits.  Unfortunately, since jemalloc is
also the system allocator on FreeBSD and a special (profiling-enabled)
build of jemalloc is required for memory leak detection, this method
cannot be used for detecting leaked memory allocated by libthr on a
stock FreeBSD installation.

However, libthr's behavior can be emulated on any platform by
implementing alternative versions of libisc functions for creating and
destroying condition variables that allocate memory using malloc() and
release it using free().  This enables using jemalloc for detecting
missing pthread_cond_destroy() calls on any platform on which it works
reliably.

When the newly introduced ISC_TRACK_PTHREADS_OBJECTS preprocessor macro
is set, allocate isc_condition_t structures on the heap in
isc_condition_init() and free them in isc_condition_destroy().  Reuse
existing condition variable macros (after renaming them appropriately)
for other operations.

3 years agoAdd an ERRNO_CHECK() preprocessor macro
Michał Kępień [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Add an ERRNO_CHECK() preprocessor macro

In a number of situations in pthreads-related code, a common sequence of
steps is taken: if the value returned by a library function is not 0,
pass errno to strerror_r(), log the string returned by the latter, and
immediately abort execution.  Add an ERRNO_CHECK() preprocessor macro
which takes those exact steps and use it wherever (conveniently)
possible.

Notes:

 1. The "log the return value of strerror_r() and abort" pattern is used
    in a number of other places that this commit does not touch; only
    "!= 0" checks followed by isc_error_fatal() calls with
    non-customized error messages are replaced here.

 2. This change temporarily breaks file name & line number reporting for
    isc__mutex_init() errors, to prevent breaking the build.  This issue
    will be rectified in a subsequent change.

3 years agoEnable tracking of pthreads mutexes
Ondřej Surý [Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)] 
Enable tracking of pthreads mutexes

Some POSIX threads implementations (e.g. FreeBSD's libthr) allocate
memory on the heap when pthread_mutex_init() is called.  Every call to
that function must be accompanied by a corresponding call to
pthread_mutex_destroy() or else the memory allocated for the mutex will
leak.

jemalloc can be used for detecting memory allocations which are not
released by a process when it exits.  Unfortunately, since jemalloc is
also the system allocator on FreeBSD and a special (profiling-enabled)
build of jemalloc is required for memory leak detection, this method
cannot be used for detecting leaked memory allocated by libthr on a
stock FreeBSD installation.

However, libthr's behavior can be emulated on any platform by
implementing alternative versions of libisc functions for creating and
destroying mutexes that allocate memory using malloc() and release it
using free().  This enables using jemalloc for detecting missing
pthread_mutex_destroy() calls on any platform on which it works
reliably.

Introduce a new ISC_TRACK_PTHREADS_OBJECTS preprocessor macro, which
causes isc_mutex_t structures to be allocated on the heap by
isc_mutex_init() and freed by isc_mutex_destroy().  Reuse existing mutex
macros (after renaming them appropriately) for other operations.

3 years agoMerge branch 'ondrej-update-dir-locals-for-libtest' into 'main'
Ondřej Surý [Wed, 13 Jul 2022 10:21:35 +0000 (10:21 +0000)] 
Merge branch 'ondrej-update-dir-locals-for-libtest' into 'main'

Update the .dir-locals.el for libtest

See merge request isc-projects/bind9!6565

3 years agoUpdate the .dir-locals.el for libtest
Ondřej Surý [Wed, 13 Jul 2022 10:17:34 +0000 (12:17 +0200)] 
Update the .dir-locals.el for libtest

The tests/libtest directory is missing from the .dir-locals.el, so the
emacs flycheck would not work for the unit tests.  Add it to the
configuration.

3 years agoMerge branch '3439-stop-resolving-invalid-names-in-resume_dslookup' into 'main'
Michał Kępień [Wed, 13 Jul 2022 08:59:30 +0000 (08:59 +0000)] 
Merge branch '3439-stop-resolving-invalid-names-in-resume_dslookup' into 'main'

Stop resolving invalid names in resume_dslookup()

Closes #3439

See merge request isc-projects/bind9!6563

3 years agoAdd CHANGES entry and release note for GL #3439
Michał Kępień [Wed, 13 Jul 2022 08:31:16 +0000 (10:31 +0200)] 
Add CHANGES entry and release note for GL #3439

3 years agoStop resolving invalid names in resume_dslookup()
Michał Kępień [Wed, 13 Jul 2022 08:31:16 +0000 (10:31 +0200)] 
Stop resolving invalid names in resume_dslookup()

Commit 7b2ea97e46034ec3db4c950100708297798826af introduced a logic bug
in resume_dslookup(): that function now only conditionally checks
whether DS chasing can still make progress.  Specifically, that check is
only performed when the previous resume_dslookup() call invokes
dns_resolver_createfetch() with the 'nameservers' argument set to
something else than NULL, which may not always be the case.  Failing to
perform that check may trigger assertion failures as a result of
dns_resolver_createfetch() attempting to resolve an invalid name.

Example scenario that leads to such outcome:

 1. A validating resolver is configured to forward all queries to
    another resolver.  The latter returns broken DS responses that
    trigger DS chasing.

 2. rctx_chaseds() calls dns_resolver_createfetch() with the
    'nameservers' argument set to NULL.

 3. The fetch fails, so resume_dslookup() is called.  Due to
    fevent->result being set to e.g. DNS_R_SERVFAIL, the default branch
    is taken in the switch statement.

 4. Since 'nameservers' was set to NULL for the fetch which caused the
    resume_dslookup() callback to be invoked
    (fctx->nsfetch->private->nameservers), resume_dslookup() chops off
    one label off fctx->nsname and calls dns_resolver_createfetch()
    again, for a name containing one label less than before.

 5. Steps 3-4 are repeated (i.e. all attempts to find the name servers
    authoritative for the DS RRset being chased fail) until fctx->nsname
    becomes stripped down the the root name.

 6. Since resume_dslookup() does not check whether DS chasing can still
    make progress, it strips off a label off the root name and continues
    its attempts at finding the name servers authoritative for the DS
    RRset being chased, passing an invalid name to
    dns_resolver_createfetch().

Fix by ensuring resume_dslookup() always checks whether DS chasing can
still make progress when a name server fetch fails.  Update code
comments to ensure the purpose of the relevant dns_name_equal() check is
clear.

3 years agoMerge branch '3446-autosign-s-checking-revoked-key-with-duplicate-key-id-test-was...
Mark Andrews [Wed, 13 Jul 2022 00:48:09 +0000 (00:48 +0000)] 
Merge branch '3446-autosign-s-checking-revoked-key-with-duplicate-key-id-test-was-incomplete' into 'main'

Resolve "Autosign's 'checking revoked key with duplicate key ID' test was incomplete"

Closes #3446

See merge request isc-projects/bind9!6555

3 years agoMake "checking revoked key with duplicate key ID" work
Mark Andrews [Thu, 23 Jun 2022 04:22:10 +0000 (14:22 +1000)] 
Make "checking revoked key with duplicate key ID" work

There should be 2 keys with the same key id after the numerically
lower one is revoked (serial space arithmetic).  The DS points
at the non-revoked key so validation should still succeed.

3 years agoMerge branch '3445-update-libdns_la_libadd-instead-of-libdns_la_ldflags' into 'main'
Mark Andrews [Wed, 13 Jul 2022 00:44:51 +0000 (00:44 +0000)] 
Merge branch '3445-update-libdns_la_libadd-instead-of-libdns_la_ldflags' into 'main'

Resolve "Update libdns_la_LIBADD instead of libdns_la_LDFLAGS"

Closes #3445

See merge request isc-projects/bind9!6553

3 years agoUpdate libdns_la_LIBADD rather than libdns_la_LDFLAGS
Mark Andrews [Mon, 20 Dec 2021 09:23:17 +0000 (20:23 +1100)] 
Update libdns_la_LIBADD rather than libdns_la_LDFLAGS

the wrong macro was being update with MAXMINDDB_LIBS making
it difficult to adjust link order.

3 years agoMerge branch '2962-invalid-fctx' into 'main'
Evan Hunt [Tue, 12 Jul 2022 23:54:25 +0000 (23:54 +0000)] 
Merge branch '2962-invalid-fctx' into 'main'

clear fctx->magic and fetch->magic when destroying

See merge request isc-projects/bind9!6543

3 years agoclear fctx->magic and fetch->magic when destroying
Evan Hunt [Mon, 11 Jul 2022 23:55:48 +0000 (16:55 -0700)] 
clear fctx->magic and fetch->magic when destroying

fctx_destroy() and dns_resolver_destroyfetch() did not clear the
'magic' field during destruction.

3 years agoMerge branch '2683-ixfr-logging' into 'main'
Evan Hunt [Tue, 12 Jul 2022 23:25:34 +0000 (23:25 +0000)] 
Merge branch '2683-ixfr-logging' into 'main'

log the reason for falling back to AXFR from IXFR at level info

Closes #2683

See merge request isc-projects/bind9!6511

3 years agolog the reason for falling back to AXFR from IXFR at level info
Evan Hunt [Sat, 2 Jul 2022 20:09:25 +0000 (13:09 -0700)] 
log the reason for falling back to AXFR from IXFR at level info

messages indicating the reason for a fallback to AXFR (i.e, because
the requested serial number is not present in the journal, or because
the size of the IXFR response would exceeed "max-ixfr-ratio") are now
logged at level info instead of debug(4).

3 years agoMerge branch 'artem-backport-tls-related-fixes-from-loopmgr-branch' into 'main'
Artem Boldariev [Tue, 12 Jul 2022 12:11:21 +0000 (12:11 +0000)] 
Merge branch 'artem-backport-tls-related-fixes-from-loopmgr-branch' into 'main'

Backport TLS-related fixes from the loopmgr-branch

See merge request isc-projects/bind9!6501

3 years agoTLS: do not ignore accept callback result
Artem Boldariev [Sat, 2 Jul 2022 00:31:35 +0000 (03:31 +0300)] 
TLS: do not ignore accept callback result

Before this change the TLS code would ignore the accept callback result,
and would not try to gracefully close the connection. This had not been
noticed, as it is not really required for DoH. Now the code tries to
shut down the TLS connection gracefully when accepting it is not
successful.

3 years ago*_noresponse, tlsdns_listen_noalpn: csends == 1 is not guaranteed
Artem Boldariev [Fri, 1 Jul 2022 23:20:39 +0000 (02:20 +0300)] 
*_noresponse, tlsdns_listen_noalpn: csends == 1 is not guaranteed

This commit removes an assertion from the unit test which cannot be
guaranteed.

According to the test, exactly one client send must succeed. However,
it cannot really be guaranteed, as do not start to read data in the
accept callback on the server nor attach to the accepted handle. Thus,
we can expect the connection to be closed soon after we have returned
from the callback.

Interestingly enough, the test would pass just fine on TCP because:

a) there are fewer layers involved and thus there is less processing;

b) it is possible for the data to be sent and end up in an internal OS
socket buffer without being touched by an application's code on the
server. In such a case the client's write callback still would be
called successfully;

There is a chance for the test to succeed over TLS as well (as it
happily did before), but as the code has been changed to close unused
connections as soon as possible, the chance is far slimmer now.

What can be guaranteed is:

* cconnects == 1 (number client connections equals 1);
* saccepts == 1 (number of accepted connections equals 1).

3 years agoTLSDNS: try pass incoming data to OpenSSL if there are any
Artem Boldariev [Tue, 28 Jun 2022 18:05:23 +0000 (21:05 +0300)] 
TLSDNS: try pass incoming data to OpenSSL if there are any

Otherwise the code path will lead to a call to SSL_get_error()
returning SSL_ERROR_SSL, which in turn might lead to closing
connection to early in an unexpected way, as it is clearly not what is
intended.

The issue was found when working on loppmgr branch and appears to
be timing related as well. Might be responsible for some unexpected
transmission failures e.g. on zone transfers.

3 years agoTLS: bail out earlier when NM is stopping
Artem Boldariev [Mon, 27 Jun 2022 11:27:49 +0000 (14:27 +0300)] 
TLS: bail out earlier when NM is stopping

In some operations - most prominently when establishing connection -
it might be beneficial to bail out earlier when the network manager
is stopping.

The issue is backported from loopmgr branch, where such a change is
not only beneficial, but required.

3 years agoTLS: sometimes TCP conn. handle might be NULL on when connecting
Artem Boldariev [Fri, 24 Jun 2022 12:49:15 +0000 (15:49 +0300)] 
TLS: sometimes TCP conn. handle might be NULL on when connecting

In some cases - in particular, in case of errors, NULL might be passed
to a connection callback instead of a handle that could have led to
an abort. This commit ensures that such a situation will not occur.

The issue was found when working on the loopmgr branch.

3 years agoTLS: try to close sockets whenever there are no pending operations
Artem Boldariev [Fri, 24 Jun 2022 12:20:13 +0000 (15:20 +0300)] 
TLS: try to close sockets whenever there are no pending operations

This commit ensures that the underlying TCP socket of a TLS connection
gets closed earlier whenever there are no pending operations on it.

In the loop-manager branch, in some circumstances the connection
could have remained opened for far too long for no reason. This
commit ensures that will not happen.

3 years agoTLS: Implement isc_nmhandle_setwritetimeout()
Artem Boldariev [Thu, 23 Jun 2022 17:18:58 +0000 (20:18 +0300)] 
TLS: Implement isc_nmhandle_setwritetimeout()

This commit adds a proper implementation of
isc_nmhandle_setwritetimeout() for TLS connections. Now it passes the
value to the underlying TCP handle.

3 years agoMerge branch 'mnowak/alpine-3.16' into 'main'
Michal Nowak [Tue, 12 Jul 2022 11:10:28 +0000 (11:10 +0000)] 
Merge branch 'mnowak/alpine-3.16' into 'main'

Add Alpine Linux 3.16

See merge request isc-projects/bind9!6360

3 years agoAdd Alpine Linux 3.16
Michal Nowak [Thu, 26 May 2022 07:53:57 +0000 (09:53 +0200)] 
Add Alpine Linux 3.16

3 years agoMerge branch '3438-dnssec-policy-does-not-set-inline-signing' into 'main'
Matthijs Mekking [Tue, 12 Jul 2022 10:12:39 +0000 (10:12 +0000)] 
Merge branch '3438-dnssec-policy-does-not-set-inline-signing' into 'main'

Fix inheritance for dnssec-policy when checking for inline-signing

Closes #3438

See merge request isc-projects/bind9!6541

3 years agoAdd release note and change entry for #3438
Matthijs Mekking [Mon, 11 Jul 2022 08:34:24 +0000 (10:34 +0200)] 
Add release note and change entry for #3438

Bug worth mentioning.

3 years agoInherit dnssec-policy in check for inline-signing
Matthijs Mekking [Mon, 11 Jul 2022 08:30:44 +0000 (10:30 +0200)] 
Inherit dnssec-policy in check for inline-signing

When dnssec-policy is used, and the zone is not dynamic, BIND will
assume that the zone is inline-signed. But the function responsible
for this did not inherit the dnssec-policy option from the view or
options level, and thus never enabled inline-signing, while the zone
should have been.

This is fixed by this commit.

3 years agoTest setting of inline-signing with dnssec-policy
Matthijs Mekking [Mon, 11 Jul 2022 08:25:47 +0000 (10:25 +0200)] 
Test setting of inline-signing with dnssec-policy

When dnssec-policy is used, and the zone is not dynamic, BIND will
assume that the zone is inline-signed. Add test cases to verify this.

3 years agoFix kasp system test bugs
Matthijs Mekking [Mon, 11 Jul 2022 08:18:56 +0000 (10:18 +0200)] 
Fix kasp system test bugs

Fix a comment, ensuring the right parameters are used (zone is
parameter $3, not $2) and add view and policy parameters to the comment.

Fix the view tests and test the correct view (example3 instead of
example2).

Fix placement of "n=$((n+1)" for two test cases.

3 years agoMerge branch '3389-unexpected-badkey-in-upforwd-system-test' into 'main'
Mark Andrews [Tue, 12 Jul 2022 08:57:47 +0000 (08:57 +0000)] 
Merge branch '3389-unexpected-badkey-in-upforwd-system-test' into 'main'

Clone UPDATE message buffer before forwarding

Closes #3389

See merge request isc-projects/bind9!6388

3 years agoAdd CHANGES note for [GL #3389]
Mark Andrews [Fri, 3 Jun 2022 07:01:20 +0000 (17:01 +1000)] 
Add CHANGES note for [GL #3389]

3 years agoClone the message buffer before forwarding UPDATE messages
Mark Andrews [Fri, 3 Jun 2022 06:55:56 +0000 (16:55 +1000)] 
Clone the message buffer before forwarding UPDATE messages

this prevents named forwarding a buffer that may have been over
written.

3 years agoMerge branch '3440-use-default_algorithm-more-often' into 'main'
Mark Andrews [Tue, 12 Jul 2022 03:46:28 +0000 (03:46 +0000)] 
Merge branch '3440-use-default_algorithm-more-often' into 'main'

Resolve "Use DEFAULT_ALGORITHM more often"

Closes #3440

See merge request isc-projects/bind9!6532

3 years agoAdd CHANGES not for [GL #3440]
Mark Andrews [Fri, 8 Jul 2022 04:40:48 +0000 (14:40 +1000)] 
Add CHANGES not for [GL #3440]

3 years agozonechecks: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 00:59:20 +0000 (10:59 +1000)] 
zonechecks: use $DEFAULT_ALGORITHM

3 years agowildcard: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 01:03:34 +0000 (11:03 +1000)] 
wildcard: use $DEFAULT_ALGORITHM

3 years agoviews: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 00:57:55 +0000 (10:57 +1000)] 
views: use $DEFAULT_ALGORITHM

3 years agoverify: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 01:08:25 +0000 (11:08 +1000)] 
verify: use $DEFAULT_ALGORITHM

3 years agoupforwd: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 01:12:03 +0000 (11:12 +1000)] 
upforwd: use $DEFAULT_ALGORITHM

3 years agounknown: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 01:15:38 +0000 (11:15 +1000)] 
unknown: use $DEFAULT_ALGORITHM

3 years agosynthfromdnssec: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 01:17:47 +0000 (11:17 +1000)] 
synthfromdnssec: use $DEFAULT_ALGORITHM

3 years agostaticstub: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 01:22:03 +0000 (11:22 +1000)] 
staticstub: use $DEFAULT_ALGORITHM

3 years agosmartsign: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 00:53:58 +0000 (10:53 +1000)] 
smartsign: use $DEFAULT_ALGORITHM

3 years agorpz: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 01:37:39 +0000 (11:37 +1000)] 
rpz: use $DEFAULT_ALGORITHM

3 years agorootkeysentinel: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 01:44:13 +0000 (11:44 +1000)] 
rootkeysentinel: use $DEFAULT_ALGORITHM

3 years agoresolver: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 01:51:09 +0000 (11:51 +1000)] 
resolver: use $DEFAULT_ALGORITHM

3 years agoredirect: use $DEFAULT_ALGORITHM
Mark Andrews [Fri, 8 Jul 2022 01:53:56 +0000 (11:53 +1000)] 
redirect: use $DEFAULT_ALGORITHM