]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
4 years agoRemove EVP_CIPHER_CTX_new() and EVP_CIPHER_CTX_free() shims
Aram Sargsyan [Fri, 25 Feb 2022 08:41:36 +0000 (08:41 +0000)] 
Remove EVP_CIPHER_CTX_new() and EVP_CIPHER_CTX_free() shims

LibreSSL 3.5.0 fails to compile with these shims. We could have just
removed the LibreSSL check from the pre-processor condition, but it
seems that these shims are no longer needed because all the supported
versions of OpenSSL and LibreSSL have those functions.

According to EVP_ENCRYPTINIT(3) manual page in LibreSSL,
EVP_CIPHER_CTX_new() and EVP_CIPHER_CTX_free() first appeared in
OpenSSL 0.9.8b, and have been available since OpenBSD 4.5.

4 years agoMerge branch '3174-fix-zone-documentation' into 'main'
Evan Hunt [Wed, 2 Mar 2022 09:57:04 +0000 (09:57 +0000)] 
Merge branch '3174-fix-zone-documentation' into 'main'

fix zone documentation in named.conf man page

Closes #3174

See merge request isc-projects/bind9!5907

4 years agodocument zone grammar more correctly
Evan Hunt [Thu, 24 Feb 2022 01:36:11 +0000 (17:36 -0800)] 
document zone grammar more correctly

the "zone" clause can be documented using, for instance,
`cfg_test --zonegrammar primary", which prints only
options that are valid in primary zones. this was not
the method being used when generating the named.conf
man page; instead, "zone" was documented with all possible
options, and no zone types at all.

this commit removes "zone" from the generic documentation
and adds include statements in named.conf.rst so that
correct zone grammars will be included in the man page.

4 years agoMerge branch '3175-add-missing-grow-data-call-in-isc-lex-gettoken' into 'main'
Mark Andrews [Wed, 2 Mar 2022 00:35:16 +0000 (00:35 +0000)] 
Merge branch '3175-add-missing-grow-data-call-in-isc-lex-gettoken' into 'main'

Grow the lex token buffer in one more place

Closes #3175

See merge request isc-projects/bind9!5916

4 years agoAdd CHANGES note for [GL #3175]
Mark Andrews [Mon, 28 Feb 2022 01:01:02 +0000 (12:01 +1100)] 
Add CHANGES note for [GL #3175]

4 years agoAdd seed that demonstrated INSIST triggered in isc_lex_gettoken
Mark Andrews [Mon, 28 Feb 2022 01:04:55 +0000 (12:04 +1100)] 
Add seed that demonstrated INSIST triggered in isc_lex_gettoken

this is similar to the input found by ClusterFuzz Issue 45027 with
the 0xff characters replaced for readability.

4 years agoGrow the lex token buffer in one more place
Mark Andrews [Mon, 28 Feb 2022 00:47:56 +0000 (11:47 +1100)] 
Grow the lex token buffer in one more place

when parsing key pairs, if the '=' character fell at max_token
a protective INSIST preventing buffer overrun could be triggered.
Attempt to grow the buffer immediately before the INSIST.

Also removed an unnecessary INSIST on the opening double quote
of key buffer pair.

4 years agoMerge branch '3176-issue-45110-by-clusterfuzz-external-bind9-dns_master_load_fuzzer...
Mark Andrews [Wed, 2 Mar 2022 00:02:09 +0000 (00:02 +0000)] 
Merge branch '3176-issue-45110-by-clusterfuzz-external-bind9-dns_master_load_fuzzer-undefined-shift-in-soa_get' into 'main'

Resolve "Issue 45110 by ClusterFuzz-External: bind9:dns_master_load_fuzzer: Undefined-shift in soa_get"

Closes #3176

See merge request isc-projects/bind9!5909

4 years agoUse unsigned arithmetic when shifting by 24
Mark Andrews [Mon, 28 Feb 2022 02:43:20 +0000 (13:43 +1100)] 
Use unsigned arithmetic when shifting by 24

By default C promotes short unsigned values to signed int which
leads to undefined behaviour when the value is shifted by too much.
Force unsigned arithmetic to be perform by explicitly casting to a
unsigned type.

4 years agoMerge branch '3177-add-missing-isc_nm_tcpsocket-to-isc__nmsocket_reset' into 'main'
Ondřej Surý [Mon, 28 Feb 2022 10:14:01 +0000 (10:14 +0000)] 
Merge branch '3177-add-missing-isc_nm_tcpsocket-to-isc__nmsocket_reset' into 'main'

Handle TCP sockets in isc__nmsocket_reset()

Closes #3177

See merge request isc-projects/bind9!5910

4 years agoHandle TCP sockets in isc__nmsocket_reset()
Ondřej Surý [Mon, 28 Feb 2022 09:25:06 +0000 (10:25 +0100)] 
Handle TCP sockets in isc__nmsocket_reset()

The isc__nmsocket_reset() was missing a case for raw TCP sockets (used
by RNDC and DoH) which would case a assertion failure when write timeout
would be triggered.

TCP sockets are now also properly handled in isc__nmsocket_reset().

4 years agoMerge branch 'each-mem-maybedup' into 'main'
Evan Hunt [Sat, 26 Feb 2022 10:39:37 +0000 (10:39 +0000)] 
Merge branch 'each-mem-maybedup' into 'main'

mem_maybedup() can no longer fail

See merge request isc-projects/bind9!5835

4 years agoReturn ISC_R_NOTIMPLEMENTED rather than ISC_R_UNEXPECTEDEND
Mark Andrews [Tue, 22 Feb 2022 01:29:41 +0000 (12:29 +1100)] 
Return ISC_R_NOTIMPLEMENTED rather than ISC_R_UNEXPECTEDEND

If the keydata rdata is shorter that 16 octets it is not out private
keydata type and we have not implemented a tostruct method for it.

4 years agoDo not return ISC_R_UNEXPECTEDEND
Mark Andrews [Tue, 22 Feb 2022 01:27:17 +0000 (12:27 +1100)] 
Do not return ISC_R_UNEXPECTEDEND

All rdata passed to dns_rdata_tostruct is supposed to be well formed,
assert if it isn't.

4 years agomem_maybedup() can no longer fail
Evan Hunt [Mon, 14 Feb 2022 21:05:03 +0000 (13:05 -0800)] 
mem_maybedup() can no longer fail

mem_maybedup() calls isc_mem_allocate() if an mctx is supplied,
but that can no longer fail, so now the only way mem_maybedup()
could return NULL is if it was given a NULL source address by the
caller. this commit adds a REQUIRE to prevent that scenario, and
cleans up all the calling code that previously checked for NULL
return values.

this function is mostly used in rdata tostruct() implementations, so
the documentation for dns_rdata_tostruct() has been updated to
remove 'ISC_R_NOMEMORY' as a possible return value.

4 years agoMerge branch '2802-fix-missed-occurrences-of-renaming-masters-to-primaries' into...
Evan Hunt [Sat, 26 Feb 2022 00:51:05 +0000 (00:51 +0000)] 
Merge branch '2802-fix-missed-occurrences-of-renaming-masters-to-primaries' into 'main'

Resolve "Fix missed occurrences of renaming masters to primaries"

Closes #2802

See merge request isc-projects/bind9!5860

4 years agoremove old zone type documentation
Evan Hunt [Thu, 24 Feb 2022 01:18:38 +0000 (17:18 -0800)] 
remove old zone type documentation

we now document zone type as either "primary" or "secondary",
omitting the old terms (though they are still accepted).

4 years agoadd a CFG_CLAUSEFLAG_NODOC flag for use with outdated terms
Evan Hunt [Sat, 26 Feb 2022 00:33:30 +0000 (16:33 -0800)] 
add a CFG_CLAUSEFLAG_NODOC flag for use with outdated terms

"masters" and "default-masters" are now flagged so they will
not be included in the named.conf man page, despite being
accepted as valid options by the parser for backward
compatibiility.

4 years agoMerge branch '3170-tiny-typo-in-doc-build-script' into 'main'
Mark Andrews [Thu, 24 Feb 2022 13:45:37 +0000 (13:45 +0000)] 
Merge branch '3170-tiny-typo-in-doc-build-script' into 'main'

Fix typo in exclude pattern in doc build configuration

Closes #3170

See merge request isc-projects/bind9!5899

4 years agocorrectly exclude logging-categories.rst
Mark Andrews [Thu, 24 Feb 2022 06:56:52 +0000 (17:56 +1100)] 
correctly exclude logging-categories.rst

4 years agoMerge branch 'pspacek/fuzz-rdata-from-text' into 'main'
Petr Špaček [Thu, 24 Feb 2022 10:30:59 +0000 (10:30 +0000)] 
Merge branch 'pspacek/fuzz-rdata-from-text' into 'main'

Add dns_rdata_fromtext() fuzzer

See merge request isc-projects/bind9!4718

4 years agoAdd dns_rdata_fromtext() fuzzer
Petr Špaček [Thu, 18 Feb 2021 20:29:33 +0000 (21:29 +0100)] 
Add dns_rdata_fromtext() fuzzer

... along with dns_rdataclass_fromtext and dns_rdatatype_fromtext

Most of the test binary is modified named-rrchecker. Main differences:
- reads single RR and exists
- does not refuse meta classes and rr types
We actually do have some fromtext code for meta-things so erroring out
in named-rrchecker would prevent us from testing this code.

Corpus has examples of all currently supported RR types. I did not do
any minimization.

In future use command

    diff -U0 \
<(sed -n -e 's/^.*fromtext_\(.*\)(.*$/\1/p' lib/dns/code.h | \
sort) \
<(ls fuzz/dns_rdata_fromtext.in/)

to check for missing RR types.

4 years agoFix configure options in FUZZING.md
Petr Špaček [Fri, 19 Feb 2021 14:32:05 +0000 (15:32 +0100)] 
Fix configure options in FUZZING.md

4 years agoMerge branch 'pspacek/fuzz_zonefile' into 'main'
Petr Špaček [Thu, 24 Feb 2022 09:12:16 +0000 (09:12 +0000)] 
Merge branch 'pspacek/fuzz_zonefile' into 'main'

Add dns_master_loadbuffer() fuzzer

See merge request isc-projects/bind9!4719

4 years agoAdd dns_master_loadbuffer() fuzzer
Petr Špaček [Fri, 19 Feb 2021 17:08:36 +0000 (18:08 +0100)] 
Add dns_master_loadbuffer() fuzzer

Corpus focuses on "extra" things in master files like $GENERATE etc.
Text encoding for RRs is thoroughly tested in dns_rdata_fromtext
fuzzer.

4 years agoMerge branch '3166-disable-inactivehandles-caching-with-address-sanitizer-fix' into...
Ondřej Surý [Wed, 23 Feb 2022 23:45:18 +0000 (23:45 +0000)] 
Merge branch '3166-disable-inactivehandles-caching-with-address-sanitizer-fix' into 'main'

Disable inactive uvreqs caching when compiled with sanitizers

Closes #3166

See merge request isc-projects/bind9!5898

4 years agoFix typo __SANITIZE_ADDRESS -> __SANITIZE_ADDRESS__
Ondřej Surý [Wed, 23 Feb 2022 23:11:45 +0000 (00:11 +0100)] 
Fix typo __SANITIZE_ADDRESS -> __SANITIZE_ADDRESS__

When checking for Address Sanitizer to disable the inactivehandles
caching, there was a typo in the macro.

4 years agoDisable inactive uvreqs caching when compiled with sanitizers
Ondřej Surý [Wed, 23 Feb 2022 23:14:26 +0000 (00:14 +0100)] 
Disable inactive uvreqs caching when compiled with sanitizers

When isc__nm_uvreq_t gets deactivated, it could be just put onto array
stack to be reused later to save some initialization time.
Unfortunately, this might hide some use-after-free errors.

Disable the inactive uvreqs caching when compiled with Address or
Thread Sanitizer.

4 years agoMerge branch '3166-disable-inactivehandles-caching-with-address-sanitizer' into ...
Ondřej Surý [Wed, 23 Feb 2022 22:22:53 +0000 (22:22 +0000)] 
Merge branch '3166-disable-inactivehandles-caching-with-address-sanitizer' into 'main'

Disable inactive handles caching when compiled with sanitizers

Closes #3166

See merge request isc-projects/bind9!5879

4 years agoDisable inactive handles caching when compiled with sanitizers
Ondřej Surý [Wed, 23 Feb 2022 08:12:51 +0000 (09:12 +0100)] 
Disable inactive handles caching when compiled with sanitizers

When isc_nmhandle_t gets deactivated, it could be just put onto array
stack to be reused later to safe some initialization time.
Unfortunately, this might hide some use-after-free errors.

Disable the inactive handles caching when compiled with Address or
Thread Sanitizer.

4 years agoMerge branch '3167-remove-isc__nmsocket_t-ah_handles' into 'main'
Ondřej Surý [Wed, 23 Feb 2022 22:13:31 +0000 (22:13 +0000)] 
Merge branch '3167-remove-isc__nmsocket_t-ah_handles' into 'main'

Remove active handles tracking from isc__nmsocket_t

Closes #3147 and #3167

See merge request isc-projects/bind9!5878

4 years agoRemove active handles tracking from isc__nmsocket_t
Ondřej Surý [Wed, 23 Feb 2022 07:54:49 +0000 (08:54 +0100)] 
Remove active handles tracking from isc__nmsocket_t

The isc__nmsocket_t has locked array of isc_nmhandle_t that's not used
for anything.  The isc__nmhandle_get() adds the isc_nmhandle_t to the
locked array (and resized if necessary) and removed when
isc_nmhandle_put() finally destroys the handle.  That's all it does, so
it serves no useful purpose.

Remove the .ah_handles, .ah_size, and .ah_frees members of the
isc__nmsocket_t and .ah_pos member of the isc_nmhandle_t struct.

4 years agoDelay isc__nm_uvreq_t deallocation to connection callback
Ondřej Surý [Tue, 22 Feb 2022 17:12:18 +0000 (18:12 +0100)] 
Delay isc__nm_uvreq_t deallocation to connection callback

When the TCP, TCPDNS or TLSDNS connection times out, the isc__nm_uvreq_t
would be pushed into sock->inactivereqs before the uv_tcp_connect()
callback finishes.  Because the isc__nmsocket_t keeps the list of
inactive isc__nm_uvreq_t, this would cause use-after-free only when the
sock->inactivereqs is full (which could never happen because the failure
happens in connection timeout callback) or when the sock->inactivereqs
mechanism is completely removed (f.e. when running under Address or
Thread Sanitizer).

Delay isc__nm_uvreq_t deallocation to the connection callback and only
signal the connection callback should be called by shutting down the
libuv socket from the connection timeout callback.

4 years agoMerge branch 'ondrej-cleanup-nm_destroy-dequeue' into 'main'
Ondřej Surý [Wed, 23 Feb 2022 21:52:49 +0000 (21:52 +0000)] 
Merge branch 'ondrej-cleanup-nm_destroy-dequeue' into 'main'

Properly free up enqueued netievents in nm_destroy()

See merge request isc-projects/bind9!5888

4 years agoProperly free up enqueued netievents in nm_destroy()
Ondřej Surý [Wed, 23 Feb 2022 21:04:05 +0000 (22:04 +0100)] 
Properly free up enqueued netievents in nm_destroy()

When the isc_netmgr is being destroyed, the normal and priority queues
should be dequeued and netievents properly freed.  This wasn't the case.

4 years agoMerge branch '3147-fix-more-ns_statscounter_recursclients-underflows' into 'main'
Michał Kępień [Wed, 23 Feb 2022 13:42:43 +0000 (13:42 +0000)] 
Merge branch '3147-fix-more-ns_statscounter_recursclients-underflows' into 'main'

Fix more ns_statscounter_recursclients underflows

Closes #3147

See merge request isc-projects/bind9!5870

4 years agoAdd CHANGES entry for GL #3147
Michał Kępień [Wed, 23 Feb 2022 13:39:11 +0000 (14:39 +0100)] 
Add CHANGES entry for GL #3147

4 years agoAdd release note for GL #3147
Michał Kępień [Wed, 23 Feb 2022 13:39:11 +0000 (14:39 +0100)] 
Add release note for GL #3147

4 years agoFix more ns_statscounter_recursclients underflows
Michał Kępień [Wed, 23 Feb 2022 13:39:11 +0000 (14:39 +0100)] 
Fix more ns_statscounter_recursclients underflows

Commit aab691d51266f552a7923db32686fb9398b1d255 did not fix all possible
scenarios in which the ns_statscounter_recursclients counter underflows.
The solution implemented therein can be ineffective e.g. when CNAME
chaining happens with prefetching enabled.

Here is an example recursive resolution scenario in which the
ns_statscounter_recursclients counter can underflow with the current
logic in effect:

 1. Query processing starts, the answer is not found in the cache, so
    recursion is started.  The NS_CLIENTATTR_RECURSING attribute is set.
    ns_statscounter_recursclients is incremented (Δ = +1).

 2. Recursion completes, returning a CNAME.  client->recursionquota is
    non-NULL, so the NS_CLIENTATTR_RECURSING attribute remains set.
    ns_statscounter_recursclients is decremented (Δ = 0).

 3. Query processing restarts.

 4. The current QNAME (the target of the CNAME from step 2) is found in
    the cache, with a TTL low enough to trigger a prefetch.

 5. query_prefetch() attaches to client->recursionquota.
    ns_statscounter_recursclients is not incremented because
    query_prefetch() does not do that (Δ = 0).

 6. Query processing restarts.

 7. The current QNAME (the target of the CNAME from step 4) is not found
    in the cache, so recursion is started.  client->recursionquota is
    already attached to (since step 5) and the NS_CLIENTATTR_RECURSING
    attribute is set (since step 1), so ns_statscounter_recursclients is
    not incremented (Δ = 0).

 8. The prefetch from step 5 completes.  client->recursionquota is
    detached from in prefetch_done().  ns_statscounter_recursclients is
    not decremented because prefetch_done() does not do that (Δ = 0).

 9. Recursion for the current QNAME completes.  client->recursionquota
    is already detached from, i.e. set to NULL (since step 8), and the
    NS_CLIENTATTR_RECURSING attribute is set (since step 1), so
    ns_statscounter_recursclients is decremented (Δ = -1).

Another possible scenario is that after step 7, recursion for the target
of the CNAME from step 4 completes before the prefetch for the CNAME
itself.  fetch_callback() then notices that client->recursionquota is
non-NULL and decrements ns_statscounter_recursclients, even though
client->recursionquota was attached to by query_prefetch() and therefore
not accompanied by an incrementation of ns_statscounter_recursclients.
The net result is also an underflow.

Instead of trying to properly handle all possible orderings of events
set into motion by normal recursion and prefetch-triggered recursion,
adjust ns_statscounter_recursclients whenever the recursive clients
quota is successfully attached to or detached from.  Remove the
NS_CLIENTATTR_RECURSING attribute altogether as its only purpose is made
obsolete by this change.

4 years agoMerge branch 'pspacek/windows-bat-removal' into 'main'
Petr Špaček [Tue, 22 Feb 2022 15:05:01 +0000 (15:05 +0000)] 
Merge branch 'pspacek/windows-bat-removal' into 'main'

Remove leftover .bat file

See merge request isc-projects/bind9!5875

4 years agoRemove last .bat file from the source tree
Petr Špaček [Tue, 22 Feb 2022 14:53:16 +0000 (15:53 +0100)] 
Remove last .bat file from the source tree

This fixes an omission in !5739, "Remove leftover test code for Windows".

4 years agoMerge branch '3164-fix-parental-agents-documentation' into 'main'
Matthijs Mekking [Tue, 22 Feb 2022 13:20:46 +0000 (13:20 +0000)] 
Merge branch '3164-fix-parental-agents-documentation' into 'main'

Fix typo in DNSSEC guide parental-agents example

Closes #3164

See merge request isc-projects/bind9!5872

4 years agoFix typo in DNSSEC guide parental-agents example
Matthijs Mekking [Tue, 22 Feb 2022 10:48:28 +0000 (11:48 +0100)] 
Fix typo in DNSSEC guide parental-agents example

The example will not load because of the typo, the comma should be a
semicolon.

4 years agoMerge branch 'michal/handle-fctx-in-FCTXTRACE-macro-stubs' into 'main'
Michał Kępień [Mon, 21 Feb 2022 09:53:26 +0000 (09:53 +0000)] 
Merge branch 'michal/handle-fctx-in-FCTXTRACE-macro-stubs' into 'main'

Add "UNUSED(fctx);" to FCTXTRACE*() macro stubs

See merge request isc-projects/bind9!5867

4 years agoAdd "UNUSED(fctx);" to FCTXTRACE*() macro stubs
Michał Kępień [Mon, 21 Feb 2022 09:50:38 +0000 (10:50 +0100)] 
Add "UNUSED(fctx);" to FCTXTRACE*() macro stubs

Commit b6d40b3c4e4452cee6f7f06d889e4e8d113e9588 removed most uses of the
'fctx' variable from the rctx_dispfail() function: it is now only needed
by the FCTXTRACE3() macro.  However, when --enable-querytrace is not in
effect, that macro evaluates to a list of UNUSED() macros that does not
include "UNUSED(fctx);".  This triggers the following compilation
warning when building without --enable-querytrace:

    resolver.c: In function 'rctx_dispfail':
    resolver.c:7888:21: warning: unused variable 'fctx' [-Wunused-variable]
     7888 |         fetchctx_t *fctx = rctx->fctx;
          |                     ^~~~

Fix by adding "UNUSED(fctx);" lines to all FCTXTRACE*() macros.  This is
safe to do because all of those macros use the 'fctx' local variable, so
there is no danger of introducing new errors caused by use of undeclared
identifiers.

4 years agoMerge branch '3140-make-keep-response-order-obsolete' into 'main'
Ondřej Surý [Fri, 18 Feb 2022 21:37:39 +0000 (21:37 +0000)] 
Merge branch '3140-make-keep-response-order-obsolete' into 'main'

Declare the keep-response-order obsolete

Closes #3140

See merge request isc-projects/bind9!5852

4 years agoAdd CHANGES and release note for [GL #3140]
Ondřej Surý [Thu, 10 Feb 2022 10:44:42 +0000 (11:44 +0100)] 
Add CHANGES and release note for [GL #3140]

4 years agoDowngrade -Wstringop-overread from error to warning
Ondřej Surý [Thu, 27 Jan 2022 11:34:15 +0000 (12:34 +0100)] 
Downgrade -Wstringop-overread from error to warning

Due to a bug in gcc-11, the build fails when AddressSanitizer is
enabled.  Downgrading the -Wstringop-overread to just a warning in the
gcc:asan build allows the code to compile.

4 years agoRemove the keep-response-order system test
Ondřej Surý [Thu, 10 Feb 2022 16:36:08 +0000 (17:36 +0100)] 
Remove the keep-response-order system test

Remove the keep-response-order from the system test and cleanup the
pipelined system test to be shell check clean and use the helper
functions.

4 years agoRemove the keep-response-order ACL map
Ondřej Surý [Thu, 27 Jan 2022 09:09:07 +0000 (10:09 +0100)] 
Remove the keep-response-order ACL map

The keep-response-order option has been obsoleted, and in this commit,
remove the keep-response-order ACL map rendering the option no-op, the
call the isc_nm_sequential() and the now unused isc_nm_sequential()
function itself.

4 years agoDeclare the keep-response-order obsolete
Ondřej Surý [Thu, 27 Jan 2022 09:13:10 +0000 (10:13 +0100)] 
Declare the keep-response-order obsolete

The keep-response-order option has been introduced when TCP pipelining
has been introduced to BIND 9 as a failsafe for possibly non-compliant
clients.

Declare the keep-response-order obsolete as all DNS clients should
either support out-of-order processing or don't send more DNS queries
until the DNS response for the previous one has been received.

4 years agoMerge branch '3141-remove-the-artificial-stream-clients-limit' into 'main'
Evan Hunt [Fri, 18 Feb 2022 00:40:45 +0000 (00:40 +0000)] 
Merge branch '3141-remove-the-artificial-stream-clients-limit' into 'main'

Remove the limit on the number of simultaneous TCP queries

Closes #3141

See merge request isc-projects/bind9!5851

4 years agoAdd CHANGES and release note for [GL #3141]
Ondřej Surý [Thu, 10 Feb 2022 10:48:01 +0000 (11:48 +0100)] 
Add CHANGES and release note for [GL #3141]

4 years agoRemove the limit on the number of simultaneous TCP queries
Ondřej Surý [Thu, 27 Jan 2022 09:08:06 +0000 (10:08 +0100)] 
Remove the limit on the number of simultaneous TCP queries

There was an artificial limit of 23 on the number of simultaneous
pipelined queries in the single TCP connection.  The new network
managers is capable of handling "unlimited" (limited only by the TCP
read buffer size ) queries similar to "unlimited" handling of the DNS
queries receive over UDP.

Don't limit the number of TCP queries that we can process within a
single TCP read callback.

4 years agoMerge branch '1897-fix-max-transfer-timeouts' into 'main'
Ondřej Surý [Thu, 17 Feb 2022 21:01:24 +0000 (21:01 +0000)] 
Merge branch '1897-fix-max-transfer-timeouts' into 'main'

Reimplement the max-transfer-time-out and max-transfer-idle-out

Closes #1897

See merge request isc-projects/bind9!5850

4 years agoAdd CHANGES and release note for [GL #1897]
Ondřej Surý [Thu, 10 Feb 2022 19:52:38 +0000 (20:52 +0100)] 
Add CHANGES and release note for [GL #1897]

4 years agoAdd XFR max-transfer-time-out and max-tranfer-idle-out system tests
Ondřej Surý [Tue, 8 Feb 2022 20:32:10 +0000 (21:32 +0100)] 
Add XFR max-transfer-time-out and max-tranfer-idle-out system tests

Extend the timeouts system test to ensure that the maximum outgoing
transfer time (max-transfer-time-out) and maximum outgoing transfer idle
time (max-transfer-idle-out) works as expected.  This is done by
lowering the limits to 5/1 minutes and testing that the connection has
been dropped while sleeping between the individual XFR messages.

4 years agoReimplement the max-transfer-time-out and max-transfer-idle-out
Ondřej Surý [Wed, 2 Feb 2022 10:20:17 +0000 (11:20 +0100)] 
Reimplement the max-transfer-time-out and max-transfer-idle-out

While refactoring the libns to use the new network manager, the
max-transfer-*-out options were not implemented and they were turned
non-operational.

Reimplement the max-transfer-idle-out functionality using the write
timer and max-transfer-time-out using the new isc_nm_timer API.

4 years agoRemove unused client->shutdown and client->shutdown_arg
Ondřej Surý [Tue, 8 Feb 2022 20:32:37 +0000 (21:32 +0100)] 
Remove unused client->shutdown and client->shutdown_arg

While refactoring the lib/ns/xfrout.c, it was discovered that .shutdown
and .shutdown_arg members of ns_client_t structure are unused.

Remove the unused members and associated code that was using in it in
the ns_xfrout.

4 years agoAdd network manager based timer API
Ondřej Surý [Wed, 2 Feb 2022 09:50:27 +0000 (10:50 +0100)] 
Add network manager based timer API

This commits adds API that allows to create arbitrary timers associated
with the network manager handles.

4 years agoMerge branch '2486-verify-journals' into 'main'
Evan Hunt [Thu, 17 Feb 2022 20:28:12 +0000 (20:28 +0000)] 
Merge branch '2486-verify-journals' into 'main'

make dnssec-verify and dnssec-signzone read journal files

Closes #2486

See merge request isc-projects/bind9!5801

4 years agoCHANGES and release note for [GL #2486]
Evan Hunt [Sat, 5 Feb 2022 07:51:39 +0000 (23:51 -0800)] 
CHANGES and release note for [GL #2486]

4 years agoadd a test for dnssec-signzone -J
Evan Hunt [Sat, 5 Feb 2022 07:43:42 +0000 (23:43 -0800)] 
add a test for dnssec-signzone -J

generate a journal file, and load it in dnssec-signzone.

4 years agoadd a test for dnssec-verify -J
Evan Hunt [Sat, 5 Feb 2022 07:20:03 +0000 (23:20 -0800)] 
add a test for dnssec-verify -J

generate a journal file and confirm that dnssec-verify is able
to load it.

4 years agosupport $INCLUDE in makejournal
Evan Hunt [Sat, 5 Feb 2022 00:52:22 +0000 (16:52 -0800)] 
support $INCLUDE in makejournal

bin/tests/system/makejournal needs to ignore DNS_R_SEENINCLUDE
when calling dns_db_load(), otherwise it cannot generate a journal
for a zone file with a $INCLUDE statement.

4 years agomake dnssec-verify and dnssec-signzone read journal files
Evan Hunt [Sat, 5 Feb 2022 00:52:22 +0000 (16:52 -0800)] 
make dnssec-verify and dnssec-signzone read journal files

add a -J option to dnssec-verify and dnssec-signzone to read
a specified journal file when loading a zone.

4 years agoMerge branch '3149-drop-TCP-connection-when-garbage-is-received' into 'main'
Ondřej Surý [Thu, 17 Feb 2022 20:01:08 +0000 (20:01 +0000)] 
Merge branch '3149-drop-TCP-connection-when-garbage-is-received' into 'main'

Reset the TCP connection when garbage is received

Closes #3149

See merge request isc-projects/bind9!5849

4 years agoAdd CHANGES and release note for [GL #3149]
Ondřej Surý [Tue, 15 Feb 2022 20:06:18 +0000 (21:06 +0100)] 
Add CHANGES and release note for [GL #3149]

4 years agoAdd TCP garbage system test
Ondřej Surý [Tue, 15 Feb 2022 20:01:25 +0000 (21:01 +0100)] 
Add TCP garbage system test

Test if the TCP connection gets reset when garbage instead of DNS
message is sent.

I'm only happy when it rains
Pour some misery down on me
- Garbage

4 years agoReset the TCP connection when garbage is received
Ondřej Surý [Tue, 15 Feb 2022 13:41:15 +0000 (14:41 +0100)] 
Reset the TCP connection when garbage is received

When invalid DNS message is received, there was a handling mechanism for
DoH that would be called to return proper HTTP response.

Reuse this mechanism and reset the TCP connection when the client is
blackholed, DNS message is completely bogus or the ns_client receives
response instead of query.

4 years agoMerge branch '3133-tcp-error-handling' into 'main'
Ondřej Surý [Thu, 17 Feb 2022 10:41:14 +0000 (10:41 +0000)] 
Merge branch '3133-tcp-error-handling' into 'main'

correct TCP error condition handling in dispatch

Closes #3133

See merge request isc-projects/bind9!5810

4 years agoAdd CHANGES note for [GL #3133]
Evan Hunt [Fri, 11 Feb 2022 20:34:52 +0000 (12:34 -0800)] 
Add CHANGES note for [GL #3133]

4 years agocorrect TCP error handling in dispatch and resolver
Evan Hunt [Wed, 9 Feb 2022 22:56:04 +0000 (14:56 -0800)] 
correct TCP error handling in dispatch and resolver

- certain TCP result codes, including ISC_R_EOF and
  ISC_R_CONNECTIONRESET, were being mapped to ISC_R_SHUTTINGDOWN
  before calling the response handler in tcp_recv_cancelall().
  the result codes should be passed through to the response handler
  without being changed.

- the response handlers, resquery_response() and req_response(), had
  code to return immediately if encountering ISC_R_EOF, but this is
  not the correct behavior; that should only happen in the case of
  ISC_R_CANCELED when it was the caller that canceled the operation

- ISC_R_CONNECTIONRESET was not being caught in rctx_dispfail().

- removed code in rctx_dispfail() to retry queries without EDNS
  when receiving ISC_R_EOF; this is now treated the same as any
  other connection failure.

4 years agoMerge branch '3132-add-send-timeout' into 'main'
Ondřej Surý [Thu, 17 Feb 2022 08:45:17 +0000 (08:45 +0000)] 
Merge branch '3132-add-send-timeout' into 'main'

Add timeout when writing TCP data

Closes #3132

See merge request isc-projects/bind9!5848

4 years agoAdd CHANGES and release note for [GL #3132]
Ondřej Surý [Thu, 10 Feb 2022 10:14:58 +0000 (11:14 +0100)] 
Add CHANGES and release note for [GL #3132]

4 years agoUpdate writetimeout to be T_IDLE in netmgr_test.c
Ondřej Surý [Thu, 10 Feb 2022 07:42:22 +0000 (08:42 +0100)] 
Update writetimeout to be T_IDLE in netmgr_test.c

Use the isc_nmhandle_setwritetimeout() function in the netmgr unit test
to allow more time for writing and reading the responses because some of
the intervals that are used in the unit tests are really small leaving a
little room for any delays.

4 years agoAdd isc_nmhandle_setwritetimeout() function
Ondřej Surý [Wed, 9 Feb 2022 18:48:13 +0000 (19:48 +0100)] 
Add isc_nmhandle_setwritetimeout() function

In some situations (unit test and forthcoming XFR timeouts MR), we need
to modify the write timeout independently of the read timeout.  Add a
isc_nmhandle_setwritetimeout() function that could be called before
isc_nm_send() to specify a custom write timeout interval.

4 years agoAdd TCP write timeout system test
Ondřej Surý [Wed, 9 Feb 2022 11:46:29 +0000 (12:46 +0100)] 
Add TCP write timeout system test

Extend the timeouts system test that bursts the queries for large TXT
record and never read any responses back filling up the server TCP write
buffer.  The test should work with the default wmem_max value on
Linux (208k).

4 years agoAdd TCP, TCPDNS and TLSDNS write timer
Ondřej Surý [Wed, 9 Feb 2022 10:21:04 +0000 (11:21 +0100)] 
Add TCP, TCPDNS and TLSDNS write timer

When the outgoing TCP write buffers are full because the other party is
not reading the data, the uv_write() could wait indefinitely on the
uv_loop and never calling the callback.  Add a new write timer that uses
the `tcp-idle-timeout` value to interrupt the TCP connection when we are
not able to send data for defined period of time.

4 years agoAdd uv_tcp_close_reset compat
Ondřej Surý [Wed, 9 Feb 2022 11:45:37 +0000 (12:45 +0100)] 
Add uv_tcp_close_reset compat

The uv_tcp_close_reset() function was added in libuv 1.32.0 and since we
support older libuv releases, we have to add a shim uv_tcp_close_reset()
implementation loosely based on libuv.

4 years agoRename sock->timer to sock->read_timer
Ondřej Surý [Wed, 9 Feb 2022 09:59:08 +0000 (10:59 +0100)] 
Rename sock->timer to sock->read_timer

Before adding the write timer, we have to remove the generic sock->timer
to sock->read_timer.  We don't touch the function names to limit the
impact of the refactoring.

4 years agoMerge branch '3157-blackhole-request' into 'main'
Evan Hunt [Thu, 17 Feb 2022 06:19:51 +0000 (06:19 +0000)] 
Merge branch '3157-blackhole-request' into 'main'

negative match on the 'blackhole' ACL could be treated as positive

Closes #3157

See merge request isc-projects/bind9!5853

4 years agoCHANGES and release note for [GL #3157]
Evan Hunt [Wed, 16 Feb 2022 23:58:50 +0000 (15:58 -0800)] 
CHANGES and release note for [GL #3157]

4 years agonegative 'blackhole' ACL match could be treated as positive
Evan Hunt [Wed, 16 Feb 2022 23:46:33 +0000 (15:46 -0800)] 
negative 'blackhole' ACL match could be treated as positive

There was a bug in the checking of the "blackhole" ACL in
dns_request_create*(), causing an address to be treated as included
in the ACL if it was explicitly *excluded*. Thus, leaving "blackhole"
unset had no effect, but setting it to "none" would cause any
destination addresses to be rejected for dns_request purposes. This
would cause zone transfer requests and SOA queries to fail, among
other things.

The bug has been fixed, and "blackhole { none; };" was added to the
xfer system test as a regression test.

4 years agoMerge branch '3139-log-the-result-of-each-resolver-priming-attempt' into 'main'
Michał Kępień [Wed, 16 Feb 2022 12:27:18 +0000 (12:27 +0000)] 
Merge branch '3139-log-the-result-of-each-resolver-priming-attempt' into 'main'

Log the result of each resolver priming attempt

Closes #3139

See merge request isc-projects/bind9!5812

4 years agoAdd CHANGES entry for [GL #3139]
Michał Kępień [Wed, 16 Feb 2022 12:26:12 +0000 (13:26 +0100)] 
Add CHANGES entry for [GL #3139]

4 years agoLog the result of each resolver priming attempt
Michał Kępień [Wed, 16 Feb 2022 12:26:12 +0000 (13:26 +0100)] 
Log the result of each resolver priming attempt

When a resolver priming attempt completes, the following message is
currently logged:

    resolver priming query complete

This message is identical for both successful and failed priming
attempts.  Consider the following log excerpts:

  - successful priming attempt:

        10-Feb-2022 11:33:11.272 all zones loaded
        10-Feb-2022 11:33:11.272 running
        10-Feb-2022 11:33:19.722 resolver priming query complete

  - failed priming attempt:

        10-Feb-2022 11:33:29.978 all zones loaded
        10-Feb-2022 11:33:29.978 running
        10-Feb-2022 11:33:38.432 timed out resolving '_.org/A/IN': 2001:500:9f::42#53
        10-Feb-2022 11:33:38.522 timed out resolving './NS/IN': 2001:500:9f::42#53
        10-Feb-2022 11:33:42.132 timed out resolving '_.org/A/IN': 2001:500:12::d0d#53
        10-Feb-2022 11:33:42.285 timed out resolving './NS/IN': 2001:500:12::d0d#53
        10-Feb-2022 11:33:44.685 resolver priming query complete

Include the result of each priming attempt in the relevant log message
to give the administrator better insight into named's resolver priming
process.

4 years agoMerge branch 'ondrej/add-UV_RUNTIME_CHECK-macro' into 'main'
Ondřej Surý [Wed, 16 Feb 2022 10:45:32 +0000 (10:45 +0000)] 
Merge branch 'ondrej/add-UV_RUNTIME_CHECK-macro' into 'main'

Add UV_RUNTIME_CHECK() macro to print uv_strerror()

See merge request isc-projects/bind9!5838

4 years agoAdd semantic patch to keep UV_RUNTIME_CHECK in sync
Ondřej Surý [Tue, 15 Feb 2022 18:54:54 +0000 (19:54 +0100)] 
Add semantic patch to keep UV_RUNTIME_CHECK in sync

The UV_RUNTIME_CHECK() macro requires to keep the function name in sync
like this:

    r = func(...);
    UV_RUNTIME_CHECK(func, r);

Add semantic patch to keep the function name and return variable in sync
with the previous line.

4 years agoUse UV_RUNTIME_CHECK() as appropriate
Ondřej Surý [Tue, 15 Feb 2022 13:51:02 +0000 (14:51 +0100)] 
Use UV_RUNTIME_CHECK() as appropriate

Replace the RUNTIME_CHECK() calls for libuv API calls with
UV_RUNTIME_CHECK() to get more detailed error message when
something fails and should not.

4 years agoAdd UV_RUNTIME_CHECK() macro to print uv_strerror()
Ondřej Surý [Tue, 15 Feb 2022 13:44:29 +0000 (14:44 +0100)] 
Add UV_RUNTIME_CHECK() macro to print uv_strerror()

When libuv functions fail, they return correct return value that could
be useful for more detailed debugging.  Currently, we usually just check
whether the return value is 0 and invoke assertion error if it doesn't
throwing away the details why the call has failed.  Unfortunately, this
often happen on more exotic platforms.

Add a UV_RUNTIME_CHECK() macro that can be used to print more detailed
error message (via uv_strerror() before ending the execution of the
program abruptly with the assertion.

4 years agoMerge branch 'ondrej/remove-dns_timer-API' into 'main'
Ondřej Surý [Wed, 16 Feb 2022 09:51:36 +0000 (09:51 +0000)] 
Merge branch 'ondrej/remove-dns_timer-API' into 'main'

Remove unused dns_timer API

See merge request isc-projects/bind9!5818

4 years agoRemove unused dns_timer API
Ondřej Surý [Wed, 2 Feb 2022 11:04:38 +0000 (12:04 +0100)] 
Remove unused dns_timer API

The dns_timer API was unused, and this commit just removes it.

4 years agoMerge branch 'matthijs-document-dnssec-policy-keys-algorithm-match' into 'main'
Matthijs Mekking [Wed, 16 Feb 2022 09:40:08 +0000 (09:40 +0000)] 
Merge branch 'matthijs-document-dnssec-policy-keys-algorithm-match' into 'main'

Update documentation wrt key algorithms

See merge request isc-projects/bind9!5823

4 years agoUpdate documentation wrt key algorithms
Matthijs Mekking [Fri, 11 Feb 2022 08:48:36 +0000 (09:48 +0100)] 
Update documentation wrt key algorithms

Add a note to the DNSSEC guide and to the ARM reference that A ZSK/KSK
pair used for signing your zone should have the same algorithm.

This commit also updates the 'dnssec-policy/keys' example to use the
slightly more modern 'rsasha256' algorithm.

4 years agoMerge branch 'mnowak/make-cocci-parallel' into 'main'
Michal Nowak [Mon, 14 Feb 2022 18:47:39 +0000 (18:47 +0000)] 
Merge branch 'mnowak/make-cocci-parallel' into 'main'

Run spatch jobs in parallel

See merge request isc-projects/bind9!4741

4 years agoRun spatch jobs in parallel
Michal Nowak [Wed, 24 Feb 2021 13:55:28 +0000 (14:55 +0100)] 
Run spatch jobs in parallel

Also make the script more verbose to identify which patch is being
processed and check for failures in spatch standard error output.

4 years agoMerge branch 'mnowak/coverity-scan-2021.12' into 'main'
Michal Nowak [Mon, 14 Feb 2022 16:37:07 +0000 (16:37 +0000)] 
Merge branch 'mnowak/coverity-scan-2021.12' into 'main'

Update Coverity Scan CI job to 2021.12

See merge request isc-projects/bind9!5811

4 years agoUpdate Coverity Scan CI job to 2021.12.1
Michal Nowak [Thu, 10 Feb 2022 09:33:06 +0000 (10:33 +0100)] 
Update Coverity Scan CI job to 2021.12.1

4 years agoMerge branch 'pspacek/rfc-nits' into 'main'
Petr Špaček [Mon, 14 Feb 2022 11:10:21 +0000 (11:10 +0000)] 
Merge branch 'pspacek/rfc-nits' into 'main'

Update and deduplicate list of RFCs in documentation

Closes #1918

See merge request isc-projects/bind9!5813