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

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

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

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

See merge request isc-projects/bind9!10860

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

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

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

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

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

See merge request isc-projects/bind9!10826

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

See merge request isc-projects/bind9!10859

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

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

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

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

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

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

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

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

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

See merge request isc-projects/bind9!10843

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

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

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

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

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

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

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

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

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

See merge request isc-projects/bind9!10686

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

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

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

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

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

See merge request isc-projects/bind9!10840

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Closes #5473

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

See merge request isc-projects/bind9!10850

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

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

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

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

Closes #5468

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

See merge request isc-projects/bind9!10851

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

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

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

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

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

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

Closes #5467

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

See merge request isc-projects/bind9!10831

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

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

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

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

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

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

See merge request isc-projects/bind9!10841

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

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

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

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

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

See merge request isc-projects/bind9!10854

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

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

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

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

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

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

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

See merge request isc-projects/bind9!10728

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

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

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

See merge request isc-private/bind9!824

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Closes #5466

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

See merge request isc-projects/bind9!10824

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

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

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

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

Related #5448

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

See merge request isc-projects/bind9!10835

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

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

Related #5448

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

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

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

See merge request isc-projects/bind9!10730

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

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

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

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

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

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

9 months agorename filter-aaaa to filters
Evan Hunt [Fri, 11 Jul 2025 05:12:10 +0000 (22:12 -0700)] 
rename filter-aaaa to filters

since the test now covers both plugins, the filter-aaaa name is
misleading.

9 months agoadd filter-a tests
Evan Hunt [Fri, 11 Jul 2025 05:00:20 +0000 (22:00 -0700)] 
add filter-a tests

add test cases to exercise the filter-a plugin.

9 months agoreduce code duplication in filter-aaaa test
Evan Hunt [Fri, 11 Jul 2025 00:17:41 +0000 (17:17 -0700)] 
reduce code duplication in filter-aaaa test

cut down the number of identical lines in the filter-aaaa test:
- replace identical test cases with small check functions
  (check_aaaa_only, check_any, check_nodata, etc).
- group those together into large check functions (check_filter,
  check_filter_other_family) that have options for recursive and
  break_dnssec, then run those for each combination of options
  on servers connfigured with filter-aaaa-on-v4 and filter-aaaa-on-v6.

9 months agoconvert filter-aaaa test to python
Evan Hunt [Thu, 10 Jul 2025 08:03:17 +0000 (01:03 -0700)] 
convert filter-aaaa test to python

use pytest for the filter-aaaa test.

In order to implement this, isctest.mark can now test whether IPv6 is
configured by calling testsock6.pl.

9 months agofix: test: Fix the .hypothesis directory to bin/tests/system/.hypothesis
Štěpán Balážik [Tue, 5 Aug 2025 16:26:26 +0000 (16:26 +0000)] 
fix: test: Fix the .hypothesis directory to bin/tests/system/.hypothesis

Previously the location of the .hypothesis directory would depend on the
current working directory when running pytest.

Set the HYPOTHESIS_STORAGE_DIRECTORY explicitly.

Closes #5424

Merge branch '5424-hypothesis-artifacts' into 'main'

See merge request isc-projects/bind9!10825

9 months agoFix the .hypothesis directory to bin/tests/system/.hypothesis
Štěpán Balážik [Tue, 5 Aug 2025 14:51:14 +0000 (16:51 +0200)] 
Fix the .hypothesis directory to bin/tests/system/.hypothesis

Previously the location of the .hypothesis directory would depend on the
current working directory when running pytest.

Set the HYPOTHESIS_STORAGE_DIRECTORY explicitly.

9 months agofix: dev: Refactor resolver cache_name() and validated() functions
Ondřej Surý [Tue, 5 Aug 2025 11:27:59 +0000 (13:27 +0200)] 
fix: dev: Refactor resolver cache_name() and validated() functions

These functions were excessive in length and complexity, with McCabe complexity values of 110 and 105 respectively, and also included some dead code. They have been cleaned up and split into smaller functions, with a maximum complexity of 27.  A few minor coding errors were discovered and fixed along the way.

Merge branch 'each-refactor-cache-name' into 'main'

See merge request isc-projects/bind9!10198

9 months agorefactor validated()
Evan Hunt [Wed, 26 Feb 2025 21:59:19 +0000 (13:59 -0800)] 
refactor validated()

- there was special-case code in validated() to handle the results
  of a validator started by a CD=1 query. since that never happens,
  the code has been removed.
- the section of code that handles opportunistic caching of
  validated SOA, NS and NSEC data has been split out to a separate
  function.
- the number of goto statements has been reduced considerably.

9 months agosplit out helper functions
Evan Hunt [Sun, 2 Mar 2025 09:24:08 +0000 (01:24 -0800)] 
split out helper functions

- fctx_setresult() sets the event result in a fetch response
  according to the rdataset being returned - DNS_R_NCACHENXDOMAIN or
  DNS_R_NXRRSET for negative responses, ISC_R_SUCCESS, DNS_R_CNAME,
  or DNS_R_DNAME for positive ones.
- cache_rrset() looks up a node and adds an rdataset.
- delete_rrset() looks up a node and removes rdatasets of a specified
  type and, optionally, the associated signatures.
- gettrust() returns the trust level of an rdataset, or dns_trust_none
  if the rdataset is NULL or not associated.
- getrrsig() scans the rdatasets associated with a name for the
  RRSIG covering a given type.

9 months agofurther subdivide caching functions
Evan Hunt [Sun, 2 Mar 2025 06:15:11 +0000 (22:15 -0800)] 
further subdivide caching functions

rctx_cacherdataset() has been split into two functions:
- rctx_cache_secure() starts validation for rdatasets
  that need it; they are then cached by the validator
  completion callback validated()
- rctx_cache_insecure() caches rdatasets immediately; it
  is called when validation is disabled or the data
  to be cached is glue.

9 months agorename and refactor cache_name() and related functions
Evan Hunt [Sun, 2 Mar 2025 04:04:18 +0000 (20:04 -0800)] 
rename and refactor cache_name() and related functions

- renamed cache_message() to rctx_cachemessage()
- renamed cache_name() to rctx_cachename()
- merged ncache_message() into rctx_ncache()
- split out a new function, rctx_cacherdataset(), which is
  called by rctx_cachename() in a loop to process each of
  the rdatasets associated with the name.

9 months agoreduce code duplication around findnoqname()
Evan Hunt [Sun, 2 Mar 2025 05:38:34 +0000 (21:38 -0800)] 
reduce code duplication around findnoqname()

every call to findnoqname() was followed by a call to
dns_rdataset_addnoqname(). we can move that call into
findnoqname() itself, and simplify the calling functions
a bit.

9 months agoset ANSWERSIG flag when processing ANY responses
Evan Hunt [Sat, 1 Mar 2025 23:40:07 +0000 (15:40 -0800)] 
set ANSWERSIG flag when processing ANY responses

previously, rctx_answer_any() set the ANSWER flag for all
rdatasets in the answer section; it now sets ANSWERSIG for
RRSIG/SIG rdatasets and ANSWER for everything else.  this
error didn't cause any harm in the current code, but it
could have led to unexpected behavior in the future.

9 months agosplit out some functionality in cache_name()
Evan Hunt [Thu, 27 Feb 2025 22:28:37 +0000 (14:28 -0800)] 
split out some functionality in cache_name()

there are now separate functions to check the cacheability of
an rdataset or to normalize TTLs, and the code to determine
whether validation is necessary has been simplified.

9 months agoadd functions to match rdataset types
Evan Hunt [Fri, 28 Feb 2025 01:10:21 +0000 (17:10 -0800)] 
add functions to match rdataset types

- dns_rdataset_issigtype() returns true if the rdataset is
  of type RRSIG and covers a specified type
- dns_rdataset_matchestype() returns true if the rdataset
  is of the specified type *or* the RRSIG covering it.

9 months agoreduce steps for negative caching
Evan Hunt [Thu, 27 Feb 2025 20:43:52 +0000 (12:43 -0800)] 
reduce steps for negative caching

whenever ncache_adderesult() was called, some preparatory code
was run first; this has now been moved into a single function
negcache() to reduce code duplication.

9 months agochange issecuredomain() functions to bool
Evan Hunt [Thu, 27 Feb 2025 06:06:40 +0000 (22:06 -0800)] 
change issecuredomain() functions to bool

dns_keytable_issecuredomain() and dns_view_issecuredomain()
previously returned a result code to inform the caller of
unexpected database failures when looking up names in the
keytable and/or NTA table. such failures are not actually
possible. both functions now return a simple bool.

also, dns_view_issecuredomain() now returns false if
view->enablevalidation is false, so the caller no longer
has to check for that.

9 months agosplit out cookie checks from resquery_response_continue()
Evan Hunt [Thu, 27 Feb 2025 05:30:43 +0000 (21:30 -0800)] 
split out cookie checks from resquery_response_continue()

split the code section that handles cookie issues into a
separate function for better readablity.

9 months agosimplify dns_ncache_add()
Evan Hunt [Wed, 26 Feb 2025 21:47:40 +0000 (13:47 -0800)] 
simplify dns_ncache_add()

there's no longer any reason to have both dns_ncache_add() and
dns_ncache_addoptout().

9 months agofix: test: Add support for small stack size for threads
Ondřej Surý [Tue, 5 Aug 2025 09:24:35 +0000 (11:24 +0200)] 
fix: test: Add support for small stack size for threads

When running the isc_quota unit test with less than
usual amount of RAM (e.g. in a CI for architectures
with 32 bits of address space), the pthread_create()
function fails with the "Resource temporarily unavailable
(11)" error code.

Add functions to get and set the thread stack size (if requested),
and use these to set the thread stack size to smaller value in the
isc_quota unit test.

Merge branch 'aram/isc-thread-stack-size-small' into 'main'

See merge request isc-projects/bind9!10778

9 months agoDocument the current default stack sizes on different systems
Ondřej Surý [Tue, 5 Aug 2025 05:34:15 +0000 (07:34 +0200)] 
Document the current default stack sizes on different systems

The default stack sizes varies between operating systems and between
different system libc libraries from 128kB (Alpine Linux with MUSL) to
8M (Linux with glibc).  Document the different values used to justify
the value of THREAD_MINSTACKSIZE (currently set to 1MB).

9 months agoAdd support for setting thread stack size
Ondřej Surý [Mon, 4 Aug 2025 15:03:42 +0000 (17:03 +0200)] 
Add support for setting thread stack size

When running the isc_quota unit test with less than usual amount of
RAM (e.g. in a CI for architectures with 32 bits of address space),
the pthread_create() function fails with the "Resource temporarily
unavailable (11):" error code.

Add functions to get and set the thread stack size (if requested),
and use these to set the thread stack size to smaller value in the
isc_quota unit test.

9 months agomeson: add 'threads' dependency for pthread_* function checks
Aram Sargsyan [Mon, 28 Jul 2025 10:53:32 +0000 (10:53 +0000)] 
meson: add 'threads' dependency for pthread_* function checks

This fixes the correct detection of these functions on some
platforms like Alma Linux 8.

Co-authored-by: Aydın Mercan <aydin@isc.org>
9 months agonew: usr: Support for parsing the DSYNC record has been added
Mark Andrews [Tue, 5 Aug 2025 08:11:41 +0000 (18:11 +1000)] 
new: usr: Support for parsing the DSYNC record has been added

Closes #5440

Merge branch '5440-add-dsync-record' into 'main'

See merge request isc-projects/bind9!10776

9 months agoAdd tests for DSYNC
Mark Andrews [Sat, 26 Jul 2025 10:27:33 +0000 (12:27 +0200)] 
Add tests for DSYNC

9 months agoAdd support for parsing and displaying DSYNC rdata type
Mark Andrews [Sat, 26 Jul 2025 04:21:34 +0000 (06:21 +0200)] 
Add support for parsing and displaying DSYNC rdata type

9 months agoAdd support for parsing DSYNC scheme mnemonics
Mark Andrews [Sat, 26 Jul 2025 04:17:20 +0000 (06:17 +0200)] 
Add support for parsing DSYNC scheme mnemonics

Adds dns_dsyncscheme_fromtext, dns_dsyncscheme_totext and
dns_dsyncscheme_format.  Adds type dns_dsyncscheme_t.

9 months agofix: usr: Add RPZ extended DNS error for zones with a CNAME override policy configured
Matthijs Mekking [Tue, 5 Aug 2025 07:19:49 +0000 (07:19 +0000)] 
fix: usr: Add RPZ extended DNS error for zones with a CNAME override policy configured

When the zone is configured with a CNAME override policy, or the response policy zone contains a wildcard CNAME, the extended DNS error code was not added. This has been fixed.

Closes #5342

Merge branch '5342-rpz-cname-override-ede-not-added' into 'main'

See merge request isc-projects/bind9!10777

9 months agoAdd ede for zone with rpz cname override policy
Matthijs Mekking [Fri, 25 Jul 2025 13:20:37 +0000 (15:20 +0200)] 
Add ede for zone with rpz cname override policy

When the zone is configured with a CNAME override policy, also add the
configured EDE code.

When the zone is contains a wildcard CNAME, also add the configured
EDE code.

9 months agoTest adding ede with rpz cname override policy
Matthijs Mekking [Fri, 25 Jul 2025 13:18:23 +0000 (15:18 +0200)] 
Test adding ede with rpz cname override policy

When the zone is configured with a CNAME override policy, the EDE code
is not added as expected. Add a test case based on the issue in GitLab
(#5342).

When the zone contains a wildcard CNAME, the EDE code is not added as
expected. Also add a test case for this.

9 months agofix: dev: Silence "may be truncated" warnings
Ondřej Surý [Mon, 4 Aug 2025 14:52:11 +0000 (16:52 +0200)] 
fix: dev:  Silence "may be truncated" warnings

Use memccpy() instead of strncpy() for safe string manipulation.

Closes #5395

Merge branch '5395-gen-c-silence-truncated-warnings' into 'main'

See merge request isc-projects/bind9!10647

9 months agoSilence "may be truncated" warnings
Ondřej Surý [Mon, 4 Aug 2025 13:38:17 +0000 (15:38 +0200)] 
Silence "may be truncated" warnings

Use memccpy() instead of strncpy() for safe string manipulation.

9 months agochg: dev: Add and use global memory context called isc_g_mctx
Ondřej Surý [Mon, 4 Aug 2025 10:11:01 +0000 (12:11 +0200)] 
chg: dev: Add and use global memory context called isc_g_mctx

Instead of having individual memory contexts scattered across different
files and called different names, add a single memory context called
isc_g_mctx that replaces named_g_mctx and various other global memory
contexts in various utilities and tests.

Merge branch 'ondrej/add-global-isc_g_mctx-instance' into 'main'

See merge request isc-projects/bind9!10737

9 months agoAdd rcu_barrier() to isc__log_shutdown()
Ondřej Surý [Thu, 24 Jul 2025 09:02:15 +0000 (11:02 +0200)] 
Add rcu_barrier() to isc__log_shutdown()

There is a data race when QP is reclaiming chunks on the call_rcu
threads and it tries to log the number of reclaimed chunks while the
server is shuttingdown.  Workaround this by adding rcu_barrier() before
shuttingdown the global log context.

9 months agoChange the 'isc_g_mctx' to be always available
Ondřej Surý [Thu, 24 Jul 2025 06:06:04 +0000 (08:06 +0200)] 
Change the 'isc_g_mctx' to be always available

This required couple of internal changes to the isc_mem_debugging.

The isc_mem_debugging is now internal to isc_mem unit and there are
three new functions:

1. isc_mem_setdebugging() can change the debugging setting for an
   individual memory context.  This is need for the memory contexts used
   for OpenSSL, libxml and libuv accounting as recording and tracing
   memory is broken there.

2. isc_mem_debugon() / isc_mem_debugoff() can be used to change default
   memory debugging flags as well as debugging flags for isc_g_mctx.

Additionally, the memory debugging is inconsistent across the code-base.
For now, we are keeping the existing flags, but three new environment
variables have been added 'ISC_MEM_DEBUGRECORD', 'ISC_MEM_DEBUGTRACE'
and 'ISC_MEM_DEBUGUSAGE' to set the global debugging flags at any
program using the memory contexts.

9 months agoAdd and use global memory context called isc_g_mctx
Ondřej Surý [Tue, 15 Jul 2025 10:56:04 +0000 (12:56 +0200)] 
Add and use global memory context called isc_g_mctx

Instead of having individual memory contexts scattered across different
files and called different names, add a single memory context called
isc_g_mctx that replaces named_g_mctx and various other global memory
contexts in various utilities and tests.

9 months agofix: usr: Prevent spurious validation failures
Mark Andrews [Fri, 1 Aug 2025 11:17:46 +0000 (21:17 +1000)] 
fix: usr: Prevent spurious validation failures

Under rare circumstances, validation could fail if multiple clients simultaneously iterated the same set of signatures.

References #3014

Merge branch '3014-validator-c-check_signer-fails-to-call-dns_rdataset_clone' into 'main'

See merge request isc-projects/bind9!5578

9 months agovalidator.c:check_signer now clones val->sigrdataset
Mark Andrews [Wed, 17 Nov 2021 02:09:03 +0000 (13:09 +1100)] 
validator.c:check_signer now clones val->sigrdataset

Spurious validation failures were traced back to check_signer looping
over val->sigrdataset directly.  Cloning val->sigrdataset prevents
check_signer from interacting with callers that are also looping
over val->sigrdataset.

9 months agofix: dev: convert dnssec system tests to python
Evan Hunt [Thu, 31 Jul 2025 20:34:56 +0000 (20:34 +0000)] 
fix: dev: convert dnssec system tests to python

Most of the shell-based tests in the `dnssec` system test have been converted to python.  The only exceptions are the test cases that exercised the `dnssec-*` command line tools, and did not interact with a name server; those have been relocated into a new `dnssectools` system test.

Merge branch 'each-convert-dnssec-test' into 'main'

See merge request isc-projects/bind9!10688

9 months agoUse nsX fixtures rather than servers
Nicki Křížek [Fri, 25 Jul 2025 16:29:55 +0000 (18:29 +0200)] 
Use nsX fixtures rather than servers

Rather than using servers["nsX"] syntax, utilize the nsX fixtures to
make the test code a bit more concise.

See fe5534291699572e67ad4a854b412e40c524307a

9 months agoVarious TTL fixes in dnssec tests
Nicki Křížek [Fri, 25 Jul 2025 15:21:56 +0000 (17:21 +0200)] 
Various TTL fixes in dnssec tests

Make sure the various TTL checks are using a lower bound as well and use
a common TTL of 5 min.

9 months agoSplit up dnssec validation tests to multiple modules
Nicki Křížek [Fri, 25 Jul 2025 16:22:21 +0000 (18:22 +0200)] 
Split up dnssec validation tests to multiple modules

Put each config into a separate module to avoid interfering with other
tests.

9 months agoSplit up badkey tests into separate modules
Nicki Křížek [Thu, 10 Jul 2025 13:21:05 +0000 (15:21 +0200)] 
Split up badkey tests into separate modules

If nsX.reconfigure() is used in a way that might affect other tests
within the same module, it's best to split up the tests which need the
reconfig to a separate module. This ensures the reconfigure() won't
interfere with test results in case the tests are executed separately,
or in a different order.

9 months agoParametrize dnssec/tests_badkey.py tests
Nicki Křížek [Thu, 10 Jul 2025 13:16:06 +0000 (15:16 +0200)] 
Parametrize dnssec/tests_badkey.py tests

Utilize test parametrization to reduce code duplication.

9 months agotidy up the dnssec test tree
Evan Hunt [Sat, 5 Jul 2025 18:12:02 +0000 (11:12 -0700)] 
tidy up the dnssec test tree

many of the zones in the dnssec system test were identical or
had only trivial differences, and it would be easier to keep track
of them if they were sourced from template files.

also, the extra_artifacts have been simplified and restored to
the test files.