]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
15 months agochg: test: Generate TSAN unit stress tests
Michal Nowak [Thu, 13 Feb 2025 16:40:25 +0000 (16:40 +0000)] 
chg: test: Generate TSAN unit stress tests

This is a complement to the already present system test "stress" test.

Merge branch 'mnowak/generate-tsan-unit-stress-tests' into 'main'

See merge request isc-projects/bind9!9474

15 months agoGenerate TSAN unit stress tests
Michal Nowak [Wed, 4 Sep 2024 18:10:27 +0000 (20:10 +0200)] 
Generate TSAN unit stress tests

15 months agochg: doc: Set up version for BIND 9.21.6
Andoni Duarte [Thu, 13 Feb 2025 16:10:39 +0000 (16:10 +0000)] 
chg: doc: Set up version for BIND 9.21.6

Merge branch 'andoni/set-up-version-for-bind-9.21.6' into 'main'

See merge request isc-projects/bind9!10093

15 months agoUpdate BIND version to 9.21.6-dev
Andoni Duarte Pintado [Thu, 13 Feb 2025 14:55:46 +0000 (15:55 +0100)] 
Update BIND version to 9.21.6-dev

15 months agoUpdate BIND version for release v9.21.5
Andoni Duarte Pintado [Tue, 11 Feb 2025 17:10:40 +0000 (18:10 +0100)] 
Update BIND version for release

15 months agonew: doc: Prepare documentation for BIND 9.21.5
Andoni Duarte [Tue, 11 Feb 2025 17:04:45 +0000 (17:04 +0000)] 
new: doc: Prepare documentation for BIND 9.21.5

Merge branch 'andoni/prepare-documentation-for-bind-9.21.5' into 'v9.21.5-release'

See merge request isc-private/bind9!778

15 months agoUpdate CVE checklist
Michał Kępień [Mon, 10 Feb 2025 17:33:11 +0000 (18:33 +0100)] 
Update CVE checklist

15 months agoTweak and reword release notes
Andoni Duarte Pintado [Fri, 7 Feb 2025 18:00:06 +0000 (19:00 +0100)] 
Tweak and reword release notes

15 months agoPrepare release notes for BIND 9.21.5
Andoni Duarte Pintado [Fri, 7 Feb 2025 12:15:11 +0000 (13:15 +0100)] 
Prepare release notes for BIND 9.21.5

15 months agoGenerate changelog for BIND 9.21.5
Andoni Duarte Pintado [Fri, 7 Feb 2025 12:12:54 +0000 (13:12 +0100)] 
Generate changelog for BIND 9.21.5

15 months agofix: ci: Do not evaluate $CI_PROJECT_DIR in generate-stress-test-configs.py
Michal Nowak [Wed, 5 Feb 2025 15:01:03 +0000 (15:01 +0000)] 
fix: ci: Do not evaluate $CI_PROJECT_DIR in generate-stress-test-configs.py

GitLab CI Runner's $builds_dir variable is set to "/builds" by default.
For technical reasons, the FreeBSD Runners, using the "instance"
executor, sets the path differently.

The value of $CI_PROJECT_DIR is based on $builds_dir, so if the
generate-stress-test-configs.py script generates jobs with
$CI_PROJECT_DIR (or variables like $INSTALL_PATH that are based on it)
evaluated, it is calcified to whatever was the value in the particular
environment, disregarding the FreeBSD "instance" executor specifics in
the child pipeline.

Instead of evaluating $CI_PROJECT_DIR in the script, evaluate it in the
runtime environment.

Merge branch 'mnowak/fix-CI_PROJECT_DIR-variable-evaluation' into 'main'

See merge request isc-projects/bind9!10075

15 months agoDo not evaluate $CI_PROJECT_DIR in generate-stress-test-configs.py
Michal Nowak [Wed, 5 Feb 2025 08:59:58 +0000 (09:59 +0100)] 
Do not evaluate $CI_PROJECT_DIR in generate-stress-test-configs.py

GitLab CI Runner's $builds_dir variable is set to "/builds" by default.
For technical reasons, the FreeBSD Runners, using the "instance"
executor, sets the path differently.

The value of $CI_PROJECT_DIR is based on $builds_dir, so if the
generate-stress-test-configs.py script generates jobs with
$CI_PROJECT_DIR (or variables like $INSTALL_PATH that are based on it)
evaluated, it is calcified to whatever was the value in the particular
environment, disregarding the FreeBSD "instance" executor specifics in
the child pipeline.

Instead of evaluating $CI_PROJECT_DIR in the script, evaluate it in the
runtime environment.

15 months agofix: dev: Reduce the false sharing the dns_qpcache and dns_qpzone
Ondřej Surý [Tue, 4 Feb 2025 22:24:20 +0000 (22:24 +0000)] 
fix: dev: Reduce the false sharing the dns_qpcache and dns_qpzone

Instead of having many node_lock_count * sizeof(<member>) arrays, pack all
the members into a qpcache_bucket_t that is cacheline aligned to prevent
false sharing between RWLocks.

Merge branch 'ondrej/prevent-nodelock-false-sharing' into 'main'

See merge request isc-projects/bind9!10072

15 months agoSwitch the locknum generation for qpznode to random
Ondřej Surý [Tue, 4 Feb 2025 20:15:22 +0000 (21:15 +0100)] 
Switch the locknum generation for qpznode to random

Instead of using on hash of the name modulo number of the buckets,
assign the locknum randomly with isc_random_uniform().  This makes
the locknum assignment aligned with qpcache and allows the bucket
number to be non-prime in the future.

15 months agoRely on call_rcu() to destroy the qpzone outside of locks
Ondřej Surý [Tue, 4 Feb 2025 17:02:29 +0000 (18:02 +0100)] 
Rely on call_rcu() to destroy the qpzone outside of locks

Reduce the number of qpzone_ref() and qpzone_unref() calls in
qpzone_detachnode() by relying on the call_rcu to delay
the destruction of the lock buckets.

15 months agoReduce false sharing in dns_qpzone
Ondřej Surý [Tue, 4 Feb 2025 15:50:27 +0000 (16:50 +0100)] 
Reduce false sharing in dns_qpzone

Instead of having many node_lock_count * sizeof(<member>) arrays, pack
all the members into a qpzone_bucket_t that is cacheline aligned and have
a single array of those.

15 months agoReduce false sharing in dns_qpcache
Ondřej Surý [Mon, 3 Feb 2025 12:36:27 +0000 (13:36 +0100)] 
Reduce false sharing in dns_qpcache

Instead of having many node_lock_count * sizeof(<member>) arrays, pack
all the members into a qpcache_bucket_t struct that is cacheline aligned
and have a single array of those.

Additionaly, make both the head and the tail of isc_queue_t padded, not
just the head, to prevent false sharing of the lock-free structure with
the lock that follows it.

15 months agochg: test: Rewrite stub system test to pytest
Michal Nowak [Tue, 4 Feb 2025 12:38:25 +0000 (12:38 +0000)] 
chg: test: Rewrite stub system test to pytest

Merge branch 'mnowak/pytest_rewrite_stub' into 'main'

See merge request isc-projects/bind9!9190

15 months agoRewrite stub system test to pytest
Michal Nowak [Tue, 30 Jul 2024 07:12:39 +0000 (09:12 +0200)] 
Rewrite stub system test to pytest

15 months agoAdd isctest.check.notauth()
Michal Nowak [Tue, 30 Jul 2024 07:12:44 +0000 (09:12 +0200)] 
Add isctest.check.notauth()

15 months agoAllow to use an arbitrary numeric identifier for NamedInstance
Nicki Křížek [Fri, 24 Jan 2025 09:35:06 +0000 (10:35 +0100)] 
Allow to use an arbitrary numeric identifier for NamedInstance

In some cases, the numeric identifier doesn't correspond to the
directory name (i.e. `resolver` server in `shutdown` test, which is
supposed to be 10.53.0.3). These are typically servers that shouldn't be
auto-started by the runner, thus avoiding the typical `*ns<X>` name.

Support these server by allowing a fallback initialization with custom
numeric identifier in case it can't be parsed from the directory name.

15 months agoAdd start/stop wrappers to control NamedInstance
Nicki Křížek [Thu, 23 Jan 2025 15:00:36 +0000 (16:00 +0100)] 
Add start/stop wrappers to control NamedInstance

The start()/stop() functions can be used in the pytests in the same way
as start_server and stop_server functions were used in shell tests. Note
that the servers obtained through the servers fixture are still started
and stopped by the test runner at the start and end of the test. This
makes these functions mostly useful for restarting the server(s)
mid-test.

15 months agoMove shell and perl util functions to isctest.run
Nicki Křížek [Thu, 23 Jan 2025 14:04:30 +0000 (15:04 +0100)] 
Move shell and perl util functions to isctest.run

Previously, these functions have been provided as fixtures. This was
limiting re-use, because it wasn't possible to call these outside of
tests / other fixtures without passing these utility functions around.
Move them into isctest.run package instead.

15 months agofix: ci: Supress the leak detection in __xmlDefaultBufferSize
Michal Nowak [Tue, 4 Feb 2025 12:34:41 +0000 (12:34 +0000)] 
fix: ci: Supress the leak detection in __xmlDefaultBufferSize

Closes #5157

Merge branch '5157-suppress-lsan-libxml2-leak' into 'main'

See merge request isc-projects/bind9!10067

15 months agoSupress the leak detection in __xmlDefaultBufferSize
Michal Nowak [Tue, 4 Feb 2025 11:10:48 +0000 (12:10 +0100)] 
Supress the leak detection in __xmlDefaultBufferSize

15 months agochg: usr: Include destination address port number in query logging
Arаm Sаrgsyаn [Tue, 4 Feb 2025 11:48:52 +0000 (11:48 +0000)] 
chg: usr: Include destination address port number in query logging

When query logging is enabled, named will now include the destination
address port in the logged message.

Closes #5060

Merge branch '5060-log-query-incoming-port' into 'main'

See merge request isc-projects/bind9!9972

15 months agoInclude destination address port number in query logging
Aram Sargsyan [Wed, 22 Jan 2025 10:42:29 +0000 (10:42 +0000)] 
Include destination address port number in query logging

When query logging is enabled, named will now include the destination
address port in the logged message.

Example messages for before and after this change:

    before: client @0x7608b2026000 10.53.0.1#52136 (example.test): query: example.test IN A +E(0)K (10.53.0.1)
    after:  client @0x729bf5c26000 10.53.0.1#35976 (example.test): query: example.test IN A +E(0)K (10.53.0.1#53)

15 months agofix: test: Fix 'ans' servers so they respond with consistent answers to NS queries... 218080
Mark Andrews [Tue, 4 Feb 2025 02:35:33 +0000 (02:35 +0000)] 
fix: test: Fix 'ans' servers so they respond with consistent answers to NS queries at QNAME.

The ANS servers were not to written to handle NS queries at the QNAME, resulting in gratuitous protocol errors that will break tests when NS requests are made for the QNAME: i.e., NXDOMAIN for NS vs data for expected type,  CNAME not being returned for all query types.

Prerequisite for !9155

Closes #5062

Merge branch '5062-fix-ans-servers-ns-at-qname' into 'main'

See merge request isc-projects/bind9!9786

15 months agoFix gratuitious DNS protocol errors in the ANS servers
Mark Andrews [Thu, 18 Jul 2024 03:35:41 +0000 (13:35 +1000)] 
Fix gratuitious DNS protocol errors in the ANS servers

The ANS servers were not to written to handle NS queries at the
QNAME resulting in gratuitious protocol errors that will break tests
when NS requests are made for the QNAME.

15 months agonew: usr: Print the expiration time of the stale records
Ondřej Surý [Mon, 3 Feb 2025 15:18:31 +0000 (15:18 +0000)] 
new: usr: Print the expiration time of the stale records

Print the expiration time of the stale RRsets in the cache dump.

Merge branch 'ondrej/print-expiration-time-of-stale-records' into 'main'

See merge request isc-projects/bind9!10057

15 months agoPrint the expiration time of the stale records (not ancient)
Ondřej Surý [Mon, 3 Feb 2025 10:15:15 +0000 (11:15 +0100)] 
Print the expiration time of the stale records (not ancient)

In #1870, the expiration time of ANCIENT records were printed, but
actually the ancient records are very short lived, and the information
carries a little value.

Instead of printing the expiration of ANCIENT records, print the
expiration time of STALE records.

15 months agofix: usr: Recently expired records could be returned with timestamp in future
Ondřej Surý [Mon, 3 Feb 2025 13:39:39 +0000 (13:39 +0000)] 
fix: usr: Recently expired records could be returned with timestamp in future

Under rare circumstances, the RRSet that expired at the time of
the query could be returned with TTL far in the future.  This
has been fixed.

As a side-effect, the expiration time of expired RRSets are no
longer printed out in the cache dump.

Closes #5094

Merge branch '5094-fix-timestamp-in-ttl' into 'main'

See merge request isc-projects/bind9!10048

15 months agoRestore the .ttl field for slabheader in dns_qpzone
Ondřej Surý [Mon, 3 Feb 2025 13:06:37 +0000 (14:06 +0100)] 
Restore the .ttl field for slabheader in dns_qpzone

The original .ttl field was actually used as TTL in the dns_qpzone unit.
Restore the field by adding it to union with the .expire struct member
and cleanup all the code that added or subtracted 'now' from the ttl
field as that was misleading as 'now' would be always 0 for qpzone
database.

15 months agoRemove duplicate 'now' argument from find_coveringnsec()
Ondřej Surý [Sun, 2 Feb 2025 13:07:18 +0000 (14:07 +0100)] 
Remove duplicate 'now' argument from find_coveringnsec()

The find_coveringnsec() was getting the 'now' from two sources -
search->now and separate now argument.  Things like this are ticking
bombs, remove the extra 'now' argument and use single source of 'now'.

15 months agoExpand the usage of mark_ancient() helper functions
Ondřej Surý [Sun, 2 Feb 2025 12:56:37 +0000 (13:56 +0100)] 
Expand the usage of mark_ancient() helper functions

When the mark_ancient() helper function was introduced, couple of places
with duplicate (or almost duplicate) code was missed.  Move the
mark_ancient() function closer to the top of the file, and correctly use
it in places that mark the header as ANCIENT.

15 months agoAdd better ZEROTTL handling in bindrdataset()
Ondřej Surý [Sun, 2 Feb 2025 12:38:04 +0000 (13:38 +0100)] 
Add better ZEROTTL handling in bindrdataset()

If we know that the header has ZEROTTL set, the server should never send
stale records for it and the TTL should never be anything else than 0.
The comment was already there, but the code was not matching the
comment.

15 months agoIn dns_slabheader_t structure, change .ttl to .expire
Ondřej Surý [Sun, 2 Feb 2025 12:31:36 +0000 (13:31 +0100)] 
In dns_slabheader_t structure, change .ttl to .expire

The old name was misleading as it never meant time-to-live, e.g. number
of seconds from now when the header should expire.  The true meaning was
an expiration time e.g. now + ttl.  This was the original design bug
that caused the slip when we assigned header->ttl to rdataset->ttl.
Because the name was matching, nobody has questioned the correctness of
the code both during the MR review and during the numerous re-reviews
when we were searching for the cause of the 54 year TTL.

15 months agoIn cache, set rdataset TTL to 0 when the header is not active
Ondřej Surý [Sun, 2 Feb 2025 10:44:00 +0000 (11:44 +0100)] 
In cache, set rdataset TTL to 0 when the header is not active

When the header has been marked as ANCIENT, but the ttl hasn't been
reset (this happens in couple of places), the rdataset TTL would be
set to the header timestamp instead to a reasonable TTL value.

Since this header has been already expired (ANCIENT is set), set the
rdataset TTL to 0 and don't reuse this field to print the expiration
time when dumping the cache.  Instead of printing the time, we now
just print 'expired (awaiting cleanup'.

15 months agofix: usr: validate adb fetches
Mark Andrews [Mon, 3 Feb 2025 02:18:09 +0000 (02:18 +0000)] 
fix: usr: validate adb fetches

ADB responses were not being validated, allowing spoofed responses to be accepted and used for further lookups. This should not be possible when the servers for the zone are in a signed zone, except with CD=1 requests or when glue is needed. This has been fixed.

Closes #5066

Merge branch '5066-validate-adb-fetches' into 'main'

See merge request isc-projects/bind9!10052

15 months agoCheck recovery from spoofed server addresses
Mark Andrews [Wed, 22 Jan 2025 12:54:53 +0000 (23:54 +1100)] 
Check recovery from spoofed server addresses

Named was failing to recover when spoofed nameserver address from
a signed zone for a peer zone were returned to a previous CD=1
query. Validate non-glue interior server addresses before using them.

15 months agoSet PENDINGOK if STARTATZONE is set
Mark Andrews [Wed, 22 Jan 2025 09:58:33 +0000 (20:58 +1100)] 
Set PENDINGOK if STARTATZONE is set

When there are parent and child zones on the same server, the DNSKEY
lookup was failing as the pending record we are validating is needed
to fetch the DNSKEY records.  This change allows that to happen.
The caller is already setting STARTATZONE when the name being looked
up is a subdomain of the current domain.

15 months agoValidate address lookups from ADB
Mark Andrews [Fri, 17 Jan 2025 08:32:28 +0000 (19:32 +1100)] 
Validate address lookups from ADB

The address lookups from ADB were not being validated, allowing
spoofed responses to be accepted and used for other lookups.

Validate the answers except when CD=1 is set in the triggering
request.  Separate ADB names looked up with CD=1 from those without
CD=1, to prevent the use of unvalidated answers in the normal lookup
case (CD=0).  Set the TTL on unvalidated (pending) responses to
ADB_CACHE_MINIMUM when adding them to the ADB.

15 months agofix: dev: Fix the cache findzonecut() implementation
Ondřej Surý [Sun, 2 Feb 2025 18:54:24 +0000 (18:54 +0000)] 
fix: dev: Fix the cache findzonecut() implementation

The search for the deepest known zone cut in the cache could improperly reject a node if it contained any stale data, regardless of whether it was the NS RRset that was stale.

Closes #5155

Merge branch '5155-fix-findzonecut' into 'main'

See merge request isc-projects/bind9!10047

15 months agofix the cache findzonecut implementation
Evan Hunt [Sat, 1 Feb 2025 21:09:22 +0000 (13:09 -0800)] 
fix the cache findzonecut implementation

the search for the deepest known zone cut in the cache could
improperly reject a node containing stale data, even if the
NS rdataset wasn't the data that was stale.

this change also improves the efficiency of the search by
stopping it when both NS and RRSIG(NS) have been found.

15 months agofix: ci: Fix shell escaping in post-merge before_script
Petr Špaček [Fri, 31 Jan 2025 13:34:59 +0000 (13:34 +0000)] 
fix: ci: Fix shell escaping in post-merge before_script

Merge branch 'pspacek/no-cross-project-after-merge-jobs-fix' into 'main'

See merge request isc-projects/bind9!10042

15 months agoFix shell escaping in post-merge before_script
Petr Špaček [Fri, 31 Jan 2025 13:20:04 +0000 (14:20 +0100)] 
Fix shell escaping in post-merge before_script

Fixup for commit 60140607740bf8e07c0f223c18798bef36ef439c
"Do not trigger post-merge jobs for cross-project pushes".

Related: isc-projects/bind9!10029

15 months agofix: ci: Do not trigger post-merge jobs for cross-project pushes
Petr Špaček [Fri, 31 Jan 2025 12:10:41 +0000 (12:10 +0000)] 
fix: ci: Do not trigger post-merge jobs for cross-project pushes

Merge branch 'pspacek/no-cross-project-after-merge-jobs' into 'main'

See merge request isc-projects/bind9!10029

15 months agoDo not trigger post-merge jobs for cross-project pushes
Petr Špaček [Thu, 30 Jan 2025 10:24:59 +0000 (11:24 +0100)] 
Do not trigger post-merge jobs for cross-project pushes

We need to avoid double-triggering of post-merge jobs in the following
scenario:

 1. A private MR gets merged into the private BIND 9 repository.

 2. This merge operation triggers a "push" pipeline in the private
    repository, which correctly runs post-merge jobs, e.g. to set MR
    metadata in the private project.

 3. When a release is published, a script is run to change the
    automatically assigned milestone value ("Not released yet") to
    something else.

 4. Shortly afterwards, the result of the merge from step 1 is merged
    back into a maintenance branch in the public repository.

 5. The push operation triggers another "push" pipeline, this time in
    the public project.

At this point there are two problems:

  - If the script is dumb (like it currently is), it will extract the
    merge request ID from the merge commit description and change the
    milestone for a merge request in the wrong project namespace.

  - Even if the script was fixed to extract and use the correct GitLab
    project reference, it would reset the milestone for the merge
    request in the private repository back to "Not released yet" - while
    the milestone set in step 3 should be retained.

An alternative would be to change the order of operations so that
post-release milestoning happens at a later stage, while also fixing the
script to correctly follow cross-project references, but that approach
seems more fragile than simply failing on all cross-project pushes.  The
rule to enforce is: each project should only take care of its own
post-merge tasks.

15 months agochg: nil: Update CVE checklist
Michał Kępień [Fri, 31 Jan 2025 11:27:51 +0000 (11:27 +0000)] 
chg: nil: Update CVE checklist

This MR adds an extra CVE checklist step suggested by @pspacek after
CVE-2024-0760.  See [Mattermost][1] for context.

It also syncs checklist steps with their corresponding links to the
explanations wiki page as these have been out-of-sync since !9307.

[1]: https://mattermost.isc.org/isc/pl/156npi4bwtr6pechbj6sfs6jjo

Merge branch 'michal/update-cve-checklist' into 'main'

See merge request isc-projects/bind9!9949

15 months agoSync checklist steps with links to explanations
Michał Kępień [Fri, 31 Jan 2025 11:26:10 +0000 (12:26 +0100)] 
Sync checklist steps with links to explanations

15 months agoUpdate CVE checklist
Michał Kępień [Fri, 31 Jan 2025 11:26:10 +0000 (12:26 +0100)] 
Update CVE checklist

15 months agochg: ci: Use default cloning depth for the Danger CI job
Michał Kępień [Fri, 31 Jan 2025 09:26:25 +0000 (09:26 +0000)] 
chg: ci: Use default cloning depth for the Danger CI job

With shallow fetching working reliably in pygit2 1.17.0+, there is no
longer any need for GitLab CI runners to clone the BIND 9 repository
with a fixed depth of 1000 during every "danger" CI job as Hazard is now
able to fetch remote refs with an arbitrary depth, controlled by the
HAZARD_FETCH_DEPTH environment variable.  The latter can be defined via
GitLab project's CI settings and adjusted as needed over time, without
the need to update .gitlab-ci.yml every time its value needs to be
changed.

Merge branch 'michal/use-default-cloning-depth-for-the-danger-ci-job' into 'main'

See merge request isc-projects/bind9!9946

15 months agoUse default cloning depth for the Danger CI job
Michał Kępień [Fri, 31 Jan 2025 09:25:56 +0000 (10:25 +0100)] 
Use default cloning depth for the Danger CI job

With shallow fetching working reliably in pygit2 1.17.0+, there is no
longer any need for GitLab CI runners to clone the BIND 9 repository
with a fixed depth of 1000 during every "danger" CI job as Hazard is now
able to fetch remote refs with an arbitrary depth, controlled by the
HAZARD_FETCH_DEPTH environment variable.  The latter can be defined via
GitLab project's CI settings and adjusted as needed over time, without
the need to update .gitlab-ci.yml every time its value needs to be
changed.

15 months agochg: dev: Refactor decref() in both QPDB
Evan Hunt [Fri, 31 Jan 2025 04:45:07 +0000 (04:45 +0000)] 
chg: dev: Refactor decref() in both QPDB

Clean up the pattern in the newref() and decref() functions in QP databases.  Replace the `db_nodelock_t` structure with plain reference counting for every active database node in QPDB.

Related to #5134

Merge branch '5134-refactor-decref-functions-in-qpdb' into 'main'

See merge request isc-projects/bind9!10006

15 months agoClarify reference counting in QP databases
Evan Hunt [Thu, 30 Jan 2025 22:42:57 +0000 (14:42 -0800)] 
Clarify reference counting in QP databases

Change the names of the node reference counting functions
and add comments to make the mechanism easier to understand:

- newref() and decref() are now called qpcnode_acquire()/
  qpznode_acquire() and qpcnode_release()/qpznode_release()
  respectively; this reflects the fact that they modify both
  the internal and external reference counters for a node.

- qpcnode_newref() and qpznode_newref() are now called
  qpcnode_erefs_increment() and qpznode_erefs_increment(), and
  qpcnode_decref() and qpznode_decref() are now called
  qpcnode_erefs_decrement() and qpznode_erefs_decrement(),
  to reflect that they only increase and decrease the node's
  external reference counters, not internal.

15 months agoRemove db_nodelock_t in favor of reference counted qpdb
Ondřej Surý [Mon, 27 Jan 2025 20:07:11 +0000 (21:07 +0100)] 
Remove db_nodelock_t in favor of reference counted qpdb

This removes the db_nodelock_t structure and changes the node_locks
array to be composed only of isc_rwlock_t pointers.  The .reference
member has been moved to qpdb->references in addition to
common.references that's external to dns_db API users.  The .exiting
members has been completely removed as it has no use when the reference
counting is used correctly.

15 months agoRemove origin_node from qpcache
Ondřej Surý [Mon, 27 Jan 2025 17:13:38 +0000 (18:13 +0100)] 
Remove origin_node from qpcache

The origin_node in qpcache was always NULL, so we can remove the
getoriginode() function and origin_node pointer as the
dns_db_getoriginnode() correctly returns ISC_R_NOTFOUND when the
function is not implemented.

15 months agoRefactor decref() in both qpcache.c and qpzone.c
Ondřej Surý [Mon, 27 Jan 2025 17:06:17 +0000 (18:06 +0100)] 
Refactor decref() in both qpcache.c and qpzone.c

Cleanup the pattern in the decref() functions in both qpcache.c and
qpzone.c, so it follows the similar patter as we already have in
newref() function.

15 months agofix: dev: DNSSEC EDE system tests on FIPS platform
Colin Vidal [Thu, 30 Jan 2025 13:07:18 +0000 (13:07 +0000)] 
fix: dev: DNSSEC EDE system tests on FIPS platform

Changes introducing the support of extended DNS error code 1 and 2 uses
SHA-1 digest for some tests which break FIPS platform. The digest itself
was irrelevant, another digest is used.

Merge branch 'colin/fix-fips-9807' into 'main'

See merge request isc-projects/bind9!10002

15 months agofix DNSSEC EDE system tests on FIPS platform
Colin Vidal [Mon, 27 Jan 2025 11:52:19 +0000 (12:52 +0100)] 
fix DNSSEC EDE system tests on FIPS platform

Changes !9948 introducing the support of extended DNS error code 1 and 2
uses SHA-1 digest for some tests which break FIPS platform. The digest
itself was irrelevant, another digest is used.

15 months agofix: dev: Split and simplify the use of EDE list implementation
Ondřej Surý [Thu, 30 Jan 2025 11:29:53 +0000 (11:29 +0000)] 
fix: dev: Split and simplify the use of EDE list implementation

Instead of mixing the dns_resolver and dns_validator units directly with
the EDE code, split-out the dns_ede functionality into own separate
compilation unit and hide the implementation details behind abstraction.

Additionally, the new dns_edelist_t doesn't have to be copied into all
responses as those are attached to the fetch context, but it could be
only passed by reference.

This makes the dns_ede implementation simpler to use, although sligtly
more complicated on the inside.

Closes #5141

Merge branch '5141-ede-mem-fix-v2' into 'main'

See merge request isc-projects/bind9!10016

15 months agoUse DNS_EDE_OTHER instead of its literal value
Colin Vidal [Thu, 30 Jan 2025 10:54:36 +0000 (11:54 +0100)] 
Use DNS_EDE_OTHER instead of its literal value

15 months agoupdate EDE copy and add dup tests
Colin Vidal [Wed, 29 Jan 2025 22:30:07 +0000 (23:30 +0100)] 
update EDE copy and add dup tests

Update EDE tests to exercise the bitmap and next ede index logic

15 months agodetect dup EDE with bitmap and store next pos
Colin Vidal [Wed, 29 Jan 2025 22:27:34 +0000 (23:27 +0100)] 
detect dup EDE with bitmap and store next pos

In order to avoid to loop to find the next position to store an EDE in
a dns_edectx_t, add a "nextede" state which holds the next available
position.

Also, in order ot avoid to loop to find if an EDE is already existing in
a dns_edectx_t, and avoid a duplicate, use a bitmap to immediately know
if the EDE is there or not.

Those both changes applies for adding or copying EDE.

Also make the direction of dns_ede_copy more explicit/avoid errors by
making "edectx_from" a const pointer.

15 months agoadd lib/dns/ede.c documentation
Colin Vidal [Wed, 29 Jan 2025 21:32:33 +0000 (22:32 +0100)] 
add lib/dns/ede.c documentation

Add documentation usage of EDE compilation unit as well as centralize
all EDE-related macros in the same lib/dns/include/dns/ede.h header.

15 months agoRefactor test covering dns_ede API
Colin Vidal [Wed, 29 Jan 2025 17:34:51 +0000 (18:34 +0100)] 
Refactor test covering dns_ede API

Migrate tests cases in client_test code which were exclusively testing
code which is now all wrapped inside ede compilation unit. Those are
testing maximum number of EDE, duplicate EDE as well as truncation of
text of an EDE.

Also add coverage for the copy of EDE from an edectx to another one, as
well as checking the assertion of the maximum EDE info code which can be
used.

15 months agoSplit and simplify the use of EDE list implementation
Ondřej Surý [Wed, 29 Jan 2025 10:11:32 +0000 (11:11 +0100)] 
Split and simplify the use of EDE list implementation

Instead of mixing the dns_resolver and dns_validator units directly with
the EDE code, split-out the dns_ede functionality into own separate
compilation unit and hide the implementation details behind abstraction.

Additionally, the EDE codes are directly copied into the ns_client
buffers by passing the EDE context to dns_resolver_createfetch().

This makes the dns_ede implementation simpler to use, although sligtly
more complicated on the inside.

Co-authored-by: Colin Vidal <colin@isc.org>
Co-authored-by: Ondřej Surý <ondrej@isc.org>
15 months agofix: ci: remove allow failure in cross version config tests
Andoni Duarte [Thu, 30 Jan 2025 10:02:18 +0000 (10:02 +0000)] 
fix: ci: remove allow failure in cross version config tests

From https://gitlab.isc.org/isc-projects/bind9/-/issues/5087, the relevant MRs have been merged in the January 2025 release. Hence this MR removes `allow_failure: true` in CI.

Merge branch 'andoni/remove-allow-failure-in-cross-version-config-tests' into 'main'

See merge request isc-projects/bind9!10026

15 months agoUpdate cross-version-config-tests CI
Andoni Duarte Pintado [Thu, 30 Jan 2025 09:24:48 +0000 (10:24 +0100)] 
Update cross-version-config-tests CI

Remove `allow_failure: true` from .gitlab-ci.yaml, as the relevant
MRs have been merged in the January 2025 release.

15 months agoMerge tag 'v9.21.4'
Andoni Duarte Pintado [Wed, 29 Jan 2025 16:17:18 +0000 (17:17 +0100)] 
Merge tag 'v9.21.4'

15 months agochg: ci: Use make clean to reduce artifacts in successful jobs
Nicki Křížek [Wed, 29 Jan 2025 14:11:13 +0000 (14:11 +0000)] 
chg: ci: Use make clean to reduce artifacts in successful jobs

Reduce the amount of artifacts stored by running make clean at the end
of unit and system test run. If any of the previous commands fail, the
runner will stop executing the commands in `script` immediately, so the
cleanup only happens if none of the previous commands failed.

The build artifacts from unit and system tests are re-used anywhere and
should be safe to throw away immediately.

Merge branch 'nicki/reduce-ci-artifacts' into 'main'

See merge request isc-projects/bind9!10015

15 months agoEnable unit test artifacts for gcov jobs
Nicki Křížek [Tue, 28 Jan 2025 15:59:47 +0000 (16:59 +0100)] 
Enable unit test artifacts for gcov jobs

Without using the build artifacts from the unit test jobs in the
bookworm tests, the gcov would be incomplete.

15 months agoUse make clean to reduce artifacts in successful jobs
Nicki Křížek [Tue, 28 Jan 2025 14:23:01 +0000 (15:23 +0100)] 
Use make clean to reduce artifacts in successful jobs

Reduce the amount of artifacts stored by running make clean at the end
of unit and system test run. If any of the previous commands fail, the
runner will stop executing the commands in `script` immediately, so the
cleanup only happens if none of the previous commands failed.

The build artifacts from unit and system tests are re-used anywhere and
should be safe to throw away immediately. Same for respdiff.

15 months agofix: ci: Run merged-metadata job for release branches in private repo
Nicki Křížek [Tue, 28 Jan 2025 13:35:07 +0000 (13:35 +0000)] 
fix: ci: Run merged-metadata job for release branches in private repo

The prior regex didn't match the actual names we use for release
branches in the private repo. This caused the merged-metadata job to not
be created upon merging to a release branch, resulting in the private MR
not being properly milestoned.

Use the correct regex along with protecting the v9.*-release branches in
the gitlab UI so that they have access to the token used to perform the
required API operations.

Merge branch 'nicki/ci-fix-post-merge-in-private-repo' into 'main'

See merge request isc-projects/bind9!10003

15 months agoRun merged-metadata job for release branches in private repo
Nicki Křížek [Mon, 27 Jan 2025 14:30:39 +0000 (15:30 +0100)] 
Run merged-metadata job for release branches in private repo

The prior regex didn't match the actual names we use for release
branches in the private repo. This caused the merged-metadata job to not
be created upon merging to a release branch, resulting in the private MR
not being properly milestoned.

Use the correct regex along with protecting the v9.*-release branches in
the gitlab UI so that they have access to the token used to perform the
required API operations.

15 months agofix: doc: Use archived version of draft-icann-dnssec-keymgmt-01.txt
Michal Nowak [Tue, 28 Jan 2025 11:55:42 +0000 (11:55 +0000)] 
fix: doc: Use archived version of draft-icann-dnssec-keymgmt-01.txt

The iana.org link is gone.

Merge branch 'mnowak/linkcheck-fix-draft-icann-dnssec-keymgmt-01.txt-link' into 'main'

See merge request isc-projects/bind9!10010

15 months agoUse archived version of draft-icann-dnssec-keymgmt-01.txt
Michal Nowak [Tue, 28 Jan 2025 11:13:57 +0000 (12:13 +0100)] 
Use archived version of draft-icann-dnssec-keymgmt-01.txt

The iana.org link is gone.

15 months agochg: test: Add stress tests with DoH and DoT
Michal Nowak [Mon, 27 Jan 2025 20:09:49 +0000 (20:09 +0000)] 
chg: test: Add stress tests with DoH and DoT

Validation pipeline: https://gitlab.isc.org/isc-projects/bind9/-/pipelines/160984

Prerequisites:
- [x] isc-private/devops!11
- [x] https://gitlab.isc.org/isc-projects/bind9-qa/-/merge_requests/9

Things to consider:
- FreeBSD DoH jobs are not added because Flamethrower queries always timeout.
- This adds 15 more CI jobs:
  - Linux (AWS autoscaler): `(auth + recursive + RPZ) * (DoH + DoT) * (amd64 + arm64) = 12`
  - FreeBSD (one FreeBSD runner): `(auth + recursive + RPZ) * (DoT) * (amd64) = 3`
- Autoscaler is not yet present on FreeBSD. Adding 3 CI jobs (i.e., DoT) run serially adds 3 hours to the pipeline runtime. Should we add just one FreeBSD DoT job to limit the runtime?
- DoH/DoT performance is slightly lower than pure TCP, so the threshold for the test to pass must be lowered by 5-10% (see isc-private/bind-qa!40).

Merge branch 'mnowak/stress-test-with-doh-dot' into 'main'

See merge request isc-projects/bind9!5800

15 months agoAdd DoH and DoT stress tests, generate test configurations
Michal Nowak [Mon, 19 Feb 2024 14:55:00 +0000 (15:55 +0100)] 
Add DoH and DoT stress tests, generate test configurations

Add DoH and DoT stress test jobs. The DoH scenario on FreeBSD is omitted
because all Flamethrower's DoH queries timeout on this platform.

Since the response rate of DoT queries is lower than that of DoH and
TCP, the expected TCP response rate is 80%.

Due to the large number of similar stress test configurations, the
"util/generate-stress-test-configs.py" script now generates them as part
of a downstream pipeline. The script is expected to be run exclusively
within the CI environment, which sources all environmental variables and
files.

This refactoring brought the following changes:

- To start a stress test immediately and not wait for artifacts of the
  autoreconf job, run the "autoreconf -fi" command as part of every job.

- Drop the BIND_STRESS_TEST_* variables as they were rarely used and
  conflicted with mode and platform selection in the configuration
  generator.

- Most pipelines now include a few short, randomly selected stress test
  jobs. To schedule all stress tests, set the ALL_BIND_STRESS_TESTS
  environmental variable, push a tag to CI, or run a scheduled pipeline.

- Set the BIND_STRESS_TESTS_RUN_TIME environmental variable to pick the
  stress test runtime of your choosing, set the BIND_STRESS_TESTS_RATE
  environmental variable to set different than the default query rate.

- Job timeout is set to 30 minutes plus stress test runtime in minutes.

15 months agofix: dev: fix EDE 22 time out detection
Colin Vidal [Mon, 27 Jan 2025 11:48:49 +0000 (11:48 +0000)] 
fix: dev: fix EDE 22 time out detection

Extended DNS error 22 (No reachable authority) was previously detected when `fctx_expired` fired. It turns out this function is used as a "safety net" and the timeout detection should be caught earlier.

It was working though, because of another issue fixed by !9927. But then, the recursive request timed out detection occurs before `fctx_expired` making impossible to raise the EDE 22 error.

This fixes the problem by triggering the EDE 22 in the part of the code detecting the (TCP or UDP) time out and taking the decision to cancel the whole fetch (i.e. There is no other server to attempt to contact).

Note this is not targeting users (no release note) because there is no release versions of BIND between !9927 and this changes. Thus a release note would be confusing.

Closes #5137

Merge branch '5137-ede22' into 'main'

See merge request isc-projects/bind9!9985

15 months agofix byte order in EDE logging
Colin Vidal [Fri, 24 Jan 2025 16:27:09 +0000 (17:27 +0100)] 
fix byte order in EDE logging

When an EDE code is added to a message, the code is converted early in a
big-endian order so it can be memcpy-ed directly in the EDE buffer that
will go on the wire.

This previous change forget to update debug logs which still assume the
EDE code was in host byte order. Add a separate variable to
differentiate both and avoid ambiguities

15 months agoupdate serve-stale test to support EDE 22
Colin Vidal [Fri, 24 Jan 2025 10:23:43 +0000 (11:23 +0100)] 
update serve-stale test to support EDE 22

When EDE 3 (stale answer) was added the serve-stale tests were checking
for those exclusively, i.e. grepping for no "EDE" in the dig output when
no stale answer was expected.

However, some stale tests disable stale answers and make the
authoritative server unresponsive, effectively triggering a timed out
request thus an EDE 22. Update those tests so they still tests the
absence of EDE 3 error, but also the presence of EDE 22.

15 months agoadd new EDE 22 system tests
Colin Vidal [Thu, 23 Jan 2025 15:43:53 +0000 (16:43 +0100)] 
add new EDE 22 system tests

This re-do a previously existing EDE 22 system test as well as add
another one making sure the timed out flow detection works also on UDP
when the resolver is contacting the authoritative server. (the existing
test was using TCP to contact the authoritative servers).

15 months agofix EDE 22 time out detection
Colin Vidal [Thu, 23 Jan 2025 15:38:35 +0000 (16:38 +0100)] 
fix EDE 22 time out detection

Extended DNS error 22 (No reachable authority) was previously detected
when `fctx_expired` fired. It turns out this function is used as a
"safety net" and the timeout detection should be caught earlier.

It was working though, because of another issue fixed by !9927. Since
this change, the recursive request timed out detection occurs before
`fctx_expired` so EDE 22 is not added to the response message anymore.

The fix of the problem is to add the EDE 22 code in two situations:

- When the dispatch code timed out (rctx_timedout) the resolver code
  checks various properties to figure out if it needs to make another
  fetch attempt. One of the paramters if the fetch expiration time. If
  it expires, the whole recursion is canceled, so it now adds the EDE 22
  code.

- If the fetch expiration time doesn't expires in the case above (and
  other parameters allows it) a new fetch attempt is made (fctx_query).
  But before the new request is actually made, the fetch expiration time
  is re-checked. It might then has elapsed, and the whole recursion is
  canceled. So it now also adds the EDE 22 code here as well.

15 months agonew: usr: add a rndc command to toggle jemalloc profiling
Aydın Mercan [Sat, 25 Jan 2025 12:53:38 +0000 (12:53 +0000)] 
new: usr: add a rndc command to toggle jemalloc profiling

The new command is `rndc memprof`. The memory profiling status is also
reported inside `rndc status`. The status also shows whether named can
toggle memory profiling or not and if the server is built with jemalloc.

Closes #4759

Merge branch '4759-add-a-trigger-to-dump-jeprof-data-or-memory-statistics' into 'main'

See merge request isc-projects/bind9!9370

15 months agoadd a rndc command to toggle jemalloc profiling
Aydın Mercan [Mon, 12 Aug 2024 15:17:05 +0000 (18:17 +0300)] 
add a rndc command to toggle jemalloc profiling

The new command is `rndc memprof`. The memory profiling status is also
reported inside `rndc status`. The status also shows whether named can
toggle memory profiling or not and if the server is built with jemalloc.

15 months agochg: ci: Ensure changelog job builds docs with the new entry
Nicki Křížek [Fri, 24 Jan 2025 18:10:32 +0000 (18:10 +0000)] 
chg: ci: Ensure changelog job builds docs with the new entry

The changelog job is supposed to test that the text from GitLab MR
title&description is valid rst syntax and can be built with sphinx. In
49128fc1, the way gitchangelog generates entries was changed - it no
longer writes to the changelog file, but generates output on stdout
instead. Ensure the generated notes is actually written to (some)
rendered file which is part of the docs so that the subsequent sphinx
build attempts to render the note.

Merge branch 'nicki/ci-fix-changelog-job' into 'main'

See merge request isc-projects/bind9!9804

15 months agoEnsure changelog job builds docs with the new entry
Nicki Křížek [Mon, 2 Dec 2024 14:31:53 +0000 (15:31 +0100)] 
Ensure changelog job builds docs with the new entry

The changelog job is supposed to test that the text from GitLab MR
title&description is valid rst syntax and can be built with sphinx. In
49128fc1, the way gitchangelog generates entries was changed - it no
longer writes to the changelog file, but generates output on stdout
instead. Ensure the generated notes is actually written to (some)
rendered file which is part of the docs so that the subsequent sphinx
build attempts to render the note.

15 months agonew: usr: adds support for EDE code 1 and 2
Colin Vidal [Fri, 24 Jan 2025 13:16:56 +0000 (13:16 +0000)] 
new: usr: adds support for EDE code 1 and 2

Add support for EDE codes 1 & 2 which might occurs during DNSSEC validation in case of unsupported RRSIG algorithm or DNSKEY digest.

See #2715

Merge branch '2715-ede-unsupported-digest-alg' into 'main'

See merge request isc-projects/bind9!9948

15 months agoadd DNSSEC EDE test for unsupported digest and alg
Colin Vidal [Mon, 20 Jan 2025 19:59:23 +0000 (20:59 +0100)] 
add DNSSEC EDE test for unsupported digest and alg

A DNSSEC validation can fail in the case where multiple DNSKEY are
available for a zone and none of them are supported, but for different
reasons: one has a DS record in the parent zone using an unsupported
digest while the other one uses an unsupported encryption algorithm.

Add a specific test case covering this flow and making sure that two
extended DNS error are provided: code 1 and 2, each of them highlighting
unsupported algorithm and digest.

15 months agotests for support for EDE 1 & 2
Colin Vidal [Mon, 13 Jan 2025 13:50:58 +0000 (14:50 +0100)] 
tests for support for EDE 1 & 2

15 months agoadd support for EDE code 1 and 2
Colin Vidal [Mon, 13 Jan 2025 13:50:01 +0000 (14:50 +0100)] 
add support for EDE code 1 and 2

Add support for EDE codes 1 (Unsupported DNSKEY Algorithm) and 2
(Unsupported DS Digest Type) which might occurs during DNSSEC
validation in case of unsupported DNSKEY algorithm or DS digest type.

Because DNSSEC internally kicks off various fetches, we need to copy
all encountered extended errors from fetch responses to the fetch
context. Upon an event, the errors from the fetch context are copied
to the client response.

15 months agonew: doc: Add linkcheck to CI
Michal Nowak [Fri, 24 Jan 2025 12:00:30 +0000 (12:00 +0000)] 
new: doc: Add linkcheck to CI

Merge branch 'mnowak/rtd-add-linkcheck' into 'main'

See merge request isc-projects/bind9!9680

15 months agoAdd linkcheck job
Michal Nowak [Fri, 24 Jan 2025 10:50:49 +0000 (11:50 +0100)] 
Add linkcheck job

15 months agoFix broken links in documentation
Michal Nowak [Fri, 24 Jan 2025 10:50:36 +0000 (11:50 +0100)] 
Fix broken links in documentation

Some detected links are not to be verified (127.*, dnssec-or-not.com)
and some I can't fix (flaticon, godaddy, icann), but they are not
crucial.

15 months agochg: test: Rewrite cipher-suites system test to pytest
Michal Nowak [Fri, 24 Jan 2025 08:53:25 +0000 (08:53 +0000)] 
chg: test: Rewrite cipher-suites system test to pytest

The minimal dnspython version to run this test is 2.5.0.

Merge branch 'mnowak/pytest_rewrite_cipher-suites' into 'main'

See merge request isc-projects/bind9!8662

15 months agoRename have_* marks to with_*
Michal Nowak [Fri, 11 Oct 2024 09:30:26 +0000 (11:30 +0200)] 
Rename have_* marks to with_*

Marks starting with "with" or "without" make more sense linguistically
than those starting with "have" or "have_not".

15 months agoTest cipher-suites after zone transfers complete
Nicki Křížek [Wed, 28 Aug 2024 13:03:27 +0000 (15:03 +0200)] 
Test cipher-suites after zone transfers complete

Ensure the zone transfers have completed (successfully or not) before
running the test cases, because they assume zone transfers have been
done.

15 months agoMake servers fixture in pytest module-wide
Nicki Křížek [Wed, 28 Aug 2024 13:00:02 +0000 (15:00 +0200)] 
Make servers fixture in pytest module-wide

The servers are setup and torn down once per each test module. All the
logs and server state persists between individual tests within the same
module. The servers fixture representing these servers should be
module-wide as well.

15 months agoRewrite cipher-suites system test to pytest
Michal Nowak [Wed, 17 Jan 2024 19:43:21 +0000 (20:43 +0100)] 
Rewrite cipher-suites system test to pytest

The minimal required dnspython version is 2.5.0 because of the need for
the "verify" argument in dns.query.tls().