]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
4 years agoRun resume_dslookup() from the correct task
Ondřej Surý [Fri, 22 Apr 2022 11:22:12 +0000 (13:22 +0200)] 
Run resume_dslookup() from the correct task

The rctx_chaseds() function calls dns_resolver_createfetch(), passing
fctx->task as the target task to run resume_dslookup() from.  This
breaks task-based serialization of events as fctx->task is the task that
the dns_resolver_createfetch() caller wants to receive its fetch
completion event in; meanwhile, intermediate fetches started by the
resolver itself (e.g. related to QNAME minimization) must use
res->buckets[bucketnum].task instead.  This discrepancy may cause
trouble if the resume_dslookup() callback happens to be run concurrently
with e.g. fctx_doshutdown().

Fix by passing the correct task to dns_resolver_createfetch() in
rctx_chaseds().

4 years agoMerge branch 'michal/fix-loading-plugins-using-just-their-filenames' into 'main'
Michał Kępień [Fri, 22 Apr 2022 11:31:38 +0000 (11:31 +0000)] 
Merge branch 'michal/fix-loading-plugins-using-just-their-filenames' into 'main'

Fix loading plugins using just their filenames

See merge request isc-projects/bind9!6142

4 years agoFix loading plugins using just their filenames
Michał Kępień [Fri, 22 Apr 2022 11:27:12 +0000 (13:27 +0200)] 
Fix loading plugins using just their filenames

BIND 9 plugins are installed using Automake's pkglib_LTLIBRARIES stanza,
which causes the relevant shared objects to be placed in the
$(libdir)/@PACKAGE@/ directory, where @PACKAGE@ is expanded to the
lowercase form of the first argument passed to AC_INIT(), i.e. "bind".
Meanwhile, NAMED_PLUGINDIR - the preprocessor macro that the
ns_plugin_expandpath() function uses for determining the absolute path
to a plugin for which only a filename has been provided (rather than a
path) - is set to $(libdir)/named.  This discrepancy breaks loading
plugins using just their filenames.  Fix the issue (and also prevent it
from reoccurring) by setting NAMED_PLUGINDIR to $(pkglibdir).

4 years agoMerge branch 'michal/regenerate-man-pages-with-sphinx-4.5.0' into 'main'
Michał Kępień [Fri, 22 Apr 2022 11:15:56 +0000 (11:15 +0000)] 
Merge branch 'michal/regenerate-man-pages-with-sphinx-4.5.0' into 'main'

Regenerate man pages with Sphinx 4.5.0

See merge request isc-projects/bind9!6159

4 years agoRegenerate man pages with Sphinx 4.5.0
Michał Kępień [Fri, 22 Apr 2022 11:05:10 +0000 (13:05 +0200)] 
Regenerate man pages with Sphinx 4.5.0

The Debian 11 (bullseye) Docker image, which GitLab CI uses for building
documentation, currently contains the following package versions:

  - Sphinx 4.5.0
  - sphinx-rtd-theme 1.0.0
  - docutils 0.17.1

Regenerate the man pages to match contents produced in a Sphinx
environment using the above package versions.  This is necessary to
prevent the "docs" GitLab CI job from failing.

4 years agoMerge branch '3297-fix-a-pylint-2.13.7-error' into 'main'
Michał Kępień [Fri, 22 Apr 2022 10:13:40 +0000 (10:13 +0000)] 
Merge branch '3297-fix-a-pylint-2.13.7-error' into 'main'

Fix a PyLint 2.13.7 error

Closes #3297

See merge request isc-projects/bind9!6150

4 years agoFix a PyLint 2.13.7 error
Michał Kępień [Fri, 22 Apr 2022 09:25:27 +0000 (11:25 +0200)] 
Fix a PyLint 2.13.7 error

PyLint 2.13.7 reports the following error:

    bin/tests/system/doth/conftest.py:34:28: E0601: Using variable 'stderr' before assignment (used-before-assignment)

The reason the current code has not caused problems before is that
invoking gnutls-cli with just the --logfile=/dev/null argument causes it
to always return with a non-zero exit code, either due to the option not
being supported or due to the hostname argument not being provided.  In
other words, the 'except' branch has always been taken.  PyLint is
obviously right on a syntactical level, though.

Instead of relying on a less than obvious code flow (where the 'except'
branch is always taken), rework the flagged code by employing
subprocess.run(..., check=False) instead of subprocess.check_output(),
making exception handling redundant.

While this issue was investigated, it was also noticed that
subprocess.check_output() was incorrectly used as a context manager:
Popen objects are context managers, but subprocess.check_output() and
subprocess.run() are not.  Fix by dropping the relevant 'with'
statement.

4 years agoFix "digdelv" system test requirements
Michał Kępień [Fri, 22 Apr 2022 09:25:27 +0000 (11:25 +0200)] 
Fix "digdelv" system test requirements

Commit 3ec5d2d6ede18e502ef0ef4521fe917f6531f258 added a Python-based
name server (bin/tests/system/digdelv/ans8/ans.py) to the "digdelv"
system test, but did not update bin/tests/system/Makefile.am to ensure
Python is present in the test environment before the "digdelv" system
test is run.  Update bin/tests/system/Makefile.am to enforce that
requirement.

4 years agoRequire Python 3.6+ for running Python-based tests
Michał Kępień [Fri, 22 Apr 2022 09:25:27 +0000 (11:25 +0200)] 
Require Python 3.6+ for running Python-based tests

configure.ac currently requires Python 3.4 for running Python-based
system tests.  Meanwhile, there are some features in Python 3.6+ that we
would like to use for making our Python code cleaner (e.g. f-strings).
Update the minimum Python version required for running Python-based
system tests to 3.6, noting that:

  - Python 3.4 has reached end-of-life on March 18th, 2019.
  - Python 3.5 has reached end-of-life on September 5th, 2020.

4 years agoMerge branch '3287-prevent-memory-bloat-caused-by-a-jemalloc-quirk' into 'main'
Michał Kępień [Thu, 21 Apr 2022 12:21:24 +0000 (12:21 +0000)] 
Merge branch '3287-prevent-memory-bloat-caused-by-a-jemalloc-quirk' into 'main'

Prevent memory bloat caused by a jemalloc quirk

Closes #3287

See merge request isc-projects/bind9!6137

4 years agoAdd CHANGES entry for GL #3287
Michał Kępień [Thu, 21 Apr 2022 12:19:39 +0000 (14:19 +0200)] 
Add CHANGES entry for GL #3287

4 years agoPrevent memory bloat caused by a jemalloc quirk
Michał Kępień [Thu, 21 Apr 2022 12:19:39 +0000 (14:19 +0200)] 
Prevent memory bloat caused by a jemalloc quirk

Since version 5.0.0, decay-based purging is the only available dirty
page cleanup mechanism in jemalloc.  It relies on so-called tickers,
which are simple data structures used for ensuring that certain actions
are taken "once every N times".  Ticker data (state) is stored in a
thread-specific data structure called tsd in jemalloc parlance.  Ticks
are triggered when extents are allocated and deallocated.  Once every
1000 ticks, jemalloc attempts to release some of the dirty pages hanging
around (if any).  This allows memory use to be kept in check over time.

This dirty page cleanup mechanism has a quirk.  If the first
allocator-related action for a given thread is a free(), a
minimally-initialized tsd is set up which does not include ticker data.
When that thread subsequently calls *alloc(), the tsd transitions to its
nominal state, but due to a certain flag being set during minimal tsd
initialization, ticker data remains unallocated.  This prevents
decay-based dirty page purging from working, effectively enabling memory
exhaustion over time. [1]

The quirk described above has been addressed (by moving ticker state to
a different structure) in jemalloc's development branch [2], but not in
any numbered jemalloc version released to date (the latest one being
5.2.1 as of this writing).

Work around the problem by ensuring that every thread spawned by
isc_thread_create() starts with a malloc() call.  Avoid immediately
calling free() for the dummy allocation to prevent an optimizing
compiler from stripping away the malloc() + free() pair altogether.

An alternative implementation of this workaround was considered that
used a pair of isc_mem_create() + isc_mem_destroy() calls instead of
malloc() + free(), enabling the change to be fully contained within
isc__trampoline_run() (i.e. to not touch struct isc__trampoline), as the
compiler is not allowed to strip away arbitrary function calls.
However, that solution was eventually dismissed as it triggered
ThreadSanitizer reports when tools like dig, nsupdate, or rndc exited
abruptly without waiting for all worker threads to finish their work.

[1] https://github.com/jemalloc/jemalloc/issues/2251
[2] https://github.com/jemalloc/jemalloc/commit/c259323ab3082324100c708109dbfff660d0f4b8

4 years agoMerge branch 'michal/revise-release-related-git-workflow' into 'main'
Michał Kępień [Thu, 21 Apr 2022 07:59:24 +0000 (07:59 +0000)] 
Merge branch 'michal/revise-release-related-git-workflow' into 'main'

Revise release-related Git workflow

See merge request isc-projects/bind9!6124

4 years agoUpdate release checklist
Michał Kępień [Thu, 21 Apr 2022 07:57:14 +0000 (09:57 +0200)] 
Update release checklist

4 years agoMerge branch '2898-improve-functions-parameter-validation-in-lib-dns-message-c-to...
Mark Andrews [Tue, 19 Apr 2022 22:13:47 +0000 (22:13 +0000)] 
Merge branch '2898-improve-functions-parameter-validation-in-lib-dns-message-c-to-prevent-accessing-the-1-index' into 'main'

Resolve "Improve functions parameter validation in lib/dns/message.c to prevent accessing the -1 index of an array"

Closes #2898

See merge request isc-projects/bind9!5824

4 years agoTighten DBC restrictions on message sections
Mark Andrews [Mon, 14 Feb 2022 05:13:46 +0000 (16:13 +1100)] 
Tighten DBC restrictions on message sections

dns_message_findname and dns_message_sectiontotext incorrectly accepted
DNS_SECTION_ANY.  If DNS_SECTION_ANY was passed the section array could
be incorrectly accessed at (-1).

dns_message_pseudosectiontotext and dns_message_pseudosectiontoyaml
incorrectly accepted DNS_PSEUDOSECTION_ANY.  These functions are
designed to process a single section.

4 years agoMerge branch '3275-notify-test-fix' into 'main'
Tony Finch [Tue, 19 Apr 2022 17:10:59 +0000 (17:10 +0000)] 
Merge branch '3275-notify-test-fix' into 'main'

Avoid timeouts in the notify system test

Closes #3275

See merge request isc-projects/bind9!6121

4 years agoUse wait_for_log_re in the autosign system test
Tony Finch [Thu, 14 Apr 2022 09:48:24 +0000 (10:48 +0100)] 
Use wait_for_log_re in the autosign system test

Fix another occurrence of the mistake of passing a regex to
wait_for_log by using the new wait_for_log_re instead.

4 years agoAvoid timeouts in the notify system test
Tony Finch [Tue, 12 Apr 2022 10:49:21 +0000 (11:49 +0100)] 
Avoid timeouts in the notify system test

There were two problems in the notify system test when it waited for
log messages to appear: the shellcheck refactoring introduced a call
to `wait_for_log` with a regex, but `wait_for_log` only supports fixed
strings, so it always ran for the full 45 second timeout; and the new
test to ensure that notify messages time out failed to reset the
nextpart pointer, so if the notify messages timed out before the test
ran, it would fail to see them.

This change adds a `wait_for_log_re` helper that matches a regex, and
uses it where appropriate in the notify system test, which stops the
test from waiting longer than necessary; and it resets the nextpart
pointer so that the notify timeout test works reliably.

Closes #3275

4 years agoMerge branch 'ondrej-improve-taskmgr-tracing' into 'main'
Ondřej Surý [Tue, 19 Apr 2022 13:14:03 +0000 (13:14 +0000)] 
Merge branch 'ondrej-improve-taskmgr-tracing' into 'main'

Add detailed tracing when TASKMGR_TRACE is define

See merge request isc-projects/bind9!6036

4 years agoMerge branch 'ondrej/remove-isc-task-sendto' into 'main'
Ondřej Surý [Tue, 19 Apr 2022 12:25:59 +0000 (12:25 +0000)] 
Merge branch 'ondrej/remove-isc-task-sendto' into 'main'

Remove isc_task_sendto(anddetach) functions

See merge request isc-projects/bind9!6139

4 years agoAdd detailed tracing when TASKMGR_TRACE is defined
Ondřej Surý [Sat, 26 Mar 2022 13:37:38 +0000 (14:37 +0100)] 
Add detailed tracing when TASKMGR_TRACE is defined

When TASKMGR_TRACE=1 is defined, the task and event objects have
detailed tracing information about function, file, line, and
backtrace (to the extent tracked by gcc) where it was created.

At exit, when there are unfinished tasks, they will be printed along
with the detailed information.

4 years agoRemove isc_task_sendto(anddetach) functions
Ondřej Surý [Sat, 26 Mar 2022 13:37:38 +0000 (14:37 +0100)] 
Remove isc_task_sendto(anddetach) functions

The only place where isc_task_sendto() was used was in dns_resolver
unit, where the "sendto" part was actually no-op, because dns_resolver
uses bound tasks.  Remove the isc_task_sendto() and
isc_task_sendtoanddetach() functions in favor of using bound tasks
create with isc_task_create_bound().

Additionally, cache the number of running netmgr threads (nworkers)
locally to reduce the number of function calls.

4 years agoMerge branch 'ondrej/remove-isc_event_constallocate' into 'main'
Ondřej Surý [Tue, 19 Apr 2022 12:23:30 +0000 (12:23 +0000)] 
Merge branch 'ondrej/remove-isc_event_constallocate' into 'main'

Remove isc_event_constallocate()

See merge request isc-projects/bind9!6138

4 years agoRemove isc_event_constallocate()
Ondřej Surý [Tue, 19 Apr 2022 09:16:01 +0000 (11:16 +0200)] 
Remove isc_event_constallocate()

The isc_event_constallocate() function was not used anywhere, thus
remove the isc_event_constallocate() macro, declaration and definition.

4 years agoMerge branch 'ondrej-listen-on-specified-number-of-threads' into 'main'
Ondřej Surý [Tue, 19 Apr 2022 10:36:51 +0000 (10:36 +0000)] 
Merge branch 'ondrej-listen-on-specified-number-of-threads' into 'main'

Allow listening on less than nworkers threads

See merge request isc-projects/bind9!6032

4 years agoAdd CHANGES note for [GL !6032]
Ondřej Surý [Fri, 25 Mar 2022 15:46:31 +0000 (16:46 +0100)] 
Add CHANGES note for [GL !6032]

4 years agoAllow listening on less than nworkers threads
Ondřej Surý [Fri, 25 Mar 2022 15:44:21 +0000 (16:44 +0100)] 
Allow listening on less than nworkers threads

For some applications, it's useful to not listen on full battery of
threads.  Add workers argument to all isc_nm_listen*() functions and
convenience ISC_NM_LISTEN_ONE and ISC_NM_LISTEN_ALL macros.

4 years agoMerge branch '3234-check-the-oid-in-privateoid-keys' into 'main'
Mark Andrews [Tue, 19 Apr 2022 04:53:59 +0000 (04:53 +0000)] 
Merge branch '3234-check-the-oid-in-privateoid-keys' into 'main'

Resolve "Check the OID in PRIVATEOID keys"

Closes #3234

See merge request isc-projects/bind9!6045

4 years agoAdd release note for [GL #3234]
Mark Andrews [Tue, 5 Apr 2022 00:29:08 +0000 (10:29 +1000)] 
Add release note for [GL #3234]

4 years agoAdd CHANGES note for [GL #3234]
Mark Andrews [Tue, 5 Apr 2022 00:26:48 +0000 (10:26 +1000)] 
Add CHANGES note for [GL #3234]

4 years agoCheck PRIVATEDNS and PRIVATEOID key identifiers
Mark Andrews [Tue, 29 Mar 2022 07:08:59 +0000 (18:08 +1100)] 
Check PRIVATEDNS and PRIVATEOID key identifiers

dns_rdata_fromtext and dns_rdata_fromwire now checks that there is
a valid name or oid at the start of the keydata when the key algorithm
is PRIVATEDNS and PRIVATEOID respectively.

dns_rdata_totext now prints out the oid if the algorithm is PRIVATEOID.

4 years agoMerge branch '3279-lib-dns-ncache-c-rdataset_settrust-fails-to-set-trust-on-called...
Mark Andrews [Mon, 18 Apr 2022 23:36:59 +0000 (23:36 +0000)] 
Merge branch '3279-lib-dns-ncache-c-rdataset_settrust-fails-to-set-trust-on-called-rdataset' into 'main'

Resolve "lib/dns/ncache.c:rdataset_settrust() fails to set trust on called rdataset"

Closes #3279

See merge request isc-projects/bind9!6129

4 years agoAdd CHANGES entry for [GL #3279]
Mark Andrews [Thu, 14 Apr 2022 01:19:23 +0000 (11:19 +1000)] 
Add CHANGES entry for [GL #3279]

4 years agoUpdate the rdataset->trust field in ncache.c:rdataset_settrust
Mark Andrews [Thu, 14 Apr 2022 01:16:32 +0000 (11:16 +1000)] 
Update the rdataset->trust field in ncache.c:rdataset_settrust

Both the trust recorded in the slab stucture and the trust on
rdataset need to be updated.

4 years agoCheck that pending negative cache entries for DS can be used successfully
Mark Andrews [Thu, 14 Apr 2022 00:57:11 +0000 (10:57 +1000)] 
Check that pending negative cache entries for DS can be used successfully

Prime the cache with a negative cache DS entry then make a query for
name beneath that entry. This will cause the DS entry to be retieved
as part of the validation process.  Each RRset in the ncache entry
will be validated and the trust level for each will be updated.

4 years agoMerge branch '3235-dig-exitcode' into 'main'
Evan Hunt [Fri, 15 Apr 2022 18:08:10 +0000 (18:08 +0000)] 
Merge branch '3235-dig-exitcode' into 'main'

ensure dig sets exitcode after local UDP connection failure

Closes #3235

See merge request isc-projects/bind9!6107

4 years agoCHANGES for [GL #3235]
Evan Hunt [Fri, 8 Apr 2022 07:39:46 +0000 (00:39 -0700)] 
CHANGES for [GL #3235]

4 years agoensure dig sets exitcode after local UDP connection failure
Evan Hunt [Fri, 8 Apr 2022 07:33:24 +0000 (00:33 -0700)] 
ensure dig sets exitcode after local UDP connection failure

dig previously set an exit code of 9 when a TCP connection failed
or when a UDP connection timed out, but when the server address is
localhost it's possible for a UDP query to fail with ISC_R_CONNREFUSED.
that code path didn't update the exit code, causing dig to exit with
status 0. we now set the exit code to 9 in this failure case.

4 years agoMerge branch '3223-catz-change-of-ownership-aka-coo-support' into 'main'
Arаm Sаrgsyаn [Thu, 14 Apr 2022 22:48:41 +0000 (22:48 +0000)] 
Merge branch '3223-catz-change-of-ownership-aka-coo-support' into 'main'

[3/5] Implement catalog zones change of ownership (coo) support

Closes #3223

See merge request isc-projects/bind9!6013

4 years agoDo not use REQUIRE in dns_catz_entry_detach() after other code
Aram Sargsyan [Fri, 25 Mar 2022 11:49:12 +0000 (11:49 +0000)] 
Do not use REQUIRE in dns_catz_entry_detach() after other code

The REQUIRE checks should be at the top of the function before
any assignments or code.

Move the REQUIRE check to the top.

4 years agoReplace CATZ_OPT_MASTERS with CATZ_OPT_PRIMARIES
Aram Sargsyan [Fri, 25 Mar 2022 11:28:07 +0000 (11:28 +0000)] 
Replace CATZ_OPT_MASTERS with CATZ_OPT_PRIMARIES

Update the enum entry in the continued effort of replacing some
DNS terminology.

4 years agoAdd CHANGES note for [GL #3223]
Aram Sargsyan [Wed, 23 Mar 2022 11:00:18 +0000 (11:00 +0000)] 
Add CHANGES note for [GL #3223]

4 years agoImplement catalog zones change of ownership (coo) support
Aram Sargsyan [Thu, 17 Mar 2022 13:09:11 +0000 (13:09 +0000)] 
Implement catalog zones change of ownership (coo) support

Catalog zones change of ownership is special mechanism to facilitate
controlled migration of a member zone from one catalog to another.

It is implemented using catalog zones property named "coo" and is
documented in DNS catalog zones draft version 5 document.

Implement the feature using a new hash table in the catalog zone
structure, which holds the added "coo" properties for the catalog zone
(containing the target catalog zone's name), and the key for the hash
table being the member zone's name for which the "coo" property is being
created.

Change some log messages to have consistent zone name quoting types.

Update the ARM with change of ownership documentation and usage
examples.

Add tests which check newly the added features.

4 years agoMerge branch '3222-catz-options-new-syntax-based-on-custom-properties' into 'main'
Arаm Sаrgsyаn [Thu, 14 Apr 2022 19:49:00 +0000 (19:49 +0000)] 
Merge branch '3222-catz-options-new-syntax-based-on-custom-properties' into 'main'

[2/5] Implement catalog zones options new syntax based on custom properties

Closes #3222

See merge request isc-projects/bind9!6012

4 years agoDo not cancel processing record datasets in catalog zone after an error
Aram Sargsyan [Thu, 24 Mar 2022 21:38:08 +0000 (21:38 +0000)] 
Do not cancel processing record datasets in catalog zone after an error

When there are multiple record datasets in a database node of a catalog
zone, and BIND encounters a soft error during processing of a dataset,
it breaks from the loop and doesn't process the other datasets in the
node.

There are cases when this is not desired. For example, the catalog zones
draft version 5 states that there must be a TXT RRset named
`version.$CATZ` with exactly one RR, but it doesn't set a limitation
on possible non-TXT RRsets named `version.$CATZ` existing alongside
with the TXT one. In case when one exists, we will get a processing
error and will not continue the loop to process the TXT RRset coming
next.

Remove the "break" statement to continue processing all record datasets.

4 years agoProcess the 'version' record of the catalog zone first
Aram Sargsyan [Thu, 24 Mar 2022 20:24:00 +0000 (20:24 +0000)] 
Process the 'version' record of the catalog zone first

When processing a new or updated catalog zone, the record datasets
from the database are being processed in order. This creates a
problem because we need to know the version of the catalog zone
schema to process some of the records differently, but we do not
know the version until the 'version' record gets processed.

Find the 'version' record and process it first, only then iterate over
the database to process the rest, making sure not to process the
'version' record twice.

4 years agoAdd CHANGES note for [GL #3222]
Aram Sargsyan [Wed, 23 Mar 2022 10:58:39 +0000 (10:58 +0000)] 
Add CHANGES note for [GL #3222]

4 years agoImplement catalog zones options new syntax based on custom properties
Aram Sargsyan [Wed, 16 Mar 2022 20:11:17 +0000 (20:11 +0000)] 
Implement catalog zones options new syntax based on custom properties

According to DNS catalog zones draft version 5 document, catalog
zone custom properties must be placed under the "ext" label.

Make necessary changes to support the new custom properties syntax in
catalog zones with version "2" of the schema.

Change the default catalog zones schema version from "1" to "2" in
ARM to prepare for the new features and changes which come starting
from this commit in order to support the latest DNS catalog zones draft
document.

Make some restructuring in ARM and rename the term catalog zone "option"
to "custom property" to better reflect the terms used in the draft.

Change the version of 'catalog1.zone.' catalog zone in the "catz" system
test to "2", and leave the version of 'catalog2.zone.' catalog zone at
version "1" to test both versions.

Add tests to check that the new syntax works only with the new schema
version, and that the old syntax works only with the legacy schema
version catalog zones.

4 years agoMerge branch '3144-dig-+trace-or-+nssearch-with-+tcp-always-crashes' into 'main'
Arаm Sаrgsyаn [Thu, 14 Apr 2022 10:46:16 +0000 (10:46 +0000)] 
Merge branch '3144-dig-+trace-or-+nssearch-with-+tcp-always-crashes' into 'main'

Unify dig +nssearch next query starting code for TCP and UDP protocols

Closes #3144

See merge request isc-projects/bind9!6109

4 years agoAdd CHANGES note for [GL #3144]
Aram Sargsyan [Fri, 8 Apr 2022 10:04:57 +0000 (10:04 +0000)] 
Add CHANGES note for [GL #3144]

4 years agodetach unfinished query when canceling
Evan Hunt [Mon, 11 Apr 2022 00:42:49 +0000 (17:42 -0700)] 
detach unfinished query when canceling

when a query was canceled while still in the process of connecting,
tcp_connected() and udp_ready() didn't detach the query object.

4 years agoUnify dig +nssearch next query starting code for TCP and UDP protocols
Aram Sargsyan [Thu, 7 Apr 2022 09:23:49 +0000 (09:23 +0000)] 
Unify dig +nssearch next query starting code for TCP and UDP protocols

In `+nssearch` mode `dig` starts the next query of the followup lookup
using `start_udp()` or `start_tcp()` calls without waiting for the
previous query to complete.

In UDP mode that happens in the `send_done()` callback of the previous
query, but in TCP mode that happens in the `start_tcp()` call of the
previous query (recursion) which doesn't work because `start_tcp()`
attaches the `lookup->current_query` to the query it is starting, so a
recursive call will result in an assertion failure.

Make the TCP mode to start the next query in `send_done()`, just like in
the UDP mode. During that time the `lookup->current_query` is already
detached by the `tcp_connected()`/`udp_ready()` callbacks.

4 years agoMerge branch '2931-cds-delete-removed-on-signing' into 'main'
Matthijs Mekking [Wed, 13 Apr 2022 12:37:39 +0000 (12:37 +0000)] 
Merge branch '2931-cds-delete-removed-on-signing' into 'main'

Don't delete CDS DELETE after zone sign

Closes #2931

See merge request isc-projects/bind9!5706

4 years agoAdd CDS/CDNSKEY DELETE documentation
Matthijs Mekking [Tue, 12 Apr 2022 13:26:18 +0000 (15:26 +0200)] 
Add CDS/CDNSKEY DELETE documentation

Mention in the DNSSEC guide in the "revert to unsigned" recipe that you
can publish CDS and CDNSKEY DELETE records to remove the corresponding
DS records from the parent zone.

4 years agoAdd CHANGE and release note for #2931
Matthijs Mekking [Mon, 10 Jan 2022 16:45:00 +0000 (17:45 +0100)] 
Add CHANGE and release note for #2931

Release note worthy.

4 years agoUpdate dns_dnssec_syncdelete() function
Matthijs Mekking [Mon, 10 Jan 2022 16:18:47 +0000 (17:18 +0100)] 
Update dns_dnssec_syncdelete() function

Update the function that synchronizes the CDS and CDNSKEY DELETE
records. It now allows for the possibility that the CDS DELETE record
is published and the CDNSKEY DELETE record is not, and vice versa.

Also update the code in zone.c how 'dns_dnssec_syncdelete()' is called.

With KASP, we still maintain the DELETE records our self. Otherwise,
we publish the CDS and CDNSKEY DELETE record only if they are added
to the zone. We do still check if these records can be signed by a KSK.

This change will allow users to add a CDS and/or CDNSKEY DELETE record
manually, without BIND removing them on the next zone sign.

Note that this commit removes the check whether the key is a KSK, this
check is redundant because this check is also made in
'dst_key_is_signing()' when the role is set to DST_BOOL_KSK.

4 years agoTest CDS DELETE persists after zone sign
Matthijs Mekking [Mon, 10 Jan 2022 14:46:25 +0000 (15:46 +0100)] 
Test CDS DELETE persists after zone sign

Add a test case for a dynamically added CDS DELETE record and make
sure it is not removed when signing the zone. This happens because
BIND maintains CDS and CDNSKEY publishing and it will only allow
CDS DELETE records if the zone is transitioning to insecure. This is
a state that can be identified when using KASP through 'dnssec-policy',
but not when using 'auto-dnssec'.

4 years agoMerge branch 'michal/fix-forward-system-test-requirements' into 'main'
Michał Kępień [Tue, 12 Apr 2022 13:30:06 +0000 (13:30 +0000)] 
Merge branch 'michal/fix-forward-system-test-requirements' into 'main'

Fix "forward" system test requirements

See merge request isc-projects/bind9!6117

4 years agoFix "forward" system test requirements
Michał Kępień [Tue, 12 Apr 2022 13:29:26 +0000 (15:29 +0200)] 
Fix "forward" system test requirements

Commit bf3fffff67e1de78e9387a93674d471bf4291604 added a Python-based
name server (bin/tests/system/forward/ans11/ans.py) to the "forward"
system test, but did not update bin/tests/system/Makefile.am to ensure
Python is present in the test environment before the "forward" system
test is run.  Update bin/tests/system/Makefile.am to enforce that
requirement.

4 years agoMerge branch 'michal/set-up-release-notes-for-bind-9.19.1' into 'main'
Michał Kępień [Tue, 12 Apr 2022 12:12:15 +0000 (12:12 +0000)] 
Merge branch 'michal/set-up-release-notes-for-bind-9.19.1' into 'main'

Set up release notes for BIND 9.19.1

See merge request isc-projects/bind9!6118

4 years agoSet up release notes for BIND 9.19.1
Michał Kępień [Tue, 12 Apr 2022 11:41:18 +0000 (13:41 +0200)] 
Set up release notes for BIND 9.19.1

4 years agoMerge branch 'michal/update-bind-version-to-9.19.1-dev' into 'main'
Michał Kępień [Tue, 12 Apr 2022 11:10:32 +0000 (11:10 +0000)] 
Merge branch 'michal/update-bind-version-to-9.19.1-dev' into 'main'

Update BIND version to 9.19.1-dev

See merge request isc-projects/bind9!6114

4 years agoUpdate BIND version to 9.19.1-dev
Michał Kępień [Tue, 12 Apr 2022 09:15:13 +0000 (11:15 +0200)] 
Update BIND version to 9.19.1-dev

4 years agoMerge branch '3256-adb-crash' into 'main'
Evan Hunt [Tue, 12 Apr 2022 07:15:12 +0000 (07:15 +0000)] 
Merge branch '3256-adb-crash' into 'main'

ADB entries could be unlinked too soon

Closes #3256

See merge request isc-projects/bind9!6113

4 years agoCHANGES for [GL #3256]
Evan Hunt [Tue, 12 Apr 2022 00:32:55 +0000 (17:32 -0700)] 
CHANGES for [GL #3256]

4 years agoADB entries could be unlinked too soon
Evan Hunt [Tue, 12 Apr 2022 00:29:03 +0000 (17:29 -0700)] 
ADB entries could be unlinked too soon

due to a typo in the code, ADB entries were unlinked from their entry
buckets during shutdown if they had a nonzero reference count. they
were only supposed to be unlinked if the reference count was exactly
one (that being the reference held by the bucket itself).

4 years agoUpdate BIND version to 9.19.0 v9.19.0
Michał Kępień [Mon, 11 Apr 2022 08:08:24 +0000 (10:08 +0200)] 
Update BIND version to 9.19.0

4 years agoAdd a CHANGES marker
Michał Kępień [Mon, 11 Apr 2022 08:08:24 +0000 (10:08 +0200)] 
Add a CHANGES marker

4 years agoMerge branch 'michal/prepare-documentation-for-bind-9.19.0' into 'v9_19_0-release'
Michał Kępień [Mon, 11 Apr 2022 08:06:22 +0000 (08:06 +0000)] 
Merge branch 'michal/prepare-documentation-for-bind-9.19.0' into 'v9_19_0-release'

Prepare documentation for BIND 9.19.0

See merge request isc-private/bind9!396

4 years agoPrepare release notes for BIND 9.19.0
Michał Kępień [Mon, 11 Apr 2022 08:05:50 +0000 (10:05 +0200)] 
Prepare release notes for BIND 9.19.0

4 years agoReorder release notes
Michał Kępień [Mon, 11 Apr 2022 08:05:50 +0000 (10:05 +0200)] 
Reorder release notes

4 years agoTweak and reword release notes
Michał Kępień [Mon, 11 Apr 2022 08:05:50 +0000 (10:05 +0200)] 
Tweak and reword release notes

4 years agoUpdate BIND 9 versions mentioned in release notes
Michał Kępień [Mon, 11 Apr 2022 08:05:50 +0000 (10:05 +0200)] 
Update BIND 9 versions mentioned in release notes

4 years agoRemove release notes applying to BIND 9.18.x
Michał Kępień [Mon, 11 Apr 2022 08:05:50 +0000 (10:05 +0200)] 
Remove release notes applying to BIND 9.18.x

4 years agoRemove release notes for BIND 9.17.x
Michał Kępień [Mon, 11 Apr 2022 08:05:50 +0000 (10:05 +0200)] 
Remove release notes for BIND 9.17.x

4 years agoFix CHANGES marker location for BIND 9.17.22
Michał Kępień [Mon, 11 Apr 2022 08:05:50 +0000 (10:05 +0200)] 
Fix CHANGES marker location for BIND 9.17.22

4 years agoUpdate release checklist
Michał Kępień [Mon, 11 Apr 2022 08:05:50 +0000 (10:05 +0200)] 
Update release checklist

4 years agoMerge branch '3129-test-check-fetch-shutting-down-in-resume_dslookup' into 'main'
Michal Nowak [Fri, 8 Apr 2022 10:15:26 +0000 (10:15 +0000)] 
Merge branch '3129-test-check-fetch-shutting-down-in-resume_dslookup' into 'main'

[CVE-2022-0667] Add reproducer

Closes #3129

See merge request isc-projects/bind9!6063

4 years agoAdd a hung fetch check while chasing DS in the forward system test
Aram Sargsyan [Fri, 11 Feb 2022 15:10:39 +0000 (15:10 +0000)] 
Add a hung fetch check while chasing DS in the forward system test

Implement TCP support in the `ans11` Python-based DNS server.

Implement a control command channel in `ans11` to support an optional
silent mode of operation, which, when enabled, will ignore incoming
queries.

In the added check, make the `ans11` the NS server of
"a.root-servers.nil." for `ns3`, so it uses `ans11` (in silent mode)
for the regular (non-forwarded) name resolutions.

This will trigger the "hung fetch" scenario, which was causing `named`
to crash.

4 years agoMerge branch '2950-cache-acceptance-rules-test' into 'main'
Petr Špaček [Thu, 7 Apr 2022 17:29:34 +0000 (17:29 +0000)] 
Merge branch '2950-cache-acceptance-rules-test' into 'main'

[CVE-2021-25220] Add tests for forwarder cache poisoning scenarios

Closes #2950

See merge request isc-projects/bind9!6062

4 years agoAdd tests for forwarder cache poisoning scenarios
Mark Andrews [Mon, 17 Jan 2022 13:19:47 +0000 (00:19 +1100)] 
Add tests for forwarder cache poisoning scenarios

- Check that an NS in an authority section returned from a forwarder
  which is above the name in a configured "forward first" or "forward
  only" zone (i.e., net/NS in a response from a forwarder configured for
  local.net) is not cached.
- Test that a DNAME for a parent domain will not be cached when sent
  in a response from a forwarder configured to answer for a child.
- Check that glue is rejected if its name falls below that of zone
  configured locally.
- Check that an extra out-of-bailiwick data in the answer section is
  not cached (this was already working correctly, but was not explicitly
  tested before).

4 years agoMerge branch '3226-fix-pools-cleaning-in-dns_zone' into 'main'
Ondřej Surý [Thu, 7 Apr 2022 16:12:26 +0000 (16:12 +0000)] 
Merge branch '3226-fix-pools-cleaning-in-dns_zone' into 'main'

Don't destroy mctx and task pools until we are destroying zonemgr

Closes #3226

See merge request isc-projects/bind9!6102

4 years agoDon't destroy mctx and task pools until we are destroying zonemgr
Ondřej Surý [Thu, 7 Apr 2022 13:40:38 +0000 (15:40 +0200)] 
Don't destroy mctx and task pools until we are destroying zonemgr

The mctx, zonetask and loadtask pools were being destroyed in the
shutdown function where in theory a dangling zone could be still
attached to it.

Move the isc_mem_put() on the pools to the destroy() function.

4 years agoMerge branch '3112-test-lingering-tcp-sockets-in-closewait' into 'main'
Michal Nowak [Thu, 7 Apr 2022 16:06:21 +0000 (16:06 +0000)] 
Merge branch '3112-test-lingering-tcp-sockets-in-closewait' into 'main'

[CVE-2022-0396] Add system test lingering CLOSE_WAIT TCP sockets

Closes #3112

See merge request isc-projects/bind9!6046

4 years agoAdd system test **/named.* modifier files to .reuse/dep5
Ondřej Surý [Wed, 2 Mar 2022 15:12:19 +0000 (16:12 +0100)] 
Add system test **/named.* modifier files to .reuse/dep5

There's couple of files that modify behaviour of named when started via
bin/tests/system/start.pl.  Add those files as CC-1.0 to .reuse/dep5 as
they are just empty placeholders.

4 years agoAdd system test lingering CLOSE_WAIT TCP sockets
Matthijs Mekking [Thu, 3 Feb 2022 09:49:25 +0000 (10:49 +0100)] 
Add system test lingering CLOSE_WAIT TCP sockets

Add a test case to check for lingering TCP sockets stuck in the
CLOSE_WAIT state. This can happen if a client sends some garbage after
its first query.

The system test runs the reproducer script and then sends another TCP
query to the resolver. The resolver is configured to allow one TCP
client only. If BIND has its TCP socket stuck in CLOSE_WAIT, it does
not have the resources available to answer the second query.

Note: A better test would be to check if the named daemon does not
have a TCP socket stuck in CLOSE_WAIT for example with netstat. When
running this test locally you can examine named with netstat manually.
But since netstat is platform specific it is not a good candidate to do
this as a system test.

If you, if you could return, don't let it burn.
Do you have to let it linger?
- Cranberries

4 years agoMerge branch '3208-add-CHANGES-entry' into 'main'
Michał Kępień [Thu, 7 Apr 2022 13:05:37 +0000 (13:05 +0000)] 
Merge branch '3208-add-CHANGES-entry' into 'main'

Add CHANGES entry for GL #3208

Closes #3208

See merge request isc-projects/bind9!6099

4 years agoAdd CHANGES entry for GL #3208
Michał Kępień [Thu, 7 Apr 2022 13:01:16 +0000 (15:01 +0200)] 
Add CHANGES entry for GL #3208

4 years agoMerge branch 'pspacek/junit-report' into 'main'
Petr Špaček [Wed, 6 Apr 2022 19:15:19 +0000 (19:15 +0000)] 
Merge branch 'pspacek/junit-report' into 'main'

Generate JUnit reports for unit & system tests

See merge request isc-projects/bind9!6088

4 years agoGenerate JUnit reports for unit & system tests
Petr Špaček [Fri, 1 Apr 2022 17:49:44 +0000 (19:49 +0200)] 
Generate JUnit reports for unit & system tests

This allows Gitlab to show nice summary for individual tests/test
directories and to expose the results in Gitlab API for consumption
elsewhere.

A catch: As of Gitlab 14.7.7, the detailed results are stored
only in artifacts and thus expire. All consumers (including API) need
to be "fast enough" to get the data before they disappear.
This also forces us to always store the artifacts intead of storing them
only on failure.

4 years agoMerge branch '3242-notify-notimeout' into 'main'
Tony Finch [Wed, 6 Apr 2022 17:15:45 +0000 (17:15 +0000)] 
Merge branch '3242-notify-notimeout' into 'main'

Ensure that zone maintenance queries have a retry limit

Closes #3242

See merge request isc-projects/bind9!6051

4 years agoEnsure that dns_request_createvia() has a retry limit
Tony Finch [Fri, 1 Apr 2022 12:46:39 +0000 (13:46 +0100)] 
Ensure that dns_request_createvia() has a retry limit

There are a couple of problems with dns_request_createvia(): a UDP
retry count of zero means unlimited retries (it should mean no
retries), and the overall request timeout is not enforced. The
combination of these bugs means that requests can be retried forever.

This change alters calls to dns_request_createvia() to avoid the
infinite retry bug by providing an explicit retry count. Previously,
the calls specified infinite retries and relied on the limit implied
by the overall request timeout and the UDP timeout (which did not work
because the overall timeout is not enforced). The `udpretries`
argument is also changed to be the number of retries; previously, zero
was interpreted as infinity because of an underflow to UINT_MAX, which
appeared to be a mistake. And `mdig` is updated to match the change in
retry accounting.

The bug could be triggered by zone maintenance queries, including
NOTIFY messages, DS parental checks, refresh SOA queries and stub zone
nameserver lookups. It could also occur with `nsupdate -r 0`.
(But `mdig` had its own code to avoid the bug.)

4 years agoMake notify test shellcheck clean
Tony Finch [Wed, 6 Apr 2022 12:57:36 +0000 (13:57 +0100)] 
Make notify test shellcheck clean

Use POSIX shell syntax, and use functions to reduce repetition.

4 years agoMerge branch 'artem-tls-ctx-refcount' into 'main'
Artem Boldariev [Wed, 6 Apr 2022 16:09:04 +0000 (16:09 +0000)] 
Merge branch 'artem-tls-ctx-refcount' into 'main'

Implement reference counting for TLS contexts, Resolve #3122 DoT stops working after "rndc reconfigure" when running named as non-root

Closes #3122

See merge request isc-projects/bind9!6087

4 years agoExtend the doth system test
Artem Boldariev [Wed, 6 Apr 2022 13:10:05 +0000 (16:10 +0300)] 
Extend the doth system test

This commit adds simple checks that the TLS contexts in question are
indeed being updated on DoT and DoH listeners.

4 years agoUpdate CHANGES [GL #3122]
Artem Boldariev [Tue, 5 Apr 2022 15:36:19 +0000 (18:36 +0300)] 
Update CHANGES [GL #3122]

Add an entry that reloading TLS certificates without destroying
underlying TCP listening sockets.

4 years agoReplace listener TLS contexts on reconfiguration
Artem Boldariev [Thu, 31 Mar 2022 10:48:14 +0000 (13:48 +0300)] 
Replace listener TLS contexts on reconfiguration

This commit makes use of isc_nmsocket_set_tlsctx(). Now, instead of
recreating TLS-enabled listeners (including the underlying TCP
listener sockets), only the TLS context in use is replaced.

4 years agoAdd isc_nmsocket_set_tlsctx()
Artem Boldariev [Thu, 31 Mar 2022 10:47:48 +0000 (13:47 +0300)] 
Add isc_nmsocket_set_tlsctx()

This commit adds isc_nmsocket_set_tlsctx() - an asynchronous function
that replaces the TLS context within a given TLS-enabled listener
socket object. It is based on the newly added reference counting
functionality.

The intention of adding this function is to add functionality to
replace a TLS context without recreating the whole socket object,
including the underlying TCP listener socket, as a BIND process might
not have enough permissions to re-create it fully on reconfiguration.

4 years agoMaintain a per-thread TLS ctx reference in TLS stream code
Artem Boldariev [Tue, 29 Mar 2022 17:42:16 +0000 (20:42 +0300)] 
Maintain a per-thread TLS ctx reference in TLS stream code

This commit changes the generic TLS stream code to maintain a
per-worker thread TLS context reference.