Commit graph

35863 commits

Author SHA1 Message Date
Ondřej Surý
192df8d2f1 The route socket and its storage was detached while still reading
The interfacemgr and the .route was being detached while the network
manager had pending read from the socket.  Instead of detaching from the
socket, we need to cancel the read which in turn will detach the route
socket and the associated interfacemgr.

(cherry picked from commit 9ae34a04e8)
2022-04-26 16:41:24 +02:00
Ondřej Surý
0cdb2f497a Merge branch '3230-remove-task-exclusive-mode-from-ns_clientmgr-v9_18' into 'v9_18'
Remove task exclusive mode from ns_clientmgr [v9.18]

See merge request isc-projects/bind9!6187
2022-04-26 14:40:42 +00:00
Ondřej Surý
4520ecc471 Add CHANGES mode for [GL #3230]
(cherry picked from commit a243860562)
2022-04-26 15:57:03 +02:00
Ondřej Surý
8beaee0b08 Remove task exclusive mode from ns_clientmgr
The .lock, .exiting and .excl members were not using for anything else
than starting task exclusive mode, setting .exiting to true and ending
exclusive mode.

Remove all the stray members and dead code eliminating the task
exclusive mode use from ns_clientmgr.

(cherry picked from commit 4f74e1010e)
2022-04-26 15:56:30 +02:00
Ondřej Surý
bc36f3e723 Merge branch '3299-fix-AX_PROG_CC_FOR_BUILD-macro-v9_18' into 'v9_18'
Fix the cached value of ac_cv_c_compiler_gnu [v9.18]

See merge request isc-projects/bind9!6185
2022-04-26 13:49:31 +00:00
Ondřej Surý
1bcd20d4bb Fix the cached value of ac_cv_c_compiler_gnu
There was an error in AX_PROG_CC_FOR_BUILD macro that cached literal
name of the cache variable `saved_ac_cv_c_compiler_gnu` instead of the
value of said variable breaking the consecutive runs of ./configure
script with caching enabled.

(cherry picked from commit 4a9f899b5c)
2022-04-26 15:49:16 +02:00
Petr Špaček
d5fd2a53ef Merge branch 'pspacek/rtd-requirements-update-v9_18' into 'v9_18'
Fix mismatch between docutils version in CI and ReadTheDocs [v9_18]

See merge request isc-projects/bind9!6184
2022-04-26 13:48:24 +00:00
Petr Špaček
243cd069fc
Fix mismatch between docutils version in CI and ReadTheDocs
Currently our CI images we use to build docs (which subsequently get
into release tarballs) are using docutils 0.17.1, which is latest version
which fulfills Sphinx 4.5.0 requirement for docutils < 0.18.

The old requirement for docutils < 0.17 was causing discrepancy between
the way we build release artifacts and the docs on ReadTheDocs.org which
uses doc/arm/requirements.txt from our repo.

Remove the limit for RDT with hope that it will pull latest permissible
version of docutils.

For the long history of messing with docutils version read also
isc-projects/images@d4435b97be
isc-projects/bind9@6a2daddf5b

(cherry picked from commit 2a8eda0084)
2022-04-26 15:46:55 +02:00
Ondřej Surý
77fde4a112 Merge branch '3229-remove-exclusive-mode-from-ns_interfacemgr-v9_18' into 'v9_18'
Remove exclusive mode from ns_interfacemgr [v9.18]

See merge request isc-projects/bind9!6179
2022-04-26 12:22:19 +00:00
Ondřej Surý
95a55d0968 Add CHANGES note for [GL #3229]
(cherry picked from commit 70e58897c7)
2022-04-26 14:21:57 +02:00
Ondřej Surý
ce8ffdda69 Remove exclusive mode from ns_interfacemgr
Now that the dns_aclenv_t has now properly rwlocked .localhost and
.localnets member, we can remove the task exclusive mode use from the
ns_interfacemgr.  Some light related cleanup has been also done.

(cherry picked from commit c0995bc380)
2022-04-26 14:21:57 +02:00
Ondřej Surý
ab528a0fcb Add isc_rwlock around dns_aclenv .localhost and .localnets member
In order to modify the .localhost and .localnets members of the
dns_aclenv, all other processing on the netmgr loops needed to be
stopped using the task exclusive mode.  Add the isc_rwlock to the
dns_aclenv, so any modifications to the .localhost and .localnets can be
done under the write lock.

(cherry picked from commit 8138a595d9)
2022-04-26 14:21:57 +02:00
Petr Špaček
a180f66b06 Merge branch '3301-support-sphinx-149-v9_18' into 'v9_18'
Split negative and positive dig/mdig/delv options to support Sphinx 1.4.9 [v9_18]

See merge request isc-projects/bind9!6180
2022-04-26 12:18:38 +00:00
Petr Špaček
a84871ccca
Add hyperlinks to dig/mdig/delv +options
(cherry picked from commit ac0c2378ca)
2022-04-26 14:06:33 +02:00
Petr Špaček
4c21534009
Split negative and positive dig/mdig/delv options to support Sphinx 1.4.9
Man pages for dig/mdig/delv used `.. option:: +[no]bla` to describe two
options at once, and very old Sphinx does not support that [] in option
names.

Solution is to split negative and positive options into `+bla, +nobla`
form. In the end it improves readability because it transforms hard to
read strings with double brackets from
`+[no]subnet=addr[/prefix-length]` to
`+subnet=addr[/prefix-length], +nosubnet`.

As a side-effect it also allows easier linking to dig/mdig/delv options
using their name directly instead of always overriding the link target
to `+[no]bla` form.

Transformation was done using regex:
    s/:: +\[no\]\(.*\)/:: +\1, +no\1
... and manual review around occurences matching regex
    +no.*=

Fixes: #3301
(cherry picked from commit 0342dddce7)
2022-04-26 14:00:38 +02:00
Ondřej Surý
d751514215 Merge branch 'ondrej-enforce-minimal-libuv-version-v9_18' into 'v9_18'
Abort when libuv at runtime mismatches libuv at compile time [v9.18]

See merge request isc-projects/bind9!6177
2022-04-26 10:12:08 +00:00
Ondřej Surý
2a648b9078 Abort when libuv at runtime mismatches libuv at compile time
When we compile with libuv that has some capabilities via flags passed
to f.e. uv_udp_listen() or uv_udp_bind(), the call with such flags would
fail with invalid arguments when older libuv version is linked at the
runtime that doesn't understand the flag that was available at the
compile time.

Enforce minimal libuv version when flags have been available at the
compile time, but are not available at the runtime.  This check is less
strict than enforcing the runtime libuv version to be same or higher
than compile time libuv version.
2022-04-26 12:11:51 +02:00
Petr Špaček
b3e1c9060b Merge branch '3295-support-sphinx-185-v9_18' into 'v9_18'
Use unique program + option names for link anchors to support Sphinx 1.8.5 [v9_18]

See merge request isc-projects/bind9!6170
2022-04-26 10:07:32 +00:00
Petr Špaček
355aebc6df
Use unique program + option names for link anchors to support Sphinx 1.8.5
Sphinx "standard domain" provides directive types ".. program::" and
".. option::" to create link anchor for a program name + option combination.
These can be referenced using :ref:`program option` syntax.

The problem is that Sphinx 1.8.5 (e.g. in Ubuntu 18.04) generates
conflicting link targets if a page contains two option directives
starting with the same word, e.g.:

.. program:: dnssec-settime
.. option:: -P date
.. option:: -P ds date

The reason is that option directive consumes only first word as "option
name" (-P) and all the rest is considered "option argument" (date, ds
date). Newer versions of Sphinx (e.g. 4.5.0) handle this by creating
numbered link anchors, but older versions warn and BIND build system
turns the warning into a hard error.

To handle that we use method recommended by Sphinx maintainer:
https://github.com/sphinx-doc/sphinx/issues/10218#issuecomment-1059925508
As a bonus it provides more accurate link anchors for sub-options.

Alternatives considered:
- Replacing standard domain definition of .. option - causes more
  problems, see BIND issue #3294.
- Removing hyperlinks for options - that would be a step back.

Fixes: #3295
(cherry picked from commit bbb24264bb)
2022-04-25 14:46:37 +02:00
Ondřej Surý
08feb4c23e Merge branch 'ondrej-use-correct-task-for-resume_dslookup-v9_18' into 'v9_18'
Run resume_dslookup() from the correct task [v9.18]

See merge request isc-projects/bind9!6164
2022-04-22 14:57:40 +00:00
Ondřej Surý
7e72c55ff9 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().

(cherry picked from commit 741a7096fc)
2022-04-22 15:57:22 +02:00
Michał Kępień
aa3a3e7cda Merge branch 'michal/fix-loading-plugins-using-just-their-filenames-v9_18' into 'v9_18'
[v9_18] Fix loading plugins using just their filenames

See merge request isc-projects/bind9!6162
2022-04-22 11:37:07 +00:00
Michał Kępień
4ac4640c40 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).

(cherry picked from commit 5065c4686e)
2022-04-22 13:29:10 +02:00
Michał Kępień
83eaff2851 Merge branch 'michal/regenerate-man-pages-with-sphinx-4.5.0-v9_18' into 'v9_18'
[v9_18] Regenerate man pages with Sphinx 4.5.0

See merge request isc-projects/bind9!6160
2022-04-22 11:21:11 +00:00
Michał Kępień
c1ba7c685d 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.

(cherry picked from commit e80ce6cfe2)
2022-04-22 13:11:35 +02:00
Michał Kępień
ccea861632 Merge branch '3297-fix-a-pylint-2.13.7-error-v9_18' into 'v9_18'
[v9_18] Fix a PyLint 2.13.7 error

See merge request isc-projects/bind9!6151
2022-04-22 10:34:57 +00:00
Michał Kępień
fd1f39fe59 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.

(cherry picked from commit 3f5318f094)
2022-04-22 12:14:50 +02:00
Michał Kępień
f8d17c6263 Fix "digdelv" system test requirements
Commit f64cd23e7b 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.

(cherry picked from commit aaa0223752)
2022-04-22 12:14:50 +02:00
Michał Kępień
1735e589d1 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.

(cherry picked from commit beaaa7f4e2)
2022-04-22 12:14:50 +02:00
Michał Kępień
0f59e1e270 Merge branch '3287-prevent-memory-bloat-caused-by-a-jemalloc-quirk-v9_18' into 'v9_18'
[v9_18] Prevent memory bloat caused by a jemalloc quirk

See merge request isc-projects/bind9!6153
2022-04-21 12:42:06 +00:00
Michał Kępień
5e4855a25d Add CHANGES entry for GL #3287
(cherry picked from commit e33aef4e39)
2022-04-21 14:22:13 +02:00
Michał Kępień
2da371d005 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] c259323ab3

(cherry picked from commit 7aa7b6474b)
2022-04-21 14:22:13 +02:00
Michał Kępień
0deec48487 BIND 9.18.2
-----BEGIN PGP SIGNATURE-----
 
 iQJDBAABCgAtFiEENKwGS3ftSQfs1TU17QVz/8hFYQUFAmJUNK8PHG1pY2hhbEBp
 c2Mub3JnAAoJEO0Fc//IRWEFEdAQAI/9Cm/hLNw13C9Uye0Pd9tgyc45s+UtMvJ6
 Zbw6Cap7rl4eNYGqbTuI1N7PjjKzjNdM2erHd2MY7R2BGXR9z9WqK/VhFZg6NMBg
 J59xi3Vgh14CdnkuWLJv3F1WW2fYy86Kh5lFONLskfBCteGaFT/aHafCsV10CApv
 kGgH89l+z/eI9LvIVwzugUv4MG/RgASlosrNTmuuj++0XqveqkQwudmXIX4l0XLU
 /0WZAZF2VBw0Ms5LIjXZ7TqvyTPQrgXrjKLsgyaaBXeMtCN1SuZs+GydrC9WIeDd
 GI7XwJ/tPmiUe+LNx73CaNnOkcG8eSDhX/NMp7wXnzs3Mu4CL1gnvX+r0hEBpKrM
 mjdZXWHb5kerwnjrIDyXsZqAX8FWPddgv1iLb/r/KjPRZQAfN9f7wyBkLD2nP8oc
 NxfboETyEh/BPoOx8NfpxUX8AS1VXgDU6rkUkZvAuKf7X9mrH8hgKihoL5Qh973G
 vjm3SsyGo3JSKCWFFJ8GCwJDjoV/K3HEonGXWi2jvM5igDYZByUk/b4qLplOwqyp
 CgZMeBmhT32ZzbR6ltK0csFCR6o44WZav0ur/UyymQgmn6QVV4RLYmB//QxST8QF
 4lNyI7JuHIyfzRGj4cbE2D8KQcpHh8aVTncELdp/SxjDY2DwkulRG7gTm/hKTnXF
 u22FbRmc
 =dOlg
 -----END PGP SIGNATURE-----

Merge tag 'v9_18_2' into v9_18

BIND 9.18.2
2022-04-21 09:44:56 +02:00
Tony Finch
05c88b18da Merge branch '3275-notify-test-fix-v9_18' into 'v9_18'
Avoid timeouts in the notify system test (backport to 9.18)

See merge request isc-projects/bind9!6143
2022-04-20 17:12:36 +00:00
Tony Finch
037223211c 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.

(cherry picked from commit f4c2909353)
2022-04-20 17:51:40 +01:00
Tony Finch
19cf15313c 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

(cherry picked from commit 4a30733ae5)
2022-04-20 17:51:40 +01:00
Mark Andrews
e618bdd2df Merge branch '3279-lib-dns-ncache-c-rdataset_settrust-fails-to-set-trust-on-called-rdataset-v9_18' into 'v9_18'
Check that pending negative cache entries for DS can be used successfully

See merge request isc-projects/bind9!6135
2022-04-19 00:05:39 +00:00
Mark Andrews
b66e00f73a Add CHANGES entry for [GL #3279]
(cherry picked from commit 14ca6270d3)
2022-04-19 09:44:09 +10:00
Mark Andrews
40bfb70d6a 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.

(cherry picked from commit d043a41499)
2022-04-19 09:44:09 +10:00
Mark Andrews
b597ea863e 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.

(cherry picked from commit d2d9910da2)
2022-04-19 09:44:09 +10:00
Evan Hunt
230b2b8c56 Merge branch '3235-dig-exitcode-v9_18' into 'v9_18'
ensure dig sets exitcode after local UDP connection failure

See merge request isc-projects/bind9!6134
2022-04-15 18:10:08 +00:00
Evan Hunt
5739f13063 CHANGES for [GL #3235]
(cherry picked from commit d646aca282)
2022-04-15 11:08:46 -07:00
Evan Hunt
50dc4f1587 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.

(cherry picked from commit 4eee6460ff)
2022-04-15 11:08:46 -07:00
Arаm Sаrgsyаn
94d2d349d2 Merge branch '3223-catz-change-of-ownership-aka-coo-support-v9_18' into 'v9_18'
[v9_18] [3/5] Implement catalog zones change of ownership (coo) support

See merge request isc-projects/bind9!6133
2022-04-14 22:48:48 +00:00
Aram Sargsyan
546732546f 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.

(cherry picked from commit 99d1ec6c4b)
2022-04-14 20:53:59 +00:00
Aram Sargsyan
5037aeb5d2 Replace CATZ_OPT_MASTERS with CATZ_OPT_PRIMARIES
Update the enum entry in the continued effort of replacing some
DNS terminology.

(cherry picked from commit 59c486391d)
2022-04-14 20:53:53 +00:00
Aram Sargsyan
c5d523d8e9 Add CHANGES note for [GL #3223]
(cherry picked from commit 1c33dbd27d)
2022-04-14 20:53:46 +00:00
Aram Sargsyan
c37a75df5d 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.

(cherry picked from commit bb837db4ee)
2022-04-14 20:53:31 +00:00
Arаm Sаrgsyаn
1a9dc2fcad Merge branch '3222-catz-options-new-syntax-based-on-custom-properties-v9_18' into 'v9_18'
[v9_18] [2/5] Implement catalog zones options new syntax based on custom properties

See merge request isc-projects/bind9!6132
2022-04-14 20:27:54 +00:00
Aram Sargsyan
581d7bece0 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.

(cherry picked from commit 0b2d5490cd)
2022-04-14 19:51:45 +00:00