]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
4 years agoCheck whether soa responses are synthesised or not
Mark Andrews [Tue, 2 Nov 2021 03:55:55 +0000 (14:55 +1100)] 
Check whether soa responses are synthesised or not

4 years agoAdd and use check_status
Mark Andrews [Tue, 2 Nov 2021 03:09:32 +0000 (14:09 +1100)] 
Add and use check_status

4 years agoAdd and use check_ad_flag
Mark Andrews [Tue, 2 Nov 2021 02:58:26 +0000 (13:58 +1100)] 
Add and use check_ad_flag

4 years agoRework rbtdb.c:find_coveringnsec() to use the auxilary nsec rbt
Mark Andrews [Wed, 29 Sep 2021 03:55:46 +0000 (13:55 +1000)] 
Rework rbtdb.c:find_coveringnsec() to use the auxilary nsec rbt

this improves the performance of looking for NSEC and RRSIG(NSEC)
records in the cache by skipping lots of nodes in the main trees
in the cache without these records present.  This is a simplified
version of previous_closest_nsec() which uses the same underlying
mechanism to look for NSEC and RRSIG(NSEC) records in authorative
zones.

The auxilary NSEC tree was already being maintained as a side effect
of looking for the covering NSEC in large zones where there can be
lots of glue records that needed to be skipped.  Nodes are added
to the tree whenever a NSEC record is added to the primary tree.
They are removed when the corresponding node is removed from the
primary tree.

Having nodes in the NSEC tree w/o NSEC records in the primary tree
should not impact on synth-from-dnssec efficiency as that node would
have held the NSEC we would have been needed to synthesise the
response.  Removing the node when the NSEC RRset expires would only
cause rbtdb to return a NSEC which would be rejected at a higher
level.

4 years agoMerge branch '2700-improve-failed-tcp-accept-logging' into 'main'
Ondřej Surý [Thu, 2 Dec 2021 13:18:10 +0000 (13:18 +0000)] 
Merge branch '2700-improve-failed-tcp-accept-logging' into 'main'

Improve the logging on failed TCP accept

Closes #2700

See merge request isc-projects/bind9!5611

4 years agoAdd CHANGES and release note for [GL #2700]
Ondřej Surý [Wed, 1 Dec 2021 16:52:33 +0000 (17:52 +0100)] 
Add CHANGES and release note for [GL #2700]

4 years agoImprove the logging on failed TCP accept
Ondřej Surý [Wed, 1 Dec 2021 16:41:20 +0000 (17:41 +0100)] 
Improve the logging on failed TCP accept

Previously, when TCP accept failed, we have logged a message with
ISC_LOG_ERROR level.  One common case, how this could happen is that the
client hits TCP client quota and is put on hold and when resumed, the
client has already given up and closed the TCP connection.  In such
case, the named would log:

    TCP connection failed: socket is not connected

This message was quite confusing because it actually doesn't say that
it's related to the accepting the TCP connection and also it logs
everything on the ISC_LOG_ERROR level.

Change the log message to "Accepting TCP connection failed" and for
specific error states lower the severity of the log message to
ISC_LOG_INFO.

4 years agoMerge branch '3026-premature-tcp-connection-closure-leaks-fetch-contexts-hang-on...
Evan Hunt [Wed, 1 Dec 2021 20:10:44 +0000 (20:10 +0000)] 
Merge branch '3026-premature-tcp-connection-closure-leaks-fetch-contexts-hang-on-shutdown' into 'main'

Shutdown all active TCP connections on error

Closes #3026

See merge request isc-projects/bind9!5599

4 years agoAdd CHANGES and release notes for [GL #3026]
Ondřej Surý [Fri, 26 Nov 2021 10:13:47 +0000 (11:13 +0100)] 
Add CHANGES and release notes for [GL #3026]

4 years agoAdd TCP connection reset test
Ondřej Surý [Wed, 1 Dec 2021 11:22:59 +0000 (12:22 +0100)] 
Add TCP connection reset test

The TCP connection reset test starts mock UDP and TCP server which
always returns empty DNS answer with TC bit set over UDP and resets the
TCP connection after five seconds.

When tested without the fix, the DNS query to 10.53.0.2 times out and
the ns2 server hangs at shutdown.

4 years agoOn non-matching answer, check for missed timeout
Evan Hunt [Tue, 30 Nov 2021 08:57:27 +0000 (09:57 +0100)] 
On non-matching answer, check for missed timeout

A TCP connection may be held open past its proper timeout if it's
receiving a stream of DNS responses that don't match any queries.
In this case, we now check whether the oldest query should have timed
out.

4 years agoTear down the TCP connection on too many unexpected DNS messages
Ondřej Surý [Mon, 29 Nov 2021 08:59:33 +0000 (09:59 +0100)] 
Tear down the TCP connection on too many unexpected DNS messages

When the outgoing TCP dispatch times-out active response, we might still
receive the answer during the lifetime of the connection.  Previously,
we would just ignore any non-matching DNS answers, which would allow the
server to feed us with otherwise valid DNS answer and keep the
connection open.

Add a counter for timed-out DNS queries over TCP and tear down the whole
TCP connection if we receive unexpected number of DNS answers.

4 years agoRefactor tcp_recv()
Ondřej Surý [Fri, 26 Nov 2021 08:14:58 +0000 (09:14 +0100)] 
Refactor tcp_recv()

The tcp_recv() function used lot of gotos that made the function hard to
read.  Refactor the function by splitting it into smaller logical chunks.

4 years agoShutdown all TCP connection on invalid DNS message
Ondřej Surý [Fri, 26 Nov 2021 08:14:58 +0000 (09:14 +0100)] 
Shutdown all TCP connection on invalid DNS message

Previously, when invalid DNS message is received over TCP we throw the
garbage DNS message away and continued looking for valid DNS message
that would match our outgoing queries.  This logic makes sense for UDP,
because anyone can send DNS message over UDP.

Change the logic that the TCP connection is closed when we receive
garbage, because the other side is acting malicious.

4 years agoShutdown all active TCP connections on error
Ondřej Surý [Fri, 26 Nov 2021 08:14:58 +0000 (09:14 +0100)] 
Shutdown all active TCP connections on error

When outgoing TCP connection was prematurely terminated (f.e. with
connection reset), the dispatch code would not cleanup the resources
used by such connection leading to dangling dns_dispentry_t entries.

4 years agoMerge branch '1610-disable-UseSTD3ASCIIRules-in-idn2' into 'main'
Ondřej Surý [Wed, 1 Dec 2021 15:32:29 +0000 (15:32 +0000)] 
Merge branch '1610-disable-UseSTD3ASCIIRules-in-idn2' into 'main'

Disable IDN2_USE_STD3_ASCII_RULES to idn2 conversion functions

Closes #1610

See merge request isc-projects/bind9!5605

4 years agoAdd CHANGES and release note for [GL #1610]
Ondřej Surý [Tue, 30 Nov 2021 14:25:22 +0000 (15:25 +0100)] 
Add CHANGES and release note for [GL #1610]

4 years agoAdd an idna test that _ and * characters are preserved
Ondřej Surý [Wed, 1 Dec 2021 09:20:31 +0000 (10:20 +0100)] 
Add an idna test that _ and * characters are preserved

Add a idna that checks whether non-character letters like _ and * are
preserved when IDN is enabled.  This wasn't the case when
UseSTD3ASCIIRules were enabled, f.e. _ from _tcp would get mangled to
tcp.

4 years agoRemove idna test for UseSTD3ASCIIRules=true
Ondřej Surý [Tue, 30 Nov 2021 14:20:07 +0000 (15:20 +0100)] 
Remove idna test for UseSTD3ASCIIRules=true

We had to disable UseSTD3ASCIIRules=true because it broke non-letter
domain names like _tcp or *.  Disable the idna test too.

4 years agoDisable IDN2_USE_STD3_ASCII_RULES to idn2 conversion functions
Ondřej Surý [Tue, 30 Nov 2021 14:18:40 +0000 (15:18 +0100)] 
Disable IDN2_USE_STD3_ASCII_RULES to idn2 conversion functions

Disable IDN2_USE_STD3_ASCII_RULES to the libidn2 conversion because it
broke encoding some non-letter but valid domain names like _tcp or *.

This reverts commit ef8aa91740592a78c9162f3f7109167f2c9297a5.

4 years agoMerge branch '2983-fix-doth-system-test' into 'main'
Artem Boldariev [Wed, 1 Dec 2021 14:06:16 +0000 (14:06 +0000)] 
Merge branch '2983-fix-doth-system-test' into 'main'

Resolve #2983: Increase startup timeout for servers in system tests

Closes #2983

See merge request isc-projects/bind9!5609

4 years agoIncrease startup timeout for servers in system tests
Artem Boldariev [Wed, 1 Dec 2021 10:50:21 +0000 (12:50 +0200)] 
Increase startup timeout for servers in system tests

This change is made in particular to address the issue with 'doth'
system tests where servers are unable to iniitalise in time in CI
system under high load (that happened particularly often for Debian
Buster cross32 configuration).

The right solution, is, of course, to (re)use TLS context sparingly,
while right now we create too many of them.

4 years agoMerge branch 'artem-xot-tls-protocols-ciphers' into 'main'
Artem Boldariev [Wed, 1 Dec 2021 11:05:51 +0000 (11:05 +0000)] 
Merge branch 'artem-xot-tls-protocols-ciphers' into 'main'

XoT: add support client-side TLS parameters for incoming XFRs, add 'tls' name configuration validation on secondaries

See merge request isc-projects/bind9!5602

4 years agoAdd CHANGES entry [GL !5602]
Artem Boldariev [Tue, 30 Nov 2021 00:20:48 +0000 (02:20 +0200)] 
Add CHANGES entry [GL !5602]

Mention that client-side 'tls' parameters are now supported for XoT.

4 years agoTLS context handling code: Fix an abort on ancient OpenSSL version
Artem Boldariev [Tue, 30 Nov 2021 08:42:23 +0000 (10:42 +0200)] 
TLS context handling code: Fix an abort on ancient OpenSSL version

There was a logical bug when setting a list of enabled TLS protocols,
which may lead to a crash (an abort()) on systems with ancient OpenSSL
versions.

The problem was due to the fact that we were INSIST()ing on supporting
all of the TLS versions, while checking only for mentioned in the
configuration was implied.

4 years agoExtend the 'doth' system test with another XoT-enabled secondary
Artem Boldariev [Tue, 30 Nov 2021 00:05:29 +0000 (02:05 +0200)] 
Extend the 'doth' system test with another XoT-enabled secondary

This commit extends the 'doth' system test to include an additional
XoT-enabled secondary which uses the supported client-side 'tls'
parameters.

4 years agoAdd 'tls' validation for XoT enabled primaries
Artem Boldariev [Mon, 29 Nov 2021 22:31:36 +0000 (00:31 +0200)] 
Add 'tls' validation for XoT enabled primaries

This commit ensure that the 'tls' name specified in the 'primaries'
clause of a 'zone' statement is a valid one.

Prior to that such a name would be silently accepted, leading to
silent XFRs-via-TLS failures.

4 years agoXoT: add support for client-side TLS parameters
Artem Boldariev [Mon, 29 Nov 2021 21:09:51 +0000 (23:09 +0200)] 
XoT: add support for client-side TLS parameters

This commit adds support for client-side TLS parameters to XoT.

Prior to this commit all client-side TLS contexts were using default
parameters only, ignoring the options from the BIND's configuration
file.

Currently, the following 'tls' parameters are supported:

- protocols;
- ciphers;
- prefer-server-ciphers.

4 years agoMerge branch '2850-the-list-of-fetches-at-the-end-of-rndc-recursing-output-is-very...
Mark Andrews [Tue, 30 Nov 2021 11:30:47 +0000 (11:30 +0000)] 
Merge branch '2850-the-list-of-fetches-at-the-end-of-rndc-recursing-output-is-very-poorly-explained-in-the-arm' into 'main'

Resolve "The list of fetches at the end of 'rndc recursing' output is very poorly explained in the ARM - what does 'allowed' mean?"

Closes #2850

See merge request isc-projects/bind9!5388

4 years agoUpdate the description of fetches-per-zone counters
Mark Andrews [Wed, 8 Sep 2021 03:51:07 +0000 (13:51 +1000)] 
Update the description of fetches-per-zone counters

4 years agoMerge branch '853-dnssec-dsfromkey-doesn-t-omit-revoked-ksk' into 'main'
Mark Andrews [Tue, 30 Nov 2021 11:08:28 +0000 (11:08 +0000)] 
Merge branch '853-dnssec-dsfromkey-doesn-t-omit-revoked-ksk' into 'main'

Resolve "dnssec-dsfromkey doesn't omit revoked KSK"

Closes #853

See merge request isc-projects/bind9!5460

4 years agoAdd CHANGES for [GL #853]
Mark Andrews [Mon, 22 Nov 2021 06:29:08 +0000 (17:29 +1100)] 
Add CHANGES for [GL  #853]

4 years agoCheck dnssec-dsfromkey with revoked DNSKEY
Mark Andrews [Wed, 17 Nov 2021 02:06:44 +0000 (13:06 +1100)] 
Check dnssec-dsfromkey with revoked DNSKEY

Checks that there is a revoked key in the DNSKEY RRset then checks
that only the correct number of DS records are produced.

4 years agodnssec-dsfromkey should not convert revoked keys
Tony Finch [Mon, 4 Oct 2021 23:01:54 +0000 (10:01 +1100)] 
dnssec-dsfromkey should not convert revoked keys

it is pointless to convert revoked keys to DS or CDS records as
they cannot be used to provide a cryptographic link from the parent
zone.

4 years agoMerge branch '2776-allow-transfer-encrypted' into 'main'
Artem Boldariev [Tue, 30 Nov 2021 10:44:11 +0000 (10:44 +0000)] 
Merge branch '2776-allow-transfer-encrypted' into 'main'

Resolve #2776: Extend 'allow-transfer' with 'port' and 'transport' parameters

Closes #2776

See merge request isc-projects/bind9!5587

4 years agoAdd transport-acl system test
Artem Boldariev [Mon, 29 Nov 2021 10:50:35 +0000 (12:50 +0200)] 
Add transport-acl system test

This commit adds a new system-test: transport-acl system test. It is
intended to test the new, extended syntax for ACLs, the one where port
or transport protocol can be specified. Currently, it includes the
tests only using allow-transfer statement, as this extended syntax is
used only there, at least for now.

4 years agoModify CHANGES [GL #2776]
Artem Boldariev [Tue, 23 Nov 2021 15:11:44 +0000 (17:11 +0200)] 
Modify CHANGES [GL #2776]

Mention in the CHANGES file that the allow-transfer options has been
extended with 'port' and 'transport' options.

4 years agoMention that the allow-transfer option has been extended
Artem Boldariev [Tue, 23 Nov 2021 13:04:51 +0000 (15:04 +0200)] 
Mention that the allow-transfer option has been extended

This commit updates both the reference manual and release notes with
the information that 'allow-transfer' has been extended with
additional "port" and "transport" options.

4 years agoExtend the 'doth' system test to test extended allow-transfer option
Artem Boldariev [Mon, 22 Nov 2021 13:31:15 +0000 (15:31 +0200)] 
Extend the 'doth' system test to test extended allow-transfer option

This commit extends the 'doth' system test to verify that the new
extended 'allow-transfer' option syntax featuring 'port' and
'transport' parameters is supported and works as expected. That is, it
restricts the primary server to allow zone transfers only via XoT.

Additionally to that, it extends the 'checkonf' test with more
configuration file examples featuring the new syntax.

4 years agoIntegrate extended ACLs syntax featuring 'port' and 'transport' opts
Artem Boldariev [Fri, 12 Nov 2021 14:53:13 +0000 (16:53 +0200)] 
Integrate extended ACLs syntax featuring 'port' and 'transport' opts

This commit completes the integration of the new, extended ACL syntax
featuring 'port' and 'transport' options.

The runtime presentation and ACL loading code are extended to allow
the syntax to be used beyond the 'allow-transfer' option (e.g. in
'acl' definitions and other 'allow-*' options) and can be used to
ultimately extend the ACL support with transport-only
ACLs (e.g. 'transport-acl tls-acl port 853 transport tls'). But, due
to fundamental nature of such a change, it has not been completed as a
part of 9.17.X release series due to it being close to 9.18 stable
release status. That means that we do not have enough time to fully
test it.

The complete integration is planned as a part of 9.19.X release
series.

The code was manually verified to work as expected by temporarily
enabling the extended syntax for 'acl' statements and 'allow-query'
options, including ACL merging, negated ACLs.

4 years agoExtend ACL syntax handling code with 'port' and 'transport' options
Artem Boldariev [Thu, 4 Nov 2021 14:52:49 +0000 (16:52 +0200)] 
Extend ACL syntax handling code with 'port' and 'transport' options

This commit extends ACL syntax handling code with 'port' and
'transport' options. Currently, the extended syntax is available only
for allow-transfer options.

4 years agoAdd isc_nm_has_encryption()
Artem Boldariev [Tue, 16 Nov 2021 11:35:37 +0000 (13:35 +0200)] 
Add isc_nm_has_encryption()

This commit adds an isc_nm_has_encryption() function intended to check
if a given handle is backed by a connection which uses encryption.

4 years agoAdd isc_nm_socket_type()
Artem Boldariev [Mon, 15 Nov 2021 15:42:15 +0000 (17:42 +0200)] 
Add isc_nm_socket_type()

This commit adds an isc_nm_socket_type() function which can be used to
obtain a handle's socket type.

This change obsoletes isc_nm_is_tlsdns_handle() and
isc_nm_is_http_handle(). However, it was decided to keep the latter as
we eventually might end up supporting multiple HTTP versions.

4 years agoMerge branch 'artem-disable-unused-tls-syntax' into 'main'
Artem Boldariev [Mon, 29 Nov 2021 12:23:37 +0000 (12:23 +0000)] 
Merge branch 'artem-disable-unused-tls-syntax' into 'main'

Remove unused 'tls' clause options: 'ca-file' and 'hostname'

See merge request isc-projects/bind9!5600

4 years agoModify CHANGES [GL !5600]
Artem Boldariev [Mon, 29 Nov 2021 09:02:32 +0000 (11:02 +0200)] 
Modify CHANGES [GL !5600]

Mention that unused 'tls' clause options 'ca-file' and 'hostname' were
removed.

4 years agoDisable unused 'tls' clause options: 'ca-file' and 'hostname'
Artem Boldariev [Mon, 29 Nov 2021 08:45:35 +0000 (10:45 +0200)] 
Disable unused 'tls' clause options: 'ca-file' and 'hostname'

This commit disables the unused 'tls' clause options. For these some
backing code exists, but their values are not really used anywhere,
nor there are sufficient syntax tests for them.

These options are only disabled temporarily, until TLS certificate
verification gets implemented.

4 years agoMerge branch '3022-doh-fix-dig-crash-on-unexpected-alpn' into 'main'
Artem Boldariev [Fri, 26 Nov 2021 08:53:24 +0000 (08:53 +0000)] 
Merge branch '3022-doh-fix-dig-crash-on-unexpected-alpn' into 'main'

Resolve #3022: DoH: dig eventually aborts on ALPN negotiation failure when issuing a DoH query (because of dangling handles)

Closes #3022

See merge request isc-projects/bind9!5590

4 years agoModify CHANGES [GL #3022]
Artem Boldariev [Wed, 24 Nov 2021 12:37:53 +0000 (14:37 +0200)] 
Modify CHANGES [GL #3022]

Mention that [GL #3022] was resolved.

4 years agoDoH: Extend 'doth' test with a check if dig can detect ALPN failure
Artem Boldariev [Wed, 24 Nov 2021 12:26:40 +0000 (14:26 +0200)] 
DoH: Extend 'doth' test with a check if dig can detect ALPN failure

This commit extends the 'doth' system test to verify if 'dig' can
detect an properly recover after ALPN negotiation failure when making
a DoH query.

4 years agoTLS stream: disable TLS I/O debug log message by default
Artem Boldariev [Wed, 24 Nov 2021 12:09:31 +0000 (14:09 +0200)] 
TLS stream: disable TLS I/O debug log message by default

This commit makes the TLS stream code to not issue mostly useless
debug log message on error during TLS I/O. This message was cluttering
logs a lot, as it can be generated on (almost) any non-clean TLS
connection termination, even in the cases when the actual query
completed successfully. Nor does it provide much value for end-users,
yet it can occasionally be seen when using dig and quite often when
running BIND over a publicly available network interface.

4 years agoDoH: Remove unneeded isc__nmsocket_prep_destroy() call
Artem Boldariev [Wed, 24 Nov 2021 12:03:44 +0000 (14:03 +0200)] 
DoH: Remove unneeded isc__nmsocket_prep_destroy() call

This commit removes unneeded isc__nmsocket_prep_destroy() call on ALPN
negotiation failure, which was eventually causing the TLS handle to
leak.

This call is not needed, as not attaching to the transport (TLS)
handle should be enough. At this point it seems like a kludge from
earlier days of the TLS code.

4 years agoMerge branch 'matthijs-fix-openssl-init-ssl-leak' into 'main'
Matthijs Mekking [Fri, 26 Nov 2021 07:41:02 +0000 (07:41 +0000)] 
Merge branch 'matthijs-fix-openssl-init-ssl-leak' into 'main'

Add OPENSSL_cleanup to tls_shutdown function

See merge request isc-projects/bind9!5593

4 years agoAdd OPENSSL_cleanup to tls_shutdown function
Matthijs Mekking [Thu, 25 Nov 2021 14:10:00 +0000 (15:10 +0100)] 
Add OPENSSL_cleanup to tls_shutdown function

This prevents a direct leak in OPENSSL_init_crypto (called from
OPENSSL_init_ssl).

Add shim version of OPENSSL_cleanup because it is missing in LibreSSL on
OpenBSD.

4 years agoMerge branch '3021-dns_sdlz_putrr-does-not-auto-increase-buffer' into 'main'
Mark Andrews [Thu, 25 Nov 2021 20:08:02 +0000 (20:08 +0000)] 
Merge branch '3021-dns_sdlz_putrr-does-not-auto-increase-buffer' into 'main'

Resolve "dns_sdlz_putrr does not auto increase buffer"

Closes #3021

See merge request isc-projects/bind9!5588

4 years agoAdd CHANGES for [GL #3021]
Mark Andrews [Wed, 24 Nov 2021 00:20:17 +0000 (11:20 +1100)] 
Add CHANGES for [GL #3021]

4 years agoExercise ISC_R_NOSPACE path in dns_sdlz_putrr
Mark Andrews [Thu, 25 Nov 2021 02:16:56 +0000 (13:16 +1100)] 
Exercise ISC_R_NOSPACE path in dns_sdlz_putrr

Use relative names when adding SOA record and a long domain
name to create SOA RR where the wire format is longer than
the initial buffer allocation in dns_sdlz_putrr.

4 years agoDo not convert ISC_R_NOSPACE to DNS_R_SERVFAIL too early
Mark Andrews [Wed, 24 Nov 2021 00:03:19 +0000 (11:03 +1100)] 
Do not convert ISC_R_NOSPACE to DNS_R_SERVFAIL too early

The parsing loop needs to process ISC_R_NOSPACE to properly
size the buffer.  If result is still ISC_R_NOSPACE at the end
of the parsing loop set result to DNS_R_SERVFAIL.

4 years agoMerge branch 'mnowak/warning-array-subscript-is-of-type-char-on-netbsd-9' into 'main'
Michal Nowak [Thu, 25 Nov 2021 17:53:35 +0000 (17:53 +0000)] 
Merge branch 'mnowak/warning-array-subscript-is-of-type-char-on-netbsd-9' into 'main'

Fix "array subscript is of type 'char'" on NetBSD 9

See merge request isc-projects/bind9!5591

4 years agoFix "array subscript is of type 'char'" on NetBSD 9
Michal Nowak [Wed, 24 Nov 2021 15:50:57 +0000 (16:50 +0100)] 
Fix "array subscript is of type 'char'" on NetBSD 9

    In file included from rdata.c:602:
    In file included from ./code.h:88:
    ./rdata/in_1/svcb_64.c:259:9: warning: array subscript is of type 'char' [-Wchar-subscripts]
                            if (!isdigit(*region->base)) {
                                 ^~~~~~~~~~~~~~~~~~~~~~
    /usr/include/sys/ctype_inline.h:51:44: note: expanded from macro 'isdigit'
    #define isdigit(c)      ((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_D))
                                                    ^~~~

4 years agoMerge branch '3024-doh_connect_makeuri-fails-on-illumos' into 'main'
Mark Andrews [Thu, 25 Nov 2021 12:58:21 +0000 (12:58 +0000)] 
Merge branch '3024-doh_connect_makeuri-fails-on-illumos' into 'main'

Resolve "doh_connect_makeuri fails on illumos"

Closes #3024

See merge request isc-projects/bind9!5592

4 years agouse .s_addr to handle potential union in struct in_addr
Mark Andrews [Thu, 25 Nov 2021 05:13:46 +0000 (16:13 +1100)] 
use .s_addr to handle potential union in struct in_addr

4 years agoMerge branch '3019-curl-check-http2-features' into 'main'
Artem Boldariev [Thu, 25 Nov 2021 09:19:30 +0000 (09:19 +0000)] 
Merge branch '3019-curl-check-http2-features' into 'main'

Fix doth test when curl without HTTP/2 support is unavailable

Closes #3019

See merge request isc-projects/bind9!5585

4 years agoFix doth test when curl without HTTP/2 support is unavailable
Artem Boldariev [Tue, 23 Nov 2021 10:58:06 +0000 (12:58 +0200)] 
Fix doth test when curl without HTTP/2 support is unavailable

This commit makes the 'doth' system test skip HTTP headers check when
curl version is new enough but was compiled without HTTP/2 support.

This should fix the 'doth' system test for macOS systems using
macports.

4 years agoMerge branch 'artem-fix-xot-crash-on-unexpected-incoming-message' into 'main'
Artem Boldariev [Wed, 24 Nov 2021 09:40:15 +0000 (09:40 +0000)] 
Merge branch 'artem-fix-xot-crash-on-unexpected-incoming-message' into 'main'

Fix a crash on unexpected incoming DNS message during XoT xfer

Closes #3004

See merge request isc-projects/bind9!5567

4 years agoAdd an entry to CHANGES [GL #3004]
Artem Boldariev [Fri, 12 Nov 2021 08:47:25 +0000 (10:47 +0200)] 
Add an entry to CHANGES [GL #3004]

Mentions that there is a fix to a bug in DoT code leading to an abort
when a zone transfer over TLS ends with an unexpected DNS message.

4 years agoFix a crash on unexpected incoming DNS message during XoT xfer
Artem Boldariev [Thu, 11 Nov 2021 14:17:02 +0000 (16:17 +0200)] 
Fix a crash on unexpected incoming DNS message during XoT xfer

This commit fixes a peculiar corner case in the client-side DoT code
because of which a crash could occur during a zone transfer. A junk
DNS message should be sent at the end of a zone transfer via TLS to
trigger the crash (abort).

This commit, hopefully, fixes that.

Also, this commit adds similar changes to the TCP DNS code, as it
shares the same origin and most of the logic.

4 years agoMerge branch '3002-fix-handling-of-mismatched-responses-past-timeout' into 'main'
Michał Kępień [Tue, 23 Nov 2021 14:40:40 +0000 (14:40 +0000)] 
Merge branch '3002-fix-handling-of-mismatched-responses-past-timeout' into 'main'

Fix handling of mismatched responses past timeout

Closes #3002

See merge request isc-projects/bind9!5586

4 years agoFix handling of mismatched responses past timeout
Michał Kępień [Tue, 23 Nov 2021 14:35:39 +0000 (15:35 +0100)] 
Fix handling of mismatched responses past timeout

When a UDP dispatch receives a mismatched response, it checks whether
there is still enough time to wait for the correct one to arrive before
the timeout fires.  If there is not, the result code is set to
ISC_R_TIMEDOUT, but it is not subsequently used anywhere as 'response'
is set to NULL a few lines earlier.  This results in the higher-level
read callback (resquery_response() in case of resolver code) not being
called.  However, shortly afterwards, a few levels up the call chain,
isc__nm_udp_read_cb() calls isc__nmsocket_timer_stop() on the dispatch
socket, effectively disabling read timeout handling for that socket.
Combined with the fact that reading is not restarted in such a case
(e.g. by calling dispatch_getnext() from udp_recv()), this leads to the
higher-level query structure remaining referenced indefinitely because
the dispatch socket it uses will neither be read from nor closed due to
a timeout.  This in turn causes fetch contexts to linger around
indefinitely, which in turn i.a. prevents certain cache nodes (those
containing rdatasets used by fetch contexts, like fctx->nameservers)
from being cleaned.

Fix by making sure the higher-level callback does get invoked with the
ISC_R_TIMEDOUT result code when udp_recv() determines there is no more
time left to receive the correct UDP response before the timeout fires.
This allows the higher-level callback to clean things up, preventing the
reference leak described above.

4 years agoMerge branch '1608-catz-reconfig-crash-fix' into 'main'
Arаm Sаrgsyаn [Tue, 23 Nov 2021 12:32:05 +0000 (12:32 +0000)] 
Merge branch '1608-catz-reconfig-crash-fix' into 'main'

Fix catalog zone reconfiguration crash

Closes #1608

See merge request isc-projects/bind9!5481

4 years agoAdd a regression test
Evan Hunt [Mon, 11 Oct 2021 20:01:20 +0000 (13:01 -0700)] 
Add a regression test

Reconfigure the server without catalog-zone configuration, and then
put it back and reconfigure again, to confirm that there's no crash.

4 years agoAdd CHANGES and release notes for [GL #1608]
Aram Sargsyan [Mon, 11 Oct 2021 18:33:06 +0000 (18:33 +0000)] 
Add CHANGES and release notes for [GL #1608]

4 years agoFix catalog zone reconfiguration crash
Aram Sargsyan [Mon, 11 Oct 2021 18:13:39 +0000 (18:13 +0000)] 
Fix catalog zone reconfiguration crash

The following scenario triggers a "named" crash:

1. Configure a catalog zone.
2. Start "named".
3. Comment out the "catalog-zone" clause.
4. Run `rndc reconfig`.
5. Uncomment the "catalog-zone" clause.
6. Run `rndc reconfig` again.

Implement the required cleanup of the in-memory catalog zone during
the first `rndc reconfig`, so that the second `rndc reconfig` could
find it in an expected state.

4 years agoMerge branch '3013-resolver-test-failure' into 'main'
Evan Hunt [Mon, 22 Nov 2021 23:18:57 +0000 (23:18 +0000)] 
Merge branch '3013-resolver-test-failure' into 'main'

fix intermittent resolver test error

Closes #3013

See merge request isc-projects/bind9!5576

4 years agofix intermittent resolver test error
Evan Hunt [Tue, 16 Nov 2021 05:59:37 +0000 (21:59 -0800)] 
fix intermittent resolver test error

the resolver test checks that the correct number of fetches have
been sent NS rrsets of a given size, but it formerly did so by
counting queries received by the authoritative server, which could
result in an off-by-one count if one of the queries had been resent
due to a timeout or a port number collision.

this commit changes the test to count fetches initiated by the
resolver, which should prevent the intermittent test failure, and
is the actual datum we were interested in anyway.

4 years agoMerge branch '3014-broken-ecdsa-signatures-may-be-generated-with-certain-private...
Mark Andrews [Mon, 22 Nov 2021 22:04:30 +0000 (22:04 +0000)] 
Merge branch '3014-broken-ecdsa-signatures-may-be-generated-with-certain-private-keys' into 'main'

Resolve "Broken ECDSA signatures may be generated with certain private keys"

Closes #3014

See merge request isc-projects/bind9!5580

4 years agoAdd CHANGES for [GL #3014]
Mark Andrews [Thu, 18 Nov 2021 06:34:33 +0000 (17:34 +1100)] 
Add CHANGES for [GL #3014]

4 years agoReject too long ECDSA public keys
Mark Andrews [Fri, 19 Nov 2021 09:54:05 +0000 (10:54 +0100)] 
Reject too long ECDSA public keys

opensslecdsa_fromdns() already rejects too short ECDSA public keys.
Make it also reject too long ones.  Remove an assignment made redundant
by this change.

4 years agoPass key length to raw_key_to_ossl() by value
Michał Kępień [Fri, 19 Nov 2021 09:32:21 +0000 (10:32 +0100)] 
Pass key length to raw_key_to_ossl() by value

As raw_key_to_ossl() no longer stores anything at the pointer passed to
it in the 'key_len' parameter, change the type of the latter to size_t.

4 years agoFix parsing ECDSA keys
Michał Kępień [Fri, 19 Nov 2021 09:32:21 +0000 (10:32 +0100)] 
Fix parsing ECDSA keys

raw_key_to_ossl() assumes fixed ECDSA private key sizes (32 bytes for
ECDSAP256SHA256, 48 bytes for ECDSAP384SHA384).  Meanwhile, in rare
cases, ECDSAP256SHA256 private keys are representable in 31 bytes or
less (similarly for ECDSAP384SHA384) and that is how they are then
stored in the "PrivateKey" field of the key file.  Nevertheless,
raw_key_to_ossl() always calls BN_bin2bn() with a fixed length argument,
which in the cases mentioned above leads to erroneously interpreting
uninitialized memory as a part of the private key.  This results in the
latter being malformed and broken signatures being generated.  Address
by using the key length provided by the caller rather than a fixed one.
Apply the same change to public key parsing code for consistency, adding
an INSIST() to prevent buffer overruns.

4 years agoDon't use 'dnssec-signzone -P' unless necessary
Mark Andrews [Thu, 18 Nov 2021 03:31:52 +0000 (14:31 +1100)] 
Don't use 'dnssec-signzone -P' unless necessary

Most of the test zones in the dnssec system test can be verified.
Use -z when only a single key is being used so that the verifier
knows that only a single key is in use.

4 years agoGenerate test zone with multiple NSEC and NSEC3 chains
Mark Andrews [Thu, 18 Nov 2021 03:22:04 +0000 (14:22 +1100)] 
Generate test zone with multiple NSEC and NSEC3 chains

The method used to generate a test zone with multiple NSEC and
NSEC3 chains was incorrect.  Multiple calls to dnssec-signzone
with multiple parameters is not additive.  Extract the chain on
each run then add them to the final signed zone instance.

4 years agoMerge branch '3018-resolver-crash' into 'main'
Ondřej Surý [Mon, 22 Nov 2021 10:38:15 +0000 (10:38 +0000)] 
Merge branch '3018-resolver-crash' into 'main'

fix a use-after-free in resolver

Closes #3018

See merge request isc-projects/bind9!5584

4 years agoCHANGES for [GL #3018]
Evan Hunt [Fri, 19 Nov 2021 20:41:43 +0000 (12:41 -0800)] 
CHANGES for [GL #3018]

4 years agofix a use-after-free in resolver
Evan Hunt [Fri, 19 Nov 2021 03:29:07 +0000 (19:29 -0800)] 
fix a use-after-free in resolver

when processing a mismatched response, we call dns_dispatch_getnext().
If that fails, for example because of a timeout, fctx_done() is called,
which cancels all queries. This triggers a crash afterward when
fctx_cancelquery() is called, and is unnecessary since fctx_done()
would have been called later anyway.

4 years agoMerge branch '2978-fix-data-race-in-adb.c' into 'main'
Ondřej Surý [Mon, 22 Nov 2021 10:29:02 +0000 (10:29 +0000)] 
Merge branch '2978-fix-data-race-in-adb.c' into 'main'

Fix the data race when shutting down dns_adb

Closes #2978

See merge request isc-projects/bind9!5569

4 years agoFix the data race when shutting down dns_adb
Ondřej Surý [Mon, 15 Nov 2021 11:13:22 +0000 (12:13 +0100)] 
Fix the data race when shutting down dns_adb

When dns_adb is shutting down, first the adb->shutting_down flag is set
and then task is created that runs shutdown_stage2() that sets the
shutdown flag on names and entries.  However, when dns_adb_createfind()
is called, only the individual shutdown flags are being checked, and the
global adb->shutting_down flag was not checked.  Because of that it was
possible for a different thread to slip in and create new find between
the dns_adb_shutdown() and dns_adb_detach(), but before the
shutdown_stage2() task is complete.  This was detected by
ThreadSanitizer as data race because the zonetable might have been
already detached by dns_view shutdown process and simultaneously
accessed by dns_adb_createfind().

This commit converts the adb->shutting_down to atomic_bool to prevent
the global adb lock when creating the find.

4 years agoMerge branch '1836-extended-dns_errors' into 'main'
Matthijs Mekking [Fri, 19 Nov 2021 09:58:26 +0000 (09:58 +0000)] 
Merge branch '1836-extended-dns_errors' into 'main'

Set Extended EDNS Error (EDE) Prohibited (18)

See merge request isc-projects/bind9!4793

4 years agoTest for EDE option with non-EDNS query
Matthijs Mekking [Mon, 1 Nov 2021 07:46:35 +0000 (08:46 +0100)] 
Test for EDE option with non-EDNS query

Add a test case to make sure the EDE option is not set on an EDNS
disabled query.

4 years agoAdd CHANGES and release notes for EDE:18
Matthijs Mekking [Thu, 28 Oct 2021 13:17:21 +0000 (15:17 +0200)] 
Add CHANGES and release notes for EDE:18

New feature.

4 years agoTest for EDE option 18 in allow-query test
Matthijs Mekking [Thu, 28 Oct 2021 13:13:31 +0000 (15:13 +0200)] 
Test for EDE option 18 in allow-query test

If a query is refused because of an ACL error, check that the extended
DNS error "Prohibited (18)" is set.

4 years agoAdd EDE to query messages
Matthijs Mekking [Mon, 8 Mar 2021 16:12:25 +0000 (17:12 +0100)] 
Add EDE to query messages

Add extended DNS error on refused queries. All instances are related to
unauthorized clients, so set extended DNS error code 18 (Prohibited).

4 years agoAdd method to set extended DNS error
Matthijs Mekking [Sat, 6 Mar 2021 14:43:00 +0000 (15:43 +0100)] 
Add method to set extended DNS error

Add a new parameter to 'ns_client_t' to store potential extended DNS
error. Reset when the client request ends, or is put back.

Add defines for all well-known info-codes.

Update the number of DNS_EDNSOPTIONS that we are willing to set.

Create a new function to set the extended error for a client reply.

4 years agoMerge branch 'doc-fix-cookie-algorithm-desc' into 'main'
Matthijs Mekking [Thu, 18 Nov 2021 12:57:52 +0000 (12:57 +0000)] 
Merge branch 'doc-fix-cookie-algorithm-desc' into 'main'

[ISC-support #19862] Update docs to reflect changes to acceptable cookie-algorithm values

See merge request isc-projects/bind9!5573

4 years agoUpdate docs with correct cookie-algorithm values
Dan Theisen [Mon, 15 Nov 2021 11:59:01 +0000 (03:59 -0800)] 
Update docs with correct cookie-algorithm values

The documentation was inconsistent with the code. The new description
for cookie-algorithm now reflects the current behavior.

The following two commits are the relevant code changes to this
section of docs: afa81ee4 a912f313

4 years agoMerge branch 'v9_17_20-release' into 'main'
Michał Kępień [Thu, 18 Nov 2021 08:14:40 +0000 (08:14 +0000)] 
Merge branch 'v9_17_20-release' into 'main'

Merge 9.17.20 release branch

See merge request isc-projects/bind9!5581

4 years agoSet up release notes for BIND 9.17.21
Michał Kępień [Thu, 18 Nov 2021 08:00:07 +0000 (09:00 +0100)] 
Set up release notes for BIND 9.17.21

4 years agoUpdate BIND version to 9.17.20
Michał Kępień [Fri, 5 Nov 2021 07:25:48 +0000 (08:25 +0100)] 
Update BIND version to 9.17.20

4 years agoAdd a CHANGES marker
Michał Kępień [Fri, 5 Nov 2021 07:25:48 +0000 (08:25 +0100)] 
Add a CHANGES marker

4 years agoMerge branch 'michal/prepare-documentation-for-bind-9.17.20' into 'v9_17_20-release'
Michał Kępień [Fri, 5 Nov 2021 07:24:45 +0000 (07:24 +0000)] 
Merge branch 'michal/prepare-documentation-for-bind-9.17.20' into 'v9_17_20-release'

Prepare documentation for BIND 9.17.20

See merge request isc-private/bind9!335

4 years agoPrepare release notes for BIND 9.17.20
Michał Kępień [Fri, 5 Nov 2021 07:04:15 +0000 (08:04 +0100)] 
Prepare release notes for BIND 9.17.20