]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
4 years agofixup! fixup! WIP: Support new server connect syntax 2992-tcp-only-replace
Artem Boldariev [Fri, 26 Nov 2021 20:18:35 +0000 (22:18 +0200)] 
fixup! fixup! WIP: Support new server connect syntax

4 years agofixup! WIP: Support new server connect syntax
Artem Boldariev [Fri, 26 Nov 2021 19:38:10 +0000 (21:38 +0200)] 
fixup! WIP: Support new server connect syntax

4 years agoWIP: Support new server connect syntax
Artem Boldariev [Thu, 25 Nov 2021 16:40:15 +0000 (18:40 +0200)] 
WIP: Support new server connect syntax

4 years agoWIP: add new "connect" server option syntax
Artem Boldariev [Thu, 25 Nov 2021 11:52:47 +0000 (13:52 +0200)] 
WIP: add new "connect" server option syntax

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

4 years agoReorder release notes
Michał Kępień [Fri, 5 Nov 2021 07:04:15 +0000 (08:04 +0100)] 
Reorder release notes

4 years agoTweak and reword release notes
Michał Kępień [Fri, 5 Nov 2021 07:04:15 +0000 (08:04 +0100)] 
Tweak and reword release notes

4 years agoMerge branch '2374-mdig-ephemeral' into 'main'
Evan Hunt [Wed, 17 Nov 2021 22:38:50 +0000 (22:38 +0000)] 
Merge branch '2374-mdig-ephemeral' into 'main'

Make mdig use the OS-supplied ephemeral port range

Closes #2374

See merge request isc-projects/bind9!5552

4 years agoMake mdig use the OS-supplied ephemeral port range
Evan Hunt [Tue, 2 Nov 2021 09:37:20 +0000 (02:37 -0700)] 
Make mdig use the OS-supplied ephemeral port range

mdig was always using the default 1024-65535 range for outgoing
messages, instead of using the system's configured ephemeral ports.

4 years agoMerge branch 'each-fix-warnings' into 'main'
Evan Hunt [Wed, 17 Nov 2021 22:11:36 +0000 (22:11 +0000)] 
Merge branch 'each-fix-warnings' into 'main'

address '--disable-doh' failures

See merge request isc-projects/bind9!5561

4 years agoaddress '--disable-doh' failures
Evan Hunt [Mon, 8 Nov 2021 20:44:55 +0000 (12:44 -0800)] 
address '--disable-doh' failures

Change 5756 (GL #2854) introduced build errors when using
'configure --disable-doh'.  To fix this, isc_nm_is_http_handle() is
now defined in all builds, not just builds that have DoH enabled.

Missing code comments were added both for that function and for
isc_nm_is_tlsdns_handle().

4 years agoMerge branch '3012-begin-end-dnssec-managed-keys-in-bin-named-config-c-are-mismatched...
Mark Andrews [Tue, 16 Nov 2021 21:44:21 +0000 (21:44 +0000)] 
Merge branch '3012-begin-end-dnssec-managed-keys-in-bin-named-config-c-are-mismatched' into 'main'

Resolve "BEGIN/END DNSSEC/MANAGED KEYS in bin/named/config.c are mismatched."

Closes #3012

See merge request isc-projects/bind9!5575

4 years agoEmbed NAMED_SYSCONFDIR contents in the bind.keys comment
Mark Andrews [Tue, 16 Nov 2021 03:39:05 +0000 (14:39 +1100)] 
Embed NAMED_SYSCONFDIR contents in the bind.keys comment

4 years agoUpdate comments around built in trust anchors
Mark Andrews [Tue, 16 Nov 2021 03:36:10 +0000 (14:36 +1100)] 
Update comments around built in trust anchors

The comments now say "# BEGIN TRUST ANCHORS" and "# END TRUST ANCHORS".

4 years agoMerge branch 'ondrej/update-flycheck-configuration-on-Linux' into 'main'
Ondřej Surý [Mon, 15 Nov 2021 11:33:37 +0000 (11:33 +0000)] 
Merge branch 'ondrej/update-flycheck-configuration-on-Linux' into 'main'

Add flycheck configuration for libxml2 and json-c on Linux

See merge request isc-projects/bind9!5570

4 years agoAdd flycheck configuration for libxml2 and json-c on Linux
Ondřej Surý [Mon, 15 Nov 2021 11:18:44 +0000 (12:18 +0100)] 
Add flycheck configuration for libxml2 and json-c on Linux

4 years agoMerge branch '3003-greedy-regular-expression-causes-intermittent-nsupdate-system...
Mark Andrews [Wed, 10 Nov 2021 01:49:43 +0000 (01:49 +0000)] 
Merge branch '3003-greedy-regular-expression-causes-intermittent-nsupdate-system-test-failures' into 'main'

Resolve "Greedy regular expression causes intermittent "nsupdate" system test failures"

Closes #3003

See merge request isc-projects/bind9!5559

4 years agoAdd CHANGES note for [GL #3003]
Mark Andrews [Mon, 8 Nov 2021 03:10:19 +0000 (14:10 +1100)] 
Add CHANGES note for [GL #3003]

4 years agoReplace incorrect sed expersion with awk
Mark Andrews [Mon, 8 Nov 2021 03:05:42 +0000 (14:05 +1100)] 
Replace incorrect sed expersion with awk

The sed expression could find the wrong instance of 10.
Use awk to replace the TTL field and also to specify the
server and issue the send command.

4 years agoMerge branch 'pspacek/ci-jobs-interruptible' into 'main'
Petr Špaček [Tue, 9 Nov 2021 10:54:39 +0000 (10:54 +0000)] 
Merge branch 'pspacek/ci-jobs-interruptible' into 'main'

Automatically cancel CI jobs on outdated branches

See merge request isc-projects/bind9!5558

4 years agoAutomatically cancel CI jobs on outdated branches
Petr Špaček [Fri, 5 Nov 2021 10:39:07 +0000 (11:39 +0100)] 
Automatically cancel CI jobs on outdated branches

Gitlab feature
https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-redundant-pipelines
can automatically cancel jobs which operate on an outdated code, i.e. on
branches which received new commits while jobs with an older set of
commits are still running. For this feature to work jobs have to be
configured with boolean interruptible: true.

I think practically all of our current CI jobs can be cancelled,
so the option is now on by default for all jobs.

4 years agoMerge branch 'pspacek/gitlab-ci-cleanup' into 'main'
Petr Špaček [Tue, 9 Nov 2021 09:54:51 +0000 (09:54 +0000)] 
Merge branch 'pspacek/gitlab-ci-cleanup' into 'main'

Remove obsolete PYTHONPATH setting from .gitlab-ci.yaml

See merge request isc-projects/bind9!5563

4 years agoRemove obsolete PYTHONPATH setting from .gitlab-ci.yaml
Petr Špaček [Tue, 9 Nov 2021 09:23:51 +0000 (10:23 +0100)] 
Remove obsolete PYTHONPATH setting from .gitlab-ci.yaml

It was leftover after removing Python tools in commit
98b3b93791777218c04a67ddaef22619162249f7.

4 years agoMerge branch '2779-wildcard_test_property_based' into 'main'
Petr Špaček [Mon, 8 Nov 2021 13:20:50 +0000 (13:20 +0000)] 
Merge branch '2779-wildcard_test_property_based' into 'main'

Add property based test for wildcard expansion

See merge request isc-projects/bind9!5203

4 years agoFix system test .status file cleanup
Petr Špaček [Wed, 27 Oct 2021 12:56:58 +0000 (14:56 +0200)] 
Fix system test .status file cleanup

4 years agoAdd new system test for wildcard expansion
Petr Špaček [Mon, 21 Jun 2021 12:51:43 +0000 (14:51 +0200)] 
Add new system test for wildcard expansion

This is almost minimal prototype to show how to use python-hypothesis
library in a system test. It does not fully replace existing shell-based
system test for wildcards.

4 years agoUse more liberal pylint for tests
Petr Špaček [Mon, 28 Jun 2021 14:17:01 +0000 (16:17 +0200)] 
Use more liberal pylint for tests

Ignore wrong-import-position to enable use of pytest.importorskip.

4 years agoUse more liberal flake8 for tests
Petr Špaček [Wed, 23 Jun 2021 08:57:14 +0000 (10:57 +0200)] 
Use more liberal flake8 for tests

Ignore rule W402 (wrong import order) to enable use of
pytest.importorskip.

4 years agoAllow py.test system test to skip itself
Petr Špaček [Tue, 22 Jun 2021 14:11:26 +0000 (16:11 +0200)] 
Allow py.test system test to skip itself

Enable use of shortcuts like pytest.importorskip and other tricks
which can cause test to skip itself.

4 years agoMerge branch '2854-cache-control-max-age' into 'main'
Artem Boldariev [Fri, 5 Nov 2021 13:02:52 +0000 (13:02 +0000)] 
Merge branch '2854-cache-control-max-age' into 'main'

Resolve #2854: DoH:  Assign HTTP responses freshness lifetime according to the smallest TTL found in the Answer section

Closes #2854

See merge request isc-projects/bind9!5493

4 years agoModify the CHANGES file [GL #2854]
Artem Boldariev [Wed, 13 Oct 2021 12:26:14 +0000 (15:26 +0300)] 
Modify the CHANGES file [GL #2854]

Mentions that we now assign HTTP freshness lifetime to responses sent
over DNS-over-HTTPS.

4 years agoadd a max-age test to doth system test
Evan Hunt [Wed, 3 Nov 2021 23:57:26 +0000 (16:57 -0700)] 
add a max-age test to doth system test

use curl, when available, to query for names that do and do not
exist; dump the response headers and check for the expected
max-age value.

4 years agoDoH: Set the "max-age" "Cache-Control" HTTP header value
Artem Boldariev [Tue, 12 Oct 2021 13:58:45 +0000 (16:58 +0300)] 
DoH: Set the "max-age" "Cache-Control" HTTP header value

This commit makes BIND set the "max-age" value of the "Cache-Control"
HTTP header to the minimal TTL from the Answer section for positive
answers, as RFC 8484 advises in section 5.1.

We calculate the minimal TTL as a side effect of rendering the
response DNS message, so it does not change the code flow much, nor
should it have any measurable negative impact on the performance.

For negative answers, the "max-age" value is set using the TTL and
SOA-minimum values from an SOA record in the Authority section.

4 years agoDoH: Add isc_nm_set_min_answer_ttl()
Artem Boldariev [Wed, 6 Oct 2021 11:09:53 +0000 (14:09 +0300)] 
DoH: Add isc_nm_set_min_answer_ttl()

This commit adds an isc_nm_set_min_answer_ttl() function which is
intended to to be used to give a hint to the underlying transport
regarding the answer TTL.

The interface is intentionally kept generic because over time more
transports might benefit from this functionality, but currently it is
intended for DoH to set "max-age" value within "Cache-Control" HTTP
header (as recommended in the RFC8484, section 5.1 "Cache
Interaction").

It is no-op for other DNS transports for the time being.

4 years agoMerge branch 'pspacek/stats_version_fix' into 'main'
Michał Kępień [Fri, 5 Nov 2021 06:42:33 +0000 (06:42 +0000)] 
Merge branch 'pspacek/stats_version_fix' into 'main'

Fix incorrect version bump in statistics channels

See merge request isc-projects/bind9!5557

4 years agoFix incorrect version bump in statistics channels
Petr Špaček [Wed, 3 Nov 2021 13:50:08 +0000 (14:50 +0100)] 
Fix incorrect version bump in statistics channels

The version number for the XML statistics channel was not incremented
correctly after removal of isc_socket code in
a55589f881bc4e4c1099e50b6d4ce84ffc7b5ba3, and the JSON version number
was not incremented at all.

4 years agoMerge branch '2973-http-buffer-fix' into 'main'
Evan Hunt [Fri, 5 Nov 2021 01:09:44 +0000 (01:09 +0000)] 
Merge branch '2973-http-buffer-fix' into 'main'

statschannel doesn't handle multiple reads correctly

Closes #2973

See merge request isc-projects/bind9!5530

4 years agoCHANGES for [GL #2973]
Evan Hunt [Sat, 23 Oct 2021 05:22:38 +0000 (22:22 -0700)] 
CHANGES for [GL #2973]

4 years agoHandle truncating the request stream in isc_httpd
Mark Andrews [Thu, 4 Nov 2021 03:36:33 +0000 (14:36 +1100)] 
Handle truncating the request stream in isc_httpd

If we have had to truncate the request stream, don't resume
reading from it.

4 years agoHandle HTTP/1.1 pipelined requests
Mark Andrews [Tue, 26 Oct 2021 04:28:36 +0000 (15:28 +1100)] 
Handle HTTP/1.1 pipelined requests

Check to see whether there are outstanding requests in the
httpd receive buffer after sending the response, and if so,
process them.

Test that pipelined requests are handled by sending multiple
minimal HTTP/1.1 using netcat (nc) and checking that we get
back the same number of responses.

4 years agoConsume the HTTP headers after processing a request
Mark Andrews [Tue, 26 Oct 2021 00:54:31 +0000 (11:54 +1100)] 
Consume the HTTP headers after processing a request

Remember the amount of space consumed by the HTTP headers, then
move any trailing data to the start of the httpd->recvbuf once
we have finished processing the request.

4 years agostatschannel doesn't handle multiple reads correctly
Evan Hunt [Fri, 22 Oct 2021 22:58:46 +0000 (15:58 -0700)] 
statschannel doesn't handle multiple reads correctly

if an incoming HTTP request is incomplete, but nothing else is clearly
wrong with it, the stats channel continues reading to see if there's
more coming.  the buffer length was not being processed correctly in
this case.  also, the server state was not reset correctly when the
request was complete, so that subsequent requests could be appended to
the first buffer instead of being treated as new.

in addition fixing the above problems, this commit also increases the
size of the httpd request buffer from 1024 to 4096, because some
browsers send a lot of headers.

4 years agoMerge branch '2998-cid-340918-uninitialized-variables-uninit' into 'main'
Mark Andrews [Wed, 3 Nov 2021 09:50:53 +0000 (09:50 +0000)] 
Merge branch '2998-cid-340918-uninitialized-variables-uninit' into 'main'

Resolve "CID 340918: Uninitialized variables (UNINIT)"

Closes #2998

See merge request isc-projects/bind9!5556

4 years agoSilence Coverity false positive
Mark Andrews [Wed, 3 Nov 2021 09:10:34 +0000 (20:10 +1100)] 
Silence Coverity false positive

Coverity if failing to determine that 'priv.elements[i].length' is
actually valid when 'buf[i]' is non-NULL.  Initialise 'priv' to
zeros.

4 years agoMerge branch 'mnowak/fix-typo-in-dns_name_copy-with-result.spatch' into 'main'
Michal Nowak [Tue, 2 Nov 2021 18:27:34 +0000 (18:27 +0000)] 
Merge branch 'mnowak/fix-typo-in-dns_name_copy-with-result.spatch' into 'main'

Fix typo in dns_name_copy-with-result.spatch

See merge request isc-projects/bind9!5549

4 years agoFix typo in dns_name_copy-with-result.spatch
Michal Nowak [Mon, 1 Nov 2021 14:40:08 +0000 (15:40 +0100)] 
Fix typo in dns_name_copy-with-result.spatch

A typo introduced in f3f1cab05e05c9bdd5da91f3ab159ec6658ec7f4 prevents
execution of the dns_name_copy-with-result.spatch. The replacement
should end with semicolon not a colon:

    plus: parse error:
      File "cocci/dns_name_copy-with-result.spatch", line 28, column 23, charpos = 421
      around = ':',
      whole content = + dns_name_copy(E1, E2):

4 years agoMerge branch '2970-bind9-xsl-is-not-properly-transmitted-over-stats-channel' into...
Mark Andrews [Tue, 2 Nov 2021 11:44:44 +0000 (11:44 +0000)] 
Merge branch '2970-bind9-xsl-is-not-properly-transmitted-over-stats-channel' into 'main'

Resolve "bind9.xsl is not properly transmitted over stats channel"

Closes #2970

See merge request isc-projects/bind9!5522

4 years agoCheck that bind9.xsl is properly transmitted
Mark Andrews [Sun, 24 Oct 2021 23:06:55 +0000 (10:06 +1100)] 
Check that bind9.xsl is properly transmitted

4 years agoAdd '\n' to the end of each line when generating xsl.c
Mark Andrews [Fri, 22 Oct 2021 06:00:39 +0000 (17:00 +1100)] 
Add '\n' to the end of each line when generating xsl.c

This makes the bind9.xml more readable in a browser when debugging
and also ensures that the file is properly terminated in the HTTP
transaction.

4 years agoMerge branch '2993-replace-instances-of-arraysize-with-array_size' into 'main'
Mark Andrews [Tue, 2 Nov 2021 10:57:45 +0000 (10:57 +0000)] 
Merge branch '2993-replace-instances-of-arraysize-with-array_size' into 'main'

Resolve "Replace instances of ARRAYSIZE with ARRAY_SIZE"

Closes #2993

See merge request isc-projects/bind9!5551

4 years agoReplace ARRAYSIZE with ARRAY_SIZE
Mark Andrews [Tue, 2 Nov 2021 05:14:40 +0000 (16:14 +1100)] 
Replace ARRAYSIZE with ARRAY_SIZE

4 years agoMerge branch '2991-address-reported-by-coverity-in-updated-openssl-code' into 'main'
Mark Andrews [Mon, 1 Nov 2021 22:37:43 +0000 (22:37 +0000)] 
Merge branch '2991-address-reported-by-coverity-in-updated-openssl-code' into 'main'

Resolve "Address reports by Coverity in updated OpenSSL code"

Closes #2991

See merge request isc-projects/bind9!5547

4 years agoAddress bugs in opensslrsa_tofile
Mark Andrews [Mon, 1 Nov 2021 00:40:26 +0000 (11:40 +1100)] 
Address bugs in opensslrsa_tofile

1) if 'key->external' is set we just need to call
   dst__privstruct_writefile
2) the cleanup of 'bufs' was incorrect as 'i' doesn't reflect the
   the current index into 'bufs'.  Use a simple for loop.

This review was triggered by Coverity reporting a buffer overrun
on 'bufs'.

4 years agoAddress potential memory leak in openssldh_parse()
Mark Andrews [Mon, 1 Nov 2021 00:13:43 +0000 (11:13 +1100)] 
Address potential memory leak in openssldh_parse()

'dh' was being assigned to key->keydata.dh too soon which could
result in a memory leak on error.  Moved the assignement of
key->keydata.dh until after dh was correct.

Coverity was reporting dead code on the error path cleaning up 'dh'
which triggered this review.

4 years agoMerge branch 'mnowak/dst-fix-unavailable-comparekeys' into 'main'
Michal Nowak [Mon, 1 Nov 2021 17:48:12 +0000 (17:48 +0000)] 
Merge branch 'mnowak/dst-fix-unavailable-comparekeys' into 'main'

Add comparekeys to release tarball

See merge request isc-projects/bind9!5548

4 years agoAdd comparekeys to release tarball
Michal Nowak [Mon, 1 Nov 2021 13:40:00 +0000 (14:40 +0100)] 
Add comparekeys to release tarball

'make dist' omits lib/dns/tests/comparekeys/ (added in
7101afa23cfc7cd005aeeb00802481094a0b9cf5) from release tarball it
creates which makes the unit:gcc:tarball CI job permanently fail in the
dst unit test.

4 years agoMerge branch 'artem/tls-do-not-strictly-require-key-and-cert' into 'main'
Artem Boldariev [Sat, 30 Oct 2021 09:13:59 +0000 (09:13 +0000)] 
Merge branch 'artem/tls-do-not-strictly-require-key-and-cert' into 'main'

Be less strict regarding "tls" statements in the configuration file by allowing both "key-file" and "cert-file" be omitted

See merge request isc-projects/bind9!5546

4 years agoBe less strict regarding "tls" statements in the configuration file
Artem Boldariev [Fri, 29 Oct 2021 15:43:40 +0000 (18:43 +0300)] 
Be less strict regarding "tls" statements in the configuration file

In the 9.17.19 release "tls" statements verification code was
added. The code was too strict and assumed that every such a statement
should have both "cert-file" and "key-file" specified. This turned out
to be a regression, as in some cases we plan to use the "tls"
statement to specify TLS connection parameters.

This commit fixes this behaviour; now a "tls" statement should either
have both "cert-file" and "key-file" specified, or both should be
omitted.

4 years agoMerge branch 'pspacek/reentrant-cleanup' into 'main'
Petr Špaček [Fri, 29 Oct 2021 07:09:20 +0000 (07:09 +0000)] 
Merge branch 'pspacek/reentrant-cleanup' into 'main'

remove last remaining reference to _REENTRANT macro and fix DLZ example

See merge request isc-projects/bind9!5544

4 years agoremove last remaining reference to _REENTRANT macro and fix DLZ example
Petr Špaček [Thu, 28 Oct 2021 12:26:09 +0000 (14:26 +0200)] 
remove last remaining reference to _REENTRANT macro and fix DLZ example

It was used only as guard against unused variable declaration, but the
surrounding code depends on strtok_r being defined unconditionally, so
there is no point in guarding a variable.
Glibc documentation suggests it is obsolete anyway and e.g. Meson build
system decided to ignore it. It seems to be required only by old
Solaris compiler and OpenIndiana uses gcc.

4 years agoMerge branch 'pspacek/clang-format-gen-patch' into 'main'
Petr Špaček [Fri, 29 Oct 2021 07:07:09 +0000 (07:07 +0000)] 
Merge branch 'pspacek/clang-format-gen-patch' into 'main'

retain diff output if clang-format changes something

See merge request isc-projects/bind9!5543

4 years agoretain diff output if clang-format changes something
Petr Špaček [Thu, 28 Oct 2021 14:39:20 +0000 (16:39 +0200)] 
retain diff output if clang-format changes something

It's major PITA trying to guess what exactly clang-format has changed,
so how CI stores patch file with changes which can be applied locally if
needed.