Commit graph

45323 commits

Author SHA1 Message Date
Matthijs Mekking
6c69fd16d0 Lock zone when checking for inline raw/secure
The caller is supposed to hold the zone lock for 'inline_raw()' and
'inline_secure()', but when adding 'REQUIRE(LOCKED_ZONE(zone));' to
these functions it turned out to be not always the case.
2026-04-02 15:50:09 +02:00
Matthijs Mekking
94788446db Rename private zone functions
Rename functions that are defined in the private header file to start
with 'dns__zone_'.
2026-04-02 15:50:09 +02:00
Matthijs Mekking
2893e128a7 Move zone set/get properties to own source file
In order to make zone.c more readable, we are splitting it up in
separate source files. This moves the set and get functions to its
own file ("zoneproperties.c").

Since this code accesses the zone structure directly, move the
'struct dns_zone' and its prerequisites to "zone_p.h".

The helper functions 'inline_raw()', 'inline_secure()',
'dns_zone_setview_helper()', 'zone_settimer(), 'set_resigntime()', and
'zone_freedbargs()' need to be internally accessible to both source
files.

A few set/get functions remain in zone.c for now:
- dns_zone_getserial
- dns_zone_getversion
- dns_zone_setviewcommit
- dns_zone_setviewrevert
- dns_zone_get_rpz_num
- dns_zone_set_parentcatz
- dns_zone_get_parentcatz
- dns_zone_setrawdata
- dns_zone_setskr
- dns_zone_getskrbundle
- dns_zone_setnsec3param
- dns_zone_setoption
- dns_zone_getoptions
- dns_zone_getrequesttransporttype
- dns_zone_getredirecttype
- dns__zone_getnotifyctx
- dns_zone_getgluecachestats
- dns_zone_setplugins
- dns_zone_setserial
- dns_zone_getxfr
- dns_zone_getkeystores
2026-04-02 15:50:07 +02:00
Matthijs Mekking
c56d4c13f9 fix: usr: Fix rndc modzone behavior for a zone in named.conf
If a zone was present in the configuration file and not originally added by `rndc addzone`, `rndc modzone` for that zone would succeed once but subsequent `modzone` attempts would fail. This has been fixed.

Closes #5826

Merge branch '5826-fix-subsequenrt-rndc-modzone' into 'main'

See merge request isc-projects/bind9!11744
2026-04-02 13:27:32 +00:00
Matthijs Mekking
ccb01b15e5 Also remove modded catalog zones from NZD
In the rare case where a catalog zone member is being modified with
'rndc modzone', also mark the zone as modded, so when the zone is
deleted again with 'rndc delzone', the configuration is also removed
from the NZD.
2026-04-02 12:35:54 +00:00
Matthijs Mekking
daa9e57448 Remove modified zone configuration from NZD
When a zone that is configured in named.conf is modified with
'rndc modzone', the new zone configuration is now also stored in the
NZD.

This must be removed when the zone is deleted with 'rndc delzone',
otherwise a restart will fail.
2026-04-02 12:35:54 +00:00
Matthijs Mekking
b8e16cf1cb Test restart works after rndc modzone
When a zone that is configured in named.conf is modified with
'rndc modzone', the new zone configuration is now also stored in the
NZD. Add a test to ensure that after a restart, the old zone
configuration is used.
2026-04-02 12:35:54 +00:00
Matthijs Mekking
98784ed753 Add the modified zone configuration to NZD
When a zone that is configured in named.conf is modified with
'rndc modzone', the zone configuration is deleted from the effective
config. Store the new configuration in the NZD. Mark the zone
as 'modified by rndc modzone'. Otherwise, subsequent calls to
'rndc modzone' would fail because the zone configuration cannot be
found.
2026-04-02 12:35:54 +00:00
Matthijs Mekking
e1bd1a4003 Introduce zone functions dns_zone_(get|set)modded
Introduce new functions to set and get whether the zone configuration
has been modified with 'rndc modzone'.
2026-04-02 12:35:54 +00:00
Matthijs Mekking
13414c640b Remove unused zoneconf from do_addzone
This is unused, so we can make the function call shorter.
2026-04-02 12:35:54 +00:00
JINMEI Tatuya
cbd1d71a1f Test rndc modzone succeeds twice for a zone in named.conf
If a zone is in named.conf, not originally added by rndc addzone,
rndc modzone for that zone succeeds once, but subsequent modzone
attempts fail. This is because do_modzone removes the zone config
from global or view options, but it would fail due to 'not found'
once the config is removed.

The test is copied from commit b737171ee215446701e7c8d4ac55d8a0e13426aa.
2026-04-02 12:35:54 +00:00
Colin Vidal
b8dcabbd72 fix: usr: possible crash when a resolver validate a static-stub zone
A NULL pointer dereference could be made in some circumstances when resolving and validating a name under a `static-stub` zone. This is now fixed.

Merge branch 'colin/fix-dns_view_bestzonecut-nullptrderef' into 'main'

See merge request isc-projects/bind9!11788
2026-04-02 14:16:58 +02:00
Colin Vidal
fc03a876ae fix NULL dereference in dns_view_bestzonecut()
When `dns_view_bestzonecut()` is called with a NULL `delegsetp`, it
calls `bestzonecut_zone()` with a NULL `rdataset` pointer but there is a
non-guarded de-reference of the `rdataset` pointer in
`bestzonecut_zone()`.

In practice, the only current situation where `dns_view_bestzonecut()`
is called with NULL `delegsetp` is from a case of `seek_ds()` _and_ the
non-guarded dereference occurs only if there is a static-stub local
zone matching the zonecut `seek_ds()` is looking for. It's unclear if
such flow is actually possible.

The `rdataset` is now always valid inside `dns_view_bestzonecut()`. (It
was initially set only if `delegsetp` was set to avoid extra works in
the qpzone, which can be skipped when `rdataset` is NULL, but this
doesn't really make a difference, considering we are in a slow path
considering the result wasn't found in this case.)
2026-04-02 12:16:12 +02:00
Colin Vidal
43c58dafcc fix: dev: 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.

Merge branch 'colin/fix-getbestns-deadcode' into 'main'

See merge request isc-projects/bind9!11790
2026-04-02 11:51:25 +02:00
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