2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00
Commit Graph

43778 Commits

Author SHA1 Message Date
Ondřej Surý
5d264b3329 Set name for all the isc_mem context
The memory context for isc_managers and dst_api units had no name and
that was causing trouble with the statistics channel output.  Set the
name for the two memory context that were missing a proper name.
2025-05-28 21:27:13 +02:00
Ondřej Surý
bc4a19acff fix: usr: Fix zone deletion issue
A secondary zone could initiate a new zone transfer from the
primary server after it had been already deleted from the
secondary server, and before the internal garbage collection
was activated to clean it up completely. This has been fixed.

Closes #5291

Merge branch '5291-zone-delete-bug' into 'main'

See merge request isc-projects/bind9!10449
2025-05-28 17:48:57 +00:00
Aram Sargsyan
874ca5ca2f Prepare a zone for shutting down when deleting it from a view
After b171cacf4f, a zone object can
remain in the memory for a while, until garbage collection is run.
Setting the DNS_ZONEFLG_EXITING flag should prevent the zone
maintenance function from running while it's in that state.
Otherwise, a secondary zone could initiate a zone transfer after
it had been deleted.
2025-05-28 16:59:05 +00:00
Ondřej Surý
610825ebc1 fix: usr: Fix a zone refresh bug
A secondary zone could fail to further refresh with new
versions of the zone from a primary server if named was
reconfigured during the SOA request step of an ongoing
zone transfer. This has been fixed.

Closes #5307

Merge branch '5307-zone-refresh-stuck-after-reconfiguration-fix' into 'main'

See merge request isc-projects/bind9!10468
2025-05-28 16:51:33 +00:00
Aram Sargsyan
f4cd307c6b Emit a ISC_R_CANCELED result instead of ISC_R_SHUTTINGDOWN
When request manager shuts down, it also shuts down all its ongoing
requests. Currently it calls their callback functions with a
ISC_R_SHUTTINGDOWN result code for the request. Since a request
manager can shutdown not only during named shutdown but also during
named reconfiguration, instead of sending ISC_R_SHUTTINGDOWN result
code send a ISC_R_CANCELED code to avoid confusion and errors with
the expectation that a ISC_R_SHUTTINGDOWN result code can only be
received during actual shutdown of named.

All the callback functions which are passed to either the
dns_request_create() or the dns_request_createraw() functions have
been analyzed to confirm that they can process both the
ISC_R_SHUTTINGDOWN and ISC_R_CANCELED result codes. Changes were
made where it was necessary.
2025-05-28 16:20:13 +00:00
Aram Sargsyan
aa6ca3e776 Test named reconfiguration during zone transfer's SOA request
This new test checks that named can correctly process an interrupted
SOA request during zone transfer, caused by reconfiguration.

Co-authored-by: Michał Kępień <michal@isc.org>
2025-05-28 16:20:13 +00:00
Aram Sargsyan
b07ec4f0b3 Add a debug log in zone.c:refresh_callback()
The new debug message logs the request result in the SOA request
callback function.
2025-05-28 16:20:13 +00:00
Aram Sargsyan
228e441328 Fix a zone refresh bug in zone.c:refresh_callback()
When the zone.c:refresh_callback() callback function is called during
a SOA request before a zone transfer, it can receive a
ISC_R_SHUTTINGDOWN result for the sent request when named is shutting
down, and in that case it just destroys the request and finishes the
ongoing transfer, without clearing the DNS_ZONEFLG_REFRESH flag of the
zone. This is alright when named is going to shutdown, but currently
the callback can get a ISC_R_SHUTTINGDOWN result also when named is
reconfigured during the ongoibg SOA request. In that case, leaving the
DNS_ZONEFLG_REFRESH flag set results in the zone never being able
to refresh again, because any new attempts will be caneled while
the flag is set. Clear the DNS_ZONEFLG_REFRESH flag on the 'exiting'
error path of the callback function.
2025-05-28 16:20:13 +00:00
Colin Vidal
08133582b0 fix: test: enable shell-based rndc system tests
Enable existing rndc system tests (the python test function calling the
shell file was missing). Also update the extra artifacts list to remove
one generated file which was left behind.

Merge branch 'colin/rndc-tests' into 'main'

See merge request isc-projects/bind9!10489
2025-05-28 15:44:21 +00:00
Colin Vidal
f84065a32c enable shell-based rndc system tests
Enable existing rndc system tests (the python test function calling the
shell file was missing). Also update the extra artifacts list to remove
one generated file which was left behind.
2025-05-28 16:58:56 +02:00
Petr Špaček
15abb88f76 chg: doc: Update security issue reporting procedure
Merge branch 'pspacek/update-reporting-procedure-sec-md' into 'main'

See merge request isc-projects/bind9!10487
2025-05-28 14:51:00 +00:00
Petr Špaček
cc60cc9a32 Update security issue reporting procedure
We have a new template for people to use. It saves lots of back and
forth if people use it.
2025-05-28 16:48:32 +02:00
Petr Špaček
83e4fda8c1 chg: test: DNSTAP test cleanup
Merge branch 'pspacek/dnstap-test-cleanup' into 'main'

See merge request isc-projects/bind9!10478
2025-05-28 11:16:17 +00:00
Petr Špaček
889b360167 Use Pytest mark to guard dnstap features 2025-05-28 10:45:32 +00:00
Petr Špaček
313a985dfc Fix DNSTAP feature detection for pytest 2025-05-28 10:45:32 +00:00
Petr Špaček
f176acdfcc Port dnstap test to use isctest utilities 2025-05-28 10:45:32 +00:00
Evan Hunt
a988ffcede fix: dev: Add more iteration macros
Add more macros for iteration: `DNS_RDATASET_FOREACH`, `CFG_LIST_FOREACH`, `DNS_DBITERATOR_FOREACH`, and `DNS_RDATASETITER_FOREACH`.

Merge branch 'each-rdataset-foreach' into 'main'

See merge request isc-projects/bind9!10350
2025-05-28 04:40:40 +00:00
Evan Hunt
8d065fd3e1 add DNS_DBITERATOR_FOREACH and DNS_RDATASETITER_FOREACH
when iterating databases, use DNS_DBITERATOR_FOREACH and
DNS_DNSRDATASETITER_FOREACH macros where possible.
2025-05-27 21:08:09 -07:00
Evan Hunt
24d077afb0 add CFG_LIST_FOREACH macro
replace the pattern `for (elt = cfg_list_first(x); elt != NULL;
elt = cfg_list_next(elt))` with a new `CFG_LIST_FOREACH` macro.
2025-05-27 21:08:09 -07:00
Evan Hunt
f10f5572ac add DNS_RDATASET_FOREACH macro
replace the pattern `for (result = dns_rdataset_first(x); result ==
ISC_R_SUCCES; result = dns_rdataset_next(x)` with a new
`DNS_RDATASET_FOREACH` macro throughout BIND.
2025-05-27 21:08:09 -07:00
Evan Hunt
6a6ef103dd import_rdataset() can't fail
the import_rdataset() function can't return any value other
than ISC_R_SUCCESS, so it's been changed to void and its callers
don't rely on its return value any longer.
2025-05-27 20:56:54 -07:00
Evan Hunt
7655e6c108 fix: nil: correct the DbC assertions in message.c
the comments for some calls in the dns_message API specified
requirements which were not actually enforced in the functions.
in most cases, this has now been corrected by adding the missing
REQUIREs. in one case, the comment was incorrect and has been
revised.

Merge branch 'each-fix-message-requires' into 'main'

See merge request isc-projects/bind9!10466
2025-05-27 23:11:27 +00:00
Evan Hunt
c437da59ee correct the DbC assertions in message.c
the comments for some calls in the dns_message API specified
requirements which were not actually enforced in the functions.

in most cases, this has now been corrected by adding the missing
REQUIREs. in one case, the comment was incorrect and has been
revised.
2025-05-27 23:11:04 +00:00
Evan Hunt
b045726f8f fix: dev: Make all ISC_LIST_FOREACH calls safe
Previously, `ISC_LIST_FOREACH` and `ISC_LIST_FOREACH_SAFE` were
two separate macros, with the _SAFE version allowing entries
to be unlinked during the loop. `ISC_LIST_FOREACH` is now also
safe, and the separate `_SAFE` macro has been removed.

Similarly, the `ISC_LIST_FOREACH_REV` macro is now safe, and
`ISC_LIST_FOREACH_REV_SAFE` has also been removed.

Merge branch 'each-isc-list-foreach' into 'main'

See merge request isc-projects/bind9!10479
2025-05-27 23:08:35 +00:00
Evan Hunt
8487e43ad9 make all ISC_LIST_FOREACH calls safe
previously, ISC_LIST_FOREACH and ISC_LIST_FOREACH_SAFE were
two separate macros, with the _SAFE version allowing entries
to be unlinked during the loop. ISC_LIST_FOREACH is now also
safe, and the separate _SAFE macro has been removed.

similarly, the ISC_LIST_FOREACH_REV macro is now safe, and
ISC_LIST_FOREACH_REV_SAFE has also been removed.
2025-05-23 13:09:10 -07:00
Nicki Křížek
94c4181442 [CVE-2025-40775] sec: test: Add a bad TSIG algorithm hypothesis python test
Closes #5300

Merge branch '5300-tsig-unknown-alg-test' into 'main'

See merge request isc-projects/bind9!10475
2025-05-23 11:30:58 +00:00
Nicki Křížek
96b0621de4 Add a bad TSIG algorithm hypothesis python test
Co-authored-by: Petr Špaček <pspacek@isc.org>
2025-05-23 10:39:52 +02:00
Alessio Podda
dc3a1bde65 chg: dev: Adaptive memory allocation strategy for qp-tries
qp-tries allocate their nodes (twigs) in chunks to reduce allocator
pressure and improve memory locality. The choice of chunk size presents
a tradeoff: larger chunks benefit qp-tries with many values (as seen
in large zones and resolvers) but waste memory in smaller use cases.

Previously, our fixed chunk size of 2^10 twigs meant that even an
empty qp-trie would consume 12KB of memory, while reducing this size
would negatively impact resolver performance.

This commit implements an adaptive chunking strategy that:
 - Tracks the size of the most recently allocated chunk.
 - Doubles the chunk size for each new allocation until reaching a
   predefined maximum.

This approach effectively balances memory efficiency for small tries
while maintaining the performance benefits of larger chunk sizes for
bigger data structures.

Merge branch 'alessio/qp-small-alloc' into 'main'

See merge request isc-projects/bind9!10245
2025-05-22 22:53:48 +00:00
Alessio Podda
d7064c9b88 Tune min and max chunk size
Before implementing adaptive chunk sizing, it was necessary to ensure
that a chunk could hold up to 48 twigs, but the new logic will size-up
new chunks to ensure that the current allocation can succeed.

We exploit the new logic in two ways:
 - We make the minimum chunk size smaller than the old limit of 2^6,
   reducing memory consumption.
 - We make the maximum chunk size larger, as it has been observed that
   it improves resolver performance.
2025-05-22 15:19:48 -07:00
alessio
70b1777d8a Adaptive memory allocation strategy for qp-tries
qp-tries allocate their nodes (twigs) in chunks to reduce allocator
pressure and improve memory locality. The choice of chunk size presents
a tradeoff: larger chunks benefit qp-tries with many values (as seen
in large zones and resolvers) but waste memory in smaller use cases.

Previously, our fixed chunk size of 2^10 twigs meant that even an
empty qp-trie would consume 12KB of memory, while reducing this size
would negatively impact resolver performance.

This commit implements an adaptive chunking strategy that:
 - Tracks the size of the most recently allocated chunk.
 - Doubles the chunk size for each new allocation until reaching a
   predefined maximum.

This approach effectively balances memory efficiency for small tries
while maintaining the performance benefits of larger chunk sizes for
bigger data structures.

This commit also splits the callback freeing qpmultis into two
phases, one that frees the underlying qptree, and one that reclaims
the qpmulti memory. In order to prevent races between the qpmulti
destructor and chunk garbage collection jobs, the second phase is
protected by reference counting.
2025-05-22 15:19:27 -07:00
Michał Kępień
13d0bab7c2 fix: doc: Update CVE checklist
Merge branch 'michal/update-cve-checklist' into 'main'

See merge request isc-projects/bind9!10473
2025-05-22 12:25:24 +00:00
Michał Kępień
65e32317e3 Fix duplicate Markdown reference
Commit 7e429463f5 added a second
definition of the "step_asn_send" reference.  Make the relevant links
distinct.
2025-05-22 14:21:04 +02:00
Michał Kępień
f8fe1bd635 Send pre-announcement emails for all ISC projects
There is no reason for the public pre-announcements of security issues
to only be sent for BIND 9.  Remove the "BIND 9 only" annotation from
the relevant checklist step as it caused confusion in practice.
2025-05-22 14:21:04 +02:00
Suzanne Goldlust
db62e8bfb9 Update CVE checklist template
Clarify a confusing step in the CVE checklist.
2025-05-22 14:21:04 +02:00
Michał Kępień
c9bf5df999 Merge tag 'v9.21.8' 2025-05-21 21:23:09 +02:00
Ondřej Surý
43f19763b3 rem: dev: Clean up the DST cryptographic API
The DST API has been cleaned up, duplicate functions has been squashed
into single call (verify and verify2 functions), and couple of unused
functions have been completely removed (createctx2, computesecret,
paramcompare, and cleanup).

Merge branch 'ondrej/dst_api-cleanup' into 'main'

See merge request isc-projects/bind9!10345
2025-05-20 23:39:34 +00:00
Ondřej Surý
8171bf01ed Deprecate max-rsa-exponent-size, always use 4096 instead
The `max-rsa-exponent-size` could limit the exponents of the RSA
public keys during the DNSSEC verification.  Instead of providing
a cryptic (not cryptographic) knob, hardcode the max exponent to
be 4096 (the theoretical maximum for DNSSEC).
2025-05-21 00:50:08 +02:00
Ondřej Surý
841b25fb62 Cleanup the DST cryptographic API
The DST API has been cleaned up, duplicate functions has been squashed
into single call (verify and verify2 functions), and couple of unused
functions have been completely removed (createctx2, computesecret,
paramcompare, and cleanup).
2025-05-20 09:52:35 +02:00
Arаm Sаrgsyаn
10a02e84eb new: usr: Implement a new 'notify-defer' configuration option
This new option sets a delay (in seconds) to wait before sending
a set of NOTIFY messages for a zone. Whenever a NOTIFY message is
ready to be sent, sending will be deferred for this duration. This
option is not to be confused with the :any:`notify-delay` option.
The default is 0 seconds.

Closes #5259

Merge branch '5259-implement-zone-notify-defer' into 'main'

See merge request isc-projects/bind9!10419
2025-05-15 13:26:44 +00:00
Aram Sargsyan
e42d6b4810 Implement a new 'notify-defer' configuration option
This new option sets the delay, in seconds, to wait before sending
a set of NOTIFY messages for a zone. Whenever a NOTIFY message is
ready to be sent, sending will be deferred for this duration.
2025-05-15 12:24:13 +00:00
Aram Sargsyan
d79b14ff5d Update the dns_zone_setnotifydelay() function's documentation
Add a note that the delay is in seconds.
2025-05-15 12:21:30 +00:00
Aram Sargsyan
62f66c0be0 Delete the unused dns_zone_getnotifydelete() function
The function is unused, delete it.
2025-05-15 12:21:30 +00:00
Arаm Sаrgsyаn
9c73285a6c fix: test: Fix catz system test errors
Merge branch 'aram/catz-system-test-errors-fix' into 'main'

See merge request isc-projects/bind9!10444
2025-05-15 12:19:46 +00:00
Aram Sargsyan
52ac03f064 Fix more catz system test errors
A quick grep check discovered a couple of more errors similar to the
one fixed in the previous commit. Fix them too.
2025-05-15 11:28:39 +00:00
Aram Sargsyan
f200b1ac18 Fix catz system test error
The '|| ret=1' is omitted from the check. This was introduced in the
b171cacf4f commit. Fix the error.
2025-05-15 11:28:39 +00:00
Michał Kępień
229a47afdb chg: test: Mark test_idle_timeout as flaky on FreeBSD 13
The test_idle_timeout check in the "timeouts" system test has been
failing often on FreeBSD 13 AWS hosts.  Adding timestamped debug logging
shows that the time.sleep() calls used in that check are returning
significantly later than asked to on that platform (e.g. after 4 seconds
when just 1 second is requested), breaking the test's timing assumptions
and triggering false positives.  These failures are not an indication of
a bug in named and have not been observed on any other platform.  Mark
the problematic check as flaky, but only on FreeBSD 13, so that other
failure modes are caught appropriately.

Merge branch 'michal/mark-test_idle_timeout-as-flaky-on-freebsd-13' into 'main'

See merge request isc-projects/bind9!10459
2025-05-14 17:17:11 +00:00
Michał Kępień
cb76b3729e Mark test_idle_timeout as flaky on FreeBSD 13
The test_idle_timeout check in the "timeouts" system test has been
failing often on FreeBSD 13 AWS hosts.  Adding timestamped debug logging
shows that the time.sleep() calls used in that check are returning
significantly later than asked to on that platform (e.g. after 4 seconds
when just 1 second is requested), breaking the test's timing assumptions
and triggering false positives.  These failures are not an indication of
a bug in named and have not been observed on any other platform.  Mark
the problematic check as flaky, but only on FreeBSD 13, so that other
failure modes are caught appropriately.
2025-05-14 09:50:33 +02:00
Evan Hunt
870c9b6a91 fix: dev: Debug level was ignored when logging to stderr
The debug level (set with the `-d` option) was ignored when running `named` with the `-g` and `-u` options.

Merge branch 'each-fix-debug-level' into 'main'

See merge request isc-projects/bind9!10453
2025-05-13 20:56:32 +00:00
Evan Hunt
96333bc6d7 debug level was ignored when logging to stderr
In commit cc167266aa, the -g option was changed so it sets both
named_g_logstderr and also named_g_logflags to use ISO style timestamps
with tzinfo. Together with an error in named_log_setsafechannels(), that
change could cause the debugging level to be ignored.
2025-05-13 12:47:23 -07:00
Michal Nowak
99b6914a94 rem: ci: Drop Ubuntu 20.04 Focal Fossa
Focal-specific ./configure options were moved to Jammy.

Merge branch 'mnowak/drop-ubuntu-focal' into 'main'

See merge request isc-projects/bind9!9899
2025-05-13 16:24:41 +00:00