Commit Graph

42029 Commits

Author SHA1 Message Date
Colin Vidal
ee77a19209 [9.20] new: usr: Add Extended DNS Error Code 22 - No Reachable Authority
When the resolver is trying to query an authority server and eventually timed out, a SERVFAIL answer is given to the client. Add the Extended DNS Error Code 22 - No Reachable Authority to the response.

Closes #2268

Backport of MR !9743

Merge branch 'backport-2268/ede-no-reachable-authority-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9814
2024-12-05 10:03:28 +00:00
Colin Vidal
c586d9a658 Add EDE 22 No reachable authority code
Add support for Extended DNS Errors (EDE) error 22: No reachable
authority. This occurs when after a timeout delay when the resolver is
trying to query an authority server.

(cherry picked from commit d13e94b930)

Commit amended in order to fix usage of isc_log_write (adding dns_lctx
parameter)
2024-12-05 10:30:28 +01:00
Michal Nowak
fc14b62e92 [9.20] chg: test: Rewrite ecdsa system test to pytest
Backport of MR !9159

Merge branch 'backport-mnowak/pytest_rewrite_ecdsa-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9816
2024-12-05 07:46:46 +00:00
Michal Nowak
211a0eafa9 Rewrite ecdsa system test to pytest
(cherry picked from commit 292e919156)
2024-12-05 07:46:17 +00:00
Mark Andrews
41af766cd0 [9.20] fix: usr: Fix possible assertion failure when reloading server while processing updates
Closes #5006

Backport of MR !9745

Merge branch 'backport-5006-get-max-by-type-earlier-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9820
2024-12-05 04:48:33 +00:00
Mark Andrews
f5bcc2a1b8 Keep a local copy of the update rules to prevent UAF
Previously, the update policy rules check was moved earlier in the
sequence, and the keep rule match pointers were kept to maintain the
ability to verify maximum records by type.

However, these pointers can become invalid if server reloading
or reconfiguration occurs before update completion. To prevent
this issue, extract the maximum records by type value immediately
during processing and only keep the copy of the values instead of the
full ssurule.

(cherry picked from commit 44a54a29d8)
2024-12-05 04:14:28 +00:00
Petr Špaček
ae739c80cc fix: dev: Fix m4 macro in configure.ac
Merge branch 'pspacek/fix-bind-9.20-build' into 'bind-9.20'

See merge request isc-projects/bind9!9813
2024-12-04 15:45:39 +00:00
Petr Špaček
cd033ac41f Fix m4 macro in configure.ac
Release automation went wrong, it seems. And I just glanced over the
line, saw 4 -> 5 change at the end and did not notice the change at the
beginning of the line...
2024-12-04 16:38:14 +01:00
Petr Špaček
37c3e5a1c0 chg: doc: Set up version for BIND 9.20.5
Merge branch 'pspacek/set-up-version-for-bind-9.20.5' into 'bind-9.20'

See merge request isc-projects/bind9!9811
2024-12-04 15:10:48 +00:00
Petr Špaček
0b44cfd53a Update BIND version to 9.20.5-dev 2024-12-04 16:06:17 +01:00
Petr Špaček
408bd910ec [9.20] chg: doc: gitchangelog: don't break lines on hyphens in relnotes
When release notes are generated, the text is wrapped and line breaks
are inserted into each paragraph (sourced from the commit message's
body). Prevent line breaks after hyphens, as these are often used for
option names. This makes it possible to easily find the options
afterwards.

Backport of MR !9801

Merge branch 'backport-nicki/gitchangelog-dont-break-on-hyphens-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9802
2024-12-02 14:01:29 +00:00
Nicki Křížek
2a86b13e28 gitchangelog: don't break lines on hyphens in relnotes
When release notes are generated, the text is wrapped and line breaks
are inserted into each paragraph (sourced from the commit message's
body). Prevent line breaks after hyphens, as these are often used for
option names. This makes it possible to easily find the options
afterwards.

(cherry picked from commit 9b0d0c0173)
2024-12-02 13:56:00 +00:00
Evan Hunt
1e9c3af75a [9.20] fix: dev: Use attach()/detach() functions instead of touching .references
In rbtdb.c, there were places where the code touched .references
directly instead of using the helper functions.  Use the helper
functions instead.

Forward port from https://gitlab.isc.org/isc-private/bind9/-/merge_requests/753

Merge branch 'ondrej/use-attach-detach-in-rbtdb-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9795
2024-11-27 22:51:41 +00:00
Ondřej Surý
db5803a0ec Use attach()/detach() functions instead of touching .references
In rbtdb.c, there were places where the code touched .references
directly instead of using the helper functions.  Use the helper
functions instead.
2024-11-27 21:16:22 +01:00
Ondřej Surý
8002fda38c [9.20] fix: dev: Make dns_validator_cancel() respect the data ownership
There was a data race dns_validator_cancel() was called when the
offloaded operations were in progress.  Make dns_validator_cancel()
respect the data ownership and only set new .canceling variable when
the offloaded operations are in progress.  The cancel operation would
then finish when the offloaded work passes the ownership back to the
respective thread.

Closes #4926

Backport of MR !9470

Merge branch 'backport-4926-fix-data-race-in-dns_validator-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9790
2024-11-27 19:04:26 +00:00
Ondřej Surý
f04514e98a Make dns_validator_cancel() respect the data ownership
There was a data race dns_validator_cancel() was called when the
offloaded operations were in progress.  Make dns_validator_cancel()
respect the data ownership and only set new .shuttingdown variable when
the offloaded operations are in progress.  The cancel operation would
then finish when the offloaded work passes the ownership back to the
respective thread.

(cherry picked from commit ee122ba025)
2024-11-27 19:43:26 +01:00
Ondřej Surý
fa5d270f95 [9.20] fix: usr: Improve the memory cleaning in the SERVFAIL cache
The SERVFAIL cache doesn't have a memory bound and the
cleaning of the old SERVFAIL cache entries was implemented
only in opportunistic manner.  Improve the memory cleaning
of the SERVFAIL cache to be more aggressive, so it doesn't
consume a lot of memory in the case the server encounters
many SERVFAILs at once.

Closes #5025

Backport of MR !9760

Merge branch 'backport-5025-improve-badcache-cleaning-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9794
2024-11-27 18:04:38 +00:00
Ondřej Surý
de7312ae5f Remove dns_badcache usage in the resolver (lame-ttl)
The lame-ttl processing was overriden to be disabled in the config,
but the code related to the lame-ttl was still kept in the resolver
code.  More importantly, the DNS_RESOLVER_BADCACHETTL() macro would
cause the entries in the resolver badcache to be always cached for at
least 30 seconds even if the lame-ttl would be set to 0.

Remove the dns_badcache code from the dns_resolver unit, so we save some
processing time and memory in the resolver code.

(cherry picked from commit b61739836d)
2024-11-27 17:07:03 +00:00
Ondřej Surý
6c3f1f09b2 Improve the badcache cleaning by adding LRU and using RCU
Instead of cleaning the dns_badcache opportunistically, add per-loop
LRU, so each thread-loop can clean the expired entries.  This also
allows removal of the atomic operations as the badcache entries are now
immutable, instead of updating the badcache entry in place, the old
entry is now deleted from the hashtable and the LRU list, and the new
entry is inserted in the LRU.

(cherry picked from commit 2cb5a6210f)
2024-11-27 17:07:03 +00:00
Arаm Sаrgsyаn
894295a926 [9.20] fix: test: Fix the nslookup system test
The nslookup system test checks the count of resolved addresses in
the CNAME tests using a 'grep' match on the hostname, and ignoring
lines containing the 'canonical name' string. In order to protect
the check from intermittent failures like the 'address in use' warning
message, which then automatically resolves after a retry, edit the
'grep' matching string to also ignore the comments (as the mentioned
warning message is a comment which contains the hostname).

Closes #4948

Backport of MR !9523

Merge branch 'backport-4948-nslookup-test-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9791
2024-11-27 15:54:01 +00:00
Aram Sargsyan
bebdabc06c Fix the nslookup system test
The nslookup system test checks the count of resolved addresses in
the CNAME tests using a 'grep' match on the hostname, and ignoring
lines containing the 'canonical name' string. In order to protect
the check from intermittent failures like the 'address in use' warning
message, which then automatically resolves after a retry, edit the
'grep' matching string to also ignore the comments (as the mentioned
warning message is a comment which contains the hostname).

(cherry picked from commit 345b0f9e5c)
2024-11-27 13:35:25 +00:00
Arаm Sаrgsyаn
ab138bb717 [9.20] fix: usr: Fix trying the next primary server when the preivous one was marked as unreachable
In some cases (there is evidence only when XoT was used) `named` failed
to try the next primary server in the list when the previous one was
marked as unreachable. This has been fixed.

Closes #5038

Backport of MR !9781

Merge branch 'backport-5038-xfr-primary-next-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9788
2024-11-27 13:30:13 +00:00
Aram Sargsyan
61d49b0731 Test trying of the next primary server
Add test cases which check that when a XoT primary server is
unreachable or is already marked as unreachble then the next
primary server in the list is used.

(cherry picked from commit 12225d125b)
2024-11-27 11:49:02 +00:00
Aram Sargsyan
375bd8ec75 xfrin: refactor and fix the ISC_R_CANCELED case handling
Previously a ISC_R_CANCELED result code switch-case has been added to
the zone.c:zone_xfrdone() function, which did two things:

1. Schedule a new zone transfer if there's a scheduled force reload of
   the zone.

2. Reset the primaries list.

This proved to be not a well-thought change and causes problems,
because the ISC_R_CANCELED code is used not only when the whole transfer
is canceled, but also when, for example, a particular primary server is
unreachable, and named still needs to continue the transfer process by
trying the next server, which it now no longer does in some cases. To
solve this issue, three changes are made:

1. Make sure dns_zone_refresh() runs on the zone's loop, so that the
   sequential calls of dns_zone_stopxfr() and dns_zone_forcexfr()
   functions (like done in 'rndc retransfer -force') run in intended
   order and don't race with each other.

2. Since starting the new transfer is now guaranteed to run after the
   previous transfer is shut down (see the previous change), remove the
   special handling of the ISC_R_CANCELED case, and let the default
   handler to handle it like before. This will bring back the ability to
   try the next primary if the current one was interrupted with a
   ISC_R_CANCELED result code.

3. Change the xfrin.c:xfrin_shutdown() function to pass the
   ISC_R_SHUTTINGDOWN result code instead of ISC_R_CANCELED, as it makes
   more sense.

(cherry picked from commit 3262ebd0f3)
2024-11-27 11:49:01 +00:00
Aram Sargsyan
b88f10afac Clean up dns_zonemgr_unreachabledel()
The results of isc_sockaddr_format() calls are not used, remove them
and the local variables.

(cherry picked from commit 1c4a34a3ab)
2024-11-27 11:49:01 +00:00
Mark Andrews
74e7e229f2 [9.20] chg: usr: emit more helpful log for exceeding max-records-per-type
The new log message is emitted when adding or updating an RRset
fails due to exceeding the max-records-per-type limit. The log includes
the owner name and type, corresponding zone name, and the limit value.
It will be emitted on loading a zone file, inbound zone transfer
(both AXFR and IXFR), handling a DDNS update, or updating a cache DB.
It's especially helpful in the case of zone transfer, since the
secondary side doesn't have direct access to the offending zone data.

It could also be used for max-types-per-name, but this change
doesn't implement it yet as it's much less likely to happen
in practice.

Backport of MR !9509

Merge branch 'backport-helpful-log-on-toomanyrecords-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9771
2024-11-27 00:51:59 +00:00
JINMEI Tatuya
c862555b66 update system tests to confirm new log messages
(cherry picked from commit 000720fe14)
2024-11-27 11:17:34 +11:00
JINMEI Tatuya
b8996b6e83 use more generic log module name for 'logtoomanyrecords'
DNS_LOGMODULE_RBTDB was simply inappropriate, and this
log message is actually dependent on db implementation
details, so DNS_LOGMODULE_DB would be the best choice.

(cherry picked from commit b0309ee631)
2024-11-27 11:17:34 +11:00
JINMEI Tatuya
08122316a7 emit more helpful log for exceeding max-records-per-type
The new log message is emitted when adding or updating an RRset
fails due to exceeding the max-records-per-type limit. The log includes
the owner name and type, corresponding zone name, and the limit value.
It will be emitted on loading a zone file, inbound zone transfer
(both AXFR and IXFR), handling a DDNS update, or updating a cache DB.
It's especially helpful in the case of zone transfer, since the
secondary side doesn't have direct access to the offending zone data.

It could also be used for max-types-per-name, but this change
doesn't implement it yet as it's much less likely to happen
in practice.

(cherry picked from commit 4156995431)
2024-11-27 11:17:34 +11:00
Michal Nowak
d754d3c2e0 [9.20] chg: test: Rewrite emptyzones system test to pytest
Backport of MR !9154

Merge branch 'backport-mnowak/pytest_rewrite_emptyzones-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9782
2024-11-26 17:03:49 +00:00
Michal Nowak
58316503b6 Rewrite emptyzones system test to pytest
(cherry picked from commit 3ace62472c)
2024-11-26 17:03:30 +00:00
Michal Nowak
a506a04c98 Add isctest.check.refused()
(cherry picked from commit 7bedd1c296)
2024-11-26 17:03:30 +00:00
Ondřej Surý
a1cd30cd25 [9.20] rem: usr: Move contributed DLZ modules into a separate repository
The DLZ modules are poorly maintained as we only ensure they can still
be compiled, the DLZ interface is blocking, so anything that blocks the
query to the database blocks the whole server and they should not be
used except in testing.  The DLZ interface itself is going to be scheduled
for removal.

The DLZ modules now live in https://gitlab.isc.org/isc-projects/dlz-modules
repository.

Closes #4865

Backport of MR !9349

Merge branch 'backport-4865-remove-contributed-DLZ-modules-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9777
2024-11-26 15:43:52 +00:00
Ondřej Surý
624ea6c57e Move contributed DLZ modules into a separate repository
The DLZ modules are poorly maintained as we only ensure they can still
be compiled, the DLZ interface is blocking, so anything that blocks the
query to the database blocks the whole server and they should not be
used except in testing.  The DLZ interface itself should be scheduled
for removal.

(cherry picked from commit a6cce753e2)
2024-11-26 16:24:17 +01:00
Michal Nowak
14d5c67f31 [9.20] chg: test: Rewrite database system test to pytest
Backport of MR !9156

Merge branch 'backport-mnowak/pytest_rewrite_database-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9779
2024-11-26 14:04:06 +00:00
Michal Nowak
5d28efecfc Rewrite database system test to pytest
(cherry picked from commit 8005ad0dcd)
2024-11-26 12:12:26 +00:00
Michal Nowak
7f14fffe6f [9.20] rem: test: Revert "xfail upforwd system test if DNSTAP is enabled"
This reverts commit 0579e0a429.

See isc-projects/bind9#4996

Backport of MR !9681

Merge branch 'backport-mnowak/revert-xfail-upforwd-system-test-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9776
2024-11-26 11:53:43 +00:00
Michal Nowak
3cb61b1252 Revert "xfail upforwd system test if DNSTAP is enabled"
This reverts commit 0579e0a429.

(cherry picked from commit e7e73da39a)
2024-11-26 10:50:15 +00:00
Nicki Křížek
2b3c88d283 [9.20] fix: test: Ignore test artifacts in .libs
Some tests may leave artifacts in the .libs directory. Ignore this
directory when detecting expected artifacts.

Closes #5055

Backport of MR !9766

Merge branch 'backport-5055-ignore-libs-artifacts-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9773
2024-11-26 10:15:25 +00:00
Nicki Křížek
d7cb6263a3 Ignore test artifacts in .libs
Some tests may leave artifacts in the .libs directory. Ignore this
directory when detecting expected artifacts.

(cherry picked from commit cf606a9ead)
2024-11-26 09:06:06 +00:00
Alessio Podda
4509b92e21 [9.20] chg: dev: Incrementally apply AXFR transfer
Reintroduce logic to apply diffs when the number of pending tuples is
above 128. The previous strategy of accumulating all the tuples and
pushing them at the end leads to excessive memory consumption during
transfer.

This effectively reverts half of e3892805d6

Closes #4986

Backport of MR !9740

Merge branch 'backport-4986-axfr-chunked-insert-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9761
2024-11-26 08:25:03 +00:00
Alessio Podda
0472494417 Incrementally apply AXFR transfer
Reintroduce logic to apply diffs when the number of pending tuples is
above 128. The previous strategy of accumulating all the tuples and
pushing them at the end leads to excessive memory consumption during
transfer.

This effectively reverts half of e3892805d6

(cherry picked from commit 99b4f01b33)
2024-11-26 07:17:06 +00:00
Mark Andrews
b27cb14616 [9.20] fix: usr: '{&dns}' is as valid as '{?dns}' in a SVCB's dohpath
`dig` fails to parse a valid (as far as I can tell, and accepted by `kdig` and `Wireshark`) `SVCB` record with a `dohpath` URI template containing a `{&dns}`, like `dohpath=/some/path?key=value{&dns}"`. If the URI template contains a `{?dns}` instead `dig` is happy, but my understanding of rfc9461 and section 1.2. "Levels and Expression Types" of rfc6570 is that `{&dns}` is valid.
See for example section 1.2. "Levels and Expression Types" of rfc6570.

Note that Peter van Dijk suggested that `{dns}` and `{dns,someothervar}` might be valid forms as well, so my patch might be too restrictive, although it's anyone's guess how DoH clients would handle complex templates.

Closes https://gitlab.isc.org/isc-projects/bind9/-/issues/4922

Backport of MR !9455

Merge branch 'backport-svcb-dohpath-uri-template-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9769
2024-11-26 06:30:29 +00:00
Mark Andrews
0e00e28ec6 Parse the URI template and check for a dns variable
The 'dns' variable in dohpath can be in various forms ({?dns},
{dns}, {&dns} etc.).  To check for a valid dohpath it ends up
being simpler to just parse the URI template rather than looking
for all the various forms if substring.

(cherry picked from commit af54ef9f5d)
2024-11-26 03:41:46 +00:00
Remi Gacogne
cc9366031b '{&dns}' is as valid as '{?dns}' in a SVCB's dohpath
See for example section 1.2. "Levels and Expression Types" of rfc6570.

(cherry picked from commit e74052ea71)
2024-11-26 03:41:45 +00:00
Mark Andrews
41fd5e9955 [9.20] fix: usr: Provide more visibility into configuration errors
by logging SSL_CTX_use_certificate_chain_file and SSL_CTX_use_PrivateKey_file errors individually.

Closes #5008

Backport of MR !9683

Merge branch 'backport-5008-provide-more-visibility-into-ssl-errors-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9767
2024-11-26 03:16:26 +00:00
Mark Andrews
983d8a6821 Provide more visibility into configuration errors
by logging SSL_CTX_use_certificate_chain_file and
SSL_CTX_use_PrivateKey_file errors

(cherry picked from commit 9006839ed7)
2024-11-26 12:25:01 +11:00
Nicki Křížek
c3691d138a [9.20] fix: test: Allow re-run of mkeys system test
On some slow systems, the test might intermittently fail due to inherent
timing issues. In our CI, this most often happens in the
system:gcc:8fips:amd64 jobs.

Closes #3098

Backport of MR !9732

Merge branch 'backport-3098-allow-re-run-of-mkeys-test-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9764
2024-11-25 15:44:47 +00:00
Nicki Křížek
80967a2c66 Allow re-run of mkeys system test
On some slow systems, the test might intermittently fail due to inherent
timing issues. In our CI, this most often happens in the
system:gcc:8fips:amd64 jobs.

(cherry picked from commit a299650a6f)
2024-11-25 14:35:54 +00:00
Michal Nowak
402e0596c8 [9.20] fix: ci: Fix paths to binaries in cross-version-config-tests job
The cross-version-config-tests job has never functioned in CI because
the testing framework changed after the testing was completed. To run
the new "named" binary using the old configurations, paths in the test
framework must be updated to point to the location of the new binaries.

Closes #4977

Backport of MR !9702

Merge branch 'backport-4977-fix-cross-version-config-tests-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9762
2024-11-25 12:32:23 +00:00