Commit graph

44417 commits

Author SHA1 Message Date
Nicki Křížek
b1ffc80f26 Remove obsolete dnspython prerequisite checks
dnspython has been mandatory to run system test for quite a while.
Remove all extraneous checks for this module from prereq.sh scipts.
2025-11-28 11:24:11 +01:00
Nicki Křížek
156b213d62 Remove extraneous prerequisite script for timeouts test
The timeouts test already checks for dnspython>=2.0.0 in
test_tcp_timeouts.py and the prereq.sh file is not needed.
2025-11-28 11:24:11 +01:00
Nicki Křížek
fe92341fd3 Remove obsolete checks for PYTHON executable
Python has been required to run the system test suite for quite a while.
Remove the dated checks inside system tests which are no longer needed.
2025-11-28 11:24:11 +01:00
Ondřej Surý
a81aad0cdc fix: usr: Fix caching RRSIG covering cache NODATA record
When a RRSIG for type that we already have cached NODATA record was cached due to mismatch of the records on the upstream nameservers, an assertion failure could trigger.  This has been fixed.

Closes #5633

Merge branch '5633-evict-related-rrsig-when-adding-negative-header' into 'main'

See merge request isc-projects/bind9!11228
2025-11-28 10:51:38 +01:00
Ondřej Surý
125d7aa232
Fix not caching RRSIG covering cache NODATA record
During refactoring, a condition that prevented caching RRSIGs for
records that we already have cached NODATA records was changed in an
invalid way.  This was caught later when a cached NODATA(type) +
RRSIG(type) was found in the cache and caused an assertion failure.

Fix and simplify condition that prevents adding such RRSIGs.
2025-11-28 10:10:14 +01:00
Ondřej Surý
3d2244a745
Refactor the conditions when adding new NEGATIVE header
Refactor the block when adding existing negative header under common
block, so it is easier to understand that the two conditions inside are
related.
2025-11-28 10:10:14 +01:00
Ondřej Surý
f4adabb2dd
Evict the RRSIG when adding negative header
Formerly, we've evicted the RRSIG(type) only when we were changing
existing header from positive to negative.  Move the eviction routine
for the RRSIG to a common path, so the RRSIG also gets evicted when we
are adding new negative header for a specific type.
2025-11-28 10:10:14 +01:00
Colin Vidal
51af07cdee fix: usr: Fix parsing bug in remote-servers with key or tls
The :any:`remote-servers` clause enable the following pattern using a named ``server-list``:

	remote-servers a { 1.2.3.4; ... };
	remote-servers b { a key foo; };

However, such configuration was wrongly rejected, with an "unexpected token 'foo'" error. Such configuration is now accepted.

Closes #5646

Merge branch '5646-fix-named-remote-servers-key-tls' into 'main'

See merge request isc-projects/bind9!11252
2025-11-28 09:51:24 +01:00
Colin Vidal
4bc435ab10 add checkconf test for named remote-servers
Add checkconf system test to cover usage of `remote-servers` with a
named server-list and a `key` and/or a `tls` option.
2025-11-28 09:10:54 +01:00
Colin Vidal
2956e4fc45 check validity of key and tls in a server-list
If a `key` or `tls` is associated to an IP address inside a server-list,
only the `tls` existence in the configuration was checked. Also, if
`key` or `tls` is associated to a named server-list inside a
server-list, there was no check at all.

Add the check for making sure a `key` is defined in the configuration,
as well as the check for `key` and `tls` when used on a named
server-list.
2025-11-28 09:10:54 +01:00
Colin Vidal
1a732b6b8e check remote-servers list correctness
`check.c` only checks if `remote-servers`, `primaries`, etc. are not
duplicated inside the configuration file, but does not check the
correctness of its definition. This commit fixes this by calling
`validate_remotes()` for each `remote-servers` (and other aliases),
which validates the correctness of the definition itself (this is the
same call done to validate other cases like `also-notify`, etc.).
2025-11-28 09:10:54 +01:00
Colin Vidal
ccb82ea85d refactoring of named_config_getipandkeylist
Function `named_config_getipandkeylist()` processes the nested lists by
overriding the current local variable of the function, jumping back to
the beginning of the list processing. Of course, in order to go back to
the previous state and process the remaining items of the current list,
a "stack" array is used in order to put and get back the next list
element and associated values.

This makes the logic quite complex and error prone. Instead, this commit
changes the logic by recursing into the nested list (while sharing a
state between all the invocations). The processing is fundamentally
identical, but instead of "manually" handling the stack to go back to
the previous state (and process remaining elements of the current list),
takes advantage of recursion.
2025-11-28 09:10:53 +01:00
Colin Vidal
e732a8d25a minimal fix for missing key/tls in named remote-servers
The following case

   remote-servers foo { 10.53.0.5; };
   remote-servers bar { foo key fookey; };

did not work: the `fookey` was silently ignored. No matter how `bar` was
used, the server `10.53.0.5` wouldn't be contacted using the TSIG key
`fookey`. The problem is the same the for `tls` property.

The reason of the problem was that when `named_config_getipandkeylist()`
reached a named server-list (here, `foo`), it modified the current
context in order to immediately process what is inside `foo`, but forgot
to look at the fields `key` and `tls`, to associate those with `foo`
addresses.

Fix the problem by wrapping the `key` and `tls` from the "caller" list
inside the existing `lists` struct which is used to figure out if a
list is already processed or not. That way, the `key` and `tls` values
can be read when adding the addresses of the nested list.
2025-11-28 09:10:53 +01:00
Colin Vidal
9c96c38268 remove dns_notify_dequeue
Function `dns_notify_dequeue` is dead code, removing it.
2025-11-28 09:10:53 +01:00
Colin Vidal
32a4aa95ae test named remote-servers key usage
Even though `remote-servers` now allows using named server-list with `key`
(or `tls`), the `key` or `tls` is not used, in the context of a named
server-list, when configuring the server.

For instance,

   remote-servers foo { 10.53.0.5; };
   also-notify { foo key fookey; };

won't use `fookey`.

Add a system test highlighting the problem.
2025-11-28 09:10:53 +01:00
Colin Vidal
046c6819b2 allow named remote-servers list with key or tls
The remote-servers clause enables the following pattern:

	remote-servers a { 1.2.3.4; ... };
	remote-servers b { a key foo; };

However, `check.c` was explicitly throwing an error if a `key` or `tls`
was provided after a named server-list. Remove this check, as this is a
valid use case.
2025-11-28 09:10:53 +01:00
Arаm Sаrgsyаn
d441e14cbf fix: usr: Fix TLS contexts cache object usage bug in the resolver
:iscman:`named` could terminate unexpectedly when reconfiguring or
reloading, and if client-side TLS transport was in use (for example,
when forwarding queries to a DoT server). This has been fixed.

Closes #5653

Merge branch '5653-tlsctx_cache-reference-bug-fix' into 'main'

See merge request isc-projects/bind9!11295
2025-11-27 17:41:17 +00:00
Aram Sargsyan
ed7b08c0c4 Fix a bug where tlsctx_cache could be destroyed while still in use
When named is being reconfigured, it detaches from the old
'isc_tlsctx_cache_t' TLS context cache object and creates a
new one. This can cause an assertion failure within the
resolver when the object is destroyed while still in use,
because the resolver is using the object without getting
attached to it.

Add an attach/detach so that the 'isc_tlsctx_cache_t' doesn't
get destroyed while still being in use.
2025-11-27 16:45:55 +00:00
Ondřej Surý
908b7c1f34 fix: usr: Fix the spurious timeouts while resolving names
Sometimes the loops in the resolving (e.g. to resolve or validate ns1.example.com we need to resolve ns1.example.com) were not properly detected leading to spurious 10 seconds delay.  This has been fixed and such loops are properly detected.

Closes #3033, #5578

Merge branch '5578-tracker-parent-fetch' into 'main'

See merge request isc-projects/bind9!11138
2025-11-27 17:34:42 +01:00
Ondřej Surý
4d307ac67a
Detect resolution loops between fetches
Maintain the relationship between the parent and child fetch and when
creating a new child fetch, properly check the resolution loops that
would lead to a new fetch would join one of the parent's fetch contexts.
2025-11-27 17:34:25 +01:00
Ondřej Surý
15494053b1 chg: usr: Change the QNAME minimization algorithm to follow the standard
In !9155, the QNAME minimization was changed to not leak the query type
to the parent name server.  This violates RFC 9156 Section 3, step (3)
and it is not necessary.  It also breaks some (weird) authoritative DNS
setups, especially when CNAMEs are involved.  Also there is really no
privacy leak with query type.

Closes #5661

Merge branch '5661-dont-minimize-when-QNAME-matches-original-QNAME' into 'main'

See merge request isc-projects/bind9!11293
2025-11-27 17:34:07 +01:00
Ondřej Surý
ed460c50b7
Change the QNAME minimization algorithm to follow the standard
In !9155, the QNAME minimization was changed to not leak the query type
to the parent name server.  This violates RFC 9156 Section 3, step (3)
and it is not necessary.  It also breaks some (weird) authoritative DNS
setups, especially when CNAMEs are involved.  Also there is really no
privacy leak with query type.
2025-11-27 16:47:29 +01:00
Michal Nowak
40c375c58e new: ci: Add Fedora 43
Merge branch 'mnowak/fedora-43' into 'main'

See merge request isc-projects/bind9!11285
2025-11-27 16:35:22 +01:00
Michal Nowak
350c3a9a19
Add Fedora 43 2025-11-27 16:30:30 +01:00
Nicki Křížek
d2777a6e78 new: test: Create trust anchors from isctest.kasp.Key
Add isctest.kasp.Key.into_ta() method which convert the key into DS /
DNSKEY trust anchor for BIND config. Add a shared template
trusted.conf.j2 which can be linked to in tests to create the trust
anchor configuration from trust anchor data returned from bootstrap()
function.

This is basically a python replacement for the keyfile_to_static_ds (and
friends) from the conf.sh shell framework.

Merge branch 'nicki/pytest-add-trust-anchor-template' into 'main'

See merge request isc-projects/bind9!11201
2025-11-27 14:49:01 +01:00
Nicki Křížek
2f2be20547 Mock DSDigest for compatibility with older dnspython
DSDigest class isn't available prior to dnspython 2.0.0 and prior to Add
an isctest.compat.DSDigest compatibility hack to support those versions.
2025-11-27 14:02:49 +01:00
Nicki Křížek
f6cb154b65 Add a template for TA and generate it from isctest.kasp.Key
Add isctest.kasp.Key.into_ta() method which convert the key into DS /
DNSKEY trust anchor for BIND config. Add a shared template
trusted.conf.j2 which can be linked to in tests to create the trust
anchor configuration from trust anchor data returned from bootstrap()
function.

This is basically a python replacement for the keyfile_to_static_ds (and
friends) from the conf.sh shell framework.
2025-11-27 14:02:49 +01:00
Nicki Křížek
0bf20f8d68 Parse DNSKEY into a dnspython type in isctest.kasp.Key.dnskey
Previously, a DNSKEY string from keyfile was returned. This made the
function brittle for further processing, as the string would have to be
split up, concatenated, and TTL could be missing, making string indices
context-dependent.

Parse the DNSKEY rrset into a proper dnspython object and return it.
This makes the output more predictable and reliable, as all the
neccessary parsing is done by dnspython.
2025-11-27 14:02:49 +01:00
Alessio Podda
1ede6683cd fix: dev: Add support for more linkers with LTO
Link-time optimization requires close coordination between the compiler
and the linker, so not all combinations of compiler and linker support
it.

Previously, when compiling with Clang, we checked only for lld. With
this commit, we expand the list of supported linkers we check for.

Closes #5536

Merge branch '5536-more-supported-linker-ids' into 'main'

See merge request isc-projects/bind9!11022
2025-11-27 12:36:57 +00:00
Alessio Podda
1378aeefa5 Add auto LTO option
Add an auto option to named-lto that disables weird setups like clang +
ld.bfd.
2025-11-27 13:00:22 +01:00
Alessio Podda
d5b8adf084 Rename -Dnamed-lto=off to -Dnamed-lto=disabled
Meson boolean options are usually configured with enabled/disabled
instead of on/off. Make things more consistent with other meson options
by renaming -Dnamed-lto=off to -Dnamed-lto=disabled.
2025-11-27 13:00:22 +01:00
Alessio Podda
fbecbfd5e2 Add support for more linkers with LTO
Link-time optimization requires close coordination between the compiler
and the linker, so not all combinations of compiler and linker support
it.

Previously, when compiling with Clang, we checked only for lld. With
this commit, we expand the list of supported linkers we check for.
2025-11-27 13:00:22 +01:00
Ondřej Surý
d8410f93d2 chg: dev: Use malloc_usable_size()/malloc_size() for memory accounting
Restore usage of malloc_usable_size()/malloc_size(), but this time only
for memory accounting and statistics purposes.  This should reduce the
memory footprint in case of compilation without jemalloc as we don't
have to keep track of the allocated memory size ourselves.

Merge branch 'ondrej/use-malloc_usable_size-when-available' into 'main'

See merge request isc-projects/bind9!11271
2025-11-27 12:42:09 +01:00
Ondřej Surý
d6e2bf2b3d
Use malloc_usable_size()/malloc_size() for memory accounting
Restore usage of malloc_usable_size()/malloc_size(), but this time only
for memory accounting and statistics purposes.  This should reduce the
memory footprint in case of compilation without jemalloc as we don't
have to keep track of the allocated memory size ourselves.
2025-11-27 11:07:55 +01:00
Ondřej Surý
def4be7cb6 rem: dev: Remove internal memory filling in favor of jemalloc opt.junk
Instead of having our own implementation of memory junk filling, rely on
the jemalloc opt.junk feature (set with MALLOC_CONF="junk:true").

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

See merge request isc-projects/bind9!11270
2025-11-27 10:40:28 +01:00
Ondřej Surý
52e2cb4d56
Enable junk filling via jemalloc option in the CI
Since the filling memory with junk patterns have been removed from ISC
memory context in favor of jemalloc opt.junk option, enable the jemalloc
behaviour by default in the GitLab CI.
2025-11-27 10:40:18 +01:00
Ondřej Surý
d08d0d81ac
Remove internal memory filling in favor of jemalloc opt.junk
Instead of having our own implementation of memory junk filling, rely on
the jemalloc opt.junk feature (set with MALLOC_CONF="junk:true").
2025-11-27 10:40:18 +01:00
Ondřej Surý
c1fea47f75 chg: nil: Add optional debugging output for fetch context reference counting
As the fetch context reference counting was converted to userspace RCU
reference counting, the ability to debug the reference counting was
lost.  Restore the debugging by adding the optional compile-time enabled
debugging output again.

Merge branch 'ondrej/add-tracing-to-fctx-reference-counting' into 'main'

See merge request isc-projects/bind9!11230
2025-11-27 10:39:37 +01:00
Ondřej Surý
3e971db1ed
Add optional debugging output for fetch context reference counting
As the fetch context reference counting was converted to userspace RCU
reference counting, the ability to debug the reference counting was
lost.  Restore the debugging by adding the optional compile-time enabled
debugging output again.
2025-11-27 10:39:23 +01:00
Ondřej Surý
aa14165656 chg: nil: Split qctx_destroy() into qctx_deinit() and qctx_destroy()
The qctx_destroy() only needs to be called on allocated memory and
qctx_deinit() needs to be called always.  Also remove .allocated member
from the query_ctx_t structure.

Merge branch 'ondrej/add-qctx-deinit' into 'main'

See merge request isc-projects/bind9!11273
2025-11-27 10:38:58 +01:00
Ondřej Surý
e94a31a666
Split qctx_destroy() into qctx_deinit() and qctx_destroy()
The qctx_destroy() only needs to be called on allocated memory and
qctx_deinit() needs to be called always.  Also remove .allocated member
from the query_ctx_t structure.
2025-11-27 10:37:58 +01:00
Ondřej Surý
7a8f4e136c fix: nil: Remove .delegating flag from the qpcache
The .delegating flag was only set, but never used in the dns_qpcache.
Remove it completely together with the code that was locking the node
to set the flag if the added type was DNAME.

Merge branch 'ondrej/remove-delegating-from-qpcache' into 'main'

See merge request isc-projects/bind9!10980
2025-11-27 10:37:36 +01:00
Ondřej Surý
0232017604
Remove .delegating flag from the qpcache
The .delegating flag was only set, but never used in the dns_qpcache.
Remove it completely together with the code that was locking the node
to set the flag if the added type was DNAME.
2025-11-27 10:37:09 +01:00
Ondřej Surý
6fd209b6f0 chg: dev: Use atomics for CMM_{LOAD,STORE}_SHARED with ThreadSanitizer
Upstream has removed the atomics implementation of CMM_LOAD_SHARED and
CMM_STORE_SHARED as these can be used also with non-stdatomics types.
As we only use the CMM api with stdatomics types, we can restore the
previous behaviour to prevent ThreadSanitizer warnings.

Closes #5660

Merge branch '5660-use-atomics-for-CMM-api-with-thread-sanitizer' into 'main'

See merge request isc-projects/bind9!11288
2025-11-27 10:31:57 +01:00
Ondřej Surý
539be61b68
Use atomics for CMM_{LOAD,STORE}_SHARED with ThreadSanitizer
Upstream has removed the atomics implementation of CMM_LOAD_SHARED and
CMM_STORE_SHARED as these can be used also with non-stdatomics types.
As we only use the CMM api with stdatomics types, we can restore the
previous behaviour to prevent ThreadSanitizer warnings.
2025-11-26 17:14:12 +01:00
Andoni Duarte
1b127320b3 chg: ci: Fix wiki.wireshark.org links in doc/arm
Fix the broken link https://wiki.wireshark.org/TLS#tls-decryption to
simply https://wiki.wireshark.org/TLS. The links in the wireshark
wiki have been updated somewhen after october 2025 as shown by
https://web.archive.org/web/20251008165051/https://wiki.wireshark.org/TLS#tls-decryption and https://wiki.wireshark.org/TLS.

Merge branch 'andoni/fix-wireshark-links-in-doc-arm' into 'main'

See merge request isc-projects/bind9!11284
2025-11-26 14:06:24 +00:00
Andoni Duarte Pintado
fe98568be6 Update wiki.wireshark.org link in doc/arm
Fix the broken link https://wiki.wireshark.org/TLS#tls-decryption.
Since their TOC also has the wrong anchor, we remove it altogether,
i.e. https://wiki.wireshark.org/TLS.
2025-11-26 14:30:26 +01:00
Nicki Křížek
693566b66e chg: ci: Adjust respdiff threshold
Closes #5649

Merge branch 'nicki/respdiff-threshold' into 'main'

See merge request isc-projects/bind9!11262
2025-11-25 15:51:21 +01:00
Nicki Křížek
bcc4369b0b Increase the threshold for respdiff-third-party
There are multiple reasons for the increased amount of differences we've
been seeing lately and for the raise of the threshold:

1. Recent hardening against cache poisoning (CVE-2025-40778) have
   uncovered a few edge cases where the domain can't be properly
   resolved with the new protections in place, but those are issues with
   upstream configuration and DNS setup.
2. The same hardening magnified some behaviour differences between 9.21
   and older versions. Some misconfigured domains, which can be resolved
   with BIND 9.20 and older are no longer resolvable in 9.21+. This can
   be again attributed to upstream DNS misconfiguration. See #5649.
3. A change in the respdiff CI job to include timeouts in the
   comparison, or rather, increasing the timeouts to resolve the
   previously timed out queries, which are typically failures. With the
   previous job configuration, those were omitted from comparison,
   because they were timeouts. Now, there should be no timeouts, but
   there is a slight increase in the amount of differences for the
   threshold evaluation.
2025-11-25 15:05:16 +01:00
Nicki Křížek
92ae687649 Set stricter respdiff:recent-named threshold
This job is testing the current BIND implementation against the latest
released version. Unless there has been a behaviour change, there should
be no difference.

In practice, there is a small number of differences caused by upstream
discrepencies. Some of those cause "upstream unstable" answers which are
excluded from the results, but statistically, some of those will end up
being detected as differences on the resolver under test.

Currently, there seems to be about 300 upstream unstable answers with
typically around 50-60 differences. Setting the threshold to 0.1 should
be stable enough to pass if there are no changes, yet sensitive enough
to detect even fairly small changes to behaviour.
2025-11-25 15:05:16 +01:00