]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agoAdd release note and CHANGES for #3743
Matthijs Mekking [Wed, 14 Dec 2022 10:53:28 +0000 (11:53 +0100)] 
Add release note and CHANGES for #3743

3 years agoDon't set EDE in ns_client_aclchecksilent
Matthijs Mekking [Wed, 14 Dec 2022 10:41:10 +0000 (11:41 +0100)] 
Don't set EDE in ns_client_aclchecksilent

The ns_client_aclchecksilent is used to check multiple ACLs before
the decision is made that a query is denied. It is also used to
determine if recursion is available. In those cases we should not
set the extended DNS error "Prohibited".

3 years agoMerge branch '3785-openssl-refactoring-7' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:33:09 +0000 (14:33 +0000)] 
Merge branch '3785-openssl-refactoring-7' into 'main'

Refactor OpenSSL RSA generation to be more readable

Closes #3785

See merge request isc-projects/bind9!7320

3 years agoMerge branch '3785-openssl-refactoring-6' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:22:22 +0000 (14:22 +0000)] 
Merge branch '3785-openssl-refactoring-6' into 'main'

Provide identical BN_GENCB_new shim

Closes #3785

See merge request isc-projects/bind9!7319

3 years agoRefactor OpenSSL RSA generation to be more readable
Timo Teräs [Mon, 26 Dec 2022 15:16:25 +0000 (17:16 +0200)] 
Refactor OpenSSL RSA generation to be more readable

No major code changes. Just reduce the ifdef clutter.

3 years agoProvide identical BN_GENCB_new shim
Timo Teräs [Mon, 26 Dec 2022 14:55:48 +0000 (16:55 +0200)] 
Provide identical BN_GENCB_new shim

Instead of trying to optimize by using a stack local variable
with additional #ifdef logic, use identical implementations of
the upstream functions to reduce #ifdef clutter.

Move the definitions from dst_openssl.h to openssl_shim.h where
rest of the shim is.

3 years agoMerge branch '3785-openssl-refactoring-5' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:20:38 +0000 (14:20 +0000)] 
Merge branch '3785-openssl-refactoring-5' into 'main'

Refactor OpenSSL RSA private key handling

Closes #3785

See merge request isc-projects/bind9!7318

3 years agoRefactor OpenSSL RSA private key handling
Timo Teräs [Mon, 26 Dec 2022 14:29:56 +0000 (16:29 +0200)] 
Refactor OpenSSL RSA private key handling

Instead of trying to enforce one pkey to contain both a private
and a public key pair, refactor the code to have separate public
and private pkeys.

This is a prerequisite for proper openssl 3.0 providers support
and greatly simplifies the code.

3 years agoMerge branch '3768-dns_zonemgr-use-after-free' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:14:41 +0000 (14:14 +0000)] 
Merge branch '3768-dns_zonemgr-use-after-free' into 'main'

Fix a use-after-free bug in dns_zonemgr_releasezone()

Closes #3768

See merge request isc-projects/bind9!7303

3 years agoAdd a CHANGES note for [GL #3768]
Aram Sargsyan [Thu, 5 Jan 2023 15:07:42 +0000 (15:07 +0000)] 
Add a CHANGES note for [GL #3768]

3 years agoFix a use-after-free bug in dns_zonemgr_releasezone()
Aram Sargsyan [Thu, 5 Jan 2023 15:01:35 +0000 (15:01 +0000)] 
Fix a use-after-free bug in dns_zonemgr_releasezone()

The dns_zonemgr_releasezone() function makes a decision to destroy
'zmgr' (based on its references count, after decreasing it) inside
a lock, and then destroys the object outside of the lock.

This causes a race with dns_zonemgr_detach(), which could destroy
the object in the meantime.

Change dns_zonemgr_releasezone() to detach from 'zmgr' and destroy
the object (if needed) using dns_zonemgr_detach(), outside of the
lock.

3 years agoMerge branch '3785-openssl-refactoring-4' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:03:03 +0000 (14:03 +0000)] 
Merge branch '3785-openssl-refactoring-4' into 'main'

Remove non-sensical RSA key compare tests

Closes #3785

See merge request isc-projects/bind9!7317

3 years agoMerge branch '3785-openssl-refactoring-3' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 14:00:07 +0000 (14:00 +0000)] 
Merge branch '3785-openssl-refactoring-3' into 'main'

Refactor OpenSSL RSA exponent bits checking to a helper function

Closes #3785

See merge request isc-projects/bind9!7316

3 years agoRemove non-sensical RSA key compare tests
Timo Teräs [Mon, 26 Dec 2022 20:19:17 +0000 (22:19 +0200)] 
Remove non-sensical RSA key compare tests

The keys tested are not valid RSA keys as a single private
component was modified manually. The key would not pass
basic sanity test.

3 years agoRefactor OpenSSL RSA exponent bits checking to a helper function
Timo Teräs [Mon, 26 Dec 2022 12:25:18 +0000 (14:25 +0200)] 
Refactor OpenSSL RSA exponent bits checking to a helper function

- Make it a separate opensslrsa_check_exponent_bits() function to
  clean up the code a bit
- Always use provider API first if using openssl 3.0, and fallback
  to EVP API for older openssl or if built with engine support
- Use RSA_get0_key() (with shim for openssl 1.0) to avoid memory
  allocations

3 years agoMerge branch '3785-openssl-refactoring-2' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 13:34:41 +0000 (13:34 +0000)] 
Merge branch '3785-openssl-refactoring-2' into 'main'

Refactor OpenSSL RSA type check to opensslrsa_valid_key_alg helper

Closes #3785

See merge request isc-projects/bind9!7315

3 years agoRefactor OpenSSL RSA type check to opensslrsa_valid_key_alg helper
Timo Teräs [Mon, 26 Dec 2022 11:40:38 +0000 (13:40 +0200)] 
Refactor OpenSSL RSA type check to opensslrsa_valid_key_alg helper

Move the repetetive code into a small opensslrsa_valid_key_alg() helper
function.

3 years agoMerge branch '3785-openssl-refactoring-1' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 13:32:59 +0000 (13:32 +0000)] 
Merge branch '3785-openssl-refactoring-1' into 'main'

Remove obsolete and unused EVP_dss1 compat #define

Closes #3785

See merge request isc-projects/bind9!7314

3 years agoRemove obsolete and unused EVP_dss1 compat #define
Timo Teräs [Mon, 26 Dec 2022 08:27:56 +0000 (10:27 +0200)] 
Remove obsolete and unused EVP_dss1 compat #define

3 years agoMerge branch '3671-override-ISC_R_EXISTS-in-findnodeintree' into 'main'
Ondřej Surý [Mon, 9 Jan 2023 12:33:12 +0000 (12:33 +0000)] 
Merge branch '3671-override-ISC_R_EXISTS-in-findnodeintree' into 'main'

Change ISC_R_EXISTS to ISC_R_SUCCESS in dns/rbtdb.c:findnodeintree()

Closes #3671

See merge request isc-projects/bind9!7312

3 years agoChange ISC_R_EXISTS to ISC_R_SUCCESS in dns/rbtdb.c:findnodeintree()
Ondřej Surý [Mon, 9 Jan 2023 11:48:19 +0000 (12:48 +0100)] 
Change ISC_R_EXISTS to ISC_R_SUCCESS in dns/rbtdb.c:findnodeintree()

In the previous refactoring, the findnodeintree() function could return
ISC_R_EXISTS (from dns_db_addnode() call) instead of ISC_R_SUCCESS
leading to node being attached, but never detached.

Change the ISC_R_EXISTS result code returned from dns_rbt_addnode() to
the ISC_R_SUCCESS in the findnodeintree() function (called internally by
dns_db_findnode() and dns_db_findnsec3node()).

3 years agoMerge branch '3678-serve-stale-servfailing-unexpectedly' into 'main'
Matthijs Mekking [Mon, 9 Jan 2023 10:09:47 +0000 (10:09 +0000)] 
Merge branch '3678-serve-stale-servfailing-unexpectedly' into 'main'

Resolve "stale-serve and RPZ put in SERVFAIL cache unexpected record"

Closes #3678

See merge request isc-projects/bind9!7231

3 years agoAdd a CHANGES note for [GL #3678]
Aram Sargsyan [Thu, 17 Nov 2022 14:21:31 +0000 (14:21 +0000)] 
Add a CHANGES note for [GL #3678]

3 years agoConsider non-stale data when in serve-stale mode
Matthijs Mekking [Thu, 17 Nov 2022 13:52:26 +0000 (13:52 +0000)] 
Consider non-stale data when in serve-stale mode

With 'stale-answer-enable yes;' and 'stale-answer-client-timeout off;',
consider the following situation:

A CNAME record and its target record are in the cache, then the CNAME
record expires, but the target record is still valid.

When a new query for the CNAME record arrives, and the query fails,
the stale record is used, and then the query "restarts" to follow
the CNAME target. The problem is that the query's multiple stale
options (like DNS_DBFIND_STALEOK) are not reset, so 'query_lookup()'
treats the restarted query as a lookup following a failed lookup,
and returns a SERVFAIL answer when there is no stale data found in the
cache, even if there is valid non-stale data there available.

With this change, query_lookup() now considers non-stale data in the
cache in the first place, and returns it if it is available.

3 years agoAdd serve-stale CNAME check with stale-answer-client-timeout off
Aram Sargsyan [Thu, 17 Nov 2022 13:48:36 +0000 (13:48 +0000)] 
Add serve-stale CNAME check with stale-answer-client-timeout off

Prime the cache with the following records:

    shortttl.cname.example. 1 IN CNAME longttl.target.example.
    longttl.target.example. 600 IN A 10.53.0.2

Wait for the CNAME record to expire, disable the authoritative server,
and query 'shortttl.cname.example' again, expecting a stale answer.

3 years agoMerge branch '3770-separate-barriers' into 'main'
Evan Hunt [Mon, 9 Jan 2023 03:00:57 +0000 (03:00 +0000)] 
Merge branch '3770-separate-barriers' into 'main'

use separate barriers for "stop" and "listen" operations

Closes #3770

See merge request isc-projects/bind9!7308

3 years agouse separate barriers for "stop" and "listen" operations
Evan Hunt [Sun, 8 Jan 2023 00:30:21 +0000 (16:30 -0800)] 
use separate barriers for "stop" and "listen" operations

On some platforms, when a synchronizing barrier is cleared, one
thread can progress while other threads are still in the process
of releasing the barrier. If a barrier is reused by the progressing
thread during this window, it can cause a deadlock. This can occur if,
for example, we stop listening immediately after we start, because the
stop and listen functions both use socket->barrier.  This has been
addressed by using separate barrier objects for stop and listen.

3 years agoMerge branch 'ondrej/dns_rbtdb-locking-fixups' into 'main'
Ondřej Surý [Sat, 7 Jan 2023 06:15:07 +0000 (06:15 +0000)] 
Merge branch 'ondrej/dns_rbtdb-locking-fixups' into 'main'

Couple of small fixes in dns_rbtdb rwlock refactoring

See merge request isc-projects/bind9!7304

3 years agoDeduplicate DNS_RBTDB_STRONG_RWLOCK_CHECK macros
Ondřej Surý [Fri, 6 Jan 2023 07:49:11 +0000 (08:49 +0100)] 
Deduplicate DNS_RBTDB_STRONG_RWLOCK_CHECK macros

There were couple of redundant macros on both sides of
DNS_RBTDB_STRONG_RWLOCK_CHECK #ifdef block.  Use a single set of
macros, but disable the extra REQUIRES if the #define is not set.

3 years agoExtend expire_header() to check node lock type
Ondřej Surý [Thu, 5 Jan 2023 21:26:23 +0000 (22:26 +0100)] 
Extend expire_header() to check node lock type

Extend the expire_header() to accept the node lock type as one of the
arguments and check whether the the node lock is always write locked +
fix that bug.

While doing that, it was found that expire_header() invocation in
rdataset_expire() passes `false` as a type of tree lock instead of
`isc_rwlocktype_none`.

(Un)fortunately, both values mapped to 0, so no harm was done, but it
has been fixed nevertheless.

3 years agoReplace repetetive _TRYUPGRADE() with _FORCEUPGRADE() macros
Ondřej Surý [Thu, 5 Jan 2023 21:18:40 +0000 (22:18 +0100)] 
Replace repetetive _TRYUPGRADE() with _FORCEUPGRADE() macros

There was a repetetive pattern:

    if (NODE_TRYUPGRADE(&nodelock->lock, nlocktypep) != ISC_R_SUCCESS)
    {
        NODE_UNLOCK(&nodelock->lock, nlocktypep);
        NODE_WRLOCK(&nodelock->lock, nlocktypep);
    }

Instead of doing that over again, introduce new NODE_FORCEUPGRADE()
and TREE_FORCEUPGRADE() that does exactly this code, and simplify
the aforementioned code with just:

    NODE_FORCEUPGRADE(&nodelock->lock, nlocktypep);

3 years agoMerge branch 'ondrej/isc_loop-reference-tracking' into 'main'
Ondřej Surý [Thu, 5 Jan 2023 12:33:19 +0000 (12:33 +0000)] 
Merge branch 'ondrej/isc_loop-reference-tracking' into 'main'

Enhance the isc_loop unit to allow reference count tracking

See merge request isc-projects/bind9!7291

3 years agoEnhance the isc_loop unit to allow reference count tracking
Ondřej Surý [Mon, 2 Jan 2023 12:26:41 +0000 (13:26 +0100)] 
Enhance the isc_loop unit to allow reference count tracking

Use ISC_REFCOUNT_TRACE_{IMPL,DECL} to allow better isc_loop reference
tracking - use `#define ISC_LOOP_TRACE 1` in <isc/loop.h> to enable.

3 years agoMerge branch 'ondrej/enforce-thread-affinity-on-dnsstream' into 'main'
Ondřej Surý [Thu, 5 Jan 2023 12:33:02 +0000 (12:33 +0000)] 
Merge branch 'ondrej/enforce-thread-affinity-on-dnsstream' into 'main'

Enforce strong thread-affinity on StreamDNS sockets

See merge request isc-projects/bind9!7301

3 years agoEnforce strong thread-affinity on StreamDNS sockets
Ondřej Surý [Wed, 4 Jan 2023 17:07:00 +0000 (18:07 +0100)] 
Enforce strong thread-affinity on StreamDNS sockets

Add a check that the isc__nm_streamdns_read(), isc__nm_streamdns_send(),
and isc__nm_streamdns_close() are being called from the matching thread.

3 years agoMerge branch '3766-pin-TCP-dispatch-to-threads' into 'main'
Ondřej Surý [Thu, 5 Jan 2023 08:12:41 +0000 (08:12 +0000)] 
Merge branch '3766-pin-TCP-dispatch-to-threads' into 'main'

Pin the dns_dispatch to threads when reusing

Closes #3766

See merge request isc-projects/bind9!7299

3 years agoPin the dns_dispatch to threads when reusing
Ondřej Surý [Wed, 4 Jan 2023 18:21:14 +0000 (19:21 +0100)] 
Pin the dns_dispatch to threads when reusing

Previously, dns_dispatch_gettcp() could pick a TCP connection created by
different thread - this breaks our contractual promise to DNS dispatch
by using the TCP connection on a different thread than it was created.
Add .tid member to the dns_dispatch_t struct and skip the dispatches
from other threads when looking up a TCP dispatch that we can reuse in
dns_request.

NOTE: This is going to be properly refactored, but this change could be
also backported to 9.18 for better stability and thread-affinity.

3 years agoMerge branch '3640-fix-control-flow' into 'main'
Evan Hunt [Wed, 4 Jan 2023 22:48:16 +0000 (22:48 +0000)] 
Merge branch '3640-fix-control-flow' into 'main'

Fix control flow issues in zone.c

Closes #3640

See merge request isc-projects/bind9!7013

3 years agoFix control flow issues in zone.c
Evan Hunt [Wed, 2 Nov 2022 12:55:50 +0000 (05:55 -0700)] 
Fix control flow issues in zone.c

Since dns_master_dump() can no longer return DNS_R_CONTINUE,
the error recovery code in synchronous calls to zone_dump() had
branches that could no longer be reached. This has been cleaned
up by using a boolean variable to determine whether the write
is asynchronous rather than depending on the result code.

3 years agoMerge branch '3745-delzone-catz' into 'main'
Tony Finch [Wed, 4 Jan 2023 17:04:48 +0000 (17:04 +0000)] 
Merge branch '3745-delzone-catz' into 'main'

Don't crash when rndc delzone encounters a catz member

Closes #3745

See merge request isc-projects/bind9!7232

3 years agoDon't crash when rndc delzone encounters a catz member
Tony Finch [Wed, 14 Dec 2022 16:24:19 +0000 (16:24 +0000)] 
Don't crash when rndc delzone encounters a catz member

This bug was masked in the tests because the `catz` test script did an
`rndc addzone` before an `rndc delzone`. The `addzone` autovivified
the NZF config, so `delzone` worked OK.

This commit swaps the order of two sections of the `catz` test script
so that it uses `delzone` before `addzone`, which provokes a crash
when `delzone` requires a non-NULL NZF config.

To fix the crash, we now try to remove the zone from the NZF config
only if it was dynamically added but not by a catalog zone.

3 years agoMerge branch '3760-cid-432259-sizeof-not-portable-in-lib-dns-remote' into 'main'
Matthijs Mekking [Wed, 4 Jan 2023 07:58:12 +0000 (07:58 +0000)] 
Merge branch '3760-cid-432259-sizeof-not-portable-in-lib-dns-remote' into 'main'

Fix CID 432259: Sizeof not portable (remote.c)

Closes #3760

See merge request isc-projects/bind9!7288

3 years agoFix CID 432259: Sizeof not portable (remote.c)
Matthijs Mekking [Tue, 3 Jan 2023 10:14:26 +0000 (11:14 +0100)] 
Fix CID 432259: Sizeof not portable (remote.c)

The following report suggests that the 'size' parameter in the two
calls to 'isc_mem_get()' should be set to the
'count * sizeof(*tlsnames)' and 'count * sizeof(*keynames)'
respectively.

/lib/dns/remote.c: 117 in dns_remote_init()
111 }
112 } else {
113 remote->keynames = NULL;
114 }
115
116 if (tlsnames != NULL) {

>>>     CID 432259:    (SIZEOF_MISMATCH)
>>>     Passing argument "count * 8UL /* sizeof (tlsnames) */" to
>>> function "isc__mem_get" and then casting the return value to
>>> "dns_name_t **" is suspicious.  In this particular case
>>> "sizeof (dns_name_t **)" happens to be equal to
>>> "sizeof (dns_name_t *)", but this is not a portable assumption.

117 remote->tlsnames = isc_mem_get(mctx, count * sizeof(tlsnames));
118 for (i = 0; i < count; i++) {
119 remote->tlsnames[i] = NULL;
120 }
121 for (i = 0; i < count; i++) {
122 if (tlsnames[i] != NULL) {

/lib/dns/remote.c: 99 in dns_remote_init()
93 memmove(remote->dscps, dscp, count * sizeof(isc_dscp_t));
94 } else {
95 remote->dscps = NULL;
96 }
97
98 if (keynames != NULL) {

>>>     CID 432259:    (SIZEOF_MISMATCH)
>>>     Passing argument "count * 8UL /* sizeof (keynames) */" to
>>> function "isc__mem_get" and then casting the return value to
>>> "dns_name_t **" is suspicious.  In this particular case
>>> "sizeof (dns_name_t **)" happens to be equal to "sizeof
>>> (dns_name_t *)", but this is not a portable assumption.

99  remote->keynames = isc_mem_get(mctx, count * sizeof(keynames));
100  for (i = 0; i < count; i++) {
101 remote->keynames[i] = NULL;
102  }
103  for (i = 0; i < count; i++) {
104 if (keynames[i] != NULL) {

3 years agoMerge branch '3735-fix-rpz-shutdown-bugs' into 'main'
Arаm Sаrgsyаn [Tue, 3 Jan 2023 15:11:08 +0000 (15:11 +0000)] 
Merge branch '3735-fix-rpz-shutdown-bugs' into 'main'

Fix shutdown and error path bugs in the rpz unit

Closes #3735

See merge request isc-projects/bind9!7289

3 years agoAdd a CHANGES note for [GL #3735]
Aram Sargsyan [Tue, 3 Jan 2023 13:27:00 +0000 (13:27 +0000)] 
Add a CHANGES note for [GL #3735]

3 years agoFix an error path bug in rpz.c:update_nodes()
Aram Sargsyan [Tue, 3 Jan 2023 13:34:58 +0000 (13:34 +0000)] 
Fix an error path bug in rpz.c:update_nodes()

When dns_db_createiterator() fails, 'updbit' should not be destroyed
for obvious reasons, i.e. it is NULL.

3 years agoFix a shutdown and error path bugs in rpz.c:update_nodes()
Aram Sargsyan [Tue, 3 Jan 2023 13:24:38 +0000 (13:24 +0000)] 
Fix a shutdown and error path bugs in rpz.c:update_nodes()

When shutting down, or when dns_dbiterator_current() fails, 'node'
shouldn't be detached, because it is NULL at that point.

3 years agoFix a shutdown bug in update_rpz_cb()
Aram Sargsyan [Tue, 3 Jan 2023 13:21:34 +0000 (13:21 +0000)] 
Fix a shutdown bug in update_rpz_cb()

When shutting down, the cleanup path should not try to destroy
'newnodes', because it is NULL at that point.

Introduce another label for the "shuttingdown" scenario.

3 years agoMerge branch '3754-adb-maybe_expire_entry-called-unlocked-bug' into 'main'
Arаm Sаrgsyаn [Tue, 3 Jan 2023 09:01:18 +0000 (09:01 +0000)] 
Merge branch '3754-adb-maybe_expire_entry-called-unlocked-bug' into 'main'

Don't expire an ADB entry without holding the entries lock

Closes #3754

See merge request isc-projects/bind9!7275

3 years agoAdd a CHANGES note for [GL #3754]
Aram Sargsyan [Fri, 23 Dec 2022 14:26:46 +0000 (14:26 +0000)] 
Add a CHANGES note for [GL #3754]

3 years agoDon't expire an ADB entry without holding the entries lock
Aram Sargsyan [Fri, 23 Dec 2022 14:21:03 +0000 (14:21 +0000)] 
Don't expire an ADB entry without holding the entries lock

The clean_namehooks() function does't hold the 'adb->entries_lock'
lock, so calling maybe_expire_entry() is not thread-safe.

Instead of adding a lock/unlock, leave the expiration to later,
e.g. by the get_attached_and_locked_entry() function.

Also fix a couple of comment typos.

3 years agoMerge branch '3761-ubsan-error-in-isc_buffer_reserve' into 'main'
Mark Andrews [Tue, 3 Jan 2023 07:30:21 +0000 (07:30 +0000)] 
Merge branch '3761-ubsan-error-in-isc_buffer_reserve' into 'main'

Resolve "UBSAN error in isc_buffer_reserve"

Closes #3761

See merge request isc-projects/bind9!7285

3 years agoDo not pass NULL pointer to memmove - undefined behaviour
Mark Andrews [Tue, 3 Jan 2023 03:28:11 +0000 (14:28 +1100)] 
Do not pass NULL pointer to memmove - undefined behaviour

Check if 'old_base' is NULL and if so skip calling memmove.

3 years agoMerge branch 'michal/update-copyright-year-to-2023' into 'main'
Michał Kępień [Mon, 2 Jan 2023 13:06:36 +0000 (13:06 +0000)] 
Merge branch 'michal/update-copyright-year-to-2023' into 'main'

Update copyright year to 2023

See merge request isc-projects/bind9!7282

3 years agoUpdate copyright year to 2023
Michał Kępień [Mon, 2 Jan 2023 12:58:00 +0000 (13:58 +0100)] 
Update copyright year to 2023

3 years agoMerge branch 'artem-tls-use-isc-buffer' into 'main'
Artem Boldariev [Fri, 30 Dec 2022 18:35:53 +0000 (18:35 +0000)] 
Merge branch 'artem-tls-use-isc-buffer' into 'main'

TLS: use isc_buffer_t for send requests, reuse isc_buffer_t during send requests

See merge request isc-projects/bind9!7281

3 years agoTLS: use isc_buffer_t for send requests
Artem Boldariev [Thu, 29 Dec 2022 18:03:26 +0000 (20:03 +0200)] 
TLS: use isc_buffer_t for send requests

This commit replaces ad-hoc code for send requests buffer management
within TLS with the one based on isc_buffer_t.

Previous version of the code was trying to use pre-allocated small
buffers to avoid extra allocations. The code would allocate a larger
dynamic buffer when needed. There is no need to have ad-hoc code for
this, as isc_buffer_t now provides this functionality internally.

Additionally to the above, the old version of the code lacked any
logic to reuse the dynamically allocated buffers. Now, as we do not
manage memory buffers, but isc_buffer_t objects, we can implement this
strategy. It can be in particular helpful for longer lasting
connections, as in this case the buffer will adjust itself to the size
of the messages being transferred. That is, it is in particular useful
for XoT, as Stream DNS happen to order send requests in such a way
that the send request will get reused.

3 years agoMerge branch 'aram/dns_dispatch_createtcp-bugfix' into 'main'
Arаm Sаrgsyаn [Wed, 28 Dec 2022 14:18:52 +0000 (14:18 +0000)] 
Merge branch 'aram/dns_dispatch_createtcp-bugfix' into 'main'

Don't pass a NULL pointer to isc_sockaddr_format()

See merge request isc-projects/bind9!7277

3 years agoDon't pass a NULL pointer to isc_sockaddr_format()
Aram Sargsyan [Wed, 28 Dec 2022 12:10:09 +0000 (12:10 +0000)] 
Don't pass a NULL pointer to isc_sockaddr_format()

The 'localaddr' pointer can be NULL, which causes an assertion failure.

Use '&disp->local' instead when printing a debug log message.

3 years agoMerge branch '3714-remove-alt-transfer-source' into 'main'
Matthijs Mekking [Fri, 23 Dec 2022 15:11:25 +0000 (15:11 +0000)] 
Merge branch '3714-remove-alt-transfer-source' into 'main'

Remove setting alternate transfer source

Closes #3714

See merge request isc-projects/bind9!7163

3 years agoAdd CHANGES and release notes for #3714
Matthijs Mekking [Mon, 5 Dec 2022 09:23:12 +0000 (10:23 +0100)] 
Add CHANGES and release notes for #3714

Update release notes, remove the deprecation entry and add a new
removed feature entry.

3 years agoRemove unused dns_remote_t functions
Matthijs Mekking [Mon, 5 Dec 2022 09:21:38 +0000 (10:21 +0100)] 
Remove unused dns_remote_t functions

Now that setting alternate transfer sources is removed, the functions
to check whether all addresses are considered good have become obsolete.

3 years agoRemove setting alternate transfer source from doc
Matthijs Mekking [Mon, 5 Dec 2022 09:18:33 +0000 (10:18 +0100)] 
Remove setting alternate transfer source from doc

Remove any reference to 'alt-transfer-source', 'alt-transfer-source-v6',
and 'use-alt-transfer-source' from the documentation and manual pages.

3 years agoRemove setting alternate transfer source
Matthijs Mekking [Fri, 2 Dec 2022 15:38:52 +0000 (16:38 +0100)] 
Remove setting alternate transfer source

Remove parsing the configuration options 'alt-transfer-source',
'alt-transfer-source-v6', and 'use-alt-transfer-source', and remove
the corresponding code that implements the feature.

3 years agoMerge branch 'matthijs-remote-server-refactor' into 'main'
Matthijs Mekking [Fri, 23 Dec 2022 13:37:14 +0000 (13:37 +0000)] 
Merge branch 'matthijs-remote-server-refactor' into 'main'

Refactor remote servers (primaries, parental agents) in zone.c

See merge request isc-projects/bind9!7110

3 years agoAdd release notes
Matthijs Mekking [Thu, 22 Dec 2022 09:11:20 +0000 (10:11 +0100)] 
Add release notes

The refactor introduces a new way to configure source addresses for
primaries and parental-agents, a new thingy that we should make people
aware of.

3 years agoAdd CHANGES
Matthijs Mekking [Wed, 23 Nov 2022 15:20:50 +0000 (16:20 +0100)] 
Add CHANGES

Mention the refactor of zone.c

3 years agoUse 'source[-v6]' for transfer, notify, checkds
Matthijs Mekking [Wed, 23 Nov 2022 15:15:16 +0000 (16:15 +0100)] 
Use 'source[-v6]' for transfer, notify, checkds

Use the configured 'source' and 'source-v6' when initiating a zone
transfer, sending a notify, or when checking for the DS. Remove the
special code for using alternate transfer sources.

Update some system tests to use the new configuration and make sure
the tests still work.

3 years agoSmall comment change in remote.h header file
Matthijs Mekking [Tue, 22 Nov 2022 15:30:19 +0000 (16:30 +0100)] 
Small comment change in remote.h header file

The documentation for 'dns_remote_addr()' was incorrect (copy paste
error).

3 years agoParse and store new 'source[-v6]' option
Matthijs Mekking [Tue, 22 Nov 2022 10:55:49 +0000 (11:55 +0100)] 
Parse and store new 'source[-v6]' option

Parse the new 'source' and 'source-v6' options and store them with
the corresponding remote servers (parental-agents, primaries, ...).

3 years agoAdd new 'source[-v6]' option for remote servers
Matthijs Mekking [Tue, 13 Dec 2022 16:28:19 +0000 (17:28 +0100)] 
Add new 'source[-v6]' option for remote servers

Add a new way to configure the preferred source address when talking to
remote servers such as primaries and parental-agents. This will
eventually deprecate options such as 'parental-source',
'parental-source-v6', 'transfer-source', etc.

Example of the new configuration:

    parental-agents "parents" port 5353 \
        source 10.10.10.10 port 5354 dscp 54 \
        source-v6 2001:db8::10 port 5355 dscp 55 {
10.10.10.11;
2001:db8::11;
    };

3 years agoRemove functions named_config_[get|put]iplist
Matthijs Mekking [Thu, 10 Nov 2022 10:21:50 +0000 (11:21 +0100)] 
Remove functions named_config_[get|put]iplist

They are unused.

3 years agoRefactor zone.c, use dns_remote_t structure
Matthijs Mekking [Wed, 26 Oct 2022 12:40:30 +0000 (14:40 +0200)] 
Refactor zone.c, use dns_remote_t structure

Use the new dns_remote_t structure for remote server communication to
primaries, parental agents, etc.

3 years agoAdd new files for remote server communication
Matthijs Mekking [Wed, 26 Oct 2022 12:38:19 +0000 (14:38 +0200)] 
Add new files for remote server communication

The dns_remote_t structure is intended to replace the variables in
the structure that deals with remote server communication to primaries,
parental agents, forwarders, etc.

3 years agoMerge branch 'tkrizek/gitignore-fixes' into 'main'
Tom Krizek [Fri, 23 Dec 2022 13:29:12 +0000 (13:29 +0000)] 
Merge branch 'tkrizek/gitignore-fixes' into 'main'

Don't track gitignored files in the repo

See merge request isc-projects/bind9!7264

3 years agoDetect "ignored yet tracked" files in GitLab CI
Michał Kępień [Fri, 23 Dec 2022 12:21:47 +0000 (13:21 +0100)] 
Detect "ignored yet tracked" files in GitLab CI

Ensure that no .gitignore file in the tree contains patterns matching
files tracked by Git by adding a simple script that detects such
situations and running that script as part of the "misc" job in the
"precheck" stage of every GitLab CI pipeline.

3 years agoRemove obsolete gitignore file in mysqldyn
Tom Krizek [Thu, 22 Dec 2022 13:54:32 +0000 (14:54 +0100)] 
Remove obsolete gitignore file in mysqldyn

The Makefile used to be autogenerated prior to
67f76b126900d313b343f563353f8237a6a264d2 which is the reason why the
.gitignore existed in the first place. Since then, a static Makefile is
used and is supposed to be tracked in the git repo.

3 years agoMake gitignore matching in rpzrecurse more precise
Tom Krizek [Thu, 22 Dec 2022 13:46:49 +0000 (14:46 +0100)] 
Make gitignore matching in rpzrecurse more precise

The pre-defined test cases use named.$TESTCASE.conf naming convention,
where TESTCASE is a human readable name contaning actual word(s). The
autogenerated test cases' names always start with a number from 1 to 6.

3 years agoRemove ans.pl system test files from gitignore
Tom Krizek [Thu, 22 Dec 2022 13:28:53 +0000 (14:28 +0100)] 
Remove ans.pl system test files from gitignore

The ans*.pl scripts are part of system tests and should be part of the
repository. The gitignore entires for these files have been removed.

3 years agoRename dig reference files in the rrsetorder test
Tom Krizek [Thu, 22 Dec 2022 13:26:03 +0000 (14:26 +0100)] 
Rename dig reference files in the rrsetorder test

bin/tests/system/rrsetorder/dig.out* files match a gitignore expression
present in bin/tests/system/.gitignore.  Since these are meant to be
reference files that are compared to the files generated when the
"rrsetorder" system test is run, rename them to avoid listing tracked
files in .gitignore files.

3 years agoMerge branch '3752-resolver-adb-quota-bug' into 'main'
Arаm Sаrgsyаn [Fri, 23 Dec 2022 10:23:29 +0000 (10:23 +0000)] 
Merge branch '3752-resolver-adb-quota-bug' into 'main'

Fix an ADB quota management bug in the resolver

Closes #3752

See merge request isc-projects/bind9!7266

3 years agoAdd CHANGES and release notes for [GL #3752]
Aram Sargsyan [Thu, 22 Dec 2022 14:01:47 +0000 (14:01 +0000)] 
Add CHANGES and release notes for [GL #3752]

3 years agoFix an ADB quota management error in the resolver
Aram Sargsyan [Thu, 22 Dec 2022 13:48:33 +0000 (13:48 +0000)] 
Fix an ADB quota management error in the resolver

Normally, when a 'resquery_t' object is created in fctx_query(),
we call dns_adb_beginudpfetch() (which increases the ADB quota)
only if it's a UDP query. Then, in fctx_cancelquery(), we call
dns_adb_endudpfetch() to decreases back the ADB quota, again only
if it's a UDP query.

The problem is that a UDP query can become a TCP query, preventing
the quota from adjusting back in fctx_cancelquery() later.

Call dns_adb_beginudpfetch() also when switching the query type
from UDP to TCP.

3 years agoINSIST that active quota is 0 in destroy_adbentry()
Aram Sargsyan [Thu, 22 Dec 2022 13:43:47 +0000 (13:43 +0000)] 
INSIST that active quota is 0 in destroy_adbentry()

This should catch ADB quota management errors in the resolver.

3 years agoMerge branch '3748-rename-tls-caches-creation-functions' into 'main'
Artem Boldariev [Fri, 23 Dec 2022 09:13:56 +0000 (09:13 +0000)] 
Merge branch '3748-rename-tls-caches-creation-functions' into 'main'

Rename isc_tlsctx_cache_new() to isc_tlsctx_cache_create(), tlsctx_client_session_cache_new() to tlsctx_client_session_create()

Closes #3748

See merge request isc-projects/bind9!7269

3 years agotlsctx_client_session_cache_new() -> tlsctx_client_session_create()
Artem Boldariev [Thu, 22 Dec 2022 18:04:22 +0000 (20:04 +0200)] 
tlsctx_client_session_cache_new() -> tlsctx_client_session_create()

Additionally to renaming, it changes the function definition so that
it accepts a pointer to pointer instead of returning a pointer to the
new object.

It is mostly done to make it in line with other functions in the
module.

3 years agoRename isc_tlsctx_cache_new() -> isc_tlsctx_cache_create()
Artem Boldariev [Thu, 22 Dec 2022 17:54:16 +0000 (19:54 +0200)] 
Rename isc_tlsctx_cache_new() -> isc_tlsctx_cache_create()

Additionally to renaming, it changes the function definition so that
it accepts a pointer to pointer instead of returning a pointer to the
new object.

It is mostly done to make it in line with other functions in the
module.

3 years agoMerge branch 'tkrizek/dangerfile-backport-tweaks' into 'main'
Tom Krizek [Fri, 23 Dec 2022 08:50:10 +0000 (08:50 +0000)] 
Merge branch 'tkrizek/dangerfile-backport-tweaks' into 'main'

danger CI: tweak backport check and add Affects label check

See merge request isc-projects/bind9!7253

3 years agodanger: check the Affects labels are set
Tom Krizek [Mon, 19 Dec 2022 14:14:48 +0000 (15:14 +0100)] 
danger: check the Affects labels are set

Unless the MR is a backport, the Affects labels should be used to
indicate which versions are affected by the issue that prompted the MR.

3 years agodanger: check version in MR title
Tom Krizek [Mon, 19 Dec 2022 13:43:16 +0000 (14:43 +0100)] 
danger: check version in MR title

Enforce the version indicator to be at the start of the MR title.

3 years agoMerge tag 'v9_19_8'
Tom Krizek [Thu, 22 Dec 2022 09:13:38 +0000 (10:13 +0100)] 
Merge tag 'v9_19_8'

BIND 9.19.8

3 years agoMerge branch '3750-legacy-system-test-dig-timed-out-fix' into 'main'
Arаm Sаrgsyаn [Wed, 21 Dec 2022 14:40:43 +0000 (14:40 +0000)] 
Merge branch '3750-legacy-system-test-dig-timed-out-fix' into 'main'

Fix DiG "timed out" message check in "legacy" system test

Closes #3750

See merge request isc-projects/bind9!7259

3 years agoFix DiG "timed out" message check in "legacy" system test
Aram Sargsyan [Wed, 21 Dec 2022 13:52:22 +0000 (13:52 +0000)] 
Fix DiG "timed out" message check in "legacy" system test

The test expects a "connection timed out" message from DiG when it
experiences a timeout, while the current version of DiG prints just
a "timed out" message, like below:

    ;; communications error to 10.53.0.1#11314: timed out
    ;; communications error to 10.53.0.1#11314: timed out
    ;; communications error to 10.53.0.1#11314: timed out

    ; <<>> DiG 9.19.9-dev <<>> -p 11314 +tries +time +tcp +tries +time @10.53.0.1 dropedns. TXT
    ; (1 server found)
    ;; global options: +cmd
    ;; no servers could be reached

Change the expected string to match the current DiG output.

Use the '-F' switch for "grep" for matching a fixed string.

3 years agoMerge branch 'tkrizek/system-tests-conventions' into 'main'
Tom Krizek [Wed, 21 Dec 2022 12:42:27 +0000 (12:42 +0000)] 
Merge branch 'tkrizek/system-tests-conventions' into 'main'

Unify system tests naming conventions

See merge request isc-projects/bind9!7150

3 years agoUpdate tests gitignore file
Tom Krizek [Wed, 21 Dec 2022 11:52:08 +0000 (12:52 +0100)] 
Update tests gitignore file

The .mypy_cache was added to the system test dir gitignore, since it
should be ignored.

3 years agoRename engine_pkcs11 system test
Tom Krizek [Fri, 2 Dec 2022 15:51:36 +0000 (16:51 +0100)] 
Rename engine_pkcs11 system test

In order to have a common naming convention for system tests, rename the
only outlier "engine_pkcs11" to "enginepkcs11", which was the only
system test using an underscore in its name.

The only allowed word separators for system test names are either dash
or no separator.

3 years agoUse common name convention for pytest files
Tom Krizek [Fri, 14 Oct 2022 09:12:53 +0000 (11:12 +0200)] 
Use common name convention for pytest files

It is better to use consistent file names to avoid issue with sorting
etc.

Using underscore in filenames as opposed to dash was chosen because it
seems more common in pytest/python to use underscore for filenames.

Also rename the bin/tests/system/timeouts/tests-tcp.py file to
bin/tests/system/timeouts/tests_tcp_timeouts.py to avoid pytest name
collision (there can't be two files named tests_tcp.py).

3 years agoMerge branch 'artem-add-missing-dnsstream-test-header-to-the-makefile-am' into 'main'
Artem Boldariev [Wed, 21 Dec 2022 12:18:36 +0000 (12:18 +0000)] 
Merge branch 'artem-add-missing-dnsstream-test-header-to-the-makefile-am' into 'main'

Add missing "dnsstream_utils_test_data.h" to the Makefile.am

See merge request isc-projects/bind9!7256

3 years agoAdd missing "dnsstream_utils_test_data.h" to the Makefile.am
Artem Boldariev [Wed, 21 Dec 2022 10:37:44 +0000 (12:37 +0200)] 
Add missing "dnsstream_utils_test_data.h" to the Makefile.am

This commit ensures that "dnsstream_utils_test_data.h" is referenced
by Makefile.am and, thus, is not missing from a created tarball.

3 years agoMerge branch '3178-dispatch-race-fix' into 'main'
Ondřej Surý [Wed, 21 Dec 2022 11:49:09 +0000 (11:49 +0000)] 
Merge branch '3178-dispatch-race-fix' into 'main'

Fix more issues in the dns_dispatch unit

Closes #3178

See merge request isc-projects/bind9!7252