]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
8 months agoLazily allocate fetch counter
Alessio Podda [Sat, 30 Aug 2025 07:21:20 +0000 (09:21 +0200)] 
Lazily allocate fetch counter

The counter in ns_client_t is used to track the maximum number of
recursions in the resolver, but it is created unconditionally when
starting the client and deallocated when resetting it.

This commit defers the allocation of the counter till recursion needs to
actually happen, speeding up authoritative workloads in perflab by
1.5~2%.

8 months agonew: test: Test another 'stale-answer-client-timeout 0' scenario
Andoni Duarte [Tue, 2 Sep 2025 08:50:18 +0000 (08:50 +0000)] 
new: test: Test another 'stale-answer-client-timeout 0' scenario

Add a test to check serve-stale with the 'stale-answer-client-timeout 0'
configuration option and with a delegation which is a CNAME to a auth
zone.

Closes #5372

Merge branch '5372-serve-stale-crash-on-insist-unreachable-test' into 'main'

See merge request isc-projects/bind9!10920

8 months agoTest another 'stale-answer-client-timeout 0' scenario
Aram Sargsyan [Wed, 18 Jun 2025 13:29:53 +0000 (13:29 +0000)] 
Test another 'stale-answer-client-timeout 0' scenario

Add a test to check serve-stale with the 'stale-answer-client-timeout 0'
configuration option and with a delegation which is a CNAME to a auth
zone.

8 months agorem: usr: Obsolete the "tkey-domain" statement
Michał Kępień [Mon, 1 Sep 2025 20:29:23 +0000 (22:29 +0200)] 
rem: usr: Obsolete the "tkey-domain" statement

Mark the ``tkey-domain`` statement as obsolete, since it has not had any
effect on server behavior since support for TKEY Mode 2 (Diffie-Hellman)
was removed (in BIND 9.20.0).

See #4204

Merge branch '4204-obsolete-tkey-domain' into 'main'

See merge request isc-projects/bind9!10798

8 months agoObsolete the "tkey-domain" statement
Michał Kępień [Mon, 1 Sep 2025 19:35:33 +0000 (21:35 +0200)] 
Obsolete the "tkey-domain" statement

The "tkey-domain" statement has effectively been a no-op since commit
bd4576b3cef88bcb78ae0dd7619019be4fdfb2ea, which removed the only bit of
code using it: the logic implementing TKEY Mode 2 (Diffie-Hellman).

A subsequent cleanup commit, 885c132f4ae6d895ee973648e15d9e61d01555a8,
also missed the opportunity to remove the "tkey-domain" statement
altogether.

Mark the "tkey-domain" statement as obsolete and remove all code and
documentation related to it.

8 months agorem: usr: Deprecate the "tkey-gssapi-credential" statement
Michał Kępień [Mon, 1 Sep 2025 19:33:33 +0000 (21:33 +0200)] 
rem: usr: Deprecate the "tkey-gssapi-credential" statement

The :any:`tkey-gssapi-keytab` statement allows GSS-TSIG to be set up in
a simpler and more reliable way than using the
:any:`tkey-gssapi-credential` statement and setting environment
variables (e.g. ``KRB5_KTNAME``). Therefore, the
:any:`tkey-gssapi-credential` statement has been deprecated;
:any:`tkey-gssapi-keytab` should be used instead.

For configurations currently using a combination of both
:any:`tkey-gssapi-keytab` *and* :any:`tkey-gssapi-credential`, the
latter should be dropped and the keytab pointed to by
:any:`tkey-gssapi-keytab` should now only contain the credential
previously specified by :any:`tkey-gssapi-credential`.

See #4204

Merge branch '4204-deprecate-tkey-gssapi-credential' into 'main'

See merge request isc-projects/bind9!10782

8 months agoDeprecate the "tkey-gssapi-credential" statement
Michał Kępień [Mon, 1 Sep 2025 19:23:30 +0000 (21:23 +0200)] 
Deprecate the "tkey-gssapi-credential" statement

The "tkey-gssapi-keytab" statement enables GSS-TSIG to be set up in a
simpler and more reliable way than using the "tkey-gssapi-credential"
statement and setting environment variables (e.g. KRB5_KTNAME).

Mark the "tkey-gssapi-credential" statement as deprecated to eventually
only have one method for setting up GSS-TSIG in named.  Do not mention
"tkey-gssapi-credential" in the section of the ARM on dynamic updates.

8 months agonew: ci: Add Debian "trixie"
Michal Nowak [Mon, 1 Sep 2025 15:05:34 +0000 (17:05 +0200)] 
new: ci: Add Debian "trixie"

Merge branch 'mnowak/add-debian-trixie' into 'main'

See merge request isc-projects/bind9!10827

8 months agoDrop unused env variable SCANBUILD
Michal Nowak [Mon, 18 Aug 2025 14:56:48 +0000 (16:56 +0200)] 
Drop unused env variable SCANBUILD

8 months agoscan-build does not need to wait for previous stages
Michal Nowak [Wed, 6 Aug 2025 15:49:34 +0000 (17:49 +0200)] 
scan-build does not need to wait for previous stages

8 months agoMake "trixie" the base image
Michal Nowak [Tue, 5 Aug 2025 16:23:10 +0000 (18:23 +0200)] 
Make "trixie" the base image

8 months agoMove CI and QA tools from Debian "sid" to "trixie"
Michal Nowak [Tue, 5 Aug 2025 16:19:34 +0000 (18:19 +0200)] 
Move CI and QA tools from Debian "sid" to "trixie"

Debian "sid" is not a stable test bed and should be avoided.

8 months agoAdd Debian "trixie"
Michal Nowak [Tue, 5 Aug 2025 16:16:15 +0000 (18:16 +0200)] 
Add Debian "trixie"

8 months agochg: nil: Refactoring in the qpcache and qpzone
Ondřej Surý [Thu, 28 Aug 2025 18:11:14 +0000 (20:11 +0200)] 
chg: nil: Refactoring in the qpcache and qpzone

- Remove double non-NULL guard around bindrdataset()
- Add DNS_SLABTOP_FOREACH macros
- Made add() function in qpcache a single pass

Merge branch 'ondrej/add-DNS_SLABTOP_FOREACH' into 'main'

See merge request isc-projects/bind9!10879

8 months agoAlways scan all the slab headers when adding new entry
Ondřej Surý [Wed, 27 Aug 2025 12:05:30 +0000 (14:05 +0200)] 
Always scan all the slab headers when adding new entry

The existing logic would always scan the headers if:
- adding negative cache entry that's NXDOMAIN or negative RRSIG
- adding positive cache entry
- the type doesn't exist in the node

As the rest is relatively minor - we only delete rrset from resolver
on broken chain and most negative entries don't exist in the case
anyway, it feels like the extra logic to decide whether we should do
full scan or not is just complicating things.

Remove the extra logic and always scan all the slabtop/slabheaders in
the node when adding new entry into the cache.

8 months agoAdd few missing qpcache_hit() calls
Ondřej Surý [Wed, 27 Aug 2025 11:52:42 +0000 (13:52 +0200)] 
Add few missing qpcache_hit() calls

There were couple of missing qpcache_hit() calls in qpcache.c:add()
function where existing data was better than the newly added header.

8 months agoRefactoring in qpcache.c:add()
Ondřej Surý [Wed, 27 Aug 2025 04:58:39 +0000 (06:58 +0200)] 
Refactoring in qpcache.c:add()

There were several consequtive foreach loops when adding new entry into
the cache.  Merge the multiple foreach loops into a single pass loop
with some effort and a lot of comments.

8 months agoAdd DNS_SLABTOP_FOREACH macros
Ondřej Surý [Thu, 21 Aug 2025 06:56:29 +0000 (08:56 +0200)] 
Add DNS_SLABTOP_FOREACH macros

Add foreach macros to iterate through the dns_slabtop_t
single-linked lists.

8 months agoRemove double non-NULL guard around bindrdataset()
Ondřej Surý [Thu, 21 Aug 2025 06:56:29 +0000 (08:56 +0200)] 
Remove double non-NULL guard around bindrdataset()

The bindrdataset() already has a logic to skip the rest of the function
if the passed rdataset is NULL.  Remove the external guarding for
'addedrdataset' to simplify the code flow both from the zone and cache
databases.

8 months agochg: dev: move handle to keystores from the view to zonemgr
Colin Vidal [Thu, 28 Aug 2025 15:30:57 +0000 (17:30 +0200)] 
chg: dev: move handle to keystores from the view to zonemgr

This is a follow-up of !10895 where the keystore pointer was removed
from the zone (as not specific to the zone) and moved to the view. But
in order to avoid adding extra lifecycle dependencies from the zone to
the view, the keystore pointer is now moved to the zonemgr, which also
makes more sense as this is a global settings, and zonemgr wraps a bunch
of other global settings to be accessibles from the zones.

Because the zonemgr lifecycle is the same of the keystores (which are
both depending on named_g_server) this should be a safe change.

Merge branch 'colin/keystores-zonemgr' into 'main'

See merge request isc-projects/bind9!10901

8 months agomove handle to keystores from the view to zonemgr
Colin Vidal [Wed, 27 Aug 2025 12:52:07 +0000 (14:52 +0200)] 
move handle to keystores from the view to zonemgr

This is a follow-up of !10895 where the keystore pointer was removed
from the zone (as not specific to the zone) and moved to the view. But
in order to avoid adding extra lifecycle dependencies from the zone to
the view, the keystore pointer is now moved to the zonemgr, which also
makes more sense as this is a global settings, and zonemgr wraps a bunch
of other global settings to be accessibles from the zones.

Because the zonemgr lifecycle is the same of the keystores (which are
both depending on named_g_server) this should be a safe change.

8 months agofix: dev: Add and use __attribute__((nonnull)) in dnssec-signzone.c
Ondřej Surý [Thu, 28 Aug 2025 14:24:08 +0000 (16:24 +0200)] 
fix: dev: Add and use __attribute__((nonnull)) in dnssec-signzone.c

Clang 20 was spuriously warning about the possibility of passing a NULL file pointer
to `fprintf()`, which uses the 'nonnull' attribute. To silence the warning, the functions
calling `fprintf()` have been marked with the same attribute to assure that NULL can't be
passed to them in the first place.

Close #5487

Merge branch '5487-mark-passed-file-pointer-as-nonnull-in-dnssec-signzone' into 'main'

See merge request isc-projects/bind9!10888

8 months agoAdd and use __attribute__((nonnull)) in dnssec-signzone.c
Ondřej Surý [Thu, 21 Aug 2025 21:51:38 +0000 (23:51 +0200)] 
Add and use __attribute__((nonnull)) in dnssec-signzone.c

Clang 20 is complaining about passing NULL to an argument with 'nonnull'
attribute.  Mark these two functions with the same attribute to assure
that these two function also don't accept NULL as an argument.

8 months agofix: dev: Ensure file descriptors 0-2 are in use
Ondřej Surý [Thu, 28 Aug 2025 08:56:29 +0000 (10:56 +0200)] 
fix: dev: Ensure file descriptors 0-2 are in use

libuv expect file descriptors <= STDERR_FILENO are in use. otherwise,
it may abort when closing a file descriptor it opened.

Closes #5226

Merge branch 'main' into 'main'

See merge request isc-projects/bind9!10582

8 months agoTest command line tools without stdio fds
Petr Špaček [Tue, 1 Jul 2025 09:12:15 +0000 (11:12 +0200)] 
Test command line tools without stdio fds

Testing all combinations seems unnecessary but is cheap.
I was too lazy to run this against all tools we have. nsupdate was
chosen because it is one of few tools which actually use stdin and the
original issue was reproducible even without any network communication,
which was not the case for simple dig invocation.

Sorry for new shell test but doing this in Python seemed very
complicated and fragile.

8 months agoensure file descriptors 0-2 are in use before using libuv
Thomas Abraham [Mon, 30 Jun 2025 18:03:56 +0000 (14:03 -0400)] 
ensure file descriptors 0-2 are in use before using libuv

libuv expects file descriptors <= STDERR_FILENO are in use. otherwise,
it may abort when closing a file descriptor it opened.

See https://github.com/libuv/libuv/pull/4559

Closes #5226

8 months agofix: usr: Fix a catalog zone issue when having an unset 'default-primaries' configura...
Arаm Sаrgsyаn [Wed, 27 Aug 2025 16:16:05 +0000 (16:16 +0000)] 
fix: usr: Fix a catalog zone issue when having an unset 'default-primaries' configuration clause

A catalog zone with an unset ``default-primaries`` clause could cause
an unexpected termination of the :iscman:`named` process after two
reloading or reconfiguration commands. This has been fixed.

Closes #5494

Merge branch '5494-catz-crash-with-unset-default-primaries-and-double-reconfig' into 'main'

See merge request isc-projects/bind9!10896

8 months agoAdd a catalog zone with an unset 'default-primaries' to the catz test
Aram Sargsyan [Tue, 26 Aug 2025 14:57:02 +0000 (14:57 +0000)] 
Add a catalog zone with an unset 'default-primaries' to the catz test

And unset 'default-primaries' is causing an assertion failure after
two reload/reconfig commands. Add such a catalog zone to check the fix.

8 months agoFix a bug in configure_catz_zone()
Aram Sargsyan [Tue, 26 Aug 2025 14:58:32 +0000 (14:58 +0000)] 
Fix a bug in configure_catz_zone()

When dns_catz_zone_add() returns ISC_R_EXISTS and there is no
'default-primaries' or 'default-masters', the ISC_R_EXISTS result
code doesn't get reset to ISC_R_SUCCESS, and the function returns
ISC_R_EXISTS instead of ISC_R_SUCCESS. Which means that the zone
is successfully added, but the caller assumes that the function has
failed.

Reset 'result' to ISC_R_SUCCESS when dns_catz_zone_add() returns
ISC_R_EXISTS (it's not an error condition).

Refactor the code go call dns_catz_zone_add() when all other error
conditions are already checked.

8 months agochg: doc: Clarify forward, stub, and static-stub zone usage
Petr Špaček [Wed, 27 Aug 2025 14:17:19 +0000 (14:17 +0000)] 
chg: doc: Clarify forward, stub, and static-stub zone usage

Merge branch 'pspacek/doc-forward-stub-zones' into 'main'

See merge request isc-projects/bind9!10417

8 months agoClarify forward, stub, and static-stub zone usage
Petr Špaček [Tue, 22 Apr 2025 09:37:09 +0000 (11:37 +0200)] 
Clarify forward, stub, and static-stub zone usage

Clarify that forwarding points to a resolver and stub to auths.
Add cross-links. Rewrite stub zone type description.

8 months agochg: dev: Rewrite the bit rotate functions using __builtin or generic
Ondřej Surý [Wed, 27 Aug 2025 09:53:13 +0000 (11:53 +0200)] 
chg: dev: Rewrite the bit rotate functions using __builtin or generic

In gcc 15, __builtin_stdc_rotate_{left,right} was added.  Use these
builtins when available otherwise rewrite the ISC_ROTATE_LEFT and
ISC_ROTATE_RIGHT using _Generic.

Merge branch 'ondrej/use-__builtin_stdc_rotate_left_right' into 'main'

See merge request isc-projects/bind9!10893

8 months agoRewrite the bit rotate functions using __builtin or generic
Ondřej Surý [Tue, 26 Aug 2025 05:31:07 +0000 (07:31 +0200)] 
Rewrite the bit rotate functions using __builtin or generic

In gcc 15, __builtin_stdc_rotate_{left,right} was added.  Use these
builtins when available otherwise rewrite the ISC_ROTATE_LEFT and
ISC_ROTATE_RIGHT using _Generic.

8 months agochg: dev: move keystores handle from the zone to the view
Colin Vidal [Wed, 27 Aug 2025 09:01:15 +0000 (11:01 +0200)] 
chg: dev: move keystores handle from the zone to the view

The list of keystores is owned by the single server object
(named_g_server), but dns_zone_t has a pointer into it in order to
preserve encapsulation (lib/dns won't link to bin/named for good
reasons).

However, getting the keystores from the zone uses the zone lock whereas
this is not needed (as the pointer value doesn't depends on the zone,
and is initialized only with the same named_g_server->keystores value);
also storing an extra pointer per zone is not needed; also, there was a
logic based on the zone->secure property which was not needed (as there
is only one keystore).

The keystores pointer is now accessible and lock-free at view level,
it also simplifies a bit the various zone configuration APIs (server.c,
zoneconf.c).

Merge branch 'colin/move-keystore-to-view' into 'main'

See merge request isc-projects/bind9!10895

8 months agomove keystores handle from the zone to the view
Colin Vidal [Tue, 26 Aug 2025 13:05:55 +0000 (15:05 +0200)] 
move keystores handle from the zone to the view

The list of keystores is owned by the single server object
(named_g_server), but dns_zone_t has a pointer into it in order to
preserve encapsulation (lib/dns won't link to bin/named for good
reasons).

However, getting the keystores from the zone uses the zone lock whereas
this is not needed (as the pointer value doesn't depends on the zone,
and is initialized only with the same named_g_server->keystores value);
also storing an extra pointer per zone is not needed; also, there was a
logic based on the zone->secure property which was not needed (as there
is only one keystore).

The keystores pointer is now accessible and lock-free at view level,
it also simplifies a bit the various zone configuration APIs (server.c,
zoneconf.c).

8 months agofix: usr: Prevent spurious SERVFAILs for certain 0-TTL resource records
Ondřej Surý [Tue, 26 Aug 2025 19:03:43 +0000 (21:03 +0200)] 
fix: usr: Prevent spurious SERVFAILs for certain 0-TTL resource records

Under certain circumstances, BIND 9 can return SERVFAIL when updating
existing entries in the cache with new NS, A, AAAA, or DS records with 0-TTL.

Closes #5294

Merge branch '5294-preserve-ZEROTTL-on-cache-update' into 'main'

See merge request isc-projects/bind9!10897

8 months agoDon't preserve cache entries if new TTL is smaller than existing
Ondřej Surý [Tue, 26 Aug 2025 16:18:12 +0000 (18:18 +0200)] 
Don't preserve cache entries if new TTL is smaller than existing

Under certain circumstances, cache entries with equivalent rdataset
might not get replaced.  Previously such entry would get preserved
regardless of the new TTL and expire time on the existing header would
get updated when the expire time was less than the expire time on the
existing header.  Change the logic to preserve the existing header only
if the new expire time is larger than the existing one and replace the
existing cache entry when the new expire time is less than the existing
one.

Co-authored-by: Jinmei Tatuya <jtatuya@infoblox.com>
8 months agoPreserve ZEROTTL attribute when replacing NS RRset
Ondřej Surý [Tue, 26 Aug 2025 15:52:45 +0000 (17:52 +0200)] 
Preserve ZEROTTL attribute when replacing NS RRset

Previously, BIND 9 would drop the ZEROTTL attribute when updating
previously cached NS entry with ZEROTTL attribute set.

Co-authored-by: Jinmei Tatuya <jtatuya@infoblox.com>
8 months agochg: dev: Improve C23 compatibility
Ondřej Surý [Tue, 26 Aug 2025 14:35:53 +0000 (16:35 +0200)] 
chg: dev: Improve C23 compatibility

Use C23 stdckdint.h when available and define ckd_{mul,add,sub} shims to __builtin_{mul,add,sub}_overflow(). Require all the __builtin functions to be supported to further simplify the non-C23 implementation.  Rename the <stdbit.h>-shims in <isc/bit.h> to their C23 names.

Merge branch 'ondrej/use-stdckdint.h-if-available' into 'main'

See merge request isc-projects/bind9!10818

8 months agoUse the <stdbit.h> names for bit manipulation shims
Ondřej Surý [Wed, 20 Aug 2025 13:08:39 +0000 (15:08 +0200)] 
Use the <stdbit.h> names for bit manipulation shims

When <stdbit.h> is unavailable, use the stdc names like stdc_count_zeros
instead of ISC_COUNT_ZERO macros to simplify the code.

8 months agoSimplify add/sub/mul overflow checks
Ondřej Surý [Tue, 5 Aug 2025 06:19:20 +0000 (08:19 +0200)] 
Simplify add/sub/mul overflow checks

Use C23 stdckdint.h when available and define ckd_{mul,add,sub} shims to
__builtin_{mul,add,sub}_overflow().  Require the __builtin functions
unconditionally.

8 months agoRequire the __builtin functions unconditionally
Ondřej Surý [Tue, 5 Aug 2025 06:19:20 +0000 (08:19 +0200)] 
Require the __builtin functions unconditionally

Currently following __builtin functions are used:

    __builtin_add_overflow
    __builtin_mul_overflow
    __builtin_prefetch
    __builtin_sub_overflow
    __builtin_unreachable

These are generally available on our supported platform, and also we use
some of these unconditionally anyway in qp.c.  Thus make the support for
these functions mandatory so we fail early in the 'setup' step.

8 months agofix: ci: Reverse config grammar checks and docs builds
Petr Špaček [Tue, 26 Aug 2025 10:13:10 +0000 (10:13 +0000)] 
fix: ci: Reverse config grammar checks and docs builds

See #5379

Merge branch 'pspacek/fix-doc-misc-patch-generator' into 'main'

See merge request isc-projects/bind9!10891

8 months agoReverse config grammar checks and docs builds
Petr Špaček [Mon, 25 Aug 2025 16:04:33 +0000 (18:04 +0200)] 
Reverse config grammar checks and docs builds

Make grammar check in CI more user friendly. Previously Sphinx docs
build might have failed because outdated grammar files and this would
have prevented CI from generating grammar file patch.

8 months agofix: dev: Update fxhash constants
Ondřej Surý [Tue, 26 Aug 2025 07:46:14 +0000 (09:46 +0200)] 
fix: dev: Update fxhash constants

The fxhash implementation was missing a constant for 32-bit platforms.
This has been fixed.  Constant for 64-bit platform was update to match
the current Rust constants.

Merge branch 'ondrej/update-fxhash-constants' into 'main'

See merge request isc-projects/bind9!10894

8 months agoUpdate fxhash constants
Ondřej Surý [Tue, 26 Aug 2025 05:56:03 +0000 (07:56 +0200)] 
Update fxhash constants

The fxhash implementation was missing a constant for 32-bit platforms.
This has been fixed.  Constant for 64-bit platform was update to match
the current Rust constants.

8 months agofix: dev: Allow negative RRSIGs in the qpcache again
Ondřej Surý [Tue, 26 Aug 2025 07:40:53 +0000 (09:40 +0200)] 
fix: dev: Allow negative RRSIGs in the qpcache again

The previous refactoring added an assertion failure when negative RRSIG
would be added to the cache database.  As result, any query for RRSIG in
any unsigned zone would trigger that assertion failure.

Allow the negative RRSIG entries to be stored in the cache database
again as not caching these would trigger new remote fetch every time
such query would be received from a client.

Closes #5489

Merge branch '5489-allow-negative-RRSIGs-in-qpcache' into 'main'

See merge request isc-projects/bind9!10876

8 months agoAllow negative RRSIGs in the qpcache again
Ondřej Surý [Thu, 21 Aug 2025 06:56:29 +0000 (08:56 +0200)] 
Allow negative RRSIGs in the qpcache again

The previous refactoring added an assertion failure when negative RRSIG
would be added to the cache database.  As result, any query for RRSIG in
any unsigned zone would trigger that assertion failure.

Allow the negative RRSIG entries to be stored in the cache database
again as not caching these would trigger new remote fetch every time
such query would be received from a client.

8 months agoAdd a test for non-existence of RRSIG in the unsigned zone
Ondřej Surý [Thu, 21 Aug 2025 07:47:32 +0000 (09:47 +0200)] 
Add a test for non-existence of RRSIG in the unsigned zone

This tests that the result is NOERROR and a single SOA record is
returned.

8 months agofix: dev: Fix ISC_ROTATE_LEFTSIZE macro on MacOS"
Ondřej Surý [Tue, 26 Aug 2025 05:33:22 +0000 (07:33 +0200)] 
fix: dev: Fix ISC_ROTATE_LEFTSIZE macro on MacOS"

Closes #5497

Merge branch '5497-isc_rotate_leftsize-doesn-t-work-on-macos' into 'main'

See merge request isc-projects/bind9!10892

8 months agoWorkaround the compile failure on macOS
Ondřej Surý [Tue, 26 Aug 2025 04:53:27 +0000 (06:53 +0200)] 
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.

8 months agofix: dev: switch bit rotation functions to statement expressions
Aydın Mercan [Mon, 25 Aug 2025 12:08:44 +0000 (15:08 +0300)] 
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

8 months agoswitch bit rotation functions to statement expressions
Aydın Mercan [Thu, 21 Aug 2025 12:24:40 +0000 (15:24 +0300)] 
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.

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.