Commit graph

44311 commits

Author SHA1 Message Date
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
Colin Vidal
103799ac23 chg: usr: Enforce bounds of prefetch configuration option
The prefetch configuration option now enforces boundaries. The configuration (including when using `named-checkconf`) now fails if the trigger (first value) is above 10, and if the eligibility (second optional value) isn't at least six seconds greater than the trigger value.

Merge branch 'colin/prefetch-enforcebounds' into 'main'

See merge request isc-projects/bind9!11243
2025-11-18 11:04:49 +01:00
Colin Vidal
5c038c2fa2 enforces bounds of prefetch statement
The prefetch statement now enforces its bounds. The configuration
(including `named-checkconf`) now fails if the trigger (first value) is
above 10, or if the eligibility (second optional value) isn't at least
six seconds more than the trigger value.
2025-11-18 10:19:15 +01:00
Colin Vidal
346007d52d chg: usr: Enforces the fact that catalog-zone can not be used in non IN views
Catalog-zones can't be used in a view which is not from the IN class.
This is now enforced as the server won't load (instead of loading
without the catalog-zone) if such configuration is detected. This
configuration error is now also caught by `named-checkconf`.

Merge branch 'colin/catz-enforce-non-in' into 'main'

See merge request isc-projects/bind9!11245
2025-11-18 10:08:57 +01:00
Colin Vidal
fd49c95070 enforces that catalog-zone can't be used in non IN views
Catalog-zones can't be used in view which are not from the IN class.
This is now enforced as the server won't load (instead of loading
without the catalog-zone). This configuration error is now also caught
by `named-checkconf`.
2025-11-18 10:08:42 +01:00
Colin Vidal
6b5f714e53 remove need_hints parameters to configure_view
The `configure_view()` `need_hints` is removed as it this function was
always called with the value `true`.

The `need_hints` wasn't even used in the function. The only thing it was
actually used was to throw a warning which can be done simply in an
`else` condition branch.

Moreoever, in the case of catalog zones and response-policy, it fixes a
possible bug that would affect root zones, as those wouldn't be reverted
back to their previous version in case of the view fails to load
(during a server reconfiguration).
2025-11-18 10:08:42 +01:00
Colin Vidal
9027889bc8 fix: nil: Add showconf in RNDC usage
The `rndc -h` command was missing the newly introduced `showconf`
commands. Adding it.

Merge branch 'colin/fix-rndc-usage' into 'main'

See merge request isc-projects/bind9!11246
2025-11-18 10:07:20 +01:00
Colin Vidal
790fb95327 add showconf in RNDC usage
The `rndc -h` command was missing the newly introduced `showconf`
commands. Adding it.
2025-11-18 09:23:10 +01:00
Colin Vidal
416826d4ea chg: dev: No effective config as text if allow-new-zones is yes
Do not save the text version of the effective configuration when
`allow-new-zones` is enabled, as in that case the object tree can
be printed on demand, reducing unnecessary memory consumption.

Merge branch 'colin/no-effective-config-as-text-allownewzones' into 'main'

See merge request isc-projects/bind9!11242
2025-11-18 09:16:57 +01:00
Colin Vidal
fb64fac3f3 no effective config as text if allow-new-zones is yes
Do not save the textual version of the effective configuration when
`allow-new-zones` is enabled, as it can be printed on-demand. This
enable to reduce the memory footprint of ~70MB on huge configurations
(1M zones).
2025-11-17 11:45:28 +01:00
Colin Vidal
1a9f7539bd fix: dev: Remove holes in dns_zoneflg_t enum
The `dns_zoneflg_t` enum defined multiple possible flags for a zone, but
contains numerous holes (likely from flag removed in the past). This
fixes the holes, and use a bit-shift and decimal notation to make holes
easier to spot.

Merge branch 'colin/remove-zoneflag-holes' into 'main'

See merge request isc-projects/bind9!11189
2025-11-13 15:33:02 +01:00
Colin Vidal
75ff5358f5 remove holes in dns_zoneflg_t enum
`dns_zoneflg_t` enum defined multiple possible flags for a zone, but
contains numerous holes (likely from flag removed in the past). This
fixes the holes, and use a bit-shift and decimal notation to make holes
easier to spot.
2025-11-13 14:09:04 +01:00
Colin Vidal
09bcacbd36 fix: dev: Save configuration as text
A `cfg_obj_t` object tree structure takes up considerably more space than the equivalent canonical text. If `allow-new-zones` is disabled and catalog zones are not in use, then we don't need the object tree. By storing the configuration in text format, we can use less memory, and `rndc showconf` and `rndc showzone` still work.

Merge branch 'each-cfg-as-text' into 'main'

See merge request isc-projects/bind9!11236
2025-11-12 11:40:33 +01:00
Evan Hunt
f9922eb65a save effective configuration as text
the effective configuration tree is now detached if allow-new-zones
or catalog-zones aren't enabled in any views. this reduces memory
consumption while still allowing "rndc showconf -effective" to work.
2025-11-12 11:36:07 +01:00
Evan Hunt
6a57c6e8f6 save zone configuration as text
as previously mentioned in commit c65b2868ab, a cfg_obj_t
configuration tree structure takes up considerably more space than
the canonical text. since the zone configuration saved in the zone
object using dns_zone_setcfg() is only currently used for "rndc
showzone", it can be saved as text more efficiently than as an
object tree. (and, if a tree were needed, the text could be
re-parsed quickly; zone configuration text is generally small.)
2025-11-12 11:36:07 +01:00
Colin Vidal
2affdbce19 new: dev: Add spatch to detect implicit bool/int/result cast
Detection of implicit cast from a boolean into an int, or an
isc_result_t into a boolean (either in an assignement or return
position).

If such pattern is found, a warning comment is added into the code (and
the CI will fails) so the error can be spotted and manually fixed.

Merge branch 'colin/cocci-detect-iscresult-int-implicit-casts' into 'main'

See merge request isc-projects/bind9!11095
2025-11-12 11:31:37 +01:00
Colin Vidal
3b3bb3eb80 check-cocci fails in WARNING is found on stderr
As the implicit cast check print "WARNING: ..." on stderr, add a pattern
to make sure that check-cocci would fails if such warning is found on
stderr. This is generic (not specific like the existing "parse error")
so it should be able to support future Coccinelle spatch warnings.
2025-11-12 11:31:28 +01:00
Colin Vidal
25f303f046 mdig: fix implicit bool to int cast
The `display_rrcomments` is a tri-state (-1, 0, 1) which is (in some
cases) initialized with `state`, a boolean, through an implicit cast.
This was spot by Coccinelle. Remove the implcit cast by explicitly
assigning 0 or 1 to `display_rrcomments` based on `state` value.
2025-11-12 11:31:28 +01:00
Colin Vidal
754595ea2d add spatch to detect implicit bool/int/result cast
Detection of implicit cast from a boolean into an int, or an
isc_result_t into a boolean (either in an assignement or return
position).

If such pattern is found, a warning comment is added into the code (and
the CI will fails) so the error can be spotted and manually fixed.
2025-11-12 11:31:28 +01:00
Nicki Křížek
fbc9262c39 new: test: Add isctest.check.ede() helper for pytest
Add a utility function to check for EDE codes present in the DNS
message. The primary benefit of this helper function is that it
handles the compatibility issues with different dnspython versions
and the actual test code doesn't have to deal with that any more.

Merge branch 'nicki/isctest-check-ede-helper' into 'main'

See merge request isc-projects/bind9!11182
2025-11-10 16:21:52 +01:00
Nicki Křížek
0e3c24d7a7 Fix CI trigger for system test modications
Use bin/tests/system/**/* to detect changes to files not just directly
inside the directory, but also all of its subdirectories.

See https://docs.gitlab.com/ci/yaml/#ruleschanges
2025-11-10 15:41:51 +01:00
Nicki Křížek
f9858e4739 Use new EDE helper in existing system tests
Previously, hasattr("extended_errors") was used as a check to detect a
mimumum required dnspython version in order to only perform the EDE
check if a new-enough dnspython was present. This is now abstracted into
isctest.check.ede().

In order to support dnspython<2.2.0, use isctest.compat.EDECode rather
than using dns.edns.EDECode directly.
2025-11-10 15:41:51 +01:00
Nicki Křížek
61b3b415d5 Add isctest.check.ede() helper for pytest
Add a utility function to check for EDE options present in the DNS
message. The primary benefit of this helper function is that it
handles the compatibility issues with different dnspython versions
and the actual test code doesn't have to deal with that any more.

Rather than using the convenience .extended_errors() method
introduced in dnspython 2.7.0, iterate over the options and find
EDEOption types, which is supported from 2.2.0 onwards.

To work around the issue of using dns.edns.EDECode to specify EDE codes
in our tests, create an isctest.compat.EDECode wrapper. This can be used
even with dnspython versions prior to 2.2.0 and will simply result in
no-op, since EDE isn't supported in the older dnspython anyway.
2025-11-10 15:41:51 +01:00
Ondřej Surý
48deff9fae rem: nil: Remove maybe_cancel_validators() function
When shutting down an fctx, validators can just be canceled
without checking whether there are pending finds.

Merge branch 'ondrej/remove-maybe_cancel_validators' into 'main'

See merge request isc-projects/bind9!11229
2025-11-09 00:37:23 +01:00
Evan Hunt
e62895e999
Remove maybe_cancel_validators() function
When shutting down an fctx, validators can just be canceled
without checking whether there are pending finds.
2025-11-08 18:00:32 +01:00
Colin Vidal
1014c622fa fix: test: Rewrite views/addzone in loop system test
A part of the `views` system test attempts to add multiples zones in a
loop, and after each zone being added, reconfig the server.

However, the test didn't take into account the fact that the server
might take a bit more time to reload than the script to move to the next
iteration, and in some case the test was re-requesting the server reload
when it was still reloading.

Since `b49f83a3`, `named` explicitly fails to reload when a load/reload
is pending, which is (unless proved otherwise) the reason of the test
was now randomly failing.

That part of the test is now waiting for the server log message saying
the server has added the new zone and is running. Also, that part of the
test has been rewrote in Python.

Closes #5617

Merge branch '5617-rewrite-reload-view-test' into 'main'

See merge request isc-projects/bind9!11225
2025-11-07 15:46:15 +01:00
Colin Vidal
e50edc9090 rewrite views/addzone in loop system test
A part of the `views` system test attempts to add multiples zones in a
loop, and after each zone being added, reconfig the server.

However, the test didn't take into account the fact that the server
might take a bit more time to reload than the script to move to the next
iteration, and in some case the test was re-requesting the server reload
when it was still reloading.

Since `b49f83a3`, `named` explicitly fails to reload when a load/reload
is pending, which is (unless proved otherwise) the reason of the test
was now randomly failing.

That part of the test is now waiting for the server log message saying
the server has added the new zone and is running. Also, that part of the
test has been rewrote in Python.
2025-11-07 15:07:56 +01:00
Colin Vidal
4b2dcb3128 fix: test: Harden EDE 24 system tests
Harden `ede24` system test in order to avoid random failures, likely caused by timing issues. Also remove expiration-related dead-code (which should have been done in the original ede24 changes) as well as printing the query ID, as this should be useful to debug further flaky system test issues. (In particular, this one, if the changes made here are not enough).

Closes #5625

Merge branch '5625-fix-ede24-test' into 'main'

See merge request isc-projects/bind9!11217
2025-11-06 16:13:29 +01:00
Colin Vidal
11a4df7ec5 split ede24 system test into separate modules
Because ede24 system tests require stopping/restarting server, there is
always the risk that the test ends (with a failure) with server in an
wrong and impredictible state. This would make the other tests to fail
in a strange way as well.

To avoid this problem, split the test into different modules, so if a
module fails, the other module is not impacted as it uses separate
server instances.
2025-11-06 15:13:29 +01:00
Colin Vidal
611a556a6c harden ede24 system test
There was a random failure of ede24 system test. While this is still a
bit speculative, the two reasons were:

- in the case of `test_ede24_noloaded` the test might attempt to early
  (before the zone actually transfered on the secondary server) to query
  ns2.

- still in the case of `test_ede24_noloaded`, even after waiting for
  transfer succeed logs, if the CI machine is slow, the zone could be
  expired before the request checking the secondary zone works because
  the expiration time of the zone was very short (1s). Moving this
  expiration time to 3 seconds should be enough (while not making the
  test execution too much longer when waiting for the zone expiration).

- in the case of `test_ede24_expired`, the zone expired flag is flipped
  and the log message is printed immediately after. However, it is
  possible that because the flag is set using a relaxed atomic
  operation, another thread process the query and gets the previous
  (non-expired) value of the flag. In order to workaround this, the
  test now also expects another log written after the zone expiration
  (stop timers) on the next UV tick.
2025-11-06 15:11:45 +01:00
Colin Vidal
0b93d5725b add query ID to the query trace message
Adding the query ID to the query trace message. The log is now as the
following (id is at the end):

    query client=0x7f75c5017000 thread=0x7f75c6dfe680(foo.fr/A): \
      client attr:0x22300, query attr:0x700, restarts:0, \
      origqname:foo.fr, timer:0, authdb:0, referral:0, id:21338

This should help debugging tests, in particular to quickly get a
specific query from the logs.
2025-11-06 15:11:45 +01:00
Colin Vidal
2a640adbc1 remove dns_zone_expire dead code
Removing `dns_zone_expire` function which is never called (the zone
expiration is detected internally in `lib/dns/zone.c`).
2025-11-06 15:11:45 +01:00
Matthijs Mekking
32322ffdd8 chg: dev: Refactor zone fetch code
There is code duplication between `keyfetch` and `nsfetch`, refactor to allow common code paths to differentiate between them. This is in preparation for support of generalized DNS notifications, that will require fetching DSYNC records.

Merge branch 'matthijs-refactor-zone-fetch' into 'main'

See merge request isc-projects/bind9!11176
2025-11-06 12:01:55 +00:00
Matthijs Mekking
868ede012c Schedule a zonefetch
Scheduling and rescheduling a zonefetch is also similar.  Refactor into
zonefetch functions.  This also increments and decrements the zone's
internal reference counter in the same module, which may be less
confusing when reading the code.
2025-11-06 12:22:20 +01:00
Matthijs Mekking
77418fedce Fix comment in lib/ns/query.c
While renaming exit_check() to dns__zone_free_check() in lib/dns/zone.c,
a dead reference to exit_check() in the comments was found in
lib/ns/query.c.
2025-11-06 10:54:55 +01:00
Matthijs Mekking
6f70cb7a39 A unified way to verify the zone fetch
There is a lot of similarity when checking the completed fetch is legit.
Create a new function to verify the fetch and to reduce code
duplication.
2025-11-06 10:54:55 +01:00
Matthijs Mekking
94a82c2ecb Count per fetch type
Track fetch counts per type in an array, rather than special named
variables within the zone structure.
2025-11-06 10:54:55 +01:00
Matthijs Mekking
7ac02d4c04 Refactor zone fetch code
There is code duplication between keyfetch and nsfetch, refactor to
allow common code paths to differentiate between them.
2025-11-06 10:54:54 +01:00
Matthijs Mekking
6adfc2348b Export zone functions
Make some zone functions available that we are going to need in the
zonefetch code.
2025-11-06 10:54:54 +01:00
Štěpán Balážik
799fc93619 chg: ci: Run system tests on all platforms on MR that touches system tests
Not doing this has lead to breakage caused by different dnspython
versions on different platforms only discovered in full nightly
pipelines.

Add a triggering rule for MRs changing code in bin/test/system.
Apply this rule to all nightly-only system test jobs.

Merge branch 'stepan/run-all-system-tests-on-system-test-change' into 'main'

See merge request isc-projects/bind9!11214
2025-11-06 09:08:30 +00:00
Štěpán Balážik
8c050fe15c Run system tests on all platforms on MR that touches system tests
Not doing this has lead to breakage caused by different dnspython
versions on different platforms only discovered in full nightly
pipelines.

Add a triggering rule for MRs changing code in bin/test/system.
Apply this rule to all nightly-only system test jobs.
2025-11-06 09:21:40 +01:00
Michal Nowak
037a72e29d chg: doc: Set up version for BIND 9.21.16
Merge branch 'mnowak/set-up-version-for-bind-9.21.16' into 'main'

See merge request isc-projects/bind9!11218
2025-11-05 19:38:15 +01:00
Michal Nowak
26a993a312 Update BIND version to 9.21.16-dev 2025-11-05 19:32:17 +01:00
Colin Vidal
6af8f8ba5e fix: dev: Fix parser test (missing string termination)
Compare only the dumped configuration as the `cfg_printx` does not NULL-terminate the configuration strings.

Merge branch 'colin/fix-parser-test' into 'main'

See merge request isc-projects/bind9!11215
2025-11-05 13:59:23 +01:00
Ondřej Surý
47328cc1f8 Fix parser test (missing string termination)
Parser test could crash because the `dumpb2` buffer hasn't explicit C
NULL string termination after dumping the configuration tree in it.
`cfg_printx` does not doing this by default.

Fix the test by comparing only the strings written with strncmp.
2025-11-05 13:06:38 +01:00
Štěpán Balážik
7f1d36db22 fix: test: Fix NSEC3HASH system test on jammy
a94aab9440 removed importorskip call from
isctest.name on which the functionality of this test relied.

Add an explicit importorskip call to the test.

Merge branch 'stepan/fix-tools-nsec3hash-on-jammy' into 'main'

See merge request isc-projects/bind9!11213
2025-11-05 11:54:23 +00:00
Štěpán Balážik
35923a952e Fix NSEC3HASH system test on jammy
a94aab9440 removed importorskip call from
isctest.name on which the functionality of this test relied.

Add an explicit importorskip call to the test.
2025-11-05 10:51:26 +01:00
Ondřej Surý
7ca069e28f fix: usr: Skip unsupported algorithms when looking for signing key
A mix of supported and unsupported DNSSEC algorithms in the same zone could have caused validation failures. Ignore the DNSSEC keys with unsupported algorithm when looking for the signing keys.

Closes #5622

Merge branch '5622-dont-fail-on-unsupported-algorithms' into 'main'

See merge request isc-projects/bind9!11208
2025-11-04 20:30:08 +01:00
Ondřej Surý
a94a7c1a1e
Skip unsupported algorithms when looking for signing key
When looking for a signing key in select_signing_key(), the result code
indicating unsupported algorithm would abort the search.  Instead, skip
such keys and continue searching for the right key.

Co-Authored-By: Aram Sargsyan <aram@isc.org>
Co-Authored-By: Petr Menšík <pemensik@redhat.com>
2025-11-04 19:53:26 +01:00
Ondřej Surý
488d7bfc75
Add a system test with one good and one bad algorithm
The case where there would be one supported algorithm and one already
unsupported (like RSAMD5 or RSASHA1) was missing.
2025-11-04 19:53:25 +01:00