]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 months agoDocument response time RTT counetrs
Aram Sargsyan [Thu, 29 Jan 2026 13:30:31 +0000 (13:30 +0000)] 
Document response time RTT counetrs

3 months agoAdd RTT statistics tests both for XML and JSON outputs
Aram Sargsyan [Fri, 16 Jan 2026 14:02:54 +0000 (14:02 +0000)] 
Add RTT statistics tests both for XML and JSON outputs

Add a resolver instance "ns4" in the statschannel test and a "ans5"
instance which adds latency to the queries delegeated to it from the
resolver.

Make queries which add latency, and compare the expected values to
the values received from the statistics channel.

3 months agoShow the incoming/outgoing queries' RTT statistics in stats channel
Aram Sargsyan [Thu, 15 Jan 2026 15:04:45 +0000 (15:04 +0000)] 
Show the incoming/outgoing queries' RTT statistics in stats channel

Expose the new isc_histo_t-based RTT statistics in the statistics
channel for the XML and JSON versions.

3 months agoCalculate incoming queries RTT statistics
Aram Sargsyan [Thu, 15 Jan 2026 15:03:09 +0000 (15:03 +0000)] 
Calculate incoming queries RTT statistics

In client_senddone() update the RTT statistics for the incoming
queries.

3 months agoKeep client->inner.tnow and client->inner.now in sync
Aram Sargsyan [Thu, 15 Jan 2026 14:58:24 +0000 (14:58 +0000)] 
Keep client->inner.tnow and client->inner.now in sync

The incoming queries RTT statistics are going to need correct time
information for calculations.

3 months agoReplace the outgoing queries RTT histogram code with isc_histomulti
Aram Sargsyan [Thu, 15 Jan 2026 14:46:06 +0000 (14:46 +0000)] 
Replace the outgoing queries RTT histogram code with isc_histomulti

The granularity of the simple histogram with fixed number of ranges
sometimes isn't good enough. As there's a need to implement a new
histogram statistics for the incoming query times (RTT), it was decided
to also update the existing RTT statistics of the outgoing queries
so that they look similar and use common code.

Remove the old histogram code from the resolver and from the statistics
channel. Reimplement the outgoing queries RTT histogram using the
isc_histomulti module, and prepare the necessary base for implementing
the incoming queries RTT histogram. The statistics channel will be
updated to expose the new histograms in an upcoming commit.

3 months agoUse standard reference counting for isc_histomulti
Aram Sargsyan [Thu, 15 Jan 2026 14:38:44 +0000 (14:38 +0000)] 
Use standard reference counting for isc_histomulti

Use reference counting for isc_histomulti module so that it's
possible to attach/detach to/from the objects when used in the
statistics channel in the coming commits.

3 months agochg: doc: Set up version for BIND 9.21.20
Michał Kępień [Thu, 26 Feb 2026 11:02:29 +0000 (12:02 +0100)] 
chg: doc: Set up version for BIND 9.21.20

Merge branch 'michal/set-up-version-for-bind-9.21.20' into 'main'

See merge request isc-projects/bind9!11608

3 months agoUpdate BIND version to 9.21.20-dev
Michał Kępień [Thu, 26 Feb 2026 10:55:41 +0000 (11:55 +0100)] 
Update BIND version to 9.21.20-dev

3 months agochg: dev: Implement Fisher-Yates shuffle for nameserver selection
Ondřej Surý [Thu, 26 Feb 2026 06:33:29 +0000 (07:33 +0100)] 
chg: dev: Implement Fisher-Yates shuffle for nameserver selection

Replace the two-pass "random start index and wrap around" logic in
fctx_getaddresses_nameservers() with a statistically sound partial
Fisher-Yates shuffle.

The previous implementation picked a random starting node and did two
passes over the linked list to find query candidates. The new logic
introduces fctx_getaddresses_nsorder() to perform an in-place
randomization of indices into a bounded, stack-allocated lookup array
(nsorder) representing the "winning" fetch slots.

The nameserver dataset is now traversed in exactly one sequential pass:
1. Every nameserver is evaluated for local cached data.
2. If the current nameserver's sequential index exists in the randomized
   nsorder array, it is permitted to launch an outgoing network fetch.
3. If not, it is restricted to local lookups via DNS_ADBFIND_NOFETCH.

This guarantees a fair random distribution for outbound queries while
maximizing local cache hits, entirely within O(1) memory and without
the overhead of linked-list pointer shuffling or dynamic allocation.

Closes #5695

Merge branch '5695-refactor-the-random-NS-selection' into 'main'

See merge request isc-projects/bind9!11604

3 months agoAdd test coverage for nameserver processing limits
Colin Vidal [Wed, 25 Feb 2026 18:01:22 +0000 (19:01 +0100)] 
Add test coverage for nameserver processing limits

Introduce a new system test (nsprocessinglimit) to verify that the
resolver strictly respects outgoing network fetch quotas when presented
with heavily delegated, unresponsive zones.

This test acts as a regression check for the recent Fisher-Yates nameserver
selection refactor.  It sets up an authoritative server delegating a zone
to 23 distinct nameservers (all pointing to unresponsive loopback IPs).

Using dnstap, the test forces a resolution failure and verifies that:
1. The resolver successfully traverses the zone delegation path.
2. The resolver caps the outgoing network queries to the delegated
   nameservers exactly at the processing limit (20 fetches), ensuring
   array boundaries and dynamic fetch quotas are strictly enforced without
   crashing or hanging.

3 months agoImplement Fisher-Yates shuffle for nameserver selection
Ondřej Surý [Wed, 25 Feb 2026 15:46:40 +0000 (16:46 +0100)] 
Implement Fisher-Yates shuffle for nameserver selection

Replace the two-pass "random start index and wrap around" logic in
fctx_getaddresses_nameservers() with a statistically sound Fisher-Yates
shuffle.

The previous implementation picked a random starting node and did two
passes over the linked list to find query candidates.  The new logic
extracts the available nameservers into a bounded, stack-allocated array
of dns_rdata_t structures.

This array is then randomized in-place using a Fisher-Yates shuffle.
Finally, the shuffled array is traversed sequentially to launch fetches
until the dynamic quota (fctx->pending_running >= fetches_allowed) is
reached.

This guarantees a fair random distribution for outbound queries while
properly respecting dynamic query limits, entirely within O(1) memory
and without the overhead of linked-list pointer shuffling or multiple
dataset traversals.

3 months agofix: ci: Fix generate-tsan-stress-test-configs CI job
Štěpán Balážik [Wed, 25 Feb 2026 12:13:54 +0000 (12:13 +0000)] 
fix: ci: Fix generate-tsan-stress-test-configs CI job

In a3d0f43d2 I moved the script that does this to the QA repo and
screwed up the path.

Fix the path and make the job run properly again.

Merge branch 'stepan/fix-tsan-stress' into 'main'

See merge request isc-projects/bind9!11599

3 months agoFix generate-tsan-stress-test-configs CI job
Štěpán Balážik [Tue, 24 Feb 2026 21:31:12 +0000 (22:31 +0100)] 
Fix generate-tsan-stress-test-configs CI job

In a3d0f43d2 I moved the script that does this to the QA repo and
screwed up the path.

Fix the path and make the job run properly again.

3 months agofix: nil: Fix log level bug related to keystores
Matthijs Mekking [Wed, 25 Feb 2026 12:01:01 +0000 (12:01 +0000)] 
fix: nil: Fix log level bug related to keystores

A debug message that logs a PKCS#11 object has been generated was erroneously
logged at error level. This has been fixed.

Merge branch 'matthijs-fix-loglevel-keystore' into 'main'

See merge request isc-projects/bind9!11586

3 months agoFix log level bug in keystore
Matthijs Mekking [Mon, 23 Feb 2026 09:21:50 +0000 (10:21 +0100)] 
Fix log level bug in keystore

A debug message that logs a PKCS#11 object has been generated was
erroneously logged at error level. This has been fixed.

3 months agofix: usr: Remove deterministic selection of nameserver
Ondřej Surý [Wed, 25 Feb 2026 09:05:55 +0000 (10:05 +0100)] 
fix: usr:  Remove deterministic selection of nameserver

When selecting nameserver addresses to be looked up we where
always selecting them in dnssec name order from the start of
the nameserver rrset.  This could lead to resolution failure
despite there being address that could be resolved for the
other names.  Use a random starting point when selecting which
names to lookup.

Closes #5695

Closes #5745

Merge branch '5695-add-random-server-selection' into 'main'

See merge request isc-projects/bind9!11395

3 months agosystem test covering NS randomization
Colin Vidal [Tue, 24 Feb 2026 16:30:56 +0000 (17:30 +0100)] 
system test covering NS randomization

Add randomizens system test which ensures that NS are randomly selected.
The test relies of the fact that `getaddresses_allowed()` logic won't
allow to query more than 3 NS at the top-level. The `example.` zone has
4 NS and the 3 formers are lame. As a result, if the resolved doesn't
randomize the NS selection, it will only quiery the 3 formers, which
won't give an answer, and fails. With randomization enabled, there is a
chance that the resolver queries the fourth NS, and gets the result.

3 months agoRemove determinist selection of nameserver
Mark Andrews [Fri, 19 Dec 2025 07:12:06 +0000 (18:12 +1100)] 
Remove determinist selection of nameserver

When selecting nameserver addresses to be looked up we where
always selecting them in dnssec name order from the start of
the nameserver rrset.  This could lead to resolution failure
despite there being address that could be resolved for the
other names.  Use a random starting point when selecting which
names to lookup.

3 months agosec: usr: Remove purged adb names and entries from SIEVE list immediately
Ondřej Surý [Wed, 25 Feb 2026 06:29:23 +0000 (07:29 +0100)] 
sec: usr: Remove purged adb names and entries from SIEVE list immediately

Both expire_name() and expire_entry() use isc_async mechanism to remove
the names and entries from the SIEVE-LRU lists on the matching isc_loop.

Under certain circumstances, this could lead to double counting the
purged named/entries when purging the SIEVE-LRU lists under the overmem
condition.  This would cause not enough memory to be cleaned up and the
ADB would then never recover from the overmem condition leading to OOM
crash of the named.

Merge branch 'ondrej/fix-runaway-memory-in-adb' into 'main'

See merge request isc-projects/bind9!11544

3 months agoRemove purged adb names and entries from SIEVE list immediately
Ondřej Surý [Tue, 10 Feb 2026 05:16:31 +0000 (06:16 +0100)] 
Remove purged adb names and entries from SIEVE list immediately

Both `expire_name()` and `expire_entry()` use the isc_async mechanism to
remove names and entries from the SIEVE-LRU lists on the matching
isc_loop.

Under heavy load when the cleaning mechanism didn't have the chance to
kick in yet, this delay could lead to double-counting the purged names
and entries when purging the SIEVE-LRU lists during an overmem
condition.  This would result in insufficient memory being cleaned up,
causing the ADB to never recover from the overmem condition and leading
to an OOM crash of `named`.

This patch resolves the issue by bypassing the async queue and executing
the removal synchronously if the target loop matches the current
isc_loop().

3 months agofix: usr: Importing invalid SKR file might corrupt stack memory
Ondřej Surý [Tue, 24 Feb 2026 18:45:16 +0000 (19:45 +0100)] 
fix: usr: Importing invalid SKR file might corrupt stack memory

If an BIND 9 administrator imports an invalid SKR file, local stack
in the import function might overflow.  This could lead to
a memory corruption on the stack and ultimately server crash.
This has been fixed.

ISC would like to thank mcsky23 for bringing this bug to our attention.

Closes #5758

Merge branch '5758-fix-stack-overflow-via-rndc-skr-import' into 'main'

See merge request isc-projects/bind9!11578

3 months agoAdd system tests that imports invalid SKR file
Ondřej Surý [Sun, 22 Feb 2026 06:27:07 +0000 (07:27 +0100)] 
Add system tests that imports invalid SKR file

Try to import invalid SKR file and observe whether the named is still
alive.  This test only triggers under ASAN.

3 months agoImporting invalid SKR file might overflow the stack buffer
Ondřej Surý [Sun, 22 Feb 2026 05:37:33 +0000 (06:37 +0100)] 
Importing invalid SKR file might overflow the stack buffer

If an invalid SKR file is imported, reading the time from the token
buffer might overflow the buffer on the local stack.  This has been
fixed by removing the intermediate buffer and parsing the lexer token
directly.

3 months agofix: ci: Use LLVM 21 for "trixie"
Michal Nowak [Tue, 24 Feb 2026 18:05:05 +0000 (19:05 +0100)] 
fix: ci: Use LLVM 21 for "trixie"

We forgot to change this when bumping CLANG_VERSION.

Merge branch 'mnowak/fix-clang-version-on-trixie' into 'main'

See merge request isc-projects/bind9!11596

3 months agoUse LLVM 21 for "trixie"
Michal Nowak [Tue, 24 Feb 2026 15:48:21 +0000 (16:48 +0100)] 
Use LLVM 21 for "trixie"

We forgot to change this when bumping CLANG_VERSION.

3 months agochg: dev: Invalid NSEC3 can cause OOB read of the isdelegation() stack
Ondřej Surý [Tue, 24 Feb 2026 15:00:35 +0000 (16:00 +0100)] 
chg: dev: Invalid NSEC3 can cause OOB read of the isdelegation() stack

When .next_length is longer than NSEC3_MAX_HASH_LENGTH, it causes a
harmless out-of-bound read of the isdelegation() stack.  This has been
fixed.

Closes #5749

Merge branch '5749-fix-OOB-read-in-isdelegation' into 'main'

See merge request isc-projects/bind9!11553

3 months agoTest maximum length NSEC3 hash detection
Mark Andrews [Tue, 24 Feb 2026 02:35:07 +0000 (13:35 +1100)] 
Test maximum length NSEC3 hash detection

Adds text and wire format unit tests to verify the newly enforced
maximum NSEC3 hash length constraints.  These tests ensure that hash
lengths up to the 39-byte maximum are accepted, while larger sizes
correctly fail.

3 months agoRemove invalid REQUIRE in NSEC3 fromstruct method
Mark Andrews [Tue, 24 Feb 2026 02:30:43 +0000 (13:30 +1100)] 
Remove invalid REQUIRE in NSEC3 fromstruct method

The NSEC3 fromstruct method only worked for hash type 1
when it should work for all hash types.

3 months agoAdd tests for NSEC3 invalid length
Ondřej Surý [Fri, 20 Feb 2026 14:44:14 +0000 (15:44 +0100)] 
Add tests for NSEC3 invalid length

Adds a static system test that fails to load an NSEC3 record with an
invalid next part length.  Additionally, introduces a dynamic test using
a crafted authoritative DNS proxy to inject invalid NSEC3 records on the
fly to test runtime behavior.

3 months agoEnforce NSEC3 record consistency
Mark Andrews [Wed, 18 Feb 2026 01:30:22 +0000 (12:30 +1100)] 
Enforce NSEC3 record consistency

NSEC3 hashes are required to fit within a single DNS label.  Since there
are 5 bits per label byte without pad characters, the maximum hash size
is floor(63*5/8) (39 bytes).

This patch enforces this maximum length for unknown algorithms, while
strictly enforcing the exact expected digest length for known algorithms
like SHA-1.

3 months agoInvalid NSEC3 can cause OOB read of the isdelegation() stack
Ondřej Surý [Sat, 14 Feb 2026 13:43:41 +0000 (14:43 +0100)] 
Invalid NSEC3 can cause OOB read of the isdelegation() stack

When .next_length is longer than NSEC3_MAX_HASH_LENGTH, it causes a
harmless out-of-bound read of the isdelegation() stack.  This patch
fixes the issue by skipping NSEC3 records with an oversized hash length
during validation.

3 months agofix: usr: Fail DNSKEY validation when supported but invalid DS is found
Ondřej Surý [Mon, 23 Feb 2026 19:57:50 +0000 (20:57 +0100)] 
fix: usr: Fail DNSKEY validation when supported but invalid DS is found

A regression was introduced when adding the EDE code for unsupported
DNSKEY and DS algorithms.  When the parent has both supported and
unsupported algorithm in the DS record, the validator would treat the
supported DS algorithm as insecure when validating DNSKEY records
instead of BOGUS.  This has not security impact as the rest of the child
zone correctly ends with BOGUS status, but it is incorrect and thus the
regression has been fixed.

Closes #5757

Merge branch '5757-fix-mixed-algorithm-DS-handling' into 'main'

See merge request isc-projects/bind9!11580

3 months agoAdd test for mixed unsupported DS records
Ondřej Surý [Mon, 23 Feb 2026 10:17:40 +0000 (11:17 +0100)] 
Add test for mixed unsupported DS records

Add a system test that has one invalid DS record with supported
algorithm and one unsupported DS record.  Both DNSKEY and A queries must
fail with SERVFAIL.

3 months agoFail DNSKEY validation when supported but invalid DS is found
Ondřej Surý [Mon, 23 Feb 2026 05:13:59 +0000 (06:13 +0100)] 
Fail DNSKEY validation when supported but invalid DS is found

A regression was introduced when adding the EDE code for unsupported
DNSKEY and DS algorithms.  When the parent has both supported and
unsupported algorithm in the DS record, the validator would treat the
supported DS algorithm as insecure when validating DNSKEY records
instead of BOGUS.  This has not security impact as the rest of the child
zone correctly ends with BOGUS status, but it is incorrect and thus the
regression has been fixed.

3 months agofix: usr: Clear serve-stale flags when following the CNAME chains
Matthijs Mekking [Mon, 23 Feb 2026 07:50:48 +0000 (07:50 +0000)] 
fix: usr: Clear serve-stale flags when following the CNAME chains

A stale answer could have been served in case of multiple upstream
failures when following the CNAME chains.  This has been fixed.

Closes #5751

Merge branch '5751-clear-staleflags-in-CNAME-chains' into 'main'

See merge request isc-projects/bind9!11558

3 months agoClear serve-stale flags when following the CNAME chains
Ondřej Surý [Wed, 18 Feb 2026 05:39:33 +0000 (06:39 +0100)] 
Clear serve-stale flags when following the CNAME chains

A stale answer or SERVFAIL could have been served in case of multiple
upstream failures when following the CNAME chains. This has been fixed.

3 months agoTest serve-stale with upstream zones and CNAMEs
Matthijs Mekking [Thu, 19 Feb 2026 11:06:14 +0000 (12:06 +0100)] 
Test serve-stale with upstream zones and CNAMEs

Three variants of YWH-PGM40640-56: Stale/Wrong DNS Data Served via
CNAME Flag Leak (DNS_DBFIND_STALEOK persistence) are presented in
GitLab issue #5751. All these variants have been converted to system
tests.

Variant 1 forwards source.stale to another server, that provides a
CNAME record, while the resolver is authoritative for target.stale.
The CNAME points to a non-existing name. A stale CNAME record should
result in a stale NXDOMAIN (instead of SERVFAIL).

Variant 2 forwards both source.stale and target.stale to other servers.
This time the CNAME points to an A RRset. If the source.stale server
is not available (and stale-answer-client-timeout is off), the cached
CNAME should be followed and pick up the fresh RRset (instead of the
stale A RRset).

Variant 3 is similar to variant 2, but this time the CNAME points to
a non-existing name again. After flushing the target, BIND should
return a stale NXDOMAIN (instead of SERVFAIL).

3 months agonew: doc: Provide guidelines for tool-generated content
Ondřej Surý [Mon, 23 Feb 2026 06:23:25 +0000 (07:23 +0100)] 
new: doc: Provide guidelines for tool-generated content

In the last few years, the capabilities of coding tools have exploded.
As those capabilities have expanded, contributors and maintainers have
more and more questions about how and when to apply those capabilities.

Add new documentation to guide contributors on how to best use BIND 9
development tools, new and old.

In short: Please show your work and make sure your contribution is
easy to review.

This has been adopted from the Linux Kernel guidelines.

Merge branch 'ondrej/clarify-the-use-of-tools' into 'main'

See merge request isc-projects/bind9!11447

3 months agoProvide guidelines for tool-generated content
Ondřej Surý [Mon, 12 Jan 2026 10:06:32 +0000 (11:06 +0100)] 
Provide guidelines for tool-generated content

In the last few years, the capabilities of coding tools have exploded.
As those capabilities have expanded, contributors and maintainers have
more and more questions about how and when to apply those capabilities.

Add new documentation to guide contributors on how to best use BIND 9
development tools, new and old.

In short: Please show your work and make sure your contribution is
easy to review.

This has been adopted from the Linux Kernel guidelines.

3 months agochg: doc: Add examples to the dig man page
Ondřej Surý [Sun, 22 Feb 2026 16:20:50 +0000 (17:20 +0100)] 
chg: doc: Add examples to the dig man page

Add a set of short examples at the end of the dig manual page to help new or infrequent users figure out the most basic ways to use dig.

Merge branch 'examples' into 'main'

See merge request isc-projects/bind9!11577

3 months agoAdd examples to the dig man page
Julia Evans [Fri, 20 Feb 2026 15:43:26 +0000 (10:43 -0500)] 
Add examples to the dig man page

The goal here is to help new or infrequent users figure out the most
basic ways to use dig.

Notes on the choice of examples:

* I wrote examples that users can copy and paste exactly as is, without
  having to come up with an appropriate IP address or domain name to use.
  The one exception is the `dig -x` example which uses an IP from the
  example range.
* `dig +noall +answer` here is because learning about `+noall +answer`
  was lifechanging for me when I learned about it, I've heard from
  others that they find it helpful too, and it's pretty hard to infer
  from the man page as is that it might be useful
* I thought about adding `+trace` but left it out because 5 examples was
  already starting to feel like a lot.

3 months agofix: nil: Cleanup setting netmgr ports from isc_managers_create()
Ondřej Surý [Fri, 20 Feb 2026 16:25:04 +0000 (17:25 +0100)] 
fix: nil: Cleanup setting netmgr ports from isc_managers_create()

This is now duplicate as the default ports are already set in
isc_netmgr_create().

Merge branch 'ondrej/mr11569-followup-cleanup' into 'main'

See merge request isc-projects/bind9!11576

3 months agoCleanup setting netmgr ports from isc_managers_create()
Ondřej Surý [Fri, 20 Feb 2026 15:37:44 +0000 (16:37 +0100)] 
Cleanup setting netmgr ports from isc_managers_create()

This is now duplicate as the default ports are already set in
isc_netmgr_create().

3 months agochg: ci: Rework linting of Python code
Štěpán Balážik [Fri, 20 Feb 2026 14:59:10 +0000 (14:59 +0000)] 
chg: ci: Rework linting of Python code

With the Python version bumped to 3.10 and the dependency situation cleared with !11415 it is now time to run linters and formatters on more parts of the Python code that was previously skipped or ignored.

Switch configuration of the various Python-adjacent tools to `pyproject.toml` to ensure that the same configuration is used in CI and locally.

See the individual commits for details on settings changed and linters added.

Tweaks to type checking and enabling more `ruff` lints will come in a subsequent MRs.

Prerequisites:
- bind9-qa!160.
- images!442

Merge branch 'stepan/python-tooling' into 'main'

See merge request isc-projects/bind9!11499

3 months agoAdd ruff job to CI
Štěpán Balážik [Tue, 10 Feb 2026 19:48:54 +0000 (20:48 +0100)] 
Add ruff job to CI

Run the linter on Python code changes in CI.

3 months agoReplace deprecated typing imports
Štěpán Balážik [Tue, 10 Feb 2026 15:12:57 +0000 (16:12 +0100)] 
Replace deprecated typing imports

More specific modules (like collections.abc) can now be used.

Generated with: ruff check --extend-select UP035 --fix

3 months agoClean up imports of dnspython modules
Štěpán Balážik [Mon, 9 Feb 2026 18:22:44 +0000 (19:22 +0100)] 
Clean up imports of dnspython modules

Add a pylint plugin that enforces:
  - There is no bare `import dns` statement.
  - All `dns.<module>` used are explicitly imported.
  - There are no unused `dns.<module>` imports.

Fix all the imports to conform with this check.

3 months agoReplace Optional["T"] with "T | None"
Štěpán Balážik [Fri, 20 Feb 2026 14:03:16 +0000 (15:03 +0100)] 
Replace Optional["T"] with "T | None"

In Python 3.10 strings don't support the | operator, so ruff doesn't
attempt to fix these. Quote the entire type specification to avoid the
typing.Optional import.

Alternatives I considered:
- leaving it as is (only use of Optional in the code base)
- using `from future import __annotations__` (replacing one import with
  another one)

3 months agoReplace Optional[T] with T | None
Štěpán Balážik [Mon, 9 Feb 2026 14:46:40 +0000 (15:46 +0100)] 
Replace Optional[T] with T | None

Generated with: ruff check --extend-select UP045 --fix && black .

3 months agoRemove the rest of Union usages by hand
Štěpán Balážik [Mon, 9 Feb 2026 14:45:58 +0000 (15:45 +0100)] 
Remove the rest of Union usages by hand

These require some manual changes.

3 months agoReplace Union[S, T] with S | T
Štěpán Balážik [Mon, 9 Feb 2026 14:40:36 +0000 (15:40 +0100)] 
Replace Union[S, T] with S | T

Generated with: ruff check --extend-select UP007 --fix && black .

3 months agoBuilt-in types are now subscriptable
Štěpán Balážik [Mon, 9 Feb 2026 14:33:22 +0000 (15:33 +0100)] 
Built-in types are now subscriptable

Generated with: ruff check --extend-select UP006 --fix

3 months agoRemove superfluous 'pylint: disable' directives
Štěpán Balážik [Mon, 9 Feb 2026 14:10:36 +0000 (15:10 +0100)] 
Remove superfluous 'pylint: disable' directives

Some of these have been fixed already, fix the rest.

3 months agoRemove unused imports
Štěpán Balážik [Mon, 9 Feb 2026 13:42:48 +0000 (14:42 +0100)] 
Remove unused imports

Generated with: ruff check --extend-select F401 --fix

3 months agoSet pytestmark explicitly in rollover* and nsec3* tests
Štěpán Balážik [Thu, 5 Feb 2026 12:24:46 +0000 (13:24 +0100)] 
Set pytestmark explicitly in rollover* and nsec3* tests

Importing pytestmark confuses static analysis tools as they flag it as
unused.

3 months agoMake default_algorithm accessible through a fixture and method
Štěpán Balážik [Wed, 4 Feb 2026 17:17:17 +0000 (18:17 +0100)] 
Make default_algorithm accessible through a fixture and method

Importing pytest fixture trips up static analysis tools, so move
default_algorithm to conftest.py and use it instead of os.environ
accesses in various system tests.

For use outside test function, use Algorithm.default().

3 months agoDefine __all__ in __init__.py files
Štěpán Balážik [Wed, 28 Jan 2026 17:49:34 +0000 (18:49 +0100)] 
Define __all__ in __init__.py files

Fix ruff's F401 unused-import errors in these files.

Also sort them with: ruff check --extend-select RUF022 --fix.

3 months agoAutomatically sort imports in Python code
Štěpán Balážik [Wed, 4 Feb 2026 14:43:40 +0000 (15:43 +0100)] 
Automatically sort imports in Python code

Generated with: ruff check --extend-select I --fix (with the changes to
pyproject.toml applied).

3 months agoLint code in doc directory
Štěpán Balážik [Wed, 28 Jan 2026 16:08:44 +0000 (17:08 +0100)] 
Lint code in doc directory

Adjust ignore lists of linters to check more code.

3 months agoFix vulture warnings and tweak ignore lists
Štěpán Balážik [Wed, 28 Jan 2026 15:29:11 +0000 (16:29 +0100)] 
Fix vulture warnings and tweak ignore lists

Run vulture on the whole repository, fix most errors in previously
unchecked code, adjust ignore lists.

3 months agoFix 'Too many return statements' pylint error
Štěpán Balážik [Wed, 28 Jan 2026 14:21:58 +0000 (15:21 +0100)] 
Fix 'Too many return statements' pylint error

Refactor `Key.match_properties` into multiple functions.

3 months agoFix pylint's 'invalid-name' errors
Štěpán Balážik [Wed, 28 Jan 2026 14:12:45 +0000 (15:12 +0100)] 
Fix pylint's 'invalid-name' errors

Where possible comply with the naming rules. Add exceptions for the
function names used in KASP tests.

3 months agoMove utility Python scripts to the bind9-qa repo
Štěpán Balážik [Wed, 28 Jan 2026 12:55:53 +0000 (13:55 +0100)] 
Move utility Python scripts to the bind9-qa repo

I would have touched them anyway in this MR so let's bite the bullet
and move them there.

3 months agoClone the bind9-qa repo to the project root in CI jobs
Štěpán Balážik [Fri, 30 Jan 2026 16:06:56 +0000 (17:06 +0100)] 
Clone the bind9-qa repo to the project root in CI jobs

Cloning to a stable location allows clearer handling of paths when
calling scripts from CI jobs.

`unit:gcc:tarball` and `system:gcc:tarball` do `cd bind-*` in
`before_script` which lead to the `bind9-qa` directory ending up in
a different place in exactly these two jobs and that made reasoning
about paths in `.system_test_common` and `.unit_test_common` tricky.

3 months agoReintroduce pylint checks that are not being violated
Štěpán Balážik [Wed, 28 Jan 2026 00:15:25 +0000 (01:15 +0100)] 
Reintroduce pylint checks that are not being violated

We might reintroduce them later if they become obnoxious.

3 months agoSet dist=loadscope for pytest in pytest.ini
Štěpán Balážik [Wed, 28 Jan 2026 00:03:10 +0000 (01:03 +0100)] 
Set dist=loadscope for pytest in pytest.ini

Previously there was some handling of old pytest-xdist versions which is
no longer needed.

3 months agoFix the rest of 'Formatting a regular string which could be an f-string'
Štěpán Balážik [Tue, 27 Jan 2026 23:47:24 +0000 (00:47 +0100)] 
Fix the rest of 'Formatting a regular string which could be an f-string'

Some fixes have to be done manually.

3 months agoFix some 'Formatting a regular string which could be an f-string' errors
Štěpán Balážik [Tue, 27 Jan 2026 23:41:06 +0000 (00:41 +0100)] 
Fix some 'Formatting a regular string which could be an f-string' errors

Generated with:
ruff check --select UP031,UP032 --fix --unsafe-fixes && black .

3 months agoAdd a small config for the ruff tool
Štěpán Balážik [Tue, 27 Jan 2026 23:37:21 +0000 (00:37 +0100)] 
Add a small config for the ruff tool

It will be used for automated refactors of Python code.

3 months agoCentralize Python tooling configuration in pyproject.toml
Štěpán Balážik [Tue, 27 Jan 2026 19:39:17 +0000 (20:39 +0100)] 
Centralize Python tooling configuration in pyproject.toml

This allows easy running of the tools from the project root both in CI
and locally.

3 months agoFix 'Import should be placed at the top of the module'
Štěpán Balážik [Tue, 27 Jan 2026 23:01:35 +0000 (00:01 +0100)] 
Fix 'Import should be placed at the top of the module'

In preparation for running pylint on more Python code.

3 months agoFix 'Using open without explicitly specifying an encoding'
Štěpán Balážik [Tue, 27 Jan 2026 22:28:06 +0000 (23:28 +0100)] 
Fix 'Using open without explicitly specifying an encoding'

In preparation for running pylint on more code.

3 months agoUse relative imports and __init__.py in the statschannel test
Štěpán Balážik [Tue, 27 Jan 2026 21:40:47 +0000 (22:40 +0100)] 
Use relative imports and __init__.py in the statschannel test

This is in preparation for automatic import sorting.

3 months agoIssue errors on re.compile only when isctest is imported
Štěpán Balážik [Tue, 27 Jan 2026 21:31:30 +0000 (22:31 +0100)] 
Issue errors on re.compile only when isctest is imported

This is in preparation of running pylint on more parts of the codebase.

3 months agoRun custom servers as Python modules
Štěpán Balážik [Tue, 27 Jan 2026 20:29:07 +0000 (21:29 +0100)] 
Run custom servers as Python modules

Use `python -m` for running the custom servers.

This allows the use of relative imports in the server modules and in
turn linting the modules.

3 months agochg: usr: Optimize the TCP source port selection on Linux
Ondřej Surý [Fri, 20 Feb 2026 13:07:13 +0000 (14:07 +0100)] 
chg: usr: Optimize the TCP source port selection on Linux

Enable a socket option on the outgoing TCP sockets to allow faster selection of the source <address,port> tuple for different destination <address,port> tuples when nearing over 70-80% of the source port utilization.

Merge branch 'improve-selection-of-outgoing-TCP-port' into 'main'

See merge request isc-projects/bind9!11569

3 months agoRename isc_net_getudpportrange() to isc_net_getportrange()
Ondřej Surý [Thu, 19 Feb 2026 11:55:45 +0000 (12:55 +0100)] 
Rename isc_net_getudpportrange() to isc_net_getportrange()

This better reflects the true nature of the function as we are reading
the ephemeral port range which is not related to UDP at all.

3 months agoImplement IP_LOCAL_PORT_RANGE socket option for Linux
Ondřej Surý [Thu, 24 Jul 2025 09:43:14 +0000 (11:43 +0200)] 
Implement IP_LOCAL_PORT_RANGE socket option for Linux

For Linux >= 6.8:

Since 2023, Linux has introduced a change to the IP_LOCAL_PORT_RANGE
socket option that eliminates the need for the random window
shifting (implemented as a fallback in the next commit).

By setting IP_LOCAL_PORT_RANGE option, we tell the kernel to use better
approach to the source port selection.

For Linux << 6.8:

This implement selecting port by random shifting range leveraging the
IP_LOCAL_PORT_RANGE socket option.  The network manager is initialized
with the ephemeral port range (on startup and on reconfig) and then for
every outgoing TCP connection, we define a custom port range (1000
ports) and then randomly shift the custom range within the system range.

This helps the kernel to reduce the search space to the custom window
between <random_offset, random_offset + 1000>.

Reference:
https://blog.cloudflare.com/linux-transport-protocol-port-selection-performance/#kernel

3 months agoImprove the source port selection on Linux
Ondřej Surý [Thu, 24 Jul 2025 09:24:24 +0000 (11:24 +0200)] 
Improve the source port selection on Linux

Since 2015, Linux has introduced a new socket option to overcome TCP
limitations: When an application needs to force a source IP on an active
TCP socket it has to use bind(IP, port=x).  As most applications do not
want to deal with already used ports, x is often set to 0, meaning the
kernel is in charge to find an available port.  But kernel does not know
yet if this socket is going to be a listener or be connected. This
IP_BIND_ADDRESS_NO_PORT socket option ask the kernel to ignore the 0
port provided by application in bind(IP, port=0) and only remember the
given IP address. The port will be automatically chosen at connect()
time, in a way that allows sharing a source port as long as the 4-tuples
are unique.

Enable IP_BIND_ADDRESS_NO_PORT on the outgoing TCP sockets to overcome
this TCP limitation.

3 months agoRemove return value from isc_net_getudpportrange()
Ondřej Surý [Thu, 19 Feb 2026 11:05:58 +0000 (12:05 +0100)] 
Remove return value from isc_net_getudpportrange()

The function was already marked as never failing, always returning
ISC_R_SUCCESS, so there was a lot of dead code around checking whether
the result would be ISC_R_SUCCESS.  This has been cleaned up.

3 months agofix: usr: Fix read UAF in BIND9 dns_client_resolve() via DNAME Response
Ondřej Surý [Fri, 20 Feb 2026 11:51:41 +0000 (12:51 +0100)] 
fix: usr: Fix read UAF in BIND9 dns_client_resolve() via DNAME Response

An attacker controlling a malicious DNS server returns a DNAME record,
and the we stores a pointer to resp->foundname, frees the response
structure, then uses the dangling pointer in dns_name_fullcompare()
possibly causing invalid match.  Only the `delv`is affected.  This has
been fixed.

Closes #5728

Merge branch '5728-heap-uaf-in-bind9-dns_client_resolve-via-dname-response' into 'main'

See merge request isc-projects/bind9!11570

3 months agoFix read UAF in BIND9 dns_client_resolve() via DNAME Response
Ondřej Surý [Fri, 20 Feb 2026 10:58:13 +0000 (11:58 +0100)] 
Fix read UAF in BIND9 dns_client_resolve() via DNAME Response

An attacker controlling a malicious DNS server returns a DNAME record,
and the we stores a pointer to resp->foundname, frees the response
structure, then uses the dangling pointer in dns_name_fullcompare()
possibly causing invalid match.  Only the `delv`is affected.  This has
been fixed.

3 months agofix: ci: Fix the `update-stable-tag` job
Andoni Duarte [Thu, 19 Feb 2026 19:56:23 +0000 (19:56 +0000)] 
fix: ci: Fix the `update-stable-tag` job

Fix the `update-stable-tag` job, necessary for updating Read the Docs.

Merge branch 'andoni/fix-update-stable-branch-for-rtd-job' into 'main'

See merge request isc-projects/bind9!11559

3 months agoFix CI stable branch update job bug
Andoni Duarte Pintado [Wed, 18 Feb 2026 11:35:45 +0000 (12:35 +0100)] 
Fix CI stable branch update job bug

The update script clones a fresh copy each time, if more than one
invocation is needed intermediate copies need to be removed.

3 months agofix: usr: Fix errors when retrying over TCP in notify_send_toaddr
Ondřej Surý [Thu, 19 Feb 2026 12:47:03 +0000 (13:47 +0100)] 
fix: usr: Fix errors when retrying over TCP in notify_send_toaddr

If the source address is not available do not attempt
to retry over TCP otherwise clear the TSIG key from the
message prior to retrying.

Closes #5457

Merge branch '5457-remove-tcp-retry-in-notify-send-toaddr' into 'main'

See merge request isc-projects/bind9!10805

3 months agoCheck notify with bad notify source address and tsig
Mark Andrews [Wed, 1 Oct 2025 04:49:33 +0000 (14:49 +1000)] 
Check notify with bad notify source address and tsig

named was asserting when the notify source address was not available
and TSIG was being used.  Check this scenario by adding a nameserver
to the zone which is configured to uses a non-existent source address
and a blackholed destination address and a TSIG using a server clause
for that destination address.

3 months agoDon't retry notify over TCP if it could not successed
Ondřej Surý [Thu, 19 Feb 2026 12:44:28 +0000 (13:44 +0100)] 
Don't retry notify over TCP if it could not successed

Prevent retrying the notify over TCP in case the source address is not
available or the source vs the destination address family mismatch or
when the destination address has been blackholed.  Properly log the
hard notify failures.

3 months agoFix assertion failure when sending notify fails over UDP
Ondřej Surý [Thu, 19 Feb 2026 12:44:23 +0000 (13:44 +0100)] 
Fix assertion failure when sending notify fails over UDP

When dns_request_create() fails in notify_send_toaddr() the TSIG key was
not cleared when retrying over TCP causing assertion failure.  Set the
TSIG key to NULL in the dns_message to prevent the assertion failure.

3 months agofix: dev: Return FORMERR for ECS family 0
Mark Andrews [Thu, 19 Feb 2026 09:47:54 +0000 (20:47 +1100)] 
fix: dev: Return FORMERR for ECS family 0

RFC 7871 only defines family 1 (IPv4) and 2 (IPv6). Additionally
it requires FORMERR to be returned for all unknown families.

Merge branch 'marka-formerr-family-0' into 'main'

See merge request isc-projects/bind9!11563

3 months agoReturn FORMERR for ECS family 0
Mark Andrews [Wed, 18 Feb 2026 23:03:36 +0000 (10:03 +1100)] 
Return FORMERR for ECS family 0

RFC 7871 only defines family 1 (IPv4) and 2 (IPv6). Additionally
it requires FORMERR to be returned for all unknown families.

3 months agochg: ci: cross-version-config-tests should hard fail again
Petr Špaček [Wed, 18 Feb 2026 15:20:14 +0000 (15:20 +0000)] 
chg: ci: cross-version-config-tests should hard fail again

Merge branch 'reenable-cross-version-tests' into 'main'

See merge request isc-projects/bind9!11560

3 months agoCross-version-config-tests should hard fail again
Petr Špaček [Wed, 18 Feb 2026 13:29:11 +0000 (14:29 +0100)] 
Cross-version-config-tests should hard fail again

New tag was released so we can now re-enable check disabled in
093bef9211b252653425f4477aa513d85e260cef.

3 months agochg: nil: Remove dns_rdataslab_merge() and friends
Ondřej Surý [Wed, 18 Feb 2026 14:08:08 +0000 (15:08 +0100)] 
chg: nil: Remove dns_rdataslab_merge() and friends

After the split to dns_rdataslab and dns_rdatavec, the
dns_rdataslab_merge() function was unused and it suffered from the same
data race as fixed in the previous commit.  Instead of fixing it, just
remove the function and bunch of other unused functions from the
dns_rdataslab unit.

Merge branch 'ondrej/cleanup-dns_rdataslab' into 'main'

See merge request isc-projects/bind9!11376

3 months agoUse offsetof() instead of pointer arithmetics to get slabheader
Ondřej Surý [Wed, 17 Dec 2025 09:01:06 +0000 (10:01 +0100)] 
Use offsetof() instead of pointer arithmetics to get slabheader

In rdataset_getheader() a cast of the raw buffer to dns_slabheader_t and
pointer arithmetics was used to get the start of the slabheader
structure.  Use more correct offsetof(dns_slabheader_t, raw) to
calculate the correct start of the dns_slabheader_t from the flexible
member raw[].

3 months agoMove the count of items in the slabheader from raw data to struct
Ondřej Surý [Wed, 17 Dec 2025 08:53:38 +0000 (09:53 +0100)] 
Move the count of items in the slabheader from raw data to struct

The count of items was stored in the raw data as first two bytes.
Instead of reading this from the raw header, move the number of the
items into the structure itself.

This needs the flexible member raw[] to be aligned on the size of the
pointer to prevent unaligned access to the start of the header from
rdataset_getheader() function that casts the raw[] to dns_slabheader_t.

3 months agoCleanup the unused members of dns_slabheader_t
Ondřej Surý [Tue, 16 Dec 2025 10:43:34 +0000 (11:43 +0100)] 
Cleanup the unused members of dns_slabheader_t

After the rdataslab -> rdataslab,rdatavec split, there were couple of
unused struct members.  Remove all the unused members, reorder the
members to eliminate the padding holes and thus reduce the
dns_slabheader_t and dns_slabtop_t structure sizes.

3 months agoRemove dns_rdataslab_merge() and friends
Ondřej Surý [Tue, 16 Dec 2025 10:37:15 +0000 (11:37 +0100)] 
Remove dns_rdataslab_merge() and friends

After the split to dns_rdataslab and dns_rdatavec, the
dns_rdataslab_merge() function was unused and it suffered from the same
data race as fixed in the previous commit.  Instead of fixing it, just
remove the function and bunch of other unused functions from the
dns_rdataslab unit.

3 months agoMerge tag 'v9.21.18'
Petr Špaček [Wed, 18 Feb 2026 10:29:45 +0000 (10:29 +0000)] 
Merge tag 'v9.21.18'

3 months agofix: usr: DNSTAP wasn't logging forwarded queries correctly
Mark Andrews [Tue, 17 Feb 2026 03:32:22 +0000 (14:32 +1100)] 
fix: usr: DNSTAP wasn't logging forwarded queries correctly

Closes #5724

Merge branch '5724-dnstap-forwarder-queries-logging' into 'main'

See merge request isc-projects/bind9!11509