Commit graph

43923 commits

Author SHA1 Message Date
Ondřej Surý
a20c8fe74b chg: dev: Add a circular reference between slabtops for type and RRSIG(type)
Previously, the slabtops for "type" and its signature was only loosely
coupled and the headers could expire at different time (both TTL and LRU
based expiry).  Add a .related member to the slabtop that allows us to
expire the headers in both related headers and also optimize the lookups
because now both slabtops are looked up at the same time.

Closes #3396

Merge branch '3396-bind-rrsigs-to-records' into 'main'

See merge request isc-projects/bind9!10985
2025-09-24 00:07:32 +02:00
Ondřej Surý
3e05958a42
Refactor find headers to make use of related
Change the code of finding headers to make use of the related circular
reference.

Co-authored-by: Matthijs Mekking <matthijs@isc.org>
2025-09-24 00:07:08 +02:00
Ondřej Surý
0f13d7f2fa
Expire related headers at the same time
Previously, the slabtops for "type" and its signature was only loosely
coupled and the headers could expire at different time (both TTL and LRU
based expiry).  This commit expires the headers in both related
headers.

Co-authored-by: Matthijs Mekking <matthijs@isc.org>
2025-09-24 00:07:07 +02:00
Ondřej Surý
0b317abe4e
Add a circular reference between slabtops for type and RRSIG(type)
Previously, the slabtops for "type" and its signature was only loosely
coupled.  Add a .related member to the slabtop that allows us to
optimize the lookups because now both slabtops are looked up at the
same time.

Co-authored-by: Matthijs Mekking <matthijs@isc.org>
2025-09-24 00:07:07 +02:00
Ondřej Surý
270f78194e
Refactor find headers
Another recurring code pattern that can be moved into a separate
function.

Co-authored-by: Matthijs Mekking <matthijs@isc.org>
2025-09-24 00:07:07 +02:00
Ondřej Surý
6b0e6cb058
Refactor check header
There was a pattern where first the header was checked for NULL
and then for being stale. In both cases the code path is the same
so it makes sense to put them in a separate function.

Co-authored-by: Matthijs Mekking <matthijs@isc.org>
2025-09-24 00:07:07 +02:00
Ondřej Surý
133d76c05e
Move the size of the expired data into expireheader
Co-authored-by: Matthijs Mekking <matthijs@isc.org>
2025-09-24 00:07:07 +02:00
Ondřej Surý
7443ff330c chg: dev: Convert slabtop and slabheader to use the cds list
This is the first MR in series that aims to reduce the node locking
by replacing the single-linked list of slabtop(s) and slabheader(s)
with CDS linked list.  This commit doesn't do anything else beyond
replacing .next and .down links with the cds_list_head.  The RCU
semantics will be added later.

Merge branch 'ondrej/use-rcu-list-for-slabtop' into 'main'

See merge request isc-projects/bind9!10944
2025-09-24 00:06:35 +02:00
Ondřej Surý
28fff0045d
Convert slabheader to use the cds_list
This is the second commit in series that aims to reduce the node locking
by replacing the single-linked list of slabheader(s) with CDS linked list.
This commit doesn't do anything else beyond replacing .next link with
the cds_list_head.  RCU semantics is going to be added in the subsequent
commits.
2025-09-23 23:18:44 +02:00
Ondřej Surý
63389b8ce6
Convert slabtop to use the cds_list
This is the first commit in series that aims to reduce the node locking
by replacing the single-linked list of slabtop(s) with CDS linked list.
This commit doesn't do anything else beyond replacing .next link with
the cds_list_head.  RCU semantics is going to be added in the subsequent
commits.
2025-09-23 11:21:47 +02:00
Ondřej Surý
2924f59cb3 fix: dev: Fix datarace between unlocking fctx lock and shuttingdown fctx
There was a data race where new fetch response could be added to the
fetch context after we unlock the fetch context and before we shut it
down.  This could cause assertion failure when fctx__done() was called
with ISC_R_SUCCESS because there was originally no fetch response, but
new fetch response without associated dataset was added before we had a
chance to shutdown the fetch context.  This manifested in the
validated() callback, where cache_rrset() now returns ISC_R_SUCCESS
instead of DNS_R_UNCHANGED when cache was not changed.  However the data
race was wrong on a general level.

Add new argument to fctx__done() that allows to call it with fctx->lock
already acquired to prevent these data races.

Closes #5507

Merge branch '5507-dont-release-fctx-lock-on-done' into 'main'

See merge request isc-projects/bind9!10961
2025-09-23 11:17:53 +02:00
Ondřej Surý
09762bdc44
Fix datarace between unlocking fctx lock and shuttingdown fctx
There was a data race where new fetch response could be added to the
fetch context after we unlock the fetch context and before we shut it
down.  This could cause assertion failure when fctx__done() was called
with ISC_R_SUCCESS because there was originally no fetch response, but
new fetch response without associated dataset was added before we had a
chance to shutdown the fetch context.  This manifested in the
validated() callback, where cache_rrset() now returns ISC_R_SUCCESS
instead of DNS_R_UNCHANGED when cache was not changed.  However the data
race was wrong on a general level.

When the fctx__done() is called with ISC_R_SUCCESS as result is expects
the fctx->lock to be already acquired to prevent these data races.
2025-09-23 10:29:27 +02:00
Ondřej Surý
1aa9cd3484
Split the fctx_done() into success and failure variants
The split will allow us to call fctx__done() with fctx->lock acquired
when it is called with ISC_R_SUCESS to prevent data races when finishing
the fetch context.
2025-09-19 10:53:29 +02:00
Michal Nowak
bed22f3acb chg: ci: Do not mangle named path in respdiff
Merge branch 'mnowak/respdiff-do-not-mangle-named-path' into 'main'

See merge request isc-projects/bind9!10855
2025-09-18 15:51:14 +02:00
Michal Nowak
287c06b8f3
Do not mangle named path in respdiff 2025-09-18 15:30:43 +02:00
Nicki Křížek
e5a417a8a6 chg: ci: Only run relevant CI jobs based on the changes
Trigger selected CI jobs on MR automatically only if there are related
code changes. Otherwise, offer an option to run the jobs manually in
MRs. For other sources, like schedules, tags etc., execute the jobs as
usual.

Merge branch 'nicki/ci-restrict-rules-changes' into 'main'

See merge request isc-projects/bind9!10987
2025-09-18 15:27:02 +02:00
Nicki Křížek
96974330d5 Run shfmt on util/check-make-install.sh.in 2025-09-18 13:55:00 +02:00
Nicki Křížek
02c58d9baa Only run relevant CI jobs based on the changes
Trigger selected CI jobs on MR automatically only if there are related
code changes. Otherwise, offer an option to run the jobs manually in
MRs. For other sources, like schedules, tags etc., execute the jobs as
usual.
2025-09-18 13:50:33 +02:00
Nicki Křížek
2d690499dd Add .sh extension to shell scripts
Use .sh(.in) file extension consistently for shell scripts
to allow more reliable detection of shell scripts based on their file
extension.
2025-09-18 13:50:33 +02:00
Colin Vidal
33bcff46d3 fix: usr: preserve cache when reload fails and reload the server again
Fixes an issue where failing to reconfigure/reload the server would prevent to preserved the views caches on the subsequent server reconfiguration/reload.

Closes #5523

Merge branch 'colin/fix-cache-revert' into 'main'

See merge request isc-projects/bind9!10984
2025-09-17 17:38:54 +02:00
Colin Vidal
a1703fa35b preserve cache when reload fails
If the server is reloaded, new views are created and preexisting cache
is attached to those _but_ something goes wrong later, the previous
views are restored but the previous cache list is destroyed. This makes
the subsequent reload to drop the existing cache. This fixes it by
avoiding a mutation of the old cache list.
2025-09-17 16:45:51 +02:00
Colin Vidal
714693742e test that cache is preserved on reconfing failure
A named bug scrap the cache on a second reload after an initial reload
failure. Adds a test checking that the cache is preserved between server
reconfiguration/reloads even if it fails at some point (after attempting
to re-use the cache) and the server is re-loaded later.
2025-09-17 16:45:51 +02:00
Ondřej Surý
22803b93e3 chg: dev: Squash the qpcache tree and nsec tries
The dns_qpcache already had all the namespace changes needed to put the
normal data and auxiliary NSEC data into a single tree.  Remove the
extra nsec QP trie and use the single QP trie for all the cache data.

Merge branch 'ondrej/use-qp-namespace-in-cache' into 'main'

See merge request isc-projects/bind9!10975
2025-09-17 15:59:13 +02:00
Ondřej Surý
cdc6950d04
Add more unit tests for dns_qp unit
Add basic unit tests and add missing DbC checks for mandatory
dns_qp_create() arguments.
2025-09-17 15:58:44 +02:00
Ondřej Surý
9e2d5d94bd
Remove dns_dbtree_t and its usage
As we removed the ability to count nodes in the auxiliary trees (because
there are no auxiliary trees), we can also cleanup the API and
associated enum type (dns_dbtree_t).
2025-09-17 15:58:44 +02:00
Ondřej Surý
a3e96f2d49
Squash the qpcache tree and nsec trees
The dns_qpcache already had all the namespace changes needed to put the
normal data and auxiliary NSEC data into a single tree.  Remove the
extra nsec QP trie and use the single QP trie for all the cache data.
2025-09-17 15:58:44 +02:00
Ondřej Surý
ec0a5f3a9d
Remove the dbiterator_{last,prev} from the qpcache
The dbiterator_{last,prev} functions are not used in the cache, and the
implementation would get quite complicated when we squash the main and
nsec trees together.  It's easier to just not implement these.
2025-09-17 15:58:44 +02:00
Ondřej Surý
70c8054b84
Remove CacheNSECNodes statistics counter
There is no auxiliary NSEC tree, so we can't count the NSEC nodes
separately.  Remove the CacheNSECNodes statistics counter as it would be
always zero.
2025-09-17 15:58:44 +02:00
Petr Špaček
f3032ecd85 chg: test: Improve root zone loading into AsyncServer
Merge branch 'pspacek/test-server-root' into 'main'

See merge request isc-projects/bind9!10981
2025-09-17 13:22:15 +00:00
Petr Špaček
339e5162d6 Add ability to load root zone into AsyncServer
We would prefer if explicit $ORIGIN is used only for root zone and
nothing else, solely to avoid zone files named "..db". For all other
zones the file name should match zone name.
2025-09-17 15:20:22 +02:00
Ondřej Surý
3b6fe27455 fix: nil: Small qpcache and qpzone related fixes
Merge branch 'ondrej/little-fixups-in-qp' into 'main'

See merge request isc-projects/bind9!10970
2025-09-16 18:49:30 +02:00
Ondřej Surý
136fddf538
Use result of first_*_header() calls instead of direct value
Fix places where we got the header by calling first_*_header() function,
but then worked with top->header instead of the result.
2025-09-16 18:47:53 +02:00
Ondřej Surý
fa12ba28ce
Fix up the descriptions in rdataslab.h
There were a lot of outdated comments. They've been updated or removed.
2025-09-16 18:47:53 +02:00
Ondřej Surý
63ed3cd0bd fix: nil: Fix dns_qpmulti_memusage() on empty dns_qpmulti_t instance
The dns_qpmulti_memusage() causes assertion failure when called on
freshly created qpmulti instance because the qp->usage hasn't been
allocated yet.

Merge branch 'ondrej/fix-qpmulti_memusage' into 'main'

See merge request isc-projects/bind9!10977
2025-09-16 16:43:46 +02:00
Ondřej Surý
b2f653b332
Fix dns_qpmulti_memusage() on empty dns_qpmulti_t instance
The dns_qpmulti_memusage() causes assertion failure when called on
freshly created qpmulti instance because the qp->usage hasn't been
allocated yet.
2025-09-16 16:30:15 +02:00
Colin Vidal
722ce92f10 chg: dev: simplify nchildren count in isc_nm_listenudp
Slight simplification of the logic to define .nchildren listening UDP
socket.

Merge branch 'colin/simplify-socket-nchildren-count' into 'main'

See merge request isc-projects/bind9!10978
2025-09-16 15:49:49 +02:00
Colin Vidal
2cbe958df6 simplify nchildren count in isc_nm_listenudp
Slight simplification of the logic to define .nchildren listening UDP
socket.
2025-09-16 14:22:15 +02:00
Mark Andrews
f2f2488bbe fix: usr: Add chroot check to meson.build
The meson build procedure was not checking for the existence of
the chroot function.  This has been fixed.

Closes #5519

Merge branch '5519-add-chroot-check-to-meson-build' into 'main'

See merge request isc-projects/bind9!10973
2025-09-16 22:06:46 +10:00
Mark Andrews
574d3147d5 Check if chroot exists 2025-09-16 20:44:44 +10:00
Colin Vidal
96855b5449 rem: dev: remove orphan dns_loadmgr_t type
dns_loadmgr_t typedef is declared but never defines as well as a pointer
of this type in named_server_t. Removing it.

Merge branch 'colin/removednsloadmgr' into 'main'

See merge request isc-projects/bind9!10974
2025-09-15 22:39:14 +02:00
Colin Vidal
c16e944b3c remove orphan dns_loadmgr_t type
dns_loadmgr_t typedef is declared but never defines as well as a pointer
of this type in named_server_t. Removing it.
2025-09-15 22:03:11 +02:00
Evan Hunt
29fc7850f1 fix: dev: clean up the dns_db API
Some of the API calls in `dns_db` were obsolete, and have been removed. Others were more complicated than necessary, and have been refactored to simplify.

Merge branch 'each-cleanup-db-api' into 'main'

See merge request isc-projects/bind9!10830
2025-09-15 16:11:59 +00:00
Evan Hunt
4122143c4d remove dns_db_{un,}locknode
remove the dns_db_locknode() and _unlocknode() calls, so that callers no
longer have the ability to directly manipulate the internal locking of
cache and zone databases.
2025-09-15 16:11:50 +00:00
Evan Hunt
17101fa491 make getoriginnode implementation optional
if the dns_db_getoriginnode() call is not implemented, we can
fall back to running dns_db_findnode() on the database origin.
we now only implement getoriginnode directly in databases where
it's clearly faster than the fallback implementation would be.
2025-09-15 16:11:50 +00:00
Evan Hunt
7a5344d591 minor cleanup in sdlz.c
dns_db_issecure() and dns_db_nodecount() return false and 0,
respectively, if they are not implemented, so there's no need to
have implementation functions that only return false and 0.
2025-09-15 16:11:50 +00:00
Evan Hunt
b2009e1ebc remove unnecessary dns_db_nodefullname()
now that node->name is accessible as a common dbnode member,
it's no longer necessary to provide an API call for that.
2025-09-15 16:11:50 +00:00
Evan Hunt
18db48eb2c remove node lock for settrust and clearprefetch
dns_rdataset_clearprefetch() performs an atomic operation,
so it didn't actually need to lock the database node.

dns_rdataset_settrust() updates header->trust; this is also
now atomic, so it doesn't need to lock the node now either.
2025-09-15 16:11:50 +00:00
Evan Hunt
4de396f955 merge dns_db_find/findext and dns_db_findnode/findnodeext
the dns_db_findext and _findnodeext calls are extended versions
of dns_db_find and _findnode, which take additional arguments for
client information in order to support ECS. previously, database
implementations could support either API call, with cross-compatibility
so that, for example, dns_db_findext() could call a find implementation
if findext was not implemented, and dns_db_find() could call findext
if find was not implemented.

this has now been simplified. the find and findnodeext implementations
now support client info.  all database implementations will now provide
these calls.  implementations which do not support ECS will simply
ignore the clientinfo and clientinfomethods parameters.

this only affects the underlying implementation; callers will still
use the same interface. dns_db_find() and dns_db_findnode() are now
macros which pass NULL to the clientinfo parameters, so that callers
don't have to do so explicitly. dns_db_findext() and dns_db_findnodeext()
are still available for callers that do wish to pass clientinfo pointers.
2025-09-15 16:11:50 +00:00
Evan Hunt
9e14fcd259 remove obsolete dns_db_hashsize()
this function's purpose was to populate the "CacheBuckets" statistic,
but there are no databases left that implemented it, so the return
value was always 0. "CacheBuckets" has now been removed from the
statistics, and the dns_db_hashsize() API call has been removed.
2025-09-15 16:11:50 +00:00
Evan Hunt
0222c385aa dns_rdatalist functions are not for general use
the rdataset method implementation functions in dns/rdatalist.c (i.e.,
dns_rdatalist_first, _next, etc) are not meant to be called directly;
they're called via dns_rdataset_first(), dns_rdataset_next(), etc.

in dnssec-ksr.c, a list-based rdataset was iterated using these
functions. this has been fixed, and the functions have been renamed
to use the `dns__` prefix as a signal that they aren't meant to be
used outside the rdataset implementation.
2025-09-15 16:11:50 +00:00