Commit graph

44367 commits

Author SHA1 Message Date
Michal Nowak
e49ec0a71f chg: test: Disable 'doh' unit test on Enterprise Linux 8
Disable test that fails for months on this platform.

Closes #5448

Merge branch '5448-disable-doh-unit-test-on-el8' into 'main'

See merge request isc-projects/bind9!11276
2025-11-25 13:29:26 +01:00
Michal Nowak
1684556577
Disable 'doh' unit test on Enterprise Linux 8
Disable test that fails for months on this platform.
2025-11-25 10:55:03 +01:00
Mark Andrews
8d9d25f6d4 fix: nil: Restore recording ns_statscounter_edns0out
Change d5e4684b3d accidentally caused
ns_statscounter_edns0out to no longer be incremented.  This has been
corrected.

Closes #5654

Merge branch '5654-restore-recording-ns_statscounter_edns0out' into 'main'

See merge request isc-projects/bind9!11267
2025-11-25 15:05:11 +11:00
Mark Andrews
98e4204db9 Check nsstats statistics in bind9.xml 2025-11-25 13:26:50 +11:00
Mark Andrews
f0f0728989 Restore recording ns_statscounter_edns0out
Change d5e4684b accidentally caused ns_statscounter_edns0out to no
longer be incremented.  This has been corrected.
2025-11-25 13:26:50 +11:00
Matthijs Mekking
ddd1040761 fix: usr: Fix bug where zone switches from NSEC3 to NSEC after retransfer
When a zone is re-transferred, but the zone journal on an inline-signing secondary is out of sync, the zone could fall back to using NSEC records instead of NSEC3. This has been fixed.

Closes #5527

Merge branch '5527-retransfer-nsec3-bug' into 'main'

See merge request isc-projects/bind9!11226
2025-11-24 13:23:21 +00:00
Matthijs Mekking
6dcb9ce77f Skip private records when syncing secure db
When synchronizing the secure database, we skip DNSSEC records that
BIND 9 maintains with inline-signing. We should also skip private
RDATA type records that are used to track the current state of a
zone-signing process.
2025-11-24 10:21:33 +01:00
Matthijs Mekking
be3e4c83d0 Test retransfer with NSEC3 policy
If the primary has been updated, but the secondary has not been
notified, the journal will go out of date. An 'rndc retransfer' causes
the zone to force an AXFR, removing and rebuilding zone and journal
files.

This test reproduces a bug that in such scenario, an NSEC3 signed zone
falls back to NSEC.
2025-11-24 10:21:33 +01:00
Colin Vidal
376313c8dc fix: nil: Do not log no root hints of _bind chaos view
The "no root hints for view X" message must not be shown for the default
_bind/CH view. However, it is shown since 27c4f68dcc (part of effective
configuration changes).

The reason is that since 27c4f68dcc, `configure_views()` now processes
a single list of views, which contains both builtin and user views as
they are both part of the effective configuration. The changes omit the
(now removed, since 6b5f714e53) `need_hints` bool that was disabling the
warning for the builtin view (_bind/CH).

This disable that log again when configuring _bind/CH view.

Merge branch 'colin/nohintswarn-bindchaos' into 'main'

See merge request isc-projects/bind9!11264
2025-11-22 04:51:30 +01:00
Colin Vidal
68fda6a035 do not log "no root hints for view '_bind'"
The "no root hints for view X" message must not be shown for the default
_bind/CH view. However, it is shown since 27c4f68dcc (part of effective
configuration changes).

The reason is that since 27c4f68dcc, `configure_views()` now processes
a single list of views, which contains both builtin and user views as
they are both part of the effective configuration. Those changes omitted
the `need_hints` bool that disabled the warning for the builtin view.
This commit silences the log message again.
2025-11-21 14:21:44 -08:00
Evan Hunt
b4d638473e chg: dev: add dns_message functions to set EDNS options
The new `dns_message_ednsinit()` and `dns_message_ednsaddopt()` functions
allow EDNS options to be added to a message one at a time; it is no
longer necessary to construct a full array of EDNS options and set
them all at once.

This allows us to simplify EDNS option handling code, and in the
future it wlil allow plugins to add EDNS options to existing
messages.

Merge branch 'each-refactor-message-edns' into 'main'

See merge request isc-projects/bind9!11261
2025-11-21 21:18:25 +00:00
Evan Hunt
d5e4684b3d remove dns_message_buildopt
now that the EDNS state is stored within dns_message_t, it's no longer
necessary to have a public API call to build an opt rdataset; we can
just have dns_message_setopt() build the opt record internally.
2025-11-21 11:13:21 -08:00
Evan Hunt
2d3439ee02 add dns_message API to add EDNS options
The new dns_message_ednsinit() and dns_message_ednsaddopt() functions
allow EDNS options to be added to a message one at a time; it is no
longer necessary to construct a full array of EDNS options and set
them all at once.

This allows us to simplify EDNS option handling code, and in the
future it wlil allow plugins to add EDNS options to existing
messages.
2025-11-21 11:13:18 -08:00
Matthijs Mekking
8750a685f9 chg: test: Rewrite nsec3 system test to pytest
Merge branch 'matthijs-pytestify-nsec3' into 'main'

See merge request isc-projects/bind9!11030
2025-11-21 14:03:05 +00:00
Matthijs Mekking
ba211de912 Wait longer before keymgr is done
To check if the key managing for a zone is done, we check a log message.
On some machines, with many zones this may take some time.

Increate the timeout to a minute. Note that most zones will continue
their test case much faster, but with many zones there may be some
straggling.
2025-11-21 14:20:58 +01:00
Matthijs Mekking
8cfccb9eac Wait until zones are signed before reconfig
In order to make the tests run reliable, first make sure the key
managing for all the zones has finished before doing running the
reconfig command.
2025-11-21 14:20:58 +01:00
Nicki Křížek
66e4146a88 Only render required zones in config for nsec3 tests
When all zones are configured, regardless of whether the test module
actually uses them, it makes debugging the logs needlessly more
complicated, as there is a bunch of stuff going on that is completely
unrelated to the test.

Define a list of tested zones in each test module and only render the
named.conf with those zones defined.
2025-11-21 14:20:58 +01:00
Matthijs Mekking
9ee62467a6 Move nsec3-change.kasp test to separate module
This zone has a specific corner case to be tested during the setup.
Move it to a separate module so it is less convoluted.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
7762b2391e Move check_nsec3_case to common code
With the nsec and nsec3 test cases being nearly identical for all
modules, these can be be unified and moved to common.py.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
29816eb621 Clean up shell tests remnants
Now that all tests are covered by pytest, we can remove the remnants
of the shell test script.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
3f5d295e29 Rewrite nsec3 system test to pytest (4/4)
Convert the final nsec3 system test case that deals with empty
non-terminals. This is a regression test case for GL #5108.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
f98f6ee3d6 Rewrite nsec3 system test to pytest (3/4)
This converts two test cases:

1. A zone that previously failed to load is now fixed. Make sure the
   zone is signed correctly with the right NSEC3 parameters.

2. Test case to ensure the salt is the same after a restart, i.e. no
   re-salting takes place. Previously we only tested with salt length
   0, this commit adds a test case for salt length 8 as well.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
2c7190609b Rewrite nsec3 system test to pytest (2/4)
This converts the nsec3 system test cases after to reconfiguring the
name server.

Two extra test for nsec3-change.kasp is updated. It depends on the
zone being updated, and a reconfig. This test code is moved to
tests_nsec3_reconfig.py.

Furthermore, an additional 'rndc signing -nsec3param' error test
case has been added.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
ba1ffe56e4 Improve check_auth_nsec3 salt checking
Since we know the salt after checking the NSEC3PARAM, we might as well
check the NSEC3 records on the NXDOMAIN response that the salt matches.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
85eea3db37 Move parts into a common module
Some constants and test functionality are the same for test cases
prior and after reconfiguration. Move these into a common module.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
4a404dd806 Convert "in"-style templates to jinja
Change the named.conf templating to make use of jinja template
rendering. The ns2 server is trivial. The ns3 server configuration
structure has changed:

The common configuration is moved out of named-fips.conf.

The main named.conf file is in named.conf.j2. It always includes the
common part, named-common.conf.j2, and the FIPS part,
named-fips.conf.j2.

The named-fips.conf.j2 and named-rsasha1.conf.j2 templates are
rendered differently depending on the reconfiged status. Mainly the
dnssec-policy for zones are different after reconfiguration, but there
are some other changes to, for example some zones change their
inline-signing setting.

Some zones only exist prior or after the configuration.

Finally, this is a bit hackish: If RSASHA1 is supported, named.conf
includes "named-rsasha1.conf", otherwise it includes the deliberately
empty "named-rsasha0.conf".
2025-11-21 09:38:47 +01:00
Matthijs Mekking
e81cc1520a Rewrite nsec3 system test to pytest (1/4)
This converts all the nsec3 system test cases prior to reconfiguring the
name server. There are two main classes, one that tests the zone is
correctly signed with NSEC, the other with NSEC3.

Two extra tests for nsec3-dynamic-update-inline.kasp and
nsec3-change.kasp are also rewritten. For the former, we need to
change the 'nsupdate' definition to be able to set the expected RCODE.
2025-11-21 09:38:47 +01:00
Evan Hunt
4a4368a5ec fix: usr: Fix allow-recursion/allow-query-cache inheritance
The merging of the user options and defaults into the effective configuration broke the mutual inheritance of the `allow-recursion`, `allow-query`, and `allow-query-cache` ACLs, and of the `allow-recursion-on` and `allow-query-cache-on` ACLs. This has been fixed.

Closes #5647

Merge branch '5647-allow-recursion-inheritance' into 'main'

See merge request isc-projects/bind9!11254
2025-11-20 20:19:52 +00:00
Evan Hunt
f798feda40 fix ACL settings when merging views
when merging view objects into the effective configuration, add
allow-query-cache, allow-recursion, allow-query-cache-on and
allow-recursion-on ACLs as needed to reflect the way those
options inherit from each other.

this means the effective configuration is now correct for each
view.  ACLs no longer need to be corrected when applying the
configuration, and the actual effective ACL values will be
displayed in "rndc showconf" and "named-checkconf -pe".
2025-11-20 11:24:11 -08:00
Evan Hunt
1a77ae2a7a fix allow-recursion/allow-query-cache inheritance
the merging of options and defaults into the effective configuration
broke the mutual inheritance of the allow-recursion, allow-query, and
allow-query-cache ACLs, and of the allow-recursion-on and
allow-query-cache-on ACLs.

this has been corrected by adding a 'cloned' flag to the cfg_obj
structure to indicate whether it was configured explicitly or
cloned from the defaults during parsing. we can then adjust the
ACLs while configuring a view, favoring user-configured values
when they're available over cloned defaults.

currently the adjustments to the ACLs are done in configure_view();
later they'll be moved into the effective configuration and this
special handling can be removed.
2025-11-20 11:24:11 -08:00
Evan Hunt
f9340fc152 add a test for allow-recursion/allow-query-cache inheritance
allow-recursion is set to "none" in the options block and to
"any" in the view.  allow-query-cache in the view should inherit
the "any", not the "none". (currently this test does not pass.)
2025-11-20 11:24:11 -08:00
Colin Vidal
fec55d786a fix: dev: Attach socket before async streamdns_resume_processing
Call to `streamdns_resume_processing` is asynchronous but the socket
passed as argument is not attached when scheduling the call.

While there is no reproducible way (so far) to make the socket reference
number down to 0 before `streamdns_resume_processing` is called, attach
the socket before scheduling the call. This guard against an hypothetic
case where, for some reasons, the socket refcount would reach 0, and be
freed from memory when `streamdns_resume_processing` is called.

Closes #5620

Merge branch '5620-attach-socket-streamdns_resume_processing' into 'main'

See merge request isc-projects/bind9!11247
2025-11-20 18:52:29 +01:00
Colin Vidal
7c8b517d56 attach socket before async streamdns_resume_processing
Call to `streamdns_resume_processing` is asynchronous but the socket
passed as argument is not attached when scheduling the call.

While there is no reproducible way (so far) to make the socket reference
number down to 0 before `streamdns_resume_processing` is called, attach
the socket before scheduling the call. This guard against an hypothetic
case where, for some reasons, the socket refcount would reach 0, and be
freed from memory when `streamdns_resume_processing` is called.
2025-11-20 18:08:52 +01:00
Ondřej Surý
37d851df37 chg: usr: Reduce the number of outgoing queries
Reduces the number of outgoing queries when resolving the nameservers
for delegation points.  This helps the DNS resolver with cold cache
resolve client queries with complex delegation chains and redirections.

Merge branch 'ondrej/fctx_getaddresses' into 'main'

See merge request isc-projects/bind9!11148
2025-11-20 13:32:42 +01:00
Ondřej Surý
d51effdb48
Refactor fctx_getaddresses() into couple smaller functions
The fctx_getaddresses() was lengthy and little bit confusing with
goto statements.  Split the single function into smaller parts:
one for forwarders, one for nameservers and one for alternates.
2025-11-20 13:32:17 +01:00
Ondřej Surý
1b90d2ffdb
Reduce the number of outgoing queries
The dns_resolver mode of operation is to resolve all the domains as it
iterates the DNS tree to fill up the cache as quickly as possible.

This commit reduces the number of outgoing queries by reducing the
number of remote fetches started for the nameserver addresses resolution
via dns_adb_createfind() to a smaller number per depth of the recursion
since the delegation point (3 2 1 0) - where 0 means only create fetch
on demand if we don't have any addresses yet.
2025-11-20 13:31:11 +01:00
Mark Andrews
d091771b42 fix: usr: AMTRELAY type 0 presentation format handling was wrong
RFC 8777 specifies a placeholder value of "." for the gateway field when the
gateway type is 0 (no gateway).  This was not being checked for nor emitted
when displaying the record. This has been corrected.

Instances of this record will need the placeholder period added to them when upgrading.

Closes #5639

Merge branch '5639-fix-atmrelay-type-0-support' into 'main'

See merge request isc-projects/bind9!11240
2025-11-20 19:46:10 +11:00
Mark Andrews
ae484d4501 AMTRELAY type 0 presentation format handling was wrong
RFC 8777 specifies a placeholder value of "." for the gateway field
when the gateway type is 0 (no gateway).
2025-11-20 18:28:32 +11:00
Mark Andrews
d30fdf063c fix: dev: Fix building on OpenBSD 7.8 with Clang 19.1.7
Add the OpenBSD and Clang combination to the existing kludge to
recognize size_t and uintXX_t types as same when using a generic.

Closes #5635

Merge branch '5635-openbsd-size_t-generics-fix' into 'main'

See merge request isc-projects/bind9!11235
2025-11-20 13:40:11 +11:00
Aram Sargsyan
bbbc5af731 Fix building on OpenBSD 7.8 with Clang 19.1.7
Add the OpenBSD and Clang combination to the existing kludge to
recognize size_t and uintXX_t types as same when using a generic.
2025-11-20 11:08:23 +11:00
Ondřej Surý
1695437f96 fix: nil: Remove install_rpath from synthrecord plugin
See 0a56c71865 for more details.

Merge branch 'ondrej/remove-rpath-from-synthrecord' into 'main'

See merge request isc-projects/bind9!11253
2025-11-19 23:07:39 +01:00
Ondřej Surý
7bb073bb8d
Remove install_rpath from synthrecord plugin
See 0a56c71865 for more details.
2025-11-19 22:07:30 +01:00
Michal Nowak
63ba9d0ddf Merge tag 'v9.21.15' 2025-11-19 17:38:37 +00:00
Mark Andrews
c76f686131 fix: test: Include <stdarg.h> in byaddr_test.c
Closes #5637

Merge branch '5637-include-stdarg-h-in-byaddr-test-c' into 'main'

See merge request isc-projects/bind9!11241
2025-11-19 11:56:16 +11:00
Mark Andrews
d9fc1f2471 Include <stdarg.h> in byaddr_test.c 2025-11-19 10:16:40 +11:00
Colin Vidal
2958b3733c chg: dev: Remove exclusive mode when scheduling zone load
Remove exclusive mode when scheduling the zone load, as it is no longer necessary;
data that can be read or written by multiple threads are locked or atomic.

The detection of the post zone DB loading logic has been refactored
to take into account the fact that zone databases may be loaded before the
function scheduling the loads.

Merge branch 'colin/remove-exclusive-zone-load' into 'main'

See merge request isc-projects/bind9!11231
2025-11-18 12:16:39 +01:00
Colin Vidal
4b566599a6 refactor detection of zone DB load completion
Because the asynchronous loading logic expected all jobs to be scheduled
then to be run (because it used to be scheduled during the exclusive
mode) and because all jobs are scheduled on various threads, there were
random situations where load_zones() would return after the scheduled
DB zone loading actually ran. In such cases, the zl->refs ref counter
in view_loaded() wouldn't go down to 0 and the remaining task to do
once all zones were loaded was never called. In particular,
server->reload_status kept the NAMED_RELOAD_PENDING state.

This problem is fixed by handling zoneload_t as a ref-counted object,
shared between load_zones() and each instance of scheduled zone DB
loading. Its destructor function is actually the content of
view_loaded() in the case the zt->refs went to 0. This ensures a
correct post-loading routine to be called once the last load is done.
2025-11-18 12:16:14 +01:00
Colin Vidal
7427f45a84 harden configloading system test
The configloading system script attempts multiple `rndc
{reconfig,reload}` commands without ensuring the system left
exclusive mode; which normally raise an RNDC error as the server is
currently reloading already. This used to work because the request was
enqueued while the server was in exclusive mode, and was processed
after the server `reload_status` was reset to `NAMED_RELOAD_DONE`.

Due to the fact the exclusive mode is not retaken after
`apply_configuration()` by `load_zones()`, the scheduling of
pending tasks is changed and, regularly, the RNDC command sent by the
test is processed before `NAMED_RELOAD_DONE` is set. This is the same
kind of issue the views system tests had, solved by
`4b2dcb3128fbd5af4609a5a73aeeee1f93bde237`

Fix the problem by waiting for a log line matching the end of
the reloading phase.
2025-11-18 12:16:14 +01:00
Colin Vidal
19cec37d5e set reload_status to fail before logging it
The `reload_status` is set to `NAMED_RELOAD_FAILED` after the log line is
printed about this change. Update `reload_status` first, to avoid
(unlikely) case where a test waiting for this log line would attempt a
RNDC reload query but it would be processed by `named` before the status
is updated.
2025-11-18 12:16:14 +01:00
Colin Vidal
e8e879c008 remove exclusive mode when scheduling zone load
Remove the exclusive mode when scheduling the zone load right after
(re)loading `named` configuration, as there is no reason anymore to
schedule zone loading while the exclusive lock is held. Data which can
be read or written by multiple threads are locked or atomic.
2025-11-18 12:16:14 +01:00