Commit Graph
39548 Commits
Author SHA1 Message Date
Mark Andrews 8325f4e872 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.

(cherry picked from commit 0680eb6f64)
2025-02-04 02:37:39 +00:00
Ondřej Surý 4c49d99d56 [9.18] 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

Backport of MR !10048

Merge branch 'backport-5094-fix-timestamp-in-ttl-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10060
2025-02-03 15:17:42 +00:00
Ondřej Surý 0c064cfde4 Expand the usage of set_ttl() before mark_header_ancient()
When the mark_header_ancient() helper function was introduced, couple of
places with duplicate (or almost duplicate) code was missed.  Add
missing set_ttl() calls before mark_header_ancient(), so the handling of
expiring headers is same in all places.

(concept cherry picked from commit 58179e6a19)
2025-02-03 15:12:59 +01:00
Ondřej Surý 63e8af9270 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.

(cherry picked from commit cfee6aa565)
2025-02-03 15:04:36 +01:00
Ondřej Surý 9a8483bece 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'.

(cherry picked from commit 1bbb57f81b)
2025-02-03 15:04:36 +01:00
Ondřej Surý 368315b3c7 [9.18] 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

Backport of MR !10047

Merge branch 'backport-5155-fix-findzonecut-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10051
2025-02-02 22:07:27 +00:00
Evan Hunt 291d0d8d90 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.

(cherry picked from commit 1f095b902c)
2025-02-02 13:22:32 -08:00
Petr Špaček 0987d28643 [9.18] fix: ci: Do not trigger post-merge jobs for cross-project pushes
Backport of MR !10029
Backport of MR !10042

Merge branch 'backport-pspacek/no-cross-project-after-merge-jobs-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10044
2025-01-31 14:12:26 +00:00
Petr Špaček 37d3ccf19f Fix shell escaping in post-merge before_script
Fixup for commit 6014060774
"Do not trigger post-merge jobs for cross-project pushes".

Related: isc-projects/bind9!10029
(cherry picked from commit 6276e0b23b)
2025-01-31 15:10:51 +01:00
Petr Špaček a4adf51e74 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.

(cherry picked from commit 6014060774)
2025-01-31 14:49:36 +01:00
Michał Kępień 3181a2b555 [9.18] 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.

Backport of MR !9946

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

See merge request isc-projects/bind9!10038
2025-01-31 09:33:04 +00:00
Michał Kępień 050d1b896c 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.

(cherry picked from commit e39e7afc16)
2025-01-31 09:30:47 +00:00
Ondřej Surý fd9a85addc [9.18] chg: dev: Refactor reference counting in RBTDB
Clean up the pattern in the newref() and decref() functions in RBTDB databases.

Related to #5134

Backport of MR !10006

Merge branch 'backport-5134-refactor-decref-functions-in-qpdb-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10036
2025-01-31 06:06:27 +00:00
Ondřej Surý 2974bbba80 Clarify reference counting in RBTDB database
Change the names of the node reference counting functions
and add comments to make the mechanism easier to understand:

- new_reference() and decrement_references() are now called
  dns__rbtnode_acquire() and dns__rbtnode_release()
  respectively; this reflects the fact that they modify both
  the internal and external reference counters for a node.

- rbtnode_newref() and rbtnode_decref are now called
  rbtnode_erefs_increment() and rbtnode_erefs_decrement(),
  to reflect that they only increase and decrease the node's
  external reference counters, not internal.

(cherry picked from commit 857225aeb6)
2025-01-31 06:15:13 +01:00
Ondřej Surý 8465e4516f Refactor node reference counting in rbtdb.c
Refactor the pattern in the newref() and decref() functions in rbtdb.c
following the pattern, so it follows the similar pattern we already have
for QPDB.

(cherry picked from commit 9c45de9473)
2025-01-31 06:01:29 +01:00
Andoni Duarte c725ca982e [9.18] 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.

Backport of MR !10026

Merge branch 'backport-andoni/remove-allow-failure-in-cross-version-config-tests-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10028
2025-01-30 12:31:14 +00:00
Andoni Duarte Pintado facd231fc5 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.

(cherry picked from commit 5d07df807a)
2025-01-30 11:37:31 +01:00
Michał Kępień b7383e5048 fix: usr: fix "rndc flushname" for longer name server names
:option:`rndc flushname` did not work for name server names longer
than 16 bytes. This has been fixed.

Closes #3885

Merge branch '3885-fix-rndc-flushname-for-longer-name-server-names' into 'bind-9.18'

See merge request isc-projects/bind9!10025
2025-01-30 06:45:59 +00:00
Michał Kępień 64367010f2 Fix "rndc flushname" for longer name server names
dns_adb_flushname() calls dns_name_hash() to determine the ADB bucket
number to search for the given name.  Meanwhile, all other functions in
lib/dns/adb.c call dns_name_fullhash() for determining the bucket number
instead.  This discrepancy causes dns_adb_flushname() to have virtually
no chances of actually removing the given name from the ADB if the
name is longer than 16 bytes (since dns_name_hash() only hashes the
first 16 bytes of the name provided to it) - more specifically, the
probability of success for names longer than 16 bytes is inversely
proportional to the number of ADB buckets in use, i.e. 1:1021 at best.

Fix by using dns_name_fullhash() instead of dns_name_hash() in
dns_adb_flushname(), so that the logic for determining the bucket number
that a given name belongs to is consistent throughout lib/dns/adb.c.
2025-01-30 07:44:18 +01:00
Andoni Duarte Pintado 73997c8161 Merge tag 'v9.18.33' into bind-9.18 2025-01-29 17:23:11 +01:00
Nicki Křížek caf6979b91 [9.18] 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.

Backport of MR !10015

Merge branch 'backport-nicki/reduce-ci-artifacts-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10019
2025-01-29 14:51:51 +00:00
Nicki Křížek 47cc402dbf 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.

(cherry picked from commit e5636598a5)
2025-01-29 15:17:07 +01:00
Nicki Křížek fddf60da09 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.

(cherry picked from commit e59bc5b366)
2025-01-29 15:15:55 +01:00
Nicki Křížek 2ab553c042 [9.18] 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.

Backport of MR !10003

Merge branch 'backport-nicki/ci-fix-post-merge-in-private-repo-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10014
2025-01-28 13:40:43 +00:00
Nicki Křížek d94caf8913 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.

(cherry picked from commit 2e5a3bde7e)
2025-01-28 13:36:59 +00:00
Michal Nowak ce1583072f [9.18] chg: test: Add stress tests with DoH and DoT
Backport of MR !5800

Merge branch 'backport-mnowak/stress-test-with-doh-dot-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10008
2025-01-28 10:56:07 +00:00
Michal Nowak aa72e06fd6 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.

(cherry picked from commit 9756292a5f)
2025-01-27 21:21:12 +01:00
Nicki Křížek 53a84151c5 [9.18] 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.

Backport of MR !9804

Merge branch 'backport-nicki/ci-fix-changelog-job-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9998
2025-01-27 09:35:45 +00:00
Nicki Křížek 50fa13cafe 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.

(cherry picked from commit 380a30ba8d)
2025-01-24 18:11:16 +00:00
Michal Nowak 70ef4952e5 [9.18] new: doc: Add linkcheck to CI
Backport of MR !9680

Merge branch 'backport-mnowak/rtd-add-linkcheck-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9995
2025-01-24 14:39:56 +00:00
Michal Nowak 2d354606d6 Disable anchor checking for GitHub
(cherry picked from commit 641d7c561f391bdb6b46f5e19a532a5028ba0946)
2025-01-24 15:07:38 +01:00
Michal Nowak 789cafb209 Add linkcheck job
(cherry picked from commit 48eab76427)
2025-01-24 14:38:52 +01:00
Michal Nowak 48a77b943a 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.

(cherry picked from commit 8302469507)
2025-01-24 14:38:52 +01:00
Matthijs Mekking 13f3e88a8e [9.18] chg: doc: Document how secondaries refresh a zone in the ARM
Closes #5123

Backport of MR !9966

Merge branch 'backport-5123-document-refreshing-a-secondary-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9987
2025-01-24 09:07:30 +00:00
Matthijs Mekking 8777a33e3e Document how secondaries refresh a zone in the ARM
We have a KB article that describes this, put a condensed version into
the ARM.

(cherry picked from commit 8daf3782d1)
2025-01-24 09:07:21 +00:00
Nicki Křížek 46be0e9838 [9.18] chg: ci: Set stricter limits for respdiff testing
Adjust the limit of maximum disagreements in respdiff results based on
recent pipeline results.

The respdiff and respdiff:asan seem to have almost identical results,
typically around 0.07 % of differences with ocassional spikes up to
around 0.11 %. Similar results are for respdiff:tsan, perhaps with more
common spikes with values up to around 0.12 %. Set the limit to 0.15 %
to allow for some tolerance due to network conditions, time of day etc.

The respdiff:third-party has a slightly higher disagreements average,
with typical values being around 0.12 %. Set the limit to 0.2 %.

Exceeding either of those values should be quite clear indication that
some resolution behaviour has changed, since the values appear to be
very stable within the newly configured limits.

Backport of MR !9950

Merge branch 'backport-nicki/ci-respdiff-limits-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9990
2025-01-23 17:48:18 +00:00
Nicki Křížek 1c1a7aa2e1 Set stricter limits for respdiff testing
Adjust the limit of maximum disagreements in respdiff results based on
recent pipeline results.

The respdiff and respdiff:asan seem to have almost identical results,
typically around 0.07 % of differences with ocassional spikes up to
around 0.11 %. Similar results are for respdiff:tsan, perhaps with more
common spikes with values up to around 0.12 %. Set the limit to 0.15 %
to allow for some tolerance due to network conditions, time of day etc.

The respdiff:third-party has a slightly higher disagreements average,
with typical values being around 0.12 %. Set the limit to 0.2 %.

Exceeding either of those values should be quite clear indication that
some resolution behaviour has changed, since the values appear to be
very stable within the newly configured limits.

(cherry picked from commit 0584d3f65f)
2025-01-23 18:31:38 +01:00
Ondřej Surý 2c8d9c490c fix: nil: Stop the timer when canceling the last fetch
When canceling the last fetch, we also need to stop the fctx_expired
timer from possibly firing between the fctx_shutdown() call and the
fetch being actually destroyed along with the timer.

Closes #5136

Merge branch '5136-stop-timer-when-canceling-last-fetch-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9988
2025-01-23 17:25:37 +00:00
Ondřej Surý b14df7d459 Stop the timer when shuttingdown the fetch context
When canceling the last fetch, we also need to stop the fctx_expired
timer from possibly firing between the fctx_shutdown() call and the
fetch being actually destroyed along with the timer.  As there are
multiple places where fctx_shutdown() is being called without stopping
the timer, move the fctx_stoptimer() to fctx_shutdown() and cleanup the
explicit usage.
2025-01-23 17:46:37 +01:00
Matthijs Mekking 8e631afebe [9.18] fix: doc: Clarify dnssec-signzone interval option
There was confusion about whether the interval was calculated from
the validity period provided on the command line (with -s and -e),
or from the signature being replaced.

Add text to clarify that the interval is calculated from the new
validity period.

Closes #5128

Backport of MR !9955

Merge branch 'backport-5128-clarify-dnssec-signzone-interval-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9984
2025-01-23 11:53:34 +00:00
Matthijs Mekking 7545157fe8 Clarify dnssec-signzone interval option
There was confusion about whether the interval was calculated from
the validity period provided on the command line (with -s and -e),
or from the signature being replaced.

Add text to clarify that the interval is calculated from the new
validity period.

(cherry picked from commit ae42fa69fa)
2025-01-23 11:13:15 +00:00
Mark Andrews 132947c0ba [9.18] fix: usr: Yaml string not terminated in negative response in delv
Closes #5098

Backport of MR !9922

Merge branch 'backport-5098-missing-yaml-string-termination-delv-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9980
2025-01-23 00:40:13 +00:00
Mark Andrews 60c441eeff Check delv +yaml negative response output
(cherry picked from commit 9c04640def)
2025-01-22 23:58:54 +00:00
Mark Andrews 8790d5cd22 Terminate yaml string after negative comment
(cherry picked from commit 89afc11389)
2025-01-22 23:58:54 +00:00
Ondřej Surý 7c90bd5bb3 [9.18] fix: usr: Apply the memory limit only to ADB database items
Resolver under heavy-load could exhaust the memory available for storing
the information in the Address Database (ADB) effectively evicting already
stored information in the ADB.  The memory used to retrieve and provide
information from the ADB is now not a subject of the same memory limits
that are applied for storing the information in the Address Database.

Closes #5127

Backport of MR !9954

Merge branch 'backport-5127-change-ADB-memory-split-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9976
2025-01-22 14:30:05 +00:00
Ondřej Surý 239f4104da Remove memory limit on ADB finds and fetches
Address Database (ADB) shares the memory for the short lived ADB
objects (finds, fetches, addrinfo) and the long lived ADB
objects (names, entries, namehooks).  This could lead to a situation
where the resolver-heavy load would force evict ADB objects from the
database to point where ADB is completely empty, leading to even more
resolver-heavy load.

Make the short lived ADB objects use the other memory context that we
already created for the hashmaps.  This makes the ADB overmem condition
to not be triggered by the ongoing resolver fetches.

(cherry picked from commit 05faff6d53)
2025-01-22 15:29:27 +01:00
Ondřej Surý 2c667bc9c6 [9.18] fix: usr: Improve the resolver performance under attack
A remote client can force the DNS resolver component to consume the memory faster than cleaning up the resources for the canceled resolver fetches due to `recursive-clients` limit. If the such traffic pattern is sustained for a long period of time, the DNS server might eventually run out of the available memory. This has been fixed.

It should be noted that when under such heavy attack for BIND 9 version both with and without the fix, no outgoing DNS queries will be successful as the generated traffic pattern will consume all the available slots for the recursive clients.

Merge branch '5110-backport-the-hashtable-use-for-fetchcontexts-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9961
2025-01-22 14:27:44 +00:00
Ondřej Surý 4cc1160e4d Replace linked lists with the hashtables to hold fetch contexts
When the recursive-clients value is too large, the linked lists holding
the fetch contexts can also grow large and since the algorithm to merge
outgoing queries is quadratic, named can get slow.

Replace the linked list with hashtable for faster lookups.  This also
allows us to reduce the number of tasks (buckets) in the resolver.
2025-01-22 15:06:04 +01:00
Ondřej Surý 43c77d95f1 [9.18] fix: usr: Avoid unnecessary locking in the zone/cache database
Prevent lock contention among many worker threads referring to the same database node at the same time. This would improve zone and cache database performance for the heavily contended database nodes.

Backport of !9963 

Closes #5130

Merge branch '5130-reduce-lock-contention-in-decrement-reference-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9965
2025-01-22 13:31:39 +00:00
JINMEI TatuyaandOndřej Surý 065ffb2eb8 Optimize database decref by avoiding locking with refs > 1
Previously, this function always acquires a node write lock if it
might need node cleanup in case the reference decrements to 0.  In
fact, the lock is unnecessary if the reference is larger than 1 and it
can be optimized as an "easy" case. This optimization could even be
"necessary". In some extreme cases, many worker threads could repeat
acquring and releasing the reference on the same node, resulting in
severe lock contention for nothing (as the ref wouldn't decrement to 0
in most cases). This change would prevent noticeable performance
drop like query timeout for such cases.

Co-authored-by: JINMEI Tatuya <jtatuya@infoblox.com>
Co-authored-by: Ondřej Surý <ondrej@isc.org>

(cherry picked from commit 7f4471594d)
2025-01-22 14:31:09 +01:00