Commit graph

45300 commits

Author SHA1 Message Date
Michal Nowak
9357fb2bdc
Drop allow_failure of cross-version-config-tests
GL!11446 is in the latest - 9.21.21 - release.
2026-04-01 17:56:44 +02:00
Michal Nowak
f882d88c3c Merge tag 'v9.21.21' 2026-04-01 14:55:09 +00:00
Ondřej Surý
6b6913c83b chg: usr: Implement RFC 3645 Section 4.1.1 key expiry check in TKEY
Check for existing TSIG keys before accepting a new
GSS-API negotiation and delete the key if it has expired.
Previously, an expired GSS key would permanently block
re-negotiation for that name until the server was restarted.

Merge branch 'ondrej/cleanup-gssapi-and-tkey-api' into 'main'

See merge request isc-projects/bind9!11713
2026-04-01 09:38:55 +02:00
Ondřej Surý
80654250ee
Add regression test for RFC 3645 Section 4.1.1 duplicate TKEY name
Add 'tkeyname' command to nsupdate to allow specifying a fixed TKEY
name instead of the default random one.  This is used by the test to
send two GSS-API TKEY negotiations with the same name.

After a successful GSS-API TKEY negotiation via nsupdate -g, a second
attempt with the same TKEY name must be rejected with BADKEY
(error=17), not BADNAME (error=20).
2026-04-01 07:04:40 +02:00
Ondřej Surý
c0a6f3bf65
Fix GSS context leak on error paths in process_gsstkey()
After gss_accept_sec_context() succeeds, the GSS context is passed
to dst_key_fromgssapi() which transfers ownership to the dst_key.
If a subsequent operation fails (dst_key_fromgssapi itself,
dns_tsigkey_createfromkey, or dns_tsigkeyring_add), the cleanup
label frees the dst_key but only if it was created.  If the failure
happened before dst_key_fromgssapi, the GSS context was orphaned.

Delete the GSS context in the cleanup path when it was not
transferred to a dst_key.
2026-04-01 07:04:40 +02:00
Ondřej Surý
5305679633
Fix GSS context leak when principal name is empty
When gss_accept_sec_context() completes successfully but
gss_display_name() returns an empty principal, the GSS context
was leaked — it was neither stored in a key nor deleted.

Delete the context and reject with BADKEY in this case.  This
should only occur due to a GSS library bug, since a completed
context should always have a valid principal.
2026-04-01 07:04:39 +02:00
Ondřej Surý
8c1fe179e3
Fix off-by-one in TSIG generated key eviction
Use pre-increment (++ring->generated) instead of post-increment
(ring->generated++) so the comparison against DNS_TSIG_MAXGENERATEDKEYS
happens after counting the new key.  With post-increment, one extra key
beyond the limit was allowed before eviction kicked in.
2026-04-01 07:04:39 +02:00
Ondřej Surý
5e10fdc295
Implement RFC 3645 Section 4.1.1 key expiry check in TKEY
Check for existing non-expired TSIG keys before accepting a new
GSS-API negotiation.  Per RFC 3645 Section 4.1.1:

- If a key exists and has not expired, reject with BADNAME
- If a key exists but has expired, delete it and start fresh

Previously, an expired GSS key would permanently block
re-negotiation for that name until the server was restarted.

Use BADKEY rather than BADNAME to avoid creating an oracle for
key name enumeration by unauthenticated attackers.
2026-04-01 07:04:39 +02:00
Michal Nowak
ec2e1ce35a
Update BIND version for release 2026-03-31 18:30:02 +02:00
Michal Nowak
8e3e3e7194
Remove changelog for GL #5747 2026-03-31 18:21:33 +02:00
Nicki Křížek
443b73b565 rem: nil: Remove license headers from test configs and zones
Related !11766

Merge branch 'nicki/remove-license-headers-from-test-data' into 'main'

See merge request isc-projects/bind9!11767
2026-03-31 17:58:40 +02:00
Nicki Křížek
13273f6ebb License *.conf* files in REUSE.toml 2026-03-31 17:57:58 +02:00
Nicki Křížek
f144db6b68 Remove license headers from test zone files
The removal has been done with the following command:

find bin/tests/system/ -type f -name "*.db*" -exec sed -i '1,10d; 11{/^$/d}' {} +

The following files have been handled manually, since they already
didn't have the license info, or had it in a slightly different format:

bin/tests/system/ssutoctou/ns1/example.db.in
bin/tests/system/checkzone/zones/crashzone.db
bin/tests/system/checkzone/zones/warn.deprecated.cds-sha1.db
bin/tests/system/checkzone/zones/warn.deprecated.digest-sha1.db
bin/tests/system/checkzone/zones/warn.deprecated.ds-alg.db
bin/tests/system/legacy/ns6/edns512.db.signed
2026-03-31 17:57:58 +02:00
Nicki Křížek
d738b907dc Remove license headers from named.conf test files
The removal was done with the following commands:

find bin/tests/system/ -type f -name "*.conf" -exec sed -i '1,12d; 13{/^$/d}' {} +
find bin/tests/system/ -type f -name "*.conf.*" -exec sed -i '1,12d; 13{/^$/d}' {} +
2026-03-31 17:57:58 +02:00
Michal Nowak
fb7a4919cf new: doc: Prepare documentation for BIND 9.21.21
I asked Claude to prepare the "Tweak and reword release notes" (663dba18f3015aefe178ba8b4790c7180f943c74) commit with the following guidance:
> add RST markup to @doc/notes/notes-9.21.21.rst. possible RST markups are to be found in @doc/arm/. if in doubt look at previous release notes in @doc/notes/. while at it, fix grammar and make sure the text is aligned to max 72 characters.

It did better that I'd do.

Merge branch 'mnowak/prepare-documentation-for-bind-9.21.21' into 'v9.21.21-release'

See merge request isc-private/bind9!970
2026-03-31 17:36:38 +02:00
Alessio Podda
a743ff1e44 chg: dev: Add a refcount to the vecheaders
This MR changes the way the ownership of the vecheaders is tracked. Before this MR, the ownership of the vecheader was implicitely tracked through a mix of the refcount on the node owning the header, the external refcount of the same node and the version. This has some adverse consequences in terms of contention, such as that querying A and AAAA glue hits the same refcount.

This MR adds a refcount to the vecheader itself, allowing it to exist independently of the node it is contained in. On its own, this would create a cycle, where the node has a reference to the header, which has a reference to the heap, which in turn has a reference to the node.

To break this cycle, this MR also moves from an "intrusive" heap, to a more traditional one where pointers to the node and vecheader in the heap are stored in a hashmap.

Merge branch 'alessio/vecheader-refs' into 'main'

See merge request isc-projects/bind9!11397
2026-03-31 15:17:43 +00:00
Michal Nowak
cac569a1af
Remove release note for GL #5747
This has been reverted.
2026-03-31 16:52:31 +02:00
Michal Nowak
ce291c4421
Tweak and reword release notes 2026-03-31 16:52:31 +02:00
Alessio Podda
9fe3809ccf Fix benign race condition
The dns_rdatavec_subtractrdataset function would copy the old header
using memmove but the old header includes fields such as trust and
reference counts that are atomic.

While the values of those fields were never used, it did cause a benign
race condition. This commit refactors dns_rdatavec_subtractrdataset and
dns_rdatavec_merge not to use memmove.
2026-03-31 16:25:33 +02:00
Alessio Podda
6202492509 Remove node and db pointer from dns_rdataset_t.vec
Now that we track the references at the vecheader level, binding an
rdataset is no longer guaranteed to keep its node alive. Therefore
remove the node pointer from the rdataset, and instead decide whether
glue is required by explicitely passing the owner name to addglue.
2026-03-31 16:22:56 +02:00
Alessio Podda
3521900ecd Add hashmap to qpz_heap
This commit adds a level of indirection to the signing operations.
Instead of being intrusive, the qpz_heap will keep track of which
headers must be resigned through a hashmap.
The intent is to make dns_vecheader_t entirely self-contained. In
particular, the ownership structure between the heap and the headers is
flipped. Before, the headers would "own" the heap, now the heap owns
the header.
2026-03-31 16:22:56 +02:00
Alessio Podda
1aa0768151 Refactor setsigningtime
Change setsigningtime to take the node of the header being changed.
Done to facilitate further refactoring that will remove the header
pointer from vecheader.
2026-03-31 16:22:56 +02:00
Alessio Podda
0683d76025 Extract heap deregistration
This commit changes the deregistration of vecheaders from the heap to
go through a private api instead of the dyndb public one. This is safe
since vecheader is only used by qpzone.

This is done in order to facilitate further refactoring.
2026-03-31 16:22:56 +02:00
Nicki Křížek
f6e9998c3c chg: nil: License test data files in REUSE.toml
In order to avoid the need to repeat the license header in named.conf
files and zone files, add the paths to REUSE.toml to assign the license.

Merge branch 'nicki/reuse-cover-configs-and-zones' into 'main'

See merge request isc-projects/bind9!11766
2026-03-31 15:58:56 +02:00
Nicki Křížek
2390bd3a8f Remove license header files from _common test files
These are either config file or zone file snippets. Their license is
declared in REUSE.toml.
2026-03-31 15:14:33 +02:00
Nicki Křížek
ef57bd3a02 License test data files in REUSE.toml
In order to avoid the need to repeat the license header in named.conf
files and zone files, add the paths to REUSE.toml to assign the license.

All shared snippets in bin/tests/system/_common and
bin/tests/system/**named.conf* files are covered.

Note that the existing rule **/**.db** already covers zone files. Only
remove the extraneous special-cases.
2026-03-31 15:14:33 +02:00
Aydın Mercan
f27aba4d7d fix: dev: include <sys/endian.h> according by checking in meson
The <sys/endian.h> header has existed in macOS since around ~26. This
causes the `htobeNN`/`htoleNN` macros to be redefined in <isc/endian.h>
in terms of <libkern/OSByteOrder.h> when other system headers include
<sys/endian.h>.

Fix this issue by using checking for the existence of <sys/endian.h> in
meson and including it according to the probe result.

Merge branch 'aydin/isc-endian-macos-fix' into 'main'

See merge request isc-projects/bind9!11751
2026-03-31 16:07:05 +03:00
Aydın Mercan
2a62cd449f
include <sys/endian.h> according by checking in meson
The <sys/endian.h> header has existed in macOS since around ~26. This
causes the `htobeNN`/`htoleNN` macros to be redefined in <isc/endian.h>
in terms of <libkern/OSByteOrder.h> when other system headers include
<sys/endian.h>.

Fix this issue by using checking for the existence of <sys/endian.h> in
meson and including it according to the probe result.
2026-03-31 16:06:37 +03:00
Michal Nowak
e438401b8c
Prepare release notes for BIND 9.21.21 2026-03-31 11:31:22 +02:00
Michal Nowak
4709d1dc32
Generate changelog for BIND 9.21.21 2026-03-31 11:29:32 +02:00
Michal Nowak
c58d3d0318 chg: doc: Set up version for BIND 9.21.22
Merge branch 'mnowak/set-up-version-for-bind-9.21.22' into 'main'

See merge request isc-projects/bind9!11770
2026-03-31 10:16:09 +02:00
Michal Nowak
3155ccce2b Update BIND version to 9.21.22-dev 2026-03-31 10:13:13 +02:00
Ondřej Surý
8721a89b64 chg: usr: Switch to LRU-only cache eviction, enforce minimum cache size
Busy resolvers will now gradually fill the configured :any:max-cache-size
before entries start being evicted. Previously, expired records were
proactively removed based on their TTL, which kept memory usage below the
configured limit but added overhead. Cache eviction now relies solely on the
SIEVE-LRU mechanism, which has matured to the point where TTL-based cleaning
is no longer necessary.

Setting :any:max-cache-size to unlimited or 0 is no longer supported
and falls back to the default (90% of physical memory).

Merge branch 'ondrej/no-ttl-based-cleaning' into 'main'

See merge request isc-projects/bind9!11459
2026-03-30 22:29:17 +02:00
Ondřej Surý
9e40f6508c Remove the dead dns_expire_ttl code path and deletettl stats counter
Now that TTL-based cleaning has been removed, the dns_expire_ttl enum
value, its switch case in expireheader(), and the deletettl stats counter
(text, XML, JSON) are all dead code.  Remove them so the stats channel
no longer reports a permanently-zero counter.
2026-03-30 21:46:44 +02:00
Ondřej Surý
03ff80a1f7 Move ADB TTL-based cleanup into dump_adb()
Instead of doing a full sweep of all names and entries before dumping,
expire stale entries lazily as they are encountered during the dump
iteration.  This aligns with the QPcache approach of avoiding separate
TTL-based cleaning passes.

dns_adb_flush() retains its explicit full sweep since it needs to
force-expire everything.
2026-03-30 21:46:44 +02:00
Ondřej Surý
dc9564f14d Raise the minimum cache size to 8 MB, warn below 256 MB
Lower the hard floor for max-cache-size from 2 MB to 8 MB to support
resource-constrained environments (e.g. CPE devices) while remaining
safe for LRU-only eviction.
2026-03-30 21:46:44 +02:00
Ondřej Surý
6fa415f71f Refactor the 'max-cache-size' configuration handling
Extract the inline max-cache-size logic from configure_view() into
reusable helpers: configure_max_cache_size(), default_max_cache_size(),
max_cache_size_as_percent(), and sanitized_max_cache_size().

Move DNS_CACHE_MINSIZE and DNS_ADB_MINADBSIZE to public headers and
remove the SIZE_AS_PERCENT sentinel.
2026-03-30 21:46:44 +02:00
Ondřej Surý
d7c99c14fc Remove 'unlimited' setting for the max-cache-size
Since TTL-based cache cleaning has been removed, an unlimited
max-cache-size would eventually exhaust system memory.

Both 'max-cache-size unlimited;' and 'max-cache-size 0;' now fall
back to the default value (90% of physical memory for recursive
views).
2026-03-30 21:46:44 +02:00
Ondřej Surý
4891a6b14f Remove the heap memory context from QPcache
The heaps have been removed, so the separate heap memory context
(hmctx) is no longer needed.  Remove it from both dns_cache and
dns_qpcache, along with the HeapMemInUse statistics.
2026-03-30 21:46:44 +02:00
Ondřej Surý
602f5b73e6 Remove TTL-based cleaning from the QPcache
The experiments show that the SIEVE-LRU based mechanism is good enough
as the only mechanism for cleaning up the expired entries from the
cache.

This simplifies the internal logic and memory usage of the cache.

The disadvantage is that the cache use will organically grow until it
hits the overmem cleaning mechanism.

The advantage is that the measurements show that BIND 9 is well behaved
even with 512 MB cache under heavy load.
2026-03-30 21:46:44 +02:00
Ondřej Surý
08a33a9cc9 Remove useless .expire initialization from rdataslab
dns_rdataslab_fromrdataset() set .expire to rdataset->ttl, but the
only consumer (qpcache_addrdataset) immediately overwrote it with
now + rdataset->ttl.  Remove the redundant initialization and set the
expire time only once.
2026-03-30 21:46:44 +02:00
Colin Vidal
e3b60291aa chg: usr: Parent-centric resolver
The `named` resolver now uses a separate "delegation database" to store zone referral data instead of the DNS cache. This new database holds the NS RRset on the parent side of a zone cut, as well as necessary glue records that were included in the referral. The NS RRset from the child side is cached in the DNS cache and is not used for name resolution.

This will be a step toward simplifying resolver logic and also supporting DELEG referrals.

Closes #3311

Merge branch 'colin/deleg-resolver' into 'main'

See merge request isc-projects/bind9!11621
2026-03-30 21:45:03 +02:00
Colin Vidal
d313d9d7e7 resolver tests: set 3MB cache size
The default max-cache-size on the system test being enforced to 2MB
(from the -T switch). It means the main cache size is 6/8 of it (1/8
being reserved for ADB and 1/8 for the delegation database).

However, the minimal cache size of the main cache is 2MB, which means
that the main cache size will actually be 2MB anyway when running the system tests.

This was breaking some resolver tests were failing because when the
cache was shared and named reload, the previous cache size was, indeed,
2MB whereas the newly requested size only 6/8 of it (that happened
before the size is bumped to the minimal value).

Set the ns1 of resolver tests max cache size of 3MB, so even 6/8 of the
max cache size is more than the minimum 2MB of the main cache size,
which enable to keep the shared cached between views for this test
between reloads.
2026-03-30 20:41:13 +02:00
Colin Vidal
c64ac308eb cache memory adjustements
The delegation DB now uses the same amount of memory than ADB, which is
1/8 of the `max-cache-size`.

The main cache database, instead of using `max-cache-size`, now use the
"remaining" part of it, after the delegation DB and ADB took their part,
so 6/8.

This avoid blowing up the host memory, typically when specifying
`max-cache-size 95%`, as the global cache usage would go way ahead 100%.
2026-03-30 20:41:13 +02:00
Colin Vidal
b5c0b32b69 Add RPZ NSDNAME test
Add a simple case (i.e. not relying on zone being generated during the
test) ensuring that RPZ NSDNAME rules are correctly applied using the
parent-centric resolver.
2026-03-30 20:41:13 +02:00
Colin Vidal
ea2cb4e9df test for auth+res server and glues in delegation
When a resolver+auth server has a delegation on a local zone and has a
glue, the glue can only be for in-domain NS.

In this case, when the resolver is looking at the zonecut,
`dns_view_bestzonecut()` synthesizes a delegset from an NS rdataset
found in the local zone (the delegation inside auth zone), and ignores
the glues if any.

As a result, the delegset will contain a single delegation of type
DNS_DELEGTYPE_NS_NAMES, which leads to an ADB fetch. But it's actually an
in-memory fetch, because in this case, the fetch will immediately find
the A/AAAA glues from the local zone.

An alternative approach (not chosen here) would be to make
`dns_view_bestzonecut()`, when converting an NS rdataset into a
`dns_deleg_t`, check for glues for the delegation in the auth zone, and
add those in the `dns_deleg_t`. The delegation would be of type
DNS_DELEGTYPE_NS_GLUES which would avoid the ADB name lookup.

However, that's extra code, extra logic and complexities, for a lookup
that will be done in memory anyway, just a bit later. So for now, this
is not implemented that way.

The test is added, however, to confirm that there is no attempt from the
resolver to get the NS fron the child zone.
2026-03-30 20:41:13 +02:00
Evan Hunt
dc6202479f remove find_deepest_zonecut() from qpcache
because the cache no longer stores delegation (parent-side) NS rrsets,
and authoritative (child-side) NS rrsets don't affect recursion,
it no longer makes sense for qpcache_find() to look for NS rrsets
and return DNS_R_DELEGATION. that code has been removed.

the cache still does search for covering DNAME records. the
check_zonecut() function has been renamed to check_dname() for clarity.

related changes:
- one test case has been removed from the mirror system test, because it
  tested the behavior of a cached delegation.
- query_checkrrl() and rpz_rrset_find() have been updated so they no
  longer expect cache responses to have DNS_R_DELEGATION response codes.
2026-03-30 20:41:13 +02:00
Colin Vidal
f20a612ae7 system test for rndc dumpdb -cache and reload
Add system test which check the behavior of `rndc dumpdb -cache` as well
as the preservation of the delegation cache on server reload.
2026-03-30 20:41:13 +02:00
Colin Vidal
43a9bce3c1 Dump delegation database in 'rndc dumpdb'
When dumping the cache, include the contents of the delegation
database. Add a new 'rndc dumpdb -deleg' option, which dumps
the delegation database exclusively.

While the delegation database dumping format mimic the zone file format,
the API does not use the `dns_master_style_t` configuration (i.e. to
specify how many spaces/tab are used between each RR fields), because
the generic API handling this relies on databse using `dns_rdataset_t`
as internal storage format. This can be improved later.
2026-03-30 20:41:13 +02:00
Evan Hunt
d2286d2633 prevent early termination of rpzrecurse test
add "|| ret=1" after calls to dig, so that dig failures won't
stop the test due to "set -e".
2026-03-30 20:41:13 +02:00