]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
8 months agostart treating openssl 3.0 and 1.1 as separate libraries aydin/libcrypto-version-split
Aydın Mercan [Tue, 12 Aug 2025 09:53:11 +0000 (12:53 +0300)] 
start treating openssl 3.0 and 1.1 as separate libraries

OpenSSL 3.0 has completely revamed the way applications are supposed to
interact with libcrypto with the old way gaining a hefty perfomance
penalty.

Almost every cryptographic functionality will have a pre-3.0 and
post-3.0 counterpart split by the preprocessor after the migration is
complete.

Instead of having a macros mess everywhere, start the long term plan of
having a cryptographic functionality layer with OpenSSL >=3.0 and
OpenSSL <3.0 as two separate backends.

Start this process by splitting the initialization function.

8 months agoremove const qualifier in isc__crypto_*
Aydın Mercan [Tue, 12 Aug 2025 09:51:38 +0000 (12:51 +0300)] 
remove const qualifier in isc__crypto_*

The `EVP_MD *` pointers assigned with `EVP_MD_fetch` aren't const
qualified, adding a correctness issue.

8 months agonew: usr: Add a new 'servfail-until-ready' configuration option for RPZ
Arаm Sаrgsyаn [Fri, 22 Aug 2025 18:37:20 +0000 (18:37 +0000)] 
new: usr: Add a new 'servfail-until-ready' configuration option for RPZ

By default, when :iscman:`named` is started it may start answering to
queries before the response policy zones are completely loaded
and processed. This new feature gives an option to the users to
tell :iscman:`named` that incoming requests should result in SERVFAIL answer
until all the response policy zones are processed and ready. Note that if
one or more response policy zones fail to load, :iscman:`named` starts
responding to queries according to those zones that did load.

Closes #5222

Merge branch '5222-stop-sending-responses-until-rpz-is-ready' into 'main'

See merge request isc-projects/bind9!10839

8 months agoTest the new 'servfail-until-ready' option
Aram Sargsyan [Fri, 8 Aug 2025 12:24:47 +0000 (12:24 +0000)] 
Test the new 'servfail-until-ready' option

Test whether 'servfail-until-ready yes' works by enabling slow
RPZ loading with a USDT probe activation, and checking that named
returns SERVFAIL during the initial RPZ zones processing stage.

The test requires SystemTap (stap, dtrace) to activate the USDT
probe.

8 months agoImplement '-T slowrpz' named testing option
Aram Sargsyan [Tue, 19 Aug 2025 09:10:06 +0000 (09:10 +0000)] 
Implement '-T slowrpz' named testing option

When used, named processes RPZ zones slowly. Useful for system tests.

8 months agoAdd a new 'servfail-until-ready' configuration option for RPZ
Aram Sargsyan [Mon, 19 May 2025 17:11:57 +0000 (17:11 +0000)] 
Add a new 'servfail-until-ready' configuration option for RPZ

By default, when named is started it may start answering to
queries before the response policy zones are completely loaded
and processed. This new feature gives an option to the users to
tell named that incoming requests should result in SERVFAIL anwser
until all the response policy zones are procesed and ready.

8 months agoAdd 'first_time' member to 'dns_rpz_zones_t'
Aram Sargsyan [Fri, 8 Aug 2025 12:08:55 +0000 (12:08 +0000)] 
Add 'first_time' member to 'dns_rpz_zones_t'

During the initial configuration of named after startup, 'first_time'
is true. This is needed for implementing the new 'servfail-until-ready'
configuration option, which should take into effect only during the
initial configuration.

8 months agonew: usr: Add manual mode configuration option to dnsec-policy
Matthijs Mekking [Thu, 21 Aug 2025 15:18:15 +0000 (15:18 +0000)] 
new: usr: Add manual mode configuration option to dnsec-policy

Add a new option ``manual-mode`` to :any:`dnssec-policy`. The intended use is that if it is enabled, it will not automatically move to the
next state transition, but instead the transition is logged. Only after manual confirmation with ``rndc dnssec -step`` the transition is made.

Closes #4606

Merge branch '4606-dnssec-policy-dry-run' into 'main'

See merge request isc-projects/bind9!10774

8 months agoTest manual-mode error case
Matthijs Mekking [Wed, 20 Aug 2025 13:41:13 +0000 (15:41 +0200)] 
Test manual-mode error case

If we hit an error when issuing an 'rndc dnssec -step' command, and the
keymgr runs again at a later scheduled time, we don't want to enforce
transitions.

8 months agoTest manual-mode while enabling DNSSEC
Matthijs Mekking [Thu, 24 Jul 2025 12:57:35 +0000 (14:57 +0200)] 
Test manual-mode while enabling DNSSEC

Similar to previous commit.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.

8 months agoTest manual-mode with ZSK rollover
Matthijs Mekking [Thu, 24 Jul 2025 12:12:23 +0000 (14:12 +0200)] 
Test manual-mode with ZSK rollover

Similar to previous commit.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.

8 months agoTest manual-mode with KSK rollover
Matthijs Mekking [Thu, 24 Jul 2025 10:05:06 +0000 (12:05 +0200)] 
Test manual-mode with KSK rollover

Similar to previous commit.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.

8 months agoTest manual-mode with CSK rollover (2)
Matthijs Mekking [Thu, 24 Jul 2025 09:42:59 +0000 (11:42 +0200)] 
Test manual-mode with CSK rollover (2)

Similar to previous commit.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.

8 months agoTest manual-mode with CSK rollover (1)
Matthijs Mekking [Wed, 23 Jul 2025 13:04:36 +0000 (15:04 +0200)] 
Test manual-mode with CSK rollover (1)

Similar to previous commits.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.

8 months agoTest manual-mode with KSK/ZSK algorithm rollover
Matthijs Mekking [Wed, 23 Jul 2025 08:34:07 +0000 (10:34 +0200)] 
Test manual-mode with KSK/ZSK algorithm rollover

Similar to the previous commit that tests CSK algorithm rollover.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.

8 months agoTest manual-mode with CSK algorithm rollover
Matthijs Mekking [Wed, 23 Jul 2025 07:27:04 +0000 (09:27 +0200)] 
Test manual-mode with CSK algorithm rollover

Update check_rollover_step to return the found keys. This can be used
to test that keymgr-manual-mode messages are correctly logged.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.

8 months agoAdd manual-mode parameter to isctest.kasp
Matthijs Mekking [Thu, 24 Jul 2025 09:09:01 +0000 (11:09 +0200)] 
Add manual-mode parameter to isctest.kasp

Key state transitions may be blocked by manual-mode, meaning key
timing metadata may not be respected and can be inaccurate. For these
tests use the state values to determine whether the DNSKEY/CDS/CDNSKEY
RRset must be published or not.

8 months agoPrepare rollover system tests for manual-mode
Matthijs Mekking [Tue, 22 Jul 2025 08:59:13 +0000 (10:59 +0200)] 
Prepare rollover system tests for manual-mode

For the algorithm, CSK, KSK, ZSK rollovers, enabling DNSSEC and going
insecure, add new zones to be tested in manual-mode.

8 months agoDetect if keymgr made changes
Matthijs Mekking [Thu, 24 Jul 2025 09:14:16 +0000 (11:14 +0200)] 
Detect if keymgr made changes

If so we also want to tickle the apex because DNSKEY/CDNSKEY/CDS
RRsets may need to be re-signed.

Note that this may be overzealous, because if state transitions
happen just because of timing events (RUMOURED -> OMNIPRESENT,
UNRETENTIVE -> HIDDEN) this would have to cause changes in the
zone DNSSEC records.

8 months agoImplement manual-mode for kasp
Matthijs Mekking [Wed, 19 Mar 2025 16:10:25 +0000 (17:10 +0100)] 
Implement manual-mode for kasp

When a key retire, key generation/introduction, or a state transition
to RUMOURED/UNRETENTIVE should happen, instead they are logged.
When those logs look good, you can run 'rndc dnssec -step' to run the
keymgr and apply those steps.

8 months agoAdd manual-mode config option
Matthijs Mekking [Mon, 17 Feb 2025 11:05:25 +0000 (12:05 +0100)] 
Add manual-mode config option

Add a new option 'manual-mode' to 'dnssec-policy'. The intended
use is that if it is enabled, it will not automatically move to the
next state transition (RUMOURED, UNRETENTIVE), only after manual
confirmation. The intended state transition should be logged.

8 months agofix: nil: Fix ISC_LEADING_ZEROS and ISC_TRAILING_ZEROS macros
Mark Andrews [Wed, 20 Aug 2025 23:54:29 +0000 (09:54 +1000)] 
fix: nil: Fix ISC_LEADING_ZEROS and ISC_TRAILING_ZEROS macros

Closes #5488

Merge branch '5488-fix-isc-leading-trailing-zeros-macros' into 'main'

See merge request isc-projects/bind9!10875

8 months agoFix ISC_LEADING_ZEROS and ISC_TRAILING_ZEROS macros
Mark Andrews [Wed, 20 Aug 2025 09:38:00 +0000 (19:38 +1000)] 
Fix ISC_LEADING_ZEROS and ISC_TRAILING_ZEROS macros

8 months agoMerge tag 'v9.21.11'
Andoni Duarte Pintado [Wed, 20 Aug 2025 16:09:46 +0000 (18:09 +0200)] 
Merge tag 'v9.21.11'

8 months agonew: test: Test migrating to dnsec-policy alessio/always-preallocate-sigrdataset-baseline
Matthijs Mekking [Tue, 19 Aug 2025 14:07:21 +0000 (14:07 +0000)] 
new: test: Test migrating to dnsec-policy

Various test cases where legacy keys exist and are used to migrate to 'dnssec-policy'. These once existed as shell script but were removed because 'auto-dnssec' was removed. But the test cases are still useful if one wants to migrate to 'dnssec-policy' with such legacy keys, so it would be good to resurrect these tests.

Closes #3769

Merge branch '3769-migrate-zsk-ksk-plit' into 'main'

See merge request isc-projects/bind9!10787

8 months agoAdd a test case for no -P sync
Matthijs Mekking [Tue, 29 Jul 2025 08:15:00 +0000 (10:15 +0200)] 
Add a test case for no -P sync

This is a follow-up from the test cases that were added long time ago
that cover migrating to dnssec-policy.

The test covers legacy keys that do not have the SyncPublish timing
metadata set.

8 months agoTest migration to dnssec-policy
Matthijs Mekking [Mon, 28 Jul 2025 08:05:46 +0000 (10:05 +0200)] 
Test migration to dnssec-policy

Various test cases where legacy keys exist and are used to migrate to
dnssec-policy. These once existed as shell script but were removed
because auto-dnssec was removed. But the test cases are still useful
if one wants to migrate to dnssec-policy with such legacy keys.

The tests were previously removed in commit
906dd57b68dab3526af82ec266f413e11391394d as part of MR !8085.

8 months agoAllow for lifetime not set in state file
Matthijs Mekking [Tue, 29 Jul 2025 07:22:00 +0000 (09:22 +0200)] 
Allow for lifetime not set in state file

When migrating to dnssec-policy, keys that do not match will not have
a lifetime set. Adjust the test code to allow for that. Setting '-'
in a key properties string signals lifetime is expected not to be set.

8 months agoUpdate set_expected_keytimes for migrate case
Matthijs Mekking [Mon, 28 Jul 2025 12:12:55 +0000 (14:12 +0200)] 
Update set_expected_keytimes for migrate case

If we are migrating keys, we should take the existing key timing
metadata to initialise the state values. These tests will only setup
keys with Publish/Activate/SyncPublish times, because the Retire and
Remove timings will still need to be adjusted to the DNSSEC policy.

8 months agofix: pkg: batch minor meson fixes
Aydın Mercan [Tue, 19 Aug 2025 13:41:47 +0000 (16:41 +0300)] 
fix: pkg: batch minor meson fixes

This MR fixes various meson issues that are found after the first meson release and are too small to have a MR on their own.

See #5379

Merge branch 'aydin/meson-batch-fixes' into 'main'

See merge request isc-projects/bind9!10780

8 months agoAdd the project version to the library name
Ondřej Surý [Mon, 4 Aug 2025 10:16:13 +0000 (12:16 +0200)] 
Add the project version to the library name

Restore the library naming that included the current project version in
the library name, e.g. SONAME is going to be libisc-9.21.11.so.

8 months agoUse a proper compiler test for constexpr support
Aydın Mercan [Mon, 28 Jul 2025 13:19:41 +0000 (13:19 +0000)] 
Use a proper compiler test for constexpr support

After GCC 15, C23 became the default version. [1]

Add a proper compiler test for constexpr support to ensure that GCC 15+
invoked with `c_std` set to `none` does not erroneously use the
constexpr shim.

This change does not affect the build in its default configuration
(which uses GNU C11); it is only meant to prepare the build system for
adding C23 elements to the code.

[1]: https://gcc.gnu.org/gcc-15/changes.html

8 months agoRemove unused datadir variable
Aydın Mercan [Thu, 24 Jul 2025 09:56:51 +0000 (12:56 +0300)] 
Remove unused datadir variable

8 months agoRemove install_rpath from installed targets alessio/pre-rpath-changes
Aydın Mercan [Thu, 24 Jul 2025 09:25:55 +0000 (12:25 +0300)] 
Remove install_rpath from installed targets

Specifying the RPATH deviates from widespread packaging norms where the
value isn't expected to be set by the project. [1] [2] [3]

Meet this expectation by restoring meson's default behavior where
targets in the build directory have the RPATH fixed with meson stripping
the value during installation.

[1]: https://wiki.debian.org/RpathIssue
[2]: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_beware_of_rpath
[3]: https://en.opensuse.org/openSUSE:Packaging_checks#Beware_of_Rpath

8 months agochg: dev: Remove opportunistic node cleaning from qpzone
Alessio Podda [Tue, 19 Aug 2025 13:00:47 +0000 (13:00 +0000)] 
chg: dev: Remove opportunistic node cleaning from qpzone

Currently, when releasing a qpznode after a read operation, we will
check if the node is dirty due to a previous write, upgrade the lock to
a write lock and perform a cleanup.

An unintended side effect of this is that protecting a node by
increasing the reference count must also protect its parent database.
For the very common case where only one zone is configured, this is a
non-trivial source of contention, as the same refcount will be hit by
all threads.

This MR removes the opportunistic cleaning and the database
refcount, reducing contention. Cleaning will be done only on
closeversion.

Merge branch 'alessio/remove-opportunistic-node-cleaning' into 'main'

See merge request isc-projects/bind9!10814

8 months agoRemove opportunistic node cleaning, clean up only on closeversion
Alessio Podda [Wed, 28 May 2025 23:03:45 +0000 (01:03 +0200)] 
Remove opportunistic node cleaning, clean up only on closeversion

Currently, when releasing a qpznode after a read operation, we will
check if the node is dirty due to a previous write, upgrade the lock to
a write lock and perform a cleanup.

An unintended side effect of this is that protecting a node by
increasing the reference count must also protect its parent database.
For the very common case where only one zone is configured, this is a
non-trivial source of contention, as the same refcount will be hit by
all threads.

This commit removes the opportunistic cleaning and the database
refcount, reducing contention. Cleaning will be done only on
closeversion.

8 months agoDo not skip cleanup for origin nodes in qpzone
Alessio Podda [Tue, 19 Aug 2025 12:12:46 +0000 (14:12 +0200)] 
Do not skip cleanup for origin nodes in qpzone

Per @each, skipping cleanup of (|nsec_|nsec3_)origin nodes in
qpznode_release in qpzone.c is a residual from RBTDB, but it is
unnecessary or at most a performance optimization with QP.

Remove it to make it further changes easier to qpznode_release easier.

8 months agonew: dev: add <isc/bit.h> alessio/no-node-cleaning
Aydın Mercan [Tue, 19 Aug 2025 11:03:12 +0000 (14:03 +0300)] 
new: dev: add <isc/bit.h>

The `<isc/bit.h>` header is a GNU C11 compatible version of C23's
`<stdbit.h>`.

It currently uses either `<stdbit.h>` or the equivilent compiler
builtins. However, the generic `__builtin_ctzg` and `__builtin_ctlz`
builtins are not available in every compiler version and thus falls
back to manually selecting from type.

Furthermore, the ctz fallback has been removed since `__builtin_ctzll`
has been used for a while directly without any compilation issues from
users. Thus, we can also require `__builtin_ctz`.

Merge branch 'aydin/isc_bit' into 'main'

See merge request isc-projects/bind9!10282

8 months agoadd isc/bit.h and unify common bit operations
Aydın Mercan [Mon, 18 Aug 2025 11:07:38 +0000 (14:07 +0300)] 
add isc/bit.h and unify common bit operations

The `<isc/bit.h>` header is a GNU C11 compatible version of C23's
`<stdbit.h>`.

It currently uses either `<stdbit.h>` or the equivilent compiler
builtins. However, the generic `__builtin_ctzg` and `__builtin_ctlz`
builtins are not available in every compiler version and thus falls
back to manually selecting from type.

Furthermore, the ctz fallback has been removed since `__builtin_ctzll`
has been used for a while directly without any compilation issues from
users. Thus, we can also require `__builtin_ctz`.

Unlike the rest of C23's bit utilities, we avoid the stdc_rotate_*
functions since we don't need the rotation modulus precision. This adds
a couple (admittedly cheap) unwanted instructions on some architectures.

8 months agochg: dev: Update clang-format style with options added in newer versions alessio/clang-format
Ondřej Surý [Tue, 19 Aug 2025 06:00:20 +0000 (08:00 +0200)] 
chg: dev: Update clang-format style with options added in newer versions

Add and apply InsertBraces statement to add missing curly braces around one-line statements and use ControlStatementsExceptControlMacros for SpaceBeforeParens to remove space between foreach macro and the brace, e.g. `FOREACH (x) {` becomes `FOREACH(x) {`.

Merge branch 'ondrej/update-clang-format' into 'main'

See merge request isc-projects/bind9!10863

8 months agoIgnore clang-format reformatting commits
Ondřej Surý [Tue, 19 Aug 2025 05:56:37 +0000 (07:56 +0200)] 
Ignore clang-format reformatting commits

8 months agoUse ControlStatementsExceptControlMacros for SpaceBeforeParens
Ondřej Surý [Tue, 19 Aug 2025 05:14:45 +0000 (07:14 +0200)] 
Use ControlStatementsExceptControlMacros for SpaceBeforeParens

> Put a space before opening parentheses only after control statement
> keywords (for/if/while...) except this option doesn’t apply to ForEach
> and If macros. This is useful in projects where ForEach/If macros are
> treated as function calls instead of control statements.

8 months agoAdd and apply InsertBraces statement
Ondřej Surý [Tue, 19 Aug 2025 05:11:16 +0000 (07:11 +0200)] 
Add and apply InsertBraces statement

> Insert braces after control statements (if, else, for, do, and while)
> in C++ unless the control statements are inside macro definitions or
> the braces would enclose preprocessor directives.

8 months agofix: dev: Disassociate added rdataset on error in cache_rrset()
Evan Hunt [Mon, 18 Aug 2025 21:08:22 +0000 (21:08 +0000)] 
fix: dev: Disassociate added rdataset on error in cache_rrset()

When first dns_db_addrdataset() succeeds in cache_rrset(), but the
second one fails with error, the added rdataset was kept associated.
This caused assertion failure down the pipe in fctx_sendevents().

Merge branch 'ondrej/disassociate-added-on-error-in-cache_rrset' into 'main'

See merge request isc-projects/bind9!10861

8 months agoDisassociate added rdataset on error in cache_rrset()
Ondřej Surý [Mon, 18 Aug 2025 15:11:03 +0000 (17:11 +0200)] 
Disassociate added rdataset on error in cache_rrset()

When first dns_db_addrdataset() succeeds in cache_rrset(), but the
second one fails with error, the added rdataset was kept associated.
This caused assertion failure down the pipe in fctx_sendevents().

8 months agofix: dev: remove unused warning if DNS_TYPEPAIR_CHECK is off 733-rewrite-various-logging-functions-to-variadic-macros
Colin Vidal [Mon, 18 Aug 2025 12:28:47 +0000 (14:28 +0200)] 
fix: dev: remove unused warning if DNS_TYPEPAIR_CHECK is off

The compile-time DNS__TYPEPAIR_CHECK macro (wrapping an INSIST) is a
no-op if DNS_TYPEPAIR_CHECK is off, making at least one unused variable
in DNS_TYPEPAIR_TYPE and DNS_TYPEPAIR_COVERS scopes (as in such case,
only one member of the pair is effectively needed).

In such case, having an unused variable (the other member of the pair)
is expected, this silence the warning by adding a (void) cast on the
no-op version of DNS__TYPEPAIR_CHECK.

Merge branch 'colin/typepair-check-unused-warn' into 'main'

See merge request isc-projects/bind9!10860

8 months agoremove unused warning if DNS_TYPEPAIR_CHECK is off
Colin Vidal [Mon, 18 Aug 2025 09:23:19 +0000 (11:23 +0200)] 
remove unused warning if DNS_TYPEPAIR_CHECK is off

The compile-time DNS__TYPEPAIR_CHECK macro (wrapping an INSIST) is a
no-op if DNS_TYPEPAIR_CHECK is off, making at least one unused variable
in DNS_TYPEPAIR_TYPE and DNS_TYPEPAIR_COVERS scopes (as in such case,
only one member of the pair is effectively needed).

In such case, having an unused variable (the other member of the pair)
is expected, this silence the warning by adding a (void) cast on the
no-op version of DNS__TYPEPAIR_CHECK.

8 months agochg: dev: Split the top level slabheader hierarchy and the individual slabheaders
Ondřej Surý [Mon, 18 Aug 2025 11:16:14 +0000 (13:16 +0200)] 
chg: dev: Split the top level slabheader hierarchy and the individual slabheaders

Merge branch 'ondrej/split-dns_slabheader' into 'main'

See merge request isc-projects/bind9!10826

8 months agoUse ISC_UxxTOyy_BE macros for {peek,get,put}_uint16 macros
Ondřej Surý [Mon, 18 Aug 2025 06:05:33 +0000 (08:05 +0200)] 
Use ISC_UxxTOyy_BE macros for {peek,get,put}_uint16 macros

Reduce the duplication and use existing macros from isc/endian.h for
network to host and vice versa conversion.

8 months agoreplace dns_slabheader_raw() with a flexible array member
Evan Hunt [Sun, 17 Aug 2025 22:54:03 +0000 (15:54 -0700)] 
replace dns_slabheader_raw() with a flexible array member

we can use header->raw instead of dns_slabheader_raw().

8 months agouse get_uint16() to read count and rdlen
Evan Hunt [Sun, 17 Aug 2025 20:59:05 +0000 (13:59 -0700)] 
use get_uint16() to read count and rdlen

use the same macro defned for rdataslab.c to get count and
length values from raw slabs in qpzone.c.

8 months agosimplify iterator_active()
Evan Hunt [Sun, 17 Aug 2025 20:53:04 +0000 (13:53 -0700)] 
simplify iterator_active()

the if statements calling iterator_active() checked the EXISTS
flag on the header and then iterator_active() checked it again.
simplify so only the caller checks it.

8 months agoMove SIEVE-LRU to dns_slabtop_t structure
Ondřej Surý [Wed, 13 Aug 2025 07:30:45 +0000 (09:30 +0200)] 
Move SIEVE-LRU to dns_slabtop_t structure

As the qpcache has only one active header at the time, we can move the
SIEVE-LRU members from dns_slabheader_t to dns_slabtop_t structure thus
saving a little bit of memory in each slabheader and using it only once
per type.

8 months agoSplit the top level slab header hierarchy and the headers
Ondřej Surý [Tue, 5 Aug 2025 16:05:52 +0000 (18:05 +0200)] 
Split the top level slab header hierarchy and the headers

The code that combines the top-level hierarchy (per-typepair) and
individual slab headers (per-version) saves a little bit of memory, but
makes the code convoluted, hard to read and hard to modify.  Change the
top level hierarchy to be of different type with individual slabheaders
"hanging" from the per-typepair dns_slabtop_t structure.

This change makes the future enhancements (changing the top level data
structure for faster lookups; coupling type + sig(type) into single
slabtop) much easier.

8 months agoPass 'mctx' instead of 'db' to dns_slabheader_new()
Ondřej Surý [Tue, 5 Aug 2025 16:05:52 +0000 (18:05 +0200)] 
Pass 'mctx' instead of 'db' to dns_slabheader_new()

The slabheader doesn't directly attach or link to 'db' anymore.  Pass
only the memory context needed to create the slab header to make the
lack of relation ship more prominent.

Also don't call dns_slabheader_reset() from dns_slabheader_new(), it has
no added value.

8 months agochg: dev: Don't count failed additions into the cache
Ondřej Surý [Mon, 18 Aug 2025 02:55:43 +0000 (04:55 +0200)] 
chg: dev: Don't count failed additions into the cache

Previously, when the new header was NOT added into the cache, we would
increment and then decrement stat counters immediately.  This has been fixed.

Merge branch 'ondrej/dont-stat-count-failed-adds' into 'main'

See merge request isc-projects/bind9!10859

8 months agoDon't count failed additions into the cache
Ondřej Surý [Wed, 13 Aug 2025 06:45:45 +0000 (08:45 +0200)] 
Don't count failed additions into the cache

Previously, when the new header was NOT added into the cache, we would
increment and then decrement stat counters immediately.

Delay incrementing the stat counters until after the newheader has
been actually added into the database.

A little cleanup to accomodate the fact that qpdb->rrsetstats is always
available was also done here.

8 months agoAlways return DNS_R_UNCHANGED when new slabheader was not added
Ondřej Surý [Wed, 13 Aug 2025 06:45:45 +0000 (08:45 +0200)] 
Always return DNS_R_UNCHANGED when new slabheader was not added

Change the add() function in the dns_qpcache to properly return
DNS_R_UNCHANGED if the newheader was not actually consumed, and move
the dns_slabheader_destroy() call outside of the add() function.

8 months agochg: dev: Remove locking from rdataslab_getownercase()
Ondřej Surý [Fri, 15 Aug 2025 05:36:13 +0000 (07:36 +0200)] 
chg: dev: Remove locking from rdataslab_getownercase()

Under normal circumstances, the case bitfield in the slabheader should
be set only once.  By actually (soft-)enforcing this, the read locking
can be completely removed from the rdataslab_getownercase() as we can
check whether the case has been already set or not and making everything
immutable once the case has been set.

Merge branch 'ondrej/remove-locking-from-slabheader-ownercase' into 'main'

See merge request isc-projects/bind9!10843

8 months agoRemove locking from rdataslab_getownercase()
Ondřej Surý [Tue, 12 Aug 2025 10:10:24 +0000 (12:10 +0200)] 
Remove locking from rdataslab_getownercase()

Under normal circumstances, the case bitfield in the slabheader should
be set only once.  By actually (soft-)enforcing this, the read locking
can be completely removed from the rdataslab_getownercase() as we can
check whether the case has been already set or not and making everything
immutable once the case has been set.

8 months agoMove the slabheader attribute helpers to private header
Ondřej Surý [Tue, 12 Aug 2025 10:21:56 +0000 (12:21 +0200)] 
Move the slabheader attribute helpers to private header

The slabheader.c, qpzone.c and qpcache.c had couple of shared macros
that were copied and paste between the units.  Move these common
attributes access macros into private header, so these can be shared
among the three compilation units.

8 months agoUnify the NONEXISTENT() macro in qpzone to EXISTS()
Ondřej Surý [Tue, 12 Aug 2025 09:31:57 +0000 (11:31 +0200)] 
Unify the NONEXISTENT() macro in qpzone to EXISTS()

In the dns_qpcache unit, we use EXISTS() macro, but in the dns_qpzone
there's a NONEXISTENT() macro for the same slabheader attribute.  Unify
the macro to be also EXISTS() in dns_qpzone.

8 months agochg: dev: The nodefullname doesn't need a read lock to access .name
Ondřej Surý [Fri, 15 Aug 2025 05:34:11 +0000 (07:34 +0200)] 
chg: dev: The nodefullname doesn't need a read lock to access .name

The qpznode->name is constant - assigned when the node is created
and it is immutable, so there's no reason to have it locked at all.

Merge branch 'ondrej/nodefullname-no-read-lock' into 'main'

See merge request isc-projects/bind9!10686

8 months agoThe nodefullname doesn't need a read lock to access .name
Ondřej Surý [Wed, 2 Jul 2025 16:19:50 +0000 (18:19 +0200)] 
The nodefullname doesn't need a read lock to access .name

The qpznode->name is constant - assigned when the node is created
and it is immutable, so there's no reason to have it locked at all.

8 months agochg: dev: Remove the negative type logic from qpcache
Ondřej Surý [Fri, 15 Aug 2025 05:27:50 +0000 (07:27 +0200)] 
chg: dev: Remove the negative type logic from qpcache

Remove the extra representation of the negative type in the slabheaders
and simply use the negative attribute on the slabheader.

Merge branch 'ondrej/remove-negtype-from-qpcache' into 'main'

See merge request isc-projects/bind9!10840

8 months agoRename DNS_SIGTYPE() to DNS_SIGTYPEPAIR()
Ondřej Surý [Tue, 12 Aug 2025 05:47:03 +0000 (07:47 +0200)] 
Rename DNS_SIGTYPE() to DNS_SIGTYPEPAIR()

The DNS_SIGTYPE() macro "returns" dns_typepair_t, rename it to make this
fact more obvious and also to match DNS_TYPEPAIR() macro naming.

8 months agoRemove the negative type logic from qpcache
Ondřej Surý [Mon, 11 Aug 2025 07:39:13 +0000 (09:39 +0200)] 
Remove the negative type logic from qpcache

Previously, when a negative header was stored in the cache, it would be
stored in the dns_typepair_t as .type = 0, .covers = <negative type>.
When searching the cache internally, we would have to look for both
positive and negative typepair and the slabheader .down list could be a
mix of positive and negative types.

Remove the extra representation of the negative type and simply use the
negative attribute on the slabheader.  Other units (namely dns_ncache)
can still insert the (0, type) negative rdatasets into the cache, but
internally, those will be converted into (type, 0) slabheaders, and vice
versa - when binding the rdatasets, the negative (type, 0) slabheader
will be converted to (0, type) rdataset.  Simple DNS_TYPEPAIR() helper
macro was added to simplify converting single rdatatype to typepair
value.

As a side-effect, the search logic in all places can exit early if
there's a negative header for the type we are looking for, f.e. when
searching for the zone cut, we don't have to walk through all the
slabheaders, if there's a stored negative slabheader.

8 months agoAdd dns_rdatatype_isnsec() helper function
Ondřej Surý [Mon, 11 Aug 2025 08:06:33 +0000 (10:06 +0200)] 
Add dns_rdatatype_isnsec() helper function

Replace the checks for both NSEC and NSEC3 with a single helper
function.

8 months agoUse dns_rdatatype_none more consistently
Ondřej Surý [Mon, 11 Aug 2025 05:17:43 +0000 (07:17 +0200)] 
Use dns_rdatatype_none more consistently

Use dns_rdatatype_none instead of plain '0' for dns_rdatatype_t and
dns_typepair_t manipulation.  While plain '0' is technically ok, it
doesn't carry the required semantic meaning, and using the named
dns_rdatatype_none constant makes the code more readable.

8 months agoAdd strict checks on typepair values in the developer's mode
Ondřej Surý [Thu, 7 Aug 2025 06:12:36 +0000 (08:12 +0200)] 
Add strict checks on typepair values in the developer's mode

When in developer's mode, make the DNS_TYPEPAIR_* macros be more
strict on the contents of the 'base' and 'covers', so we can catch
invalid use of the API.

8 months agoDisallow TYPE0 to be queried or inserted into the database
Ondřej Surý [Thu, 7 Aug 2025 06:08:24 +0000 (08:08 +0200)] 
Disallow TYPE0 to be queried or inserted into the database

The RR type 0 is a reserved type for SIG[1] resource record.  It should
not be ever inserted into the database nor queried.  Add a special
handling to bail out quickly with DNS_R_DISALLOWED when inserting and
ISC_R_NOTFOUND when looking up TYPE0.  This is also prerequisite for
stricter checks in the follow-up commit.

1. https://www.rfc-editor.org/rfc/rfc2535#section-4.1.8.1

8 months agoFix typo in nsupdate where covers would be equal to type
Ondřej Surý [Mon, 11 Aug 2025 14:22:03 +0000 (16:22 +0200)] 
Fix typo in nsupdate where covers would be equal to type

There was an apparent typo where rdatalist->covers would be assigned the
same value as rdatalist->type.  As nsupdate can't update signatures, the
covers must be dns_rdatatype_none.

8 months agoUnify the dns_typepair_t variable naming and usage
Ondřej Surý [Wed, 6 Aug 2025 17:34:35 +0000 (19:34 +0200)] 
Unify the dns_typepair_t variable naming and usage

The dns_typepair_t and dns_rdatatype_t variables were both named 'type'
in multiple places.  Rename all dns_typepair_t variables to include word
'pair' in the variable name to make sure that the distinction between
the two types is more clear.

8 months agofix: dev: Simplify the DNS_R_UNCHANGED handling in dns_resolver unit
Ondřej Surý [Fri, 15 Aug 2025 05:06:11 +0000 (07:06 +0200)] 
fix: dev: Simplify the DNS_R_UNCHANGED handling in dns_resolver unit

Instead of catching the DNS_R_UNCHANGED from dns_db_addrdataset() (via
cache_rrset() and dns_ncache_add()) individually, mask it properly as
soon as possible by moving the sigrdataset caching logic inside the
cache_rrset() and returning ISC_R_SUCCESS from cache_rrset() and
dns_ncache_add() when the database was unchanged.

Closes #5473

Merge branch '5473-fix-crash-in-validated' into 'main'

See merge request isc-projects/bind9!10850

8 months agoSimplify the DNS_R_UNCHANGED handling in dns_resolver unit
Ondřej Surý [Thu, 14 Aug 2025 06:35:05 +0000 (08:35 +0200)] 
Simplify the DNS_R_UNCHANGED handling in dns_resolver unit

Instead of catching the DNS_R_UNCHANGED from dns_db_addrdataset() (via
cache_rrset() and dns_ncache_add()) individually, mask it properly as
soon as possible, by moving the sigrdataset caching logic inside
cache_rrset() and returning ISC_R_SUCCESS from cache_rrset() and
dns_ncache_add() when the database was unchanged.

8 months agofix: dev: result could be set incorrectly in validated()
Ondřej Surý [Fri, 15 Aug 2025 04:25:23 +0000 (06:25 +0200)] 
fix: dev: result could be set incorrectly in validated()

During a recent refactoring of `validated()`, a line was
removed, causing `result` to be left unchanged. This
caused time to be wasted continuing to try to validate when a
non-recoverable error had occurred, and also caused the wrong
reason to be logged in `add_bad()`.

Closes #5468

Merge branch '5468-fix-deadcode' into 'main'

See merge request isc-projects/bind9!10851

8 months agoAlways delete the cached results on broken chain
Ondřej Surý [Thu, 14 Aug 2025 06:41:05 +0000 (08:41 +0200)] 
Always delete the cached results on broken chain

The logic to delete records from the cache was relying on the contents
of the validation answer.  Change the logic to always delete the
contents of the cache on the broken chain result.

8 months agoresult could be set incorrectly in validated()
Evan Hunt [Thu, 14 Aug 2025 06:11:29 +0000 (23:11 -0700)] 
result could be set incorrectly in validated()

during a recent refactoring of validated(), a line was
removed, causing 'result' to be left unchanged. this
wasted time continuing to try to validate when a
non-recoverable error had occured, and caused the wrong
reason to be logged in add_bad().

9 months agofix: dev: Use DNS_RDATACOMMON_INIT to hide branch differences
Mark Andrews [Thu, 14 Aug 2025 22:07:33 +0000 (08:07 +1000)] 
fix: dev: Use DNS_RDATACOMMON_INIT to hide branch differences

Initialization of the common members of rdata type structures varies
across branches.  Standardize it by using the `DNS_RDATACOMMON_INIT`
macro for all types, so that new types are more likely to use it,
and hence backport more cleanly.

Closes #5467

Merge branch '5467-use-dns_rdatacommon_init-to-hide-branch-differences' into 'main'

See merge request isc-projects/bind9!10831

9 months agoUse DNS_RDATACOMMON_INIT to hide branch differences
Mark Andrews [Wed, 6 Aug 2025 05:28:39 +0000 (15:28 +1000)] 
Use DNS_RDATACOMMON_INIT to hide branch differences

Initialization of the common members of rdata type structures varies
across branches.  Standardize it by using the DNS_RDATACOMMON_INIT
macro for all types, so that new types are more likely to use it,
and hence backport more cleanly.

9 months agofix: ci: Update DNS Shotgun parameters for an updated dataset
Nicki Křížek [Thu, 14 Aug 2025 18:57:03 +0000 (20:57 +0200)] 
fix: ci: Update DNS Shotgun parameters for an updated dataset

We've switched to an updated dataset for shotgun jobs. The change in
underlying traffic caused the more sensitive doh-get (and partially dot)
jobs to overload the resolver, making the jobs unstable and unreliable,
due to an increased number of timeouts.

Readjust the load parameters slightly to avoid exceeding ~2 % of
timeouts in the cold cache scenario to stabilize the job results.

Merge branch 'nicki/ci-shotgun-load-new-dataset' into 'main'

See merge request isc-projects/bind9!10841

9 months agoUpdate DNS Shotgun parameters for an updated dataset
Nicki Křížek [Mon, 11 Aug 2025 13:04:50 +0000 (15:04 +0200)] 
Update DNS Shotgun parameters for an updated dataset

We've switched to an updated dataset for shotgun jobs. The change in
underlying traffic caused the more sensitive doh-get (and partially dot)
jobs to overload the resolver, making the jobs unstable and unreliable,
due to an increased number of timeouts.

Readjust the load parameters slightly to avoid exceeding ~2 % of
timeouts in the cold cache scenario to stabilize the job results.

9 months agochg: doc: Set up version for BIND 9.21.12
Andoni Duarte [Thu, 14 Aug 2025 11:14:59 +0000 (11:14 +0000)] 
chg: doc: Set up version for BIND 9.21.12

Merge branch 'andoni/set-up-version-for-bind-9.21.12' into 'main'

See merge request isc-projects/bind9!10854

9 months agoUpdate BIND version to 9.21.12-dev
Andoni Duarte Pintado [Thu, 14 Aug 2025 10:28:14 +0000 (12:28 +0200)] 
Update BIND version to 9.21.12-dev

9 months agochg: dev: Split dbmethods into node and db vtable
Alessio Podda [Thu, 14 Aug 2025 10:10:21 +0000 (10:10 +0000)] 
chg: dev: Split dbmethods into node and db vtable

All databases in the codebase follow the same structure: a database is
an associative container from DNS names to nodes, and each node is an
associative container from RR types to RR data.

Each database implementation (qpzone, qpcache, sdlz, builtin, dyndb) has
its own corresponding node type (qpznode, qpcnode, etc). However, some
code needs to work with nodes generically regardless of their specific
type - for example, to acquire locks, manage references, or
register/unregister slabs from the heap.

Before this MR, these generic node operations were implemented as methods in
a `dns_dbmethods_t` vtable. This created a coupling between the database
and node lifetimes. If a node were to outlive its parent database, the node
destructor would destroy all RR data, and each RR data destructor would
try to unregister from heaps by calling a virtual function from the
database vtable. Since the database was already freed, this would cause a
crash.

This MR breaks the coupling by standardizing the layout of all
database nodes, adding a `dns_dbnode_methods_t` vtable for node
operations, and moving node-specific methods from the database vtable to
the node vtable.

Merge branch 'alessio/dbnode-vtable' into 'main'

See merge request isc-projects/bind9!10728

9 months agoUpdate BIND version for release v9.21.11
Andoni Duarte Pintado [Wed, 13 Aug 2025 17:10:38 +0000 (19:10 +0200)] 
Update BIND version for release

9 months agonew: doc: Prepare documentation for BIND 9.21.11
Andoni Duarte [Wed, 13 Aug 2025 16:33:22 +0000 (16:33 +0000)] 
new: doc: Prepare documentation for BIND 9.21.11

Merge branch 'andoni/prepare-documentation-for-bind-9.21.11' into 'v9.21.11-release'

See merge request isc-private/bind9!824

9 months agoTweak and reword release notes
Andoni Duarte Pintado [Tue, 12 Aug 2025 08:40:46 +0000 (10:40 +0200)] 
Tweak and reword release notes

9 months agoPrepare release notes for BIND 9.21.11
Andoni Duarte Pintado [Tue, 12 Aug 2025 08:38:00 +0000 (10:38 +0200)] 
Prepare release notes for BIND 9.21.11

9 months agoGenerate changelog for BIND 9.21.11
Andoni Duarte Pintado [Tue, 12 Aug 2025 08:34:32 +0000 (10:34 +0200)] 
Generate changelog for BIND 9.21.11

9 months agoRemove unused dns_slabheader_reset argument
Alessio Podda [Tue, 15 Jul 2025 10:16:39 +0000 (12:16 +0200)] 
Remove unused dns_slabheader_reset argument

As a part of the previous refactor, the db argument of
dns_slabheader_reset is now unused, and can be removed.

9 months agoDecouple database and node lifetimes by adding node-specific vtables
Alessio Podda [Thu, 5 Jun 2025 09:51:29 +0000 (11:51 +0200)] 
Decouple database and node lifetimes by adding node-specific vtables

All databases in the codebase follow the same structure: a database is
an associative container from DNS names to nodes, and each node is an
associative container from RR types to RR data.

Each database implementation (qpzone, qpcache, sdlz, builtin, dyndb) has
its own corresponding node type (qpznode, qpcnode, etc). However, some
code needs to work with nodes generically regardless of their specific
type - for example, to acquire locks, manage references, or
register/unregister slabs from the heap.

Currently, these generic node operations are implemented as methods in
the database vtable, which creates problematic coupling between database
and node lifetimes. If a node outlives its parent database, the node
destructor will destroy all RR data, and each RR data destructor will
try to unregister from heaps by calling a virtual function from the
database vtable. Since the database was already freed, this causes a
crash.

This commit breaks the coupling by standardizing the layout of all
database nodes, adding a dedicated vtable for node operations, and
moving node-specific methods from the database vtable to the node
vtable.

9 months agoRefactor sdlz to use name instead of pointer to name
Alessio Podda [Wed, 16 Jul 2025 11:11:21 +0000 (13:11 +0200)] 
Refactor sdlz to use name instead of pointer to name

Right now dns_sdlzlookup has a slight difference from other dbnode
implementations in that it stores a pointer to a dns name instead of
the dns name itself.

This commit harmonizes dns_sdlzlookup with other dbnode
implementations, facilitating further refactoring.

9 months agofix: ci: backtraces are not generated for core files from failed unit tests
Andoni Duarte [Wed, 6 Aug 2025 12:11:02 +0000 (12:11 +0000)] 
fix: ci: backtraces are not generated for core files from failed unit tests

Closes #5466

Merge branch '5466-fix-ci-backtraces-are-not-generated-for-core-files' into 'main'

See merge request isc-projects/bind9!10824

9 months agoAdd a different log file for each `meson test`
Andoni Duarte Pintado [Tue, 5 Aug 2025 09:26:47 +0000 (11:26 +0200)] 
Add a different log file for each `meson test`

Each run of `meson test` overwrites the default log file testlog.txt,
this means we lose the backtraces of previous run. This commit assigns
a different log file for each run.

9 months agofix: ci: Allow unit tests to fail on AlmaLinux 8
Nicki Křížek [Wed, 6 Aug 2025 10:38:32 +0000 (12:38 +0200)] 
fix: ci: Allow unit tests to fail on AlmaLinux 8

The doh unit test has been timing out recently and we don't have a fix
for it yet. Mark it as warning rather than a hard failure, since it's a
known issue.

Related #5448

Merge branch '5448-allow-failure-unit-almalinux8-doh' into 'main'

See merge request isc-projects/bind9!10835

9 months agoAllow unit tests to fail on AlmaLinux 8
Nicki Křížek [Tue, 5 Aug 2025 15:28:52 +0000 (17:28 +0200)] 
Allow unit tests to fail on AlmaLinux 8

The doh unit test has been timing out recently and we don't have a fix
for it yet. Mark it as warning rather than a hard failure, since it's a
known issue.

Related #5448

9 months agonew: test: Update filter-aaaa test
Evan Hunt [Wed, 6 Aug 2025 06:42:01 +0000 (06:42 +0000)] 
new: test: Update filter-aaaa test

Renamed the `filter-aaaa` system test to `filters`, converted it to python, and added test cases to exercise the `filter-a` plugin as well.

Merge branch 'each-test-filter-a' into 'main'

See merge request isc-projects/bind9!10730

9 months agoUse full path for shared test code imports in rollover tests
Nicki Křížek [Mon, 4 Aug 2025 14:30:41 +0000 (16:30 +0200)] 
Use full path for shared test code imports in rollover tests

Previously, symlinks and relative directory imports were used in test
modules. This caused a name clash when a shared code module "common.py"
was introduced for a different test. To avoid the issue, use full paths
in imports.

9 months agoSplit up and parametrize filters tests
Nicki Křížek [Thu, 31 Jul 2025 17:00:27 +0000 (19:00 +0200)] 
Split up and parametrize filters tests

Move tests which use different configuration to dedicated modules to
avoid possible interference with other tests.

Parametrize the test cases to have a dedicated test for each server
configuration.

Turn the check_filter() comments into log messages to help with
debugging.