Commit graph

43785 commits

Author SHA1 Message Date
Colin Vidal
6d75e03971 add checkconf test with key defined inside a view
A configuration where a key was defined inside a view, then used in a
`primary` statement wasn't covered. This is now fixed.

(cherry picked from commit d8f46b09a7)
2026-03-01 13:41:53 +01:00
Colin Vidal
867a85713e checkconf: check key existence in views
Commit `2956e4fc45b3c2142a3351682d4200647448f193` hardened the `key`
name check when used in `primaries` to reject the configuration if
the key was not defined, rather than simply checking whether the
key name was correctly formed.

However, the key name check didn't include the view configuration,
causing keys not to be recognized if they were defined inside the
view and not at the global level.  This regression is now fixed.

(cherry picked from commit b90399ebdc)
2026-03-01 13:41:53 +01:00
Michał Kępień
c460ce8430 Merge tag 'v9.20.20' into bind-9.20 2026-02-27 12:20:20 +00:00
Michał Kępień
70865706d2
Update BIND version for release 2026-02-26 21:53:41 +01:00
Michał Kępień
1ee5b847e5 new: doc: Prepare documentation for BIND 9.20.20
Merge branch 'michal/prepare-documentation-for-bind-9.20.20' into 'v9.20.20-release'

See merge request isc-private/bind9!933
2026-02-26 21:50:29 +01:00
Michał Kępień
09dd097c0d
Add release note for GL !11565 2026-02-26 21:29:38 +01:00
Michał Kępień
576285226f
Reorder release notes 2026-02-26 21:29:38 +01:00
Michał Kępień
b1e994ef9b
Tweak and reword release notes 2026-02-26 21:29:38 +01:00
Michał Kępień
140d817e13
Prepare release notes for BIND 9.20.20 2026-02-26 21:29:38 +01:00
Michał Kępień
833316c29f
Generate changelog for BIND 9.20.20 2026-02-26 21:29:38 +01:00
Michał Kępień
41c963685d chg: doc: Set up version for BIND 9.20.21
Merge branch 'michal/set-up-version-for-bind-9.20.21' into 'bind-9.20'

See merge request isc-projects/bind9!11609
2026-02-26 12:02:32 +01:00
Michał Kępień
0241c8883a
Update BIND version to 9.20.21-dev 2026-02-26 12:00:26 +01:00
Ondřej Surý
dd453590a0 [9.20] 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

Backport of MR !11604

Merge branch 'backport-5695-refactor-the-random-NS-selection-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!11606
2026-02-26 09:13:34 +01:00
Colin Vidal
d85889710b
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.

(cherry picked from commit 5274e764c4)
2026-02-26 08:17:23 +01:00
Ondřej Surý
8ddab7f0b8
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.

(cherry picked from commit 3c33e7d937)
2026-02-26 08:17:23 +01:00
Matthijs Mekking
9901ca97a4 [9.20] 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.

Backport of MR !11586

Merge branch 'backport-matthijs-fix-loglevel-keystore-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!11601
2026-02-25 17:05:26 +00:00
Matthijs Mekking
038a9ae46a 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.

(cherry picked from commit 5bd6322739)
2026-02-25 16:27:29 +00:00
Štěpán Balážik
6ff1e897b0 [9.20] 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.

Backport of MR !11599

Merge branch 'backport-stepan/fix-tsan-stress-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!11602
2026-02-25 16:01:00 +00:00
Štěpán Balážik
9cbd49827b 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.

(cherry picked from commit 4ed6c4e4e7)
2026-02-25 16:09:32 +01:00
Štěpán Balážik
191026a4cc [9.20] 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

Backport of MR !11499

Merge branch 'backport-stepan/python-tooling-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!11574
2026-02-25 13:49:25 +00:00
Štěpán Balážik
23c3da1dc8 Add ruff job to CI
Run the linter on Python code changes in CI.

(cherry picked from commit 8b0a8dbd8e)
2026-02-25 13:33:53 +01:00
Štěpán Balážik
6e91738efe Replace deprecated typing imports
More specific modules (like collections.abc) can now be used.

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

(cherry picked from commit ced002c4ab)
2026-02-25 13:33:46 +01:00
Štěpán Balážik
c04b9251aa 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.

(cherry picked from commit d3186c7038)
2026-02-25 13:33:25 +01:00
Štěpán Balážik
963ef9cb8e 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)

(cherry picked from commit 1d5924c82f)
2026-02-25 13:33:25 +01:00
Štěpán Balážik
17cf986396 Replace Optional[T] with T | None
Generated with: ruff check --extend-select UP045 --fix && black .

(cherry picked from commit fe38515ad0)
2026-02-25 13:33:25 +01:00
Štěpán Balážik
89ce3b5e74 Remove the rest of Union usages by hand
These require some manual changes.

(cherry picked from commit cdb7428431)
2026-02-25 13:33:25 +01:00
Štěpán Balážik
95f49d58b9 Replace Union[S, T] with S | T
Generated with: ruff check --extend-select UP007 --fix && black .

(cherry picked from commit ce9c9a1a9c)
2026-02-25 13:33:25 +01:00
Štěpán Balážik
a7ef013f6d Built-in types are now subscriptable
Generated with: ruff check --extend-select UP006 --fix

(cherry picked from commit 790745da18)
2026-02-25 13:33:25 +01:00
Štěpán Balážik
5fc2b9b2f3 Remove superfluous 'pylint: disable' directives
Some of these have been fixed already, fix the rest.

(cherry picked from commit 08f5e5ebd1)
2026-02-25 13:33:25 +01:00
Štěpán Balážik
e5d5a6433c Remove unused imports
Generated with: ruff check --extend-select F401 --fix

(cherry picked from commit b00f16f026)
2026-02-25 13:33:25 +01:00
Štěpán Balážik
af85bc2592 Set pytestmark explicitly in rollover* and nsec3* tests
Importing pytestmark confuses static analysis tools as they flag it as
unused.

(cherry picked from commit 7178c97e5c)
2026-02-25 13:33:25 +01:00
Štěpán Balážik
99658ad4a1 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().

(cherry picked from commit ef21b77912)
2026-02-25 13:33:25 +01:00
Štěpán Balážik
6e9e3b7208 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.

(cherry picked from commit 2b9c5ccd77)
2026-02-25 13:33:25 +01:00
Štěpán Balážik
746ca1d481 Automatically sort imports in Python code
Generated with: ruff check --extend-select I --fix (with the changes to
pyproject.toml applied).

(cherry picked from commit ffd5b6ac26)
2026-02-25 13:33:20 +01:00
Štěpán Balážik
d079305ba3 Remove unneeded pylint: disable=import-error
Paths are now correctly set up for pylint.
2026-02-25 13:15:05 +01:00
Štěpán Balážik
a2cdf5d8cd Lint code in doc directory
Adjust ignore lists of linters to check more code.

(cherry picked from commit 0fb7403ef4)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
68b9928f0f Fix vulture warnings and tweak ignore lists
Run vulture on the whole repository, fix most errors in previously
unchecked code, adjust ignore lists.

(cherry picked from commit 57ecaee95d)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
5e6399411a Fix 'Too many return statements' pylint error
Refactor `Key.match_properties` into multiple functions.

(cherry picked from commit 19076c0d4d)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
50f6dcdc75 Fix pylint's 'invalid-name' errors
Where possible comply with the naming rules. Add exceptions for the
function names used in KASP tests.

(cherry picked from commit 50ed74197c)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
7982b2e0c0 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.

(cherry picked from commit a3d0f43d21)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
929420ed24 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.

(cherry picked from commit 482c1cc72f)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
dd18071893 Reintroduce pylint checks that are not being violated
We might reintroduce them later if they become obnoxious.

(cherry picked from commit 115e64ea9e)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
4f8d253d7a Set dist=loadscope for pytest in pytest.ini
Previously there was some handling of old pytest-xdist versions which is
no longer needed.

(cherry picked from commit c47b076494)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
a8911683d7 Fix the rest of 'Formatting a regular string which could be an f-string'
Some fixes have to be done manually.

(cherry picked from commit a384283497)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
eb9a93ebd5 Fix some 'Formatting a regular string which could be an f-string' errors
Generated with:
ruff check --select UP031,UP032 --fix --unsafe-fixes && black .

(cherry picked from commit df0be6b4bd)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
ce66d794fc Add a small config for the ruff tool
It will be used for automated refactors of Python code.

(cherry picked from commit b7000ba9b0)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
c5c7790aa8 Centralize Python tooling configuration in pyproject.toml
This allows easy running of the tools from the project root both in CI
and locally.

(cherry picked from commit 601fc1f1cf)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
d6247cad75 Fix 'Using deprecated class FileType of module argparse'
In preparation for running pylint on more Python code.
2026-02-25 13:15:05 +01:00
Štěpán Balážik
7dd6b4dc5b Fix 'Import should be placed at the top of the module'
In preparation for running pylint on more Python code.

(cherry picked from commit 4253d7298c)
2026-02-25 13:15:05 +01:00
Štěpán Balážik
cffa775a90 Fix 'Using open without explicitly specifying an encoding'
In preparation for running pylint on more code.

(cherry picked from commit 38a47d9f7c)
2026-02-25 13:15:05 +01:00