Commit graph

43793 commits

Author SHA1 Message Date
Ondřej Surý
a274cf6ce6
Workaround the compile failure on macOS
The following check:

    __builtin_types_compatible_p(size_t, uint64_t)

doesn't work with default compiler on macOS.  Workaround the issue
by typing the size_t to matching unsigned int type.
2025-08-26 06:53:27 +02:00
Aydın Mercan
160bc1a198 fix: dev: switch bit rotation functions to statement expressions
Using `static inline` functions in the headers break gcov as it cannot
properly track the hits. To fix the issue, convert the expressions to
statement macros. The added static assertions will ensure integer
promotion cannot occur unlike its previous function counterpart.

Merge branch 'aydin/rotate-as-macro' into 'main'

See merge request isc-projects/bind9!10878
2025-08-25 15:08:44 +03:00
Aydın Mercan
7b7c853c07
switch bit rotation functions to statement expressions
Using `static inline` functions in the headers break gcov as it cannot
properly track the hits. To fix the issue, convert the expressions to
statement macros. The added static assertions will ensure integer
promotion cannot occur unlike its previous function counterpart.
2025-08-25 13:02:03 +03:00
Arаm Sаrgsyаn
ec1e919389 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
2025-08-22 18:37:20 +00:00
Aram Sargsyan
924230f05a 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.
2025-08-22 17:17:28 +00:00
Aram Sargsyan
5e718dd220 Implement '-T slowrpz' named testing option
When used, named processes RPZ zones slowly. Useful for system tests.
2025-08-22 16:31:17 +00:00
Aram Sargsyan
41387b8d30 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.
2025-08-22 16:31:17 +00:00
Aram Sargsyan
88ed81e12d 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.
2025-08-22 16:31:17 +00:00
Matthijs Mekking
888b5f55a8 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
2025-08-21 15:18:15 +00:00
Matthijs Mekking
e4529b6308 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.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
1df76e2c24 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.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
0aa5dee474 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.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
6904e43510 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.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
e35e103d7f 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.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
73ecc7223e 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.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
6b5c69d431 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.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
c000cf70cb 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.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
927c249711 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.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
02460a009f 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.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
a0dc0434e5 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.
2025-08-21 16:09:49 +02:00
Matthijs Mekking
aa49850b5e 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.
2025-08-21 16:08:16 +02:00
Matthijs Mekking
63c5b453e0 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.
2025-08-21 16:00:19 +02:00
Mark Andrews
b7eb292121 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
2025-08-21 09:54:29 +10:00
Mark Andrews
1c3b9698bc Fix ISC_LEADING_ZEROS and ISC_TRAILING_ZEROS macros 2025-08-21 09:12:14 +10:00
Andoni Duarte Pintado
5d219d2612 Merge tag 'v9.21.11' 2025-08-20 18:09:46 +02:00
Matthijs Mekking
b24834c604 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
2025-08-19 14:07:21 +00:00
Matthijs Mekking
dfdac550d8 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.
2025-08-19 14:07:12 +00:00
Matthijs Mekking
6499814835 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
906dd57b68 as part of MR !8085.
2025-08-19 14:07:12 +00:00
Matthijs Mekking
89e90c30f8 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.
2025-08-19 14:07:12 +00:00
Matthijs Mekking
1a8cbf11fe 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.
2025-08-19 14:07:12 +00:00
Aydın Mercan
e6478836e7 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
2025-08-19 16:41:47 +03:00
Ondřej Surý
234d0e9e8d
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.
2025-08-19 16:02:32 +03:00
Aydın Mercan
6ae002f1ae
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
2025-08-19 16:02:32 +03:00
Aydın Mercan
e8c3bcc0a2
Remove unused datadir variable 2025-08-19 16:02:32 +03:00
Aydın Mercan
0a56c71865
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
2025-08-19 16:02:32 +03:00
Alessio Podda
3a84604e23 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
2025-08-19 13:00:47 +00:00
Alessio Podda
954b527383 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.
2025-08-19 14:18:44 +02:00
Alessio Podda
3271f5fda4 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.
2025-08-19 14:18:19 +02:00
Aydın Mercan
87dfd96743 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
2025-08-19 14:03:12 +03:00
Aydın Mercan
7d5928c3a2
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.
2025-08-19 11:52:12 +03:00
Ondřej Surý
0da10d8bbe 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
2025-08-19 08:00:20 +02:00
Ondřej Surý
255f484f49
Ignore clang-format reformatting commits 2025-08-19 07:59:52 +02:00
Ondřej Surý
42496f3f4a
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.
2025-08-19 07:58:33 +02:00
Ondřej Surý
d051e1e8f8
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.
2025-08-19 07:58:33 +02:00
Evan Hunt
018ff7b294 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
2025-08-18 21:08:22 +00:00
Ondřej Surý
7f9647d16e
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().
2025-08-18 17:11:03 +02:00
Colin Vidal
6d8c0b2a8d 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
2025-08-18 14:28:47 +02:00
Colin Vidal
fd8624354b 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.
2025-08-18 13:26:50 +02:00
Ondřej Surý
68153104fa 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
2025-08-18 13:16:14 +02:00
Ondřej Surý
80dac1bbae
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.
2025-08-18 12:36:47 +02:00