]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
8 months agonew: usr: support for zone-specific plugins alessio/checkpoint-zone-plugins
Colin Vidal [Tue, 9 Sep 2025 19:56:03 +0000 (21:56 +0200)] 
new: usr: support for zone-specific plugins

Query plugins can now be configured at the `zone` level, as well as globally or at the `view` level. A plugin's hooks are then called only while that specific zone's database is being used to answer a query.

This simplifies the implementation of plugins that are only needed for specific namespaces for which the server is authoritative. It can also enable quicker responses, since plugins will only be called when they are needed.

Closes #5356

Merge branch 'colin/zone-plugins' into 'main'

See merge request isc-projects/bind9!10483

8 months agorename test hooks python file
Colin Vidal [Tue, 9 Sep 2025 08:13:40 +0000 (10:13 +0200)] 
rename test hooks python file

As bin/tests/system/hooks/tests_hooks.py still contains wrapper to a
shell-based test (even if not only), rename the file name into
tests_sh_hooks.py

8 months agoremove query_ctx_t detach_client property
Colin Vidal [Mon, 8 Sep 2025 08:12:53 +0000 (10:12 +0200)] 
remove query_ctx_t detach_client property

Since the removal of NS_QUERY_QCTX_DESTROYED hook, there is no need for
the `qctx->detach_client` object anymore, as this was designed to tell
the plugin whether the client object is about to be, or is already,
freed from memory.  This is not needed anymore, as NS_QUERY_RESET is
called _always_ when the client object is about to be freed from memory.

Remove `detach_client` and tidy up the code a bit by including the
freeing of the qctx object (when allocated) inside the qctx_destroy
function instead of requiring extra calls.

8 months agoupdate hooks tests to use NS_QUERY_RESET
Colin Vidal [Mon, 8 Sep 2025 08:12:29 +0000 (10:12 +0200)] 
update hooks tests to use NS_QUERY_RESET

Update hooks-related unit tests since the removal of
NS_QUERY_QCTX_DESTROY and the introduction of NS_QUERY_RESET hook. This
also simplifies (a bit) the plugin usage as NS_QUERY_RESET is _always_
called when the client plugin is about to be freed from memory.

8 months agoreplace QCTX_INIT/_DESTROY hooks with QUERY_SETUP/_RESET
Colin Vidal [Mon, 8 Sep 2025 08:10:37 +0000 (10:10 +0200)] 
replace QCTX_INIT/_DESTROY hooks with QUERY_SETUP/_RESET

The hook NS_QUERY_QCTX_DESTROY is problematic with zone plugins because
it can be called in some contexts where `qctx->client` is invalid (the
pointer is dangling); which would lead to a use-after-free (spotted by
TSAN build) as `qctx->client` is used to get the zone hooktable, to find
out whether there is an authoritive zone which would have
NS_QUERY_QCTX_DESTROY registered.

This can't easily be fixed, because there is no easy way to know from
query.c code if `client` is still a valid object: `client->reqhandle`,
representing the request from a client, is refcounted, and the `client`
object is freed from memory once its refcounter gets to 0. While
`reqhandle` is attached from query.c code, it can be attached more than
once from asynchronous code and there is no clear path where detaching
it would lead to a client free. Hence, there is no way to know for sure
when to set `qctx->client = NULL` (this is why the pointer remains
dangling).

Back to the original problem; this is why the NS_QUERY_QCTX_DESTROY hook
is incompatible with zone plugins. `qctx->detach_client`, which is used
to tell a plugin that the `client` object is either free or about to be
free can't be use either, because in some cases the client is still
there, and should be used.

Code issue aside, the `qctx` object is really just an aggregate of
various data to pass easily in the various functions and callbacks,
initially stored on the stack, but allocated in some cases (for some
asynchronous flow, when recursion is needed), so the point it gets
created/"destroyed" is really just an implementation "detail", and
providing a higher level hook for the plugin would be beneficial. Hence,
NS_QUERY_RESET and NS_QUERY_INIT are removed, and instead, the existing
NS_QUERY_SETUP can be used as well as the newly introduced
NS_QUERY_RESET (which replaces NS_QUERY_QCTX_DESTROY). The advanage is
that NS_QUERY_RESET is called _only_ when the client object is _always_
about to be freed, which avoids usage of the extra `qctx->detach_client`
usage from the plugin.

The way NS_QUERY_RESET works is that when the `client` is freed, a
callback (from `query.c`) is called. This callback creates a transient
qctx object on the stack with a pointer to the view, and uses that
to call the hook.

8 months agoadd unit test for plugin_register source param
Colin Vidal [Tue, 19 Aug 2025 12:45:56 +0000 (14:45 +0200)] 
add unit test for plugin_register source param

Update the existing test's syncplugin plugin with a new parameter
indicating whether the plugin should be loaded in a view or a zone.
If it doesn't match where the plugin is actually loaded, it fails the
initialization. This covers the correctless of the `source` parameter of
`plugin_register` API.

8 months agoadd plugin_register param telling the source
Colin Vidal [Tue, 19 Aug 2025 12:38:36 +0000 (14:38 +0200)] 
add plugin_register param telling the source

The plugin `plugin_register` API has a new parameter `source` indicating
whether the plugin is loaded from a view or a zone.

This extra parameter enables the plugin to fail early during
initialization if a plugin written to be used in a zone exclusively
is loaded at a view level, or vice versa.

8 months agofilter-aaaa can be used as zone or view plugin
Colin Vidal [Tue, 10 Jun 2025 14:32:04 +0000 (16:32 +0200)] 
filter-aaaa can be used as zone or view plugin

Update the filter-aaaa system test so the two authoritative zones
in ns4 both configure filter-aaaa as a zone plugin.

In order to work in both contexts, the plugin must register both
the `NS_QUERY_QCTX_INITIALIZED` and `NS_QUERY_AUTHZONE_ATTACHED`
hooks.

When the plugin is configured at the zone level in an authoritative
server, `NS_QUERY_QCTX_INITIALIZED` is skipped, because no zone will
have been looked up by the time it is called.  When the zone is
found, calling `NS_QUERY_AUTHZONE_ATTACHED` will allow the same
initialization to occur.

8 months agoadd NS_QUERY_AUTHZONE_ATTACHED hook
Colin Vidal [Tue, 10 Jun 2025 14:27:58 +0000 (16:27 +0200)] 
add NS_QUERY_AUTHZONE_ATTACHED hook

Add a new query hook called `NS_QUERY_AUTHZONE_ATTACHED`. This hook is
called whenever an authoritative zone is found and attached during a
query answer.

From code level, this hook is called when `qctx->client->query->authzone`
is attached during a query.  This enables zone-specific plugins to
initialize specific states whenever a local zone is found that can
answer a query.

8 months agoupdate hook developer documentation
Colin Vidal [Thu, 5 Jun 2025 15:31:12 +0000 (17:31 +0200)] 
update hook developer documentation

Attempt to add zone plugin specificities into the hook developer
documentation. In particular about the hook call order and hookpoint
which can't be called on a zone plugin.

8 months agoadd zone plugin documentation
Colin Vidal [Wed, 4 Jun 2025 11:36:34 +0000 (13:36 +0200)] 
add zone plugin documentation

Update ARM documentation to mention plugin usage at the zone level (as
well as template level).

8 months agoadd template support for zone plugins
Colin Vidal [Wed, 4 Jun 2025 11:52:30 +0000 (13:52 +0200)] 
add template support for zone plugins

The zone plugin loading code now also looks into the zone template
configuration property of a zone. If it exists, it checks whether there
is a plugin sub-tree defined in the template and, if that exists, loads
the plugin definition from the template.

8 months agoadd query unit test
Colin Vidal [Wed, 28 May 2025 09:54:19 +0000 (11:54 +0200)] 
add query unit test

A new query unit test covers the logic where zone hooks must be called
first, then view ones, and finally the default hooks. It also ensures
that if any hook returns NS_HOOK_RETURN the chain immediately stops.

8 months agoadd tests for per-zone hook instance support
Colin Vidal [Tue, 27 May 2025 12:20:02 +0000 (14:20 +0200)] 
add tests for per-zone hook instance support

add system tests covering the individual support of zone plugins.

8 months agoadd zone-specific plugin instance
Colin Vidal [Tue, 27 May 2025 09:46:21 +0000 (11:46 +0200)] 
add zone-specific plugin instance

The zone object now has its own hooktable and plugins, which are
initialized during zone initialization.

8 months agotest for namedconf zone plugin support
Colin Vidal [Mon, 26 May 2025 14:55:26 +0000 (16:55 +0200)] 
test for namedconf zone plugin support

add a system test, using a dummy plugin, to test named.conf
validation of a plugin inside a zone definition.

8 months agoadd namedconf support for plugin inside a zone
Colin Vidal [Mon, 26 May 2025 14:53:31 +0000 (16:53 +0200)] 
add namedconf support for plugin inside a zone

The named.conf parser now accepts the plugin clause inside a zone
definition.  This enables us to add (in later commits) support for
zone plugins.

8 months agorem: usr: Remove randomized RRset ordering
Ondřej Surý [Mon, 8 Sep 2025 15:05:05 +0000 (17:05 +0200)] 
rem: usr: Remove randomized RRset ordering

The rrset-order random doesn't offer uniform distribution of all
permutations and it isn't superior to cyclic order in any way.  Make the
random ordering an alias to the cyclic ordering.

Closes: #5513
Merge branch 'ondrej/remove-rrset-order-random' into 'main'

See merge request isc-projects/bind9!10912

8 months agoRefactor the cyclic ordering to use query ID as offset
Ondřej Surý [Thu, 28 Aug 2025 17:19:01 +0000 (19:19 +0200)] 
Refactor the cyclic ordering to use query ID as offset

Mimic the Unbound behaviour where the cyclic offset is taken from query
ID, and remove recording of the current state.  As the incoming query ID
should have random distribution, the cyclic ordering should also have
uniform distribution of the starting record.

8 months agoRefactor the cyclic ordering to be more efficient
Ondřej Surý [Thu, 28 Aug 2025 13:29:44 +0000 (15:29 +0200)] 
Refactor the cyclic ordering to be more efficient

With random ordering removed, the cyclic ordering can be rewritten in a
that it uses thread_local static array to keep the cyclic order.

This could be further improved by keeping the current position inside
the slabheader and adding a function to start directly there instead at
dns_rdataset_first().

8 months agoRemove the random ordering of resource records in RRset
Ondřej Surý [Thu, 28 Aug 2025 10:24:17 +0000 (12:24 +0200)] 
Remove the random ordering of resource records in RRset

The rrset-order random doesn't offer uniform distribution of all
permutations and it isn't superior to cyclic order in any way.  Make the
random ordering an alias to the cyclic ordering.

8 months agonew: usr: add extra tokens to the zone file name template
Colin Vidal [Mon, 8 Sep 2025 10:46:48 +0000 (12:46 +0200)] 
new: usr: add extra tokens to the zone file name template

Extend the `$name`, `$view` and `$type` tokens (expanding into the zone
name, zone's view name and type); the new following tokens are now also
accepted:

- `$name` or `%s` is replaced with the zone name in lower case;
- `$type` or `%t` is replaced with the zone type -- i.e., primary,
  secondary, etc);
- `$view` or `%v` is replaced with the view name;
- `$char1` or `%1` is replaced with the first character of the zone name;
- `$char2` or `%2` is replaced with the second character of the zone name
  (or a dot if there is no second character);
- `$char3` or `%3` is replaced with the third character of the zone name (or
  a dot if there is no third character);
- `$label1` or `%z` is replaced with the toplevel domain of the zone (or a
  dot if it is the root zone);
- `$label2` or `%y` is replaced with the next label under the toplevel
  domain (or a dot if there is no next label);
- `$label3` or `%x` is replaced with the next-next label under the toplevel
  domain (or a dot if there is no next-next label).

Closes #85

Merge branch '85-file-template' into 'main'

See merge request isc-projects/bind9!10779

8 months agoadd extra tokens to the zone file name template
Colin Vidal [Thu, 24 Jul 2025 12:54:07 +0000 (14:54 +0200)] 
add extra tokens to the zone file name template

Extend the `$name`, `$view` and `$type` tokens (expanding into the zone
name, zone's view name and type); the new following tokens are now also
accepted:

- $name or %s is replaced with the zone name in lower case;
- $type or %t is replaced with the zone type -- i.e., primary,
  secondary, etc);
- $view or %v is replaced with the view name;
- $char1 or %1 is replaced with the first character of the zone name;
- $char2 or %2 is replaced with the second character of the zone name
  (or a dot if there is no second character);
- $char3 or %3 is replaced with the third character of the zone name (or
  a dot if there is no third character);
- $label1 or %z is replaced with the toplevel domain of the zone (or a
  dot if it is the root zone);
- $label2 or %y is replaced with the next label under the toplevel
  domain (or a dot if there is no next label);
- $label3 or %x is replaced with the next-next label under the toplevel
  domain (or a dot if there is no next-next label).

8 months agochg: doc: Set up version for BIND 9.21.13
Petr Špaček [Mon, 8 Sep 2025 09:45:16 +0000 (09:45 +0000)] 
chg: doc: Set up version for BIND 9.21.13

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

See merge request isc-projects/bind9!10952

8 months agoUpdate BIND version to 9.21.13-dev
Andoni Duarte Pintado [Mon, 8 Sep 2025 09:41:27 +0000 (11:41 +0200)] 
Update BIND version to 9.21.13-dev

8 months agofix: nil: Replace .reuse/dep5 with REUSE.toml
Ondřej Surý [Mon, 8 Sep 2025 09:22:51 +0000 (11:22 +0200)] 
fix: nil: Replace .reuse/dep5 with REUSE.toml

Update to REUSE Specification 3.2+ that uses REUSE.toml instead of DEP5
based specification.

Merge branch 'ondrej/cover-reuse-dep5-to-toml' into 'main'

See merge request isc-projects/bind9!10945

8 months agoReplace .reuse/dep5 with REUSE.toml
Ondřej Surý [Sat, 6 Sep 2025 13:58:22 +0000 (15:58 +0200)] 
Replace .reuse/dep5 with REUSE.toml

Update to REUSE Specification 3.2+ that uses REUSE.toml instead of DEP5
based specification.

8 months agochg: doc: Document rndc dnssec -step
Petr Špaček [Thu, 4 Sep 2025 13:49:56 +0000 (13:49 +0000)] 
chg: doc: Document rndc dnssec -step

Related to #4606

Merge branch '4606-document-rndc-dnssec-step' into 'main'

See merge request isc-projects/bind9!10941

8 months agoDocument rndc dnssec -step
Matthijs Mekking [Thu, 4 Sep 2025 07:45:11 +0000 (09:45 +0200)] 
Document rndc dnssec -step

This documentation was missing from !10774.

8 months agofix: dev: RPZ 'servfail-until-ready': skip updating SERVFAIL cache
Petr Špaček [Wed, 3 Sep 2025 13:23:38 +0000 (13:23 +0000)] 
fix: dev: RPZ 'servfail-until-ready': skip updating SERVFAIL cache

In order to not pollute the SERVFAIL cache with the configured
SERVFAIL answers while RPZ is loading, set the NS_CLIENTATTR_NOSETFC
attribute for the client.

Merge branch 'aram/rpz-servfail-until-ready-tunings' into 'main'

See merge request isc-projects/bind9!10904

8 months agoLog the servfail-until-ready message not faster than once per second
Aram Sargsyan [Wed, 27 Aug 2025 15:25:43 +0000 (15:25 +0000)] 
Log the servfail-until-ready message not faster than once per second

Since the log level has been raised, busy servers can "explode" from
the amount of log messages. Use the usual practice of logging "every
once in a while".

8 months agoChange the "RPZ not ready yet" message and its log level
Aram Sargsyan [Wed, 27 Aug 2025 14:35:09 +0000 (14:35 +0000)] 
Change the "RPZ not ready yet" message and its log level

The "RPZ not ready yet" message is logged at debug 3 level. Use the
info level instead for better visibility.

After raising the log level, the rpz_log_fail_helper() function starts
appending " failed: " the the message. Change the log message so it
makes more sense.

8 months agoRPZ 'servfail-until-ready': skip updating SERVFAIL cache
Aram Sargsyan [Wed, 27 Aug 2025 14:33:01 +0000 (14:33 +0000)] 
RPZ 'servfail-until-ready': skip updating SERVFAIL cache

In order to not pollute the SERVFAIL cache with the configured
SERVFAIL answers while RPZ is loading, set the NS_CLIENTATTR_NOSETFC
attribute for the client.

8 months agochg: doc: Clarify rrset-order random distribution
Ondřej Surý [Wed, 3 Sep 2025 06:50:50 +0000 (08:50 +0200)] 
chg: doc: Clarify rrset-order random distribution

The randomized order of the records in the rrset is not uniform across
all permutations.  Clarify this in the documentation.

Closes #5485

Merge branch 'ondrej/clarify-rrset-order-random' into 'main'

See merge request isc-projects/bind9!10909

8 months agoClarify rrset-order random distribution
Ondřej Surý [Thu, 28 Aug 2025 09:40:37 +0000 (11:40 +0200)] 
Clarify rrset-order random distribution

The randomized order of the records in the rrset is not uniform across
all permutations.  Clarify this in the documentation.

8 months agonew: usr: Support for parsing HHIT and BRID records has been added
Mark Andrews [Wed, 3 Sep 2025 00:47:37 +0000 (10:47 +1000)] 
new: usr: Support for parsing HHIT and BRID records has been added

Closes #5444

Merge branch '5444-add-hhit-and-brid-records' into 'main'

See merge request isc-projects/bind9!10795

8 months agoAdd tests for BRID and HHIT
Mark Andrews [Wed, 30 Jul 2025 05:22:05 +0000 (15:22 +1000)] 
Add tests for BRID and HHIT

8 months agoAdd support for parsing and displaying BRID rdata type
Mark Andrews [Wed, 30 Jul 2025 03:12:13 +0000 (13:12 +1000)] 
Add support for parsing and displaying BRID rdata type

8 months agoAdd support for parsing and displaying HHIT rdata type
Mark Andrews [Wed, 30 Jul 2025 03:11:40 +0000 (13:11 +1000)] 
Add support for parsing and displaying HHIT rdata type

8 months agofix: usr: RPZ canonical warning displays zone entry incorrectly
Mark Andrews [Tue, 2 Sep 2025 23:41:18 +0000 (09:41 +1000)] 
fix: usr: RPZ canonical warning displays zone entry incorrectly

When an IPv6 rpz prefix entry is entered incorrectly the log
message was just displaying the prefix rather than the full
entry.  This has been corrected.

Closes #5491

Merge branch '5491-rpz-canonical-warning-displays-zone-entry-incorrectly' into 'main'

See merge request isc-projects/bind9!10890

8 months agoAdd non canonical form entry to trigger log message
Mark Andrews [Mon, 25 Aug 2025 01:19:37 +0000 (11:19 +1000)] 
Add non canonical form entry to trigger log message

8 months agoRPZ canonical warning displays zone entry incorrectly
Mark Andrews [Mon, 25 Aug 2025 00:32:36 +0000 (10:32 +1000)] 
RPZ canonical warning displays zone entry incorrectly

Do not insert a NUL into ip_str too early as the full value
is needed later.  Only insert the NUL immediately before
displaying just the prefix string.

8 months agorem: nil: Remove qname/qtype from dns_adb_createfind() call
Ondřej Surý [Tue, 2 Sep 2025 19:41:05 +0000 (21:41 +0200)] 
rem: nil: Remove qname/qtype from dns_adb_createfind() call

Both qname and qtype arguments to dns_adb_createfind() were unused.
Remove both these arguments from the function prototype.

Merge branch 'ondrej/minor-dns_adb-cleanup' into 'main'

See merge request isc-projects/bind9!10918

8 months agoRemove qname/qtype from dns_adb_createfind() call
Ondřej Surý [Sun, 31 Aug 2025 17:34:35 +0000 (19:34 +0200)] 
Remove qname/qtype from dns_adb_createfind() call

Both qname and qtype arguments to dns_adb_createfind() were unused.
Remove both these arguments from the function prototype.

8 months agochg: test: Wait for rekey_done log in rollover system tests
Matthijs Mekking [Tue, 2 Sep 2025 13:03:08 +0000 (13:03 +0000)] 
chg: test: Wait for rekey_done log in rollover system tests

Waiting for "keymgr: done" logs caused some manual-mode tests to fail intermittently. Waiting for "rekey done" logs should be more reliable.

Closes #5493

Merge branch '5493-algoroll-csk-step3-manual-unstable-test' into 'main'

See merge request isc-projects/bind9!10923

8 months agoWait for rekey_done log in rollover system tests
Matthijs Mekking [Mon, 1 Sep 2025 15:11:51 +0000 (17:11 +0200)] 
Wait for rekey_done log in rollover system tests

Waiting for "keymgr: done" logs caused some manual-mode tests to fail
intermittently. Waiting for "rekey done" logs should be more reliable.

8 months agochg: dev: Lazily allocate fetch counter
Alessio Podda [Tue, 2 Sep 2025 09:57:30 +0000 (09:57 +0000)] 
chg: dev: 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%.

Merge branch 'alessio/lazy-fetch-counter-alloc' into 'main'

See merge request isc-projects/bind9!10917

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.