]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
4 years agoAdd CHANGES entry for [GL !5778]
Mark Andrews [Mon, 2 May 2022 04:46:36 +0000 (14:46 +1000)] 
Add CHANGES entry for [GL !5778]

4 years agoFix few warnings in DLZ modules
Petr Mensik [Fri, 28 Jan 2022 22:53:07 +0000 (23:53 +0100)] 
Fix few warnings in DLZ modules

Also make similar change to ldap module. Change few public functions in
module to dlz_<module> prefix, so they cannot collide with used library.

4 years agoMerge branch '3318-typo-in-rndc-man-page' into 'main'
Mark Andrews [Mon, 2 May 2022 02:58:36 +0000 (02:58 +0000)] 
Merge branch '3318-typo-in-rndc-man-page' into 'main'

Resolve "typo in rndc man page"

Closes #3318

See merge request isc-projects/bind9!6240

4 years agoFix typo, withdraw should be withdrawn
Mark Andrews [Mon, 2 May 2022 02:50:46 +0000 (12:50 +1000)] 
Fix typo, withdraw should be withdrawn

4 years agoMerge branch 'matthijs-kasp-system-test-failure' into 'main'
Matthijs Mekking [Fri, 29 Apr 2022 11:56:30 +0000 (11:56 +0000)] 
Merge branch 'matthijs-kasp-system-test-failure' into 'main'

Fix kasp system test failures

See merge request isc-projects/bind9!6223

4 years agoFix a kasp system test bug
Matthijs Mekking [Thu, 28 Apr 2022 14:45:33 +0000 (16:45 +0200)] 
Fix a kasp system test bug

In '_check_apex_dnskey' we check for each key (KEY1 to KEY4) if they
are present in the DNSKEY RRset if they should be.

However, we only grep the dig output for the first seven fields (owner,
ttl, class, type, flags, protocol, algorithm). This can be the same
for different keys.

For example, KEY1 may be KSK predecessor and KEY2 a KSK successor,
both DNSKEY records for these keys are the same up to the public key
field. This can cause test failures if KEY1 needs to be present, but
KEY2 not, because when grepping for KEY2 we will falsely detect the
key to be present (because the grep matches KEY1).

Fix the function by grepping looking for the first seven fields in the
corresponding key file and retrieve the public key part. Grep for this
in the dig output.

4 years agoMinor fixes in kasp system test
Matthijs Mekking [Thu, 28 Apr 2022 10:58:38 +0000 (12:58 +0200)] 
Minor fixes in kasp system test

Fix two typos and two grep calls.

4 years agoMerge branch '3278-placeholder' into 'main'
Arаm Sаrgsyаn [Fri, 29 Apr 2022 08:59:50 +0000 (08:59 +0000)] 
Merge branch '3278-placeholder' into 'main'

Add placeholder for [GL #3278]

See merge request isc-projects/bind9!6234

4 years agoAdd placeholder for [GL #3278]
Aram Sargsyan [Fri, 29 Apr 2022 08:44:15 +0000 (08:44 +0000)] 
Add placeholder for [GL #3278]

4 years agoMerge branch 'feature/main/default-config-print' into 'main'
Petr Špaček [Fri, 29 Apr 2022 08:06:43 +0000 (08:06 +0000)] 
Merge branch 'feature/main/default-config-print' into 'main'

Export built-in default configuration for named binary

See merge request isc-projects/bind9!6016

4 years agoExport built-in default configuration for named binary
Petr Menšík [Wed, 23 Mar 2022 11:52:33 +0000 (12:52 +0100)] 
Export built-in default configuration for named binary

It might be useful to display built-in configuration with all its
values. It should make it easier to test what default values has changed
in a new release.

Related: #1326

4 years agoMerge branch '3241-cid-351290-control-flow-issues-deadcode' into 'main'
Mark Andrews [Fri, 29 Apr 2022 04:53:49 +0000 (04:53 +0000)] 
Merge branch '3241-cid-351290-control-flow-issues-deadcode' into 'main'

Resolve "CID 351290:  Control flow issues  (DEADCODE)"

Closes #3241

See merge request isc-projects/bind9!6232

4 years agoRemove dead code, result cannot be ISC_R_SUSPEND
Mark Andrews [Fri, 29 Apr 2022 02:25:25 +0000 (12:25 +1000)] 
Remove dead code, result cannot be ISC_R_SUSPEND

    *** CID 351290:  Control flow issues  (DEADCODE)
    /lib/dns/client.c: 1027 in dns_client_resolve()
    1021      if (!client->readydone) {
    1022      WAIT(&client->ready, &client->readylock);
    1023      }
    1024      UNLOCK(&client->readylock);
    1025
    1026      LOCK(&resarg->lock);
    >>>     CID 351290:  Control flow issues  (DEADCODE)
    >>>     Execution cannot reach the expression "result == ISC_R_SUSPEND" inside this statement: "if (result == ISC_R_SUCCESS...".
    1027      if (result == ISC_R_SUCCESS || result == ISC_R_SUSPEND) {
    1028      result = resarg->result;
    1029      }
    1030      if (result != ISC_R_SUCCESS && resarg->vresult != ISC_R_SUCCESS) {
    1031      /*
    1032       * If this lookup failed due to some error in DNSSEC

4 years agoMerge branch 'bug/main/new-zones-dir-null' into 'main'
Mark Andrews [Fri, 29 Apr 2022 01:42:02 +0000 (01:42 +0000)] 
Merge branch 'bug/main/new-zones-dir-null' into 'main'

Assorted coverity fixes

See merge request isc-projects/bind9!5735

4 years agoAdditional safety check for negative array index
Petr Menšík [Wed, 19 Jan 2022 16:05:00 +0000 (17:05 +0100)] 
Additional safety check for negative array index

inet_ntop result should always protect against empty string accepted
without an error. Make additional check to satisfy coverity scans.

4 years agoInitialize printed buffer
Petr Menšík [Wed, 19 Jan 2022 13:47:13 +0000 (14:47 +0100)] 
Initialize printed buffer

- var_decl: Declaring variable "tbuf" without initializer
- assign: Assigning: "target.base" = "tbuf", which points to
  uninitialized data
- assign: Assigning: "r.base" = "target.base", which points to
  uninitialized data

I expect it would correctly initialize length always. Add simple
initialization to silent coverity.

4 years agoEnsure diff variable is not read uninitialized
Petr Menšík [Wed, 19 Jan 2022 12:35:32 +0000 (13:35 +0100)] 
Ensure diff variable is not read uninitialized

Coverity detected issues:
- var_decl: Declaring variable "diff" without initializer.
- uninit_use_in_call: Using uninitialized value "diff.tuples.head" when
  calling "dns_diff_clear".

4 years agoDon't test new-zones-directory argument validity
Petr Menšík [Tue, 18 Jan 2022 11:46:22 +0000 (12:46 +0100)] 
Don't test new-zones-directory argument validity

Parser ensures new-zones-directory has qstring parameter before it can
reach this place. dir == NULL then should never happen on any
configuration. Replace silent check with insist.

4 years agoMerge branch '3306-undefined-macros-in-contrib-dlz-modules-wildcard-dlz_wildcard_dyna...
Mark Andrews [Fri, 29 Apr 2022 00:51:09 +0000 (00:51 +0000)] 
Merge branch '3306-undefined-macros-in-contrib-dlz-modules-wildcard-dlz_wildcard_dynamic-c' into 'main'

Resolve "Undefined macros in contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c"

Closes #3306

See merge request isc-projects/bind9!6203

4 years agoAdd CHANGES note for [GL #3306]
Mark Andrews [Wed, 27 Apr 2022 21:42:51 +0000 (07:42 +1000)] 
Add CHANGES note for [GL #3306]

4 years agoDefine local instances of FALLTHROUGH and UNREACHABLE
Mark Andrews [Wed, 27 Apr 2022 20:56:56 +0000 (06:56 +1000)] 
Define local instances of FALLTHROUGH and UNREACHABLE

FALLTHOUGH is a copy of how it is defined in <isc/util.h>

UNREACHABLE follows the model used in MacOS /usr/include/c++/v1/cstdlib
to determine if __builtin_ureachable is available

4 years agoMerge branch '3296-check-the-algorithm-name-oid-for-privatedns-and-privateoid-signatu...
Mark Andrews [Thu, 28 Apr 2022 23:32:14 +0000 (23:32 +0000)] 
Merge branch '3296-check-the-algorithm-name-oid-for-privatedns-and-privateoid-signatures' into 'main'

Resolve "Check the algorithm name / oid for PRIVATEDNS and PRIVATEOID signatures."

Closes #3296

See merge request isc-projects/bind9!6149

4 years agoAdd release note entry for [GL #3296]
Mark Andrews [Thu, 21 Apr 2022 14:42:18 +0000 (00:42 +1000)] 
Add release note entry for [GL #3296]

4 years agoAdd CHANGES entry for [GL #3296]
Mark Andrews [Thu, 21 Apr 2022 10:00:37 +0000 (20:00 +1000)] 
Add CHANGES entry for [GL #3296]

4 years agoCheck that SIG and RRSIG records for private algorithms are valid
Mark Andrews [Thu, 21 Apr 2022 09:49:29 +0000 (19:49 +1000)] 
Check that SIG and RRSIG records for private algorithms are valid

SIG and RRSIG records for private algorithms are supposed to contain
the name / OID of the algorithm used to generate them at the start
of the signature field.

4 years agoMerge branch '2813-build-named-with-dlz-is-broken-with-MariaDB-10' into 'main'
Ondřej Surý [Thu, 28 Apr 2022 16:01:30 +0000 (16:01 +0000)] 
Merge branch '2813-build-named-with-dlz-is-broken-with-MariaDB-10' into 'main'

Use MARIADB_BASE_VERSION instead of LIBMARIADB to detect Maria DB

Closes #2813

See merge request isc-projects/bind9!6213

4 years agoUse MARIADB_BASE_VERSION instead of LIBMARIADB to detect Maria DB
Ondřej Surý [Thu, 28 Apr 2022 11:37:40 +0000 (13:37 +0200)] 
Use MARIADB_BASE_VERSION instead of LIBMARIADB to detect Maria DB

It was discovered that MariaDB 10 didn't define LIBMARIADB leading
to compilation errors of MySQL DLZ modules on Debian stretch.

Use MARIADB_BASE_VERSION instead which is defined in all tested MariaDB
versions.

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