]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
4 years agoMerge branch '3225-catz-member-zone-reset' into 'main'
Arаm Sаrgsyаn [Thu, 28 Apr 2022 15:27:05 +0000 (15:27 +0000)] 
Merge branch '3225-catz-member-zone-reset' into 'main'

[5/5] Document catalog zones member zone reset by change of unique label

Closes #3225

See merge request isc-projects/bind9!6015

4 years agoDocument catalog zones member zone reset by change of unique label
Aram Sargsyan [Thu, 17 Mar 2022 17:11:04 +0000 (17:11 +0000)] 
Document catalog zones member zone reset by change of unique label

The DNS catalog zones draft version 5 document requires that catalog
zones consumers must reset the member zone's internal zone state when
its unique label changes (either within the same catalog zone or
during change of ownership performed using the "coo" property).

BIND already behaves like that, and, in fact, doesn't support keeping
the zone state during change of ownership even if the unique label
has been kept the same, because BIND always removes the member zone
and adds it back during unique label renaming or change of ownership.

Document the described behavior and add a log message to inform when
unique label renaming occurs.

Add a system test case with unique label renaming.

4 years agoMerge branch '3224-catz-broken-catalog-zones-concept-support' into 'main'
Arаm Sаrgsyаn [Thu, 28 Apr 2022 13:19:12 +0000 (13:19 +0000)] 
Merge branch '3224-catz-broken-catalog-zones-concept-support' into 'main'

[4/5] Introduce the concept of broken catalog zones

Closes #3224

See merge request isc-projects/bind9!6014

4 years agoRemove reduntant checks of 'rdclass' in catz.c
Aram Sargsyan [Fri, 15 Apr 2022 15:50:43 +0000 (15:50 +0000)] 
Remove reduntant checks of 'rdclass' in catz.c

We check the `rdclass` to be of type IN in `dns_catz_update_process()`
function, and all the other static functions where similar checks exist
are called after (and in the result of) that function being called,
so they are effectively redundant.

4 years agoAdd new catz system test to check a version property with invalid type
Aram Sargsyan [Fri, 15 Apr 2022 15:34:19 +0000 (15:34 +0000)] 
Add new catz system test to check a version property with invalid type

There is already a check for the missing version property case
(catalog-bad1.example), and this new test should result in the same
outcome, but differs in a way that there exists a version record in the
zone, but it is of a wrong type (A instead of the expected TXT).

4 years agoAdd a system test to check catalog zones with non-IN rdata class fail
Aram Sargsyan [Wed, 13 Apr 2022 14:06:00 +0000 (14:06 +0000)] 
Add a system test to check catalog zones with non-IN rdata class fail

According to DNS catalog zones draft version 5 document, the CLASS field
of every RR in a catalog zone MUST be IN.

Add a new check in the catz system test to verify that a non-IN class
catalog zone (in this case CH) fails to load.

BIND does not support having a non-IN class RR in an IN class zone, or
non-IN class zone in an IN class view, so to verify that BIND respects
the mentioned restriction we must try to add a non-IN class catalog
zone and check that it didn't succeed.

The `named` configuration files had to be restructured to put all the
zones inside views, which also resulted in some corresponding changes
in the tests.sh script.

4 years agoAdd a new warning message when processing view configuration
Aram Sargsyan [Wed, 13 Apr 2022 13:56:37 +0000 (13:56 +0000)] 
Add a new warning message when processing view configuration

When parsing the configuration file, log a warning message in
configure_view() function when encountering a `catalog-zones`
option in a view with non-IN rdata class.

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

4 years agoIntroduce the concept of broken catalog zones
Aram Sargsyan [Thu, 17 Mar 2022 14:43:18 +0000 (14:43 +0000)] 
Introduce the concept of broken catalog zones

The DNS catalog zones draft version 5 document describes various
situations when a catalog zones must be considered as "broken" and
not be processed.

Implement those checks in catz.c and add corresponding system tests.

4 years agoMerge branch '2267-extended-errors-stale-data' into 'main'
Matthijs Mekking [Thu, 28 Apr 2022 09:33:40 +0000 (09:33 +0000)] 
Merge branch '2267-extended-errors-stale-data' into 'main'

Add stale answer extended errors

Closes #2267

See merge request isc-projects/bind9!6148

4 years agoAdd CHANGES and release notes for #2267
Matthijs Mekking [Thu, 21 Apr 2022 08:45:01 +0000 (10:45 +0200)] 
Add CHANGES and release notes for #2267

4 years agoAdd stale answer extended errors
Matthijs Mekking [Thu, 21 Apr 2022 08:29:09 +0000 (10:29 +0200)] 
Add stale answer extended errors

Add DNS extended errors 3 (Stale Answer) and 19 (Stale NXDOMAIN Answer)
to responses. Add extra text with the reason why the stale answer was
returned.

To test, we need to change the configuration such that for the first
set of tests the stale-refresh-time window does not interfer with the
expected extended errors.

4 years agoMerge branch 'ondrej-zone.c-refactor-me-into-__func__' into 'main'
Ondřej Surý [Thu, 28 Apr 2022 07:28:59 +0000 (07:28 +0000)] 
Merge branch 'ondrej-zone.c-refactor-me-into-__func__' into 'main'

In zone.c, use __func__ instead of hand-crafted me strings

See merge request isc-projects/bind9!6197

4 years agoIn zone.c, use __func__ instead of hand-crafted me strings
Ondřej Surý [Wed, 27 Apr 2022 14:58:26 +0000 (16:58 +0200)] 
In zone.c, use __func__ instead of hand-crafted me strings

In zone.c, the "me" strings were defined for functions that could be
traced with "ENTER" macro.

Use the __func__ that's defined by the compiler and is less prone to
copy&paste errors.

4 years agoMerge branch '3272-shutdown-deadlock' into 'main'
Evan Hunt [Thu, 28 Apr 2022 06:56:20 +0000 (06:56 +0000)] 
Merge branch '3272-shutdown-deadlock' into 'main'

prevent a deadlock in the shutdown system test

Closes #3272

See merge request isc-projects/bind9!6205

4 years agoCHANGES for [GL #3272]
Evan Hunt [Thu, 28 Apr 2022 05:17:00 +0000 (22:17 -0700)] 
CHANGES for [GL #3272]

4 years agoprevent a deadlock in the shutdown system test
Evan Hunt [Thu, 28 Apr 2022 05:12:01 +0000 (22:12 -0700)] 
prevent a deadlock in the shutdown system test

The shutdown test sends 'rdnc status' commands in parallel with
'rndc stop' A new rndc connection arriving will reference the ACL
environment to see whether the client is allowed to connect.
Commit c0995bc380 added a mutex lock to ns_interfacemgr_getaclenv(),
but if the new connection arrives while the interfaces are being
purged during shutdown, that lock is already being held. If the
the connection event slips in ahead of one of the netmgr's "stop
listening" events on a worker thread, a deadlock can occur.

The fix is not to hold the interfacemgr lock while shutting down
interfaces; only while actually traversing the interface list to
identify interfaces needing shutdown.

4 years agoMerge branch 'marka-placeholder' into 'main'
Mark Andrews [Thu, 28 Apr 2022 06:07:30 +0000 (06:07 +0000)] 
Merge branch 'marka-placeholder' into 'main'

Add placeholder for !6157

See merge request isc-projects/bind9!6206

4 years agoAdd placeholder for !6157
Mark Andrews [Thu, 28 Apr 2022 06:01:27 +0000 (16:01 +1000)] 
Add placeholder for !6157

4 years agoMerge branch '2969-refactor-fctx_done' into 'main'
Evan Hunt [Wed, 27 Apr 2022 20:30:00 +0000 (20:30 +0000)] 
Merge branch '2969-refactor-fctx_done' into 'main'

refactor fctx_done() to set fctx to NULL

Closes #2969

See merge request isc-projects/bind9!6188

4 years agoCHANGES for [GL #2969]
Evan Hunt [Tue, 26 Apr 2022 19:07:04 +0000 (12:07 -0700)] 
CHANGES for [GL #2969]

4 years agorefactor resume_dsfetch()
Evan Hunt [Fri, 22 Apr 2022 23:41:10 +0000 (16:41 -0700)] 
refactor resume_dsfetch()

clean up resume_dsfetch() so that the fctx reference counting is
saner and easier to follow.

4 years agorefactor validated()
Evan Hunt [Tue, 26 Apr 2022 17:33:36 +0000 (10:33 -0700)] 
refactor validated()

minor changes to ensure that fctx reference counting is clear and correct.

4 years agorename maybe_destroy() to maybe_cancel_validators()
Evan Hunt [Fri, 22 Apr 2022 18:30:12 +0000 (11:30 -0700)] 
rename maybe_destroy() to maybe_cancel_validators()

the maybe_destroy() function no longer destroys the fctx,
so rename it and update the comments.

4 years agorefactor fctx_done() to set fctx to NULL
Evan Hunt [Wed, 20 Apr 2022 22:05:12 +0000 (15:05 -0700)] 
refactor fctx_done() to set fctx to NULL

previously fctx_done() detached the fctx but did not clear the pointer
passed into it from the caller.  in some conditions, when rctx_done()
was reached while waiting for a validator to complete, fctx_done()
could be called twice on the same fetch, causing a double detach.

fctx_done() now clears the fctx pointer, to reduce the chances of
such mistakes.

4 years agoMerge branch '3274-fix-test-server-for-solaris' into 'main'
Artem Boldariev [Wed, 27 Apr 2022 17:05:51 +0000 (17:05 +0000)] 
Merge branch '3274-fix-test-server-for-solaris' into 'main'

Rename yield() to the test_server_yield()

Closes #3274

See merge request isc-projects/bind9!6122

4 years agoRename yield() to the test_server_yield()
Artem Boldariev [Tue, 12 Apr 2022 12:44:40 +0000 (15:44 +0300)] 
Rename yield() to the test_server_yield()

This commit ensures that the test_server binary will build on Solaris,
which has yield() definition within 'unistd.h'.

4 years agoMerge branch '3300-dispatch-udp_recv-handle-deactivated-resp-returning-success' into...
Arаm Sаrgsyаn [Wed, 27 Apr 2022 16:34:34 +0000 (16:34 +0000)] 
Merge branch '3300-dispatch-udp_recv-handle-deactivated-resp-returning-success' into 'main'

Handle ISC_R_SUCCESS on a deactivated response in udp_recv()

Closes #3300

See merge request isc-projects/bind9!6194

4 years agoAdd CHANGES note for [GL #3300]
Aram Sargsyan [Wed, 27 Apr 2022 12:48:57 +0000 (12:48 +0000)] 
Add CHANGES note for [GL #3300]

4 years agoHandle ISC_R_SUCCESS on a deactivated response in udp_recv()
Aram Sargsyan [Wed, 27 Apr 2022 12:29:50 +0000 (12:29 +0000)] 
Handle ISC_R_SUCCESS on a deactivated response in udp_recv()

There is a possibility for `udp_recv()` to be called with `eresult`
being `ISC_R_SUCCESS`, but nevertheless with already deactivated `resp`,
which can happen when the request has been canceled in the meantime.

4 years agoMerge branch '3271-tlsdns-call-write-callbacks-after-send' into 'main'
Artem Boldariev [Wed, 27 Apr 2022 15:37:04 +0000 (15:37 +0000)] 
Merge branch '3271-tlsdns-call-write-callbacks-after-send' into 'main'

TLSDNS: call send callbacks only after the data was sent

Closes #3271

See merge request isc-projects/bind9!6128

4 years agoTLSDNS: call send callbacks after only the data was sent
Artem Boldariev [Wed, 13 Apr 2022 13:24:20 +0000 (16:24 +0300)] 
TLSDNS: call send callbacks after only the data was sent

This commit ensures that write callbacks are getting called only after
the data has been sent via the network.

Without this fix, a situation could appear when a write callback could
get called before the actual encrypted data would have been sent to
the network. Instead, it would get called right after it would have
been passed to the OpenSSL (i.e. encrypted).

Most likely, the issue does not reveal itself often because the
callback call was asynchronous, so in most cases it should have been
called after the data has been sent, but that was not guaranteed by
the code logic.

Also, this commit removes one memory allocation (netievent) from a hot
path, as there is no need to call this callback asynchronously
anymore.

4 years agoMerge branch '3285-dig-do-not-hang-on-tlsctx-errors' into 'main'
Artem Boldariev [Wed, 27 Apr 2022 14:02:03 +0000 (14:02 +0000)] 
Merge branch '3285-dig-do-not-hang-on-tlsctx-errors' into 'main'

Dig: do not hang on TLS context creation errors (Resolve #3285)

Closes #3285

See merge request isc-projects/bind9!6131

4 years agoUpdate CHANGES [GL #3285]
Artem Boldariev [Thu, 14 Apr 2022 15:49:06 +0000 (18:49 +0300)] 
Update CHANGES [GL #3285]

Mention that dig hanging on TLS context creation errors has been
fixed.

4 years agoDig: do not hang on TLS context creation errors
Artem Boldariev [Thu, 14 Apr 2022 15:39:20 +0000 (18:39 +0300)] 
Dig: do not hang on TLS context creation errors

There was a query_detach() call missing in dig, which could lead to
dig hanging on TLS context creation errors. This commit fixes.

The error was introduced because the Strict TLS implementation was
initially made over an older version of the code, where this extra
query_detach() call was not needed.

4 years agoMerge branch 'pspacek/pin-sphinx-packages-for-rtd' into 'main'
Petr Špaček [Wed, 27 Apr 2022 12:34:38 +0000 (12:34 +0000)] 
Merge branch 'pspacek/pin-sphinx-packages-for-rtd' into 'main'

Pin Sphinx related package versions to match ReadTheDocs and our CI

See merge request isc-projects/bind9!6190

4 years agoPin Sphinx related package versions to match ReadTheDocs and our CI
Petr Špaček [Wed, 27 Apr 2022 06:51:41 +0000 (08:51 +0200)] 
Pin Sphinx related package versions to match ReadTheDocs and our CI

This seems to be most appropriate way to ensure consistency between
release tarballs and public presentation on ReadTheDocs.

Previous attempt with removing docutils constraint, which relied on pip
depedency solver to pick the same packages as in CI was flawed. RTD
installs a bit different set of packages so it was inherently
unreliable.

As a result RTD pulled in sphinx-rtd-theme==0.4.3 while CI
had 1.0.0, and this inconsistency caused Table of Contents in Release
Notes to render incorrectly. Previous solution was to downgrade
docutils to < 0.17, but I think we should rather pin exact versions.

For the long history of messing with versions read also
isc-projects/bind9@2a8eda0084fbdd34af8071fe586c8ed50af87f11
isc-projects/images@d4435b97be70c2a3a6f8b570ef0dcb616c3dc4ae
isc-projects/bind9@6a2daddf5b95375668945801f636c8335e300fb5

4 years agoMerge branch 'fanf-rbt-demacro' into 'main'
Tony Finch [Wed, 27 Apr 2022 12:05:30 +0000 (12:05 +0000)] 
Merge branch 'fanf-rbt-demacro' into 'main'

Reduce rbt macrology

See merge request isc-projects/bind9!6158

4 years agoCHANGES note for [GL !6158]
Tony Finch [Fri, 22 Apr 2022 09:21:12 +0000 (10:21 +0100)] 
CHANGES note for [GL !6158]

[cleanup] Remove redundant macros in the RBT implementation.

4 years agoApply clang-format to rbt.c
Tony Finch [Fri, 22 Apr 2022 11:01:33 +0000 (12:01 +0100)] 
Apply clang-format to rbt.c

Giving the code a proper spring cleaning

4 years agoClean up a few rbt comments
Tony Finch [Fri, 22 Apr 2022 08:14:47 +0000 (09:14 +0100)] 
Clean up a few rbt comments

Avoid HTML entities, and describe what a function does
instead of explaining why it used to be a macro.

4 years agoFix style of a function name in rbt.c
Tony Finch [Fri, 22 Apr 2022 08:08:24 +0000 (09:08 +0100)] 
Fix style of a function name in rbt.c

Mechanically generated with:

:; spatch --no-show-diff --in-place --sp-file <<END lib/dns/rbt.c
@@ expression node, name; @@
- NODENAME(node, name)
+ node_name(node, name)
@@ parameter list params; @@
  static void
- NODENAME(params)
+ node_name(params)
  { ... }
END

4 years agoRemove redundant rbt macro definitions
Tony Finch [Fri, 22 Apr 2022 08:06:31 +0000 (09:06 +0100)] 
Remove redundant rbt macro definitions

After the previous commit, these macros are no longer used.

4 years agoRemove do-nothing rbt macro calls
Tony Finch [Fri, 22 Apr 2022 08:02:49 +0000 (09:02 +0100)] 
Remove do-nothing rbt macro calls

Pointer chasing reads better like left->right instead of RIGHT(left)

Mechanically generated with:

:; spatch --no-show-diff --in-place --sp-file <<END lib/dns/rbt.c
@@ expression node; @@
- PARENT(node)
+ node->parent
@@ expression node; @@
- LEFT(node)
+ node->left
@@ expression node; @@
- RIGHT(node)
+ node->right
@@ expression node; @@
- DOWN(node)
+ node->down
@@ expression node; @@
- UPPERNODE(node)
+ node->uppernode
@@ expression node; @@
- DATA(node)
+ node->data
@@ expression node; @@
- IS_EMPTY(node)
+ node->data == NULL
@@ expression node; @@
- HASHNEXT(node)
+ node->hashnext
@@ expression node; @@
- HASHVAL(node)
+ node->hashval
@@ expression node; @@
- COLOR(node)
+ node->color
@@ expression node; @@
- NAMELEN(node)
+ node->namelen
@@ expression node; @@
- OLDNAMELEN(node)
+ node->oldnamelen
@@ expression node; @@
- OFFSETLEN(node)
+ node->offsetlen
@@ expression node; @@
- ATTRS(node)
+ node->attributes
@@ expression node; @@
- IS_ROOT(node)
+ node->is_root
@@ expression node; @@
- FINDCALLBACK(node)
+ node->find_callback
@@ expression node; @@
- DIRTY(node)
+ node->dirty
@@ expression node; @@
- WILD(node)
+ node->wild
@@ expression node; @@
- LOCKNUM(node)
+ node->locknum
@@ expression node; @@
- MAKE_RED(node)
+ node->color = RED
@@ expression node; @@
- MAKE_BLACK(node)
+ node->color = BLACK
END

4 years agoMerge branch '3299-fix-AX_PROG_CC_FOR_BUILD-macro' into 'main'
Ondřej Surý [Tue, 26 Apr 2022 13:47:11 +0000 (13:47 +0000)] 
Merge branch '3299-fix-AX_PROG_CC_FOR_BUILD-macro' into 'main'

Fix the cached value of ac_cv_c_compiler_gnu

Closes #3299

See merge request isc-projects/bind9!6183

4 years agoFix the cached value of ac_cv_c_compiler_gnu
Ondřej Surý [Tue, 26 Apr 2022 13:27:10 +0000 (15:27 +0200)] 
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.

4 years agoMerge branch 'pspacek/rtd-requirements-update' into 'main'
Petr Špaček [Tue, 26 Apr 2022 13:33:12 +0000 (13:33 +0000)] 
Merge branch 'pspacek/rtd-requirements-update' into 'main'

Fix mismatch between docutils version in CI and ReadTheDocs

See merge request isc-projects/bind9!6182

4 years agoFix mismatch between docutils version in CI and ReadTheDocs
Petr Špaček [Tue, 26 Apr 2022 12:28:11 +0000 (14:28 +0200)] 
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@d4435b97be70c2a3a6f8b570ef0dcb616c3dc4ae
isc-projects/bind9@6a2daddf5b95375668945801f636c8335e300fb5

4 years agoMerge branch '3288-adb-cancelfind-race' into 'main'
Ondřej Surý [Tue, 26 Apr 2022 11:34:44 +0000 (11:34 +0000)] 
Merge branch '3288-adb-cancelfind-race' into 'main'

lock find when unlinking adbname->finds in dns_adb_cancelfind()

Closes #3288

See merge request isc-projects/bind9!6141

4 years agolock find when unlinking adbname->finds in dns_adb_cancelfind()
Evan Hunt [Wed, 20 Apr 2022 02:14:49 +0000 (19:14 -0700)] 
lock find when unlinking adbname->finds in dns_adb_cancelfind()

In dns_adb_cancelfind(), we need to release the find lock and
then acquire the bucket and find locks in that order, for
consistency with locking hierarchy elsehwere. Previously we
were only acquiring the bucket lock.

Also rewrote the function for better readability.

4 years agoMerge branch '3301-support-sphinx-149' into 'main'
Petr Špaček [Tue, 26 Apr 2022 10:43:28 +0000 (10:43 +0000)] 
Merge branch '3301-support-sphinx-149' into 'main'

Split negative and positive dig/mdig/delv options to support Sphinx 1.4.9

Closes #3301

See merge request isc-projects/bind9!6175

4 years agoAdd hyperlinks to dig/mdig/delv +options
Petr Špaček [Mon, 25 Apr 2022 16:12:17 +0000 (18:12 +0200)] 
Add hyperlinks to dig/mdig/delv +options

4 years agoSplit negative and positive dig/mdig/delv options to support Sphinx 1.4.9
Petr Špaček [Mon, 25 Apr 2022 14:28:02 +0000 (16:28 +0200)] 
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
4 years agoMerge branch '835-use-UV_UDP_LINUX_RECVERR-to-detect-destination-unreachable' into...
Ondřej Surý [Tue, 26 Apr 2022 10:41:08 +0000 (10:41 +0000)] 
Merge branch '835-use-UV_UDP_LINUX_RECVERR-to-detect-destination-unreachable' into 'main'

Set IP(V6)_RECVERR on connect UDP sockets (via libuv)

Closes #835

See merge request isc-projects/bind9!6171

4 years agoAdd CHANGES note for [GL #4251]
Ondřej Surý [Mon, 25 Apr 2022 12:48:06 +0000 (14:48 +0200)] 
Add CHANGES note for [GL #4251]

4 years agoSet IP(V6)_RECVERR on connect UDP sockets (via libuv)
Ondřej Surý [Mon, 25 Apr 2022 12:09:44 +0000 (14:09 +0200)] 
Set IP(V6)_RECVERR on connect UDP sockets (via libuv)

The connect()ed UDP socket provides feedback on a variety of ICMP
errors (eg port unreachable) which bind can then use to decide what to
do with errors (report them to the client, try again with a different
nameserver etc).  However, Linux's implementation does not report what
it considers "transient" conditions, which is defined as Destination
host Unreachable, Destination network unreachable, Source Route Failed
and Message Too Big.

Explicitly enable IP_RECVERR / IPV6_RECVERR (via libuv uv_udp_bind()
flag) to learn about ICMP destination network/host unreachable.

4 years agoMerge branch 'ondrej-enforce-minimal-libuv-version' into 'main'
Ondřej Surý [Tue, 26 Apr 2022 10:21:43 +0000 (10:21 +0000)] 
Merge branch 'ondrej-enforce-minimal-libuv-version' into 'main'

Abort when libuv at runtime mismatches libuv at compile time

See merge request isc-projects/bind9!6176

4 years agoAbort when libuv at runtime mismatches libuv at compile time
Ondřej Surý [Mon, 25 Apr 2022 12:43:14 +0000 (14:43 +0200)] 
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.

4 years agoMerge branch 'ondrej-fix-route_recv-use-after-free' into 'main'
Ondřej Surý [Mon, 25 Apr 2022 15:42:38 +0000 (15:42 +0000)] 
Merge branch 'ondrej-fix-route_recv-use-after-free' into 'main'

The route socket and its storage was detached while still reading

See merge request isc-projects/bind9!6169

4 years agoThe route socket and its storage was detached while still reading
Ondřej Surý [Mon, 25 Apr 2022 11:38:33 +0000 (13:38 +0200)] 
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.

4 years agoMerge branch 'fanf-random-failures' into 'main'
Tony Finch [Mon, 25 Apr 2022 15:13:51 +0000 (15:13 +0000)] 
Merge branch 'fanf-random-failures' into 'main'

Revert "Move random number re-seeding out of the hot path"

See merge request isc-projects/bind9!6172

4 years agoRevert "Move random number re-seeding out of the hot path"
Tony Finch [Mon, 25 Apr 2022 14:18:58 +0000 (15:18 +0100)] 
Revert "Move random number re-seeding out of the hot path"

This reverts commit b1bb41603e76a86ec73419418d1e2db52e864058.

4 years agoMerge branch '3295-support-sphinx-185' into 'main'
Petr Špaček [Mon, 25 Apr 2022 12:45:59 +0000 (12:45 +0000)] 
Merge branch '3295-support-sphinx-185' into 'main'

Use unique program + option names for link anchors to support Sphinx 1.8.5

Closes #3295

See merge request isc-projects/bind9!6167

4 years agoUse unique program + option names for link anchors to support Sphinx 1.8.5
Petr Špaček [Mon, 25 Apr 2022 10:07:24 +0000 (12:07 +0200)] 
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
4 years agoMerge branch 'fanf-lemire-nearly-divisionless' into 'main'
Tony Finch [Fri, 22 Apr 2022 17:38:34 +0000 (17:38 +0000)] 
Merge branch 'fanf-lemire-nearly-divisionless' into 'main'

Make isc_random_uniform() nearly divisionless

See merge request isc-projects/bind9!6161

4 years agoCHANGES note for [GL !6161]
Tony Finch [Fri, 22 Apr 2022 11:24:45 +0000 (12:24 +0100)] 
CHANGES note for [GL !6161]

[cleanup] Use Daniel Lemire's "nearly divisionless" algorithm
for unbiased bounded random numbers, and move
re-seeding out of the hot path.

4 years agoMove random number re-seeding out of the hot path
Tony Finch [Fri, 22 Apr 2022 13:35:36 +0000 (14:35 +0100)] 
Move random number re-seeding out of the hot path

Instead of checking if we need to re-seed for every isc_random call,
seed the random number generator in the libisc global initializer
and the per-thread initializer.

4 years agoClean up isc_random
Tony Finch [Thu, 14 Apr 2022 18:06:02 +0000 (19:06 +0100)] 
Clean up isc_random

Remove redundant comments and avoid implicit casts.

4 years agoMake isc_random_uniform() nearly divisionless
Tony Finch [Thu, 14 Apr 2022 17:18:12 +0000 (18:18 +0100)] 
Make isc_random_uniform() nearly divisionless

It used to require two 32-bit integer divisions to get a random number
less than some limit. Now we use Daniel Lemire's "nearly-divisionless"
algorithm for unbiased bounded random numbers, which requires one
64-bit integer multiply in the usual case, and one 32-bit integer
division in rare slow cases. Even the slow cases are faster than
before; there are also fewer branches.

I think this algorithm is exceptionally beautiful. It also has more
clever tricks than lines of code, so I have done my best to explain
how it works.

4 years agoMerge branch '3298-dont-check-exiting-in-dns__adb_attach' into 'main'
Ondřej Surý [Fri, 22 Apr 2022 15:29:43 +0000 (15:29 +0000)] 
Merge branch '3298-dont-check-exiting-in-dns__adb_attach' into 'main'

Allow attaching to dns_adb which is shutting down

Closes #3298

See merge request isc-projects/bind9!6165

4 years agoAdd CHANGES note for [GL #3298]
Ondřej Surý [Fri, 22 Apr 2022 15:00:10 +0000 (17:00 +0200)] 
Add CHANGES note for [GL #3298]

4 years agoAllow attaching to dns_adb which is shutting down
Ondřej Surý [Fri, 22 Apr 2022 14:48:37 +0000 (16:48 +0200)] 
Allow attaching to dns_adb which is shutting down

The dns__adb_attach() had an assertion failure that prevented to attach
to dns_adb if the dns_adb was shutting down.  There was a race between
checking for .exiting in dns_adb_createfind and creating new_adbfind() -
other thread could have set the .exiting to true between the check.

Remove the assertion failure and allow attaching to dns_adb even while
shutting down.  The process of dns_adb shutting down would be noticed
only a moments later when any other callback is called.

4 years agoMerge branch 'ondrej-use-correct-task-for-resume_dslookup' into 'main'
Ondřej Surý [Fri, 22 Apr 2022 13:42:53 +0000 (13:42 +0000)] 
Merge branch 'ondrej-use-correct-task-for-resume_dslookup' into 'main'

Use right task for the internal dns_resolver fetches

See merge request isc-projects/bind9!6163

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]