Commit graph

45309 commits

Author SHA1 Message Date
Colin Vidal
50a2fce68f remove deadcode in query_addbestns()
The local variable `zfname` was released in the cleanup part of the
function if not NULL, but it turns out it is now always NULL at that
point.

The flow can get to that part only in two cases: either `zfname` is not
NULL, and then it's ownership is moved to a different variable (thus, it
is now NULL), or `zfname` is already NULL.

Removing the bit of deadcode releasing it.
2026-04-02 11:51:12 +02:00
Michal Nowak
5eda8a2543 chg: doc: Revert "Add Sphinx 9.1.0"
This reverts commit a31a4c2d2d.

ReadTheDocs will not work with this version:

    python -m pip install -r https://gitlab.isc.org/isc-projects/bind9/-/raw/main/doc/arm/requirements.txt
    ERROR: Ignored the following yanked versions: 8.3.0
    ERROR: Ignored the following versions that require a different python version: 9.1.0 Requires-Python >=3.12; 9.1.0rc1 Requires-Python >=3.12; 9.1.0rc2 Requires-Python >=3.12
    ERROR: Could not find a version that satisfies the requirement Sphinx==9.1.0 (from versions: 0.1.61611, ..., 9.0.4)
    ERROR: No matching distribution found for Sphinx==9.1.0

Merge branch 'mnowak/revert-sphinx-9.1.0' into 'main'

See merge request isc-projects/bind9!11793
2026-04-02 11:46:44 +02:00
Michal Nowak
aef329b18d
Revert "Add Sphinx 9.1.0"
This reverts commit a31a4c2d2d.

ReadTheDocs will not work with this version:

    python -m pip install -r https://gitlab.isc.org/isc-projects/bind9/-/raw/main/doc/arm/requirements.txt
    ERROR: Ignored the following yanked versions: 8.3.0
    ERROR: Ignored the following versions that require a different python version: 9.1.0 Requires-Python >=3.12; 9.1.0rc1 Requires-Python >=3.12; 9.1.0rc2 Requires-Python >=3.12
    ERROR: Could not find a version that satisfies the requirement Sphinx==9.1.0 (from versions: 0.1.61611, ..., 9.0.4)
    ERROR: No matching distribution found for Sphinx==9.1.0
2026-04-02 11:45:46 +02:00
Michal Nowak
91d3c659d3 chg: doc: Add Sphinx 9.1.0
Update Sphinx Python package to the current version pulled in by "pip3
install sphinx_rtd_theme" run in a fresh Debian "trixie" container.

Merge branch 'mnowak/sphinx-9.1.0' into 'main'

See merge request isc-projects/bind9!11783
2026-04-02 10:35:02 +02:00
Michal Nowak
a31a4c2d2d Add Sphinx 9.1.0
Update Sphinx Python package to the current version pulled in by "pip3
install sphinx_rtd_theme" run in a fresh Debian "trixie" container.
2026-04-02 10:34:53 +02:00
Evan Hunt
08fa344014 fix: usr: Use the zone file's basename as origin in DNSSEC tools
In `dnssec-signzone` and `dnssec-verify`, when the zone origin is not specified using the `-o` parameter, the default behavior is to try to sign using the zone's file name as the origin. So, for example, `dnssec-signzone -S example.com` will work, so long as the file name matches the zone name.

This now also works if the zone is in a different directory. For example, `dnssec-signzone -S zones/example.com` will set the origin value to `example.com`.

Closes #5678

Merge branch '5678-signzone-basename' into 'main'

See merge request isc-projects/bind9!11360
2026-04-01 20:47:44 +00:00
Matthijs Mekking
1251ae896c Test dnssec tools using zone file basename as origin
Add test cases where dnssec-signzone and dnssec-verify use the
zone file's basename as the origin when '-o' is omitted.
2026-04-01 12:30:09 -07:00
Evan Hunt
b8cb65db93 use the zone file's basename as origin in dnssec tools
In dnssec-signzone and dnssec-verify, if the zone origin is not
specified using the `-o` parameter, the default behavior is to try
to use the zone's file name as the origin. So, for example,
`dnssec-signzone -S example.com` or 'dnssec-verify example.com'
will work, so long as the file name matches the zone name.

This now also works if the zone is in a different directory.
For example, `dnssec-signzone -S zones/example.com` or
'dnssec-verify zones/example.com' will set the origin value
to `example.com`.
2026-04-01 12:29:33 -07:00
Michal Nowak
22116110ff chg: ci: Drop allow_failure of cross-version-config-tests
!11446 is in the latest - 9.21.21 - release.

Merge branch 'mnowak/cross-version-config-tests-drop-allow_failure' into 'main'

See merge request isc-projects/bind9!11778
2026-04-01 18:21:41 +02:00
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