Compare commits

..
Author SHA1 Message Date
Andoni Duarte Pintado 72cbad0469 Update BIND version for release 2025-02-11 18:11:22 +01:00
Andoni Duarte af83b48a49 new: doc: Prepare documentation for BIND 9.20.6
Merge branch 'andoni/prepare-documentation-for-bind-9.20.6' into 'v9.20.6-release'

See merge request isc-private/bind9!779
2025-02-11 16:51:37 +00:00
Andoni Duarte Pintado b1b0681189 Tweak and reword release notes 2025-02-11 15:00:39 +01:00
Andoni Duarte Pintado 40ab4800b4 Prepare release notes for BIND 9.20.6 2025-02-07 19:35:59 +01:00
Andoni Duarte Pintado 22bb228a16 Generate changelog for BIND 9.20.6 2025-02-07 19:35:23 +01:00
Michal Nowak bc3957136d [9.20] 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.

Backport of MR !10075

Merge branch 'backport-mnowak/fix-CI_PROJECT_DIR-variable-evaluation-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10077
2025-02-05 15:30:30 +00:00
Michal Nowak aa68ffeabd 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.

(cherry picked from commit dab7d28b09)
2025-02-05 15:04:45 +00:00
Nicki Křížek 38c51c8401 [9.20] 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

Backport of MR !9370

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

See merge request isc-projects/bind9!10000
2025-02-05 10:14:25 +00:00
Aydın MercanandNicki Křížek dde251b773 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.

(cherry picked from commit b495e9918e)
2025-02-05 10:40:05 +01:00
Ondřej Surý 5c27e9cdda [9.20] 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.

Backport of MR !10072

Merge branch 'backport-ondrej/prevent-nodelock-false-sharing-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10074
2025-02-04 23:17:37 +00:00
Ondřej Surý db2bce1c6f 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.

(cherry picked from commit 732fc338a9)
2025-02-04 23:28:53 +01:00
Ondřej Surý d4e8a92977 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.

(cherry picked from commit 1fa5219fdf)
2025-02-04 23:28:53 +01:00
Ondřej Surý c6c03a6b11 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.

(cherry picked from commit 6dcc398726)
2025-02-04 23:28:50 +01:00
Ondřej Surý a9f4e3369a 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.

(cherry picked from commit c602d76c1f)
2025-02-04 23:27:28 +01:00
Ondřej Surý b5cce0f597 [9.20] new: usr: Print the expiration time of the stale records
Print the expiration time of the stale RRsets in the cache dump.

Backport of MR !10057

Merge branch 'backport-ondrej/print-expiration-time-of-stale-records-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10061
2025-02-04 17:08:20 +00:00
Ondřej Surý 8229d9cdfa 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.

(cherry picked from commit 355fc48472)
2025-02-04 18:07:59 +01:00
Michal Nowak 9fbc273417 [9.20] chg: test: Rewrite stub system test to pytest
Backport of MR !9190

Merge branch 'backport-mnowak/pytest_rewrite_stub-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10070
2025-02-04 13:25:41 +00:00
Michal Nowak fb7d78a258 Rewrite stub system test to pytest
(cherry picked from commit 1069eb1969)
2025-02-04 13:24:54 +00:00
Michal Nowak 1047797100 Add isctest.check.notauth()
(cherry picked from commit b19fb37080)
2025-02-04 13:24:54 +00:00
Nicki KřížekandMichal Nowak b5ecd7416c 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.

(cherry picked from commit a24f71bae4)
2025-02-04 13:24:54 +00:00
Nicki KřížekandMichal Nowak 0e412834e9 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.

(cherry picked from commit 37699ad84b)
2025-02-04 13:24:54 +00:00
Nicki KřížekandMichal Nowak 184160ac36 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.

(cherry picked from commit b6d645410c)
2025-02-04 13:24:54 +00:00
Michal Nowak f76cacae35 [9.20] fix: ci: Supress the leak detection in __xmlDefaultBufferSize
Closes #5157

Backport of MR !10067

Merge branch 'backport-5157-suppress-lsan-libxml2-leak-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10068
2025-02-04 13:24:11 +00:00
Michal Nowak 0e14319ef6 Supress the leak detection in __xmlDefaultBufferSize
(cherry picked from commit ca859563aa)
2025-02-04 12:37:53 +00:00
Mark Andrews 16b57388ab [9.20] 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

Backport of MR !9786

Merge branch 'backport-5062-fix-ans-servers-ns-at-qname-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10064
2025-02-04 04:14:10 +00:00
Mark Andrews 2a8bf4f6bb 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:34 +00:00
Ondřej Surý 9a4df4caac [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!10059
2025-02-03 15:05:48 +00:00
Ondřej Surý 302aca809d 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.

(cherry picked from commit 58179e6a19)
2025-02-03 15:53:34 +01:00
Ondřej Surý 4b114838de 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:53:34 +01:00
Ondřej Surý b32512a232 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:53:34 +01:00
Ondřej Surý 619f163e68 [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!10050
2025-02-02 22:06:52 +00:00
Evan HuntandOndřej Surý 1e818d368f 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 20:01:52 +01:00
Petr Špaček 51d5d0aae2 [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!10043
2025-01-31 14:07:50 +00:00
Petr Špaček 86f7822c81 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 14:52:04 +01:00
Petr Špaček 80f330ab60 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:31 +01:00
Michał Kępień 9d87acf959 [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!10037
2025-01-31 09:32:53 +00:00
Michał Kępień 3cb6c224f2 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:42 +00:00
Ondřej Surý 3244f7848f [9.20] chg: dev: Refactor reference counting in both QPDB and RBTDB
Clean up the pattern in the newref() and decref() functions in QP and RBTDB databases.  Replace the `db_nodelock_t` structure with plain reference counting for every active database node in QPDB.

Related to #5134

Backport of MR !10006

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

See merge request isc-projects/bind9!10035
2025-01-31 05:48:14 +00:00
Ondřej Surý 857225aeb6 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:

- dns__rbtdb_newref() and dns__rbtdb_decref() 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.
2025-01-31 06:07:48 +01:00
Ondřej Surý 9c45de9473 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.
2025-01-31 05:52:13 +01:00
Evan HuntandOndřej Surý 5300eebc9e 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.

(cherry picked from commit d4f791793e)
2025-01-31 05:52:13 +01:00
Ondřej Surý 7dab6cdfbc 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.

(cherry picked from commit 431513d8b3)
2025-01-31 05:49:36 +01:00
Ondřej Surý 082a54cc5d 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.

(cherry picked from commit 36a26bfa1a)
2025-01-31 05:49:23 +01:00
Ondřej Surý d1d444d2ab 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.

(cherry picked from commit 814b87da64)
2025-01-31 05:49:12 +01:00
Colin Vidal 8662424442 [9.20] 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

Backport of MR !9985

Merge branch 'backport-5137-ede22-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10001
2025-01-30 15:39:18 +00:00
Colin Vidal 588924bbb5 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.

(cherry picked from commit 27f3b8950a)
2025-01-30 14:43:25 +00:00
Colin Vidal edd6f0eb35 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).

(cherry picked from commit 7cb8a028fe)
2025-01-30 14:43:25 +00:00
Colin Vidal 3aff00dc7b 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.

(cherry picked from commit 78274ec2b1)
2025-01-30 14:43:25 +00:00
Colin Vidal 917181b4e2 [9.20] 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.

Backport of MR !10002

Merge branch 'backport-colin/fix-fips-9807-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10031
2025-01-30 14:39:56 +00:00
Colin Vidal b03cedc754 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.

(cherry picked from commit d82262d293)
2025-01-30 13:32:38 +00:00
Colin Vidal 23a9bed310 [9.20] 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

Backport of MR !10016

Merge branch 'backport-5141-ede-mem-fix-v2-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10030
2025-01-30 13:12:16 +00:00
Colin Vidal 7b04c80183 manually add dns_lctx to isc_log_write in ede.c
Because the new introduced code in main doesn't use the log context
anymore, manually add the log context for isc_log_write usages in the
new ede.c file.
2025-01-30 12:37:55 +00:00
Colin Vidal ccafa27b44 Use DNS_EDE_OTHER instead of its literal value
(cherry picked from commit 7c5678bb03)
2025-01-30 12:37:55 +00:00
Colin Vidal 3bc6de9265 update EDE copy and add dup tests
Update EDE tests to exercise the bitmap and next ede index logic

(cherry picked from commit c7b0fe5bec)
2025-01-30 12:37:55 +00:00
Colin Vidal e5fc9f5fcb 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.

(cherry picked from commit 9021f9d802)
2025-01-30 12:37:55 +00:00
Colin Vidal f390108f8c 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.

(cherry picked from commit 7b01cbfb04)
2025-01-30 12:37:55 +00:00
Colin Vidal 7e3a650ae2 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.

(cherry picked from commit f9f41190b3)
2025-01-30 12:37:55 +00:00
Ondřej SurýandColin Vidal 1ffb67a135 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>
(cherry picked from commit 2f8e0edf3b)
2025-01-30 12:37:55 +00:00
Andoni Duarte 77c4107bcd [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!10027
2025-01-30 12:31:11 +00:00
Andoni Duarte Pintado bd03265d0c 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:36:29 +01:00
Andoni Duarte Pintado 2d0323e006 Merge tag 'v9.20.5' into bind-9.20 2025-01-29 17:21:44 +01:00
Nicki Křížek c753376b2e [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!10018
2025-01-29 14:45:23 +00:00
Nicki Křížek 5d45acaa2f 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 14:11:59 +00:00
Nicki Křížek 9410fd815a 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 14:11:59 +00:00
Michal Nowak 0285a0447f [9.20] fix: doc: Use archived version of draft-icann-dnssec-keymgmt-01.txt
The iana.org link is gone.

Backport of MR !10010

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

See merge request isc-projects/bind9!10011
2025-01-28 13:41:27 +00:00
Michal Nowak 2134b35557 Use archived version of draft-icann-dnssec-keymgmt-01.txt
The iana.org link is gone.

(cherry picked from commit 5dbc87730e)
2025-01-28 13:41:05 +00:00
Nicki Křížek ea4a113375 [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!10013
2025-01-28 13:40:34 +00:00
Nicki Křížek 54e53a9bc9 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:55 +00:00
Michal Nowak 0cea21019e [9.20] chg: test: Add stress tests with DoH and DoT
Backport of MR !5800

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

See merge request isc-projects/bind9!10007
2025-01-28 10:54:16 +00:00
Michal Nowak fa941f01b5 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 20:10:36 +00:00
Michal Nowak cf51840753 [9.20] new: doc: Add linkcheck to CI
Backport of MR !9680

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

See merge request isc-projects/bind9!9994
2025-01-27 09:50:45 +00:00
Michal Nowak c429cfa3b2 Disable anchor checking for GitHub 2025-01-27 09:42:47 +00:00
Michal Nowak bd3b24ab7a Add linkcheck job
(cherry picked from commit 48eab76427)
2025-01-27 09:42:47 +00:00
Michal Nowak 10aed4344c 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-27 09:42:47 +00:00
Nicki Křížek ccd45042d7 [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!9997
2025-01-27 09:35:37 +00:00
Nicki Křížek 02cf566312 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:11 +00:00
Colin Vidal b3eab79bc1 [9.20] 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

Backport of MR !9948

Merge branch 'backport-2715-ede-unsupported-digest-alg-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9996
2025-01-24 14:58:46 +00:00
Colin Vidal b61e1a5bcf 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.

(cherry picked from commit 244923b9dc)
2025-01-24 14:27:17 +01:00
Colin Vidal e133411451 tests for support for EDE 1 & 2
(cherry picked from commit 8b50d63fe1)
2025-01-24 14:27:17 +01:00
Colin Vidal 6c65d70ce5 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.

(cherry picked from commit 46a58acdf5)
2025-01-24 14:27:16 +01:00
Michal Nowak 20057d587f [9.20] chg: test: Rewrite cipher-suites system test to pytest
The minimal dnspython version to run this test is 2.5.0.

Backport of MR !8662

Merge branch 'backport-mnowak/pytest_rewrite_cipher-suites-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9992
2025-01-24 09:31:16 +00:00
Michal Nowak d2c8694930 Rename have_* marks to with_*
Marks starting with "with" or "without" make more sense linguistically
than those starting with "have" or "have_not".

(cherry picked from commit df7e9f4ac3)
2025-01-24 08:56:36 +00:00
Nicki KřížekandMichal Nowak e7a469133c 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.

(cherry picked from commit 23fb615963)
2025-01-24 08:56:36 +00:00
Nicki KřížekandMichal Nowak 2eb5ce24fb 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.

(cherry picked from commit a72ff9fd57)
2025-01-24 08:56:36 +00:00
Michal Nowak f3f7667fc7 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().

(cherry picked from commit 100b759863)
2025-01-24 08:56:36 +00:00
Michal Nowak 3047cc9a25 Use Debian "sid" for pylint and mypy jobs to get recent dnspython
The base image tends to have a rather old dnspython version and when
used with pylint and mypy it produces errors about newer dnspython
features the old version does not know about.

    $ mypy "bin/tests/system/isctest/"
    bin/tests/system/isctest/query.py:55: error: Unexpected keyword argument "verify" for "tls"  [call-arg]
    /usr/lib/python3/dist-packages/dns/query.py:958: note: "tls" defined here

    $ pylint --rcfile $CI_PROJECT_DIR/.pylintrc --disable=wrong-import-position $(git ls-files 'bin/tests/system/*.py' | grep -vE 'ans\.py')
    ************* Module isctest.query
    bin/tests/system/isctest/query.py:55:11: E1123: Unexpected keyword argument 'verify' in function call (unexpected-keyword-arg)

(cherry picked from commit b2964cc922)
2025-01-24 08:56:36 +00:00
Michal Nowak 9f356962ec Add isctest.query.tls() function
When explicitly set to True, the "verify" argument lets dnspython verify
certificates used for the connection. As most certificates in the system
test will inevitably be self-signed, the "verify" argument defaults to
False.

The "verify" argument is present in dnspython since the version 2.5.0.

(cherry picked from commit df8c419058)
2025-01-24 08:56:36 +00:00
Michal Nowak 1a4fb0550b Add "without_fips" mark
The "without_fips" mark disables test function when BIND 9 was built
with the FIPS mode enabled as not everything works in FIPS-enabled
builds.

(cherry picked from commit feecbd8e77)
2025-01-24 08:56:36 +00:00
Nicki Křížek d79b113f93 [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!9989
2025-01-23 17:48:09 +00:00
Nicki Křížek a4f480ba04 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:29:31 +01:00
Matthijs Mekking fe95badcd0 [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!9986
2025-01-23 16:27:45 +00:00
Matthijs Mekking 049ac923b7 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-23 15:53:54 +00:00
Matthijs Mekking ddda6cb59e [9.20] fix: usr: Fix a bug in dnssec-signzone related to keys being offline
In the case when `dnssec-signzone` is called on an already signed zone, and the private key file is unavailable, a signature that needs to be refreshed may be dropped without being able to generate a replacement. This has been fixed.

Closes #5126

Backport of MR !9951

Merge branch 'backport-5126-dnssec-signzone-retain-rrsig-if-key-is-offline-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9982
2025-01-23 15:46:27 +00:00
Matthijs Mekking 9d6302b32c dnssec-signzone retain signature if key is offline
Track inside the dns_dnsseckey structure whether we have seen the
private key, or if this key only has a public key file.

If the key only has a public key file, or a DNSKEY reference in the
zone, mark the key 'pubkey'. In dnssec-signzone, if the key only
has a public key available, consider the key to be offline. Any
signatures that should be refreshed for which the key is not available,
retain the signature.

So in the code, 'expired' becomes 'refresh', and the new 'expired'
is only used to determine whether we need to keep the signature if
the corresponding key is not available (retaining the signature if
it is not expired).

In the 'keysthatsigned' function, we can remove:
  -	key->force_publish = false;
  -	key->force_sign = false;

because they are redundant ('dns_dnsseckey_create' already sets these
values to false).

(cherry picked from commit 5e3aef364f)
2025-01-23 14:04:03 +00:00
Matthijs Mekking cf73c9b1a9 Test dnssec-signzone with private key file missing
Add a test case for the scenario below.

There is a case when signing a zone with dnssec-signzone where the
private key file is moved outside the key directory (for offline
ksk purposes), and then the zone is resigned. The signature of the
DNSKEY needs refreshing, but is not expired.

Rather than removing the signature without having a valid replacement,
leave the signature in the zone (despite it needs to be refreshed).

(cherry picked from commit 0a91321d78)
2025-01-23 14:04:03 +00:00
Colin Vidal 4d945128dc [9.20] new: usr: Add support for multiple extended DNS errors
Extended DNS error mechanism (EDE) may have several errors raised during a DNS resolution. `named` is now able to add up to three EDE codes in a DNS response. In the case of duplicate error codes, only the first one will be part of the DNS response.

Closes #5085

Backport of MR !9952

Merge branch 'backport-5085-multiple-ede-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9978
2025-01-23 13:46:03 +00:00
Colin Vidal 01bbc357c7 add unit tests covering multiple EDE support
(cherry picked from commit 950a0cffb3)
2025-01-23 13:12:53 +00:00
Colin Vidal e685443c74 add support for multiple EDE
Extended DNS error mechanism (EDE) enables to have several EDE raised
during a DNS resolution (typically, a DNSSEC query will do multiple
fetches which each of them can have an error). Add support to up to 3
EDE errors in an DNS response. If duplicates occur (two EDEs with the
same code, the extra text is not compared), only the first one will be
part of the DNS answer.

Because the maximum number of EDE is statically fixed, `ns_client_t`
object own a static vector of `DNS_DE_MAX_ERRORS` (instead of a linked
list, for instance). The array can be fully filled (all slots point to
an allocated `dns_ednsopt_t` object) or partially filled (or
empty). In such case, the first NULL slot means there is no more EDE
objects.

(cherry picked from commit 4096f27130)
2025-01-23 13:12:53 +00:00
Matthijs Mekking 2bbb30156b [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!9983
2025-01-23 12:08:20 +00:00
Matthijs Mekking e36f4b66a3 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 12:08:11 +00:00
Matthijs Mekking 1333dac316 [9.20] fix: dev: Fix possible truncation in dns_keymgr_status()
If the generated status output exceeds 4096 it was silently truncated, now we output that the status was truncated.

Closes #4180

Backport of MR !9905

Merge branch 'backport-4180-possible-truncation-in-dns_keymgr_status-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9981
2025-01-23 11:28:07 +00:00
Matthijs Mekking 87518b618b Fix possible truncation in dns_keymgr_status()
If the generated status output exceeds 4096 it was silently truncated,
now we output that the status was truncated.

(cherry picked from commit 7ae7851173)
2025-01-23 09:40:39 +00:00
Mark Andrews 74640b3613 [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!9979
2025-01-23 00:34:59 +00:00
Mark Andrews 2225f96251 Check delv +yaml negative response output
(cherry picked from commit 9c04640def)
2025-01-22 23:58:49 +00:00
Mark Andrews 69a15deffa Terminate yaml string after negative comment
(cherry picked from commit 89afc11389)
2025-01-22 23:58:49 +00:00
Ondřej Surý 55b7cc9596 [9.20] chg: dev: Shutdown the fetch context after canceling the last fetch
Shutdown the fetch context immediately after the last fetch has been canceled from
that particular fetch context.

Backport of MR !9958

Merge branch 'backport-ondrej/shutdown-the-fetch-context-early-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9977
2025-01-22 14:05:12 +00:00
Ondřej Surý ea301cf062 Shutdown the fetch context after canceling the last fetch
Currently, the fetch context will continue running even when the last
fetch (response) has been removed from the context, so named can process
and cache the answer.  This can lead to a situation where the number of
outgoing recursing clients exceeds the the configured number for
recursive-clients.

Be more stringent about the recursive-clients limit and shutdown the
fetch context immediately after the last fetch has been canceled from
that particular fetch context.

(cherry picked from commit 9f945c8b67)
2025-01-22 15:02:38 +01:00
Ondřej Surý 0ab22458f5 [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!9975
2025-01-22 14:01:52 +00:00
Ondřej Surý 819e809be5 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:01:33 +01:00
Ondřej Surý 60b81239de [9.20] 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.20' into 'bind-9.20'

See merge request isc-projects/bind9!9964
2025-01-22 13:30:28 +00:00
JINMEI TatuyaandOndřej Surý da0453b1d5 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:29:30 +01:00
Colin Vidal ba48aee4c9 [9.20] new: nil: ignore TAGS files
Backport of MR !9956

Merge branch 'backport-colin/ignoreTAGS-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9973
2025-01-22 11:59:50 +00:00
Colin Vidal 6eed964dd9 ignore TAGS files
TAGS file are generated from `make tags` using etags. Other index tags
are already ignored (GTAGS, GPATH, etc.). Also ignoring `TAGS`.

(cherry picked from commit 2164ea8abd)
2025-01-22 11:23:28 +00:00
Andoni Duarte ac651c4250 chg: doc: Set up version for BIND 9.20.6
Merge branch 'andoni/set-up-version-for-bind-9.20.6' into 'bind-9.20'

See merge request isc-projects/bind9!9969
2025-01-22 08:40:51 +00:00
Andoni Duarte Pintado d343349b83 Update BIND version to 9.20.6-dev 2025-01-21 17:52:22 +01:00
Nicki Křížek 5464a5d46a Update BIND version for release 2025-01-20 14:15:57 +01:00
Nicki Křížek 34332de83f new: doc: Prepare documentation for BIND 9.20.5
Merge branch 'andoni/prepare-documentation-for-bind-9.20.5' into 'v9.20.5-release'

See merge request isc-private/bind9!773
2025-01-20 13:14:59 +00:00
Petr ŠpačekandNicki Křížek ae8518b2ae Reword release note for #5108 2025-01-20 14:07:34 +01:00
Michał Kępień b4f661e4c2 Add release note for GL #5099 2025-01-18 05:58:35 +01:00
Andoni Duarte PintadoandMichał Kępień 9144d0d198 Tweak and reword release notes 2025-01-18 05:58:35 +01:00
Andoni Duarte PintadoandMichał Kępień 38536ad107 Fix broken option reference in the ARM 2025-01-18 05:58:35 +01:00
Andoni Duarte PintadoandMichał Kępień e9ef3c3ce7 Prepare release notes for BIND 9.20.5 2025-01-18 05:58:35 +01:00
Andoni Duarte PintadoandMichał Kępień 0ce9b034f5 Generate changelog for BIND 9.20.5 2025-01-18 05:58:35 +01:00
Andoni Duarte 51900adf29 [9.20] [CVE-2024-12705] sec: usr: DNS-over-HTTP(s) flooding fixes
Fix DNS-over-HTTP(S) implementation issues that arise under heavy
query load. Optimize resource usage for :iscman:`named` instances
that accept queries over DNS-over-HTTP(S).

Previously, :iscman:`named` would process all incoming HTTP/2 data
at once, which could overwhelm the server, especially when dealing
with clients that send requests but don't wait for responses. That
has been fixed. Now, :iscman:`named` handles HTTP/2 data in smaller
chunks and throttles reading until the remote side reads the
response data. It also throttles clients that send too many requests
at once.

Additionally, :iscman:`named` now carefully processes data sent by
some clients, which can be considered "flooding." It logs these
clients and drops connections from them.
:gl:`#4795`

In some cases, :iscman:`named` could leave DNS-over-HTTP(S)
connections in the `CLOSE_WAIT` state indefinitely. That also has
been fixed. ISC would like to thank JF Billaud for thoroughly
investigating the issue and verifying the fix.
:gl:`#5083`

See https://gitlab.isc.org/isc-projects/bind9/-/issues/4795

Closes https://gitlab.isc.org/isc-projects/bind9/-/issues/5083

Backport of !732.

Merge branch 'artem-improve-doh-resource-usage-9.20' into 'v9.20.5-release'

See merge request isc-private/bind9!766
2025-01-15 15:40:42 +00:00
Artem BoldarievandAndoni Duarte Pintado 50a062e5ce DoH: reduce excessive bad request logging
We started using isc_nm_bad_request() more actively throughout
codebase. In the case of HTTP/2 it can lead to a large count of
useless "Bad Request" messages in the BIND log, as often we attempt to
send such request over effectively finished HTTP/2 sessions.

This commit fixes that.

(cherry picked from commit 937b5f8349)
2025-01-15 16:07:13 +01:00
Artem BoldarievandAndoni Duarte Pintado c53541bfc5 Do not stop timer in isc_nm_read_stop() in manual timer mode
A call to isc_nm_read_stop() would always stop reading timer even in
manual timer control mode which was added with StreamDNS in mind. That
looks like an omission that happened due to how timers are controlled
in StreamDNS where we always stop the timer before pausing reading
anyway (see streamdns_on_complete_dnsmessage()). That would not work
well for HTTP, though, where we might want pause reading without
stopping the timer in the case we want to split incoming data into
multiple chunks to be processed independently.

I suppose that it happened due to NM refactoring in the middle of
StreamDNS development (at the time isc_nm_cancelread() and
isc_nm_pauseread() were removed), as the StreamDNS code seems to be
written as if timers are not stoping during a call to
isc_nm_read_stop().

(cherry picked from commit 4ae4e255cf)
2025-01-15 16:05:56 +01:00
Artem BoldarievandAndoni Duarte Pintado 36e9720d24 DoH: introduce manual read timer control
This commit introduces manual read timer control as used by StreamDNS
and its underlying transports. Before that, DoH code would rely on the
timer control provided by TCP, which would reset the timer any time
some data arrived. Now, the timer is restarted only when a full DNS
message is processed in line with other DNS transports.

That change is required because we should not stop the timer when
reading from the network is paused due to throttling. We need a way to
drop timed-out clients, particularly those who refuse to read the data
we send.

(cherry picked from commit 609a41517b)
2025-01-15 16:05:47 +01:00
Artem BoldarievandAndoni Duarte Pintado 4907248d14 DoH: floodding clients detection
This commit adds logic to make code better protected against clients
that send valid HTTP/2 data that is useless from a DNS server
perspective.

Firstly, it adds logic that protects against clients who send too
little useful (=DNS) data. We achieve that by adding a check that
eventually detects such clients with a nonfavorable useful to
processed data ratio after the initial grace period. The grace period
is limited to processing 128 KiB of data, which should be enough for
sending the largest possible DNS message in a GET request and then
some. This is the main safety belt that would detect even flooding
clients that initially behave well in order to fool the checks server.

Secondly, in addition to the above, we introduce additional checks to
detect outright misbehaving clients earlier:

The code will treat clients that open too many streams (50) without
sending any data for processing as flooding ones; The clients that
managed to send 1.5 KiB of data without opening a single stream or
submitting at least some DNS data will be treated as flooding ones.
Of course, the behaviour described above is nothing else but
heuristical checks, so they can never be perfect. At the same time,
they should be reasonable enough not to drop any valid clients,
realatively easy to implement, and have negligible computational
overhead.

(cherry picked from commit 3425e4b1d0)
2025-01-15 16:05:33 +01:00
Artem BoldarievandAndoni Duarte Pintado 5eec1f5368 DoH: process data chunk by chunk instead of all at once
Initially, our DNS-over-HTTP(S) implementation would try to process as
much incoming data from the network as possible. However, that might
be undesirable as we might create too many streams (each effectively
backed by a ns_client_t object). That is too forgiving as it might
overwhelm the server and trash its memory allocator, causing high CPU
and memory usage.

Instead of doing that, we resort to processing incoming data using a
chunk-by-chunk processing strategy. That is, we split data into small
chunks (currently 256 bytes) and process each of them
asynchronously. However, we can process more than one chunk at
once (up to 4 currently), given that the number of HTTP/2 streams has
not increased while processing a chunk.

That alone is not enough, though. In addition to the above, we should
limit the number of active streams: these streams for which we have
received a request and started processing it (the ones for which a
read callback was called), as it is perfectly fine to have more opened
streams than active ones. In the case we have reached or surpassed the
limit of active streams, we stop reading AND processing the data from
the remote peer. The number of active streams is effectively decreased
only when responses associated with the active streams are sent to the
remote peer.

Overall, this strategy is very similar to the one used for other
stream-based DNS transports like TCP and TLS.

(cherry picked from commit 9846f395ad)
2025-01-15 16:05:13 +01:00
Andoni Duarte 4d3d17c344 [9.20] [CVE-2024-11187] sec: usr: Limit the additional processing for large RDATA sets
When answering queries, don't add data to the additional section if the answer has more than 13 names in the RDATA. This limits the number of lookups into the database(s) during a single client query, reducing query processing load.

Backport of MR !750

See isc-projects/bind9#5034

Merge branch '5034-security-limit-additional-9.20' into 'v9.20.5-release'

See merge request isc-private/bind9!758
2025-01-15 13:08:50 +00:00
Ondřej SurýandAndoni Duarte Pintado 1b531c17a5 Limit the additional processing for large RDATA sets
When answering queries, don't add data to the additional section if
the answer has more than 13 names in the RDATA.  This limits the
number of lookups into the database(s) during a single client query,
reducing query processing load.

Also, don't append any additional data to type=ANY queries. The
answer to ANY is already big enough.

(cherry picked from commit a1982cf1bb)
2025-01-15 13:57:27 +01:00
Ondřej SurýandAndoni Duarte Pintado e7d4e27337 Isolate using the -T noaa flag only for part of the resolver test
Instead of running the whole resolver/ns4 server with -T noaa flag,
use it only for the part where it is actually needed.  The -T noaa
could interfere with other parts of the test because the answers don't
have the authoritative-answer bit set, and we could have false
positives (or false negatives) in the test because the authoritative
server doesn't follow the DNS protocol for all the tests in the resolver
system test.

(cherry picked from commit e51d4d3b88)
2025-01-15 13:57:16 +01:00
Nicki Křížek 993cb76148 chg: usr: Revert "Fix NSEC3 closest encloser lookup for names with empty non-terminals"
Revert the fix for #4950 for 9.20.

This reverts MR !9438.

History: A performance improvement for NSEC3 closest encloser lookups (#4460) was introduced (in MR !9436) and backported to 9.20 (MR !9438) and to 9.18 in (MR !9439). It was released in 9.18.30 (and 9.20.2 and 9.21.1).

There was a bug in the code (#4950), so we reverted the change in !9611, !9613 and !9614 (not released).

Then a new attempt was merged in main (MR !9610) and backported to 9.20 (MR !9631) and 9.18 (MR !9632). The latter should not have been backported and was reverted in !9689. 

We now also revert the fix for 9.20

Related #5108

Merge branch 'revert-4950-bind-logs-expected-covering-nsec3-got-an-exact-match-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9947
2025-01-14 08:35:53 +00:00
Matthijs Mekking 8c9d31edaf Revert "Test that the correct NSEC3 closest encloser is returned"
This reverts commit fd2f1bdf02.
2025-01-13 11:42:26 +01:00
Matthijs Mekking 5798ed1fa6 Revert "Use a binary search to find the NSEC3 closest encloser"
This reverts commit 14bb1f8aa0.
2025-01-13 11:40:19 +01:00
Michał Kępień 698f1091bf [9.20] fix: nil: Fix default IANA root zone mirror configuration
Closes #5115

Backport of MR !9934

Merge branch 'backport-5115-fix-default-iana-root-zone-mirror-configuration-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9944
2025-01-09 12:00:26 +00:00
Michał Kępień 1e9eab2b5d Fix default IANA root zone mirror configuration
Commit 4555a31934 renamed the top-level
"primaries" block in bin/named/config.c to "remote-servers".  This
configuration block lists the primary servers used for an IANA root zone
mirror when no primary servers are explicitly specified for it in the
configuration.  However, the relevant part of the named_zone_configure()
function only looks for a top-level "primaries" block and not for any of
its synonyms.  As a result, configuring an IANA root zone mirror with
just:

    zone "." {
        type mirror;
    };

now results in a cryptic fatal error on startup:

    loading configuration: not found
    exiting (due to fatal error)

Fix by using the correct top-level block name in named_zone_configure().

(cherry picked from commit 010d2eb436)
2025-01-09 12:25:33 +01:00
Arаm Sаrgsyаn cc0cbbe697 [9.20] fix: usr: Fix response policy zones and catalog zones with an $INCLUDE statement defined
Response policy zones (RPZ) and catalog zones were not working correctly if they had an $INCLUDE statement defined. This has been fixed.

Closes #5111

Backport of MR !9930

Merge branch 'backport-5111-includes-disable-rpz-and-catz-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9941
2025-01-08 15:21:52 +00:00
Aram Sargsyan c9ecf79e89 Fix a typo in dns/master.h
The ISC_R_SEENINCLUDE definition does not exist, the correct one
is DNS_R_SEENINCLUDE.

(cherry picked from commit d75bdabe51)
2025-01-08 15:21:28 +00:00
Aram Sargsyan 1c6a97055d Don't disable RPZ and CATZ for zones with an $INCLUDE statement
The code in zone_startload() disables RPZ and CATZ for a zone if
dns_master_loadfile() returns anything other than ISC_R_SUCCESS,
which makes sense, but it's an error because zone_startload() can
also return DNS_R_SEENINCLUDE upon success when the zone had an
$INCLUDE statement.

(cherry picked from commit 3d7a9fba3b)
2025-01-08 15:21:28 +00:00
Nicki Křížek 2d89dae589 [9.20] new: ci: Add shotgun perf test of DoH GET to CI
Add performance tests of DoH using the GET protocol to nightly pipelines.

Backport of MR !9926

Merge branch 'backport-nicki/ci-shotgun-doh-get-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9939
2025-01-08 14:12:54 +00:00
Nicki Křížek ee76d3f2c2 Add shotgun perf test of DoH GET to CI
(cherry picked from commit 32c5f24713)
2025-01-08 13:46:49 +00:00
Ondřej Surý fa7443d3fd [9.20] fix: dev: Use CMM_{STORE,LOAD}_SHARED to store/load glue in gluelist
ThreadSanitizer has trouble understanding that gluelist->glue is
constant after it is assigned to the slabheader with cmpxchg.  Help
ThreadSanitizer to understand the code by using CMM_STORE_SHARED and
CMM_LOAD_SHARED on gluelist->glue.

Backport of MR !9929

Merge branch 'backport-ondrej/hint-tsan-in-addglue-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9936
2025-01-06 19:13:37 +00:00
Ondřej Surý 9fbfc8a8b5 Use CMM_{STORE,LOAD}_SHARED to store/load glue in gluelist
ThreadSanitizer has trouble understanding that gluelist->glue is
constant after it is assigned to the slabheader with cmpxchg.  Help
ThreadSanitizer to understand the code by using CMM_STORE_SHARED and
CMM_LOAD_SHARED on gluelist->glue.

The ThreadSanitizer report:

    WARNING: ThreadSanitizer: data race
      Read of size 8 at 0x000000000001 by thread T0001:
	#0 addglue lib/dns/qpzone.c:5304 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#1 dns_db_addglue lib/dns/db.c:1119 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#2 query_additional lib/ns/query.c:2230 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#3 query_addrrset lib/ns/query.c:2324
	#4 query_prepare_delegation_response lib/ns/query.c:8595 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#5 query_delegation lib/ns/query.c:8780 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#6 query_notfound lib/ns/query.c:8552 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#7 query_gotanswer lib/ns/query.c:7553 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#8 query_lookup lib/ns/query.c:6020 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#9 ns__query_start lib/ns/query.c:5690 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#10 query_setup lib/ns/query.c:5239 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#11 ns_query_start lib/ns/query.c:11979 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#12 ns_client_request_continue lib/ns/client.c:2466 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#13 ns_client_request lib/ns/client.c:2142 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#14 isc___nm_readcb netmgr/netmgr.c:1859 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#15 isc__nm_readcb netmgr/netmgr.c:1874
	#16 isc__nm_udp_read_cb netmgr/udp.c:589 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#17 uv__udp_recvmmsg src/unix/udp.c:202 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#18 uv__udp_recvmsg src/unix/udp.c:245 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#19 uv__udp_io src/unix/udp.c:142
	#20 uv__io_poll src/unix/linux.c:1564 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#21 uv_run src/unix/core.c:458 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#22 loop_thread lib/isc/loop.c:328 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#23 thread_body lib/isc/thread.c:85 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#24 thread_run lib/isc/thread.c:100

      Previous write of size 8 at 0x000000000001 by thread T0002:
	#0 create_gluelist lib/dns/qpzone.c:5253 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#1 addglue lib/dns/qpzone.c:5281
	#2 dns_db_addglue lib/dns/db.c:1119 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#3 query_additional lib/ns/query.c:2230 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#4 query_addrrset lib/ns/query.c:2324
	#5 query_prepare_delegation_response lib/ns/query.c:8595 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#6 query_delegation lib/ns/query.c:8780 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#7 query_notfound lib/ns/query.c:8552 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#8 query_gotanswer lib/ns/query.c:7553 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#9 query_lookup lib/ns/query.c:6020 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#10 ns__query_start lib/ns/query.c:5690 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#11 query_setup lib/ns/query.c:5239 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#12 ns_query_start lib/ns/query.c:11979 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#13 ns_client_request_continue lib/ns/client.c:2466 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#14 ns_client_request lib/ns/client.c:2142 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#15 isc___nm_readcb netmgr/netmgr.c:1859 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#16 isc__nm_readcb netmgr/netmgr.c:1874
	#17 isc__nm_udp_read_cb netmgr/udp.c:589 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#18 uv__udp_recvmmsg src/unix/udp.c:202 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#19 uv__udp_recvmsg src/unix/udp.c:245 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#20 uv__udp_io src/unix/udp.c:142
	#21 uv__io_poll src/unix/linux.c:1564 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#22 uv_run src/unix/core.c:458 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#23 loop_thread lib/isc/loop.c:328 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#24 thread_body lib/isc/thread.c:85 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#25 thread_run lib/isc/thread.c:100

      Location is heap block of size 88 at 0x000000000024 allocated by thread T0002:
	#0 malloc <null> (BuildId: c08afb1c60772d9b4e4d4be38d0c0434c5b41990)
	#1 mallocx lib/isc/jemalloc_shim.h:41 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#2 mem_get lib/isc/mem.c:303
	#3 isc__mem_get lib/isc/mem.c:654
	#4 new_gluelist lib/dns/qpzone.c:5012 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#5 create_gluelist lib/dns/qpzone.c:5241
	#6 addglue lib/dns/qpzone.c:5281
	#7 dns_db_addglue lib/dns/db.c:1119 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#8 query_additional lib/ns/query.c:2230 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#9 query_addrrset lib/ns/query.c:2324
	#10 query_prepare_delegation_response lib/ns/query.c:8595 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#11 query_delegation lib/ns/query.c:8780 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#12 query_notfound lib/ns/query.c:8552 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#13 query_gotanswer lib/ns/query.c:7553 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#14 query_lookup lib/ns/query.c:6020 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#15 ns__query_start lib/ns/query.c:5690 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#16 query_setup lib/ns/query.c:5239 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#17 ns_query_start lib/ns/query.c:11979 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#18 ns_client_request_continue lib/ns/client.c:2466 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#19 ns_client_request lib/ns/client.c:2142 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#20 isc___nm_readcb netmgr/netmgr.c:1859 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#21 isc__nm_readcb netmgr/netmgr.c:1874
	#22 isc__nm_udp_read_cb netmgr/udp.c:589 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#23 uv__udp_recvmmsg src/unix/udp.c:202 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#24 uv__udp_recvmsg src/unix/udp.c:245 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#25 uv__udp_io src/unix/udp.c:142
	#26 uv__io_poll src/unix/linux.c:1564 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#27 uv_run src/unix/core.c:458 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#28 loop_thread lib/isc/loop.c:328 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#29 thread_body lib/isc/thread.c:85 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#30 thread_run lib/isc/thread.c:100

      Thread T0001 'isc-loop-0002' (running) created by main thread at:
	#0 pthread_create <null> (BuildId: c08afb1c60772d9b4e4d4be38d0c0434c5b41990)
	#1 isc_thread_create lib/isc/thread.c:139 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#2 isc_loopmgr_run lib/isc/loop.c:508 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#3 main bin/named/main.c:1532 (BuildId: d03d7837520674921fd1fe7c353cb790cab69b3b)

      Thread T0002 'isc-loop-0003' (running) created by main thread at:
	#0 pthread_create <null> (BuildId: c08afb1c60772d9b4e4d4be38d0c0434c5b41990)
	#1 isc_thread_create lib/isc/thread.c:139 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#2 isc_loopmgr_run lib/isc/loop.c:508 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#3 main bin/named/main.c:1532 (BuildId: d03d7837520674921fd1fe7c353cb790cab69b3b)

    SUMMARY: ThreadSanitizer: data race lib/dns/qpzone.c:5304 in addglue

(cherry picked from commit f7316b44b9)
2025-01-06 19:13:29 +00:00
Ondřej Surý eb3c66304f [9.20] fix: usr: Resolve the spurious drops in performance due GLUE cache
For performance reasons, the returned GLUE records are cached on the first use.  The current implementation could randomly cause a performance drop and increased memory use.  This has been fixed.

Closes #5064

Backport of MR !9831

Merge branch 'backport-5064-rewrite-glue-cache-in-qpzone-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9918
2025-01-06 19:13:04 +00:00
Ondřej Surý 547f376f21 Rewrite the GLUE cache in QP zone database
This is a second attempt to rewrite the GLUE cache to not use per
database version hash table.  Instead of keeping a hash table indexed by
the node, use a directly linked list of GLUE records for each
slabheader.  This was attempted before, but there was a data race caused
by the fact that the thread cleaning the GLUE records could be slower
than accessing the slab headers again and reinitializing the wait-free
stack.

The improved design builds on the previous design, but adds a new
dns_gluelist structure that has a pointer to the database version.

If a dns_gluelist belonging to a different (old) version is detected, it
is just detached from the slabheader and left for the closeversion() to
clean it up later.

(cherry picked from commit 29bde687b5)
2025-01-06 14:00:47 +01:00
Ondřej Surý ad952ffee6 Revert "Fix the glue table in the QP and RBT zone databases"
This reverts commit 46cfebac58.

(cherry picked from commit 759d59801b)
2025-01-06 14:00:43 +01:00
Michal Nowak f85a7f9be9 [9.20] fix: test: Fix "checking startup notify rate limit" fails on OL 8 FIPS
Adjust number of zones down to 23 to match those present when testing in FIPS mode.

Closes #5097

Backport of MR !9919

Merge branch 'backport-5097-checking-startup-notify-rate-limit-fails-on-ol-8-fips-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9935
2025-01-02 16:08:36 +00:00
Mark AndrewsandMichal Nowak 40af61428e Adjust number of zones to those in FIPS mode
(cherry picked from commit 17804f5154)
2025-01-02 15:35:39 +00:00
Artem Boldariev b14148ac89 [9.20] chg: dev: Add TLS SNI extension to all outgoing TLS connections
Backport of !9923.

Merge branch 'artem-outgoing-tls-sni-support-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9933
2024-12-26 17:13:03 +00:00
Artem Boldariev 50876e52f1 BIND - enable TLS SNI support for outgoing TLS connections
This commit ensures that BIND enables TLS SNI support for outgoing DoT
connections (when possible) in order to improve compatibility with
other DNS server software.

(cherry picked from commit 740292d3ec)
2024-12-26 18:31:31 +02:00
Artem Boldariev 01076f9396 Dig - enable TLS SNI support
This commit ensures that dig enables TLS SNI support for outgoing
connections in order to improve compatibility with other DNS server
software.

(cherry picked from commit e04fb30ee6)
2024-12-26 18:31:20 +02:00
Artem Boldariev 4f8ade0e1e TLS SNI - add low level support for SNI to the networking code
This commit adds support for setting SNI hostnames in outgoing
connections over TLS.

Most of the changes are related to either adapting the code to accept
and extra argument in *connect() functions and a couple of changes to
the TLS Stream to actually make use of the new SNI hostname
information.

(cherry picked from commit 6691a1530d)
2024-12-26 18:31:03 +02:00
Michal Nowak 703ff7aef3 [9.20] fix: test: Various coccinelle fixes
Backport of MR !9836

Merge branch 'backport-mnowak/cocci-more-set-if-not-null-changes-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9916
2024-12-13 14:25:04 +00:00
Michal Nowak 75931127ac Drop superfluous isc_mem_get() NULL check
coccinelle v1.1 trips over a superfluous isc_mem_get() NULL check in
tests/libtest/ns.c and reports the following failure in CI:

    EXN: Failure("rule starting on line 26: already tagged token:\nC code context\nFile \"./tests/libtest/ns.c\", line 350, column 1, charpos = 7939\n  around = 'if',\n  whole content = \tif (qctx != NULL) {") in ./tests/libtest/ns.c

(cherry picked from commit cf76851c75)
2024-12-13 13:50:06 +00:00
Michal Nowak 7324e1f70b Move coccinelle job to "sid" image
The "sid" image has newer coccinelle 1.2 that identifies more issues.

(cherry picked from commit 7f55041426)
2024-12-13 13:50:06 +00:00
Michal Nowak 885b095a15 Disable unsigned-int spatch in models.c and sdlz.c
coccinelle v1.1 reports the following failure:

    EXN: Failure("./lib/dns/sdlz.c: 172: try to delete an expanded token: unsigned") in ./lib/dns/sdlz.c

coccinelle v1.2 reports the following failure:

    EXN: Failure("./util/models.c: 21: try to delete an expanded token: unsigned") in ./util/models.c

(cherry picked from commit 7fb6be62e0)
2024-12-13 13:50:06 +00:00
Michal Nowak c6c4f8ac92 Apply more SET_IF_NOT_NULL() changes
coccinelle v1.2 found more cases where the SET_IF_NOT_NULL macro
applies.

(cherry picked from commit 57b64dc397)
2024-12-13 13:50:05 +00:00
Matthijs Mekking b483cd4638 [9.20] chg: usr: The configuration clauses parental-agents and primaries are renamed to remote-servers
The top blocks 'primaries' and 'parental-agents' are no longer preferred and should be renamed to 'remote-servers'. The zone statements 'parental-agents' and 'primaries' are still used, and may refer to any 'remote-servers' top block.

Closes #4544

Backport of MR !9822

Merge branch 'backport-4544-primaries-block-documentation-issues-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9911
2024-12-13 11:06:04 +00:00
Matthijs Mekking 13fdd987df Rename remote-servers standard term to server-list
The 'remote-servers' named.conf reference conflicts with the standard
term from the glossary. Rename the standard term to server-list to
make the docs build.

(cherry picked from commit 726c9cd73b)
2024-12-13 11:23:03 +01:00
Matthijs Mekking aa744b5dd9 Add primaries, parental-agents as synonyms
Add back the top blocks 'parental-agents', 'primaries', and 'masters'
to the configuration. Do not document them as so many names for the
same clause is confusing.

This has a slight negative side effect that a top block 'primaries'
can be referred to with a zone statement 'parental-agents' for example,
but that shouldn't be a big issue.

(cherry picked from commit 1b2eadb197)
2024-12-13 11:23:03 +01:00
Matthijs Mekking 4555a31934 Unify parental-agents, primaries to remote-servers
Having zone statements that are also top blocks is confusing, and if
we want to add more in the future (which I suspect will be for
generalized notifications, multi-signer), we need to duplicate a lot
of code.

Remove top blocks 'parental-agents' and 'primaries' and just have one
top block 'remote-servers' that you can refer to with zone statements.

(cherry picked from commit b121f02eac)
2024-12-13 10:39:25 +01:00
Andoni Duarte Pintado 2ece365da5 Merge tag 'v9.20.4' into bind-9.20 2024-12-13 10:35:31 +01:00
Mark Andrews 8b19673d0d [9.20] fix: test: Fix "checking startup notify rate limit" failure
Fix the loop terminating condition to get consistent sample sizes and increase the minimum number of samples from 20 to 40.

Closes #5091

Backport of MR !9894

Merge branch 'backport-5091-investigate-checking-startup-notify-rate-limit-failure-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9909
2024-12-13 00:45:05 +00:00
Mark Andrews e8ef8eddb8 Fix startup notify rate test
The terminating conditions for the startup notify test would
occasionally get ~20 records or get +10 seconds of records due to
a bad terminating condition.  Additionally 20 samples lead to test
failures.  Fix the terminating condition to use the correct conditional
(-eq -> -ge) and increase the minimum number of log entries to
average over to 40.

(cherry picked from commit 46388d07a2)
2024-12-13 00:07:52 +00:00
Mark Andrews c8f7fba7bf [9.20] fix: test: tests/irs/resconf_test.c is missing check callbacks
Closes #5088

Backport of MR !9884

Merge branch 'backport-5088-tests-irs-resconf_test-c-is-missing-check-callbacks-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9907
2024-12-12 23:38:44 +00:00
Mark Andrews d6026a7255 Move resconf_test.c to tests/dns and cleanup
(cherry picked from commit b711b5b10d)
2024-12-12 22:50:22 +00:00
Mark Andrews 3b13f75629 Check that nameservers are parsed correctly
Add checks that the expected nameservers where actuall addes when
parsing resolv.conf.

(cherry picked from commit c38eb87158)
2024-12-12 22:50:22 +00:00
Michal Nowak e7387f7c85 [9.20] fix: ci: Disable tracing otherwise gcovr fails
Backport of MR !9809

Merge branch 'backport-mnowak/gcovr-disable-tracing-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9906
2024-12-12 15:29:41 +00:00
Michal Nowak 646ab10d6d Disable tracing for gcovr-enabled builds
gcovr has issues with processing files produced as part of a BIND 9
build with tracing support enabled (--enable-tracing).  Depending on the
gcovr version used, these issues may result in either warnings or
failures being reported by that tool.  Disable tracing support for
gcovr-enabled builds to work around these issues.

(cherry picked from commit 7048b3ab0d)
2024-12-12 15:29:26 +00:00
Nicki Křížek c1af853c46 [9.20] chg: doc: Update CONTRIBUTING.md and developer docs
Include the recent changes such as:
- changes to running system tests
- gitlab development workflow
- changelog and release note process

Closes #5045

Backport of MR !9784

Merge branch 'backport-5045-update-contributing-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9902
2024-12-12 15:18:59 +00:00
Nicki Křížek f20c302363 Update CONTRIBUTING.md and developer doc
Include the recent changes such as:
- changes to running system tests
- gitlab development workflow
- changelog and release note process

(cherry picked from commit 39485c1f70)
2024-12-12 15:18:50 +00:00
Michal Nowak 504c92bee7 [9.20] fix: test: Wait for "all zones loaded" after rndc reload in "database" test
After the rndc reload command finished, we might have queried the
database zone sooner than it was reloaded because rndc reloads zones
asynchronously if no specific zone was provided. We should wait for "all
zones loaded" in the ns1 log to be sure.

Closes #5075

Backport of MR !9829

Merge branch 'backport-5075-database-rndc-reload-ensure-all-zones-loaded-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9900
2024-12-12 12:50:19 +00:00
Michal Nowak 1bff2cd49c Wait for "all zones loaded" after rndc reload in "database" test
After the rndc reload command finished, we might have queried the
database zone sooner than it was reloaded because rndc reloads zones
asynchronously if no specific zone was provided. We should wait for "all
zones loaded" in the ns1 log to be sure.

(cherry picked from commit 0bdd03db66)
2024-12-12 12:09:30 +00:00
Evan Hunt f4cc6a5464 [9.20] fix: nil: update style guideline to reflect current practice
The style guide now mentions clang-format, doesn't parenthesize return values, and no longer calls for backward compatibility in public function names.

Backport of MR !9892

Merge branch 'backport-each-style-update-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9896
2024-12-11 15:52:55 +00:00
Evan Hunt a778691701 update style guideline to reflect current practice
It now mentions clang-format, doesn't parenthesize return values,
and no longer calls for backward compatibility in public function names.

(cherry picked from commit 9f7314eaa4)
2024-12-11 03:39:57 +00:00
Mark Andrews 1ea20c9847 [9.20] fix: test: Add rr-related common test artifacts
Backport of MR !9830

Merge branch 'backport-mnowak/add-rr-related-common-artifacts-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9889
2024-12-11 01:28:45 +00:00
Michal NowakandMark Andrews 945dbad5ed Add rr-related common test artifacts
(cherry picked from commit c607237b77)
2024-12-11 00:38:56 +00:00
Mark Andrews 08aefa5a6b [9.20] chg: test: Use a different burst name to identify test queries
This allows easier identification of which burst is which in
named.run.

Backport of MR !9881

Merge branch 'backport-marka-use-different-burst-name-for-forensics-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9882
2024-12-10 23:51:43 +00:00
Mark Andrews 4bc7d505e8 Use a different burst name to identify test queries
This allows easier identification of which burst is which in
named.run.

(cherry picked from commit e02d66b279)
2024-12-10 21:55:31 +00:00
Ondřej Surý fed5e55e33 [9.20] fix: dev: mark loop as shuttingdown earlier in shutdown_cb
Backport of MR !9827

Merge branch 'backport-loop-shuttingdown-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9891
2024-12-10 20:27:40 +00:00
Pavel BřezinaandOndřej Surý 93bef0ea28 mark loop as shuttingdown earlier in shutdown_cb
`shutdown_trigger_close_cb` is not called in the main loop since
queued events in the `loop->async_trigger`, including loop teardown
(shutdown_server) are processed first, before the `uv_close` callback
is executed..

In order to pass the information to the queued events, it is necessary
to set the flag earlier in the process and not wait for the `uv_close`
callback to trigger.

(cherry picked from commit 67e21d94d4)
2024-12-10 19:52:13 +00:00
Colin Vidal e260eb39c5 [9.20] chg: usr: Add none parameter to query-source and query-source-v6 to disable IPv4 or IPv6 upstream queries
Add a none parameter to named configuration option `query-source`
(respectively `query-source-v6`) which forbid usage of IPv4
(respectively IPv6) addresses when named is doing an upstream query.

Closes #4981 Turning-off upstream IPv6 queries while still listening
to downstream queries on IPv6.

Merge branch 'colin/querysource-none' into 'main'

See merge request isc-projects/bind9!9727

Backport of MR: !9727

Merge branch 'backport-querysource-none-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9775
2024-12-10 11:34:17 +00:00
Colin Vidal 32f5b69703 Add none parameter to query-source and query-source-v6 to disable IPv4 or IPv6 upstream queries
Add a none parameter to named configuration option `query-source` (respectively `query-source-v6`) which forbid usage of IPv4 (respectively IPv6) addresses when named is doing an upstream query.

Closes #4981 Turning-off upstream IPv6 queries while still listening to downstream queries on IPv6.

Merge branch 'colin/querysource-none' into 'main'

See merge request isc-projects/bind9!9727

Backport of MR !9727

Some changes had to be done to the existing 9.20.x code in order to
make this backport compatible:

- first, the 9.20.x branches support the `port` parameter in
  query-source[-v6], where 9.21.x does not. The original changes
  depend on things that can't be backported because that would break
  `port` support.

- second, the changes remove the optional `address` parameter from the
  canonical form. So `query-source address <ip>` is now printed as
  `query-source <ip>`. This means that `named-checkconf -p` will now
  generate different output if users have `query-source address <ip>` or
  `query-source address <ip> port <port>`; it will now generate
  `query-source <ip>` or `query-source <ip> port <port>`. This is a
  non-breaking change, because the parser has been updated to support
  this form as well.
2024-12-10 11:58:20 +01:00
Michal Nowak efbfa541b5 [9.20] fix: ci: Set cross-version-config-tests to allow_failure in CI
Address failing cross-version-config-tests job.

Closes #5087

Backport of MR !9833

Merge branch 'backport-mnowak/cross-version-config-tests-allow-fail-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9886
2024-12-10 10:21:38 +00:00
Michal Nowak 1766e4df20 Set cross-version-config-tests to allow_failure in CI
The December releases suffer from the ns2/managed1.conf file not being
in the mkeys extra_artifacts. This manifests only when pytest is run
with the --setup-only option, which is the case in the
cross-version-config-tests CI job. The original issue is fixed in !9815,
but the fix will be effective only when subsequent releases are out.

(cherry picked from commit 97a9d7287c)
2024-12-10 11:08:57 +01:00
Matthijs Mekking 87f70696c8 [9.20] rem: dev: Drop single-use RETERR macro
If the RETERR define is only used once in a file, just drop the macro.

Backport of MR !9871

Merge branch 'backport-matthijs-remove-single-use-define-reterr-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9885
2024-12-10 09:22:53 +00:00
Matthijs Mekking 551d1dd67d Drop single-use RETERR macro
If the RETERR define is only used once in a file, just drop the macro.

(cherry picked from commit b6d031462f)
2024-12-10 08:47:25 +00:00
Mark Andrews f15a35bfdd [9.20] fix: test: Fix static stub subtest description
This subtest exercises static stub behaviour when server-addresses has an address.  This was misidentified in the description.

Closes !9799

Backport of MR !9799

Merge branch 'backport-marka-fix-stub-subtest-description-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9879
2024-12-10 03:53:00 +00:00
Mark Andrews 6177eb8c5b Fix static stub subtest description
(cherry picked from commit f173a01454)
2024-12-10 03:16:33 +00:00
Mark Andrews 7738fd28c9 [9.20] fix: usr: Unknown directive in resolv.conf not handled properly
The line after an unknown directive in resolv.conf could accidentally be skipped, potentially affecting dig, host, nslookup, nsupdate, or delv. This has been fixed.

Closes #5084

Backport of MR !9865

Merge branch 'backport-5084-plain-unknown-keyword-in-resolv-conf-not-handled-propely-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9877
2024-12-10 01:24:51 +00:00
Mark Andrews ff6db0bea4 Extend resconf_test
Update to the new unit test framework.

Add a test for an unknown directive without any arguments.

Add test for an unknown directive without arguments, followed
by a search directive.

(cherry picked from commit c44c4fcbfb)
2024-12-10 00:49:07 +00:00
Mark Andrews 722e6689f5 Fix parsing of unknown directives in resolv.conf
Only call eatline() to skip to the next line if we're not
already at the end of a line when parsing an unknown directive.
We were accidentally skipping the next line when there was only
a single unknown directive on the current line.

(cherry picked from commit eb78ad2080)
2024-12-10 00:49:06 +00:00
Michal Nowak e6f773c84f [9.20] new: test: Add Fedora 41
Prereq: isc-projects/images!345

Backport of MR !9612

Merge branch 'backport-mnowak/fedora-41-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9875
2024-12-09 17:59:45 +00:00
Michal Nowak f360aa82f0 Add Fedora 41
(cherry picked from commit 66fddf812f)
2024-12-09 17:20:32 +00:00
Michal Nowak 0b1e257bb6 [9.20] new: test: Add Alpine Linux 3.21
Prereq: isc-projects/images!359

Backport of MR !9872

Merge branch 'backport-mnowak/alpine-3.21-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9873
2024-12-09 17:18:43 +00:00
Michal Nowak a04e97fb7c Add Alpine Linux 3.21
(cherry picked from commit 6340454ea7)
2024-12-09 16:26:30 +00:00
Michal Nowak db17c54e54 [9.20] new: ci: Add FreeBSD 14.2
Backport of MR !9838

Merge branch 'backport-mnowak/freebsd-14.2-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9869
2024-12-09 13:42:00 +00:00
Michal Nowak d57c5f5312 Add FreeBSD 14.2
(cherry picked from commit a5628101ee)
2024-12-09 13:37:56 +00:00
Michal Nowak 227b829efe [9.20] fix: ci: tests: Use FIPS compatible DH-param files
When the tests were added, the files were generated without FIPS
compatibility in mind. That made the tests fail on recent OpenSSL
versions in FIPS mode.

So, the files were regenerated on a FIPS compliant system using the
following stanza:

```
$ openssl dhparam -out <file> 3072
```

Apparently, the old files are not valid for FIPS starting with OpneSSL
3.1.X release series as "FIPS 140-3 compliance changes" are mentioned
in the [changelog](https://openssl-library.org/news/openssl-3.1-notes/).

Closes #5074.

Backport of MR !9807

Merge branch 'backport-5074-fips-compatible-dhparams-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9868
2024-12-09 12:53:19 +00:00
Artem BoldarievandMichal Nowak 17dd30ec52 Use FIPS compatible DH-param files
When the tests were added, the files were generated without FIPS
compatibility in mind. That made the tests fail on recent OpenSSL
versions in FIPS mode.

So, the files were regenerated on a FIPS compliant system using the
following stanza:

$ openssl dhparam -out <file> 3072

Apparently, the old files are not valid for FIPS starting with OpneSSL
3.1.X release series as "FIPS 140-3 compliance changes" are mentioned
in the changelog:

https://openssl-library.org/news/openssl-3.1-notes/
(cherry picked from commit 384c92880e)
2024-12-09 12:00:49 +00:00
Matthijs Mekking d91835160a [9.20] chg: dev: Use query counters in validator code
Commit af7db89513 as part of #4141 was supposed to apply the 'max-recursion-queries' quota to validator queries, but the counter was never actually passed on to 'dns_resolver_createfetch()'. This has been fixed, and the global query counter ('max-query-count', per client request) is now also added.

Related to #4980

Backport of MR !9856

Merge branch 'backport-4980-pass-counters-in-validator-createfetch-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9866
2024-12-09 11:41:29 +00:00
Matthijs Mekking e96d6ee85f Use query counters in validator code
Commit af7db89513 as part of #4141 was
supposed to apply the 'max-recursion-queries' quota to validator
queries, but the counter was never actually passed on to
dns_resolver_createfetch(). This has been fixed, and the global query
counter ('max-query-count', per client request) is now also added.

(cherry picked from commit 5b1ae4a948)
2024-12-09 11:41:19 +00:00
Alessio Podda 67fa22a774 [9.20] chg: dev: Optimize memory layout of core structs
Reduce memory footprint by:
- Reordering struct fields to minimize padding.
- Using exact-sized atomic types instead of `*_least`/`*_fast` variants
- Downsizing integer fields where possible

Affected structs:
- dns_name_t
- dns_slabheader_t 
- dns_rdata_t
- qpcnode_t
- qpznode_t

Closes #5022

Backport of MR !9721

Merge branch 'backport-5022-reduce-metadata-overhead-by-struct-packing-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9793
2024-12-09 10:44:42 +00:00
Alessio Podda 1edf405add Optimize memory layout of core structs
Reduce memory footprint by:

 - Reordering struct fields to minimize padding.
 - Using exact-sized atomic types instead of *_least/*_fast variants
 - Downsizing integer fields where possible

Affected structs:

 - dns_name_t
 - dns_slabheader_t
 - dns_rdata_t
 - qpcnode_t
 - qpznode_t

(cherry picked from commit 32c7060bd2)
2024-12-09 09:04:28 +01:00
Ondřej Surý 3c9657a3f4 [9.20] chg: dev: Update picohttpparser.{c,h} with upstream repository
Closes #4485

Backport of MR !9857

Merge branch 'backport-4485-update-httppicoparser-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9863
2024-12-08 13:15:51 +00:00
Ondřej Surý 476757770b Update picohttpparser.{c,h} with upstream repository
Upstream code doesn't do regular releases, so we need to regularly
sync the code from the upstream repository.  This is synchronization up
to the commit f8d0513 from Jan 29, 2024.

(cherry picked from commit d14a76e115)
2024-12-08 12:30:07 +00:00
Ondřej Surý d954d9c20b [9.20] fix: dev: Revert "Lock and attach when returning zone stats"
Closes #5082

Backport of MR !9859

Merge branch 'backport-5082-lock-and-attach-when-return-zone-stats-revert-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9860
2024-12-08 11:39:08 +00:00
Ondřej Surý 81d661ffc0 Revert "Attach dnssecsignstats, rcvquerystats, and requeststats"
This reverts commit fb50a71159.

(cherry picked from commit 7a99d1baf8)
2024-12-08 12:03:12 +01:00
Evan Hunt 826dfa006e [9.20] fix: usr: Preserve cache across reconfig when using attach-cache
When the `attach-cache` option is used in the `options` block with an arbitrary name, it causes all views to use the same cache. Previously, this configuration caused the cache to be deleted and a new cache created every time the server was reconfigured. This has been fixed.

Closes #5061

Backport of MR !9787

Merge branch 'backport-5061-attach-cache-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9862
2024-12-07 02:55:17 +00:00
Evan Hunt f7d67710e2 preserve cache across reload when using attach-cache
when the attach-cache option is used in the options block
with an arbitrary name, it causes all views to use the same
cache. however, previously, this could cause the cache to be
deleted and a new cache created every time the server was
reconfigured. this did *not* occur when attach-cache was
used at the view level to refer back to another view's cache.

in this commit we correct the problem by checking for
pre-existing caches during reconfiguration, and moving
them from the old server cache list to the new cache list
before cleaning up and freeing the old cache list.

(cherry picked from commit f3af8a7dc3)
2024-12-06 18:19:54 -08:00
Matthijs Mekking d61bfeb91e [9.20] chg: dev: Remove unused maxquerycount
Related to #4980

Backport of MR !9850

Merge branch 'backport-4980-remove-unused-maxqueryqount-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9853
2024-12-06 16:17:19 +00:00
Matthijs Mekking 9af97fd0fe Remove unused maxquerycount
While implementing the global limit 'max-query-count', initially I
thought adding the variable to the resolver structure. But the limit
is per client request so it was moved to the view structure (and
counter in ns_query structure). However, I forgot to remove the
variable from the resolver structure again. This commit fixes that.

(cherry picked from commit 397ca34e34)
2024-12-06 15:18:56 +00:00
Michal Nowak aafafbbd22 [9.20] new: test: Add OpenBSD 7.6
Backport of MR !9609

Merge branch 'backport-mnowak/openbsd-7.6-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9848
2024-12-06 13:34:08 +00:00
Michal Nowak 83178557b4 Add OpenBSD 7.6
(cherry picked from commit 11670b581d)
2024-12-06 10:17:12 +00:00
Michal Nowak b2c60b8401 [9.20] chg: test: Add FreeBSD 13.4
Backport of MR !9640

Merge branch 'backport-mnowak/freebsd-13.4-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9845
2024-12-06 10:08:28 +00:00
Michal Nowak 2b7ed7fde8 Add FreeBSD 13.4
(cherry picked from commit 88b4367daa)
2024-12-06 09:32:08 +00:00
Matthijs Mekking 4ca7a5d601 [9.20] fix: usr: Fix nsupdate hang when processing a large update
To mitigate DNS flood attacks over a single TCP connection, we throttle the connection when the other side does not read the data. Throttling should only occur on server-side sockets, but erroneously also happened for nsupdate, which acts as a client. When nsupdate started throttling the connection, it never attempts to read again. This has been fixed.
 
Closes #4910

Backport of MR !9709

Merge branch 'backport-4910-nsupdate-hangs-when-processing-large-update-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9834
2024-12-06 08:31:28 +00:00
Matthijs Mekking a7b291adc7 Fix nsupdate hang when processing a large update
The root cause is the fix for CVE-2024-0760 (part 3), which resets
the TCP connection on a failed send. Specifically commit
4b7c61381f stops reading on the socket
because the TCP connection is throttling.

When the tcpdns_send_cb callback thinks about restarting reading
on the socket, this fails because the socket is a client socket.
And nsupdate is a client and is using the same netmgr code.

This commit removes the requirement that the socket must be a server
socket, allowing reading on the socket again after being throttled.

(cherry picked from commit aa24b77d8b)
2024-12-06 08:31:19 +00:00
Matthijs Mekking cc004b2b8f Add test case for nsupdate hangs on large update
This test case hangs, despite the update being performed on the
name server.

(cherry picked from commit 3adabb4f89)
2024-12-06 08:31:19 +00:00
Michal Nowak 336e9c746e [9.20] fix: test: ecdsa pytest rewrite fixes
Backport of MR !9823

Merge branch 'backport-mnowak/ecdsa-pytest-rewrite-fixes-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9837
2024-12-06 07:08:34 +00:00
Michal Nowak dffcf1226c Use os.getenv() instead of os.environ
If ECDSAP256SHA256_SUPPORTED or ECDSAP384SHA384_SUPPORTED variables were
not present in the environment, os.environ would raise KeyError that is
not being handled in the decorator. Use os.getenv() instead.

(cherry picked from commit 1a5683b638)
2024-12-06 07:06:31 +00:00
Michal Nowak 85176a62ca Fix skipif decorators' conditions
The ECDSA256 and ECDSA384 check conditions were switched.

(cherry picked from commit 2a7b8d9795)
2024-12-06 07:06:31 +00:00
Mark Andrews 844a531053 [9.20] new: usr: Add a new option to configure the maximum number of outgoing queries per client request
The configuration option 'max-query-count' sets how many outgoing queries per client request is allowed. The existing 'max-recursion-queries' is the number of permissible queries for a single name and is reset on every CNAME redirection. This new option is a global limit on the client request. The default is 200.

This allows us to send a bit more queries while looking up a single name. The default for 'max-recursion-queries' is changed from 32 to 50.

Closes #4980 
Closes #4921

Backport of MR !9737

Merge branch 'backport-4980-global-limit-outgoing-queries-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9832
2024-12-06 06:59:18 +00:00
Matthijs MekkingandMark Andrews dd098a4b3b Change default max-recursion-queries to 50
Changing the default for max-recursion-queries from 100 to 32 was too
strict in some cases, especially lookups in reverse IPv6 trees started
to fail more frequently. From issue #4921 it looks like 50 is a better
default.

Now that we have 'max-query-count' as a global limit of outgoing queries
per client request, we can increase the default for
'max-recursion-queries' again, as the number of recursive queries is
no longer bound by the multiple of 'max-recursion-queries' and
'max-query-restarts'.

(cherry picked from commit 84df920d9e)
2024-12-06 06:20:33 +00:00
Matthijs MekkingandMark Andrews 1d7ddb5ec4 Add a CAMP test case
This adds a new test directory specifically for CAMP attacks. This first
test in this test directory follows multiple CNAME chains, restarting
the max-recursion-queries counter, but should bail when the global
maximum quota max-query-count is reached.

(cherry picked from commit 73eafaba14)
2024-12-06 06:20:33 +00:00
Matthijs MekkingandMark Andrews 63e5f295fb Add +maxtotalqueries option to delv
The max-query-count value can now be set on the command line in delv
with +maxtotalqueries.

(cherry picked from commit 74f845d62f)
2024-12-06 06:20:33 +00:00
Matthijs MekkingandMark Andrews 492f79560d Implement global limit for outgoing queries
This global limit is not reset on query restarts and is a hard limit
for any client request.

(cherry picked from commit 16b3bd1cc7)
2024-12-06 06:20:33 +00:00
Matthijs MekkingandMark Andrews 511c86facb Implement getter function for counter limit
(cherry picked from commit ca7d487357)
2024-12-06 06:20:33 +00:00
Matthijs MekkingandMark Andrews c233bb9de0 Implement 'max-query-count'
Add another option to configure how many outgoing queries per
client request is allowed. The existing 'max-recursion-queries' is
per restart, this one is a global limit.

(cherry picked from commit bbc16cc8e6)
2024-12-06 06:20:33 +00:00
Mark Andrews 79e6519168 [9.20] fix: dev: Lock and attach when returning zone stats
When returning zone statistics counters, the statistics sets are now attached while the zone is locked.  This addresses Coverity warnings CID 468720, 468728 and 468729.

Closes #4934

Backport of MR !9488

Merge branch 'backport-4934-lock-and-attach-when-return-zone-stats-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9843
2024-12-06 06:19:41 +00:00
Mark Andrews bcf3f8b44d Attach dnssecsignstats, rcvquerystats, and requeststats
In dns_zone_getdnssecsignstats, dns_zone_getrcvquerystats and
dns_zone_getrequeststats attach to the statistics structure.

(cherry picked from commit fb50a71159)
2024-12-06 16:45:52 +11:00
Mark Andrews 12a0f80b99 INSIST that the zone in locked before unlocking
This is the counterpart to the INSIST(!zone->locked) when the zone
is locked.

(cherry picked from commit aa686512df)
2024-12-06 05:32:56 +00:00
Mark Andrews 31918336e8 [9.20] fix: dev: Finalize removal of memory debug flags size and mctx
Commit 4b3d0c6600 has removed them, but
did not remove few traces in documentation and help. Remove them from
remaining places.

Backport of MR !9606

Merge branch 'backport-main-memory-flags-size-mctx-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9842
2024-12-06 03:56:14 +00:00
Petr MenšíkandMark Andrews 5a1c39b1b7 Finalize removal of memory debug flags size and mctx
Commit 4b3d0c6600 has removed them, but
did not remove few traces in documentation and help. Remove them from
remaining places.

(cherry picked from commit 65b9eeb39a)
2024-12-06 03:13:14 +00:00
Mark Andrews c577c3b544 [9.20] fix: usr: Fix dnssec-signzone signing non-DNSKEY RRsets with revoked keys
`dnssec-signzone` was using revoked keys for signing RRsets other than DNSKEY.  This has been corrected.

Closes #5070

Backport of MR !9800

Merge branch 'backport-5070-dnssec-signzone-fix-revoke-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9840
2024-12-06 02:03:35 +00:00
Mark Andrews 3eea26ba37 Check dnssec-signzone behaviour with revoked keys
Only DNSKEY records should be signed with a revoked key.

(cherry picked from commit 30ef6dde05)
2024-12-06 01:00:08 +00:00
Mark Andrews db19675ee9 Do not sign non DNSKEY RRset with revoked keys
It does not make sense to sign RRsets other than DNSKEY with revoked
keys.

(cherry picked from commit 23775c6006)
2024-12-06 01:00:08 +00:00
Ondřej Surý 4345aac6dc [9.20] chg: doc: only one loopmgr is expected
Resolves: https://gitlab.isc.org/isc-projects/bind9/-/issues/5057

Backport of MR !9789

Merge branch 'backport-docs-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9826
2024-12-05 19:50:21 +00:00
Pavel BřezinaandOndřej Surý 0884e223c4 update docs: only one loopmgr is expected
Resolves: https://gitlab.isc.org/isc-projects/bind9/-/issues/5057
(cherry picked from commit 6f21cf201b)
2024-12-05 19:50:16 +00:00
Michal Nowak d1f1d13efd [9.20] fix: ci: Add ns2/managed1.conf to mkeys extra_artifacts
The ns2/managed1.conf file is created by the setup.sh script. Then, in
the tests.sh script it is moved to ns2/managed.conf. The latter file
name is in mkeys extra_artifacts, but the former one is not. This is a
problem when pytest is started with the --setup-only option as it only
runs the setup.sh script (e.g., in the cross-version-config-tests CI
job) and thus failing the "Unexpected files found" assertion.

Backport of MR !9815

Merge branch 'backport-mnowak/mkeys-add-ns2-managed1-conf-to-extra-artifacts-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9824
2024-12-05 10:43:25 +00:00
Michal Nowak e8d6be9c38 Add ns2/managed1.conf to mkeys extra_artifacts
The ns2/managed1.conf file is created by the setup.sh script. Then, in
the tests.sh script it is moved to ns2/managed.conf. The latter file
name is in mkeys extra_artifacts, but the former one is not. This is a
problem when pytest is started with the --setup-only option as it only
runs the setup.sh script (e.g., in the cross-version-config-tests CI
job) and thus failing the "Unexpected files found" assertion.

(cherry picked from commit e7d973bd00)
2024-12-05 10:08:34 +00:00
Colin Vidal ee77a19209 [9.20] new: usr: Add Extended DNS Error Code 22 - No Reachable Authority
When the resolver is trying to query an authority server and eventually timed out, a SERVFAIL answer is given to the client. Add the Extended DNS Error Code 22 - No Reachable Authority to the response.

Closes #2268

Backport of MR !9743

Merge branch 'backport-2268/ede-no-reachable-authority-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9814
2024-12-05 10:03:28 +00:00
Colin Vidal c586d9a658 Add EDE 22 No reachable authority code
Add support for Extended DNS Errors (EDE) error 22: No reachable
authority. This occurs when after a timeout delay when the resolver is
trying to query an authority server.

(cherry picked from commit d13e94b930)

Commit amended in order to fix usage of isc_log_write (adding dns_lctx
parameter)
2024-12-05 10:30:28 +01:00
Michal Nowak fc14b62e92 [9.20] chg: test: Rewrite ecdsa system test to pytest
Backport of MR !9159

Merge branch 'backport-mnowak/pytest_rewrite_ecdsa-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9816
2024-12-05 07:46:46 +00:00
Michal Nowak 211a0eafa9 Rewrite ecdsa system test to pytest
(cherry picked from commit 292e919156)
2024-12-05 07:46:17 +00:00
Mark Andrews 41af766cd0 [9.20] fix: usr: Fix possible assertion failure when reloading server while processing updates
Closes #5006

Backport of MR !9745

Merge branch 'backport-5006-get-max-by-type-earlier-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9820
2024-12-05 04:48:33 +00:00
Mark Andrews f5bcc2a1b8 Keep a local copy of the update rules to prevent UAF
Previously, the update policy rules check was moved earlier in the
sequence, and the keep rule match pointers were kept to maintain the
ability to verify maximum records by type.

However, these pointers can become invalid if server reloading
or reconfiguration occurs before update completion. To prevent
this issue, extract the maximum records by type value immediately
during processing and only keep the copy of the values instead of the
full ssurule.

(cherry picked from commit 44a54a29d8)
2024-12-05 04:14:28 +00:00
Petr Špaček ae739c80cc fix: dev: Fix m4 macro in configure.ac
Merge branch 'pspacek/fix-bind-9.20-build' into 'bind-9.20'

See merge request isc-projects/bind9!9813
2024-12-04 15:45:39 +00:00
Petr Špaček cd033ac41f Fix m4 macro in configure.ac
Release automation went wrong, it seems. And I just glanced over the
line, saw 4 -> 5 change at the end and did not notice the change at the
beginning of the line...
2024-12-04 16:38:14 +01:00
Petr Špaček 37c3e5a1c0 chg: doc: Set up version for BIND 9.20.5
Merge branch 'pspacek/set-up-version-for-bind-9.20.5' into 'bind-9.20'

See merge request isc-projects/bind9!9811
2024-12-04 15:10:48 +00:00
Petr Špaček 0b44cfd53a Update BIND version to 9.20.5-dev 2024-12-04 16:06:17 +01:00
Petr Špaček 283ac230b9 Update BIND version for release 2024-12-03 13:30:02 +01:00
Andoni Duarte 9a0f62db2d new: doc: Prepare documentation for BIND 9.20.4
Merge branch 'pspacek/prepare-documentation-for-bind-9.20.4' into 'v9.20.4-release'

See merge request isc-private/bind9!756
2024-12-03 12:26:07 +00:00
Petr Špaček e7af24214b Tweak and reword release notes 2024-12-03 12:38:50 +01:00
Petr Špaček 26d1bd7c4e Prepare release notes for BIND 9.20.4 2024-12-03 12:31:04 +01:00
Petr Špaček 09fd413403 Fix Sphinx build failures on generated changelog for BIND 9.20.4 2024-12-03 12:01:13 +01:00
Petr Špaček 52a2caf0fd Generate changelog for BIND 9.20.4 2024-12-03 11:55:10 +01:00
Petr Špaček 408bd910ec [9.20] chg: doc: gitchangelog: don't break lines on hyphens in relnotes
When release notes are generated, the text is wrapped and line breaks
are inserted into each paragraph (sourced from the commit message's
body). Prevent line breaks after hyphens, as these are often used for
option names. This makes it possible to easily find the options
afterwards.

Backport of MR !9801

Merge branch 'backport-nicki/gitchangelog-dont-break-on-hyphens-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9802
2024-12-02 14:01:29 +00:00
Nicki KřížekandPetr Špaček 2a86b13e28 gitchangelog: don't break lines on hyphens in relnotes
When release notes are generated, the text is wrapped and line breaks
are inserted into each paragraph (sourced from the commit message's
body). Prevent line breaks after hyphens, as these are often used for
option names. This makes it possible to easily find the options
afterwards.

(cherry picked from commit 9b0d0c0173)
2024-12-02 13:56:00 +00:00
Evan Hunt 1e9c3af75a [9.20] fix: dev: Use attach()/detach() functions instead of touching .references
In rbtdb.c, there were places where the code touched .references
directly instead of using the helper functions.  Use the helper
functions instead.

Forward port from https://gitlab.isc.org/isc-private/bind9/-/merge_requests/753

Merge branch 'ondrej/use-attach-detach-in-rbtdb-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9795
2024-11-27 22:51:41 +00:00
Ondřej Surý db5803a0ec Use attach()/detach() functions instead of touching .references
In rbtdb.c, there were places where the code touched .references
directly instead of using the helper functions.  Use the helper
functions instead.
2024-11-27 21:16:22 +01:00
Ondřej Surý 8002fda38c [9.20] fix: dev: Make dns_validator_cancel() respect the data ownership
There was a data race dns_validator_cancel() was called when the
offloaded operations were in progress.  Make dns_validator_cancel()
respect the data ownership and only set new .canceling variable when
the offloaded operations are in progress.  The cancel operation would
then finish when the offloaded work passes the ownership back to the
respective thread.

Closes #4926

Backport of MR !9470

Merge branch 'backport-4926-fix-data-race-in-dns_validator-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9790
2024-11-27 19:04:26 +00:00
Ondřej Surý f04514e98a Make dns_validator_cancel() respect the data ownership
There was a data race dns_validator_cancel() was called when the
offloaded operations were in progress.  Make dns_validator_cancel()
respect the data ownership and only set new .shuttingdown variable when
the offloaded operations are in progress.  The cancel operation would
then finish when the offloaded work passes the ownership back to the
respective thread.

(cherry picked from commit ee122ba025)
2024-11-27 19:43:26 +01:00
Ondřej Surý fa5d270f95 [9.20] fix: usr: Improve the memory cleaning in the SERVFAIL cache
The SERVFAIL cache doesn't have a memory bound and the
cleaning of the old SERVFAIL cache entries was implemented
only in opportunistic manner.  Improve the memory cleaning
of the SERVFAIL cache to be more aggressive, so it doesn't
consume a lot of memory in the case the server encounters
many SERVFAILs at once.

Closes #5025

Backport of MR !9760

Merge branch 'backport-5025-improve-badcache-cleaning-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9794
2024-11-27 18:04:38 +00:00
Ondřej Surý de7312ae5f Remove dns_badcache usage in the resolver (lame-ttl)
The lame-ttl processing was overriden to be disabled in the config,
but the code related to the lame-ttl was still kept in the resolver
code.  More importantly, the DNS_RESOLVER_BADCACHETTL() macro would
cause the entries in the resolver badcache to be always cached for at
least 30 seconds even if the lame-ttl would be set to 0.

Remove the dns_badcache code from the dns_resolver unit, so we save some
processing time and memory in the resolver code.

(cherry picked from commit b61739836d)
2024-11-27 17:07:03 +00:00
Ondřej Surý 6c3f1f09b2 Improve the badcache cleaning by adding LRU and using RCU
Instead of cleaning the dns_badcache opportunistically, add per-loop
LRU, so each thread-loop can clean the expired entries.  This also
allows removal of the atomic operations as the badcache entries are now
immutable, instead of updating the badcache entry in place, the old
entry is now deleted from the hashtable and the LRU list, and the new
entry is inserted in the LRU.

(cherry picked from commit 2cb5a6210f)
2024-11-27 17:07:03 +00:00
Arаm Sаrgsyаn 894295a926 [9.20] fix: test: Fix the nslookup system test
The nslookup system test checks the count of resolved addresses in
the CNAME tests using a 'grep' match on the hostname, and ignoring
lines containing the 'canonical name' string. In order to protect
the check from intermittent failures like the 'address in use' warning
message, which then automatically resolves after a retry, edit the
'grep' matching string to also ignore the comments (as the mentioned
warning message is a comment which contains the hostname).

Closes #4948

Backport of MR !9523

Merge branch 'backport-4948-nslookup-test-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9791
2024-11-27 15:54:01 +00:00
Aram Sargsyan bebdabc06c Fix the nslookup system test
The nslookup system test checks the count of resolved addresses in
the CNAME tests using a 'grep' match on the hostname, and ignoring
lines containing the 'canonical name' string. In order to protect
the check from intermittent failures like the 'address in use' warning
message, which then automatically resolves after a retry, edit the
'grep' matching string to also ignore the comments (as the mentioned
warning message is a comment which contains the hostname).

(cherry picked from commit 345b0f9e5c)
2024-11-27 13:35:25 +00:00
Arаm Sаrgsyаn ab138bb717 [9.20] fix: usr: Fix trying the next primary server when the preivous one was marked as unreachable
In some cases (there is evidence only when XoT was used) `named` failed
to try the next primary server in the list when the previous one was
marked as unreachable. This has been fixed.

Closes #5038

Backport of MR !9781

Merge branch 'backport-5038-xfr-primary-next-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9788
2024-11-27 13:30:13 +00:00
Aram Sargsyan 61d49b0731 Test trying of the next primary server
Add test cases which check that when a XoT primary server is
unreachable or is already marked as unreachble then the next
primary server in the list is used.

(cherry picked from commit 12225d125b)
2024-11-27 11:49:02 +00:00
Aram Sargsyan 375bd8ec75 xfrin: refactor and fix the ISC_R_CANCELED case handling
Previously a ISC_R_CANCELED result code switch-case has been added to
the zone.c:zone_xfrdone() function, which did two things:

1. Schedule a new zone transfer if there's a scheduled force reload of
   the zone.

2. Reset the primaries list.

This proved to be not a well-thought change and causes problems,
because the ISC_R_CANCELED code is used not only when the whole transfer
is canceled, but also when, for example, a particular primary server is
unreachable, and named still needs to continue the transfer process by
trying the next server, which it now no longer does in some cases. To
solve this issue, three changes are made:

1. Make sure dns_zone_refresh() runs on the zone's loop, so that the
   sequential calls of dns_zone_stopxfr() and dns_zone_forcexfr()
   functions (like done in 'rndc retransfer -force') run in intended
   order and don't race with each other.

2. Since starting the new transfer is now guaranteed to run after the
   previous transfer is shut down (see the previous change), remove the
   special handling of the ISC_R_CANCELED case, and let the default
   handler to handle it like before. This will bring back the ability to
   try the next primary if the current one was interrupted with a
   ISC_R_CANCELED result code.

3. Change the xfrin.c:xfrin_shutdown() function to pass the
   ISC_R_SHUTTINGDOWN result code instead of ISC_R_CANCELED, as it makes
   more sense.

(cherry picked from commit 3262ebd0f3)
2024-11-27 11:49:01 +00:00
Aram Sargsyan b88f10afac Clean up dns_zonemgr_unreachabledel()
The results of isc_sockaddr_format() calls are not used, remove them
and the local variables.

(cherry picked from commit 1c4a34a3ab)
2024-11-27 11:49:01 +00:00
Mark Andrews 74e7e229f2 [9.20] chg: usr: emit more helpful log for exceeding max-records-per-type
The new log message is emitted when adding or updating an RRset
fails due to exceeding the max-records-per-type limit. The log includes
the owner name and type, corresponding zone name, and the limit value.
It will be emitted on loading a zone file, inbound zone transfer
(both AXFR and IXFR), handling a DDNS update, or updating a cache DB.
It's especially helpful in the case of zone transfer, since the
secondary side doesn't have direct access to the offending zone data.

It could also be used for max-types-per-name, but this change
doesn't implement it yet as it's much less likely to happen
in practice.

Backport of MR !9509

Merge branch 'backport-helpful-log-on-toomanyrecords-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9771
2024-11-27 00:51:59 +00:00
JINMEI TatuyaandMark Andrews c862555b66 update system tests to confirm new log messages
(cherry picked from commit 000720fe14)
2024-11-27 11:17:34 +11:00
JINMEI TatuyaandMark Andrews b8996b6e83 use more generic log module name for 'logtoomanyrecords'
DNS_LOGMODULE_RBTDB was simply inappropriate, and this
log message is actually dependent on db implementation
details, so DNS_LOGMODULE_DB would be the best choice.

(cherry picked from commit b0309ee631)
2024-11-27 11:17:34 +11:00
JINMEI TatuyaandMark Andrews 08122316a7 emit more helpful log for exceeding max-records-per-type
The new log message is emitted when adding or updating an RRset
fails due to exceeding the max-records-per-type limit. The log includes
the owner name and type, corresponding zone name, and the limit value.
It will be emitted on loading a zone file, inbound zone transfer
(both AXFR and IXFR), handling a DDNS update, or updating a cache DB.
It's especially helpful in the case of zone transfer, since the
secondary side doesn't have direct access to the offending zone data.

It could also be used for max-types-per-name, but this change
doesn't implement it yet as it's much less likely to happen
in practice.

(cherry picked from commit 4156995431)
2024-11-27 11:17:34 +11:00
Michal Nowak d754d3c2e0 [9.20] chg: test: Rewrite emptyzones system test to pytest
Backport of MR !9154

Merge branch 'backport-mnowak/pytest_rewrite_emptyzones-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9782
2024-11-26 17:03:49 +00:00
Michal Nowak 58316503b6 Rewrite emptyzones system test to pytest
(cherry picked from commit 3ace62472c)
2024-11-26 17:03:30 +00:00
Michal Nowak a506a04c98 Add isctest.check.refused()
(cherry picked from commit 7bedd1c296)
2024-11-26 17:03:30 +00:00
Ondřej Surý a1cd30cd25 [9.20] rem: usr: Move contributed DLZ modules into a separate repository
The DLZ modules are poorly maintained as we only ensure they can still
be compiled, the DLZ interface is blocking, so anything that blocks the
query to the database blocks the whole server and they should not be
used except in testing.  The DLZ interface itself is going to be scheduled
for removal.

The DLZ modules now live in https://gitlab.isc.org/isc-projects/dlz-modules
repository.

Closes #4865

Backport of MR !9349

Merge branch 'backport-4865-remove-contributed-DLZ-modules-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9777
2024-11-26 15:43:52 +00:00
Ondřej Surý 624ea6c57e Move contributed DLZ modules into a separate repository
The DLZ modules are poorly maintained as we only ensure they can still
be compiled, the DLZ interface is blocking, so anything that blocks the
query to the database blocks the whole server and they should not be
used except in testing.  The DLZ interface itself should be scheduled
for removal.

(cherry picked from commit a6cce753e2)
2024-11-26 16:24:17 +01:00
Michal Nowak 14d5c67f31 [9.20] chg: test: Rewrite database system test to pytest
Backport of MR !9156

Merge branch 'backport-mnowak/pytest_rewrite_database-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9779
2024-11-26 14:04:06 +00:00
Michal Nowak 5d28efecfc Rewrite database system test to pytest
(cherry picked from commit 8005ad0dcd)
2024-11-26 12:12:26 +00:00
Michal Nowak 7f14fffe6f [9.20] rem: test: Revert "xfail upforwd system test if DNSTAP is enabled"
This reverts commit 0579e0a429.

See isc-projects/bind9#4996

Backport of MR !9681

Merge branch 'backport-mnowak/revert-xfail-upforwd-system-test-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9776
2024-11-26 11:53:43 +00:00
Michal Nowak 3cb61b1252 Revert "xfail upforwd system test if DNSTAP is enabled"
This reverts commit 0579e0a429.

(cherry picked from commit e7e73da39a)
2024-11-26 10:50:15 +00:00
Nicki Křížek 2b3c88d283 [9.20] fix: test: Ignore test artifacts in .libs
Some tests may leave artifacts in the .libs directory. Ignore this
directory when detecting expected artifacts.

Closes #5055

Backport of MR !9766

Merge branch 'backport-5055-ignore-libs-artifacts-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9773
2024-11-26 10:15:25 +00:00
Nicki Křížek d7cb6263a3 Ignore test artifacts in .libs
Some tests may leave artifacts in the .libs directory. Ignore this
directory when detecting expected artifacts.

(cherry picked from commit cf606a9ead)
2024-11-26 09:06:06 +00:00
Alessio Podda 4509b92e21 [9.20] chg: dev: Incrementally apply AXFR transfer
Reintroduce logic to apply diffs when the number of pending tuples is
above 128. The previous strategy of accumulating all the tuples and
pushing them at the end leads to excessive memory consumption during
transfer.

This effectively reverts half of e3892805d6

Closes #4986

Backport of MR !9740

Merge branch 'backport-4986-axfr-chunked-insert-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9761
2024-11-26 08:25:03 +00:00
Alessio Podda 0472494417 Incrementally apply AXFR transfer
Reintroduce logic to apply diffs when the number of pending tuples is
above 128. The previous strategy of accumulating all the tuples and
pushing them at the end leads to excessive memory consumption during
transfer.

This effectively reverts half of e3892805d6

(cherry picked from commit 99b4f01b33)
2024-11-26 07:17:06 +00:00
Mark Andrews b27cb14616 [9.20] fix: usr: '{&dns}' is as valid as '{?dns}' in a SVCB's dohpath
`dig` fails to parse a valid (as far as I can tell, and accepted by `kdig` and `Wireshark`) `SVCB` record with a `dohpath` URI template containing a `{&dns}`, like `dohpath=/some/path?key=value{&dns}"`. If the URI template contains a `{?dns}` instead `dig` is happy, but my understanding of rfc9461 and section 1.2. "Levels and Expression Types" of rfc6570 is that `{&dns}` is valid.
See for example section 1.2. "Levels and Expression Types" of rfc6570.

Note that Peter van Dijk suggested that `{dns}` and `{dns,someothervar}` might be valid forms as well, so my patch might be too restrictive, although it's anyone's guess how DoH clients would handle complex templates.

Closes https://gitlab.isc.org/isc-projects/bind9/-/issues/4922

Backport of MR !9455

Merge branch 'backport-svcb-dohpath-uri-template-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9769
2024-11-26 06:30:29 +00:00
Mark Andrews 0e00e28ec6 Parse the URI template and check for a dns variable
The 'dns' variable in dohpath can be in various forms ({?dns},
{dns}, {&dns} etc.).  To check for a valid dohpath it ends up
being simpler to just parse the URI template rather than looking
for all the various forms if substring.

(cherry picked from commit af54ef9f5d)
2024-11-26 03:41:46 +00:00
Remi GacogneandMark Andrews cc9366031b '{&dns}' is as valid as '{?dns}' in a SVCB's dohpath
See for example section 1.2. "Levels and Expression Types" of rfc6570.

(cherry picked from commit e74052ea71)
2024-11-26 03:41:45 +00:00
Mark Andrews 41fd5e9955 [9.20] fix: usr: Provide more visibility into configuration errors
by logging SSL_CTX_use_certificate_chain_file and SSL_CTX_use_PrivateKey_file errors individually.

Closes #5008

Backport of MR !9683

Merge branch 'backport-5008-provide-more-visibility-into-ssl-errors-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9767
2024-11-26 03:16:26 +00:00
Mark Andrews 983d8a6821 Provide more visibility into configuration errors
by logging SSL_CTX_use_certificate_chain_file and
SSL_CTX_use_PrivateKey_file errors

(cherry picked from commit 9006839ed7)
2024-11-26 12:25:01 +11:00
Nicki Křížek c3691d138a [9.20] fix: test: Allow re-run of mkeys system test
On some slow systems, the test might intermittently fail due to inherent
timing issues. In our CI, this most often happens in the
system:gcc:8fips:amd64 jobs.

Closes #3098

Backport of MR !9732

Merge branch 'backport-3098-allow-re-run-of-mkeys-test-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9764
2024-11-25 15:44:47 +00:00
Nicki Křížek 80967a2c66 Allow re-run of mkeys system test
On some slow systems, the test might intermittently fail due to inherent
timing issues. In our CI, this most often happens in the
system:gcc:8fips:amd64 jobs.

(cherry picked from commit a299650a6f)
2024-11-25 14:35:54 +00:00
Michal Nowak 402e0596c8 [9.20] fix: ci: Fix paths to binaries in cross-version-config-tests job
The cross-version-config-tests job has never functioned in CI because
the testing framework changed after the testing was completed. To run
the new "named" binary using the old configurations, paths in the test
framework must be updated to point to the location of the new binaries.

Closes #4977

Backport of MR !9702

Merge branch 'backport-4977-fix-cross-version-config-tests-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9762
2024-11-25 12:32:23 +00:00
Michal Nowak b60f28389d Fix paths to binaries in cross-version-config-tests job
The cross-version-config-tests job has never functioned in CI because
the testing framework changed after the testing was completed. To run
the new "named" binary using the old configurations, paths in the test
framework must be updated to point to the location of the new binaries.

(cherry picked from commit 09d7e2430a)
2024-11-25 12:11:33 +00:00
Mark Andrews 428b155e12 [9.20] chg: nil: Re-split format strings lib/ns/update.c
Re-split format strings that had been poorly split by multiple
clang-format runs using different versions of clang-format. 

Closes #5043

Backport of MR !9752

Merge branch 'backport-5043-re-split-format-strings-lib-ns-update-c-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9755
2024-11-21 06:27:16 +00:00
Mark Andrews 1135bf9284 Re-split format strings
Re-split format strings that had been poorly split by multiple
clang-format runs using different versions of clang-format.

(cherry picked from commit a24d6e1654)
2024-11-21 04:22:11 +00:00
Ondřej Surý 4230b2b514 [9.20] chg: dev: Add two new clang-format options that help with code formatting
* Add new clang-format option to remove redundant semicolons
* Add new clang-format option to remove redundant parentheses

Backport of MR !9749

Merge branch 'backport-ondrej/code-style-2024-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9750
2024-11-19 15:42:23 +00:00
Ondřej Surý 5448b2ea25 Ignore clang-format reformatting commit
(cherry picked from commit 82f0c31c0d)
2024-11-19 14:27:51 +01:00
Ondřej Surý c22176c0f9 Remove redundant semicolons after the closing braces of functions
(cherry picked from commit 1a19ce39db)
2024-11-19 14:26:56 +01:00
Ondřej Surý 1fdc2d76f3 Add new clang-format option to remove redundant semicolons
The new clang-format options (since clang-format 16) removes semicolons
after the closing braces of functions and constructors/destructors.

(cherry picked from commit c7420eccd9)
2024-11-19 14:26:55 +01:00
Ondřej Surý 58a15d38c2 Remove redundant parentheses from the return statement
(cherry picked from commit 0258850f20)
2024-11-19 14:26:52 +01:00
Ondřej Surý 2044a64d8b Add new clang-format option to remove redundant parentheses
The new clang-format option (since 17) can remove redundant parentheses
in the return statement (with configuration value ReturnStatement).

(cherry picked from commit 3873b0c279)
2024-11-19 14:15:20 +01:00
Arаm Sаrgsyаn 2cb91e0631 [9.20] fix: dev: Fix a data race between dns_zone_getxfr() and dns_xfrin_create()
There is a data race between the statistics channel, which uses
`dns_zone_getxfr()` to get a reference to `zone->xfr`, and the creation
of `zone->xfr`, because the latter happens outside of a zone lock.

Split the `dns_xfrin_create()` function into two parts to separate the
zone transfer starting part from the zone transfer object creation part.
This allows us to attach the new object to a local variable first, then
attach it to `zone->xfr` under a lock, and only then start the transfer.

Closes #5011

Backport of MR !9716

Merge branch 'backport-5011-dns_zone_getxfr-race-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9728
2024-11-16 19:51:25 +00:00
Aram Sargsyan 19d4539926 Fix a data race between dns_zone_getxfr() and dns_xfrin_create()
There is a data race between the statistics channel, which uses
`dns_zone_getxfr()` to get a reference to `zone->xfr`, and the creation
of `zone->xfr`, because the latter happens outside of a zone lock.

Split the `dns_xfrin_create()` function into two parts to separate the
zone tranfer startring part from the zone transfer object creation part.
This allows us to attach the new object to a local variable first, then
attach it to `zone->xfr` under a lock, and only then start the transfer.

(cherry picked from commit dbf230650f)
2024-11-16 18:55:00 +00:00
Evan Hunt 1f988e2cc7 [9.20] new: usr: Update bind.keys with the new 2025 IANA root key
Add an 'initial-ds' entry to bind.keys for the new root key, ID
38696, which is scheduled for publication in January 2025.

Closes #4896

Backport of MR !9422

Merge branch 'backport-4896-update-bind-keys-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9746
2024-11-15 23:16:37 +00:00
Evan Hunt 7045da6d6a Add the DS for the new root key (38696)
Add an 'initial-ds' entry to bind.keys for the new root key, ID
38696, scheduled for publication in January 2025.

(cherry picked from commit 609bf35075)
2024-11-15 22:32:10 +00:00
Ondřej Surý 4740d5d0a9 [9.20] fix: nil: Add OpenSSL includes as needed
The isc/crypto.h now directly includes the OpenSSL headers (evp.h) and
any application that includes that header also needs to have
OPENSSL_CFLAGS in the Makefile.am.  Adjust the required automake files
as needed.

Backport of MR !9713

Merge branch 'backport-ondrej/add-missing-OPENSSL_CFLAGS-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9715
2024-11-15 15:54:59 +00:00
Ondřej Surý 9b346bc6f1 Add OpenSSL includes as needed
The isc/crypto.h now directly includes the OpenSSL headers (evp.h) and
any application that includes that header also needs to have
OPENSSL_CFLAGS in the Makefile.am.  Adjust the required automake files
as needed.

(cherry picked from commit 88103e72d5)
2024-11-15 14:03:44 +00:00
Petr Špaček 74028e3923 [9.20] chg: doc: Move Known Issues to BIND9 wiki
Merge branch 'nicki/move-known-issues-to-wiki-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9730
2024-11-15 13:02:23 +00:00
Nicki KřížekandPetr Špaček 81b641d59c Move Known Issues to BIND9 wiki
Keeping the Known Issues as part of the rendered docs has the issue that
the list can't be updated on the official docs website until the next
release. This is unpractical is a high-priority issue is discovered
shortly after a release. Keep the Known Issues in wiki and simply link
to the list from the rendered docs. The wiki article can be updated at
any time as needed.
2024-11-15 13:00:31 +00:00
Ondřej Surý 668ea24467 [9.20] fix: usr: Fix race condition when canceling ADB find
When canceling the ADB find, the lock on the find gets released for
a brief period of time to be locked again inside adbname lock.  During
the brief period that the ADB find is unlocked, it can get canceled by
other means removing it from the adbname list which in turn causes
assertion failure due to a double removal from the adbname list.
This has been fixed.

Closes #5024

Backport of MR !9722

Merge branch 'backport-5024-fix-crash-in-dns_adb_cancelfind-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9744
2024-11-13 08:52:08 +00:00
Ondřej Surý d6f2dd79f6 Revalidate the adbname when canceling the ADB find
When canceling the ADB find, the lock on the find gets released for
a brief period of time to be locked again inside adbname lock.  During
the brief period that the ADB find is unlocked, it can get canceled by
other means removing it from the adbname list which in turn causes
assertion failure due to a double removal from the adbname list.

Recheck if the find->adbname is still valid after acquiring the lock
again and if not just skip the double removal.  Additionally, attach to
the adbname as in the worst case, the adbname might also cease to exist
if the scheduler would block this particular thread for a longer period
of time invalidating the lock we are going to acquire and release.

(cherry picked from commit 128e50e1ff)
2024-11-13 07:51:19 +00:00
Nicki Křížek 9487ab6ae5 [9.20] fix: test: minor fixes for extra_artifacts detection
Some omissions of !9426 discovered during the backports

Backport of MR !9739

Merge branch 'backport-nicki/extra-artifacts-fixups-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9741
2024-11-12 13:29:51 +00:00
Nicki Křížek 9ba60be870 Fix clean.sh removal omissions
- Ensure keyfromlabel token is cleaned up
- Remove forgotten clean.sh file
- Add missing enginepkcs11 test artifact

(cherry picked from commit 7dde34afac)
2024-11-12 11:21:15 +01:00
Nicki Křížek 0b9d3fbfea Ensure pytest runner get proper outcome from flaky reruns
When a test is re-run by the flaky plugin, the TestReport outcomes
collected in the pytest_runtest_makereport() hook should be overriden.
Each of the setup/call/teardown phases is reported again and since we
care about the overall outcome, their respective results should be
overriden so that only the outcome from the final test (re)run gets
reported.

Prior to this change, it lead to a situation where an extra_artifact
generated during the test might be ignored. This was caused because the
check was skipped, since the test was incorrectly considered as "failed"
in the case where the test would fail on the first run, but pass on a
subsequent flaky rerun.

(cherry picked from commit b66fb31dcb)
2024-11-12 10:20:27 +00:00
Nicki Křížek e5fa109599 [9.20] chg: dev: Use lists of expected artifacts in system tests
``clean.sh`` scripts have been replaced by lists of expected artifacts for each system test module. The list is defined using the custom ``pytest.mark.extra_artifacts`` mark, which can use both filenames and globs.

Closes #4261

Backport of MR !9426

Merge branch 'backport-4261-add-pytest-fixture-checking-test-artifacts-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9734
2024-11-08 15:24:07 +00:00
Nicki Křížek 0ed39d76dc Remove invocations and mentions of clean.sh
(cherry picked from commit f2cb2e5723)
2024-11-08 15:39:50 +01:00
Nicki Křížek c3a0af96ad Replace clean.sh files with extra_artifacts mark
The artifact lists in clean.sh and extra_artifacts might be slightly
different. The list was updated for each test to reflect the current
state.

(cherry picked from commit 7c259fe254)
2024-11-08 15:39:50 +01:00
Michał KępieńandNicki Křížek 95d3bbd5dc Add pytest fixture for checking test artifacts
Prior to introducing the pytest runner, clean.sh files were used as a
list of files that the test is expected to leave around as artifacts and
check that no extra files were created.

With the pytest runner, those scripts are no longer used, but the
ability to detect extraneous files is still useful. Add a new
"extra_artifacts" mark which can be used for the same purpose.

(cherry picked from commit 3a9f4edddc)
2024-11-08 15:39:50 +01:00
Mark Andrews ee91ba9dd3 [9.20] rem: nil: Remove named_g_sessionkey and named_g_sessionkeyname
Remove named_g_sessionkey and named_g_sessionkeyname as they are declared and cleaned up but otherwise are unused.

Closes #5023

Backport of MR !9720

Merge branch 'backport-5023-remove-named_g_sessionkey-as-it-is-unused-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9725
2024-11-07 05:15:00 +00:00
Mark Andrews e2746e86d9 Remove named_g_sessionkey and named_g_sessionkeyname
They are only declared and cleaned up but otherwise unused.

(cherry picked from commit f70ff727ec)
2024-11-07 02:18:48 +00:00
Mark Andrews 6cd001a68b [9.20] chg: usr: Print expire option in transfer summary.
The zone transfer summary will now print the expire option value in the zone transfer summary.

Closes #5013

Backport of MR !9694

Merge branch 'backport-5013-print-expire-option-in-transfer-summary-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9714
2024-11-05 02:06:11 +00:00
Mark Andrews 57e84efd67 Update zone transfer summary
Print the expire option in the zone transfer summary. This is
currently emitted in a DEBUG(1) message.

(cherry picked from commit 5253c75b7a)
2024-11-04 18:30:10 +00:00
Mark Andrews 834c04fc77 [9.20] chg: usr: dnssec-ksr now supports KSK rollovers
The tool 'dnssec-ksr' now allows for KSK generation, as well as planned KSK rollovers. When signing a bundle from a Key Signing Request (KSR), only the key that is active in that time frame is being used for signing. Also, the CDS and CDNSKEY records are now added and removed at the correct time.

Closes #4697 

Closes #4705

Backport of MR !9452

Merge branch 'backport-4705-dnssec-ksr-only-sign-with-active-ksks-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9711
2024-11-04 02:16:52 +00:00
Matthijs MekkingandMark Andrews 9a92cb4fbb Fix dnssec-ksr to support KSK rollovers
dnssec-ksr can now sign KSR files with multiple KSKs. A planned KSK
rollover is supported, meaning the KSR will first be signed with
one KSK and later with another. The timing metadata for CDS and
CDNSKEY records are also taken into account, so these records are
only published when the time is between "SyncPublish" and "SyncDelete".

(cherry picked from commit d7f2a2f437)
2024-11-04 01:10:34 +00:00
Matthijs MekkingandMark Andrews 1fcc346729 Add KSK roll test case
Add a test case for Offline KSK where during the lifespan of the Signed
Key Response a KSK rollover happens. Ensure that the correct DNSKEY,
CDNSKEY, and CDS records are published at the right times.

(cherry picked from commit 8cf5f972f4)
2024-11-04 01:10:34 +00:00
Matthijs MekkingandMark Andrews 2e5a2f4e81 Allow empty CDNSKEY/CDS RRset in ksr system test
When the zone is initially signed, the CDNSKEY/CDS RRset is not
immediately published. The DNSKEY and signatures must propagate first.
Adjust the test to allow for this case.

(cherry picked from commit 708927e03d)
2024-11-04 01:10:34 +00:00
Matthijs MekkingandMark Andrews a92fb659d3 dnssec-ksr keygen -o to create KSKs
Add an option to dnssec-ksr keygen, -o, to create KSKs instead of ZSKs.
This way, we can create a set of KSKS for a given period too.

For KSKs we also need to set timing metadata, including "SyncPublish"
and "SyncDelete". This functionality already exists in keymgr.c so
let's make the function accessible.

Replace dnssec-keygen calls with dnssec-ksr keygen for KSK in the
ksr system test and check keys for created KSKs as well. This requires
a slight modification of the check_keys function to take into account
KSK timings and metadata.

(cherry picked from commit 680aedb595)
2024-11-04 01:10:34 +00:00
Matthijs MekkingandMark Andrews 1adcb2945e Add -f option to dnssec-ksr documentation
This was previously left out by error.

(cherry picked from commit 01169b7ffc)
2024-11-04 01:10:34 +00:00
Mark Andrews 2d4d8382c8 [9.20] fix: nil: TLS notify checks fail on OL 8 FIPS
Add missing checks for `$FEATURETEST --have-fips-dh` in notify system test to match those in setup.sh.

Closes #5015

Backport of MR !9707

Merge branch 'backport-5015-tls-notify-checks-fail-on-ol-8-fips-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9712
2024-11-02 06:36:41 +00:00
Mark Andrews f793b28de4 Add missing $FEATURETEST --have-fips-dh
Notify over TLS only works if FIPS DH is supported.  Skip the system
tests parts that depend on it.

(cherry picked from commit 4f7e3e29a7)
2024-11-02 06:02:51 +00:00
Matthijs Mekking ba2e8fe5f9 [9.20] chg: test: Match algorithms when checking signatures
In the ksr system test, the 'test_ksr_twotone' case may fail if there are two keys with the same keytag (but different algorithms), because one key is expected to be signing and the other is not.

Switch to regular expression matching and include the algorithm in the search string.

Closes #5017

Backport of MR !9701

Merge branch 'backport-5017-unexpected-match-ksr-twotone-again-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9710
2024-11-01 14:51:01 +00:00
Matthijs Mekking 9621369524 Match algorithms when checking signatures
In the ksr system test, the test_ksr_twotone case may fail if there
are two keys with the same keytag (but different algorithms), because
one key is expected to be signing and the other is not.

Switch to regular expression matching and include the algorithm in the
search string.

(cherry picked from commit 795fcc9f80)
2024-11-01 14:16:38 +00:00
Michal Nowak b02f039d3a [9.20] chg: test: Rewrite rsabigexponent system test to pytest
Backport of MR !9157

Merge branch 'backport-mnowak/pytest_rewrite_rsabigexponent-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9705
2024-10-31 18:57:28 +00:00
Michal Nowak ba1d4cc4db Rewrite rsabigexponent system test to pytest
(cherry picked from commit cacff68e78)
2024-10-31 18:15:14 +00:00
Michal Nowak 4f4a39e910 [9.20] fix: doc: Remove the CHANGES file
With the introduction of the generated changelog, the CHANGES file
became a symlink to doc/arm/changelog.rst. After the changes made in
!9549, the changelog file transitioned from being a wholly generated
file to one that includes versioned changelog files, which are
themselves generated. However, while implementing !9549, we overlooked
that the CHANGES file is copied to a release directory on an FTP server
and contains just "include" directives, not the changelog itself.
Therefore, in the same fashion as the "RELEASE-NOTES*.html" file, create
a "CHANGELOG*.html" file that redirects to the Changelog appendix of the
ARM.

Closes #5000

Backport of MR !9690

Merge branch 'backport-5000-provide-correct-changelog-on-ftp-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9703
2024-10-31 18:11:43 +00:00
Michal Nowak daab2defe6 Fix changelog history header
(cherry picked from commit 9750f22e3a)
2024-10-31 16:46:58 +00:00
Michal Nowak 3ed3ace466 Remove the CHANGES file
With the introduction of the generated changelog, the CHANGES file
became a symlink to doc/arm/changelog.rst. After the changes made in
!9549, the changelog file transitioned from being a wholly generated
file to one that includes versioned changelog files, which are
themselves generated. However, while implementing !9549, we overlooked
that the CHANGES file is copied to a release directory on an FTP server
and contains just "include" directives, not the changelog itself.
Therefore, in the same fashion as the "RELEASE-NOTES*.html" file, create
a "CHANGELOG*.html" file that redirects to the Changelog appendix of the
ARM.

(cherry picked from commit e40bd273e4)
2024-10-31 16:46:57 +00:00
Nicki Křížek 4a9380835f [9.20] new: dev: Support jinja2 templates in pytest runner
Configuration files in system tests which require some variables (e.g.
port numbers) filled in during test setup, can now use jinja2 templates
when `jinja2` python package is available.

Any `*.j2` file found within the system test directory will be
automatically rendered with the environment variables into a file
without the `.j2` extension by the pytest runner. E.g.
`ns1/named.conf.j2` will become `ns1/named.conf` during test setup. To
avoid automatic rendering, use `.j2.manual` extension and render the
files manually at test time.

New `templates` pytest fixture has been added. Its `render()` function
can be used to render a template with custom test variables. This can be
useful to fill in different config options during the test. With
advanced jinja2 template syntax, it can also be used to include/omit
entire sections of the config file rather than using `named1.conf.in`,
`named2.conf.in` etc.

Closes #4938

Backport of MR !9587

Merge branch 'backport-4938-use-jinja2-templates-in-system-tests-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9699
2024-10-31 12:13:09 +00:00
Nicki Křížek 668544ec74 Support jinja2 templates in pytest runner
Configuration files in system tests which require some variables (e.g.
port numbers) filled in during test setup, can now use jinja2 templates
when `jinja2` python package is available.

Any `*.j2` file found within the system test directory will be
automatically rendered with the environment variables into a file
without the `.j2` extension by the pytest runner. E.g.
`ns1/named.conf.j2` will become `ns1/named.conf` during test setup. To
avoid automatic rendering, use `.j2.manual` extension and render the
files manually at test time.

New `templates` pytest fixture has been added. Its `render()` function
can be used to render a template with custom test variables. This can be
useful to fill in different config options during the test. With
advanced jinja2 template syntax, it can also be used to include/omit
entire sections of the config file rather than using `named1.conf.in`,
`named2.conf.in` etc.

(cherry picked from commit 60e118c4fb)
2024-10-31 09:40:46 +00:00
Matthijs Mekking efc790c715 chg: doc: Make inline-signing default value change more clear in documentation
Emphasize more that the `inline-signing` default value has changed in 9.20.0.

Merge branch 'matthijs-improve-release-notes-wrt-inline-signing-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9647
2024-10-30 16:11:01 +00:00
Matthijs Mekking 77d54c03dd Make inline-signing default value change more clear
Emphasize more that the inline-signing default value has changed in
9.20.0.
2024-10-30 15:57:36 +01:00
Nicki Křížek b4c79bdcdf [9.20] chg: ci: Make changelog audience mandatory
Backport of MR !9628

Merge branch 'backport-nicki/harazd-enforce-mr-title-audience-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9696
2024-10-29 16:12:35 +00:00
Nicki Křížek babdac49c8 Make changelog audience mandatory
Use a stricter hazard check which ensures the audience tag is present in
the MR title and is one of the known values. This prevents siuations
where incorrect audience is accidentally used, resulting in a missing
changelog entry or a release note.

(cherry picked from commit cdb93bcbd4)
2024-10-29 16:03:31 +00:00
Matthijs Mekking 7995ebf009 [9.20] fix: test: Fix CID 510858: Null ptr derefs in check_keys
Coverity Scan reported a new issue for the ksr system test. There is allegedly a null pointer dereference (FORWARD_NULL) in check_keys().

This popped up because previously we set 'retired' to 0 in case of unlimited lifetime, but we changed it to None.

It is actually a false positive, because if lifetime is unlimited there will be only one key in 'keys'.

However, the code would be better if we always initialized 'active' and if it is not the first key and retired is set, set the successor key's active time to the retire time of the predecessor key.

Closes #5004

Backport of MR !9687

Merge branch 'backport-5004-cid-510858-ksr-check-keys-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9693
2024-10-25 14:08:04 +00:00
Matthijs Mekking 5c724d4c25 Fix CID 510858: Null ptr derefs in check_keys
Coverity Scan reported a new issue for the ksr system test. There
is allegedly a null pointer dereference (FORWARD_NULL) in check_keys().

This popped up because previously we set 'retired' to 0 in case of
unlimited lifetime, but we changed it to None.

It is actually a false positive, because if lifetime is unlimited
there will be only one key in 'keys'.

However, the code would be better if we always initialized 'active'
and if it is not the first key and retired is set, set the successor
key's active time to the retire time of the predecessor key.

(cherry picked from commit e777efb576)
2024-10-25 11:22:26 +00:00
Matthijs Mekking c905bf1c71 [9.20] fix: test: Fix intermittent ksr test failure
A test may fail if the key id is shorter than 5 digits. Add a leading space to the expected strings which start with the key tag to avoid the issue.

Closes #5002

Backport of MR !9688

Merge branch 'backport-5002-unexpected-match-ksr-twotwone-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9692
2024-10-25 09:25:27 +00:00
Matthijs Mekking 8a598cb3bf Fix intermittent ksr test failure
The test_ksr_twotwone may fail if the key id is shorter than 5 digits.
Add a leading space to the expected strings which start with the key
tag to avoid the issue.

(cherry picked from commit d5f32f6990)
2024-10-25 07:47:01 +00:00
Nicki Křížek 401964d188 [9.20] fix: test: Make system tests compatible with pytest 8.0.0+
Make system tests symlinks and logged test names consistent across pytest versions.

Backport of MR !9071

Merge branch 'backport-nicki/pytest-v8-compat-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9685
2024-10-24 12:28:25 +00:00
Nicki Křížek 93356d6b3a Add legacy.run.sh to .gitignore
While this file is no longer created / used in the main branch, it may
linger around when switching from maintenance branches.

(cherry picked from commit 6262d002bf)
2024-10-24 11:55:18 +00:00
Nicki Křížek 04200e4025 Make system tests compatible with pytest 8.0.0+
The pytest collection mechanism has been overhauled in pytest 8.0.0,
resulting in a different node tree when collecting the tests. Ensure the
paths / names we're using that are derived from the node tree are
consistent across different pytest versions.

Particularly, this has affected the convenience symlink name (which is
supposed to be in the form of e.g. dns64_sh_dns64 for the dns64 module
and tests_sh_dns64.py module) and the test name that's logged at the
start of the test, which is supposed to include the system test
directory relative to the root system test directory as well as the
module name (e.g. dns64/tests_sh_dns64.py).

Related https://github.com/pytest-dev/pytest/issues/7777

(cherry picked from commit 7118cbed98)
2024-10-24 11:55:18 +00:00
Mark Andrews c1b82c1fb8 [9.20] fix: usr: Use TLS for notifies if configured to do so
Notifies configured to use TLS will now be sent over TLS, instead of plaintext UDP or TCP.
Also, failing to load the TLS configuration for notify now also results in an error.

Closes #4821

Backport of MR !9407

Merge branch 'backport-4821-notify-over-tls-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9684
2024-10-24 06:01:40 +00:00
Timo EisenmannandMark Andrews a9faeb86aa Use correct certificates for TLS notify tests
Use tls-forward-secrecy instead of tls-expired for tls-x2 and regenerate
the expired certificate for tls-x6 to reflect the swap of ns2 and ns3.

(cherry picked from commit bbdc6b26aa)
2024-10-24 03:11:50 +00:00
Mark Andrews 08f12c70e6 swap ns2 and ns3 rolls in tls notify tests
Still need to regenerate the expired certificate as it has
the wrong IP address

(cherry picked from commit 87e287c984)
2024-10-24 03:11:50 +00:00
Timo EisenmannandMark Andrews 1b59467e82 Add system tests for notify over TLS
We use ns2 as the primary, and ns3 as the secondary server.

(cherry picked from commit e00beca8c5)
2024-10-24 03:11:50 +00:00
Timo EisenmannandMark Andrews 7a5b3c39fc Use TLS for notifies if configured to do so
(cherry picked from commit e9d54d798f)
2024-10-24 03:11:50 +00:00
Mark Andrews 09fb8e354a [9.20] fix: dev: Transport needs to be a selector when looking for an existing dispatch
This allows for dispatch to use existing TCP/HTTPS/TLS etc. streams without accidentally using an unexpected transport.

Closes #4989

Backport of MR !9633

Merge branch 'backport-4989-fix-transport-use-with-dispatch-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9682
2024-10-24 01:57:28 +00:00
Mark Andrews d5da28d1ca Fix TCP dispatches and transport
Dispatch needs to know the transport that is being used over the
TCP connection to correctly allow for it to be reused.  Add a
transport parameter to dns_dispatch_createtcp and dns_dispatch_gettcp
and use it when selecting a TCP socket for reuse.

(cherry picked from commit baab8a5d75)
2024-10-24 01:21:37 +00:00
Nicki Křížek 36cac5d27d [9.20] fix: test: Use UTC timezone when handling keys in kasp test library
When working with key timestamps, ensure we correctly set the UTC
timezone in order for the tests to work consistently regardless of the
local time setting.

Closes #4999

Backport of MR !9673

Merge branch 'backport-4999-pytest-kasp-use-utc-timezone-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9679
2024-10-22 11:23:03 +00:00
Nicki Křížek dd73617549 Set TZ to Australia/Sydney for bookworm CI job
Use a different timezone via the TZ variable in at least one of the
system test jobs in order to detect possible issues with timezone
handling in python.

(cherry picked from commit 46810be809)
2024-10-22 10:51:53 +02:00
Nicki Křížek 2cdb8c90d1 Use UTC timezone when handling keys in kasp test library
When working with key timestamps, ensure we correctly set the UTC
timezone in order for the tests to work consistently regardless of the
local time setting.

(cherry picked from commit f840deba33)
2024-10-22 10:51:53 +02:00
Nicki Křížek 7974626482 [9.20] chg: test: Disable too-many/too-few pylint checks
Backport of MR !9626

Merge branch 'backport-nicki/pylint-disable-too-few-too-many-checks-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9656
2024-10-22 08:45:52 +00:00
Nicki Křížek fb9a87e8c5 Disable too-many/too-few pylint checks
Enforcing pylint standards and default for our test code seems
counter-productive. Since most of the newly added code are tests or is
test-related, encountering these checks rarely make us refactor the code
in other ways and we just disable these checks individually. Code that
is too complex or convoluted will be pointed out in reviews anyways.

(cherry picked from commit 7639c58c48)
2024-10-22 09:14:06 +02:00
Matthijs Mekking b9afbd1055 [9.20] chg: test: Rewrite ksr system test to pytest
Backport of MR !9445

Merge branch 'backport-matthijs-pytest-rewrite-ksr-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9648
2024-10-22 07:00:12 +00:00
Matthijs Mekking b46ddad5df Retry dnssec-verify in kasp test code
It is possible that the zone is not yet fully signed because it is
signed in batches. Retry the AXFR and verify command a couple of times.

(cherry picked from commit b8b3df0676)
2024-10-22 06:24:42 +00:00
Nicki KřížekandMatthijs Mekking f1fc2e1db4 Address pylint issues
(cherry picked from commit 3c6124a093)
2024-10-22 06:24:42 +00:00
Nicki KřížekandMatthijs Mekking fafb75ff8e Use difflib rather than diff cmd
(cherry picked from commit b7207fa3e7)
2024-10-22 06:24:42 +00:00
Nicki KřížekandMatthijs Mekking 36ab7489f7 Move algorithm defaults to check_keys()
(cherry picked from commit c9ecd2a618)
2024-10-22 06:24:42 +00:00
Nicki KřížekandMatthijs Mekking ba2fe0a830 Use f-strings
(cherry picked from commit 55ec9f94bc)
2024-10-22 06:24:42 +00:00
Nicki KřížekandMatthijs Mekking 3cffc34551 Simplify command invocation
(cherry picked from commit 732a959d9a)
2024-10-22 06:24:42 +00:00
Nicki KřížekandMatthijs Mekking 00ec96e6e6 Remove unused isctest/kasp code
(cherry picked from commit b5633462bf)
2024-10-22 06:24:42 +00:00
Nicki KřížekandMatthijs Mekking e806d8c6f5 Rename kasp function to check_*
If a function is expected to assert / raise on failure (rather than
return boolean), its name should start with "check_".

(cherry picked from commit 67957d1f54)
2024-10-22 06:24:42 +00:00
Nicki KřížekandMatthijs Mekking f5adeb6800 Use convenience wrappers for kasp key operations
(cherry picked from commit 2b0a8fcfb5)
2024-10-22 06:24:42 +00:00
Matthijs Mekking 288dce213a Convert ksr system test to pytest
Move all test cases from tests.sh to tests_ksr.py. The only test that
is not moved is the check that key id's match expected keys. The
shell-based system test checks two earlier set environment variables
against each other that has become redundant in the pytest variant,
because we now check the signed key response against a list of keys
and for each key we take into account the timing metadata. So we
already ensure that each published key is in the correct key bundle.

(cherry picked from commit a15bf6704b)
2024-10-22 06:24:42 +00:00
Matthijs Mekking 5d0144d006 Introduce pytest kasp library
Write initial pytest kasp library. This contains everything that is
required for testing Offline KSK functionality with pytest.

This includes:
- addtime: adding a value to a timing metadata
- get_timing_metdata: retrieve timing metadata from keyfile
- get_metadata/get_keystate: retrieve metadata from statefile
- get_keytag: retrieve keytag from base keyfile string
- get_keyrole: get key role from statefile
- dnskey_equals: compare DNSKEY record from file against a string
- cds_equals: compare CDS derived from file against a string
- zone_is_signed: wait until a zone is completely signed
- dnssec_verify: verify a DNSSEC signed zone with dnssec-verify
- check_dnssecstatus: check rndc dnssec -status output
- check_signatures: check that signatures for a given RRset are correct
- check_dnskeys: check that the published DNSKEY RRset is correct
- check_cds: check that the published CDS RRset is correct
- check_apex: check SOA, DNSKEY, CDNSKEY, and CDS RRset
- check_subdomain: check an RRset below the apex

(cherry picked from commit a3829990fd)
2024-10-22 06:24:42 +00:00
Matthijs Mekking 761758b0b1 Change dnssec-ksr key sorting
Sort keys on algorithm, then keytag. This is more convenient for
testing.

(cherry picked from commit ea1fc5c47b)
2024-10-22 06:24:42 +00:00
Mark Andrews b46f2376d0 [9.20] fix: usr: Parsing of hostnames in rndc.conf was broken
When DSCP support was removed, parsing of hostnames in rndc.conf was accidentally broken, resulting in an assertion failure.  This has been fixed.

Closes #4991

Backport of MR !9669

Merge branch 'backport-4991-rndc-fix-parsing-hostnames-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9676
2024-10-22 01:14:07 +00:00
Mark Andrews 7116dd327a Add regression test for [GL #4991]
(cherry picked from commit 5a78f6b21b)
2024-10-22 00:12:32 +00:00
Mark Andrews 6918c9d17a Fix parsing of hostnames in rndc.conf
When DSCP was removed the parsing of hostnames was accidentally
broken resulting in an assertion failure.  Call cfg_parse_tuple
rather than using custom code in parse_sockaddrnameport.

(cherry picked from commit 6c095f89f5)
2024-10-22 00:12:32 +00:00
Michal Nowak d233f12080 [9.20] chg: test: Rewrite verify system test to pytest
Backport of MR !9249

Merge branch 'backport-mnowak/pytest_rewrite_verify-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9674
2024-10-21 12:58:32 +00:00
Michal Nowak 771a09ea71 Rewrite verify system test to pytest
(cherry picked from commit 091968f5fa)
2024-10-21 12:01:01 +00:00
Michal Nowak d5c1f00abd [9.20] chg: test: xfail upforwd system test if DNSTAP is enabled
See isc-projects/bind9#4996

Backport of MR !9662

Merge branch 'backport-mnowak/mark-upforwd-xfail-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9672
2024-10-21 11:46:57 +00:00
Michal Nowak f814095b1a xfail upforwd system test if DNSTAP is enabled
(cherry picked from commit 0579e0a429)
2024-10-21 12:58:19 +02:00
Michal Nowak 02ac58e8ea Add with_dnstap mark
(cherry picked from commit a8b70abca1)
2024-10-21 12:58:17 +02:00
Michal Nowak f10bcbaf37 [9.20] fix: doc: All footnotes need to have unique name and be referenced
With Sphinx 8.1.0, footnotes can't stand on their own and have to be
referenced from somewhere, otherwise build fails, e.g.:

    doc/dnssec-guide/signing.rst:1470: WARNING: Footnote [#] is not referenced. [ref.footnote]

Backport of MR !9663

Merge branch 'backport-mnowak/fix-dnssec-guide-footnote-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9670
2024-10-21 07:41:36 +00:00
Michal Nowak be23cd6af0 All footnotes need to have unique name and be referenced
With Sphinx 8.1.0, footnotes can't stand on their own and have to be
referenced from somewhere, otherwise build fails, e.g.:

    doc/dnssec-guide/signing.rst:1470: WARNING: Footnote [#] is not referenced. [ref.footnote]

(cherry picked from commit bdf8859e2d)
2024-10-21 07:27:17 +00:00
Evan Hunt 653b200151 fix: nil: corrected code style errors
- add missing brackets around one-line statements
- add paretheses around return values

Merge branch 'each-style-corrections-bind-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9665
2024-10-18 19:32:22 +00:00
Evan Hunt b5475c9cda corrected code style errors
- add missing brackets around one-line statements
- add paretheses around return values
2024-10-18 19:31:56 +00:00
Mark Andrews f604c31ad2 [9.20] fix: usr: Restore values when dig prints command line
Options of the form `[+-]option=<value>` failed to display the value on the printed command line. This has been fixed.

Closes #4993

Backport of MR !9653

Merge branch 'backport-4993-dig-restore-command-line-values-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9666
2024-10-18 03:55:26 +00:00
Mark Andrews 0be99decb9 Correctly get final token
(cherry picked from commit df5b4ba894)
2024-10-18 02:10:33 +00:00
Mark Andrews b9a4b97367 Restore seperator values
strtok_r is destructive.  Restore the seperators so that the command
line can be properly displayed.

(cherry picked from commit 609d96aa12)
2024-10-18 02:10:33 +00:00
Mark Andrews 747a19bc00 [9.20] fix: usr: 'Recursive-clients 0;' triggers an assertion
BIND 9.20.0 broke `recursive-clients 0;`.  This has now been fixed.

Closes #4987

Backport of MR !9621

Merge branch 'backport-4987-fix-recursive-clients-0-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9654
2024-10-17 22:47:36 +00:00
Mark Andrews 10a599d3e8 Add regression test for [GL #4987]
(cherry picked from commit 677abded6b)
2024-10-17 22:05:22 +00:00
Mark Andrews 887e874e93 Fix recursive-clients 0
Setting recursive-clients 0 triggered an assertion in isc_quota_soft.
This has now been fixed.

(cherry picked from commit 840eaa628d)
2024-10-17 22:05:22 +00:00
Nicki Křížek 14c5d7f551 [9.20] chg: doc: Review BIND ARM (9.20 updates)
Closes #4945

Merge branch '4945-bind-arm-review-from-9-18-28-to-9-20-0' into 'bind-9.20'

See merge request isc-projects/bind9!9508
2024-10-17 13:52:21 +00:00
Suzanne GoldlustandNicki Křížek 998c61c1cf Review and update ARM documentation
Minor edits and fixes for the documentation added from 9.18.28 through
9.20.0.
2024-10-17 13:57:57 +02:00
Michal Nowak 4f9afdfaf1 [9.20] chg: doc: Read the Docs should always source requirements.txt from "main"
HTTP URI of doc/arm/requirements.txt on the "main" branch is the source
of PyPI packages in CI base image. To make it consistent in all
maintained CI branches on RTD, use the HTTP URI as well.

This change is non-material on the "main" branch, but ensures the right
packages on stable branches where for RTD we currently leverage outdated
packages because we failed to update doc/arm/requirements.txt there.

Backport of MR !9630

Merge branch 'backport-mnowak/rtd-always-resource-requirements-txt-from-main-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9660
2024-10-17 11:19:21 +00:00
Michal Nowak a43ed940cd Drop doc/arm/requirements.txt
doc/arm/requirements.txt is maintained only on the "main" branch.
2024-10-17 12:56:41 +02:00
Michal Nowak 325d80430b Read the Docs should always source requirements.txt from "main"
HTTP URI of doc/arm/requirements.txt on the "main" branch is the source
of PyPI packages in CI base image. To make it consistent in all
maintained CI branches on RTD, use the HTTP URI as well.

This change is non-material on the "main" branch, but ensures the right
packages on stable branches where for RTD we currently leverage outdated
packages because we failed to update doc/arm/requirements.txt there.

(cherry picked from commit 8fb6115492)
2024-10-17 10:50:21 +00:00
Michal Nowak b642aab1a1 [9.20] chg: doc: Update Sphinx, docutils, and sphinx_rtd_theme packages
Backport of MR !9652

Merge branch 'backport-mnowak/doc-tools-october-2024-updates-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9658
2024-10-17 10:20:24 +00:00
Michal Nowak bf7ccc5d8d Add RFCs referenced by footnotes
With Sphinx 8.1.0, footnotes can't stand on their own and have
referenced from somewhere:

    /builds/isc-projects/bind9/doc/arm/general.rst:439: WARNING: Footnote [#] is not referenced. [ref.footnote]
    /builds/isc-projects/bind9/doc/arm/general.rst:441: WARNING: Footnote [#] is not referenced. [ref.footnote]
    /builds/isc-projects/bind9/doc/arm/general.rst:445: WARNING: Footnote [#] is not referenced. [ref.footnote]
    /builds/isc-projects/bind9/doc/arm/general.rst:457: WARNING: Footnote [#] is not referenced. [ref.footnote]

(cherry picked from commit 54410e034f)
2024-10-17 10:11:14 +00:00
Michal Nowak 4ec2cbf156 Update Sphinx, docutils, and sphinx_rtd_theme packages
(cherry picked from commit 755dd44ec5)
2024-10-17 10:11:14 +00:00
Michal Nowak 31247b8e2f Merge tag 'v9.20.3' into bind-9.20 2024-10-16 17:53:15 +02:00
Mark Andrews 6d717e88c0 fix: dev: Remove unused <openssl/{hmac,engine}.h> headers from OpenSSL shims
The <openssl/{hmac,engine}.h> headers were unused and including the
<openssl/engine.h> header might cause build failure when OpenSSL
doesn't have Engines support enabled.

See https://fedoraproject.org/wiki/Changes/OpensslDeprecateEngine

Merge branch 'bind-9.20-openssl-engine' into 'bind-9.20'

See merge request isc-projects/bind9!9593
2024-10-16 05:15:25 +00:00
Petr MenšíkandMark Andrews 75a50925f7 Remove unused <openssl/{hmac,engine}.h> headers from OpenSSL shims
The <openssl/{hmac,engine}.h> headers were unused and including the
<openssl/engine.h> header might cause build failure when OpenSSL
doesn't have Engines support enabled.

See https://fedoraproject.org/wiki/Changes/OpensslDeprecateEngine
2024-10-16 04:39:43 +00:00
Michal Nowak a89dd1572d [9.20] chg: test: Remove unused sbytes, stime, n, response, and rtime variables
Backport of MR !9617

Merge branch 'backport-mnowak/drop-unused-variables-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9643
2024-10-15 18:57:09 +00:00
Michal Nowak f4eb2793d3 Add vulture
(cherry picked from commit c0246ecef6)
2024-10-15 18:49:29 +00:00
Michal Nowak 369bbd9dad Remove unused sbytes, stime, n, response, and rtime variables
(cherry picked from commit 4857da271d)
2024-10-15 18:49:29 +00:00
Michal Nowak 666d03a8a3 [9.20] chg: test: Rewrite tools system test to pytest
Backport of MR !9208

Merge branch 'backport-mnowak/pytest_rewrite_tools-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9641
2024-10-15 18:12:23 +00:00
Michal Nowak b5118a7e70 Rewrite tools system test to pytest
(cherry picked from commit 3f8e59330d)
2024-10-15 17:28:37 +00:00
Michal Nowak 95c8c7875f [9.20] chg: doc: Update sphinx to 7.4.7
Backport of MR !9529.

Merge branch 'mnowak/update-sphinx' into 'bind-9.20'

See merge request isc-projects/bind9!9638
2024-10-15 12:36:40 +00:00
Nicki KřížekandMichal Nowak 9f75256c25 Update sphinx to 7.4.7
(cherry picked from commit 3d65fa2740)
2024-10-15 13:43:57 +02:00
Nicki Křížek 0793766d8a [9.20] chg: ci: Allow re-try of unit tests on FreeBSD 14
The unit test doh_test tends do fail quite often due to exceeding run
time limit in the unit:clang:freebsd14:amd64 job. Use a retry on gitlab
level to alleviate the issue until a better fix is available.

Related #4924

Backport of MR !9578

Merge branch 'backport-4924-retry-doh_test-freebsd14-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9637
2024-10-15 11:40:45 +00:00
Nicki Křížek b9708fd42a Allow re-try of unit tests on FreeBSD 14
The unit test doh_test tends do fail quite often due to exceeding run
time limit in the unit:clang:freebsd14:amd64 job. Use a retry on gitlab
level to alleviate the issue until a better fix is available.

(cherry picked from commit 1636864ddb)
2024-10-15 11:40:34 +00:00
Michal Nowak d2067ba142 rem: test: Drop util/release-tarball-comparison.sh
This script is only maintained on the "main" branch.

Merge branch 'mnowak/drop-util-release-tarball-comparison-sh-script' into 'bind-9.20'

See merge request isc-projects/bind9!9629
2024-10-15 11:35:20 +00:00
Michal Nowak acb1626f11 Drop util/release-tarball-comparison.sh
This script is only maintained on the "main" branch.
2024-10-15 11:35:01 +00:00
Nicki Křížek e9c4917903 [9.20] chg: test: Support dnspython 2.7.0
Closes #4988

Backport of MR !9634

Merge branch 'backport-4988-dnspython-2.7.0-support-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9635
2024-10-15 11:06:49 +00:00
Nicki Křížek 1dbeee61f8 Support dnspython 2.7.0
CookieOption with new .server/.client attributes (rather than .data) was
added to dnspython. Adjust the code to use the new attributes if
available and fall back to the old code for dnspython<2.7.0
compatibility.

(cherry picked from commit 0d90b13646)
2024-10-15 10:29:57 +00:00
Mark Andrews 76dc8accd3 [9.20] fix: usr: Fix NSEC3 closest encloser lookup for names with empty non-terminals
The performance improvement for finding the NSEC3 closest encloser when generating authoritative responses could cause servers to return incorrect NSEC3 records in some cases. This has been fixed.

Closes #4950

Backport of MR !9610

Merge branch 'backport-4950-bind-logs-expected-covering-nsec3-got-an-exact-match-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9631
2024-10-15 00:33:14 +00:00
Mark Andrews fd2f1bdf02 Test that the correct NSEC3 closest encloser is returned
(cherry picked from commit b457f64d4a)
2024-10-14 23:55:09 +00:00
Mark Andrews 14bb1f8aa0 Use a binary search to find the NSEC3 closest encloser
maxlabels is the suffix length that corresponds to the latest
NXDOMAIN response.  minlabels is the suffix length that corresponds
to longest found existing name.

(cherry picked from commit 67f31c5046)
2024-10-14 23:55:08 +00:00
Nicki Křížek 39c67a05ae [9.20] chg: ci: Increase shotgun pipeline timeout
When running shotgun tests on tagged releases, the increased number of
jobs may cause the shotgun pipeline to take longer than 50 minutes to
finish.

Backport of MR !9599

Merge branch 'backport-nicki/increase-shotgun-pipeline-timeout-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9624
2024-10-14 11:33:13 +00:00
Nicki Křížek de7b0663f4 Increase shotgun pipeline timeout
When running shotgun tests on tagged releases, the increased number of
jobs may cause the shotgun pipeline to take longer than 50 minutes to
finish.

(cherry picked from commit 3b227e1161)
2024-10-14 11:06:03 +00:00
Matthijs Mekking 11b0f41f80 [9.20] chg: usr: Harden key management when key files have become unavailabe
Prior to doing key management, BIND 9 will check if the key files on disk match the expected keys. If key files for previously observed keys have become unavailable, this will prevent the internal key manager from running.

Backport of MR !9337

Merge branch 'backport-4763-do-not-roll-if-key-files-are-missing-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9622
2024-10-14 09:42:43 +00:00
Matthijs Mekking a71e037ac4 Add new behavior to the ARM
Add text to the ARM that describes what we do in case key files have
become unavailable.

(cherry picked from commit 351c066d91)
2024-10-14 10:04:04 +02:00
Matthijs Mekking 25f39228e0 Test removing DNSKEYs from other providers
In a multi-signer setup, removing DNSKEY records from the zone should
not be treated as a key that previously exists in the keyring, thus
blocking the keymgr. Add a test case to make sure.

(cherry picked from commit 5f552293d7)
2024-10-14 10:03:59 +02:00
Matthijs Mekking 7aaa36f09f Small keymgr improvement
When a key is to be purged, don't run the key state machinery for it.

(cherry picked from commit af54e3dadc)
2024-10-14 10:03:31 +02:00
Matthijs Mekking 80d5b3877a Add additional test case with purged key
Test that if a key to be purged is in the keyring, it does not
prevent the keymgr from running. Normally a key that is in the keyring
should be available again on the next run, but that is not true for
a key that can be purged.

In addition, fix some wait_for_log calls, by adding the missing
'|| ret=1' parts.

(cherry picked from commit a2317425bc)
2024-10-14 10:03:19 +02:00
Matthijs Mekking 24e8e4294a Fix some system test cases
Some test cases were working but for the wrong reasons. These started
to fail when I implemented the first approach for #4763, where the
existence of a DNSKEY together with an empty keyring is suspicious and
would prevent the keymgr from running.

These are:

1. kasp: The multisigner-model2.kasp zone has ZSKs from other providers
   in the zone, but not yet its own keys. Pregenerate signing keys and
   add them to the unsigned zone as well.

2. kasp: The dynamic-signed-inline-signing.kasp zone has a key generated
   and added in the raw version of the zone. But the key file is stored
   outside the key-directory for the given zone. Add '-K keys' to the
   dnssec-keygen command.

(cherry picked from commit d1e263ef13)
2024-10-14 10:03:12 +02:00
Matthijs Mekking 2494275a8e Verify new key files before running keymgr
Prior to running the keymgr, first make sure that existing keys
are present in the new keylist. If not, treat this as an operational
error where the keys are made offline (temporarily), possibly unwanted.

(cherry picked from commit 5fdad05a8a)
2024-10-14 10:03:00 +02:00
Matthijs Mekking 04ae34cff6 Add test for missing key files, don't roll
In this specific case the key files are temporary unavailable, for
example because of an operator error, or a mount failure). In such
cases, BIND should not try to roll over these keys.

(cherry picked from commit a3afbd9d6f)
2024-10-14 07:19:37 +00:00
Artem Boldariev 9aab8cb150 [9.20] fix: dig - always set the default port when doing a UDP query
This change ensures that the port is set before attempting a UDP query. Before that a situation could appear when previous query have completed over a different transport (that uses a dedicated port) and then a UDP query will be attempted over the port of the previous transport.

Backport of !9618.

Merge branch 'artem-debian-bug-1059582-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9619
2024-10-10 19:56:47 +00:00
Artem Boldariev 3585a004b9 dig: always set the default port when doing a UDP query
This commit ensures that the port is set before attempting a UDP
query. Before that a situation could appear when previous query have
completed over a different transport (that uses a dedicated port) and
then a UDP query will be attempted over the port of the previous
transport.

(cherry picked from commit e390ed4421)
2024-10-10 22:13:55 +03:00
Matthijs Mekking f6696418ef [9.20] chg: doc: Add release note for #4460
This release note was missing due to a malformed Merge Request title.

The text is not copied verbatim, but changed to something more release
note-like.

Backport of MR !9598

Merge branch 'backport-4460-add-missing-release-note-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9615
2024-10-10 12:46:40 +00:00
Matthijs Mekking 69d121df3d Add release note for #4460
This release note was missing due to a malformed Merge Request title.

The text is not copied verbatim, but changed to something more release
note-like.

(cherry picked from commit 5860bafc60)
2024-10-10 11:43:06 +00:00
Matthijs Mekking 29c460a4e5 [9.20] fix: dev: Revert "Improve performance when looking for the closest encloser"
Revert "fix: chg: Improve performance when looking for the closest encloser when returning NSEC3 proofs"

This reverts merge request !9436

Closes #4950

Backport of MR !9611

Merge branch 'backport-revert-78d48f7a-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9613
2024-10-10 11:31:18 +00:00
Matthijs Mekking d768dd1f5d Revert "fix: chg: Improve performance when looking for the closest encloser when returning NSEC3 proofs"
This reverts merge request !9436

(cherry picked from commit 0396bf98ee)
2024-10-10 09:29:52 +00:00
Arаm Sаrgsyаn d2ea42e237 [9.20] fix: dev: Fix error path bugs in the manager's "recursing-clients" list management
In two places, after linking the client to the manager's
"recursing-clients" list using the check_recursionquota()
function, the query.c module fails to unlink it on error
paths. Fix the bugs by unlinking the client from the list.

Backport of MR !9586

Merge branch 'backport-aram/unlink-recursing-clients-on-error-paths-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9604
2024-10-09 12:41:06 +00:00
Aram Sargsyan 3b76aa01ba Refactor the way check_recursionquota() is used
Rename check_recursionquota() to acquire_recursionquota(), and
implement a new function called release_recursionquota() to
reverse the action. It helps with decreasing code duplication.

(cherry picked from commit 7bd44a4182)
2024-10-09 11:40:19 +00:00
Aram Sargsyan dbd308436f Fix error path bugs in the "recursing-clients" list management
In two places, after linking the client to the manager's
"recursing-clients" list using the check_recursionquota()
function, the query.c module fails to unlink it on error
paths. Fix the bugs by unlinking the client from the list.

Also make sure that unlinking happens before detaching the
client's handle, as it is the logically correct order, e.g.
in case if it's the last handle and ns__client_reset_cb()
can be called because of the detachment.

(cherry picked from commit 36c4808903)
2024-10-09 11:40:19 +00:00
Arаm Sаrgsyаn dd72a5eb8d [9.20] fix: dev: Fix a data race in dns_zone_getxfrintime()
The dns_zone_getxfrintime() function fails to lock the zone before
accessing its 'xfrintime' structure member, which can cause a data
race between soa_query() and the statistics channel. Add the missing
locking/unlocking pair, like it's done in numerous other similar
functions.

Closes #4976

Backport of MR !9591

Merge branch 'backport-4976-zone-xfrintime-data-race-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9601
2024-10-09 11:37:46 +00:00
Aram Sargsyan 407aba8840 Fix a data race in dns_zone_getxfrintime()
The dns_zone_getxfrintime() function fails to lock the zone before
accessing its 'xfrintime' structure member, which can cause a data
race between soa_query() and the statistics channel. Add the missing
locking/unlocking pair, like it's done in numerous other similar
functions.

(cherry picked from commit ab07803465)
2024-10-09 10:34:28 +00:00
Arаm Sаrgsyаn 47a77a3b12 [9.20] fix: dev: Clean up 'nodetach' in ns_client
The 'nodetach' member is a leftover from the times when non-zero
'stale-answer-client-timeout' values were supported, and currently
is always 'false'. Clean up the member and its usage.

Backport of MR !9592

Merge branch 'backport-aram/cleanup-ns-client-nodetach-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9600
2024-10-09 10:14:27 +00:00
Aram Sargsyan 3a5e683075 Clean up 'nodetach' in ns_client
The 'nodetach' member is a leftover from the times when non-zero
'stale-answer-client-timeout' values were supported, and currently
is always 'false'. Clean up the member and its usage.

(cherry picked from commit b8c068835e)
2024-10-09 09:16:21 +00:00
Michal Nowak c385ae315b chg: doc: Set up version for BIND 9.20.4
Merge branch 'mnowak/set-up-version-for-bind-9.20.4' into 'bind-9.20'

See merge request isc-projects/bind9!9596
2024-10-08 08:40:54 +00:00
Michal Nowak 22f3037d06 Update BIND version to 9.20.4-dev 2024-10-08 10:34:31 +02:00
Michal Nowak 1e2850eb63 Update BIND version for release 2024-10-07 16:35:59 +02:00
Michal Nowak 4b3e705da3 new: doc: Prepare documentation for BIND 9.20.3
Merge branch 'mnowak/prepare-documentation-for-bind-9.20.3' into 'v9.20.3-release'

See merge request isc-private/bind9!744
2024-10-07 14:34:18 +00:00
Michal Nowak 30cbf948b4 Tweak and reword release notes 2024-10-07 10:17:23 +02:00
Michal Nowak e538d6847b Prepare release notes for BIND 9.20.3 2024-10-07 09:50:12 +02:00
Michal Nowak 43e06c84d4 Generate release notes 2024-10-07 09:48:56 +02:00
Michal Nowak 5d561051cb Generate changelog 2024-10-07 09:48:29 +02:00
Ondřej Surý a6692e793c [9.20] fix: dev: Don't enable REUSEADDR on outgoing UDP sockets
The outgoing UDP sockets enabled `SO_REUSEADDR` that allows sharing of the UDP sockets, but with one big caveat - the socket that was opened the last would get all traffic.  The dispatch code would ignore the invalid responses in the dns_dispatch, but this could lead to unexpected results.

Backport of MR !9569

Merge branch 'backport-ondrej/fix-outgoing-UDP-port-selection-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9583
2024-10-02 13:23:19 +00:00
Ondřej Surý 4b4c550cd8 Don't enable SO_REUSEADDR on outgoing UDP sockets
Currently, the outgoing UDP sockets have enabled
SO_REUSEADDR (SO_REUSEPORT on BSDs) which allows multiple UDP sockets to
bind to the same address+port.  There's one caveat though - only a
single (the last one) socket is going to receive all the incoming
traffic.  This in turn could lead to incoming DNS message matching to
invalid dns_dispatch and getting dropped.

Disable setting the SO_REUSEADDR on the outgoing UDP sockets.  This
needs to be done explicitly because `uv_udp_open()` silently enables the
option on the socket.

(cherry picked from commit eec30c33c2)
2024-10-02 12:16:58 +00:00
Ondřej Surý e2058ab461 [9.20] fix: usr: Fix assertion failure when receiving DNS responses over TCP
When matching the received Query ID in the TCP connection,
an invalid received Query ID can very rarely cause assertion
failure.

Closes #4952

Backport of MR !9580

Merge branch 'backport-4952-check-whether-QID-is-not-deleted-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9582
2024-10-02 12:07:49 +00:00
Ondřej Surý b46108b428 Skip TCP dispatch responses that are not ours
When matching the TCP dispatch responses, we should skip the responses
that do not belong to our TCP connection.  This can happen with faulty
upstream server that sends invalid QID back to us.

(cherry picked from commit 4ef316e21e)
2024-10-02 10:45:05 +00:00
Arаm Sаrgsyаn 97fad455d7 [9.20] fix: dev: Don't ignore the local port number in dns_dispatch_add() for TCP
The dns_dispatch_add() function registers the 'resp' entry in
'disp->mgr->qids' hash table with 'resp->port' being 0, but in
tcp_recv_success(), when looking up an entry in the hash table
after a successfully received data the port is used, so if the
local port was set (i.e. it was not 0) it fails to find the
entry and results in an unexpected error.

Set the 'resp->port' to the given local port value extracted from
'disp->local'.

Closes #4969

Backport of MR !9576

Merge branch 'backport-4969-dispatch-tcp-source-port-bug-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9581
2024-10-02 10:44:38 +00:00
Aram Sargsyan ca966c396a Don't ignore the local port number in dns_dispatch_add() for TCP
The dns_dispatch_add() function registers the 'resp' entry in
'disp->mgr->qids' hash table with 'resp->port' being 0, but in
tcp_recv_success(), when looking up an entry in the hash table
after a successfully received data the port is used, so if the
local port was set (i.e. it was not 0) it fails to find the
entry and results in an unexpected error.

Set the 'resp->port' to the given local port value extracted from
'disp->local'.

(cherry picked from commit d49a8f518a)
2024-10-02 09:53:45 +00:00
Ondřej Surý 19e3cd0cd2 [9.20] chg: dev: Use release memory ordering when incrementing reference counter
As the relaxed memory ordering doesn't ensure any memory
synchronization, it is possible that the increment will succeed even
in the case when it should not - there is a race between
atomic_fetch_sub(..., acq_rel) and atomic_fetch_add(..., relaxed).
Only the result is consistent, but the previous value for both calls
could be same when both calls are executed at the same time.

Backport of MR !9460

Merge branch 'backport-ondrej/use-release-memory-ordering-for-reference-counting-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9567
2024-10-02 07:09:54 +00:00
Ondřej Surý 5701bf9dab Use release memory ordering when incrementing reference counter
As the relaxed memory ordering doesn't ensure any memory
synchronization, it is possible that the increment will succeed even
in the case when it should not - there is a race between
atomic_fetch_sub(..., acq_rel) and atomic_fetch_add(..., relaxed).
Only the result is consistent, but the previous value for both calls
could be same when both calls are executed at the same time.

(cherry picked from commit 88227ea665)
2024-10-02 09:09:35 +02:00
Mark Andrews aa078bdd37 [9.20] fix: doc: Restore text about sig validity and SOA expire
When `sig-validity-interval` was obsoleted, the text that the signature validity interval should be multiples of the SOA expire interval was removed. Restore this text to the description of the `signatures-validity` option.

Closes #4951

Backport of MR !9566

Merge branch 'backport-4951-document-signatures-validity-soa-expire-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9573
2024-10-02 07:01:05 +00:00
Matthijs MekkingandMark Andrews 2267394f0a Update example.com zone SOA expire value
The example.com zone file given in the "Configurations and Zone Files"
chapter has an SOA expire of 3 weeks, which is not a multiple of
the default signatures-validity value. Adjust the SOA expire so that
it is much lower than the signatures-validity default.

(cherry picked from commit 8aa94931c3)
2024-10-02 05:28:22 +00:00
Matthijs MekkingandMark Andrews e25f165bdd Restore text about sig validity and SOA expire
When `sig-validity-interval` was obsoleted, the text that the signature
validity interval should be multiples of the SOA expire interval was
removed. Restore this text to the description of the
`signatures-validity` option.

(cherry picked from commit b09230004b)
2024-10-02 05:28:22 +00:00
Michal Nowak cd2e369aa8 [9.20] chg: test: Replace dns.query module with isctest.query
The `dns.query.udp` and `dns.query.tcp` methods are [prone to timeouts](https://gitlab.isc.org/isc-projects/bind9/-/jobs/4785053); their `isctest.query` equivalents should be used in system tests instead.

Backport of MR !9560

Merge branch 'backport-mnowak/convert-dns-query-udp-and-tcp-to-isctest-query-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9574
2024-10-01 15:04:13 +00:00
Michal Nowak 8252f8cbc4 Replace dns.query module with isctest.query
(cherry picked from commit dfec69b4a2)
2024-10-01 12:06:40 +00:00
Michal Nowak b5bdc3ff30 Add isctest.check.notimp()
(cherry picked from commit a2d2d9c0d3)
2024-10-01 12:06:40 +00:00
Michal Nowak 8f5fcf6441 Report expected and last returned rcode on query timeout
Sometimes it's useful to see what was the server returning that did not
match the expected rcode.

(cherry picked from commit 4cb52f072e)
2024-10-01 12:06:40 +00:00
Mark Andrews 72626cf940 [9.20] fix: usr: Fix a bug in the static-stub implementation
Static-stub addresses and addresses from other sources were being
mixed together, resulting in static-stub queries going to addresses
not specified in the configuration, or alternatively, static-stub
addresses being used instead of the correct server addresses.

Closes #4850

Backport of MR !9314

Merge branch 'backport-4850-add-an-additional-class-of-names-to-adb-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9571
2024-10-01 02:07:40 +00:00
Mark Andrews 7e8ffe3d63 Store static-stub addresses seperately in the adb
Static-stub address and addresses from other sources where being
mixed together resulting in static-stub queries going to addresses
not specified in the configuration or alternatively static-stub
addresses being used instead of the real addresses.

(cherry picked from commit b3a2c790f3)
2024-10-01 01:27:55 +00:00
Mark Andrews cee11c8610 [9.20] new: usr: Log query response status to the query log
Log a query response summary using the new category `responses`.  Logging can be controlled by the option `responselog` and `rndc responselog`.

Closes #459

Backport of MR !9449

Merge branch 'backport-459-log-query-response-status-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9526
2024-09-30 01:14:26 +00:00
Mark Andrews 3c0515b349 Document 'responselog' in the ARM
(cherry picked from commit 452db02c19)
2024-09-30 00:10:47 +00:00
Mark Andrews 39afab41f0 Check responselog behaviour
Extends the resolver system test to to check whether responses are
logged to the query log in addition to the queries.

(cherry picked from commit 61415432ec)
2024-09-30 00:10:47 +00:00
Petr MenšíkandMark Andrews 59770f281c Move common flags logging to shared functions
Query and response log shares the same flags. Move flags logging out of
log_query to share it with log_response. Use buffer instead of snprintf
to fill flags a bit faster.

Signed-off-by: Petr Menšík <pemensik@redhat.com>
(cherry picked from commit e6b19af2dd)
2024-09-30 00:10:47 +00:00
Petr MenšíkandMark Andrews d9d50f6274 Make responselog flags similar to querylog
Remove answer flag from log, log instead count of records for each
message section. Include EDNS version and few flags of response. Add
also status of result.

Still does not include body of responses rrset.

(cherry picked from commit 6f879aba65)
2024-09-30 00:10:47 +00:00
Evan HuntandMark Andrews b9f4a1b029 Reduce code duplication
combined named_server_togglequerylog() and
named_server_toggleresponselog() into named_server_setortoggle().

(cherry picked from commit c4b7dce376)
2024-09-30 00:10:47 +00:00
Mark Andrews 3968813724 Log the rcode returned to for a query
Log to the querylog the rcode of a previous query using
the identifier 'response:' to diffenciate queries from
responses.

(cherry picked from commit 5fad79c92f)
2024-09-30 00:10:47 +00:00
Arаm Sаrgsyаn 5db2ec0739 [9.20] fix: dev: Add a missing rcu_read_unlock() call on exit path
An exit path in the dns_dispatch_add() function fails to get out of
the RCU critical section when returning early. Add the missing
rcu_read_unlock() call.

Backport of MR !9561

Merge branch 'backport-aram/add-missing-rcu_read_unlock-in-dns_dispatch_add-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9564
2024-09-27 14:29:46 +00:00
Aram Sargsyan 346850954c Add a missing rcu_read_unlock() call on exit path
An exit path in the dns_dispatch_add() function fails to get out of
the RCU critical section when returning early. Add the missing
rcu_read_unlock() call.

(cherry picked from commit 4123d59fbc)
2024-09-27 13:53:31 +00:00
Ondřej Surý 5e6594b1f7 [9.20] dev: Add full Alessio's name to .mailmap to fix some of the older commits
Backport of MR !9557

Merge branch 'backport-ondrej/add-alessio-to-.mailmap-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9558
2024-09-26 11:55:07 +00:00
Ondřej Surý 6444583f65 Add full Alessio's name to .mailmap to fix some of the older commits
(cherry picked from commit 1bc9eb0fc8)
2024-09-26 11:51:08 +00:00
Mark Andrews dad3fafe9e [9.20] new: usr: Added WALLET type
Add the new record type WALLET (262).  This provides a mapping from a domain name to a cryptographic currency wallet.  Multiple mappings can exist if multiple records exist.

Closes #4947

Backport of MR !9521

Merge branch 'backport-4947-add-wallet-type-to-named-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9554
2024-09-25 12:49:22 +00:00
Mark Andrews 00287db8ed Add examples of WALLET records
(cherry picked from commit 9b358e6e8b)
2024-09-25 12:07:52 +00:00
Mark Andrews c6045acc41 Add the new record type WALLET (262)
This provides a mapping from a domain name to a cryptographic
currency wallet and is a clone of TXT.

(cherry picked from commit b919b9b4f3)
2024-09-25 12:07:52 +00:00
Arаm Sаrgsyаn d35f654d67 [9.20] fix: usr: Fix the 'rndc dumpdb' command's error reporting
The 'rndc dumpdb' command wasn't reporting errors which
occurred when starting up the database dump process by named,
like, for example, a permission denied error for the
'dump-file' file. This has been fixed. Note, however, that
'rndc dumpdb' performs asynchronous writes, so errors can
also occur during the dumping process, which will not be
reported back to 'rndc', but which will still be logged by
named.

Closes #4944

Backport of MR !9547

Merge branch 'backport-4944-rndc-dumpdb-do-not-ignore-errors-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9553
2024-09-25 10:05:52 +00:00
Aram Sargsyan cc038054e1 Test 'rndc dumpdb' with an unwritable dump-file
Check that with a preexisting dump file without a write permission
no actual dump happens, and rndc returns an error result.

Also add a couple of missing entries in the cleaning script.

(cherry picked from commit 63bddd7192)
2024-09-25 09:11:49 +00:00
Aram Sargsyan 782a570052 Do not ignore named_server_dumpdb() result code
The named_server_dumpdb() function, which is called when a 'rndc dumpdb'
command is issued, returns a 'isc_result_t' result code and it has been
always ignored since its introduction in
eb8713ed94, where it was still called
ns_server_dumpdb(). The orignal reasoning is not preserved, but it could
have been also a simple copy-paste mistake, as there are commands, which
return 'void' and require manually setting 'result = ISC_R_SUCCESS;', as
it was done here. Anyway, named will now return the actual result, and
'rndc' will report an error, when the 'dumpdb' command fails.

(cherry picked from commit 8b866ba8a0)
2024-09-25 09:11:49 +00:00
Nicki Křížek 12fe4d9f75 [9.20] chg: doc: Track changes in separate files
Keep the changelog for each version in a separate source file to avoid
rebase conflicts when handling the -S version.

---

Related !9549 

Closes #4946

Merge branch 'nicki/reorganize-changelog-docfiles-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9550
2024-09-24 14:59:54 +00:00
Nicki Křížek 55af00f6d5 Fix changelog entry for [GL #4759] 2024-09-24 16:13:50 +02:00
Nicki Křížek 9accdf345f Generate changelog to stdout
Since the changes aren't tracked in the single changelog.rst file,
generate the changelog to stdout instead, so it can be easily redirected
to the proper file.
2024-09-24 16:13:50 +02:00
Nicki Křížek 5e771e7735 Track changes in separate files
Keep the changelog for each version in a separate source file to avoid
rebase conflicts when handling the -S version.
2024-09-24 16:13:50 +02:00
Nicki Křížek 2258bd1518 [9.20] chg: ci: Increase the load TCP/DoT shotgun perf tests
Due to the recent improvements to the TCP processing, much higher loads
can be handled by BIND9 without causing client timeouts. The updated
parameters give us useful data for both cold and hot cache testing.

Backport of MR !9494

Merge branch 'backport-nicki/increase-tcp-dot-shotgun-load-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9548
2024-09-24 11:52:55 +00:00
Nicki Křížek c4ba41f498 Increase the load TCP/DoT shotgun perf tests
Due to the recent improvements to the TCP processing, much higher loads
can be handled by BIND9 without causing client timeouts. The updated
parameters give us useful data for both cold and hot cache testing.

(cherry picked from commit e89afd3349)
2024-09-24 11:17:43 +00:00
Mark Andrews b30274bc8c [9.20] fix: test: Check read value in upforwd/ans4
The ans4 server wasn't shutting down cleanly sometimes.  Check that read returns the
expected value for the message length or exit read loop.

Closes #4301

Backport of MR !9537

Merge branch 'backport-4301-check-read-value-in-ans4-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9545
2024-09-24 09:23:57 +00:00
Mark Andrews 2952f8339d Check read value in upforwd/ans4
The ans4 server wasn't shutting down cleanly sometimes.  Check that
read returns the expected value for the message length or exit read
loop.

(cherry picked from commit 21baad0a8f)
2024-09-24 07:29:29 +00:00
Michal Nowak 7c8f0afd44 [9.20] chg: test: Downgrade "timeout" and "attempts" arguments in shutdown
The shutdown system test sends queries when named is shutting down, not
in an attempt to get answers but to destabilize the server into a crash.
With isctest.query.udp() defaulting to try up to ten times with a
ten-second timeout to get a response we don't care about from a likely
terminated server, we make the test run much longer than needed because
of retries and long timeouts.

Also, see isc-projects/bind9#4943.

Backport of MR !9507

Merge branch 'backport-mnowak/shutdown-downgrade-timeout-and-attempts-arguments-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9541
2024-09-23 16:16:02 +00:00
Michal Nowak e7dd232320 Print correct udp/tcp function name in generic_query()
(cherry picked from commit 1c637e96d1)
2024-09-23 15:40:40 +00:00
Michal Nowak 69b116b788 Downgrade "timeout" and "attempts" arguments in shutdown
The shutdown system test sends queries when named is shutting down, not
in an attempt to get answers but to destabilize the server into a crash.
With isctest.query.udp() defaulting to try up to ten times with a
ten-second timeout to get a response we don't care about from a likely
terminated server, we make the test run much longer than needed because
of retries and long timeouts.

(cherry picked from commit 463ab2f3f5)
2024-09-23 15:40:39 +00:00
Michal Nowak f4489d0ded [9.20] chg: ci: Exclude some RPZ files from long stress test artifacts
This fixes 6f86885304, that excluded files
only from short stress tests.

Validation jobs:
- [x] short - [#4756989](https://gitlab.isc.org/isc-projects/bind9/-/jobs/4756989/artifacts/browse/output/ns4/) - 
- [x] long - [#4757196](https://gitlab.isc.org/isc-projects/bind9/-/jobs/4757196/artifacts/browse/output/ns4/)

Backport of MR !9522

Merge branch 'backport-mnowak/exclude-some-rpz-files-from-long-stress-tests-artifacts-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9538
2024-09-23 12:25:11 +00:00
Michal Nowak aed660e57d Exclude some RPZ files from long stress test artifacts
This fixes 6f86885304, that excluded files
only from short stress tests.

(cherry picked from commit 871eeed519)
2024-09-23 11:20:49 +00:00
Ondřej Surý c511535b72 [9.20] chg: ci: Update code formatting
Backport of MR !9533

Merge branch 'backport-nicki/update-code-format-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9534
2024-09-21 11:20:07 +00:00
Nicki KřížekandOndřej Surý 7bb0a15578 Ignore clang-format reformatting commit
(cherry picked from commit 28d4e866c7)
2024-09-21 12:45:45 +02:00
Nicki KřížekandOndřej Surý 5662236fa1 Fix arguments-renamed pylint issue in iscconf.py
The argument name was different in the base class.

(cherry picked from commit 833ea7926c)
2024-09-21 12:45:27 +02:00
Nicki KřížekandOndřej Surý f2fa1b7d63 Update code formatting
clang 19 was updated in the base image.

(cherry picked from commit ebb5bd9c0f)
2024-09-21 12:45:27 +02:00
Ondřej Surý c5cadd29d8 [9.20] fix: usr: Fix long-running incoming transfers
Incoming transfers that took longer than 30 seconds would stop reading from the TCP stream and the incoming transfer would be indefinitely stuck causing BIND 9 to hang during shutdown.

This has been fixed and the `max-transfer-time-in` and `max-transfer-idle-in` timeouts are now honoured.

Closes #4949

Backport of MR !9531

Merge branch 'backport-4949-fix-ignored-and-invalid-dispatch-timeout-in-dns_xfrin-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9536
2024-09-21 10:37:48 +00:00
Ondřej Surý deba4670cb Don't enable timeouts in dns_dispatch for incoming transfers
The dns_dispatch_add() call in the dns_xfrin unit had hardcoded 30
second limit.  This meant that any incoming transfer would be stopped in
it didn't finish within 30 seconds limit.  Additionally, dns_xfrin
callback was ignoring the return value from dns_dispatch_getnext() when
restarting the reading from the TCP stream; this could cause transfers
to get stuck waiting for a callback that would never come due to the
dns_dispatch having already been shut down.

Call the dns_dispatch_add() without a timeout and properly handle the
result code from the dns_dispatch_getnext().

(cherry picked from commit 96ef98558c)
2024-09-21 08:53:25 +00:00
Ondřej Surý 4127068305 Modify dns_dispatch API to accept zero timeout
The dns_dispatch_add() has timeout parameter that could not be 0 (for
not timeout).  Modify the dns_dispatch implementation to accept a zero
timeout for cases where the timeouts are undesirable because they are
managed externally.

(cherry picked from commit 0f810b3144)
2024-09-21 08:53:25 +00:00
Nicki Křížek a0eada5388 [9.20] chg: dev: Restore the number of threadpool threads back to original value
The issue of long-running operations potentially blocking query resolution has been fixed. Revert this temporary workaround and restore the number of threadpool threads.

Related #4898

Backport of MR !9530

Merge branch 'backport-4898-remove-workaround-and-note-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9532
2024-09-20 15:46:12 +00:00
Nicki Křížek a2a4eef5b0 Remove fixed known issue [GL #4898]
(cherry picked from commit 9fc773ce4c)
2024-09-20 14:51:33 +00:00
Nicki Křížek 38fb8bed49 Revert "Double the number of threadpool threads"
This reverts commit 6857df20a4.

(cherry picked from commit 842abe9fbf)
2024-09-20 14:51:33 +00:00
Evan Hunt b1b2ab0cb3 [9.20] chg: minor cleanup in qpcache
when the QP cache was adapted from the RBTDB, some variable names weren't changed, and still incorrectly reference the RBT.

Backport of MR !9515

Merge branch 'backport-each-qpcache-nits-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9525
2024-09-19 22:37:07 +00:00
Evan Hunt c1b94dc622 rename 'rbtiterator' and similar names in qpcache
when the QP cache was adapted from the RBT database, some names
weren't changed. this could be confusing, so let's change them now.
also, we no longer need to include rbt.h.

(cherry picked from commit 5a444838db)
2024-09-19 15:02:23 -07:00
Nicki Křížek 379d7faeac Merge tag 'v9.20.2' into bind-9.20 2024-09-18 18:06:27 +02:00
Arаm Sаrgsyаn 1f553c61f7 [9.20] chg: usr: Set logging category for notify/xfer-in related messages
Some 'notify' and 'xfer-in' related log messages were logged at the
'general' category instead of their own category. This has been fixed.

Closes #2730

Backport of MR !9451

Merge branch 'backport-2730-logging-category-for-notify-and-xfer-related-messages-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9514
2024-09-17 17:45:30 +00:00
Aram Sargsyan 0098ff6456 Set logging category for notify/xfer related messages
Some notify/xfer related log messages are logged at the general
category. Set a more suitable caterogry for those messages.

(cherry picked from commit 7c45caa8a5)
2024-09-17 16:14:52 +00:00
Ondřej Surý 251b90c25e [9.20] fix: usr: Limit the outgoing UDP send queue size
If the operating system UDP queue gets full and the outgoing UDP sending
starts to be delayed, BIND 9 could exhibit memory spikes as it tries to
enqueue all the outgoing UDP messages.  Try a bit harder to deliver the
outgoing UDP messages synchronously and if that fails, drop the outgoing
DNS message that would get queued up and then timeout on the client side.

Closes #4930

Backport of MR !9506

Merge branch 'backport-4930-limit-the-UDP-send-queue-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9511
2024-09-17 15:37:22 +00:00
Ondřej Surý 6bff6df272 Limit the outgoing UDP send queue size
If the operating system UDP queue gets full and the outgoing UDP sending
starts to be delayed, BIND 9 could exhibit memory spikes as it tries to
enqueue all the outgoing UDP messages.  As those are not going to be
delivered anyway (as we argued when we stopped enlarging the operating
system send and receive buffers), try to send the UDP messages directly
using `uv_udp_try_send()` and if that fails, drop the outgoing UDP
message.

(cherry picked from commit b576c4c977)
2024-09-17 16:31:25 +02:00
Alessio Podda 6c9f3d0d1e [9.20] fix: usr: Do not set SO_INCOMING_CPU
We currently set SO_INCOMING_CPU incorrectly, and testing by Ondrej
shows that fixing the issue by setting affinities is worse than letting
the kernel schedule threads without constraints. So we should not set
SO_INCOMING_CPU anymore.

Closes #4936

Backport of MR !9497

Merge branch 'backport-4936-remove-so-incoming-cpu-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9504
2024-09-16 13:39:18 +00:00
alessio 6e42d96cf1 Do not set SO_INCOMING_CPU
We currently set SO_INCOMING_CPU incorrectly, and testing by Ondrej
shows that fixing the issue and setting affinities is worse than letting
the kernel schedule threads without constraints. So we should not set
SO_INCOMING_CPU anymore.

(cherry picked from commit 8b8149cdd2)
2024-09-16 12:57:08 +00:00
Arаm Sаrgsyаn 2287dc0ac0 [9.20] fix: usr: Fix a statistics channel counter bug when 'forward only' zones are used
When resolving a zone with a 'forward only' policy, and
finding out that all the forwarders are marked as "bad",
the 'ServerQuota' counter of the statistics channel was
incorrectly increased. This has been fixed.

Closes #1793

Backport of MR !9493

Merge branch 'backport-1793-serverquota-counter-bug-with-forward-only-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9502
2024-09-16 12:25:19 +00:00
Aram Sargsyan 80dad234ba Add a statistics channel check in the forward system test
Check that the fix in the previous commit works and that the
'ServerQuota' counter in the statistics channel is still unset
after a SERVFAIL result in a 'forward only' zone.

(cherry picked from commit 81b3c5d908)
2024-09-16 09:31:38 +00:00
Aram Sargsyan 59cc292928 Fix a 'serverquota' counter calculation bug
The 'all_spilled' local variable in resolver.c:fctx_getaddresses()
is 'true' by default, and only becomes false when there is at least
one successfully found NS address. However, when a 'forward only;'
configuration is used, the code jumps over the part where it looks
for NS addresses and doesn't reset the 'all_spilled' to false, which
results in incorretly increased 'serverquota' statistics variable,
and also in invalid return error code from the function. The result
code error didn't make any differences, because all codes other than
'ISC_R_SUCCESS' or 'DNS_R_WAIT' were treated in the same way, and
the result code was never logged anywhere.

Set the default value of 'all_spilled' to 'false', and only make it
'true' before actually starting to look up NS addresses.

(cherry picked from commit e430ce7039)
2024-09-16 09:31:38 +00:00
Mark Andrews 12eb16186f [9.20] chg: dev: Remove statslock from dnssec-signzone
Silence Coverity CID 468757 and 468767 (DATA RACE read not locked) by converting dnssec-signzone to use atomics for statistics counters rather than using a lock.

Closes #4939

Backport of MR !9496

Merge branch 'backport-4939-remove-stats-lock-from-dnssec-signzone-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9500
2024-09-16 03:29:39 +00:00
Mark Andrews b33727a202 Remove 'statslock' from dnssec-signzone
Silence Coverity CID 468757 and 468767 (DATA RACE read not locked)
by converting dnssec-signzone to use atomics for statistics counters
rather than using a lock.  This should be marginally faster than
using the lock as well when statistics are requested.

(cherry picked from commit 473cbd4e87)
2024-09-16 02:52:38 +00:00
Ondřej Surý c0022f6802 [9.20] fix: usr: Separate DNSSEC validation from the long-running tasks
As part of the KeyTrap \[CVE-2023-50387\] mitigation, the DNSSEC CPU-intensive operations were offloaded to a separate threadpool that we use to run other tasks that could affect the networking latency.

If that threadpool is running some long-running tasks like RPZ, catalog zone processing, or zone file operations, it would delay DNSSEC validations to a point where the resolving signed DNS records would fail.

Split the CPU-intensive and long-running tasks into separate threadpools in a way that the long-running tasks don't block the CPU-intensive operations.

Closes #4898

Backport of MR !9473

Merge branch 'backport-4898-move-offloaded-DNSSEC-to-own-threads-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9495
2024-09-12 15:46:28 +00:00
Ondřej Surý 26c2cbe63b Move offloaded DNSSEC operations to different helper threads
Currently, the isc_work API is overloaded.  It runs both the
CPU-intensive operations like DNSSEC validations and long-term tasks
like RPZ processing, CATZ processing, zone file loading/dumping and few
others.

Under specific circumstances, when many large zones are being loaded, or
RPZ zones processed, this stops the CPU-intensive tasks and the DNSSEC
validation is practically stopped until the long-running tasks are
finished.

As this is undesireable, this commit moves the CPU-intensive operations
from the isc_work API to the isc_helper API that only runs fast memory
cleanups now.

(cherry picked from commit 8a96a3af6a)
2024-09-12 16:41:02 +02:00
Ondřej Surý 17f23224d1 Add isc_helper API that adds 1:1 thread for each loop
Add an extra thread that can be used to offload operations that would
affect latency, but are not long-running tasks; those are handled by
isc_work API.

Each isc_loop now has matching isc_helper thread that also built on top
of uv_loop.  In fact, it matches most of the isc_loop functionality, but
only the `isc_helper_run()` asynchronous call is exposed.

(cherry picked from commit 6370e9b311)
2024-09-12 14:39:07 +00:00
Michal Nowak f0277b7284 [9.20] chg: test: Replace dns.resolver module in system tests
Closes #4634

Backport of MR !9150

Merge branch 'backport-4634-drop-dns.resolver-module-from-system-tests-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9491
2024-09-12 11:19:04 +00:00
Michal Nowak 944fc02f83 Extract dns.rcode compatibility code to isctest.compat
(cherry picked from commit 8b55d0709d)
2024-09-12 11:17:52 +00:00
Michal Nowak c8c8b36e44 Turn off deadline for wildcard tests
Tests that query BIND need much longer deadline to account for retries,
the default 200ms won't work.

(cherry picked from commit d2e0043ec3)
2024-09-12 11:17:52 +00:00
Michal Nowak 937d7f30eb Extract "custom" named instances support to isctest.run module
(cherry picked from commit 2cec1de43b)
2024-09-12 11:17:52 +00:00
Michal Nowak 531567b0a1 Rework query functions to retry by default
(cherry picked from commit 5929ba0f54)
2024-09-12 11:17:52 +00:00
Michal Nowak f7e03b4f3f Deprecate dns.resolver module in BIND 9 system tests
(cherry picked from commit cb3ffac9a7)
2024-09-12 11:17:52 +00:00
Michal Nowak 555f42754e Replace dns.resolver module in system tests
(cherry picked from commit bfe338b965)
2024-09-12 11:17:52 +00:00
Arаm Sаrgsyаn 3b5c4f94d7 [9.20] fix: dev: Fix data race in offloaded dns_message_checksig()
When verifying a message in an offloaded thread there is a race with
the worker thread which writes to the same buffer. Clone the message
buffer before offloading.

Closes #4929

Backport of MR !9481

Merge branch 'backport-4929-data-race-in-dns_dnssec_verifymessage-memmove-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9490
2024-09-12 10:34:07 +00:00
Aram Sargsyan 65fced42b9 Fix data race in offloaded dns_message_checksig()
When verifying a message in an offloaded thread there is a race with
the worker thread which writes to the same buffer. Clone the message
buffer before offloading.

(cherry picked from commit 35ef25e5ea)
2024-09-12 09:12:35 +00:00
Mark Andrews 02822b70ee [9.20] fix: usr: Don't allow statistics-channel if libxml2 and libjson-c are unsupported
When the libxml2 and libjson-c libraries are not supported, the statistics channel can't return anything useful, so it is now disabled. Use of `statistics-channel` in `named.conf` is a fatal error.

Closes #4895

Backport of MR !9423

Merge branch 'backport-4895-link-style-sheet-to-libxml2-support-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9486
2024-09-12 04:07:13 +00:00
Mark Andrews 4dcfa7b580 Fix named-checkconf and statistics-channels
If neither libxml2 nor libjson_c are available have named-checkconf
fail if a statistics-channels block is specified.

(cherry picked from commit b9246418e8)
2024-09-12 03:27:38 +00:00
Mark Andrews c52a9a5731 Only configure statistics-channels if supported
(cherry picked from commit d0c8c6d7ef)
2024-09-12 03:27:38 +00:00
Mark Andrews b3c0eb9bac Don't create the HTTP server if libxml and libjson-c are unavailable
(cherry picked from commit 31650d9440)
2024-09-12 03:27:38 +00:00
Mark Andrews 592ca7dc19 Don't return the style sheet unless libxml2 is supported
If not statistics are available we don't want the style sheet
returned.

(cherry picked from commit ed81b3ae93)
2024-09-12 03:27:38 +00:00
Mark Andrews e9627cef19 [9.20] fix: test: The statschannel tests fails if one of libxml2 or json-c is configured
The `statschannel` system test failed if only one of `libxml2` or `json-c` is
available / configured as checks were being run against the non available
statistics page.

Closes #4919

Backport of MR !9454

Merge branch 'backport-4919-fix-statschannel-system-test-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9483
2024-09-11 23:42:16 +00:00
Mark Andrews bacc945989 Properly detect when libxml2 or json-c is not available
(cherry picked from commit 7de939609b)
2024-09-11 23:06:55 +00:00
Nicki Křížek 09ec79b3e4 [9.20] chg: doc: Review BIND ARM (9.18 updates)
Forward-port of !9375

Closes #4832

Merge branch '4832-bind-arm-review-from-2022-through-9-18-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9480
2024-09-11 15:11:16 +00:00
Suzanne GoldlustandNicki Křížek 0fa0555dd4 Review and update ARM documentation
Minor edits and fixes for the documentation added from 2022 through
9.18.

(cherry picked from commit b6e4b512dd)
2024-09-11 16:32:33 +02:00
Michal Nowak 117c021082 [9.20] chg: ci: Update code formatting
clang 19 was updated in the base image.

Backport of MR !9475

Merge branch 'backport-mnowak/fix-clang-format-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9477
2024-09-11 09:44:42 +00:00
Michal Nowak 0d1cdf2677 Update to ignore 0aeefb9741 2024-09-11 11:36:56 +02:00
Michal Nowak 0aeefb9741 Update code formatting
clang 19 was updated in the base image.

(cherry picked from commit ff69d07fed)
2024-09-11 09:33:13 +00:00
Nicki Křížek 30c4cbd403 [9.20] chg: usr: allow IXFR-to-AXFR fallback on DNS_R_TOOMANYRECORDS
This change allows fallback from an IXFR failure to AXFR when the reason is `DNS_R_TOOMANYRECORDS`. This is because this error condition could be temporary only in an intermediate version of IXFR transactions and it's possible that the latest version of the zone doesn't have that condition. In such a case, the secondary would never be able to update the zone (even if it could) without this fallback.

This fallback behavior is particularly useful with the recently introduced `max-records-per-type` and `max-types-per-name` options: the primary may not have these limitations and may temporarily introduce "too many" records, breaking IXFR. If the primary side subsequently deletes these records, this fallback will help recover the zone transfer failure automatically; without it, the secondary side would first need to increase the limit, which requires more operational overhead and has its own adverse effect.

Closes #4928

Backport of MR !9333

Merge branch 'backport-fallback-ixfr-to-axfr-on-toomanyrecords-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9471
2024-09-10 13:15:46 +00:00
JINMEI TatuyaandNicki Křížek 33dd3fbca2 allow IXFR-to-AXFR fallback on DNS_R_TOOMANYRECORDS
This change allows fallback from an IXFR failure to AXFR when the
reason is DNS_R_TOOMANYRECORDS. This is because this error condition
could be temporary only in an intermediate version of IXFR
transactions and it's possible that the latest version of the zone
doesn't have that condition. In such a case, the secondary would never
be able to update the zone (even if it could) without this fallback.

This fallback behavior is particularly useful with the recently
introduced max-records-per-type and max-types-per-name options:
the primary may not have these limitations and may temporarily
introduce "too many" records, breaking IXFR. If the primary side
subsequently deletes these records, this fallback will help recover
the zone transfer failure automatically; without it, the secondary
side would first need to increase the limit, which requires more
operational overhead and has its own adverse effect.

This change also fixes a minor glitch that DNS_R_TOOMANYRECORDS wasn't
logged in xfrin_fail.

(cherry picked from commit 7289090683)
2024-09-10 12:39:36 +00:00
Arаm Sаrgsyаn a15d975dbe [9.20] fix: usr: Fix assertion failure when processing access control lists
The named process could terminate unexpectedly when processing access
control lists (ACLs). This has been fixed.

Closes #4908

Backport of MR !9458

Merge branch 'backport-4908-acl-assertion-failure-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9466
2024-09-10 11:26:30 +00:00
Aram Sargsyan 6706d2427e Fix RCU API usage in acl.c
The rcu_xchg_pointer() function can be used outside of a critical
section, and usually must be followed by a synchronize_rcu() or
call_rcu() call to detach from the resource, unless if there are
some guarantees in place because of our own reference counting.

(cherry picked from commit 0367c60759)
2024-09-10 10:34:32 +00:00
Nicki Křížek d42a5be6be [9.20] chg: test: Remove test.skr unit test file
This file was initially created for unit testing, but later code was added to generate the file. The static file should have been removed from the git repo.

Closes #4916

Backport of MR !9450

Merge branch 'backport-4916-skr-unit-test-rm-test-file-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9465
2024-09-10 06:30:42 +00:00
Matthijs MekkingandNicki Křížek c89230efcf Remove test.skr unit test file
This file was initially created for unit testing, but later code was
added to generate the file. The static file should have been removed
from the git repo.

(cherry picked from commit 903534c9a9)
2024-09-09 17:42:05 +00:00
Nicki Křížek 3f115d3cda [9.20] fix: usr: Fix bug in Offline KSK that is using ZSK with unlimited lifetime
If the ZSK has unlimited lifetime, the timing metadata "Inactive" and "Delete" cannot be found and is treated as an error, preventing the zone to be signed. This has been fixed.

Closes #4914

Backport of MR !9447

Merge branch 'backport-4914-offline-ksk-zsk-lifetime-unlimited-bug-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9453
2024-09-09 17:28:11 +00:00
Matthijs MekkingandNicki Křížek 66f850f01c Nit logging change
Fix wrong function name (dns_dnssec_keymgr -> dns_keymgr_run).

Add error log if dns_keymgr_offline() fails.

(cherry picked from commit 911daeb306)
2024-09-09 19:27:28 +02:00
Matthijs MekkingandNicki Křížek fa20a1df39 Fix bug in dns_keymgr_offline
If the ZSK has lifetime unlimited, the timing metadata "Inactive" and
"Delete" cannot be found and is treated as an error. Fix by allowing
these metadata to not exist.

(cherry picked from commit 5af53a329f)
2024-09-09 19:27:28 +02:00
Nicki Křížek 90bec9e287 chg: doc: Set up version for BIND 9.20.3
Merge branch 'nicki/set-up-version-for-bind-9.20.3' into 'bind-9.20'

See merge request isc-projects/bind9!9463
2024-09-09 17:23:58 +00:00
Nicki Křížek 314ba3898d Update BIND version to 9.20.3-dev 2024-09-09 19:21:41 +02:00
Nicki Křížek 66643d6a2a Update BIND version for release 2024-09-09 15:06:19 +02:00
Nicki Křížek caa7c36c2d new: doc: Prepare documentation for BIND 9.20.2
The statements that already exist in the grammar can't be created with
the namedconf:statement. Use a plain definition list for these
statements and add a manual anchor for each one so links to them can be
created.

Avoid using the :any: syntax in the definition lists, as that just
creates a link to the duplicate and completely unrelated statement,
which just makes the documentation more confusing.

Merge branch 'nicki/prepare-documentation-for-bind-9.20.2' into 'v9.20.2-release'

See merge request isc-private/bind9!738
2024-09-09 13:05:30 +00:00
Nicki Křížek a7d1c96b9d Tweak and reword release notes 2024-09-06 15:46:40 +02:00
Nicki Křížek 000b63ad21 Fix dnssec-policy options formatting and links in ARM
The statements that already exist in the grammar can't be created with
the namedconf:statement. Use a plain definition list for these
statements and add a manual anchor for each one so links to them can be
created.

Avoid using the :any: syntax in the definition lists, as that just
creates a link to the duplicate and completely unrelated statement,
which just makes the documentation more confusing.
2024-09-06 15:46:40 +02:00
Nicki Křížek 1e7e69afae Add Known Issue [#GL 4898] 2024-09-06 15:46:40 +02:00
Nicki Křížek f8921652ba Remove a fixed known issue [GL #4793] 2024-09-06 15:44:10 +02:00
Nicki Křížek d6df5aa97f Prepare release notes for BIND 9.20.2 2024-09-06 15:44:10 +02:00
Nicki Křížek a0829e4942 Generate release notes 2024-09-06 15:44:10 +02:00
Nicki Křížek 92588787fb Generate changelog 2024-09-06 15:44:10 +02:00
Nicki Křížek 6ba47269f5 [9.20] chg: dev: Double the number of threadpool threads
Introduce this temporary workaround to reduce the impact of long-running
tasks in offload threads which can block the resolution of queries.

Related isc-projects/bind9#4898

Backport of isc-private/bind9!740

Merge branch 'backport-4898-workaround-double-threadpool-threads-9.20' into 'v9.20.2-release'

See merge request isc-private/bind9!741
2024-09-06 13:40:27 +00:00
Nicki Křížek 4d8491396d Double the number of threadpool threads
Introduce this temporary workaround to reduce the impact of long-running
tasks in offload threads which can block the resolution of queries.

(cherry picked from commit 6857df20a4)
2024-09-06 14:55:38 +02:00
Nicki Křížek 870f0be27e [9.20] fix: usr: Fix an assertion failure in validate_dnskey_dsset_done()
Under rare circumstances, named could terminate unexpectedly
when validating a DNSKEY resource record if the validation
was canceled in the meantime. This has been fixed.

Closes isc-projects/bind9#4911

Backport of isc-private/bind9!731

Merge branch 'backport-4911-assertion-failure-in-validate_dnskey_dsset_done-9.20' into 'v9.20.2-release'

See merge request isc-private/bind9!734
2024-09-04 15:10:34 +00:00
Aram SargsyanandNicki Křížek bf549e32bb Process canceled/shut down results in validate_dnskey_dsset_done()
When a validator is already shut down, val->name becomes NULL. We
need to process and keep the ISC_R_CANCELED or ISC_R_SHUTTINGDOWN
result code before calling validate_async_done(), otherwise, when it
is called with the hardcoded DNS_R_NOVALIDSIG result code, it can
cause an assetion failure when val->name (being NULL) is used in
proveunsecure().

(cherry picked from commit d85918aebf)
2024-09-04 16:23:25 +02:00
Nicki Křížek 02d4755cc3 [9.20] fix: usr: Fix rare assertion failure when shutting down incoming transfer
A very rare assertion failure can be triggered when the incoming transfer is either forcefully shut down or it is finished during printing the details about the statistics channel.  This has been fixed.

Closes #4860

Backport of MR !9336

Merge branch 'backport-4860-destroy-xfrin-timers-on-the-loop-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9377
2024-09-03 16:26:59 +00:00
Ondřej SurýandNicki Křížek 6db9f177b5 Destroy the dns_xfrin isc_timers on the correct loop
There are few places where we attach/detach from the dns_xfrin object
while running on a different thread than the zone's assigned thread -
xfrin_xmlrender() in the statschannel and dns_zone_stopxfr() to name the
two places where it happens now.  In the rare case, when the incoming
transfer completes (or shuts down) in the brief period between the other
thread attaches and detaches from the dns_xfrin, the isc_timer_destroy()
calls would be called by the last thread calling the xfrin_detach().
In the worst case, it would be this other thread causing assertion
failure.  Move the isc_timer_destroy() call to xfrin_end() function
which is always called on the right thread and to match this move
isc_timer_create() to xfrin_start() - although this other change makes
no difference.

(cherry picked from commit 3bca3cb5cf)
2024-09-03 15:51:35 +00:00
Nicki Křížek ce3209b1dc [9.20] chg: usr: Follow the number of CPU set by taskset/cpuset
Administrators may wish to constrain the set of cores that BIND 9 runs on via the 'taskset', 'cpuset' or 'numactl' programs (or equivalent on other O/S).

If the admin has used taskset, the `named` will now follow to automatically use the given number of CPUs rather than the system wide count.

Closes #4884

Backport of MR !9398

Merge branch 'backport-4884-use-cpuset-to-get-number-of-cpus-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9442
2024-09-03 13:52:42 +00:00
Ondřej SurýandNicki Křížek 5255843f9b Follow the number of CPU set by taskset/cpuset
Administrators may wish to constrain the set of cores that BIND 9 runs
on via the 'taskset', 'cpuset' or 'numactl' programs (or equivalent on
other O/S), for example to achieve higher (or more stable) performance
by more closely associating threads with individual NIC rx queues. If
the admin has used taskset, it follows that BIND ought to
automatically use the given number of CPUs rather than the system wide
count.

Co-Authored-By: Ray Bellis <ray@isc.org>
(cherry picked from commit 5a2df8caf5)
2024-09-03 13:52:10 +00:00
Nicki Křížek 36e220646c [9.20] chg: test: Reduce the size of hashmap_nodes.h file
Instead of keeping the whole array of test_node_t objects, just keep the
hashvalues and generated the rest of the test_node_t on the fly.  The
test still works this way and the file size has been reduced from 2M to
90k.

Closes #4851

Backport of MR !9318

Merge branch 'backport-4851-generate-problematic-isc_hashmap-test-data-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9321
2024-09-03 13:24:21 +00:00
Ondřej SurýandNicki Křížek 95faca929e Reduce the size of hashmap_nodes.h file
Instead of keeping the whole array of test_node_t objects, just keep the
hashvalues and generated the rest of the test_node_t on the fly.  The
test still works this way and the file size has been reduced from 2M to
90k.

(cherry picked from commit 2310c322c0)
2024-09-03 14:46:58 +02:00
Mark Andrews 4f01e8d33c [9.20] fix: Address potential TSAN issue with find->status
find->status is a private field of dns_adbfind_t so it now has an accessor function and has been made atomic.

Closes #4802

Backport of MR !9137

Merge branch 'backport-4802-address-potential-tsan-issue-with-find-status-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9433
2024-09-02 05:27:56 +00:00
Mark Andrews 1be660a1a2 Use atomics to access find->status
(cherry picked from commit a45e39d114)
2024-09-02 03:25:35 +00:00
Mark Andrews ce6c0c26a0 Use an accessor fuction to access find->status
find->status is marked as private and access is controlled
by find->lock.

(cherry picked from commit c900300f21)
2024-09-02 03:25:35 +00:00
Mark Andrews a348077718 [9.20] fix: chg: Improve performance when looking for the closest encloser when returning NSEC3 proofs
Use the fact that the database returns the longest matching part of the requested name to find the required NSEC3 record. If there are multiple versions present in the database we may have to search further.

Closes #4460

Backport of MR !9436

Merge branch 'backport-4460-auth-nsec3-many-labels-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9438
2024-08-29 22:37:35 +00:00
Mark Andrews b30bff7dee Return partial match when requested
Return partial match from dns_db_find/dns_db_find when requested
to short circuit the closest encloser discover process.  Most of the
time this will be the actual closest encloser but may not be when
there yet to be committed / cleaned up versions of the zone with
names below the actual closest encloser.

(cherry picked from commit d42ea08f16)
2024-08-29 21:40:16 +00:00
Ondřej Surý 0b7eb9d7a9 [9.20] fix: usr: Delay release of root privileges until after configuring controls
Delay relinquishing root privileges until the control channel has been configured, for the benefit of systems that require root to use privileged port numbers.  This mostly affects systems without fine-grained privilege systems (i.e., other than Linux).

Closes #4793

Backport of MR !9123

Merge branch 'backport-4793-bind-9-19-24-not-listening-to-rndc-port-953-on-localhost-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9444
2024-08-29 18:47:44 +00:00
Evan Hunt 93729a294a Delay release of root privileges until after configuring controls
On systems where root access is needed to configure privileged
ports, we don't want to fully relinquish root privileges until
after the control channel (which typically runs on port 953) has
been established.

named_os_changeuser() now takes a boolean argument 'permanent'.
This allows us to switch the effective userid temporarily with
named_os_changeuser(false) and restore it with named_os_restoreuser(),
before permanently dropping privileges with named_os_changeuser(true).

(cherry picked from commit d57fa148af)
2024-08-29 18:11:58 +00:00
Michal Nowak c5abdfc8f6 [9.20] chg: test: Bump max-recursion-queries to 100 in resolver system test
With max-recursion-queries set to 50 the resolver system test was
unstable in the "checking query resolution for a domain with a valid
glueless delegation chain" check as ns1 replied with SERVFAIL.

Closes #4897

Backport of MR !9435

Merge branch 'backport-4897-resolver-ns1-max-recursion-queries-100-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9440
2024-08-29 15:18:26 +00:00
Michal Nowak f3b54c6688 Bump max-recursion-queries to 100 in resolver system test
With max-recursion-queries set to 50 the resolver system test was
unstable in the "checking query resolution for a domain with a valid
glueless delegation chain" check as ns1 replied with SERVFAIL.

(cherry picked from commit 8e0244d300)
2024-08-29 14:41:48 +00:00
Mark Andrews 498b762177 [9.20] fix: Accessing fctx->state without holding lock
Move lock earlier in the call sequence to address access without lock report.

```
1559        /*
1560         * Caller must be holding the fctx lock.
1561         */
      	
CID 468796: (#1 of 1): Data race condition (MISSING_LOCK)
1. missing_lock: Accessing fctx->state without holding lock fetchctx.lock. Elsewhere, fetchctx.state is written to with fetchctx.lock held 2 out of 2 times.
1562        REQUIRE(fctx->state == fetchstate_done);
1563
1564        FCTXTRACE("sendevents");
1565
1566        LOCK(&fctx->lock);
1567
```

Closes #4902

Backport of MR !9427

Merge branch 'backport-4902-accessing-fctx-state-without-holding-lock-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9437
2024-08-29 13:22:18 +00:00
Mark Andrews a39b4552a9 Move lock earlier in the call sequence
fctx->state should be read with the lock held.

    1559        /*
    1560         * Caller must be holding the fctx lock.
    1561         */

    CID 468796: (#1 of 1): Data race condition (MISSING_LOCK)
    1. missing_lock: Accessing fctx->state without holding lock fetchctx.lock.
       Elsewhere, fetchctx.state is written to with fetchctx.lock held 2 out of 2 times.
    1562        REQUIRE(fctx->state == fetchstate_done);
    1563
    1564        FCTXTRACE("sendevents");
    1565
    1566        LOCK(&fctx->lock);
    1567

(cherry picked from commit 43f0b0e8eb)
2024-08-29 12:46:43 +00:00
Michal Nowak e81e4d0b99 [9.20] chg: ci: Generate TSAN stress test
Backport of MR !9334

Merge branch 'backport-mnowak/generate-tsan-stress-jobs-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9431
2024-08-28 16:20:26 +00:00
Michal Nowak e7d24ddcff Generate TSAN stress test
(cherry picked from commit 338d4c8dd3)
2024-08-28 09:40:21 +00:00
Michal Nowak 9d811a1d7e [9.20] chg: ci: Cleanup stress test artifacts
Backport of MR !9424

Merge branch 'backport-mnowak/avoid-some-artifacts-in-stress-tests-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9428
2024-08-28 08:55:26 +00:00
Michal Nowak 09021e4b92 Some stress test artifacts should not be saved in CI artifact
(cherry picked from commit 6f86885304)
2024-08-28 08:01:23 +00:00
Ondřej Surý 1b7fa52d8f [9.20] fix: dev: Stop using malloc_usable_size and malloc_size
The `malloc_usable_size()` can return size larger than originally allocated and when these sizes disagree the fortifier enabled by `_FORTIFY_SOURCE=3` detects overflow and stops the `named` execution abruptly.  Stop using these convenience functions as they are primary used for introspection-only.

Closes #4880

Backport of MR !9400

Merge branch 'backport-4880-dont-use-malloc_usable_size-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9418
2024-08-26 18:27:19 +00:00
Ondřej Surý 619d21b57c Stop using malloc_usable_size and malloc_size
Although the nanual page of malloc_usable_size says:

    Although the excess bytes can be over‐written by the application
    without ill effects, this is not good programming practice: the
    number of excess bytes in an allocation depends on the underlying
    implementation.

it looks like the premise is broken with _FORTIFY_SOURCE=3 on newer
systems and it might return a value that causes program to stop with
"buffer overflow" detected from the _FORTIFY_SOURCE.  As we do have own
implementation that tracks the allocation size that we can use to track
the allocation size, we can stop relying on this introspection function.

Also the newer manual page for malloc_usable_size changed the NOTES to:

    The value returned by malloc_usable_size() may be greater than the
    requested size of the allocation because of various internal
    implementation details, none of which the programmer should rely on.
    This function is intended to only be used for diagnostics and
    statistics; writing to the excess memory without first calling
    realloc(3) to resize the allocation is not supported.  The returned
    value is only valid at the time of the call.

Remove usage of both malloc_usable_size() and malloc_size() to be on the
safe size and only use the internal size tracking mechanism when
jemalloc is not available.

(cherry picked from commit d61712d14e)
2024-08-26 18:27:01 +00:00
Arаm Sаrgsyаn 5e78cade52 [9.20] chg: usr: Exempt prefetches from the fetches-per-zone and fetches-per-server quotas
Fetches generated automatically as a result of 'prefetch' are now
exempt from the 'fetches-per-zone' and 'fetches-per-server' quotas.
This should help in maintaining the cache from which query responses
can be given.

Closes #4219

Backport of MR !9095

Merge branch 'backport-4219-exempt-good-queries-from-fetch-limits-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9420
2024-08-26 16:29:16 +00:00
Aram Sargsyan e464005903 Document that prefeteches are exempt from select quotas
Add notes to the 'fetches-per-zone' and 'fetches-per-server' clauses
documentation to document that prefetches are exempted.

(cherry picked from commit ad329ddcaa)
2024-08-26 15:54:02 +00:00
Aram Sargsyan c90aa16929 Exempt prefetches from the fetches-per-server quota
Give prefetches a free pass through the quota so that the cache
entries for popular zones could be updated successfully even if the
quota for is already reached.

(cherry picked from commit c7e8b7cf63)
2024-08-26 15:54:02 +00:00
Aram Sargsyan d96fca478a Exempt prefetches from the fetches-per-zone quota
Give prefetches a free pass through the quota so that the cache entry
for a popular zone could be updated successfully even if the quota for
it is already reached.

(cherry picked from commit cada2de31f)
2024-08-26 15:54:01 +00:00
Michal Nowak fad5d1ada5 [9.20] chg: ci: Drop removed system tests from cross-version-config-tests
The cross-version-config-tests job fails when a system test is removed
from the upcoming release. To avoid this, remove the system test also
from the $BIND_BASELINE_VERSION.

See the failure mode at https://gitlab.isc.org/isc-projects/bind9/-/jobs/4668947.

Backport of MR !9413

Merge branch 'backport-mnowak/remove-dialup-from-cross-version-config-tests-job-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9415
2024-08-26 15:20:07 +00:00
Michal Nowak b3902a3871 Drop removed system tests from $BIND_BASELINE_VERSION
The cross-version-config-tests job fails when a system test is removed
from the upcoming release. To avoid this, remove the system test also
from the $BIND_BASELINE_VERSION.

(cherry picked from commit 60f5f2a9d9)
2024-08-26 14:32:46 +00:00
Petr Špaček 57a9e3da00 [9.20] fix: dev: Preserve statement tag order in documentation
This supports bit-for-bit reproducibility of built documentation.

Closes #4886

Backport of MR !9399

Merge branch 'backport-issue-4886/order-preserving-documentation-tags-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9408
2024-08-23 14:43:09 +00:00
Petr Špaček 12c240dd56 Disallow duplicate statement tags in docs
I can't think of a use-case for them, so let's simplify code and treat
them as an invalid input.

(cherry picked from commit 5b832126b3)
2024-08-23 14:02:16 +00:00
James AddisonandPetr Špaček 7880e1e73a Preserve de-duplicated tag order in documentation
The 'set' datatype in Python does not provide iteration-order
guarantees related to insertion-order.  That means that its
usage in the 'split_csv' helper function during documentation
build can produce nondeterministic results.

That is non-desirable for two reasons: it means that the
documentation output may appear to vary unnecessarily between
builds, and secondly there could be loss-of-information in cases
where tag order in the source documentation is significant.

This patch implements order-preserving de-duplication of tags,
allowing authors to specify tags using intentional priority
ordering, while also removing tags that appear more than once.

(cherry picked from commit 5a79b36f56)
2024-08-23 14:02:16 +00:00
Petr Špaček 3e6c2d6ed7 [9.20] new: ci: Automate parts of MR workflow
Backport of MR !9244

Merge branch 'backport-pspacek/post-merge-ci-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9401
2024-08-23 08:17:56 +00:00
Petr Špaček 4f04079727 Remove milestone check from dangerfile
Milestone is automatically set by 'merged-metadata' CI job to 'Not
released yet' so it does not matter what the original value was.

(cherry picked from commit 73b950dc29)
2024-08-23 07:58:29 +00:00
Petr Špaček 84e7550631 Remove 'Release notes' label check from dangerfile
This label is now handled automatically by 'merged-metadata' CI job.

(cherry picked from commit 146743d5a3)
2024-08-23 07:58:29 +00:00
Petr Špaček 23cd27689b Remove 'No CHANGES' check from dangerfile
This label is now handled automatically by 'merged-metadata' CI job.

(cherry picked from commit edf0e6415a)
2024-08-23 07:58:29 +00:00
Petr Špaček 19fd63b15b Automatically adjust MR metadata after merge
1. Set milestone to 'Not released yet' after merge
   We will set milestone to actual version number when we actually tag a
   particular version. This will get rid of mass MR reassignment when we
   do last minute changes to a release plan etc.

2. Adjust No CHANGES and Release Notes MR labels to match gitchangelog
   workflow.

(cherry picked from commit d1c64d588b)
2024-08-23 07:58:28 +00:00
Petr Špaček 77ff5dc762 Mark backports CI job as non-interruptible
Previously CI job for the autobackport bot inherited "interruptible:
true" global configuration. This caused premature termination of the job
when another merge was finished before the autobackport job ran to
completion.

(cherry picked from commit 3165261ecd)
2024-08-23 07:58:28 +00:00
Mark Andrews d089963263 [9.20] new: usr: Support restricted key tag range when generating new keys
It is useful when multiple signers are being used
to sign a zone to able to specify a restricted
range of range of key tags that will be used by an
operator to sign the zone.  This adds controls to
named (dnssec-policy), dnssec-signzone, dnssec-keyfromlabel and
dnssec-ksr (dnssec-policy) to specify such ranges.

Closes #4830

Backport of MR !9258

Merge branch 'backport-4830-support-restricted-key-tag-range-when-generating-new-keys-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9396
2024-08-22 23:03:16 +00:00
Mark Andrews 20632b9f44 Add bad dnssec-policy range variants test examples
(cherry picked from commit bb653d37e0)
2024-08-23 08:05:16 +10:00
Mark Andrews fab6d0e021 Add a multi-signer where the key tag range changes
(cherry picked from commit 62469afe71)
2024-08-23 08:05:16 +10:00
Mark Andrews 3ec77a2f92 Use key tag ranges when generating multisigner keys
(cherry picked from commit 266530d473)
2024-08-23 08:05:16 +10:00
Mark Andrews 6e51d5b04b Check that dnssec-keygen honours key tag ranges
(cherry picked from commit d165466125)
2024-08-23 08:05:16 +10:00
Mark Andrews 2c8fd5337c Document dnssec-policy keys range directive
Co-authored-by: Suzanne Goldlust <sgoldlust@isc.org>
(cherry picked from commit c088772191)
2024-08-23 08:05:16 +10:00
Mark Andrews 4c980c2a51 Add good dnssec-policy tag-range variants test examples
(cherry picked from commit e7decd7a65)
2024-08-23 08:05:16 +10:00
Mark Andrews 1f1440c1b9 Check key tag range when matching dnssec keys to kasp keys
(cherry picked from commit 035289be71)
2024-08-23 08:05:16 +10:00
Mark Andrews e3dedfb981 Add optional range directive to keys in dnssec-policy
(cherry picked from commit c5bc0a1805)
2024-08-23 08:05:16 +10:00
Mark Andrews a5c3e3b9f7 Add the concept of allowed key tag ranges to kasp
(cherry picked from commit 25bf77fac6)
2024-08-23 07:44:13 +10:00
Mark Andrews 57c7c5452a Document -M tag_min:tag_max
A new argument has been added to dnssec-keygen and dnssec-keyfromlabel
to restrict the tag value of key generated / imported to a particular
range.  This is intended to be used by multi-signers.

Co-authored-by: Suzanne Goldlust <sgoldlust@isc.org>
(cherry picked from commit 0c347fb321)
2024-08-23 07:44:11 +10:00
Mark Andrews 79f9a10eb6 Add restrict key tag range support
to dnssec-keygen and dnssec-keyfromlabel.

(cherry picked from commit 329e5eee9b)
2024-08-23 07:42:21 +10:00
Matthijs Mekking 2f2003c55d [9.20] fix: usr: Fix algoritm rollover bug when there are two keys with the same keytag
If there is an algorithm rollover and two keys of different algorithm share the same keytags, then there is a possibility that if we check that a key matches a specific state, we are checking against the wrong key. This has been fixed by not only checking for matching key tag but also key algorithm.

Closes #4878

Backport of MR !9381

Merge branch 'backport-4878-fix-algorithm-rollover-keytag-conflict-bug-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9393
2024-08-22 12:58:06 +00:00
Matthijs Mekking d0db5c07f8 Fix algorithm rollover bug wrt keytag conflicts
If there is an algorithm rollover and two keys of different algorithm
share the same keytags, then there is a possibility that if we check
that a key matches a specific state, we are checking against the wrong
key.

Fix this by not only checking for matching key id but also key
algorithm.

(cherry picked from commit f37eb33f29)
2024-08-22 12:58:00 +00:00
Matthijs Mekking b7bc6abdfe Adjust kasp system test to get keys which signed
If there is a keytag conflict between keys with different algorithms,
we need to supply what key algorithm is used so we can get the right
public key.

For clarity, print the algorithm on the found keys after 'check_keys'.

(cherry picked from commit 7bb6d82505)
2024-08-22 12:58:00 +00:00
Michal Nowak abe82a52c4 [9.20] chg: ci: Revert "Workaround temporary cross-version-config-tests limitation"
With the release of BIND 9.19.25 this workaround is not needed anymore.

This reverts commit c58dd6e78f.

Backport of MR !9065

Merge branch 'backport-mnowak/revert-workaround-temporary-cross-version-config-tests-limitation-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9395
2024-08-22 10:53:40 +00:00
Michal Nowak abc58b2796 Revert "Workaround temporary cross-version-config-tests limitation"
With the release of BIND 9.19.25 this workaround is not needed anymore.

This reverts commit c58dd6e78f.

(cherry picked from commit 125059caef)
2024-08-22 10:45:01 +00:00
Matthijs Mekking 3555094a68 [9.20] new: usr: Support for Offline KSK implemented
Add a new configuration option `offline-ksk` to enable Offline KSK key management. Signed Key Response (SKR) files created with `dnssec-ksr` (or other program) can now be imported into `named` with the new `rndc skr -import` command. Rather than creating new DNSKEY, CDS and CDNSKEY records and generating signatures covering these types, these records are loaded from the currently active bundle from the imported SKR. 

The implementation is loosely based on: https://www.iana.org/dnssec/archive/files/draft-icann-dnssec-keymgmt-01.txt

Closes #1128

Backport of MR !9119

Merge branch 'backport-1128-offline-ksk-rndc-import-skr-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9389
2024-08-22 10:17:23 +00:00
Matthijs Mekking 762f78e150 Add a section for Offline KSK to the DNSSEC Guide
This will describe in more detail the operational practices of
Offline KSK.

(cherry picked from commit d504f4f20b)
2024-08-22 10:17:08 +00:00
Matthijs Mekking c92ae2b010 Add skr unit test
Add a test file for testing the skr related code.

(cherry picked from commit 1ce163795e)
2024-08-22 10:17:08 +00:00
Matthijs Mekking f4624281dc Disable some behavior in offline-ksk mode
Some things we no longer want to do when we are in offline-ksk mode.

1. Don't check for inactive and private keys if the key is a KSK.
2. Don't update the TTL of DNSKEY, CDS and CDNSKEY RRset, these come
   from the SKR.

(cherry picked from commit 2e3068ed60)
2024-08-22 10:17:08 +00:00
Matthijs Mekking 282d32c3d8 Retrieve RRSIG from SKR
When it is time to generate a new signature (dns_dnssec_sign), rather
than create a new one, retrieve it from the SKR.

(cherry picked from commit 61cf599fbf)
2024-08-22 10:17:08 +00:00
Matthijs Mekking 75f7118a92 Don't read private key files for offline KSKs
When we are appending contents of a DNSKEY rdataset to a keylist,
don't attempt to read the private key file of a KSK when we are in
offline-ksk mode.

(cherry picked from commit 30d20b110e)
2024-08-22 10:17:08 +00:00
Matthijs Mekking 56814221fd Update key states in offline-ksk mode
With offline-ksk enabled, we don't run the keymgr because the key
timings are determined by the SKR. We do update the key states but
we derive them from the timing metadata.

Then, we can skip a other tasks in offline-ksk mode, like DS checking
at the parent and CDS synchronization, because the CDS and CDNSKEY
RRsets also come from the SKR.

(cherry picked from commit 2190aa904f)
2024-08-22 10:17:08 +00:00
Matthijs Mekking 6f6d000103 Apply SKR bundle on rekey
When a zone has a skr structure, lookup the currently active bundle
that contains the right key and signature material.

(cherry picked from commit 63e058c29e)
2024-08-22 10:17:08 +00:00
Matthijs Mekking f516e461fd Implement SKR import
When 'rndc skr import' is called, read the file contents and store the
data in the zone's skr structure.

(cherry picked from commit 037382c4a5)
2024-08-22 10:17:08 +00:00
Matthijs Mekking 27fd4e5687 Add code to store SKR
This added source code stores SKR data. It is loosely based on:
https://www.iana.org/dnssec/archive/files/draft-icann-dnssec-keymgmt-01.txt

A SKR contains a list of signed DNSKEY RRsets. Each change in data
should be stored in a separate bundle. So if the RRSIG is refreshed that
means it is stored in the next bundle. Likewise, if there is a new ZSK
pre-published, it is in the next bundle.

In addition (not mentioned in the draft), each bundle may contain
signed CDS and CDNSKEY RRsets.

Each bundle has an inception time. These will determine when we need
to re-sign or re-key the zone.

(cherry picked from commit 445722d2bf)
2024-08-22 10:17:08 +00:00
Matthijs Mekking 908bf753f9 Test rndc skr import
Test importing a Signed Key Response. Files should be loaded and once
loaded the correct bundle should be used. Alsoe test cases where the
bundle is not the first bundle in the SKR.

(cherry picked from commit afe093258c)
2024-08-22 10:17:08 +00:00
Matthijs Mekking 0fd246ac26 Add option to kasp.sh check_keys to retain found keys
This will come in handy when we are testing offline-ksk where first
we check for ZSKs and then the KSK.

(cherry picked from commit ecd2b79106)
2024-08-22 10:17:08 +00:00
Matthijs Mekking 07de3d8466 Implement dummy 'rndc skr -import' command
Add the code and documentation required to provide KSR import using
rndc.  This is just the command, and the feature is at this point in
time still not implemented.

(cherry picked from commit edbb219fda)
2024-08-22 10:17:08 +00:00
Matthijs Mekking 1813b7877c Add a common setup script for ksr
The previous setup.sh has been moved to ns1/setup.sh, we need a common
setup script to invoke ns1/setup.sh.

(cherry picked from commit 748d98e387)
2024-08-22 10:17:08 +00:00
Matthijs Mekking ad7366853e Update ksr system test to include server
Prepare the system test for tests that require a server to import
created SKR files. This means the test script needs adjustments to
take into account the directory test files are located.

In addition, the check_keys function is renamed to ksr_check_keys
because the name clashes with check_keys from kasp.sh. It also has an
extra parameter added, offset, that can be used to check ksr files that
are created in the past or future.

(cherry picked from commit 367154c1de)
2024-08-22 10:17:08 +00:00
Matthijs Mekking 40bd74b182 Add offline-ksk option
Add a new configuration option to enable Offline KSK key management.

Offline KSK cannot work with CSK because it splits how keys with the
KSK and ZSK role operate. Therefore, one key cannot have both roles.
Add a configuration check to ensure this.

(cherry picked from commit 0598381236)
2024-08-22 10:17:08 +00:00
Petr Špaček 196466e42a chg: ci: Disallow cross-version-test failures
This reverts commit df97088dcf.

Merge branch 'pspacek/disallow-cross-version-test-failures' into 'bind-9.20'

See merge request isc-projects/bind9!9392
2024-08-22 10:09:34 +00:00
Petr Špaček a2e78e5eb2 Revert "Allow failure of cross-version-config due to !9201"
This reverts commit df97088dcf.
2024-08-22 11:25:37 +02:00
Michal Nowak 463ec6b384 [9.20] chg: ci: Update Clang to version 19
These Clang 19-identified issues need to be addressed first:
- [x] isc-projects/bind9!9313
- [x] isc-projects/bind9!9317
- [x] isc-projects/bind9!9316
- [x] isc-projects/bind9!9315

Validation pipelines for backports:
- [x] ~"v9.21" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191211
- [x] ~"v9.20" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191512
- [x] ~"v9.18" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191904

Prereq: isc-projects/images!328

Backport of MR !9296

Merge branch 'backport-mnowak/llvm-19-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9390
2024-08-22 09:09:17 +00:00
Ondřej SurýandMichal Nowak 46069fe5c7 Use clang-format-19 to update formatting
This is purely result of running:

    git-clang-format-19 --binary clang-format-19 origin/main

(cherry picked from commit 7b756350f5)
2024-08-22 08:16:03 +00:00
Michal Nowak 8ed97e5144 Update Clang to version 19
(cherry picked from commit ec62fc1399)
2024-08-22 08:16:03 +00:00
Michal Nowak 3221b3bae1 [9.20] chg: ci: Add FreeBSD 14.1
Prereq: https://gitlab.isc.org/isc-projects/images/-/merge_requests/323

Backport of MR !9116

Merge branch 'backport-mnowak/freebsd-14.1-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9382
2024-08-22 04:20:15 +00:00
Michal Nowak f0f5e783d1 Add FreeBSD 14.1
(cherry picked from commit bca3d09354)
2024-08-22 06:09:51 +02:00
Mark Andrews cfac05cc96 [9.20] chg: dev: Restore the ability to select individual unit tests
This adds the command line arguments: `-d` (debug), `-l` (list tests) and `-t test` (run this test) to the unit tests.

e.g. 
```
    % ./rdata_test -t zonemd
    [==========] selected: Running 1 test(s).
    [ RUN      ] zonemd
    [       OK ] zonemd
    [==========] selected: 1 test(s) run.
    [  PASSED  ] 1 test(s).
    % 
```

Closes #4579

Backport of MR !9384

Merge branch 'backport-4579-restore-the-ability-to-select-individual-unit-tests-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9385
2024-08-22 02:50:34 +00:00
Mark Andrews 394df760b2 Extend ISC_TEST_MAIN for debugging
ISC_TEST_MAIN now supports turning on/off debugging and
running individual tests.

(cherry picked from commit d8a6ff5c3e)
2024-08-22 11:34:42 +10:00
Nicki Křížek ac11357466 Merge tag 'v9.20.1' into bind-9.20 2024-08-21 16:32:33 +02:00
Arаm Sаrgsyаn 1c8eeafffb [9.20] new: usr: Print the full path of the working directory in startup log messages
named now prints its initial working directory during startup and the
changed working directory when loading or reloading its configuration
file if it has a valid 'directory' option defined.

Closes #4731

Backport of MR !9362

Merge branch 'backport-4731-log-workdir-full-path-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9372
2024-08-21 09:26:41 +00:00
Aram Sargsyan 3fc322f07c Print the full path of the working directory in startup log messages
named now prints its initial working directory during startup and the
changed working directory when loading or reloading its configuration
file if it has a valid 'directory' option defined.

(cherry picked from commit fd8e1d161f)
2024-08-21 08:23:48 +00:00
Ondřej Surý 1127b2b3d1 [9.20] chg: dev: Use seteuid()/setegid() instead of setreseuid()/setresgid()
It looks like that all supported systems now have support for
_POSIX_SAVED_IDS, so it's safe to use setegid() and setegid() because
those will not change saved used/group IDs.

Closes #4862

Backport of MR !9363

Merge branch 'backport-4862-just-use-seteuid-and-setegid-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9371
2024-08-20 17:36:35 +00:00
Ondřej Surý 1a657766c3 Use seteuid()/setegid() instead of setreseuid()/setresgid()
It looks like that all supported systems now have support for
_POSIX_SAVED_IDS, so it's safe to use setegid() and setegid() because
those will not change saved used/group IDs.

(cherry picked from commit ab517fc6e4)
2024-08-20 17:36:27 +00:00
Ondřej Surý 77f3919fad [9.20] fix: test: Allow TTL skew in the badcache print unit test
If the machine running the job is extra loaded (or extra slow), the
print test in the badcache unit test would fail because the TTL would be
59 (possibly even lower) and the test expects the badcache.out to only
have TTL 60.  Refactor the test to check for the expected strings and
check whether the TTL is in the expected range.

Closes #4861

Backport of MR !9338

Merge branch 'backport-4861-allow-TTL-skew-in-badcache_test-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9368
2024-08-20 17:33:51 +00:00
Ondřej Surý 673c1c8b96 Allow TTL skew in the badcache print unit test
If the machine running the job is extra loaded (or extra slow), the
print test in the badcache unit test would fail because the TTL would be
59 (possibly even lower) and the test expects the badcache.out to only
have TTL 60.  Refactor the test to check for the expected strings and
check whether the TTL is in the expected range.

(cherry picked from commit 7860b6519d)
2024-08-20 17:33:43 +00:00
Ondřej Surý 662287aab7 [9.20] fix: test: Ignore ISC_R_CONNECTIONRESET in the TCP tests
On FreeBSD, the TCP connection callback could spuriously receive
ISC_R_CONNECTIONRESET even when connection to the loopback interface.
Skip the other checks in such case and graciously shutdown the TCP
connection.

Closes #4849

Backport of MR !9303

Merge branch 'backport-4849-dispatch_test-fails-in-connected_shutdown-on-freebsd-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9366
2024-08-20 17:33:27 +00:00
Ondřej Surý 18398da61c Ignore ISC_R_CONNECTIONRESET in the TCP tests
On FreeBSD, the TCP connection callback could spuriously receive
ISC_R_CONNECTIONRESET even when connection to the loopback interface.
Skip the other checks in such case and graciously shutdown the TCP
connection.

(cherry picked from commit e53cb61cf7)
2024-08-20 12:49:57 +00:00
Petr Špaček 0ccff375e6 [9.20] chg: doc: Improve changelog & release notes workflow
Related: #4847

Backport of MR !9300

Merge branch 'backport-4847-changelog-sorting-and-tweaks-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9364
2024-08-20 12:03:22 +00:00
Nicki Křížek fd60b52366 Omit MR link from release notes
When manually handling the release notes (due to rst markup, fixups
etc.), the different MR number for backports causes needless friction.
Remove the reference from release notes and keep it only in changelog
which isn't manually redacted.

(cherry picked from commit 993ba7cc7f)
2024-08-20 11:51:42 +00:00
Nicki Křížek 9358ce1434 Sort changelog & relnotes entries by issue number
To reduce the friction when handling the release notes, it is preferable
to have the sections sorted by issue number, rather than merge order.
Fallback to commit subject line if unavailable (e.g. for changelog
entries).

(cherry picked from commit 759948fffe)
2024-08-20 11:51:42 +00:00
Ondřej Surý d959c035e8 [9.20] fix: dev: Fix the resesuid() shim implementation for NetBSD
The shim implementation of setresuid() was wrong - there was a copy and
paste error and it was calling setresgid() instead.  This only affects
NetBSD because Linux, FreeBSD and OpenBSD have setresuid() and
setresgid() implementation available from the system library.

Closes #4862

Backport of MR !9359

Merge branch 'backport-4862-fix-setresuid-shim-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9361
2024-08-20 11:07:26 +00:00
Ondřej Surý 6d59dcf167 Fix the resesuid() shim implementation for NetBSD
The shim implementation of setresuid() was wrong - there was a copy and
paste error and it was calling setresgid() instead.  This only affects
NetBSD because Linux, FreeBSD and OpenBSD have setresuid() and
setresgid() implementation available from the system library.

(cherry picked from commit 5567407a82)
2024-08-20 10:24:32 +00:00
Petr Špaček 97e95a0869 chg: doc: Set up version for BIND 9.20.2
Merge branch 'nicki/set-up-version-and-release-notes-for-bind-9.20.2' into 'bind-9.20'

See merge request isc-projects/bind9!9357
2024-08-20 09:05:17 +00:00
Nicki Křížek cba9def10e Remove release note draft file
Since we've started the new changelog & release notes process, the file
for drafting release notes for the version-to-be is no longer needed.

(cherry picked from commit c795cfec54)
2024-08-19 18:11:00 +02:00
Nicki Křížek f6656c801c Update BIND version to 9.20.2-dev 2024-08-19 18:10:05 +02:00
Nicki Křížek 2b335f2ee3 [9.20] chg: ci: Allow rerun of unstable statschannel tests under TSAN
The test_traffic_json and test_traffic_xml occasionally fail when
running under TSAN. This happens in CI and is most likely a result of
some instability that doesn't seem to be easily reproduced.

Closes #4598

Backport of MR !9293

Merge branch 'backport-4598-mark-statschannel-test-flaky-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9350
2024-08-19 15:53:40 +00:00
Nicki Křížek 441209dd91 Allow rerun of unstable statschannel tests under TSAN
The test_traffic_json and test_traffic_xml occasionally fail when
running under TSAN. This happens in CI and is most likely a result of
some instability that doesn't seem to be easily reproduced.

(cherry picked from commit ec2fc7680a)
2024-08-19 14:14:47 +00:00
Arаm Sаrgsyаn eb2e0991e1 [9.20] chg: dev: Process also the ISC_R_CANCELED result code in rpz_rewrite()
Log canceled resolver queries (e.g. when shutting down a hung
fetch) in DEBUG3 level instead of DEBUG1 which is used for the
"unrecognized" result codes.

Closes #4797

Backport of MR !9148

Merge branch 'backport-4797-rpz_rewrite-add-ISC_R_CANCELED-processing-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9347
2024-08-19 13:56:44 +00:00
Aram Sargsyan 2353771253 Process also the ISC_R_CANCELED result code in rpz_rewrite()
Log  canceled queries (e.g. when shutting down a hung fetch)
in DEBUG3 level instead of DEBUG1 which is used for the
"unrecognized" result codes.

(cherry picked from commit 8bb9568467)
2024-08-19 13:56:27 +00:00
Ondřej Surý b41e7b695f [9.20] fix: test: Add missing fclose() when applying updates failed (rpz/testlib)
In rpz system tests, we could leak file if the applying the updates has
failed.  Add the missing fclose() before returning.

Backport of MR !9317

Merge branch 'backport-ondrej/add-missing-flose-to-rpz-testlib-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9345
2024-08-19 12:16:00 +00:00
Ondřej Surý f1405af84c Add missing fclose() when applying updates failed (rpz/testlib)
In rpz system tests, we could leak file if the applying the updates has
failed.  Add the missing fclose() before returning.

(cherry picked from commit 2855ec8f5f)
2024-08-19 11:51:28 +00:00
Ondřej Surý e3cc5034ab [9.20] chg: dev: Remove code to read and parse /proc/net/if_inet6 on Linux
The getifaddr() works fine for years, so we don't have to
keep the callback to parse /proc/net/if_inet6 anymore.

Closes #4852

Backport of MR !9315

Merge branch 'backport-4852-handle-errors-from-rewind-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9341
2024-08-19 11:50:04 +00:00
Ondřej Surý 97a9e4711c Remove code to read and parse /proc/net/if_inet6 on Linux
The getifaddr() works fine for years, so we don't have to
keep the callback to parse /proc/net/if_inet6 anymore.

(cherry picked from commit 2fbf9757b8)
2024-08-19 11:49:56 +00:00
Ondřej Surý 2a0454f881 Ignore errno returned from rewind() in the interface iterator
The clang-scan 19 has reported that we are ignoring errno after the call
to rewind().  As we don't really care about the result, just silence the
error, the whole code will be removed in the development version anyway
as it is not needed.

(cherry picked from commit dda5ba53df)
2024-08-19 11:49:56 +00:00
Ondřej Surý 335796f32a [9.20] fix: dev: Check the result of dirfd() before calling unlinkat()
Instead of directly using the result of dirfd() in the unlinkat() call,
check whether the returned file descriptor is actually valid.  That
doesn't really change the logic as the unlinkat() would fail with
invalid descriptor anyway, but this is cleaner and will report the right
error returned directly by dirfd() instead of EBADF from unlinkat().

Closes #4853

Backport of MR !9316

Merge branch 'backport-4853-check-result-of-dirfd-in-isc_log-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9343
2024-08-19 11:49:29 +00:00
Ondřej Surý 530f1dd913 Check the result of dirfd() before calling unlinkat()
Instead of directly using the result of dirfd() in the unlinkat() call,
check whether the returned file descriptor is actually valid.  That
doesn't really change the logic as the unlinkat() would fail with
invalid descriptor anyway, but this is cleaner and will report the right
error returned directly by dirfd() instead of EBADF from unlinkat().

(cherry picked from commit 59f4fdebc0)
2024-08-19 10:03:08 +00:00
Ondřej Surý 91cecebf4c [9.20] fix: dev: Change the NS_PER_SEC (and friends) from enum to static const
New version of clang (19) has introduced a stricter checks when mixing
integer (and float types) with enums.  In this case, we used enum {}
as C17 doesn't have constexpr yet.  Change the time conversion constants
to be static const unsigned int instead of enum values.

Closes #4845

Backport of MR !9313

Merge branch 'backport-4845-change-NS_PER_SEC-type-from-enum-to-integer-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9339
2024-08-19 09:54:27 +00:00
Ondřej Surý dc4c0397eb Use constexpr for NS_PER_SEC and friends constants
The contexpr introduced in C23 standard makes perfect sense to be used
instead of preprocessor macros - the symbols are kept, etc.  Define
ISC_CONSTEXPR to be `constexpr` for C23 and `static const` for the older
C standards.  Use the newly introduced macro for the NS_PER_SEC and
friends time constants.

(cherry picked from commit 122a142241)
2024-08-19 09:10:04 +00:00
Ondřej Surý 27a7647559 Change the NS_PER_SEC (and friends) from enum to static const
New version of clang (19) has introduced a stricter checks when mixing
integer (and float types) with enums.  In this case, we used enum {}
as C17 doesn't have constexpr yet.  Change the time conversion constants
to be static const unsigned int instead of enum values.

(cherry picked from commit b03e90e0d4)
2024-08-19 09:10:04 +00:00
Ondřej Surý 4fbb0a146b [9.20] chg: test: For TSAN builds, use libraries from /opt/tsan
The new TSAN images, the TSAN-enabled images install libraries to
opt/tsan, synchronize the configure options and CFLAGS between gcc:tsan
and clang:tsan images and set the PKG_CONFIG_PATH to /opt/tsan/lib.

Additionally, drop Debian bullseye that's EOL now.

Backport of MR !9324

Merge branch 'backport-ondrej/use-staging-tsan-images-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9325
2024-08-16 06:47:32 +00:00
Michal NowakandOndřej Surý 8efa1568ce Retire Debian 11 "bullseye"
A follow-up to isc-projects/bind9!9324.
2024-08-16 08:41:31 +02:00
Ondřej Surý 6b051b028b Remove Debian bullseye jobs
The Debian bullseye has reached end-of-life, remove it from the CI.

(cherry picked from commit d02d6af2b9)
2024-08-16 07:56:36 +02:00
Ondřej Surý d7e73d3ff8 For TSAN builds, use libraries from /opt/tsan
The new TSAN images, the TSAN-enabled images install libraries to
/opt/tsan, synchronize the configure options and CFLAGS between gcc:tsan
and clang:tsan images and set the PKG_CONFIG_PATH to /opt/tsan/lib.

(cherry picked from commit 2a46396f29)
2024-08-15 21:12:39 +00:00
Arаm Sаrgsyаn 11cb376725 [9.20] fix: dev: Check if logconfig is NULL before using it in isc_log_doit()
Check if 'lctx->logconfig' is NULL before using it in isc_log_doit(),
because it's possible that isc_log_destroy() was already called, e.g.
when a 'call_rcu' function wants to log a message during shutdown.

Closes #4842

Backport of MR !9297

Merge branch 'backport-4842-shutdown-crash-in-isc_log_doit-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9323
2024-08-15 14:27:48 +00:00
Aram Sargsyan 864d55081e Check if logconfig is NULL before using it in isc_log_doit()
Check if 'lctx->logconfig' is NULL before using it in isc_log_doit(),
because it's possible that isc_log_destroy() was already called, e.g.
when a 'call_rcu' function wants to log a message during shutdown.

(cherry picked from commit 656e04f48a)
2024-08-15 14:27:29 +00:00
Arаm Sаrgsyаn 9f2061e31e [9.20] fix: dev: Add -Wno-psabi to CFLAGS for x86 (32-bit) builds
GCC 11.1+ emits a note during compilation when there are 64-bit
atomic fields in a structure, because it fixed a compiler bug
by changing the alignment of such fields, which caused ABI change.

Add -Wno-psabi to CFLAGS for such builds in order to silence the
warning. That shouldn't be a problem since we don't expose our
structures to the outside.

Closes #4841

Backport of MR !9319

Merge branch 'backport-4841-alignment-of-_Atomic-long-long-unsigned-int-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9322
2024-08-15 14:07:03 +00:00
Aram Sargsyan 62f68ff71d Add -Wno-psabi to CFLAGS for x86 (32-bit) builds
GCC 11.1+ emits a note during compilation when there are 64-bit
atomic fields in a structure, because it fixed a compiler bug
by changing the alignment of such fields, which caused ABI change.

Add -Wno-psabi to CFLAGS for such builds in order to silence the
warning. That shouldn't be a problem since we don't expose our
structures to the outside.

(cherry picked from commit 867066aa53)
2024-08-15 12:52:39 +00:00
Ondřej Surý dde3847047 [9.20] fix: dev: Silence all warnings that stem from the default config
As we now setup the logging very early, parsing the default config would
always print warnings about experimental (and possibly deprecated)
options in the default config.  This would even mess with commands like
`named -V` and it is also wrong to warn users about using experimental
options in the default config, because they can't do anything about
this.  Add CFG_PCTX_NODEPRECATED and CFG_PCTX_NOEXPERIMENTAL options
that we can pass to cfg parser and silence the early warnings caused by
using experimental options in the default config.

Backport of MR !9304

Merge branch 'backport-ondrej/silence-warnings-from-default-config-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9305
2024-08-15 12:10:08 +00:00
Ondřej Surý 2f1205443e Silence all warnings that stem from the default config
As we now setup the logging very early, parsing the default config would
always print warnings about experimental (and possibly deprecated)
options in the default config.  This would even mess with commands like
`named -V` and it is also wrong to warn users about using experimental
options in the default config, because they can't do anything about
this.  Add CFG_PCTX_NODEPRECATED and CFG_PCTX_NOEXPERIMENTAL options
that we can pass to cfg parser and silence the early warnings caused by
using experimental options in the default config.

(cherry picked from commit 86f1ec34dc)
2024-08-15 12:10:02 +00:00
Ondřej Surý 92e54fa9b7 [9.20] fix: dev: Fix the assertion failure in the isc_hashmap iterator
When the round robin hashing reorders the map entries on deletion, we
were adjusting the iterator table size only when the reordering was
happening at the internal table boundary.  The iterator table size had
to be reduced by one to prevent seeing the entry that resized on
position [0] twice because it migrated to [iter->size - 1] position.

However, the same thing could happen when the same entry migrates a
second time from [iter->size - 1] to [iter->size - 2] position (and so
on) because the check that we are manipulating the entry just in the [0]
position was insufficient.  Instead of checking the position [pos == 0],
we now check that the [pos % iter->size == 0], thus ignoring all the
entries that might have moved back to the end of the internal table.

Closes #4838

Backport of MR !9292

Merge branch 'backport-4838-fix-assertion-failure-in-hashmap-deletion-iterator-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9310
2024-08-15 12:09:33 +00:00
Ondřej Surý 14302330f4 Skip already rehashed positions in the old hashmap table
When iterating through the old internal hashmap table, skip all the
nodes that have been already migrated to the new table.  We know that
all positions with index less than .hiter are NULL.

(cherry picked from commit 3e4d153453)
2024-08-15 12:09:28 +00:00
Ondřej Surý 61b88c56cd Fix the assertion failure in the isc_hashmap iterator
When the round robin hashing reorders the map entries on deletion, we
were adjusting the iterator table size only when the reordering was
happening at the internal table boundary.  The iterator table size had
to be reduced by one to prevent seeing the entry that resized on
position [0] twice because it migrated to [iter->size - 1] position.

However, the same thing could happen when the same entry migrates a
second time from [iter->size - 1] to [iter->size - 2] position (and so
on) because the check that we are manipulating the entry just in the [0]
position was insufficient.  Instead of checking the position [pos == 0],
we now check that the [pos % iter->size == 0], thus ignoring all the
entries that might have moved back to the end of the internal table.

(cherry picked from commit acdc57259f)
2024-08-15 12:09:28 +00:00
Ondřej Surý 54b3fec145 Add known-to-crash static hashmap iterator nodes array
Add second iterator test with a well-known configuration of the nodes
array that causes the last element of the array to migrate two times to
the previous node.

(cherry picked from commit 482eed2e31)
2024-08-15 12:09:28 +00:00
Nicki Křížek 86a0dfbae5 [9.20] chg: ci: Check that generated changelog entry doesn't break docs build
Since changelog entries are now generated from MR title&description,
they aren't sanity checked during a regular docs build. If these contain
special sequences that will be interpreted by sphinx, it might result in
breakage that would have to be amended manually.

Add a CI check to test a doc build with changelog after the MR is merged
to ensure that the docs can be built when generating changelog from
pristine git contents.

Related #4847

Backport of MR !9294

Merge branch 'backport-nicki/add-changelog-entry-check-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9311
2024-08-14 19:15:28 +00:00
Nicki Křížek 1706c571b3 Use python3 in shebang lines for util scripts
Some distributions (notably, debian bookworm) have deprecated the
`python` interpreter in favor of `python3`. Since our scripts are
python3 anyway, use the proper numbered version in shebang to make
scripts easily executable.

(cherry picked from commit 480dcdef9a)
2024-08-14 15:43:34 +00:00
Nicki Křížek 7fd4237978 Check that generated changelog entry doesn't break docs build
Since changelog entries are now generated from MR title&description,
they aren't sanity checked during a regular docs build. If these contain
special sequences that will be interpreted by sphinx, it might result in
breakage that would have to be amended manually.

Add a CI check to test a doc build with changelog after the MR is merged
to ensure that the docs can be built when generating changelog from
pristine git contents.

(cherry picked from commit bf69e8f149)
2024-08-14 15:43:34 +00:00
Nicki Křížek b72b75dd88 [9.20] chg: doc: Fix ordering of gitchangelog replacement regexs
Ensure the issue number in changelog isn't accidentally removed for backport MRs.

Backport of MR !9295

Merge branch 'backport-nicki/fix-gitchangelog-replacement-regexs-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9308
2024-08-14 15:23:27 +00:00
Nicki Křížek 3aee465436 Fix ordering of gitchangelog replacement regexs
Prior to this change, the issue number could be accidentally removed by
the `Backport of` text, depending on the order of the MR description
contents. Ensure all the removals for text in MR descriptions happen
first, and only then run the replacement regex for issue number, which
appends it to the end of the last non-empty line (which will no longer
be removed).

The only removals that happen after the replacement are guaranteed to
always happen after the end of MR description, since they're
auto-generated by gitlab when the merge commit is created, thus won't
affect the line with the issue number.

Also remove the needless isc-private/bind9 replacement. References
to private MRs are already removed by the very first regex.

(cherry picked from commit 37274bebe1)
2024-08-14 15:11:54 +00:00
Petr Špaček 478c83cde3 Update BIND version for release 2024-08-13 17:20:54 +02:00
Petr Špaček df8870b949 Prepare documentation for BIND 9.20.1
Merge branch 'pspacek/prepare-documentation-for-bind-9.20.1' into 'v9.20.1-release'

See merge request isc-private/bind9!729
2024-08-13 15:19:54 +00:00
Petr Špaček a47164216a Add changelog entry for last-minute regression fix 2024-08-13 17:03:33 +02:00
Petr Špaček c57054d793 Prepare documentation for BIND 9.20.1 2024-08-13 16:58:59 +02:00
Petr Špaček ff6c6ec421 Re-apply release note tweaks from the 9.21.0 release 2024-08-13 16:58:59 +02:00
Petr Špaček 4d7bc4084e Re-apply changelog formatting tweaks from the 9.21.0 release 2024-08-13 16:58:59 +02:00
Petr Špaček 7474f25273 Generate release documentation 2024-08-13 16:58:59 +02:00
Michał KępieńandPetr Špaček 07bc236b42 [9.20] fix: usr: reconfigure catz member zones during named reconfiguration
During a reconfiguration named wasn't reconfiguring catalog zones' member zones. This has been fixed.

Backport of MR !695

Closes isc-projects/bind9#4733

Merge branch '4733-fix-catz-member-zones-reconfigure-9.20' into 'v9.20.1-release'

See merge request isc-private/bind9!726
2024-08-13 16:57:50 +02:00
Aram SargsyanandPetr Špaček 27ec6f8561 Non empty 'catalog-zones' implies that 'allow-new-zones' is true
This condition in catalog zone processing functions is checked only
for sanity, so there is no meaning for a log message that normally
shouldn't be ever logged.

(cherry picked from commit 0b3c8ee55e6cda1f2de35aa15f6a4d82d072c309)
2024-08-13 16:57:50 +02:00
Aram SargsyanandPetr Špaček db1162cffe Reconfigure catz member zones during named reconfiguration
During a reconfiguration named doesn't reconfigure catalog zones
member zones. Implement the necessary code to reconfigure catz
member zones.

(cherry picked from commit fd71ed5d73ae2dc968e8782ce652fb8ef257c25e)
2024-08-13 16:57:50 +02:00
Aram SargsyanandPetr Špaček 0cdbdeaeb2 Test that 'rndc reconfig' reconfigures catz member zones
Catalog zone member zones should be reconfigured as all the other
zones during a reconfiguration. Test it by checking whether the newly
added allow-query setting affects a member zone.

(cherry picked from commit cd04b89dba85781c194f22ce6fe358c972a14758)
2024-08-13 16:57:50 +02:00
Ondřej Surý 1db5c6a0d3 [9.20] fix: dev: Don't skip the counting if fcount_incr() is called with force==true (v2)
The fcount_incr() was not increasing counter->count when force was set
to true, but fcount_decr() would try to decrease the counter leading to
underflow and assertion failure.  Swap the order of the arguments in the
condition, so the !force is evaluated after incrementing the .count.

Closes #4846

Backport of MR !9298

Merge branch 'backport-4786-forced-fcount_incr-should-increment-count-and-allowed-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9299
2024-08-13 14:53:28 +00:00
Ondřej Surý 85d9311afe Add fetches-per-zone 40 to qmin/ns5 configuration
The simple change causes assertion failure fixed in the previous commit.

(cherry picked from commit c2c9d8f01b)
2024-08-13 16:08:12 +02:00
Ondřej Surý afb345b0e8 Don't skip the counting if fcount_incr() is called with force==true (v2)
The fcount_incr() was not increasing counter->count when force was set
to true, but fcount_decr() would try to decrease the counter leading to
underflow and assertion failure.  Swap the order of the arguments in the
condition, so the !force is evaluated after incrementing the .count.

(cherry picked from commit 8e86e55af1)
2024-08-13 16:08:12 +02:00
Michal Nowak 085098c6fb [9.20] chg: Make every changelog entry a separate code block
LaTeX in CI and on ReadTheDocs [fails][1] to render a PDF version of ARM if
the Changelog section is included. The running theory is that the
verbatim section of more than twenty thousand lines is too big to meet
LaTeX self-imposed constraints, and it fails with:

    ! TeX capacity exceeded, sorry [main memory size=5000000].

Or it just hangs if extra_mem_bot=30000000 is set in
/etc/texmf/texmf.d/01main_memory_bump.cnf:

    ! Dimension too large.
    \fb@put@frame ...p \ifdim \dimen@ >\ht \@tempboxa

    \fb@putboxa #1\fb@afterfra...
    l.56913 \end{sphinxVerbatim}

Make each BIND 9 release a separate code block to work around the issue.
Further split up the sections for some exceptionally large releases, for
the same reason.

[1]: https://gitlab.isc.org/isc-projects/bind9/-/jobs/4584011

Backport of MR !9266

Merge branch 'backport-mnowak/fix-arm-changelog-section-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9289
2024-08-08 15:08:29 +00:00
Michal Nowak 32a8e2bcd8 Split up changelog into per-release code blocks
LaTeX in CI and on ReadTheDocs fails to render a PDF version of ARM if
the Changelog section is included. The running theory is that the
verbatim section of more than twenty thousand lines is too big to meet
LaTeX self-imposed constraints, and it fails with:

    ! TeX capacity exceeded, sorry [main memory size=5000000].

Or it just hangs if extra_mem_bot=30000000 is set in
/etc/texmf/texmf.d/01main_memory_bump.cnf:

    ! Dimension too large.
    \fb@put@frame ...p \ifdim \dimen@ >\ht \@tempboxa

    \fb@putboxa #1\fb@afterfra...
    l.56913 \end{sphinxVerbatim}

Make each BIND 9 release a separate code block to work around the issue.
Further split up the sections for some exceptionally large releases, for
the same reason.

(cherry picked from commit bc802359b0)
2024-08-08 14:26:34 +00:00
Evan Hunt 42e70b0f0e [9.20] new: usr: Tighten 'max-recursion-queries' and add 'max-query-restarts' option
There were cases in resolver.c when the `max-recursion-queries` quota was ineffective. It was possible to craft zones that would cause a resolver to waste resources by sending excessive queries while attempting to resolve a name. This has been addressed by correcting errors in the implementation of `max-recursion-queries`, and by reducing the default value from 100 to 32.

In addition, a new `max-query-restarts` option has been added which limits the number of times a recursive server will follow CNAME or DNAME records before terminating resolution. This was previously a hard-coded limit of 16, and now defaults to 11.
 
Closes #4741

Backport of MR !9281

Merge branch 'backport-4741-reclimit-restarts-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9282
2024-08-07 22:52:52 +00:00
Evan Hunt 9c292299c0 add +restarts and +maxqueries options to delv
max-query-restarts and max-recursion-queries values can now be set
on the command line in delv for testing purposes.

(cherry picked from commit 0d010ddebe)
2024-08-07 21:12:34 +00:00
Evan Hunt 053e01b9f0 implement 'max-query-restarts'
implement, document, and test the 'max-query-restarts' option
which specifies the query restart limit - the number of times
we can follow CNAMEs before terminating resolution.

(cherry picked from commit 104f3b82fb)
2024-08-07 21:12:34 +00:00
Evan Hunt 5e1e33da6f reduce the max-recursion-queries default to 32
the number of iterative queries that can be sent to resolve a
name now defaults to 32 rather than 100.

(cherry picked from commit 7e3b425dc2)
2024-08-07 21:12:34 +00:00
Evan Hunt 74d94707cd make "max_restarts" a configurable value
MAX_RESTARTS is no longer hard-coded; ns_server_setmaxrestarts()
and dns_client_setmaxrestarts() can now be used to modify the
max-restarts value at runtime. in both cases, the default is 11.

(cherry picked from commit c5588babaf)
2024-08-07 21:12:34 +00:00
Evan Hunt be3b660e54 reduce MAX_RESTARTS to 11
the number of steps that can be followed in a CNAME chain
before terminating the lookup has been reduced from 16 to 11.
(this is a hard-coded value, but will be made configurable later.)

(cherry picked from commit 05d78671bb)
2024-08-07 21:12:34 +00:00
Evan Hunt d201355739 add debug logging when creating or attaching to a query counter
fctx_create() now logs at debug level 9 when the fctx attaches
to an existing counter or creates a new one.

(cherry picked from commit 825f3d68c5)
2024-08-07 21:12:34 +00:00
Evan Hunt 6c941eda7e apply max-recursion-queries quota to validator queries
previously, validator queries for DNSKEY and DS records were
not counted toward the quota for max-recursion-queries; they
are now.

(cherry picked from commit af7db89513)
2024-08-07 21:12:34 +00:00
Evan Hunt 3fd795d84d attach query counter to NS fetches
there were cases in resolver.c when queries for NS records were
started without passing a pointer to the parent fetch's query counter;
as a result, the max-recursion-queries quota for those queries started
counting from zero, instead of sharing the limit for the parent fetch,
making the quota ineffective in some cases.

(cherry picked from commit d3b7e92783)
2024-08-07 21:12:34 +00:00
Ondřej Surý 3de13146e8 [9.20] chg: test: Use new images with TSAN-enabled libraries
The new Fedora 40 TSAN images use libuv, urcu and OpenSSL libraries compiled with ThreadSanitizer.  This (in theory) should enable better detection of memory races in those (most important) libraries.

Backport of MR !9264

Merge branch 'backport-ondrej/test-new-tsan-images-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9276
2024-08-07 15:36:49 +00:00
Ondřej Surý dff915c7e6 Add configure for libraries in /usr/local for the gcc:tsan job
The TSAN-enabled libraries are installed to /usr/local, pass the
PKG_CONFIG_PATH and few other options to CFLAGS to the configure
arguments.

(cherry picked from commit ed766efc15)
2024-08-07 15:36:18 +00:00
Ondřej Surý 54b24fb015 [9.20] fix: dev: Disassociate the SSL object from the cached SSL_SESSION
When the SSL object was destroyed, it would invalidate all SSL_SESSION
objects including the cached, but not yet used, TLS session objects.

Properly disassociate the SSL object from the SSL_SESSION before we
store it in the TLS session cache, so we can later destroy it without
invalidating the cached TLS sessions.

Closes #4834

Backport of MR !9271

Merge branch 'backport-4834-detach-SSL-from-cached-SSL_SESSION-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9274
2024-08-07 15:25:37 +00:00
Ondřej Surý bbf34c0604 Disassociate the SSL object from the cached SSL_SESSION
When the SSL object was destroyed, it would invalidate all SSL_SESSION
objects including the cached, but not yet used, TLS session objects.

Properly disassociate the SSL object from the SSL_SESSION before we
store it in the TLS session cache, so we can later destroy it without
invalidating the cached TLS sessions.

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Artem Boldariev <artem@isc.org>
Co-authored-by: Aram Sargsyan <aram@isc.org>
(cherry picked from commit c11b736e44)
2024-08-07 15:25:29 +00:00
Ondřej Surý 24ac7a7cd2 [9.20] fix: dev: Attach/detach to the listening child socket when accepting TLS
When TLS connection (TLSstream) connection was accepted, the children
listening socket was not attached to sock->server and thus it could have
been freed before all the accepted connections were actually closed.

In turn, this would cause us to call isc_tls_free() too soon - causing
cascade errors in pending SSL_read_ex() in the accepted connections.

Properly attach and detach the children listening socket when accepting
and closing the server connections.

Closes #4833

Backport of MR !9270

Merge branch 'backport-4833-tlssock-needs-to-attach-to-child-tlslistener-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9273
2024-08-07 15:17:24 +00:00
Ondřej Surý c6daaa4b8c Attach/detach to the listening child socket when accepting TLS
When TLS connection (TLSstream) connection was accepted, the children
listening socket was not attached to sock->server and thus it could have
been freed before all the accepted connections were actually closed.

In turn, this would cause us to call isc_tls_free() too soon - causing
cascade errors in pending SSL_read_ex() in the accepted connections.

Properly attach and detach the children listening socket when accepting
and closing the server connections.

(cherry picked from commit 684f3eb8e6)
2024-08-07 15:16:50 +00:00
Petr Špaček d8d49c9340 [9.20] fix: pkg: Fix --enable-tracing build on systems without dtrace
Missing file util/dtrace.sh prevented builds on system without dtrace utility.
This has been corrected.

Fixes: #4835

Backport of MR !9262

Merge branch 'backport-pspacek/gitattribute-fixes-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9272
2024-08-07 14:23:00 +00:00
Petr Špaček a59b649214 Include util/dtrace.sh in tarballs
(cherry picked from commit 9abedb7757)
2024-08-07 13:58:46 +00:00
Petr Špaček 3d9785f518 Remove obsolete reference to mksymtbl.pl
This was a leftover from commit c463808992

(cherry picked from commit 50b8d9b674)
2024-08-07 13:58:46 +00:00
Petr Špaček c5f1cb8a04 [9.20] fix: dev: Make hypothesis optional for system tests
Ensure that system tests can be executed without Python hypothesis
package.

Closes #4831

Backport of MR !9265

Merge branch 'backport-4831-isctest-make-hypothesis-optional-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9267
2024-08-07 12:10:43 +00:00
Nicki KřížekandPetr Špaček 4d2239d169 Make hypothesis optional for system tests
Ensure that system tests can be executed without Python hypothesis
package.

(cherry picked from commit e6a7695600)
2024-08-07 12:10:35 +00:00
Michał Kępień b277a6f1f0 [9.20] fix: usr: Dig now reports missing query section for opcode QUERY
Query responses should contain the question section with some exceptions.  Dig was not reporting this.

Closes #4808

Backport of MR !9233

Merge branch 'backport-4808-have-dig-report-missing-question-section-in-axfr-response-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9269
2024-08-07 12:02:37 +00:00
Mark AndrewsandMichał Kępień 813b8e9b12 Dig now reports a missing question section
The question section should be present in the first AXFR/IXFR
response and in other QUERY responses unless no question was sent.
Issue a warning if the question section is not present.

(cherry picked from commit 327e890910)
2024-08-07 13:20:27 +02:00
Nicki Křížek 520ad2d206 [9.20] chg: test: Improve crypto support detection and algorithm selection in pytest
Ensure that the selected algorithms remains stable throughout the entire test session. Crypto support detection was rewritten to python and simplified.

Closes #4202

Closes #4422 

Related #3810

Backport of MR !8803

Merge branch 'backport-4202-algorithm-detection-pytest-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9201
2024-08-05 15:55:09 +00:00
Nicki Křížek df97088dcf Allow failure of cross-version-config due to !9201
When attempting to run the system tests using v9.20.0 code, the test
setup will fail with ERROR due to setup.sh calling conf.sh which
attempts to call get_algorithms.py script which was deleted in this MR.

This should be reverted once v9.20.1 with the updated code is released.
2024-08-05 17:54:11 +02:00
Nicki Křížek dbe059c545 Initialize all environment variables when running isctest
Ensure all the variables are initialized when running the main function
of isctest module. This enables proper environment variables during test
script development when only conf.sh is sourced, rather than the script
being executed by the pytest runner.

(cherry picked from commit d7ace928b5)
2024-08-05 17:54:11 +02:00
Tom KrizekandNicki Křížek 257730f30b Replace testcrypto.sh invocations in tests
Use the provided environment variables instead.

(cherry picked from commit fc84bf80e4)
2024-08-05 17:54:11 +02:00
Tom KrizekandNicki Křížek 87a45f4646 Rewrite testcrypto.sh into python
Run the crypto support checks when initializing the isctest package and
save those results in environment variable. This removes the need to
repeatedly check for crypto operation support, as it's not something
that would change at test runtime.

(cherry picked from commit 25cb39b7fc)
2024-08-05 17:54:10 +02:00
Tom KrizekandNicki Křížek 9f97452b5d Move test algorithm configuration to isctest
Instead of invoking get_algorithms.py script repeatedly (which may yield
different results), move the algorithm configuration to an isctest
module. This ensures the variables are consistent across the entire test
run.

(cherry picked from commit 8302db407c)
2024-08-05 17:54:09 +02:00
Nicki Křížek f8a0c0bed6 [9.20] fix: usr: Fix assertion failure in the glue cache
Fix an assertion failure that could happen as a result of data race between free_gluetable() and addglue() on the same headers.

Closes #4691

Backport of MR !9126

Merge branch 'backport-4691-fix-data-race-between-free_gluetable-and-addglue-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9256
2024-08-05 15:52:37 +00:00
Ondřej Surý 46cfebac58 Fix the glue table in the QP and RBT zone databases
When adding glue to the header, we add header to the wait-free stack to
be cleaned up later which sets wfc_node->next to non-NULL value.  When
the actual cleaning happens we would only cleanup the .glue_list, but
since the database isn't locked for the time being, the headers could be
reused while cleaning the existing glue entries, which creates a data
race between database versions.

Revert the code back to use per-database-version hashtable where keys
are the node pointers.  This allows each database version to have
independent glue cache table that doesn't affect nodes or headers that
could already "belong" to the future database version.

(cherry picked from commit 5beae5faf9)
2024-08-05 14:43:18 +00:00
Ondřej Surý 4281aaab45 [9.20] fix: dev: don't use 'create' flag unnecessarily in findnode()
when searching the cache for a node so that we can delete an rdataset, it isn't necessary to set the 'create' flag. if the
node doesn't exist yet, we won't be able to delete anything from it anyway.

Backport of MR !9158

Merge branch 'backport-each-minor-findnode-refactor-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9253
2024-08-05 14:25:26 +00:00
Evan HuntandOndřej Surý b4fc8e6294 minor findnode optimization
when searching the cache for a node so that we can delete an
rdataset, it is not necessary to set the 'create' flag. if the
node doesn't exist yet, we then we won't be able to delete
anything from it anyway.

(cherry picked from commit 6b720bfe1a)
2024-08-05 14:25:17 +00:00
Ondřej Surý 074c7cc12c [9.20] fix: usr: Raise the log level of priming failures
When a priming query is complete, it's currently logged at level ISC_LOG_DEBUG(1), regardless of success or failure. We are now raising it to ISC_LOG_NOTICE in the case of failure. [GL #3516]

Closes #3516

Backport of MR !9121

Merge branch 'backport-3516-log-priming-errors-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9250
2024-08-05 14:05:12 +00:00
Evan HuntandOndřej Surý f840b44401 raise the log level of priming failures
when a priming query is complete, it's currently logged at
level ISC_LOG_DEBUG(1), regardless of success or failure. we
are now raising it to ISC_LOG_NOTICE in the case of failure.

(cherry picked from commit a84d54c6ff)
2024-08-05 13:06:54 +00:00
Ondřej Surý e00b13ac6e [9.20] chg: dev: call rcu_barrier() in the isc_mem_destroy() just once
The previous work in this area was led by the belief that we might be
calling call_rcu() from within call_rcu() callbacks.  After carefully
checking all the current callback, it became evident that this is not
the case and the problem isn't enough rcu_barrier() calls, but something
entirely else.

Call the rcu_barrier() just once as that's enough and the multiple
rcu_barrier() calls will not hide the real problem anymore, so we can
find it.

Backport of MR !9134

Merge branch 'backport-4607-call-a-single-rcu_barrier-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9247
2024-08-05 11:39:35 +00:00
Ondřej Surý b0ba2b72e6 Call rcu_barrier() in the isc_mem_destroy() just once
The previous work in this area was led by the belief that we might be
calling call_rcu() from within call_rcu() callbacks.  After carefully
checking all the current callback, it became evident that this is not
the case and the problem isn't enough rcu_barrier() calls, but something
entirely else.

Call the rcu_barrier() just once as that's enough and the multiple
rcu_barrier() calls will not hide the real problem anymore, so we can
find it.

(cherry picked from commit 13941c8ca7)
2024-08-05 11:39:30 +00:00
Ondřej Surý 42e84e4b97 [9.20] fix: usr: Fix assertion failure when checking named-checkconf version
Checking the version of `named-checkconf` would end with assertion failure.  This has been fixed.

Closes #4827

Backport of MR !9243

Merge branch 'backport-4827-cleanup-dst-only-if-initialized-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9246
2024-08-05 11:12:12 +00:00
Ondřej Surý 3cb97454cc Fix assertion failure when checking named-checkconf version
The dst_lib_destroy() should be called only if dst_lib_init() was called
before.  In named-checkconf, that is guarded by dst_cleanup variable
that was erroneously set to true by default.  Set the dst_cleanup to
'false' by default.

(cherry picked from commit c54880e3fa)
2024-08-05 11:12:05 +00:00
Ondřej Surý 2438db2eae [9.20] fix: usr: Valid TSIG signatures with invalid time cause crash
An assertion failure triggers when the TSIG has valid cryptographic signature, but the time is invalid. This can happen when the times between the primary and secondary servers are not synchronised.

Closes #4811

Backport of MR !9234

Merge branch 'backport-4811-fix-isc_buffer_putuint48-buffer-size-requirement-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9245
2024-08-05 11:11:47 +00:00
Ondřej Surý ac170e8c5b Add a system test that sends TSIG with bad time
Add a system test that sets TSIG fudge to 0, waits three seconds and
then sends signed message to the server.  This tests the path where the
time difference between the client and the server is outside of the TSIG
fudge value.

(cherry picked from commit 8def0c3b12)
2024-08-05 11:11:40 +00:00
Ondřej Surý 0e1d47c171 Add tsig unit test for bad time and bad signatures
The tsig unit test was only testing if everything went ok, but it was
not testing whether the error paths work.  Add two more unit tests - one
uses the time outside of the TSIG skew, and the second trashes the
signature with random data.

(cherry picked from commit 3835d75f00)
2024-08-05 11:11:40 +00:00
Ondřej Surý 506138ec0f Fix the assertion failure when putting 48-bit number to buffer
When putting the 48-bit number into a fixed-size buffer that's exactly 6
bytes, the assertion failure would occur as the 48-bit number is
internally represented as 64-bit number and the code was checking if
there is enough space for `sizeof(val)`.  This causes assertion failure
when otherwise valid TSIG signature has a bad timing information.

Specify the size of the argument explicitly, so the 48-bit number
doesn't require 8-byte long buffer.

(cherry picked from commit 37dbd57c16)
2024-08-05 11:11:40 +00:00
Ondřej Surý 4f369af51e [9.20] chg: dev: Don't open route socket if we don't need it
When automatic-interface-scan is disabled, the route socket was still being opened. Add new API to connect / disconnect from the route socket only as needed.

Additionally, move the block that disables periodic interface rescans to a place where it actually have access to the configuration values. Previously, the values were being checked before the configuration was loaded.

Backport of https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/9122

Merge branch '4757-dont-open-routing-socket-if-not-needed-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9239
2024-08-05 10:17:15 +00:00
Ondřej Surý 36265057f9 Don't open route socket if we don't need it
When automatic-interface-scan is disabled, the route socket was still
being opened.  Add new API to connect / disconnect from the route socket
only as needed.

Additionally, move the block that disables periodic interface rescans to
a place where it actually have access to the configuration values.
Previously, the values were being checked before the configuration was
loaded.

(cherry picked from commit b26079fdaf)
2024-08-05 10:17:08 +00:00
Ondřej Surý 9cd2880a82 [9.20] fix: dev: Don't skip the counting if fcount_incr() is called with force==true
The fcount_incr() was incorrectly skipping the accounting for the fetches-per-zone if the force argument was set to true. We want to skip the accounting only when the fetches-per-zone is completely disabled, but for individual names we need to do the accounting even if we are forcing the result to be success.

Backport of https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/9115

Merge branch 'backport-4786-forced-fcount_incr-should-still-increment-count-and-allowed-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9241
2024-08-05 09:40:33 +00:00
Ondřej Surý 6df4fa58fd Don't skip the counting if fcount_incr() is called with force==true
The fcount_incr() was incorrectly skipping the accounting for the
fetches-per-zone if the force argument was set to true.  We want to skip
the accounting only when the fetches-per-zone is completely disabled,
but for individual names we need to do the accounting even if we are
forcing the result to be success.

(cherry picked from commit a513d4c07f)
2024-08-05 09:40:25 +00:00
Ondřej Surý 46caf5f4a4 [9.20] fix: dev: Fix PTHREAD_MUTEX_ADAPTIVE_NP and PTHREAD_MUTEX_ERRORCHECK_NP usage
The PTHREAD_MUTEX_ADAPTIVE_NP and PTHREAD_MUTEX_ERRORCHECK_NP are usually not defines, but enum values, so simple preprocessor check doesn't work.

Check for PTHREAD_MUTEX_ADAPTIVE_NP from the autoconf AS_COMPILE_IFELSE block and define HAVE_PTHREAD_MUTEX_ADAPTIVE_NP. This should enable adaptive mutex on Linux and FreeBSD.

As PTHREAD_MUTEX_ERRORCHECK actually comes from POSIX and Linux glibc does define it when compatibility macros are being set, we can just use PTHREAD_MUTEX_ERRORCHECK instead of PTHREAD_MUTEX_ERRORCHECK_NP.

Backport of https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/9111

Merge branch 'backport-ondrej/fix-adaptive-mutex-use-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9240
2024-08-05 09:13:14 +00:00
Ondřej Surý 80738e98bd Fix PTHREAD_MUTEX_ADAPTIVE_NP and PTHREAD_MUTEX_ERRORCHECK_NP usage
The PTHREAD_MUTEX_ADAPTIVE_NP and PTHREAD_MUTEX_ERRORCHECK_NP are
usually not defines, but enum values, so simple preprocessor check
doesn't work.

Check for PTHREAD_MUTEX_ADAPTIVE_NP from the autoconf AS_COMPILE_IFELSE
block and define HAVE_PTHREAD_MUTEX_ADAPTIVE_NP.  This should enable
adaptive mutex on Linux and FreeBSD.

As PTHREAD_MUTEX_ERRORCHECK actually comes from POSIX and Linux glibc
does define it when compatibility macros are being set, we can just use
PTHREAD_MUTEX_ERRORCHECK instead of PTHREAD_MUTEX_ERRORCHECK_NP.

(cherry picked from commit cc4f99bc6d)
2024-08-05 09:13:07 +00:00
Ondřej Surý 5d76ef21f0 Remove ISC_MUTEX_INITIALIZER
It's hard to get it right on different platforms and it's unused
in BIND 9 anyway.

(cherry picked from commit f158884344)
2024-08-05 09:13:07 +00:00
Ondřej Surý 34847e7e32 Remove defunct --with-locktype configure option
The --with-locktype configure option was no-op, so it was removed.

(cherry picked from commit c33bf0de8d)
2024-08-05 09:13:07 +00:00
Ondřej Surý 4098157e6c [9.20] fix: test: Use LC_ALL to override all system locales
The system tests were overriding the local locale by setting LANG to C.
This does not override the locale in case there are individual LC_<*>
variables like LC_CTYPE explicitly set.

Use LC_ALL=C instead which is the proper way of overriding all currently
set locales.

Backport of MR !9109

Merge branch 'backport-ondrej/use-LC_ALL-not-LANG-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9235
2024-08-05 08:49:14 +00:00
Ondřej Surý cf77491a5d Use LC_ALL to override all system locales
The system tests were overriding the local locale by setting LANG to C.
This does not override the locale in case there are individual LC_<*>
variables like LC_CTYPE explicitly set.

Use LC_ALL=C instead which is the proper way of overriding all currently
set locales.

(cherry picked from commit 10147efc87)
2024-08-05 07:34:20 +00:00
Mark Andrews 53738634c3 [9.20] fix: usr: Remove extra newline from yaml output
I split this into two commits, one for the actual newline removal, and one for issues I found, ruining the yaml output when some errors were outputted.

Closes: #4772

Backport of MR !9112

Merge branch 'backport-yaml-indent-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9231
2024-08-05 05:17:26 +00:00
Yedaya KatsmanandMark Andrews e258727739 Remove newlines from dighost errors calls
Not all invocations had it, and this makes it more consistent with
dighost_warning. Also remove the conditional newline when not outputting
yaml

(cherry picked from commit 1dd76fe780)
2024-08-05 03:40:36 +00:00
Yedaya KatsmanandMark Andrews a41c52e226 Remove extra newline from +yaml output
The newlines weren't needed for the yaml syntax, and took up space.

(cherry picked from commit 8986dda74a)
2024-08-05 03:40:36 +00:00
Mark Andrews b6298b394e [9.20] fix: dev: CID 498025 and CID 498031: Overflowed constant INTEGER_OVERFLOW
Add INSIST to fail if the multiplication would cause the variables to overflow.

Closes #4798

Backport of MR !9131

Merge branch 'backport-4798-cid-498025-and-cid-498031-overflowed-constant-integer_overflow-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9229
2024-08-05 01:09:34 +00:00
Mark Andrews 25466b18a2 Prevent overflow of bufsize
If bufsize overflows we will have an infinite loop.  In practice
this will not happen unless we have made a coding error.  Add an
INSIST to detect this condition.

    181retry:
    182        isc_buffer_allocate(mctx, &b, bufsize);
    183        result = dns_rdata_totext(rdata, NULL, b);
    184        if (result == ISC_R_NOSPACE) {
    185                isc_buffer_free(&b);

    CID 498031: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression bufsize, which is equal to 0, overflows
    the type that receives it, an unsigned integer 32 bits wide.
    186                bufsize *= 2;
    187                goto retry;
    188        }

(cherry picked from commit 20ac13fb23)
2024-08-04 23:52:16 +00:00
Mark Andrews 754e2f028a Prevent overflow of size
If size overflows we will have an infinite loop.  In practice
this will not happen unless we have made a coding error.  Add
an INSIST to detect this condition.

    181        while (!done) {
    182                isc_buffer_allocate(mctx, &b, size);
    183                result = dns_rdata_totext(rdata, NULL, b);
    184                if (result == ISC_R_SUCCESS) {
    185                        printf("%.*s\n", (int)isc_buffer_usedlength(b),
    186                               (char *)isc_buffer_base(b));
    187                        done = true;
    188                } else if (result != ISC_R_NOSPACE) {
    189                        check_result(result, "dns_rdata_totext");
    190                }
    191                isc_buffer_free(&b);

    CID 498025: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression size, which is equal to 0, overflows the type that
    receives it, an unsigned integer 32 bits wide.
    192                size *= 2;
    193        }

(cherry picked from commit e7ef0a60ab)
2024-08-04 23:52:16 +00:00
Petr Špaček 7939166564 [9.20] new: doc: Clarify how to print default dnssec-policy
Backport of MR !9092

Merge branch 'backport-pspacek/doc-dnssec-policy-default-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9225
2024-08-02 09:15:30 +00:00
Petr Špaček 90af20349e Clarify how to print default dnssec-policy
Reading the source tree is unnecessarily complicated, we now have
command line option to print defaults.

(cherry picked from commit 1e1334a322)
2024-08-02 08:27:49 +00:00
Mark Andrews 067f87f158 [9.20] fix: dev: Remove unnecessary operations
Decrementing optlen immediately before calling continue is unneccesary
and inconsistent with the rest of dns_message_pseudosectiontoyaml
and dns_message_pseudosectiontotext.  Coverity was also reporting
an impossible false positive overflow of optlen (CID 499061).

    4176                        } else if (optcode == DNS_OPT_CLIENT_TAG) {
    4177                                uint16_t id;
    4178                                ADD_STRING(target, "; CLIENT-TAG:");
    4179                                if (optlen == 2U) {
    4180                                        id = isc_buffer_getuint16(&optbuf);
    4181                                        snprintf(buf, sizeof(buf), " %u
", id);
    4182                                        ADD_STRING(target, buf);

    CID 499061: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression optlen, which is equal to 65534, underflows
    the type that receives it, an unsigned integer 16 bits wide.
    4183                                        optlen -= 2;
    4184                                        POST(optlen);
    4185                                        continue;
    4186                                }
    4187                        } else if (optcode == DNS_OPT_SERVER_TAG) {

Backport of MR !9130

Merge branch 'backport-marka-remove-unnecessary-operations-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9223
2024-08-02 07:28:55 +00:00
Mark Andrews 7b238ba36a Remove unnecessary operations
Decrementing optlen immediately before calling continue is unneccesary
and inconsistent with the rest of dns_message_pseudosectiontoyaml
and dns_message_pseudosectiontotext.  Coverity was also reporting
an impossible false positive overflow of optlen (CID 499061).

    4176                        } else if (optcode == DNS_OPT_CLIENT_TAG) {
    4177                                uint16_t id;
    4178                                ADD_STRING(target, "; CLIENT-TAG:");
    4179                                if (optlen == 2U) {
    4180                                        id = isc_buffer_getuint16(&optbuf);
    4181                                        snprintf(buf, sizeof(buf), " %u\n", id);
    4182                                        ADD_STRING(target, buf);

    CID 499061: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression optlen, which is equal to 65534, underflows
    the type that receives it, an unsigned integer 16 bits wide.
    4183                                        optlen -= 2;
    4184                                        POST(optlen);
    4185                                        continue;
    4186                                }
    4187                        } else if (optcode == DNS_OPT_SERVER_TAG) {

(cherry picked from commit 47338c2c87)
2024-08-02 06:42:59 +00:00
Mark Andrews 6d06e7e7e5 [9.20] fix: test: digdelv system test can report more errors than there actually are
Closes #4770

Backport of MR !9104

Merge branch 'backport-4770-digdelv-system-test-can-report-more-errors-than-they-actually-are-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9221
2024-08-02 03:44:39 +00:00
Mark Andrews c2d2fffec2 Reset 'ret' to zero at start of tests
(cherry picked from commit 2dc2abd00d)
2024-08-02 03:01:43 +00:00
Arаm Sаrgsyаn 5dd7146ed8 [9.20] chg: doc: update querylog documentation in ARM
Add a note that 'rndc reload' and 'rndc reconfig' can't change the
querylog option during the runtime of named.

Closes #4801

Backport of MR !9136

Merge branch 'backport-4801-arm-querylog-clarification-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9206
2024-08-01 19:25:54 +00:00
Aram Sargsyan 92d8a3ccd1 Update querylog documentation in ARM
Add a note that 'rndc reload' and 'rndc reconfig' can't change the
querylog option during the runtime of named.

(cherry picked from commit 8fd7da2a9e)
2024-08-01 19:25:21 +00:00
Arаm Sаrgsyаn 840e56a979 [9.20] chg: usr: allow shorter resolver-query-timeout configuration
The minimum allowed value of 'resolver-query-timeout' was lowered to
301 milliseconds instead of the earlier 10000 milliseconds (which is the
default). As earlier, values less than or equal to 300 are converted to
seconds before applying the limit.

Closes #4320

Backport of MR !9091

Merge branch 'backport-4320-allow-shorter-resolver-query-timeout-configuration-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9220
2024-08-01 19:23:42 +00:00
Aram Sargsyan fa15c1fb23 Update the resolver unit test
Before there was a gap from 301 to 9999 which would be converted
to 10000 and now there is no such gap.

This settimeout_belowmin test was checking the behavior of a value
in the gap. As there is now no gap left, the minimum is 301 and
anything below that is converted to seconds as before. In order
for this check to still test the "below minimum" behavior, change
the value from 9000 to 300.

Update the settimeout_overmax value test too so it logically aligns
with the minimum value test.

(cherry picked from commit 63b787effe)
2024-08-01 19:23:06 +00:00
Aram Sargsyan 2788b99ee1 Document shorter resolver-query-timeout configuration
The lower limit is now 301 milliseconds instead of 10000 milliseconds.

(cherry picked from commit 621149c50a)
2024-08-01 19:23:06 +00:00
Aram Sargsyan 3e7689fc23 Test shorter resolver-query-timeout configuration
Add two new checks which test the shorter than usual
resolver-query-timeout configuration.

(cherry picked from commit d6a79cce53)
2024-08-01 19:23:06 +00:00
Aram Sargsyan 003cb48f0f Allow shorter resolver-query-timeout configuration
There are use cases for which shorter timeout values make sense.
For example if there is a load balancer which sets RD=1 and
forwards queries to a BIND resolver which is then configured to
talk to backend servers which are not visible in the public NS set.
WIth a shorter timeout value the frontend can give back SERVFAIL
early when backends are not available and the ultimate client will
not penalize the BIND-frontend for non-response.

(cherry picked from commit 5f47c2b567)
2024-08-01 19:23:06 +00:00
Arаm Sаrgsyаn 008bfb6249 [9.20] new: usr: implement rndc retransfer -force
A new optional argument '-force' has been added to the command channel
command 'rndc retransfer'. When it is specified, named aborts the
ongoing zone transfer (if there is one), and starts a new transfer.

Closes #2299

Backport of MR !9102

Merge branch 'backport-2299-implement-rndc-force-retransfer-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9219
2024-08-01 19:12:25 +00:00
Aram Sargsyan aa6e388591 Rename dns_zone_forcereload() to dns_zone_forcexfr()
The new name describes the function more accurately.

(cherry picked from commit 63b8a75de9)
2024-08-01 17:04:27 +00:00
Aram Sargsyan 28cd7bc666 Test rndc retransfer -force
Use a big zone and the slow transfer mode. Initiate a retransfer, wait
several seconds, then initiate a retransfer using a '-force' argument,
which should cancel the previous transfer and start a new one.

(cherry picked from commit e48f4e8101)
2024-08-01 17:04:27 +00:00
Aram Sargsyan c76d083d4d Make dns_xfrin_shutdown() safe to run from a different loop
If the current loop is different than the zone transfer's loop then
run the shutdown operation asynchronously.

(cherry picked from commit 3d1179501a)
2024-08-01 17:04:27 +00:00
Aram Sargsyan 2886a08c1f Implement rndc retransfer -force
With this new optional argument if there is an ongoing zone
transfer it will be aborted before a new zone transfer is scheduled.

(cherry picked from commit 402ca316ae)
2024-08-01 17:04:27 +00:00
Aram Sargsyan b6721db490 Do not automatically restart a canceled zone transfer
If a zone transfer is canceled there is no need to try the
next primary or retry with AXFR.

(cherry picked from commit b156531b29)
2024-08-01 17:04:27 +00:00
Mark Andrews 00ce93a69c [9.20] fix: usr: fix generation of 6to4-self name expansion from IPv4 address
The period between the most significant nibble of the encoded IPv4 address and the 2.0.0.2.IP6.ARPA suffix was missing resulting in the wrong name being checked. Add system test for 6to4-self implementation.

Closes #4766

Backport of MR !9099

Merge branch 'backport-4766-add-system-test-for-6to4-self-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9217
2024-08-01 07:31:25 +00:00
Mark Andrews c55d89f9d1 check 'update-policy 6to4-self' over IPv6
(cherry picked from commit 3b0de4773b)
2024-08-01 06:41:47 +00:00
Mark Andrews c92b05c0e2 check 'update-policy 6to4-self' over IPv4
(cherry picked from commit b28e5ff721)
2024-08-01 06:41:47 +00:00
Mark Andrews fc350f311a Add missing period to generated IPv4 6to4 name
The period between the most significant nibble of the IPv4 address
and the 2.0.0.2.IP6.ARPA suffix was missing resulting in the wrong
name being checked.

(cherry picked from commit bca63437a1)
2024-08-01 06:41:47 +00:00
Mark Andrews fb07c38697 [9.20] fix: usr: fix false QNAME minimisation error being reported
Remove the false positive "success resolving" log message when QNAME minimisation is in effect and the final result is NXDOMAIN.

Closes #4784

Backport of MR !9117

Merge branch 'backport-4784-false-qname-minimisation-error-being-reported-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9215
2024-08-01 06:21:14 +00:00
Mark Andrews eb7d784544 Test that false positive "success resolving" is not logged
(cherry picked from commit 111e285214)
2024-08-01 05:24:00 +00:00
Mark Andrews eea196fc78 Cleanup old clang-format string splitting
(cherry picked from commit 6d1c7beb15)
2024-08-01 05:24:00 +00:00
Mark Andrews 2789554dec Remove false positive qname minimisation error
Don't report qname minimisation NXDOMAIN errors when the result is
NXDOMAIN.

(cherry picked from commit f78beca942)
2024-08-01 05:24:00 +00:00
Mark Andrews a42afbce2e [9.20] fix: usr: Dig +yaml was producing unexpected and/or invalid YAML output
Closes #4796

Backport of MR !9127

Merge branch 'backport-4796-yaml-stringify-question-and-records-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9213
2024-08-01 04:31:49 +00:00
Mark Andrews b91eb0e524 Test yaml output with yaml specials
(cherry picked from commit fadf461761)
2024-08-01 03:48:08 +00:00
Mark Andrews 9fe19ffafa Fix yaml output
In yaml mode we emit a string for each question and record.  Certain
names and data could result in invalid yaml being produced.  Use single
quote string for all questions and records.  This requires that single
quotes get converted to two quotes within the string.

(cherry picked from commit 393d7fa78e)
2024-08-01 03:48:08 +00:00
Mark Andrews b177581bb2 [9.20] chg: test: resolver system test didn't fail on all subtest errors
Closes #4774

Backport of MR !9105

Merge branch 'backport-4774-resolver-system-test-didn-t-fail-on-all-subtest-errors-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9211
2024-08-01 03:30:12 +00:00
Mark Andrews dde9523b2b resolver system test didn't record all failures
(cherry picked from commit 5843b29f47)
2024-08-01 02:36:16 +00:00
Mark Andrews 1a1413ff59 [9.20] fix: usr: SVBC alpn text parsing failed to reject zero length alpn
Closes #4775

Backport of MR !9106

Merge branch 'backport-4775-reject-zero-length-alpn-in-alpn-fromtext-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9209
2024-08-01 01:54:38 +00:00
Mark Andrews 99701a9a36 Check invalid alpn empty value
(cherry picked from commit fa35c67301)
2024-08-01 01:10:48 +00:00
Mark Andrews 3b35a18dac Check invalid alpn produced due to missing double escapes
(cherry picked from commit a49b2a3568)
2024-08-01 01:10:48 +00:00
Mark Andrews b4fdd2f0df Properly reject zero length ALPN in commatxt_fromtext
ALPN are defined as 1*255OCTET in RFC 9460.  commatxt_fromtext was not
rejecting invalid inputs produces by missing a level of escaping
which where later caught be dns_rdata_fromwire on reception.

These inputs should have been rejected

	svcb in svcb 1 1.svcb alpn=\,abc
	svcb1 in svcb 1 1.svcb alpn=a\,\,abc

and generated 00 03 61 62 63 and 01 61 00 02 61 62 63 respectively.

The correct inputs to include commas in the alpn requires double
escaping.

	svcb in svcb 1 1.svcb alpn=\\,abc
	svcb1 in svcb 1 1.svcb alpn=a\\,\\,abc

and generate 04 2C 61 62 63 and 06 61 2C 2C 61 62 63 respectively.

(cherry picked from commit b51c9eb797)
2024-08-01 01:10:48 +00:00
Arаm Sаrgsyаn 6d1fdb8505 [9.20] chg: dev: replace #define DNS_GETDB_ with struct of bools
Replace #define DNS_GETDB_ with struct of bools to make
it easier to pretty-print the attributes in a debugger.

Closes #4559

Backport of MR !9093

Merge branch 'backport-4559-convert-dns_getdb_x-defines-to-1-bit-long-bools-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9205
2024-07-31 16:28:57 +00:00
Aram Sargsyan adddcde263 Replace #define DNS_GETDB_ with struct of bools
This makes it easier to pretty-print the attributes in a debugger.

(cherry picked from commit cb5238cc62)
2024-07-31 16:28:29 +00:00
Arаm Sаrgsyаn d7e5f7903d [9.20] fix: usr: return SERVFAIL for a too long CNAME chain
When cutting a long CNAME chain, named was returning NOERROR 
instead of SERVFAIL (alongside with a partial answer). This
has been fixed.

Closes #4449

Backport of MR !9090

Merge branch 'backport-4449-return-servfail-for-a-long-cname-chain-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9203
2024-07-31 15:11:33 +00:00
Aram Sargsyan b6372216ba Update the chain test
Update the CNAME chain test to correspond to the changed behavior,
because now named returns SERVFAIL when hitting the maximum query
restarts limit (e.g. happening when following a long CNAME chain).

In the current test auth will hit the limit and return partial data
with a SERVFAIL code, while the resolver will return no data with
a SERVFAIL code after auth returns SERVFAIL to it.

(cherry picked from commit 7751c7eca6)
2024-07-31 11:55:35 +00:00
Aram Sargsyan 21cdd8ed5b Test that a long CNAME chain causes SERVFAIL
Also check that the expected partial answer in returned too.

(cherry picked from commit 580f872fe1)
2024-07-31 11:55:35 +00:00
Aram Sargsyan 2b3ce5e514 Return SERVFAIL for a too long CNAME chain
Due to the maximum query restart limitation a long CNAME chain
it is cut after 16 queries but named still returns NOERROR.

Return SERVFAIL instead and the partial answer.

(cherry picked from commit b621f1d88e)
2024-07-31 11:55:35 +00:00
Mark Andrews c63b7fad49 [9.20] fix: usr: Properly calculate the amount of system memory
On 32 bit machines isc_meminfo_totalphys could return an incorrect value.

Closes #4799

Backport of MR !9132

Merge branch 'backport-4799-cid-498034-overflowed-return-value-integer_overflow-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9199
2024-07-31 08:37:27 +00:00
Mark Andrews fbcdfefd2d Properly compute the physical memory size
On a 32 bit machine casting to size_t can still lead to an overflow.
Cast to uint64_t.  Also detect all possible negative values for
pages and pagesize to silence warning about possible negative value.

    39#if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
    	1. tainted_data_return: Called function sysconf(_SC_PHYS_PAGES),
           and a possible return value may be less than zero.
    	2. assign: Assigning: pages = sysconf(_SC_PHYS_PAGES).
    40        long pages = sysconf(_SC_PHYS_PAGES);
    41        long pagesize = sysconf(_SC_PAGESIZE);
    42
    	3. Condition pages == -1, taking false branch.
    	4. Condition pagesize == -1, taking false branch.
    43        if (pages == -1 || pagesize == -1) {
    44                return (0);
    45        }
    46
    	5. overflow: The expression (size_t)pages * pagesize might be negative,
           but is used in a context that treats it as unsigned.

    CID 498034: (#1 of 1): Overflowed return value (INTEGER_OVERFLOW)
    6. return_overflow: (size_t)pages * pagesize, which might have underflowed,
       is returned from the function.
    47        return ((size_t)pages * pagesize);
    48#endif /* if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE) */

(cherry picked from commit e8dbc5db92)
2024-07-31 07:30:35 +00:00
Mark Andrews be1e649974 [9.20] chg: dev: Fix data race in clean_finds_at_name
Stop updating `find.result_v4` and `find.result_v4` in `clean_finds_at_name`. The values are supposed to be		static.

Closes #4118

Backport of MR !9108

Merge branch 'backport-4118-data-race-lib-dns-adb-c-1537-in-clean_finds_at_name-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9197
2024-07-31 06:58:53 +00:00
Mark Andrews 450aa90309 Do not update find.result_v4 and find.result_v6
These values are supposed to be static for the life of the find and
clean_finds_at_name was updating them resulting in TSAN error
reports.

    WARNING: ThreadSanitizer: data race
    Write of size 4 at 0x000000000001 by thread T1 (mutexes: write M1, write M2):
      #0 clean_finds_at_name lib/dns/adb.c:1537
      #1 fetch_callback lib/dns/adb.c:4009
      #2 task_run lib/isc/task.c:815
      #3 isc_task_run lib/isc/task.c:896
      #4 isc__nm_async_task netmgr/netmgr.c:848
      #5 process_netievent netmgr/netmgr.c:920
      #6 process_queue netmgr/netmgr.c:1013
      #7 process_all_queues netmgr/netmgr.c:767
      #8 async_cb netmgr/netmgr.c:796
      #9 uv__async_io /usr/src/libuv-v1.44.1/src/unix/async.c:163
      #10 isc__trampoline_run lib/isc/trampoline.c:189

    Previous read of size 4 at 0x000000000001 by thread T2:
      #0 findname lib/dns/resolver.c:3749
      #1 fctx_getaddresses lib/dns/resolver.c:3993
      #2 fctx_try lib/dns/resolver.c:4390
      #3 rctx_nextserver lib/dns/resolver.c:10356
      #4 rctx_done lib/dns/resolver.c:10503
      #5 resquery_response lib/dns/resolver.c:8511
      #6 udp_recv lib/dns/dispatch.c:638
      #7 isc__nm_async_readcb netmgr/netmgr.c:2885
      #8 isc__nm_readcb netmgr/netmgr.c:2858
      #9 udp_recv_cb netmgr/udp.c:650
      #10 isc__nm_udp_read_cb netmgr/udp.c:1057
      #11 uv__udp_recvmsg /usr/src/libuv-v1.44.1/src/unix/udp.c:303
      #12 isc__trampoline_run lib/isc/trampoline.c:189

(cherry picked from commit 53a5f50e9d)
2024-07-31 06:20:45 +00:00
Mark Andrews 4d292fc37f [9.20] fix: test: Prevent intermittent setup.sh failures in the "statschannel" system test
Don't verify the just signed zone as the RRSIGs could have expired before the signing process completes

Closes #4781 #2476

Backport of MR !9114

Merge branch 'backport-4781-statschannel-setup-can-fail-due-to-short-validity-interval-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9195
2024-07-31 06:07:29 +00:00
Mark Andrews 5b7134c9d5 Disable post zone verification for manykeys
As the expiration time is now+1 the RRSIG records may expire before
the verification step happens.

(cherry picked from commit 0d69afd764)
2024-07-31 04:47:33 +00:00
Matthijs Mekking 761b47a648 [9.20] chg: test: fix intermittent test failure dnssec system test
Closes #4768

Backport of MR !9101

Merge branch 'backport-4768-dnssec-test-is-broken-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9193
2024-07-30 13:24:18 +00:00
Matthijs Mekking 9be1126cd2 Fix intermittent test failure dnssec system test
The updatecheck-kskonly.secure zone is being used to test dynamic
updates while the KSK is offline. It ensures that the DNSKEY RRset
will retain the RRSIG record, while the updated data is being signed
with the currently active ZSK.

When walking through ZSK rollovers, ensure that the newest ZSK (ZSK3)
is published before doing the dynamic update, preventing timing
related test failures.

Also fix the test log line ($ZSK_ID3 was not yet created at the time
of logging).

(cherry picked from commit e874632488)
2024-07-30 12:06:16 +00:00
Matthijs Mekking a5f554959e [9.20] fix: usr: Update key lifetime and metadata after dnssec-policy reconfig
Adjust key state and timing metadata if dnssec-policy key lifetime configuration is updated, so that it also
affects existing keys.

Closes #4677

Backport of MR !9118

Merge branch 'backport-4677-dnssec-policy-key-lifetime-reconfigure-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9191
2024-07-30 11:11:55 +00:00
Mark AndrewsandMatthijs Mekking 45e49640ce Log key calculation overflows
(cherry picked from commit 14a76ae498)
2024-07-30 10:22:48 +00:00
Mark AndrewsandMatthijs Mekking edb1df856e Check for overflow when adding lifetime
(cherry picked from commit 25845a866e)
2024-07-30 10:22:48 +00:00
Matthijs Mekking b489e267d4 No longer update key lifetime if key is retired
The key lifetime should no longer be adjusted if the key is being
retired earlier, for example because a manual rollover was started.

This would falsely be seen as a dnssec-policy lifetime reconfiguration,
and would adjust the retire/removed time again.

This also means we should update the status output, and the next
rollover scheduled is now calculated using (retire-active) instead of
key lifetime.

(cherry picked from commit 129973ebb0)
2024-07-30 10:22:48 +00:00
Matthijs Mekking bfb29acc7f Update key lifetime and metadata after reconfig
If dnssec-policy is reconfigured and the key lifetime has changed,
update existing keys with the new lifetime and adjust the retire
and removed timing metadata accordingly.

If the key has no lifetime yet, just initialize the lifetime. It
may be that the retire/removed timing metadata has already been set.

Skip keys which goal is not set to omnipresent. These keys are already
in the progress of retiring, or still unused.

(cherry picked from commit 1cec0b0448)
2024-07-30 10:22:48 +00:00
Matthijs Mekking 671414ba42 Test updating dnssec-policy key lifetime
Check if the key lifetime is updated in the key files. Make sure the
inactive and removed timing metadata are adjusted accordingly.

(cherry picked from commit 2237895bb4)
2024-07-30 10:22:48 +00:00
Matthijs Mekking 1da982e6d0 Move dnssec-policy to kasp-fips.conf.in
All dnssec-policy configurations are here, so why not this one?

(cherry picked from commit 93326e3e18)
2024-07-30 10:22:48 +00:00
Matthijs Mekking 75e3154df9 [9.20] fix: doc: Fix typo in key-store reference rst
Closes #4813

Backport of MR !9176

Merge branch 'backport-4813-fix-typo-in-reference-rst-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9189
2024-07-30 09:40:45 +00:00
Suzanne GoldlustandMatthijs Mekking ab790d7092 Fix backslashes on key-store block
(cherry picked from commit 645cd0496e)
2024-07-30 08:45:35 +00:00
Nicki Křížek d2afa7f07d [9.20] chg: test: Retry job in case of AWS Spot Instance interruption event
Closes #4777

Backport of MR !9107

Merge branch '4777-retry-job-aws-spot-instance-interruption-event-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9184
2024-07-29 14:52:03 +00:00
Emanuel PetrandNicki Křížek d4690abd06 Retry job in case of AWS Spot Instance interruption
(cherry picked from commit bbcce1bfc1)
2024-07-29 13:26:49 +00:00
Nicki Křížek cf60eb2738 [9.20] new: dev: generate changelog from git log
Use a single source of truth, the git log, to generate the list of CHANGES. Use the .rst format and include it in the ARM for a quick reference with proper gitlab links to issues and merge requests.

Closes #75

Backport of MR !9152

Merge branch 'nicki/add-gitchangelog-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9180
2024-07-29 13:22:25 +00:00
Nicki Křížek e9780d55bf Update docs and processes to use the new changelog
(cherry picked from commit bcc99213a5)
2024-07-29 14:44:59 +02:00
Nicki Křížek 98f7d68062 Update dangerfile for new changelog workflow
(cherry picked from commit 91be111dc7)
2024-07-29 14:44:59 +02:00
Nicki Křížek 96767a9cf6 Skip pylint checks for contrib directory
The files in contrib/ directory shouldn't be subject to our pylint
check. They can come from external sources and we don't subject these to
the same standards as the rest of the BIND9 code / scripts.

(cherry picked from commit 7cbb052649)
2024-07-29 14:44:59 +02:00
Nicki Křížek 417066f792 Remove changes job and related scripts
These are no longer needed, since changelog is generated using
gitchangelog.

(cherry picked from commit 3f1a843695)
2024-07-29 14:44:59 +02:00
Nicki Křížek 9beffa5a8d Add BIND9 configuration for gitchangelog
The configuration has been crafted to cater for BIND9 needs:
- Define actions that have an equivalent section in existing Release
  Notes
- Assume the commits that have the necessary changelog makrup are merge
  commits from GitLab and transform them into messages and proper links
- Put the resulting changelog into the proper place in
  doc/arm/changelog.rst
- Have a separate configuration for changelog and release notes. Both of
  these should be generated from the `git log`, with release notes being
  subject to more scrutiny and further editing

(cherry picked from commit 0ec8b99ea3)
2024-07-29 14:44:57 +02:00
Nicki Křížek 1e4bccf250 Add new changelog file
Create new changelog and include it in the documentation. Include the
previous CHANGES as plain text without any markup.

(cherry picked from commit e9b6031e0c)
2024-07-29 14:44:39 +02:00
Nicki Křížek c6119b5513 Address gitchangelog deprecation warning
(cherry picked from commit 951280bca5)
2024-07-29 12:34:03 +00:00
Nicki Křížek d4a76252f0 Adjust gitchangelog whitespace
Format the output to produce a nicer looking rst output, similar to the
former CHANGES file.

(cherry picked from commit 1c95eeeb3f)
2024-07-29 12:34:03 +00:00
Nicki Křížek 6c7a0b1a94 Allow gitchangelog to include commit sha
Add an option which can be used to put short commit sha at the end of
each commit subject line in the generated changelog.

(cherry picked from commit c2b23fa2de)
2024-07-29 12:34:03 +00:00
Nicki Křížek 226bd5cfe0 Remove authors from gitchangelog output
Given our workflow, this could easily lead to misattribution. It's also
not an actionable information and it can be found in the MR / git log
instead.

(cherry picked from commit a8258d1c53)
2024-07-29 12:34:03 +00:00
Nicki Křížek e0feedcab7 Reformat gitchangelog with black
(cherry picked from commit 9f90c1c65e)
2024-07-29 12:34:03 +00:00
Nicki Křížek f64aaf1a40 Import gitchanglog 3.0.4
The  project hasn't seen any new development/changes since 2018 and it
seems unlikely we'd be able to get any changes into the upstream. Since
it's isolated into a single file and its task is fairly straighforward,
pull the code into our own repository and maintain it here as needed.

This also makes it easier to make any changes that are specific to our
project.

(cherry picked from commit 63247d8a73)
2024-07-29 12:34:02 +00:00
Nicki Křížek 7e210d9212 Set up version and release notes for BIND 9.20.1
Merge branch 'nicki/set-up-version-and-release-notes-for-bind-9.20.1' into 'bind-9.20'

See merge request isc-projects/bind9!9167
2024-07-23 16:37:23 +00:00
Nicki Křížek 856d73003b Set up release notes for BIND 9.20.1 2024-07-23 17:49:29 +02:00
Nicki Křížek 71d137939d Update BIND version to 9.20.1-dev 2024-07-23 17:49:28 +02:00
Nicki Křížek 03e289030e Merge tag 'v9.20.0' 2024-07-23 17:15:41 +02:00
Nicki Křížek 14bbdfc7b9 Update BIND version to 9.20.0 2024-07-08 15:01:00 +02:00
Nicki Křížek c299dece45 Add a CHANGES marker 2024-07-08 14:58:59 +02:00
Nicki Křížek 844864041c Merge branch 'nicki/prepare-documentation-for-bind-9.20.0' into 'v9.20.0-release'
Prepare documentation for BIND 9.20.0

See merge request isc-private/bind9!710
2024-07-08 12:55:47 +00:00
Nicki Křížek 3489840948 Update documentation for 9.20.0 2024-07-08 14:53:01 +02:00
Nicki Křížek 890ebd3fd3 Create release notes for 9.20.0 2024-07-08 14:53:01 +02:00
Nicki Křížek 1fa52674e1 Extend max-types-per-name documentation 2024-07-08 14:53:01 +02:00
Nicki Křížek 322110a797 Document new -J option for dnssec-signzone and dnssec-verify 2024-07-08 14:53:01 +02:00
Nicki Křížek b3423bb347 Reorder release notes 2024-07-08 14:53:01 +02:00
Nicki Křížek 6d44c8fcbd Tweak and reword release notes 2024-07-08 14:53:00 +02:00
Nicki Křížek 10d2aceb02 Add release note for [GL #4708] 2024-07-08 14:53:00 +02:00
Nicki Křížek a624b8c541 Add release note for [GL #4736] 2024-07-08 14:53:00 +02:00
Nicki Křížek 0a584eb318 Add release note for [GL #3472] 2024-07-08 14:53:00 +02:00
Nicki Křížek e847f32a36 Prepare release notes for BIND 9.19.25
This version won't be released. This commit is just a preparation for
9.20.0.
2024-07-08 14:53:00 +02:00
Nicki Křížek 3d307f869d Add another placeholder for [GL #4480]
(cherry picked from commit 1680916d67)
2024-07-08 14:52:58 +02:00
Nicki Křížek 99309ce8ae Merge branch 'tcp-reset-connection-on-failed-send' into 'v9.20.0-release'
[CVE-2024-0760 (part 3)] Reset the TCP connection on a failed send

See merge request isc-private/bind9!721
2024-07-03 15:50:58 +00:00
Artem Boldariev 5781ff3a93 Drop expired but not accepted TCP connections
This commit ensures that we are not attempting to accept an expired
TCP connection as we are not interested in any data that could have
been accumulated in its internal buffers. Now we just drop them for
good.
2024-07-03 15:03:02 +03:00
Ondřej Surý bf9fd2a6ff Reset the TCP connection on a failed send
When sending fails, the ns__client_request() would not reset the
connection and continue as nothing is happening.  This comes from the
model that we don't care about failed UDP sends because datagrams are
unreliable anyway, but it greatly affects TCP connections with
keep-alive.

The worst case scenario is as follows:

1. the 3-way TCP handshake gets completed
2. the libuv calls the "uv_connection_cb" callback
3. the TCP connection gets queue because of the tcp-clients quota
4. the TCP client sends as many DNS messages as the buffers allow
5. the TCP connection gets dropped by the client due to the timeout
6. the TCP connection gets accepted by the server
7. the data already sent by the client gets read
8. all sending fails immediately because the TCP connection is dead
9. we consume all the data in the buffer in a very tight loop

As it doesn't make sense to trying to process more data on the TCP
connection when the sending is failing, drop the connection immediately
on the first sending error.
2024-07-03 09:07:20 +02:00
Ondřej Surý 1c0564d715 Remove ns_query_init() cannot fail, remove the error paths
As ns_query_init() cannot fail now, remove the error paths, especially
in ns__client_setup() where we now don't have to care what to do with
the connection if setting up the client could fail.  It couldn't fail
even before, but now it's formal.
2024-07-03 09:05:51 +02:00
Ondřej Surý bc3e713317 Throttle the reading when writes are asynchronous
Be more aggressive when throttling the reading - when we can't send the
outgoing TCP synchronously with uv_try_write(), we start throttling the
reading immediately instead of waiting for the send buffers to fill up.

This should not affect behaved clients that read the data from the TCP
on the other end.
2024-07-03 08:45:39 +02:00
Nicki Křížek 92a73bca2d Merge branch '3405-security-limit-the-number-of-resource-records-in-rrset-nxdomain' into 'v9.20.0-release'
[CVE-2024-1737 (part 2)] Be smarter about refusing to add many RR types to the database

See merge request isc-private/bind9!712
2024-07-02 11:05:37 +00:00
Ondřej Surý 4089f4e2c3 Add more tests for adding many RR types to the database
More reclimit tests that test various scenarios adding combinations of
priority and non-priority RR types into the database.
2024-07-01 12:49:02 +02:00
Ondřej Surý 57cd34441a Be smarter about refusing to add many RR types to the database
Instead of outright refusing to add new RR types to the cache, be a bit
smarter:

1. If the new header type is in our priority list, we always add either
   positive or negative entry at the beginning of the list.

2. If the new header type is negative entry, and we are over the limit,
   we mark it as ancient immediately, so it gets evicted from the cache
   as soon as possible.

3. Otherwise add the new header after the priority headers (or at the
   head of the list).

4. If we are over the limit, evict the last entry on the normal header
   list.
2024-07-01 12:48:51 +02:00
Ondřej Surý 58f660cf2b Make the resolver qtype ANY test order agnostic
Instead of relying on a specific order of the RR types in the databases
pick the first RR type as returned from the cache.
2024-07-01 12:47:30 +02:00
Ondřej Surý b27c6bcce8 Expand the list of the priority types and move it to db_p.h
Add HTTPS, SVCB, SRV, PTR, NAPTR, DNSKEY and TXT records to the list of
the priority types that are put at the beginning of the slabheader list
for faster access and to avoid eviction when there are more types than
the max-types-per-name limit.
2024-07-01 12:47:30 +02:00
Nicki Křížek b8522e5b8e Merge branch 'tcp-do-not-unthrottle-on_isc_nm_read' into 'v9.20.0-release'
[CVE-2024-0760 (part 2)] Do not un-throttle TCP connections on isc_nm_read()

See merge request isc-private/bind9!708
2024-06-25 08:54:47 +00:00
Artem Boldariev 55b1a093ea Do not un-throttle TCP connections on isc_nm_read()
Due to omission it was possible to un-throttle a TCP connection
previously throttled due to the peer not reading back data we are
sending.

In particular, that affected DoH code, but it could also affect other
transports (the current or future ones) that pause/resume reading
according to its internal state.
2024-06-12 13:44:37 +03:00
Nicki Křížek 392e7199df Merge branch 'nicki/add-another-placeholder-for-4480' into 'main'
Add another placeholder for [GL #4480]

See merge request isc-projects/bind9!9100
2024-06-11 07:33:46 +00:00
Nicki Křížek 1680916d67 Add another placeholder for [GL #4480] 2024-06-11 09:30:47 +02:00
Nicki Křížek 9216d0a74c Merge branch 'nicki/add-placeholder-entries' into 'main'
Add placeholder entries to CHANGES

See merge request isc-projects/bind9!9096
2024-06-10 15:52:21 +00:00
Nicki Křížek f149ecc81a Merge branch '4507-confidential-clear-zversion' into 'v9.20.0-release'
[CVE-2024-4076] serve-stale zversion crash

See merge request isc-private/bind9!631
2024-06-10 15:51:03 +00:00
Matthijs MekkingandNicki Křížek 6f58d2c6fa Add release note for [GL #4507] 2024-06-10 17:47:55 +02:00
Mark AndrewsandNicki Křížek d8a4851e90 Add CHANGES note for [GL #4507] 2024-06-10 17:47:15 +02:00
Mark AndrewsandNicki Křížek e52c2a654b Clear qctx->zversion
Clear qctx->zversion when clearing qctx->zrdataset et al in
lib/ns/query.c:qctx_freedata.  The uncleared pointer could lead to
an assertion failure if zone data needed to be re-saved which could
happen with stale data support enabled.
2024-06-10 17:45:38 +02:00
Nicki Křížek b2cfdba565 Merge branch '4480-sig0-can-be-used-to-exhaust-cpu-resources-v6' into 'v9.20.0-release'
[CVE-2024-1975] Mitigate SIG(0) CPU resources exhaustion attack vectors

See merge request isc-private/bind9!689
2024-06-10 15:44:34 +00:00
Petr ŠpačekandNicki Křížek 9370acd3a7 Require local KEYs for SIG(0) verification
This is additional hardening. There is no known use-case for KEY RRs
from DNS cache and it potentially allows attackers to put weird keys
into cache.
2024-06-10 17:36:45 +02:00
Aram SargsyanandNicki Křížek d69fab1530 Mark SIG(0) quota settings as experimantal
A different solution in the future might be adopted depending
on feedback and other new information, so it makes sense to mark
these options as EXPERIMENTAL until we have more data.
2024-06-10 17:36:45 +02:00
Aram SargsyanandNicki Křížek 54ddd848fe Avoid running get_matching_view() asynchronously on an error path
Also create a new ns_client_async_reset() static function to decrease
code duplication.
2024-06-10 17:35:40 +02:00
Aram SargsyanandNicki Křížek a2b61c0a65 Test that named checks maximum two keys for SIG(0)-signed messages
Send three updates with three different keys, and expect that one
of them should fail.

Also retain more artifacts for neighboring nsupdate calls.
2024-06-10 17:35:39 +02:00
Aram SargsyanandNicki Křížek be482311de Add a release note for [GL #4480] 2024-06-10 17:35:36 +02:00
Aram SargsyanandNicki Křížek 3bb9241bec Add a CHANGES note for [GL #4480] 2024-06-10 17:34:09 +02:00
Aram SargsyanandNicki Křížek 7ca9bd6014 Limit the number of keys for SIG(0) message verification
Check at most two KEY RRs agains a SIG(0) signature. This should
limit potential abuse and at the same time allow key rollover.
2024-06-10 17:33:11 +02:00
Aram SargsyanandNicki Křížek 70ff4a3f85 Run resolver message signature checking asynchronously 2024-06-10 17:33:11 +02:00
Aram SargsyanandNicki Křížek ad489c44df Remove sig0checks-quota-maxwait-ms support
Waiting for a quota to appear complicates things and wastes
rosources on timer management. Just answer with REFUSE if
there is no quota.
2024-06-10 17:33:11 +02:00
Aram SargsyanandNicki Křížek f0cde05e06 Implement asynchronous view matching for SIG(0)-signed queries
View matching on an incoming query checks the query's signature,
which can be a CPU-heavy task for a SIG(0)-signed message. Implement
an asynchronous mode of the view matching function which uses the
offloaded signature checking facilities, and use it for the incoming
queries.
2024-06-10 17:33:10 +02:00
Aram SargsyanandNicki Křížek 710bf9b938 Implement asynchronous message signature verification
Add support for using the offload threadpool to perform message
signature verifications. This should allow check SIG(0)-signed
messages without affecting the worker threads.
2024-06-10 17:33:10 +02:00
Aram SargsyanandNicki Křížek 7f013ad05d Remove dns_message_rechecksig()
This is a tiny helper function which is used only once and can be
replaced with two function calls instead. Removing this makes
supporting asynchronous signature checking less complicated.
2024-06-10 17:33:10 +02:00
Aram SargsyanandNicki Křížek bbc866d0cb Document the SIG(0) signature checking quota options
Add documentation entries for the 'sig0checks-quota',
'sig0checks-quota-maxwait-ms', and 'sig0checks-quota-exempt'
optoins.
2024-06-10 17:33:10 +02:00
Aram SargsyanandNicki Křížek c7f79a0353 Add a quota for SIG(0) signature checks
In order to protect from a malicious DNS client that sends many
queries with a SIG(0)-signed message, add a quota of simultaneously
running SIG(0) checks.

This protection can only help when named is using more than one worker
threads. For example, if named is running with the '-n 4' option, and
'sig0checks-quota 2;' is used, then named will make sure to not use
more than 2 workers for the SIG(0) signature checks in parallel, thus
leaving the other workers to serve the remaining clients which do not
use SIG(0)-signed messages.

That limitation is going to change when SIG(0) signature checks are
offloaded to "slow" threads in a future commit.

The 'sig0checks-quota-exempt' ACL option can be used to exempt certain
clients from the quota requirements using their IP or network addresses.

The 'sig0checks-quota-maxwait-ms' option is used to define a maximum
amount of time for named to wait for a quota to appear. If during that
time no new quota becomes available, named will answer to the client
with DNS_R_REFUSED.
2024-06-10 17:33:08 +02:00
Nicki Křížek 24e8cc7b38 Merge branch '3405-security-limit-the-number-of-resource-records-in-rrset' into 'v9.20.0-release'
Limit the number of RRs in RRSets

See merge request isc-private/bind9!694
2024-06-10 15:01:48 +00:00
Evan HuntandNicki Křížek 1bf7795b38 Add CHANGES and release note for [GL #3403] 2024-06-10 16:57:29 +02:00
Matthijs MekkingandNicki Křížek c1ac8b6ad0 Log rekey failure as error if too many records
By default we log a rekey failure on debug level. We should probably
change the log level to error. We make an exception for when the zone
is not loaded yet, it often happens at startup that a rekey is
run before the zone is fully loaded.
2024-06-10 16:55:12 +02:00
Matthijs MekkingandNicki Křížek 82635e56d8 Log error when update fails
The new "too many records" error can make an update fail without the
error being logged. This commit fixes that.
2024-06-10 16:55:12 +02:00
Evan HuntandNicki Křížek 7dd6b47ace fix a memory leak that could occur when signing
when signatures were not added because of too many types already
existing at a node, the diff was not being cleaned up; this led to
a memory leak being reported at shutdown.
2024-06-10 16:55:12 +02:00
Matthijs MekkingandNicki Křížek 4e46453035 Add new test cases with DNSSEC signing
kasp-max-types-per-name (named2.conf.in):
An unsigned zone with RR type count on a name right below the
configured limit. Then sign the zone using KASP. Adding a RRSIG would
push it over the RR type limit per name. Signing should fail, but
the server should not crash, nor end up in infinite resign-attempt loop.

kasp-max-records-per-type-dnskey (named1.conf.in):
Test with low max-record-per-rrset limit and a DNSSEC policy requiring
more than the limit. Signing should fail.

kasp-max-types-per-name (named1.conf.in):
Each RRSIG(covered type) is counted as an individual RR type. Test the
corner case where a signed zone, which is just below the limit-1,
adds a new type - doing so would trigger signing for the new type and
thus increase the number of "types" by 2, pushing it over the limit
again.
2024-06-10 16:55:11 +02:00
Matthijs MekkingandNicki Křížek 15ecd2cce6 Check if restart works 2024-06-10 16:55:11 +02:00
Matthijs MekkingandNicki Křížek ef9d5cf552 Switch to inline-signing no 2024-06-10 16:55:11 +02:00
Matthijs MekkingandNicki Křížek 6297e0d7a9 Add test cases that use DNSSEC signing
Add two new masterformat tests that use signing. In the case of
'under-limit-kasp', the signing will keep the number of records in the
RRset under the limit. In the case of 'on-limit-kasp', the signing
will push the number of records in the RRset over the limit, because
of the added RRSIG record.
2024-06-10 16:55:11 +02:00
Petr ŠpačekandNicki Křížek b2afc83040 Remove duplicated empty zone files 2024-06-10 16:55:11 +02:00
Petr ŠpačekandNicki Křížek d85f516f5b masterformat: rename zone names to reflect intended meaning 2024-06-10 16:55:10 +02:00
Petr ŠpačekandNicki Křížek 124e220579 Test owner name rename: a b c d e -> <number>-txt 2024-06-10 16:55:10 +02:00
Petr ŠpačekandNicki Křížek c080e510ab Test variable rename i->_attempt 2024-06-10 16:55:10 +02:00
Petr ŠpačekandNicki Křížek 35faf81680 Test variable rename a->rrcount 2024-06-10 16:55:10 +02:00
Ondřej SurýandNicki Křížek ccde4911ca Add test for not-loading many RRsets per name on a secondary
This tests makes sure the zone with many RRsets per name is not loaded
via XFR on the secondary server.
2024-06-10 16:55:10 +02:00
Ondřej SurýandNicki Křížek 86aa4674ab Add a test for not caching large number of RRsets
Send a recursive query for a large number of RRsets, which should
fail when using the default max-types-per-name setting of 100, but
succeed when the cap is disabled.
2024-06-10 16:55:10 +02:00
Ondřej SurýandNicki Křížek 52b3d86ef0 Add a limit to the number of RR types for single name
Previously, the number of RR types for a single owner name was limited
only by the maximum number of the types (64k).  As the data structure
that holds the RR types for the database node is just a linked list, and
there are places where we just walk through the whole list (again and
again), adding a large number of RR types for a single owner named with
would slow down processing of such name (database node).

Add a configurable limit to cap the number of the RR types for a single
owner.  This is enforced at the database (rbtdb, qpzone, qpcache) level
and configured with new max-types-per-name configuration option that
can be configured globally, per-view and per-zone.
2024-06-10 16:55:09 +02:00
Evan HuntandNicki Křížek 3dc4388f4a Add a test for not caching large RRset
Send a recursive query for a large (2500 record) RRset, which should
fail when using the default max-records-per-type setting of 100, but
succeed when the cap is disabled.
2024-06-10 16:55:09 +02:00
Ondřej SurýandNicki Křížek 5d4e57b914 Add test for not-loading and not-transfering huge RRSets
Add two new masterformat tests - the 'huge' zone fits within the ns1
limit and loads on the primary ns1 server, but must not transfer to the
ns2 secondary, and the 'uber' zone should not even load on the primary
ns1 server.
2024-06-10 16:55:09 +02:00
Ondřej SurýandNicki Křížek 32af7299eb Add a limit to the number of RRs in RRSets
Previously, the number of RRs in the RRSets were internally unlimited.
As the data structure that holds the RRs is just a linked list, and
there are places where we just walk through all of the RRs, adding an
RRSet with huge number of RRs inside would slow down processing of said
RRSets.

Add a configurable limit to cap the number of the RRs in a single RRSet.
This is enforced at the database (rbtdb, qpzone, qpcache) level and
configured with new max-records-per-type configuration option that can
be configured globally, per-view and per-zone.
2024-06-10 16:55:07 +02:00
Nicki Křížek 0b44383c5b Merge branch '4481-security-tcp-flood' into 'v9.20.0-release'
[CVE-2024-0760] Throttle reading from TCP if the sends are not getting through

See merge request isc-private/bind9!639
2024-06-10 14:53:12 +00:00
Ondřej SurýandNicki Křížek 1002f920f6 Add CHANGES and release note for [GL #4481] 2024-06-10 16:49:56 +02:00
Ondřej SurýandNicki Křížek e28266bfbc Remove the extra memory context with own arena for sending
The changes in this MR prevent the memory used for sending the outgoing
TCP requests to spike so much.  That strictly remove the extra need for
own memory context, and thus since we generally prefer simplicity,
remove the extra memory context with own jemalloc arenas just for the
outgoing send buffers.
2024-06-10 16:48:54 +02:00
Ondřej SurýandNicki Křížek 4c2ac25a95 Limit the number of DNS message processed from a single TCP read
The single TCP read can create as much as 64k divided by the minimum
size of the DNS message.  This can clog the processing thread and trash
the memory allocator because we need to do as much as ~20k allocations in
a single UV loop tick.

Limit the number of the DNS messages processed in a single UV loop tick
to just single DNS message and limit the number of the outstanding DNS
messages back to 23.  This effectively limits the number of pipelined
DNS messages to that number (this is the limit we already had before).
2024-06-10 16:48:54 +02:00
Ondřej SurýandNicki Křížek 452a2e6348 Replace the tcp_buffers memory pool with static per-loop buffer
As a single thread can process only one TCP send at the time, we don't
really need a memory pool for the TCP buffers, but it's enough to have
a single per-loop (client manager) static buffer that's being used to
assemble the DNS message and then it gets copied into own sending
buffer.

In the future, this should get optimized by exposing the uv_try API
from the network manager, and first try to send the message directly
and allocate the sending buffer only if we need to send the data
asynchronously.
2024-06-10 16:48:53 +02:00
Aram SargsyanandNicki Křížek 982eab7de0 ns_client: reuse TCP send buffers
Constantly allocating, reallocating and deallocating 64K TCP send
buffers by 'ns_client' instances takes too much CPU time.

There is an existing mechanism to reuse the ns_clent_t structure
associated with the handle using 'isc_nmhandle_getdata/_setdata'
(see ns_client_request()), but it doesn't work with TCP, because
every time ns_client_request() is called it gets a new handle even
for the same TCP connection, see the comments in
streamdns_on_complete_dnsmessage().

To solve the problem, we introduce an array of available (unused)
TCP buffers stored in ns_clientmgr_t structure so that a 'client'
working via TCP can have a chance to reuse one (if there is one)
instead of allocating a new one every time.
2024-06-10 16:48:53 +02:00
Ondřej SurýandNicki Křížek 4e7c4af17f Throttle reading from TCP if the sends are not getting through
When TCP client would not read the DNS message sent to them, the TCP
sends inside named would accumulate and cause degradation of the
service.  Throttle the reading from the TCP socket when we accumulate
enough DNS data to be sent.  Currently this is limited in a way that a
single largest possible DNS message can fit into the buffer.
2024-06-10 16:48:52 +02:00
Nicki Křížek d3609b742d Merge branch '4473-fix-doh-intermittent-crash' into 'v9.20.0-release'
DoH:  Avoid potential data races in our DoH implementation related to to HTTP/2 session object management and endpoints set object management

See merge request isc-private/bind9!614
2024-06-10 14:45:42 +00:00
Artem BoldarievandNicki Křížek cdb5ae35e8 Modify release notes [GL #4473]
Mention that an intermittent BIND process termination in DoH code has
been fixed.
2024-06-10 16:41:00 +02:00
Artem BoldarievandNicki Křížek a51ffa58d7 Modify CHANGES [GL #4473]
Mention that an intermittent BIND process termination in DoH code has
been fixed.
2024-06-10 16:40:56 +02:00
Artem BoldarievandNicki Křížek d80dfbf745 Keep the endpoints set reference within an HTTP/2 socket
This commit ensures that an HTTP endpoints set reference is stored in
a socket object associated with an HTTP/2 stream instead of
referencing the global set stored inside a listener.

This helps to prevent an issue like follows:

1. BIND is configured to serve DoH clients;
2. A client is connected and one or more HTTP/2 stream is
created. Internal pointers are now pointing to the data on the
associated HTTP endpoints set;
3. BIND is reconfigured - the new endpoints set object is created and
promoted to all listeners;
4. The old pointers to the HTTP endpoints set data are now invalid.

Instead referencing a global object that is updated on
re-configurations we now store a local reference which prevents the
endpoints set objects to go out of scope prematurely.
2024-06-10 16:40:12 +02:00
Artem BoldarievandNicki Křížek c41fb499b9 DoH: avoid potential use after free for HTTP/2 session objects
It was reported that HTTP/2 session might get closed or even deleted
before all async. processing has been completed.

This commit addresses that: now we are avoiding using the object when
we do not need it or specifically check if the pointers used are not
'NULL' and by ensuring that there is at least one reference to the
session object while we are doing incoming data processing.

This commit makes the code more resilient to such issues in the
future.
2024-06-10 16:40:10 +02:00
Nicki Křížek 662e3cd14b Add placeholder entries to CHANGES
Add placeholders for the following issues:

- [GL #4473]
- [GL #4481]
- [GL #497] [GL #3405]
- [GL #3403] [GL #4548]
- [GL #4480]
- [GL #4507]
2024-06-10 16:19:03 +02:00
Nicki Křížek 07a5e7a921 Merge branch 'nicki/add-placeholder-for-4661' into 'main'
Add a CHANGES placeholder for [GL #4661]

See merge request isc-projects/bind9!9097
2024-06-10 14:16:46 +00:00
Nicki Křížek 4fe6a6bdc0 Add a CHANGES placeholder for [GL #4661] 2024-06-10 16:14:25 +02:00
Evan Hunt 05823eb1b0 Merge branch '4728-allow-transfer-none' into 'main'
change allow-transfer default to "none"

Closes #4728

See merge request isc-projects/bind9!9046
2024-06-05 21:50:47 +00:00
Evan Hunt 2b7cbd8d95 CHANGES and relnotes for [GL #4728] 2024-06-05 10:50:06 -07:00
Evan Hunt c3d3d12911 change allow-transfer default to "none"
Changed the default value for 'allow-transfer' to 'none'; zone
transfers now require explicit authorization.

Updated all system tests to specify an allow-transfer ACL when needed.

Revised the ARM to specify that the default is 'none'.
2024-06-05 10:50:06 -07:00
Ondřej Surý 74cbaf46c9 Merge branch 'ondrej/use-rcu-stack-for-qpcache-deadnodes' into 'main'
Use RCU wait-free stack for qpcache deadnodes

See merge request isc-projects/bind9!8907
2024-06-05 17:40:30 +00:00
Ondřej Surý 086b63f56d Use isc_queue to implement wait-free deadnodes queue
Replace the ISC_LIST based deadnodes implementation with isc_queue which
is wait-free and we don't have to acquire neither the tree nor node lock
to append nodes to the queue and the cleaning process can also
copy (splice) the list into a local copy without acquiring the list.

Currently, there's little benefit to this as we need to hold those
locks anyway, but in the future as we move to RCU based implementation,
this will be ready.

To align the cleaning with our event loop based model, remove the
hardcoded count for the node locks and use the number of the event loops
instead.  This way, each event loop can have its own cleaning as part of
the process.  Use uniform random numbers to spread the nodes evenly
between the buckets (instead of hashing the domain name).
2024-06-05 09:19:56 +02:00
Ondřej Surý a9b4d42346 Add isc_queue implementation on top of cds_wfcq
Add an isc_queue implementation that hides the gory details of cds_wfcq
into more neat API.  The same caveats as with cds_wfcq.

TODO: Add documentation to the API.
2024-06-05 09:19:56 +02:00
Mark Andrews 67b9510988 Merge branch '4736-isc_r_hostdown-was-not-being-handled-by-resolver-c' into 'main'
Resolve "ISC_R_HOSTDOWN was not being handled by resolver.c"

Closes #4736

See merge request isc-projects/bind9!9055
2024-06-04 07:35:36 +00:00
Mark Andrews 71cfa8dfba Add CHANGES note for [GL #4736] 2024-06-04 00:16:30 +10:00
Mark Andrews 56c3dcc5d7 Update resquery_senddone handling of ISC_R_TIMEDOUT
Treat timed out as an address specific error.
2024-06-04 00:15:48 +10:00
Mark Andrews 4e3dd85b8d Update resquery_senddone handling of ISC_R_CONNECTIONRESET
Treat connection reset as an address specific error.
2024-06-04 00:15:48 +10:00
Mark Andrews 180b1e7939 Handle ISC_R_HOSTDOWN and ISC_R_NETDOWN in resolver.c
These error codes should be treated like other unreachable error
codes.
2024-06-04 00:15:48 +10:00
Michał Kępień e7971f6ac8 Merge branch '4706-4707-add-more-label-checks-to-dangerfile.py' into 'main'
Add more label checks to dangerfile.py

Closes #4706 and #4707

See merge request isc-projects/bind9!9040
2024-06-03 11:10:55 +00:00
Michał Kępień aae51cf28d Fail for merge requests with "Affects v9.x" labels
Setting "Affects v9.x" labels on a merge request duplicates information
already present on the GitLab issue associated with that merge request.
For trivial merge requests that are not associated with any GitLab
issue, setting the "Affects v9.x" label(s) is considered unnecessary.
Trigger a failure for every merge request marked with at least one
"Affects v9.x" label.
2024-06-03 13:07:21 +02:00
Michał Kępień 80ec57f198 Warn about auto-generated merge request titles
Merge request titles auto-generated by GitLab are often a source of
confusion regarding the actual contents of a given merge request.  Warn
for merge requests containing titles that look like auto-generated ones.
2024-06-03 13:07:21 +02:00
Michał Kępień 09851e6230 Fail for branches using old-style version suffixes
Using "-v9_x" and "-v9.x" version suffixes for branch names is now
deprecated since some automation logic does not handle these.  Fail for
any merge request using such old-style version suffixes.
2024-06-03 13:07:21 +02:00
Michał Kępień 9359cb9c99 Fail for backports with "Affects v9.x" labels set
Backports are not expected to have any "Affects v9.x" labels set since
those are only meant to be set for merge requests that should have
backports created for them.
2024-06-03 13:07:21 +02:00
Mark Andrews 89d7d52010 Merge branch '3472-ipv4-only-mode-not-respected-for-zone-transfers' into 'main'
Resolve "IPv4-only mode not respected for zone transfers"

Closes #3472

See merge request isc-projects/bind9!8522
2024-06-03 09:59:44 +00:00
Mark Andrews 3834e433f7 Add CHANGES note for [GL #6288] 2024-06-03 18:35:02 +10:00
Mark Andrews 05472e63e8 Don't do DS checks over disabled address families 2024-06-03 18:34:31 +10:00
Mark Andrews d026dbe536 Don't forward UPDATE messages over disabled address families 2024-06-03 18:34:31 +10:00
Mark Andrews 5d99625515 Don't send NOTIFY over disabled address families 2024-06-03 18:34:31 +10:00
Mark Andrews 07cdf3e945 Check that no primaries is logged with -4 or -6
When in -4 mode check that "IPv6 disabled and no IPv4 primaries"
is logged and when in -6 mode check that "IPv4 disabled and no IPv6
primaries" is logged.
2024-06-03 18:34:31 +10:00
Mark Andrews 2cd4303249 Report non-effective primaries
When named is started with -4 or -6 and the primaries for a zone
do not have an IPv4 or IPv6 address respectively issue a log message.
2024-06-03 18:34:31 +10:00
Mark Andrews ecdde04e63 Zone transfers should honour -4 and -6 options
Check if the address family has been disabled when transferring
zones.
2024-06-03 18:34:31 +10:00
Mark Andrews 9be1873ef3 Add helper function isc_sockaddr_disabled 2024-06-03 18:34:31 +10:00
Matthijs Mekking 50a2c308d6 Merge branch '4708-uv-tcp-close-reset-issue' into 'main'
Deal with uv_tcp_close_reset more gracefully

Closes #4708

See merge request isc-projects/bind9!9022
2024-06-03 08:15:35 +00:00
Matthijs Mekking 113968f3a0 Add CHANGES entry for [GL #4708] 2024-06-03 10:15:18 +02:00
Matthijs Mekking c40e5c8653 Call reset_shutdown if uv_tcp_close_reset failed
If uv_tcp_close_reset() returns an error code, this means the
reset_shutdown callback has not been issued, so do it now.
2024-06-03 10:14:47 +02:00
Matthijs Mekking 5b94bb2129 Do not runtime check uv_tcp_close_reset
When we reset a TCP connection by sending a RST packet, do not bother
requiring the result is a success code.
2024-06-03 10:14:47 +02:00
Mark Andrews 91d5c9a878 Merge branch 'marka-placeholder' into 'main'
add placeholder

See merge request isc-projects/bind9!9083
2024-06-03 07:46:04 +00:00
Mark Andrews 728e53be47 add placeholder 2024-06-03 17:18:24 +10:00
Mark Andrews 52a2fb1ab3 Merge branch '2744-warning-checkhints-unable-to-get-root-ns-rrset-from-cache-not-found' into 'main'
Resolve "warning: checkhints: unable to get root NS rrset from cache: not found"

Closes #2744

See merge request isc-projects/bind9!8745
2024-05-31 06:16:24 +00:00
Mark Andrews 5be6ceebc4 Add CHANGES entry for [GL #2744] 2024-05-31 15:40:32 +10:00
Mark Andrews 87e3b9dbf3 Pass a memory context in to dns_cache_create 2024-05-31 15:40:32 +10:00
Mark Andrews 5e77edd074 Use a new memory context when flushing the cache
When the cache's memory context was in over memory state when the
cache was flushed it resulted in LRU cleaning removing newly entered
data in the new cache straight away until the old cache had been
destroyed enough to take it out of over memory state.  When flushing
the cache create a new memory context for the new db to prevent this.
2024-05-31 15:40:32 +10:00
Ondřej Surý 5f69e0a311 Merge branch '4750-set-loop-on-incoming-transfer' into 'main'
Create the new database for AXFR from the dns_zone API

Closes #4750

See merge request isc-projects/bind9!9073
2024-05-29 06:31:28 +00:00
Ondřej Surý 3310cac2b0 Create the new database for AXFR from the dns_zone API
The `axfr_makedb()` didn't set the loop on the newly created database,
effectively killing delayed cleaning on such database.  Move the
database creation into dns_zone API that knows all the gory details of
creating new database suitable for the zone.
2024-05-29 08:30:19 +02:00
Petr Špaček 37ae380e97 Merge branch 'stepan/hypothesis' into 'main'
Expand the wildcard system test with wider use of hypothesis

See merge request isc-projects/bind9!8461
2024-05-28 13:17:32 +00:00
Štěpán BalážikandPetr Špaček 9584a7bdcd Add a helper for uncompressed length of dnspython's dns.name.Name
This is useful for generating using hypothesis but also for other
cases.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček bb1e5cfa09 Move hypothesis strategies to isctest for later reuse
`isctest.hypothesis` seems to be a nice place to have these.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček f55cacbbfd Disable deadlines for hypothesis tests when running in CI
The times it takes to run tests CI vary significantly enough
that it makes hypothesis test reach their deadlines and fail randomly
marking the tests as flaky.

This commit disables the deadlines when running in CI.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček 9943172566 Test nested wildcard special case in the respective system test
See final remark of RFC 4592 2.2.1. for details.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček d0cfbd398e Expand the wildcard system test with wider use of hypothesis
The queries are now generated more generally (i. e. they have
multiple labels, etc.).
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček 5d738cd9ed Add hypothesis strategies for generating DNS names and company
The most important being `dns_names` that generates dns.name.Name
objects based on given paramaters.

No guarantees are given when it comes the uniformity of generated
samples, however it plays nicely with the hypothesis' shrinking
algorithm.

Once we use hypothesis more widely (in at least one more test) this file
should be moved for it to be reused easily.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček e7d46ad8ba Extend isctest package with more utility functions
Check for more rcodes and various properties needed in the wildcard
test. Add a `name` module for various dns.name.Name operations (with
`prepend_label` function only now).

Expose `timeout` as a parameter of `query.tcp`/`query.udp`.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček 02d1c5fc89 Silent pylint's line-too-long warning as it's handled better by black
Black allows the lines with string literals to be longer, which is
convenient for descriptive error messages.
2024-05-28 12:12:16 +00:00
Nicki Křížek 8cdfccf140 Merge branch 'nicki/use-bind-team-gitlab-tokens' into 'main'
Use bind-team tokens for CI gitlab access

See merge request isc-projects/bind9!9067
2024-05-27 11:13:34 +00:00
Nicki Křížek d391f0c958 Use BIND_TEAM_WRITE_TOKEN for autobackport bot
This is done to unify the token usage across our repositories to
simplify token maintenance.
2024-05-27 13:03:13 +02:00
Nicki Křížek 6767172bc0 Use BIND_TEAM_API_TOKEN for danger bot
This is done to unify the token usage across our repositories to
simplify token maintenance.
2024-05-27 13:03:10 +02:00
Ondřej Surý b70ef5e5a4 Merge branch 'ondrej/cleanup-dns_db' into 'main'
Cleanup the dns_cache unit

See merge request isc-projects/bind9!9064
2024-05-25 09:48:34 +00:00
Aram SargsyanandOndřej Surý 4d3c31b928 fixup! Merge branch 'ondrej/light-cleanup-of-rdataslab' into 'main' 2024-05-25 11:47:33 +02:00
Ondřej Surý 3feabc8a22 Cleanup the dns_cache unit
Remove duplicate code and use ISC_REFCOUNT_{DECL,IMPL} macros.
2024-05-25 11:47:33 +02:00
Michal Nowak 08eef0fa0d Merge branch 'mnowak/cross-version-config-tests-drop-allow_failure-true' into 'main'
Drop "allow_failure: true" in cross-version-config-tests job

See merge request isc-projects/bind9!9044
2024-05-24 11:44:39 +00:00
Michal NowakandNicki Křížek c58dd6e78f Workaround temporary cross-version-config-tests limitation
The system test from the BIND 9.19.24 release does not include the
isctest/vars/autoconf.py file from 9.19.25-dev, and therefore the job
will fail before the 9.19.25 release is published. In the meantime,
consider using the conf.sh file.
2024-05-24 11:01:40 +02:00
Nicki Křížek e712cf613f Fix oversight in cross-version-config test
This is a followup for 5e7b3d9ef36b199e2d24d385593a8e2f7d541b65. The
change slipped by during refactoring and this line wasn't updated.
2024-05-24 11:00:09 +02:00
Michal NowakandNicki Křížek 8d99ce28e8 Revert "Allow failure of cross-version-config test"
This reverts commit b99cdfab9d.
2024-05-24 10:59:27 +02:00
Ondřej Surý 7e87e2657a Merge branch 'ondrej/light-cleanup-of-rdataslab' into 'main'
Refactor the common buffer manipulation in rdataslab.c in macros

See merge request isc-projects/bind9!9063
2024-05-24 08:29:54 +00:00
Ondřej Surý 03ed19cf71 Refactor the common buffer manipulation in rdataslab.c in macros
The rdataslab.c was full of code like this:

        length = raw[0] * 256 + raw[1];

and

        count2 = *current2++ * 256;
        count2 += *current2++;

Refactor code like this into peek_uint16() and get_uint16 macros
to prevent code repetition and possible mistakes when copy and
pasting the same code over and over.

As a side note for an entertainment of a careful reader of the commit
messages: The byte manipulation was changed from multiplication and
addition to shift with or.

The difference in the assembly looks like this:

MUL and ADD:

	movzx   eax, BYTE PTR [rdi]
        movzx   edi, BYTE PTR [rdi+1]
        sal     eax, 8
        or      edi, eax

SHIFT and OR:

        movzx   edi, WORD PTR [rdi]
        rol     di, 8
        movzx   edi, di

If the result and/or buffer is then being used after the macro call,
there's more differences in favor of the SHIFT+OR solution.
2024-05-24 09:52:45 +02:00
Michal Nowak c8289279f0 Merge branch 'mnowak/alpine-3.20' into 'main'
Add Alpine Linux 3.20

See merge request isc-projects/bind9!9059
2024-05-23 11:19:26 +00:00
Michal Nowak 6f22e79ef9 Add Alpine Linux 3.20 2024-05-23 10:58:25 +02:00
Michal Nowak 1f5143e066 Merge branch 'mnowak/short-stress-tests-should-keep-artifacts' into 'main'
Short stress tests should keep artifacts

See merge request isc-projects/bind9!9056
2024-05-22 10:55:18 +00:00
Michal Nowak aa72747c80 Short stress tests should keep artifacts 2024-05-22 10:46:28 +02:00
Aydın Mercan 4de93e86fa Merge branch 'aydin/fix-trace' into 'main'
Fix typing mistakes in trace macros

See merge request isc-projects/bind9!9050
2024-05-20 11:45:22 +00:00
Aydın MercanandEvan Hunt 03a59cbb04 reinsert accidentally removed + in db trace
It only affects development when using `DNS_DB_TRACE`.
2024-05-17 18:11:23 -07:00
Aydın MercanandEvan Hunt 49e62ee186 fix typing mistakes in trace macros
The detach function declaration in `ISC__REFCOUNT_TRACE_DECL` had an
returned an accidental implicit int. While not allowed since C99, it
became an error by default in GCC 14.

`ISC_REFCOUNT_TRACE_IMPL` and `ISC_REFCOUNT_STATIC_TRACE_IMPL` expanded
into the wrong macros, trying to declare it again with the wrong number
of parameters.
2024-05-17 18:11:23 -07:00
Evan Hunt 5972a80714 Merge branch '4730-clang-format-header-file-changes' into 'main'
Resolve "Clang format header file changes"

Closes #4730

See merge request isc-projects/bind9!9047
2024-05-17 23:18:47 +00:00
Mark AndrewsandEvan Hunt 1697011af6 Ignore reformat sources with up-to-date clang-format-18 2024-05-17 16:03:46 -07:00
Mark AndrewsandEvan Hunt b7de2c7cb9 Clang-format header file changes 2024-05-17 16:03:21 -07:00
Arаm Sаrgsyаn add3a6ee8c Merge branch 'aram/mr8937-changes-placeholder' into 'main'
Add a CHANGES placeholder for [GL !8937]

See merge request isc-projects/bind9!9049
2024-05-17 10:48:23 +00:00
Aram Sargsyan 563ed741bf Add a CHANGES placeholder for [GL !8937] 2024-05-17 10:20:48 +00:00
Mark Andrews 8246465513 Merge branch '4726-increase-formerr-coverage-in-message-parsing' into 'main'
Resolve "Increase FORMERR coverage in message parsing"

Closes #4726

See merge request isc-projects/bind9!9034
2024-05-17 05:16:48 +00:00
Mark Andrews 6e9ed4983e add test cases for several FORMERR code paths:
- duplicated question
  - duplicated answer
  - qtype as an answer
  - two question types
  - question names
  - nsec3 bad owner name
  - short record
  - short question
  - mismatching question class
  - bad record owner name
  - mismatched class in record
  - mismatched KEY class
  - OPT wrong owner name
  - invalid RRSIG "covers" type
  - UPDATE malformed delete type
  - TSIG wrong class
  - TSIG not the last record
2024-05-17 13:39:22 +10:00
Evan Hunt 6a9ac65f0c Merge branch '4683-qpzone-tsan-fix' into 'main'
replace qpzone node attributes with atomics

Closes #4683

See merge request isc-projects/bind9!9033
2024-05-17 00:33:48 +00:00
Evan Hunt 9c882f1e69 replace qpzone node attriutes with atomics
there were TSAN error reports because of conflicting uses of
node->dirty and node->nsec, which were in the same qword.

this could be resolved by separating them, but we could also
make them into atomic values and remove some node locking.
2024-05-17 00:33:35 +00:00
Matthijs Mekking bcc6039bf5 Merge branch 'matthijs-qp-set-iterator' into 'main'
Rewrite fix_iterator()

See merge request isc-projects/bind9!9038
2024-05-16 09:50:08 +00:00
Matthijs Mekking 82e9d93c0b Two more qp test cases
Add two more cases that should select different predecessors from
different twigs.
2024-05-16 09:49:41 +00:00
Matthijs Mekking f882101265 Rewrite qp fix_iterator()
The fix_iterator() function had a lot of bugs in it and while fixing
them, the number of corner cases and the complexity of the function
got out of hand. Rewrite the function with the following modifications:

The function now requires that the iterator is pointing to a leaf node.
This removes the cases we have to deal when the iterator was left on a
dead branch.

From the leaf node, pop up the iterator stack until we encounter the
branch where the offset point is before the point where the search key
differs. This will bring us to the right branch, or at the first
unmatched node, in which case we pop up to the parent branch. From
there it is easier to retrieve the predecessor.

Once we are at the right branch, all we have to do is find the right
twig (which is either the twig for the character at the position where
the search key differs, or the previous twig) and walk down from there
to the greatest leaf or, in case there is no good twig, get the
previous twig from the successor and get the greatest leaf from there.

If there is no previous twig to select in this branch, because every
leaf from this branch node is greater than the one we wanted, we need
to pop up the stack again and resume at the parent branch. This is
achieved by calling prevleaf().
2024-05-16 09:49:41 +00:00
Matthijs Mekking 8b8c16d7a4 Get anyleaf when qp lookup is on a dead end branch
Move the fix_iterator out of the loop and only call it when we found
a leaf node. This leaf node may be the wrong leaf node, but fix_iterator
should correct that.

Also, when we don't need to set the iterator, just get any leaf. We
only need to have a leaf for the qpkey_compare and the end result does
not matter if compare was against an ancestor leaf or any leaf below
that point.
2024-05-16 09:49:41 +00:00
Michal Nowak 6b89d66ce8 Merge tag 'v9.19.24' 2024-05-16 11:37:12 +02:00
Mark Andrews ed5b9b0898 Merge branch '4517-dnssec-verify-reports-errors-in-nsec3-chain' into 'main'
Resolve "dnssec-verify reports errors in NSEC3 chain"

Closes #4517

See merge request isc-projects/bind9!8631
2024-05-16 01:52:55 +00:00
Mark Andrews e4dbf4be8e Add CHANGES note for [GL #4517] 2024-05-16 10:28:27 +10:00
Mark Andrews dd13f41ae1 Don't sign non-apex DNSKEY records
DNSKEY can only be validated if it is signed by itself.  Stop
attempting to sign non apex DNSKEY RRsets.
2024-05-16 10:28:27 +10:00
Mark Andrews 315ad2df7a Remove invalid DNSKEY RRset from zone 2024-05-16 10:28:27 +10:00
Mark Andrews 122111f75e Add regression test data for [GL #4517]
An obscured DNSKEY RRset at a delegation was incorrectly added to
the NSEC/NSEC3 type bit map leading to zone verification failures.
This adds such a RRset to the test zone.
2024-05-16 10:28:27 +10:00
Mark Andrews b3efc15be4 Fail if there are non apex DNSKEYs
DNSSEC only works when DNSKEYs are self signed.  This only occurs
when the DNSKEY RRset is at the apex.  Cause dnssec-signzone to
fail if it attempts to sign an non-apex DNSKEY RRset.
2024-05-16 10:28:27 +10:00
Mark Andrews ec3c624814 Properly build the NSEC/NSEC3 type bit map
DNSKEY was incorrectly being added to the NESC/NSEC3 type bit map
when it was obscured by the delegation.  This lead to zone verification
failures.
2024-05-16 10:27:49 +10:00
Mark Andrews e84615629f Properly update 'maxtype'
'maxtype' should be checked to see if it should be updated whenever
a type is added to the type map.
2024-05-16 10:20:49 +10:00
Ondřej Surý 333d1881f9 Merge branch 'ondrej/isc_httpd-reference-counting' into 'main'
Properly attach/detach isc_httpd in case read ends earlier than send

See merge request isc-projects/bind9!9037
2024-05-15 12:32:15 +00:00
Ondřej Surý eb862ce509 Properly attach/detach isc_httpd in case read ends earlier than send
An assertion failure would be triggered when sending the TCP data ends
after the TCP reading gets closed.  Implement proper reference counting
for the isc_httpd object.
2024-05-15 12:22:10 +02:00
Michał Kępień 5fd3530741 Merge branch '4719-placeholder' into 'main'
Add placeholder for GL #4719

See merge request isc-projects/bind9!9036
2024-05-15 08:21:55 +00:00
Michał Kępień ea6032146c Add placeholder for GL #4719 2024-05-15 10:20:19 +02:00
Evan Hunt 0748847400 Merge branch '4717-qp-lookup-creates-incorrect-chain' into 'main'
Fix dns_qp_lookup() chain inconsistency after fix_iterator()

Closes #4717

See merge request isc-projects/bind9!9028
2024-05-14 20:36:11 +00:00
Matthijs MekkingandEvan Hunt 730e532cac Test check_predecessors with chain
In addition to testing check_qpchain in combination with qpiter,
test check_predecessors in combination with a qpchain.
2024-05-14 12:58:46 -07:00
Evan Hunt b6815de316 Fix QP chain on partial match
When searching for a requested name in dns_qp_lookup(), we may add
a leaf node to the QP chain, then subsequently determine that the
branch we were on was a dead end. When that happens, the chain can be
left holding a pointer to a node that is *not* an ancestor of the
requested name.

We correct for this by unwinding any chain links with an offset
value greater or equal to that of the node we found.
2024-05-14 12:58:46 -07:00
Petr ŠpačekandEvan Hunt 5d96f11693 Unit test to demonstrate issue #4717
Iterator in lookup() call must be non-NULL to trigger the issue.
Run chain tests twice, once without iterator and second time with
iterator.
2024-05-14 12:58:46 -07:00
Matthijs MekkingandEvan Hunt 91de4f6490 Refactor fix_iterator
The code below the if/else construction could only be run if the 'if'
code path was taken. Move the code into the 'if' code block so that
it is more easier to read.
2024-05-14 12:58:46 -07:00
Nicki Křížek ac569ad544 Merge branch 'nicki/add-mailmap' into 'main'
Add .mailmap to the git repo

See merge request isc-projects/bind9!9025
2024-05-14 11:28:00 +00:00
Nicki Křížek 986013a708 Add .mailmap to the git repo
Mailmap can be used to unify the display name in standard git tools.
2024-05-14 13:05:45 +02:00
Michal Nowak d9fbbd537d Merge branch 'mnowak/pytest_rewrite_include-multiplecfg' into 'main'
Rewrite include-multiplecfg system test to pytest

See merge request isc-projects/bind9!8806
2024-05-14 10:46:10 +00:00
Michal Nowak e9e8753306 Rewrite include-multiplecfg system test to pytest 2024-05-14 11:45:55 +02:00
Michal Nowak 77a42f8875 Use isctest.run.cmd() helper function in tests 2024-05-14 11:45:55 +02:00
Tom KrizekandMichal Nowak a9f3fb3db5 Add isctest.run.cmd() helper function 2024-05-14 11:45:55 +02:00
Aydın Mercan 4f34011ccc Merge branch 'aydin/author-expand' into 'main'
Expand list in chaos authors response

See merge request isc-projects/bind9!9026
2024-05-13 09:57:25 +00:00
Aydın Mercan df862f9fef Expand list in chaos authors response
The list isn't exactly maintained but it helped with some BIND history
tracking and is basically harmless so it might be worth holding onto it.
I have adapted the name to ASCII so IDN support won't be necessary.
2024-05-13 11:24:29 +03:00
Aydın Mercan aa860b3ab1 Merge branch '4668-request-to-add-a-new-statistic-recursive-client-high-water-in-rndc-status-and-stats-channel' into 'main'
Add new statistics variable for recursive client high-water

Closes #4668

See merge request isc-projects/bind9!9023
2024-05-10 10:52:51 +00:00
Aydın Mercan d6dd51bb1b Added CHANGES and release note for [GL #4668] 2024-05-10 12:08:52 +03:00
Aydın Mercan e037520b92 Keep track of the recursive clients highwater
The high-water allows administrators to better tune the recursive
clients limit without having to to poll the statistics channel in high
rates to get this number.
2024-05-10 12:08:52 +03:00
Aydın Mercan 09e4fb2ffa Return the old counter value in isc_stats_increment
Returning the value allows for better high-water tracking without
running into edge cases like the following:

0. The counter is at value X
1. Increment the value (X+1)
2. The value is decreased multiple times in another threads (X+1-Y)
3. Get the value (X+1-Y)
4. Update-if-greater misses the X+1 value which should have been the
   high-water
2024-05-10 12:08:52 +03:00
Nicki Křížek ced011f05a Merge branch 'tkrizek/pytest-conf-cleanup' into 'main'
Define environment variables in pytest instead of conf.sh

See merge request isc-projects/bind9!8800
2024-05-09 16:26:26 +00:00
Nicki Křížek faeec83b64 Ensure OPENSSL_CONF is a file if it exists
Prevent unexpected behavior in cases where the OPENSSL_CONF path would
exist, but it wouldn't point to a file.
2024-05-09 17:08:11 +02:00
Nicki Křížek ac7c657d19 Move isctest.var initialization to conftest.py
The environment variable initialization requires logging to be set up
first. Ensure the initialization is delayed until loggers have been set
up.
2024-05-09 17:08:11 +02:00
Tom KrizekandNicki Křížek 2a09f632ab Use a dedicated file for each autoconf variable
To avoid any escaping issues or messing with a language-specific format
when the variable has to be parsed, create a dedicated file for each
variable that is obtained from autoconf.
2024-05-09 17:08:10 +02:00
Tom KrizekandNicki Křížek b99cdfab9d Allow failure of cross-version-config test
The test is bound to fail until it is executed against a new release
which will include the pytest env var refactoring.
2024-05-09 17:08:10 +02:00
Tom KrizekandNicki Křížek 2d1f348483 Move env var initialization to isctest.vars
Make sure all initialization takes place in isctest.vars.__init__ and
export the initial env vars there. Remove the no longer needed env
fixture and use os.environ instead.
2024-05-09 17:08:10 +02:00
Tom KrizekandNicki Křížek 1f6f2234d8 Move dir env var handling to isctest.vars.dirs 2024-05-09 17:08:10 +02:00
Tom KrizekandNicki Křížek 41cb553bdd Move port env vars into isctest.vars.ports module
The fixture for port assignment isn't needed, replace it with the common
way of handling environment variables.
2024-05-09 17:08:10 +02:00
Tom KrizekandNicki Křížek cca26efe52 Don't export openssl-related env vars unless set
If OPENSSL_CONF is exported as an empty string, it will cause issues on
rhel9fips. Allow the environment variables to be set and exported, but
make sure to only export them if they have been set by the user.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek b100ce4c88 Parse openssl-related vars in pytest
The openssl config needs to be parsed for some tests that use SoftHSM2.
Rewrite the parsing to python and ensure the required variables are
properly set test-wide.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek e531bfc3b3 Adjust .gitlab-ci env var detection with sed
The environment variables set by autoconf were moved to autoconf.py.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek 46433ae17b Coalesce system test variables
Provide a single point of access to all the variables used by tests. Use
a custom dict-like structure to access the underlying data without
making a copy. This allows the individual modules to update the contents
at runtime, which is used for some variables.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek 308a8727e5 Format conf.sh with shfmt
No manual changes in this commit - simply running shfmt for proper shell
code formatting.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek 8c6e6758b5 Load env vars in shell-only processing of conf.sh
While this isn't required for pytest operation and execution of the
system test suite, it can be handy to allow test script development and
debugging. Especially setup scripts often source conf.sh and expect
environment variables to be loaded. If these scripts are executed
stand-alone, the environment variables need to be loaded from the python
package.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek ab27f504ca Move environment variables from conf.sh to pytest
Remove conf.sh.in and move the environment variables into isctest/vars
python package. This enabled the removal of an ugly pytest hack which
loaded and parsed these variables from the environment.
2024-05-09 17:08:08 +02:00
Tom KrizekandNicki Křížek b3caa9226d Remove terminal color support from conf.sh.common
Pytest processes all the output, so the terminal colors are no longer
interpreted. Remove the obsolete code.
2024-05-09 17:08:07 +02:00
Michal Nowak 91275eb6bc Merge branch '4635-add-rbt-ci-job' into 'main'
Add jobs for RBT zone- & cache-enabled GCC builds

Closes #4635

See merge request isc-projects/bind9!8997
2024-05-09 13:50:42 +00:00
Mark AndrewsandMichal Nowak 1482e9bbb9 Address qp/rbtdb backup file style differences
qp and rbtdb produce stylistically different backup files.  This
was causing the xferquota system test to fail.  This has been
addressed by making the test independent of the stylistic differences.
2024-05-09 15:03:45 +02:00
Michal Nowak 8f687fff35 Add jobs for RBT zone- & cache-enabled GCC builds 2024-05-09 15:03:45 +02:00
Mark Andrews 149c61b3ca Merge branch '4502-missing-reference' into 'main'
Resolve "Missing reference?"

Closes #4502

See merge request isc-projects/bind9!8996
2024-05-09 00:08:09 +00:00
Mark Andrews 53698ad58d Add CHANGES for [GL #4502] 2024-05-09 08:17:44 +10:00
Mark Andrews 88c48dde5e Stop processing catalog zone changes when shutting down
Abandon catz_addmodzone_cb  and catz_delzone_cb processing if the
loop is shutting down.
2024-05-09 08:17:44 +10:00
Mark Andrews 941ad2b3c5 catz should use weak attachment to the view 2024-05-09 08:17:44 +10:00
Mark Andrews 307e3ed9a6 catzs->view should maintain a view reference
Use dns_view_weakattach and dns_view_weakdetach to maintain a
reference to the view referenced through catzs->view.
2024-05-09 08:17:44 +10:00
Petr Špaček 9357019498 Merge branch 'pspacek/doc-rfc-ref-update' into 'main'
Update RFC references in documentation

See merge request isc-projects/bind9!9020
2024-05-08 07:07:48 +00:00
Petr Špaček ead4a110ad Update reference for Catalog Zones spec to RFC9432 2024-05-07 13:38:40 +02:00
Petr Špaček 153311da2d Update KSK root sentinel references
The mechanism was published as RFC 8509. I've briefly looked at diff
between versions -08 and the RFC and did not find significant protocol
change. Quick manual check confirms what we seem to comply with the
published protocol.
2024-05-07 13:38:40 +02:00
Petr Špaček 8e4c0329c3 Mention RFC 9276 Guidance for NSEC3 Parameter Settings
Draft was eventually published as RFC 9276 but we did not update our
docs. Also add couple mentions in relevant places in the ARM and
dnssec-signzone man page, mainly around "do not touch" places.
2024-05-07 13:38:40 +02:00
Petr Špaček c5d6769e11 Update DNSSEC Operational Practices references to Version 2
RFC 4641 was obsoleted by 6781.
2024-05-07 13:38:10 +02:00
Mark Andrews 12ae798bc7 Merge branch '4704-svcb-https-bind9-and-dig-fail-to-parse-packet-if-zero-svcpriority-and-existing-svcparams' into 'main'
Resolve "SVCB/HTTPS: Bind9 and Dig fail to parse packet if zero SvcPriority and existing SvcParams"

Closes #4704

See merge request isc-projects/bind9!9000
2024-05-07 02:07:21 +00:00
Mark Andrews e0b5c85f5a Add CHANGES note for [GL #4704] 2024-05-07 11:21:20 +10:00
Mark Andrews 799046929c Only check SVBC alias forms at higher levels
Allow SVBC (HTTPS) alias form with parameters to be accepted from
the wire and when transfered.  This is for possible future extensions.
2024-05-07 11:20:49 +10:00
Mark Andrews 836da75dc1 Merge branch '4357-treat-notfile-as-eof' into 'main'
Remove infinite loop on ISC_R_NOFILE

Closes #4357

See merge request isc-projects/bind9!9004
2024-05-07 01:03:00 +00:00
Mark Andrews 236a38a7c9 Add CHANGES note for [GL #4357] 2024-05-07 10:01:48 +10:00
Mark Andrews e697d20f00 Test including a directory in a zone file 2024-05-07 10:01:12 +10:00
Mark Andrews efd27bb82d Remove infinite loop on ISC_R_NOFILE
When parsing a zonefile named-checkzone (and others) could loop
infinitely if a directory was $INCLUDED.  Record the error and treat
as EOF when looking for multiple errors.

This was found by Eric Sesterhenn from X41.
2024-05-07 10:01:12 +10:00
Mark Andrews 1a12fac371 Merge branch '4353-fix-nibbles' into 'main'
Address infinite loop when processing $GENERATE

Closes #4353

See merge request isc-projects/bind9!9003
2024-05-06 23:58:36 +00:00
Mark Andrews f154187fd0 Add CHANGES note for [GL #4353] 2024-05-07 09:20:12 +10:00
Mark Andrews 32535de856 Test $GENERATE in nibble mode with a negative value
Negative values used to cause $GENERATE to loop forever.
2024-05-07 09:19:43 +10:00
Mark Andrews 371824f078 Address infinite loop when processing $GENERATE
In nibble mode if the value to be converted was negative the parser
would loop forever.  Process the value as an unsigned int instead
of as an int to prevent sign extension when shifting.

This was found by Eric Sesterhenn from X41.
2024-05-07 09:19:43 +10:00
Michal Nowak d08e3ad9d9 Merge branch 'mnowak/fedora-40' into 'main'
Add Fedora 40

See merge request isc-projects/bind9!8979
2024-05-06 17:40:55 +00:00
Michal Nowak b3a11f38b1 Supress the leak detection in xmlNewGlobalState 2024-05-06 19:35:36 +02:00
Michal Nowak 1a09f822ad Add Fedora 40 2024-05-06 19:35:29 +02:00
Michal Nowak 4247e36340 Merge branch 'mnowak/ubuntu-24.04-noble-numbat' into 'main'
Add Ubuntu 24.04 LTS (Noble Numbat)

See merge request isc-projects/bind9!8980
2024-05-06 16:35:59 +00:00
Michal Nowak d02ed1a0eb Add Ubuntu 24.04 LTS (Noble Numbat) 2024-05-06 17:58:22 +02:00
Michal Nowak 3daf2ee76e Merge branch 'mnowak/openbsd-7.5' into 'main'
Add OpenBSD 7.5

See merge request isc-projects/bind9!8965
2024-05-06 15:20:24 +00:00
Michal Nowak 102fccdcba Add OpenBSD 7.5 2024-05-06 17:11:05 +02:00
Michal Nowak c3a7d9cd29 Merge branch '4711-stress-test-finer-runtime-granularity' into 'main'
Add short version of "stress" tests to MR-triggered pipelines

Closes #4711

See merge request isc-projects/bind9!9002
2024-05-06 14:05:22 +00:00
Michal Nowak f33b746353 Add short "stress" test jobs 2024-05-06 15:36:49 +02:00
Michal Nowak 58a1a50e76 Rename "stress" tests to long "stress" tests 2024-05-06 15:36:49 +02:00
Michal Nowak 1d77a3b3c6 Revert "Drop parallel build from stress tests"
This reverts commit 3fd7e7c81f.

In AWS this is no longer a concern.
2024-05-06 15:36:49 +02:00
Nicki Křížek 12fed598ea Merge branch '4543-reenable-unreachable-dnssec-checks' into 'main'
Re-enable accidentally disabled dnssec checks

Closes #4543

See merge request isc-projects/bind9!8667
2024-05-06 13:15:49 +00:00
Matthijs MekkingandNicki Křížek 02f5d82333 Update hours-vs-days test
This test is outdated because it tested the 'sig-validity-interval'
option that has been replaced by dnssec-policy's 'signatures-validity',
'signatures-refresh', and 'signatures-jitter' options.

Nevertheless, it tests if the jitter is spread correctly.

Update the test to make use of 'signatures-jitter', set the value
to 1 day (meaning resign in 499 days since 'signatures-validity' is
set to 500 days).

Note that this previously changed erroneously the refresh value to
449 days (should have been 499 days, but that is not allowed by
checkconf, since it is above 90% of 'signatures-validity').
2024-05-06 14:44:10 +02:00
Matthijs MekkingandNicki Křížek a68f8c7cf0 Fix dnssec system test iterations too high
After we have changed the maximum allowed iterations to 51 for signing,
the NSEC3 chain has changed and requires one more NSEC to be returned
in the answer (plus corresponding RRSIG). So the expected number or
records in the authority section is now 8.
2024-05-06 14:44:10 +02:00
Matthijs MekkingandNicki Křížek fc5eb493c9 Offline KSK and dnssec-policy not yet supported
If the key is offline and the keymgr runs, it will treat it as a missing key,
and generate a new key (according to the policy). Fix the test by putting
back the KSK temporarily when we run 'rndc loadkeys'.
2024-05-06 14:44:10 +02:00
Matthijs MekkingandNicki Křížek ebb90ba77f Fix ZSK rollovers in dnssec system test
1. When generating keys, don't set timing metadata. Otherwise keys
   are considered to be in use and won't be selected when dnssec-policy
   starts a new key rollover.

2. Add an extra check to make sure the new ZSK (zsk2) is prepublished.
   Also add a check to make sure it has become active.

3. When using dnssec-settime, add -s to also write to key state files.
2024-05-06 14:44:10 +02:00
Tom KrizekandNicki Křížek 2e26eac31c Ensure dnssec test doesn't leak queries to root servers
The config was recently modified to ensure ns4 won't leak any queries to
root servers. However, the test wasn't executed and it turns out the way
this was handled actually broke the test case. Add our custom root hint
to both of the views to ensure the test can still pass without leaking
any queries.
2024-05-06 14:44:09 +02:00
Tom KrizekandNicki Křížek 672b07a503 Re-enable accidentally disabled dnssec checks
Remove the premature exit statement which made the rest of the checks
unreachable.
2024-05-06 14:44:08 +02:00
Matthijs Mekking 005c1386ea Merge branch '3323-different-rpz-soa-ttl' into 'main'
RPZ response's SOA record is incorrectly set to 1

Closes #3323

See merge request isc-projects/bind9!8998
2024-05-06 10:10:42 +00:00
Matthijs Mekking 2726b569b1 Add release note and CHANGES for #3323 2024-05-06 11:39:02 +02:00
Matthijs Mekking 5d7e613e81 RPZ response's SOA record is incorrectly set to 1
An RPZ response's SOA record TTL is set to 1 instead of the SOA TTL,
a boolean value is passed on to query_addsoa, which is supposed to be
a TTL value. I don't see what value is appropriate to be used for
overriding, so we will pass UINT32_MAX.
2024-05-06 11:38:36 +02:00
Matthijs Mekking 2e99c66a00 Merge branch 'matthijs-offline-ksk-add-ksk-on-sign' into 'main'
Add DNSKEY record for KSK when creating the SKR

See merge request isc-projects/bind9!8986
2024-05-06 09:30:10 +00:00
Matthijs Mekking 03e8747aaa Retrieve DNSKEY TTL from policy
The desired DNSKEY TTL is configured in the policy so set it to that
value on new RRsets. Note that the same TTL is used for CDS and CDNSKEY.
2024-05-06 10:54:41 +02:00
Matthijs Mekking d9fb2054f1 Rename create_cds to create_ksk
Now that this function also creates the DNSKEY record for the KSKs,
as well as other associated records such as CDS and CDNSKEY, rename
the function to something slightly better.
2024-05-06 10:54:41 +02:00
Matthijs Mekking 30ce8abd30 Add DNSKEY rr corresponding to the KSK to the SKR
When signing a KSR, add the DNSKEY records from the signing KSK(s) to
the DNSKEY RRset prior to signing.
2024-05-06 10:54:41 +02:00
Matthijs Mekking 6b7bd77596 Don't add KSKs to the KSR
Creating the KSR happens on the "ZSK side". The KSK is offline and while
the public key and state file may be present, draft-icann-dnssec-keymgmt-01.txt
suggest that the KSR only contains ZSKs.

This is also what knot dns does, so it would also be in the spirit of
interoperability.
2024-05-06 10:54:41 +02:00
Matthijs Mekking 3bf4ec95dd Merge branch 'matthijs-fix-dnssec-ksr-version-missing' into 'main'
Fix missing version in KSR

See merge request isc-projects/bind9!8983
2024-05-06 08:40:46 +00:00
Matthijs Mekking 0071e6c10a Fix missing version in KSR
The final line in a KSR ";; KeySigningRequest generated at ..." was
missing the version number, that has now been fixed.

Thanks Libor Peltan for reporting.
2024-05-06 09:52:01 +02:00
Michal Nowak b327da30f8 Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.19.25' into 'main'
Set up version and release notes for BIND 9.19.25

See merge request isc-projects/bind9!9005
2024-05-03 14:01:59 +00:00
Michal Nowak 4fae72e2de Set up release notes for BIND 9.19.25 2024-05-03 15:51:53 +02:00
Michal Nowak fd880c29f2 Update BIND version to 9.19.25-dev 2024-05-03 15:51:53 +02:00
Michal Nowak be3e3da7b2 Update BIND version for release 2024-05-03 09:11:45 +02:00
Michal Nowak b507cb7bc2 Add a CHANGES marker 2024-05-03 09:10:49 +02:00
Michal Nowak 8793a41d8f Merge branch 'mnowak/prepare-documentation-for-bind-9.19.24' into 'v9.19.24-release'
Prepare documentation for BIND 9.19.24

See merge request isc-private/bind9!684
2024-05-03 07:08:26 +00:00
Michal Nowak 0f81fbcb1f Tweak and reword release notes 2024-05-02 19:16:58 +02:00
Michal Nowak 8cdc0eafd9 Prepare release notes for BIND 9.19.24 2024-05-02 12:31:00 +02:00
Arаm Sаrgsyаn 265b08b98e Merge branch '4710-qpcache-crash-on-assert-in-decref' into 'main'
Fix a bug in expireheader() call arguments order

Closes #4710

See merge request isc-projects/bind9!9001
2024-05-02 10:25:55 +00:00
Aram Sargsyan 8052848d50 Fix a bug in expireheader() call arguments order
The expireheader() call in the expire_ttl_headers() function
is erroneous as it passes the 'nlocktypep' and 'tlocktypep'
arguments in a wrong order, which then causes an assertion
failure.

Fix the order of the arguments so it corresponds to the function's
prototype.
2024-05-02 08:38:35 +00:00
Evan Hunt f8f0f45043 Merge branch '4702-qpiter-fix' into 'main'
dns_qp_lookup() doesn't handle searches for escaped characters well

Closes #4702

See merge request isc-projects/bind9!8999
2024-05-01 08:13:58 +00:00
Evan Hunt 9bbba20fbf CHANGES for [GL #4702] 2024-05-01 00:36:51 -07:00
Evan Hunt f81bf6bafd handle QP lookups involving escaped characters better
in QP keys, characters that are not common in DNS names are
encoded as two-octet sequences. this caused a glitch in iterator
positioning when some lookups failed.

consider the case where we're searching for "\009" (represented
in a QP key as {0x03, 0x0c}) and a branch exists for "\000"
(represented as {0x03, 0x03}). we match on the 0x03, and continue
to search down. at the point where we find we have no match,
we need to pop back up to the branch before the 0x03 - which may
be multiple levels up the stack - before we position the iterator.
2024-05-01 00:36:51 -07:00
Evan Hunt a23ce2c53c add another test case for an incorrect QP iterator position
build a database tree with names containing control characters,
search for another control character, and verify the iterator is
positioned correctly.
2024-05-01 00:36:16 -07:00
Matthijs MekkingandEvan Hunt ada46eb9f5 Add a unit test case for converting \000\009
Sanity checking that this domain converts to the key I am expecting.

Also fix some of the other names that had trailing 0x02 bits.
2024-04-30 16:00:13 -07:00
Evan Hunt a0bd1e67cd add a test method to print QP keys
add a method qp_test_printkey() to print the name encoded in a QP key.
2024-04-30 15:58:17 -07:00
Evan Hunt 539518bfba Merge branch 'each-qpcache-cleanup' into 'main'
clean up and speed up qpcache

See merge request isc-projects/bind9!8987
2024-04-30 20:28:52 +00:00
Evan Hunt 4b02246130 fix more ambiguous struct names
there were some structure names used in qpcache.c and qpzone.c that
were too similar to each other and could be confusing when debugging.
they have been changed as follows:

in qcache.c:
- changed_t was unused, and has been removed
- search_t -> qpc_search_t
- qpdb_rdatasetiter_t -> qpc_rditer_t
- qpdb_dbiterator_t -> qpc_dbiter_t

in qpzone.c:
- qpdb_changed_t -> qpz_changed_t
- qpdb_changedlist_t -> qpz_changedlist_t
- qpdb_version_t -> qpz_version_t
- qpdb_versionlist_t -> qpz_versionlist_t
- qpdb_search_t -> qpz_search_t
- qpdb_load_t -> qpz_search_t
2024-04-30 12:50:01 -07:00
Evan Hunt e300dfce46 use dns_qp_getname() where possible
some calls to dns_qp_lookup() do not need partial matches, QP chains
or QP iterators. in these cases it's more efficient to use
dns_qp_getname().
2024-04-30 12:50:01 -07:00
Evan Hunt 2789e58473 get foundname from the node
when calling dns_qp_lookup() from qpcache, instead of passing
'foundname' so that a name would be constructed from the QP key,
we now just use the name field in the node data. this makes
dns_qp_lookup() run faster.

the same optimization has also been added to qpzone.

the documentation for dns_qp_lookup() has been updated to
discuss this performance consideration.
2024-04-30 12:50:01 -07:00
Evan Hunt 04d319afe4 include the nodenames when calculating memory to purge
when the cache is over memory, we purge from the LRU list until
we've freed the approximate amount of memory to be added. this
approximation could fail because the memory allocated for nodenames
wasn't being counted.

add a dns_name_size() function so we can look up the size of nodenames,
then add that to the purgesize calculation.
2024-04-30 12:50:01 -07:00
Evan Hunt a8bda6ff1e simplify qpcache iterators
in a cache database, unlike zones, NSEC3 records are stored in
the main tree. it is not necessary to maintain a separate 'nsec3'
tree, nor to have code in the dbiterator implementation to traverse
from one tree to another.

(if we ever implement synth-from-dnssec using NSEC3 records, we'll
need to revert this change. in the meantime, simpler code is better.)
2024-04-30 12:50:01 -07:00
Evan Hunt 7ff43befb7 clean up unnecessary dbiterator code related to origin
the QP database doesn't support relative names as the RBTDB did, so
there's no need for a 'new_origin' flag or to handle `DNS_R_NEWORIGIN`
result codes.
2024-04-30 12:42:32 -07:00
Evan Hunt 85ab92b6e0 more cleanups in qpcache.c
- remove unneeded struct members and misleading comments.
- remove unused parameters for static functions.
- rename 'find_callback' to 'delegating' for consistency with qpzone;
  the find callback mechanism is not used in QP databases.
2024-04-30 12:42:31 -07:00
Evan Hunt 3acab71d46 rename QPDB_HEADERNODE to HEADERNODE
this makes the macro consistent between qpcache.c and qpzone.c.

also removed a redundant definition of HEADERNODE in qpzone.c.
2024-04-30 12:42:31 -07:00
Evan Hunt 46d40b3dca fix structure names in qpcache.c and qpzone.c
- change dns_qpdata_t to qpcnode_t (QP cache node), and dns_qpdb_t to
  qpcache_t, as these types are only accessed locally.
- also change qpdata_t in qpzone.c to qpznode_t (QP zone node), for
  consistency.
- make the refcount declarations for qpcnode_t and qpznode_t static,
  using the new ISC_REFCOUNT_STATIC macros.
2024-04-30 12:42:07 -07:00
Evan Hunt 20d32512ca clean up unnecessary requirements in qpcache.c
qpcache can only support cache semantics now, so there's
no longer any need to check for that internally.
2024-04-30 12:31:48 -07:00
Evan Hunt a5d0e6c4ba add static macros for ISC_REFCOUNT_DECL/IMPL
this commit adds a mechanism to statically declare attach/detach
and ref/unref methods, for objects that are only accessed within
a single C file.
2024-04-30 12:31:48 -07:00
Ondřej Surý bc8095311a Merge branch 'ondrej/improve-newref-checks' into 'main'
Improve the reference counting in newref()

See merge request isc-projects/bind9!8914
2024-04-30 18:43:39 +00:00
Ondřej Surý c13a1d8b01 Improve the reference counting checks in newref()
In qpcache (and rbtdb), there are some functions that acquire
neither the tree lock nor the node lock when calling newref().
In theory, this could lead to a race in which a new reference
is added to a node that was about to be deleted.

We now detect this condition by passing the current tree and node
lock status to newref(). If the node was previously unreferenced
and we don't hold at least one read lock, we will assert.
2024-04-30 08:41:56 +02:00
Michal Nowak b1b9ac1cba Merge branch 'mnowak/stress-tests-freebsd-instance-autoscaler' into 'main'
Use FreeBSD autoscaler for "stress" tests

See merge request isc-projects/bind9!8968
2024-04-29 18:10:52 +00:00
Michal Nowak 65a93b77e1 Use FreeBSD autoscaler for "stress" tests
The FreeBSD autoscaler has been configured to utilize the new "instance"
GitLab Runner executor to spawn "stress" test CI jobs on AWS EC2
dynamically. A shared GitLab Runner named "freebsd-instance-autoscaler"
has been set up in GitLab CI/CD to communicate with EC2, provisioning VM
instances on demand based on a FreeBSD 13 AMI image. This image is the
same as the one previously used for FreeBSD "stress" tests before the
implementation of autoscaling (specifically, the
"freebsd13-amd64-bind9stress.aws.lab.isc.org" GitLab Runner in CI/CD).
2024-04-29 19:53:51 +02:00
Michał Kępień 29cef34a34 Merge branch 'michal/update-urls-and-paths-for-the-bind-9-qa-repository' into 'main'
Update URLs and paths for the BIND 9 QA repository

See merge request isc-projects/bind9!8990
2024-04-29 09:48:06 +00:00
Michał Kępień 25ec1d79e4 Update URLs and paths for the BIND 9 QA repository
Since the BIND 9 QA repository has been made public, adjust the relevant
URLs and paths used in .gitlab-ci.yml so that they work with the public
version of that repository.
2024-04-26 18:43:07 +02:00
Aydın Mercan 79573f1390 Merge branch '4523-dnstap-support-for-new-transport-protocols' into 'main'
Emit and read correct DoT and DoH dnstap entries

Closes #4523

See merge request isc-projects/bind9!8697
2024-04-26 15:47:46 +00:00
Aydın Mercan 042bb98846 Add CHANGES and release note for [GL #4523] 2024-04-26 16:12:29 +03:00
Aydın Mercan f30008a71c Provide an early escape hatch for ns_client_transport_type
Because some tests don't have a legtimate handle, provide a temporary
return early that should be fixed and removed before squashing. This
short circuiting is still correct until DoQ/DoH3 support is introduced.
2024-04-26 16:12:29 +03:00
Aydın Mercan b5478654a2 Add fallback to ns_client_get_type despite unreachable
GCC might fail to compile because it expects a return after UNREACHABLE.
It should ideally just work anyway since UNREACHABLE is either a
noreturn or UB (__builtin_unreachable / C23 unreachable).

Either way, it should be optimized almost always so the fallback is
free or basically free anyway when it isn't optimized out.
2024-04-26 16:12:29 +03:00
Aydın Mercan 4a3f7fe1ef Emit and read correct DoT and DoH dnstap entries
Other protocols still pretend to be TCP/UDP.
This only causes a difference when using dnstap-read on a file with DoQ
or DNSCrypt entries
2024-04-26 16:12:29 +03:00
Aydın Mercan 9d1a8a98c6 Update the dnstap protobuf definition
The new definition includes the missing protocol definitions and
specifies the protobuf version.
2024-04-26 16:08:46 +03:00
Evan Hunt 657ee2b997 Merge branch 'each-qpzone-oneheap' into 'main'
simplify qpzone database by using only one heap for resigning

See merge request isc-projects/bind9!8889
2024-04-26 01:19:42 +00:00
Ondřej SurýandEvan Hunt 6c54337f52 avoid a race in the qpzone getsigningtime() implementation
the previous commit introduced a possible race in getsigningtime()
where the rdataset header could change between being found on the
heap and being bound.

getsigningtime() now looks at the first element of the heap, gathers the
locknum, locks the respective lock, and retrieves the header from the
heap again.  If the locknum has changed, it will rinse and repeat.
Theoretically, this could spin forever, but practically, it almost never
will as the heap changes on the zone are very rare.

we simplify matters further by changing the dns_db_getsigningtime()
API call. instead of passing back a bound rdataset, we pass back the
information the caller actually needed: the resigning time, owner name
and type of the rdataset that was first on the heap.
2024-04-25 15:48:43 -07:00
Evan Hunt 7e6be9f1b5 simplify qpzone database by using only one heap for resigning
in RBTDB, the heap was used by zone databases for resigning, and
by the cache for TTL-based cache cleaning. the cache use case required
very frequent updates, so there was a separate heap for each of the
node lock buckets.

qpzone is for zones only, so it doesn't need to support the cache
use case; the heap will only be touched when the zone is updated or
incrementally signed. we can simplify the code by using only a single
heap.
2024-04-25 15:41:39 -07:00
Evan Hunt 7d289e5333 Merge branch '4659-rootkeysentinel-test-fails-for-certain-values-of-oldid' into 'main'
fix_iterator() bug causes DNSSEC NXDOMAIN responses to be broken

Closes #4659

See merge request isc-projects/bind9!8942
2024-04-25 18:10:29 +00:00
Evan Hunt 6f4ef40ccd CHANGES for [GL #4659] 2024-04-25 10:30:47 -07:00
Evan Hunt 237123e500 simplify code by removing return values where possible
fix_iterator() and related functions are quite difficult to read.
perhaps it would be a little clearer if we didn't assign values
to variables that won't subsequently be used, or unnecessarily
pop the stack and then push the same value back onto it.

also, in dns_qp_lookup() we previously called fix_iterator(),
removed the leaf from the top of the iterator stack, and then
added it back on. this would be clearer if we just push the leaf
onto the stack when we need to, but leave the stack alone when
it's already complete.
2024-04-25 10:29:07 -07:00
Evan Hunt b1b1ca8ca4 add another broken testcase 2024-04-25 10:29:07 -07:00
Evan Hunt 66dbff596b clean up fix_iterator() arguments
the value passed as 'start' was redundant; it's always the same
as the current top of the iterator stack.
2024-04-25 10:29:07 -07:00
Evan Hunt 2dff926624 yet another fix_iterator() bug
under some circumstances it was possible for the iterator to
be set to the first leaf in a set of twigs, when it should have
been set to the last.

a unit test has been added to test this scenario. if there is a
a tree containing the following values: {".", "abb.", "abc."}, and
we query for "acb.", previously the iterator would be positioned at
"abb." instead of "abc.".

the tree structure is:
    branch (offset 1, ".")
      branch (offset 3, ".ab")
        leaf (".abb")
        leaf (".abc")

we find the branch with offset 3 (indicating that its twigs differ
from each other in the third position of the label, "abB" vs "abC").
but the search key differs from the found keys at position 2
("aC" vs "aB").  we look up the bit value in position 3 of the
search key ("B"), and incorrectly follow it onto the wrong twig
("abB").

to correct for this, we need to check for the case where the search
key is greater than the found key in a position earlier than the
branch offset. if it is, then we need to pop from the current leaf
to its parent, and get the greatest leaf from there.

a further change is needed to ensure that we don't do this twice;
when we've moved to a new leaf and the point of difference between
it and the search key even earlier than before, then we're definitely
at a predecessor node and there's no need to continue the loop.
2024-04-25 10:29:07 -07:00
Michal Nowak b1184d916d Merge branch 'mnowak/fix-changes-entry-6378' into 'main'
Reformat overflowing CHANGES entry 6378

See merge request isc-projects/bind9!8981
2024-04-25 07:31:29 +00:00
Michal Nowak 84180c8ee1 Reformat overflowing CHANGES entry 6378
$ sh util/check-line-length.sh CHANGES
    CHANGES: Line Too Long
                            previously removed. An attempt to use the option now prints
2024-04-25 09:22:27 +02:00
Ondřej Surý 1359694267 Merge branch '1879-fix-documentation-on-named--U' into 'main'
Properly document that named -U <n> is no-op now

Closes #1879

See merge request isc-projects/bind9!8976
2024-04-24 20:50:09 +00:00
Ondřej Surý 9305ebdabe Add CHANGES and release note for [GL #1879] 2024-04-24 22:49:26 +02:00
Ondřej Surý d69cd51f91 Properly document that named -U <n> is no-op now
We don't create <n> UDP dispatches anymore and -U <n> option to named is
a no-op for a while.  Properly document that in the named man page.
2024-04-24 22:49:14 +02:00
Petr Špaček 0f86976672 Merge branch 'spdx-custom-test-driver' into 'main'
Use standard SPDX license for custom-test-driver

See merge request isc-projects/bind9!8971
2024-04-24 09:49:44 +00:00
Petr MenšíkandPetr Špaček 2b348a5daa Change exception SPDX to Autoconf-exception-generic
License text is in fact Autoconf generic exception, with already defined
SPDX identificator. Use that instead.

https://spdx.org/licenses/Autoconf-exception-generic.html
2024-04-24 09:46:58 +00:00
Mark Andrews ed77b61599 Merge branch '4684-unit-test-error-handling-in-dns_name_-api' into 'main'
test dns_name_fromregion

Closes #4684

See merge request isc-projects/bind9!8967
2024-04-24 02:14:05 +00:00
Mark Andrews e6984e5c07 Extract empty name in 'source' into 'name' 2024-04-24 01:38:14 +00:00
Mark Andrews 7a13fcd601 Extract non absolute name from source
The entire source region needs to be consumed for this usage.
2024-04-24 01:38:14 +00:00
Mark Andrews 7d7fc8cb2d Extract fully qualified named from source without buffer
'name.ndata' should point to the source.
2024-04-24 01:38:14 +00:00
Mark Andrews 254ba1b051 Test dns_name_fromregion
with a large source region and a large target buffer, both
larger than DNS_NAME_MAXWIRE.
2024-04-24 01:38:14 +00:00
Mark Andrews 63b93ccda2 Merge branch '4689-test-invalid-notify-source-address' into 'main'
Check behaviour using invalid notify source address

Closes #4689

See merge request isc-projects/bind9!8966
2024-04-24 01:09:35 +00:00
Mark Andrews 580c41de0d check behaviour with invalid notify-source-v6 address
This was reported as causing the server to fail to shutdown on
NetBSD.  Look for the expected informational and error messages.
2024-04-24 10:12:42 +10:00
Michal Nowak 4f7947c583 Merge branch 'mnowak/llvm-18' into 'main'
Bump the LLVM version to 18 and reformat sources

See merge request isc-projects/bind9!8827
2024-04-23 12:48:22 +00:00
Michal Nowak f454fa6dea Update sources to Clang 18 formatting 2024-04-23 13:11:52 +02:00
Michal Nowak 7107c44c7c Update Clang to version 18 2024-04-23 13:11:52 +02:00
Ondřej Surý abbc59a270 Merge branch 'ondrej/fix-adb-entries-cleaning' into 'main'
Always set ADB entry expiration to now + ADB_ENTRY_WINDOW

See merge request isc-projects/bind9!8934
2024-04-22 08:37:45 +00:00
Ondřej Surý 141e4c9805 Change the ADB_ENTRY_WINDOW to 60 seconds
The previous value of 30 minutes used to cache the ADB names and entries
was quite long.  Change the value to 60 seconds for faster recovery
after cached intermittent failure of the remote nameservers.
2024-04-22 10:36:36 +02:00
Ondřej Surý 6708da3112 Unify the expiration time handling for all ADB expiration
The algorithm from the previous commit[1] is now used to calculate all
the expiration values through the code (ncache results, cname/dname
targets).

1. ISC_MIN(cur, ISC_MAX(now + ADB_ENTRY_WINDOW, now + rdataset->ttl))
2024-04-22 10:36:36 +02:00
Ondřej Surý 53cc00ee3f Fix the expire_v4 and expire_v6 logic
Correct the logic to set the expiration period of expire_{v4,v6} as
follows:

1. If the trust is ultimate (local entry), immediately set the entry as
   expired, so the changes to the local zones have immediate effect.

3. If the expiration is already set and smaller than the new value, then
   leave the expiration value as it is.

2. Otherwise pick larger of `now + ADB_ENTRY_WINDOW` and `now + TTL` as
   the new expiration value.
2024-04-22 10:36:36 +02:00
Ondřej Surý 932665410d Always set ADB entry expiration to now + ADB_ENTRY_WINDOW
When ADB entry was created it was set to never expire.  If we never
called any of the functions that adjust the expiration, it could linger
in the ADB forever.

Set the expiration (.expires) to now + ADB_ENTRY_WINDOW when creating
the new ADB entry to ensure the ADB entry will always expire.
2024-04-22 10:36:36 +02:00
Mark Andrews 6cb6b99ae7 Merge branch '4687-validator-c-1280-insist-val-nfails-0-failed' into 'main'
Resolve "validator.c:1280: INSIST((*val->nfails) > 0) failed"

Closes #4687

See merge request isc-projects/bind9!8963
2024-04-22 04:57:45 +00:00
Mark Andrews 26375bdcf2 Break out of the switch if we have already reached the quota
This prevents consume_validation_fail being called and causing an
INSIST.
2024-04-22 12:32:36 +10:00
Michal Nowak 970ac03196 Merge branch 'mnowak/drop-respdiff-short-ci-jobs' into 'main'
Drop respdiff-short CI jobs

See merge request isc-projects/bind9!8958
2024-04-19 15:56:00 +00:00
Michal Nowak 6a045cd8ec Drop respdiff-short CI jobs
In the past, our CI infrastructure was more sensitive to the number of
CI jobs running on it. We tried to limit long-running jobs in merge
request-triggered pipelines, as there are many of them, and spawned them
only in daily scheduled ones. Moving most of the CI infrastructure to
AWS has made it way better to run jobs in parallel, and the existence of
short respdiff jobs has lost its original merit. It can also be harmful
as some problems are detected only by the longer respdiff variant when a
faulty merge request has already been merged. We should run all long
respdiff tests in merge request-triggered pipelines.

Also, move the former respdiff-long job (now just "respdiff") to AWS as
old instance memory constraints (see
f09cf69594) are no longer an issue.
2024-04-19 16:42:49 +02:00
Petr Špaček c35f00e48a Merge branch 'pspacek/auto-backports' into 'main'
Attempt automatic MR backports after every merge

See merge request isc-projects/bind9!8959
2024-04-19 13:40:51 +00:00
Petr Špaček 49f9487577 Attempt automatic MR backports after every merge 2024-04-19 13:35:19 +00:00
Matthijs Mekking b53c03d98e Merge branch '1128-offline-ksk' into 'main'
Introduce new DNSSEC tool dnssec-ksr

See merge request isc-projects/bind9!8188
2024-04-19 11:56:50 +00:00
Matthijs Mekking afda87cb08 dnssec-keygen: Change flag options into booleans
We now have ctx.kskflag, ctx.zskflag, and ctx.revflag, but zskflag is
not quite like the other two, as it doesn't have a special bit in the
DNS packet, and is used as a boolean.

This patch changes so that we use booleans for all three, and
construct the flags based on which ones are set.

patch by @aram
2024-04-19 13:52:21 +02:00
Matthijs Mekking 7007025302 Don't leak
Make tsan happy, fix memory leaks by keeping track of the buffers
to be cleaned up.
2024-04-19 13:52:21 +02:00
Matthijs Mekking d9c947c57d Add test cases for CDS/CDNSKEY
Add two more test cases to ensure that a Signed Key Response file
creates signed CDNSKEY and/or CDS RRsets according to the policy.
2024-04-19 13:52:21 +02:00
Matthijs Mekking cdf0fd2e5e Adjust system test to expect CDS and CDNSKEY
Requires storing the KSK keyfile identifier to calculate the expected
CDS and CDNSKEY.
2024-04-19 13:52:21 +02:00
Matthijs Mekking 83da52d6e4 Add option to dnssec-dsfromkey to chop up rdata
The new option 'w' allows us to print DS rdata with the base64 portions
split up in chunks. This is mainly done for testing purposes.
2024-04-19 13:52:21 +02:00
Matthijs Mekking efe4fa6fc7 Add CDS and CDNSKEY to SKR
Add signed CDS and CDNSKEY RRsets to the Signed Key Response (SKR) for the
used KSKs.

We only print one bundle header for all three RRsets.
2024-04-19 13:52:21 +02:00
Matthijs Mekking 46785dc71e sh the fmt up
Apply shfmt patch. Ideally I fixup every commit that changes testing,
but that is just too much at this point.
2024-04-19 13:52:21 +02:00
Matthijs Mekking e7525cab4f Add CHANGES and release note
Introduce the new 'dnssec-ksr' tool.
2024-04-19 13:52:21 +02:00
Matthijs Mekking 695be761b0 Test dnssec-ksr sign
Add test cases for the 'sign' command. Reuse the earlier generated KSR
files.

Also update dnssec-ksr.c to have better cleanup.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 887fa0ddc9 Implement dnssec-ksr sign
Add code that can create a Signed Key Response (SKR) given a Key
Signing Request (KSR), a DNSSEC policy, a set of keys and an interval.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 31521fade2 Change ksr format
Make the ksr format compatible with knot.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 2bf03ab7df Refactor dnssec-ksr
Refactor some more, making the cleanup a generic function.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 852ba174dd Test dnssec-ksr request
Add test cases for the 'request' command. Reuse the earlier
pregenerated ZSKs. We also need to set up some KSK files, that can
be done with 'dnssec-keygen -k <policy> -fK' now.

The 'check_keys()' function is adjusted such that the expected active
time of the successor key is set to the inactive time of the
predecessor. Some additional information is saved to make 'request'
testing easier.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 1b39172ee7 Implement dnssec-ksr request
Add code that can create a Key Signing Request (KSR) given a DNSSEC
policy, a set of keys and an interval.

Multiple keys that match the bundle and kasp parameters are sorted by
keytag, mainly for testing purposes.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 22a4bd5bbe Also free the dst_key after keygen
During cleanup, we also need to free the dst_key structure that is part
of the dns_dnsseckey.
2024-04-19 10:41:04 +02:00
Matthijs Mekking ed9704fcda Refactor dnssec-ksr keygen
Create some helper functions for code that is going to be reused by the
other commands (request, sign), such as setting and checking the context
parameters, and retrieving the dnssec-policy/kasp.
2024-04-19 10:41:04 +02:00
Matthijs Mekking e033e58a85 dnssec-keygen: allow -f and -k together
The 'dnssec-keygen' tool now allows the options '-k <dnssec-policy>'
and '-f <flags>' together to create keys from a DNSSEC policy that only
match the given role. Allow setting '-fZ' to only create ZSKs, while
'-fK' will only create KSKs.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 7508534789 Implement dnssec-ksr keygen
Add code that can pregenerate ZSKs given a DNSSEC policy and an
interval.

Fix configuration shell scripts, fixing the ksr system test.
2024-04-19 10:41:04 +02:00
Matthijs Mekking a3915e535a Move kasp key match function to kasp header
The dnssec-ksr tool needs to check if existing key files match lines
in the keys section of a dnssec-policy, so make this function publicly
available.
2024-04-19 10:41:04 +02:00
Matthijs Mekking bc31575899 Move common create key functions to dnssectool.c
The dnssec-ksr tool needs to read a dnssec-policy from configuration
too, as well as deal with FIPS mode checks.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 1cb345fa95 Add ksr system test
Add a system test for testing dnssec-ksr, initally for the keygen
command. This should be able to create or select key files given a
DNSSEC policy and a time window.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 77d4afba1b Introduce new DNSSEC tool dnssec-ksr
Introduce a new DNSSEC tool, dnssec-ksr, for creating signed key
response (SKR) files, given one or more key signing requests (KSRs).

For now it is just a dummy tool, but the future purpose of this utility
is to pregenerate ZSKs and signed RRsets for DNSKEY, CDNSKEY, and CDS
for a given period that a KSK is to be offline.
2024-04-19 10:41:04 +02:00
Michal Nowak 2ca6bcc99a Merge branch 'mnowak/revert-874329b3b1a56e58e8caf61d89127441d2cc79a1' into 'main'
Revert "Temporarily allow failure of respdiff-long:tsan job"

See merge request isc-projects/bind9!8957
2024-04-19 08:37:47 +00:00
Michal Nowak 620cce8f7e Revert "Temporarily allow failure of respdiff-long:tsan job"
This reverts commit 874329b3b1.

Addressed in isc-projects/bind9#4475.
2024-04-19 10:28:51 +02:00
Ondřej Surý e4793242eb Merge branch '4416-fix-reading-multiple-rndc-messages-in-single-TCP-message' into 'main'
Rework isccc_ccmsg to support multiple messages per tcp read

Closes #4416

See merge request isc-projects/bind9!8956
2024-04-18 18:10:56 +00:00
Ondřej Surý cbbc0051a3 Add CHANGES note for [GL #4416] 2024-04-18 20:09:47 +02:00
Dominik ThalhammerandOndřej Surý 24ae1157e8 Rework isccc_ccmsg to support multiple messages per tcp read
Previously, only a single controlconf message would be processed from a
single TCP read even if the TCP read buffer contained multiple messages.
Refactor the isccc_ccmsg unit to store the extra buffer in the internal
buffer and use the already read data first before reading from the
network again.

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Dominik Thalhammer <dominik@thalhammer.it>
2024-04-18 20:08:44 +02:00
Ondřej Surý e13728413a Merge branch '4586-don-t-count-expired-future-rrsigs-in-verification-failure-quota' into 'main'
Don't count expired / future RRSIGs in verification failure quota

Closes #4586

See merge request isc-projects/bind9!8746
2024-04-18 15:07:43 +00:00
Ondřej Surý 5d4233c2c2 Add CHANGES and release notes for [GL #4586] 2024-04-18 16:05:32 +02:00
Ondřej Surý 3b9ea189b2 Don't count expired / future RRSIG against quota
These don't trigger a public key verification unless
dnssec-accept-expired is set.
2024-04-18 16:05:31 +02:00
Petr Špaček 903af2e1de Merge branch 'pspacek/update-sphinx' into 'main'
Update Sphinx version used for documentation build

See merge request isc-projects/bind9!8952
2024-04-18 14:00:33 +00:00
Petr Špaček da607d6a06 Update Sphinx version used for documentation build 2024-04-18 12:46:13 +02:00
Ondřej Surý bbb2741de8 Merge branch 'ondrej-offload-statschannel' into 'main'
Offload the isc_http response processing to worker thread

Closes #4680

See merge request isc-projects/bind9!7647
2024-04-18 08:56:06 +00:00
Ondřej Surý fbea3bb255 Add CHANGES and release note for [GL #4680] 2024-04-18 10:53:31 +02:00
Ondřej Surý c7ed858c6e Supress the leak detection in xmlGetGlobalState
The xmlGetGlobalState allocates per-thread memory that is not properly
cleaned up when the libxml2 is used from offloaded threads.  Add the
function the the LeakSanitizer suppression list.
2024-04-18 10:53:31 +02:00
Ondřej Surý 23835c4afe Use xmlMemSetup() instead of xmlGcMemSetup()
Since we don't have a specialized function for "atomic" allocations,
it's better to just use xmlMemSetup() instead of xmlGcMemSetup()
according to this:

https://mail.gnome.org/archives/xml/2007-August/msg00032.html
2024-04-18 10:53:31 +02:00
Ondřej Surý 950f828cd2 Offload the isc_http response processing to worker thread
Prepare the statistics channel data in the offloaded worker thread, so
the networking thread is not blocked by the process gathering data from
various data structures.  Only the netmgr send is then run on the
networkin thread when all the data is already there.
2024-04-18 10:53:00 +02:00
Matthijs Mekking f8a09fd91a Merge branch '4554-dnssec-policy-jitter' into 'main'
Add signatures-jitter option

Closes #4554

See merge request isc-projects/bind9!8686
2024-04-18 08:11:18 +00:00
Matthijs Mekking c3d8932f79 Add checkconf check for signatures-jitter
Having a value higher than signatures-validity does not make sense
and should be treated as a configuration error.
2024-04-18 09:50:33 +02:00
Matthijs Mekking 8b7785bc23 Add release notes and CHANGES for #4554
Mention the new signature jitter option.
2024-04-18 09:50:31 +02:00
Matthijs Mekking 67f403a423 Implement signature jitter
When calculating the RRSIG validity, jitter is now derived from the
config option rather than from the refresh value.
2024-04-18 09:50:10 +02:00
Matthijs Mekking 0438d3655b Refactor code that calculates signature validity
There are three code blocks that are (almost) similar, refactor it
to one function.
2024-04-18 09:50:10 +02:00
Matthijs Mekking 50bd729019 Update autosign test to use signatures-jitter
Now that we have an option to configure jitter, use it in system tests
that test jitter.
2024-04-18 09:50:10 +02:00
Matthijs Mekking 2a4daaedca Add signatures-jitter option
Add an option to speficy signatures jitter.
2024-04-18 09:50:10 +02:00
Petr Špaček c9ff77c067 Merge tag 'v9.19.23' 2024-04-18 09:21:47 +02:00
Mark Andrews 9360d90bf2 Merge branch '4671-calling-dns_qpkey_toname-twice-fails' into 'main'
Resolve "Calling dns_qpkey_toname twice fails."

Closes #4671

See merge request isc-projects/bind9!8948
2024-04-18 01:05:42 +00:00
Mark Andrews 36c11d9180 Check that name is properly reset by dns_qpkey_toname 2024-04-18 00:17:48 +00:00
Mark Andrews bf70d4840c dns_qpkey_toname failed to reset name correctly
This could lead to a mismatch between name->length and the rest
of the name structure.
2024-04-18 00:17:48 +00:00
Ondřej Surý fcf2919c93 Merge branch '4475-use-atomics-to-access-trust-access-in-dns_ncache' into 'main'
Use atomic operations to access the trust byte in ncache data

Closes #4475

See merge request isc-projects/bind9!8946
2024-04-17 19:18:35 +00:00
Mark AndrewsandOndřej Surý d2fd97f4da Add CHANGES note for [GL #4475] 2024-04-17 17:14:50 +02:00
Ondřej Surý eb1829b970 Use atomic operations to access the trust byte in ncache data
Protect the access to the trust byte in the ncache data with relaxed
atomic operation to mimick the current behaviour.  This will teach
TSAN that the concurrent access is fine.
2024-04-17 17:14:34 +02:00
Mark AndrewsandOndřej Surý 4ef755ffb0 Only copy the name data after we know its actual length
This prevents TSAN errors with the ncache code where the trust byte
access needs to be protected by a lock.  The old code copied the
entire region before determining where the name ended.  We now
determine where the name ends then copy just that data and in doing
so avoid reading the trust byte.
2024-04-17 17:14:34 +02:00
Artem Boldariev 90b0038ea0 Merge branch '4434-use-nm-tests-timeouts-for-the-dispatch-test' into 'main'
dispatch_test: use the NM tests timeouts

Closes #4434

See merge request isc-projects/bind9!8923
2024-04-15 14:25:13 +00:00
Artem Boldariev 7f805659c3 dispatch_test: use the NM tests timeouts
This commit makes the dispatch_test use the same timeouts that network
manager tests. We do that because the old values appear to be too
small for our heavy loaded CI machines, leading to spurious failures
on them. The network manager tests are much more stable in this
situation and they use somewhat larger timeout values.

We use a smaller connection timeouts for the tests which are expected
to timeout to not wait for too long.
2024-04-15 16:33:24 +03:00
Mark Andrews 381273f89f Merge branch '4669-error-sending-notify-to-ipv6-secondary' into 'main'
Wrong source address used for IPv6 notify messages

Closes #4669

See merge request isc-projects/bind9!8935
2024-04-12 00:16:01 +00:00
Mark Andrews 9cc6b4a68a Add CHANGES note for [GL #4669] 2024-04-11 18:05:25 +00:00
Mark Andrews 7c369ea3d9 Check that notify message was sent over IPv6 2024-04-11 18:05:25 +00:00
Mark Andrews 40fd4cd407 Wrong source address used for IPv6 notify messages
The source address field of 'newnotify' was not updated from the
default (0.0.0.0) when the destination address was an IPv6 address.
This resulted in the messages failing to be sent.  Set the source
address to :: when the destination address is an IPv6 address.
2024-04-11 18:05:25 +00:00
Petr Špaček 9c712eff0a Merge branch 'pspacek/releng-changes' into 'main'
Move Release issue template to BIND QA repo

See merge request isc-projects/bind9!8944
2024-04-11 15:15:49 +00:00
Petr Špaček d2fa9a642b Move Release issue template to BIND QA repo
It's easier to maintain the template in a single place together with
the script used to in the template.

In future use script bind9/releng/create_checklist.py
from isc-private/bind-qa to generate release issue.
2024-04-11 15:15:32 +00:00
Evan Hunt c13e8e1859 Merge branch 'each-dupwithoffsets-cannot-fail' into 'main'
dns_name_dupwithoffsets() cannot fail

See merge request isc-projects/bind9!8945
2024-04-11 03:25:07 +00:00
Evan Hunt 2c88946590 dns_name_dupwithoffsets() cannot fail
this function now always returns success; change it to void and
clean up its callers.
2024-04-10 22:51:07 -04:00
Petr Špaček 480126919a Merge branch 'pspacek/set-up-version-and-release-notes-for-bind-9.19.24' into 'main'
Set up version and release notes for BIND 9.19.24

See merge request isc-projects/bind9!8939
2024-04-04 19:15:28 +00:00
Petr Špaček 1341a1a734 Set up release notes for BIND 9.19.24 2024-04-04 19:35:03 +02:00
Petr Špaček b0b4ea3975 Update BIND version to 9.19.24-dev 2024-04-04 19:35:03 +02:00
Petr Špaček 3c0eaff4c6 Update BIND version for release 2024-04-02 18:08:00 +02:00
Petr Špaček dc9d9a8fdf Add a CHANGES marker 2024-04-02 18:06:04 +02:00
Petr Špaček 03c9e0b753 Merge branch 'pspacek/prepare-documentation-for-bind-9.19.23' into 'v9.19.23-release'
Prepare documentation for BIND 9.19.23

See merge request isc-private/bind9!677
2024-04-02 16:04:47 +00:00
Suzanne GoldlustandPetr Špaček 4c0db2ee3c Tweak and reword release notes 2024-04-02 17:45:25 +02:00
Petr Špaček e4344b7d1a Add release note for GL #4622 and #4652 2024-04-02 17:31:42 +02:00
Petr Špaček 3989b99a0b Add release note for GL #4614 2024-04-02 17:31:42 +02:00
Petr Špaček 1076bd3c78 Add release note for GL #4552 2024-04-02 17:31:42 +02:00
Petr Špaček bf92e16c0e Prepare release notes for BIND 9.19.23 2024-04-02 17:31:42 +02:00
1447 changed files with 73582 additions and 63423 deletions
+2
View File
@@ -79,3 +79,5 @@ PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8
ForEachMacros: [ 'cds_lfs_for_each', 'cds_lfs_for_each_safe', 'cds_list_for_each_entry_safe', 'ISC_LIST_FOREACH', 'ISC_LIST_FOREACH_SAFE', 'ISC_LIST_FOREACH_REV', 'ISC_LIST_FOREACH_REV_SAFE' ]
RemoveParentheses: ReturnStatement
RemoveSemicolon: true
+2
View File
@@ -78,3 +78,5 @@ PenaltyBreakString: 80
PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8
RemoveParentheses: ReturnStatement
RemoveSemicolon: true
+10
View File
@@ -1538,3 +1538,13 @@ ffbe6b95371c99b7fb05e6de17a8d6b7bf4f629f
4cb8b13987b930952238cc88e84272b8cf911933
# Reformat sources with up-to-date clang-format-17
79d93600116faabd89798522817ad95a69684fff
# Reformat sources with up-to-date clang-format-18
b7de2c7cb959fa35099d72c3f9b13938348c74e6
# Reformat sources with up-to-date clang-format-19
0aeefb974197ccf05c3f25c20506b4e8b97ded5d
# Reformat sources with up-to-date clang-format-19
f2fa1b7d63100564dc55463a05bdeed893f83d86
# Remove redundant semicolons after the closing braces of functions
c22176c0f9a71217be9bfab00573f8f0265499af
# Remove redundant parentheses from the return statement
58a15d38c2c321fac75abef389a48ff82deaccf0
+1 -1
View File
@@ -10,4 +10,4 @@
/util/** export-ignore
/util/bindkeys.pl -export-ignore
/util/check-make-install.in -export-ignore
/util/mksymtbl.pl -export-ignore
/util/dtrace.sh -export-ignore
+1
View File
@@ -0,0 +1 @@
contrib/gitchangelog/changelog.rc.py
+2
View File
@@ -75,6 +75,7 @@ doc/man/dnssec-importkey.8in
doc/man/dnssec-keyfromlabel.8in
doc/man/dnssec-keygen.8in
doc/man/dnssec-keymgr.8in
doc/man/dnssec-ksr.8in
doc/man/dnssec-revoke.8in
doc/man/dnssec-settime.8in
doc/man/dnssec-signzone.8in
@@ -95,6 +96,7 @@ doc/man/pkcs11-tokens.8in
/GPATH
/GRTAGS
/GTAGS
TAGS
# Emacs specific files
\.dir-locals-2.el
/emacs.desktop
+302 -343
View File
File diff suppressed because it is too large Load Diff
@@ -46,7 +46,6 @@ confidential!
- [ ] [:link:][step_backports] **(SwEng)** Prepare backports of the merge request addressing the problem for all affected (and still maintained) branches of a given product
- [ ] [:link:][step_finish_advisory] **(Support)** Finish preparing the Security Advisory
- [ ] [:link:][step_meta_issue] **(QA)** Create (or update) the private issue containing links to fixes & reproducers for all CVEs fixed in a given release cycle
- [ ] [:link:][step_changes] **(QA)** (BIND 9 only) Reserve a block of `CHANGES` placeholders once the complete set of vulnerabilities fixed in a given release cycle is determined
- [ ] [:link:][step_merge_fixes] **(QA)** Merge the CVE fixes in CVE identifier order
- [ ] [:link:][step_patches] **(QA)** Prepare a standalone patch for the last stable release of each affected (and still maintained) product branch
- [ ] [:link:][step_asn_releases] **(QA)** Prepare ASN releases (as outlined in the Release Checklist)
-101
View File
@@ -1,101 +0,0 @@
## Release Schedule
**Code Freeze:**
**Tagging Deadline:**
**Public Release:**
## Documentation Review Links
**Closed issues assigned to the milestone without a release note:**
- []()
- []()
- []()
**Merge requests merged into the milestone without a release note:**
- []()
- []()
- []()
**Merge requests merged into the milestone without a `CHANGES` entry:**
- []()
- []()
- []()
## Release Checklist
### Before the Code Freeze
- [ ] ***(QA)*** Rebase -S editions on top of current open-source versions: `git checkout bind-9.18-sub && git rebase origin/bind-9.18`
- [ ] ***(QA)*** [Inform](https://gitlab.isc.org/isc-private/bind-qa/-/blob/master/bind9/releng/inform_supp_marketing.py) Support and Marketing of impending release (and give estimated release dates).
- [ ] ***(QA)*** Ensure there are no permanent test failures on any platform. Check [public](https://gitlab.isc.org/isc-projects/bind9/-/pipelines?scope=all&source=schedule) and [private](https://gitlab.isc.org/isc-private/bind9/-/pipelines?scope=all&source=schedule) scheduled pipelines.
- [ ] ***(QA)*** Check charts from `shotgun:*` jobs in the scheduled pipelines to verify there is no unexplained performance drop for any protocol.
- [ ] ***(QA)*** Check [Perflab](https://perflab.isc.org/) to ensure there has been no unexplained drop in performance for the versions being released.
- [ ] ***(QA)*** Check whether all issues assigned to the release milestone are resolved[^1].
- [ ] ***(QA)*** Ensure that there are no outstanding [merge requests in the private repository](https://gitlab.isc.org/isc-private/bind9/-/merge_requests/)[^1] (Subscription Edition only).
- [ ] ***(QA)*** [Ensure](https://gitlab.isc.org/isc-private/bind-qa/-/blob/master/bind9/releng/check_backports.py) all merge requests marked for backporting have been indeed backported.
- [ ] ***(QA)*** [Announce](https://gitlab.isc.org/isc-private/bind-qa/-/blob/master/bind9/releng/inform_code_freeze.py) (on Mattermost) that the code freeze is in effect.
### Before the Tagging Deadline
- [ ] ***(QA)*** Inspect the current output of the `cross-version-config-tests` job to verify that no unexpected backward-incompatible change was introduced in the current release cycle.
- [ ] ***(QA)*** Ensure release notes are correct, ask Support and Marketing to check them as well. [Example](https://gitlab.isc.org/isc-private/bind9/-/merge_requests/510)
- [ ] ***(QA)*** Add a release marker to `CHANGES`. Examples: [9.18](https://gitlab.isc.org/isc-projects/bind9/-/commit/f14d8ad78c0506fd4247187f2177f8eceeb6b3b9), [9.16](https://gitlab.isc.org/isc-projects/bind9/-/commit/1bcdf21874f99a00da389d723e0ad07dfd70f9f1)
- [ ] ***(QA)*** Add a release marker to `CHANGES.SE` (Subscription Edition only). [Example](https://gitlab.isc.org/isc-private/bind9/-/commit/0f03d5737bcbdaa1bf713c6db1887b14938c3421)
- [ ] ***(QA)*** Update BIND 9 version in `configure.ac` ([9.18+](https://gitlab.isc.org/isc-projects/bind9/-/commit/3c85ab7f4c35e6d8acef1393606002a0a8730100)) or `version` ([9.16](https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/7692/diffs?commit_id=1bcdf21874f99a00da389d723e0ad07dfd70f9f1)).
- [ ] ***(QA)*** Rebuild `configure` using Autoconf on `docs.isc.org` (9.16).
- [ ] ***(QA)*** Update GitLab settings for all maintained branches to disallow merging to them: [public](https://gitlab.isc.org/isc-projects/bind9/-/settings/repository), [private](https://gitlab.isc.org/isc-private/bind9/-/settings/repository)
- [ ] ***(QA)*** Tag the releases in the private repository (`git tag -s -m "BIND 9.x.y" v9.x.y`).
### Before the ASN Deadline (for ASN Releases) or the Public Release Date (for Regular Releases)
- [ ] ***(QA)*** Check that the formatting is correct for the HTML version of release notes.
- [ ] ***(QA)*** Check that the formatting of the generated man pages is correct.
- [ ] ***(QA)*** Verify GitLab CI results [for the tags](https://gitlab.isc.org/isc-private/bind9/-/pipelines?scope=tags) created and sign off on the releases to be published.
- [ ] ***(QA)*** Update GitLab settings for all maintained branches to allow merging to them again: [public](https://gitlab.isc.org/isc-projects/bind9/-/settings/repository), [private](https://gitlab.isc.org/isc-private/bind9/-/settings/repository)
- [ ] ***(QA)*** Prepare (using [`version_bump.py`](https://gitlab.isc.org/isc-private/bind-qa/-/blob/master/bind9/releng/version_bump.py)) and merge MRs resetting the release notes and updating the version string for each maintained branch.
- [ ] ***(QA)*** Rebase the Subscription Edition branches (including recent release prep commits) on top of the open source branches with updated version strings.
- [ ] ***(QA)*** Announce (on Mattermost) that the code freeze is over.
- [ ] ***(QA)*** Request signatures for the tarballs, providing their location and checksums. Ask [signers on Mattermost](https://mattermost.isc.org/isc/channels/bind-9-qa).
- [ ] ***(Signers)*** Ensure that the contents of tarballs and tags are identical.
- [ ] ***(Signers)*** Validate tarball checksums, sign tarballs, and upload signatures.
- [ ] ***(QA)*** Verify tarball signatures and check tarball checksums again: Run `publish_bind.sh` on repo.isc.org to pre-publish.
- [ ] ***(QA)*** Prepare the `patches/` subdirectory for each security release (if applicable).
- [ ] ***(QA)*** Pre-publish ASN and/or Subscription Edition tarballs so that packages can be built.
- [ ] ***(QA)*** Build and test ASN and/or Subscription Edition packages (in [cloudsmith branch in private repo](https://gitlab.isc.org/isc-private/rpms/bind/-/tree/cloudsmith)). [Example](https://gitlab.isc.org/isc-private/rpms/bind/-/commit/e2512f4cfaf991827a635e374e7e93b27a5f38ba)
- [ ] ***(Marketing)*** Prepare and send out ASN emails (as outlined in the CVE checklist; if applicable).
### On the Day of Public Release
- [ ] ***(QA)*** Wait for clearance from Security Officer to proceed with the public release (if applicable).
- [ ] ***(QA)*** Place tarballs in public location on FTP site.
- [ ] ***(QA)*** Inform Marketing of the release, providing FTP links for the published tarballs.
- [ ] ***(QA)*** Use the [Printing Press project](https://gitlab.isc.org/isc-private/printing-press/-/wikis/home#adding-new-documents) to prepare a release announcement email.
- [ ] ***(Marketing)*** Publish links to downloads on ISC website. [Example](https://gitlab.isc.org/website/theme-staging-site/-/commit/1ac7b30b73cb03228df4cd5651fa4e774ac35625)
- [ ] ***(Marketing)*** Update the BIND -S information document in SF with download links to the new versions. (If this is a security release, this will have already been done as part of the ASN process.)
- [ ] ***(Marketing)*** Update the Current Software Versions document in the SF portal if any stable versions were released.
- [ ] ***(Marketing)*** Send the release announcement email to the *bind-announce* mailing list (and to *bind-users* if a major release - [example](https://lists.isc.org/pipermail/bind-users/2022-January/105624.html)).
- [ ] ***(Marketing)*** Announce release on social media sites.
- [ ] ***(Marketing)*** Update [Wikipedia entry for BIND](https://en.wikipedia.org/wiki/BIND).
- [ ] ***(Support)*** Add the new releases to the [vulnerability matrix in the Knowledge Base](https://kb.isc.org/docs/aa-00913).
- [ ] ***(Support)*** Update tickets in case of waiting support customers.
- [ ] ***(QA)*** Build and test any outstanding private packages in [private repo](https://gitlab.isc.org/isc-private/rpms/bind/-/tree/cloudsmith). [Example](https://gitlab.isc.org/isc-private/rpms/bind/-/commit/2007d566db81dd9dfd79e571e2f600a3bc284da4)
- [ ] ***(QA)*** Build [public RPMs](https://gitlab.isc.org/isc-packages/rpms/bind). [Example commit](https://gitlab.isc.org/isc-packages/rpms/bind/-/commit/3b5e851ea7c4e3570371a4878b5461f02a44f8cc) which triggers [Copr builds](https://copr.fedorainfracloud.org/coprs/isc/) automatically
- [ ] ***(SwEng)*** Build Debian/Ubuntu packages.
- [ ] ***(SwEng)*** Update Docker files [here](https://gitlab.isc.org/isc-projects/bind9-docker/-/branches) and make sure push is synchronized to [GitHub](https://github.com/isc-projects/bind9-docker). [Docker Hub](https://hub.docker.com/r/internetsystemsconsortium/bind9) should pick it up automatically. [Example](https://gitlab.isc.org/isc-projects/bind9-docker/-/commit/cada7e10e9af951595c98bfffc4bd42512faac05)
- [ ] ***(QA)*** Ensure all new tags are annotated and signed. `git show --show-signature v9.19.12`
- [ ] ***(QA)*** Push tags for the published releases to the public repository.
- [ ] ***(QA)*** Using [`merge_tag.py`](https://gitlab.isc.org/isc-private/bind-qa/-/blob/master/bind9/releng/merge_tag.py), merge published release tags back into the their relevant development/maintenance branches.
- [ ] ***(QA)*** Ensure `allow_failure: true` is removed from the `cross-version-config-tests` job if it was set during the current release cycle.
- [ ] ***(QA)*** Sanitize confidential issues which are assigned to the current release milestone and do not describe a security vulnerability, then make them public.
- [ ] ***(QA)*** Sanitize [confidential issues](https://gitlab.isc.org/isc-projects/bind9/-/issues/?sort=milestone_due_desc&state=opened&confidential=yes) which are assigned to older release milestones and describe security vulnerabilities, then make them public if appropriate[^2].
- [ ] ***(QA)*** Update QA tools used in GitLab CI (e.g. Black, PyLint, Sphinx) by modifying the relevant [`Dockerfile`](https://gitlab.isc.org/isc-projects/images/-/merge_requests/228/diffs).
- [ ] ***(QA)*** Run a pipeline to rebuild all [images](https://gitlab.isc.org/isc-projects/images) used in GitLab CI.
- [ ] ***(QA)*** Update [`metadata.json`](https://gitlab.isc.org/isc-private/bind-qa/-/blob/master/bind9/releng/metadata.json) with the upcoming release information.
[^1]: If not, use the time remaining until the tagging deadline to ensure all outstanding issues are either resolved or moved to a different milestone.
[^2]: As a rule of thumb, security vulnerabilities which have reproducers merged to the public repository are considered okay for full disclosure.
+27
View File
@@ -0,0 +1,27 @@
Alan Clegg <aclegg@isc.org>
Alessio Podda <alessio@isc.org>
Aram Sargsyan <aram@isc.org>
Artem Boldariev <artem@isc.org> <artem@boldariev.com>
Curtis Blackburn <ckb@isc.org> <ckb@freebsd11.local>
Curtis Blackburn <ckb@isc.org> <ckb@isc.org>
Diego Fronza <diego@isc.org>
Evan Hunt <each@isc.org> Evan Hunt <fanf@isc.org>
Håvard Eidnes <he@uninett.no>
Jeremy C. Reed <jreed@isc.org> <jreed@docs.lab.isc.org>
Jeremy C. Reed <jreed@isc.org> <jreed@ISC.org>
Joey Salazar <joey@isc.org>
John H. DuBois III <johnd>
Mark Andrews <marka@isc.org>
Mark Andrews <marka@isc.org> <marka@daemon.lab.isc.org>
Mark Andrews <marka@isc.org> <marka@newdocs.lab.isc.org>
Matthijs Mekking <matthijs@isc.org> <github@pletterpet.nl>
Nicki Křížek <nicki@isc.org> <tkrizek@isc.org>
Ondřej Surý <ondrej@isc.org>
Ondřej Surý <ondrej@isc.org> <ondrej@openbsd-6-9.home.sury.org>
Ondřej Surý <ondrej@isc.org> <ondrej@sury.org>
Petr Menšík <pemensik@redhat.com>
Petr Menšík <pemensik@redhat.com> <pmensik@redhat.com>
Robert Edmonds <edmonds>
Tatuya JINMEI 神明達哉 <jinmei@isc.org>
Witold Kręcicki <wpk@isc.org>
Witold Kręcicki <wpk@isc.org> <wpk@culm.net>
+19 -1
View File
@@ -1,10 +1,28 @@
[MASTER]
[IMPORTS]
deprecated-modules=
dns.resolver,
[MESSAGES CONTROL]
disable=
C0103, # invalid-name
C0114, # missing-module-docstring
C0115, # missing-class-docstring
C0116, # missing-function-docstring
C0209, # consider-using-f-string
C0301, # line-too-long, handled better by black
C0302, # too-many-lines
C0415, # import-outside-toplevel
R0801, # duplicate-code
R0901, # too-many-ancestors
R0902, # too-many-instance-attributes
R0903, # too-few-public-methods
R0904, # too-many-public-methods
R0911, # too-many-return-statements
R0912, # too-many-branches
R0913, # too-many-arguments
R0914, # too-many-locals
R0915, # too-many-statements
R0916, # too-many-boolean-expressions
R0917, # too-many-positional-arguments
+3 -5
View File
@@ -6,6 +6,9 @@ build:
os: ubuntu-22.04
tools:
python: "3.11"
jobs:
pre_build:
- python -m pip install -r https://gitlab.isc.org/isc-projects/bind9/-/raw/main/doc/arm/requirements.txt
# Build documentation in doc/arm/ with Sphinx
sphinx:
@@ -13,8 +16,3 @@ sphinx:
# Build all formats
formats: all
# Explicitly set the version of Python and its requirements
python:
install:
- requirements: doc/arm/requirements.txt
+27 -4
View File
@@ -24,8 +24,8 @@ Files: **/*.after*
**/testdata/*
.github/*
.gitlab/*
.mailmap
AUTHORS
CHANGES
COPYRIGHT
Makefile
Makefile.*
@@ -38,15 +38,31 @@ Files: **/*.after*
bin/tests/system/doth/CA/index.txt
bin/tests/system/doth/CA/index.txt.attr
bin/tests/system/doth/CA/serial
bin/tests/system/notify/ns4/named.port.in
bin/tests/system/formerr/badnsec3owner
bin/tests/system/formerr/badrecordname
bin/tests/system/formerr/dupans
bin/tests/system/formerr/dupquestion
bin/tests/system/formerr/keyclass
bin/tests/system/formerr/malformeddeltype
bin/tests/system/formerr/malformedrrsig
bin/tests/system/formerr/nametoolong
bin/tests/system/formerr/noquestions
bin/tests/system/formerr/twoquestions
bin/tests/system/formerr/optwrongname
bin/tests/system/formerr/qtypeasanswer
bin/tests/system/formerr/questionclass
bin/tests/system/formerr/shortquestion
bin/tests/system/formerr/shortrecord
bin/tests/system/formerr/tsignotlast
bin/tests/system/formerr/tsigwrongclass
bin/tests/system/formerr/twoquestionnames
bin/tests/system/formerr/twoquestiontypes
bin/tests/system/formerr/wrongclass
bin/tests/system/forward/CA/CA.cfg
bin/tests/system/forward/CA/README
bin/tests/system/forward/CA/index.txt
bin/tests/system/forward/CA/index.txt.attr
bin/tests/system/forward/CA/serial
bin/tests/system/isctest/vars/.ac_vars/*
bin/tests/system/journal/ns1/managed-keys.bind.in
bin/tests/system/journal/ns1/managed-keys.bind.jnl.in
bin/tests/system/journal/ns2/managed-keys.bind.in
@@ -57,6 +73,12 @@ Files: **/*.after*
bin/tests/system/masterfile/knowngood.include
bin/tests/system/masterfile/knowngood.ttl1
bin/tests/system/masterfile/knowngood.ttl2
bin/tests/system/notify/CA/CA.cfg
bin/tests/system/notify/CA/README
bin/tests/system/notify/CA/index.txt
bin/tests/system/notify/CA/index.txt.attr
bin/tests/system/notify/CA/serial
bin/tests/system/notify/ns4/named.port.in
bin/tests/system/nsupdate/CA/CA.cfg
bin/tests/system/nsupdate/CA/README
bin/tests/system/nsupdate/CA/index.txt
@@ -101,7 +123,6 @@ Files: **/*.after*
doc/arm/*.dia
doc/arm/*.png
doc/arm/isc-logo.pdf
doc/arm/requirements.txt
doc/man/*.1in
doc/man/*.5in
doc/man/*.8in
@@ -173,6 +194,8 @@ Files: **/.clang-format
.readthedocs.yaml
.tsan-suppress
.uncrustify.cfg
contrib/gitchangelog/changelog.rc.py
contrib/gitchangelog/relnotes.rc.py
doc/misc/*.zoneopt
doc/misc/options
doc/misc/rndc.grammar
-21965
View File
File diff suppressed because it is too large Load Diff
+12 -11
View File
@@ -11,7 +11,7 @@ See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
-->
## BIND 9 Source Access and Contributor Guidelines
*May 28, 2020*
*Nov 26, 2024*
### Contents
@@ -72,13 +72,13 @@ To clone the repository, use:
> $ git clone https://gitlab.isc.org/isc-projects/bind9.git
Release branch names are of the form `bind-9.X`, where X represents the second
number in the BIND 9 version number. So, to check out the BIND 9.18
number in the BIND 9 version number. So, to check out the BIND 9.20
branch, use:
> $ git checkout bind-9.18
> $ git checkout bind-9.20
Whenever a branch is ready for publication, a tag is placed of the
form `v9.X.Y`. The 9.18.0 release, for instance, is tagged as `v9.18.0`.
form `v9.X.Y`. The 9.20.0 release, for instance, is tagged as `v9.20.0`.
The branch in which the next major release is being developed is called
`main`.
@@ -121,8 +121,9 @@ patch will be applied.
#### <a name="bind"></a>BIND code
Patches for BIND may be submitted directly via merge requests in
[ISC's GitLab](https://gitlab.isc.org/isc-projects/bind9/) source
repository for BIND.
[ISC's GitLab](https://gitlab.isc.org/isc-projects/bind9/) source repository for
BIND. Please contact ISC and provide your GitLab username in order to be allowed
to fork the project and submit merge requests.
Patches can also be submitted as diffs against a specific version of
BIND -- preferably the current top of the `main` branch. Diffs may
@@ -144,8 +145,8 @@ we're busy with other work, it may take us a long time to get to it.
To ensure your patch is acted on as promptly as possible, please:
* Try to adhere to the [BIND 9 coding style](doc/dev/style.md).
* Run `make check` to ensure your change hasn't caused any
functional regressions.
* Run unit and system tests to ensure your change hasn't caused any
functional regressions (these can be checked in the CI pipeline).
* Document your work, both in the patch itself and in the
accompanying email.
* In patches that make non-trivial functional changes, include system
@@ -156,12 +157,12 @@ To ensure your patch is acted on as promptly as possible, please:
##### Changes to `configure`
If you need to make changes to `configure`, you should not edit it
directly; instead, edit `configure.in`, then run `autoconf`. Similarly,
instead of editing `config.h.in` directly, edit `configure.in` and run
directly; instead, edit `configure.ac`, then run `autoconf`. Similarly,
instead of editing `config.h.in` directly, edit `configure.ac` and run
`autoheader`.
When submitting a patch as a diff, it's fine to omit the `configure`
diffs to save space. Just send the `configure.in` diffs and we'll
diffs to save space. Just send the `configure.ac` diffs and we'll
generate the new `configure` during the review process.
##### Documentation
-1
View File
@@ -21,7 +21,6 @@ EXTRA_DIST = \
util/bindkeys.pl \
util/dtrace.sh \
contrib \
CHANGES \
COPYRIGHT \
LICENSE \
*.md
+1 -1
View File
@@ -1 +1 @@
CHANGES
doc/arm/changelog.rst
+2 -33
View File
@@ -20,7 +20,6 @@ information regarding copyright ownership.
1. [Building BIND](#build)
1. [Automated testing](#testing)
1. [Documentation](#doc)
1. [Change log](#changes)
1. [Acknowledgments](#ack)
### <a name="intro"/> Introduction
@@ -49,8 +48,7 @@ ongoing maintenance and improvement. BIND is open source software
licensed under the terms of the Mozilla Public License, version 2.0.
For a detailed list of changes made throughout the history of BIND 9, see
the file [CHANGES](CHANGES). See [below](#changes) for details on the
CHANGES file format.
the [changelog](doc/arm/changelog.rst).
For up-to-date versions and release notes, see
[https://www.isc.org/download/](https://www.isc.org/download/).
@@ -163,38 +161,9 @@ can be found in the ISC Knowledgebase at
Additional information on various subjects can be found in other
`README` files throughout the source tree.
### <a name="changes"/> Change log
A detailed list of all changes that have been made throughout the
development of BIND 9 is included in the file CHANGES, with the most recent
changes listed first. Change notes include tags indicating the category of
the change that was made; these categories are:
|Category |Description |
|-------------- |-----------------------------------------------|
| [func] | New feature |
| [bug] | General bug fix |
| [security] | Fix for a significant security flaw |
| [experimental] | Used for new features when the syntax or other aspects of the design are still in flux and may change |
| [port] | Portability enhancement |
| [maint] | Updates to built-in data such as root server addresses and keys |
| [tuning] | Changes to built-in configuration defaults and constants to improve performance |
| [performance] | Other changes to improve server performance |
| [protocol] | Updates to the DNS protocol such as new RR types |
| [test] | Changes to the automatic tests, not affecting server functionality |
| [cleanup] | Minor corrections and refactoring |
| [doc] | Documentation |
| [contrib] | Changes to the contributed tools and libraries in the 'contrib' subdirectory |
| [placeholder] | Used in the main development branch to reserve change numbers for use in other branches, e.g., when fixing a bug that only exists in older releases |
In general, [func] and [experimental] tags only appear in new-feature
releases (i.e., those with version numbers ending in zero). Some new
functionality may be backported to older releases on a case-by-case basis.
All other change types may be applied to all currently supported releases.
#### Bug report identifiers
Most notes in the CHANGES file include a reference to a bug report or
Most notes in the ARM Changelog appendix include a reference to a bug report or
issue number. Prior to 2018, these were usually of the form `[RT #NNN]`
and referred to entries in the "bind9-bugs" RT database, which was not open
to the public. More recent entries use the form `[GL #NNN]` or, less often,
+17 -17
View File
@@ -146,14 +146,14 @@ logged(char *key, int value) {
isc_result_t result;
if (symtab == NULL) {
return (false);
return false;
}
result = isc_symtab_lookup(symtab, key, value, NULL);
if (result == ISC_R_SUCCESS) {
return (true);
return true;
}
return (false);
return false;
}
static bool
@@ -177,7 +177,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
aaaa->type == dns_rdatatype_aaaa);
if (a == NULL || aaaa == NULL) {
return (answer);
return answer;
}
memset(&hints, 0, sizeof(hints));
@@ -234,7 +234,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0 */
return (true);
return true;
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
@@ -243,7 +243,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
gai_strerror(result));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return (true);
return true;
}
/*
@@ -371,7 +371,7 @@ checkmissing:
}
}
freeaddrinfo(ai);
return (answer);
return answer;
}
static bool
@@ -434,7 +434,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
}
}
freeaddrinfo(ai);
return (answer);
return answer;
case EAI_NONAME:
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
@@ -448,7 +448,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0. */
return (true);
return true;
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
@@ -457,7 +457,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
gai_strerror(result));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return (true);
return true;
}
}
@@ -521,7 +521,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
}
}
freeaddrinfo(ai);
return (answer);
return answer;
case EAI_NONAME:
#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
@@ -535,7 +535,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0. */
return (true);
return true;
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
@@ -544,7 +544,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
gai_strerror(result));
add(namebuf, ERR_LOOKUP_FAILURE);
}
return (true);
return true;
}
}
@@ -573,7 +573,7 @@ setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
ISC_R_SUCCESS);
*logp = log;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*% load the zone */
@@ -648,7 +648,7 @@ cleanup:
if (zone != NULL) {
dns_zone_detach(&zone);
}
return (result);
return result;
}
/*% dump the zone */
@@ -679,7 +679,7 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
"could not open output "
"file \"%s\" for writing\n",
filename);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
}
@@ -689,5 +689,5 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
(void)isc_stdio_close(output);
}
return (result);
return result;
}
+27 -27
View File
@@ -86,10 +86,10 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
cfg_obj_log(obj, logc, ISC_LOG_ERROR,
"change directory to '%s' failed: %s\n", directory,
isc_result_totext(result));
return (result);
return result;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static bool
@@ -97,10 +97,10 @@ get_maps(const cfg_obj_t **maps, const char *name, const cfg_obj_t **obj) {
int i;
for (i = 0;; i++) {
if (maps[i] == NULL) {
return (false);
return false;
}
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
return (true);
return true;
}
}
}
@@ -116,7 +116,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
for (i = 0;; i++) {
if (maps[i] == NULL) {
return (false);
return false;
}
checknames = NULL;
result = cfg_map_get(maps[i], "check-names", &checknames);
@@ -125,7 +125,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
}
if (checknames != NULL && !cfg_obj_islist(checknames)) {
*obj = checknames;
return (true);
return true;
}
for (element = cfg_list_first(checknames); element != NULL;
element = cfg_list_next(element))
@@ -139,7 +139,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
continue;
}
*obj = cfg_tuple_get(value, "mode");
return (true);
return true;
}
}
}
@@ -152,23 +152,23 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
isc_textregion_t r;
if (zfile == NULL) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
r.base = UNCONST(zclass);
r.length = strlen(zclass);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = dns_rootns_create(mctx, rdclass, zfile, &db);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
dns_db_detach(&db);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*% configure the zone */
@@ -224,18 +224,18 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
printf("%s %s %s in-view %s\n", zname, zclass, view, inview);
}
if (inviewobj != NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
cfg_map_get(zoptions, "type", &typeobj);
if (typeobj == NULL) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
if (list) {
const char *ztype = cfg_obj_asstring(typeobj);
printf("%s %s %s %s\n", zname, zclass, view, ztype);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -245,12 +245,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
if (dbobj != NULL &&
strcmp(ZONEDB_DEFAULT, cfg_obj_asstring(dbobj)) != 0)
{
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
cfg_map_get(zoptions, "dlz", &dlzobj);
if (dlzobj != NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
cfg_map_get(zoptions, "file", &fileobj);
@@ -264,12 +264,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
* master and redirect
*/
if (strcasecmp(cfg_obj_asstring(typeobj), "hint") == 0) {
return (configure_hint(zfile, zclass, mctx));
return configure_hint(zfile, zclass, mctx);
} else if ((strcasecmp(cfg_obj_asstring(typeobj), "primary") != 0) &&
(strcasecmp(cfg_obj_asstring(typeobj), "master") != 0) &&
(strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0))
{
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -282,12 +282,12 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
}
if (primariesobj != NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
if (zfile == NULL) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
obj = NULL;
@@ -465,7 +465,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
fprintf(stderr, "%s/%s/%s: %s\n", view, zname, zclass,
isc_result_totext(result));
}
return (result);
return result;
}
/*% configure a view */
@@ -500,7 +500,7 @@ configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
result = tresult;
}
}
return (result);
return result;
}
static isc_result_t
@@ -510,11 +510,11 @@ config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
if (!cfg_obj_isstring(classobj)) {
*classp = defclass;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
r.base = UNCONST(cfg_obj_asstring(classobj));
r.length = strlen(r.base);
return (dns_rdataclass_fromtext(classp, &r));
return dns_rdataclass_fromtext(classp, &r);
}
/*% load zones from the configuration */
@@ -572,7 +572,7 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
}
cleanup:
return (result);
return result;
}
static void
@@ -593,7 +593,7 @@ main(int argc, char **argv) {
const char *conffile = NULL;
isc_mem_t *mctx = NULL;
isc_result_t result = ISC_R_SUCCESS;
bool cleanup_dst = true;
bool cleanup_dst = false;
bool load_zones = false;
bool list_zones = false;
bool print = false;
@@ -769,5 +769,5 @@ cleanup:
isc_mem_destroy(&mctx);
}
return (result == ISC_R_SUCCESS ? 0 : 1);
return result == ISC_R_SUCCESS ? 0 : 1;
}
+1 -1
View File
@@ -571,5 +571,5 @@ main(int argc, char **argv) {
}
isc_mem_destroy(&mctx);
return ((result == ISC_R_SUCCESS) ? 0 : 1);
return (result == ISC_R_SUCCESS) ? 0 : 1;
}
+14 -14
View File
@@ -44,24 +44,24 @@ alg_fromtext(const char *name) {
}
if (strcasecmp(p, "md5") == 0) {
return (DST_ALG_HMACMD5);
return DST_ALG_HMACMD5;
}
if (strcasecmp(p, "sha1") == 0) {
return (DST_ALG_HMACSHA1);
return DST_ALG_HMACSHA1;
}
if (strcasecmp(p, "sha224") == 0) {
return (DST_ALG_HMACSHA224);
return DST_ALG_HMACSHA224;
}
if (strcasecmp(p, "sha256") == 0) {
return (DST_ALG_HMACSHA256);
return DST_ALG_HMACSHA256;
}
if (strcasecmp(p, "sha384") == 0) {
return (DST_ALG_HMACSHA384);
return DST_ALG_HMACSHA384;
}
if (strcasecmp(p, "sha512") == 0) {
return (DST_ALG_HMACSHA512);
return DST_ALG_HMACSHA512;
}
return (DST_ALG_UNKNOWN);
return DST_ALG_UNKNOWN;
}
/*%
@@ -71,19 +71,19 @@ int
alg_bits(dns_secalg_t alg) {
switch (alg) {
case DST_ALG_HMACMD5:
return (128);
return 128;
case DST_ALG_HMACSHA1:
return (160);
return 160;
case DST_ALG_HMACSHA224:
return (224);
return 224;
case DST_ALG_HMACSHA256:
return (256);
return 256;
case DST_ALG_HMACSHA384:
return (384);
return 384;
case DST_ALG_HMACSHA512:
return (512);
return 512;
default:
return (0);
return 0;
}
}
+2 -2
View File
@@ -30,7 +30,7 @@ set_user(FILE *fd, const char *user) {
pw = getpwnam(user);
if (pw == NULL) {
errno = EINVAL;
return (-1);
return -1;
}
return (fchown(fileno(fd), pw->pw_uid, -1));
return fchown(fileno(fd), pw->pw_uid, -1);
}
+1 -1
View File
@@ -290,5 +290,5 @@ options {\n\
isc_mem_destroy(&mctx);
return (0);
return 0;
}
+1 -1
View File
@@ -296,5 +296,5 @@ nsupdate -k <keyfile>\n");
isc_mem_destroy(&mctx);
return (0);
return 0;
}
+2 -1
View File
@@ -5,7 +5,8 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBNS_CFLAGS) \
$(LIBISCCFG_CFLAGS)
$(LIBISCCFG_CFLAGS) \
$(OPENSSL_CFLAGS)
AM_CPPFLAGS += \
-DSYSCONFDIR=\"${sysconfdir}\"
+122 -48
View File
@@ -88,6 +88,10 @@
#define MAXNAME (DNS_NAME_MAXTEXT + 1)
#define MAX_QUERIES 50
#define MAX_TOTAL 200
#define MAX_RESTARTS 11
/* Variables used internally by delv. */
char *progname = NULL;
static isc_mem_t *mctx = NULL;
@@ -130,6 +134,10 @@ static bool showcomments = true, showdnssec = true, showtrust = true,
multiline = false, short_form = false, print_unknown_format = false,
yaml = false, fulltrace = false;
static uint32_t maxqueries = MAX_QUERIES;
static uint32_t maxtotal = MAX_TOTAL;
static uint32_t restarts = MAX_RESTARTS;
static bool resolve_trace = false, validator_trace = false,
message_trace = false, send_trace = false;
@@ -600,7 +608,7 @@ setup_style(void) {
48, 80, 8, splitwidth, mctx);
}
return (result);
return result;
}
static isc_result_t
@@ -621,11 +629,11 @@ convert_name(dns_fixedname_t *fn, dns_name_t **name, const char *text) {
if (result != ISC_R_SUCCESS) {
delv_log(ISC_LOG_ERROR, "failed to convert name %s: %s", text,
isc_result_totext(result));
return (result);
return result;
}
*name = n;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -658,7 +666,7 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client, dns_view_t *toview) {
CHECK(convert_name(&fkeyname, &keyname, keynamestr));
if (!root_validation) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (anchor_name) {
@@ -666,11 +674,11 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client, dns_view_t *toview) {
}
if (!match_root) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (!root_validation) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
delv_log(ISC_LOG_DEBUG(3), "adding trust anchor %s", trust_anchor);
@@ -823,7 +831,7 @@ cleanup:
result = ISC_R_FAILURE;
}
return (result);
return result;
}
static isc_result_t
@@ -848,7 +856,7 @@ cleanup:
if (result == DST_R_NOCRYPTO) {
result = ISC_R_SUCCESS;
}
return (result);
return result;
}
static isc_result_t
@@ -861,7 +869,7 @@ setup_dnsseckeys(dns_client_t *client, dns_view_t *toview) {
cfg_obj_t *bindkeys = NULL;
if (!root_validation) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (trust_anchor == NULL) {
@@ -928,7 +936,7 @@ cleanup:
delv_log(ISC_LOG_ERROR, "setup_dnsseckeys: %s",
isc_result_totext(result));
}
return (result);
return result;
}
static isc_result_t
@@ -975,7 +983,7 @@ addserver(dns_client_t *client) {
if (gaierror != 0) {
delv_log(ISC_LOG_ERROR, "getaddrinfo failed: %s",
gai_strerror(gaierror));
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
result = ISC_R_SUCCESS;
@@ -1011,7 +1019,7 @@ cleanup:
isc_result_totext(result));
}
return (result);
return result;
}
static isc_result_t
@@ -1080,7 +1088,7 @@ cleanup:
if (resconf != NULL) {
irs_resconf_destroy(&resconf);
}
return (result);
return result;
}
static isc_result_t
@@ -1093,10 +1101,10 @@ parse_uint(uint32_t *uip, const char *value, uint32_t max, const char *desc) {
if (result != ISC_R_SUCCESS) {
printf("invalid %s '%s': %s\n", desc, value,
isc_result_totext(result));
return (result);
return result;
}
*uip = n;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -1191,6 +1199,47 @@ plus_option(char *option) {
break;
case 'm':
switch (cmd[1]) {
case 'a':
switch (cmd[3]) {
case 'q': /* maxqueries */
FULLCHECK("maxqueries");
if (value == NULL) {
goto need_value;
}
if (!state) {
goto invalid_option;
}
result = parse_uint(&maxqueries, value,
UINT_MAX, "maxqueries");
if (result != ISC_R_SUCCESS) {
fatal("Couldn't parse maxqueries");
}
if (maxqueries == 0) {
fatal("maxqueries must be nonzero");
}
break;
case 't': /* maxtotalqueries */
FULLCHECK("maxtotalqueries");
if (value == NULL) {
goto need_value;
}
if (!state) {
goto invalid_option;
}
result = parse_uint(&maxtotal, value, UINT_MAX,
"maxtotalqueries");
if (result != ISC_R_SUCCESS) {
fatal("Couldn't parse maxtotalqueries");
}
if (maxtotal == 0) {
fatal("maxtotalqueries must be "
"nonzero");
}
break;
default:
goto invalid_option;
}
break;
case 't': /* mtrace */
FULLCHECK("mtrace");
message_trace = state;
@@ -1243,6 +1292,22 @@ plus_option(char *option) {
break;
case 'r':
switch (cmd[1]) {
case 'e': /* restarts */
FULLCHECK("restarts");
if (value == NULL) {
goto need_value;
}
if (!state) {
goto invalid_option;
}
result = parse_uint(&restarts, value, 255, "restarts");
if (result != ISC_R_SUCCESS) {
fatal("Couldn't parse restarts");
}
if (restarts == 0) {
fatal("restarts must be between 1..255");
}
break;
case 'o': /* root */
FULLCHECK("root");
if (state && no_sigs) {
@@ -1370,10 +1435,7 @@ plus_option(char *option) {
break;
default:
invalid_option:
/*
* We can also add a "need_value:" case here if we ever
* add a plus-option that requires a specified value
*/
need_value:
fprintf(stderr, "Invalid option: +%s\n", option);
usage();
}
@@ -1446,7 +1508,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
if (strlen(option) > 1U) {
option = &option[1];
} else {
return (false);
return false;
}
}
opt = option[0];
@@ -1463,7 +1525,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
switch (opt) {
case 'a':
anchorfile = isc_mem_strdup(mctx, value);
return (value_from_next);
return value_from_next;
case 'b':
hash = strchr(value, '#');
if (hash != NULL) {
@@ -1500,7 +1562,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
if (hash != NULL) {
*hash = '#';
}
return (value_from_next);
return value_from_next;
case 'c':
if (classset) {
warn("extra query class");
@@ -1518,28 +1580,28 @@ dash_option(char *option, char *next, bool *open_type_class) {
} else {
warn("ignoring invalid class");
}
return (value_from_next);
return value_from_next;
case 'd':
result = parse_uint(&num, value, 99, "debug level");
if (result != ISC_R_SUCCESS) {
fatal("Couldn't parse debug level");
}
loglevel = num;
return (value_from_next);
return value_from_next;
case 'p':
port = value;
result = parse_uint(&destport, port, 0xffff, "port");
if (result != ISC_R_SUCCESS) {
fatal("Couldn't parse port number");
}
return (value_from_next);
return value_from_next;
case 'q':
if (curqname != NULL) {
warn("extra query name");
isc_mem_free(mctx, curqname);
}
curqname = isc_mem_strdup(mctx, value);
return (value_from_next);
return value_from_next;
case 't':
*open_type_class = false;
tr.base = value;
@@ -1560,7 +1622,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
} else {
warn("ignoring invalid type");
}
return (value_from_next);
return value_from_next;
case 'x':
result = get_reverse(textname, sizeof(textname), value, false);
if (result == ISC_R_SUCCESS) {
@@ -1578,14 +1640,14 @@ dash_option(char *option, char *next, bool *open_type_class) {
fprintf(stderr, "Invalid IP address %s\n", value);
exit(EXIT_FAILURE);
}
return (value_from_next);
return value_from_next;
invalid_option:
default:
fprintf(stderr, "Invalid option: -%s\n", option);
usage();
}
UNREACHABLE();
return (false);
return false;
}
/*
@@ -1752,11 +1814,11 @@ parse_args(int argc, char **argv) {
static isc_result_t
append_str(const char *text, int len, char **p, char *end) {
if (len > end - *p) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
memmove(*p, text, len);
*p += len;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -1767,17 +1829,17 @@ reverse_octets(const char *in, char **p, char *end) {
isc_result_t result;
result = reverse_octets(dot + 1, p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = append_str(".", 1, p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
len = (int)(dot - in);
} else {
len = strlen(in);
}
return (append_str(in, len, p, end));
return append_str(in, len, p, end);
}
static isc_result_t
@@ -1796,10 +1858,10 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
name = dns_fixedname_initname(&fname);
result = dns_byaddr_createptrname(&addr, name);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
dns_name_format(name, reverse, (unsigned int)len);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else {
/*
* Not a valid IPv6 address. Assume IPv4.
@@ -1812,17 +1874,17 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
char *p = reverse;
char *end = reverse + len;
if (strict && inet_pton(AF_INET, value, &addr.type.in) != 1) {
return (DNS_R_BADDOTTEDQUAD);
return DNS_R_BADDOTTEDQUAD;
}
result = reverse_octets(value, &p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = append_str(".in-addr.arpa.", 15, &p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
@@ -1898,6 +1960,8 @@ run_resolve(void *arg) {
/* Create client */
CHECK(dns_client_create(mctx, loopmgr, netmgr, 0, tlsctx_client_cache,
&client, srcaddr4, srcaddr6));
dns_client_setmaxrestarts(client, restarts);
dns_client_setmaxqueries(client, maxtotal);
/* Set the nameserver */
if (server != NULL) {
@@ -2058,7 +2122,7 @@ accept_cb(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
UNUSED(handle);
UNUSED(arg);
return (result);
return result;
}
static void
@@ -2117,16 +2181,23 @@ cleanup:
static isc_result_t
matchview(isc_netaddr_t *srcaddr, isc_netaddr_t *destaddr,
dns_message_t *message, dns_aclenv_t *env, isc_result_t *sigresultp,
dns_message_t *message, dns_aclenv_t *env, ns_server_t *lsctx,
isc_loop_t *loop, isc_job_cb cb, void *cbarg,
isc_result_t *sigresultp, isc_result_t *viewpatchresultp,
dns_view_t **viewp) {
UNUSED(srcaddr);
UNUSED(destaddr);
UNUSED(message);
UNUSED(env);
UNUSED(lsctx);
UNUSED(loop);
UNUSED(cb);
UNUSED(cbarg);
UNUSED(sigresultp);
*viewp = view;
return (ISC_R_SUCCESS);
*viewpatchresultp = ISC_R_SUCCESS;
return ISC_R_SUCCESS;
}
static void
@@ -2147,14 +2218,16 @@ run_server(void *arg) {
isc_sockaddr_any(&any);
CHECK(dns_dispatch_createudp(dispatchmgr, &any, &dispatch));
CHECK(ns_interfacemgr_create(mctx, sctx, loopmgr, netmgr, dispatchmgr,
NULL, false, &interfacemgr));
NULL, &interfacemgr));
CHECK(dns_view_create(mctx, dispatchmgr, dns_rdataclass_in, "_default",
&view));
CHECK(dns_cache_create(loopmgr, dns_rdataclass_in, "", &cache));
CHECK(dns_view_create(mctx, loopmgr, dispatchmgr, dns_rdataclass_in,
"_default", &view));
CHECK(dns_cache_create(loopmgr, dns_rdataclass_in, "", mctx, &cache));
dns_view_setcache(view, cache, false);
dns_cache_detach(&cache);
dns_view_setdstport(view, destport);
dns_view_setmaxrestarts(view, restarts);
dns_view_setmaxqueries(view, maxtotal);
CHECK(dns_rootns_create(mctx, dns_rdataclass_in, hintfile, &roothints));
dns_view_sethints(view, roothints);
@@ -2168,6 +2241,7 @@ run_server(void *arg) {
CHECK(dns_view_createresolver(view, netmgr, 0, tlsctx_client_cache,
dispatch, NULL));
dns_resolver_setmaxqueries(view->resolver, maxqueries);
isc_stats_create(mctx, &resstats, dns_resstatscounter_max);
dns_resolver_setstats(view->resolver, resstats);
@@ -2264,5 +2338,5 @@ cleanup:
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
return (0);
return 0;
}
+17
View File
@@ -337,6 +337,23 @@ assign values to options like the timeout interval. They have the form
they are replaced by the string ``[omitted]`` or, in the DNSKEY case, the
key ID is displayed as the replacement, e.g. ``[ key id = value ]``.
.. option:: +restarts
When name server mode (``delv +ns``) is in use, this option sets the
maximum number of CNAME queries to follow before terminating resolution.
This prevents ``delv`` from hanging in the event of a CNAME loop.
The default is 11.
.. option:: +maxqueries
This option specifies the maximum number of queries to send to resolve
a name before giving up. The default is 50.
.. option:: +maxtotalqueries
This option specifies the maximum number of queries to send to resolve
a client request before giving up. The default is 200.
.. option:: +trust, +notrust
This option controls whether to display the trust level when printing a record.
+2 -1
View File
@@ -5,7 +5,8 @@ AM_CPPFLAGS += \
$(LIBDNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBIDN2_CFLAGS) \
$(LIBUV_CFLAGS)
$(LIBUV_CFLAGS) \
$(OPENSSL_CFLAGS)
LDADD += \
libdighost.la \
+77 -72
View File
@@ -89,9 +89,9 @@ rcode_totext(dns_rcode_t rcode) {
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (strspn(buf + 1, "0123456789") == strlen(buf + 1)) {
buf[0] = '?';
return (buf);
return buf;
}
return (buf + 1);
return buf + 1;
}
/*% print usage */
@@ -473,7 +473,7 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
if (query->lookup->trace || query->lookup->ns_search_only) {
result = dns_rdatatype_totext(rdata->type, buf);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
ADD_STRING(buf, " ");
}
@@ -494,7 +494,7 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
result = dns_rdata_tofmttext(rdata, NULL, styleflags, 0, splitwidth,
" ", buf);
if (result == ISC_R_NOSPACE) {
return (result);
return result;
}
check_result(result, "dns_rdata_totext");
if (query->lookup->identify) {
@@ -511,7 +511,7 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
ADD_STRING(buf, store);
}
ADD_STRING(buf, "\n");
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -535,14 +535,14 @@ dns64prefix_answer(dns_message_t *msg, isc_buffer_t *buf) {
dns_rdatatype_aaaa, dns_rdatatype_none,
NULL, &rdataset);
if (result == DNS_R_NXDOMAIN || result == DNS_R_NXRRSET) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = dns_dns64_findprefix(rdataset, prefix, &count);
if (result == ISC_R_NOTFOUND) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (count > 10) {
count = 10;
@@ -550,15 +550,15 @@ dns64prefix_answer(dns_message_t *msg, isc_buffer_t *buf) {
for (i = 0; i < count; i++) {
result = isc_netaddr_totext(&prefix[i].addr, buf);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = isc_buffer_printf(buf, "/%u\n", prefix[i].prefixlen);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -578,9 +578,9 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
dns_name_init(&empty_name, NULL);
result = dns_message_firstname(msg, DNS_SECTION_ANSWER);
if (result == ISC_R_NOMORE) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
for (;;) {
@@ -595,7 +595,7 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
dns_rdataset_current(rdataset, &rdata);
result = say_message(&rdata, query, buf);
if (result == ISC_R_NOSPACE) {
return (result);
return result;
}
check_result(result, "say_message");
loopresult = dns_rdataset_next(rdataset);
@@ -606,11 +606,11 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
if (result == ISC_R_NOMORE) {
break;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static bool
@@ -628,10 +628,10 @@ isdotlocal(dns_message_t *msg) {
dns_name_t *name = NULL;
dns_message_currentname(msg, DNS_SECTION_QUESTION, &name);
if (dns_name_issubdomain(name, &local)) {
return (true);
return true;
}
}
return (false);
return false;
}
/*
@@ -748,8 +748,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
char *hash;
int pf;
printf("-\n");
printf(" type: MESSAGE\n");
printf("- type: MESSAGE\n");
printf(" message:\n");
if (isquery) {
@@ -1025,7 +1024,7 @@ repopulate_buffer:
dig_idnsetup(query->lookup, false);
return (result);
return result;
}
/*%
@@ -1194,7 +1193,7 @@ proxy_handle_addr_string(const char *addr_start, const size_t addr_len,
}
}
return (result);
return result;
}
static bool
@@ -1214,7 +1213,7 @@ parse_proxy_addresses(const char *addrs, isc_sockaddr_t *psrc,
/* start syntax analysis and verification */
if (!rule_proxy_addrs(&st)) {
warn("PROXY source and destination addresses cannot be parsed");
return (false);
return false;
}
/* get port numeric values */
@@ -1241,7 +1240,7 @@ parse_proxy_addresses(const char *addrs, isc_sockaddr_t *psrc,
if (result != ISC_R_SUCCESS) {
warn("Cannot get PROXY source address: %s",
isc_result_totext(result));
return (false);
return false;
}
result = proxy_handle_addr_string(st.dst_addr_start, st.dst_addr_len,
@@ -1249,26 +1248,26 @@ parse_proxy_addresses(const char *addrs, isc_sockaddr_t *psrc,
if (result != ISC_R_SUCCESS) {
warn("Cannot get PROXY destination address: %s",
isc_result_totext(result));
return (false);
return false;
}
/* addresses should be of the same type */
if (isc_sockaddr_pf(&src) != isc_sockaddr_pf(&dst)) {
warn("PROXY source and destination addresses must be of the "
"same type");
return (false);
return false;
}
*psrc = src;
*pdst = dst;
return (true);
return true;
}
static bool
rule_proxy_addrs(isc_proxy_addrs_parser_state_t *st) {
if (!rule_addr(st)) {
return (false);
return false;
}
st->src_addr_start = st->last_addr_start;
@@ -1277,13 +1276,13 @@ rule_proxy_addrs(isc_proxy_addrs_parser_state_t *st) {
st->src_port_len = st->last_port_len;
if (!MATCH('-')) {
return (false);
return false;
}
ADVANCE();
if (!rule_addr(st)) {
return (false);
return false;
}
st->dst_addr_start = st->last_addr_start;
@@ -1292,17 +1291,17 @@ rule_proxy_addrs(isc_proxy_addrs_parser_state_t *st) {
st->dst_port_len = st->last_port_len;
if (!MATCH('\0')) {
return (false);
return false;
}
return (true);
return true;
}
static bool
rule_addr(isc_proxy_addrs_parser_state_t *st) {
const char *start = GETP();
if (!rule_addr_char(st)) {
return (false);
return false;
}
while (rule_addr_char(st)) {
@@ -1316,18 +1315,18 @@ rule_addr(isc_proxy_addrs_parser_state_t *st) {
ADVANCE();
if (!rule_port(st)) {
return (false);
return false;
}
}
return (true);
return true;
}
static bool
rule_port(isc_proxy_addrs_parser_state_t *st) {
const char *start = GETP();
if (!MATCH_DIGIT()) {
return (false);
return false;
}
ADVANCE();
@@ -1339,18 +1338,18 @@ rule_port(isc_proxy_addrs_parser_state_t *st) {
st->last_port_start = start;
st->last_port_len = GETP() - start;
return (true);
return true;
}
static bool
rule_addr_char(isc_proxy_addrs_parser_state_t *st) {
if (MATCH('#') || MATCH('-') || MATCH('\0')) {
return (false);
return false;
}
ADVANCE();
return (true);
return true;
}
#undef GETP
@@ -1367,20 +1366,20 @@ plus_proxy_handle_addresses(const char *value, const bool state,
* We are not interested in the option value in that
* case
*/
return (true);
return true;
}
if (value == NULL || *value == '\0') {
lookup->proxy_local = true;
return (true);
return true;
}
if (!parse_proxy_addresses(value, &lookup->proxy_src_addr,
&lookup->proxy_dst_addr))
{
return (false);
return false;
}
return (true);
return true;
}
static bool
@@ -1403,10 +1402,10 @@ plus_proxy_options(const char *cmd, const char *value, const bool state,
default:
goto invalid_option;
}
return (true);
return true;
invalid_option:
return (false);
return false;
}
static bool
@@ -1526,7 +1525,7 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
if ((cmd = strtok_r(option, "=", &last)) == NULL) {
printf(";; Invalid option %s\n", option);
return (lookup);
return lookup;
}
if (strncasecmp(cmd, "no", 2) == 0) {
cmd += 2;
@@ -1825,9 +1824,12 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
"specified");
goto exit_or_usage;
}
extra = strtok_r(NULL, "\0",
extra = strtok_r(NULL, "",
&last);
save_opt(lookup, code, extra);
if (extra != NULL) {
extra[-1] = ':';
}
break;
default:
goto invalid_option;
@@ -2556,7 +2558,10 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
fprintf(stderr, "Invalid option: +%s\n", option);
usage();
}
return (lookup);
if (value != NULL) {
value[-1] = '=';
}
return lookup;
#if !TARGET_OS_IPHONE
exit_or_usage:
@@ -2602,7 +2607,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
} else {
fatal("can't find IPv4 networking");
UNREACHABLE();
return (false);
return false;
}
break;
case '6':
@@ -2612,7 +2617,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
} else {
fatal("can't find IPv6 networking");
UNREACHABLE();
return (false);
return false;
}
break;
case 'd':
@@ -2621,7 +2626,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
cmd = option;
FULLCHECK("debug");
debugging = true;
return (false);
return false;
} else {
debugging = true;
}
@@ -2652,7 +2657,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
if (strlen(option) > 1U) {
option = &option[1];
} else {
return (false);
return false;
}
}
opt = option[0];
@@ -2696,7 +2701,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
*hash = '#';
}
specified_source = true;
return (value_from_next);
return value_from_next;
case 'c':
if ((*lookup)->rdclassset) {
fprintf(stderr, ";; Warning, extra class option\n");
@@ -2715,13 +2720,13 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
"invalid class %s\n",
value);
}
return (value_from_next);
return value_from_next;
case 'f':
batchname = value;
return (value_from_next);
return value_from_next;
case 'k':
strlcpy(keyfile, value, sizeof(keyfile));
return (value_from_next);
return value_from_next;
case 'p':
result = parse_uint(&num, value, MAXPORT, "port number");
if (result != ISC_R_SUCCESS) {
@@ -2729,7 +2734,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
}
port = num;
port_set = true;
return (value_from_next);
return value_from_next;
case 'q':
if (!config_only) {
if (*need_clone) {
@@ -2748,7 +2753,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
ISC_LIST_APPEND(lookup_list, (*lookup), link);
debug("looking up %s", (*lookup)->textname);
}
return (value_from_next);
return value_from_next;
case 't':
*open_type_class = false;
if (strncasecmp(value, "ixfr=", 5) == 0) {
@@ -2806,7 +2811,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
"invalid type %s\n",
value);
}
return (value_from_next);
return value_from_next;
case 'y':
if ((ptr = strtok_r(value, ":", &last)) == NULL) {
usage();
@@ -2815,8 +2820,8 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
* secret */
usage();
}
if ((ptr3 = strtok_r(NULL, ":", &last)) != NULL) { /* secret or
* NULL */
if ((ptr3 = strtok_r(NULL, "", &last)) != NULL) { /* secret or
* NULL */
parse_hmac(ptr);
ptr = ptr2;
ptr2 = ptr3;
@@ -2827,7 +2832,11 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
/* XXXONDREJ: FIXME */
strlcpy(keynametext, ptr, sizeof(keynametext));
strlcpy(keysecret, ptr2, sizeof(keysecret));
return (value_from_next);
if (ptr3 != NULL) {
ptr[-1] = ':';
}
ptr2[-1] = ':';
return value_from_next;
case 'x':
if (*need_clone) {
*lookup = clone_lookup(default_lookup, true);
@@ -2857,14 +2866,14 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
fprintf(stderr, "Invalid IP address %s\n", value);
exit(EXIT_FAILURE);
}
return (value_from_next);
return value_from_next;
invalid_option:
default:
fprintf(stderr, "Invalid option: -%s\n", option);
usage();
}
UNREACHABLE();
return (false);
return false;
}
/*%
@@ -2958,7 +2967,7 @@ split_batchline(char *batchline, char **bargv, int len, const char *msg) {
{
debug("%s %d: %s", msg, bargc, bargv[bargc]);
}
return (bargc);
return bargc;
}
static void
@@ -3306,8 +3315,7 @@ dig_error(const char *format, ...) {
va_list args;
if (yaml) {
printf("-\n");
printf(" type: DIG_ERROR\n");
printf("- type: DIG_ERROR\n");
/*
* Print an indent before a literal block quote.
@@ -3324,10 +3332,7 @@ dig_error(const char *format, ...) {
va_start(args, format);
vprintf(format, args);
va_end(args);
if (!yaml) {
printf("\n");
}
printf("\n"); /* We get the error without a newline */
}
static void
@@ -3423,5 +3428,5 @@ main(int argc, char **argv) {
dig_startup();
dig_shutdown();
return (exitcode);
return exitcode;
}
+93 -76
View File
@@ -60,6 +60,7 @@
#include <isc/xml.h>
#include <dns/byaddr.h>
#include <dns/ede.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/message.h>
@@ -236,7 +237,7 @@ count_dots(char *string) {
}
s++;
}
return (i);
return i;
}
static void
@@ -284,11 +285,11 @@ hex_dump(isc_buffer_t *b) {
static isc_result_t
append(const char *text, size_t len, char **p, char *end) {
if (*p + len > end) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
memmove(*p, text, len);
*p += len;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -299,17 +300,17 @@ reverse_octets(const char *in, char **p, char *end) {
isc_result_t result;
result = reverse_octets(dot + 1, p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = append(".", 1, p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
len = (int)(dot - in);
} else {
len = (int)strlen(in);
}
return (append(in, len, p, end));
return append(in, len, p, end);
}
isc_result_t
@@ -328,10 +329,10 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
name = dns_fixedname_initname(&fname);
result = dns_byaddr_createptrname(&addr, name);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
dns_name_format(name, reverse, (unsigned int)len);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else {
/*
* Not a valid IPv6 address. Assume IPv4.
@@ -344,18 +345,18 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
char *p = reverse;
char *end = reverse + len;
if (strict && inet_pton(AF_INET, value, &addr.type.in) != 1) {
return (DNS_R_BADDOTTEDQUAD);
return DNS_R_BADDOTTEDQUAD;
}
result = reverse_octets(value, &p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
/* Append .in-addr.arpa. and a terminating NUL. */
result = append(".in-addr.arpa.", 15, &p, end);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
@@ -456,7 +457,7 @@ make_server(const char *servname, const char *userarg) {
strlcpy(srv->servername, servname, MXNAME);
strlcpy(srv->userarg, userarg, MXNAME);
ISC_LINK_INIT(srv, link);
return (srv);
return srv;
}
/*%
@@ -632,7 +633,7 @@ make_empty_lookup(void) {
debug("make_empty_lookup() = %p->references = %" PRIuFAST32, looknew,
isc_refcount_current(&looknew->references));
return (looknew);
return looknew;
}
#define EDNSOPT_OPTIONS 100U
@@ -823,7 +824,7 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
looknew->magic = DIG_LOOKUP_MAGIC;
return (looknew);
return looknew;
}
/*%
@@ -853,7 +854,7 @@ requeue_lookup(dig_lookup_t *lookold, bool servers) {
ISC_LIST_PREPEND(lookup_list, looknew, link);
debug("after insertion, init -> %p, new = %p, new -> %p", lookold,
looknew, looknew->link.next);
return (looknew);
return looknew;
}
void
@@ -914,20 +915,20 @@ parse_uint_helper(uint32_t *uip, const char *value, uint32_t max,
if (result != ISC_R_SUCCESS) {
printf("invalid %s '%s': %s\n", desc, value,
isc_result_totext(result));
return (result);
return result;
}
*uip = n;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
isc_result_t
parse_uint(uint32_t *uip, const char *value, uint32_t max, const char *desc) {
return (parse_uint_helper(uip, value, max, desc, 10));
return parse_uint_helper(uip, value, max, desc, 10);
}
isc_result_t
parse_xint(uint32_t *uip, const char *value, uint32_t max, const char *desc) {
return (parse_uint_helper(uip, value, max, desc, 0));
return parse_uint_helper(uip, value, max, desc, 0);
}
static uint32_t
@@ -940,7 +941,7 @@ parse_bits(char *arg, const char *desc, uint32_t max) {
fatal("couldn't parse digest bits");
}
tmp = (tmp + 7) & ~0x7U;
return (tmp);
return tmp;
}
isc_result_t
@@ -1018,7 +1019,7 @@ done:
sa->length = prefix_length;
*sap = sa;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -1094,7 +1095,7 @@ read_confkey(void) {
isc_result_t result;
if (!isc_file_exists(keyfile)) {
return (ISC_R_FILENOTFOUND);
return ISC_R_FILENOTFOUND;
}
result = cfg_parser_create(mctx, NULL, &pctx);
@@ -1135,7 +1136,7 @@ cleanup:
cfg_parser_destroy(&pctx);
}
return (result);
return result;
}
void
@@ -1205,7 +1206,7 @@ make_searchlist_entry(char *domain) {
strlcpy(search->origin, domain, MXNAME);
search->origin[MXNAME - 1] = 0;
ISC_LINK_INIT(search, link);
return (search);
return search;
}
static void
@@ -1549,13 +1550,13 @@ check_if_queries_done(dig_lookup_t *l, dig_query_t *except_q) {
if (!q->started || isc_refcount_current(&q->references) > 1) {
if (!q->canceled && q != except_q) {
debug("there is a pending query %p", q);
return (false);
return false;
}
}
q = ISC_LIST_NEXT(q, link);
}
return (true);
return true;
}
static void
@@ -1865,7 +1866,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
result = dns_message_findtype(name, dns_rdatatype_soa,
0, &rdataset);
if (result == ISC_R_SUCCESS) {
return (0);
return 0;
}
}
rdataset = NULL;
@@ -1968,7 +1969,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
if (lookup == NULL && section == DNS_SECTION_ANSWER &&
(query->lookup->trace || query->lookup->ns_search_only))
{
return (followup_lookup(msg, query, DNS_SECTION_AUTHORITY));
return followup_lookup(msg, query, DNS_SECTION_AUTHORITY);
}
/*
@@ -2000,7 +2001,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) {
link);
}
return (numLookups);
return numLookups;
}
/*%
@@ -2027,7 +2028,7 @@ next_origin(dig_lookup_t *oldlookup) {
* We're not using a search list, so don't even think
* about finding the next entry.
*/
return (false);
return false;
}
/*
@@ -2039,14 +2040,14 @@ next_origin(dig_lookup_t *oldlookup) {
(dns_name_isabsolute(name) ||
(int)dns_name_countlabels(name) > ndots))
{
return (false);
return false;
}
if (oldlookup->origin == NULL && !oldlookup->need_search) {
/*
* Then we just did rootorg; there's nothing left.
*/
return (false);
return false;
}
if (oldlookup->origin == NULL && oldlookup->need_search) {
newlookup = requeue_lookup(oldlookup, true);
@@ -2055,13 +2056,13 @@ next_origin(dig_lookup_t *oldlookup) {
} else {
search = ISC_LIST_NEXT(oldlookup->origin, link);
if (search == NULL && oldlookup->done_as_is) {
return (false);
return false;
}
newlookup = requeue_lookup(oldlookup, true);
newlookup->origin = search;
}
cancel_lookup(oldlookup);
return (true);
return true;
}
/*%
@@ -2164,7 +2165,7 @@ _new_query(dig_lookup_t *lookup, char *servname, char *userarg,
ISC_LINK_INIT(query, link);
query->magic = DIG_QUERY_MAGIC;
return (query);
return query;
}
/*%
@@ -2298,7 +2299,7 @@ setup_lookup(dig_lookup_t *lookup) {
dns_message_puttempname(lookup->sendmsg,
&lookup->oname);
if (result == DNS_R_NAMETOOLONG) {
return (false);
return false;
}
fatal("'%s' is not in legal name syntax (%s)",
lookup->textname,
@@ -2325,7 +2326,7 @@ setup_lookup(dig_lookup_t *lookup) {
isc_result_totext(result));
#if TARGET_OS_IPHONE
clear_current_lookup();
return (false);
return false;
#else /* if TARGET_OS_IPHONE */
cleanup_openssl_refs();
digexit();
@@ -2658,7 +2659,7 @@ setup_lookup(dig_lookup_t *lookup) {
ISC_LIST_ENQUEUE(lookup->q, query, link);
}
return (true);
return true;
}
/*%
@@ -2785,6 +2786,12 @@ _cancel_lookup(dig_lookup_t *lookup, const char *file, unsigned int line) {
check_if_done();
}
static inline const char *
get_tls_sni_hostname(dig_query_t *query) {
return query->lookup->tls_hostname_set ? query->lookup->tls_hostname
: query->userarg;
}
static isc_tlsctx_t *
get_create_tls_context(dig_query_t *query, const bool is_https,
isc_tlsctx_client_session_cache_t **psess_cache) {
@@ -2803,7 +2810,7 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
if (query->lookup->tls_key_file_set != query->lookup->tls_cert_file_set)
{
return (NULL);
return NULL;
}
isc_sockaddr_format(&query->sockaddr, tlsctxname, sizeof(tlsctxname));
@@ -2831,10 +2838,7 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
}
if (store != NULL) {
const char *hostname =
query->lookup->tls_hostname_set
? query->lookup->tls_hostname
: query->userarg;
const char *hostname = get_tls_sni_hostname(query);
/*
* According to RFC 8310, Subject field MUST NOT be
* inspected when verifying hostname for DoT. Only
@@ -2882,7 +2886,7 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
INSIST(*psess_cache == NULL);
*psess_cache = sess_cache;
}
return (ctx);
return ctx;
}
if (psess_cache != NULL) {
@@ -2891,7 +2895,7 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
}
INSIST(!query->lookup->tls_ca_set || found_store != NULL);
return (found_ctx);
return found_ctx;
failure:
if (ctx != NULL) {
isc_tlsctx_free(&ctx);
@@ -2906,7 +2910,7 @@ failure:
if (store != NULL && store != found_store) {
isc_tls_cert_store_free(&store);
}
return (NULL);
return NULL;
}
static void
@@ -3048,7 +3052,8 @@ start_tcp(dig_query_t *query) {
}
isc_nm_streamdnsconnect(netmgr, &localaddr, &query->sockaddr,
tcp_connected, connectquery,
local_timeout, tlsctx, sess_cache,
local_timeout, tlsctx,
get_tls_sni_hostname(query), sess_cache,
proxy_type, ppi);
#if HAVE_LIBNGHTTP2
} else if (query->lookup->https_mode) {
@@ -3068,14 +3073,15 @@ start_tcp(dig_query_t *query) {
isc_nm_httpconnect(netmgr, &localaddr, &query->sockaddr, uri,
!query->lookup->https_get, tcp_connected,
connectquery, tlsctx, sess_cache,
connectquery, tlsctx,
get_tls_sni_hostname(query), sess_cache,
local_timeout, proxy_type, ppi);
#endif
} else {
isc_nm_streamdnsconnect(netmgr, &localaddr, &query->sockaddr,
tcp_connected, connectquery,
local_timeout, NULL, NULL, proxy_type,
ppi);
local_timeout, NULL, NULL, NULL,
proxy_type, ppi);
}
return;
@@ -3231,7 +3237,7 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
start_udp(next);
check_if_done();
} else {
dighost_error("no servers could be reached\n");
dighost_error("no servers could be reached");
clear_current_lookup();
}
@@ -3288,6 +3294,10 @@ start_udp(dig_query_t *query) {
return;
}
if (!port_set) {
port = 53;
}
result = get_address(query->servname, port, &query->sockaddr);
if (result != ISC_R_SUCCESS) {
/* This servname doesn't have an address. */
@@ -3356,12 +3366,12 @@ try_next_server(dig_lookup_t *lookup) {
current_query = lookup->current_query;
if (current_query == NULL || !ISC_LINK_LINKED(current_query, link)) {
return (false);
return false;
}
next_query = ISC_LIST_NEXT(current_query, link);
if (next_query == NULL) {
return (false);
return false;
}
debug("trying next server...");
@@ -3372,7 +3382,7 @@ try_next_server(dig_lookup_t *lookup) {
start_udp(next_query);
}
return (true);
return true;
}
static void
@@ -3423,10 +3433,10 @@ force_next(dig_query_t *query) {
isc_netaddr_fromsockaddr(&netaddr, &query->sockaddr);
isc_netaddr_format(&netaddr, buf, sizeof(buf));
dighost_error("no response from %s\n", buf);
dighost_error("no response from %s", buf);
} else {
printf("%s", l->cmdline);
dighost_error("no servers could be reached\n");
dighost_error("no servers could be reached");
}
if (exitcode < 9) {
@@ -3650,7 +3660,7 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
start_tcp(next);
check_if_done();
} else {
dighost_error("no servers could be reached\n");
dighost_error("no servers could be reached");
clear_current_lookup();
}
@@ -3711,7 +3721,7 @@ check_for_more_data(dig_lookup_t *lookup, dig_query_t *query,
result = dns_message_firstname(msg, DNS_SECTION_ANSWER);
if (result != ISC_R_SUCCESS) {
puts("; Transfer failed.");
return (true);
return true;
}
do {
dns_name_t *name;
@@ -3737,7 +3747,7 @@ check_for_more_data(dig_lookup_t *lookup, dig_query_t *query,
{
puts("; Transfer failed. "
"Didn't start with SOA answer.");
return (true);
return true;
}
if ((!query->second_rr_rcvd) &&
(rdata.type != dns_rdatatype_soa))
@@ -3817,10 +3827,10 @@ check_for_more_data(dig_lookup_t *lookup, dig_query_t *query,
isc_nmhandle_detach(&query->readhandle);
launch_next_query(query);
query_detach(&query);
return (false);
return false;
doexit:
dighost_received(len, peer, query);
return (true);
return true;
}
static void
@@ -3914,7 +3924,7 @@ process_opt(dig_lookup_t *l, dns_message_t *msg) {
static int
ednsvers(dns_rdataset_t *opt) {
return ((opt->ttl >> 16) & 0xff);
return (opt->ttl >> 16) & 0xff;
}
/*%
@@ -4103,7 +4113,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
* and cancel the lookup.
*/
printf("%s", l->cmdline);
dighost_error("no servers could be reached\n");
dighost_error("no servers could be reached");
if (exitcode < 9) {
exitcode = 9;
@@ -4128,8 +4138,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
if (l->tcp_mode) {
bool fail = true;
if (result == ISC_R_SUCCESS) {
if ((!query->first_soa_rcvd || query->warn_id))
{
if (!query->first_soa_rcvd || query->warn_id) {
dighost_warning("%s: ID mismatch: "
"expected ID %u, got "
"%u",
@@ -4237,7 +4246,15 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
goto keep_query;
}
if (msg->counts[DNS_SECTION_QUESTION] != 0) {
if (msg->counts[DNS_SECTION_QUESTION] == 0) {
if (l->doing_xfr) {
if (query->msg_count == 0) {
dighost_warning("missing question section");
}
} else if (!l->header_only && msg->opcode == dns_opcode_query) {
dighost_warning("missing question section");
}
} else {
match = true;
for (result = dns_message_firstname(msg, DNS_SECTION_QUESTION);
result == ISC_R_SUCCESS && match;
@@ -4577,12 +4594,12 @@ get_address(char *host, in_port_t myport, isc_sockaddr_t *sockaddr) {
result = isc_getaddresses(host, myport, sockaddr, 1, &count);
isc_loopmgr_nonblocking(loopmgr);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
INSIST(count == 1);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
int
@@ -4604,7 +4621,7 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) {
fatal("couldn't get address for '%s': %s", host,
isc_result_totext(result));
}
return (0);
return 0;
}
for (i = 0; i < count; i++) {
@@ -4614,7 +4631,7 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) {
ISC_LIST_APPEND(lookup->my_server_list, srv, link);
}
return (count);
return count;
}
/*%
@@ -4796,7 +4813,7 @@ idn_filter(isc_buffer_t *buffer, unsigned int start) {
}
resetlocale(LC_ALL);
if (res != IDN2_OK) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -4804,14 +4821,14 @@ idn_filter(isc_buffer_t *buffer, unsigned int start) {
*/
dstlen = strlen(dst);
if (isc_buffer_length(buffer) < start + dstlen) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
isc_buffer_subtract(buffer, srclen);
memmove(isc_buffer_used(buffer), dst, dstlen);
isc_buffer_add(buffer, dstlen);
idn2_free(dst);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -4877,8 +4894,8 @@ dig_idnsetup(dig_lookup_t *lookup, bool active) {
bool
dig_lookup_is_tls(const dig_lookup_t *lookup) {
if (lookup->tls_mode || (lookup->tls_ca_set && !lookup->https_mode)) {
return (true);
return true;
}
return (false);
return false;
}
+17 -16
View File
@@ -96,7 +96,7 @@ rcode_totext(dns_rcode_t rcode) {
} else {
totext.consttext = rcodetext[rcode];
}
return (totext.deconsttext);
return totext.deconsttext;
}
noreturn static void
@@ -183,6 +183,7 @@ retry:
result = dns_rdata_totext(rdata, NULL, b);
if (result == ISC_R_NOSPACE) {
isc_buffer_free(&b);
INSIST(bufsize <= (UINT_MAX / 2));
bufsize *= 2;
goto retry;
}
@@ -221,9 +222,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
result = dns_message_firstname(msg, sectionid);
if (result == ISC_R_NOMORE) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
for (;;) {
@@ -261,7 +262,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
print_name, false,
no_rdata, &target);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
#ifdef USEINITALWS
if (first) {
@@ -316,11 +317,11 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
if (result == ISC_R_NOMORE) {
break;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -340,12 +341,12 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
result = dns_rdataset_totext(rdataset, owner, false, false, &target);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
isc_buffer_usedregion(&target, &r);
printf("%.*s", (int)r.length, (char *)r.base);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -422,7 +423,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
: query->lookup->textname,
msg->rcode, rcode_totext(msg->rcode));
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
@@ -516,7 +517,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION",
true, query);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
@@ -526,7 +527,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER",
!short_form, query);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
@@ -537,7 +538,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
true, query);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
@@ -547,7 +548,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printsection(msg, DNS_SECTION_ADDITIONAL, "ADDITIONAL",
true, query);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
if ((tsig != NULL) && !short_form) {
@@ -555,7 +556,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
result = printrdata(msg, tsig, tsigname, "PSEUDOSECTION TSIG",
true);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
if (!short_form) {
@@ -573,7 +574,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
printf("%s has no %s record\n", namestr, typestr);
}
seen_error = force_error;
return (result);
return result;
}
static const char *optstring = "46aAc:dilnm:p:rst:vVwCDN:R:TUW:";
@@ -916,5 +917,5 @@ main(int argc, char **argv) {
cancel_all();
destroy_libs();
return ((seen_error == 0) ? 0 : 1);
return (seen_error == 0) ? 0 : 1;
}
+17 -16
View File
@@ -128,7 +128,7 @@ rcode_totext(dns_rcode_t rcode) {
} else {
totext.consttext = rcodetext[rcode];
}
return (totext.deconsttext);
return totext.deconsttext;
}
static void
@@ -189,6 +189,7 @@ printrdata(dns_rdata_t *rdata) {
check_result(result, "dns_rdata_totext");
}
isc_buffer_free(&b);
INSIST(size <= (UINT_MAX / 2));
size *= 2;
}
}
@@ -209,9 +210,9 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
result = dns_message_firstname(msg, section);
if (result == ISC_R_NOMORE) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
for (;;) {
name = NULL;
@@ -255,10 +256,10 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
if (result == ISC_R_NOMORE) {
break;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -293,9 +294,9 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
result = dns_message_firstname(msg, section);
if (result == ISC_R_NOMORE) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
for (;;) {
name = NULL;
@@ -337,10 +338,10 @@ detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
if (result == ISC_R_NOMORE) {
break;
} else if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -423,7 +424,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
/* the lookup failed */
print_error |= 1;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
@@ -477,7 +478,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
printsection(query, msg, headers, DNS_SECTION_AUTHORITY);
printsection(query, msg, headers, DNS_SECTION_ADDITIONAL);
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -536,10 +537,10 @@ testtype(char *typetext) {
tr.length = strlen(typetext);
result = dns_rdatatype_fromtext(&rdtype, &tr);
if (result == ISC_R_SUCCESS) {
return (true);
return true;
} else {
printf("unknown query type: %s\n", typetext);
return (false);
return false;
}
}
@@ -553,10 +554,10 @@ testclass(char *typetext) {
tr.length = strlen(typetext);
result = dns_rdataclass_fromtext(&rdclass, &tr);
if (result == ISC_R_SUCCESS) {
return (true);
return true;
} else {
printf("unknown query class: %s\n", typetext);
return (false);
return false;
}
}
@@ -974,5 +975,5 @@ main(int argc, char **argv) {
cancel_all();
destroy_libs();
return (query_error | print_error);
return query_error | print_error;
}
+3 -3
View File
@@ -48,10 +48,10 @@ readline(const char *prompt) {
line = fgets(buf, RL_MAXCMD, stdin);
if (line == NULL) {
free(buf);
return (NULL);
return NULL;
}
return (buf);
};
return buf;
}
#define add_history(line)
+1
View File
@@ -2,6 +2,7 @@ dnssec-cds
dnssec-dsfromkey
dnssec-keyfromlabel
dnssec-keygen
dnssec-ksr
dnssec-makekeyset
dnssec-revoke
dnssec-settime
+3 -4
View File
@@ -2,6 +2,7 @@ include $(top_srcdir)/Makefile.top
AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBDNS_CFLAGS)
AM_CPPFLAGS += \
@@ -12,6 +13,7 @@ noinst_LTLIBRARIES = libdnssectool.la
LDADD += \
libdnssectool.la \
$(LIBISC_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBDNS_LIBS) \
$(OPENSSL_LIBS)
@@ -21,6 +23,7 @@ bin_PROGRAMS = \
dnssec-importkey \
dnssec-keyfromlabel \
dnssec-keygen \
dnssec-ksr \
dnssec-revoke \
dnssec-settime \
dnssec-signzone \
@@ -32,20 +35,16 @@ libdnssectool_la_SOURCES = \
dnssec_keygen_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(OPENSSL_CFLAGS)
dnssec_keygen_LDADD = \
$(LDADD) \
$(LIBISCCFG_LIBS) \
$(OPENSSL_LIBS)
dnssec_signzone_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(OPENSSL_CFLAGS)
dnssec_signzone_LDADD = \
$(LDADD) \
$(LIBISCCFG_LIBS) \
$(OPENSSL_LIBS)
+18 -18
View File
@@ -395,7 +395,7 @@ formatset(dns_rdataset_t *rdataset) {
}
isc_buffer_putuint8(buf, 0);
return (buf);
return buf;
}
static void
@@ -505,14 +505,14 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
vbprintf(1, "found matching %s %d %d %d\n",
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
ds.digest_type);
return (true);
return true;
} else if (strictness == TIGHT) {
vbprintf(0,
"key does not match %s %d %d %d "
"when it looks like it should\n",
c ? "CDS" : "DS", ds.key_tag, ds.algorithm,
ds.digest_type);
return (false);
return false;
}
}
@@ -521,7 +521,7 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) {
ki->rdata.type == dns_rdatatype_cdnskey ? "CDNSKEY" : "DNSKEY",
ki->tag, ki->algo);
return (false);
return false;
}
/*
@@ -575,7 +575,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
}
}
return (keytable);
return keytable;
}
static void
@@ -681,7 +681,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
}
}
return (algo);
return algo;
}
/*
@@ -698,7 +698,7 @@ signed_loose(dns_secalg_t *algo) {
}
}
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
return (ok);
return ok;
}
/*
@@ -740,7 +740,7 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
}
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
return (all_ok);
return all_ok;
}
/*
@@ -761,10 +761,10 @@ ds_from_cds(isc_buffer_t *buf, dns_rdata_t *rds, dns_dsdigest_t dt,
ds.common.rdtype = dns_rdatatype_ds;
if (ds.digest_type != dt) {
return (ISC_R_IGNORE);
return ISC_R_IGNORE;
}
return (dns_rdata_fromstruct(rds, rdclass, dns_rdatatype_ds, &ds, buf));
return dns_rdata_fromstruct(rds, rdclass, dns_rdatatype_ds, &ds, buf);
}
static isc_result_t
@@ -777,7 +777,7 @@ ds_from_cdnskey(isc_buffer_t *buf, dns_rdata_t *ds, dns_dsdigest_t dt,
isc_buffer_availableregion(buf, &r);
if (r.length < DNS_DS_BUFFERSIZE) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
result = dns_ds_buildrdata(name, cdnskey, dt, r.base, ds);
@@ -785,7 +785,7 @@ ds_from_cdnskey(isc_buffer_t *buf, dns_rdata_t *ds, dns_dsdigest_t dt,
isc_buffer_add(buf, DNS_DS_BUFFERSIZE);
}
return (result);
return result;
}
static isc_result_t
@@ -816,14 +816,14 @@ append_new_ds_set(ds_maker_func_t *ds_from_rdata, isc_buffer_t *buf,
continue;
case ISC_R_NOSPACE:
isc_mem_put(mctx, ds, sizeof(*ds));
return (result);
return result;
default:
isc_mem_put(mctx, ds, sizeof(*ds));
check_result(result, "ds_from_rdata()");
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -868,8 +868,8 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl,
static int
rdata_cmp(const void *rdata1, const void *rdata2) {
return (dns_rdata_compare((const dns_rdata_t *)rdata1,
(const dns_rdata_t *)rdata2));
return dns_rdata_compare((const dns_rdata_t *)rdata1,
(const dns_rdata_t *)rdata2);
}
/*
@@ -950,7 +950,7 @@ consistent_digests(dns_rdataset_t *dsset) {
isc_mem_cput(mctx, ds, n, sizeof(dns_rdata_ds_t));
isc_mem_cput(mctx, arrdata, n, sizeof(dns_rdata_t));
return (match);
return match;
}
static void
@@ -1355,5 +1355,5 @@ cleanup:
print_mem_stats = true;
cleanup();
return (0);
return 0;
}
+16 -11
View File
@@ -54,6 +54,7 @@ static dns_name_t *name = NULL;
static isc_mem_t *mctx = NULL;
static uint32_t ttl;
static bool emitttl = false;
static unsigned int split_width = 0;
static isc_result_t
initname(char *setname) {
@@ -65,7 +66,7 @@ initname(char *setname) {
isc_buffer_init(&buf, setname, strlen(setname));
isc_buffer_add(&buf, strlen(setname));
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
return (result);
return result;
}
static void
@@ -137,7 +138,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
if (db != NULL) {
dns_db_detach(&db);
}
return (result);
return result;
}
static isc_result_t
@@ -152,7 +153,7 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
if (dirname != NULL) {
/* allow room for a trailing slash */
if (strlen(dirname) >= isc_buffer_availablelength(&buf)) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
isc_buffer_putstr(&buf, dirname);
if (dirname[strlen(dirname) - 1] != '/') {
@@ -161,18 +162,18 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
}
if (isc_buffer_availablelength(&buf) < 7) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
isc_buffer_putstr(&buf, "keyset-");
result = dns_name_tofilenametext(name, false, &buf);
check_result(result, "dns_name_tofilenametext()");
if (isc_buffer_availablelength(&buf) == 0) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
isc_buffer_putuint8(&buf, 0);
return (loadset(filename, rdataset));
return loadset(filename, rdataset);
}
static void
@@ -279,8 +280,8 @@ emit(dns_dsdigest_t dt, bool showall, bool cds, dns_rdata_t *rdata) {
fatal("can't print name");
}
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, 0, "",
&textb);
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, split_width,
"", &textb);
if (result != ISC_R_SUCCESS) {
fatal("can't print rdata");
@@ -347,6 +348,7 @@ usage(void) {
" -f zonefile: read keys from a zone file\n"
" -h: print help information\n"
" -K directory: where to find key or keyset files\n"
" -w split base64 rdata text into chunks\n"
" -s: read keys from keyset-<dnsname> file\n"
" -T: TTL of output records (omitted by default)\n"
" -v level: verbosity\n"
@@ -380,7 +382,7 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:hV"
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:whV"
while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
switch (ch) {
case '1':
@@ -432,6 +434,9 @@ main(int argc, char **argv) {
fatal("-v must be followed by a number");
}
break;
case 'w':
split_width = UINT_MAX;
break;
case 'F':
/* Reserved for FIPS mode */
FALLTHROUGH;
@@ -553,8 +558,8 @@ main(int argc, char **argv) {
fflush(stdout);
if (ferror(stdout)) {
fprintf(stderr, "write error\n");
return (1);
return 1;
} else {
return (0);
return 0;
}
}
+4 -4
View File
@@ -68,7 +68,7 @@ initname(char *setname) {
isc_buffer_init(&buf, setname, strlen(setname));
isc_buffer_add(&buf, strlen(setname));
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
return (result);
return result;
}
static void
@@ -141,7 +141,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
if (db != NULL) {
dns_db_detach(&db);
}
return (result);
return result;
}
static void
@@ -468,8 +468,8 @@ main(int argc, char **argv) {
fflush(stdout);
if (ferror(stdout)) {
fprintf(stderr, "write error\n");
return (1);
return 1;
} else {
return (0);
return 0;
}
}
+21 -3
View File
@@ -43,6 +43,8 @@
const char *program = "dnssec-keyfromlabel";
static uint16_t tag_min = 0, tag_max = 0xffff;
noreturn static void
usage(void);
@@ -70,6 +72,7 @@ usage(void) {
"key files\n");
fprintf(stderr, " -k: generate a TYPE=KEY key\n");
fprintf(stderr, " -L ttl: default key TTL\n");
fprintf(stderr, " -M <min>:<max>: allowed Key ID range\n");
fprintf(stderr, " -n nametype: ZONE | HOST | ENTITY | USER | "
"OTHER\n");
fprintf(stderr, " (DNSKEY generation defaults to ZONE\n");
@@ -160,7 +163,7 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
#define CMDLINE_FLAGS "3A:a:Cc:D:E:Ff:GhI:i:kK:L:l:n:P:p:R:S:t:v:Vy"
#define CMDLINE_FLAGS "3A:a:Cc:D:E:Ff:GhI:i:kK:L:l:M:n:P:p:R:S:t:v:Vy"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
case '3':
@@ -207,6 +210,20 @@ main(int argc, char **argv) {
case 'l':
label = isc_mem_strdup(mctx, isc_commandline_argument);
break;
case 'M': {
unsigned long ul;
tag_min = ul = strtoul(isc_commandline_argument, &endp,
10);
if (*endp != ':' || ul > 0xffff) {
fatal("-M range invalid");
}
tag_max = ul = strtoul(endp + 1, &endp, 10);
if (*endp != '\0' || ul > 0xffff || tag_max <= tag_min)
{
fatal("-M range invalid");
}
break;
}
case 'n':
nametype = isc_commandline_argument;
break;
@@ -686,7 +703,8 @@ main(int argc, char **argv) {
* is a risk of ID collision due to this key or another key
* being revoked.
*/
if (key_collision(key, name, directory, mctx, &exact)) {
if (key_collision(key, name, directory, mctx, tag_min, tag_max, &exact))
{
isc_buffer_clear(&buf);
ret = dst_key_buildfilename(key, 0, directory, &buf);
if (ret != ISC_R_SUCCESS) {
@@ -743,5 +761,5 @@ main(int argc, char **argv) {
free(freeit);
}
return (0);
return 0;
}
+13 -1
View File
@@ -21,7 +21,7 @@ dnssec-keyfromlabel - DNSSEC key generation tool
Synopsis
~~~~~~~~
:program:`dnssec-keyfromlabel` {**-l** label} [**-3**] [**-a** algorithm] [**-A** date/offset] [**-c** class] [**-D** date/offset] [**-D** sync date/offset] [**-E** engine] [**-f** flag] [**-G**] [**-I** date/offset] [**-i** interval] [**-k**] [**-K** directory] [**-L** ttl] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-R** date/offset] [**-S** key] [**-t** type] [**-v** level] [**-V**] [**-y**] {name}
:program:`dnssec-keyfromlabel` {**-l** label} [**-3**] [**-a** algorithm] [**-A** date/offset] [**-c** class] [**-D** date/offset] [**-D** sync date/offset] [**-E** engine] [**-f** flag] [**-G**] [**-I** date/offset] [**-i** interval] [**-k**] [**-K** directory] [**-L** ttl] [**-M** tag_min:tag_max] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-R** date/offset] [**-S** key] [**-t** type] [**-v** level] [**-V**] [**-y**] {name}
Description
~~~~~~~~~~~
@@ -133,6 +133,18 @@ Options
place, in which case the existing TTL would take precedence. Setting
the default TTL to ``0`` or ``none`` removes it.
.. option:: -M tag_min:tag_max
This option sets the range of key tag values
that ``dnssec-keyfromlabel`` will accept. If the key tag of the new
key or the key tag of the revoked version of the new key is
outside this range, the new key will be rejected. This is
designed to be used when generating keys in a multi-signer
scenario, where each operator is given a range of key tags to
prevent collisions among different operators. The valid
values for ``tag_min`` and ``tag_max`` are [0..65535]. The
default allows all key tag values to be accepted.
.. option:: -p protocol
This option sets the protocol value for the key. The protocol is a number between
+57 -117
View File
@@ -56,10 +56,6 @@
#include <dst/dst.h>
#include <isccfg/cfg.h>
#include <isccfg/grammar.h>
#include <isccfg/kaspconf.h>
#include <isccfg/namedconf.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
#include <openssl/err.h>
#include <openssl/provider.h>
@@ -67,9 +63,6 @@
#include "dnssectool.h"
#define MAX_RSA 4096 /* should be long enough... */
#define MAX_DH 4096 /* should be long enough... */
const char *program = "dnssec-keygen";
/*
@@ -98,13 +91,16 @@ struct keygen_ctx {
char *type;
int protocol;
int size;
uint16_t tag_min;
uint16_t tag_max;
int signatory;
dns_rdataclass_t rdclass;
int options;
int dbits;
dns_ttl_t ttl;
uint16_t kskflag;
uint16_t revflag;
bool wantzsk;
bool wantksk;
bool wantrev;
dns_secalg_t alg;
/* timing data */
int prepub;
@@ -184,9 +180,10 @@ usage(void) {
fprintf(stderr, " -d <digest bits> (0 => max, default)\n");
fprintf(stderr, " -E <engine>:\n");
fprintf(stderr, " name of an OpenSSL engine to use\n");
fprintf(stderr, " -f <keyflag>: KSK | REVOKE\n");
fprintf(stderr, " -f <keyflag>: ZSK | KSK | REVOKE\n");
fprintf(stderr, " -F: FIPS mode\n");
fprintf(stderr, " -L <ttl>: default key TTL\n");
fprintf(stderr, " -M <min>:<max>: allowed Key ID range\n");
fprintf(stderr, " -p <protocol>: (default: 3 [dnssec])\n");
fprintf(stderr, " -s <strength>: strength value this key signs DNS "
"records with (default: 0)\n");
@@ -197,7 +194,7 @@ usage(void) {
"(default: AUTHCONF)\n");
fprintf(stderr, " -h: print usage and exit\n");
fprintf(stderr, " -m <memory debugging mode>:\n");
fprintf(stderr, " usage | trace | record | size | mctx\n");
fprintf(stderr, " usage | trace | record\n");
fprintf(stderr, " -v <level>: set verbosity level (0 - 10)\n");
fprintf(stderr, " -V: print version information\n");
fprintf(stderr, "Timing options:\n");
@@ -254,90 +251,6 @@ progress(int p) {
(void)fflush(stderr);
}
static void
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, const char *name,
const char *keydir, const char *engine, dns_kasp_t **kaspp) {
isc_result_t result = ISC_R_NOTFOUND;
const cfg_listelt_t *element;
const cfg_obj_t *kasps = NULL;
dns_kasp_t *kasp = NULL, *kasp_next;
dns_kasplist_t kasplist;
const cfg_obj_t *keystores = NULL;
dns_keystore_t *ks = NULL, *ks_next;
dns_keystorelist_t kslist;
ISC_LIST_INIT(kasplist);
ISC_LIST_INIT(kslist);
(void)cfg_map_get(config, "key-store", &keystores);
for (element = cfg_list_first(keystores); element != NULL;
element = cfg_list_next(element))
{
cfg_obj_t *kconfig = cfg_listelt_value(element);
ks = NULL;
result = cfg_keystore_fromconfig(kconfig, mctx, lctx, engine,
&kslist, NULL);
if (result != ISC_R_SUCCESS) {
fatal("failed to configure key-store '%s': %s",
cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
isc_result_totext(result));
}
}
/* Default key-directory key store. */
ks = NULL;
(void)cfg_keystore_fromconfig(NULL, mctx, lctx, engine, &kslist, &ks);
INSIST(ks != NULL);
if (keydir != NULL) {
/* '-K keydir' takes priority */
dns_keystore_setdirectory(ks, keydir);
}
dns_keystore_detach(&ks);
(void)cfg_map_get(config, "dnssec-policy", &kasps);
for (element = cfg_list_first(kasps); element != NULL;
element = cfg_list_next(element))
{
cfg_obj_t *kconfig = cfg_listelt_value(element);
kasp = NULL;
if (strcmp(cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
name) != 0)
{
continue;
}
result = cfg_kasp_fromconfig(kconfig, NULL, true, mctx, lctx,
&kslist, &kasplist, &kasp);
if (result != ISC_R_SUCCESS) {
fatal("failed to configure dnssec-policy '%s': %s",
cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
isc_result_totext(result));
}
INSIST(kasp != NULL);
dns_kasp_freeze(kasp);
break;
}
*kaspp = kasp;
/*
* Cleanup kasp list.
*/
for (kasp = ISC_LIST_HEAD(kasplist); kasp != NULL; kasp = kasp_next) {
kasp_next = ISC_LIST_NEXT(kasp, link);
ISC_LIST_UNLINK(kasplist, kasp, link);
dns_kasp_detach(&kasp);
}
/*
* Cleanup keystore list.
*/
for (ks = ISC_LIST_HEAD(kslist); ks != NULL; ks = ks_next) {
ks_next = ISC_LIST_NEXT(ks, link);
ISC_LIST_UNLINK(kslist, ks, link);
dns_keystore_detach(&ks);
}
}
static void
keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
char filename[255];
@@ -645,8 +558,12 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
if ((ctx->options & DST_TYPE_KEY) != 0) { /* KEY */
flags |= ctx->signatory;
} else if ((flags & DNS_KEYOWNER_ZONE) != 0) { /* DNSKEY */
flags |= ctx->kskflag;
flags |= ctx->revflag;
if (ctx->ksk || ctx->wantksk) {
flags |= DNS_KEYFLAG_KSK;
}
if (ctx->wantrev) {
flags |= DNS_KEYFLAG_REVOKE;
}
}
if (ctx->protocol == -1) {
@@ -769,7 +686,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
}
if (ctx->setrev) {
if (ctx->kskflag == 0) {
if (!ctx->wantksk) {
fprintf(stderr,
"%s: warning: Key is "
"not flagged as a KSK, but -R "
@@ -844,7 +761,9 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
* if there is a risk of ID collision due to this key
* or another key being revoked.
*/
if (key_collision(key, name, ctx->directory, mctx, NULL)) {
if (key_collision(key, name, ctx->directory, mctx, ctx->tag_min,
ctx->tag_max, NULL))
{
conflict = true;
if (null_key) {
dst_key_free(&key);
@@ -954,8 +873,8 @@ main(int argc, char **argv) {
/*
* Process memory debugging argument first.
*/
#define CMDLINE_FLAGS \
"3A:a:b:Cc:D:d:E:Ff:GhI:i:K:k:L:l:m:n:P:p:qR:r:S:s:" \
#define CMDLINE_FLAGS \
"3A:a:b:Cc:D:d:E:Ff:GhI:i:K:k:L:l:M:m:n:P:p:qR:r:S:s:" \
"T:t:v:V"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
@@ -1013,9 +932,11 @@ main(int argc, char **argv) {
case 'f':
c = (unsigned char)(isc_commandline_argument[0]);
if (toupper(c) == 'K') {
ctx.kskflag = DNS_KEYFLAG_KSK;
ctx.wantksk = true;
} else if (toupper(c) == 'Z') {
ctx.wantzsk = true;
} else if (toupper(c) == 'R') {
ctx.revflag = DNS_KEYFLAG_REVOKE;
ctx.wantrev = true;
} else {
fatal("unknown flag '%s'",
isc_commandline_argument);
@@ -1042,6 +963,21 @@ main(int argc, char **argv) {
case 'n':
ctx.nametype = isc_commandline_argument;
break;
case 'M': {
unsigned long ul;
ctx.tag_min = ul = strtoul(isc_commandline_argument,
&endp, 10);
if (*endp != ':' || ul > 0xffff) {
fatal("-M range invalid");
}
ctx.tag_max = ul = strtoul(endp + 1, &endp, 10);
if (*endp != '\0' || ul > 0xffff ||
ctx.tag_max <= ctx.tag_min)
{
fatal("-M range invalid");
}
break;
}
case 'm':
break;
case 'p':
@@ -1289,8 +1225,8 @@ main(int argc, char **argv) {
if (ctx.size != -1) {
fatal("-k and -b cannot be used together");
}
if (ctx.kskflag || ctx.revflag) {
fatal("-k and -f cannot be used together");
if (ctx.wantrev) {
fatal("-k and -fR cannot be used together");
}
if (ctx.options & DST_TYPE_KEY) {
fatal("-k and -T KEY cannot be used together");
@@ -1305,12 +1241,13 @@ main(int argc, char **argv) {
ctx.use_nsec3 = false;
ctx.alg = DST_ALG_ECDSA256;
ctx.size = 0;
ctx.kskflag = DNS_KEYFLAG_KSK;
ctx.ttl = 3600;
ctx.setttl = true;
ctx.ksk = true;
ctx.zsk = true;
ctx.lifetime = 0;
ctx.tag_min = 0;
ctx.tag_max = 0xffff;
keygen(&ctx, mctx, argc, argv);
} else {
@@ -1330,8 +1267,8 @@ main(int argc, char **argv) {
ctx.policy, ctx.configfile);
}
kasp_from_conf(config, mctx, ctx.policy, ctx.directory,
engine, &kasp);
kasp_from_conf(config, mctx, lctx, ctx.policy,
ctx.directory, engine, &kasp);
if (kasp == NULL) {
fatal("failed to load dnssec-policy '%s'",
ctx.policy);
@@ -1345,15 +1282,13 @@ main(int argc, char **argv) {
ctx.ttl = dns_kasp_dnskeyttl(kasp);
ctx.setttl = true;
kaspkey = ISC_LIST_HEAD(dns_kasp_keys(kasp));
while (kaspkey != NULL) {
for (kaspkey = ISC_LIST_HEAD(dns_kasp_keys(kasp));
kaspkey != NULL;
kaspkey = ISC_LIST_NEXT(kaspkey, link))
{
ctx.use_nsec3 = false;
ctx.alg = dns_kasp_key_algorithm(kaspkey);
ctx.size = dns_kasp_key_size(kaspkey);
ctx.kskflag = dns_kasp_key_ksk(kaspkey)
? DNS_KEYFLAG_KSK
: 0;
ctx.ksk = dns_kasp_key_ksk(kaspkey);
ctx.zsk = dns_kasp_key_zsk(kaspkey);
ctx.lifetime = dns_kasp_key_lifetime(kaspkey);
@@ -1361,9 +1296,14 @@ main(int argc, char **argv) {
if (ctx.keystore != NULL) {
check_keystore_options(&ctx);
}
ctx.tag_min = dns_kasp_key_tagmin(kaspkey);
ctx.tag_max = dns_kasp_key_tagmax(kaspkey);
if ((ctx.ksk && !ctx.wantksk && ctx.wantzsk) ||
(ctx.zsk && !ctx.wantzsk && ctx.wantksk))
{
continue;
}
keygen(&ctx, mctx, argc, argv);
kaspkey = ISC_LIST_NEXT(kaspkey, link);
}
dns_kasp_detach(&kasp);
@@ -1393,5 +1333,5 @@ main(int argc, char **argv) {
free(freeit);
}
return (0);
return 0;
}
+21 -2
View File
@@ -21,7 +21,7 @@ dnssec-keygen: DNSSEC key generation tool
Synopsis
~~~~~~~~
:program:`dnssec-keygen` [**-3**] [**-A** date/offset] [**-a** algorithm] [**-b** keysize] [**-C**] [**-c** class] [**-D** date/offset] [**-d** bits] [**-D** sync date/offset] [**-E** engine] [**-f** flag] [**-F**] [**-G**] [**-h**] [**-I** date/offset] [**-i** interval] [**-K** directory] [**-k** policy] [**-L** ttl] [**-l** file] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-q**] [**-R** date/offset] [**-S** key] [**-s** strength] [**-T** rrtype] [**-t** type] [**-V**] [**-v** level] {name}
:program:`dnssec-keygen` [**-3**] [**-A** date/offset] [**-a** algorithm] [**-b** keysize] [**-C**] [**-c** class] [**-D** date/offset] [**-d** bits] [**-D** sync date/offset] [**-E** engine] [**-f** flag] [**-F**] [**-G**] [**-h**] [**-I** date/offset] [**-i** interval] [**-K** directory] [**-k** policy] [**-L** ttl] [**-l** file] [**-n** nametype] [**-M** tag_min:tag_max] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-q**] [**-R** date/offset] [**-S** key] [**-s** strength] [**-T** rrtype] [**-t** type] [**-V**] [**-v** level] {name}
Description
~~~~~~~~~~~
@@ -105,7 +105,13 @@ Options
.. option:: -f flag
This option sets the specified flag in the flag field of the KEY/DNSKEY record.
The only recognized flags are KSK (Key-Signing Key) and REVOKE.
The only recognized flags are ZSK (Zone-Signing Key), KSK (Key-Signing Key)
and REVOKE.
Note that ZSK is not a physical flag in the DNSKEY record, it is merely used
to explicitly tell that you want to create a ZSK. Setting :option:`-f` in
conjunction with :option:`-k` will result in generating keys that only
match the given role set with this option.
.. option:: -F
@@ -152,6 +158,19 @@ Options
This option provides a configuration file that contains a ``dnssec-policy`` statement
(matching the policy set with :option:`-k`).
.. option:: -M tag_min:tag_max
This option sets the range of acceptable key tag values that ``dnssec-keygen``
will produce. If the key tag of the new key or the key tag of
the revoked version of the new key is outside this range,
the new key will be rejected and another new key will be generated.
This is designed to be used when generating keys in a multi-signer
scenario, where each operator is given a range of key tags to
prevent collisions among different operators. The valid values
for ``tag_min`` and ``tag_max`` are [0..65535]. The default allows all
key tag values to be produced. This option is ignored when ``-k policy``
is specified.
.. option:: -n nametype
This option specifies the owner type of the key. The value of ``nametype`` must
File diff suppressed because it is too large Load Diff
+172
View File
@@ -0,0 +1,172 @@
.. Copyright (C) Internet Systems Consortium, Inc. ("ISC")
..
.. SPDX-License-Identifier: MPL-2.0
..
.. This Source Code Form is subject to the terms of the Mozilla Public
.. License, v. 2.0. If a copy of the MPL was not distributed with this
.. file, you can obtain one at https://mozilla.org/MPL/2.0/.
..
.. See the COPYRIGHT file distributed with this work for additional
.. information regarding copyright ownership.
.. highlight: console
.. iscman:: dnssec-ksr
.. program:: dnssec-ksr
.. _man_dnssec-ksr:
dnssec-ksr - Create signed key response (SKR) files for offline KSK setups
--------------------------------------------------------------------------
Synopsis
~~~~~~~~
:program:`dnssec-ksr` [**-E** engine] [**-e** date/offset] [**-F**] [**-f** file] [**-h**] [**-i** date/offset] [**-K** directory] [**-k** policy] [**-l** file] [**-o**] [**-V**] [**-v** level] {command} {zone}
Description
~~~~~~~~~~~
The :program:`dnssec-ksr` can be used to issue several commands that are needed
to generate presigned RRsets for a zone where the private key file of the Key
Signing Key (KSK) is typically offline. This requires Zone Signing Keys
(ZSKs) to be pregenerated, and the DNSKEY, CDNSKEY, and CDS RRsets to be
already signed in advance.
The latter is done by creating Key Signing Requests (KSRs) that can be imported
to the environment where the KSK is available. Once there, this program can
create Signed Key Responses (SKRs) that can be loaded by an authoritative DNS
server.
Options
~~~~~~~
.. option:: -E engine
This option specifies the cryptographic hardware to use, when applicable.
When BIND 9 is built with OpenSSL, this needs to be set to the OpenSSL
engine identifier that drives the cryptographic accelerator or
hardware service module (usually ``pkcs11``).
.. option:: -e date/offset
This option sets the end date for which keys or SKRs need to be generated
(depending on the command).
.. option:: -F
This options turns on FIPS (US Federal Information Processing Standards)
mode if the underlying crytographic library supports running in FIPS
mode.
.. option:: -f
This option sets the SKR file to be signed when issuing a ``sign`` command.
.. option:: -h
This option prints a short summary of the options and arguments to
:program:`dnssec-ksr`.
.. option:: -i date/offset
This option sets the start date for which keys or SKRs need to be generated
(depending on the command).
.. option:: -K directory
This option sets the directory in which the key files are to be read or
written (depending on the command).
.. option:: -k policy
This option sets the specific ``dnssec-policy`` for which keys need to
be generated, or signed.
.. option:: -l file
This option provides a configuration file that contains a ``dnssec-policy``
statement (matching the policy set with :option:`-k`).
.. option:: -o
Normally when pregenerating keys, ZSKs are created. When this option is
set, create KSKs instead.
.. option:: -V
This option prints version information.
.. option:: -v level
This option sets the debugging level. Level 1 is intended to be usefully
verbose for general users; higher levels are intended for developers.
``command``
The KSR command to be executed. See below for the available commands.
``zone``
The name of the zone for which the KSR command is being executed.
Commands
~~~~~~~~
.. option:: keygen
Pregenerate a number of keys, given a DNSSEC policy and an interval. The
number of generated keys depends on the interval and the key lifetime.
.. option:: request
Create a Key Signing Request (KSR), given a DNSSEC policy and an interval.
This will generate a file with a number of key bundles, where each bundle
contains the currently published ZSKs (according to the timing metadata).
.. option:: sign
Sign a Key Signing Request (KSR), given a DNSSEC policy and an interval,
creating a Signed Key Response (SKR). This will add the corresponding DNSKEY,
CDS, and CDNSKEY records for the KSK that is being used for signing.
Exit Status
~~~~~~~~~~~
The :program:`dnssec-ksr` command exits 0 on success, or non-zero if an error
occurred.
Examples
~~~~~~~~
When you need to generate ZSKs for the zone "example.com" for the next year,
given a ``dnssec-policy`` named "mypolicy":
::
dnssec-ksr -i now -e +1y -k mypolicy -l named.conf keygen example.com
Creating a KSR for the same zone and period can be done with:
::
dnssec-ksr -i now -e +1y -k mypolicy -l named.conf request example.com > ksr.txt
Typically you would now transfer the KSR to the system that has access to
the KSK.
Signing the KSR created above can be done with:
::
dnssec-ksr -i now -e +1y -k kskpolicy -l named.conf -f ksr.txt sign example.com
Make sure that the DNSSEC parameters in ``kskpolicy`` match those
in ``mypolicy``.
See Also
~~~~~~~~
:iscman:`dnssec-keygen(8) <dnssec-keygen>`,
:iscman:`dnssec-signzone(8) <dnssec-signzone>`,
BIND 9 Administrator Reference Manual.
+1 -1
View File
@@ -257,5 +257,5 @@ cleanup:
}
isc_mem_destroy(&mctx);
return (0);
return 0;
}
+1 -1
View File
@@ -960,5 +960,5 @@ main(int argc, char **argv) {
isc_mem_free(mctx, directory);
isc_mem_destroy(&mctx);
return (0);
return 0;
}
+91 -73
View File
@@ -140,10 +140,10 @@ static dns_masterformat_t inputformat = dns_masterformat_text;
static dns_masterformat_t outputformat = dns_masterformat_text;
static uint32_t rawversion = 1, serialnum = 0;
static bool snset = false;
static unsigned int nsigned = 0, nretained = 0, ndropped = 0;
static unsigned int nverified = 0, nverifyfailed = 0;
static atomic_uint_fast32_t nsigned = 0, nretained = 0, ndropped = 0;
static atomic_uint_fast32_t nverified = 0, nverifyfailed = 0;
static const char *directory = NULL, *dsdir = NULL;
static isc_mutex_t namelock, statslock;
static isc_mutex_t namelock;
static isc_nm_t *netmgr = NULL;
static isc_loopmgr_t *loopmgr = NULL;
static dns_db_t *gdb; /* The database */
@@ -182,11 +182,9 @@ static dns_ttl_t maxttl = 0;
static bool no_max_check = false;
static const char *sync_records = "cdnskey,cds:sha-256";
#define INCSTAT(counter) \
if (printstats) { \
LOCK(&statslock); \
counter++; \
UNLOCK(&statslock); \
#define INCSTAT(counter) \
if (printstats) { \
atomic_fetch_add_relaxed(&counter, 1); \
}
/*%
@@ -199,7 +197,7 @@ savezonecut(dns_fixedname_t *fzonecut, dns_name_t *name) {
result = dns_fixedname_initname(fzonecut);
dns_name_copy(name, result);
return (result);
return result;
}
static void
@@ -328,28 +326,28 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dst_key_t *key,
static bool
issigningkey(dns_dnsseckey_t *key) {
return (key->force_sign || key->hint_sign);
return key->force_sign || key->hint_sign;
}
static bool
ispublishedkey(dns_dnsseckey_t *key) {
return ((key->force_publish || key->hint_publish) && !key->hint_remove);
return (key->force_publish || key->hint_publish) && !key->hint_remove;
}
static bool
iszonekey(dns_dnsseckey_t *key) {
return (dns_name_equal(dst_key_name(key->key), gorigin) &&
dst_key_iszonekey(key->key));
return dns_name_equal(dst_key_name(key->key), gorigin) &&
dst_key_iszonekey(key->key);
}
static bool
isksk(dns_dnsseckey_t *key) {
return (key->ksk);
return key->ksk;
}
static bool
iszsk(dns_dnsseckey_t *key) {
return (ignore_kskflag || !key->ksk);
return ignore_kskflag || !key->ksk;
}
/*%
@@ -369,10 +367,10 @@ keythatsigned_unlocked(dns_rdata_rrsig_t *rrsig) {
rrsig->algorithm == dst_key_alg(key->key) &&
dns_name_equal(&rrsig->signer, dst_key_name(key->key)))
{
return (key);
return key;
}
}
return (NULL);
return NULL;
}
/*%
@@ -389,7 +387,7 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
key = keythatsigned_unlocked(rrsig);
RWUNLOCK(&keylist_lock, isc_rwlocktype_read);
if (key != NULL) {
return (key);
return key;
}
/*
@@ -403,7 +401,7 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
key = keythatsigned_unlocked(rrsig);
if (key != NULL) {
isc_rwlock_unlock(&keylist_lock, isc_rwlocktype_write);
return (key);
return key;
}
result = dst_key_fromfile(&rrsig->signer, rrsig->keyid,
@@ -411,7 +409,7 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
mctx, &pubkey);
if (result != ISC_R_SUCCESS) {
isc_rwlock_unlock(&keylist_lock, isc_rwlocktype_write);
return (NULL);
return NULL;
}
result = dst_key_fromfile(
@@ -422,15 +420,14 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
dns_dnsseckey_create(mctx, &privkey, &key);
} else {
dns_dnsseckey_create(mctx, &pubkey, &key);
key->pubkey = true;
}
key->force_publish = false;
key->force_sign = false;
key->index = keycount++;
ISC_LIST_APPEND(keylist, key, link);
isc_rwlock_unlock(&keylist_lock, isc_rwlocktype_write);
return (key);
return key;
}
/*%
@@ -452,11 +449,11 @@ expecttofindkey(dns_name_t *name) {
case ISC_R_SUCCESS:
case DNS_R_NXDOMAIN:
case DNS_R_NXRRSET:
return (true);
return true;
case DNS_R_DELEGATION:
case DNS_R_CNAME:
case DNS_R_DNAME:
return (false);
return false;
default:
break;
}
@@ -464,7 +461,7 @@ expecttofindkey(dns_name_t *name) {
fatal("failure looking for '%s DNSKEY' in database: %s", namestr,
isc_result_totext(result));
UNREACHABLE();
return (false); /* removes a warning */
return false; /* removes a warning */
}
static bool
@@ -474,10 +471,10 @@ setverifies(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
result = dns_dnssec_verify(name, set, key, false, 0, mctx, rrsig, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) {
INCSTAT(nverified);
return (true);
return true;
} else {
INCSTAT(nverifyfailed);
return (false);
return false;
}
}
@@ -543,7 +540,7 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
}
while (result == ISC_R_SUCCESS) {
bool expired, future;
bool expired, refresh, future, offline;
bool keep = false, resign = false;
dns_rdataset_current(&sigset, &sigrdata);
@@ -554,8 +551,10 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
future = isc_serial_lt(now, rrsig.timesigned);
key = keythatsigned(&rrsig);
offline = key->pubkey;
sig_format(&rrsig, sigstr, sizeof(sigstr));
expired = isc_serial_gt(now + cycle, rrsig.timeexpire);
expired = isc_serial_gt(now, rrsig.timeexpire);
refresh = isc_serial_gt(now + cycle, rrsig.timeexpire);
if (isc_serial_gt(rrsig.timesigned, rrsig.timeexpire)) {
/* rrsig is dropped and not replaced */
@@ -584,15 +583,21 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
} else if (issigningkey(key)) {
wassignedby[key->index] = true;
if (!expired && rrsig.originalttl == set->ttl &&
if (!refresh && rrsig.originalttl == set->ttl &&
setverifies(name, set, key->key, &sigrdata))
{
vbprintf(2, "\trrsig by %s retained\n", sigstr);
keep = true;
} else if (offline) {
vbprintf(2,
"\trrsig by %s retained - private key "
"missing\n",
sigstr);
keep = true;
} else {
vbprintf(2, "\trrsig by %s dropped - %s\n",
sigstr,
expired ? "expired"
refresh ? "refresh"
: rrsig.originalttl != set->ttl
? "ttl change"
: "failed to "
@@ -605,25 +610,32 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
} else if (iszonekey(key)) {
wassignedby[key->index] = true;
if (!expired && rrsig.originalttl == set->ttl &&
if (!refresh && rrsig.originalttl == set->ttl &&
setverifies(name, set, key->key, &sigrdata))
{
vbprintf(2, "\trrsig by %s retained\n", sigstr);
keep = true;
} else if (offline) {
vbprintf(2,
"\trrsig by %s retained - private key "
"missing\n",
sigstr);
keep = true;
} else {
vbprintf(2, "\trrsig by %s dropped - %s\n",
sigstr,
expired ? "expired"
refresh ? "refresh"
: rrsig.originalttl != set->ttl
? "ttl change"
: "failed to "
"verify");
}
} else if (!expired) {
} else if (!refresh) {
vbprintf(2, "\trrsig by %s retained\n", sigstr);
keep = true;
} else {
vbprintf(2, "\trrsig by %s expired\n", sigstr);
vbprintf(2, "\trrsig by %s %s\n", sigstr,
expired ? "expired" : "needs refresh");
}
if (keep) {
@@ -680,6 +692,10 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
for (key = ISC_LIST_HEAD(keylist); key != NULL;
key = ISC_LIST_NEXT(key, link))
{
if (REVOKE(key->key) && set->type != dns_rdatatype_dnskey) {
continue;
}
if (nowsignedby[key->index]) {
continue;
}
@@ -862,7 +878,7 @@ hashlist_add_dns_name(hashlist_t *l,
static int
hashlist_comp(const void *a, const void *b) {
return (memcmp(a, b, hash_length + 1));
return memcmp(a, b, hash_length + 1);
}
static void
@@ -894,11 +910,11 @@ hashlist_hasdup(hashlist_t *l) {
continue;
}
if (isc_safe_memequal(current, next, l->length - 1)) {
return (true);
return true;
}
current = next;
}
return (false);
return false;
}
static const unsigned char *
@@ -920,16 +936,16 @@ hashlist_findnext(const hashlist_t *l,
}
} while (entries-- > 1U);
INSIST(entries != 0U);
return (next);
return next;
}
static bool
hashlist_exists(const hashlist_t *l,
const unsigned char hash[NSEC3_MAX_HASH_LENGTH]) {
if (bsearch(hash, l->hashbuf, l->entries, l->length, hashlist_comp)) {
return (true);
return true;
} else {
return (false);
return false;
}
}
@@ -1038,7 +1054,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
vbprintf(2, "found DS records\n");
dsset->ttl = ttl;
dns_db_detach(&db);
return (result);
return result;
}
}
dns_db_detach(&db);
@@ -1047,13 +1063,13 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
/* No DS records found; try again, looking for DNSKEY records */
opendb("keyset-", name, gclass, &db);
if (db == NULL) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
result = dns_db_findnode(db, name, false, &node);
if (result != ISC_R_SUCCESS) {
dns_db_detach(&db);
return (result);
return result;
}
dns_rdataset_init(&keyset);
@@ -1062,7 +1078,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
if (result != ISC_R_SUCCESS) {
dns_db_detachnode(db, &node);
dns_db_detach(&db);
return (result);
return result;
}
vbprintf(2, "found DNSKEY records\n");
@@ -1099,7 +1115,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
dns_rdataset_disassociate(&keyset);
dns_db_detachnode(db, &node);
dns_db_detach(&db);
return (result);
return result;
}
static bool
@@ -1108,7 +1124,7 @@ secure(dns_name_t *name, dns_dbnode_t *node) {
isc_result_t result;
if (dns_name_equal(name, gorigin)) {
return (false);
return false;
}
dns_rdataset_init(&dsset);
@@ -1118,7 +1134,7 @@ secure(dns_name_t *name, dns_dbnode_t *node) {
dns_rdataset_disassociate(&dsset);
}
return (result == ISC_R_SUCCESS);
return result == ISC_R_SUCCESS;
}
static bool
@@ -1128,7 +1144,7 @@ is_delegation(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
isc_result_t result;
if (dns_name_equal(name, origin)) {
return (false);
return false;
}
dns_rdataset_init(&nsset);
@@ -1141,7 +1157,7 @@ is_delegation(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
dns_rdataset_disassociate(&nsset);
}
return ((result == ISC_R_SUCCESS));
return result == ISC_R_SUCCESS;
}
/*%
@@ -1160,14 +1176,14 @@ has_dname(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node) {
dns_rdataset_disassociate(&dnameset);
}
return ((result == ISC_R_SUCCESS));
return result == ISC_R_SUCCESS;
}
/*%
* Signs all records at a name.
*/
static void
signname(dns_dbnode_t *node, dns_name_t *name) {
signname(dns_dbnode_t *node, bool apex, dns_name_t *name) {
isc_result_t result;
dns_rdataset_t rdataset;
dns_rdatasetiter_t *rdsiter;
@@ -1218,6 +1234,10 @@ signname(dns_dbnode_t *node, dns_name_t *name) {
dns_name_format(name, namebuf, sizeof(namebuf));
fatal("'%s': found DS RRset without NS RRset\n",
namebuf);
} else if (rdataset.type == dns_rdatatype_dnskey && !apex) {
char namebuf[DNS_NAME_FORMATSIZE];
dns_name_format(name, namebuf, sizeof(namebuf));
fatal("'%s': Non-apex DNSKEY RRset\n", namebuf);
}
signset(&del, &add, node, name, &rdataset);
@@ -1374,7 +1394,7 @@ active_node(dns_dbnode_t *node) {
}
dns_rdatasetiter_destroy(&rdsiter);
return (active);
return active;
}
/*%
@@ -1423,7 +1443,7 @@ setsoaserial(uint32_t serial, dns_updatemethod_t method) {
result = dns_db_getoriginnode(gdb, &node);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
dns_rdataset_init(&rdataset);
@@ -1497,7 +1517,7 @@ cleanup:
}
dns_rdata_reset(&rdata);
return (result);
return result;
}
/*%
@@ -1537,7 +1557,7 @@ signapex(void) {
check_result(result, "dns_dbiterator_seek()");
result = dns_dbiterator_current(gdbiter, &node, name);
check_dns_dbiterator_current(result);
signname(node, name);
signname(node, true, name);
dumpnode(name, node);
dns_db_detachnode(gdb, &node);
result = dns_dbiterator_first(gdbiter);
@@ -1666,7 +1686,7 @@ assignwork(void *arg) {
UNLOCK(&namelock);
signname(node, dns_fixedname_name(&fname));
signname(node, false, dns_fixedname_name(&fname));
/*%
* Write a node to the output file, and restart the worker task.
@@ -3318,21 +3338,24 @@ print_stats(isc_time_t *timer_start, isc_time_t *timer_finish,
uint64_t sig_ms; /* Signatures per millisecond */
FILE *out = output_stdout ? stderr : stdout;
fprintf(out, "Signatures generated: %10u\n", nsigned);
fprintf(out, "Signatures retained: %10u\n", nretained);
fprintf(out, "Signatures dropped: %10u\n", ndropped);
fprintf(out, "Signatures successfully verified: %10u\n", nverified);
fprintf(out,
"Signatures unsuccessfully "
"verified: %10u\n",
nverifyfailed);
fprintf(out, "Signatures generated: %10" PRIuFAST32 "\n",
atomic_load(&nsigned));
fprintf(out, "Signatures retained: %10" PRIuFAST32 "\n",
atomic_load(&nretained));
fprintf(out, "Signatures dropped: %10" PRIuFAST32 "\n",
atomic_load(&ndropped));
fprintf(out, "Signatures successfully verified: %10" PRIuFAST32 "\n",
atomic_load(&nverified));
fprintf(out, "Signatures unsuccessfully verified: %10" PRIuFAST32 "\n",
atomic_load(&nverifyfailed));
time_us = isc_time_microdiff(sign_finish, sign_start);
time_ms = time_us / 1000;
fprintf(out, "Signing time in seconds: %7u.%03u\n",
(unsigned int)(time_ms / 1000), (unsigned int)(time_ms % 1000));
if (time_us > 0) {
sig_ms = ((uint64_t)nsigned * 1000000000) / time_us;
sig_ms = ((uint64_t)atomic_load(&nsigned) * 1000000000) /
time_us;
fprintf(out, "Signatures per second: %7u.%03u\n",
(unsigned int)sig_ms / 1000,
(unsigned int)sig_ms % 1000);
@@ -4043,10 +4066,6 @@ main(int argc, char *argv[]) {
isc_mutex_init(&namelock);
if (printstats) {
isc_mutex_init(&statslock);
}
presign();
sign_start = isc_time_now();
signapex();
@@ -4153,9 +4172,8 @@ main(int argc, char *argv[]) {
timer_finish = isc_time_now();
print_stats(&timer_start, &timer_finish, &sign_start,
&sign_finish);
isc_mutex_destroy(&statslock);
}
isc_mutex_destroy(&namelock);
return (vresult == ISC_R_SUCCESS ? 0 : 1);
return vresult == ISC_R_SUCCESS ? 0 : 1;
}
+17 -4
View File
@@ -21,7 +21,7 @@ dnssec-signzone - DNSSEC zone signing tool
Synopsis
~~~~~~~~
:program:`dnssec-signzone` [**-a**] [**-c** class] [**-d** directory] [**-D**] [**-E** engine] [**-e** end-time] [**-f** output-file] [**-F**] [**-g**] [**-G sync-records**] [**-h**] [**-i** interval] [**-I** input-format] [**-j** jitter] [**-K** directory] [**-k** key] [**-L** serial] [**-M** maxttl] [**-N** soa-serial-format] [**-o** origin] [**-O** output-format] [**-P**] [**-Q**] [**-q**] [**-R**] [**-S**] [**-s** start-time] [**-T** ttl] [**-t**] [**-u**] [**-v** level] [**-V**] [**-X** extended end-time] [**-x**] [**-z**] [**-3** salt] [**-H** iterations] [**-A**] {zonefile} [key...]
:program:`dnssec-signzone` [**-a**] [**-c** class] [**-d** directory] [**-D**] [**-E** engine] [**-e** end-time] [**-f** output-file] [**-F**] [**-g**] [**-G sync-records**] [**-h**] [**-i** interval] [**-I** input-format] [**-j** jitter] [**-J** filename] [**-K** directory] [**-k** key] [**-L** serial] [**-M** maxttl] [**-N** soa-serial-format] [**-o** origin] [**-O** output-format] [**-P**] [**-Q**] [**-q**] [**-R**] [**-S**] [**-s** start-time] [**-T** ttl] [**-t**] [**-u**] [**-v** level] [**-V**] [**-X** extended end-time] [**-x**] [**-z**] [**-3** salt] [**-H** iterations] [**-A**] {zonefile} [key...]
Description
~~~~~~~~~~~
@@ -89,6 +89,11 @@ Options
where ``digest-type`` is an allowed algorithm such as SHA-256 (2), or SHA-384 (4).
Only works in combination with smart signing (``-S``).
.. option:: -J filename
This option tells :program:`dnssec-signzone` to read the journal from the given file
when loading the zone file.
.. option:: -K directory
This option specifies the directory to search for DNSSEC keys. If not
@@ -178,6 +183,11 @@ Options
days. Therefore, if any existing RRSIG records are due to expire in
less than 7.5 days, they are replaced.
Note that the calculation of cycle interval is based upon the validity
period of the replacement signatures that would be generated by
``dnssec-signzone``, not on the valid lifetimes of the input RRSIGs being
considered for pre-expiry replacement.
.. option:: -I input-format
This option sets the format of the input zone file. Possible formats are
@@ -273,7 +283,7 @@ Options
with cached copies of the old DNSKEY RRset. The :option:`-Q` option forces
:program:`dnssec-signzone` to remove signatures from keys that are no longer
active. This enables ZSK rollover using the procedure described in
:rfc:`4641#4.2.1.1` ("Pre-Publish Key Rollover").
:rfc:`6781#section-4.1.1.1` ("Pre-Publish Zone Signing Key Rollover").
.. option:: -q
@@ -290,7 +300,7 @@ Options
This option is similar to :option:`-Q`, except it forces
:program:`dnssec-signzone` to remove signatures from keys that are no longer
published. This enables ZSK rollover using the procedure described in
:rfc:`4641#4.2.1.2` ("Double Signature Zone Signing Key
:rfc:`6781#section-4.1.1.2` ("Double Signature Zone Signing Key
Rollover").
.. option:: -S
@@ -374,6 +384,7 @@ Options
.. note::
``-3 -`` is the recommended configuration. Adding salt provides no practical benefits.
See :rfc:`9276`.
.. option:: -H iterations
@@ -382,6 +393,7 @@ Options
.. warning::
Values greater than 0 cause interoperability issues and also increase the risk of CPU-exhausting DoS attacks.
See :rfc:`9276`.
.. option:: -A
@@ -390,6 +402,7 @@ Options
.. warning::
Do not use this option unless all its implications are fully understood. This option is intended only for extremely large zones (comparable to ``com.``) with sparse secure delegations.
See :rfc:`9276`.
.. option:: -AA
@@ -443,4 +456,4 @@ See Also
~~~~~~~~
:iscman:`dnssec-keygen(8) <dnssec-keygen>`, BIND 9 Administrator Reference Manual, :rfc:`4033`,
:rfc:`4641`.
:rfc:`6781`.
+1 -1
View File
@@ -342,5 +342,5 @@ main(int argc, char *argv[]) {
}
isc_mem_destroy(&mctx);
return (result == ISC_R_SUCCESS ? 0 : 1);
return result == ISC_R_SUCCESS ? 0 : 1;
}
+6 -1
View File
@@ -21,7 +21,7 @@ dnssec-verify - DNSSEC zone verification tool
Synopsis
~~~~~~~~
:program:`dnssec-verify` [**-c** class] [**-E** engine] [**-I** input-format] [**-o** origin] [**-q**] [**-v** level] [**-V**] [**-x**] [**-z**] {zonefile}
:program:`dnssec-verify` [**-c** class] [**-E** engine] [**-I** input-format] [**-J** filename] [**-o** origin] [**-q**] [**-v** level] [**-V**] [**-x**] [**-z**] {zonefile}
Description
~~~~~~~~~~~
@@ -53,6 +53,11 @@ Options
format containing updates can be verified independently.
This option is not useful for non-dynamic zones.
.. option:: -J filename
This option tells :program:`dnssec-verify` to read the journal from the given file
when loading the zone file.
.. option:: -o origin
This option indicates the zone origin. If not specified, the name of the zone file is
+130 -32
View File
@@ -202,16 +202,16 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
switch (suffix[0]) {
case 'Y':
case 'y':
return (offset * (365 * 24 * 3600));
return offset * (365 * 24 * 3600);
case 'M':
case 'm':
switch (suffix[1]) {
case 'O':
case 'o':
return (offset * (30 * 24 * 3600));
return offset * (30 * 24 * 3600);
case 'I':
case 'i':
return (offset * 60);
return offset * 60;
case '\0':
fatal("'%s' ambiguous: use 'mi' for minutes "
"or 'mo' for months",
@@ -223,29 +223,29 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
break;
case 'W':
case 'w':
return (offset * (7 * 24 * 3600));
return offset * (7 * 24 * 3600);
case 'D':
case 'd':
return (offset * (24 * 3600));
return offset * (24 * 3600);
case 'H':
case 'h':
return (offset * 3600);
return offset * 3600;
case 'S':
case 's':
case '\0':
return (offset);
return offset;
default:
fatal("time value %s is invalid", str);
}
UNREACHABLE();
return (0); /* silence compiler warning */
return 0; /* silence compiler warning */
}
static bool
isnone(const char *str) {
return ((strcasecmp(str, "none") == 0) ||
(strcasecmp(str, "never") == 0) ||
(strcasecmp(str, "unset") == 0));
return (strcasecmp(str, "none") == 0) ||
(strcasecmp(str, "never") == 0) ||
(strcasecmp(str, "unset") == 0);
}
dns_ttl_t
@@ -255,7 +255,7 @@ strtottl(const char *str) {
char *endp;
if (isnone(str)) {
return ((dns_ttl_t)0);
return (dns_ttl_t)0;
}
ttl = strtol(str, &endp, 0);
@@ -263,19 +263,19 @@ strtottl(const char *str) {
fatal("TTL must be numeric");
}
ttl = time_units(ttl, endp, orig);
return (ttl);
return ttl;
}
dst_key_state_t
strtokeystate(const char *str) {
if (isnone(str)) {
return (DST_KEY_STATE_NA);
return DST_KEY_STATE_NA;
}
for (int i = 0; i < KEYSTATES_NVALUES; i++) {
if (keystates[i] != NULL && strcasecmp(str, keystates[i]) == 0)
{
return ((dst_key_state_t)i);
return (dst_key_state_t)i;
}
}
fatal("unknown key state %s", str);
@@ -292,13 +292,13 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
if (isnone(str)) {
SET_IF_NOT_NULL(setp, false);
return ((isc_stdtime_t)0);
return (isc_stdtime_t)0;
}
SET_IF_NOT_NULL(setp, true);
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') {
return ((isc_stdtime_t)0);
return (isc_stdtime_t)0;
}
/*
@@ -347,7 +347,7 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
}
if (str[0] == '\0') {
return ((isc_stdtime_t)base);
return (isc_stdtime_t)base;
} else if (str[0] == '+') {
offset = strtol(str + 1, &endp, 0);
offset = time_units((isc_stdtime_t)offset, endp, orig);
@@ -360,7 +360,7 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
fatal("time value %s is invalid", orig);
}
return ((isc_stdtime_t)val);
return (isc_stdtime_t)val;
}
dns_rdataclass_t
@@ -370,7 +370,7 @@ strtoclass(const char *str) {
isc_result_t result;
if (str == NULL) {
return (dns_rdataclass_in);
return dns_rdataclass_in;
}
r.base = UNCONST(str);
r.length = strlen(str);
@@ -378,7 +378,7 @@ strtoclass(const char *str) {
if (result != ISC_R_SUCCESS) {
fatal("unknown class %s", str);
}
return (rdclass);
return rdclass;
}
unsigned int
@@ -393,14 +393,14 @@ strtodsdigest(const char *str) {
if (result != ISC_R_SUCCESS) {
fatal("unknown DS algorithm %s", str);
}
return (alg);
return alg;
}
static int
cmp_dtype(const void *ap, const void *bp) {
int a = *(const uint8_t *)ap;
int b = *(const uint8_t *)bp;
return (a - b);
return a - b;
}
void
@@ -432,7 +432,7 @@ try_dir(const char *dirname) {
if (result == ISC_R_SUCCESS) {
isc_dir_close(&d);
}
return (result);
return result;
}
/*
@@ -479,7 +479,7 @@ set_keyversion(dst_key_t *key) {
bool
key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
isc_mem_t *mctx, bool *exact) {
isc_mem_t *mctx, uint16_t min, uint16_t max, bool *exact) {
isc_result_t result;
bool conflict = false;
dns_dnsseckeylist_t matchkeys;
@@ -489,19 +489,32 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
dns_secalg_t alg;
isc_stdtime_t now = isc_stdtime_now();
if (exact != NULL) {
*exact = false;
}
SET_IF_NOT_NULL(exact, false);
id = dst_key_id(dstkey);
rid = dst_key_rid(dstkey);
alg = dst_key_alg(dstkey);
if (min != max) {
if (id < min || id > max) {
fprintf(stderr, "Key ID %d outside of [%u..%u]\n", id,
min, max);
return true;
}
if (rid < min || rid > max) {
fprintf(stderr,
"Revoked Key ID %d (for tag %d) outside of "
"[%u..%u]\n",
rid, id, min, max);
return true;
}
}
ISC_LIST_INIT(matchkeys);
result = dns_dnssec_findmatchingkeys(name, NULL, dir, NULL, now, mctx,
&matchkeys);
if (result == ISC_R_NOTFOUND) {
return (false);
return false;
}
while (!ISC_LIST_EMPTY(matchkeys) && !conflict) {
@@ -545,7 +558,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
dns_dnsseckey_destroy(mctx, &key);
}
return (conflict);
return conflict;
}
bool
@@ -560,9 +573,9 @@ isoptarg(const char *arg, char **argv, void (*usage)(void)) {
isc_commandline_argument = argv[isc_commandline_index];
/* skip to next argument */
isc_commandline_index++;
return (true);
return true;
}
return (false);
return false;
}
void
@@ -602,3 +615,88 @@ loadjournal(isc_mem_t *mctx, dns_db_t *db, const char *file) {
cleanup:
dns_journal_destroy(&jnl);
}
void
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, isc_log_t *lctx,
const char *name, const char *keydir, const char *engine,
dns_kasp_t **kaspp) {
isc_result_t result = ISC_R_NOTFOUND;
const cfg_listelt_t *element;
const cfg_obj_t *kasps = NULL;
dns_kasp_t *kasp = NULL, *kasp_next;
dns_kasplist_t kasplist;
const cfg_obj_t *keystores = NULL;
dns_keystore_t *ks = NULL, *ks_next;
dns_keystorelist_t kslist;
ISC_LIST_INIT(kasplist);
ISC_LIST_INIT(kslist);
(void)cfg_map_get(config, "key-store", &keystores);
for (element = cfg_list_first(keystores); element != NULL;
element = cfg_list_next(element))
{
cfg_obj_t *kconfig = cfg_listelt_value(element);
ks = NULL;
result = cfg_keystore_fromconfig(kconfig, mctx, lctx, engine,
&kslist, NULL);
if (result != ISC_R_SUCCESS) {
fatal("failed to configure key-store '%s': %s",
cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
isc_result_totext(result));
}
}
/* Default key-directory key store. */
ks = NULL;
(void)cfg_keystore_fromconfig(NULL, mctx, lctx, engine, &kslist, &ks);
INSIST(ks != NULL);
if (keydir != NULL) {
/* '-K keydir' takes priority */
dns_keystore_setdirectory(ks, keydir);
}
dns_keystore_detach(&ks);
(void)cfg_map_get(config, "dnssec-policy", &kasps);
for (element = cfg_list_first(kasps); element != NULL;
element = cfg_list_next(element))
{
cfg_obj_t *kconfig = cfg_listelt_value(element);
kasp = NULL;
if (strcmp(cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
name) != 0)
{
continue;
}
result = cfg_kasp_fromconfig(kconfig, NULL, true, mctx, lctx,
&kslist, &kasplist, &kasp);
if (result != ISC_R_SUCCESS) {
fatal("failed to configure dnssec-policy '%s': %s",
cfg_obj_asstring(cfg_tuple_get(kconfig, "name")),
isc_result_totext(result));
}
INSIST(kasp != NULL);
dns_kasp_freeze(kasp);
break;
}
*kaspp = kasp;
/*
* Cleanup kasp list.
*/
for (kasp = ISC_LIST_HEAD(kasplist); kasp != NULL; kasp = kasp_next) {
kasp_next = ISC_LIST_NEXT(kasp, link);
ISC_LIST_UNLINK(kasplist, kasp, link);
dns_kasp_detach(&kasp);
}
/*
* Cleanup keystore list.
*/
for (ks = ISC_LIST_HEAD(kslist); ks != NULL; ks = ks_next) {
ks_next = ISC_LIST_NEXT(ks, link);
ISC_LIST_UNLINK(kslist, ks, link);
dns_keystore_detach(&ks);
}
}
+14 -1
View File
@@ -20,10 +20,18 @@
#include <isc/log.h>
#include <isc/stdtime.h>
#include <dns/kasp.h>
#include <dns/rdatastruct.h>
#include <dst/dst.h>
#include <isccfg/cfg.h>
#include <isccfg/kaspconf.h>
#include <isccfg/namedconf.h>
#define MAX_RSA 4096 /* should be long enough... */
#define MAX_DH 4096 /* should be long enough... */
/*! verbosity: set by -v and -q option in each program, defined in dnssectool.c
*/
extern int verbose;
@@ -101,10 +109,15 @@ set_keyversion(dst_key_t *key);
bool
key_collision(dst_key_t *key, dns_name_t *name, const char *dir,
isc_mem_t *mctx, bool *exact);
isc_mem_t *mctx, uint16_t min, uint16_t max, bool *exact);
bool
isoptarg(const char *arg, char **argv, void (*usage)(void));
void
loadjournal(isc_mem_t *mctx, dns_db_t *db, const char *journal);
void
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, isc_log_t *lctx,
const char *name, const char *keydir, const char *engine,
dns_kasp_t **kaspp);
+90 -86
View File
@@ -120,7 +120,7 @@ putrdata(bdbnode_t *node, dns_rdatatype_t typeval, dns_ttl_t ttl,
rdatalist->ttl = ttl;
ISC_LIST_APPEND(node->lists, rdatalist, link);
} else if (rdatalist->ttl != ttl) {
return (DNS_R_BADTTL);
return DNS_R_BADTTL;
}
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
@@ -136,7 +136,7 @@ putrdata(bdbnode_t *node, dns_rdatatype_t typeval, dns_ttl_t ttl,
ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
ISC_LIST_APPEND(node->buffers, rdatabuf, link);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -159,7 +159,7 @@ putrr(bdbnode_t *node, const char *type, dns_ttl_t ttl, const char *data) {
isc_constregion_t r = { .base = type, .length = strlen(type) };
result = dns_rdatatype_fromtext(&typeval, (isc_textregion_t *)&r);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
isc_lex_create(mctx, 64, &lex);
@@ -170,7 +170,7 @@ putrr(bdbnode_t *node, const char *type, dns_ttl_t ttl, const char *data) {
result = isc_lex_openbuffer(lex, &b);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
isc_buffer_allocate(mctx, &rb, DNS_RDATA_MAXLENGTH);
@@ -185,7 +185,7 @@ putrr(bdbnode_t *node, const char *type, dns_ttl_t ttl, const char *data) {
isc_buffer_free(&rb);
return (result);
return result;
}
/* Reasonable default SOA values */
@@ -207,9 +207,9 @@ putsoa(bdbnode_t *node, const char *mname, const char *rname, uint32_t serial) {
serial, DEFAULT_REFRESH, DEFAULT_RETRY, DEFAULT_EXPIRE,
DEFAULT_MINIMUM);
if (n >= (int)sizeof(str) || n < 0) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
return (putrr(node, "SOA", DEFAULT_TTL, str));
return putrr(node, "SOA", DEFAULT_TTL, str);
}
static isc_result_t
@@ -222,7 +222,7 @@ puttxt(bdbnode_t *node, const char *text) {
}
buf[0] = len;
memmove(&buf[1], text, len);
return (putrdata(node, dns_rdatatype_txt, 0, buf, len + 1));
return putrdata(node, dns_rdatatype_txt, 0, buf, len + 1);
}
/*
@@ -279,7 +279,7 @@ dns64_rdata(unsigned char *v, size_t start, unsigned char *rdata) {
}
}
memmove(&rdata[j], "\07in-addr\04arpa", 14);
return (j + 14);
return j + 14;
}
static isc_result_t
@@ -301,7 +301,7 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
zlen = zone->length;
nlen = name->length;
if ((zlen + nlen) > 74U || zlen < 10U || (nlen % 2) != 0U) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
@@ -320,11 +320,11 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
while (j != 0U) {
INSIST((i / 2) < sizeof(v));
if (ndata[0] != 1) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
n = hex16[ndata[1] & 0xff];
if (n == 1) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
v[i / 2] = n | (v[i / 2] >> 4);
j -= 2;
@@ -346,14 +346,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* to exist in the zone.
*/
if (nlen > 16U && v[(nlen - 1) / 4 - 4] != 0) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
* If the total length is not 74 then this is a empty node
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 8, rdata);
break;
@@ -363,14 +363,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* to exist in the zone.
*/
if (nlen > 12U && v[(nlen - 1) / 4 - 3] != 0) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
* If the total length is not 74 then this is a empty node
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 6, rdata);
break;
@@ -380,14 +380,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* to exist in the zone.
*/
if (nlen > 8U && v[(nlen - 1) / 4 - 2] != 0) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
* If the total length is not 74 then this is a empty node
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 5, rdata);
break;
@@ -397,14 +397,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* to exist in the zone.
*/
if (nlen > 4U && v[(nlen - 1) / 4 - 1] != 0) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
* If the total length is not 74 then this is a empty node
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 4, rdata);
break;
@@ -414,14 +414,14 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* to exist in the zone.
*/
if (v[(nlen - 1) / 4] != 0) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
* If the total length is not 74 then this is a empty node
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 3, rdata);
break;
@@ -431,7 +431,7 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* so return success.
*/
if (nlen + zlen != 74U) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
len = dns64_rdata(v, 0, rdata);
break;
@@ -440,7 +440,7 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
* This should never be reached unless someone adds a
* zone declaration with this internal type to named.conf.
*/
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
/*
@@ -449,22 +449,22 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name, bdbnode_t *node) {
if ((v[0] == 170 || v[0] == 171) && v[1] == 0 && v[2] == 0 &&
v[3] == 192)
{
return (putrdata(node, dns_rdatatype_ptr, 3600, ipv4only,
sizeof(ipv4only)));
return putrdata(node, dns_rdatatype_ptr, 3600, ipv4only,
sizeof(ipv4only));
}
return (putrdata(node, dns_rdatatype_cname, 600, rdata,
(unsigned int)len));
return putrdata(node, dns_rdatatype_cname, 600, rdata,
(unsigned int)len);
}
static isc_result_t
builtin_lookup(bdb_t *bdb, const dns_name_t *name, bdbnode_t *node) {
if (name->labels == 0 && name->length == 0) {
return (bdb->lookup(node));
return bdb->lookup(node);
} else if ((node->bdb->implementation->flags & BDB_DNS64) != 0) {
return (dns64_cname(&bdb->common.origin, name, node));
return dns64_cname(&bdb->common.origin, name, node);
} else {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
}
@@ -483,27 +483,27 @@ builtin_authority(bdb_t *bdb, bdbnode_t *node) {
result = putsoa(node, server, contact, 0);
if (result != ISC_R_SUCCESS) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
result = putrr(node, "NS", 0, server);
if (result != ISC_R_SUCCESS) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
version_lookup(bdbnode_t *node) {
if (named_g_server->version_set) {
if (named_g_server->version == NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else {
return (puttxt(node, named_g_server->version));
return puttxt(node, named_g_server->version);
}
} else {
return (puttxt(node, PACKAGE_VERSION));
return puttxt(node, PACKAGE_VERSION);
}
}
@@ -511,16 +511,16 @@ static isc_result_t
hostname_lookup(bdbnode_t *node) {
if (named_g_server->hostname_set) {
if (named_g_server->hostname == NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
} else {
return (puttxt(node, named_g_server->hostname));
return puttxt(node, named_g_server->hostname);
}
} else {
char buf[256];
if (gethostname(buf, sizeof(buf)) != 0) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
return (puttxt(node, buf));
return puttxt(node, buf);
}
}
@@ -529,29 +529,33 @@ authors_lookup(bdbnode_t *node) {
isc_result_t result;
const char **p = NULL;
static const char *authors[] = {
"Mark Andrews", "Curtis Blackburn", "James Brister",
"Ben Cottrell", "John H. DuBois III", "Francis Dupont",
"Michael Graff", "Andreas Gustafsson", "Bob Halley",
"Evan Hunt", "JINMEI Tatuya", "Witold Krecicki",
"David Lawrence", "Scott Mann", "Danny Mayer",
"Damien Neil", "Matt Nelson", "Jeremy C. Reed",
"Michael Sawyer", "Brian Wellington", NULL
"Mark Andrews", "Curtis Blackburn",
"James Brister", "Ben Cottrell",
"John H. DuBois III", "Francis Dupont",
"Michael Graff", "Andreas Gustafsson",
"Bob Halley", "Evan Hunt",
"JINMEI Tatuya", "Witold Krecicki",
"David Lawrence", "Scott Mann",
"Danny Mayer", "Aydin Mercan",
"Damien Neil", "Matt Nelson",
"Jeremy C. Reed", "Michael Sawyer",
"Brian Wellington", NULL
};
/*
* If a version string is specified, disable the authors.bind zone.
*/
if (named_g_server->version_set) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
for (p = authors; *p != NULL; p++) {
result = puttxt(node, *p);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -559,13 +563,13 @@ id_lookup(bdbnode_t *node) {
if (named_g_server->sctx->usehostname) {
char buf[256];
if (gethostname(buf, sizeof(buf)) != 0) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
return (puttxt(node, buf));
return puttxt(node, buf);
} else if (named_g_server->sctx->server_id != NULL) {
return (puttxt(node, named_g_server->sctx->server_id));
return puttxt(node, named_g_server->sctx->server_id);
} else {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
@@ -573,7 +577,7 @@ static isc_result_t
empty_lookup(bdbnode_t *node) {
UNUSED(node);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -584,10 +588,10 @@ ipv4only_lookup(bdbnode_t *node) {
for (int i = 0; i < 2; i++) {
result = putrdata(node, dns_rdatatype_a, 3600, data[i], 4);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -596,7 +600,7 @@ ipv4reverse_lookup(bdbnode_t *node) {
result = putrdata(node, dns_rdatatype_ptr, 3600, ipv4only,
sizeof(ipv4only));
return (result);
return result;
}
/*
@@ -666,10 +670,10 @@ rdatasetiter_first(dns_rdatasetiter_t *iterator DNS__DB_FLARG) {
bdbnode_t *bdbnode = (bdbnode_t *)iterator->node;
if (ISC_LIST_EMPTY(bdbnode->lists)) {
return (ISC_R_NOMORE);
return ISC_R_NOMORE;
}
bdbiterator->current = ISC_LIST_HEAD(bdbnode->lists);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -678,9 +682,9 @@ rdatasetiter_next(dns_rdatasetiter_t *iterator DNS__DB_FLARG) {
bdbiterator->current = ISC_LIST_NEXT(bdbiterator->current, link);
if (bdbiterator->current == NULL) {
return (ISC_R_NOMORE);
return ISC_R_NOMORE;
} else {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
@@ -783,7 +787,7 @@ createnode(bdb_t *bdb, bdbnode_t **nodep) {
node->magic = BDBNODE_MAGIC;
*nodep = node;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -840,23 +844,23 @@ getoriginnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG) {
result = createnode(bdb, &node);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = builtin_lookup(bdb, name, node);
if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND) {
destroynode(node);
return (result);
return result;
}
result = builtin_authority(bdb, node);
if (result != ISC_R_SUCCESS) {
destroynode(node);
return (result);
return result;
}
*nodep = node;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -883,26 +887,26 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create,
result = createnode(bdb, &node);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = builtin_lookup(bdb, name, node);
if (result != ISC_R_SUCCESS && (!isorigin || result != ISC_R_NOTFOUND))
{
destroynode(node);
return (result);
return result;
}
if (isorigin) {
result = builtin_authority(bdb, node);
if (result != ISC_R_SUCCESS) {
destroynode(node);
return (result);
return result;
}
}
*nodep = node;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -924,7 +928,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
REQUIRE(version == NULL || version == (void *)&dummy);
if (!dns_name_issubdomain(name, &db->origin)) {
return (DNS_R_NXDOMAIN);
return DNS_R_NXDOMAIN;
}
olabels = dns_name_countlabels(&db->origin);
@@ -950,13 +954,13 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
* No data at zone apex?
*/
if (i == olabels) {
return (DNS_R_BADDB);
return DNS_R_BADDB;
}
result = DNS_R_NXDOMAIN;
continue;
}
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
/*
@@ -1065,7 +1069,7 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
detachnode(db, &node DNS__DB_FLARG_PASS);
}
return (result);
return result;
}
static void
@@ -1113,7 +1117,7 @@ findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
UNUSED(sigrdataset);
if (type == dns_rdatatype_rrsig) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
list = ISC_LIST_HEAD(bdbnode->lists);
@@ -1124,12 +1128,12 @@ findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
list = ISC_LIST_NEXT(list, link);
}
if (list == NULL) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
new_rdataset(list, db, node, rdataset);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -1154,7 +1158,7 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
*iteratorp = (dns_rdatasetiter_t *)iterator;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static dns_dbmethods_t bdb_methods = {
@@ -1182,7 +1186,7 @@ create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
REQUIRE(implementation != NULL);
if (type != dns_dbtype_zone) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
bdb = isc_mem_get(mctx, sizeof(*bdb));
@@ -1237,7 +1241,7 @@ create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
*dbp = (dns_db_t *)bdb;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
dns_name_free(&bdb->common.origin, mctx);
@@ -1249,7 +1253,7 @@ cleanup:
}
isc_mem_putanddetach(&bdb->common.mctx, bdb, sizeof(bdb_t));
return (result);
return result;
}
/*
@@ -1265,17 +1269,17 @@ named_builtin_init(void) {
result = dns_db_register("_builtin", create, &builtin, named_g_mctx,
&builtin.dbimp);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = dns_db_register("_dns64", create, &dns64, named_g_mctx,
&dns64.dbimp);
if (result != ISC_R_SUCCESS) {
dns_db_unregister(&builtin.dbimp);
return (result);
return result;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
void
+61 -62
View File
@@ -96,10 +96,12 @@ options {\n\
#endif
"\
prefetch 2 9;\n\
# querylog <boolean>;\n\
recursing-file \"named.recursing\";\n\
recursive-clients 1000;\n\
request-nsid false;\n\
resolver-query-timeout 10;\n\
# responselog <boolean>;\n\
rrset-order { order random; };\n\
secroots-file \"named.secroots\";\n\
send-cookie true;\n\
@@ -109,6 +111,7 @@ options {\n\
# session-keyfile \"" NAMED_LOCALSTATEDIR "/run/named/session.key\";\n\
session-keyname local-ddns;\n\
startup-notify-rate 20;\n\
sig0checks-quota 1;\n\
statistics-file \"named.stats\";\n\
tcp-advertised-timeout 300;\n\
tcp-clients 150;\n\
@@ -169,7 +172,9 @@ options {\n\
max-clients-per-query 100;\n\
max-ncache-ttl 10800; /* 3 hours */\n\
max-recursion-depth 7;\n\
max-recursion-queries 100;\n\
max-recursion-queries 50;\n\
max-query-count 200;\n\
max-query-restarts 11;\n\
max-stale-ttl 86400; /* 1 day */\n\
message-compression yes;\n\
min-ncache-ttl 0; /* 0 hours */\n\
@@ -207,7 +212,7 @@ options {\n\
/* zone */\n\
allow-query {any;};\n\
allow-query-on {any;};\n\
allow-transfer {any;};\n\
allow-transfer {none;};\n\
# also-notify <none>\n\
check-integrity yes;\n\
check-mx-cname warn;\n\
@@ -222,8 +227,10 @@ options {\n\
ixfr-from-differences false;\n\
max-journal-size default;\n\
max-records 0;\n\
max-records-per-type 100;\n\
max-refresh-time 2419200; /* 4 weeks */\n\
max-retry-time 1209600; /* 2 weeks */\n\
max-types-per-name 100;\n\
max-transfer-idle-in 60;\n\
max-transfer-idle-out 60;\n\
max-transfer-time-in 120;\n\
@@ -295,9 +302,11 @@ dnssec-policy \"default\" {\n\
cds-digest-types { 2; };\n\
dnskey-ttl " DNS_KASP_KEY_TTL ";\n\
inline-signing yes;\n\
offline-ksk no;\n\
publish-safety " DNS_KASP_PUBLISH_SAFETY "; \n\
retire-safety " DNS_KASP_RETIRE_SAFETY "; \n\
purge-keys " DNS_KASP_PURGE_KEYS "; \n\
signatures-jitter " DNS_KASP_SIG_JITTER "; \n\
signatures-refresh " DNS_KASP_SIG_REFRESH "; \n\
signatures-validity " DNS_KASP_SIG_VALIDITY "; \n\
signatures-validity-dnskey " DNS_KASP_SIG_VALIDITY_DNSKEY "; \n\
@@ -326,7 +335,7 @@ dnssec-policy \"insecure\" {\n\
"# END TRUST ANCHORS\n\
\n\
primaries " DEFAULT_IANA_ROOT_ZONE_PRIMARIES " {\n\
remote-servers " DEFAULT_IANA_ROOT_ZONE_PRIMARIES " {\n\
2801:1b8:10::b; # b.root-servers.net\n\
2001:500:2::c; # c.root-servers.net\n\
2001:500:2f::f; # f.root-servers.net\n\
@@ -350,13 +359,15 @@ named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) {
isc_buffer_init(&b, defaultconf, sizeof(defaultconf) - 1);
isc_buffer_add(&b, sizeof(defaultconf) - 1);
return (cfg_parse_buffer(parser, &b, __FILE__, 0, &cfg_type_namedconf,
CFG_PCTX_NODEPRECATED, conf));
return cfg_parse_buffer(parser, &b, __FILE__, 0, &cfg_type_namedconf,
CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
CFG_PCTX_NOEXPERIMENTAL,
conf);
}
const char *
named_config_getdefault(void) {
return (defaultconf);
return defaultconf;
}
isc_result_t
@@ -366,10 +377,10 @@ named_config_get(cfg_obj_t const *const *maps, const char *name,
for (i = 0; maps[i] != NULL; i++) {
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
isc_result_t
@@ -395,7 +406,7 @@ named_checknames_get(const cfg_obj_t **maps, const char *const names[],
*/
if (checknames != NULL && !cfg_obj_islist(checknames)) {
*obj = checknames;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
for (element = cfg_list_first(checknames);
element != NULL; element = cfg_list_next(element))
@@ -409,13 +420,13 @@ named_checknames_get(const cfg_obj_t **maps, const char *const names[],
{
*obj = cfg_tuple_get(value,
"mode");
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
}
}
}
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
int
@@ -427,7 +438,7 @@ named_config_listcount(const cfg_obj_t *list) {
i++;
}
return (i);
return i;
}
isc_result_t
@@ -438,7 +449,7 @@ named_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
if (!cfg_obj_isstring(classobj)) {
*classp = defclass;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
r.base = UNCONST(cfg_obj_asstring(classobj));
r.length = strlen(r.base);
@@ -447,7 +458,7 @@ named_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
cfg_obj_log(classobj, named_g_lctx, ISC_LOG_ERROR,
"unknown class '%s'", r.base);
}
return (result);
return result;
}
isc_result_t
@@ -458,7 +469,7 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
if (!cfg_obj_isstring(typeobj)) {
*typep = deftype;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
r.base = UNCONST(cfg_obj_asstring(typeobj));
r.length = strlen(r.base);
@@ -467,7 +478,7 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
cfg_obj_log(typeobj, named_g_lctx, ISC_LOG_ERROR,
"unknown type '%s'", r.base);
}
return (result);
return result;
}
dns_zonetype_t
@@ -493,12 +504,12 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
} else {
UNREACHABLE();
}
return (ztype);
return ztype;
}
static isc_result_t
getremotesdef(const cfg_obj_t *cctx, const char *list, const char *name,
const cfg_obj_t **ret) {
isc_result_t
named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
const char *name, const cfg_obj_t **ret) {
isc_result_t result;
const cfg_obj_t *obj = NULL;
const cfg_listelt_t *elt;
@@ -509,7 +520,7 @@ getremotesdef(const cfg_obj_t *cctx, const char *list, const char *name,
result = cfg_map_get(cctx, list, &obj);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
elt = cfg_list_first(obj);
while (elt != NULL) {
@@ -518,28 +529,11 @@ getremotesdef(const cfg_obj_t *cctx, const char *list, const char *name,
name) == 0)
{
*ret = obj;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
elt = cfg_list_next(elt);
}
return (ISC_R_NOTFOUND);
}
isc_result_t
named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
const char *name, const cfg_obj_t **ret) {
isc_result_t result;
if (strcmp(list, "parental-agents") == 0) {
return (getremotesdef(cctx, list, name, ret));
} else if (strcmp(list, "primaries") == 0) {
result = getremotesdef(cctx, list, name, ret);
if (result != ISC_R_SUCCESS) {
result = getremotesdef(cctx, "masters", name, ret);
}
return (result);
}
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
static isc_result_t
@@ -554,7 +548,7 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
if (!cfg_obj_isstring(obj)) {
*namep = NULL;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
*namep = isc_mem_get(mctx, sizeof(**namep));
@@ -569,11 +563,11 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
if (result != ISC_R_SUCCESS) {
isc_mem_put(mctx, *namep, sizeof(**namep));
*namep = NULL;
return (result);
return result;
}
dns_name_dup(dns_fixedname_name(&fname), mctx, *namep);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
#define grow_array(mctx, array, newlen, oldlen) \
@@ -590,10 +584,12 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
oldlen = newlen; \
}
static const char *remotesnames[4] = { "remote-servers", "parental-agents",
"primaries", "masters" };
isc_result_t
named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
const cfg_obj_t *list, isc_mem_t *mctx,
dns_ipkeylist_t *ipkl) {
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
isc_mem_t *mctx, dns_ipkeylist_t *ipkl) {
uint32_t addrcount = 0, srccount = 0;
uint32_t keycount = 0, tlscount = 0;
uint32_t listcount = 0, l = 0, i = 0;
@@ -676,8 +672,6 @@ newlist:
isc_sockaddr_any6(&src6);
}
result = ISC_R_NOMEMORY;
element = cfg_list_first(addrlist);
resume:
for (; element != NULL; element = cfg_list_next(element)) {
@@ -708,17 +702,22 @@ resume:
continue;
}
list = NULL;
tresult = named_config_getremotesdef(config, listtype,
listname, &list);
tresult = ISC_R_NOTFOUND;
for (size_t n = 0; n < ARRAY_SIZE(remotesnames); n++) {
tresult = named_config_getremotesdef(
config, remotesnames[n], listname,
&list);
if (tresult == ISC_R_SUCCESS) {
break;
}
}
if (tresult == ISC_R_NOTFOUND) {
cfg_obj_log(addr, named_g_lctx, ISC_LOG_ERROR,
"%s \"%s\" not found", listtype,
"remote-servers \"%s\" not found",
listname);
result = tresult;
goto cleanup;
}
if (tresult != ISC_R_SUCCESS) {
result = tresult;
goto cleanup;
}
lists[l++].name = listname;
@@ -821,7 +820,7 @@ resume:
ipkl->count = addrcount;
ipkl->allocated = addrcount;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
if (addrs != NULL) {
@@ -860,7 +859,7 @@ cleanup:
if (stack != NULL) {
isc_mem_cput(mctx, stack, stackcount, sizeof(stack[0]));
}
return (result);
return result;
}
isc_result_t
@@ -886,10 +885,10 @@ named_config_getport(const cfg_obj_t *config, const char *type,
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
"port '%u' out of range",
cfg_obj_asuint32(portobj));
return (ISC_R_RANGE);
return ISC_R_RANGE;
}
*portp = (in_port_t)cfg_obj_asuint32(portobj);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
struct keyalgorithms {
@@ -933,15 +932,15 @@ named_config_getkeyalgorithm(const char *str, unsigned int *typep,
}
}
if (algorithms[i].str == NULL) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
if (str[len] == '-') {
result = isc_parse_uint16(&bits, str + len + 1, 10);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
if (bits > algorithms[i].size) {
return (ISC_R_RANGE);
return ISC_R_RANGE;
}
} else if (algorithms[i].size == 0) {
bits = 128;
@@ -950,5 +949,5 @@ named_config_getkeyalgorithm(const char *str, unsigned int *typep,
}
SET_IF_NOT_NULL(typep, algorithms[i].type);
SET_IF_NOT_NULL(digestbits, bits);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
+19 -10
View File
@@ -43,23 +43,23 @@ getcommand(isc_lex_t *lex, char **cmdp) {
result = isc_lex_gettoken(lex, ISC_LEXOPT_EOF, &token);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
isc_lex_ungettoken(lex, &token);
if (token.type != isc_tokentype_string) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
*cmdp = token.value.as_textregion.base;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static bool
command_compare(const char *str, const char *command) {
return (strcasecmp(str, command) == 0);
return strcasecmp(str, command) == 0;
}
/*%
@@ -85,7 +85,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
/*
* No data section.
*/
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
result = isccc_cc_lookupstring(data, "type", &cmdline);
@@ -93,7 +93,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
/*
* We have no idea what this is.
*/
return (result);
return result;
}
isc_lex_create(named_g_mctx, strlen(cmdline), &lex);
@@ -210,8 +210,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
{
result = named_server_dnstap(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_DUMPDB)) {
named_server_dumpdb(named_g_server, lex, text);
result = ISC_R_SUCCESS;
result = named_server_dumpdb(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_DUMPSTATS)) {
result = named_server_dumpstats(named_g_server);
} else if (command_compare(command, NAMED_COMMAND_FETCHLIMIT)) {
@@ -224,10 +223,14 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
result = named_server_flushnode(named_g_server, lex, true);
} else if (command_compare(command, NAMED_COMMAND_FREEZE)) {
result = named_server_freeze(named_g_server, true, lex, text);
} else if (command_compare(command, NAMED_COMMAND_SKR)) {
result = named_server_skr(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_LOADKEYS) ||
command_compare(command, NAMED_COMMAND_SIGN))
{
result = named_server_rekey(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_MEMPROF)) {
result = named_server_togglememprof(lex);
} else if (command_compare(command, NAMED_COMMAND_MKEYS)) {
result = named_server_mkeys(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_NOTIFY)) {
@@ -241,7 +244,9 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
} else if (command_compare(command, NAMED_COMMAND_NULL)) {
result = ISC_R_SUCCESS;
} else if (command_compare(command, NAMED_COMMAND_QUERYLOG)) {
result = named_server_togglequerylog(named_g_server, lex);
result = named_server_setortoggle(named_g_server,
"query logging",
NS_SERVER_LOGQUERIES, lex);
} else if (command_compare(command, NAMED_COMMAND_RECONFIG)) {
result = named_server_reconfigcommand(named_g_server);
} else if (command_compare(command, NAMED_COMMAND_RECURSING)) {
@@ -250,6 +255,10 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
result = named_server_refreshcommand(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_RELOAD)) {
result = named_server_reloadcommand(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_RESPONSELOG)) {
result = named_server_setortoggle(named_g_server,
"response logging",
NS_SERVER_LOGRESPONSES, lex);
} else if (command_compare(command, NAMED_COMMAND_RETRANSFER)) {
result = named_server_retransfercommand(named_g_server, lex,
text);
@@ -294,5 +303,5 @@ cleanup:
isc_lex_destroy(&lex);
}
return (result);
return result;
}
+12 -12
View File
@@ -246,7 +246,7 @@ address_ok(isc_sockaddr_t *sockaddr, controllistener_t *listener) {
result = dns_acl_match(&netaddr, NULL, listener->acl, env, &match,
NULL);
return (result == ISC_R_SUCCESS && match > 0);
return result == ISC_R_SUCCESS && match > 0;
}
static void
@@ -641,7 +641,7 @@ control_newconn(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
if (result == ISC_R_SHUTTINGDOWN) {
shutdown_listener(listener);
}
return (result);
return result;
}
peeraddr = isc_nmhandle_peeraddr(handle);
@@ -652,11 +652,11 @@ control_newconn(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
NAMED_LOGMODULE_CONTROL, ISC_LOG_WARNING,
"rejected command channel message from %s",
socktext);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
newconnection(listener, handle);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -710,11 +710,11 @@ cfgkeylist_find(const cfg_obj_t *keylist, const char *keyname,
}
}
if (element == NULL) {
return (ISC_R_NOTFOUND);
return ISC_R_NOTFOUND;
}
obj = cfg_listelt_value(element);
*objp = obj;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -838,7 +838,7 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) {
NAMED_LOGMODULE_CONTROL, ISC_LOG_INFO,
"configuring command channel from '%s'", named_g_keyfile);
if (!isc_file_exists(named_g_keyfile)) {
return (ISC_R_FILENOTFOUND);
return ISC_R_FILENOTFOUND;
}
CHECK(cfg_parser_create(mctx, named_g_lctx, &pctx));
@@ -904,7 +904,7 @@ cleanup:
if (pctx != NULL) {
cfg_parser_destroy(&pctx);
}
return (result);
return result;
}
/*
@@ -1212,7 +1212,7 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
ISC_LOG_ERROR,
"UNIX domain sockets are not "
"supported");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
(void)cfg_map_get(controls, "inet", &inetcontrols);
@@ -1341,7 +1341,7 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
* down will be taken care of by listen_done().
*/
ISC_LIST_APPENDLIST(cp->listeners, new_listeners, link);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
isc_result_t
@@ -1364,10 +1364,10 @@ named_controls_create(named_server_t *server, named_controls_t **ctrlsp) {
if (result != ISC_R_SUCCESS) {
isc_mutex_destroy(&controls->symtab_lock);
isc_mem_put(server->mctx, controls, sizeof(*controls));
return (result);
return result;
}
*ctrlsp = controls;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
void
+25 -25
View File
@@ -98,13 +98,13 @@ dlopen_dlz_allnodes(const char *zone, void *driverarg, void *dbdata,
UNUSED(driverarg);
if (cd->dlz_allnodes == NULL) {
return (ISC_R_NOPERM);
return ISC_R_NOPERM;
}
MAYBE_LOCK(cd);
result = cd->dlz_allnodes(zone, cd->dbdata, allnodes);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
static isc_result_t
@@ -116,13 +116,13 @@ dlopen_dlz_allowzonexfr(void *driverarg, void *dbdata, const char *name,
UNUSED(driverarg);
if (cd->dlz_allowzonexfr == NULL) {
return (ISC_R_NOPERM);
return ISC_R_NOPERM;
}
MAYBE_LOCK(cd);
result = cd->dlz_allowzonexfr(cd->dbdata, name, client);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
static isc_result_t
@@ -134,13 +134,13 @@ dlopen_dlz_authority(const char *zone, void *driverarg, void *dbdata,
UNUSED(driverarg);
if (cd->dlz_authority == NULL) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
MAYBE_LOCK(cd);
result = cd->dlz_authority(zone, cd->dbdata, lookup);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
static isc_result_t
@@ -155,7 +155,7 @@ dlopen_dlz_findzonedb(void *driverarg, void *dbdata, const char *name,
MAYBE_LOCK(cd);
result = cd->dlz_findzonedb(cd->dbdata, name, methods, clientinfo);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
static isc_result_t
@@ -172,7 +172,7 @@ dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg,
result = cd->dlz_lookup(zone, name, cd->dbdata, lookup, methods,
clientinfo);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
/*
@@ -195,7 +195,7 @@ dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
}
}
return (ptr);
return ptr;
}
static void
@@ -219,7 +219,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
"dlz_dlopen driver for '%s' needs a path to "
"the shared library",
dlzname);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
isc_mem_create(&mctx);
@@ -319,14 +319,14 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
*dbdata = cd;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failed:
dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname);
dlopen_dlz_destroy(NULL, cd);
return (result);
return result;
}
/*
@@ -363,13 +363,13 @@ dlopen_dlz_newversion(const char *zone, void *driverarg, void *dbdata,
UNUSED(driverarg);
if (cd->dlz_newversion == NULL) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
MAYBE_LOCK(cd);
result = cd->dlz_newversion(zone, cd->dbdata, versionp);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
/*
@@ -404,7 +404,7 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_configure == NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
MAYBE_LOCK(cd);
@@ -413,7 +413,7 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *driverarg,
cd->in_configure = false;
MAYBE_UNLOCK(cd);
return (result);
return result;
}
/*
@@ -429,7 +429,7 @@ dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
UNUSED(driverarg);
if (cd->dlz_ssumatch == NULL) {
return (false);
return false;
}
MAYBE_LOCK(cd);
@@ -437,7 +437,7 @@ dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
keydata, cd->dbdata);
MAYBE_UNLOCK(cd);
return (ret);
return ret;
}
/*
@@ -452,14 +452,14 @@ dlopen_dlz_addrdataset(const char *name, const char *rdatastr, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_addrdataset == NULL) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
MAYBE_LOCK(cd);
result = cd->dlz_addrdataset(name, rdatastr, cd->dbdata, version);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
/*
@@ -474,14 +474,14 @@ dlopen_dlz_subrdataset(const char *name, const char *rdatastr, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_subrdataset == NULL) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
MAYBE_LOCK(cd);
result = cd->dlz_subrdataset(name, rdatastr, cd->dbdata, version);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
/*
@@ -496,14 +496,14 @@ dlopen_dlz_delrdataset(const char *name, const char *type, void *driverarg,
UNUSED(driverarg);
if (cd->dlz_delrdataset == NULL) {
return (ISC_R_NOTIMPLEMENTED);
return ISC_R_NOTIMPLEMENTED;
}
MAYBE_LOCK(cd);
result = cd->dlz_delrdataset(name, type, cd->dbdata, version);
MAYBE_UNLOCK(cd);
return (result);
return result;
}
static dns_sdlzmethods_t dlz_dlopen_methods = {
@@ -535,7 +535,7 @@ dlz_dlopen_init(isc_mem_t *mctx) {
result = ISC_R_UNEXPECTED;
}
return (result);
return result;
}
/*
+5 -5
View File
@@ -127,7 +127,7 @@ fuzz_thread_client(void *arg) {
named_server_flushonshutdown(named_g_server,
false);
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
return NULL;
}
raise(SIGSTOP);
goto next;
@@ -161,7 +161,7 @@ fuzz_thread_client(void *arg) {
named_server_flushonshutdown(named_g_server, false);
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
return NULL;
}
/*
@@ -375,7 +375,7 @@ fuzz_thread_resolver(void *arg) {
named_server_flushonshutdown(named_g_server,
false);
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
return NULL;
}
raise(SIGSTOP);
continue;
@@ -587,7 +587,7 @@ fuzz_thread_resolver(void *arg) {
__AFL_LOOP(0);
#endif /* ifdef __AFL_LOOP */
return (NULL);
return NULL;
}
/*
@@ -718,7 +718,7 @@ fuzz_thread_tcp(void *arg) {
named_server_flushonshutdown(named_g_server, false);
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
return NULL;
}
#endif /* ENABLE_AFL */
+3 -3
View File
@@ -43,7 +43,7 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"GeoIP2 database '%s/%s': path too long", dir,
dbfile);
return (NULL);
return NULL;
}
ret = MMDB_open(pathbuf, MMDB_MODE_MMAP, mmdb);
@@ -51,7 +51,7 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
"opened GeoIP2 database '%s'", pathbuf);
return (mmdb);
return mmdb;
}
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@@ -59,7 +59,7 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
"unable to open GeoIP2 database '%s' (status %d)",
pathbuf, ret);
return (NULL);
return NULL;
}
#endif /* HAVE_GEOIP2 */
+2 -3
View File
@@ -57,9 +57,8 @@ named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
const char *name, const cfg_obj_t **ret);
isc_result_t
named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
const cfg_obj_t *list, isc_mem_t *mctx,
dns_ipkeylist_t *ipkl);
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
isc_mem_t *mctx, dns_ipkeylist_t *ipkl);
isc_result_t
named_config_getport(const cfg_obj_t *config, const char *type,
+37 -34
View File
@@ -28,48 +28,51 @@
#define NAMED_CONTROL_PORT 953
#define NAMED_COMMAND_STOP "stop"
#define NAMED_COMMAND_HALT "halt"
#define NAMED_COMMAND_RELOAD "reload"
#define NAMED_COMMAND_RECONFIG "reconfig"
#define NAMED_COMMAND_REFRESH "refresh"
#define NAMED_COMMAND_RETRANSFER "retransfer"
#define NAMED_COMMAND_DUMPSTATS "stats"
#define NAMED_COMMAND_QUERYLOG "querylog"
#define NAMED_COMMAND_ADDZONE "addzone"
#define NAMED_COMMAND_DELZONE "delzone"
#define NAMED_COMMAND_DNSSEC "dnssec"
#define NAMED_COMMAND_DNSTAP "dnstap"
#define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
#define NAMED_COMMAND_DUMPDB "dumpdb"
#define NAMED_COMMAND_SECROOTS "secroots"
#define NAMED_COMMAND_TRACE "trace"
#define NAMED_COMMAND_NOTRACE "notrace"
#define NAMED_COMMAND_DUMPSTATS "stats"
#define NAMED_COMMAND_FETCHLIMIT "fetchlimit"
#define NAMED_COMMAND_FLUSH "flush"
#define NAMED_COMMAND_FLUSHNAME "flushname"
#define NAMED_COMMAND_FLUSHTREE "flushtree"
#define NAMED_COMMAND_STATUS "status"
#define NAMED_COMMAND_FREEZE "freeze"
#define NAMED_COMMAND_UNFREEZE "unfreeze"
#define NAMED_COMMAND_THAW "thaw"
#define NAMED_COMMAND_RECURSING "recursing"
#define NAMED_COMMAND_NULL "null"
#define NAMED_COMMAND_NOTIFY "notify"
#define NAMED_COMMAND_VALIDATION "validation"
#define NAMED_COMMAND_SCAN "scan"
#define NAMED_COMMAND_SIGN "sign"
#define NAMED_COMMAND_HALT "halt"
#define NAMED_COMMAND_LOADKEYS "loadkeys"
#define NAMED_COMMAND_ADDZONE "addzone"
#define NAMED_COMMAND_MODZONE "modzone"
#define NAMED_COMMAND_DELZONE "delzone"
#define NAMED_COMMAND_SHOWZONE "showzone"
#define NAMED_COMMAND_SYNC "sync"
#define NAMED_COMMAND_SIGNING "signing"
#define NAMED_COMMAND_DNSSEC "dnssec"
#define NAMED_COMMAND_ZONESTATUS "zonestatus"
#define NAMED_COMMAND_NTA "nta"
#define NAMED_COMMAND_TESTGEN "testgen"
#define NAMED_COMMAND_MEMPROF "memprof"
#define NAMED_COMMAND_MKEYS "managed-keys"
#define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
#define NAMED_COMMAND_DNSTAP "dnstap"
#define NAMED_COMMAND_TCPTIMEOUTS "tcp-timeouts"
#define NAMED_COMMAND_MODZONE "modzone"
#define NAMED_COMMAND_NOTIFY "notify"
#define NAMED_COMMAND_NOTRACE "notrace"
#define NAMED_COMMAND_NTA "nta"
#define NAMED_COMMAND_NULL "null"
#define NAMED_COMMAND_QUERYLOG "querylog"
#define NAMED_COMMAND_RECONFIG "reconfig"
#define NAMED_COMMAND_RECURSING "recursing"
#define NAMED_COMMAND_REFRESH "refresh"
#define NAMED_COMMAND_RELOAD "reload"
#define NAMED_COMMAND_RESPONSELOG "responselog"
#define NAMED_COMMAND_RETRANSFER "retransfer"
#define NAMED_COMMAND_SCAN "scan"
#define NAMED_COMMAND_SECROOTS "secroots"
#define NAMED_COMMAND_SERVESTALE "serve-stale"
#define NAMED_COMMAND_FETCHLIMIT "fetchlimit"
#define NAMED_COMMAND_SHOWZONE "showzone"
#define NAMED_COMMAND_SIGN "sign"
#define NAMED_COMMAND_SIGNING "signing"
#define NAMED_COMMAND_SKR "skr"
#define NAMED_COMMAND_STATUS "status"
#define NAMED_COMMAND_STOP "stop"
#define NAMED_COMMAND_SYNC "sync"
#define NAMED_COMMAND_TCPTIMEOUTS "tcp-timeouts"
#define NAMED_COMMAND_TESTGEN "testgen"
#define NAMED_COMMAND_THAW "thaw"
#define NAMED_COMMAND_TRACE "trace"
#define NAMED_COMMAND_UNFREEZE "unfreeze"
#define NAMED_COMMAND_VALIDATION "validation"
#define NAMED_COMMAND_ZONESTATUS "zonestatus"
isc_result_t
named_controls_create(named_server_t *server, named_controls_t **ctrlsp);
-2
View File
@@ -100,8 +100,6 @@ EXTERN const char *named_g_conffile INIT(NAMED_SYSCONFDIR "/named.conf");
EXTERN const char *named_g_defaultbindkeys INIT(NULL);
EXTERN const char *named_g_keyfile INIT(NAMED_SYSCONFDIR "/rndc.key");
EXTERN dns_tsigkey_t *named_g_sessionkey INIT(NULL);
EXTERN dns_name_t named_g_sessionkeyname;
EXTERN bool named_g_conffileset INIT(false);
EXTERN cfg_aclconfctx_t *named_g_aclconfctx INIT(NULL);
+5 -2
View File
@@ -39,10 +39,13 @@ void
named_os_inituserinfo(const char *username);
void
named_os_changeuser(void);
named_os_changeuser(bool permanent);
void
named_os_restoreuser(void);
uid_t
ns_os_uid(void);
named_os_uid(void);
void
named_os_adjustnofile(void);
+31 -3
View File
@@ -184,10 +184,20 @@ named_server_retransfercommand(named_server_t *server, isc_lex_t *lex,
*/
isc_result_t
named_server_togglequerylog(named_server_t *server, isc_lex_t *lex);
named_server_setortoggle(named_server_t *server, const char *optname,
unsigned int option, isc_lex_t *lex);
/*%<
* Enable/disable logging of queries. (Takes "yes" or "no" argument,
* but can also be used as a toggle for backward comptibility.)
* Enable/disable, or toggle, a server option via the command channel.
* 'option' is the option value to be changed (for example,
* NS_SERVER_LOGQUERIES or NS_SERVER_LOGRESPOSNES) and 'optname' is the
* option's human-readable name for logging purposes ("query logging"
* or "response logging").
*
* If an explicit argument to enable the option was provided
* (i.e., "on", "enable", "true", or "yes") or an explicit argument
* to disable it ("off", "disable", "false", or "no"), it will be used.
*
* If no argument is provided, the option's current state will be reversed.
*/
/*%
@@ -375,3 +385,21 @@ named_server_servestale(named_server_t *server, isc_lex_t *lex,
isc_result_t
named_server_fetchlimit(named_server_t *server, isc_lex_t *lex,
isc_buffer_t **text);
/*%
* Import SKR file for offline KSK signing.
*/
isc_result_t
named_server_skr(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
/*%
* Toggle memory profiling if supported.
*/
isc_result_t
named_server_togglememprof(isc_lex_t *lex);
/*%
* Get status of memory profiling.
*/
const char *
named_server_getmemprof(void);
+4 -4
View File
@@ -89,14 +89,14 @@ named_log_init(bool safe) {
named_log_setdefaultsslkeylogfile(lcfg);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
isc_log_destroy(&named_g_lctx);
isc_log_setcontext(NULL);
dns_log_setcontext(NULL);
return (result);
return result;
}
void
@@ -237,7 +237,7 @@ named_log_setdefaultcategory(isc_logconfig_t *lcfg) {
}
cleanup:
return (result);
return result;
}
isc_result_t
@@ -246,7 +246,7 @@ named_log_setunmatchedcategory(isc_logconfig_t *lcfg) {
result = isc_log_usechannel(lcfg, "null", NAMED_LOGCATEGORY_UNMATCHED,
NULL);
return (result);
return result;
}
void
+8 -8
View File
@@ -57,11 +57,11 @@ category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *logconfig) {
/*
* Allow further processing by returning success.
*/
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (logconfig == NULL) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
module = NULL;
@@ -80,10 +80,10 @@ category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *logconfig) {
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"logging channel '%s': %s", channelname,
isc_result_totext(result));
return (result);
return result;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -131,7 +131,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
"channel '%s': exactly one of file, syslog, "
"null, and stderr must be present",
channelname);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
type = ISC_LOG_TONULL;
@@ -310,7 +310,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
}
done:
return (result);
return result;
}
isc_result_t
@@ -365,8 +365,8 @@ named_logconfig(isc_logconfig_t *logconfig, const cfg_obj_t *logstmt) {
CHECK(named_log_setunmatchedcategory(logconfig));
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
return (result);
return result;
}
+11 -10
View File
@@ -313,7 +313,7 @@ usage(void) {
" [-S sockets] [-t chrootdir] [-u "
"username] [-U listeners]\n"
" [-m "
"{usage|trace|record|size|mctx}]\n"
"{usage|trace|record}]\n"
" [-M fill|nofill]\n"
"usage: named [-v|-V|-C]\n");
}
@@ -406,7 +406,7 @@ parse_int(char *arg, const char *desc) {
if (tmp < 0 || tmp != ltmp) {
named_main_earlyfatal("%s '%s' out of range", desc, arg);
}
return (tmp);
return tmp;
}
static struct flag_def {
@@ -949,6 +949,7 @@ parse_command_line(int argc, char *argv[]) {
break;
case 'U':
/* Obsolete. No longer in use. Ignore. */
named_main_earlywarning("option '-U' has been removed");
break;
case 'u':
named_g_username = isc_commandline_argument;
@@ -1042,7 +1043,7 @@ create_managers(void) {
isc_nm_maxudp(named_g_netmgr, maxudp);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -1436,7 +1437,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
UNEXPECTED_ERROR("scf_handle_create() failed: %s",
scf_strerror(scf_error()));
}
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
if (scf_handle_bind(h) == -1) {
@@ -1445,7 +1446,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
scf_strerror(scf_error()));
}
scf_handle_destroy(h);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
if ((namelen = scf_myname(h, NULL, 0)) == -1) {
@@ -1454,7 +1455,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
scf_strerror(scf_error()));
}
scf_handle_destroy(h);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
if ((instance = isc_mem_allocate(mctx, namelen + 1)) == NULL) {
@@ -1462,7 +1463,7 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
"allocation failed: %s",
isc_result_totext(ISC_R_NOMEMORY));
scf_handle_destroy(h);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
if (scf_myname(h, instance, namelen + 1) == -1) {
@@ -1472,12 +1473,12 @@ named_smf_get_instance(char **ins_name, int debug, isc_mem_t *mctx) {
}
scf_handle_destroy(h);
isc_mem_free(mctx, instance);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
scf_handle_destroy(h);
*ins_name = instance;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
#endif /* HAVE_LIBSCF */
@@ -1634,5 +1635,5 @@ main(int argc, char *argv[]) {
ProfilerStop();
#endif /* ifdef HAVE_GPERFTOOLS_PROFILER */
return (0);
return 0;
}
+3 -10
View File
@@ -21,7 +21,7 @@ named - Internet domain name server
Synopsis
~~~~~~~~
:program:`named` [ [**-4**] | [**-6**] ] [**-c** config-file] [**-C**] [**-d** debug-level] [**-D** string] [**-E** engine-name] [**-f**] [**-g**] [**-L** logfile] [**-M** option] [**-m** flag] [**-n** #cpus] [**-p** port] [**-s**] [**-t** directory] [**-U** #listeners] [**-u** user] [**-v**] [**-V**] ]
:program:`named` [ [**-4**] | [**-6**] ] [**-c** config-file] [**-C**] [**-d** debug-level] [**-D** string] [**-E** engine-name] [**-f**] [**-g**] [**-L** logfile] [**-M** option] [**-m** flag] [**-n** #cpus] [**-p** port] [**-s**] [**-t** directory] [**-u** user] [**-v**] [**-V**] ]
Description
~~~~~~~~~~~
@@ -117,7 +117,7 @@ Options
.. option:: -m flag
This option turns on memory usage debugging flags. Possible flags are ``usage``,
``trace``, ``record``, ``size``, and ``mctx``. These correspond to the
``trace`` and ``record``. These correspond to the
``ISC_MEM_DEBUGXXXX`` flags described in ``<isc/mem.h>``.
.. option:: -n #cpus
@@ -163,14 +163,7 @@ Options
.. option:: -U #listeners
This option tells :program:`named` the number of ``#listeners`` worker threads to listen on, for incoming UDP packets on
each address. If not specified, :program:`named` calculates a default
value based on the number of detected CPUs: 1 for 1 CPU, and the
number of detected CPUs minus one for machines with more than 1 CPU.
This cannot be increased to a value higher than the number of CPUs.
If :option:`-n` has been set to a higher value than the number of detected
CPUs, then :option:`-U` may be increased as high as that value, but no
higher.
This option has been removed. Attempts to use it now result in a warning.
.. option:: -u user
+51 -139
View File
@@ -61,6 +61,9 @@ static struct passwd *runas_pw = NULL;
static bool done_setuid = false;
static int dfd[2] = { -1, -1 };
static uid_t saved_uid = (uid_t)-1;
static gid_t saved_gid = (gid_t)-1;
#if HAVE_LIBCAP
static bool non_root = false;
@@ -249,115 +252,6 @@ linux_keepcaps(void) {
#endif /* HAVE_LIBCAP */
/*
* First define compatibility shims if {set,get}res{uid,gid} are not available
*/
#if !HAVE_GETRESGID
static int
getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) {
*rgid = -1;
*egid = getegid();
*sgid = -1;
return (0);
}
#endif /* !HAVE_GETRESGID */
#if !HAVE_SETRESGID
static int
setresgid(gid_t rgid, gid_t egid, gid_t sgid) {
REQUIRE(rgid == (gid_t)-1);
REQUIRE(sgid == (gid_t)-1);
#if HAVE_SETREGID
return (setregid(rgid, egid));
#else /* HAVE_SETREGID */
return (setegid(egid));
#endif /* HAVE_SETREGID */
}
#endif /* !HAVE_SETRESGID */
#if !HAVE_GETRESUID
static int
getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) {
*ruid = -1;
*euid = geteuid();
*suid = -1;
return (0);
}
#endif /* !HAVE_GETRESUID */
#if !HAVE_SETRESUID
static int
setresuid(uid_t ruid, uid_t euid, uid_t suid) {
REQUIRE(ruid == (uid_t)-1);
REQUIRE(suid == (uid_t)-1);
#if HAVE_SETREGID
return (setregid(ruid, euid));
#else /* HAVE_SETREGID */
return (setegid(euid));
#endif /* HAVE_SETREGID */
}
#endif /* !HAVE_SETRESUID */
static int
set_effective_gid(gid_t gid) {
gid_t oldgid;
if (getresgid(&(gid_t){ 0 }, &oldgid, &(gid_t){ 0 }) == -1) {
return (-1);
}
if (oldgid == gid) {
return (0);
}
if (setresgid(-1, gid, -1) == -1) {
return (-1);
}
if (getresgid(&(gid_t){ 0 }, &oldgid, &(gid_t){ 0 }) == -1) {
return (-1);
}
if (oldgid != gid) {
return (-1);
}
return (0);
}
static int
set_effective_uid(uid_t uid) {
uid_t olduid;
if (getresuid(&(uid_t){ 0 }, &olduid, &(uid_t){ 0 }) == -1) {
return (-1);
}
if (olduid == uid) {
return (0);
}
if (setresuid(-1, uid, -1) == -1) {
return (-1);
}
if (getresuid(&(uid_t){ 0 }, &olduid, &(uid_t){ 0 }) == -1) {
return (-1);
}
if (olduid != uid) {
return (-1);
}
/* Success */
return (0);
}
static void
setperms(uid_t uid, gid_t gid) {
char strbuf[ISC_STRERRORSIZE];
@@ -366,13 +260,13 @@ setperms(uid_t uid, gid_t gid) {
* Drop the gid privilege first, because in some cases the gid privilege
* cannot be dropped after the uid privilege has been dropped.
*/
if (set_effective_gid(gid) == -1) {
if (setegid(gid) == -1) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective gid to %d: %s",
gid, strbuf);
}
if (set_effective_uid(uid) == -1) {
if (seteuid(uid) == -1) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("unable to set effective uid to %d: %s",
uid, strbuf);
@@ -506,15 +400,15 @@ named_os_closedevnull(void) {
static bool
all_digits(const char *s) {
if (*s == '\0') {
return (false);
return false;
}
while (*s != '\0') {
if (!isdigit((unsigned char)(*s))) {
return (false);
return false;
}
s++;
}
return (true);
return true;
}
void
@@ -570,20 +464,41 @@ named_os_inituserinfo(const char *username) {
}
void
named_os_changeuser(void) {
named_os_restoreuser(void) {
if (runas_pw == NULL || done_setuid) {
return;
}
REQUIRE(saved_uid != (uid_t)-1);
REQUIRE(saved_gid != (gid_t)-1);
setperms(saved_uid, saved_gid);
}
void
named_os_changeuser(bool permanent) {
char strbuf[ISC_STRERRORSIZE];
if (runas_pw == NULL || done_setuid) {
return;
}
if (!permanent) {
saved_uid = getuid();
saved_gid = getgid();
setperms(runas_pw->pw_uid, runas_pw->pw_gid);
return;
}
done_setuid = true;
if (setgid(runas_pw->pw_gid) < 0) {
if (setgid(runas_pw->pw_gid) == -1) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("setgid(): %s", strbuf);
}
if (setuid(runas_pw->pw_uid) < 0) {
if (setuid(runas_pw->pw_uid) == -1) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlyfatal("setuid(): %s", strbuf);
}
@@ -604,11 +519,11 @@ named_os_changeuser(void) {
}
uid_t
ns_os_uid(void) {
named_os_uid(void) {
if (runas_pw == NULL) {
return (0);
return 0;
}
return (runas_pw->pw_uid);
return runas_pw->pw_uid;
}
void
@@ -660,7 +575,7 @@ void
named_os_minprivs(void) {
#if HAVE_LIBCAP
linux_keepcaps();
named_os_changeuser();
named_os_changeuser(true);
linux_minprivs();
#endif /* HAVE_LIBCAP */
}
@@ -672,22 +587,22 @@ safe_open(const char *filename, mode_t mode, bool append) {
if (stat(filename, &sb) == -1) {
if (errno != ENOENT) {
return (-1);
return -1;
}
} else if ((sb.st_mode & S_IFREG) == 0) {
errno = EOPNOTSUPP;
return (-1);
return -1;
}
if (append) {
fd = open(filename, O_WRONLY | O_CREAT | O_APPEND, mode);
} else {
if (unlink(filename) < 0 && errno != ENOENT) {
return (-1);
return -1;
}
fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, mode);
}
return (fd);
return fd;
}
static void
@@ -735,7 +650,7 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) {
!strcmp(slash + 1, ".."))
{
*slash = '/';
return (0);
return 0;
}
mode = S_IRUSR | S_IWUSR | S_IXUSR; /* u=rwx */
mode |= S_IRGRP | S_IXGRP; /* g=rx */
@@ -757,11 +672,11 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) {
}
*slash = '/';
}
return (0);
return 0;
error:
*slash = '/';
return (-1);
return -1;
}
FILE *
@@ -778,28 +693,25 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("couldn't strdup() '%s': %s", filename,
strbuf);
return (NULL);
return NULL;
}
if (mkdirpath(f, named_main_earlywarning) == -1) {
free(f);
return (NULL);
return NULL;
}
free(f);
if (switch_user && runas_pw != NULL) {
uid_t olduid = getuid();
gid_t oldgid = getgid();
/*
* Set UID/GID to the one we'll be running with
* Temporarily set UID/GID to the one we'll be running with
* eventually.
*/
setperms(runas_pw->pw_uid, runas_pw->pw_gid);
named_os_changeuser(false);
fd = safe_open(filename, mode, false);
/* Restore UID/GID to previous uid/gid */
setperms(olduid, oldgid);
named_os_restoreuser();
if (fd == -1) {
fd = safe_open(filename, mode, false);
@@ -825,7 +737,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
strerror_r(errno, strbuf, sizeof(strbuf));
named_main_earlywarning("could not open file '%s': %s",
filename, strbuf);
return (NULL);
return NULL;
}
fp = fdopen(fd, "w");
@@ -835,7 +747,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
filename, strbuf);
}
return (fp);
return fp;
}
void
@@ -951,5 +863,5 @@ named_os_uname(void) {
if (unamep == NULL) {
getuname();
}
return (unamep);
return unamep;
}
+1221 -544
View File
File diff suppressed because it is too large Load Diff
+100 -76
View File
@@ -126,19 +126,19 @@ user_zonetype(dns_zone_t *zone) {
const struct zt *tp;
if ((dns_zone_getoptions(zone) & DNS_ZONEOPT_AUTOEMPTY) != 0) {
return ("builtin");
return "builtin";
}
view = dns_zone_getview(zone);
if (view != NULL && strcmp(view->name, "_bind") == 0) {
return ("builtin");
return "builtin";
}
ztype = dns_zone_gettype(zone);
for (tp = typemap; tp->string != NULL && tp->type != ztype; tp++) {
/* empty */
}
return (tp->string);
return tp->string;
}
#endif /* ifdef EXTENDED_STATS */
@@ -251,7 +251,7 @@ get_histo_desc(const char *prefix, int i, int inf, bool ext) {
}
INSIST(0 < len && (size_t)len < space);
used += len + 1;
return (desc);
return desc;
}
static void
@@ -327,6 +327,8 @@ init_desc(void) {
SET_NSSTATDESC(updatebadprereq,
"updates rejected due to prerequisite failure",
"UpdateBadPrereq");
SET_NSSTATDESC(recurshighwater, "Recursive clients high-water",
"RecursHighwater");
SET_NSSTATDESC(recursclients, "recursing clients", "RecursClients");
SET_NSSTATDESC(dns64, "queries answered by DNS64", "DNS64");
SET_NSSTATDESC(ratedropped, "responses dropped for rate limits",
@@ -812,8 +814,8 @@ dump_stats(isc_stats_t *stats, isc_statsformat_t type, void *arg,
memset(values, 0, sizeof(values[0]) * ncounters);
isc_stats_dump(stats, generalstat_dump, &dumparg, options);
return (dump_counters(type, arg, category, desc, ncounters, indices,
values, options));
return dump_counters(type, arg, category, desc, ncounters, indices,
values, options);
}
#if defined(EXTENDED_STATS)
@@ -829,8 +831,8 @@ dump_histo(isc_histomulti_t *hm, isc_statsformat_t type, void *arg,
}
isc_histo_destroy(&hg);
return (dump_counters(type, arg, category, desc, ncounters, indices,
values, options));
return dump_counters(type, arg, category, desc, ncounters, indices,
values, options);
}
#endif /* defined(EXTENDED_STATS) */
@@ -859,7 +861,7 @@ dump_counters(isc_statsformat_t type, void *arg, const char *category,
if (category != NULL) {
cat = json_object_new_object();
if (cat == NULL) {
return (ISC_R_NOMEMORY);
return ISC_R_NOMEMORY;
}
json_object_object_add(job, category, cat);
}
@@ -924,20 +926,20 @@ dump_counters(isc_statsformat_t type, void *arg, const char *category,
#ifdef HAVE_JSON_C
counter = json_object_new_int64(value);
if (counter == NULL) {
return (ISC_R_NOMEMORY);
return ISC_R_NOMEMORY;
}
json_object_object_add(cat, desc[idx], counter);
#endif /* ifdef HAVE_JSON_C */
break;
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
#ifdef HAVE_LIBXML2
cleanup:
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"failed at dump_counters()");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
#endif /* ifdef HAVE_LIBXML2 */
}
@@ -1007,7 +1009,7 @@ cleanup:
static bool
rdatastatstype_attr(dns_rdatastatstype_t type, unsigned int attr) {
return ((DNS_RDATASTATSTYPE_ATTR(type) & attr) != 0);
return (DNS_RDATASTATSTYPE_ATTR(type) & attr) != 0;
}
static void
@@ -1291,7 +1293,7 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
statlevel = dns_zone_getstatlevel(zone);
if (statlevel == dns_zonestat_none) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
dumparg.type = isc_statsformat_xml;
@@ -1448,12 +1450,12 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
TRY0(xmlTextWriterEndElement(writer)); /* zone */
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"Failed at zone_xmlrender()");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
static isc_result_t
@@ -1479,7 +1481,7 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
statlevel = dns_zone_getstatlevel(zone);
if (statlevel == dns_zonestat_none) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (dns_zone_getxfr(zone, &xfr, &is_firstrefresh, &is_running,
@@ -1491,7 +1493,7 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
* (if any), but we still want to continue generating the
* remaining parts of the output.
*/
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (!is_running && !is_deferred && !is_presoa && !is_pending &&
@@ -1501,12 +1503,12 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
dns_xfrin_detach(&xfr);
}
/* No ongoing/queued transfer. */
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (is_running && xfr == NULL) {
/* The transfer is finished, and it's shutting down. */
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "xfrin"));
@@ -1716,7 +1718,7 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
dns_xfrin_detach(&xfr);
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
if (xfr != NULL) {
@@ -1727,7 +1729,7 @@ cleanup:
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"Failed at xfrin_xmlrender()");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
static isc_result_t
@@ -2129,7 +2131,7 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
xmlFreeTextWriter(writer);
xmlFreeDoc(doc);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@@ -2141,7 +2143,7 @@ cleanup:
if (doc != NULL) {
xmlFreeDoc(doc);
}
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
static void
@@ -2176,7 +2178,7 @@ render_xml(uint32_t flags, void *arg, unsigned int *retcode,
"failed at rendering XML()");
}
return (result);
return result;
}
static isc_result_t
@@ -2186,8 +2188,8 @@ render_xml_all(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_ALL, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_ALL, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2197,8 +2199,8 @@ render_xml_status(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_STATUS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_STATUS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2208,8 +2210,8 @@ render_xml_server(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_SERVER, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_SERVER, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2219,8 +2221,8 @@ render_xml_zones(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_ZONES, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_ZONES, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2230,8 +2232,8 @@ render_xml_xfrins(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_XFRINS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_XFRINS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2241,8 +2243,8 @@ render_xml_net(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_NET, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_NET, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2252,8 +2254,8 @@ render_xml_mem(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_MEM, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_MEM, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -2263,8 +2265,8 @@ render_xml_traffic(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_xml(STATS_XML_TRAFFIC, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_xml(STATS_XML_TRAFFIC, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
#endif /* HAVE_LIBXML2 */
@@ -2304,7 +2306,7 @@ addzone(char *name, char *classname, const char *ztype, uint32_t serial,
json_object *node = json_object_new_object();
if (node == NULL) {
return (NULL);
return NULL;
}
json_object_object_add(node, "name", json_object_new_string(name));
@@ -2318,7 +2320,7 @@ addzone(char *name, char *classname, const char *ztype, uint32_t serial,
json_object_object_add(node, "type",
json_object_new_string(ztype));
}
return (node);
return node;
}
static isc_result_t
@@ -2337,7 +2339,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
statlevel = dns_zone_getstatlevel(zone);
if (statlevel == dns_zonestat_none) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
dns_zone_nameonly(zone, buf, sizeof(buf));
@@ -2356,7 +2358,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
}
if (zoneobj == NULL) {
return (ISC_R_NOMEMORY);
return ISC_R_NOMEMORY;
}
/*
@@ -2524,7 +2526,7 @@ cleanup:
if (zoneobj != NULL) {
json_object_put(zoneobj);
}
return (result);
return result;
}
static isc_result_t
@@ -2553,7 +2555,7 @@ xfrin_jsonrender(dns_zone_t *zone, void *arg) {
statlevel = dns_zone_getstatlevel(zone);
if (statlevel == dns_zonestat_none) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
dns_zone_nameonly(zone, buf, sizeof(buf));
@@ -2778,7 +2780,7 @@ cleanup:
if (xfrinobj != NULL) {
json_object_put(xfrinobj);
}
return (result);
return result;
}
static isc_result_t
@@ -2816,7 +2818,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
bindstats = json_object_new_object();
if (bindstats == NULL) {
return (ISC_R_NOMEMORY);
return ISC_R_NOMEMORY;
}
/*
@@ -3349,7 +3351,7 @@ cleanup:
json_object_put(bindstats);
}
return (result);
return result;
}
static isc_result_t
@@ -3379,7 +3381,7 @@ render_json(uint32_t flags, void *arg, unsigned int *retcode,
"failed at rendering JSON()");
}
return (result);
return result;
}
static isc_result_t
@@ -3389,8 +3391,8 @@ render_json_all(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_ALL, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_json(STATS_JSON_ALL, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3400,8 +3402,8 @@ render_json_status(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_STATUS, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args));
return render_json(STATS_JSON_STATUS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3411,8 +3413,8 @@ render_json_server(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_SERVER, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args));
return render_json(STATS_JSON_SERVER, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3422,8 +3424,8 @@ render_json_zones(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_ZONES, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_json(STATS_JSON_ZONES, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3433,8 +3435,8 @@ render_json_xfrins(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_XFRINS, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args));
return render_json(STATS_JSON_XFRINS, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3444,8 +3446,8 @@ render_json_mem(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_MEM, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_json(STATS_JSON_MEM, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3455,8 +3457,8 @@ render_json_net(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_NET, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args));
return render_json(STATS_JSON_NET, arg, retcode, retmsg, mimetype, b,
freecb, freecb_args);
}
static isc_result_t
@@ -3466,12 +3468,17 @@ render_json_traffic(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) {
UNUSED(httpd);
UNUSED(urlinfo);
return (render_json(STATS_JSON_TRAFFIC, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args));
return render_json(STATS_JSON_TRAFFIC, arg, retcode, retmsg, mimetype,
b, freecb, freecb_args);
}
#endif /* HAVE_JSON_C */
#if HAVE_LIBXML2
/*
* This is only needed if we have libxml2 and was confusingly returned if
* neither of libxml2 or json-c is configured.
*/
static isc_result_t
render_xsl(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo, void *args,
unsigned int *retcode, const char **retmsg, const char **mimetype,
@@ -3525,8 +3532,9 @@ send:
isc_buffer_reinit(b, p, strlen(xslmsg));
isc_buffer_add(b, strlen(xslmsg));
end:
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
#endif
static void
shutdown_listener(named_statschannel_t *listener) {
@@ -3539,6 +3547,7 @@ shutdown_listener(named_statschannel_t *listener) {
isc_httpdmgr_shutdown(&listener->httpdmgr);
}
#if defined(HAVE_LIBXML2) || defined(HAVE_JSON_C)
static bool
client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
named_statschannel_t *listener = arg;
@@ -3558,7 +3567,7 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
match > 0)
{
UNLOCK(&listener->lock);
return (true);
return true;
}
UNLOCK(&listener->lock);
@@ -3567,9 +3576,11 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
"rejected statistics connection from %s", socktext);
return (false);
return false;
}
#endif
#if defined(HAVE_LIBXML2) || defined(HAVE_JSON_C)
static void
destroy_listener(void *arg) {
named_statschannel_t *listener = (named_statschannel_t *)arg;
@@ -3583,12 +3594,24 @@ destroy_listener(void *arg) {
isc_mutex_destroy(&listener->lock);
isc_mem_putanddetach(&listener->mctx, listener, sizeof(*listener));
}
#endif
static isc_result_t
add_listener(named_server_t *server, named_statschannel_t **listenerp,
const cfg_obj_t *listen_params, const cfg_obj_t *config,
isc_sockaddr_t *addr, cfg_aclconfctx_t *aclconfctx,
const char *socktext) {
#if !defined(HAVE_LIBXML2) && !defined(HAVE_JSON_C)
UNUSED(server);
UNUSED(listenerp);
UNUSED(listen_params);
UNUSED(config);
UNUSED(addr);
UNUSED(aclconfctx);
UNUSED(socktext);
return ISC_R_NOTIMPLEMENTED;
#else
isc_result_t result;
named_statschannel_t *listener = NULL;
const cfg_obj_t *allow = NULL;
@@ -3654,6 +3677,8 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
isc_httpdmgr_addurl(listener->httpdmgr,
"/xml/v" STATS_XML_VERSION_MAJOR "/traffic", false,
render_xml_traffic, server);
isc_httpdmgr_addurl(listener->httpdmgr, "/bind9.xsl", true, render_xsl,
server);
#endif /* ifdef HAVE_LIBXML2 */
#ifdef HAVE_JSON_C
isc_httpdmgr_addurl(listener->httpdmgr, "/json", false, render_json_all,
@@ -3683,15 +3708,13 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
"/json/v" STATS_JSON_VERSION_MAJOR "/traffic",
false, render_json_traffic, server);
#endif /* ifdef HAVE_JSON_C */
isc_httpdmgr_addurl(listener->httpdmgr, "/bind9.xsl", true, render_xsl,
server);
*listenerp = listener;
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_NOTICE,
"statistics channel listening on %s", socktext);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
if (listener->acl != NULL) {
@@ -3700,7 +3723,8 @@ cleanup:
isc_mutex_destroy(&listener->lock);
isc_mem_putanddetach(&listener->mctx, listener, sizeof(*listener));
return (result);
return result;
#endif
}
static void
@@ -3895,7 +3919,7 @@ named_statschannels_configure(named_server_t *server, const cfg_obj_t *config,
}
ISC_LIST_APPENDLIST(server->statschannels, new_listeners, link);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
void
@@ -4133,5 +4157,5 @@ named_stats_dump(named_server_t *server, FILE *fp) {
fprintf(fp, "--- Statistics Dump --- (%lu)\n", (unsigned long)now);
return (ISC_R_SUCCESS); /* this function currently always succeeds */
return ISC_R_SUCCESS; /* this function currently always succeeds */
}
+3 -3
View File
@@ -55,7 +55,7 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
result = dns_tkeyctx_create(mctx, &tctx);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
obj = NULL;
@@ -91,9 +91,9 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
}
*tctxp = tctx;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
dns_tkeyctx_destroy(&tctx);
return (result);
return result;
}
+7 -7
View File
@@ -131,13 +131,13 @@ add_doh_transports(const cfg_obj_t *transportlist, dns_transport_list_t *list) {
dns_transport_set_remote_hostname);
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
cfg_obj_log(doh, named_g_lctx, ISC_LOG_ERROR,
"configuring DoH '%s': %s", dohid,
isc_result_totext(result));
return (result);
return result;
}
static isc_result_t
@@ -185,13 +185,13 @@ add_tls_transports(const cfg_obj_t *transportlist, dns_transport_list_t *list) {
dns_transport_set_remote_hostname);
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
cfg_obj_log(tls, named_g_lctx, ISC_LOG_ERROR,
"configuring tls '%s': %s", tlsid,
isc_result_totext(result));
return (result);
return result;
}
#define CHECK(f) \
@@ -218,7 +218,7 @@ transport_list_fromconfig(const cfg_obj_t *config, dns_transport_list_t *list) {
obj = NULL;
}
return (result);
return result;
}
static void
@@ -260,8 +260,8 @@ named_transports_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
}
*listp = list;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
dns_transport_list_detach(&list);
return (result);
return result;
}
+4 -4
View File
@@ -123,7 +123,7 @@ add_initial_keys(const cfg_obj_t *list, dns_tsigkeyring_t *ring,
dns_tsigkey_detach(&tsigkey);
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
if (secret != NULL) {
@@ -131,7 +131,7 @@ failure:
}
cfg_obj_log(key, named_g_lctx, ISC_LOG_ERROR,
"configuring key '%s': %s", keyid, isc_result_totext(ret));
return (ret);
return ret;
}
isc_result_t
@@ -172,9 +172,9 @@ named_tsigkeyring_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
}
*ringp = ring;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
failure:
dns_tsigkeyring_detach(&ring);
return (result);
return result;
}
+65 -54
View File
@@ -61,13 +61,6 @@ typedef enum {
allow_update_forwarding
} acl_type_t;
#define RETERR(x) \
do { \
isc_result_t _r = (x); \
if (_r != ISC_R_SUCCESS) \
return ((_r)); \
} while (0)
#define CHECK(x) \
do { \
result = (x); \
@@ -148,7 +141,7 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
/* Failing that, see if there's a default ACL already in the view */
if (aclp != NULL && *aclp != NULL) {
(*setzacl)(zone, *aclp);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/* Check for default ACLs that haven't been parsed yet */
@@ -171,14 +164,14 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
(void)named_config_get(maps, aclname, &aclobj);
if (aclobj == NULL) {
(*clearzacl)(zone);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
parse_acl:
result = cfg_acl_fromconfig(aclobj, config, named_g_lctx, actx,
named_g_mctx, 0, &acl);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
(*setzacl)(zone, acl);
@@ -188,7 +181,7 @@ parse_acl:
}
dns_acl_detach(&acl);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -208,7 +201,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
if (updatepolicy == NULL) {
dns_zone_setssutable(zone, NULL);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (cfg_obj_isstring(updatepolicy) &&
@@ -376,7 +369,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
cleanup:
dns_ssutable_detach(&table);
return (result);
return result;
}
/*
@@ -418,7 +411,7 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
cfg_obj_log(zconfig, named_g_lctx, ISC_LOG_ERROR,
"port is not configurable for "
"static stub server-addresses");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
isc_netaddr_fromsockaddr(&na, sa);
if (isc_netaddr_getzone(&na) != 0) {
@@ -426,7 +419,7 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
"scoped address is not allowed "
"for static stub "
"server-addresses");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
switch (na.family) {
@@ -457,7 +450,7 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
if (ISC_LIST_EMPTY(rdatalist_a->rdata) &&
ISC_LIST_EMPTY(rdatalist_aaaa->rdata))
{
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/* Add to the list an apex NS with the ns name being the origin name */
@@ -471,7 +464,7 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
&region);
ISC_LIST_APPEND(rdatalist_ns->rdata, rdata, link);
return (result);
return result;
}
/*%
@@ -512,14 +505,14 @@ configure_staticstub_servernames(const cfg_obj_t *zconfig, dns_zone_t *zone,
"server-name '%s' is not a valid "
"name",
str);
return (result);
return result;
}
if (dns_name_issubdomain(nsname, dns_zone_getorigin(zone))) {
cfg_obj_log(zconfig, named_g_lctx, ISC_LOG_ERROR,
"server-name '%s' must not be a "
"subdomain of zone name '%s'",
str, zname);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
dns_name_toregion(nsname, &sregion);
@@ -533,7 +526,7 @@ configure_staticstub_servernames(const cfg_obj_t *zconfig, dns_zone_t *zone,
ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
}
return (result);
return result;
}
/*%
@@ -558,9 +551,12 @@ configure_staticstub(const cfg_obj_t *zconfig, dns_zone_t *zone,
isc_region_t region;
/* Create the DB beforehand */
RETERR(dns_db_create(mctx, dbtype, dns_zone_getorigin(zone),
dns_dbtype_stub, dns_zone_getclass(zone), 0, NULL,
&db));
result = dns_db_create(mctx, dbtype, dns_zone_getorigin(zone),
dns_dbtype_stub, dns_zone_getclass(zone), 0,
NULL, &db);
if (result != ISC_R_SUCCESS) {
return result;
}
dns_rdataset_init(&rdataset);
@@ -673,7 +669,7 @@ cleanup:
INSIST(dbversion == NULL);
return (result);
return result;
}
/*%
@@ -686,7 +682,7 @@ zonetype_fromconfig(const cfg_obj_t *map) {
result = cfg_map_get(map, "type", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
return (named_config_getzonetype(obj));
return named_config_getzonetype(obj);
}
/*%
@@ -717,11 +713,11 @@ strtoargvsub(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp,
result = strtoargvsub(mctx, p, argcp, argvp, n + 1);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
(*argvp)[n] = s;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*%
@@ -733,7 +729,7 @@ strtoargvsub(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp,
*/
static isc_result_t
strtoargv(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp) {
return (strtoargvsub(mctx, s, argcp, argvp, 0));
return strtoargvsub(mctx, s, argcp, argvp, 0);
}
static const char *const primary_synonyms[] = { "primary", "master", NULL };
@@ -780,12 +776,12 @@ isself(dns_view_t *myview, dns_tsigkey_t *mykey, const isc_sockaddr_t *srcaddr,
/* interfacemgr can be destroyed only in exclusive mode. */
if (named_g_server->interfacemgr == NULL) {
return (true);
return true;
}
if (!ns_interfacemgr_listeningon(named_g_server->interfacemgr, dstaddr))
{
return (false);
return false;
}
isc_netaddr_fromsockaddr(&netsrc, srcaddr);
@@ -828,7 +824,7 @@ isself(dns_view_t *myview, dns_tsigkey_t *mykey, const isc_sockaddr_t *srcaddr,
break;
}
}
return (view == myview);
return view == myview;
}
/*%
@@ -846,7 +842,7 @@ process_notifytype(dns_notifytype_t ntype, dns_zonetype_t ztype,
* zone is configured with something else than "notify yes;".
*/
if (ztype != dns_zone_mirror || ntype != dns_notifytype_yes) {
return (ntype);
return ntype;
}
/*
@@ -860,7 +856,7 @@ process_notifytype(dns_notifytype_t ntype, dns_zonetype_t ztype,
zname);
}
return (dns_notifytype_explicit);
return dns_notifytype_explicit;
}
isc_result_t
@@ -1074,6 +1070,22 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_zone_setmaxrecords(zone, 0);
}
obj = NULL;
result = named_config_get(maps, "max-records-per-type", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
dns_zone_setmaxrrperset(mayberaw, cfg_obj_asuint32(obj));
if (zone != mayberaw) {
dns_zone_setmaxrrperset(zone, 0);
}
obj = NULL;
result = named_config_get(maps, "max-types-per-name", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
dns_zone_setmaxtypepername(mayberaw, cfg_obj_asuint32(obj));
if (zone != mayberaw) {
dns_zone_setmaxtypepername(zone, 0);
}
if (raw != NULL && filename != NULL) {
#define SIGNED ".signed"
size_t signedlen = strlen(filename) + sizeof(SIGNED);
@@ -1270,8 +1282,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_ipkeylist_t ipkl;
dns_ipkeylist_init(&ipkl);
CHECK(named_config_getipandkeylist(config, "primaries",
obj, mctx, &ipkl));
CHECK(named_config_getipandkeylist(config, obj, mctx,
&ipkl));
dns_zone_setalsonotify(zone, ipkl.addrs, ipkl.sources,
ipkl.keys, ipkl.tlss,
ipkl.count);
@@ -1626,9 +1638,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
if (parentals != NULL) {
dns_ipkeylist_t ipkl;
dns_ipkeylist_init(&ipkl);
CHECK(named_config_getipandkeylist(
config, "parental-agents", parentals, mctx,
&ipkl));
CHECK(named_config_getipandkeylist(config, parentals,
mctx, &ipkl));
dns_zone_setparentals(zone, ipkl.addrs, ipkl.sources,
ipkl.keys, ipkl.tlss, ipkl.count);
dns_ipkeylist_clear(mctx, &ipkl);
@@ -1800,7 +1811,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_name_equal(dns_zone_getorigin(zone), dns_rootname))
{
result = named_config_getremotesdef(
named_g_config, "primaries",
named_g_config, "remote-servers",
DEFAULT_IANA_ROOT_ZONE_PRIMARIES, &obj);
CHECK(result);
}
@@ -1808,8 +1819,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
dns_ipkeylist_t ipkl;
dns_ipkeylist_init(&ipkl);
CHECK(named_config_getipandkeylist(config, "primaries",
obj, mctx, &ipkl));
CHECK(named_config_getipandkeylist(config, obj, mctx,
&ipkl));
dns_zone_setprimaries(mayberaw, ipkl.addrs,
ipkl.sources, ipkl.keys,
ipkl.tlss, ipkl.count);
@@ -1896,7 +1907,7 @@ cleanup:
if (kasp != NULL) {
dns_kasp_detach(&kasp);
}
return (result);
return result;
}
/*
@@ -1911,11 +1922,11 @@ named_zone_configure_writeable_dlz(dns_dlzdb_t *dlzdatabase, dns_zone_t *zone,
dns_zone_settype(zone, dns_zone_dlz);
result = dns_sdlz_setdb(dlzdatabase, rdclass, name, &db);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = dns_zone_dlzpostload(zone, db);
dns_db_detach(&db);
return (result);
return result;
}
bool
@@ -1939,7 +1950,7 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig,
if (zonetype_fromconfig(zoptions) == dns_zone_staticstub) {
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"not reusable: staticstub");
return (false);
return false;
}
/* If there's a raw zone, use that for filename and type comparison */
@@ -1960,17 +1971,17 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig,
if (!inline_signing && has_raw) {
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"not reusable: old zone was inline-signing");
return (false);
return false;
} else if (inline_signing && !has_raw) {
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"not reusable: old zone was not inline-signing");
return (false);
return false;
}
if (zonetype_fromconfig(zoptions) != ztype) {
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"not reusable: type mismatch");
return (false);
return false;
}
obj = NULL;
@@ -1986,10 +1997,10 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig,
{
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"not reusable: filename mismatch");
return (false);
return false;
}
return (true);
return true;
}
bool
@@ -2023,13 +2034,13 @@ named_zone_inlinesigning(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
if (res != ISC_R_SUCCESS ||
strcmp(cfg_obj_asstring(policy), "none") == 0)
{
return (false);
return false;
}
/* Lookup the policy. */
res = dns_kasplist_find(kasplist, cfg_obj_asstring(policy), &kasp);
if (res != ISC_R_SUCCESS) {
return (false);
return false;
}
inline_signing = dns_kasp_inlinesigning(kasp);
@@ -2042,8 +2053,8 @@ named_zone_inlinesigning(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
*/
res = cfg_map_get(maps[0], "inline-signing", &signing);
if (res == ISC_R_SUCCESS && cfg_obj_isboolean(signing)) {
return (cfg_obj_asboolean(signing));
return cfg_obj_asboolean(signing);
}
return (inline_signing);
return inline_signing;
}
+123 -123
View File
@@ -256,7 +256,7 @@ getzoneclass(void) {
if (zoneclass == dns_rdataclass_none) {
zoneclass = defaultclass;
}
return (zoneclass);
return zoneclass;
}
static bool
@@ -266,9 +266,9 @@ setzoneclass(dns_rdataclass_t rdclass) {
zoneclass = rdclass;
}
if (zoneclass != rdclass) {
return (false);
return false;
}
return (true);
return true;
}
static void
@@ -332,7 +332,7 @@ nsu_strsep(char **stringp, const char *delim) {
char sc, dc;
if (string == NULL) {
return (NULL);
return NULL;
}
for (; *string != '\0'; string++) {
@@ -353,11 +353,11 @@ nsu_strsep(char **stringp, const char *delim) {
if (sc == dc) {
*s++ = '\0';
*stringp = s;
return (string);
return string;
}
}
}
return (string);
return string;
}
static void
@@ -393,7 +393,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
if (len >= sizeof(buf)) {
error("unknown key type '%.*s'", (int)(len), hmacstr);
return (false);
return false;
}
/* Copy len bytes and NUL terminate. */
@@ -406,7 +406,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[9], 10);
if (result != ISC_R_SUCCESS || digestbits > 128) {
error("digest-bits out of range [0..128]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else if (strcasecmp(buf, "hmac-sha1") == 0) {
@@ -416,7 +416,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[10], 10);
if (result != ISC_R_SUCCESS || digestbits > 160) {
error("digest-bits out of range [0..160]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else if (strcasecmp(buf, "hmac-sha224") == 0) {
@@ -426,7 +426,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[12], 10);
if (result != ISC_R_SUCCESS || digestbits > 224) {
error("digest-bits out of range [0..224]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else if (strcasecmp(buf, "hmac-sha256") == 0) {
@@ -436,7 +436,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[12], 10);
if (result != ISC_R_SUCCESS || digestbits > 256) {
error("digest-bits out of range [0..256]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else if (strcasecmp(buf, "hmac-sha384") == 0) {
@@ -446,7 +446,7 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[12], 10);
if (result != ISC_R_SUCCESS || digestbits > 384) {
error("digest-bits out of range [0..384]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else if (strcasecmp(buf, "hmac-sha512") == 0) {
@@ -456,14 +456,14 @@ parse_hmac(const char *hmacstr, size_t len, dst_algorithm_t *hmac_alg,
result = isc_parse_uint16(&digestbits, &buf[12], 10);
if (result != ISC_R_SUCCESS || digestbits > 512) {
error("digest-bits out of range [0..512]");
return (false);
return false;
}
*digestbitsp = (digestbits + 7) & ~0x7U;
} else {
error("unknown key type '%s'", buf);
return (false);
return false;
}
return (true);
return true;
}
static int
@@ -477,7 +477,7 @@ basenamelen(const char *file) {
} else if (len > 4 && strcmp(file + len - 4, ".key") == 0) {
len -= 4;
}
return (len);
return len;
}
static void
@@ -573,7 +573,7 @@ read_sessionkey(isc_mem_t *mctx, isc_log_t *lctx) {
int len;
if (!isc_file_exists(keyfile)) {
return (ISC_R_FILENOTFOUND);
return ISC_R_FILENOTFOUND;
}
result = cfg_parser_create(mctx, lctx, &pctx);
@@ -619,7 +619,7 @@ cleanup:
isc_mem_free(mctx, keystr);
}
return (result);
return result;
}
static void
@@ -797,8 +797,8 @@ create_name(const char *str, char *namedata, size_t len, dns_name_t *name) {
isc_buffer_add(&namesrc, strlen(str));
isc_buffer_init(&namebuf, namedata, len);
return (dns_name_fromtext(name, &namesrc, dns_rootname,
DNS_NAME_DOWNCASE, &namebuf));
return dns_name_fromtext(name, &namesrc, dns_rootname,
DNS_NAME_DOWNCASE, &namebuf);
}
static void
@@ -1003,7 +1003,7 @@ get_addresses(char *host, in_port_t port, isc_sockaddr_t *sockaddr,
error("couldn't get address for '%s': %s", host,
isc_result_totext(result));
}
return (count);
return count;
}
#define PARSE_ARGS_FMT "46A:C:dDE:ghH:iK:lL:MoOk:p:Pr:R:St:Tu:vVy:"
@@ -1313,7 +1313,7 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
word = nsu_strsep(cmdlinep, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read owner name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
dns_message_gettempname(msg, namep);
@@ -1324,10 +1324,10 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
error("invalid owner name: %s", isc_result_totext(result));
isc_buffer_invalidate(&source);
dns_message_puttempname(msg, namep);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
isc_buffer_invalidate(&source);
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1342,7 +1342,7 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
if (cmdline == NULL) {
rdata->flags = DNS_RDATA_UPDATE;
return (STATUS_MORE);
return STATUS_MORE;
}
while (*cmdline != 0 && isspace((unsigned char)*cmdline)) {
@@ -1373,13 +1373,13 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
fprintf(stderr, "invalid rdata format: %s\n",
isc_result_totext(result));
isc_buffer_free(&buf);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
} else {
rdata->flags = DNS_RDATA_UPDATE;
}
*cmdlinep = cmdline;
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1402,7 +1402,7 @@ make_prereq(char *cmdline, bool ispositive, bool isrrset) {
*/
retval = parse_name(&cmdline, updatemsg, &name);
if (retval != STATUS_MORE) {
return (retval);
return retval;
}
/*
@@ -1482,13 +1482,13 @@ make_prereq(char *cmdline, bool ispositive, bool isrrset) {
ISC_LIST_INIT(name->list);
ISC_LIST_APPEND(name->list, rdataset, link);
dns_message_addname(updatemsg, name, DNS_SECTION_PREREQUISITE);
return (STATUS_MORE);
return STATUS_MORE;
failure:
if (name != NULL) {
dns_message_puttempname(updatemsg, &name);
}
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
static uint16_t
@@ -1500,7 +1500,7 @@ evaluate_prereq(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read operation code\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (strcasecmp(word, "nxdomain") == 0) {
ispositive = false;
@@ -1516,9 +1516,9 @@ evaluate_prereq(char *cmdline) {
isrrset = true;
} else {
fprintf(stderr, "incorrect operation code: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (make_prereq(cmdline, ispositive, isrrset));
return make_prereq(cmdline, ispositive, isrrset);
}
static void
@@ -1564,7 +1564,7 @@ evaluate_lease(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read ttl\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (!strcasecmp(word, "none")) {
@@ -1573,12 +1573,12 @@ evaluate_lease(char *cmdline) {
keylease = 0;
keylease_set = false;
updateopt();
return (STATUS_MORE);
return STATUS_MORE;
}
result = isc_parse_uint32(&value1, word, 10);
if (result != ISC_R_SUCCESS) {
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
word = nsu_strsep(&cmdline, " \t\r\n");
@@ -1588,12 +1588,12 @@ evaluate_lease(char *cmdline) {
keylease = 0;
keylease_set = false;
updateopt();
return (STATUS_MORE);
return STATUS_MORE;
}
result = isc_parse_uint32(&value2, word, 10);
if (result != ISC_R_SUCCESS) {
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
lease = value1;
@@ -1602,7 +1602,7 @@ evaluate_lease(char *cmdline) {
keylease_set = true;
updateopt();
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1612,13 +1612,13 @@ evaluate_server(char *cmdline) {
if (local_only) {
fprintf(stderr, "cannot reset server in localhost-only mode\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read server name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
server = word;
@@ -1630,13 +1630,13 @@ evaluate_server(char *cmdline) {
port = strtol(word, &endp, 10);
if (*endp != 0) {
fprintf(stderr, "port '%s' is not numeric\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
} else if (port < 1 || port > 65535) {
fprintf(stderr,
"port '%s' is out of range "
"(1 to 65535)\n",
word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
}
@@ -1654,10 +1654,10 @@ evaluate_server(char *cmdline) {
servers = isc_mem_cget(gmctx, ns_alloc, sizeof(isc_sockaddr_t));
ns_total = get_addresses(server, (in_port_t)port, servers, ns_alloc);
if (ns_total == 0) {
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1670,7 +1670,7 @@ evaluate_local(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read server name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
local = word;
@@ -1682,13 +1682,13 @@ evaluate_local(char *cmdline) {
port = strtol(word, &endp, 10);
if (*endp != 0) {
fprintf(stderr, "port '%s' is not numeric\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
} else if (port < 1 || port > 65535) {
fprintf(stderr,
"port '%s' is out of range "
"(1 to 65535)\n",
word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
}
@@ -1704,10 +1704,10 @@ evaluate_local(char *cmdline) {
isc_sockaddr_fromin(localaddr4, &in4, (in_port_t)port);
} else {
fprintf(stderr, "invalid address %s", local);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1728,7 +1728,7 @@ evaluate_key(char *cmdline) {
namestr = nsu_strsep(&cmdline, " \t\r\n");
if (namestr == NULL || *namestr == 0) {
fprintf(stderr, "could not read key name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
mykeyname = dns_fixedname_initname(&fkeyname);
@@ -1736,7 +1736,7 @@ evaluate_key(char *cmdline) {
n = strchr(namestr, ':');
if (n != NULL) {
if (!parse_hmac(namestr, n - namestr, &hmac_alg, &digestbits)) {
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
namestr = n + 1;
} else {
@@ -1748,13 +1748,13 @@ evaluate_key(char *cmdline) {
result = dns_name_fromtext(mykeyname, &b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "could not parse key name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
secretstr = nsu_strsep(&cmdline, "\r\n");
if (secretstr == NULL || *secretstr == 0) {
fprintf(stderr, "could not read key secret\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
secretlen = strlen(secretstr) * 3 / 4;
secret = isc_mem_allocate(gmctx, secretlen);
@@ -1765,7 +1765,7 @@ evaluate_key(char *cmdline) {
fprintf(stderr, "could not create key from %s: %s\n", secretstr,
isc_result_totext(result));
isc_mem_free(gmctx, secret);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
secretlen = isc_buffer_usedlength(&secretbuf);
@@ -1778,10 +1778,10 @@ evaluate_key(char *cmdline) {
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "could not create key from %s %s: %s\n",
namestr, secretstr, isc_result_totext(result));
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
dst_key_setbits(tsigkey->key, digestbits);
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1793,7 +1793,7 @@ evaluate_zone(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read zone name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
userzone = dns_fixedname_initname(&fuserzone);
@@ -1803,10 +1803,10 @@ evaluate_zone(char *cmdline) {
if (result != ISC_R_SUCCESS) {
userzone = NULL; /* Lest it point to an invalid name */
fprintf(stderr, "could not parse zone name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1823,19 +1823,19 @@ evaluate_realm(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
return (STATUS_MORE);
return STATUS_MORE;
}
n = snprintf(buf, sizeof(buf), "@%s", word);
if (n < 0 || (size_t)n >= sizeof(buf)) {
error("realm is too long");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
realm = isc_mem_strdup(gmctx, buf);
return (STATUS_MORE);
return STATUS_MORE;
#else /* HAVE_GSSAPI */
UNUSED(cmdline);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
#endif /* HAVE_GSSAPI */
}
@@ -1848,29 +1848,29 @@ evaluate_ttl(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read ttl\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (!strcasecmp(word, "none")) {
default_ttl = 0;
default_ttl_set = false;
return (STATUS_MORE);
return STATUS_MORE;
}
result = isc_parse_uint32(&ttl, word, 10);
if (result != ISC_R_SUCCESS) {
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (ttl > TTL_MAX) {
fprintf(stderr, "ttl '%s' is out of range (0 to %u)\n", word,
TTL_MAX);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
default_ttl = ttl;
default_ttl_set = true;
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1883,7 +1883,7 @@ evaluate_class(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read class name\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
r.base = word;
@@ -1891,19 +1891,19 @@ evaluate_class(char *cmdline) {
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "could not parse class name: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
switch (rdclass) {
case dns_rdataclass_none:
case dns_rdataclass_any:
case dns_rdataclass_reserved0:
fprintf(stderr, "bad default class: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
default:
defaultclass = rdclass;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -1927,7 +1927,7 @@ update_addordelete(char *cmdline, bool isdelete) {
*/
retval = parse_name(&cmdline, updatemsg, &name);
if (retval != STATUS_MORE) {
return (retval);
return retval;
}
dns_message_gettemprdata(updatemsg, &rdata);
@@ -2113,14 +2113,14 @@ doneparsing:
ISC_LIST_INIT(name->list);
ISC_LIST_APPEND(name->list, rdataset, link);
dns_message_addname(updatemsg, name, DNS_SECTION_UPDATE);
return (STATUS_MORE);
return STATUS_MORE;
failure:
if (name != NULL) {
dns_message_puttempname(updatemsg, &name);
}
dns_message_puttemprdata(updatemsg, &rdata);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
static uint16_t
@@ -2132,7 +2132,7 @@ evaluate_update(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read operation code\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (strcasecmp(word, "delete") == 0) {
isdelete = true;
@@ -2142,9 +2142,9 @@ evaluate_update(char *cmdline) {
isdelete = false;
} else {
fprintf(stderr, "incorrect operation code: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (update_addordelete(cmdline, isdelete));
return update_addordelete(cmdline, isdelete);
}
static uint16_t
@@ -2155,7 +2155,7 @@ evaluate_checknames(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read check-names directive\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (strcasecmp(word, "yes") == 0 || strcasecmp(word, "true") == 0 ||
strcasecmp(word, "on") == 0)
@@ -2168,9 +2168,9 @@ evaluate_checknames(char *cmdline) {
checknames = false;
} else {
fprintf(stderr, "incorrect check-names directive: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static uint16_t
@@ -2181,7 +2181,7 @@ evaluate_checksvcb(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
fprintf(stderr, "could not read check-svcb directive\n");
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
if (strcasecmp(word, "yes") == 0 || strcasecmp(word, "true") == 0 ||
strcasecmp(word, "on") == 0)
@@ -2194,9 +2194,9 @@ evaluate_checksvcb(char *cmdline) {
checksvcb = false;
} else {
fprintf(stderr, "incorrect check-svcb directive: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
return (STATUS_MORE);
return STATUS_MORE;
}
static void
@@ -2274,58 +2274,58 @@ do_next_command(char *cmdline) {
word = nsu_strsep(&cmdline, " \t\r\n");
if (word == NULL || *word == 0) {
return (STATUS_SEND);
return STATUS_SEND;
}
if (word[0] == ';') {
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "quit") == 0) {
return (STATUS_QUIT);
return STATUS_QUIT;
}
if (strcasecmp(word, "prereq") == 0) {
return (evaluate_prereq(cmdline));
return evaluate_prereq(cmdline);
}
if (strcasecmp(word, "nxdomain") == 0) {
return (make_prereq(cmdline, false, false));
return make_prereq(cmdline, false, false);
}
if (strcasecmp(word, "yxdomain") == 0) {
return (make_prereq(cmdline, true, false));
return make_prereq(cmdline, true, false);
}
if (strcasecmp(word, "nxrrset") == 0) {
return (make_prereq(cmdline, false, true));
return make_prereq(cmdline, false, true);
}
if (strcasecmp(word, "yxrrset") == 0) {
return (make_prereq(cmdline, true, true));
return make_prereq(cmdline, true, true);
}
if (strcasecmp(word, "update") == 0) {
return (evaluate_update(cmdline));
return evaluate_update(cmdline);
}
if (strcasecmp(word, "delete") == 0) {
return (update_addordelete(cmdline, true));
return update_addordelete(cmdline, true);
}
if (strcasecmp(word, "del") == 0) {
return (update_addordelete(cmdline, true));
return update_addordelete(cmdline, true);
}
if (strcasecmp(word, "add") == 0) {
return (update_addordelete(cmdline, false));
return update_addordelete(cmdline, false);
}
if (strcasecmp(word, "lease") == 0) {
return (evaluate_lease(cmdline));
return evaluate_lease(cmdline);
}
if (strcasecmp(word, "server") == 0) {
return (evaluate_server(cmdline));
return evaluate_server(cmdline);
}
if (strcasecmp(word, "local") == 0) {
return (evaluate_local(cmdline));
return evaluate_local(cmdline);
}
if (strcasecmp(word, "zone") == 0) {
return (evaluate_zone(cmdline));
return evaluate_zone(cmdline);
}
if (strcasecmp(word, "class") == 0) {
return (evaluate_class(cmdline));
return evaluate_class(cmdline);
}
if (strcasecmp(word, "send") == 0) {
return (STATUS_SEND);
return STATUS_SEND;
}
if (strcasecmp(word, "debug") == 0) {
if (debugging) {
@@ -2333,14 +2333,14 @@ do_next_command(char *cmdline) {
} else {
debugging = true;
}
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "ttl") == 0) {
return (evaluate_ttl(cmdline));
return evaluate_ttl(cmdline);
}
if (strcasecmp(word, "show") == 0) {
show_message(stdout, updatemsg, "Outgoing update query:");
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "answer") == 0) {
LOCK(&answer_lock);
@@ -2348,24 +2348,24 @@ do_next_command(char *cmdline) {
show_message(stdout, answer, "Answer:");
}
UNLOCK(&answer_lock);
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "key") == 0) {
usegsstsig = false;
return (evaluate_key(cmdline));
return evaluate_key(cmdline);
}
if (strcasecmp(word, "realm") == 0) {
return (evaluate_realm(cmdline));
return evaluate_realm(cmdline);
}
if (strcasecmp(word, "check-names") == 0 ||
strcasecmp(word, "checknames") == 0)
{
return (evaluate_checknames(cmdline));
return evaluate_checknames(cmdline);
}
if (strcasecmp(word, "check-svcb") == 0 ||
strcasecmp(word, "checksvcb") == 0)
{
return (evaluate_checksvcb(cmdline));
return evaluate_checksvcb(cmdline);
}
if (strcasecmp(word, "gsstsig") == 0) {
#if HAVE_GSSAPI
@@ -2373,7 +2373,7 @@ do_next_command(char *cmdline) {
#else /* HAVE_GSSAPI */
fprintf(stderr, "gsstsig not supported\n");
#endif /* HAVE_GSSAPI */
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "oldgsstsig") == 0) {
#if HAVE_GSSAPI
@@ -2381,7 +2381,7 @@ do_next_command(char *cmdline) {
#else /* HAVE_GSSAPI */
fprintf(stderr, "gsstsig not supported\n");
#endif /* HAVE_GSSAPI */
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "help") == 0) {
fprintf(stdout, "nsupdate " PACKAGE_VERSION ":\n"
@@ -2421,14 +2421,14 @@ do_next_command(char *cmdline) {
"record to the zone)\n"
"[update] del[ete] .... (remove the given "
"record(s) from the zone)\n");
return (STATUS_MORE);
return STATUS_MORE;
}
if (strcasecmp(word, "version") == 0) {
fprintf(stdout, "nsupdate " PACKAGE_VERSION "\n");
return (STATUS_MORE);
return STATUS_MORE;
}
fprintf(stderr, "incorrect section name: %s\n", word);
return (STATUS_SYNTAX);
return STATUS_SYNTAX;
}
static uint16_t
@@ -2460,7 +2460,7 @@ get_next_command(void) {
free(ptr);
}
return (result);
return result;
}
static bool
@@ -2475,9 +2475,9 @@ user_interaction(void) {
}
}
if (result == STATUS_SEND) {
return (true);
return true;
}
return (false);
return false;
}
static void
@@ -2522,10 +2522,10 @@ next_primary(const char *caller, isc_sockaddr_t *addr, isc_result_t eresult) {
fprintf(stderr, "; Communication with %s failed: %s\n", addrbuf,
isc_result_totext(eresult));
if (++primary_inuse >= primary_total) {
return (false);
return false;
}
ddebug("%s: trying next server", caller);
return (true);
return true;
}
static void
@@ -3575,8 +3575,8 @@ main(int argc, char **argv) {
cleanup();
if (seenerror) {
return (2);
return 2;
}
return (0);
return 0;
}
+27 -27
View File
@@ -179,7 +179,7 @@ static const char *filter_a_enums[] = { "break-dnssec", NULL };
static isc_result_t
parse_filter_a(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
return (cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret));
return cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret);
}
static void
@@ -212,7 +212,7 @@ parse_filter_a_on(const cfg_obj_t *param_obj, const char *param_name,
result = cfg_map_get(param_obj, param_name, &obj);
if (result != ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (cfg_obj_isboolean(obj)) {
@@ -227,7 +227,7 @@ parse_filter_a_on(const cfg_obj_t *param_obj, const char *param_name,
result = ISC_R_UNEXPECTED;
}
return (result);
return result;
}
static isc_result_t
@@ -240,7 +240,7 @@ check_syntax(cfg_obj_t *fmap, const void *cfg, isc_mem_t *mctx, isc_log_t *lctx,
cfg_map_get(fmap, "filter-a", &aclobj);
if (aclobj == NULL) {
return (result);
return result;
}
CHECK(cfg_acl_fromconfig(aclobj, (const cfg_obj_t *)cfg, lctx,
@@ -268,7 +268,7 @@ cleanup:
dns_acl_detach(&acl);
}
return (result);
return result;
}
static isc_result_t
@@ -309,7 +309,7 @@ cleanup:
if (parser != NULL) {
cfg_parser_destroy(&parser);
}
return (result);
return result;
}
/**
@@ -362,7 +362,7 @@ cleanup:
plugin_destroy((void **)&inst);
}
return (result);
return result;
}
isc_result_t
@@ -390,7 +390,7 @@ cleanup:
if (parser != NULL) {
cfg_parser_destroy(&parser);
}
return (result);
return result;
}
/*
@@ -420,7 +420,7 @@ plugin_destroy(void **instp) {
*/
int
plugin_version(void) {
return (NS_PLUGIN_VERSION);
return NS_PLUGIN_VERSION;
}
/**
@@ -445,14 +445,14 @@ typedef struct section_filter {
static bool
is_v4_client(ns_client_t *client) {
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET) {
return (true);
return true;
}
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 &&
IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr))
{
return (true);
return true;
}
return (false);
return false;
}
/*
@@ -463,9 +463,9 @@ is_v6_client(ns_client_t *client) {
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 &&
!IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr))
{
return (true);
return true;
}
return (false);
return false;
}
static filter_data_t *
@@ -478,7 +478,7 @@ client_state_get(const query_ctx_t *qctx, filter_instance_t *inst) {
sizeof(qctx->client), (void **)&client_state);
UNLOCK(&inst->hlock);
return (result == ISC_R_SUCCESS ? client_state : NULL);
return result == ISC_R_SUCCESS ? client_state : NULL;
}
static void
@@ -574,7 +574,7 @@ process_name(query_ctx_t *qctx, filter_a_t mode, const dns_name_t *name,
}
cleanup:
return (modified);
return modified;
}
/*%
@@ -645,7 +645,7 @@ filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp) {
client_state_create(qctx, inst);
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -663,7 +663,7 @@ filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (client_state == NULL) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (inst->v4_a != NONE || inst->v6_a != NONE) {
@@ -680,7 +680,7 @@ filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp) {
}
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -700,7 +700,7 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (client_state == NULL) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (client_state->mode != BREAK_DNSSEC &&
@@ -708,7 +708,7 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
(WANTDNSSEC(qctx->client) && qctx->sigrdataset != NULL &&
dns_rdataset_isassociated(qctx->sigrdataset))))
{
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (qctx->qtype == dns_rdatatype_a) {
@@ -781,11 +781,11 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = result;
return (NS_HOOK_RETURN);
return NS_HOOK_RETURN;
}
*resp = result;
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -818,7 +818,7 @@ filter_respond_any_found(void *arg, void *cbdata, isc_result_t *resp) {
process_section(&filter_answer);
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -855,7 +855,7 @@ filter_query_done_send(void *arg, void *cbdata, isc_result_t *resp) {
}
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -870,10 +870,10 @@ filter_qctx_destroy(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (!qctx->detach_client) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
client_state_destroy(qctx, inst);
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
+27 -27
View File
@@ -179,7 +179,7 @@ static const char *filter_aaaa_enums[] = { "break-dnssec", NULL };
static isc_result_t
parse_filter_aaaa(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
return (cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret));
return cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret);
}
static void
@@ -213,7 +213,7 @@ parse_filter_aaaa_on(const cfg_obj_t *param_obj, const char *param_name,
result = cfg_map_get(param_obj, param_name, &obj);
if (result != ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (cfg_obj_isboolean(obj)) {
@@ -228,7 +228,7 @@ parse_filter_aaaa_on(const cfg_obj_t *param_obj, const char *param_name,
result = ISC_R_UNEXPECTED;
}
return (result);
return result;
}
static isc_result_t
@@ -241,7 +241,7 @@ check_syntax(cfg_obj_t *fmap, const void *cfg, isc_mem_t *mctx, isc_log_t *lctx,
cfg_map_get(fmap, "filter-aaaa", &aclobj);
if (aclobj == NULL) {
return (result);
return result;
}
CHECK(cfg_acl_fromconfig(aclobj, (const cfg_obj_t *)cfg, lctx,
@@ -269,7 +269,7 @@ cleanup:
dns_acl_detach(&acl);
}
return (result);
return result;
}
static isc_result_t
@@ -312,7 +312,7 @@ cleanup:
if (parser != NULL) {
cfg_parser_destroy(&parser);
}
return (result);
return result;
}
/**
@@ -366,7 +366,7 @@ cleanup:
plugin_destroy((void **)&inst);
}
return (result);
return result;
}
isc_result_t
@@ -394,7 +394,7 @@ cleanup:
if (parser != NULL) {
cfg_parser_destroy(&parser);
}
return (result);
return result;
}
/*
@@ -424,7 +424,7 @@ plugin_destroy(void **instp) {
*/
int
plugin_version(void) {
return (NS_PLUGIN_VERSION);
return NS_PLUGIN_VERSION;
}
/**
@@ -449,14 +449,14 @@ typedef struct section_filter {
static bool
is_v4_client(ns_client_t *client) {
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET) {
return (true);
return true;
}
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 &&
IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr))
{
return (true);
return true;
}
return (false);
return false;
}
/*
@@ -467,9 +467,9 @@ is_v6_client(ns_client_t *client) {
if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 &&
!IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr))
{
return (true);
return true;
}
return (false);
return false;
}
static filter_data_t *
@@ -482,7 +482,7 @@ client_state_get(const query_ctx_t *qctx, filter_instance_t *inst) {
sizeof(qctx->client), (void **)&client_state);
UNLOCK(&inst->hlock);
return (result == ISC_R_SUCCESS ? client_state : NULL);
return result == ISC_R_SUCCESS ? client_state : NULL;
}
static void
@@ -578,7 +578,7 @@ process_name(query_ctx_t *qctx, filter_aaaa_t mode, const dns_name_t *name,
}
cleanup:
return (modified);
return modified;
}
/*%
@@ -649,7 +649,7 @@ filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp) {
client_state_create(qctx, inst);
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -667,7 +667,7 @@ filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (client_state == NULL) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (inst->v4_aaaa != NONE || inst->v6_aaaa != NONE) {
@@ -684,7 +684,7 @@ filter_prep_response_begin(void *arg, void *cbdata, isc_result_t *resp) {
}
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -704,7 +704,7 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (client_state == NULL) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (client_state->mode != BREAK_DNSSEC &&
@@ -712,7 +712,7 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
(WANTDNSSEC(qctx->client) && qctx->sigrdataset != NULL &&
dns_rdataset_isassociated(qctx->sigrdataset))))
{
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
if (qctx->qtype == dns_rdatatype_aaaa) {
@@ -784,11 +784,11 @@ filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp) {
*resp = result;
return (NS_HOOK_RETURN);
return NS_HOOK_RETURN;
}
*resp = result;
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -821,7 +821,7 @@ filter_respond_any_found(void *arg, void *cbdata, isc_result_t *resp) {
process_section(&filter_answer);
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -858,7 +858,7 @@ filter_query_done_send(void *arg, void *cbdata, isc_result_t *resp) {
}
}
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
/*
@@ -873,10 +873,10 @@ filter_qctx_destroy(void *arg, void *cbdata, isc_result_t *resp) {
*resp = ISC_R_UNSET;
if (!qctx->detach_client) {
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
client_state_destroy(qctx, inst);
return (NS_HOOK_CONTINUE);
return NS_HOOK_CONTINUE;
}
+11 -6
View File
@@ -132,6 +132,9 @@ command is one of the following:\n\
halt Stop the server without saving pending updates.\n\
halt -p Stop the server without saving pending updates reporting\n\
process id.\n\
skr -import file zone [class [view]]\n\
Import a SKR file for the specified zone, for offline KSK\n\
signing.\n\
loadkeys zone [class [view]]\n\
Update keys without signing immediately.\n\
managed-keys refresh [class [view]]\n\
@@ -140,6 +143,10 @@ command is one of the following:\n\
Display RFC 5011 managed keys information\n\
managed-keys sync [class [view]]\n\
Write RFC 5011 managed keys to disk\n\
memprof [ on | off | dump ]\n\
Enable / disable memory profiling or dump the profile.\n\
Requires named to built with jemalloc and run with the relevant\n\
MALLOC_CONF environment variables.\n\
modzone zone [class [view]] { zone-options }\n\
Modify a zone's configuration.\n\
Requires allow-new-zones option.\n\
@@ -305,8 +312,7 @@ rndc_recvdone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
fatal("recv failed: %s", isc_result_totext(result));
}
source.rstart = isc_buffer_base(ccmsg->buffer);
source.rend = isc_buffer_used(ccmsg->buffer);
isccc_ccmsg_toregion(ccmsg, &source);
DO("parse message",
isccc_cc_fromwire(&source, &response, algorithm, &secret));
@@ -381,8 +387,7 @@ rndc_recvnonce(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
fatal("recv failed: %s", isc_result_totext(result));
}
source.rstart = isc_buffer_base(ccmsg->buffer);
source.rend = isc_buffer_used(ccmsg->buffer);
isccc_ccmsg_toregion(ccmsg, &source);
DO("parse message",
isccc_cc_fromwire(&source, &response, algorithm, &secret));
@@ -1022,8 +1027,8 @@ main(int argc, char **argv) {
isc_managers_destroy(&rndc_mctx, &loopmgr, &netmgr);
if (failed) {
return (1);
return 1;
}
return (0);
return 0;
}
+33 -2
View File
@@ -257,6 +257,11 @@ Currently supported commands are:
See also :option:`rndc stop`.
.. option:: skr -import file zone [class [view]]
This command allows you to import a SKR file for the specified zone, to
support offline KSK signing.
.. option:: loadkeys [zone [class [view]]]
This command fetches all DNSSEC keys for the given zone from the key directory. If
@@ -308,6 +313,19 @@ Currently supported commands are:
keys in the event of a trust anchor rollover, or as a brute-force
repair for key maintenance problems.
.. option:: memprof [(on | off | dump)]
This command controls memory profiling. To have any effect, :iscman:`named` must be
built with jemalloc, the library have profiling support enabled and run with the
``prof:true`` allocator configuration. (either via ``MALLOC_CONF`` or ``/etc/malloc.conf``)
The ``prof_active:false`` option is recommended to ensure the profiling overhead does
not affect :iscman:`named` when not needed.
The ``on`` and ``off`` options will start and stop the jemalloc memory profiling respectively.
When run with the `dump` option, :iscman:`named` will dump the profile to the working
directory. The name will be chosen automatically by jemalloc.
.. option:: modzone zone [class [view]] configuration
This command modifies the configuration of a zone while the server is running. This
@@ -444,14 +462,27 @@ Currently supported commands are:
.. program:: rndc
.. option:: retransfer zone [class [view]]
.. option:: responselog [on | off]
This command enables or disables response logging. For backward compatibility,
this command can also be used without an argument to toggle response logging
on and off.
Unlike query logging, response logging cannot be enabled by explicitly directing
the ``responses`` ``category`` to a ``channel`` in the ``logging`` section
of :iscman:`named.conf`, but it can still be enabled by specifying
``responselog yes;`` in the ``options`` section of :iscman:`named.conf`.
.. option:: retransfer [-force] zone [class [view]]
This command retransfers the given secondary zone from the primary server.
If the zone is configured to use ``inline-signing``, the signed
version of the zone is discarded; after the retransfer of the
unsigned version is complete, the signed version is regenerated
with new signatures.
with new signatures. With the optional ``-force`` argument provided
if there is an ongoing zone transfer it will be aborted before a new zone
transfer is scheduled.
.. option:: scan
-1
View File
@@ -3,7 +3,6 @@ nxtify
sdig
*_test
gsstest
conf.sh
dlopen
keycreate
keydelete
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
+3
View File
@@ -15,10 +15,13 @@ named.run
/*.trs
/*.xml
/resolve
/legacy.run.sh
/run.log
/start.sh
/stop.sh
/ifconfig.sh
/isctest/vars/.ac_vars/*
!/isctest/vars/.ac_vars/*.in
# Ignore file names with underscore in their name except python or shell files.
# This is done to ignore the temporary directories and symlinks created by the
+4
View File
@@ -86,6 +86,7 @@ TESTS = \
autosign \
builtin \
cacheclean \
camp \
case \
catz \
cds \
@@ -95,6 +96,7 @@ TESTS = \
checknames \
checkzone \
cookie \
cpu \
database \
dialup \
digdelv \
@@ -128,6 +130,7 @@ TESTS = \
kasp \
keepalive \
keyfromlabel \
ksr \
legacy \
limits \
logfileconfig \
@@ -148,6 +151,7 @@ TESTS = \
proxy \
pipelined \
qmin \
query-source \
reclimit \
redirect \
resolver \
+12 -3
View File
@@ -51,6 +51,7 @@ To run system tests, make sure you have the following dependencies installed:
- perl
- dnspython
- pytest-xdist (for parallel execution)
- python-jinja2 (for tests which use jinja templates)
Individual system tests might also require additional dependencies. If those
are missing, the affected tests will be skipped and should produce a message
@@ -154,9 +155,17 @@ system test directories may contain the following standard files:
- `tests_*.py`: These python files are picked up by pytest as modules. If they
contain any test functions, they're added to the test suite.
- `setup.sh`: This sets up the preconditions for the tests. Although optional,
virtually all tests will require such a file to set up the ports they should
use for the test.
- `*.j2`: These jinja2 templates can be used for configuration files or any
other files which require certain variables filled in, e.g. ports from the
environment variables. During test setup, the pytest runner will automatically
fill those in and strip the filename extension .j2, e.g. `ns1/named.conf.j2`
becomes `ns1/named.conf`. When using advanced templating to conditionally
include/omit entire sections or when filling in custom variables used for the
test, ensure the templates always include the defaults. If you don't need the
file to be auto-templated during test setup, use `.j2.manual` instead and then
no defaults are needed.
- `setup.sh`: This sets up the preconditions for the tests.
- `tests.sh`: Any shell-based tests are located within this file. Runs the
actual tests.
+6
View File
@@ -19,3 +19,9 @@ key rndc_key {
algorithm hmac-sha256;
secret "1234abcd8765";
};
/* Regresssion test for [GL #4991] */
server example.com {
key rndc-key;
addresses { localhost; 127.0.0.1; ::1; };
};
-1
View File
@@ -13,7 +13,6 @@
. ../conf.sh
$SHELL clean.sh
$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 3 >ns2/example.db
$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 3 >ns2/tsigzone.db
copy_setports ns2/named1.conf.in ns2/named.conf
+12
View File
@@ -9,6 +9,18 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"dig.out*",
"ns*/_default.nzd*",
"ns*/_default.nzf*",
"ns2/example.db",
"ns2/tsigzone.db",
]
)
def test_acl(run_tests_sh):
run_tests_sh()
-1
View File
@@ -13,7 +13,6 @@
. ../conf.sh
$SHELL clean.sh
copy_setports ns1/named1.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
copy_setports ns3/named.conf.in ns3/named.conf
+1 -1
View File
@@ -279,7 +279,7 @@ n=$((n + 1))
echo_i "testing with 'minimal-any no;' ($n)"
ret=0
$DIG $DIGOPTS -t ANY www.rt.example @10.53.0.1 >dig.out.$n || ret=1
grep "ANSWER: 3, AUTHORITY: 2, ADDITIONAL: 2" dig.out.$n >/dev/null || ret=1
grep "ANSWER: 3, AUTHORITY: 2, ADDITIONAL: 1" dig.out.$n >/dev/null || ret=1
if [ $ret -eq 1 ]; then
echo_i "failed"
status=$((status + 1))
@@ -9,6 +9,14 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"dig.out.*",
]
)
def test_additional(run_tests_sh):
run_tests_sh()
-43
View File
@@ -1,43 +0,0 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
rm -f ./dig.out.*
rm -f ./rndc.out*
rm -f ./showzone.out*
rm -f ./zonestatus.out*
rm -f ./*/named.conf
rm -f ./*/named.memstats
rm -f ./ns1/*.nzf ./ns1/*.nzf~
rm -f ./ns1/*.nzd ./ns1/*.nzd-lock
rm -f ./ns2/*.nzf ./ns2/*.nzf~
rm -f ./ns2/*.nzd ./ns2/*.nzd-lock
rm -f ./ns3/*.nzf ./ns3/*.nzf~
rm -f ./ns3/*.nzd ./ns3/*.nzd-lock
rm -f ./ns2/core*
rm -f ./ns2/inline.db.jbk
rm -f ./ns2/inline.db.signed
rm -f ./ns2/inlinesec.bk*
rm -rf ./ns2/new-zones
rm -f ./ns*/named.run ./ns*/named.run.prev
rm -f ./ns2/nzf-*
rm -f ./ns3/named.conf
rm -f ./ns3/*.nzf ./ns3/*.nzf~
rm -f ./ns3/*.nzd ns3/*.nzd-lock
rm -f ./ns3/inlinesec.db
rm -f ./ns1/redirect.db
rm -f ./ns2/redirect.db
rm -f ./ns2/redirect.bk
rm -f ./ns3/redirect.db
rm -f ./ns*/managed-keys.bind* ns*/*.mkeys*
rm -f ./nzd2nzf.out.*
rm -f ./wait_for_message.*
@@ -25,6 +25,7 @@ options {
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
allow-transfer { any; };
allow-query { any; };
allow-new-zones yes;
recursion no;
+2 -1
View File
@@ -23,6 +23,7 @@ options {
listen-on { 10.53.0.3; };
listen-on-v6 { none; };
allow-query { any; };
allow-transfer { any; };
recursion no;
allow-new-zones yes;
dnssec-validation no;
@@ -33,6 +34,6 @@ zone "." {
file "redirect.db";
};
primaries "test" {
remote-servers "test" {
10.53.0.99;
};
@@ -23,6 +23,7 @@ options {
listen-on { 10.53.0.3; };
listen-on-v6 { none; };
allow-query { any; };
allow-transfer { any; };
recursion no;
allow-new-zones yes;
dnssec-validation no;
@@ -12,8 +12,21 @@
import concurrent.futures
import time
import pytest
import isctest
pytestmark = pytest.mark.extra_artifacts(
[
"ns*/*.nzf*",
"ns*/*.nzd*",
"ns1/redirect.db",
"ns2/new-zones",
"ns2/redirect.db",
"ns3/redirect.db",
]
)
def rndc_loop(test_state, domain, ns3):
"""
@@ -9,6 +9,35 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"dig.out.*",
"rndc.out*",
"showzone.out.*",
"zonestatus.out.*",
"ns*/*.nzd*",
"ns*/*.nzf*",
"ns1/redirect.db",
"nzd2nzf.out.*",
"ns2/*.nzf~",
"ns2/K*.key",
"ns2/K*.private",
"ns2/K*.state",
"ns2/external.nzd",
"ns2/extra.nzd",
"ns2/inline.db.jbk",
"ns2/inline.db.signed",
"ns2/inline.db.signed.jnl",
"ns2/inlinesec.bk.jbk",
"ns2/new-zones",
"ns2/redirect.bk",
"ns2/redirect.db",
"ns3/redirect.db",
]
)
def test_addzone(run_tests_sh):
run_tests_sh()
@@ -9,6 +9,15 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import pytest
pytestmark = pytest.mark.extra_artifacts(
[
"dig.out.*",
"ns2/controls.conf",
]
)
def test_allow_query(run_tests_sh):
run_tests_sh()

Some files were not shown because too many files have changed in this diff Show More