]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
10 months agorename and refactor cache_name() and related functions
Evan Hunt [Sun, 2 Mar 2025 04:04:18 +0000 (20:04 -0800)] 
rename and refactor cache_name() and related functions

- renamed cache_message() to rctx_cachemessage()
- renamed cache_name() to rctx_cachename()
- merged ncache_message() into rctx_ncache()
- split out a new function, rctx_cacherdataset(), which is
  called by rctx_cachename() in a loop to process each of
  the rdatasets associated with the name.

10 months agoreduce code duplication around findnoqname()
Evan Hunt [Sun, 2 Mar 2025 05:38:34 +0000 (21:38 -0800)] 
reduce code duplication around findnoqname()

every call to findnoqname() was followed by a call to
dns_rdataset_addnoqname(). we can move that call into
findnoqname() itself, and simplify the calling functions
a bit.

10 months agoset ANSWERSIG flag when processing ANY responses
Evan Hunt [Sat, 1 Mar 2025 23:40:07 +0000 (15:40 -0800)] 
set ANSWERSIG flag when processing ANY responses

previously, rctx_answer_any() set the ANSWER flag for all
rdatasets in the answer section; it now sets ANSWERSIG for
RRSIG/SIG rdatasets and ANSWER for everything else.  this
error didn't cause any harm in the current code, but it
could have led to unexpected behavior in the future.

10 months agosplit out some functionality in cache_name()
Evan Hunt [Thu, 27 Feb 2025 22:28:37 +0000 (14:28 -0800)] 
split out some functionality in cache_name()

there are now separate functions to check the cacheability of
an rdataset or to normalize TTLs, and the code to determine
whether validation is necessary has been simplified.

10 months agoadd functions to match rdataset types
Evan Hunt [Fri, 28 Feb 2025 01:10:21 +0000 (17:10 -0800)] 
add functions to match rdataset types

- dns_rdataset_issigtype() returns true if the rdataset is
  of type RRSIG and covers a specified type
- dns_rdataset_matchestype() returns true if the rdataset
  is of the specified type *or* the RRSIG covering it.

10 months agoreduce steps for negative caching
Evan Hunt [Thu, 27 Feb 2025 20:43:52 +0000 (12:43 -0800)] 
reduce steps for negative caching

whenever ncache_adderesult() was called, some preparatory code
was run first; this has now been moved into a single function
negcache() to reduce code duplication.

10 months agochange issecuredomain() functions to bool
Evan Hunt [Thu, 27 Feb 2025 06:06:40 +0000 (22:06 -0800)] 
change issecuredomain() functions to bool

dns_keytable_issecuredomain() and dns_view_issecuredomain()
previously returned a result code to inform the caller of
unexpected database failures when looking up names in the
keytable and/or NTA table. such failures are not actually
possible. both functions now return a simple bool.

also, dns_view_issecuredomain() now returns false if
view->enablevalidation is false, so the caller no longer
has to check for that.

10 months agosplit out cookie checks from resquery_response_continue()
Evan Hunt [Thu, 27 Feb 2025 05:30:43 +0000 (21:30 -0800)] 
split out cookie checks from resquery_response_continue()

split the code section that handles cookie issues into a
separate function for better readablity.

10 months agosimplify dns_ncache_add()
Evan Hunt [Wed, 26 Feb 2025 21:47:40 +0000 (13:47 -0800)] 
simplify dns_ncache_add()

there's no longer any reason to have both dns_ncache_add() and
dns_ncache_addoptout().

10 months agofix: test: Add support for small stack size for threads
Ondřej Surý [Tue, 5 Aug 2025 09:24:35 +0000 (11:24 +0200)] 
fix: test: Add support for small stack size for threads

When running the isc_quota unit test with less than
usual amount of RAM (e.g. in a CI for architectures
with 32 bits of address space), the pthread_create()
function fails with the "Resource temporarily unavailable
(11)" error code.

Add functions to get and set the thread stack size (if requested),
and use these to set the thread stack size to smaller value in the
isc_quota unit test.

Merge branch 'aram/isc-thread-stack-size-small' into 'main'

See merge request isc-projects/bind9!10778

10 months agoDocument the current default stack sizes on different systems
Ondřej Surý [Tue, 5 Aug 2025 05:34:15 +0000 (07:34 +0200)] 
Document the current default stack sizes on different systems

The default stack sizes varies between operating systems and between
different system libc libraries from 128kB (Alpine Linux with MUSL) to
8M (Linux with glibc).  Document the different values used to justify
the value of THREAD_MINSTACKSIZE (currently set to 1MB).

10 months agoAdd support for setting thread stack size
Ondřej Surý [Mon, 4 Aug 2025 15:03:42 +0000 (17:03 +0200)] 
Add support for setting thread stack size

When running the isc_quota unit test with less than usual amount of
RAM (e.g. in a CI for architectures with 32 bits of address space),
the pthread_create() function fails with the "Resource temporarily
unavailable (11):" error code.

Add functions to get and set the thread stack size (if requested),
and use these to set the thread stack size to smaller value in the
isc_quota unit test.

10 months agomeson: add 'threads' dependency for pthread_* function checks
Aram Sargsyan [Mon, 28 Jul 2025 10:53:32 +0000 (10:53 +0000)] 
meson: add 'threads' dependency for pthread_* function checks

This fixes the correct detection of these functions on some
platforms like Alma Linux 8.

Co-authored-by: Aydın Mercan <aydin@isc.org>
10 months agonew: usr: Support for parsing the DSYNC record has been added
Mark Andrews [Tue, 5 Aug 2025 08:11:41 +0000 (18:11 +1000)] 
new: usr: Support for parsing the DSYNC record has been added

Closes #5440

Merge branch '5440-add-dsync-record' into 'main'

See merge request isc-projects/bind9!10776

10 months agoAdd tests for DSYNC
Mark Andrews [Sat, 26 Jul 2025 10:27:33 +0000 (12:27 +0200)] 
Add tests for DSYNC

10 months agoAdd support for parsing and displaying DSYNC rdata type
Mark Andrews [Sat, 26 Jul 2025 04:21:34 +0000 (06:21 +0200)] 
Add support for parsing and displaying DSYNC rdata type

10 months agoAdd support for parsing DSYNC scheme mnemonics
Mark Andrews [Sat, 26 Jul 2025 04:17:20 +0000 (06:17 +0200)] 
Add support for parsing DSYNC scheme mnemonics

Adds dns_dsyncscheme_fromtext, dns_dsyncscheme_totext and
dns_dsyncscheme_format.  Adds type dns_dsyncscheme_t.

10 months agofix: usr: Add RPZ extended DNS error for zones with a CNAME override policy configured
Matthijs Mekking [Tue, 5 Aug 2025 07:19:49 +0000 (07:19 +0000)] 
fix: usr: Add RPZ extended DNS error for zones with a CNAME override policy configured

When the zone is configured with a CNAME override policy, or the response policy zone contains a wildcard CNAME, the extended DNS error code was not added. This has been fixed.

Closes #5342

Merge branch '5342-rpz-cname-override-ede-not-added' into 'main'

See merge request isc-projects/bind9!10777

10 months agoAdd ede for zone with rpz cname override policy
Matthijs Mekking [Fri, 25 Jul 2025 13:20:37 +0000 (15:20 +0200)] 
Add ede for zone with rpz cname override policy

When the zone is configured with a CNAME override policy, also add the
configured EDE code.

When the zone is contains a wildcard CNAME, also add the configured
EDE code.

10 months agoTest adding ede with rpz cname override policy
Matthijs Mekking [Fri, 25 Jul 2025 13:18:23 +0000 (15:18 +0200)] 
Test adding ede with rpz cname override policy

When the zone is configured with a CNAME override policy, the EDE code
is not added as expected. Add a test case based on the issue in GitLab
(#5342).

When the zone contains a wildcard CNAME, the EDE code is not added as
expected. Also add a test case for this.

10 months agofix: dev: Silence "may be truncated" warnings
Ondřej Surý [Mon, 4 Aug 2025 14:52:11 +0000 (16:52 +0200)] 
fix: dev:  Silence "may be truncated" warnings

Use memccpy() instead of strncpy() for safe string manipulation.

Closes #5395

Merge branch '5395-gen-c-silence-truncated-warnings' into 'main'

See merge request isc-projects/bind9!10647

10 months agoSilence "may be truncated" warnings
Ondřej Surý [Mon, 4 Aug 2025 13:38:17 +0000 (15:38 +0200)] 
Silence "may be truncated" warnings

Use memccpy() instead of strncpy() for safe string manipulation.

10 months agochg: dev: Add and use global memory context called isc_g_mctx
Ondřej Surý [Mon, 4 Aug 2025 10:11:01 +0000 (12:11 +0200)] 
chg: dev: Add and use global memory context called isc_g_mctx

Instead of having individual memory contexts scattered across different
files and called different names, add a single memory context called
isc_g_mctx that replaces named_g_mctx and various other global memory
contexts in various utilities and tests.

Merge branch 'ondrej/add-global-isc_g_mctx-instance' into 'main'

See merge request isc-projects/bind9!10737

10 months agoAdd rcu_barrier() to isc__log_shutdown()
Ondřej Surý [Thu, 24 Jul 2025 09:02:15 +0000 (11:02 +0200)] 
Add rcu_barrier() to isc__log_shutdown()

There is a data race when QP is reclaiming chunks on the call_rcu
threads and it tries to log the number of reclaimed chunks while the
server is shuttingdown.  Workaround this by adding rcu_barrier() before
shuttingdown the global log context.

10 months agoChange the 'isc_g_mctx' to be always available
Ondřej Surý [Thu, 24 Jul 2025 06:06:04 +0000 (08:06 +0200)] 
Change the 'isc_g_mctx' to be always available

This required couple of internal changes to the isc_mem_debugging.

The isc_mem_debugging is now internal to isc_mem unit and there are
three new functions:

1. isc_mem_setdebugging() can change the debugging setting for an
   individual memory context.  This is need for the memory contexts used
   for OpenSSL, libxml and libuv accounting as recording and tracing
   memory is broken there.

2. isc_mem_debugon() / isc_mem_debugoff() can be used to change default
   memory debugging flags as well as debugging flags for isc_g_mctx.

Additionally, the memory debugging is inconsistent across the code-base.
For now, we are keeping the existing flags, but three new environment
variables have been added 'ISC_MEM_DEBUGRECORD', 'ISC_MEM_DEBUGTRACE'
and 'ISC_MEM_DEBUGUSAGE' to set the global debugging flags at any
program using the memory contexts.

10 months agoAdd and use global memory context called isc_g_mctx
Ondřej Surý [Tue, 15 Jul 2025 10:56:04 +0000 (12:56 +0200)] 
Add and use global memory context called isc_g_mctx

Instead of having individual memory contexts scattered across different
files and called different names, add a single memory context called
isc_g_mctx that replaces named_g_mctx and various other global memory
contexts in various utilities and tests.

10 months agofix: usr: Prevent spurious validation failures
Mark Andrews [Fri, 1 Aug 2025 11:17:46 +0000 (21:17 +1000)] 
fix: usr: Prevent spurious validation failures

Under rare circumstances, validation could fail if multiple clients simultaneously iterated the same set of signatures.

References #3014

Merge branch '3014-validator-c-check_signer-fails-to-call-dns_rdataset_clone' into 'main'

See merge request isc-projects/bind9!5578

10 months agovalidator.c:check_signer now clones val->sigrdataset
Mark Andrews [Wed, 17 Nov 2021 02:09:03 +0000 (13:09 +1100)] 
validator.c:check_signer now clones val->sigrdataset

Spurious validation failures were traced back to check_signer looping
over val->sigrdataset directly.  Cloning val->sigrdataset prevents
check_signer from interacting with callers that are also looping
over val->sigrdataset.

10 months agofix: dev: convert dnssec system tests to python
Evan Hunt [Thu, 31 Jul 2025 20:34:56 +0000 (20:34 +0000)] 
fix: dev: convert dnssec system tests to python

Most of the shell-based tests in the `dnssec` system test have been converted to python.  The only exceptions are the test cases that exercised the `dnssec-*` command line tools, and did not interact with a name server; those have been relocated into a new `dnssectools` system test.

Merge branch 'each-convert-dnssec-test' into 'main'

See merge request isc-projects/bind9!10688

10 months agoUse nsX fixtures rather than servers
Nicki Křížek [Fri, 25 Jul 2025 16:29:55 +0000 (18:29 +0200)] 
Use nsX fixtures rather than servers

Rather than using servers["nsX"] syntax, utilize the nsX fixtures to
make the test code a bit more concise.

See fe5534291699572e67ad4a854b412e40c524307a

10 months agoVarious TTL fixes in dnssec tests
Nicki Křížek [Fri, 25 Jul 2025 15:21:56 +0000 (17:21 +0200)] 
Various TTL fixes in dnssec tests

Make sure the various TTL checks are using a lower bound as well and use
a common TTL of 5 min.

10 months agoSplit up dnssec validation tests to multiple modules
Nicki Křížek [Fri, 25 Jul 2025 16:22:21 +0000 (18:22 +0200)] 
Split up dnssec validation tests to multiple modules

Put each config into a separate module to avoid interfering with other
tests.

10 months agoSplit up badkey tests into separate modules
Nicki Křížek [Thu, 10 Jul 2025 13:21:05 +0000 (15:21 +0200)] 
Split up badkey tests into separate modules

If nsX.reconfigure() is used in a way that might affect other tests
within the same module, it's best to split up the tests which need the
reconfig to a separate module. This ensures the reconfigure() won't
interfere with test results in case the tests are executed separately,
or in a different order.

10 months agoParametrize dnssec/tests_badkey.py tests
Nicki Křížek [Thu, 10 Jul 2025 13:16:06 +0000 (15:16 +0200)] 
Parametrize dnssec/tests_badkey.py tests

Utilize test parametrization to reduce code duplication.

10 months agotidy up the dnssec test tree
Evan Hunt [Sat, 5 Jul 2025 18:12:02 +0000 (11:12 -0700)] 
tidy up the dnssec test tree

many of the zones in the dnssec system test were identical or
had only trivial differences, and it would be easier to keep track
of them if they were sourced from template files.

also, the extra_artifacts have been simplified and restored to
the test files.

10 months agoconvert delv tests to python
Evan Hunt [Thu, 3 Jul 2025 22:32:37 +0000 (15:32 -0700)] 
convert delv tests to python

move all dnssec tests using delv from the shell test to tests_delv.py,
and remove tests.sh and tests_sh_dnssec.py.

10 months agoconvert dnssec signing tests to python
Evan Hunt [Wed, 2 Jul 2025 08:06:19 +0000 (01:06 -0700)] 
convert dnssec signing tests to python

the shell tests that queried servers to check correct signing
behavior (using dnssec-signzone, dnssec-policy and nsupdate),
as well as "rndc signing", private-type records, rndc zonestatus,
offline keys, etc, have been moved to tests_signing.py.

the minimal update test in the dnssec_update_test.pl script
was also moved here and the perl script has been removed.

10 months agoconvert dnssec validation tests to python
Evan Hunt [Fri, 27 Jun 2025 03:29:24 +0000 (20:29 -0700)] 
convert dnssec validation tests to python

begin converting DNSSEC validation tests from shell to python,
and simplify the name servers used in the test.

ns4, the name server used for validation tests, is now configured
using jinja2 templates.

ns8, which was previously used for testing unsupported, disabled
and revoked keys and trust anchors, has been removed.  we now
use a jinja2 configuration in ns5 for this purpose.

the configurations in ns7 and ns6 didn't conflict with one another,
so the two servers have been merged into one.

10 months agoconvert dnssec-policy tests to python
Evan Hunt [Sat, 28 Jun 2025 00:43:13 +0000 (17:43 -0700)] 
convert dnssec-policy tests to python

move the signatures-validity tests to tests_policy.py

10 months agoconvert TAT tests to python
Evan Hunt [Wed, 2 Jul 2025 04:37:58 +0000 (21:37 -0700)] 
convert TAT tests to python

the trust-anchor-telemetry tests have been moved to a new
python subtest, dnssec/tests_tat.py.

10 months agomove some test cases to different system tests
Evan Hunt [Fri, 27 Jun 2025 22:35:11 +0000 (15:35 -0700)] 
move some test cases to different system tests

- dnssec tool tests (i.e., dnssec-signzone, dnssec-keygen, etc) that
  don't require interaction with a running server have been moved
  to a new 'dnssectools' system test directory.
- a dig formatting test has been moved to digdelv.
- a named-rrchecker test has been moved to rrchecker

10 months agomove NTA test cases to a separate python test
Evan Hunt [Thu, 26 Jun 2025 20:05:40 +0000 (13:05 -0700)] 
move NTA test cases to a separate python test

the tests of "rndc nta" behavior have been moved out of the
dnssec shell test, into bin/tests/system/nta, and converted
to python. features of the dnssec test framework that were
needed for NTA testing have been moved to the nta test, and
dnssec has been correspondingly simplified.

10 months agostart converting dnssec system test to python/jinja2
Evan Hunt [Thu, 26 Jun 2025 02:00:22 +0000 (19:00 -0700)] 
start converting dnssec system test to python/jinja2

- changed named.conf.in to named.conf.j2 in all server directories that
  don't currently need to use copy_setports() during the test.
- converted the tests that use ns5 to python, and replaced
  named1.conf.in and named2.conf.in with a jinja2 template instead.
  the only remaining server that still needs copy_setports() is ns4.
- removed ns4/named5.conf.in, and moved its functions to ns5 (which
  is supposed to be for servers with broken trust-anchor configurations,
  so it should have been there in the first place). converted the tests
  that used that ns4 configuration to use ns5 with jinja instead.
- revised the remaining ns4 configurations (named[1-4].conf.in) to
  minimize the differences between them. this will make it easier to
  convert it into a jinja2 template later.

10 months agofix: dev: reintroduce cross version tests
Aydın Mercan [Thu, 31 Jul 2025 11:54:03 +0000 (14:54 +0300)] 
fix: dev: reintroduce cross version tests

Merge branch 'aydin/meson-cross-version-test' into 'main'

See merge request isc-projects/bind9!10792

10 months agoreintroduce cross version config tests
Aydın Mercan [Tue, 29 Jul 2025 12:48:46 +0000 (12:48 +0000)] 
reintroduce cross version config tests

The `cross-version-config-tests` CI job had to be removed due to radical
differences between meson and autoconf. With the release of 9.21.11
this job now can be reintroduced by comparing two meson built BIND
source trees.

10 months agofix: ci: Revert "Capture scripts for Coverity Scan analysis"
Michal Nowak [Thu, 31 Jul 2025 10:35:41 +0000 (12:35 +0200)] 
fix: ci: Revert "Capture scripts for Coverity Scan analysis"

This reverts commit b4a2674d98902983e8096c99b747343482d30673.

The --fs-capture-search option is no more. The ability to analyse Python
scripts in Coverity turned out to be questionable anyways.

Closes #5456

Merge branch '5456-coverity-scan-drop-fs-capture-search-option' into 'main'

See merge request isc-projects/bind9!10808

10 months agoRevert "Capture scripts for Coverity Scan analysis"
Michal Nowak [Thu, 31 Jul 2025 09:37:27 +0000 (11:37 +0200)] 
Revert "Capture scripts for Coverity Scan analysis"

This reverts commit b4a2674d98902983e8096c99b747343482d30673.

The --fs-capture-search option is no more. The ability to analyse Python
scripts in Coverity turned out to be questionable anyways.

10 months agochg: ci: Log packages, test AlmaLinux 9
Petr Špaček [Thu, 31 Jul 2025 08:39:27 +0000 (08:39 +0000)] 
chg: ci: Log packages, test AlmaLinux 9

Merge branch 'pspacek/ci-platforms-and-logging' into 'main'

See merge request isc-projects/bind9!10799

10 months agoLog all installed system packages and Python libraries before build
Petr Špaček [Wed, 30 Jul 2025 12:12:51 +0000 (14:12 +0200)] 
Log all installed system packages and Python libraries before build

10 months agoRun MR pipelines also on AlmaLinux 9
Petr Špaček [Wed, 30 Jul 2025 12:03:40 +0000 (14:03 +0200)] 
Run MR pipelines also on AlmaLinux 9

Turns out Python version there is older than elsewhere.

10 months agochg: dev: Check meson.build formatting in CI
Michał Kępień [Wed, 30 Jul 2025 15:41:13 +0000 (17:41 +0200)] 
chg: dev: Check meson.build formatting in CI

Add a new CI job that checks whether all meson.build files in the
repository are formatted in the exact same way as "muon fmt" would
format them.  This enforces formatting consistency across all
meson.build files in the repository and enables updating their contents
using dedicated tools, e.g. "meson rewrite".

See #5379

Merge branch '5379-check-meson.build-formatting-in-ci' into 'main'

See merge request isc-projects/bind9!10770

10 months agoCheck meson.build formatting in CI
Michał Kępień [Wed, 30 Jul 2025 15:37:38 +0000 (17:37 +0200)] 
Check meson.build formatting in CI

Add a new CI job that checks whether all meson.build files in the
repository are formatted in the exact same way as "muon fmt" would
format them.  This enforces formatting consistency across all
meson.build files in the repository and enables updating their contents
using dedicated tools, e.g. "meson rewrite".

10 months agoFix system test compatibility with old Python
Petr Špaček [Wed, 30 Jul 2025 14:35:45 +0000 (14:35 +0000)] 
Fix system test compatibility with old Python

Merge branch 'pspacek/test-compatibility' into 'main'

See merge request isc-projects/bind9!10797

10 months agoFix compatibility with Python < 3.10
Petr Špaček [Wed, 30 Jul 2025 08:10:59 +0000 (10:10 +0200)] 
Fix compatibility with Python < 3.10

Dataclass kw_only argument was added only in Python 3.10 but EL9 image
has only 3.9.21.

10 months agoFix minimal dnspython version test
Petr Špaček [Wed, 30 Jul 2025 07:49:27 +0000 (09:49 +0200)] 
Fix minimal dnspython version test

Wrong version number was uncovered by Ubuntu 22.04 Jammy which actually
has dnspython 2.1.0.

10 months agofix: test: fix macOS build for plugin unit test
Colin Vidal [Wed, 30 Jul 2025 10:11:46 +0000 (12:11 +0200)] 
fix: test: fix macOS build for plugin unit test

MR !10753 breaks macOS build for plugin unit test as its linker doesn't
supports `--wrap` option, which is used in in order to mock the function
`isc_file_exits()`.

To work around the problem, a mocked `isc_file_exits()` is implemented
inside the plugin test as a static function before inlining the file
using it, which effectively links to this version rather than the isclib
one.

Closes #5455

Merge branch '5455-fix-macos-build-plugintest' into 'main'

See merge request isc-projects/bind9!10796

10 months agofix ns_plugin_expandpath tests with no extension
Colin Vidal [Wed, 30 Jul 2025 08:35:26 +0000 (10:35 +0200)] 
fix ns_plugin_expandpath tests with no extension

Parts of ns_plugin_expandpath() test expected the plugin extension to be
appened automatically (the plugin name/path is provided without the
extension), this enable to test the logic which adds the correct
extension based on the platfrom.

But the expected expanded paths from the test were hard coded with the
`.so` extension, so the test can't pass on macOS platform. This fixes
the test by using the macro providing the current-platform extension.

10 months agofix macOS build for plugin unit test
Colin Vidal [Wed, 30 Jul 2025 07:54:05 +0000 (09:54 +0200)] 
fix macOS build for plugin unit test

MR !10753 breaks macOS build for plugin unit test as its linker doesn't
supports `--wrap` option, which is used in in order to mock the function
`isc_file_exits()`.

To work around the problem, a mocked `isc_file_exits()` is implemented
inside the plugin test as a static function before inlining the file
using it, which effectively links to this version rather than the isclib
one.

10 months agonew: test: add helper functions to isctest
Evan Hunt [Tue, 29 Jul 2025 22:56:53 +0000 (22:56 +0000)] 
new: test: add helper functions to isctest

added some helper functions in isctest to reduce code repetition
in dnssec-related tests:

- isctest.check.adflag() - checks that a response contains AD=1
- isctest.check.noadflag() - checks that a response contains AD=0

- isctest.check.rdflag() - checks that a response contains RD=1
- isctest.check.nordflag() - checks that a response contains RD=0

- isctest.check.raflag() - checks that a response contains RA=1
- isctest.check.noraflag() - checks that a response contains RA=0

- isctest.check.rr_count_eq() - checks the number of RRsset in a section

- isctest.check.same_data() - checks that two message have the
                              same rcode and data
- isctest.check.same_answer() - checks that two message have the same
                                rcode and answer

- isctest.query.create() - a wrapper for dns.message.make_query() that
                           creates a query message similar to dig +dnssec

Merge branch 'each-isctest-helpers' into 'main'

See merge request isc-projects/bind9!10760

10 months agoUse isctest.query.create across system tests
Nicki Křížek [Mon, 14 Jul 2025 12:58:51 +0000 (14:58 +0200)] 
Use isctest.query.create across system tests

Rather than using the dnspython's facilities and defaults to create the
queries, use the isctest.query.create function in all the cases that
don't require special handling to have consistent defaults.

10 months agoAdd RA flag checks to isctest.check
Nicki Křížek [Fri, 25 Jul 2025 09:19:46 +0000 (11:19 +0200)] 
Add RA flag checks to isctest.check

10 months agoRefactor and move query helper to isctest.query.create
Nicki Křížek [Fri, 25 Jul 2025 08:30:54 +0000 (10:30 +0200)] 
Refactor and move query helper to isctest.query.create

Make the query helper function more universal and reusable across our
system tests -- default to using EDNS and sending AD=1.

10 months agoUnify RR counting in isctest.check helper
Nicki Křížek [Fri, 25 Jul 2025 09:09:30 +0000 (11:09 +0200)] 
Unify RR counting in isctest.check helper

Use a common function to count the number of RRs in any section of the
DNS message. For the ADDITIONAL section, stick with the dnspython
convention of not including OPT and TSIG.

10 months agoRefactor isctest.check.section_equal comparison
Nicki Křížek [Thu, 10 Jul 2025 14:23:48 +0000 (16:23 +0200)] 
Refactor isctest.check.section_equal comparison

Use the same logic as dnspython uses in dns.message.Message.

10 months agoadd helper functions to isctest
Evan Hunt [Thu, 26 Jun 2025 22:19:45 +0000 (15:19 -0700)] 
add helper functions to isctest

added some helper functions in isctest to reduce code repetition
in dnssec-related tests:

- isctest.check.adflag() - checks that a response contains AD=1
- isctest.check.noadflag() - checks that a response contains AD=0

- isctest.check.rdflag() - checks that a response contains RD=1
- isctest.check.nordflag() - checks that a response contains RD=0

- isctest.check.answer_count_eq() - checks the answer count is correct
- isctest.check.additional_count_eq() - same for authority count
- isctest.check.authority_count_eq() - same for additional count

- isctest.check.same_data() - check that two message have the
                              same rcode and data
- isctest.check.same_answer() - check that two message have the same
                                rcode and answer

- isctest.dnssec.msg() - a wrapper for dns.message.make_query() that
                         creates a query message similar to dig +dnssec:
                         use_edns=True, want_dnssec=True,
                         and flags are set to (RD|AD) by default, but
                         options exist to disable AD or enable CD.
                         (to generate non-DNSSEC queries, use
                         message.make_query() directly.)

10 months agofix: test: Improve key collision detection in ksr system test alessio/aligned-atomics-baseline
Matthijs Mekking [Tue, 29 Jul 2025 12:46:20 +0000 (12:46 +0000)] 
fix: test: Improve key collision detection in ksr system test

MR !10238 added key collision detection in the ksr system test but it was flawed because for every "collide" in the output we also log
"Generating an new key" and for each "Generating" we add the counter by one, nullifying the subtract by one.

Fix by splitting the output on ':' rather than on the default whitespace. Also make the substring matching more strict.

Closes #5229 (again)

Merge branch '5229-ksr-key-collision' into 'main'

See merge request isc-projects/bind9!10775

10 months agoImprove key collision detection in ksr system test
Matthijs Mekking [Fri, 25 Jul 2025 09:05:41 +0000 (11:05 +0200)] 
Improve key collision detection in ksr system test

MR !10238 added key collision detection in the ksr system test but it
was flawed because for every "collide" in the output we also log
"Generating an new key" and for each "Generating" we add the counter
by one, nullifying the subtract by one.

Use regular expressions to search in the output and make the string
expression more strict.

10 months agonew: test: Robust tests for NSEC3 nonexistent QNAME proof
Petr Špaček [Tue, 29 Jul 2025 08:54:27 +0000 (08:54 +0000)] 
new: test: Robust tests for NSEC3 nonexistent QNAME proof

Related to #5292

Merge branch '5292-wrong' into 'main'

See merge request isc-projects/bind9!10416

10 months agoAdjust type hints for the "nsec3-answer" test
Michał Kępień [Fri, 25 Jul 2025 12:50:49 +0000 (14:50 +0200)] 
Adjust type hints for the "nsec3-answer" test

Add missing type hints in the tests_nsec3.py module.  Tweak the syntax
used for type hints for better consistency with other Python code in
bin/tests/system/.

10 months agoAdd more empty non-terminals to test zone
Petr Špaček [Fri, 11 Jul 2025 11:33:46 +0000 (13:33 +0200)] 
Add more empty non-terminals to test zone

I don't know exactly why, I just have a feeling there might be
interesting corner cases somewhere.

10 months agoRandomize NSEC3 salt
Petr Špaček [Fri, 11 Jul 2025 09:17:05 +0000 (11:17 +0200)] 
Randomize NSEC3 salt

This should prevent the case where are are unlucky enough that static
values hash 'just right' for the test to pass, but only accidentally.

10 months agoTest proof of nonexistance of DS in insecure referrals
Petr Špaček [Fri, 11 Jul 2025 08:22:33 +0000 (10:22 +0200)] 
Test proof of nonexistance of DS in insecure referrals

Currently this test is limited only to auth because currently BIND
resolver does not send DS proof of nonexistence for RD=0 queries.

10 months agoTest dangling DNAME answers come with NXDOMAIN proofs
Petr Špaček [Thu, 10 Jul 2025 13:14:06 +0000 (15:14 +0200)] 
Test dangling DNAME answers come with NXDOMAIN proofs

Simplistic test. Ignores the possibility of DNAME chain going through
multiple zones and/or wildcard expansions.

10 months agoTest dangling CNAMEs come with NXDOMAIN proofs
Petr Špaček [Thu, 10 Jul 2025 11:13:02 +0000 (13:13 +0200)] 
Test dangling CNAMEs come with NXDOMAIN proofs

Simplistic test. Ignores the possibility of CNAME chain going through
multiple zones and/or wildcard expansions.

10 months agoMove query outside of check_() functions
Petr Špaček [Thu, 10 Jul 2025 12:45:35 +0000 (14:45 +0200)] 
Move query outside of check_() functions

This allows better check() code reuse.

10 months agoSeparate test into a new directory
Petr Špaček [Mon, 30 Jun 2025 15:03:50 +0000 (17:03 +0200)] 
Separate test into a new directory

The test actually needs just two servers - auth and resolver. The rest
was not needed and made test setup only slower and harder to debug.

10 months agoTest simple NODATA answers with NSEC3
Petr Špaček [Mon, 9 Jun 2025 09:15:04 +0000 (11:15 +0200)] 
Test simple NODATA answers with NSEC3

10 months agoDetect extraneous NSEC3 RRs in responses
Petr Špaček [Mon, 9 Jun 2025 09:01:27 +0000 (11:01 +0200)] 
Detect extraneous NSEC3 RRs in responses

We expect minimal possible answers which prove what they have to
according to DNSSEC protocol.

10 months agoMove proof checking into a NSEC3Checker class
Petr Špaček [Mon, 9 Jun 2025 08:46:34 +0000 (10:46 +0200)] 
Move proof checking into a NSEC3Checker class

10 months agoAdd consistency checks to responses with NSEC3
Petr Špaček [Fri, 6 Jun 2025 15:10:42 +0000 (17:10 +0200)] 
Add consistency checks to responses with NSEC3

Basic sanity checks - limited to responses from a single zone:
- NSEC3 type cannot be present in type bitmap:
  By definition, the type bitmap describes state of the unhashed name
  but NSEC3 RR is present at a different owner name. RFC 7129 section 5
- NSEC3 owner names cannot be duplicated:
  Unless the response crosses zone boundary, parent zone has insecure
  delegation for child, but child is signed ... don't do that.
- All parameters are consistent across all RRs present in answer:
  RFC 5155 section 7.2, last paragraph - at least when we don't cross
  zone boundary.

10 months agoSplit NXDOMAIN/NOERROR/NODATA test cases
Petr Špaček [Thu, 5 Jun 2025 13:15:08 +0000 (15:15 +0200)] 
Split NXDOMAIN/NOERROR/NODATA test cases

Untangling individual cases allows for clearer documentation and makes
it easier to build similar but slightly different test cases.  Wildcard
NODATA answer was added.

10 months agoExtract closest encloser and source of synthesis logic into ZoneAnalyzer
Petr Špaček [Tue, 3 Jun 2025 15:20:54 +0000 (17:20 +0200)] 
Extract closest encloser and source of synthesis logic into ZoneAnalyzer

As a side-effect, we now have set of all existing names in a zone with a
test, too. These parts should be shared with new NSEC tests.

10 months agoUse isctest library to check hypothesis version
Petr Špaček [Mon, 2 Jun 2025 11:06:54 +0000 (13:06 +0200)] 
Use isctest library to check hypothesis version

Side-effect of importing from isctest.hypothesis first is a version
check and clean Pytest skip if version is too old.

10 months agoGenerate comprehensive tests for ZoneAnalyzer utility class
Petr Špaček [Fri, 23 May 2025 07:07:02 +0000 (09:07 +0200)] 
Generate comprehensive tests for ZoneAnalyzer utility class

Test all combinations of wildcard, ENT, DNAME, NS, and ordinary
TXT records.

Test zone and expected outputs are generated by another script which
encodes node content into node name. This encoding removes 'node
content' level of indirection and thus enables simpler implementation of
same logic which needs to be in ZoneAnalyzer itself.

For humans the generated zone file also lists expected 'categories' a
name belongs to as dot-separated list on right hand side of a generated
RR.

10 months agoTest ZoneAnalyzer utility class
Petr Špaček [Wed, 21 May 2025 15:58:17 +0000 (17:58 +0200)] 
Test ZoneAnalyzer utility class

I've considered writing hypothesis test for this but I would have to
reimplement the same thing, which would probably have the same logic
bugs, so I will leave it as an exercise for someone else.

10 months agoSeparate zone analyzer from NSEC3 test
Petr Špaček [Wed, 21 May 2025 14:40:01 +0000 (16:40 +0200)] 
Separate zone analyzer from NSEC3 test

Code to generate ENTs, detect wildcards, occlusion etc. is generic
enough to be in an utility module.

10 months agoShorten syntax to access Name object
Petr Špaček [Wed, 21 May 2025 13:19:25 +0000 (15:19 +0200)] 
Shorten syntax to access Name object

dns.name all over the place does not make it easier to read the code at
all, and I'm going to add lot more code here.

10 months agoMove multi-subdomain name generator into shared utilities
Petr Špaček [Wed, 21 May 2025 12:55:45 +0000 (14:55 +0200)] 
Move multi-subdomain name generator into shared utilities

10 months agoAdd property based test for nsec3hash utility
Evan Hunt [Wed, 30 Apr 2025 00:03:47 +0000 (17:03 -0700)] 
Add property based test for nsec3hash utility

Check the correctness of NSEC3 hash generation by generating random
combinations of name, salt, and iterations and comparing the outputs
of the nsec3hash tool against the dnspython nsec3_hash function
for the same inputs.

10 months agoTest also with subdomains of existing names
Petr Špaček [Wed, 7 May 2025 13:45:24 +0000 (15:45 +0200)] 
Test also with subdomains of existing names

Composite strategy makes sure we always test with a subdomain of an
existing name.

10 months agoDedup NSEC3 get_next_name function
Petr Špaček [Wed, 7 May 2025 14:58:08 +0000 (16:58 +0200)] 
Dedup NSEC3 get_next_name function

10 months agoAdd a property based test for NSEC3 proofs for non-existent QNAMEs
Matthijs Mekking [Tue, 29 Apr 2025 13:01:53 +0000 (15:01 +0200)] 
Add a property based test for NSEC3 proofs for non-existent QNAMEs

For any given NSEC3 signed zone, when doing queries for non-existent
names, the response must contain:
- NSEC3 RR that matches the closest encloser,
- NSEC3 RR that covers the next closer name,
- NSEC3 RR that covers the wildcard.

10 months agoCheck that correct NSEC3 proofs are returned
Mark Andrews [Tue, 22 Apr 2025 08:47:19 +0000 (18:47 +1000)] 
Check that correct NSEC3 proofs are returned

10 months agochg: usr: plugin extension in plugin path is now optional
Colin Vidal [Mon, 28 Jul 2025 21:43:11 +0000 (23:43 +0200)] 
chg: usr: plugin extension in plugin path is now optional

Plugin configuration no longer requires the library file extension, so it is now possible to invoke a plugin using the syntax `plugin query "library"` instead of `plugin query "libary.so"`.

Closes #5377

Merge branch '5377-implicit-plugin-ext' into 'main'

See merge request isc-projects/bind9!10753

10 months agoupdate ARM plugin documentation
Colin Vidal [Thu, 24 Jul 2025 08:51:32 +0000 (10:51 +0200)] 
update ARM plugin documentation

Update the ARM documentation of plugin usage as the extension in the
plugin library path is now optional.

10 months agoupdate test_hooks system tests
Colin Vidal [Tue, 22 Jul 2025 12:43:26 +0000 (14:43 +0200)] 
update test_hooks system tests

Add the case where the plugin name is provided without the extension in
the test_hooks system tests.

10 months agons_plugin_expandpath() auto-extension unit-tests
Colin Vidal [Mon, 21 Jul 2025 13:58:31 +0000 (15:58 +0200)] 
ns_plugin_expandpath() auto-extension unit-tests

Update existing ns_plugin_expandpath() unit test to cover the logic
appending the plugin extension if missing.

Because ns_plugin_expandpath() now relies on isc_file_exists() API, a
mocked version has been added in tests/ns/plugin_test.c and relies on the
linker --wrap mechanism.

10 months agoplugin expand path automatically adds extension
Colin Vidal [Mon, 21 Jul 2025 13:06:11 +0000 (15:06 +0200)] 
plugin expand path automatically adds extension

If a plugin is configured without the extension,
`ns_plugin_expandpath()` automatically take cares of appending the
suffix to the path. The way it works is by checking if a file exists at
the expanded path. If it doesn't, it assumes the plugin path (or name)
doesn't have the extension and append the extension (which is
platform-specific) to the actual path.

10 months agoExport plugin extension in config.h
Colin Vidal [Mon, 21 Jul 2025 12:38:30 +0000 (14:38 +0200)] 
Export plugin extension in config.h

Dynamically loadable libraries all use the `.so` extension on
BIND9-supported platforms, except for macOS. Export the dynamic library
extension of the current build platform in the generated `config.h`
file, in order to let the plugin code building plugin path based on a
simple plugin name. (which then would be platform-independent)

10 months agonew: ci: Add AlmaLinux 10 FIPS
Michal Nowak [Mon, 28 Jul 2025 17:29:55 +0000 (19:29 +0200)] 
new: ci: Add AlmaLinux 10 FIPS

Merge branch 'mnowak/add-almalinux-10-fips' into 'main'

See merge request isc-projects/bind9!10722