]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
4 years agoRemove obsolete notes on name compression
Tony Finch [Wed, 4 May 2022 08:38:54 +0000 (09:38 +0100)] 
Remove obsolete notes on name compression

These notes describe the initial compression design for BIND 9 in
1998/1999, when the IETF had some over-optimistic plans for using EDNS
to change the wire format of domain names. (Another example was
bitstring labels for IPv6 reverse DNS.) By the end of 2000 the EDNS
name compression schemes had been abandoned, and BIND 9's compression
code was rewritten to use a hash table.

There is nothing left of the implementation described here, and the
API functions are better described in `compress.h`, so these notes are
more misleading than helpful. Those who are interested in the past can
look at the version control history.

4 years agoMerge branch 'aram/update-top-level-gitignore-add-ide-files' into 'main'
Arаm Sаrgsyаn [Wed, 1 Jun 2022 10:19:14 +0000 (10:19 +0000)] 
Merge branch 'aram/update-top-level-gitignore-add-ide-files' into 'main'

Update top-level .gitignore to ignore files generated by some IDEs

See merge request isc-projects/bind9!6361

4 years agoUpdate top-level .gitignore to ignore files generated by some IDEs
Aram Sargsyan [Thu, 26 May 2022 11:11:52 +0000 (11:11 +0000)] 
Update top-level .gitignore to ignore files generated by some IDEs

4 years agoMerge branch '3345-fix-keyless-example-generation' into 'main'
Mark Andrews [Wed, 1 Jun 2022 00:36:15 +0000 (00:36 +0000)] 
Merge branch '3345-fix-keyless-example-generation' into 'main'

Resolve "Insecurity proof failed resolving 'a.b.keyless.example/A/IN' in dnssec test"

Closes #3345

See merge request isc-projects/bind9!6280

4 years agoMake modifications to keyless.example deterministic
Mark Andrews [Wed, 11 May 2022 04:32:11 +0000 (14:32 +1000)] 
Make modifications to keyless.example deterministic

The perl modifation code for keyless.example was not deterministic
(/NXT/ matched part of signature) resulting in different error
strings being returned.  Replaced /NXT/ with /A RRSIG NSEC/ and
updated expected error string,

4 years agoMerge branch '3349-managed-keys' into 'main'
Evan Hunt [Tue, 31 May 2022 18:18:13 +0000 (18:18 +0000)] 
Merge branch '3349-managed-keys' into 'main'

don't create managed-keys zone unless dnssec-validation is "auto"

Closes #3349

See merge request isc-projects/bind9!6306

4 years agoCHANGES for [GL #3349]
Evan Hunt [Tue, 31 May 2022 17:55:31 +0000 (10:55 -0700)] 
CHANGES for [GL #3349]

4 years agodon't create managed-keys zone unless dnssec-validation is "auto"
Evan Hunt [Sat, 14 May 2022 03:55:23 +0000 (20:55 -0700)] 
don't create managed-keys zone unless dnssec-validation is "auto"

previously, a managed-keys zone was created for every view
regardless of whether rfc5011 was in use; when it was not in
use, the zone would be left empty. this made for some confusing
log messages.

we now only set up the managed-keys zone if dnssec-validation is
set to the default value of "auto".

certain system test servers have had their dnssec-validation settings
changed to auto because the tests depended on the existence of the
zone.

4 years agoMerge branch '1611-detect-insane-dnssec-policies' into 'main'
Matthijs Mekking [Tue, 31 May 2022 14:36:32 +0000 (14:36 +0000)] 
Merge branch '1611-detect-insane-dnssec-policies' into 'main'

Add some dnssec-policy configuration checks

Closes #1611 and #1601

See merge request isc-projects/bind9!6273

4 years agoOnly log "new successor in ..." if prepub != 0
Matthijs Mekking [Tue, 10 May 2022 08:25:27 +0000 (10:25 +0200)] 
Only log "new successor in ..." if prepub != 0

If 'prepub' is 0, this has the special meaning that no rollover is
scheduled. If so, don't log "new successor in x seconds".

4 years agoAdd CHANGE and release note for #1611
Matthijs Mekking [Mon, 9 May 2022 12:28:45 +0000 (14:28 +0200)] 
Add CHANGE and release note for #1611

Feature change.

4 years agoError if key lifetime is too short
Matthijs Mekking [Mon, 9 May 2022 11:56:45 +0000 (13:56 +0200)] 
Error if key lifetime is too short

The key lifetime should not be shorter than the time it costs to
introduce the successor key, otherwise keys will be created faster than
they are removed, resulting in a large key set.

The time it takes to replace a key is determined by the publication
interval (Ipub) of the successor key and the retire interval of the
predecessor key (Iret).

For the ZSK, Ipub is the sum of the DNSKEY TTL and zone propagation
delay (and publish safety). Iret is the sum of Dsgn, the maximum zone
TTL and zone propagation delay (and retire safety). The sign delay is
the signature validity period minus the refresh interval: The time to
ensure that all existing RRsets have been re-signed with the new key.
The ZSK lifetime should be larger than both values.

For the KSK, Ipub is the sum of the DNSKEY TTL and zone propagation
delay (and publish safety). Iret is the sum of the DS TTL and parent
zone propagation delay (and retire safety). The KSK lifetime should be
larger than both values.

4 years agoUpdate signatures-refresh documentation
Matthijs Mekking [Fri, 6 May 2022 14:56:13 +0000 (16:56 +0200)] 
Update signatures-refresh documentation

Mention in the ARM the new restriction about signatures-refresh.

4 years agoError if signatures-refresh is too high
Matthijs Mekking [Fri, 6 May 2022 14:54:49 +0000 (16:54 +0200)] 
Error if signatures-refresh is too high

The signatures-refresh should not near the signatures-validity value,
to prevent operational instability. Same is true when checking against
signatures-validity-dnskey.

4 years agoWarn if key lifetime is short
Matthijs Mekking [Fri, 6 May 2022 14:21:16 +0000 (16:21 +0200)] 
Warn if key lifetime is short

Log a warning if the key lifetime is less than 30 days.

4 years agoWarn if multiple keys have same role
Matthijs Mekking [Fri, 6 May 2022 14:08:39 +0000 (16:08 +0200)] 
Warn if multiple keys have same role

If a dnssec-policy has multiple keys configured with the
same algorithm and role.

4 years agoMerge branch 'ondrej-unit-tests-refactoring' into 'main'
Ondřej Surý [Tue, 31 May 2022 08:56:05 +0000 (08:56 +0000)] 
Merge branch 'ondrej-unit-tests-refactoring' into 'main'

Give the unit tests a big overhaul and move all the unit tests to /tests/<libname>/

See merge request isc-projects/bind9!6243

4 years agoAdd CHANGES note for [GL !6243]
Ondřej Surý [Tue, 3 May 2022 13:10:49 +0000 (15:10 +0200)] 
Add CHANGES note for [GL !6243]

4 years agoExclude unit tests from gcov
Evan Hunt [Mon, 16 May 2022 22:37:38 +0000 (15:37 -0700)] 
Exclude unit tests from gcov

Modify the .gitlab-ci.yml to match the previous lib/.*/tests/.* pattern
for excluding the unit tests from the gcov.

4 years agoStop the unit tests from running twice
Evan Hunt [Wed, 4 May 2022 02:43:23 +0000 (19:43 -0700)] 
Stop the unit tests from running twice

Move the libtest code into a 'libtest' subdirectory and make it
one of the SUBDIRS in the tests Makefile. having it at the top level
required having "." as one of the subdirs, and that caused the
unit tests to be executed twice.

4 years agoMove all the unit tests to /tests/<libname>/
Ondřej Surý [Tue, 3 May 2022 09:37:31 +0000 (11:37 +0200)] 
Move all the unit tests to /tests/<libname>/

The unit tests are now using a common base, which means that
lib/dns/tests/ code now has to include lib/isc/include/isc/test.h and
link with lib/isc/test.c and lib/ns/tests has to include both libisc and
libdns parts.

Instead of cross-linking code between the directories, move the
/lib/<foo>/test.c to /tests/<foo>.c and /lib/<foo>/include/<foo>test.h
to /tests/include/tests/<foo>.h and create a single libtest.la
convenience library in /tests/.

At the same time, move the /lib/<foo>/tests/ to /tests/<foo>/ (but keep
it symlinked to the old location) and adjust paths accordingly.  In few
places, we are now using absolute paths instead of relative paths,
because the directory level has changed.  By moving the directories
under the /tests/ directory, the test-related code is kept in a single
place and we can avoid referencing files between libns->libdns->libisc
which is unhealthy because they live in a separate Makefile-space.

In the future, the /bin/tests/ should be merged to /tests/ and symlink
kept, and the /fuzz/ directory moved to /tests/fuzz/.

4 years agoGive the unit tests a big overhaul
Ondřej Surý [Mon, 2 May 2022 08:56:42 +0000 (10:56 +0200)] 
Give the unit tests a big overhaul

The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.

This commit does several things:

1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
   conditionals.

2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
   implementations, test lists, and the main test routine, so we don't
   have to repeat this all over again.  The macros were modeled after
   libuv test suite but adapted to cmocka as the test driver.

   A simple example of a unit test would be:

    ISC_RUN_TEST_IMPL(test1) { assert_true(true); }

    ISC_TEST_LIST_START
    ISC_TEST_ENTRY(test1)
    ISC_TEST_LIST_END

    ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)

   For more complicated examples including group setup and teardown
   functions, and per-test setup and teardown functions.

3. The macros prefix the test functions and cmocka entries, so the name
   of the test can now match the tested function name, and we don't have
   to append `_test` because `run_test_` is automatically prepended to
   the main test function, and `setup_test_` and `teardown_test_` is
   prepended to setup and teardown function.

4. Update all the unit tests to use the new syntax and fix a few bits
   here and there.

5. In the future, we can separate the test declarations and test
   implementations which are going to greatly help with uncluttering the
   bigger unit tests like doh_test and netmgr_test, because the test
   implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
   and `ISC_RUN_TEST_IMPL` for more details.

NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros.  There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.

4 years agoMerge branch 'ondrej-make-all-tasks-bound-to-thread' into 'main'
Ondřej Surý [Wed, 25 May 2022 14:45:32 +0000 (14:45 +0000)] 
Merge branch 'ondrej-make-all-tasks-bound-to-thread' into 'main'

Make all tasks to be bound to a thread

See merge request isc-projects/bind9!6347

4 years agoMake all tasks to be bound to a thread
Ondřej Surý [Thu, 19 May 2022 09:20:21 +0000 (11:20 +0200)] 
Make all tasks to be bound to a thread

Previously, tasks could be created either unbound or bound to a specific
thread (worker loop).  The unbound tasks would be assigned to a random
thread every time isc_task_send() was called.  Because there's no logic
that would assign the task to the least busy worker, this just creates
unpredictability.  Instead of random assignment, bind all the previously
unbound tasks to worker 0, which is guaranteed to exist.

4 years agoMerge branch 'ondrej-remove-dns_byaddr-API' into 'main'
Ondřej Surý [Wed, 25 May 2022 12:50:25 +0000 (12:50 +0000)] 
Merge branch 'ondrej-remove-dns_byaddr-API' into 'main'

Remove dns_lookup and unused functions in dns_byaddr

See merge request isc-projects/bind9!6348

4 years agoRemove dns_lookup and unused functions in dns_byaddr
Ondřej Surý [Thu, 19 May 2022 11:07:30 +0000 (13:07 +0200)] 
Remove dns_lookup and unused functions in dns_byaddr

Clean up unused functions from the dns_byaddr API and completely remove
the dns_lookup API.

4 years agoMerge branch '3375-cids-352848-352849-handle-deadcode-flow-errors' into 'main'
Artem Boldariev [Wed, 25 May 2022 10:20:05 +0000 (10:20 +0000)] 
Merge branch '3375-cids-352848-352849-handle-deadcode-flow-errors' into 'main'

Resolve: CID 352848, CID 352849: Control flow issues (DEADCODE)

Closes #3375

See merge request isc-projects/bind9!6351

4 years agoCID 352848: split xfrin_start() and remove dead code
Artem Boldariev [Tue, 24 May 2022 08:39:26 +0000 (11:39 +0300)] 
CID 352848: split xfrin_start() and remove dead code

This commit separates TLS context creation code from xfrin_start() as
it has become too large and hard to follow into a new
function (similarly how it is done in dighost.c)

The dead code has been removed from the cleanup section of the TLS
creation code:

* there is no way 'tlsctx' can equal 'found';
* there is no way 'sess_cache' can be non-NULL in the cleanup section.

Also, it fixes a bug in the older version of the code, where TLS
client session context fetched from the cache would not get passed to
isc_nm_tlsdnsconnect().

4 years agoCID 352849: refactor get_create_tls_context() within dighost.c
Artem Boldariev [Tue, 24 May 2022 08:25:30 +0000 (11:25 +0300)] 
CID 352849: refactor get_create_tls_context() within dighost.c

This commit removes dead code from cleanup handling part of the
get_create_tls_context().

In particular, currently:

* there is no way 'found_ctx' might equal 'ctx';
* there is no way 'session_cache' might equal a non-NULL value while
cleaning up after a TLS initialisation error.

4 years agoMerge branch '2801-unittest-isc-netmgr-s390x' into 'main'
Ondřej Surý [Tue, 24 May 2022 18:22:54 +0000 (18:22 +0000)] 
Merge branch '2801-unittest-isc-netmgr-s390x' into 'main'

Fix failures in isc netmgr_test on big endian machines

Closes #2801

See merge request isc-projects/bind9!6352

4 years agoFix failures in isc netmgr_test on big endian machines
Petr Menšík [Tue, 24 May 2022 17:42:41 +0000 (19:42 +0200)] 
Fix failures in isc netmgr_test on big endian machines

Typing from libuv structure to isc_region_t is not possible, because
their sizes differ on 64 bit architectures. Little endian machines seems
to be lucky and still result in test passed. But big endian machine such
as s390x fails the test reliably.

Fix by directly creating the buffer as isc_region_t and skipping the
type conversion. More readable and still more correct.

4 years agoMerge branch '3064-avoid-periodic-interface-rescans' into 'main'
Artem Boldariev [Tue, 24 May 2022 13:55:33 +0000 (13:55 +0000)] 
Merge branch '3064-avoid-periodic-interface-rescans' into 'main'

Disable periodic interface re-scans on Linux

Closes #3064

See merge request isc-projects/bind9!6111

4 years agoModify CHANGES [GL #3064]
Artem Boldariev [Fri, 8 Apr 2022 12:50:06 +0000 (15:50 +0300)] 
Modify CHANGES [GL #3064]

Mention that "interface-interval" might be ignored if a reliable,
event-based mechanism to detect interface state changes is available.

4 years agoDisable periodic interface re-scans on modern platforms
Artem Boldariev [Fri, 8 Apr 2022 12:32:10 +0000 (15:32 +0300)] 
Disable periodic interface re-scans on modern platforms

This commit disables periodic interface re-scans timer on Linux where
a kernel-based dynamic interface mechanisms make it a thing of the
past in most cases.

4 years agoMerge branch '3376-fix-openssl-1.1.0-unimplementable-SSL-SESSION-is-resumable' into...
Artem Boldariev [Tue, 24 May 2022 10:52:06 +0000 (10:52 +0000)] 
Merge branch '3376-fix-openssl-1.1.0-unimplementable-SSL-SESSION-is-resumable' into 'main'

Resolve #3376: Do not provide a shim for SSL_SESSION_is_resumable()

Closes #3376

See merge request isc-projects/bind9!6346

4 years agoDo not provide a shim for SSL_SESSION_is_resumable()
Artem Boldariev [Mon, 23 May 2022 10:41:06 +0000 (13:41 +0300)] 
Do not provide a shim for SSL_SESSION_is_resumable()

The recently added TLS client session cache used
SSL_SESSION_is_resumable() to avoid polluting the cache with
non-resumable sessions. However, it turned out that we cannot provide
a shim for this function across the whole range of OpenSSL versions
due to the fact that OpenSSL 1.1.0 does uses opaque pointers for
SSL_SESSION objects.

The commit replaces the shim for SSL_SESSION_is_resumable() with a non
public approximation of it on systems shipped with OpenSSL 1.1.0. It
is not turned into a proper shim because it does not fully emulate the
behaviour of SSL_SESSION_is_resumable(), but in our case it is good
enough, as it still helps to protect the cache from pollution.

For systems shipped with OpenSSL 1.0.X and derivatives (e.g. older
versions of LibreSSL), the provided replacement perfectly mimics the
function it is intended to replace.

4 years agoMerge branch '3341-servestale-extendederrors-test-failure' into 'main'
Matthijs Mekking [Mon, 23 May 2022 14:01:47 +0000 (14:01 +0000)] 
Merge branch '3341-servestale-extendederrors-test-failure' into 'main'

Tweak timings in serve-stale system test

Closes #3341

See merge request isc-projects/bind9!6276

4 years agoTweak timings in serve-stale system test
Matthijs Mekking [Tue, 10 May 2022 13:09:29 +0000 (15:09 +0200)] 
Tweak timings in serve-stale system test

Give a little bit more time if we wait on a time out from the
authoritative (aka resolver failure), and give up after one try
(because the second attempt will likely result in a different EDE).

4 years agoMerge branch '3354-cid-352776-missing_lock' into 'main'
Matthijs Mekking [Mon, 23 May 2022 10:27:29 +0000 (10:27 +0000)] 
Merge branch '3354-cid-352776-missing_lock' into 'main'

Fix CID 352776: Concurrent data access violations

Closes #3354

See merge request isc-projects/bind9!6315

4 years agoRequire valid key for dst_key functions
Matthijs Mekking [Tue, 17 May 2022 10:02:43 +0000 (12:02 +0200)] 
Require valid key for dst_key functions

Make sure that the key structure is valid when calling the following
functions:
- dst_key_setexternal
- dst_key_isexternal
- dst_key_setmodified
- dst_key_ismodified

4 years agoFix CID 352776: Concurrent data access violations
Matthijs Mekking [Mon, 16 May 2022 17:00:47 +0000 (19:00 +0200)] 
Fix CID 352776: Concurrent data access violations

*** CID 352776:  Concurrent data access violations  (MISSING_LOCK)
/lib/dns/dst_api.c: 474 in dst_key_setmodified()
468     dst_key_isexternal(dst_key_t *key) {
469 return (key->external);
470     }
471
472     void
473     dst_key_setmodified(dst_key_t *key, bool value) {
>>>     CID 352776:  Concurrent data access violations  (MISSING_LOCK)
>>>     Accessing "key->modified" without holding lock
>>> "dst_key.mdlock". Elsewhere, "dst_key.modified" is accessed with
>>> "dst_key.mdlock" held 8 out of 11 times (8 of these accesses
>>> strongly imply that it is necessary).
474 key->modified = value;
475     }
476
477     bool
478     dst_key_ismodified(dst_key_t *key) {
479 return (key->modified);

4 years agoMerge branch 'artem-client-tls-sessions-reuse' into 'main'
Artem Boldariev [Fri, 20 May 2022 17:53:33 +0000 (17:53 +0000)] 
Merge branch 'artem-client-tls-sessions-reuse' into 'main'

TLS session resumption support

See merge request isc-projects/bind9!6274

4 years agoDig: Do not call isc_nm_cancelread() for HTTP sockets
Artem Boldariev [Tue, 10 May 2022 20:09:59 +0000 (23:09 +0300)] 
Dig: Do not call isc_nm_cancelread() for HTTP sockets

This commit ensures that isc_nm_cancelread() is not called from within
dig code for HTTP sockets, as these lack its implementation.

It does not have much sense to have it due to transactional nature of
HTTP.

Every HTTP request-response pair is represented by a virtual socket,
where read callback is called only when full DNS message is received
or when an error code is being passed there. That is, there is nothing
to cancel at the time of the call.

4 years agoFix an abort in DoH (client-side) when writing on closing sock
Artem Boldariev [Tue, 10 May 2022 16:46:12 +0000 (19:46 +0300)] 
Fix an abort in DoH (client-side) when writing on closing sock

The commit fixes a corner case in client-side DoH code, when a write
attempt is done on a closing socket (session).

The change ensures that the write call-back will be called with a
proper error code (see failed_send_cb() call in client_httpsend()).

4 years agoAvoid aborting when uv_timer_start() is used on a closing socket
Artem Boldariev [Tue, 10 May 2022 16:44:28 +0000 (19:44 +0300)] 
Avoid aborting when uv_timer_start() is used on a closing socket

In such a case it will return UV_EINVAL (-EINVAL), leading to
aborting, as the code expects the function to succeed.

4 years agoModify CHANGES
Artem Boldariev [Mon, 9 May 2022 16:40:01 +0000 (19:40 +0300)] 
Modify CHANGES

Mention that TLS session resumption is now fully supported in the
client side code.

4 years agoAdd SSL_SESSION_is_resumable() implementation shim
Artem Boldariev [Mon, 9 May 2022 16:08:29 +0000 (19:08 +0300)] 
Add SSL_SESSION_is_resumable() implementation shim

This commit adds SSL_SESSION_is_resumable() implementation if it is
missing.

4 years agoDoT: implement TLS client session resumption
Artem Boldariev [Mon, 25 Apr 2022 13:47:06 +0000 (16:47 +0300)] 
DoT: implement TLS client session resumption

This commit extends DoT code with TLS client session resumption
support implemented on top of the TLS client session cache.

4 years agoTLS stream/DoH: implement TLS client session resumption
Artem Boldariev [Fri, 22 Apr 2022 12:59:11 +0000 (15:59 +0300)] 
TLS stream/DoH: implement TLS client session resumption

This commit extends TLS stream code and DoH code with TLS client
session resumption support implemented on top of the TLS client
session cache.

4 years agoExtend TLS context cache with TLS client session cache
Artem Boldariev [Fri, 22 Apr 2022 08:41:14 +0000 (11:41 +0300)] 
Extend TLS context cache with TLS client session cache

This commit extends TLS context cache with TLS client session cache so
that an associated session cache can be stored alongside the TLS
context within the context cache.

4 years agoAdd TLS client session cache implementation
Artem Boldariev [Thu, 21 Apr 2022 12:29:45 +0000 (15:29 +0300)] 
Add TLS client session cache implementation

This commit adds an implementation of a client TLS session cache. TLS
client session cache is an object which allows efficient storing and
retrieval of previously saved TLS sessions so that they can be
resumed. This object is supposed to be a foundation for implementing
TLS session resumption - a standard technique to reduce the cost of
re-establishing a connection to the remote server endpoint.

OpenSSL does server-side TLS session caching transparently by
default. However, on the client-side, a TLS session to resume must be
manually specified when establishing the TLS connection. The TLS
client session cache is precisely the foundation for that.

4 years agoMerge branch '3344-threadsanitizer-data-race-in-isc__nm_tcpdns_send' into 'main'
Ondřej Surý [Thu, 19 May 2022 20:37:16 +0000 (20:37 +0000)] 
Merge branch '3344-threadsanitizer-data-race-in-isc__nm_tcpdns_send' into 'main'

Move setting the sock->write_timeout to the async_*send

Closes #3344

See merge request isc-projects/bind9!6320

4 years agoMove setting the sock->write_timeout to the async_*send
Ondřej Surý [Tue, 17 May 2022 19:31:37 +0000 (21:31 +0200)] 
Move setting the sock->write_timeout to the async_*send

Setting the sock->write_timeout from the TCP, TCPDNS, and TLSDNS send
functions could lead to (harmless) data race when setting the value for
the first time when the isc_nm_send() function would be called from
thread not-matching the socket we are sending to.  Move the setting the
sock->write_timeout to the matching async function which is always
called from the matching thread.

4 years agoMerge branch '3371-check-for-__attribute__-fallthrough-support-is-sometimes-incorrect...
Ondřej Surý [Thu, 19 May 2022 20:01:06 +0000 (20:01 +0000)] 
Merge branch '3371-check-for-__attribute__-fallthrough-support-is-sometimes-incorrect' into 'main'

Use C2x [[fallthrough]] when supported by LLVM/clang

Closes #3371

See merge request isc-projects/bind9!6338

4 years agoUse C2x [[fallthrough]] when supported by LLVM/clang
Ondřej Surý [Thu, 19 May 2022 19:40:24 +0000 (21:40 +0200)] 
Use C2x [[fallthrough]] when supported by LLVM/clang

Clang added support for the gcc-style fallthrough
attribute (i.e. __attribute__((fallthrough))) in version 10.  However,
__has_attribute(fallthrough) will return 1 in C mode in older versions,
even though they only support the C++11 fallthrough attribute. At best,
the unsupported attribute is simply ignored; at worst, it causes errors.

The C2x fallthrough attribute has the advantages of being supported in
the broadest range of clang versions (added in version 9) and being easy
to check for support. Use C2x [[fallthrough]] attribute if possible, and
fall back to not using an attribute for clang versions that don't have
it.

Courtesy of Joshua Root

4 years agoMerge tag 'v9_19_1'
Michal Nowak [Thu, 19 May 2022 08:55:42 +0000 (10:55 +0200)] 
Merge tag 'v9_19_1'

BIND 9.19.1

4 years agoMerge branch 'each-resolver-hash-tables' into 'main'
Evan Hunt [Thu, 19 May 2022 07:49:11 +0000 (07:49 +0000)] 
Merge branch 'each-resolver-hash-tables' into 'main'

Use self-resizing hash tables for resolver

See merge request isc-projects/bind9!6271

4 years agoCHANGES for [GL !6271]
Evan Hunt [Thu, 19 May 2022 07:48:06 +0000 (00:48 -0700)] 
CHANGES for [GL !6271]

4 years agoAlways use the number of CPUS for resolver->ntasks
Evan Hunt [Sun, 8 May 2022 03:58:19 +0000 (20:58 -0700)] 
Always use the number of CPUS for resolver->ntasks

Since the fctx hash table is now self-resizing, and resolver tasks are
selected to match the thread that created the fetch context, there
shouldn't be any significant advantage to having multiple tasks per CPU;
a single task per thread should be sufficient.

Additionally, the fetch context is always pinned to the calling netmgr
thread to minimize the contention just to coalesced fetches - if two
threads starts the same fetch, it will be pinned to the first one to get
the bucket.

4 years agoUse automatically-resizing hash table for resolver buckets
Evan Hunt [Fri, 6 May 2022 21:51:12 +0000 (14:51 -0700)] 
Use automatically-resizing hash table for resolver buckets

Replace the statically-sized hash table used for the resolver
fetch contexts with an isc_ht_t.

4 years agoUse automatically-resizing hash table for fetches-per-zone
Evan Hunt [Wed, 4 May 2022 22:26:39 +0000 (15:26 -0700)] 
Use automatically-resizing hash table for fetches-per-zone

Replace the statically-sized hash table used for fcount_incr()
and fcount_decr() with an isc_ht_t.

4 years agoMerge branch '3350-rndc-dnssec-checkds-doc' into 'main'
Evan Hunt [Wed, 18 May 2022 22:28:39 +0000 (22:28 +0000)] 
Merge branch '3350-rndc-dnssec-checkds-doc' into 'main'

specify time format in the documentation for 'rdnc dnssec -checkds'

Closes #3350

See merge request isc-projects/bind9!6302

4 years agospecify time format in the documentation for 'rdnc dnssec -checkds'
Evan Hunt [Sat, 14 May 2022 02:42:29 +0000 (19:42 -0700)] 
specify time format in the documentation for 'rdnc dnssec -checkds'

also clarified the writing in the surrounding paragraph.

4 years agoMerge branch 'mnowak/fix-typo-in-ednscompliance-test' into 'main'
Michal Nowak [Wed, 18 May 2022 17:15:04 +0000 (17:15 +0000)] 
Merge branch 'mnowak/fix-typo-in-ednscompliance-test' into 'main'

Fix typo in ednscompliance test

See merge request isc-projects/bind9!6323

4 years agoFix typo in ednscompliance test
Michal Nowak [Wed, 18 May 2022 09:23:21 +0000 (11:23 +0200)] 
Fix typo in ednscompliance test

Caused by ba0313e649b9de3d746cc8a748cd02da75f258bd, an incomplete fix of
spelling errors.

4 years agoMerge branch '3366-configure-fails-to-find-uv-h-on-bsd' into 'main'
Ondřej Surý [Wed, 18 May 2022 17:04:31 +0000 (17:04 +0000)] 
Merge branch '3366-configure-fails-to-find-uv-h-on-bsd' into 'main'

Use libuv CFLAGS and LIBS when checking for features

Closes #3366

See merge request isc-projects/bind9!6326

4 years agoUse libuv CFLAGS and LIBS when checking for features
Ondřej Surý [Wed, 18 May 2022 12:10:58 +0000 (14:10 +0200)] 
Use libuv CFLAGS and LIBS when checking for features

When autoconf was checking for libuv features, the LIBUV_CFLAGS was not
added to CFLAGS and LIBUV_LIBS to LIBS which resulted in false
negatives.

Use AX_SAVE_FLAGS and AX_RESTORE_FLAGS to temporarily add LIBUV_CFLAGS
and LIBUV_LIBS to their respective variables.

4 years agoMerge branch '3356-wrong-path-for-geoip-directory' into 'main'
Mark Andrews [Tue, 17 May 2022 18:56:17 +0000 (18:56 +0000)] 
Merge branch '3356-wrong-path-for-geoip-directory' into 'main'

Resolve "wrong path for geoip-directory"

Closes #3356

See merge request isc-projects/bind9!6316

4 years agoRemove extraneous '$' in AS_VAR_COPY([MAXMINDDB_PREFIX], [with_maxminddb])
Mark Andrews [Tue, 17 May 2022 09:39:22 +0000 (19:39 +1000)] 
Remove extraneous '$' in AS_VAR_COPY([MAXMINDDB_PREFIX], [with_maxminddb])

4 years agoMerge branch '3361-dnssec-settime-unset' into 'main'
Tony Finch [Tue, 17 May 2022 15:33:29 +0000 (15:33 +0000)] 
Merge branch '3361-dnssec-settime-unset' into 'main'

Teach dnssec-settime to read unset times that it writes

Closes #3361

See merge request isc-projects/bind9!6317

4 years agoTeach dnssec-settime to read unset times that it writes
Tony Finch [Tue, 17 May 2022 12:13:57 +0000 (14:13 +0200)] 
Teach dnssec-settime to read unset times that it writes

When there is no time in a key file, `dnssec-settime` will print
"UNSET", but to unset a time the user must specify "none" or "never".
This change allows "unset" or "UNSET" as well as "none" or "never".
The "UNSET" output remains the same to avoid compatibility problems
with wrapper scripts.

I have also re-synchronized the "Timing Options" sections of the man
pages.

4 years agoMerge branch 'ondrej-cleanup-dns_message_gettemp' into 'main'
Ondřej Surý [Tue, 17 May 2022 11:12:06 +0000 (11:12 +0000)] 
Merge branch 'ondrej-cleanup-dns_message_gettemp' into 'main'

Cleanup dns_message_gettemp*() functions - they cannot fail

See merge request isc-projects/bind9!6311

4 years agoCleanup dns_message_gettemp*() functions - they cannot fail
Ondřej Surý [Mon, 16 May 2022 11:28:13 +0000 (13:28 +0200)] 
Cleanup dns_message_gettemp*() functions - they cannot fail

The dns_message_gettempname(), dns_message_gettemprdata(),
dns_message_gettemprdataset(), and dns_message_gettemprdatalist() always
succeeds because the memory allocation cannot fail now.  Change the API
to return void and cleanup all the use of aforementioned functions.

4 years agoMerge branch '3352-kasp-test-broken-on-freebsd' into 'main'
Matthijs Mekking [Mon, 16 May 2022 16:15:01 +0000 (16:15 +0000)] 
Merge branch '3352-kasp-test-broken-on-freebsd' into 'main'

Fix "kasp test broken on freebsd"

Closes #3352

See merge request isc-projects/bind9!6310

4 years agoReplace stat with PERL stat in kasp system test
Matthijs Mekking [Mon, 16 May 2022 09:23:15 +0000 (11:23 +0200)] 
Replace stat with PERL stat in kasp system test

7249bad7 introduced the -c option to stat(1) command, but BSD systems
do not know about it. Replace the stat(1) command with a PERL script
that achieves the same.

Why PERL? For consistency purposes, there are more places in the
system test where we use the same method.

4 years agoMerge branch '3327-fetches-per-server-quota' into 'main'
Evan Hunt [Sat, 14 May 2022 07:42:04 +0000 (07:42 +0000)] 
Merge branch '3327-fetches-per-server-quota' into 'main'

fix the fetches-per-server quota calculation

Closes #3327

See merge request isc-projects/bind9!6268

4 years agoAdd CHANGES note for [GL #3327]
Evan Hunt [Thu, 5 May 2022 22:02:43 +0000 (15:02 -0700)] 
Add CHANGES note for [GL #3327]

4 years agoAdd lower bound checks to fetchlimit test
Evan Hunt [Mon, 9 May 2022 00:17:29 +0000 (17:17 -0700)] 
Add lower bound checks to fetchlimit test

Check that the recursing client count is above a reasonable
minimum, as well as below a maximum, so that we can detect
bugs that cause recursion to fail too early or too often.

4 years agoCleanup: always count ns_statscounter_recursclients
Evan Hunt [Thu, 5 May 2022 21:57:16 +0000 (14:57 -0700)] 
Cleanup: always count ns_statscounter_recursclients

The ns_statscounter_recursclients counter was previously only
incremented or decremented if client->recursionquota was non-NULL.
This was harmless, because that value should always be non-NULL if
recursion is enabled, but it made the code slightly confusing.

4 years agoDisable EDNS for the fetchlimit test server
Evan Hunt [Thu, 5 May 2022 21:52:15 +0000 (14:52 -0700)] 
Disable EDNS for the fetchlimit test server

The fetchlimit test depends on a resolver continuing to try UDP
and timing out while the client waits for resolution to succeed.
but since commit bb990030 (flag day 2020), a fetch will always
switch to TCP after two timeouts, unless EDNS was disabled for
the query.

This commit adds "edns no;" to server statements in the fetchlimit
resolver, to restore the behavior expected by the test.

4 years agoFix the fetches-per-server quota calculation
Evan Hunt [Thu, 5 May 2022 00:27:56 +0000 (17:27 -0700)] 
Fix the fetches-per-server quota calculation

Since commit bad5a523c2e, when the fetches-per-server quota
was increased or decreased, instead of the value being set to
the newly calculated quota, it was set to the *minimum* of
the new quota or 1 - which effectively meant it was always set to 1.
it should instead have been the maximum, to prevent the value from
ever dropping to zero.

4 years agoMerge branch '3351-checkconf-overflow' into 'main'
Evan Hunt [Sat, 14 May 2022 03:28:48 +0000 (03:28 +0000)] 
Merge branch '3351-checkconf-overflow' into 'main'

prevent a possible buffer overflow in configuration check

Closes #3351

See merge request isc-projects/bind9!6303

4 years agoprevent a possible buffer overflow in configuration check
Evan Hunt [Sat, 14 May 2022 02:59:58 +0000 (19:59 -0700)] 
prevent a possible buffer overflow in configuration check

corrected code that could have allowed a buffer overfow while
parsing named.conf.

4 years agoMerge branch 'each-view-cleanup' into 'main'
Evan Hunt [Fri, 13 May 2022 21:23:40 +0000 (21:23 +0000)] 
Merge branch 'each-view-cleanup' into 'main'

clean up view and related object shutdown processes

See merge request isc-projects/bind9!6278

4 years agoCHANGES
Evan Hunt [Thu, 12 May 2022 23:57:43 +0000 (16:57 -0700)] 
CHANGES

4 years agoattach the resolver to the ADB
Evan Hunt [Thu, 12 May 2022 22:51:10 +0000 (15:51 -0700)] 
attach the resolver to the ADB

the ADB depends on the resolver, but previously only accessed it
via the view. as view->resolver may now be detached before the ADB
finishes, a shutdown race was possible. attaching to the resolver
directly prevents this.

4 years agoremove requestmgr whenshutdown events
Evan Hunt [Wed, 11 May 2022 20:55:01 +0000 (13:55 -0700)] 
remove requestmgr whenshutdown events

the request manager has no direct dependency on the
view, so there's no need for a weak reference. remove the
dns_requestmgr_whenshutdown() mechanism since it is no longer
used.

4 years agoremove resolver whenshutdown events
Evan Hunt [Wed, 11 May 2022 20:55:01 +0000 (13:55 -0700)] 
remove resolver whenshutdown events

weakly attaching and detaching when creating and destroying the
resolver obviates the need to have a callback event to do the weak
detach. remove the dns_resolver_whenshutdown() mechanism, as it is
now unused.

4 years agoremove ADB whenshutdown events
Evan Hunt [Wed, 11 May 2022 20:55:01 +0000 (13:55 -0700)] 
remove ADB whenshutdown events

weakly attaching and detaching the view when creating or destroying
the ADB obviates the need for a whenshutdown callback event to do
the detaching.  remove the dns_adb_whenshutdown() mechanism, since
it is no longer needed.

4 years agomove ADB and resolver stats out of the view object
Evan Hunt [Wed, 11 May 2022 22:38:54 +0000 (15:38 -0700)] 
move ADB and resolver stats out of the view object

for better object separation, ADB and resolver statistics counters
are now stored in the ADB and resolver objects themsevles, rather than
in the associated view.

4 years agoremove view->attributes field
Evan Hunt [Wed, 11 May 2022 21:18:45 +0000 (14:18 -0700)] 
remove view->attributes field

it's not necessary to use view attributes to determine whether
the ADB, resolver and requestmgr need to be shut down; checking
whether they're NULL is sufficient.

4 years agothe validator can attach to the view normally
Evan Hunt [Wed, 11 May 2022 19:15:46 +0000 (12:15 -0700)] 
the validator can attach to the view normally

dns_view_weakattach() and _weakdetach() are used by objects that
are created by the view and need it to persist until they are
destroyed, but don't need to prevent it from being shut down. the
validator can use normal view references instead of weak references.

4 years agofixed a possible reference leak in dns_resolver_create()
Evan Hunt [Tue, 10 May 2022 19:48:31 +0000 (12:48 -0700)] 
fixed a possible reference leak in dns_resolver_create()

If an error occurred while creating the resolver, the mctx could
remain attached.

4 years agominor view refactoring
Evan Hunt [Tue, 10 May 2022 19:48:31 +0000 (12:48 -0700)] 
minor view refactoring

- eliminate dns_view_flushanddetach(), which was only called from
  one place; instead, we now call a function dns_view_flushonshutdown()
  which sets the view up to flush zones when it is detached normally
  with dns_view_detach().
- cleaned up code in dns_view_create().

4 years agomaybe_cancel_validators() is always called locked
Evan Hunt [Mon, 9 May 2022 19:55:07 +0000 (12:55 -0700)] 
maybe_cancel_validators() is always called locked

there's no longer any need for a parameter to specify whether the
function is called while holding the bucket lock, because all
unlocked uses have been removed.

4 years agoMerge branch '3302-keymgr-updates-key-files-each-run' into 'main'
Matthijs Mekking [Fri, 13 May 2022 12:50:16 +0000 (12:50 +0000)] 
Merge branch '3302-keymgr-updates-key-files-each-run' into 'main'

Fix "keymgr updates key files each run"

Closes #3302

See merge request isc-projects/bind9!6250

4 years agoAdd changes and release notes for #3302
Matthijs Mekking [Tue, 3 May 2022 10:32:45 +0000 (12:32 +0200)] 
Add changes and release notes for #3302

Add a comment to make danger happy.

4 years agoCheck if key metadata is modified before writing
Matthijs Mekking [Tue, 3 May 2022 10:28:31 +0000 (12:28 +0200)] 
Check if key metadata is modified before writing

Add a new parameter to the dst_key structure, mark a key modified if
dst_key_(un)set[bool,num,state,time] is called. Only write out key
files during a keymgr run if the metadata has changed.

4 years agoAdd kasp test for #3302
Matthijs Mekking [Tue, 3 May 2022 10:24:58 +0000 (12:24 +0200)] 
Add kasp test for #3302

Add a test case that triggers a keymgr run that will not trigger any
metadata changes. Ensure that the last status change of the key files
is unmodified.

4 years agoMerge branch 'ondrej-fix-trampoline-locking' into 'main'
Ondřej Surý [Fri, 13 May 2022 10:16:16 +0000 (10:16 +0000)] 
Merge branch 'ondrej-fix-trampoline-locking' into 'main'

Lock the trampoline when attaching

See merge request isc-projects/bind9!6257