Compare commits

..
Author SHA1 Message Date
Evan Hunt 6f289188a3 clean up flies in addzone system test
some generated files were not cleaned up after running the test.
2023-12-21 00:04:59 -08:00
Mark Andrews b072bf612f Merge branch '4488-memory-reference-leak-in-lib-dns-zone-c-zone_sign-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Memory/reference leak in lib/dns/zone.c:zone_sign" !8570

See merge request isc-projects/bind9!8607
2023-12-20 23:48:28 +00:00
Mark Andrews 7b10f5f154 Add CHANGES note for [GL #4488]
(cherry picked from commit 4e4200ee2e)
2023-12-21 10:06:29 +11:00
Mark Andrews 0ceb01386c Don't look for KSK status here and squash memory leak
Just remove the key from  consideration as it is being removed.

The old code could leak a key reference as dst_free_key was not
called every time we continued. This simplification will address
this as well.

(cherry picked from commit a3d0476d17)
2023-12-21 10:05:54 +11:00
Tom Krizek b04849c46a Merge tag 'v9.18.21' into bind-9.18 2023-12-20 16:07:25 +01:00
Mark Andrews 8f34392979 Merge branch '4498-gl-4495-followup-regression-test-was-too-strict-bind-9.18' into 'bind-9.18'
[9.18] Resolve "[GL #4494] followup: regression test was too strict"

See merge request isc-projects/bind9!8598
2023-12-20 00:46:40 +00:00
Mark Andrews 38babba214 The NSEC3 -> NSEC private record may be added later
Check each delta for the NSEC3 -> NSEC private record addition
as it may be added in the second delta.

(cherry picked from commit 80a4dff986)
2023-12-20 11:11:12 +11:00
Mark Andrews a26693e987 Merge branch '4500-log-the-change-that-generated-not-exact-when-applying-a-diff-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Log the change that generated "not exact" when applying a diff."

See merge request isc-projects/bind9!8596
2023-12-19 22:04:20 +00:00
Mark Andrews 39f2fe0c7a Add CHANGES entry for [GL #4500]
(cherry picked from commit 71d67b6fdf)
2023-12-20 02:48:13 +11:00
Mark Andrews a2bcd4fc0e Log what change generated a 'not exact' error
(cherry picked from commit c896e07277)
2023-12-20 02:47:42 +11:00
Mark Andrews c5fee06ff9 Merge branch '4494-add_sigs-was-using-the-wrong-time-in-kasp-mode-bind-9.18' into 'bind-9.18'
[9.18] Resolve "add_sigs was using the wrong time in kasp mode"

See merge request isc-projects/bind9!8588
2023-12-19 02:27:53 +00:00
Mark Andrews 74d61641e1 Add CHANGES note for [GL #4494]
(cherry picked from commit 94b00f44ae)
2023-12-19 12:44:49 +11:00
Mark Andrews 15601cca43 Regression check for missing RRSIGs
When transitioning from NSEC3 to NSEC the added records where not
being signed because the wrong time was being used to determine if
a key should be used or not.  Check that these records are actually
signed.

(cherry picked from commit bdb42d3838)
2023-12-19 12:44:27 +11:00
Mark Andrews 65fdc892eb Use 'now' rather than 'inception' in 'add_sigs'
When kasp support was added 'inception' was used as a proxy for
'now' and resulted in signatures not being generated or the wrong
signatures being generated.  'inception' is the time to be set
in the signatures being generated and is usually in the past to
allow for clock skew.  'now' determines what keys are to be used
for signing.

(cherry picked from commit 6066e41948)
2023-12-19 12:39:16 +11:00
Michał Kępień 3713d6c909 Merge branch '4497-trust-anchor-telemetry-is-no-longer-experimental-9.18' into 'bind-9.18'
[9.18] "trust-anchor-telemetry" is no longer experimental

See merge request isc-projects/bind9!8587
2023-12-18 14:50:16 +00:00
Michał Kępień 6961509039 Add CHANGES entry for GL #4497
(cherry picked from commit 693fee4836)
2023-12-18 15:13:34 +01:00
Michał Kępień 8882d88731 "trust-anchor-telemetry" is no longer experimental
Remove the CFG_CLAUSEFLAG_EXPERIMENTAL flag from the
"trust-anchor-telemetry" statement as the behavior of the latter has not
been changed since its initial implementation and there are currently no
plans to do so.  This silences a relevant log message that was emitted
even when the feature was explicitly disabled.

(cherry picked from commit b1baf7af3a)
2023-12-18 15:13:34 +01:00
Arаm Sаrgsyаn 8f9c0eb284 Merge branch '4477-tests-statschannel-loadtime-bugfix-9.18' into 'bind-9.18'
[9.18] Resolve "statschannel test intermittently fails with incorrect zone loadtime"

See merge request isc-projects/bind9!8583
2023-12-18 10:24:49 +00:00
Aram Sargsyan ba923834b2 Fix a statschannel system test zone loadtime issue
The check_loaded() function compares the zone's loadtime value and
an expected loadtime value, which is based on the zone file's mtime
extracted from the filesystem.

For the secondary zones there may be cases, when the zone file isn't
ready yet before the zone transfer is complete and the zone file is
dumped to the disk, so a so zero value mtime is retrieved.

In such cases wait one second and retry until timeout. Also modify
the affected check to allow a possible difference of the same amount
of seconds as the chosen timeout value.

(cherry picked from commit 4e94ff2541)
2023-12-18 09:34:31 +00:00
Mark Andrews 418a1ad762 Merge branch '4478-redefinition-of-hmac-as-different-kind-of-symbol-on-netbsd-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Redefinition of 'hmac' as different kind of symbol on NetBSD"

See merge request isc-projects/bind9!8573
2023-12-14 01:29:27 +00:00
Mark Andrews c705fee830 Add CHANGES note for [GL #4478]
(cherry picked from commit 648fa635f8)
2023-12-14 11:14:04 +11:00
Mark Andrews adfb365602 NetBSD has added 'hmac' to libc so rename our uses of hmac
(cherry picked from commit fd077c2661)
2023-12-14 11:14:04 +11:00
Michal Nowak c54c268c4c Merge branch 'mnowak/alpine-3.19-9.18' into 'bind-9.18'
[9.18] Add Alpine Linux 3.19

See merge request isc-projects/bind9!8566
2023-12-12 10:42:39 +00:00
Michal Nowak 3b603d0fe5 Add Alpine Linux 3.19
(cherry picked from commit 1fc56d705e)
2023-12-12 11:12:15 +01:00
Michal Nowak 07f6d1e67f Merge branch 'mnowak/replace-danger-python-with-hazard-9.18' into 'bind-9.18'
[9.18] Replace danger-python with Hazard

See merge request isc-projects/bind9!8563
2023-12-11 17:23:57 +00:00
Tom KrizekandMichal Nowak e97f4c0784 Handle empty MR description in dangerfile
A merge request might have no description at all (i.e. None, rather than
an empty string). This might happen when the MR is created via an API.
Check a description is present before trying to find a backport string
in it.

(cherry picked from commit 4f70f5bd7c)
2023-12-11 17:45:31 +01:00
Michał KępieńandMichal Nowak a4fbb8edd0 Improve determining the lines added by a branch
Since the list of lines added to Git-tracked text files in a given
branch is not part of the Danger DSL [1], it is determined using custom
code in dangerfile.py.  The current implementation of that logic is less
than perfect as it examines the diff between the current tip of the
target branch and the source branch rather than the diff between the
merge base of the two branches and the source branch.  Consider a Git
history like this:

    *   F (target)
    ...
    *   E
    *   D
    *   C
    | * B (source)
    |/
    *   A (merge base)

If danger-python or Hazard are run for commit B, the current logic for
determining the list of added lines in dangerfile.py examines the diff
between commits F and B rather than between commits A and B.  Therefore,
the added_lines() function returns not just the lines added by commit B
on top of commit A, but also the list of lines that were removed between
commits A and F, which leads to confusing results.

Fix by using the triple-dot diff operator in the Git invocation whose
output is used as the source of information for determining the list of
lines added by a given branch.

Since Hazard fetches the target branch itself when it is run, remove the
explicit "git fetch" invocation that fetches the target branch from
GitLab (shortening its local history to a single commit in the process)
before "git diff" is invoked.

[1] https://danger.systems/js/reference.html#GitDSL

(cherry picked from commit 43126e81e6)
2023-12-11 17:45:29 +01:00
Michal Nowak 33ebaea600 Replace danger-python with Hazard
Hazard is a minimal danger-python replacement.

(cherry picked from commit 08ce1bc45f)
2023-12-11 17:45:28 +01:00
Tom Krizek 75b18cf01e Merge branch 'tkrizek/set-up-version-and-release-notes-for-bind-9.18.22' into 'bind-9.18'
Set up version and release notes for BIND 9.18.22

See merge request isc-projects/bind9!8561
2023-12-08 15:05:10 +00:00
Tom Krizek cd310b4835 Set up release notes for BIND 9.18.22 2023-12-08 15:55:30 +01:00
Tom Krizek 1f93aecde3 Update BIND version to 9.18.22-dev 2023-12-08 15:55:30 +01:00
Tom Krizek cb6cff65a9 Update BIND version for release 2023-12-08 12:44:04 +01:00
Tom Krizek c482580110 Add a CHANGES marker 2023-12-08 12:44:04 +01:00
Tom Krizek 9d5aa0b7f8 Merge branch 'michal/prepare-documentation-for-bind-9.18.21' into 'v9.18.21-release'
Prepare documentation for BIND 9.18.21

See merge request isc-private/bind9!599
2023-12-08 11:43:30 +00:00
Michał KępieńandTom Krizek b3f116fada Tweak and reword release notes 2023-12-07 15:48:45 +01:00
Michał KępieńandTom Krizek 35ca98d518 Prepare release notes for BIND 9.18.21 2023-12-07 15:38:31 +01:00
Ondřej Surý bcb22e6e78 Merge branch '4448-improve-lur-cleaning-behaviour-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Improve LRU cleaning behaviour" !8516

See merge request isc-projects/bind9!8556
2023-12-07 12:23:18 +00:00
Mark Andrews c185821d96 Add CHANGES for [GL #4448]
(cherry picked from commit 6ef8d8d699)
2023-12-07 22:16:13 +11:00
Mark Andrews 9ded7428ad Use explict atomic for older compilers 2023-12-07 22:16:13 +11:00
Mark Andrews 2cc84d7678 Also cleanup the space for the rbt nodes
As we are in overmem state we want to free more memory than we are
adding so we need to add in an allowance for the rbtnodes that may
have been added and the names stored with them.  There is the node
for the owner name and a possible ENT node if there was a node split.

(cherry picked from commit 7e462c2b26)
2023-12-07 21:50:02 +11:00
Mark Andrews 8e5bd86416 Process the combined LRU lists in LRU order
Only cleanup headers that are less than equal to the rbt's last_used
time.  Adjust the rbt's last_used time when the target cleaning was
not achieved to the oldest value of the remaining set of headers.

When updating delegating NS and glue records last_used was not being
updated when it should have been.

When adding zero TTL records to the tail of the LRU lists set
last_used to rbtdb->last_used + 1 rather than now.  This appoximately
preserves the lists LRU order.

(cherry picked from commit 5e8f0e9ceb)
2023-12-07 21:34:19 +11:00
Evan Hunt 931437480a Merge branch '4405-remove-resolver-opts-bind-9.18' into 'bind-9.18'
[9.18] deprecate resolver-retry-interval and resolver-nonbackoff-tries

See merge request isc-projects/bind9!8553
2023-12-06 22:13:47 +00:00
Evan Hunt 374b4d6258 deprecate resolver-retry-interval and resolver-nonbackoff-tries
these options control default timing of retries in the resolver
for experimental purposes; they are not known to useful in production
environments.  they will be removed in the future; for now, we
only log a warning if they are used.

(cherry picked from commit 4aaa4f7dca)
2023-12-06 13:41:47 -08:00
Evan Hunt 4ee01a8b5a Merge branch '3498-glue-rehash-overflow' into 'bind-9.18'
correctly limit hash resize to RBTDB_GLUE_TABLE_MAX_BITS

See merge request isc-projects/bind9!8465
2023-12-06 19:44:40 +00:00
Evan Hunt 8f73814469 correctly limit hash resize to RBTDB_GLUE_TABLE_MAX_BITS
Use < instead of <= when testing the new new hash bits size,
otherwise it can exceed the limit.
2023-12-06 11:30:41 -08:00
Artem Boldariev 9f5d5971a7 Merge branch '4464-multithread-tls-initialisation-crash-fix-9.18' into 'bind-9.18'
[9.18]Fix TLS certs store deletion on concurrent access

See merge request isc-projects/bind9!8549
2023-12-06 16:21:32 +00:00
Artem Boldariev 7632a72739 Update CHANGES [GL #4464]
Mention that BIND crashing due to a `tls` multithreaded entry
initialisation attempts has been fixed.

(cherry picked from commit f7de766168)
2023-12-06 17:08:04 +02:00
Artem Boldariev 96228d9a08 doth test: add a secondary NS instance that reuses a 'tls' entry
This commit extends the 'doth' system tests with additional secondary
NS instance that reuses the same 'tls' entry for connecting the the
primary to download zones. This configurations were known to crash
secondaries in some cases.

(cherry picked from commit 10e626111f)
2023-12-06 17:07:12 +02:00
Artem Boldariev d20f1240e2 Fix TLS certs store deletion on concurrent access
During initialisation or reconfiguration, it is possible that multiple
threads are trying to create a TLS context and associated data (like
TLS certs store) concurrently. In some cases, a thread might be too
late to add newly created data to the TLS contexts cache, in which
case it needs to be discarded. In the code that handles that case, it
was not taken into account that, in some cases, the TLS certs store
could not have been created or should not be deleted, as it is being
managed by the TLS contexts cache already. Deleting the store in such
cases might lead to crashes.

This commit fixes the issue.

(cherry picked from commit b109fa9192)
2023-12-06 17:06:51 +02:00
Mark Andrews 44e4b5cb4a Merge branch '4432-pointers-dereferenced-before-being-checked-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Pointers Dereferenced before Being Checked" !8508

See merge request isc-projects/bind9!8544
2023-12-05 23:08:27 +00:00
Mark Andrews 3aaf20a2dc Ineffective DbC protections
Dereference before NULL checks.  Thanks to Eric Sesterhenn from X41
D-Sec GmbH for reporting this.

(cherry picked from commit decc17d3b0)
2023-12-06 09:01:05 +11:00
Michal Nowak 9736338bc3 Merge branch 'mnowak/drop-openbsd-system-test-job-9.18' into 'bind-9.18'
[9.18] Drop OpenBSD system test CI job

See merge request isc-projects/bind9!8540
2023-12-05 15:58:07 +00:00
Michal Nowak 9436384969 Run "make check" in system:gcc:sid:amd64
Following the discontinuation of the OpenBSD system test in CI, transfer
the execution of the system test using the "make check" method to the
Debian "sid" system test CI job.

(cherry picked from commit 27d51d6ab6)
2023-12-05 16:25:54 +01:00
Michal Nowak 84541be86d Drop OpenBSD system test CI job
The system tests on OpenBSD consistently exhibit lower stability
compared to our other CI platforms. Some of these challenges are
intrinsic to the system test itself and require attention. However,
there are OpenBSD issues, which seem to be more widespread on this
platform than others. In our daily CI pipelines, OpenBSD system tests
often bear the brunt of all failed CI jobs.

It's possible that our OpenBSD CI image could be optimized, but we
currently lack the domain-specific knowledge needed to make
improvements.

(cherry picked from commit 2ab292c169)
2023-12-05 16:24:04 +01:00
Tom Krizek 8fe21a15ce Merge branch '4452-pytest-improve-assert-messages-9.18' into 'bind-9.18'
[9.18] Improve assert messages in pytests

See merge request isc-projects/bind9!8538
2023-12-05 14:26:49 +00:00
Tom Krizek 41ce14f389 Refactor statschannel test to use isctest
Use common utility functions in favor of duplicating the code in a
test-specific file.

(cherry picked from commit 5de2b07daa)
2023-12-05 14:27:41 +01:00
Tom Krizek 1fe70c6095 Add system test utility package isctest
Create a utility package for code shared by the python tests. The
utility functions should use reasonable defaults and be split up into
modules according to their functionality.

Ensure assert rewriting is enabled for the modules to get the most
useful output from pytest.

(cherry picked from commit cba5a1d62c)
2023-12-05 14:27:41 +01:00
Tom Krizek 4e74513c1b Simplify statsport fixture in statschannel test
The ports fixture provides the required port numbers already and there's
no need to get the port number from environment.

(cherry picked from commit f0481c8600)
2023-12-05 14:27:41 +01:00
Tom Krizek cf81c9e833 Allow assertion message rewrite in statschannel test
By default, the useful assertion message rewrite is used by pytest for
test modules only. Since another module is imported with shared
functionality, ensure it has pytest's assertion message rewriting
enabled to obtain more debug information in case it fails.

(cherry picked from commit a57af8163a)
2023-12-05 14:27:41 +01:00
Tom Krizek 33b61de350 Move helper functions in statchannel into single file
Since dnspython is now a required dependency, there's no need to keep
these two helper files separate.

(cherry picked from commit fc295b2b5d)
2023-12-05 14:27:40 +01:00
Tom Krizek ad133d4c1c Add assert message to test doth/stress_http_quota.py
This file is executed outside of pytest with pure python, which doesn't
do any AssertionError message rewriting like pytest. Ensure the assert
messages in this file provide a useful debug message.

(cherry picked from commit 767f4670c6)
2023-12-05 14:27:37 +01:00
Tom Krizek 46925fb8f5 Merge branch '4421-deprecate-AES-based-DNS-cookies-9.18' into 'bind-9.18'
[9.18] Deprecate AES algorithm for DNS cookies

See merge request isc-projects/bind9!8486
2023-12-05 10:28:38 +00:00
Ondřej SurýandTom Krizek a9e4d6c682 Add CHANGES and release note for [GL #4421]
(cherry picked from commit 2a3b3beaf1)
2023-12-05 10:54:01 +01:00
Ondřej SurýandTom Krizek 1285238d95 Deprecate AES algorithm for DNS cookies
The AES algorithm for DNS cookies was being kept for legacy reasons,
and it can be safely removed in the next major release.  Mark is as
deprecated, so the `named-checkconf` prints a warning when in use.

(cherry picked from commit 67d14b0ee5)
2023-12-05 10:52:03 +01:00
Michal Nowak 3b24611844 Merge branch '3198-add-rr-record-9.18' into 'bind-9.18'
[9.18] Add support for recording named with rr

See merge request isc-projects/bind9!8536
2023-12-04 19:51:39 +00:00
Michał KępieńandMichal Nowak a195d9b126 Do not daemonize named instances with custom args
This enables the "logfileconfig" and "rpzextra" system tests to pass
when named is started under the supervision of rr (USE_RR=1).

(cherry picked from commit 422286e9c2)
2023-12-04 19:30:03 +01:00
Michal Nowak 3bd3dfd187 Fix process listing string of rpzextra ns3 server
(cherry picked from commit 920af590d1)
2023-12-04 19:28:49 +01:00
Michal Nowak 72760c0c2b Add support for recording named runtime with rr
The traces of the named process are stored in the directory
$system_test/nsX/named-Y/.

(cherry picked from commit e088e8a992)
2023-12-04 19:28:05 +01:00
Ondřej SurýandMichal Nowak b83b9dc2c6 Remove support for running system tests under Valgrind
Valgrind support has been scarcely used.

(cherry picked from commit 658d62a6f4)
2023-12-04 19:26:25 +01:00
Michal Nowak 7e5035be3c Merge branch 'mnowak/freebsd-14.0-9.18' into 'bind-9.18'
[9.18] Add FreeBSD 14.0

See merge request isc-projects/bind9!8533
2023-12-04 16:02:46 +00:00
Michal Nowak 3e791c64a7 Add FreeBSD 14.0
(cherry picked from commit 9152fc40a8)
2023-12-04 16:28:28 +01:00
Arаm Sаrgsyаn ece18ccf97 Merge branch '1229-dig-no-yaml-output-when-host-is-unreachable-9.18' into 'bind-9.18'
[9.18] Resolve "No YAML output in dig when host is unreachable"

See merge request isc-projects/bind9!8529
2023-12-04 12:21:10 +00:00
Aram Sargsyan 2552f731c5 Add a CHANGES note for [GL #1229]
(cherry picked from commit ed879c41f2)
2023-12-04 10:40:26 +00:00
Aram Sargsyan 4181a187a1 Emit "no servers could be reached" also for UDP setup failure
When all the servers are exhausted for UDP setup emit "no servers
could be reached" in udp_ready(). This message can also be emitted
for a recv_done() error and for TCP connection failure similarly.

(cherry picked from commit 4d529ee12a)
2023-12-04 10:39:46 +00:00
Petr Špaček 350ab23f6c Merge branch '4417-stale-hyperlinks-in-the-arm-9.18' into 'bind-9.18'
[9.18] Fix stale hyperlinks in the ARM

See merge request isc-projects/bind9!8528
2023-12-04 10:02:35 +00:00
Suzanne GoldlustandPetr Špaček 0f7c92ff4b Fix broken link to TLD DNSSEC stats
(cherry picked from commit 15eea792b9)
2023-12-04 11:01:37 +01:00
Suzanne GoldlustandPetr Špaček dd99c8bc3e Fix broken link to OMB memo
(cherry picked from commit 1482f5b1ed)
2023-12-04 11:01:37 +01:00
Michał Kępień 6817bf1284 Merge branch 'michal/minor-gitlab-ci-cleanup-9.18' into 'bind-9.18'
[9.18] Minor GitLab CI cleanup

See merge request isc-projects/bind9!8512
2023-11-21 09:31:33 +00:00
Michał Kępień 2d1f51d627 Move job definitions to the proper place
The definitions of the "ci-variables" and "cross-version-config-tests"
GitLab CI jobs were accidentally added in the .gitlab-ci.yml section
that claims to only contain job templates.  Move the definitions of
these two jobs to a more appropriate location in .gitlab-ci.yml, without
changing the job definitions themselves.

(cherry picked from commit 192cceba5a)
2023-11-21 10:29:21 +01:00
Michał Kępień c81c4f3f96 Drop the TARBALL_EXTENSION variable
All currently supported BIND 9 branches use xz-packed tarballs for
source code distribution.  Having a variable with a lengthy name that
only holds two characters does not improve readability - it was only
useful for maintaining .gitlab-ci.yml consistency between BIND 9.11 and
all the newer branches, but that era has come to an end a while ago.

Replace all occurrences of the TARBALL_EXTENSION variable in
.gitlab-ci.yml with a fixed string ("xz") to simplify the contents of
that file.

(cherry picked from commit 832c7d4396)
2023-11-21 10:29:21 +01:00
Matthijs Mekking 144c7d0d9d Merge branch 'matthijs-lexopt-escape-public-key-9.18' into 'bind-9.18'
[9.18] Recognize escapes when reading the public key

See merge request isc-projects/bind9!8504
2023-11-20 12:40:43 +00:00
Matthijs Mekking 004236e5f2 Add CHANGES
(cherry picked from commit 53657591fa)
2023-11-20 12:10:30 +01:00
Matthijs Mekking cf23303dd9 Add a DNSSEC policy test case for a special zone
Try to create a key for a zone, and then sign it, that has some special
characters in the name.

(cherry picked from commit 6a4f3ec242)
2023-11-20 12:10:30 +01:00
Matthijs Mekking 3c244da9d4 Recognize escapes when reading the public key
Escapes are valid in DNS names, and should be recognized when reading
the public key from disk.

(cherry picked from commit 71f023a1c3)
2023-11-20 08:35:30 +01:00
Mark Andrews 79e2a91cb4 Merge branch '4396-dig-does-not-display-yaml-output-for-errors-when-using-protocols-other-than-udp-bind-9.18' into 'bind-9.18'
[9.18] Resolve "dig does not display YAML output for errors when using protocols other than UDP"

See merge request isc-projects/bind9!8503
2023-11-20 03:14:58 +00:00
Mark Andrews ad9c39ebad Add CHANGES for [GL #4396]
(cherry picked from commit f813795c6f)
2023-11-20 13:41:11 +11:00
Mark Andrews 734061ac1b Emit "no servers could be reached" for TCP as well as UDP
When all the servers are exhausted for TCP emit "no servers could
be reached" in tcp_connected.  This message is already emitted for
UDP.

(cherry picked from commit 831efa40d6)
2023-11-20 13:40:19 +11:00
Evan Hunt 4e31215c20 Merge branch '3983-secondary-loadtime-bind-9.18' into 'bind-9.18'
[9.18] set loadtime during initial transfer of a secondary zone

See merge request isc-projects/bind9!8498
2023-11-16 05:53:00 +00:00
Evan Hunt 6b47d98a95 set loadtime during initial transfer of a secondary zone
when transferring in a non-inline-signing secondary for the first time,
we previously never set the value of zone->loadtime, so it remained
zero. this caused a test failure in the statschannel system test,
and that test case was temporarily disabled.  the value is now set
correctly and the test case has been reinstated.

(cherry picked from commit 9643281453)
2023-11-15 18:06:58 -08:00
Mark Andrews 95d75b653c Merge branch '4433-supplied-buffer-too-large-in-wire_test-c-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Supplied Buffer Too Large in wire_test.c"

See merge request isc-projects/bind9!8497
2023-11-16 02:01:21 +00:00
Mark Andrews 617f73426d Adjust comment to have correct message limit value
(cherry picked from commit 560c245971)
2023-11-16 12:22:08 +11:00
Mark Andrews dc0671e724 Adjust message buffer sizes in test code
(cherry picked from commit cbfcdbc199)
2023-11-16 12:22:08 +11:00
Mark Andrews ab2a450887 Check that buffer length in dns_message_renderbegin
The maximum DNS message size is 65535 octets. Check that the buffer
being passed to dns_message_renderbegin does not exceed this as the
compression code assumes that all offsets are no bigger than this.

(cherry picked from commit a069513234)
2023-11-16 12:22:08 +11:00
Michał Kępień d30902f9cf Merge tag 'v9.18.20' into bind-9.18 2023-11-15 14:57:53 +01:00
Michal Nowak ed78bc4a01 Merge branch 'mnowak/fedora-39-9.18' into 'bind-9.18'
[9.18] Add Fedora 39

See merge request isc-projects/bind9!8491
2023-11-14 19:21:02 +00:00
Michal Nowak 59b2452c7a Add Fedora 39
(cherry picked from commit cdb4b97b28)
2023-11-14 19:34:52 +01:00
Ondřej Surý 50a7594475 Merge branch 'ondrej-clang-format-17-bind-9.18' into 'bind-9.18'
Reformat sources with up-to-date clang-format-17

See merge request isc-projects/bind9!8489
2023-11-13 16:22:04 +00:00
Ondřej Surý eaadc30b4d Ignore clang-format reformat 2023-11-13 17:13:58 +01:00
Ondřej Surý 6a85e79c0b Reformat sources with up-to-date clang-format-17 2023-11-13 17:13:07 +01:00
Petr Špaček 957eb31680 Merge branch 'pspacek/set-up-version-and-release-notes-for-bind-9.18.21' into 'bind-9.18'
Set up version and release notes for BIND 9.18.21

See merge request isc-projects/bind9!8483
2023-11-10 13:20:57 +00:00
Petr Špaček c1fbdc6c5a Set up release notes for BIND 9.18.21 2023-11-10 14:04:03 +01:00
Petr Špaček 9a2665efde Update BIND version to 9.18.21-dev 2023-11-10 14:04:03 +01:00
Michał Kępień 396c2b43f4 Update BIND version for release 2023-11-09 13:41:09 +01:00
Michał Kępień 16c123df5e Add a CHANGES marker 2023-11-09 13:41:09 +01:00
Michał Kępień 69c60db1d4 Merge branch 'michal/prepare-documentation-for-bind-9.18.20' into 'v9.18.20-release'
Prepare documentation for BIND 9.18.20

See merge request isc-private/bind9!592
2023-11-09 12:40:14 +00:00
Michał Kępień 965405211a Reorder release notes 2023-11-09 13:10:33 +01:00
Michał Kępień d12076f9f4 Tweak and reword release notes 2023-11-09 13:10:33 +01:00
Michał Kępień 87c0ac8cf9 Prepare release notes for BIND 9.18.20 2023-11-09 13:10:33 +01:00
Michał Kępień d4cd418c94 Tweak CHANGES entry for [GL #4260] 2023-11-09 13:10:33 +01:00
Michał Kępień d50b55ef6d Tweak CVE-2021-25219 reference 2023-11-09 13:10:33 +01:00
Michał Kępień 450019ba83 Merge branch 'ondrej/remove-i386-as-fully-supported-platform-9.18' into 'bind-9.18'
[9.18] Move i386 and armhf to the Best-Effort category

See merge request isc-projects/bind9!8475
2023-11-08 12:14:02 +00:00
Ondřej SurýandMichał Kępień ac63acdb3b Split the CPU architectures into more categories
Move i386 and other less common or ancient CPU architectures to
Community-Maintened category.  Move armhf and arm64 to the Best-Effort
category as we do test them as part of development work (new MacBooks
are all arm64), we don't really do full set of tests in the CI.

(cherry picked from commit db94c7526c)
2023-11-08 13:01:40 +01:00
Evan Hunt acbe660771 Merge branch 'each-fix-ntadump' into 'bind-9.18'
[9.18] Fix missing newlines in output of `rndc nta -dump`

See merge request isc-projects/bind9!8466
2023-11-03 13:08:07 +00:00
Evan Hunt 9a4ccdf4fc CHANGES for [GL !8454]
(cherry picked from commit 37b101b6e2)
2023-11-03 08:28:18 +01:00
Tony FinchandEvan Hunt 1b138a5883 Fix missing newlines in output of rndc nta -dump
There were no newlines between each view in the list of negative trust
anchors.

(cherry picked from commit 61b245e318)
2023-11-03 08:28:18 +01:00
Mark Andrews 27cf95ac98 Merge branch '4101-update-b-root-server-net-addresses-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Update b.root-server.net addresses"

See merge request isc-projects/bind9!8462
2023-11-02 17:19:05 +00:00
Mark Andrews 3b55342a4b Add release note for [GL #4101]
(cherry picked from commit c7a06b1fa1)
2023-11-03 03:44:30 +11:00
Mark Andrews a4c447f9e3 Add CHANGES note for [GL #4101]
(cherry picked from commit b9bba29c5e)
2023-11-03 03:44:27 +11:00
Mark Andrews ba7cfd2f92 Suppress reporting upcoming changes in root hints
To reduce the amount of log spam when root servers change their
addresses keep a table of upcoming changes by expected date and time
and suppress reporting differences for them until then.

Add initial entry for B.ROOT-SERVERS.NET, Nov 27, 2023.

(cherry picked from commit b69100b747)
2023-11-03 03:43:49 +11:00
Mark Andrews 15e13bd523 Update b.root-servers.net IP addresses
This covers both root hints and the default primaries for the root
zone mirror.  The official change date is Nov 27, 2023.

(cherry picked from commit 2ca2f7e985)
2023-11-03 03:43:49 +11:00
Mark Andrews 1664f95c66 Merge branch '4406-cleanup-b-in-dnstap-main-bind-9.18' into 'bind-9.18'
[9.18] Resolve "cleanup 'b' in dnstap-read main"

See merge request isc-projects/bind9!8460
2023-11-02 10:53:15 +00:00
Mark Andrews b4352bbc6f Cleanup dead code in dnstap-read
Remove 'b' from main as it is unused.

(cherry picked from commit 0482451f84)
2023-11-02 10:09:44 +00:00
Tom Krizek 09c2dab315 Merge branch '4401-make-check-fix-junitxml-output-processing-9.18' into 'bind-9.18'
[9.18] Fix pytest junitxml output processing for make check

See merge request isc-projects/bind9!8459
2023-11-02 09:30:31 +00:00
Tom Krizek 8c8ff7faea Fix pytest junitxml output processing for make check
Not every element tagged `skipped` in the JUnitXML tree has to contain
the `type` attribute. An example of that is a test that results in
xpass.

This has been verified with pytest version 7.4.2 and prior.

(cherry picked from commit ba25ecd2d2)
2023-11-02 10:02:51 +01:00
Michał Kępień 9199555db9 Merge branch 'michal/add-a-release-signing-job-to-gitlab-ci-9.18' into 'bind-9.18'
[9.18] Add a release signing job to GitLab CI

See merge request isc-projects/bind9!8457
2023-11-02 06:36:22 +00:00
Michał Kępień dd217e1acf Add a release signing job to GitLab CI
Add a GitLab CI job that is only run for tags and makes signing BIND 9
releases more convenient by utilizing a signing VM that is registered as
a GitLab CI runner.  This pulls the signing process into the release
pipelines in GitLab CI, resulting in job artifacts containing the
signatures for BIND 9 releases, which in turns simplifies the subsequent
release publication steps.

(cherry picked from commit a3a91a1557)
2023-11-02 07:23:38 +01:00
Michał Kępień 8f1dd1751e Merge branch '4404-improve-stability-of-the-jemalloc-workaround' into 'bind-9.18'
Improve stability of the jemalloc workaround

See merge request isc-projects/bind9!8453
2023-11-01 17:04:36 +00:00
Michał Kępień e974f98eb4 Improve stability of the jemalloc workaround
When jemalloc is linked into BIND 9 binaries (rather than preloaded or
used as the system allocator), depending on the decisions made by the
linker, the malloc() symbol may be resolved to a non-jemalloc
implementation at runtime.  Such a scenario foils the workaround added
in commit 2da371d005 as it relies on the
jemalloc implementation of malloc() to be executed.

Handle the above scenario properly by calling mallocx() explicitly
instead of relying on the runtime resolution of the malloc() symbol.
Use trivial wrapper functions to avoid the need to copy multiple #ifdef
lines from lib/isc/mem.c to lib/isc/trampoline.c.  Using a simpler
alternative, e.g. calling isc_mem_create() & isc_mem_destroy(), was
already considered before and rejected, as described in the log message
for commit 2da371d005.

ADJUST_ZERO_ALLOCATION_SIZE() is only used in isc__mem_free_noctx() to
concisely avoid compilation warnings about its 'size' parameter not
being used when building against jemalloc < 4.0.0 (as sdallocx() is then
redefined to dallocx(), which has a different signature).
2023-11-01 18:04:07 +01:00
Tom Krizek 3488ada94b Merge branch 'tkrizek/perf-tests-shotgun-9.18' into 'bind-9.18'
[9.18] Add DNS Shotgun performance tests to nightly pipelines

See merge request isc-projects/bind9!8452
2023-11-01 14:18:14 +00:00
Tom Krizek a303fa25ac Update release checklist
Add a step to verify results of shotgun:* jobs.

(cherry picked from commit 322dfbf6a9)
2023-11-01 14:41:40 +01:00
Tom Krizek 61f1305b4b ci: trigger a DNS Shotgun performance test
Run comparative performance tests against the latest released version of
the same branch. This is done for different protocols with an
appropriate load the server is expected to be able to handle.

Currently, the results need to be inspected manually, since a success of
the job doesn't indicate there is no issue. Instead, the job provides an
URL to an overview with latency, memory and CPU charts which display the
test results with the current code against the reference version. There
should be no major unexplained and reproducible differences in the
charts.

(cherry picked from commit c7fcb1ca60)
2023-11-01 14:39:31 +01:00
Tom Krizek 1ff49ab199 util: script to get DNS Shotgun pipeline results
The shotgun performance tests are executed in a different repository, in
a couple of different pipelines. To hide away the complexity, this
script takes the pipeline ID of the triggered pipeline and then takes
care of the rest - waits for the pipeline to finish, locates the child
pipeline and the relevant results. The output from this script is a
convenient link to the charts with the results once they're available.

GitLab also has a mechanism which can wait for another pipeline.
However, it can't be utilized here, since there are variables which
need to be passed in when the pipeline is triggered (like protocol to be
tested, load, runtime etc.). This isn't currently supported by the
GitLab feature.

(cherry picked from commit ff32421a64)
2023-11-01 14:39:31 +01:00
Tom Krizek 4ad89d8e34 ci: move baseline version detection into separate job
Multiple CI jobs may utilize a baseline version, i.e. the version that
the current code should be tested against when doing comparative
testing. To avoid repeating the non-trivial detection of the baseline
version, move it into a separate job which creates an environment file
that subsequent jobs may require via `needs` option. It is then possible
to use the variable(s) defined in the script section of the new job.

(cherry picked from commit ef4e2d2964)
2023-11-01 14:39:29 +01:00
Matthijs Mekking 51f3b118dd Merge branch '4355-serve-stale-unexpected-recursion-9.18' into 'bind-9.18'
[9.18] Don't ignore authoritative local zones when in serve-stale mode

See merge request isc-projects/bind9!8446
2023-10-31 13:32:52 +00:00
Matthijs Mekking 87e21a716e Add release note and CHANGES for #4355
(cherry picked from commit ac19d43a32)
2023-10-31 14:01:21 +01:00
Matthijs Mekking 76c9019403 Don't ignore auth zones when in serve-stale mode
When serve-stale is enabled and recursive resolution fails, the fallback
to lookup stale data always happens in the cache database. Any
authoritative data is ignored, and only information learned through
recursive resolution is examined.

If there is data in the cache that could lead to an answer, and this can
be just the root delegation, the resolver will iterate further, getting
closer to the answer that can be found by recursing down the root, and
eventually puts the final response in the cache.

Change the fallback to serve-stale to use 'query_getdb()', that finds
out the best matching database for the given query.

(cherry picked from commit 2322425016)
2023-10-31 13:52:08 +01:00
Matthijs Mekking 784b096098 Test case for issue #4355
Add a test case where serve-stale is enabled on a server that also
servers a local authoritative zone.

The particular case tests a lame delegation and checks if falling
back to serving stale data does not attempt to retrieve the query
by recursing from the root down.

(cherry picked from commit e196ba6168)
2023-10-31 13:52:01 +01:00
Michal Nowak 15f664171d Merge branch 'mnowak/openbsd-7.4-9.18' into 'bind-9.18'
[9.18] Add OpenBSD 7.4

See merge request isc-projects/bind9!8434
2023-10-30 12:18:34 +00:00
Michal Nowak 0c3bd09595 Add OpenBSD 7.4
(cherry picked from commit f8733fc051)
2023-10-30 12:12:50 +01:00
Mark Andrews 3a7c7693d7 Merge branch '4393-only-declare-engine-when-used' into 'bind-9.18'
Resolve "error: variable 'engine' set but not used on OpenBSD 7.4"

See merge request isc-projects/bind9!8436
2023-10-27 05:56:25 +00:00
Mark Andrews 8b11061b91 Only declare 'engine' if it is used
Move the declaration of 'engine' within the appropriate #if/#endif
block.  Remove the UNUSED(engine) from the #else block.
2023-10-27 10:49:38 +11:00
Arаm Sаrgsyаn 9c50e0fb8d Merge branch 'aram/fix-lock-file-option-and--X-argument-issues-9.18' into 'bind-9.18'
[9.18] Fix assertion failure when using -X none and lock-file in configuration

See merge request isc-projects/bind9!8433
2023-10-26 13:49:30 +00:00
Aram Sargsyan 08de15e5f2 Do not warn about lock-file option change when -X is used
When -X is used the 'lock-file' option change detection condition
is invalid, because it compares the 'lock-file' option's value to
the '-X' argument's value instead of the older 'lock-file' option
value (which was ignored because of '-X').

Don't warn about changing 'lock-file' option if '-X' is used.

(cherry picked from commit 41945b32d7)
2023-10-26 13:12:57 +00:00
Aram Sargsyan 4ed32424c8 Fix an invalid condition check when detecting a lock-file change
It is obvious that the '!cfg_obj_asstring(obj)' check should be
'cfg_obj_asstring(obj)' instead, because it is an AND logic chain
which further uses 'obj' as a string.

Fix the error.

(cherry picked from commit bc891e749f)
2023-10-26 13:12:52 +00:00
Aram Sargsyan 1bff704681 Fix assertion failure when using -X none and lock-file in configuration
When 'lock-file <lockfile>' is used in configuration at the same time
as using '-X none' in 'named' invocation, there is an invalid
logic that would lead to a isc_mem_strdup() call on a NULL value.

Also, contradicting to ARM, 'lock-file none' is overriding the '-X'
argument.

Fix the overall logic, and make sure that the '-X' takes precedence to
'lock-file'.

(cherry picked from commit fc2dd09390)
2023-10-26 13:12:47 +00:00
Ondřej Surý cdd68a3700 Merge branch '4386-fix-assertion-failure-when-using--X-named-option-9.18' into 'bind-9.18'
[9.18] Fix assertion failure when using -X and lock-file in configuration

See merge request isc-projects/bind9!8430
2023-10-26 12:07:54 +00:00
Ondřej Surý cdf7c34a58 Add CHANGES and release note for [GL #4386]
(cherry picked from commit 8294a43acf)
2023-10-26 13:59:46 +02:00
Ondřej Surý d9fc95f842 Fix assertion failure when using -X and lock-file in configuration
When 'lock-file <lockfile1>' was used in configuration at the same time
as using `-X <lockfile2>` in `named` invocation, there was an invalid
logic that would lead to a double isc_mem_strdup() call on the
<lockfile2> value.

Skip the second allocation if `lock-file` is being used in
configuration, so the <lockfile2> is used only single time.

(cherry picked from commit 4f68def5e9)
2023-10-26 13:59:46 +02:00
Tom Krizek bf330dc3cc Merge branch 'tkrizek/shfmt-9.18' into 'bind-9.18'
[9.18] Enforce shell script codestyle with shfmt

See merge request isc-projects/bind9!8429
2023-10-26 11:59:05 +00:00
Tom Krizek 914654efeb Ignore shell script formatting in git blame
(cherry picked from commit c8fb0b48e0)
2023-10-26 13:07:44 +02:00
Tom Krizek 5bd67594b1 Add editorconfig file for shell style
(cherry picked from commit bebdfa13be)
2023-10-26 13:06:55 +02:00
Tom Krizek a17230fefb Run shfmt in CI
Ensure our shell script format stays consistent in the future.

(cherry picked from commit b6505ff573)
2023-10-26 13:06:53 +02:00
Tom Krizek b8b9b4ac2c Reformat shell scripts with shfmt
All changes in this commit were automated using the command:

shfmt -w -i 2 -ci -bn . $(find . -name "*.sh.in")

By default, only *.sh and files without extension are checked, so
*.sh.in files have to be added additionally. (See mvdan/sh#944)

(manually replayed commit 4cb8b13987)
2023-10-26 13:05:00 +02:00
Mark Andrews fd2e6f90a4 Merge branch '4387-lock-file-is-deleted-on-exit-even-if-lock-acquisition-failed-bind-9.18' into 'bind-9.18'
[9.18] Resolve "lock file is deleted on exit even if lock acquisition failed"

See merge request isc-projects/bind9!8424
2023-10-26 07:47:14 +00:00
Mark Andrews 81b5a94ad8 Add release note for [GL #4387]
(cherry picked from commit c1b8279ebb)
2023-10-26 18:05:26 +11:00
Mark Andrews 46870c74e6 Add CHANGES note for [GL #4387]
(cherry picked from commit a8613372c9)
2023-10-26 18:05:25 +11:00
Mark Andrews 74ab7e4660 Check that the lock file was not removed too early
When named fails to starts due to not being able to obtain
a lock on the lock file that lock file should remain.  Check
that the lock file exists before and after the attempt to
start a second instance of named.

(cherry picked from commit 811c9ee7d1)
2023-10-26 18:05:07 +11:00
Mark Andrews 534cadba3a Only remove the lock file if we managed to lock it
The lock file was being removed when we hadn't successfully locked
it which defeated the purpose of the lockfile.  Adjust cleanup_lockfile
such that it only unlinks the lockfile if we have successfully locked
the lockfile and it is still active (lockfile != NULL).

(cherry picked from commit b9c789b8b3)
2023-10-26 18:05:07 +11:00
Arаm Sаrgsyаn d18be57900 Merge branch '4381-assert-in-dns__catz_update_cb-on-shutdown-9.18' into 'bind-9.18'
[9.18] Resolve "Assertion failure in dns__catz_update_cb() on shutdown"

See merge request isc-projects/bind9!8413
2023-10-23 11:08:16 +00:00
Aram Sargsyan 4f29e514df Add a CHANGES note for [GL #4381]
(cherry picked from commit 598107f1c2)
2023-10-23 10:53:40 +00:00
Aram Sargsyan 2141bde46b Fix shutdown races in catzs
The dns__catz_update_cb() does not expect that 'catzs->zones'
can become NULL during shutdown.

Add similar checks in the dns__catz_update_cb() and dns_catz_zone_get()
functions to protect from such a case. Also add an INSIST in the
dns_catz_zone_add() function to explicitly state that such a case
is not expected there, because that function is called only during a
reconfiguration.

(cherry picked from commit 4eb4fa288c)
2023-10-23 10:53:40 +00:00
Michal Nowak 59294c4320 Merge branch 'mnowak/drop-ubuntu-bionic' into 'bind-9.18'
Drop Ubuntu 18.04 "bionic"

See merge request isc-projects/bind9!8365
2023-10-23 09:52:13 +00:00
Michal Nowak 6d100c4a32 Drop Ubuntu 18.04 "bionic"
Ubuntu 18.04 LTS (Bionic Beaver) is EOL.

Move gcc:bionic:amd64-specific CFLAGS and EXTRA_CONFIGURE to
gcc:jammy:amd64.
2023-10-23 11:47:01 +02:00
Michal Nowak a9a2700672 Merge branch '4152-reproducer-stack-exhaustion-9.18' into 'bind-9.18'
[9.18] Add test for CVE-2023-3341

See merge request isc-projects/bind9!8411
2023-10-20 14:56:57 +00:00
Michal Nowak 114551659e Add test for CVE-2023-3341
(cherry picked from commit 7d1834b250)
2023-10-20 16:27:31 +02:00
Mark Andrews d25813a08a Merge branch '4260-adjust-udp-refresh-timeouts-bind-9.18' into 'bind-9.18'
[9.18] Adjust UDP zone maintenance timeouts

See merge request isc-projects/bind9!8405
2023-10-20 00:45:26 +00:00
Mark Andrews 593647bde5 add CHANGES for [GL #4260]
(cherry picked from commit 1a9791b4d8)
2023-10-20 00:16:01 +00:00
Mark Andrews 306ee4cb28 Adjust UDP timeouts used in zone maintenance
Drop timeout before resending a UDP request from 15 seconds to 5
seconds and add 1 second to the total time to allow for the reply
to the third request to arrive.  This will speed up the time it
takes for named to recover from a lost packet when refreshing a
zone and for it to determine that a primary is down.

(cherry picked from commit 29f399797d)
2023-10-20 00:16:01 +00:00
Mark Andrews f82844aee1 Merge branch '4378-uv_sleep-wrapper-misses-parentheses-causing-unit-test-hang-bind-9.18' into 'bind-9.18'
[9.18] Resolve "uv_sleep wrapper misses parentheses, causing unit test hang"

See merge request isc-projects/bind9!8404
2023-10-20 00:05:31 +00:00
Mark Andrews ebfbad29c1 Add parentheses around macro arguement 'msec'
The is needed to ensure that the multiplication is correctly done.
This was reported by Jinmei Tatuya.
2023-10-20 10:30:48 +11:00
Michal Nowak b0f3a440f1 Merge branch 'mnowak/llvm-17-9.18' into 'bind-9.18'
[9.18] Update clang to version 17

See merge request isc-projects/bind9!8398
2023-10-18 07:42:36 +00:00
Michal Nowak 7c6632e174 Update the source code formatting using clang-format-17 2023-10-18 09:02:57 +02:00
Michal Nowak 1cf082baa6 Update clang to version 17
(cherry picked from commit 625a4ffc7a)
2023-10-18 09:02:18 +02:00
Mark Andrews 5c35ca97b9 Merge branch '4368-callback-prototype-mismatch' into 'bind-9.18'
Resolve "tcp_noresponse check fails with LLVM 17"

See merge request isc-projects/bind9!8394
2023-10-17 22:06:16 +00:00
Mark Andrews a25ab7ec25 Fix callback to match prototype
noop_accept_cb triggers an undefined behaviour failure with LLVM 17.
The return type mismatched the prototype.  Also return ISC_R_SUCCESS
instead of 0.
2023-10-17 17:47:24 +11:00
Mark Andrews bde42c4293 Merge branch '4365-update-dangerfile-py-to-know-about-cve-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Update dangerfile.py to know about `:cve:`"

See merge request isc-projects/bind9!8391
2023-10-17 02:51:34 +00:00
Mark Andrews da6077b7f7 Update dangerfile.py to know about ':cve:'
(cherry picked from commit dbc2167325)
2023-10-17 13:19:12 +11:00
Matthijs Mekking 837082fbfb Merge branch 'matthijs-kasp-system-test-nit-fixes-v9_18' into 'bind-9.18'
Two minor fixes in the kasp system test

See merge request isc-projects/bind9!8390
2023-10-16 11:19:33 +00:00
Matthijs Mekking e3f65d465c Two minor fixes in the kasp system test
The 'dynamic-signed-inline-signing.kasp' zone was set up with
the environment variable 'ksktimes', but that should be 'csktimes'
which is set one line above. Since the values are currently the same
the behavior is identical, but of course it should use the correct
variable.

The 'step4.enable-dnssec.autosign' zone was set up twice. This is
unnecessary.

(cherry picked from commit 21d04f556d)
2023-10-16 12:34:52 +02:00
Matthijs Mekking bae7534a24 Merge branch '4350-resign-triggered-on-raw-dnssec-zone-9.18' into 'bind-9.18'
[9.18]  Don't schedule resign for raw version of an inline-signing zone

See merge request isc-projects/bind9!8388
2023-10-16 09:10:34 +00:00
Matthijs Mekking 641da0ff0f Add changes and release note for #4350
(cherry picked from commit a8306b541b)
2023-10-16 10:34:43 +02:00
Matthijs Mekking ac1b70ad00 Don't resign raw version of the zone
Update the function 'set_resigntime()' so that raw versions of
inline-signing zones are not scheduled to be resigned.

Also update the check in the same function for zone is dynamic, there
exists a function 'dns_zone_isdynamic()' that does a similar thing
and is more complete.

Also in 'zone_postload()' check whether the zone is not the raw
version of an inline-signing zone, preventing calculating the next
resign time.

(cherry picked from commit 741ce2d07a)
2023-10-16 10:34:17 +02:00
Matthijs Mekking e9989c541b Add test case for GL #4350
Add a test scenario for a dynamic zone that uses inline-signing which
accidentally has signed the raw version of the zone.

This should not trigger resign scheduling on the raw version of the
zone.

(cherry picked from commit c90b622648)
2023-10-16 10:33:25 +02:00
Arаm Sаrgsyаn ecebd9187c Merge branch '4360-fix-undefined-behaviours-detected-by-llvm-17-9.18' into 'bind-9.18'
[9.18] Resolve "Undefined behaviours detected by LLVM 17 (noop_accept_cb, dns__nta_shutdown_cb)"

See merge request isc-projects/bind9!8383
2023-10-13 12:10:47 +00:00
Aram Sargsyan 59741ddea9 Fix undefined behaviour occurrences
The undefined behaviour was detected by LLVM 17. Fix the affected
functions definitions to match the expected function type.

(cherry picked from commit 20fdab8667)
2023-10-13 11:25:53 +00:00
Ondřej Surý f0b21a2218 Merge branch 'ondrej/dont-undef-TRACE-define-9.18' into 'bind-9.18'
[9.18] Don't undef <unit>_TRACE, instead add comment how to enable it

See merge request isc-projects/bind9!8382
2023-10-13 11:09:08 +00:00
Ondřej Surý 905f8c5899 Don't undef <unit>_TRACE, instead add comment how to enable it
In units that support detailed reference tracing via ISC_REFCOUNT
macros, we were doing:

    /* Define to 1 for detailed reference tracing */
    #undef <unit>_TRACE

This would prevent using -D<unit>_TRACE=1 in the CFLAGS.

Convert the above mentioned snippet with just a comment how to enable
the detailed reference tracing:

    /* Add -D<unit>_TRACE=1 to CFLAGS for detailed reference tracing */

(cherry picked from commit 6afa961534)
2023-10-13 11:46:41 +02:00
Petr Špaček b12e5bc84d Merge branch 'pspacek/doc-and-build-tweaks-9.18' into 'bind-9.18'
[9.18] Describe BIND threat model

See merge request isc-projects/bind9!8379
2023-10-13 07:54:26 +00:00
Petr Špaček 43f39a266a Describe BIND threat model
Basically all local data is considered trusted, and proper ACLs and
limits need to be explicitly configured. We are also free to let
protocol non-compliant servers burn in flames.

(cherry picked from commit fc907baa7f)
2023-10-13 09:26:57 +02:00
Michał Kępień ee3ac71622 Merge branch 'michal/install-pdf-dependencies-on-demand-in-gitlab-ci' into 'bind-9.18'
Install PDF dependencies on demand in GitLab CI

See merge request isc-projects/bind9!8351
2023-10-12 13:09:15 +00:00
Michał Kępień 29cba33d44 Install PDF dependencies on demand in GitLab CI
Building the PDF version of the BIND 9 ARM requires TeX Live to be
present on the build host.  A TeX Live installation takes up several
gigabytes of disk space.  This significantly increases the size of the
Debian Docker images that include that toolchain, even though only two
GitLab CI jobs actually use it.

Instead of including TeX Live in the Docker image itself, install the
former on demand in a new GitLab CI job that only tests building the PDF
version of the BIND 9 ARM.  Do the same for qpdf, a tool used for
checking the PDF output produced by TeX Live.  This enables the size of
the "base" Docker image (which a lot of GitLab CI jobs need to pull) to
remain within reasonable limits.  As downloading and installing TeX Live
takes a significant amount of time, only run the new job in scheduled
pipelines and for tags.  Adjust job dependencies so that the "release"
job continues to work.
2023-10-12 14:27:35 +02:00
Michał Kępień 02df1a681e Merge branch 'michal/move-linux-stress-tests-to-autoscaled-instances-9.18' into 'bind-9.18'
[9.18] Move Linux "stress" tests to autoscaled instances

See merge request isc-projects/bind9!8362
2023-10-06 11:12:06 +00:00
Michał Kępień 1f9d59f726 Move Linux "stress" tests to autoscaled instances
The autoscaling GitLab CI runners currently used for most GitLab CI jobs
spin up AWS EC2 instances that are at least as powerful as the dedicated
instances used for running "stress" tests.  Move all Linux-based
"stress" tests to autoscaling GitLab CI runners to enable deprovisioning
Linux AWS instances reserved for running "stress" tests.  Leave FreeBSD
"stress" tests intact as there is currently no support for autoscaling
BSD instances.

(cherry picked from commit 12ea994680)
2023-10-06 13:10:09 +02:00
Michal Nowak 0de0cc0206 Merge branch 'mnowak/monitor-stuck-system-tests-9.18' into 'bind-9.18'
[9.18] Report hung system tests

See merge request isc-projects/bind9!8360
2023-10-06 07:20:44 +00:00
Michal Nowak 28bae02a96 Report hung system tests
At times, a problem might occur where a test is not responding,
especially in the CI, determining the specific test responsible can be
difficult. Fortunately, when running tests with the pytest runner,
pytest sets the PYTEST_CURRENT_TEST environment variable to the current
test nodeid and stage. Afterward, the variable can be examined to
identify the test that has stopped responding.

The monitoring script needs to be started in the background. Still, the
shell executor used for BSD and FIPS testing can't handle the background
process cleanly, and the script step will wait for the background
process for the entire duration of the background process (currently
3000 seconds). Therefore, run the monitoring script only when the Docker
executor is used where this is not a problem.

(cherry picked from commit 35792b1700)
2023-10-05 19:44:41 +02:00
Petr Špaček 3ebcca683f Merge branch 'pspacek/cross-version-tests-junit-9.18' into 'bind-9.18'
[9.18] Generate and capture JUnit XML output from cross-version-config-tests

See merge request isc-projects/bind9!8358
2023-10-04 12:52:10 +00:00
Petr Špaček fccfc99b44 Generate and capture JUnit XML output from cross-version-config-tests
(cherry picked from commit f2a3eb00b9)
2023-10-04 14:51:31 +02:00
Petr Špaček 9b617a3649 Merge branch 'pspacek/fix-no-case-compression-docs-9.18' into 'bind-9.18'
[9.18] Fix no-case-compress description in the ARM

See merge request isc-projects/bind9!8355
2023-10-03 13:09:34 +00:00
Petr Špaček 241de55536 Fix no-case-compress description in the ARM
We confused ourselves, it seems.

(cherry picked from commit 6451462a93)
2023-10-03 14:37:16 +02:00
Arаm Sаrgsyаn fb8e80a6b9 Merge branch '4343-cid-465861-unnecessary-null-check-in-ns__client_setup-9.18' into 'bind-9.18'
[9.18] Remove unnecessary NULL-checks in ns__client_setup()

See merge request isc-projects/bind9!8353
2023-10-02 11:29:53 +00:00
Aram Sargsyan c061b90cc6 Remove unnecessary NULL-checks in ns__client_setup()
All these pointers are guaranteed to be non-NULL.

Additionally, update a comment to remove obviously outdated
information about the function's requirements.

(cherry picked from commit b970556f21)
2023-10-02 10:04:56 +00:00
Arаm Sаrgsyаn 4779eccdea Merge branch '4331-resolver.c-assert-uninitialized-link-9.18' into 'bind-9.18'
[9.18] Don't use an uninitialized link on an error path

See merge request isc-projects/bind9!8346
2023-09-28 11:32:25 +00:00
Aram Sargsyan 197d032aa8 Add a CHANGES note for [GL #4331]
(cherry picked from commit 9c545c3513)
2023-09-28 10:31:43 +00:00
Aram Sargsyan 92e5173a9f Don't use an uninitialized link on an error path
Move the block on the error path, where the link is checked, to a place
where it makes sense, to avoid accessing an unitialized link when
jumping to the 'cleanup_query' label from 4 different places. The link
is initialized only after those jumps happen.

In addition, initilize the link when creating the object, to avoid
similar errors.

(cherry picked from commit fb7bbbd1be)
2023-09-28 10:30:42 +00:00
Mark Andrews 87b857fad3 Merge branch '4316-dynamic-update-refused-shortly-after-zone-was-thawed-bind-9.18' into 'bind-9.18'
[9.18] Resolve "dynamic update refused shortly after zone was thawed"

See merge request isc-projects/bind9!8336
2023-09-26 04:37:26 +00:00
Mark Andrews 745db8775b Document that reloading happens asynchronously
(cherry picked from commit e33dbd0cbd)
2023-09-26 14:11:30 +10:00
Mark Andrews de94bee5f3 Wait for the test zone to finish re-loading
'rndc thaw' initiates asynchrous loading of all the zones
similar to 'rndc load'.  Wait for the test zone's load to
complete before testing that it is updatable again.

(cherry picked from commit 5b3238aa85)
2023-09-26 14:11:30 +10:00
Ondřej Surý 357584abc6 Merge branch '4327-minor-warning-about-ctype-h-function-9.18' into 'bind-9.18'
[9.18] Add semantic patch to explicitly cast chars to unsigned for ctype.h

See merge request isc-projects/bind9!8332
2023-09-22 15:41:39 +00:00
Ondřej Surý cb57e77c68 Add CHANGES note for [GL #4327]
(cherry picked from commit 0e49a8422f)
2023-09-22 17:02:17 +02:00
Ondřej Surý 818f4dc3a7 Explicitly cast chars to unsigned chars for <ctype.h> functions
Apply the semantic patch to catch all the places where we pass 'char' to
the <ctype.h> family of functions (isalpha() and friends, toupper(),
tolower()).

(cherry picked from commit 29caa6d1f0)
2023-09-22 17:01:59 +02:00
Ondřej Surý d9b8412f08 Add semantic patch to explicitly cast chars to unsigned for ctype.h
Add a semantic patch to catch all the places where we pass 'char' to the
<ctype.h> family of functions (isalpha() and friends, toupper(),
tolower()).  While it generally works because the way how these
functions are constructed in the libc, it's safer to do the explicit
cast.

(cherry picked from commit 5ec65ab5d0)
2023-09-22 17:01:18 +02:00
Michał Kępień 7ff22f5961 Merge branch 'mnowak/add-cve-ref-role-9.18' into 'bind-9.18'
[9.18] Add a Sphinx role for linking CVEs to the ISC Knowledgebase

See merge request isc-projects/bind9!8326
2023-09-21 12:37:29 +00:00
Michal NowakandMichał Kępień 5477f97643 Add a Sphinx role for linking CVEs to the ISC Knowledgebase
The new :cve: Sphinx role takes a CVE number as an argument and creates
a hyperlink to the relevant ISC Knowledgebase document that might have
more up-to-date or verbose information than the relevant release note.
This makes reaching ISC Knowledgebase pages directly from the release
notes easier.

Make all CVE references in the release notes use the new Sphinx role.

(cherry picked from commit 41b857e567)
2023-09-21 14:24:24 +02:00
Michał Kępień 56ae3eba80 Merge branch 'michal/update-sphinx-and-sphinx_rtd_theme-9.18' into 'bind-9.18'
[9.18] Update Sphinx and sphinx_rtd_theme

See merge request isc-projects/bind9!8323
2023-09-20 15:25:01 +00:00
Michał Kępień fa7fc9084f Update Sphinx and sphinx_rtd_theme
Update Sphinx-related Python packages to their current versions pulled
in by "pip install sphinx-rtd-theme" run in a fresh virtual environment.

(cherry picked from commit 2f879cdec3)
2023-09-20 17:21:50 +02:00
Michał Kępień 2f08b622bf Merge tag 'v9.18.19' into bind-9.18 2023-09-20 16:52:16 +02:00
Tom Krizek 9a97f6f70a Merge branch '4312-pytest-symlink-name-collision-9.18' into 'bind-9.18'
[9.18] Rename convenience symlink to pytest artifacts

See merge request isc-projects/bind9!8318
2023-09-20 14:36:27 +00:00
Tom Krizek 2ad197b37d Rename convenience symlink to pytest artifacts
The previous symlink name convention was prone to name collisions If a
system test contained both a shell test and a pytest module of the same
name (e.g. dnstap test has both tests.sh and tests_dnstap.py), then
these would have the same convenience symlink, which could cause test
setup issues as well as confusion when examining test artifacts.

Update the naming convention to include the full pytest module name.
This results in a slightly more verbose names for shell tests (e.g.
dnstap_sh_dnstap instead of the previous dnstap_dnstap), but it removes
the chance of a collision.

(cherry picked from commit fd13dfb097)
2023-09-20 16:04:40 +02:00
Tom Krizek 08647118ce Merge branch '4250-remove-legacy-runner-support-for-python-tests-9.18' into 'bind-9.18'
[9.18] remove support for running python system tests with legacy test runner

See merge request isc-projects/bind9!8317
2023-09-20 13:52:38 +00:00
Tom Krizek a5eb779c94 Update system test runner doc with pytest glue files
Document that pytest requires a glue file for each shell tests in order
to detect it.

(cherry picked from commit d050843a30)
2023-09-20 14:51:49 +02:00
Tom Krizek f318cc081b Add CHANGES note for [GL #4250]
(cherry picked from commit 363677bde7)
2023-09-20 14:51:47 +02:00
Tom Krizek 60c4356554 Use integers for ports fixtures in pytest
Reorganize individual port fixtures and re-use the ports fixture to
obtain their number. Store it as integer and only cast it to string when
setting it as environment variable.

(cherry picked from commit 8deb026748)
2023-09-20 14:51:05 +02:00
Tom Krizek 0ac22ebc95 Reformat conftest.py with black
(cherry picked from commit 197dac55a2)
2023-09-20 14:51:05 +02:00
Tom Krizek 7a28a76885 Remove legacy runner support from conftest.py
Remove code fork for legacy runner, reorganize imports and move a
pylint-silencing snippet to the top of the file. The rest of the code
was just unindented.

(cherry picked from commit d16e5fd5e5)
2023-09-20 14:51:02 +02:00
Tom Krizek 98191e6371 Remove pytest invocation from legacy runner
In order to python system tests, pytest (runner) has to be used
directly. This makes it possible to simplify the pytest runner and make
its behavior simpler and easier to extend.

The legacy runner can still be used to run shell system tests.

(cherry picked from commit 4af9bafb4e)
2023-09-20 14:50:18 +02:00
Tom Krizek 9759d8ee28 Merge branch '4262-make-check-pytest-9.18' into 'bind-9.18'
[9.18] Use pytest runner for make check

See merge request isc-projects/bind9!8316
2023-09-20 12:38:34 +00:00
Tom Krizek 8c1a1b304c Use 0 exit code for skipped tests in legacy runner
Since the legacy runner is no longer used in the automake test suite,
don't use the special GNU exit code indicating a skipped tests. Instead,
use 0 to avoid considering skipped tests as failed when using simpler
mechanism (such as xargs -P) to run the tests with the legacy runner.
2023-09-20 13:45:41 +02:00
Tom Krizek 20c8fab299 ci: make sure to use legacy test runner on EL7
EL7 doesn't have the required dependencies for the newer pytest runner.
Since make check now invokes the pytest runner, ensure that the legacy
runner will be used instead.
2023-09-20 13:45:32 +02:00
Tom Krizek 01aada479c Remove make check invocation from legacy.run.sh
The legacy runner no longer uses make check. Ensure the legacy runner
script doesn't interact with that automake target in any way. The legacy
runner script remains available to execute the legacy runner, but there
is no out-of-the box support for running tests in parallel. Other tools
such as xargs can be utilized for that.

(cherry picked from commit 0a9ee342e9)
2023-09-20 10:35:27 +02:00
Tom Krizek a4edb7db29 ci: switch OpenBSD job to use make check
Invoking pytest directly provides a better formatted output and more
flexibility. However, it's prudent to verify that `make check` keeps
working as expected. Use it in the OpenBSD job which isn't executed as
frequently and its output is of least concern.

(cherry picked from commit f1c631f448)
2023-09-20 10:33:42 +02:00
Tom Krizek ca392c6f64 Modify custom-test-driver to interpret JUnit results
Pytest provides JUnit output and uses different exit codes from
Automake. Use the conversion script to interpret the JUnit test results
from python rather than relying on the status code.

(cherry picked from commit 295890a16b)
2023-09-20 10:33:42 +02:00
Tom Krizek fce6fa0fc4 Convert JUnit XML from pytest into Automake .trs files
It's important to parse the JUnit result file rather than relying on the
exit code from pytest, which has a different meaning. Include a .trs test
result for each test case and set an exit code which is most appropriate
as the aggregate result (e.g. it will be set to 77 (SKIP) if there's at
least one test case that was skipped).

(cherry picked from commit b96c8e8062)
2023-09-20 10:33:42 +02:00
Tom Krizek 68f186dd82 Prioritize long-running system tests for legacy runner
Synchronize the test priority with the pytest runner (which handles the
prioritization in conftest.py).

(cherry picked from commit 15fa8f1506)
2023-09-20 10:33:38 +02:00
Tom Krizek a28529c11d Use prereq.sh for rpzrecurse system test
(cherry picked from commit 0538b7e0da)
2023-09-20 10:32:11 +02:00
Tom Krizek 3fb1f2e851 Use prereq.sh for serve-stale system test
(cherry picked from commit c3abedc0a2)
2023-09-20 10:32:11 +02:00
Tom Krizek 27c3e576fd Use prereq.sh for chain system test
(cherry picked from commit 5d9a09c086)
2023-09-20 10:32:11 +02:00
Tom Krizek 74def754f9 Use prereq.sh for digdelv, dnssec, forward system tests
(cherry picked from commit 00b92bd064)
2023-09-20 10:32:11 +02:00
Tom Krizek 53a09edc4f Use prereq.sh for qmin, cookie system tests
(cherry picked from commit 78981cee77)
2023-09-20 10:32:11 +02:00
Tom Krizek 39770409a9 Use prereq.sh for reclimit system test
(cherry picked from commit 2f962f7041)
2023-09-20 10:32:11 +02:00
Tom Krizek 697041ae93 Use prereq.sh for xfer system test
(cherry picked from commit 587129b4c0)
2023-09-20 10:32:11 +02:00
Tom Krizek cefa09ada5 Use prereq.sh for statschannel system test
(cherry picked from commit 27281955af)
2023-09-20 10:32:11 +02:00
Tom Krizek c0e4411961 Add prereq.sh scripts for system tests requiring perl mod DNS
prereq.sh mechanism for dependency detection is preferred since it works
for both legacy and pytest runner.

(cherry picked from commit 9cc821d42f)
2023-09-20 10:32:10 +02:00
Tom Krizek ee849d2a0c Use proper perl interpreter in xfer system test
(cherry picked from commit f0493890cc)
2023-09-20 10:32:10 +02:00
Tom Krizek 76b5c07b8d Remove redundant dependency checks for system tests
Dependencies for these tests are already checked in prereq.sh - if the
dependencies are missing, these tests will be skipped. The extra
dependency check in Makefile.am is extraneous and only applied for the
legacy test runner.

(cherry picked from commit 807f67b1cd)
2023-09-20 10:32:10 +02:00
Tom Krizek 9d9f2dcda5 Fix pytest module detection for run.sh
To allow concurrent invocations of pytest, it is necessary to assign
ports properly to avoid conflicts. In order to do that, pytest needs to
know a complete list of all test modules.

When pytest is invoked from run.sh, the current working directory is the
system test directory. To properly detect other tests, the conftest.py
has to look in the bin/tests/system directory, rather than the current
working directory.

(cherry picked from commit d4502206a1)
2023-09-20 10:32:10 +02:00
Tom Krizek b86a41780a Use pytest runner for make check
Make python & pytest required dependencies to run system tests and
invoke the pytest runner from the makefile.

(cherry picked from commit 56c1087304)
2023-09-20 10:32:05 +02:00
Tom Krizek 7509613408 Merge branch 'tkrizek/pytest-check-system-test-files-with-danger-9.18' into 'bind-9.18'
[9.18] enforce system test file and name conventions with danger CI

See merge request isc-projects/bind9!8311
2023-09-19 13:40:50 +00:00
Tom Krizek b3a1288ed6 danger: check system test convetions for pytest runner
When adding a new system test, it might easy to forget to add the
required files for the pytest runner or break a naming convention. Add
danger checks to cover these cases.

(cherry picked from commit d1371267c6)
2023-09-19 14:59:39 +02:00
Tom Krizek 56e842bbf2 Rename allow-query pytest glue file
To conform with the expected naming convention, the pytest glue file for
the `allow-query` test should use underscore as the word separator in
the python file name: allow-query/tests_sh_allow_query.py

(cherry picked from commit c026a00696)
2023-09-19 14:56:21 +02:00
Tom Krizek 09a8dd2f5b Treat bin/tests/system/_common as non-temp directory
The _common directory is a special case directory which contains shared
files for other system test directories. Make sure it's tracked in git
and not deleted during temporary directory cleanup.

(cherry picked from commit 9e13c3dbcb)
2023-09-19 14:56:21 +02:00
Tom Krizek f9e075175d Rename system test directory with common files to _common
The old name "common" clashes with the convention of system test
directory naming. It appears as a system test directory, but it only
contains helper files.

To reduce confusion and to allow automatic detection of issues with
possibly missing test files, rename the helper directory to "_common".
The leading underscore indicates the directory is different and the its
name can no longer be confused with regular system test directories.

(cherry picked from commit 168dba163c)
2023-09-19 14:56:12 +02:00
Mark Andrews a5639e05b4 Merge branch '4314-dns_ncache_current-fails-to-set-covered-correctly-bind-9.18' into 'bind-9.18'
[9.18] Resolve "dns_ncache_current fails to set covered correctly"

See merge request isc-projects/bind9!8307
2023-09-18 06:40:27 +00:00
Mark Andrews 55baa49118 Add a CHANGES note for [GL #4314]
(cherry picked from commit 80298ade33)
2023-09-18 15:52:16 +10:00
Mark Andrews 88f696de93 Check RRSIG covered type in negative cache entry
The covered type previously displayed as TYPE0 when it should
have reflected the records that was actually covered.

(cherry picked from commit 8ce359652a)
2023-09-18 15:51:44 +10:00
Mark Andrews 933d03fc83 Correctly set the value of covered in dns_ncache_current
Fix the type and rdclass being passed to dns_rdata_tostruct so
that rrsig.covered is correctly set.

(cherry picked from commit 779980710c)
2023-09-18 15:51:44 +10:00
Arаm Sаrgsyаn 4e7f22a228 Merge branch 'aram/danger-ignore-length-warn-for-fixups-9.18' into 'bind-9.18'
[9.18] Don't warn about subject line length for the fixup commits (CI)

See merge request isc-projects/bind9!8302
2023-09-14 12:13:10 +00:00
Aram Sargsyan 43409d27e4 Don't warn about subject line length for the fixup commits
The fixup commits' subject line has a prefix which has its own
length, so warning about the exceeding length is not accurate.
Given that the fixup commits can not be merged, because they
cause a danger failure, it's safe to ignore the length check
for them.

(cherry picked from commit 3db2beef9f)
2023-09-14 11:24:00 +00:00
Arаm Sаrgsyаn 0c0f694a86 Merge branch '4299-cid-465168-null-pointer-dereference' into 'bind-9.18'
Resolve "CID 465168: Null pointer dereference in lib/ns/client.c"

See merge request isc-projects/bind9!8281
2023-09-14 11:22:58 +00:00
Aram Sargsyan 2a57c12922 Remove an unnecessary NULL-check
In the ns__client_put_cb() callback function the 'client->manager'
pointer is guaranteed to be non-NULL, because in ns__client_request(),
before setting up the callback, the ns__client_setup() function is
called for the 'client', which makes sure that 'client->manager' is set.

Removing the NULL-check resolves the following static analyzer warning:

    /lib/ns/client.c: 1675 in ns__client_put_cb()
    1669     		dns_message_puttemprdataset(client->message, &client->opt);
    1670     	}
    1671     	client_extendederror_reset(client);
    1672
    1673     	dns_message_detach(&client->message);
    1674
    >>>     CID 465168:  Null pointer dereferences  (REVERSE_INULL)
    >>>     Null-checking "client->manager" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    1675     	if (client->manager != NULL) {
    1676     		ns_clientmgr_detach(&client->manager);
    1677     	}
    1678
    1679     	/*
    1680     	 * Detaching the task must be done after unlinking from
2023-09-14 10:39:24 +00:00
Tom Krizek e25643f019 Merge branch 'tkrizek/ci-test-binaries-compilation-9.18' into 'bind-9.18'
[9.18] ci: omit explicit command to compile test binaries

See merge request isc-projects/bind9!8295
2023-09-12 08:55:42 +00:00
Tom Krizek cdbe94ce46 ci: omit explicit command to compile test binaries
The command to compile test binaries is no longer needed, as these are
now compiled as part of the default make target.

Related !8189

(cherry picked from commit 26f20b81ec)
2023-09-12 10:25:03 +02:00
Michal Nowak 3fc050f097 Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.18.20' into 'bind-9.18'
Set up version and release notes for BIND 9.18.20

See merge request isc-projects/bind9!8293
2023-09-12 07:38:12 +00:00
Michal Nowak 8b5e396f45 Set up release notes for BIND 9.18.20 2023-09-12 09:36:39 +02:00
Michal Nowak a0d8c44bf7 Update BIND version to 9.18.20-dev 2023-09-12 09:36:39 +02:00
Michal Nowak c78cd3681c Update BIND version for release 2023-09-11 10:20:17 +02:00
Michal Nowak 32c8b36c3b Add a CHANGES marker 2023-09-11 10:20:17 +02:00
Michal Nowak 56d7ec7424 Fix release note for [GL #4242]
An unintended release note has been merged in isc-private/bind9!565.
This is the correct one.
2023-09-11 10:20:17 +02:00
Michal Nowak 142579aec9 Merge branch 'mnowak/prepare-documentation-for-bind-9.18.19' into 'security-bind-9.18'
Prepare documentation for BIND 9.18.19

See merge request isc-private/bind9!579
2023-09-08 14:22:57 +00:00
Michal Nowak 2e668d0c9d Tweak and reword release notes 2023-09-08 16:05:31 +02:00
Michal Nowak 32822140b5 Prepare release notes for BIND 9.18.19 2023-09-08 12:22:38 +02:00
Mark AndrewsandMichal Nowak c6cfc75a96 Check dig's exist status
(cherry picked from commit 701ad350f8)
2023-09-08 12:22:38 +02:00
Michal Nowak 29b8fd8f11 Merge branch '4242-use-after-free-fix' into 'security-bind-9.18'
[9.18] [CVE-2023-4236] TLS DNS: fix 'isc__nm_uvreq_t' send request use after free error

See merge request isc-private/bind9!565
2023-09-08 09:51:44 +00:00
Artem BoldarievandMichal Nowak 86df0993d7 Add CHANGES and release note for [GL #4242] 2023-09-08 11:16:38 +02:00
Artem BoldarievandMichal Nowak 18efa454a9 TLS DNS: fix 'isc__nm_uvreq_t' send request use after free error
In TLS DNS, it was possible for an 'isc__nm_uvreq_t' object to be used
twice when it was not implied, leading to use after free errors,
leading to abort()'s and/or crashes.

In particular, in the older version of the code, the following was
happening:

* 'tlsdns_send_direct()' is eventually called from
'isc__nm_async_tlsdnssend()' when sending data;

* 'tlsdns_send_direct()' could fail. If it happens early closer to the
beginning of the function, then the 'isc__nm_uvreq_t' object is passed
to 'isc__nm_failed_send_cb()' and eventually gets destroyed normally
without any negative consequences;

* However, if 'tlsdns_send_direct()' fails due to the call to
'tls_cycle()', then the send request object is re-queued to be
processed asynchronously later by a call to 'tlsdns_send_enqueue()'.

* The error processing code in 'tlsdns_send_direct()' is written
without an assumption that the send request object could be re-queued
in 'tlsdns_send_direct()' and, thus, it was passed to
'isc__nm_failed_send_cb()' for asynchronous error processing.

* As a result of asynchronous processing initiated by
`tlsdns_send_enqueue()` the 'isc__nm_uvreq_t' send request object gets
properly destroyed eventually.

* Then, as a result of asynchronous error processing initiated by the
'isc__nm_failed_send_cb()' call, the send request object is used a
second time. However, it was destroyed at the previous step.

So we have a (relatively) obvious logical mistake here. Why
'tls_cycle()' was failing is of no particular importance, as I can see
many ways for it to fail both on TLS and networking levels. In
particular, during testing with 'dnsperf', I have encountered the
following two cases:

1. 'result == ISC_R_TLSERROR' - the remote side was wrapping up,
causing errors on TLS level (e.g. handshake has not been completed
yet);

2. 'result == ISC_R_CONNECTIONRESET' - the remote side closed the
connection after we have initiated the asynchronous send request
operation and reached the point when its processing started.

One could ask: why haven't we encountered the error before? That
happened because 'send()' is, in general, a faster operation than
'read()' so we were lucky enough not to encounter this, as it took
dnsperf to make our code fail in a particular way to trigger the
problematic code path. It requires closing the connection shortly
after we have made an asynchronous 'send()' attempt and passed the
data for processing by the libuv code (or, to be precise, down our
technologies stack).
2023-09-08 11:14:22 +02:00
Michal Nowak 3dc9b75aff Merge branch '4152-confidential-limit-isccc_cc_fromwire-recursion-depth-bind-9.18' into 'security-bind-9.18'
[9.18] [CVE-2023-3341] Stack Exhaustion in control channel

See merge request isc-private/bind9!569
2023-09-08 09:13:46 +00:00
Mark AndrewsandMichal Nowak fba3728497 Add release note for [GL #4152] 2023-09-07 19:51:36 +02:00
Mark AndrewsandMichal Nowak 4ca272fa1e Add CHANGES note for [GL #4152] 2023-09-07 19:51:33 +02:00
Mark AndrewsandMichal Nowak 432a49a7b0 Limit isccc_cc_fromwire recursion depth
Named and rndc do not need a lot of recursion so the depth is
set to 10.
2023-09-07 19:50:27 +02:00
Ondřej Surý 04128e764e Merge branch '4292-uncleared-libcrypto-error-crypto-evp-evp_fetch-c-373-inner_evp_generic_fetch-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Uncleared libcrypto error: crypto/evp/evp_fetch.c:373 inner_evp_generic_fetch"

See merge request isc-projects/bind9!8279
2023-09-06 15:47:08 +00:00
Mark AndrewsandOndřej Surý 7f89f2d6bc Call ERR_clear_error on EVP_MD_fetch or EVP_##alg error
(cherry picked from commit 28adcf1831)
2023-09-06 15:47:05 +00:00
Mark Andrews ad9fd9e362 Merge branch '4290-raise-log-level-to-isc_log_error-on-formerr-in-xfrin-c-bind-9.18' into 'bind-9.18'
[9.18] Resolve "raise log level to ISC_LOG_NOTICE on FORMERR in xfrin.c"

See merge request isc-projects/bind9!8280
2023-09-06 11:29:12 +00:00
Mark Andrews dd9f205c13 Add a CHANGES note for [GL #4290]
(cherry picked from commit b867244305)
2023-09-06 20:15:17 +10:00
Mark Andrews 0325e4a1fb Adjust level of log messages when transferring in a zone
This raises the log level of messages treated as FORMERR to NOTICE
when transfering in a zone.  This also adds a missing log message
for TYPE0 and meta types received during a zone transfer.

(cherry picked from commit 6c3414739d)
2023-09-06 20:14:41 +10:00
Michal Nowak 95950a2160 Merge branch 'mnowak/statschannel-system-test-is-too-verbose-9.18' into 'bind-9.18'
[9.18] Disable command tracing in statschannel system test

See merge request isc-projects/bind9!8278
2023-09-05 17:23:48 +00:00
Michal Nowak 71441b782b Disable command tracing in statschannel system test
Command tracing was added recently via
525afc666a and makes the system test too
verbose.

(cherry picked from commit f0c37d861c)
2023-09-05 19:20:37 +02:00
Michal Nowak 1f55cbf2d1 Merge branch '4255-suspicious-messsage-id-fix' into 'bind-9.18'
TLS DNS: take into account partial writes by SSL_write_ex()

See merge request isc-projects/bind9!8276
2023-09-05 16:45:42 +00:00
Artem BoldarievandMichal Nowak 35bd74a5f0 Add CHANGES and release note for [GL #4255]
Mention that possibility of partial TLS writes was taken into account
and that fixes DNS messages corruption over long DNS over TLS streams.
2023-09-05 18:05:59 +02:00
Artem BoldarievandMichal Nowak 84d71c8e2c TLS DNS: take into account partial writes by SSL_write_ex()
This commit changes TLS DNS so that partial writes by the
SSL_write_ex() function are taken into account properly. Now, before
doing encryption, we are flushing the buffers for outgoing encrypted
data.

The problem is fairly complicated and originates from the fact that it
is somewhat hard to understand by reading the documentation if and
when partial writes are supported/enabled or not, and one can get a
false impression that they are not supported or enabled by
default (https://www.openssl.org/docs/man3.1/man3/SSL_write_ex.html). I
have added a lengthy comment about that into the code because it will
be more useful there. The documentation on this topic is vague and
hard to follow.

The main point is that when SSL_write_ex() fails with
SSL_ERROR_WANT_WRITE, the OpenSSL code tells us that we need to flush
the outgoing buffers and then call SSL_write_ex() again with exactly
the same arguments in order to continue as partial write could have
happened on the previous call to SSL_write_ex() (that is not hard to
verify by calling BIO_pending(sock->tls.app_rbio) before and after the
call to SSL_write_ex() and comparing the returned values). This aspect
was not taken into account in the code.

Now, one can wonder how that could have led to the behaviour that we
saw in the #4255 bug report. In particular, how could we lose one
message and duplicate one twice? That is where things get interesting.

One needs to keep two things in mind (that is important):

Firstly, the possibility that two (or more) subsequent SSL_write_ex()
calls will be done with exactly the same arguments is very high (the
code does not guarantee that in any way, but in practice, that happens
a lot).

Secondly, the dnsperf (the software that helped us to trigger the bug)
bombed the test server with messages that contained exactly the same
data. The only difference in the responses is message IDs, which can
be found closer to the start of a message.

So, that is what was going on in the older version of the code:

1. During one of the isc_nm_send() calls, the SSL_write_ex() call
fails with SSL_ERROR_WANT_WRITE. Partial writing has happened, though,
and we wrote a part of the message with the message
ID (e.g. 2014). Nevertheless, we have rescheduled the complete send
operation asynchronously by a call to tlsdns_send_enqueue().

2. While the asynchronous request has not been completed, we try to
send the message (e.g. with ID 2015). The next isc_nm_send() or
re-queued send happens with a call to SSL_write_ex() with EXACTLY the
same arguments as in the case of the previous call. That is, we are
acting as if we want to complete the previously failed SSL_write_ex()
attempt (according to the OpenSSL documentation:
https://www.openssl.org/docs/man3.1/man3/SSL_write_ex.html, the
"Warnings" section). This way, we already have a start of the message
containing the previous ID (2014 in our case) but complete the write
request with the rest of the data given in the current write
attempt. However, as responses differ only in message ID, we end up
sending a valid (properly structured) DNS message but with the ID of
the previous one. This way, we send a message with ID from the
previous isc_nm_send() attempt. The message with the ID from the send
request from this attempt will never be sent, as the code thinks that
it is sending it now (that is how we send the message with ID 2014
instead of 2015, as in our example, thus making the message with ID
2015 never to be sent).

3. At some point later, the asynchronous send request (the rescheduled
on the first step) completes without an error, sending a second
message with the same ID (2014).

It took exhausting SSL write buffers (so that a data encryption
attempt cannot be completed in one operation) via long DoT streams in
order to exhibit the behaviour described above. The exhaustion
happened because we have not been trying to flush the buffers often
enough (especially in the case of multiple subsequent writes).

In my opinion, the origin of the problem can be described as follows:

It happened due to making wrong guesses caused by poorly written
documentation.
2023-09-05 18:03:44 +02:00
Ondřej Surý 7df60d3085 Merge branch '4038-specialised-arena-per-worker-9.18' into 'bind-9.18'
[9.18] Make it possible to create memory contexts backed by jemalloc arenas

See merge request isc-projects/bind9!8271
2023-09-05 14:00:16 +00:00
Artem BoldarievandOndřej Surý 7e967f54a4 Add CHANGES and release note for [GL #4038]
Mention that send buffer allocations/deallocations are now routed
through dedicated memory arenas.

(cherry picked from commit 60d52a49b0)
2023-09-05 15:02:30 +02:00
Artem BoldarievandOndřej Surý 1cc17f797e Allocate DNS send buffers using dedicated per-worker memory arenas
This commit ensures that memory allocations related to DNS send
buffers are routed through dedicated per-worker memory arenas in order
to decrease memory usage on high load caused by TCP-based DNS
transports.

We do that by following jemalloc developers suggestions:

https://github.com/jemalloc/jemalloc/issues/2483#issuecomment-1639019699
https://github.com/jemalloc/jemalloc/issues/2483#issuecomment-1698173849
(cherry picked from commit 01cc7edcca)
2023-09-05 15:02:30 +02:00
Artem BoldarievandOndřej Surý f5cb14265f Add ability to set per jemalloc arena dirty and muzzy decay values
This commit adds couple of functions to change "dirty_decay_ms" and
"muzzy_decay_ms" settings on arenas associated with memory contexts.

(cherry picked from commit 6e98b58d15)
2023-09-05 15:02:30 +02:00
Artem BoldarievandOndřej Surý 16a45837ca Make it possible to create memory contexts backed by jemalloc arenas
This commit extends the internal memory management middleware code in
BIND so that memory contexts backed by dedicated jemalloc arenas can
be created. A new function (isc_mem_create_arena()) is added for that.

Moreover, it extends the existing code so that specialised memory
contexts can be created easily, should we need that functionality for
other future purposes. We have achieved that by passing the flags to
the underlying jemalloc-related calls. See the above
isc_mem_create_arena(), which can serve as an example of this.

Having this opens up possibilities for creating memory contexts tuned
for specific needs.

(cherry picked from commit 8550c52588)
2023-09-05 15:02:30 +02:00
Ondřej Surý 6d24650333 Merge branch 'artem-fix-building-on-dragonflybsd-9.18' into 'bind-9.18'
[9.18] Fix building BIND on DragonFly BSD (on both older an newer versions)

See merge request isc-projects/bind9!8272
2023-09-05 11:07:49 +00:00
Artem BoldarievandOndřej Surý d53ecb7720 Fix building BIND on DragonFly BSD (on both older an newer versions)
This commit ensures that BIND and supplementary tools still can be
built on newer versions of DragonFly BSD. It used to be the case, but
somewhere between versions 6.2 and 6.4 the OS developers rearranged
headers and moved some function definitions around.

Before that the fact that it worked was more like a coincidence, this
time we, at least, looked at the related man pages included with the
OS.

No in depth testing has been done on this OS as we do not really
support this platform - so it is more like a goodwill act. We can,
however, use this platform for testing purposes, too. Also, we know
that the OS users do use BIND, as it is included in its ports
directory.

Building with './configure' and './configure --without-jemalloc' have
been fixed and are known to work at the time the commit is made.

(cherry picked from commit 942569a1bb)
2023-09-05 10:33:51 +02:00
Ondřej Surý 445283a67b Merge branch '4263-deprecate-dnssec-must-be-secure-feature-9.18' into 'bind-9.18'
Deprecate 'dnssec-must-be-secure' option

See merge request isc-projects/bind9!8268
2023-09-04 16:54:46 +00:00
Ondřej Surý 12935f2e70 Add CHANGES and release note for [GL #4263]
(cherry picked from commit 898f0ee3cf)
2023-09-04 17:27:38 +02:00
Ondřej Surý c9d6f0e400 Deprecate 'dnssec-must-be-secure' option
The dnssec-must-be-secure feature was added in the early days of BIND 9
and DNSSEC and it makes sense only as a debugging feature.

Remove the feature to simplify the code.

(cherry picked from commit 9e0b348a2b)
2023-09-04 17:27:14 +02:00
Michał Kępień 8f99ee3e13 Merge branch 'michal/reorganize-vulnerability-docs-9.18' into 'bind-9.18'
[9.18] Move security-related information to SECURITY.md

See merge request isc-projects/bind9!8266
2023-09-04 10:00:36 +00:00
Michał Kępień 695624f314 Move security-related information to SECURITY.md
To follow current best practices, create a short SECURITY.md file in the
root of the repository that contains information about the project's
security policy and guidelines for reporting potential security issues.
Replace the relevant bits of text in other files with references to the
new SECURITY.md file, so that the relevant information only needs to be
maintained in one place.

Replace all occurrences of the generic security-officer@isc.org email
with a dedicated address for reporting BIND 9 security issues,
bind-security@isc.org.

(cherry picked from commit ca9fed9143)
2023-09-04 11:56:46 +02:00
Arаm Sаrgsyаn 07599c2798 Merge branch 'aram/zone.c-got_transfer_quota-bugfix-9.18' into 'bind-9.18'
[9.18] Reset the 'result' before using it again in zone.c:got_transfer_quota()

See merge request isc-projects/bind9!8256
2023-09-04 08:36:57 +00:00
Ondřej SurýandArаm Sаrgsyаn 46969dca75 Unobfuscate the code-flow logic in got_transfer_quota()
This refactors the code flow in got_transfer_quota() to not use the
CHECK() macro as it really obfuscates the code flow logic here.

(cherry picked from commit 00cb151f8e)
2023-09-04 08:04:52 +00:00
Aram Sargsyan 07b2d19b92 Reset the 'result' before using it again
The 'result' variable should be reset to ISC_R_NOTFOUND again,
because otherwise a log message could be logged about not being
able to get the TLS configuration based on on the 'result' value
from the previous calls to get the TSIG key.

(cherry picked from commit 6cab7fc627)
2023-09-04 08:04:52 +00:00
Matthijs Mekking 978b4cdd6f Merge branch '4266-document-dnssec-policy-lifetime-v9_18' into 'bind-9.18'
[9.18] Clarify BIND 9 time formats

See merge request isc-projects/bind9!8259
2023-09-01 08:19:40 +00:00
Matthijs Mekking 41085510a6 Add CHANGES entry for #4266
(cherry picked from commit fd3d58d512)
2023-09-01 10:18:50 +02:00
Matthijs Mekking 44cd3788ac Explain lifetime format
Add the text "TTL-style unit suffixes or ISO 8601 duration formats",
just like we do at other places that are duration option types.

Also, in the dnssec-policy "keys" example, use a TTL-style unit too.

(cherry picked from commit b5a757c452)
2023-09-01 10:18:31 +02:00
Matthijs Mekking a3f94bf002 Add a glossary definition for duration
We don't yet explain the syntax of TTL-style suffixes or ISO 8601
duration formats.

(cherry picked from commit cc122d22b4)
2023-09-01 10:18:31 +02:00
Matthijs Mekking caf5eeb141 Fix keys reference link in ARM
There's a statement that says: "Here is an example (for illustration
purposes only) of some possible entries in a [keys] list:", and that
links to the wrong "keys" statement (it links to the TSIG keys section).

Remove the reference, as we are already in the right section.

(cherry picked from commit 07c70ea2bd)
2023-09-01 10:18:31 +02:00
Mark Andrews 2dbdcd6f4b Merge branch '4159-openssl-error-queue-not-cleaned-bind-9.18' into 'bind-9.18'
[9.18] Resolve "OpenSSL error queue not cleaned"

See merge request isc-projects/bind9!8263
2023-09-01 04:49:40 +00:00
Mark Andrews 3c2704e994 Add release note for [GL #4159]
(cherry picked from commit 6a1a73759a)
2023-09-01 14:22:19 +10:00
Mark Andrews 4735383680 Add CHANGES note for [GL #4159]
(cherry picked from commit 6c3d4d7aa2)
2023-09-01 14:22:17 +10:00
Mark Andrews e10dfc2e2d Detect uncleared libcrypto errors in rdata processing
If libcrypto errors are not cleared slow memory leaks occur which
are not detected at shutdown.

(cherry picked from commit 14727bb4b9)
2023-09-01 14:21:49 +10:00
Mark Andrews 91a6885a01 Style fix
(cherry picked from commit b6e1650455)
2023-09-01 14:06:28 +10:00
Mark Andrews 29a93d2889 Check that buf is large enough
(cherry picked from commit 299f519b09)
2023-09-01 14:06:27 +10:00
Mark Andrews f77ffa7953 Take ownership of pointer before freeing
(cherry picked from commit 9e2288208d)
2023-09-01 14:03:49 +10:00
Mark Andrews 4c27f80476 Add missing "Design by Contract" REQUIREs
(cherry picked from commit b442ae8d3e)
2023-09-01 14:00:14 +10:00
Mark Andrews 788a8a7c4d Free evp_md_ctx and pkey at exit
(cherry picked from commit 936b73cb57)
2023-09-01 13:45:57 +10:00
Mark Andrews 74f9d749bf Clear OpenSSL error stack when exiting
(cherry picked from commit eaedba6621)
2023-09-01 13:45:34 +10:00
Mark Andrews 894b0970e6 Clear OpenSSL errors on TSL error paths
(cherry picked from commit 4f790b6c58)
2023-09-01 13:45:34 +10:00
Mark Andrews 0111782f1e Clear OpenSSL errors on context creation failures
(cherry picked from commit 96db614d69)
2023-09-01 13:45:34 +10:00
Mark Andrews 900efd613f Clear OpenSSL errors on SHA failures
(cherry picked from commit 247422c69f)
2023-09-01 13:45:34 +10:00
Mark Andrews 34a0bb146c Clear OpenSSL errors on engine errors
(cherry picked from commit 2ba62aebce)
2023-09-01 13:43:20 +10:00
Mark Andrews aca6f3e82d Clear OpenSSL errors on EVP failures
(cherry picked from commit 4ea926934a)
2023-09-01 13:40:32 +10:00
Mark Andrews b5b13771f2 Clear OpenSSL errors on EVP_PKEY_new failures
(cherry picked from commit 6df53cdb87)
2023-09-01 13:37:02 +10:00
Mark Andrews 4d37996b1a Clear OpenSSL errors on EC_KEY_get0_private_key failures
(cherry picked from commit 86b04368b0)
2023-09-01 13:34:14 +10:00
Mark Andrews 386e88d0e4 Clear OpenSSL errors on EVP_PKEY_get0_EC_KEY failures
(cherry picked from commit abd8c03592)
2023-09-01 13:30:30 +10:00
Mark Andrews ababcd28c1 Clear OpenSSL errors on EVP_PKEY_get_bn_param failures
(cherry picked from commit d8a9adc821)
2023-09-01 13:24:02 +10:00
Mark Andrews fb503aa275 Clear OpenSSL errors on EVP_MD_CTX_create failures
(cherry picked from commit 8529be30bb)
2023-09-01 13:13:59 +10:00
Mark Andrews 290896921d Clear OpenSSL errors on ECDSA_SIG_new failures
(cherry picked from commit eafcd41120)
2023-09-01 13:13:06 +10:00
Matthijs Mekking 47a741f3b1 Merge branch '4278-rndc-flush-resets-stale-refresh-time-to-0-v9_18' into 'bind-9.18'
[9.18] Restore serve-stale settings after cache flush

See merge request isc-projects/bind9!8255
2023-08-31 11:52:29 +00:00
Matthijs Mekking 94a61cea3e Add release note and CHANGES for #4278
(cherry picked from commit 9523eb70f6)
2023-08-31 11:15:44 +02:00
Matthijs Mekking 6e078a79d5 After cache flush, restore serve-stale settings
When flushing the cache, we create a new cache database. The serve-stale
settings need to be restored after doing this. We already did this
for max-stale-ttl, but forgot to do this for stale-refresh-time.

(cherry picked from commit 3ae721db6c)
2023-08-31 11:13:08 +02:00
Matthijs Mekking 804f4b8d5d Add serve-stale test settings after flush
Add a test case to ensure that after 'rndc flush', the serve-stale
settings are not reset.

(cherry picked from commit 0f593fd70a)
2023-08-31 11:12:59 +02:00
Mark Andrews 955b7aa6f1 Merge branch '4280-isc-support-22588-bind-now-returning-servfail-for-attempted-deletions-of-non-existent-ptr-srv-bind-9.18' into 'bind-9.18'
[9.18] Resolve "[ISC-support #22588] BIND now returning SERVFAIL for attempted deletions of non-existent PTR/SRV records"

See merge request isc-projects/bind9!8252
2023-08-30 00:34:14 +00:00
Mark Andrews 2502fea7df Add release note for [GL #4280]
(cherry picked from commit 2b4e109c6a)
2023-08-30 10:07:33 +10:00
Mark Andrews 5b12ba7673 Add CHANGES for [GL #4280]
(cherry picked from commit bb3556baa4)
2023-08-30 10:07:31 +10:00
Mark Andrews 58be5d8ed0 rr_exists should not error if the name does not exist
rr_exists errored if the name did not exist in the zone.  This was
not an issue prior to the addition of krb5-subdomain-self-rhs and
ms-subdomain-self-rhs as the only name used was the zone name which
always existed.

(cherry picked from commit b76a15977a)
2023-08-30 10:05:09 +10:00
Mark Andrews b4694e7551 Check that removal of nonexistent PTR and SRV records work
There was a bug in rr_exists that caused it to fail when the
name didn't exist in the zone.

(cherry picked from commit 2b7192c5be)
2023-08-30 10:05:08 +10:00
Mark Andrews 4efa74279e Merge branch '4277-cid-464851-possible-control-flow-issues-deadcode-in-lib-dns-opensslrsa_link-c' into 'bind-9.18'
Only declare 'ex' if it will be used.

See merge request isc-projects/bind9!8238
2023-08-29 22:32:57 +00:00
Mark Andrews 2282d5325a Only declare 'ex' if we will use it
Fixes
>>>     CID 464851:  Possible Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "BN_free(ex);".

Makes conditionals between declaring and use constistent. BN_free is
not needed as BIGNUM's returned by RSA_get0_key are not to be freed.
2023-08-29 22:05:27 +00:00
Tom Krizek 15b1dac152 Merge branch 'tkrizek-update-sphinx-rtd-theme-9.18' into 'bind-9.18'
[9.18] Update sphinx_rtd_theme

See merge request isc-projects/bind9!8249
2023-08-29 08:23:13 +00:00
Tom Krizek 8bd5468fb7 Update sphinx_rtd_theme
To resolve the version select and search issue on readthedocs.org,
sphinx_rtd_theme>=1.2.1 is required.

Related https://github.com/readthedocs/sphinx_rtd_theme/issues/1452

(cherry picked from commit 92143fa960)
2023-08-29 10:11:08 +02:00
Ondřej Surý 32c57b1e60 Merge branch '4125-statschannel-content-length-overflow-9.18' into 'bind-9.18'
[9.18] Parse statschannel Content-Length: more carefully

See merge request isc-projects/bind9!8215
2023-08-23 13:49:31 +00:00
Ondřej Surý 034a63c1f3 Add release note for [GL #4125]
(cherry picked from commit 58a8de5246)
2023-08-23 15:48:28 +02:00
Tony FinchandOndřej Surý 3f4d9f739c Add CHANGES entry for [GL #4125]
(cherry picked from commit 1ba538f32f)
2023-08-23 15:44:26 +02:00
Tony FinchandOndřej Surý 525afc666a Parse statschannel Content-Length: more carefully
A negative or excessively large Content-Length could cause a crash
by making `INSIST(httpd->consume != 0)` fail.

(cherry picked from commit 26e10e8fb5)
2023-08-23 15:44:11 +02:00
Tom Krizek 942c827ed5 Merge branch '3001-pytest-nitpicks-9.18' into 'bind-9.18'
[9.18] system tests stability tweaks and cleanup

See merge request isc-projects/bind9!8242
2023-08-23 13:38:55 +00:00
Tom Krizek 764161d8cf Allow re-runs of rrl system test
The rrl system test has been unstable and producing false positive
results for years (GL #172). Allow the test to be re-run (once) to
reduce the noise it causes.

(cherry picked from commit 40289d5440)
2023-08-23 14:50:24 +02:00
Tom Krizek ac465416f9 Allow re-runs of reclimit system test
The reclimit system test has been unstable and producing false positive
results for years (GL #1587). Allow the test to be re-run (once) to
reduce the noise it causes.

(cherry picked from commit 8c5833fe39)
2023-08-23 14:50:24 +02:00
Tom Krizek 83cde47734 Allow re-runs of qmin system test
The qmin test is inherently unstable. It fails quite often with failure
modes described in GL #904. Allow the pytest runner to re-run the test
up to 3 times to only detect a more persistent and reproducible failures
rather than random noise caused by the nature of the test.

(cherry picked from commit be2123a8e9)
2023-08-23 14:50:24 +02:00
Tom Krizek 0c5d718849 Disable loadtime check in statschannel test
It is better to disable the specific check that causes the test to fail
rather than mark the entire test as xfail, which can mask other issues
which the test is capable of detecting.

(cherry picked from commit 7522583b57)
2023-08-23 14:50:24 +02:00
Tom Krizek d6c17a4502 ci: fix after_script for out-of-tree tests
The commands in after_script run in a new shell, separate from
before_script and script commands. Since the pytest.log.txt is for out
of tree tests is present in the build directory, switch to it (if set)
before running any postprocessing commands.

(cherry picked from commit 86043b0bbe)
2023-08-23 14:50:24 +02:00
Tom Krizek 71f96aa1e6 Clean up pytest .gitignore file
The _last_test_run entry was accidentally added in !8194. It came from a
work-in-progress version of the MR and was left there during a rebase.

(cherry picked from commit 1b3db25adf)
2023-08-23 14:50:24 +02:00
Tom Krizek 7a42a6b409 Skip checkds test on Python<3.7
checkds test requires the capture_output argument for subprocess.run()
which was added in Python 3.7.

(cherry picked from commit 0361233b3d)
2023-08-23 14:50:22 +02:00
Matthijs Mekking c6fb15bdd6 Merge branch '1181-nsupdate-tcp-soa-requests' into 'bind-9.18'
Make nsupdate honor -v for SOA queries

See merge request isc-projects/bind9!8191
2023-08-23 09:17:10 +00:00
Matthijs Mekking 97c70e6b4e Add release note and CHANGES for #1181 2023-08-23 09:59:25 +02:00
Matthijs Mekking a0a95fb997 Make nsupdate honor -v for SOA queries
nsupdate offers the switch -v to use TCP for update requests. But
before sending that update request nsupdate was using UDP connection
to gather the SOA for determining the zone if not given explicitly.

Only use TCP if not using the default servers, because the SOA
query lookup is a different server with different capabilities (and
usually not for the better of it).
2023-08-23 09:58:17 +02:00
Tom Krizek c0e39f0272 Merge branch '4249-compile-test-files-during-make-9.18' into 'bind-9.18'
[9.18] Compile system test binaries during make

See merge request isc-projects/bind9!8226
2023-08-22 14:22:47 +00:00
Tom Krizek 468e05a181 ci: Disable dnsrps for respdiff jobs compiled with ASAN/TSAN
The dnsrps build assumes that dlopen is available from libc. This
assumption isn't met when attempting to build with address or thread
sanitizer on debian (bullseye, bookworm). Disable dnsrps build to avoid
the issue, since it's not needed anyway for our respdiff tests.

See commit b396f55586 for more info about
the dnsrps build.

(cherry picked from commit 0422415500)
2023-08-22 15:40:47 +02:00
Tom Krizek ae18bc33c5 Compile system test binaries during make
Using check_PROGRAMS would postpone compiling the binaries needed by
system tests until `make check` would be called. Since it's preferable
to invoke pytest directly to run the system test suite, compile these
binaries without installing them during `make all` instead by using
noinst_PROGRAMS.

This removes the need to use TESTS= make -e check hack invoked from
pytest to work around this issue.

(cherry picked from commit 21980b43b8)
2023-08-22 15:40:44 +02:00
Ondřej Surý fb95c1b8f4 Merge branch '4270-use-HAVE_STDATOMIC_H-for-stdatomic.h-header-detection-9.18' into 'bind-9.18'
Workaround faulty stdatomic.h header detection on Oracle Linux 7

See merge request isc-projects/bind9!8230
2023-08-22 13:29:43 +00:00
Ondřej Surý 701eb26f97 Workaround faulty stdatomic.h header detection on Oracle Linux 7
Oracle Linux 7 sets __STDC_VERSION__ to 201112L, but doesn't define
__STDC_NO_ATOMICS__, so we try to include <stdatomic.h> without the
header present in the system.  Since we are already detecting the header
in the autoconf, use the HAVE_STDATOMIC_H for more reliable detecting
whether <stdatomic.h> header is present.
2023-08-22 14:23:05 +02:00
Michal Nowak 9424f5a5b1 Merge branch 'mnowak/shutdown-test-drop-t-option' into 'bind-9.18'
Drop the rndc "-t" option from shudown system test

See merge request isc-projects/bind9!8227
2023-08-22 09:00:02 +00:00
Michal Nowak 8738309e24 Drop the rndc "-t" option from shudown system test
BIND 9.18 rndc does not know about the "-t" option, that results in an
silent "invalid argument" error.

The "-t" option originally came with
184eddb595 (a backport from the main
branch).
2023-08-22 10:58:58 +02:00
Michal Nowak 3ac53b39f2 Merge branch '4139-test_send_timeout-check-can-be-unstable-9.18' into 'bind-9.18'
[9.18] Make the test_send_timeout check more stable

See merge request isc-projects/bind9!8219
2023-08-22 08:07:07 +00:00
Michal Nowak c3cc8aa429 Mark test_send_timeout as flaky
In some cases, BIND is not fast enough to fill the send buffer and
manages to answer all queries, contrary to what the test expects.
Repeat the check up to 3 times to limit this test instability.

(cherry picked from commit 681b23c398)
2023-08-22 08:55:03 +02:00
Tom KrizekandMichal Nowak 71a9e152f1 Add custom flaky decorator to handle unstable tests
If the flaky plugin for pytest is available, use its decorator to
support re-running unstable tests. In case the package is missing,
execute the test as usual without attempts to re-run it in case of
failure.

This is mostly intended to increase the test stability in CI. Using a
custom decorator enables us to keep the flaky package as an optional
dependency.

(cherry picked from commit 5b703de733)
2023-08-22 08:55:03 +02:00
Evan Hunt 812a37cf93 Merge branch '3835-cname-wildcard-loop-followup-bind-9.18' into 'bind-9.18'
[9.18] prevent query_coveringnsec() from running twice

See merge request isc-projects/bind9!8224
2023-08-21 22:22:36 +00:00
Evan Hunt 30bd750dd5 CHANGES for [GL #3835]
(cherry picked from commit ba1f75684f)
2023-08-21 14:31:37 -07:00
Evan Hunt 07f6c63a80 prevent query_coveringnsec() from running twice
when synthesizing a new CNAME, we now check whether the target
matches the query already being processed. if so, we do not
restart the query; this prevents a waste of resources.

(cherry picked from commit 0ae8b2e056)
2023-08-21 14:31:10 -07:00
Michal Nowak d6ba9b3ed5 Merge branch '3893-make-debian-12-bookworm-base-image-9.18' into 'bind-9.18'
[9.18] Make Debian 12 "bookworm" the base image

See merge request isc-projects/bind9!8221
2023-08-21 18:03:30 +00:00
Michal Nowak a5daf67a60 Move clang:bullseye PKCS11 testing to gcc:bullseye
Move clang:bullseye:amd64 PKCS11 testing to the gcc:bullseye:amd64 job
to evenly represent compilers in PKCS11 testing.

(cherry picked from commit 077d82403e)
2023-08-21 17:27:22 +02:00
Michal Nowak ed09a82d18 Drop unnecessary gcovr workarounds
Many problems of the Debian 11 gcovr version were fixed in the Debian 12
one. Replace workarounds we accumulated over the years with two new,
simple ones.

(cherry picked from commit 55f5aa08f0)
2023-08-21 17:27:07 +02:00
Michal Nowak 405888dc8b Drop PKCS11 testing from "sid", resore it on "clang:bookworm"
The gcc:sid:amd64 job was used to test PKCS11 via the OpenSSL engine API
but is now designated for future PKCS11 testing via the provider API.

The ability to use PKCS11 via engine API in clang:bookworm:amd64 has
been restored using only deprecated APIs in OpenSSL 3.

(cherry picked from commit cfb06dabfe)
2023-08-21 17:26:48 +02:00
Michal Nowak 10458a419f Disable mandoc stylistic warning
We are not concerned by the "input text line longer than 80 bytes"
stylistic warning.

(cherry picked from commit 7929168295)
2023-08-21 17:26:27 +02:00
Michal Nowak 23a45b83f6 Drop unneeded -Wno-compound-token-split-by-macro option
Debian 12 has Perl 5.36 and the option is no longer needed.

(cherry picked from commit a330ab221e)
2023-08-21 17:26:03 +02:00
Michal Nowak 84911e693b Reintroduce Debian 11 "bullseye" Clang and GCC jobs
(cherry picked from commit 5e1120d9a3)
2023-08-21 17:25:41 +02:00
Michal Nowak eebe045d46 Make Debian 12 "bookworm" the base image
Just replace "bullseye" with "bookworm" and reintroduce Debian 11
"bullseye" later.

(cherry picked from commit 2d18c57c54)
2023-08-21 17:24:30 +02:00
Tom Krizek 23099da568 Merge branch '4252-pytest-symlink-to-test-artifacts-9.18' into 'bind-9.18'
[9.18] Create symlinks to test artifacts for pytest runner

See merge request isc-projects/bind9!8218
2023-08-21 14:47:23 +00:00
Tom Krizek b6e522ad03 .gitignore temporary directories and symlinks in system test dir
(cherry picked from commit 355dc73391)
2023-08-21 16:07:30 +02:00
Tom Krizek 303de3e089 Add clean-local target to clean pytest runner artifacts
The command finds all directories in bin/tests/system which contain an
underscore. Underscore indicates either a temporary directory (_tmp_), a
symlink to test artifacts (TESTNAME_MODULENAME), or a python-related
cache. Using underscore for a system test name is invalid and a hyphen
must be used instead.

(cherry picked from commit d66ff81543)
2023-08-21 16:07:30 +02:00
Tom Krizek 4b3d0c0f46 Silence pylint's refactoring suggestions for system_test_dir()
While it'd be fairly easy to split the function up into smaller ones,
the readability wouldn't be improved in this case. Silence the
suggestions instead.

(cherry picked from commit 83ddca7690)
2023-08-21 16:07:30 +02:00
Tom Krizek 4f6ea4fa1b Improve tempdir logging for pytest runner
At the end of the test, display the symlink path to the artifact
directory in case it's preserved. Log the full tempdir name in debug
log.

(cherry picked from commit f91d0b13e8)
2023-08-21 16:07:30 +02:00
Tom Krizek 89e6d1bc26 Create symlinks to test artifacts for pytest runner
While temporary directories are useful for test execution to keep
everything clean, they are difficult to work with manually. Create a
symlink for each test artifact directory with a stable and predictable
path. The symlink always either points to the latest artifacts, or is
missing in case the last run succeeded.

Ensure these symlinked directories aren't detected as test suites by the
pytest runner.

(cherry picked from commit e1ca5c8071)
2023-08-21 16:07:28 +02:00
Tom Krizek 22de8654a5 Merge branch '4246-remove-legacy-test-runner-from-ci-9.18' into 'bind-9.18'
[9.18] Use pytest runner for out-of-tree and OpenBSD system tests in CI

See merge request isc-projects/bind9!8217
2023-08-21 14:06:59 +00:00
Tom Krizek 57b2966d0b Improve pytest message when sanitizer report is found
(cherry picked from commit b1a9d1fe25)
2023-08-21 15:16:53 +02:00
Tom Krizek 8a4386f90c ci: run out-of-tree system tests with pytest runner
Out-of-tree builds are built in a directory that is different from
source directory. The build directory doesn't contain the non-compiled
test files from bin/tests/system which are the test cases required by
the pytest runner.

In order to run the system tests for out-of-tree build, copy over the
contents (tests) of bin/tests/system/ from the source directory into the
build directory. Then, it is possible to invoke the pytest runner inside
the build directory.

(cherry picked from commit d49d9ec80e)
2023-08-21 15:15:31 +02:00
Tom Krizek 30ddef53cb ci: use pytest system test runner on OpenBSD
A supported pytest version finally made it to OpenBSD repositories,
allowing us to run system tests with the pytest runner.

(cherry picked from commit 8846877dfe)
2023-08-21 15:15:29 +02:00
Michał Kępień 223fcb0fe2 Merge tag 'v9.18.18' into bind-9.18 2023-08-17 14:14:42 +02:00
Mark Andrews 7baabe5e10 Merge branch '4259-statschannel-leftovers-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Statschannel leftovers"

See merge request isc-projects/bind9!8200
2023-08-15 04:50:22 +00:00
Mark Andrews 86b9e02600 Remove bind9.xsl.1, bind9.xsl.2 and bind9.xsl.3
(cherry picked from commit 7da47fd858)
2023-08-15 14:25:11 +10:00
Mark Andrews 7c78ea9ebe Merge branch '4238-the-mkeys-system-test-can-update-the-root-zone-too-fast-bind-9.18' into 'bind-9.18'
[9.18] Resolve "The mkeys system test can update the root zone too fast"

See merge request isc-projects/bind9!8197
2023-08-15 00:16:17 +00:00
Mark Andrews 5097911f51 Add sleeps so that the modification time changes
The mkeys system test could fail because root zone was resigned
within the same second as it was previously signed causing reloads
to fail.  Add delays to the test to prevent this.

(cherry picked from commit 40e3529379)
2023-08-15 09:38:00 +10:00
Ondřej Surý 0e8cccec64 Merge branch '4124-check-statschannel-if-modified-since-9.18' into 'bind-9.18'
[9.18] Fix a stack buffer overflow in the statistics channel

See merge request isc-projects/bind9!8196
2023-08-14 12:57:26 +00:00
Ondřej Surý c63c646019 Add CHANGES and release notes for [GL #4124]
(cherry picked from commit 57c8bdaff5)
2023-08-14 13:08:11 +02:00
Tony FinchandOndřej Surý 57069556eb Fix a stack buffer overflow in the statistics channel
A long timestamp in an If-Modified-Since header could overflow a
fixed-size buffer.

(cherry picked from commit b22c87ca61)
2023-08-14 13:07:47 +02:00
Mark Andrews 3160239998 Merge branch '4245-incorrect-return-values-in-rpz-s-addr-and-drop-function-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Incorrect return values in rpz's addr and drop functions"

See merge request isc-projects/bind9!8190
2023-08-10 00:05:27 +00:00
Mark Andrews 2dd9c3a5f3 Fix 'addr', 'ckresult' and 'drop' functions
'addr', 'ckresult' and 'drop' should return 0 rather than 1 after
calling 'setret' as the error has been logged and these functions
are not expect to fail.

(cherry picked from commit 1394f12a1c)
2023-08-10 09:37:11 +10:00
Michal Nowak 082d6ae965 Merge branch 'mnowak/cross-version-test-9.18' into 'bind-9.18'
[9.18] Cross-version testing with named configurations

See merge request isc-projects/bind9!8184
2023-08-08 18:08:23 +00:00
Michal Nowak 9ba5c120cf Cross-version testing with named configurations
In #3381 (and #3385), we committed a backward-incompatible change to
BIND 9.19.5, 9.18.7, and 9.16.33, explicitly requiring "inline-signing"
for every "dnssec-policy".

We did this backward-incompatible change deliberately, knowing the
consequences for users and their configurations. But if we didn't, say,
we were unaware this is a backward-incompatible change and fixed failing
systems test by "tweaking a knob to make the CI pass", we would not have
a second look before the change hits user configurations.

"cross-version-config-tests" CI job is such a second look. It will run
system tests from the latest release tag specific to the particular
branch (e.g., v9.19.12 for the "main" branch) with BIND 9 binaries from
the current "HEAD" (the future v9.19.13). This Frankenstein build gets
conceived by altering the "TOP_BUILDDIR" variable in
"bin/tests/system/conf.sh".

Caveats:
- Only system test configurations are tested; no actual test code is
  run.
- Problems with namedN.conf configurations are not identified.

When backward-incompatible change is introduced, the CI job is expected
to fail. If the change is deliberate, the job will keep failing until
the version with the backward-incompatible change is tagged, and the
minor version in configure.ac is bumped.

(cherry picked from commit cc54211baa)
2023-08-08 19:39:16 +02:00
Michal Nowak 6f01270de7 Merge branch 'mnowak/pytest_rewrite_stress-9.18' into 'bind-9.18'
[9.18] Rewrite stress test to pytest

See merge request isc-projects/bind9!8182
2023-08-08 13:08:29 +00:00
Michał KępieńandMichal Nowak dbdc70cbe0 Convert setup.pl into static configurations
The setup.pl script has been replaced with static BIND configurations,
and in the course of this change, the unused ns1 server was removed.
This enhancement has greatly improved the overall test's readability.

(cherry picked from commit 08a8906cfc)
2023-08-08 14:30:34 +02:00
Michal Nowak 624c20b191 Rewrite stress test to pytest
The shell version of the test was completed only after all DNS zone
updates were sent, even if the BIND server crashed while processing
them, leading to prolonged execution and potential hang in the CI
environment. The Python rewrite of the test ensures that DNS update
tasks finish within five minutes of starting, irrespective of a BIND
crash possibility or DNS zone updates not finishing in time.

(cherry picked from commit ecd7b30d0a)
2023-08-08 14:30:27 +02:00
Michał Kępień 300f0230e1 Merge branch '4240-dnstap-system-test-fixes-9.18' into 'bind-9.18'
[9.18] "dnstap" system test fixes

See merge request isc-projects/bind9!8178
2023-08-07 12:59:41 +00:00
Michał Kępień a1800c23a0 Wait until fstrm_capture is ready
The fstrm_capture utility is started in the background during the
"dnstap" system test.  Consequently, "rndc dnstap-reopen" and similar
commands may be executed before fstrm_capture starts listening on the
Unix domain socket it is configured to receive dnstap data on.  This
results in the dnstap data sent to that socket in the meantime to be
lost; while the fstrm writer thread is able to recover from such a
scenario within a couple of seconds (by reopening the configured dnstap
destination itself), only one write attempt is made for data
successfully queued to the writer thread, so dnstap frames can still be
lost in the process.  This may happen during the "dnstap" system test,
leading to the dnstap output file being empty, which in turn causes the
test to fail.

Fix by waiting until fstrm_capture starts listening on the Unix domain
socket it is configured to use before asking named to reopen the
configured dnstap destination.  Since various fstrm_capture versions log
different messages when the listening socket is set up, wait for a
common string that works for all fstrm_capture versions released to
date.  Add a few extra debug messages indicating test progress and make
the test fail if the expected fstrm_capture log message is not generated
within 10 seconds.

(cherry picked from commit 26d3d97f12)
2023-08-07 13:59:35 +02:00
Michał Kępień 7db6129f62 Capture all fstrm_capture output
The fstrm_capture.out file is overwritten when the fstrm_capture utility
is restarted during the "dnstap" system test.  Use a separate output
file for each fstrm_capture instance to ensure all output produced by
that tool during the "dnstap" system test is preserved for forensic
purposes.

(cherry picked from commit bd2941fc72)
2023-08-07 13:59:35 +02:00
Mark Andrews edad2eb2b9 Merge branch '4243-_wait_for_stats-errors-not-detected-in-ixfr-system-test-bind-9.18' into 'bind-9.18'
[9.18] Resolve "_wait_for_stats errors not detected in ixfr system test"

See merge request isc-projects/bind9!8176
2023-08-07 09:47:39 +00:00
Mark Andrews 4e8b3f9893 Set ret=1 if _wait_for_stats does not succeed
Errors getting transfer statistics from named.run where not detected
as ret was not set to one if there hadn't been a success after looping
for a while.

(cherry picked from commit 287a1ac09b)
2023-08-07 19:20:13 +10:00
Michał Kępień 6c930b8db5 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.19' into 'bind-9.18'
Set up version and release notes for BIND 9.18.19

See merge request isc-projects/bind9!8174
2023-08-07 08:27:23 +00:00
Michał Kępień 6c7c302cbc Set up release notes for BIND 9.18.19 2023-08-07 10:26:29 +02:00
Michał Kępień bda09d3602 Update BIND version to 9.18.19-dev 2023-08-07 10:26:29 +02:00
Michał Kępień 1f8de2f0aa Update BIND version for release 2023-08-04 11:45:33 +02:00
Michał Kępień 4ba877aafb Add a CHANGES marker 2023-08-04 11:45:33 +02:00
Michał Kępień b5f0f71ad1 Merge branch 'michal/prepare-documentation-for-bind-9.18.18' into 'v9.18.18-release'
Prepare documentation for BIND 9.18.18

See merge request isc-private/bind9!562
2023-08-04 09:44:18 +00:00
Michał Kępień e36d6ca0d8 Add release note for GL #4215 2023-08-04 11:08:44 +02:00
Michał Kępień dda66bbe00 Reorder release notes 2023-08-04 11:08:44 +02:00
Michał Kępień 2a57eb4a29 Tweak and reword release notes 2023-08-04 11:08:44 +02:00
Michał Kępień 682f018150 Prepare release notes for BIND 9.18.18 2023-08-04 11:08:44 +02:00
Matthijs Mekking f80b95bd97 Merge branch 'matthijs-followup-4032-v9_18' into 'bind-9.18'
[9.18] Change default TTLsig to one week

See merge request isc-projects/bind9!8165
2023-08-02 12:03:46 +00:00
Matthijs Mekking dab43f84dd Change default TTLsig to one week
Commit dc6dafdad1 allows larger TTL values
in zones that go insecure, and ignores the maximum zone TTL.

This means that if you use TTL values larger than 1 day in your zone,
your zone runs the risk of going bogus before it moves safely to
insecure.

Most resolvers by default cap the maximum TTL that they cache RRsets,
at one day (Unbound, Knot, PowerDNS) so that is fine. However, BIND 9's
default is one week.

Change the default TTLsig to one week, so that also for BIND 9
resolvers in the default cases responses for zones that are going
insecure will not be evaluated as bogus.

This change does mean that when unsigning your zone, it will take six
days longer to safely go insecure, regardless of what TTL values you
use in the zone.

(cherry picked from commit 32686beabc)
2023-08-02 12:19:25 +02:00
Evan Hunt 668e1f613f Merge branch '3700-deprecate-dialup-bind-9.18' into 'bind-9.18'
[9.18] deprecate "dialup" and "heartbeat-interval"

See merge request isc-projects/bind9!8159
2023-08-02 02:10:29 +00:00
Evan Hunt aa4e3e0994 CHANGES and release note for [GL #3700]
(cherry picked from commit d10b6a4b39)
2023-08-01 18:42:19 -07:00
Evan Hunt 3cc1e5e12a deprecate "dialup" and "heartbeat-interval"
these options concentrate zone maintenance actions into
bursts for the benefit of servers with intermittent connections.
that's no longer something we really need to optimize.

(cherry picked from commit eeeccec67c)
2023-08-01 18:41:49 -07:00
Mark Andrews c17cbc371c Merge branch '4229-nextpart-failed-set-e-fallout-bind-9.18' into 'bind-9.18'
[9.18] Resolve "nextpart failed, set -e fallout?"

See merge request isc-projects/bind9!8158
2023-08-02 01:09:22 +00:00
Mark Andrews 0e4872a12a Use $() instead of backticks
(cherry picked from commit 162db75e2b)
2023-08-02 00:31:30 +00:00
Mark Andrews ad69f979c6 Merge branch '4059-oracle-linux-8-shell-doesn-t-always-restore-environment-variable-correctly-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Oracle Linux 8 shell doesn't always restore environment variable correctly"

See merge request isc-projects/bind9!8157
2023-08-02 00:24:17 +00:00
Mark Andrews b1a9077011 Use sub shell to isolate enviroment changes
'HOME=value command' should only change HOME for command but on
some platforms this occasionally sets HOME for the rest of the
test. Explicitly isolate the enviroment change using a sub shell.

(cherry picked from commit 96f75bba18)
2023-08-02 09:56:27 +10:00
Arаm Sаrgsyаn c2957ad386 Merge branch '4226-dig-help-message-https-plain-get-vs-http-plain-get-9.18' into 'bind-9.18'
[9.18] Fix dig help message typo in the http-plain-get option

See merge request isc-projects/bind9!8156
2023-08-01 12:03:41 +00:00
Aram Sargsyan 18ba295abe Fix dig help message typo in the http-plain-get option
The option name is misspelled as 'https-plain-get'. Fix the error.

(cherry picked from commit 77d1476c46)
2023-08-01 11:22:10 +00:00
Matthijs Mekking 6fbbfe9018 Merge branch '4032-ignore-max-zone-ttl-dnssec-policy-insecure-v9_18' into 'bind-9.18'
[9.18] Ignore max-zone-ttl on dnssec-policy insecure

See merge request isc-projects/bind9!8155
2023-08-01 09:37:38 +00:00
Matthijs Mekking 803e95dc00 Add CHANGES and release note for #4032
(cherry picked from commit 0bdf1980c4)
2023-08-01 09:53:03 +02:00
Matthijs Mekking a21407d062 Ignore max-zone-ttl on dnssec-policy insecure
Allow larger TTL values in zones that go insecure. This is necessary
because otherwise the zone will not be loaded due to the max-zone-ttl
of P1D that is part of the current insecure policy.

In the keymgr.c code, default back to P1D if the max-zone-ttl is set
to zero.

(cherry picked from commit dc6dafdad1)
2023-08-01 09:53:03 +02:00
Mark Andrews dea6db53bc Merge branch '4225-return-refused-if-gssapi-not-configured-bind-9.18' into 'bind-9.18'
[9.18] Resolve "SERVFAIL response to TKEY query"

See merge request isc-projects/bind9!8154
2023-08-01 01:45:15 +00:00
Mark Andrews 26ff230be2 Add CHANGES for [GL #4225]
(cherry picked from commit ccaefce7ca)
2023-07-29 05:47:14 +10:00
Mark Andrews 022397a2c7 Check GSS-API TKEY against non configured server
Check for the expected error message which includes rcode REFUSED
then reload the server to specify the keytab for the rest of the
GSSAPI tests.

(cherry picked from commit 3a2a24903c)
2023-07-29 05:46:32 +10:00
Mark Andrews aeab068adc Report TKEY query errors in nsupdate
(cherry picked from commit f244619680)
2023-07-29 05:46:32 +10:00
Mark Andrews b64aa2d7a2 Return REFUSED if GSSAPI is not configured
Return REFUSED if neither a keytab nor a gssapi credential is
configured to GSSAPI/TKEY requests.

(cherry picked from commit b5076014b9)
2023-07-29 05:46:32 +10:00
Ondřej Surý 465923efff Merge branch 'stepan/fix-check-in-ecdsa-system-test-9.18' into 'bind-9.18'
[9.18] Fix ecdsa256 check in ecdsa system test setup

See merge request isc-projects/bind9!8150
2023-07-28 08:12:33 +00:00
Štěpán BalážikandOndřej Surý ffe0cb4bb0 Fix ecdsa256 check in ecdsa system test setup
Probably by copy-paste mistake, ecdsa384 was checked twice.

(cherry picked from commit 10194baa07)
2023-07-28 09:15:06 +02:00
Tom Krizek 49dcee5b19 Merge branch '4055-improve-the-overmem-cache-cleaning-test-9.18' into 'bind-9.18'
[9.18] [CVE-2023-2828] Add test for dns_rbtdb overmem purging

See merge request isc-projects/bind9!8143
2023-07-26 12:15:23 +00:00
Ondřej SurýandTom Krizek a2c5503bba Add test for dns_rbtdb overmem purging
Add a unit test to check if the overmem purging in the RBTDB is
effective when mixed size RR data is inserted into the database.

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

(manually picked from 269c03831f)
2023-07-26 13:39:24 +02:00
Tom Krizek 3a837951fe Merge branch 'tkrizek/disable-resolve-in-tsan' into 'bind-9.18'
[9.18] Disable resolve checks under TSAN

See merge request isc-projects/bind9!8138
2023-07-26 08:06:58 +00:00
Tom Krizek 774b9bc629 Disable resolve checks under TSAN
The resolve binary is affected by GL#4119 which occassionally makes it
hand during system tests when running with TSAN. This is a workaround to
avoid wasting resources caused by a CI timeout for the system test tsan
jobs.
2023-07-25 14:05:28 +02:00
Tom Krizek 5c98308987 Merge branch '4089-stale-query-loop-test-9.18' into 'bind-9.18'
[9.18] Reproducer for CVE-2023-2911

See merge request isc-projects/bind9!8135
2023-07-25 11:25:13 +00:00
Tom Krizek 0d88cd444b Reproducer for CVE-2023-2911
The conditions that trigger the crash:
- a stale record is in cache
- stale-answer-client-timeout is 0
- multiple clients query for the stale record, enough of them to exceed
  the recursive-clients quota
- the response from the authoritative is sufficiently delayed so that
  recursive-clients quota is exceeded first

The reproducer attempts to simulate this situation. However, it hasn't
proven to be 100 % reproducible, especially in CI. When reproducing
locally, the priming query also seems to sometimes interfere and prevent
the crash. When the reproducer is ran twice, it appears to be more
reliable in reproducing the issue.

(cherry picked from commit f617512d37)
2023-07-25 10:34:33 +02:00
Tom Krizek a9b4552db2 Merge branch 'tkrizek/checkconf-keys-dir-set-e-9.18' into 'bind-9.18'
[9.18] Clean up keys directory in checkconf test

See merge request isc-projects/bind9!8134
2023-07-25 08:11:12 +00:00
Tom Krizek 744185f524 Clean up keys directory in checkconf test
The keys directory should be cleaned up in clean.sh. Doing that in the
test itself isn't reliable which may lead to failing mkdir which causes
the test to fail with set -e.

(cherry picked from commit 062dfac28e)
2023-07-25 09:21:50 +02:00
Mark Andrews e927dd4609 Merge branch '4215-add-isc_r_timedout-to-the-reasons-to-call-dns_zonemgr_unreachableadd-in-xfrin-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Add ISC_R_TIMEDOUT to the reasons to call dns_zonemgr_unreachableadd in xfrin"

See merge request isc-projects/bind9!8128
2023-07-21 23:38:58 +00:00
Mark Andrews 85173c2bf5 Add CHANGES note for [GL #4215]
(cherry picked from commit fefc273eb0)
2023-07-22 09:01:02 +10:00
Mark Andrews c36d41d39c Mark a primary as unreachable on timed out in xfin
When a primary server is not responding, mark it as temporarialy
unreachable.  This will prevent too many zones queuing up on a
unreachable server and allow the refresh process to move onto
the next primary sooner once it has been so marked.

(cherry picked from commit 621c117101)
2023-07-22 09:00:08 +10:00
Ondřej Surý 4e12fb257e Merge branch '4200-dont-process-next-TCP-packet-when-paused-9.18' into 'bind-9.18'
[9.18] Don't process detach and close as priority netmgr events

See merge request isc-projects/bind9!8094
2023-07-20 17:20:48 +00:00
Ondřej Surý 7cd1ac2fa7 Add CHANGES and release note for [GL #4200] 2023-07-20 18:41:01 +02:00
Ondřej Surý c2c2ec0c96 Don't process detach and close as priority netmgr events
The detach (and possibly close) netmgr events can cause additional
callbacks to be called when under exclusive mode.  The detach can
trigger next queued TCP query to be processed and close will call
configured close callback.

Move the detach and close netmgr events from the priority queue to the
normal queue as the detaching and closing the sockets can wait for the
exclusive mode to be over.
2023-07-20 18:37:48 +02:00
Arаm Sаrgsyаn 13151c3515 Merge branch 'aram/tests-statschannel-fetch.pl-typo-9.18' into 'bind-9.18'
[9.18] Fix a bug in an utility script for the statschannel system test

See merge request isc-projects/bind9!8120
2023-07-19 15:47:24 +00:00
Aram Sargsyan 67f4b9d2a6 Fix a bug in an utility script for the statschannel system test
Because of a typo, the fetch.pl script tries to extract the server
address from the input parameter 'a' instead of 's'. Fix the typo.

(cherry picked from commit aa7538fd38)
2023-07-19 13:25:17 +00:00
Tom Krizek 42d7c0e92a Merge tag 'v9.18.17' into bind-9.18 2023-07-19 14:36:57 +02:00
Mark Andrews 5e6628f3ab Merge branch '4203-run-gdb-not-found-bind-9.18' into 'bind-9.18'
[9.18] Resolve "run.gdb not found"

See merge request isc-projects/bind9!8112
2023-07-19 03:14:01 +00:00
Mark Andrews d865ca788f Use absolute path to locate run.gdb
(cherry picked from commit 3f7723cdff)
2023-07-19 12:37:48 +10:00
Michal Nowak f6dddbe687 Merge branch 'mnowak/remove-windows-support-remnants-9.18' into 'bind-9.18'
[9.18] Remove remnants of Windows support in system test

See merge request isc-projects/bind9!8111
2023-07-18 15:59:22 +00:00
Michal Nowak add15bd083 Remove remnants of Windows support in system test
The "uname -o" command is harmful on OpenBSD because this platform does
not know about the "-o" option. It is a permanent failure since system
tests are started with "set -e".

(cherry picked from commit ad3efede4d)
2023-07-18 17:45:35 +02:00
Tom Krizek 5cd6d2e70b Merge branch 'tkrizek/readthedocs-config-9.18' into 'bind-9.18'
[9.18] Add configuration for readthedocs.org

See merge request isc-projects/bind9!8109
2023-07-18 14:59:51 +00:00
Tom Krizek 5512e8fd6b Synchronize Sphinx package version on ReadTheDocs with our CI
Related: isc-projects/images!228
2023-07-18 16:17:36 +02:00
Tom Krizek ab336d5da8 Add configuration for readthedocs.org
readthedocs.org is switching to in-repo configuration file in favor of
the deprecated web interface as it allows more flexibility.

This also fixes our recent doc build issues, as we're switching to a
newer Python which is required by Sphinx.

See https://blog.readthedocs.com/migrate-configuration-v2/

(cherry picked from commit a1a0ccda6e)
2023-07-18 15:33:07 +02:00
Tom Krizek da44dff5ef Merge branch 'tkrizek/run-tests-with-set-e-9.18' into 'bind-9.18'
[9.18] Run system tests with set -e

See merge request isc-projects/bind9!8103
2023-07-17 15:03:26 +00:00
Tom Krizek 915e633a5d Handle curl without HTTP/2 support in doth test 2023-07-17 16:28:49 +02:00
Tom Krizek 854b50db32 Check return codes from commands in inline test
To improve the compatibility of the inline test with the `set -e`
option, ensure all commands which are expected to pass are explicitly
checked for return code and non-zero return codes are handled.

(cherry picked from commit e5f2addcaa)
2023-07-17 15:37:18 +02:00
Tom Krizek e94162457c Ignore test cleanup commits in git blame
(manually picked from commit ccc9b87f59)
2023-07-17 15:36:45 +02:00
Tom Krizek bca32c0c30 Handle non-zero return codes in autosign test 2023-07-17 15:30:14 +02:00
Tom Krizek 59e5fa4217 Use $(...) notation for subshells in system tests
The changes were mostly done with sed:

find . -name '*.sh' | xargs sed -i 's/`\([^`]*\)`/$(\1)/g'

There have been a few manual changes where the regex wasn't sufficient
(e.g. backslashes inside the `...`) or wrong (`...` referring to docs or
in comments).

(manually picked from commit 05baf7206b)
2023-07-17 15:30:14 +02:00
Tom Krizek 02edc985cf Handle non-zero return codes in rootkeysentinel tests
(cherry picked from commit d203681a75)
2023-07-17 15:30:14 +02:00
Tom Krizek 17f6a849ab Handle non-zero return codes in resolver test
(cherry picked from commit 2b8e5e1155)
2023-07-17 15:30:14 +02:00
Tom Krizek 28e39b567c Handle non-zero return codes in statschannel test
(cherry picked from commit cde02fdb6a)
2023-07-17 15:30:13 +02:00
Tom Krizek db589ad1e5 Handle non-zero return codes in checkconf test
(cherry picked from commit 4a87b44196)
2023-07-17 15:30:13 +02:00
Tom Krizek c1de0c9788 Handle non-zero return codes in dnstap test
(cherry picked from commit 9d383dce40)
2023-07-17 15:30:13 +02:00
Tom Krizek e302ee1cc7 Handle non-zero return codes in kasp test
(cherry picked from commit ede8ea889b)
2023-07-17 15:30:13 +02:00
Tom Krizek b7ef365cff Handle non-zero return codes in serve-stale test
(cherry picked from commit 4e8802a22d)
2023-07-17 15:30:13 +02:00
Tom Krizek 94a6fd2ad0 Handle non-zero return codes in doth test
(cherry picked from commit fae6808b9c)
2023-07-17 15:30:13 +02:00
Tom Krizek 523bbe906d Handle non-zero return codes in acl test
(cherry picked from commit 1e64749ed3)
2023-07-17 15:30:13 +02:00
Tom Krizek 716d8f43e0 Handle non-zero return codes in statistics test
(cherry picked from commit 3a36ff506d)
2023-07-17 15:30:13 +02:00
Tom Krizek a460982af7 Handle non-zero return codes in rrsetorder test
(cherry picked from commit 9fdf537f52)
2023-07-17 15:30:13 +02:00
Tom Krizek e7ec2cea48 Handle non-zero return codes in redirect test
(cherry picked from commit 45fc4cc465)
2023-07-17 15:30:12 +02:00
Tom Krizek be033cf794 Handle non-zero return codes in rndc test
(cherry picked from commit c50a9e158d)
2023-07-17 15:30:12 +02:00
Tom Krizek aca0cbe902 Handle non-zero return codes in inline test
(cherry picked from commit 36d74bd2e3)
2023-07-17 15:30:12 +02:00
Tom Krizek c6fa52c31e Handle non-zero return codes unknown test
(cherry picked from commit f3310e1731)
2023-07-17 15:30:12 +02:00
Tom Krizek 245730cf78 Handle non-zero return codes in nsupdate test
(cherry picked from commit 86765ad1d3)
2023-07-17 15:30:12 +02:00
Tom Krizek fcb72ad748 Handle non-zero return codes in zonechecks test
(cherry picked from commit e5933f65d6)
2023-07-17 15:30:12 +02:00
Tom Krizek 45c3163083 Handle non-zero return codes in wildcard test
(cherry picked from commit e8c61f8da4)
2023-07-17 15:30:12 +02:00
Tom Krizek 2ee1e36308 Handle non-zero return codes in zero test
(cherry picked from commit 69e8876966)
2023-07-17 15:30:12 +02:00
Tom Krizek 05247d365f Handle non-zero return codes in legacy test
(cherry picked from commit 3ce200ead8)
2023-07-17 15:30:11 +02:00
Tom Krizek 32ccdddcda Handle non-zero return codes in forward test
(cherry picked from commit 2823d0b469)
2023-07-17 15:30:11 +02:00
Tom Krizek 09cc0a03f5 Handle non-zero return codes in upforwd test
(cherry picked from commit 855f5b143a)
2023-07-17 15:30:11 +02:00
Tom Krizek ffa70cad1a Handle non-zero return codes in addzone test
(cherry picked from commit 146cb978c5)
2023-07-17 15:30:11 +02:00
Tom Krizek d34f1aac27 Handle non-zero return codes in rpzrecurse test
(cherry picked from commit 247b608f62)
2023-07-17 15:30:11 +02:00
Tom Krizek 881e4af8ed Handle non-zero return codes in rpz test
(cherry picked from commit 1d5caafa9e)
2023-07-17 15:30:11 +02:00
Tom Krizek b04181224f Make $? compatible with set -e in system tests
Ensure handling of return code from previous command doesn't cause the
script to halt if that code is non-zero when running with `set -e`.

(cherry picked from commit 837c190d9e)
2023-07-17 15:30:11 +02:00
Tom Krizek e577b1eca7 Use arithmetic expansion in system tests (followup)
These are manual edits in addition of the automated changes from the
previous commit.

(manually picked from commit 1436025e20)
2023-07-17 15:30:09 +02:00
Tom Krizek 6f07ba6b7d Use arithmetic expansion in system tests
Change the way arithmetic operations are performed in system test shell
scripts from using `expr` to `$(())`. This ensures that updating the
variable won't end up with a non-zero exit code, which would case the
script to exit prematurely when `set -e` is in effect.

The following replacements were performed using sed in all text files
(git grep -Il '' | xargs sed -i):

s/status=`expr $status + $ret`/status=$((status + ret))/g
s/n=`expr $n + 1`/n=$((n + 1))/g
s/t=`expr $t + 1`/t=$((t + 1))/g
s/status=`expr $status + 1`/status=$((status + 1))/g
s/try=`expr $try + 1`/try=$((try + 1))/g

(manually picked from commit 4d42bdc245)
2023-07-17 14:12:59 +02:00
Tom Krizek d715bae429 Run system tests with set -e
Ensure all shell system tests are executed with the errexit option set.
This prevents unchecked return codes from commands in the test from
interfering with the tests, since any failures need to be handled
explicitly.

(cherry picked from commit 01bc805f89)
2023-07-17 13:46:19 +02:00
Michal Nowak 7abd0723fc Merge branch 'mnowak/detect-core-dumps-after-server-failed-to-stop-9.18' into 'bind-9.18'
[9.18] Detect core dumps after BIND failed to stop cleanly

See merge request isc-projects/bind9!8100
2023-07-13 13:52:34 +00:00
Michal Nowak 577f0723e0 Detect core dumps after BIND failed to stop cleanly
With the pytest runner, when BIND crashed during test runtime, the
get_core_dumps.sh script hasn't been run, and core dumps were not
detected.

(cherry picked from commit 89c77daddb)
2023-07-13 15:14:47 +02:00
Tom Krizek 80d4b602a7 Merge branch 'tkrizek/set-up-version-and-release-notes-for-bind-9.18.18' into 'bind-9.18'
Set up version and release notes for BIND 9.18.18

See merge request isc-projects/bind9!8093
2023-07-10 13:45:28 +00:00
Tom Krizek e472710cac Set up release notes for BIND 9.18.18 2023-07-10 15:39:38 +02:00
Tom Krizek 77271086a2 Update BIND version to 9.18.18-dev 2023-07-10 15:39:37 +02:00
Michał Kępień 42ca7611bd Update BIND version for release 2023-07-06 16:09:43 +02:00
Michał Kępień 9a292d18d9 Add a CHANGES marker 2023-07-06 16:09:43 +02:00
Michał Kępień 9dae6ab51e Merge branch 'michal/prepare-documentation-for-bind-9.18.17' into 'v9.18.17-release'
Prepare documentation for BIND 9.18.17

See merge request isc-private/bind9!551
2023-07-06 14:09:04 +00:00
Michał Kępień a9a932d3b4 Add release note for GL #4132, GL #4136, GL #4171 2023-07-06 15:46:16 +02:00
Michał Kępień dac36248be Tweak and reword release notes 2023-07-06 15:46:16 +02:00
Michał Kępień 01491c5a29 Prepare release notes for BIND 9.18.17 2023-07-06 15:46:16 +02:00
Michał Kępień e237ab6614 Update sample query log excerpt in the ARM 2023-07-06 15:46:16 +02:00
Michał Kępień ebab8b7705 Fix typo in tests_shutdown.py 2023-07-06 15:46:16 +02:00
Arаm Sаrgsyаn 7428653012 Merge branch '4171-add-shutdown-check-in-dns_catz_dbupdate_callback-9.18' into 'bind-9.18'
[9.18] Add shutdown checks in dns_catz_dbupdate_callback()

See merge request isc-projects/bind9!8089
2023-07-06 12:32:11 +00:00
Aram Sargsyan d753174392 Add a CHANGES note for [GL #4171]
(cherry picked from commit 8887da60ad)
2023-07-06 11:27:50 +00:00
Aram Sargsyan 4fdb57a1f3 Add shutdown checks in dns_catz_dbupdate_callback()
When a zone database update callback is called, the 'catzs' object,
extracted from the callback argument, might be already shutting down,
in which case the 'catzs->zones' can be NULL and cause an assertion
failure when calling isc_ht_find().

Add an early return from the callback if 'catzs->shuttingdown' is true.

Also check the validity of 'catzs->zones' after locking 'catzs' in
case there is a race with dns_catz_shutdown_catzs() running in another
thread.

(cherry picked from commit 28bb419edc)
2023-07-06 11:27:45 +00:00
Arаm Sаrgsyаn e1529a6a01 Merge branch '4132-catz-data-race-in-db.c-9.18' into 'bind-9.18'
[9.18] Fix a data race between the dns_zone and dns_catz modules

See merge request isc-projects/bind9!8036
2023-07-06 11:25:37 +00:00
Ondřej SurýandAram Sargsyan 26bb402b44 Run RPZ and catalog zones tasks in exclusive mode
All the heavy RPZ and CATZ work is already running with offloaded
threads, and running the remaining small functions in exclusive mode
offers more synchronization guaranties.

Move the update notify registration code from the offloaded
dns__catz_update_cb() function into dns__catz_done_cb().

After this change, it should be safe to remove the lock/unlock code
from the dns_catz_dbupdate_register() and dns_catz_dbupdate_unregister()
functions, as they were causing a benign TSAN lock-order-inversion
report.
2023-07-06 10:44:03 +00:00
Aram Sargsyan 471a2c0dd5 Add a CHANGES note for [GL #4132]
(cherry picked from commit f73007afe7)
2023-07-06 10:44:03 +00:00
Aram Sargsyan c67ce97045 Fix a data race between the dns_zone and dns_catz modules
The dns_zone_catz_enable_db() and dns_zone_catz_disable_db()
functions can race with similar operations in the catz module
because there is no synchronization between the threads.

Add catz functions which use the view's catalog zones' lock
when registering/unregistering the database update notify callback,
and use those functions in the dns_zone module, instead of doing it
directly.

(cherry picked from commit 6f1f5fc307)
2023-07-06 10:44:03 +00:00
Matthijs Mekking b78a555078 Merge branch '2471-test-three-is-a-crowd-v9_18' into 'bind-9.18'
[9.18] Add "three is a crowd" test case

See merge request isc-projects/bind9!8088
2023-07-06 10:22:40 +00:00
Matthijs Mekking 9cb0a2731d Add test for "three is a crowd" bug (GL #2375)
Add this test scenario for a bug fixed a while ago. When a third key is
introduced while the previous rollover hasn't finished yet, the keymgr
could decide to remove the first two keys, because it was not checking
for an indirect dependency on the keys.

In other words, the previous bug behavior was that the first two keys
were removed from the zone too soon.

This test case checks that all three keys stay in the zone, and no keys
are removed premature after another new key has been introduced.

(cherry picked from commit 9c40cf0566)
2023-07-06 10:57:54 +02:00
Matthijs Mekking 6859294c26 Check all keys despite early failure
In the kasp script, if one expected key is not found, continue checking
the other key ids, even if there is no match for the first one.  This
provides a bit more information which keys mismatch and makes for
easier debugging test failures.

(cherry picked from commit 674249f66a)
2023-07-06 10:57:09 +02:00
Evan Hunt 3955457c95 Merge branch 'each-refactor-fetchopt-bind-9.18' into 'bind-9.18'
[9.18] clean up numbering of FETCHOPT and ADDRINFO flags

See merge request isc-projects/bind9!8084
2023-07-04 19:36:50 +00:00
Evan Hunt 995b78ea4e clean up numbering of FETCHOPT and ADDRINFO flags
in the past there was overlap between the fields used
as resolver fetch options and ADB addrinfo flags. this has
mostly been eliminated; now we can clean up the rest of
it and remove some confusing comments.

(cherry picked from commit 0955cf1af5)
2023-07-04 11:58:09 -07:00
Tom Krizek 6db34b6ebb Merge branch '4126-statschannel-connection-close-keepalive-9.18' into 'bind-9.18'
[9.18] Improve statschannel HTTP Connection: header logic

See merge request isc-projects/bind9!8082
2023-07-04 13:02:57 +00:00
Tony FinchandTom Krizek 1ddf2b87f5 Improve statschannel HTTP Connection: header protocol conformance
In HTTP/1.0 and HTTP/1.1, RFC 9112 section 9.6 says the last response
in a connection should include a `Connection: close` header, but the
statschannel server omitted it.

In an HTTP/1.0 response, the statschannel server can sometimes send a
`Connection: keep-alive` header when it is about to close the
connection. There are two ways:

If the first request on a connection is keep-alive and the second
request is not, then _both_ responses have `Connection: keep-alive`
but the connection is (correctly) closed after the second response.

If a single request contains

	Connection: close
	Connection: keep-alive

then RFC 9112 section 9.3 says the keep-alive header is ignored, but
the statschannel sends a spurious keep-alive in its response, though
it correctly closes the connection.

To fix these bugs, make it more clear that the `httpd->flags` are part
of the per-request-response state. The Connection: flags are now
described in terms of the effect they have instead of what causes them
to be set.

(manually picked from commit e18ca83a3b)
2023-07-04 14:53:08 +02:00
Tom Krizek 56546ecf20 Merge branch 'tkrizek-shutdown-rndc-hang-9.18' into 'bind-9.18'
[9.18] Split shutdown test into separate test cases

See merge request isc-projects/bind9!8083
2023-07-04 12:43:45 +00:00
Tom Krizek 184eddb595 Use timeout for rndc status in shutdown test
Pass 5 second timeout to the rndc status command(s) to avoid hitting the
hard 10 second timeout from subprocess.call, which would result in an
unwanted exception that would only mask the real issue: if the rndc
status times out in this test, it is likely due to the server not
stopping as it should.

(cherry picked from commit ceed694659)
2023-07-04 14:36:05 +02:00
Tom Krizek c7b0ac0367 Split shutdown test into separate test cases
The shutdown test attempts to shut down the server using two different
methods - rndc and sigterm. Use pytest.mark.parametrize to run these as
separate test cases for easier identification of failures.

(cherry picked from commit 603c58ee28)
2023-07-04 14:36:03 +02:00
Michał Kępień 0c23b13291 Merge branch '4169-add-google-site-verification-tag-to-the-toc-page-9.18' into 'bind-9.18'
[9.18] Add Google Site Verification tag to the TOC page

See merge request isc-projects/bind9!8077
2023-06-29 16:49:44 +00:00
Michał Kępień 83e811f518 Add Google Site Verification tag to the TOC page
This should allow tracking HTTP 404 errors for Read the Docs using the
Google Search Console.

(cherry picked from commit 13c35ab0b3)
2023-06-29 18:48:31 +02:00
Tom Krizek 5cd3051793 Merge branch 'tkrizek-disable-delv-in-tsan-9.18' into 'bind-9.18'
[9.18] Disable delv tests under TSAN

See merge request isc-projects/bind9!8071
2023-06-29 12:33:35 +00:00
Tom Krizek 4dcb0c67d3 Check for unset variables only after conf.sh is loaded
Make the cds/setup.sh compatible with the workaround which relies on
testing the TSAN_OPTIONS variable which may not be set.

(cherry picked from commit 76d9873ef6)
2023-06-29 13:14:33 +02:00
Tom Krizek b94f5146a1 Fix checking for executables in shell conditions in tests
Surround the variables which are checked whether they're executable in
double quotes. Without them, empty paths won't be properly interpreted
as not executable.

(manually picked from commit 06056c44a7)
2023-06-29 13:14:26 +02:00
Tom Krizek cfada0f62e Only use delv if available in mkeys test
Check that $DELV is an executable before using it in a test.

(cherry picked from commit 384339dbba)
2023-06-29 13:00:26 +02:00
Tom Krizek 6eeec896ef Disable delv tests under TSAN
Since delv can occasionally hang in system tests when running with TSAN
(see GL#4119), disable these tests as a workaround. Otherwise, the hung
delv process will just waste CI resources and prevent any meaningful
output from the rest of the test suite.

(cherry picked from commit fbcf37f914)
2023-06-29 13:00:24 +02:00
Mark Andrews 1eed6e28c8 Merge branch '4154-restore-the-ability-to-read-old-hmac-md5-key-pair-files-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Restore the ability to read old HMAC-MD5 key pair files."

See merge request isc-projects/bind9!8069
2023-06-29 01:38:11 +00:00
Mark Andrews c73876fa90 Emit deprecated warning for K* file pairs
We try reading the same file using different methods so only
emit a warning if we successfully read the file.

(cherry picked from commit e3e20ed76e)
2023-06-29 10:52:48 +10:00
Mark Andrews 3db353c646 Add release note entry for [GL #4154]
(cherry picked from commit 91cb94dcbb)
2023-06-29 10:52:48 +10:00
Mark Andrews 16d6b10c5b Test legacy HMAC key files with dig
tsig-keygen is now used to generate key files for TSIG.  These have
a different format to those that were generated by dnssec-keygen.
Test that dig can still read these files.

(cherry picked from commit c91a208ef5)
2023-06-29 10:52:46 +10:00
Mark Andrews a16e10ad8a Test support with legacy HMAC K files with nsupdate
tsig-keygen generates key files that are different to those that
where generated by dnssec-keygen.  Check that nsupdate can still
read those old format files.

(cherry picked from commit e1fb17e72c)
2023-06-29 10:41:45 +10:00
Mark Andrews 2376abc18e Restore the ability to read legacy K*+157+* files
The ability to read legacy HMAC-MD5 K* keyfile pairs using algorithm
number 157 was accidentally lost when the algorithm numbers were
consolidated into a single block, in commit
09f7e0607a.

The assumption was that these algorithm numbers were only known
internally, but they were also used in key files. But since HMAC-MD5
got renumbered from 157 to 160, legacy HMAC-MD5 key files no longer
work.

Move HMAC-MD5 back to 157 and GSSAPI back to 160.  Add exception for
GSSAPI to list_hmac_algorithms.

(cherry picked from commit 3f93d3f757)
2023-06-29 10:32:10 +10:00
Ondřej Surý 068d14a963 Merge branch '3325-strict-qname-minimisation-should-check-for-cached-nodata-for-ns-name-9.18' into 'bind-9.18'
[9.18] Use NS rather than A records for qname-minimization relaxed

See merge request isc-projects/bind9!8066
2023-06-28 11:18:41 +00:00
Mark AndrewsandOndřej Surý ae853dd2b6 Add release note for [GL #3325]
(cherry picked from commit 2a71ed47a7)
2023-06-28 12:33:18 +02:00
Mark AndrewsandOndřej Surý 1e7f5eb161 Add CHANGES note for [GL #3325]
(cherry picked from commit f378e02423)
2023-06-28 12:32:50 +02:00
Mark AndrewsandOndřej Surý 5739b4817a In rctx_answer return DNS_R_DELEGATION on NOFOLLOW
When DNS_FETCHOPT_NOFOLLOW is set DNS_R_DELEGATION needs to be
returned to restart the resolution process rather than converting
it to ISC_R_SUCCESS.

(cherry picked from commit ea11650376)
2023-06-28 12:32:26 +02:00
Mark AndrewsandOndřej Surý 7f2eeb60ee Skip some QNAME mininisation queries if possible
If we know that the NS RRset for an intermediate label doesn't exist
on cache contents don't query using that name when looking for a
referral.

(cherry picked from commit 80bc0ee075)
2023-06-28 12:32:23 +02:00
Mark AndrewsandOndřej Surý b3a97da7a7 Use NS rather than A records for qname-minimization relaxed
Remove all references to DNS_FETCHOPT_QMIN_USE_A and adjust
the expected tests results in the qmin system test.

(cherry picked from commit dd00b3c50b)
2023-06-28 12:31:49 +02:00
Mark Andrews 0eb73bb6a3 Merge branch '4047-assertion-failure-in-dns_resolver_attach-at-resolver-c-10599' into 'bind-9.18'
Resolve "Assertion failure in dns_resolver_attach() at resolver.c:10599"

See merge request isc-projects/bind9!8045
2023-06-27 06:53:41 +00:00
Mark Andrews 0d3693f08f Remove unnecessary REQUIRE in dns_resolver_attach
There is no harm in aquiring an additional reference to the resolver
after it has started shutting down.  All the REQUIRE was doing was
introducing a point of failure when shutting down the server.
2023-06-27 05:19:56 +00:00
Evan Hunt adf199b309 Merge branch '950-test-validation-bind-9.18' into 'bind-9.18'
[9.18] explicitly set dnssec-validation in system tests

See merge request isc-projects/bind9!8063
2023-06-27 00:18:29 +00:00
Evan Hunt a31dd61b0f explicitly set dnssec-validation in system tests
the default value of dnssec-validation is 'auto', which causes
a server to send a key refresh query to the root zone when starting
up. this is undesirable behavior in system tests, so this commit
sets dnssec-validation to either 'yes' or 'no' in all tests where
it had not previously been set.

this change had the mostly-harmless side effect of changing the cached
trust level of unvalidated answer data from 'answer' to 'authanswer',
which caused a few test cases in which dumped cache data was examined in
the serve-stale system test to fail. those test cases have now been
updated to expect 'authanswer'.

(cherry picked from commit 0b09ee8cdc)
2023-06-26 15:03:06 -07:00
Ondřej Surý f6ee78c61a Merge branch '4049-detect-formerr-with-an-echoed-dns-cookie-client-cookie-and-retry-without-dns-cookie-9.18' into 'bind-9.18'
[9.18] Handle FORMERR on unknown EDNS option that are echoed

See merge request isc-projects/bind9!8061
2023-06-26 17:05:44 +00:00
Michał KępieńandOndřej Surý 74ef08a7b5 Add release note for #4049
(cherry picked from commit 466530c73b)
2023-06-26 18:52:37 +02:00
Mark AndrewsandOndřej Surý 20db7497b1 Add CHANGES note for [GL #4049]
(cherry picked from commit 97e1bb0e98)
2023-06-26 16:36:36 +02:00
Mark AndrewsandOndřej Surý b19bb84116 Check fallback on FORMERR to EDNS options
(cherry picked from commit 9d95cd427d)
2023-06-26 16:36:11 +02:00
Mark AndrewsandOndřej Surý d65feb0796 Add a server which returns FORMERR to all EDNS options
The server also echoes back the EDNS options and EDNS flags.

(cherry picked from commit 3328ddaf7a)
2023-06-26 16:36:11 +02:00
Mark AndrewsandOndřej Surý e7e29278a8 Handle FORMERR on unknown EDNS option that are echoed
If the resolver received a FORMERR response to a request with
an DNS COOKIE option present that echoes the option back, resend
the request without an DNS COOKIE option present.

(cherry picked from commit f3b24ba789)
2023-06-26 16:36:11 +02:00
Tom Krizek a0d672f0c5 Merge branch 'tkrizek-system-test-fixes-9.18' into 'bind-9.18'
[9.18] Fix a couple of oversights in system tests

See merge request isc-projects/bind9!8056
2023-06-26 14:27:09 +00:00
Tom Krizek ad5006cef4 Check for proper file size output in dnstap test
Previously, the first check silently failed, as 450 is apparently (in
the CI setup) the minimum output size for the dnstap output, rather than
470 which the test was expecting. Effectively, the check served as a 5
second sleep rather than waiting for the proper file size.

Additionally, check the expected file sizes and fail if expectations
aren't met.

(manually picked from commit 5f809e50b6)

On main, the minimum file size seems to 454 bytes, while on EL7 in our
CI setup for the 9.18 branch, it appears to be 450 instead.
2023-06-26 14:36:55 +02:00
Tom Krizek d1caa0b4f0 Check for proper log message in kasp test
The log message is supposed to contain the zone name which was
erroneously omitted, but didn't pop up during tests, since return code
was silently ignored.

Now it actually waits for the proper log message rather than being an
equivalent of 3 second sleep (which was also sufficient to make the test
pass, thus we detected no failure).

(cherry picked from commit 1dd4c2b9e2)
2023-06-26 13:07:29 +02:00
Michal Nowak d527fca768 Merge tag 'v9.18.16' into bind-9.18
BIND 9.18.16
2023-06-21 19:51:22 +02:00
Arаm Sаrgsyаn 4b97081fca Merge branch '4044-nslookup-reports-timeout-if-input-lookup-is-delayed' into 'bind-9.18'
[9.18] Update the event loop's time after executing a task

See merge request isc-projects/bind9!7891
2023-06-20 11:06:35 +00:00
Aram Sargsyan 7f70809d91 Add a CHANGES note for [GL #4044] 2023-06-20 10:22:46 +00:00
Aram Sargsyan 0c751ce72e Update the event loop's time after executing a task
Tasks can block for a long time, especially when used by tools in
interactive mode. Update the event loop's time to avoid unexpected
errors when processing later events during the same callback.
For example, newly started timers can fire too early, because the
current time was stale. See the note about uv_update_time() in the
https://docs.libuv.org/en/v1.x/timer.html#c.uv_timer_start page.
2023-06-20 10:21:54 +00:00
Aram Sargsyan 7f5beb751d Add nslookup test with a delayed input
The added test checks the stdin input mode of nslookup with an
added delay to confirm that [GL #4044] is fixed.
2023-06-20 10:21:54 +00:00
Michał Kępień e1a9db5fa6 Merge branch '2354-add-a-tool-for-reproducing-isc-spnego-bugs-9.18' into 'bind-9.18'
[9.18] [CVE-2020-8625] [CVE-2021-25216] Add a tool for reproducing ISC SPNEGO bugs

See merge request isc-projects/bind9!8042
2023-06-19 09:08:20 +00:00
Michał Kępień f046e415bf Add a tool for reproducing ISC SPNEGO bugs
Extend the "tsiggss" system test with reproducers for CVE-2020-8625 and
CVE-2021-25216.

(cherry picked from commit a47dc810f7)
2023-06-19 10:34:56 +02:00
Ondřej Surý b855432686 Merge branch '4149-make-isc_result-tables-more-compact-9.18' into 'bind-9.18'
[9.18] Make isc_result tables smaller

See merge request isc-projects/bind9!8038
2023-06-15 14:28:47 +00:00
Ondřej Surý a1413c2faf Add CHANGES note for [GL #4149]
(cherry picked from commit 0a35c0da9b)
2023-06-15 16:27:17 +02:00
Ondřej Surý be0f38553e Make isc_result tables smaller
The isc_result_t enum was to sparse when each library code would skip to
next << 16 as a base.  Remove the huge holes in the isc_result_t enum to
make the isc_result tables more compact.

This change required a rewrite how we map dns_rcode_t to isc_result_t
and back, so we don't ever return neither isc_result_t value nor
dns_rcode_t out of defined range.

(cherry picked from commit a8e6c3b8f7)
2023-06-15 16:27:17 +02:00
Ondřej Surý a29de517fa Refactor how we map isc_result_t <-> dns_rcode_t
The mapping functions between isc_result_t and dns_rcode_t could return
both isc_result_t values not defined in the header and dns_rcode_t
values not defined in the header because it blindly maps anything
withing full 12-bits defined for RCODEs to isc_result_t and back.

Refactor the dns_result_{from,to}rcode() functions to always return
valid isc_result_t and dns_rcode_t values by explicitly mapping the
values to each other and returning DNS_R_SERVFAIL (dns_rcode_servfail)
when encountering value out of the defined range.

(cherry picked from commit b53d1d7069)
2023-06-15 16:27:17 +02:00
Michał Kępień 01fc746996 Merge branch '4150-fix-entity-renumbering-in-parse_tsan.py-9.18' into 'bind-9.18'
[9.18] Fix entity renumbering in util/parse_tsan.py

See merge request isc-projects/bind9!8039
2023-06-15 14:22:20 +00:00
Michał Kępień 9b764ab0e9 Fix entity renumbering in util/parse_tsan.py
util/parse_tsan.py builds tables of mutexes, threads, and pointers it
finds in the TSAN report provided to it as a command-line argument and
then replaces all mentions of each of these entities so that they are
numbered sequentially in the processed report.  For example, this line:

    Cycle in lock order graph: M0 (...) => M5 (...) => M9 (...) => M0

is expected to become:

    Cycle in lock order graph: M1 (...) => M2 (...) => M3 (...) => M1

Problems arise when the gaps between mutex/thread identifiers present on
a single line are smaller than the total number of mutexes/threads found
by the script so far.  For example, the following line:

    Cycle in lock order graph: M0 (...) => M1 (...) => M2 (...) => M0

first gets turned into:

    Cycle in lock order graph: M1 (...) => M1 (...) => M2 (...) => M1

and then into:

    Cycle in lock order graph: M2 (...) => M2 (...) => M2 (...) => M2

In other words, lines like this become garbled due to information loss.

The problem stems from the fact that the numbering scheme the script
uses for identifying mutexes and threads is exactly the same as the one
used by TSAN itself.  Update util/parse_tsan.py so that it uses
zero-padded numbers instead, making the "overlapping" demonstrated above
impossible.

(cherry picked from commit 7f0790c82f)
2023-06-15 16:18:49 +02:00
Tony Finch 9813e6d006 Merge branch '4134-zonefile-erofs-bind-9.18' into 'bind-9.18'
Translate POSIX errorcode EROFS to ISC_R_NOPERM

See merge request isc-projects/bind9!8033
2023-06-14 13:20:18 +00:00
Tony Finch dde068c2a0 CHANGES note for [GL #4134]
[cleanup]	Report "permission denied" instead of "unexpected error"
		when trying to update a zone file is on a read-only file
		system. Thanks to Midnight Veil. [GL #4134]

(cherry picked from commit 82401f0f0e)
2023-06-14 13:49:27 +01:00
Midnight VeilandTony Finch 5172f4c32a Translate POSIX errorcode EROFS to ISC_R_NOPERM
Report "permission denied" instead of "unexpected error"
when trying to update a zone file on a read-only file system.

(cherry picked from commit dd6acc1cac)
2023-06-14 13:48:25 +01:00
Arаm Sаrgsyаn 025110b07a Merge branch '4136-catz-db-update-notify-bug-9.18' into 'bind-9.18'
[9.18] Fix catz db update callback registration logic error

See merge request isc-projects/bind9!8030
2023-06-14 09:25:44 +00:00
Aram Sargsyan 2ab73c3a94 Add a CHANGES note for [GL #4136]
(cherry picked from commit 23f609ba59)
2023-06-14 09:24:41 +00:00
Aram Sargsyan 6154eab679 Fix catz db update callback registration logic error
When a catalog zone is updated using AXFR, the zone database is changed,
so it is required to unregister the update notification callback from
the old database, and register it for the new one.

Currently, here is the order of the steps happening in such scenario:

1. The zone.c:zone_startload() function registers the notify callback
   on the new database using dns_zone_catz_enable_db()
2. The callback, when called, notices that the new 'db' is different
   than 'catz->db', and unregisters the old callback for 'catz->db',
   marks that it's unregistered by setting 'catz->db_registered' to
   false, then it schedules an update if it isn't already scheduled.
3. The offloaded update process, after completing its job, notices that
   'catz->db_registered' is false, and (re)registers the update callback
   for the current database it is working on. There is no harm here even
   if it was registered also on step 1, and we can't skip it, because
   this function can also be called "artificially" during a
   reconfiguration, and in that case the registration step is required
   here.

A problem arises when before step 1 an update process was already
in a running state, operating on the old database, and finishing its
work only after step 2. As described in step 3, dns__catz_update_cb()
notices that 'catz->db_registered' is false and registers the callback
on the current database it is working on, which, at that state, is
already obsolete and unused by the zone. When it detaches the database,
the function which is responsible for its cleanup (e.g. free_rbtdb())
asserts because there is a registered update notify callback there.

To fix the problem, instead of delaying the (re)registration to step 3,
make sure that the new callback is registered and 'catz->db_registered'
is accordingly marked on step 2.

(cherry picked from commit 998765fea5)
2023-06-14 09:24:41 +00:00
Tom Krizek eee589f5ee Merge branch 'tkrizek/remove-trailing-whitespace-9.18' into 'bind-9.18'
[9.18] Remove trailing whitespace from all text files

See merge request isc-projects/bind9!8013
2023-06-14 08:53:05 +00:00
Tom Krizek 6f4afe238c Add utility script to detect trailing whitespace
Run the script in CI as well to ensure we don't accidentally add
trailing whitespace again.

(cherry picked from commit 034a32a4f3)
2023-06-14 09:52:58 +02:00
Tom Krizek 0820bedbd8 Ignore trailing whitespace removal commit in git blame 2023-06-14 09:52:58 +02:00
Tom Krizek 644a0b80c8 Remove trailing whitespace from all text files
I've used the following command to remove the trailing whitespace for
all tracked text files:

git grep -Il '' | xargs sed -i 's/[ \t]*$//'
2023-06-13 16:13:16 +02:00
Tom Krizek e0c4f5b60f Merge branch '4117-serve-stale-check-9.18' into 'bind-9.18'
[9.18] Avoid false positive in serve-stale system test check

See merge request isc-projects/bind9!8027
2023-06-13 12:54:26 +00:00
Tom Krizek c911aef622 Avoid false positive in serve-stale system test check
The purpose of the check is to verify the server has survived the
previous barrage of queries. This is done by sending a query and
checking we get a NOERROR response back.

Previously, that query could've been affected by a servfail cache - the
server would return a SERVFAIL answer, thus failing the check, despite
being up and running. Use version.bind txt ch query to avoid the
interference of servfail cache.

(cherry picked from commit dd7bcd2855)
2023-06-13 14:16:00 +02:00
Michal Nowak 6f23eef2d5 Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.18.17' into 'bind-9.18'
Set up version and release notes for BIND 9.18.17

See merge request isc-projects/bind9!8022
2023-06-12 15:14:45 +00:00
Michal Nowak 1184301d24 Set up release notes for BIND 9.18.17 2023-06-12 16:33:46 +02:00
Michal Nowak af92f44561 Update BIND version to 9.18.17-dev 2023-06-12 16:32:22 +02:00
Michal Nowak 8193c9b862 Update BIND version for release 2023-06-09 15:38:48 +02:00
Michal Nowak 7488850de1 Add a CHANGES marker 2023-06-09 15:38:05 +02:00
Michal Nowak 1264eb6da8 Merge branch 'mnowak/prepare-documentation-for-bind-9.18.16' into 'security-bind-9.18'
Prepare documentation for BIND 9.18.16

See merge request isc-private/bind9!543
2023-06-09 13:36:40 +00:00
Michał KępieńandMichal Nowak 7e2c9d2747 Tweak and reword release notes 2023-06-09 15:17:23 +02:00
Michal Nowak ddfa545022 Prepare release notes for BIND 9.18.16 2023-06-09 15:17:23 +02:00
Michał KępieńandMichal Nowak d3fa7e1930 Re-add a code comment to the "hooks" system test
Commit da74157440 removed a useful code
comment from the "hooks" system test.  Add it back to prevent confusion.
2023-06-09 15:17:23 +02:00
Michal Nowak 2d69829850 Merge branch '4089-confidential-stale-query-loop-bind-9.18' into 'security-bind-9.18'
[9.18][CVE-2023-2911] Fix stale-answer-client-timeout 0 crash

See merge request isc-private/bind9!523
2023-06-09 13:15:41 +00:00
Evan HuntandMichal Nowak 10ac503a94 CHANGES and release notes for [GL #4089] 2023-06-09 14:58:22 +02:00
Matthijs MekkingandMichal Nowak ff5bacf17c Fix serve-stale hang at shutdown
The 'refresh_rrset' variable is used to determine if we can detach from
the client. This can cause a hang on shutdown. To fix this, move setting
of the 'nodetach' variable up to where 'refresh_rrset' is set (in
query_lookup(), and thus not in ns_query_done()), and set it to false
when actually refreshing the RRset, so that when this lookup is
completed, the client will be detached.
2023-06-09 14:54:48 +02:00
Evan HuntandMichal Nowak 240caa32b9 Stale answer lookups could loop when over recursion quota
When a query was aborted because of the recursion quota being exceeded,
but triggered a stale answer response and a stale data refresh query,
it could cause named to loop back where we are iterating and following
a delegation. Having no good answer in cache, we would fall back to
using serve-stale again, use the stale data, try to refresh the RRset,
and loop back again, without ever terminating until crashing due to
stack overflow.

This happens because in the functions 'query_notfound()' and
'query_delegation_recurse()', we check whether we can fall back to
serving stale data. We shouldn't do so if we are already refreshing
an RRset due to having prioritized stale data in cache.

In other words, we need to add an extra check to 'query_usestale()' to
disallow serving stale data if we are currently refreshing a stale
RRset.

As an additional mitigation to prevent looping, we now use the result
code ISC_R_ALREADYRUNNING rather than ISC_R_FAILURE when a recursion
loop is encountered, and we check for that condition in
'query_usestale()' as well.
2023-06-09 14:54:48 +02:00
Michal Nowak e9af3d15d8 Merge branch '4055-improve-the-overmem-cache-cleaning-9.18' into 'security-bind-9.18'
[9.18] Improve RBT overmem cache cleaning

See merge request isc-private/bind9!527
2023-06-09 12:54:04 +00:00
Michal Nowak ec72e11ee4 Set max-cache-size expectations for low values 2023-06-08 11:47:04 +02:00
Ondřej SurýandMichal Nowak 09fcd8f88a Add CHANGES and release note for [GL #4055] 2023-06-08 11:47:04 +02:00
Ondřej SurýandMichal Nowak e9d5219fca Improve RBT overmem cache cleaning
When cache memory usage is over the configured cache size (overmem) and
we are cleaning unused entries, it might not be enough to clean just two
entries if the entries to be expired are smaller than the newly added
rdata.  This could be abused by an attacker to cause a remote Denial of
Service by possibly running out of the operating system memory.

Currently, the addrdataset() tries to do a single TTL-based cleaning
considering the serve-stale TTL and then optionally moves to overmem
cleaning if we are in that condition.  Then the overmem_purge() tries to
do another single TTL based cleaning from the TTL heap and then continue
with LRU-based cleaning up to 2 entries cleaned.

Squash the TTL-cleaning mechanism into single call from addrdataset(),
but ignore the serve-stale TTL if we are currently overmem.

Then instead of having a fixed number of entries to clean, pass the size
of newly added rdatasetheader to the overmem_purge() function and
cleanup at least the size of the newly added data.  This prevents the
cache going over the configured memory limit (`max-cache-size`).

Additionally, refactor the overmem_purge() function to reduce for-loop
nesting for readability.
2023-06-08 11:43:18 +02:00
Arаm Sаrgsyаn 36d019ffce Merge branch '4105-QryDropped-stats-counter-documentation-update-9.18' into 'bind-9.18'
[9.18] QryDropped stats counter documentation update

See merge request isc-projects/bind9!8011
2023-06-07 15:13:17 +00:00
Aram Sargsyan dd2973996f QryDropped stats counter documentation update
Document which dropped queries are calculated by the QryDropped
statistics counter.

(cherry picked from commit 27c30fe8a4)
2023-06-07 14:01:46 +00:00
Arаm Sаrgsyаn 5206a06e11 Merge branch '4074-fix-stale-answer-client-timeout-with-clients-per-query-9.18' into 'bind-9.18'
[9.18] Fix a clients-per-query miscalculation bug

See merge request isc-projects/bind9!7997
2023-06-06 12:47:28 +00:00
Aram Sargsyan 545a3fe089 Add CHANGES and release notes for [GL #4074]
(cherry picked from commit 466a7d9b5f)
2023-06-06 12:46:18 +00:00
Aram Sargsyan d91edda639 Fix a clients-per-query miscalculation bug
The number of clients per query is calculated using the pending
fetch responses in the list. The dns_resolver_createfetch() function
includes every item in the list when deciding whether the limit is
reached (i.e. fctx->spilled is true). Then, when the limit is reached,
there is another calculation in fctx_sendevents(), when deciding
whether it is needed to increase the limit, but this time the TRYSTALE
responses are not included in the calculation (because of early break
from the loop), and because of that the limit is never increased.

A single client can have more than one associated response/event in the
list (currently max. two), and calculating them as separate "clients"
is unexpected. E.g. if 'stale-answer-enable' is enabled and
'stale-answer-client-timeout' is enabled and is larger than 0, then
each client will have two events, which will effectively halve the
clients-per-query limit.

Fix the dns_resolver_createfetch() function to calculate only the
regular FETCHDONE responses/events.

Change the fctx_sendevents() function to also calculate only FETCHDONE
responses/events. Currently, this second change doesn't have any impact,
because the TRYSTALE events were already skipped, but having the same
condition in both places will help prevent similar bugs in the future
if a new type of response/event is ever added.

(cherry picked from commit 2ae5c4a674)
2023-06-06 12:45:00 +00:00
Aram Sargsyan f82aaedbdc Add clients-per-query checks for the fetchlimit system test
Check if clients-per-query quota works as expected with or without
a positive stale-answer-client-timeout value and serve-stale answers
enabled.

(cherry picked from commit 3bb2babcd0)
2023-06-06 12:45:00 +00:00
Aram Sargsyan 71a27a2848 Light refactoring of the fetchlimit system test
Prepare the fetchlimit system test for adding a clients-per-query
check. Change some functions and commands to accept a destination
NS IP address instead of using the hardcoded 10.53.0.3.

(cherry picked from commit 7ebd055c78)
2023-06-06 12:45:00 +00:00
Aram Sargsyan 17e09d8a10 Fix fetchlimit system test issues
1. Fix the numbering.
2. Fix an artifacts rewriting issue.
3. Add missing checks of 'ret' after some checks.
4. Fix extracting the quota value from the ADB dump.

(cherry picked from commit 101d829b02)
2023-06-06 12:45:00 +00:00
Ondřej Surý 449124c56d Merge branch '4038-resize-send-buffers-to-avoid-excessive-memory-allocation-9.18' into 'bind-9.18'
[9.18] Use appropriately sized send buffers for DNS messages over TCP

See merge request isc-projects/bind9!8005
2023-06-06 12:21:56 +00:00
Artem BoldarievandOndřej Surý 2c145b1862 Update CHANGES and release note [GL #4038]
Mention that memory usage was reduced by allocating properly sized
send buffers for stream-based transports.

(cherry picked from commit 8672d54847)
2023-06-06 14:04:01 +02:00
Artem BoldarievandOndřej Surý 285e75b3b0 Use appropriately sized send buffers for DNS messages over TCP
This commit changes send buffers allocation strategy for stream based
transports. Before that change we would allocate a dynamic buffers
sized at 64Kb even when we do not need that much. That could lead to
high memory usage on server. Now we resize the send buffer to match
the size of the actual data, freeing the memory at the end of the
buffer for being reused later.

(cherry picked from commit d8a5feb556)
2023-06-06 14:04:01 +02:00
Arаm Sаrgsyаn e72c92c497 Merge branch '4106-lock-order-inversion-in-resolver.c' into 'bind-9.18'
[9.18] Fix a lock-order-inversion bug in resolver.c

See merge request isc-projects/bind9!8000
2023-06-06 11:56:01 +00:00
Aram Sargsyan db45cab546 Fix a lock-order-inversion bug in resolver.c
There is a lock-order-inversion (potential deadlock) in resolver.c,
because in dns_resolver_shutdown() a resolver bucket lock is locked
while the resolver lock itself is already locked, while in
fctx_sendevents() the resolver lock is locked while a bucket lock
is locked before calling that function in fctx__done_detach().

The resolver lock/unlock in dns_resolver_shutdown() was added back in
the 317e36d47e commit to make sure that
the function is finished before the resolver object is destroyed.

Since res->exiting is atomic, it should be possible to remove the
resolver locking in dns_resolver_shutdown() and add it to the
send_shutdown_events() function which requires it.

Also, since 'res->exiting' is now set while unlocked, the 'INSIST'
in spillattimer_countdown() is wrong, and is removed.
2023-06-06 11:02:24 +00:00
Arаm Sаrgsyаn ff3d25a47f Merge branch 'aram/statschannel-spilled-clients-counter-9.18' into 'bind-9.18'
[9.18] Add ClientQuota statistics channel counter

See merge request isc-projects/bind9!7993
2023-05-31 14:51:08 +00:00
Aram Sargsyan 9a3e00478f Add a CHANGES note for [GL !7978]
(cherry picked from commit fa9172d996)
2023-05-31 11:07:08 +00:00
Aram Sargsyan b6eec9ee51 Update the documentation of the resolver statistics counters
The reference manual doesn't document all the available resolver
statistics counters. Add information about the missing counters.

(cherry picked from commit 08ebf39d1e)
2023-05-31 11:07:08 +00:00
Aram Sargsyan cd47429365 Add ClientQuota statistics channel counter
This counter indicates the number of the resolver's spilled
queries due to reaching the clients per query quota.

(cherry picked from commit 04648d7c2f)
2023-05-31 11:07:08 +00:00
Michal Nowak 56ae462f21 Merge branch 'mnowak/alpine-3.18-9.18' into 'bind-9.18'
[9.18] Add Alpine Linux 3.18

See merge request isc-projects/bind9!7994
2023-05-31 10:16:09 +00:00
Michal Nowak 46e98810d7 Add Alpine Linux 3.18
(cherry picked from commit ddb846454d)
2023-05-31 12:03:52 +02:00
Michal Nowak b751e2b4be Merge branch 'mnowak/look-for-core-files-in-TOP_BUILDDIR-9.18' into 'bind-9.18'
[9.18] Look for core files in $TOP_BUILDDIR

See merge request isc-projects/bind9!7986
2023-05-30 20:27:33 +00:00
Michal Nowak 2476d43acf Look for core files in $TOP_BUILDDIR
The get_core_dumps.sh script couldn't find and process core files of
out-of-tree configurations because it looked for them in the source
instead of the build directory.

(cherry picked from commit a13448a769)
2023-05-30 21:31:41 +02:00
Michal Nowak 99e910e4b9 Merge branch 'mnowak/custom-userspace-rcu-library-9.18' into 'bind-9.18'
[9.18] Change images for TSAN jobs

See merge request isc-projects/bind9!7987
2023-05-30 19:30:02 +00:00
Michal Nowak 44fff18b68 Change images for TSAN jobs
Fedora 38 and Debian "bullseye" images were "forked" to images used only
for TSAN CI jobs. The new images contain TSAN-aware liburcu that does
not fit well with ASAN CI jobs for which original images were also used.

liburcu is not used in this branch, but images are shared among
branches, and their use needs to be consistent in all maintained
branches.

(cherry picked from commit 04dda8661f)
2023-05-30 20:35:12 +02:00
Tom Krizek 4f3cfba6c0 Merge branch 'tkrizek-fix-pytest-base-port-9.18' into 'bind-9.18'
[9.18] Fix base_port calculation in pytest runner

See merge request isc-projects/bind9!7983
2023-05-30 15:37:37 +00:00
Tom Krizek 1b8f0711f2 Fix base_port calculation in pytest runner
The selected base port should be in the range <port_min, port_max), the
formula was incorrect.

Credit for discovering this fault goes to Ondrej Sury.

(cherry picked from commit e8ea6b610b)
2023-05-30 15:37:29 +02:00
Matthijs Mekking 076b8363fc Merge branch '3950-serve-stale-strikes-again-9.18' into 'bind-9.18'
[9.18] Fix serve-stale bug when cache has no data

See merge request isc-projects/bind9!7909
2023-05-30 13:15:13 +00:00
Matthijs Mekking cbe0cddcd4 Add release note and changes for #3950
Fixing another serve-stale bug is still news.

(cherry picked from commit 23dbb6ba72)
2023-05-30 13:46:34 +02:00
Matthijs Mekking b90bad93cb Fix serve-stale bug when cache has no data
We recently fixed a bug where in some cases (when following an
expired CNAME for example), named could return SERVFAIL if the target
record is still valid (see isc-projects/bind9#3678, and
isc-projects/bind9!7096). We fixed this by considering non-stale
RRsets as well during the stale lookup.

However, this triggered a new bug because despite the answer from
cache not being stale, the lookup may be triggered by serve-stale.
If the answer from database is not stale, the fix in
isc-projects/bind9!7096 erroneously skips the serve-stale logic.

Add 'answer_found' checks to the serve-stale logic to fix this issue.

(cherry picked from commit bbd163acf6)
2023-05-30 13:46:00 +02:00
Matthijs Mekking ad5d447348 Add serve-stale test case for GL #3950
Add a test case where when priming the cache with a slow authoritative
resolver, the stale-answer-client-timeout option should not return
a delegation to the client (it should wait until an applicable answer
is found, if no entry is found in the cache).

(cherry picked from commit c3d4fd3449)
2023-05-30 13:45:54 +02:00
Ondřej Surý 2a498d944a Merge branch '4098-remove-cruft-epoll-kqueue-configure-options-9.18' into 'bind-9.18'
[9.18] Remove obsolete epoll/kqueue/devpoll configure options

See merge request isc-projects/bind9!7975
2023-05-29 06:07:16 +00:00
Ondřej Surý 4fb2c9568d Add CHANGES note for [GL #4098]
(cherry picked from commit 0266760fdd)
2023-05-29 07:58:51 +02:00
Ondřej Surý 6b6076c882 Remove obsolete epoll/kqueue/devpoll configure options
Since we don't use networking directly but rather via libuv, these
configure options were no-op.  Remove the configure checks for epoll
(Linux), kqueue (BSDs) and /dev/poll (Solaris).

(cherry picked from commit 051f3d612f)
2023-05-29 07:58:03 +02:00
Mark Andrews aca974dc29 Merge branch '4090-corrected-bad-insist-logic-in-isc_radix_remove-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Corrected bad INSIST logic in isc_radix_remove()"

See merge request isc-projects/bind9!7974
2023-05-29 04:42:09 +00:00
Mark Andrews eb52c30524 Add regression test for [GL # 4090]
These insertions are added to produce a radix tree that will trigger
the INSIST reported in [GL #4090].  Due to fixes added since BIND 9.9
an extra insert in needed to ensure node->parent is non NULL.

(cherry picked from commit 03ebe96110)
2023-05-29 13:27:51 +10:00
Mark Andrews 27eb8ed20f Move isc_mem_put to after node is checked for equality
isc_mem_put NULL's the pointer to the memory being freed.  The
equality test 'parent->r == node' was accidentally being turned
into a test against NULL.

(cherry picked from commit ac2e0bc3ff)
2023-05-29 13:27:51 +10:00
Evan Hunt 9a1d565f07 Merge branch '3905-deprecate-tkey-dhkey-v9_18' into 'bind-9.18'
mark 'tkey-dhkey' as deprecated

See merge request isc-projects/bind9!7956
2023-05-28 08:07:25 +00:00
Evan Hunt 9a8f8d6046 CHANGES and release note for [GL #3905] 2023-05-28 00:55:55 -07:00
Evan Hunt 88383aa158 mark 'tkey-dhkey' as deprecated
Diffie-Hellman TKEY mode has been removed for 9.20.
2023-05-28 00:55:34 -07:00
Artem Boldariev 97d672d368 Merge branch '4091-syncrhonise-access-to-the-client-tlsctx-cache-9.18' into 'bind-9.18'
[9.18] ZMGR: TLS contexts cache - properly synchronise access

See merge request isc-projects/bind9!7972
2023-05-26 14:11:40 +00:00
Artem Boldariev cec8947bc1 ZMGR: TLS contexts cache - properly synchronise access
This commit ensures that access to the TLS context cache within zone
manager is properly synchronised.

Previously there was a possibility for it to get unexpectedly
NULLified for a brief moment by a call to
dns_zonemgr_set_tlsctx_cache() from one thread, while being accessed
from another (e.g. from got_transfer_quota()). This behaviour could
lead to server abort()ing on configuration reload (under very rare
circumstances).

That behaviour has been fixed.

(cherry picked from commit 0b95cf74ff)
2023-05-26 15:24:51 +03:00
Michal Nowak 207f9bb1c3 Merge branch 'mnowak/gitlab-runner-autoscaling-9.18' into 'bind-9.18'
[9.18] Run most Docker CI jobs in AWS with autoscaler

See merge request isc-projects/bind9!7969
2023-05-26 09:54:12 +00:00
Michal Nowak 94d83b7960 Run most Docker CI jobs in AWS with autoscaler
All but the "respdiff-long" job, for which our AWS instances do not have
enough memory, are now being spawned in the AWS by the autoscaler
executor.

(cherry picked from commit f09cf69594)
2023-05-26 11:47:20 +02:00
Evan Hunt 59827b21d1 Merge branch '4072-tcp-dispatch-timeout-bind-9.18' into 'bind-9.18'
[9.18] fix handling of TCP timeouts

See merge request isc-projects/bind9!7968
2023-05-26 09:32:22 +00:00
Evan Hunt e9b6991357 fix handling of TCP timeouts
when a TCP dispatch times out, we call tcp_recv() with a result
value of ISC_R_TIMEDOUT; this cancels the oldest dispatch
entry in the dispatch's active queue, plus any additional entries
that have waited longer than their configured timeouts. if, at
that point, there were more dispatch entries still on the active
queue, it resumes reading, but until now it failed to restart
the timer.

this has been corrected: we now calculate a new timeout
based on the oldest dispatch entry still remaining.  this
requires us to initialize the start time of each dispatch entry
when it's first added to the queue.

in order to ensure that the handling of timed-out requests is
consistent, we now calculate the runtime of each dispatch
entry based on the same value for 'now'.

incidentally also fixed a compile error that turned up when
DNS_DISPATCH_TRACE was turned on.

(cherry picked from commit 0e800467ee)
2023-05-26 02:07:02 -07:00
Evan Hunt 7045f33d45 Merge branch '4079-multiple-keyrings-bind-9.18' into 'bind-9.18'
[9.18] prevent TSIG keys from being added to multiple rings

See merge request isc-projects/bind9!7965
2023-05-25 23:43:36 +00:00
Evan Hunt 913fce98bf CHANGES for [GL #4079] 2023-05-25 15:08:59 -07:00
Evan Hunt afae1b65e8 prevent TSIG keys from being added to multiple rings
it was possible to add a TSIG key to more than one TSIG
keyring at a time, and this was in fact happening with the
session key, which was generated once and then added to the
keyrings for each view as it was configured.

this has been corrected and a REQUIRE added to dns_tsigkeyring_add()
to prevent it from happening again.
2023-05-25 15:08:48 -07:00
Arаm Sаrgsyаn 911f3af2fb Merge branch '3765-interfacemgr-use-after-afree-on-shutdown-9.18' into 'bind-9.18'
[9.18] Fix an interfacemgr use-after-free error in zoneconf.c:isself()

See merge request isc-projects/bind9!7964
2023-05-25 11:42:18 +00:00
Aram Sargsyan 685d9ece61 Add a CHANGES note for [GL #3765]
(cherry picked from commit b409db08cf)
2023-05-25 08:39:20 +00:00
Aram Sargsyan 1d736cf451 Fix an interfacemgr use-after-free error in zoneconf.c:isself()
The 'named_g_server->interfacemgr' pointer is saved in the zone
structure using dns_zone_setisself(), as a void* argument to be
passed to the isself() callback, so there is no attach/detach,
and when shutting down, the interface manager can be destroyed
by the shutdown_server(), running in exclusive mode, and causing
isself() to crash when trying to use the pointer.

Instead of keeping the interface manager pointer in the zone
structure, just check and use the 'named_g_server->interfacemgr'
itself, as it was implemented originally in the
3aca8e5bf3 commit. Later, in the
8eb88aafee commit, the code was
changed to pass the interface manager pointer using the additional
void* argument, but the commit message doesn't mention if there
was any practical reason for that.

Additionally, don't pass the interfacemgr pointer to the
ns_interfacemgr_getaclenv() function before it is checked
against NULL.

(cherry picked from commit 64d69e4adc)
2023-05-25 08:39:20 +00:00
Tom Krizek 66254cf56d Merge branch 'tkrizek/system-tests-pytest-runner-9.18' into 'bind-9.18'
[9.18] System tests: support using pytest instead of run.sh

See merge request isc-projects/bind9!7959
2023-05-23 16:02:15 +00:00
Tom Krizek 81b7682e24 Reorder dead primary checks in upforwd test
The check which attempts to forward dynamic update to a dead primary may
trigger a timing issue #4080. For some reason, this has manifested under
the pytest runner, while the test still passes with the legacy runner.

Move the dead primary check closer to the end of the test to avoid
hitting this issue before we have a proper fix.

(cherry picked from commit edaa5f5d2a)
2023-05-23 17:41:35 +02:00
Tom Krizek b9b3b53e2c Add CHANGES and release note for [GL #3978]
(cherry picked from commit fd889bf0ad)
2023-05-23 17:41:35 +02:00
Tom Krizek f3c0005257 Tear down module logger handler in system tests
The module-level logger has a handler that writes into a temporary
directory. Ensure the logging output is flushed and the handler is
closed before attempting to remove this temporary directory.

(cherry picked from commit 0f8a2b07a4)
2023-05-23 17:41:35 +02:00
Tom Krizek 6811f9704a Rewrite run.sh to invoke pytest in a system test directory
Previously, run.sh tried to use pytest's -k option for test selection.
The downside was that this filter expression matched any test case with
the given substring, rather than executing a system test suite with the
given name.

The run.sh has been rewritten to invoke pytest from a system test
directory instead. This behaves more consistently with the run.sh from
legacy system test framework.

run.sh is now also a shell script to avoid confusion regarding its
file extension.

(cherry picked from commit 1aaefc9cf4)
2023-05-23 17:41:34 +02:00
Tom Krizek de206d6436 Add .log.txt to gitignore
It can be useful to append the .txt extension to logs. When this
extension is used, GitLab is able to set the proper content type on such
artifacts in CI. This makes it possible to display those files directly
in the browser rather than having to download them.

(cherry picked from commit 8d40156bb2)
2023-05-23 17:41:34 +02:00
Tom Krizek e2f7dbcbd1 Remove "which" declaration from env vars in EL8+ tests
EL8+ systems declare "which" function using environment variables in the
/etc/profile.d/which2.sh file. Because of our suboptimal environment
variable detection, which is required in order to support the legacy
runner, these variables are picked up by the pytest runner.

If subprocesses are spawned with these environment variables set, it
will cause the following issue when they spawn yet another subprocess:

/bin/sh: which: line 1: syntax error: unexpected end of file
/bin/sh: error importing function definition for `which'

(cherry picked from commit 68b1c6877b)
2023-05-23 17:41:34 +02:00
Tom Krizek 5b5210854d Capture log output during pytest runner setup
Instantiate a new logger that is used during pytest initialization /
configuration. This logging isn't handled by pytest itself, since it
happens outside of any tests or fixtures.

Root logger can't be reused for this purpose, because that would
duplicate the logs. Instead, create a conftest-specific logger for this
purpose.

Unfortunately, this introduces another log file,
pytest.conftest.log.txt, which contains only the logging from pytest
initialization. However, unless one is debugging the runner /
environment, there should be no need to investigate this file.

(cherry picked from commit 12c724ee07)
2023-05-23 17:41:34 +02:00
Tom Krizek 16eeb36432 Execute long running system tests first
In order to take the most advantage of parallel execution of tests,
ensure certain long running tests are scheduled first.

The list of tests considered long-running was created empirically. In
addition to the test run time, its position in the default
(alphabetical) ordering was also taken into account.

(cherry picked from commit 99e2e50c0e)
2023-05-23 17:41:34 +02:00
Tom Krizek b9596d2107 Disable pylint check for too-few-public-methods
This check is overly aggressive and not really useful, especially for
non-Python codebase, where the primary use of Python is for testing.

(cherry picked from commit 6f134283eb)
2023-05-23 17:41:34 +02:00
Tom Krizek 1acb8a3f39 Add test specific logger for pytests
The logger fixture is provided as a test-level logging facility which
can be easily passed to tests to enable capturing and/or displaying
messages from tests written in Python.

While this works optimally with the pytest runner, messages on INFO
level or above will also be visible when using the legacy runner.

(cherry picked from commit 952776b61f)
2023-05-23 17:41:34 +02:00
Tom Krizek 862f6e043a Mark selected statschannel tests as xfail
The test_zone_timers_secondary_json() and
test_zone_timers_secondary_xml() tests are affected by issue #3983. Due
to the way tests are run, they are only affected when executing them
with the pytest runner.

Strict mode is set for pytest runner, as it always fails there. The
strict mode ensures we'll catch the change when the it starts passing
once the underlying issue is fixed. It can't be set for the legacy
runner, since the test (incorrectly) passes there.

Related #3983

(cherry picked from commit 087a9b3c97)
2023-05-23 17:41:34 +02:00
Tom Krizek f0db1c27ba Ensure assertions and exceptions end up in system test log
If a test fails with an assertion failure or exception, its content
along with traceback is displayed in pytest output. This information
should be preserved in the test-specific logger for a given system test
to make it easier to debug test failures.

(cherry picked from commit 3a20e8d990)
2023-05-23 17:41:34 +02:00
Petr ŠpačekandTom Krizek 0277c5098c Use raw byte format of env variables in pytest
In order to avoid issues with decoding/encoding env variables due to
different encodings on different systems, deal with the environment
variables directly as bytes.

(cherry picked from commit 37ed9ad2f8)
2023-05-23 17:41:33 +02:00
Tom Krizek 23b2777067 Display pytest failures for system:gcc:tarball
Since the tarball build&tests happen in a subdirectory, ensure the
after_script switches to it, so artifacts can be found properly.

(cherry picked from commit a6559176f1)
2023-05-23 17:41:33 +02:00
Tom Krizek 445b30b883 Handle missing test_results due to pytest runner interrupt
If pytest execution is interrupted, the hook that exposes test_results
to the pytest session is never called so the results can't be
interpreted.

(cherry picked from commit 0a063f51d3)
2023-05-23 17:41:33 +02:00
Tom Krizek 6103ee988e Run system tests sequentially if xdist is not available
(cherry picked from commit 1cc55d01c7)
2023-05-23 17:41:33 +02:00
Petr ŠpačekandTom Krizek 8627d41d4d Include logs from failing tests in JUnit output
(cherry picked from commit 8952618262)
2023-05-23 17:41:33 +02:00
Petr ŠpačekandTom Krizek a802e84cd5 Enable live logging for non-parallel pytest runs
This provides incremental output when test is running _without xdist_,
just like the old runner did.

With xdist the live output is not available, I believe because of
https://github.com/pytest-dev/pytest-xdist/issues/402
https://github.com/pytest-dev/pytest-xdist/pull/883 might help with
that, but I'm not going to hold my breath until it is available on
distros we use.

(cherry picked from commit d0619c7a18)
2023-05-23 17:41:33 +02:00
Tom Krizek a388a689cf Ensure --dist=loadscope is used when running pytest in parallel
The loadscope setting is required for parallel execution of our system
tests using pytest. The option ensure that all tests within a single
(module) scope will be assigned to the same worker.

This is neccessary because the worker sets up the nameservers for all
the tests within a module scope. If tests from the same module would be
assigned to different workers, then the setup could happen multiple
times, causing a race condition. This happens because each module uses
deterministic port numbers for the nameservers.

(cherry picked from commit 8f57bce7af)
2023-05-23 17:41:33 +02:00
Tom Krizek ac1e7eb40d Invoke pytest runner from run.sh
Utilize developers' muscle memory to incentivize using the pytest runner
instead of the legacy one. The script also serves as basic examples of
how to run the pyest command to achieve the same results as the legacy
runner.

Invoking pytest directly should be the end goal, since it offers many
potentially useful options (refer to pytest --help).

(cherry picked from commit 4dbe8e5347)

(also manually added a additional run.sh -> legacy.run.sh renames)
2023-05-23 17:41:33 +02:00
Tom Krizek 75a31555bd Use pytest system test runner in CI
Replace the legacy system test runner by the pytest system test runner.
Since EL7 and OpenBSD have only ancient versions of pytest / xdist, keep
using the legacy test runner there for now.

Out of tree tests aren't supported by the pytest runner yet. Use the
legacy test runner for that purpose as well.

Use awk to display failures and errors at the end of the log for
convenience, since pytest displays them first, which makes them
difficult to find.

(cherry picked from commit 4bc2b3be48)
2023-05-23 17:41:31 +02:00
Tom Krizek 2c167bb35f Add developer docs for pytest system test runner
(cherry picked from commit d1ef51f589)
2023-05-23 16:55:28 +02:00
Tom Krizek e9c15a5736 Update user docs with pytest system test runner
(cherry picked from commit dc84121004)
2023-05-23 16:55:27 +02:00
Tom Krizek 3b6ca76f46 Add pytest functions for shell system tests
In order to run the shell system tests, the pytest runner has to pick
them up somehow. Adding an extra python file with a single function
for the shell tests for each system test proved to be the most
compatible way of running the shell tests across older pytest/xdist
versions.

Modify the legacy run.sh script to ignore these pytest-runner specific
glue files when executing tests written in pytest.

(cherry picked from commit 2f5bf6d971)

(manually added host/tests_sh_host.py, tkey/tests_sh_tkey.py on top)
2023-05-23 16:55:26 +02:00
Tom Krizek 0df2ea8fab Ignore tempdirs during pytest collection phase
(cherry picked from commit 8a406b73c9)
2023-05-23 16:17:24 +02:00
Tom Krizek b8d6434d5d Ensure compatiblity with older pytest
Special care needs to be taken to support older pytest / xdist versions.
The target versions are what is available in EL8, since that seems to
have the oldest versions that can be reasonably supported.

(cherry picked from commit 527ac6ad26)
2023-05-23 16:17:24 +02:00
Tom Krizek eaf64e93aa Keep the tempdir in case test setup/teardown fails
When an issue occurs inside a fixture (e.g. servers fail to start/stop),
the test result won't be detected as failed, but rather an error will be
thrown.

To ensure the tempdir is kept even if the test itself passes but the
system_test() fixture throws an error, a different mechanism is needed.
At the start of the critical test setup section, note that the fixture
hasn't finished yet. When this is detected in the system_test_dir()
fixture, it is recognized as error in test setup/teardown and the temp
directory is kept.

This may seem cumbersome, because it is. It's basically a workaround for
the way pytest handles fixtures and test errors in general.

(cherry picked from commit 247e90c382)
2023-05-23 16:17:24 +02:00
Tom Krizek cdbdbd9eaf Ensure tempdir is kept for failed system tests
The temporary directory contains artifacts for the pytest module. That
module may contain multiple individual tests which were executed
sequentially. The artifacts should be kept if even one of these tests
failed.

Since pytest doesn't have any facility to expose test results to
fixtures, customize the pytest_runtest_makereport() hook to enable that.
It stores the test results into a session scope variable which is
available in all fixtures.

When deciding whether to remove the temporary directory, find the
relevant test results for this module and don't remove the tmpdir if any
one the tests failed.

(cherry picked from commit 2d93ed8546)
2023-05-23 16:17:24 +02:00
Tom Krizek ba922ba774 Add --noclean option to pytest runner
Support the --noclean option to allow the user to keep the artifacts
from any test run.

(cherry picked from commit 8b1a906b39)
2023-05-23 16:17:24 +02:00
Tom Krizek d1e6400d63 Run system tests inside temporary directories
For every pytest module, create a copy of its system test directory and
run the test from that directory. This makes it easier to clean up
afterwards and makes it less error-prone when re-running (failed) tests.

Configure the logger to capture the module's log output into a separate
file available from the temporary directory. This is quite convenient
for exploring failures.

Cases where temporary directory should be kept are handled in a
follow-up commits.

(cherry picked from commit c571af8c8f)
2023-05-23 16:17:24 +02:00
Tom Krizek 0ed639010c Execute the system test workflow in pytest runner
This is basically the pytest re-implementation of the run.sh script.

The fixture is applied to every module and ensures complete test
setup/teardown, such as starting/stopping servers, detecting coredumps
etc.

Note that the fixture system_test_dir is not defined yet. It is omitted
now for review readability and it's added in follow-up commits.

(cherry picked from commit 2b64618624)
2023-05-23 16:17:24 +02:00
Tom Krizek 23cecd2190 Utility fixtures for pytest runner
Add fixtures for deriving system test name from the directory name and
for a module-specific logger.

Add fixtures to execute shell and perl scripts. Similar to how run.sh
calls commands, this functionality is also needed in pytest. The
fixtures take care of switching to a proper directory, logging
everything and handling errors.

Note that the fixture system_test_dir is not defined yet. It is omitted
now for review readability and it's added in follow-up commits.

(cherry picked from commit 6886cc1826)
2023-05-23 16:17:23 +02:00
Tom Krizek aa199e2726 Assign unique ports to pytest modules
This is basically a pytest re-implementation of the get_ports.sh script.
The main difference is that ports are assigned on a module basis, rather
than a directory basis. Module is the new atomic unit for parallel
execution, therefore it needs to have unique ports to avoid collisions.

Each module gets its ports through the env fixture which is updated with
ports and other module-specific variables.

(cherry picked from commit 0061758156)
2023-05-23 16:17:23 +02:00
Tom Krizek f23ce6a37f Ensure system test programs and deps are compiled
Some system tests require extra programs and/or dependencies to be
compiled first. This is done via `make check` with the automake
framework when using check_* variables such as check_PROGRAMS.

To avoid running any tests via the automake framework, set the TESTS
env variable to empty string and utilize `make -e check` to override
default Makefile variables with environment ones. This ensures automake
will only compile the needed dependencies without running any tests.

Additional consideration needs to be taken for xdist. The compilation
command should be called just once before any tests are executed. To
achieve that, use the pytest_configure() hook and check that the
PYTEST_XDIST_WORKER env variable isn't set -- if it is, it indicates
we're in the spawned xdist worker and the compilation was already done
by the main pytest process that spawned the workers.

This is mostly done to have on-par functionality with legacy test
framework. In the future, we should get rid of the need to run "empty"
make -e check and perhaps compile test-stuff by default.

(cherry picked from commit ee26066897)
2023-05-23 16:17:23 +02:00
Tom Krizek 6000883f8d Obtain env vars from conf.sh in pytest runner
The commands executed by pytest during a system test need to have the
same environment variables set as if they were executed by the run.sh
shell script.

It was decided that for the moment, legacy way of executing system tests
with run.sh should be kept, which complicates things a bit. In order to
avoid duplicating the required variables in both conf.sh and pytest, it
was decided to use the existing conf.sh as the only authoritative
place for the variables.

It is necessary to process the environment variables from conf.sh right
when conftest.py is loaded, since they might be needed right away (e.g.
to test for feature support during test collection).

This solution is a bit hacky and is only meant to be used during the
transitory phase when both pytest and the legacy run.sh are both
supported. In the future, a superior pytest-only solution should be
used.

For discussion of other options, refer to
https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/6809#note_318889

(cherry picked from commit 2f7af791a1)
2023-05-23 16:17:23 +02:00
Tom Krizek 495216f81c Collect existing tests in pytest runner
Ensure pytest picks up our python test modules, since we're using
tests_*.py convention, which is different from the default.

Configure pytest logging to display the output from all tests (even the
ones that passed). This ensures we have sufficient amount of information
to debug test post-mortem just from the artifacts.

(cherry picked from commit 08c4e35bc0)
2023-05-23 16:17:23 +02:00
Tom Krizek 9112b51bb9 Support both pytest and legacy system test runner
The legacy system test framework uses pytest to execute some tests.
Since it'd be quite difficult to convince pytest to decide whether to
include conftest.py (or which ones to include when launching from
subdir), it makes more sense to have a shared conftest.py which is used
by both the legacy test runner invocations of pytest and the new pytest
system test runner. It is ugly, but once we drop support for the legacy
runner, we'll get rid of it.

Properly scope the *port fixtures in order to ensure they'll work as
expected with the new pytest runner. Instead of using "session" (which
means the fixture is only evaluated once for the entire execution of
pytest), use "module" scope, which is evaluated separately for each
module. The legacy runner invoked pytest for each system test
separately, while the new pytest runner is invoked once for all system
tests -- therefore it requires the more fine-grained "module" scope to
for the fixtures to work properly.

Remove python shebang, as conftest.py isn't supposed to be an executable
script.

(cherry picked from commit 30cb9b7e28)
2023-05-23 16:17:20 +02:00
Michal Nowak 799a6d1941 Merge branch 'mnowak/danger-test-pairwise-hint-9.18' into 'bind-9.18'
[9.18] Add a friendly Danger plea to run the pairwise CI job

See merge request isc-projects/bind9!7953
2023-05-19 12:34:30 +00:00
Michal Nowak b52d416cb0 Add a friendly Danger plea to run the pairwise CI job
Sometimes a pairwise definition for a new ./configure switch is added
but not tested in the CI.

(cherry picked from commit 96563c6020)
2023-05-19 14:32:10 +02:00
Michal Nowak 7ade835795 Merge branch 'mnowak/fedora-38-9.18' into 'bind-9.18'
[9.18] Add Fedora 38

See merge request isc-projects/bind9!7951
2023-05-19 12:03:42 +00:00
Michal Nowak 465a797014 Add Fedora 38
(cherry picked from commit 2e0550970b)
2023-05-19 13:56:34 +02:00
Michal Nowak 3007bb18e2 Merge branch 'mnowak/get_core_dumps-fix-misplaced-tsan-line-9.18' into 'bind-9.18'
[9.18] TSAN summarising line was misplaced in get_core_dumps.sh

See merge request isc-projects/bind9!7949
2023-05-19 08:11:32 +00:00
Michal Nowak 1fa70a559c TSAN summarising line was misplaced in get_core_dumps.sh
The line summarising TSAN reports was misplaced in the ASAN territory
and thus never used.

I also made core dumps, assertion failures, and TSAN reports detection
independent of each other.

(cherry picked from commit 0c4c7ddec4)
2023-05-19 09:20:51 +02:00
Michał Kępień 66a8a0de23 Merge branch 'michal/cmocka-future-proofing-9.18' into 'bind-9.18'
[9.18] cmocka future-proofing

See merge request isc-projects/bind9!7947
2023-05-18 13:51:35 +00:00
Michał Kępień b2b3899af7 Fix cmocka-related compiler warnings in ht_test
tests/isc/ht_test.c triggers the following compiler warnings when built
against development versions of cmocka:

    In file included from ht_test.c:24:
    ht_test.c: In function ‘test_ht_full’:
    ht_test.c:69:45: warning: passing argument 2 of ‘_assert_ptr_equal’ makes pointer from integer without a cast [-Wint-conversion]
       69 |                 assert_ptr_equal((void *)i, (uintptr_t)f);
    /usr/include/cmocka.h:1513:56: note: in definition of macro ‘assert_ptr_equal’
     1513 | #define assert_ptr_equal(a, b) _assert_ptr_equal((a), (b), __FILE__, __LINE__)
          |                                                        ^
    /usr/include/cmocka.h:2907:36: note: expected ‘const void *’ but argument is of type ‘long unsigned int’
     2907 |                        const void *b,
          |                        ~~~~~~~~~~~~^
    ht_test.c:164:45: warning: passing argument 2 of ‘_assert_ptr_equal’ makes pointer from integer without a cast [-Wint-conversion]
      164 |                 assert_ptr_equal((void *)i, (uintptr_t)f);
    /usr/include/cmocka.h:1513:56: note: in definition of macro ‘assert_ptr_equal’
     1513 | #define assert_ptr_equal(a, b) _assert_ptr_equal((a), (b), __FILE__, __LINE__)
          |                                                        ^
    /usr/include/cmocka.h:2907:36: note: expected ‘const void *’ but argument is of type ‘long unsigned int’
     2907 |                        const void *b,
          |                        ~~~~~~~~~~~~^

These are caused by a change to the definitions of pointer assert
functions in cmocka's development branch [1].  Fix by casting the
affected variables to (void *) instead of (uintptr_t).

[1] https://git.cryptomilk.org/projects/cmocka.git/commit/?id=09621179af67535788a67957a910d9f17c975b45

(cherry picked from commit 8d36e68c7a)
2023-05-18 15:36:03 +02:00
Michał Kępień 78afc0bf04 Include <inttypes.h> whenever including <cmocka.h>
Development versions of cmocka require the intmax_t and uintmax_t types
to be defined by the time the test code includes the <cmocka.h> header.
These types are defined in the <stdint.h> header, which is included by
the <inttypes.h> header, which in turn is already explicitly included by
some of the programs in the tests/ directory.  Ensure all programs in
that directory that include the <cmocka.h> header also include the
<inttypes.h> header to future-proof the code while keeping the change
set minimal and the resulting code consistent.  Also prevent explicitly
including the <stdint.h> header in those programs as it is included by
the <inttypes.h> header.

(cherry picked from commit c2dcd055fe)
2023-05-18 15:36:03 +02:00
Michał Kępień c65a405827 Merge tag 'v9.18.15' into bind-9.18
BIND 9.18.15
2023-05-18 14:10:33 +02:00
Tony Finch 09c5244611 Merge branch 'fanf-noreturn-lossage-bind-9.18' into 'bind-9.18'
[9.18] Avoid lossage from <stdnoreturn.h>

See merge request isc-projects/bind9!7940
2023-05-17 15:23:18 +00:00
Tony Finch 3c1098715e Avoid lossage from <stdnoreturn.h>
A few of the source files in `tests/ns` included `<isc/util.h>`
before `<cmocka.h>`. This could cause compile failures because the
`CMOCKA_NORETURN` macro is defined as `__attribute__((noreturn))`
and `<stdnoreturn.h>` defines `noreturn` as `_Noreturn` which does
not work as a gcc-style attribute.

(cherry picked from commit 623f2fdb18)
2023-05-17 14:21:06 +01:00
Artem Boldariev 1e412d1bf5 Merge branch 'artem-9_18-fix_isc__nm_sockstop' into 'bind-9.18'
Fix isc__nmsocket_stop(): make sockstop netievent as a high priority event (similarly to other transports)

See merge request isc-projects/bind9!7935
2023-05-17 13:18:44 +00:00
Artem Boldariev d7a60427b9 Update release notes [GL #4071]
Mention that BIND getting stuck during reconfiguration when
DoH-enabled listen statement is removed on re-configuration has been
fixed.
2023-05-17 14:25:31 +03:00
Artem Boldariev 8eeafbc6a7 Update CHANGES [GL #4071]
Mention that BIND getting stuck during reconfiguration when
DoH-enabled listen statement is removed on re-configuration has been
fixed.
2023-05-17 14:25:14 +03:00
Artem Boldariev 9ab6c3a5b1 Make sockstop netievent a high-priority one
Seemingly by omission, sockstop netievent used by multi-layer sockets
was not a high priority event, like it should be (similarly to other
socket types).

In particular, that could make BIND stuck on reconfiguration after a
DoH-listener is removed from the configuration.

This commit fixes that.
2023-05-17 13:06:41 +03:00
Artem Boldariev 18d662f4d2 Pass the right worker into isc__nm_async_sockstop()
The intention behind 'isc__nmsocket_stop()' was that the function
sends notifications on every worker thread, making them synchronise on
the barrier, then the initiating thread waits on it, too. This way we
ensure than no other operation will start when we shutting down the
listener.

However, it seems that due to mistake we have been passing the wrong
worker pointer into isc__nm_async_sockstop() from within the context
of an worker thread which has initiated shutting down. While
effectively we have not been using the pointer in this case, it could
cause maintenance issues later. This commit fixes that.
2023-05-17 12:56:25 +03:00
Mark Andrews 50c30d835c Merge branch '4066-resolv-conf-parsing-eats-lines-if-more-than-3-nameservers-set-bind-9.18' into 'bind-9.18'
[9.18] Resolve "resolv.conf parsing eats lines if more than 3 nameservers set"

See merge request isc-projects/bind9!7933
2023-05-16 04:05:58 +00:00
Mark Andrews 4e9d998180 Add CHANGES for [GL #4066]
(cherry picked from commit 36dab033dc)
2023-05-16 13:30:01 +10:00
Mark Andrews d7c1094d10 Properly process extra nameserver lines in resolv.conf
The whole line needs to be read rather than just the token "nameserver"
otherwise the next line in resolv.conf is not properly processed.

(cherry picked from commit 864cd08052)
2023-05-16 13:29:33 +10:00
Michal Nowak 4620384b5b Merge branch 'mnowak/openbsd-7.3-9.18' into 'bind-9.18'
[9.18] Add OpenBSD 7.3

See merge request isc-projects/bind9!7929
2023-05-15 18:37:29 +00:00
Michal Nowak 1cf4231d29 Add OpenBSD 7.3
(cherry picked from commit ff52cd9604)
2023-05-15 19:47:23 +02:00
Michal Nowak 0f047910d9 Merge branch 'mnowak/freebsd-13.2-9.18' into 'bind-9.18'
[9.18] Add FreeBSD 13.2

See merge request isc-projects/bind9!7927
2023-05-15 16:53:10 +00:00
Michal Nowak 3af5c8badb Add FreeBSD 13.2
(cherry picked from commit 81ad645d7d)
2023-05-15 18:33:02 +02:00
Arаm Sаrgsyаn 52844fa8c7 Merge branch '4054-zone_resigninc-bugfix-9.18' into 'bind-9.18'
[9.18] zone_resigninc(): check whether zone->db is a valid pointer before attaching

See merge request isc-projects/bind9!7923
2023-05-15 14:00:21 +00:00
Aram Sargsyan cc197e82fe Add a CHANGES note for [GL #4054]
(cherry picked from commit 00ed5f84a9)
2023-05-15 12:02:27 +00:00
Aram Sargsyan 7713d2cb6d Check whether zone->db is a valid pointer before attaching
The zone_resigninc() function does not check the validity of
'zone->db', which can crash named if the zone was unloaded earlier,
for example with "rndc delete".

Check that 'zone->db' is not 'NULL' before attaching to it, like
it is done in zone_sign() and zone_nsec3chain() functions, which
can similarly be called by zone maintenance.

(cherry picked from commit fae0930eb8)
2023-05-15 12:01:23 +00:00
Michal Nowak 9285538683 Merge branch 'mnowak/coverity-scan-2022.12-9.18' into 'bind-9.18'
[9.18] Use the latest Coverity Scan

See merge request isc-projects/bind9!7918
2023-05-12 08:54:25 +00:00
Michal Nowak 7858de96f6 Use the latest Coverity Scan
(cherry picked from commit 68dd458764)
2023-05-12 10:14:29 +02:00
Michal Nowak 582e155c5e Merge branch 'mnowak/pytest_rewrite_ttl-9.18' into 'bind-9.18'
[9.18] Rewrite the ttl system test to pytest

See merge request isc-projects/bind9!7915
2023-05-11 14:40:54 +00:00
Michal Nowak 858954da9a Rewrite the ttl system test to pytest
(cherry picked from commit 0c05c3d97b)
2023-05-11 16:10:23 +02:00
Michal Nowak 73d25a85d0 Merge branch 'mnowak/clang-16-9.18' into 'bind-9.18'
[9.18] Update clang to version 16

See merge request isc-projects/bind9!7912
2023-05-11 13:10:45 +00:00
Michal Nowak 9699a377f5 Update clang to version 16
(cherry picked from commit 30aa258107)
2023-05-11 14:20:59 +02:00
Michal Nowak 534c5697b2 Merge branch 'mnowak/pytest_rewrite_hooks-9.18' into 'bind-9.18'
[9.18] Rewrite the hooks system test to pytest

See merge request isc-projects/bind9!7911
2023-05-11 10:52:55 +00:00
Michal Nowak da74157440 Rewrite the hooks system test to pytest
Also, enable the test under TSAN.

(cherry picked from commit 5a84c7a09b)
2023-05-11 12:27:42 +02:00
Arаm Sаrgsyаn 4cae19f533 Merge branch '4039-dighost-fix-double-shutdown-call-9.18' into 'bind-9.18'
[9.18] dighost.c: don't call check_if_done() twice successively

See merge request isc-projects/bind9!7904
2023-05-10 12:49:57 +00:00
Aram Sargsyan 4b1e0913a5 Add a CHANGES note for [GL #4039]
(cherry picked from commit d71299121e)
2023-05-10 11:41:35 +00:00
Aram Sargsyan 906525642d dighost.c: don't call check_if_done() twice successively
The check_if_done() function can pass control back out to
dighost_shutdown() (which is part of dig.c, host.c, or nslookup.c),
and calling that twice can cause unexpected problems, if it is not
designed to be idempotent.

Since cancel_lookup() calls check_if_done() implicitly, don't call
check_if_done() again when 'next' is NULL.

(cherry picked from commit e4604b71d2)
2023-05-10 11:41:35 +00:00
Tom Krizek ef0f7a7f13 Merge branch 'tkrizek/shutdown-test-exc-handling-9.18' into 'bind-9.18'
[9.18] Ensure named always terminates in the shutdown test

See merge request isc-projects/bind9!7902
2023-05-10 11:40:02 +00:00
Tom Krizek 8820c459c6 Replace dnspython resolver.query with resolver.resolve
The resolver.query() has been deprecated in favor of resolver.resolve();
used that.

This is an omission from 3b1756d450

(cherry picked from commit dee49b7a1f)
2023-05-10 12:55:30 +02:00
Tom Krizek 2dfe5367b7 Ensure named always terminates in the shutdown test
Previously, if an exception would happen inside the `with` block, the
error handler would wait indefinitely for the process to end. That would
never happen, since the termination signal was never sent to named and
the test would get stuck.

Using the try-finally block ensures that the named process is always
killed and any exception or errors will be handled gracefully.

(cherry picked from commit 836e6ed284)
2023-05-10 12:55:30 +02:00
Tom Krizek 947212a93f Refactor shutdown test into more helper functions
Improve code readability by splitting the test into more functions. Some
could be re-used later on for more general-purpose subprocess handling
or named checks.

(cherry picked from commit 9d64f1c1ed)
2023-05-10 12:55:27 +02:00
Michał Kępień 47fc1bf6bb Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.16' into 'bind-9.18'
Set up version and release notes for BIND 9.18.16

See merge request isc-projects/bind9!7900
2023-05-10 08:47:56 +00:00
Michał Kępień 8fee182171 Set up release notes for BIND 9.18.16 2023-05-10 10:41:42 +02:00
Michał Kępień 9c09313bc9 Update BIND version to 9.18.16-dev 2023-05-10 10:41:42 +02:00
Michał Kępień f53a0765c3 Update BIND version for release 2023-05-09 12:47:13 +02:00
Michał Kępień 0a8d9a7413 Add a CHANGES marker 2023-05-09 12:47:13 +02:00
Michał Kępień 5dc1788099 Merge branch 'michal/prepare-documentation-for-bind-9.18.15' into 'v9.18.15-release'
Prepare documentation for BIND 9.18.15

See merge request isc-private/bind9!516
2023-05-09 10:45:33 +00:00
Michał Kępień af1bcc652f Add release note for GL #4002 2023-05-09 12:36:44 +02:00
Michał Kępień 2cecc9652c Add release note for GL #4027 2023-05-09 12:36:44 +02:00
Michał Kępień c5441e8ff4 Reorder release notes 2023-05-09 12:36:44 +02:00
Michał Kępień a656a5453d Tweak and reword release notes 2023-05-09 12:36:44 +02:00
Michał Kępień 0841eadd59 Prepare release notes for BIND 9.18.15 2023-05-09 12:36:44 +02:00
Michał Kępień ca76d5dd92 Apply minor corrections to CHANGES 2023-05-09 12:36:44 +02:00
Michał Kępień f0c97789ff Merge branch '3986-handle-ISC_R_NOPERM-in-dns_dispatch-and-honour-the-source-port-9.18' into 'bind-9.18'
[9.18] Honour the source-port when retrying in dns_dispatch

See merge request isc-projects/bind9!7893
2023-05-05 13:50:06 +00:00
Ondřej SurýandMichał Kępień a41eb823e9 Add CHANGES note for [GL #3986]
(cherry picked from commit 3d36e0bb89)
2023-05-05 15:40:12 +02:00
Ondřej SurýandMichał Kępień e0620ca208 Honour the source-port when retrying in dns_dispatch
When retrying in the DNS dispatch, the local port would be forgotten on
ISC_R_ADDRINUSE, keep the configured source-port even when retrying.

Additionally, treat ISC_R_NOPERM same as ISC_R_ADDRINUSE.

Closes: #3986
(cherry picked from commit c8e8ccd026)
2023-05-05 15:40:12 +02:00
Michał Kępień 9ae821b70e Merge branch '3980-add-timeouts-to-unit-tests-9.18' into 'bind-9.18'
[9.18] Use SIGABRT rather than SIGKILL for long running unit test

See merge request isc-projects/bind9!7892
2023-05-05 12:26:53 +00:00
Mark AndrewsandMichał Kępień ce391b500b Use SIGABRT rather than SIGKILL for long running unit test
SIGABRT will produce a core dump which will allow for forensic
analysis of the unit test

(cherry picked from commit 21a3d4f762)
2023-05-05 14:15:49 +02:00
Michał Kępień 54f842a442 Merge branch '4046-rndc-timeout-9.18' into 'bind-9.18'
[9.18] set the default rndc read timeout to 60 seconds

See merge request isc-projects/bind9!7890
2023-05-05 10:20:31 +00:00
Evan HuntandMichał Kępień 5c4a56a9de CHANGES and release note for [GL #4046]
(cherry picked from commit dfc8efc467)
2023-05-05 11:46:55 +02:00
Evan HuntandMichał Kępień 248f765e73 set the default rndc read timeout to 60 seconds
While the connect timeout was set to 60 seconds in rndc, the
idle read timeout was left at the default value of 30 seconds.
This commit sets it back to 60, to match the behavior in 9.16
and earlier.

(cherry picked from commit 9cacf9e336)
2023-05-05 11:46:55 +02:00
Matthijs Mekking 5a4ea1236b Merge branch '3991-logfile-absolutepath-bug-v9_18' into 'bind-9.18'
[9.18] Fix purging old log files with absolute file path

See merge request isc-projects/bind9!7880
2023-05-03 09:19:28 +00:00
Mark AndrewsandMatthijs Mekking fa35d059da Re-write remove_old_tsversions and greatest_version
Stop deliberately breaking const rules by copying file->name into
dirbuf and truncating it there.  Handle files located in the root
directory properly. Use unlinkat() from POSIX 200809.

(cherry picked from commit 9fcd42c672)
2023-05-03 10:39:46 +02:00
Matthijs Mekking 1670a738bd Add release note and CHANGES for #3991
Bug worth mentioning.

(cherry picked from commit ab9230b383)
2023-05-03 10:13:26 +02:00
Matthijs Mekking cf8bf1e084 Add log rotation test with absolute file path
Add a test to the logfileconfig system test to test log file rotation
when using absolute file paths.

(cherry picked from commit d9b1df3b5d)
2023-05-03 10:13:02 +02:00
Matthijs Mekking eb37fd2f13 Add more log/tap rotation tests
Add more tests to the dnstap system test to roll with different values.
Touch some files to make sure the number of existing files exceed the
number that we want to keep.

Add a test to the logfileconfig system test for the increment suffix.

(cherry picked from commit 9fb9670ebc)
2023-05-03 10:12:56 +02:00
Matthijs Mekking 33ad117166 Fix purging old log files with absolute file path
Removing old timestamp or increment versions of log backup files did
not work when the file is an absolute path: only the entry name was
provided to the file remove function.

The dirname was also bogus, since the file separater was put back too
soon.

Fix these issues to make log file rotation work when the file is
configured to be an absolute path.

(cherry picked from commit 70629d73da)
2023-05-03 10:12:51 +02:00
Mark Andrews 021337f3e2 Merge branch '4027-nsec3-of-removed-empty-non-terminal-remains-in-chain-breaking-validation-tools-bind-9.18' into 'bind-9.18'
[9.18] Resolve "NSEC3 of removed empty-non-terminal remains in chain, breaking validation tools"

See merge request isc-projects/bind9!7867
2023-04-25 06:10:31 +00:00
Mark Andrews a69862e1a6 Add CHANGES note for [GL #4027]
(cherry picked from commit 7dbb2b877b)
2023-04-25 06:46:08 +01:00
Mark Andrews a3c3012c25 Check removal of ENT when subdomains are removed
Empty-non-terminal NSEC records where not always removed when the
delegations generating them where removed via update. Check that
they now are.

(cherry picked from commit ad91a70d15)
2023-04-25 06:46:08 +01:00
Mark Andrews 0eee434741 Cleanup orphaned empty-non-terminal NSEC3
When OPTOUT was in use we didn't ensure that NSEC3 records
for orphaned empty-non-terminals where removed.  Check if
there are orphaned empty-non-terminal NSEC3 even if there
wasn't an NSEC3 RRset to be removed in dns_nsec3_delnsec3.

(cherry picked from commit 27160c137f)
2023-04-25 06:46:08 +01:00
Ondřej Surý 57171a7047 Merge branch 'jpmens-main-patch-10650-9.18' into 'bind-9.18'
[9.18] Fix typo in the ARM - missed -> missing

See merge request isc-projects/bind9!7866
2023-04-24 15:14:41 +00:00
JP MensandOndřej Surý 6862b5724e Fix typo in the ARM - missed -> missing
(cherry picked from commit 7bfffa1bd8)
2023-04-24 17:12:23 +02:00
Ondřej Surý 83ec46676f Merge branch '4004-reimplemented-max-transfer--in-9.18' into 'bind-9.18'
[9.18] Implement maximum global and idle time for incoming XFR

See merge request isc-projects/bind9!7862
2023-04-21 15:49:28 +00:00
Ondřej Surý c71efbf45f Add CHANGES note for [GL #4004]
(cherry picked from commit 713e202110)
2023-04-21 17:21:32 +02:00
Aram SargsyanandOndřej Surý bc0461d4ae Implement new checks for the xfer system test
Check the max-transfer-time-in and max-transfer-idle-in options.

(cherry picked from commit 5324f047b2)
2023-04-21 17:21:32 +02:00
Aram SargsyanandOndřej Surý 305bf677ab Implement new -T options for xfer system tests
'-T transferinsecs' makes named interpret the max-transfer-time-out,
max-transfer-idle-out, max-transfer-time-in and max-transfer-idle-in
configuration options as seconds instead of minutes.

'-T transferslowly' makes named to sleep for one second for every
xfrout message.

'-T transferstuck' makes named to sleep for one minute for every
xfrout message.

(cherry picked from commit dfaecfd752)
2023-04-21 17:21:32 +02:00
Ondřej Surý fa2cb06c75 Implement maximum global and idle time for incoming XFR
After the dns_xfrin was changed to use network manager, the maximum
global (max-transfer-time-in) and idle (max-transfer-idle-in) times for
incoming transfers were turned inoperational because of missing
implementation.

Restore this functionality by implementing the timers for the incoming
transfers.

(cherry picked from commit d2377f8e04)
2023-04-21 17:21:32 +02:00
Ondřej Surý cf6a8987b3 Merge branch '4005-handle-ISC_R_INVALIDPROTO-from-libuv-9.18' into 'bind-9.18'
[9.18] Handle ISC_R_INVALIDPROTO in the dispatch

See merge request isc-projects/bind9!7861
2023-04-21 11:30:30 +00:00
Ondřej Surý 89b1f25c44 Add CHANGES and release note for [GL #4005]
(cherry picked from commit c233cd621b)
2023-04-21 12:49:06 +02:00
Evan HuntandOndřej Surý 960e4dadd2 check for invalid protocol when dispatch fails
treat ISC_R_INVALIDPROTO as a networking error when it occurs.

(cherry picked from commit 2269a3e6fb)
2023-04-21 12:47:07 +02:00
Evan HuntandOndřej Surý 2a714c25f8 add a result code for ENOPROTOOPT, EPROTONOSUPPORT
there was no isc_result_t value for invalid protocol errors
that could be returned from libuv.

(cherry picked from commit 0393b54afb)
2023-04-21 12:47:07 +02:00
Michał Kępień cdff6bb8ba Merge tag 'v9.18.14' into bind-9.18
BIND 9.18.14
2023-04-20 12:52:22 +02:00
Arаm Sаrgsyаn 6772a05371 Merge branch 'aram/xfer-test-bugfix-9.18' into 'bind-9.18'
[9.18] Fix variable name error in the xfer system test

See merge request isc-projects/bind9!7850
2023-04-18 10:20:39 +00:00
Aram Sargsyan 50493282a6 Fix variable name error in the xfer system test
There is no 'ret' in this test, and it is obvious that 'ret=1'
should be 'tmp=1' for the check to work correctly, if the string
is not found in the log file.

(cherry picked from commit 613a9fc659)
2023-04-18 09:39:30 +00:00
Matthijs Mekking d98ec86299 Merge branch '3769-migrate-zsk-ksk-split-tocsk-v9_18' into 'bind-9.18'
[9.18] kasp: Add test case for migrating KSK/ZSK to CSK

See merge request isc-projects/bind9!7844
2023-04-17 13:34:00 +00:00
Matthijs Mekking bf5eea515d Add key state init debugging
When debugging an issue it can be useful to see what BIND initially
set the key states to.

(cherry picked from commit e752656a38)
2023-04-17 12:14:06 +02:00
Matthijs Mekking e2167eb1d1 kasp: Add test case for migrating KSK/ZSK to CSK
Add a test case to cover #3679 where a user migrates from a KSK/ZSK
split using auto-dnssec maintain, to the default dnssec-policy (CSK).

The test actually does not use the default dnssec-policy, but it does
use one that has the same keys clause. For testing convenience, we use
the same propagation time values as other test cases that migrate to
dnssec-policy with mismatching existing key set.

(cherry picked from commit c42ec8a56e)
2023-04-17 12:14:00 +02:00
Arаm Sаrgsyаn deb5a89962 Merge branch '4000-openssl-attr-malloc-vs-cmocka-define-malloc-9.18' into 'bind-9.18'
[9.18] unit tests: include an OpenSSL header before including cmocka.h

See merge request isc-projects/bind9!7842
2023-04-14 13:33:08 +00:00
Aram Sargsyan 2b85e3603e Add a CHANGES note for [GL #4000]
(cherry picked from commit 786b0689c6)
2023-04-14 12:41:27 +00:00
Aram Sargsyan f25f58438c unit tests: include an OpenSSL header before including cmocka.h
OpenSSL 3.1.0 uses __attribute__(malloc), conflicting with a redefined
malloc in cmocka.h.

As a workaround, include an OpenSSL header file before including
cmocka.h in the unit tests where OpenSSL is used.

(cherry picked from commit 87db9ea84c)
2023-04-14 12:40:14 +00:00
Petr Špaček c67b7bcc09 Merge branch 'pspacek/set-up-version-and-release-notes-for-bind-9.18.15' into 'bind-9.18'
Set up version and release notes for BIND 9.18.15

See merge request isc-projects/bind9!7838
2023-04-14 08:48:52 +00:00
Petr Špaček fc30d2523e Set up release notes for BIND 9.18.15 2023-04-14 10:45:38 +02:00
Petr Špaček ae77ab4ca5 Update BIND version to 9.18.15-dev 2023-04-14 10:45:38 +02:00
Ondřej Surý 19bf6c846f Merge branch '3980-revert-unit-test-forking-9.18' into 'bind-9.18'
Revert "Kill unit tests that run more than 1200 seconds"

See merge request isc-projects/bind9!7834
2023-04-14 04:22:20 +00:00
Ondřej Surý f7bdab0591 Revert "Kill unit tests that run more than 1200 seconds"
This reverts commit 6cdeb5b046 which added
wrapper around all the unit tests that would run the unit test in the
forked process.

This makes any debugging of the unit tests too hard. Futures attempts to
fix #3980 (closed) should add a custom automake test harness (log
driver) that would kill the unit test after configured timeout.
2023-04-14 06:21:03 +02:00
Petr Špaček 2c5e22fcbc Update BIND version for release 2023-04-11 18:55:27 +02:00
Petr Špaček e42b15c6d1 Add a CHANGES marker 2023-04-11 18:54:57 +02:00
Petr Špaček f3eac1795e Merge branch 'pspacek/prepare-documentation-for-bind-9.18.14' into 'v9.18.14-release'
Prepare documentation for BIND 9.18.14

See merge request isc-private/bind9!512
2023-04-11 16:53:31 +00:00
Petr Špaček e413c85edf Add release notes for GL #3955, #3968, and #3997 2023-04-11 18:46:14 +02:00
Petr Špaček 28fb44e62b Tweak and reword release note 2023-04-11 18:46:14 +02:00
Petr Špaček 59c5d95290 Prepare release notes for BIND 9.18.14 2023-04-11 17:25:37 +02:00
Michal Nowak a901bf893f Merge branch '3916-legacy-test-no-retries-in-resolution_fails-9.18' into 'bind-9.18'
[9.18] Do not retry in resolution_fails() on timeout

See merge request isc-projects/bind9!7816
2023-04-06 10:14:21 +00:00
Michal Nowak fab91f89e6 Do not retry in resolution_fails() on timeout
At the time of test number (19), there were 10 "sending packet to
10.53.0.7" lines in the "legacy/ns1/named.run" file; usually, only seven
are present:

    I:legacy:checking recursive lookup to edns 512 + no tcp server does not cause query loops (19)
    I:legacy:ns1 sent 10 queries to ns7, expected less than 10
    I:legacy:failed

Those three can be attributed to tests "8", "10", and "18", where the
dig of "resolution_fails()" retried after a timeout to succeed with
"status: SERVFAIL" subsequently, as seen in each of
dig.out.test{8,10,18} files.

    ;; communications error to 10.53.0.1#13093: timed out

    ; <<>> DiG 9.19.12-dev <<>> -p 13093 +tcp @10.53.0.1 edns512-notcp. TXT
    ; (1 server found)
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 5368
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

This retry is unnecessary because "resolution_fails()" considers timeout
a positive result.

(cherry picked from commit e05460c813)
2023-04-06 11:39:57 +02:00
Michal Nowak 17b31a95dc Merge branch 'mnowak/looking-for-dig-errors-must-not-fail-9.18' into 'bind-9.18'
[9.18] Looking for errors in dig output files must not fail

See merge request isc-projects/bind9!7815
2023-04-06 09:33:51 +00:00
Michal Nowak 5eb0a4e537 Looking for errors in dig output files must not fail
If no errors in dig output files of failed tests are found, TSAN file
parsing won't occur.

(cherry picked from commit 28a0df3081)
2023-04-06 11:04:14 +02:00
Petr Špaček 7956df54d7 Merge branch 'pspacek/log-roll-doc-nits-9.18' into 'bind-9.18'
[9.18] Log rotation doc improvements

See merge request isc-projects/bind9!7807
2023-04-05 14:08:25 +00:00
Petr Špaček 9659d40148 Remove erroneous cross-references to suffix statement
Logging section referenced to "suffix" statement definition for dns64.

(cherry picked from commit 1dada31187)
2023-04-05 16:03:24 +02:00
Petr Špaček 8f86b48c46 Make rndc dnstap -roll docs easier to read
(cherry picked from commit 2897a45644)
2023-04-05 16:03:24 +02:00
Petr Špaček d9a745e310 Merge branch 'bug/main/rndc-dnstap-roll-9.18' into 'bind-9.18'
[9.18] Document that rndc dnstap -roll number is optional

See merge request isc-projects/bind9!7801
2023-04-05 12:06:06 +00:00
Petr MenšíkandPetr Špaček c16cabff04 Make it obvious -roll number is optional
Manual page were updated to indicate it, but rndc -h still displays it
as required parameter. Make it look like optional.

(cherry picked from commit 0627214568)
2023-04-05 14:05:14 +02:00
Petr Špaček 996f635991 Merge branch '3990-remove-dead-code-from-dst_api--9.18' into 'bind-9.18'
[9.18] Eliminate the dead code in dst_api.c

See merge request isc-projects/bind9!7775
2023-04-05 11:45:12 +00:00
Ondřej Surý 07720989a0 Eliminate the dead code in dst_api.c
In write_public_key() and write_key_state(), there were left-over checks
for result, that were effectively dead code after the last refactoring.
Remove those.

(cherry picked from commit 766366e934)
2023-04-05 09:11:24 +02:00
Mark Andrews 052422b1a8 Merge branch '3994-unnecessary-null-check-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Unnecessary NULL check"

See merge request isc-projects/bind9!7798
2023-04-05 00:51:59 +00:00
Mark Andrews bb705e9a90 Remove 'inst != NULL' from cleanup check in plugin_register
'inst' is guarenteed to be non NULL at this point.

    358        *instp = inst;
    359
    360cleanup:

    CID 281450 (#2 of 2): Dereference before null check (REVERSE_INULL)
    check_after_deref: Null-checking inst suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    361        if (result != ISC_R_SUCCESS && inst != NULL) {
    362                plugin_destroy((void **)&inst);
    363        }
    364
    365        return (result);

(cherry picked from commit 8c5539e905)
2023-04-05 10:27:52 +10:00
Ondřej Surý 09e0c5f14a Merge branch 'ondrej/require-dnspyton-2.0.0-in-shutdown-system-test-9.18' into 'bind-9.18'
[9.18] Bump the requirement in the shutdown test to dnspython 2.0.0

See merge request isc-projects/bind9!7797
2023-04-04 19:58:55 +00:00
Ondřej Surý 36572d4a1a Bump the requirement in the shutdown test to dnspython 2.0.0
The dnspython.Resolve.resolve() requires at least dnspython >= 2.0.0,
this wasn't enforced in the shutdown system test leading to infinite
loop waiting for the server start due to failing resolve() call.
2023-04-04 19:58:45 +00:00
Ondřej Surý 7f8528cc09 Merge branch 'ondrej/require-dnspyton-2.0.0-in-dnstap-system-test-9.18' into 'bind-9.18'
[9.18] Bump the requirement in dnstap test to dnspython 2.0.0

See merge request isc-projects/bind9!7794
2023-04-04 19:58:14 +00:00
Ondřej Surý 947540fc7f Bump the requirement in dnstap test to dnspython 2.0.0
The dnspython.Resolve.resolve() requires at least dnspython >= 2.0.0,
this wasn't enforced in the dnstap system test.
2023-04-04 16:44:19 +00:00
Ondřej Surý 7873e37778 Merge branch 'ondrej/add-tests-for-rpz-in-multiple-views--9.18' into 'bind-9.18'
[9.18] Add test for RPZ in multiple views

See merge request isc-projects/bind9!7792
2023-04-04 15:05:41 +00:00
Ondřej Surý 1b1eaa20bc Squash both rpzextra tests into tests_rpzextra.py
We don't need a separate module/file for every test. Both the rpz tests
could live in the same file.

The setup/teardown of servers if performed separately for each module --
unless there is a need to do that, it's better to avoid it.

(cherry picked from commit 1734d4a33e)
2023-04-04 16:27:48 +02:00
Tom KrizekandOndřej Surý b765eac703 Use more concise syntax to check responses in rpzextra tests
All the answers are expected to have exactly one resource record. Check
it directly instead of iterating over all (possible) records.

(cherry picked from commit 2ed26609b8)
2023-04-04 16:27:48 +02:00
Ondřej Surý f60bed5eb1 Add test for RPZ in multiple views
This adds rudimentary test for response-policy zones in multiple
views.  Different combinations are tested:

- two views with response-policy inherited from options {};
- two views view explicit response-policy using same RPZ zone name
- two views view explicit response-policy using secondary RPZ zone

(cherry picked from commit 1649c768e9)
2023-04-04 16:27:46 +02:00
Ondřej Surý f38860d561 Replace dnspython resolver.query() with resolver.resolve()
The resolver.query() has been deprecated in favor of resolver.resolve();
used that.

(cherry picked from commit 3b1756d450)
2023-04-04 16:27:31 +02:00
Arаm Sаrgsyаn e793fcefc7 Merge branch '3997-catz-shutdown-crash-in-dns_catz_zones_unref-9.18' into 'bind-9.18'
[9.18] Resolve "Catalog zone shutdown crash in dns_catz_zones_unref"

See merge request isc-projects/bind9!7789
2023-04-04 12:43:56 +00:00
Aram Sargsyan f2d5f9d8f1 Add a CHANGES note for [GL #3997]
(cherry picked from commit 4a0bd69056)
2023-04-04 11:48:36 +00:00
Ondřej SurýandAram Sargsyan 7e7985c9c7 Attach catzs to catz instead of doing this explicitly
Instead of explicitly adding a reference to catzs (catalog zones) when
calling the update callback, attach the catzs to the catz (catalog zone)
object to keep it referenced for the whole time the catz exists.

(cherry picked from commit 2ded876db2)
2023-04-04 11:47:43 +00:00
Ondřej Surý 05400684a6 Merge branch '3989-remove-dead-code-from-dns_xfrin--9.18' into 'bind-9.18'
[9.18] Fix xfrin_connect_done() error paths

See merge request isc-projects/bind9!7785
2023-04-04 09:33:19 +00:00
Ondřej Surý d0f72756b6 Add CHANGES note for [GL #3989]
(cherry picked from commit 04b851342b)
2023-04-04 10:07:27 +02:00
Ondřej Surý 2bb4fa34cc Fix xfrin_connect_done() error paths
The xfrin_connect_done() had several problems:

- it would not add the server to unreachable table in case of the
  failure coming from the dispatch [GL #3989]

- if dns_dispatch_checkperm() disallowed the connection, the xfr would
  be left undetached

- if xfrin_send_request() failed to send the request, the xfr would be
  left undetached

All of these have been fixed in this commit.

(cherry picked from commit 536e439c79)
2023-04-04 10:07:27 +02:00
Arаm Sаrgsyаn 3d341d090b Merge branch '3674-nsupdate--t-timeout-does-not-work-9.18' into 'bind-9.18'
[9.18] Resolve "nsupdate -t timeout does not work"

See merge request isc-projects/bind9!7779
2023-04-03 17:14:19 +00:00
Aram Sargsyan a7d5ccdb1b nsupdate: set network manager default timeout values
The default values are currently set to 30 seconds, use nsupdate
default (or overriden using the -t option) timeout value instead.

(cherry picked from commit 98c8135692)
2023-04-03 16:19:18 +00:00
Aram Sargsyan 1287b0b0e8 Add a CHANGES note for [GL #3674]
(cherry picked from commit ef81775e7b)
2023-04-03 16:19:17 +00:00
Aram Sargsyan 9e42bfd1a0 nsupdate: use the configurable timeout and retry values for all queries
The 'nsupdate' tool, when sending SOA queries, uses a hard-coded value
3 UDP retries and of 5 seconds of timeout for UDP queries, and 100
seconds of timeout for TCP queries.

Use the timeout and retry values which can be configured using the
-t, -u, -r command line options, and which are already used for
sending the update query.

(cherry picked from commit 3ef2a30c75)
2023-04-03 16:18:39 +00:00
Aram Sargsyan d861433ad4 Update nsupdate -t option's documentation
Add some clarifications about the -t option's behavior differences
in TCP and UDP modes.

(cherry picked from commit a00540ac24)
2023-04-03 16:18:39 +00:00
Aram Sargsyan 7beda284d2 Do not resend TCP requests
The req_response() function is using 'udpcount' variable to resend
the request 'udpcount' times on timeout even for TCP requests,
which does not make sense, as it would use the same connection.

Add a condition to use the resend logic only for UDP requests.

(cherry picked from commit edcdb881da)
2023-04-03 16:18:39 +00:00
Aram Sargsyan 14084d8eac Perform request validation in req_response() before using the pointer
The 'request' pointer is used before it is checked. Perform the check
before using the pointer.

(cherry picked from commit 5b37359697)
2023-04-03 16:18:39 +00:00
Aram Sargsyan 4dc2ff79d6 Synchronize dns_request_createraw() and dns_request_create() UDP timeout
The dns_request_createraw() function, unlike dns_request_create(), when
calculating the UDP timeout value, doesn't check that 'udpretries' is
not zero, and that is the more logical behavior, because the calculation
formula uses division to 'udpretries + 1', where '1' is the first try.

Change the dns_request_create() function to remove the 'udpretries != 0'
condition.

Add a 'REQUIRE(udpretries != UINT_MAX)' check to protect from a division
by zero.

Make the 'request->udpcount' field to represent the number of tries,
instead of the number of retries.

(cherry picked from commit 643abfbba7)
2023-04-03 16:18:39 +00:00
Aram Sargsyan b015b87fdc nsupdate: when set to 0, UDP timeout should be calculated by dns_request
The manual page of nsupdate's '-u udptimeout' option states that, quote:

> If zero, the interval is computed from the timeout interval and number
> of UDP retries.

However, nsupdate sets the UDP timeout value to UINT_MAX when it is 0,
thus, not behaving as documented.

Let dns_request_create() calculate the UDP timeout, if it was set to 0.

(cherry picked from commit 0ef11c0ccb)
2023-04-03 16:18:39 +00:00
Aram Sargsyan 9597a3aaca Add nsupdate timeout tests
* nsupdate should take 12 seconds (one try and three retries with
  3 second timeout for each), UDP mode
* nsupdate -u 4 -r 1 should take 8 seconds (one try and one retry with
  4 second timeout for each), UDP mode
* nsupdate -u 0 -t 8 -r 1 should also take 8 seconds, UDP mode
* nsupdate -u 4 -t 30 -r 1 should also take 8 seconds, as -u takes
  precedence over -t, UDP mode
* nsupdate -t 8 -v should also take 8 seconds, TCP mode

(cherry picked from commit 5ce2ed0688)
2023-04-03 16:18:39 +00:00
Petr Špaček 347222ad82 Merge branch '3981-reduce-dnssec-verify-calls-9.18' into 'bind-9.18'
[9.18] Reduce dns_dnssec_verify calls made checking for revoked trust anchor

See merge request isc-projects/bind9!7777
2023-04-03 16:17:09 +00:00
Petr Špaček 6f3d3d7eff Add release note for [GL #3981]
(cherry picked from commit 705a9ced01)
2023-04-03 17:47:36 +02:00
Mark AndrewsandPetr Špaček ed6ba1d273 Add CHANGES for [GL #3981]
(cherry picked from commit 5de552d545)
2023-04-03 17:46:42 +02:00
Mark AndrewsandPetr Špaček 39c82bf429 dns_view_untrust modifies dnskey->flags when it shouldn't
Copy the structure and declare dnskey as const.

(cherry picked from commit 21d828241b)
2023-04-03 17:46:13 +02:00
Mark AndrewsandPetr Špaček 972c245065 Handle dns_rdata_fromstruct failure dns_keytable_deletekey
dns_rdata_fromstruct in dns_keytable_deletekey can potentially
fail with ISC_R_NOSPACE.  Handle the error condition.

(cherry picked from commit b5df9b8591)
2023-04-03 17:46:13 +02:00
Mark AndrewsandPetr Špaček 4920fca095 Reduce the number of verifiations required
In selfsigned_dnskey only call dns_dnssec_verify if the signature's
key id matches a revoked key, the trust is pending and the key
matches a trust anchor.  Previously named was calling dns_dnssec_verify
unconditionally resulted in busy work.

(cherry picked from commit e68fecbdaa)
2023-04-03 17:46:13 +02:00
Mark AndrewsandPetr Špaček 59f17be969 Add new view method dns_view_istrusted
dns_view_istrusted determines if the given key is treated as
being trusted by the view.

(cherry picked from commit 7278fff579)
2023-04-03 17:46:13 +02:00
Tom Krizek ad6990f019 Merge branch '3915-check-dig-output-for-errors-9.18' into 'bind-9.18'
[9.18] Find errors in dig output in system tests

See merge request isc-projects/bind9!7769
2023-04-03 11:13:11 +00:00
Tom Krizek b447032489 Find errors in dig output in system tests
Facilitate faster system test failure identification and debugging by
checking any dig outputs for errors, which are typically indicative of
CI runner network / load issues.

(cherry picked from commit 940e160c06)
2023-04-03 13:06:37 +02:00
Ondřej Surý 67737ef3cb Merge branch '3710-properly-document-DF-flag-on-outbound-UDP--9.18' into 'bind-9.18'
Clarify the documentation about DF-flag

See merge request isc-projects/bind9!7771
2023-04-03 10:32:00 +00:00
Ondřej Surý 9eddb9ecd9 Add CHANGES note for [GL #3710]
(cherry picked from commit d5921fafed)
2023-04-03 12:29:28 +02:00
Ondřej Surý 01b578f67e Clarify the documentation about DF-flag
Remove the reference to setting the DF-flag as we don't do that right
now.  Rephrase the paragraph that the default value should not be
causing fragmentation.

(cherry picked from commit 61f276d5a4)
2023-04-03 12:29:07 +02:00
Mark Andrews 5cf99e3d23 Merge branch '3980-add-timeouts-to-unit-tests-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Add timeouts to unit tests."

See merge request isc-projects/bind9!7768
2023-04-03 01:55:17 +00:00
Mark Andrews 6cdeb5b046 Kill unit tests that run more than 1200 seconds
The CI doesn't provide useful forensics when a system test locks
up.  Fork the process and kill it with ABRT if it is still running
after 20 minutes.  Pass the exit status to the caller.

(cherry picked from commit 3d5c7cd46c)
2023-04-03 11:11:26 +10:00
Ondřej Surý 93efd7389f Merge branch '3982-remove-isc_fsaccess-API--9.18' into 'bind-9.18'
[9.18] Replace isc_fsaccess API with more secure file creation

See merge request isc-projects/bind9!7767
2023-03-31 16:01:45 +00:00
Ondřej Surý 7e0319b957 Add CHANGES note for [GL #3982]
(cherry picked from commit f853672e41)
2023-03-31 16:47:15 +02:00
Ondřej Surý 718893ece4 Replace isc_fsaccess API with more secure file creation
The isc_fsaccess API was created to hide the implementation details
between POSIX and Windows APIs.  As we are not supporting the Windows
APIs anymore, it's better to drop this API used in the DST part.

Moreover, the isc_fsaccess was setting the permissions in an insecure
manner - it operated on the filename, and not on the file descriptor
which can lead to all kind of attacks if unpriviledged user has read (or
even worse write) access to key directory.

Replace the code that operates on the private keys with code that uses
mkstemp(), fchmod() and atomic rename() at the end, so at no time the
private key files have insecure permissions.

(cherry picked from commit 263d232c79)
2023-03-31 16:47:15 +02:00
Ondřej Surý dcea09a327 Add isc_os_umask() function to get current umask
As it's impossible to get the current umask without modifying it at the
same time, initialize the current umask at the program start and keep
the loaded value internally.  Add isc_os_umask() function to access the
starttime umask.

(cherry picked from commit aca7dd3961)
2023-03-31 16:47:15 +02:00
Matthijs Mekking 02bcff70aa Merge branch 'matthijs-checkconf-kasp-test-bug-9.18' into 'bind-9.18'
[9.18] Fix kasp system test bug

See merge request isc-projects/bind9!7764
2023-03-31 09:18:15 +00:00
Matthijs Mekking d74557ba35 Fix kasp system test bug
This test was succeeding for the wrong reason (policy not found, rather
than bad key length).

(cherry picked from commit 106497b011)
2023-03-31 10:34:27 +02:00
Artem Boldariev 846b893a46 Merge branch '3966-backport-tlsstream-connectcb-behaviour-from-main-to-v9.18' into 'bind-9.18'
[9.18] TLS Stream: backport connect callback handling behaviour from main

See merge request isc-projects/bind9!7753
2023-03-30 16:41:08 +00:00
Artem Boldariev d1d4f6e362 TLS Stream: backport connect callback handling behaviour from main
This commit contains the backport of the behaviour for handling TLS
connect callbacks when wrapping up.

The current behaviour have not caused any problems to us, yet, but we
are changing it to remain on the safer side.
2023-03-30 18:37:21 +03:00
Matthijs Mekking c3cbd09027 Merge branch '3967-linkfix-dnssec-guide-9.18' into 'bind-9.18'
[9.18] linkfix in dnssec-guide/validation.rst

See merge request isc-projects/bind9!7746
2023-03-29 15:07:00 +00:00
Matthijs Mekking f6f99d1b82 Add CHANGES for #3967
(cherry picked from commit 5a879028fe)
2023-03-29 16:14:47 +02:00
Matthijs Mekking 30e12e3a24 Remove dead link to resolver test
The doc file doc/dnssec-guide/validation.rst points to a resolver test
site that is now down. Remove the dead link.

(cherry picked from commit 8e78f8fc0f)
2023-03-29 16:14:16 +02:00
Matthijs Mekking 44ccc0b9d0 Merge branch '3965-source-never-read-master.c-v9_18' into 'bind-9.18'
[9.18] Fix scan-build issue: initialized value never read

See merge request isc-projects/bind9!7738
2023-03-29 14:11:49 +00:00
Matthijs Mekking b719991230 Add CHANGES entry for #3965
(cherry picked from commit 357b27b04f)
2023-03-29 13:31:49 +00:00
Matthijs Mekking 9874a26686 Fix scan-build issue: initialized value never read
Value stored to 'source' during its initialization is never read.

(cherry picked from commit 4c33277446)
2023-03-29 13:31:49 +00:00
Ondřej Surý 32768d9c94 Merge branch 'ondrej/fix-isc_nm_httpconnect-to-check-for-shuttingdown--9.18' into 'bind-9.18'
[9.18]: Fix isc_nm_httpconnect to check for shuttindown condition

See merge request isc-projects/bind9!7744
2023-03-29 08:17:22 +00:00
Ondřej Surý 3e9bce0a7a Fix isc_nm_httpconnect to check for shuttindown condition
The isc_nm_httpconnect() would succeed even if the netmgr would be
already shuttingdown.  This has been fixed and the unit test has been
updated to cope with fact that the handle would be NULL when
isc_nm_httpconnect() returns with an error.

(cherry picked from commit 665f8bb78d)
2023-03-29 08:27:05 +02:00
Michal Nowak 824378d876 Merge branch 'mnowak/drop-unit-and-system-test-jobs-9.18' into 'bind-9.18'
[9.18] Drop unit and system tests on amd64cross32

See merge request isc-projects/bind9!7740
2023-03-28 14:40:39 +00:00
Michal Nowak d7bbc52c3a Drop "unstable" Debian "bullseye" unit and system jobs
"Unstable" Debian "bullseye" unit and system jobs differ from unit and
system jobs on the Debian "bullseye" image by running a few more tests
enabled by the CI_ENABLE_ALL_TESTS environmental variable.  These tests
are no less stable than the rest, and thus to have distinct jobs for
them wastes resources.

Run "unstable" unit and system tests as part of stock Debian "bullseye"
jobs.

(cherry picked from commit 2b9111b435)
2023-03-28 16:36:24 +02:00
Michal Nowak 01b5a69f73 Drop unit and system tests on amd64cross32
amd64cross32 jobs run a cross-compiled 32-bit BIND 9 on the 64-bit
platform. This approach brings no build issues, and it is a good way to
catch 32-bit issues in BIND 9 code-base and ensure cross-compilation
keeps working.

Unfortunately, running unit and system tests is a problem:

- #3269 - doth-ns1 frequently failed to start
- #3316 - quota_test sometimes fails to create new thread
- #3956 - tcp-ns1 sometimes fails to allocate memory

There's little value in running unit and system tests on the
amd64cross32 platform, and it only means the effort spent by QA by
looking into what turns out to be 32-bit limitations.

(cherry picked from commit f86d4f3bd8)
2023-03-28 16:36:24 +02:00
Tom Krizek 5b13b5df74 Merge branch 'tkrizek/gh-actions-branch-name-update-9.18' into 'bind-9.18'
[9.18] Update branch&tag name conventions

See merge request isc-projects/bind9!7734
2023-03-27 15:47:41 +00:00
Tom Krizek 340166ef28 Update branch&tag naming convention in CONTRIBUTING
(cherry picked from commit 5248a3e7db)
2023-03-27 17:39:37 +02:00
Tom Krizek 763bb3afce Update github actions to trigger on correct branches
The naming convention for maintanence branches was changed from `vX_Y`
to `bind-X.Y`.

(cherry picked from commit ee53e3c02d)
2023-03-27 17:39:35 +02:00
Tom Krizek d82bf3b04f Merge branch '3962-doc-arm-fixes-9.18' into 'bind-9.18'
[9.18] Documentation formatting fixes in ARM

See merge request isc-projects/bind9!7732
2023-03-27 15:37:39 +00:00
Tom Krizek 86d23a1d9c Apply suppress_grammar directive in ARM docs
With a newline before the :suppress_grammar: directive, it wasn't
actually interpreted as a directive, but rather as node content.
Therefore, the directive was ignored and the grammar was incorrectly
printed out.

(cherry picked from commit 36a5c098bd)
2023-03-27 17:08:31 +02:00
Tom Krizek 90842d1f8d Add missing newline in documentation code example
(cherry picked from commit 1849c02606)
2023-03-27 17:08:29 +02:00
Michal Nowak 98541aaaae Merge branch 'mnowak/suppress-gitlab-clean-up-output-9.18' into 'bind-9.18'
[9.18] Suppress Git clean output in GitLab CI

See merge request isc-projects/bind9!7729
2023-03-27 13:12:03 +00:00
Michal Nowak 0f6d1c6a54 Suppress Git clean output in GitLab CI
Git clean in GitLab CI can take up to a thousand lines, thus cluttering
the output for no good reason.

The default GitLab GIT_CLEAN_FLAGS variable is extended with "q" as in
"quiet.

(cherry picked from commit ddb33a12fc)
2023-03-27 15:11:07 +02:00
Petr Špaček 98d7846d22 Merge branch 'pspacek/qmin-docs-describe-underscore-9.18' into 'bind-9.18'
[9.18] Clarify qname-minimization relaxed in the ARM

See merge request isc-projects/bind9!7728
2023-03-27 13:09:29 +00:00
Petr Špaček d7c611becb Clarify qname-minimization relaxed in the ARM
Leading underscore in qname confused some users, and it was not
documented.

(cherry picked from commit 02430a7263)
2023-03-27 15:05:01 +02:00
Arаm Sаrgsyаn e8aae75aec Merge branch '3968-catz-data-race-in-dns__catz_update_cb-9.18' into 'bind-9.18'
[9.18] Fix a data race in dns__catz_update_cb()

See merge request isc-projects/bind9!7727
2023-03-27 12:35:31 +00:00
Aram Sargsyan 9fb1381110 Add a CHANGES note for [GL #3968]
(cherry picked from commit 95cb2affaa)
2023-03-27 11:40:19 +00:00
Aram Sargsyan 987f61dbb7 Fix a data race in dns__catz_update_cb()
The dns__catz_update_cb() function was earlier updated (see
d2ecff3c4a) to use a separate
'dns_db_t' object ('catz->updb' instead of 'catz->db') to
avoid a race between the 'dns__catz_update_cb()' and
'dns_catz_dbupdate_callback()' functions, but the 'REQUIRE'
check there still checks the validity of the 'catz->db' object.

Fix the omission.

(cherry picked from commit a2817541b3)
2023-03-27 11:39:19 +00:00
Evan Hunt c2d8d99148 Merge branch '3953-deprecate-delegation-only-v9_18' into 'bind-9.18'
[9.18] Merge branch '3953-deprecate-delegation-only' into 'main'

See merge request isc-projects/bind9!7718
2023-03-23 21:10:50 +00:00
Evan Hunt f7b2ec32b4 CHANGES and release note for [GL #3953]
(cherry picked from commit 8d80ee561e)
2023-03-23 14:10:06 -07:00
Evan Hunt 1ab3ebb718 deprecate delegation-only and root-delegation only
These options and zone type were created to address the
SiteFinder controversy, in which certain TLD's redirected queries
rather than returning NXDOMAIN. since TLD's are now DNSSEC-signed,
this is no longer likely to be a problem.

The deprecation message for 'type delegation-only' is issued from
the configuration checker rather than the parser. therefore,
isccfg_check_namedconf() has been modified to take a 'nodeprecate'
parameter to suppress the warning when named-checkconf is used with
the command-line option to ignore warnings on deprecated options (-i).

(cherry picked from commit 2399556bee)
2023-03-23 14:09:53 -07:00
Ondřej Surý 02b6cc9b35 Merge branch '3960-handle-non-ISC_R_SUCCESS-in-rctx_respinit-bind-9.18' into 'bind-9.18'
Properly handle ISC_R_SHUTTINGDOWN in resquery_response()

See merge request isc-projects/bind9!7716
2023-03-23 12:39:03 +00:00
Ondřej Surý 4bf253ffe1 Properly handle ISC_R_SHUTTINGDOWN in resquery_response()
When resquery_response() was called with ISC_R_SHUTTINDOWN, the region
argument would be NULL, but rctx_respinit() would try to pass
region->base and region->len to the isc_buffer_init() leading to
a NULL pointer dereference.  Properly handle non-ISC_R_SUCCESS by
ignoring the provided region.

(cherry picked from commit 93259812dd)
2023-03-23 12:26:09 +01:00
Tom Krizek 616920d4b2 Merge branch '3665-dupsigs-test-stability-9.18' into 'bind-9.18'
[9.18] Improve dupsigs test stability

See merge request isc-projects/bind9!7706
2023-03-22 10:21:29 +00:00
Tom Krizek 85c78dbaa9 Lighten the CI load during the dupsigs test
Previously, an AXFR request would be issued every second while waiting
for the zone to be signed. This might've been the cause of issues in CI
where many tests are running in parallel and any extra load may increase
test instability.

Instead, check for the last NSEC record to have a signature before
commencing the AXFR request to check the zone has been fully signed.

Also increase the time for the zone signing to a total of 60+10 seconds
up from the previous 30.

(cherry picked from commit 3291c891f6)
2023-03-22 10:56:25 +01:00
Tom Krizek e4484bfde6 End dupsigs test early if it fails
There's no point in continuing the dupsigs test if a failure is
detected. End the test early to avoid wasting time and resources.

(cherry picked from commit ad647dca13)
2023-03-22 10:56:25 +01:00
Tom Krizek 4b56482e62 Store dupsigs axfr to a file for easier debugging
(cherry picked from commit fad2eee631)
2023-03-22 10:56:25 +01:00
Tom Krizek 1e94c87b00 Redirect dupsigs test output to proper logger
Ensure messages from dupsigs system test end up in its log rather than
stdout. Previously, the output was hard to debug when running the tests
in parallel and messages wouldn't end up in the dupsigs.log.

(cherry picked from commit cbe2559f37)
2023-03-22 10:56:23 +01:00
Arаm Sаrgsyаn 069eaa1232 Merge branch '3955-hold-catz-reference-during-update-v9_18' into 'bind-9.18'
[9.18] Hold a catz reference while the update process is running

See merge request isc-projects/bind9!7705
2023-03-21 12:17:35 +00:00
Aram Sargsyan 51d7b13009 Add a CHANGES note for [GL #3955]
(cherry picked from commit aee14ee5d9)
2023-03-21 11:47:17 +00:00
Aram Sargsyan eef58e9708 Hold a catz reference while the update process is running
This should delay the catalog zone from being destroyed during
shutdown, if the update process is still running.

Doing this should not introduce significant shutdown delays, as
the update function constantly checks the 'shuttingdown' flag
and cancels the process if it is set.

(cherry picked from commit dc2b8bb1c9)
2023-03-21 11:47:17 +00:00
Michal Nowak 43eac16dd7 Merge branch 'mnowak/respdiff-drop-allow_failure-9.18' into 'bind-9.18'
[9.18] respdiff jobs do not need "allow_failure: true"

See merge request isc-projects/bind9!7699
2023-03-17 10:18:25 +00:00
Michal Nowak 7b7d8b7a6c respdiff jobs do not need "allow_failure: true"
ASAN and TSAN respdiff jobs should be stable and not require
"allow_failure: true" anymore.

(cherry picked from commit dd97ddca6f)
2023-03-17 11:11:06 +01:00
Tom Krizek c4ce5662fd Merge branch 'tkrizek/ci-artifacts-1d-9.18' into 'bind-9.18'
[9.18] Use the default retention time for CI artifacts

See merge request isc-projects/bind9!7694
2023-03-16 14:14:28 +00:00
Tom Krizek 7acea8eb5d Use the default retention time for CI artifacts
The instance-wide GitLab CI artifact retention time was changed to 1 day
up from the previous value of 12 hours. Remove our explicit overrides
for 1 day artifact retention time, as it is the default now.

Previously, most of our jobs had overrides for 1 day retention, while
some of our jobs used the default 12 hours. This discrepancy could be
quite impractical at times.

(cherry picked from commit 8fef5676fa)
2023-03-16 15:13:13 +01:00
Tom Krizek 7aba37333f Move gitlab-ci.yml comment to its proper place
The comment refers to "interruptible" key, rather than the entire
"default" section.

(cherry picked from commit 1139907450)
2023-03-16 15:13:09 +01:00
Tom Krizek 7545ac0a97 Merge tag 'v9_18_13' into v9_18
BIND 9.18.13
2023-03-15 18:38:23 +01:00
Artem Boldariev b6e1339612 Merge branch '3867-fix-xot-hang' into 'v9_18'
DoT: remove TLS-related kludge in isc__nmsocket_connecttimeout_cb()

See merge request isc-projects/bind9!7687
2023-03-14 18:03:36 +00:00
Artem Boldariev b029f86334 Update release notes [GL #3867]
Mention that XoT hangs have been fixed.
2023-03-14 18:51:05 +02:00
Artem Boldariev 8e4b9421ac Update CHANGES [GL #3867]
Mention that XoT hangs have been fixed.
2023-03-14 18:51:00 +02:00
Artem Boldariev 034b5febb1 DoT: remove TLS-related kludge in isc__nmsocket_connecttimeout_cb()
This commit ensures that 'sock->tls.pending_req' is not getting
nullified during TLS connection timeout callback as it prevents the
connection callback being called when connecting was not successful.

We expect 'isc__nm_failed_connect_cb() to be called from
'isc__nm_tlsdns_shutdown()' when establishing connections was
successful, but with 'sock->tls.pending_req' nullified that will not
happen.

The code removed most likely was required in older iterations of the
NM, but to me it seems that now it does only harm. One of the well
know pronounced effects is leading to irrecoverable zone transfer
hangs via TLS.
2023-03-14 18:49:29 +02:00
Mark Andrews 03a73f720d Merge branch '3937-zone-sign-kasp-v9_18' into 'v9_18'
[9.18] Resolve "NSEC records aren't signed with both configured algorithms during NSEC3->NSEC transition"

See merge request isc-projects/bind9!7685
2023-03-14 14:00:49 +00:00
Mark Andrews 68fb8ad9dd Add CHANGES for [GL #3937]
(cherry picked from commit aafcb8611c)
2023-03-15 00:19:33 +11:00
Mark Andrews 7f13c9d3fa When signing with a new algorithm preserve NSEC/NSEC3 chains
If the zone already has existing NSEC/NSEC3 chains then zone_sign
needs to continue to use them.  If there are no chains then use
kasp setting otherwise generate an NSEC chain.

(cherry picked from commit 4b55201459)
2023-03-15 00:18:54 +11:00
Mark Andrews f012549203 Merge branch '3939-insufficient-information-to-identify-key-v9_18' into 'v9_18'
[9.18] Resolve "Insufficient information to identify key"

See merge request isc-projects/bind9!7683
2023-03-14 05:49:22 +00:00
Mark Andrews bc7c9c6ad1 Report key name when removing it
(cherry picked from commit 9f161544fd)
2023-03-14 16:26:56 +11:00
Mark Andrews 92cab3fb5e Add ISC_FORMAT_PRINTF to report's declaration
dns_dnssec_updatekeys's 'report' could be called with invalid arguments
which the compiler should be be able to detect.

(cherry picked from commit 7a0a2fc3e4)
2023-03-14 16:26:56 +11:00
Arаm Sаrgsyаn 4a41a1af40 Merge branch '3924-dnstap-test-timing-issue-v9_18' into 'v9_18'
[9.18] Resolve "missing messages in `dnstap` system test after query failure"

See merge request isc-projects/bind9!7677
2023-03-13 13:23:37 +00:00
Aram Sargsyan f86495f1ad Improve dnstap system test reliability
The dnstap system test fails intermittently, and it appears to be
a timing issue - adding a short delay after running 'fstrm_capture',
and before running 'dnstap -reopen' improves the situation from
50% failures (5 out of 10 times) to 0% failures (0 out of 20 times),
tested locally.

The reason is that 'fstrm_capture' is executed in the background,
and due to OS scheduling and other factors, the listener socket
may not be ready when the following command runs and tells 'named'
to (re)open it.

(cherry picked from commit fa686fcea5)
2023-03-13 11:57:00 +00:00
Michal Nowak bdc14c4e3b Merge branch 'mnowak/stress-test-drop-parallel-build-v9_18' into 'v9_18'
[9.18] Drop parallel build from stress tests

See merge request isc-projects/bind9!7671
2023-03-09 17:36:26 +00:00
Michal Nowak 780f28ce58 Drop parallel build from stress tests
BUILD_PARALLEL_JOBS environmental variable is set to 6, which does not
align well with 4 and 8 CPU core systems dedicated to CI "stress" tests.
When multiple parallel jobs run on the host, they compete for resources
with an undesirable result: 6 compiler processes of one job may starve
named, resulting in lower-than-expected throughput and minutes-long
query response latency spikes.

Better drop the build parallelism of BIND-under-test. About 1-2 minutes
are added to the 60-65 minutes long job duration.

(cherry picked from commit 3fd7e7c81f)
2023-03-09 18:32:17 +01:00
Arаm Sаrgsyаn cf03a997e4 Merge branch '3923-doth-system-test-timing-issue-v9_18' into 'v9_18'
[9.18] Resolve "timing issue with incoming XoT check in `doth` system test"

See merge request isc-projects/bind9!7667
2023-03-09 11:30:00 +00:00
Aram Sargsyan 0b80d442ac Retry multiple times in doth test when checking if the zone file exists
Dumping of the freshly transferred zone file can take some time.

Retry 5 times before failing.

The log excerpt below shows such a case, when dumping lasted more than
two seconds.

    06-Mar-2023 09:32:09.973 zone example6/IN: Transfer started.
    06-Mar-2023 09:32:10.301 zone example6/IN: zone transfer finished: success
    06-Mar-2023 09:32:10.301 zone_dump: zone example6/IN: enter
    06-Mar-2023 09:32:11.789 client @0x7fe9ab435d68 10.53.0.10#44113 (example6): AXFR request
    06-Mar-2023 09:32:11.801 client @0x7fe9ab435d68 10.53.0.10#44113 (example6): transfer of 'example6/IN': AXFR ended: 5 messages, 2676 records, 55815 bytes, 0.011 secs (5074090 bytes/sec) (serial 1397051952)
    06-Mar-2023 09:32:12.409 zone_gotwritehandle: zone example6/IN: enter
    06-Mar-2023 09:32:12.421 dump_done: zone example6/IN: enter
    06-Mar-2023 09:32:12.421 zone_journal_compact: zone example6/IN: target journal size 53044

(cherry picked from commit 5d5d4b523b)
2023-03-09 10:40:43 +00:00
Aram Sargsyan 5ed65ce81f Fix the placement of printing dig output comments in doth system test
There can be comments in dig output for a zone transfer only in case
of an error, so we should print those errors not when wait_for_tls_xfer
succeeds, but when it fails.

Also, there is no point in printing those comments when a failure was
indeed expected.

(cherry picked from commit 9672b6be57)
2023-03-09 10:40:37 +00:00
Aram Sargsyan d2d55acf6e Fail early in doth system test when the expected failure doesn't happen
If wait_for_tls_xfer succeeds, while a failure was being expected,
set ret=1 to fail without further checking if the zone file exists.

(cherry picked from commit 2fdf01573c)
2023-03-09 10:40:31 +00:00
Michal Nowak 1668d92e63 Merge branch 'mnowak/stress-test-build-with-default-CFLAGS-v9_18' into 'v9_18'
[9.18] Build BIND in stress test jobs with common CFLAGS

See merge request isc-projects/bind9!7665
2023-03-09 10:03:22 +00:00
Michal Nowak d04776aae5 Build BIND in stress test jobs with common CFLAGS
By omission, BIND was not built with common CFLAGS in the stress test
jobs. Building with common CFLAGS and -Og should help GDB produce a
backtrace with more information.

(cherry picked from commit d33bdd36b4)
2023-03-09 10:58:39 +01:00
Matthijs Mekking ab79a09d73 Merge branch '3925-serve-stale-system-test-failure-vv9_18' into 'v9_18'
[9.18] Lower chance of intermittent serve-stale system test failure

See merge request isc-projects/bind9!7664
2023-03-09 08:56:03 +00:00
Matthijs Mekking 4ce9114b34 Update serve-stale system test
The serve-stale system test was intermittently failing due to a timing
issue:

    I:serve-stale:check stale data.example TXT was refreshed...
    I:serve-stale:failed

The RRset is refreshed, however, it first checks for an expected log
line, prior checking that the stale data.example TXT was refreshed
(using dig). This log line is there to ensure the record is actually
refreshed before we start querying again. Alternatively we could just
retry_quiet 10 <wait for dig output matches expectations>. It would
lower the chances for intermittent test failures, since there is no
longer a "check for log line, sleep one second if check fails, check
for log line, ...", prior to the check.

(cherry picked from commit 0bf36da305)
2023-03-09 08:14:17 +01:00
Tom Krizek ac9a4a73be Merge branch 'tkrizek/set-up-version-and-release-notes-for-bind-9.18.14' into 'v9_18'
Set up version and release notes for BIND 9.18.14

See merge request isc-projects/bind9!7651
2023-03-07 16:36:28 +00:00
Tom Krizek 316c6929a4 Set up release notes for BIND 9.18.14 2023-03-07 14:52:01 +01:00
Tom Krizek 8016e471d8 Update BIND version to 9.18.14-dev 2023-03-07 14:49:39 +01:00
Tom Krizek 3c85ab7f4c Update BIND version for release 2023-03-03 15:23:18 +01:00
Tom Krizek 8f2543a7d4 Add a CHANGES marker 2023-03-03 15:22:43 +01:00
Tom Krizek a5dbc24770 Merge branch 'tkrizek/prepare-documentation-for-bind-9.18.13' into 'v9_18_13-release'
Prepare documentation for BIND 9.18.13

See merge request isc-private/bind9!501
2023-03-03 14:21:06 +00:00
Tom Krizek a6d72365ee Add release note for GL #3673 2023-03-03 13:14:19 +01:00
Tom Krizek 866841a30a Reorder release notes 2023-03-03 13:14:19 +01:00
Tom Krizek 2474d7fe87 Tweak and reword release notes 2023-03-03 13:14:19 +01:00
Tom Krizek f95a0edc4c Prepare release notes for BIND 9.18.13 2023-03-03 13:14:19 +01:00
Tom Krizek 3e46baa6ff Merge branch '3917-named-should-log-uv-version-when-starting-up-v9_18' into 'v9_18'
[9.18] Resolve "Named should log UV version when starting up"

See merge request isc-projects/bind9!7644
2023-03-03 09:07:46 +00:00
Mark AndrewsandTom Krizek cdbebb0a69 Now logs UV versions when starting up
Named now logs both compile time and run time UV versions when
starting up.  This is useful information to have when debugging
network issues involving named.

(cherry picked from commit 5fd2cd8018)
2023-03-03 09:31:54 +01:00
Arаm Sаrgsyаn c70914d788 Merge branch '3907-data-race-in-rbtdb-v9_18' into 'v9_18'
[9.18] Resolve "ThreadSanitizer: data race lib/dns/rbtdb.c:1365 in newversion"

See merge request isc-projects/bind9!7640
2023-03-02 20:22:15 +00:00
Aram Sargsyan 9c48b6619a Check if catz is active in dns__catz_update_cb()
A reconfiguration can deactivate the catalog zone, while the
offloaded update process was preparing to run.

(cherry picked from commit 6980e3b354)
2023-03-02 18:57:16 +00:00
Aram Sargsyan 2e348627a1 Check if catz is active in dns__catz_timer_cb()
A reconfiguration can deactivate the catalog zone, while the
update process was deferred using a timer.

(cherry picked from commit 67c77aba38)
2023-03-02 18:57:16 +00:00
Aram Sargsyan fb15a6d6f6 Use catzs->lock in dns_catz_prereconfig()
There can be an update running in another thread, so use a lock,
like it's done in dns_catz_postreconfig().

(cherry picked from commit 3973724d67)
2023-03-02 18:57:16 +00:00
Aram Sargsyan b230fbb591 Add a CHANGES note for [GL #3907]
(cherry picked from commit cb0d6393a7)
2023-03-02 18:57:16 +00:00
Aram Sargsyan d6001423af catz: protect db_registered and db callback (un)registration with a lock
Doing this to avoid a race between the 'dns__catz_update_cb()' and
'dns_catz_dbupdate_callback()' functions.

(cherry picked from commit a87859f1fa)
2023-03-02 18:57:16 +00:00
Aram Sargsyan 574682b8c7 catz: use two pairs of dns_db_t and dns_dbversion_t in a catalog zone
As it is done in the RPZ module, use 'db' and 'dbversion' for the
database we are going to update to, and 'updb' and 'updbversion' for
the database we are working on.

Doing this should avoid a race between the 'dns__catz_update_cb()' and
'dns_catz_dbupdate_callback()' functions.

(cherry picked from commit d2ecff3c4a)
2023-03-02 18:57:16 +00:00
Aram Sargsyan 363061a1fc Update the CHANGES note for [GL #3777]
Remove the part which is no longer true after reverting the commit
in question.

The CHANGES entry was never part of a released BIND 9 version.

(cherry picked from commit e1627e1289)
2023-03-02 18:57:16 +00:00
Aram Sargsyan 6834ea968e Revert "Process db callbacks in zone_loaddone() after zone_postload()"
This reverts commit a719647023.

The commit introduced a data race, because dns_db_endload() is called
after unfreezing the zone.

(not cherry picked from commit 593dea871a)
2023-03-02 18:55:06 +00:00
Arаm Sаrgsyаn 8ccdf53fa9 Merge branch 'aram/catz-add-lock-for-dns_catz_zone_t-v9_18' into 'v9_18'
[9.18] Add a lock for dns_catz_zone_t

See merge request isc-projects/bind9!7636
2023-03-01 17:56:33 +00:00
Aram Sargsyan 9fdce9948e Add a lock for dns_catz_zone_t
Use a lock for the catalog zones during dns__catz_zones_merge() to
avoid races between 'catz' and 'parentcatz'.

(cherry picked from commit 2ae3bc6e1d)
2023-03-01 17:05:15 +00:00
Arаm Sаrgsyаn 48981ccc84 Merge branch '3911-reconfig-zone-view-revert-bugfix-v9_18' into 'v9_18'
[9.18] Fix view's zones reverting bug during reconfiguration

See merge request isc-projects/bind9!7634
2023-03-01 16:45:43 +00:00
Aram Sargsyan 4a5156f132 Add CHANGES and release notes for [GL #3911]
(cherry picked from commit e1036253db)
2023-03-01 15:41:10 +00:00
Aram Sargsyan 78f1d256a3 Fix view's zones reverting bug during reconfiguration
During reconfiguration, the configure_view() function reverts the
configured zones to the previous view in case if there is an error.

It uses the 'zones_configured' boolean variable to decide whether
it is required to revert the zones, i.e. the error happened after
all the zones were successfully configured.

The problem is that it does not account for the case when an error
happens during the configuration of one of the zones (not the first),
in which case there are zones that are already configured for the
new view (and they need to be reverted), and there are zones that
are not (starting from the failed one).

Since 'zones_configured' remains 'false', the configured zones are
not reverted.

Replace the 'zones_configured' variable with a pointer to the latest
successfully configured zone configuration element, and when reverting,
revert up to and including that zone.

(cherry picked from commit 84c235a4b0)
2023-03-01 15:40:33 +00:00
Aram Sargsyan 789ce76dd1 Add a catz system test check for [GL #3911]
The trick is to configure a duplicate zone, which comes after the
catalog zone, where the duplicate zone is an existing member zone.

In that scenario, all the zones which come before the "faulty" zone
in the configuration file will fail to be reverted to the previous
version of the view after a reconfiguration error, and in this
particular case that will result in an assertion failure when the
catalog zone update is initiated, because it will be still tied to
the new version of the view, which was dismissed.

(cherry picked from commit 93c4f382f4)
2023-03-01 15:39:39 +00:00
Mark Andrews 2f808b76e5 Merge branch '3894-emit-coverage-summary-for-the-coverage-badge-v9_18' into 'v9_18'
[9.18] Resolve "Emit coverage summary for the coverage badge"

See merge request isc-projects/bind9!7628
2023-03-01 00:57:07 +00:00
Mark Andrews 51f25b52e4 Extract test coverage statistics from the gcov job
In older GitLab versions, the regular expression used for extracting
test coverage statistics from the output of GitLab CI jobs was
configured in the project's settings, using GitLab's web interface.
That changed in recent GitLab versions [1]; the previous configuration
method was removed from the web interface altogether as of GitLab 15.0.
The relevant regular expression is now supposed to be set in the
relevant job's definition in .gitlab-ci.yml.

Set the regular expression used for extracting test coverage
statistics in the definition of the "gcov" GitLab CI job.  Use the
regular expression suggested in GitLab's documentation [2].

[1] https://docs.gitlab.com/ee/update/deprecations.html#test-coverage-project-cicd-setting
[2] https://docs.gitlab.com/ee/ci/pipelines/settings.html#test-coverage-examples

(cherry picked from commit db7af9fcc1)
2023-03-01 10:50:02 +11:00
Arаm Sаrgsyаn 6060c33161 Merge branch 'aram/catz-refactor-renaming-leftovers-finish-v9_18' into 'v9_18'
[9.18] Finish catalog zone 'zone' and 'zones' to 'catz' and 'catzs' renaming

See merge request isc-projects/bind9!7625
2023-02-28 16:21:12 +00:00
Aram Sargsyan 6b7d2df6b8 Finish catalog zone 'zone' and 'zones' to 'catz' and 'catzs' renaming
There are leftovers from the previous refactoring effort, which left
some function declarations and comments in the header file unchanged.

Finish the renaming.

(cherry picked from commit 580ef2e18f)
2023-02-28 14:52:35 +00:00
Arаm Sаrgsyаn 1b8cd6a59d Merge branch '3777-fix-crash-after-failed-ixfr-from-differences-v9_18' into 'v9_18'
[9.18] Resolve "crash after failed ixfr-from-differences on a catalog zone"

See merge request isc-projects/bind9!7620
2023-02-28 14:29:55 +00:00
Aram Sargsyan 09667330d4 Add a CHANGES note for [GL #3777]
(cherry picked from commit 46b1c558ce)
2023-02-28 13:47:18 +00:00
Aram Sargsyan e9acfbd43a catz: unregister the db update-notify callback before detaching from db
When detaching from the previous version of the database, make sure
that the update-notify callback is unregistered, otherwise there is
an INSIST check which can generate an assertion failure in free_rbtdb(),
which checks that there are no outstanding update listeners in the list.

There is a similar code already in place for RPZ.

(cherry picked from commit cf79692a66)
2023-02-28 13:47:18 +00:00
Aram Sargsyan 00569f62b3 Searching catzs->zones requires a read lock
Lock the catzs->lock mutex before searching in the catzs->zones
hash table.

(cherry picked from commit 0ef0c86632)
2023-02-28 13:47:18 +00:00
Aram Sargsyan a719647023 Process db callbacks in zone_loaddone() after zone_postload()
The zone_postload() function can fail and unregister the callbacks.

Call dns_db_endload() only after calling zone_postload() to make
sure that the registered update-notify callbacks are not called
when the zone loading has failed during zone_postload().

Also, don't ignore the return value of zone_postload().

(cherry picked from commit ed268b46f1)
2023-02-28 13:47:18 +00:00
Aram Sargsyan 7e4d450c1e Add a system test for [GL #3777]
Add the 'ixfr-from-differences yes;' option to trigger a failed
zone postload operation when a zone is updated but the serial
number is not updated, then issue two successive 'rndc reload'
commands to trigger the bug, which causes an assertion failure.

(cherry picked from commit a73b67456e)
2023-02-28 13:47:18 +00:00
Michal Nowak ed598a8c7a Merge branch '3269-increase-server-start-timeout-v9_18' into 'v9_18'
[9.18] Increase server start timeout for system tests

See merge request isc-projects/bind9!7619
2023-02-28 13:31:24 +00:00
Artem BoldarievandMichal Nowak c392b57e50 Increase server start timeout for system tests
This commit increases server start timeout from 60 to 90 seconds in
order to avoid system test failures on some platforms due to inability
to initialise TLS contexts in time.

(cherry picked from commit 705f0d1ed1)
2023-02-28 14:26:13 +01:00
Mark Andrews 5b1fbe0c1f Merge branch '3902-fetchlimit-system-test-failed-v9_18' into 'v9_18'
[9.18] Resolve "'fetchlimit' system test failed"

See merge request isc-projects/bind9!7616
2023-02-28 12:49:38 +00:00
Mark Andrews aa8bcc0a5a Fix 'checking drop statistics' test
Wait for the desired log message to appear in ns3/named.stats rather
than the creation of the file.

(cherry picked from commit c7ae975ecf)
2023-02-28 12:26:45 +00:00
Mark Andrews 1c0ef5fabe Fix 'lame server clients are dropped below the hard limit' test
The test was setting a minimum count for recursive clients which
was not always being met (e.g. 91 instead of 100) producing a false
positive.  Lower the lower bound on recursive clients for this
test to 1.

(cherry picked from commit af47090d99)
2023-02-28 12:26:45 +00:00
Michał Kępień 902cd753c1 Merge branch 'michal/add-a-dnsrps-enabled-build-to-regular-ci-pipelines-v9_18' into 'v9_18'
[9.18] Add a DNSRPS-enabled build to regular CI pipelines

See merge request isc-projects/bind9!7621
2023-02-28 12:12:16 +00:00
Michał Kępień 7dfd4ec61b Add a DNSRPS-enabled build to regular CI pipelines
DNSRPS-enabled builds have recently been silently broken a few times due
to that feature not being tested in regular CI pipelines.  Add the
--enable-dnsrps --enable-dnsrps-dl switches to the ./configure
invocation in one of the CI jobs run for all merge requests so that
DNSRPS-related build issues can be detected in advance.

It is important to note that this change by itself does NOT enable
actual testing of the DNSRPS feature as doing that requires a DNSRPS
provider library to be present on the test host.

(cherry picked from commit a4d6f5f6fd)
2023-02-28 12:57:41 +01:00
Michał Kępień 8fcf05a724 (Mostly) fix building bin/tests/system/rpz/dnsrps
Building the bin/tests/system/rpz/dnsrps helper binary is currently not
possible at all as the necessary compiler and linker flag definitions
are missing from bin/tests/system/Makefile.am.  Add these as a basis for
addressing the problem.

Unfortunately, this is where the "mostly" bit mentioned in this commit's
subject line comes into play.  The dlopen() parts of DNSRPS code have
not yet been reworked to use libuv's dlopen() API (uv_dlopen() etc.)
(See commit 37b9511ce1 for prior work in
this area.)  While it is certainly possible to do that, implementing
such a change without testing it in practice against a usable librpz.so
(i.e. a DNSRPS provider library) is bound to cause more trouble and
confusion than keeping the code the way it is right now.  However,
making that code buildable as-is requires linking against a C standard
library that exports the dlopen(), dlsym(), and dlclose() symbols used
by the DNSRPS dynamic loading code.  glibc 2.34+ satisfies that
requirement, but older glibc versions do not (these come with a separate
libdl shared library that would need to be linked in as well).  (Other
C standard library implementations have not been examined.)  Since the
long-term plan is to rely on libuv's dlopen() API exclusively and
detecting the shared object containing dlopen() & friends would only
pull in build system complexity for no good reason, assume for now that
the target system provides the dlopen() API in its C standard library.

This change enables the system test suite to be run for a BIND 9 build
prepared using --enable-dnsrps --enable-dnsrps-dl (on systems satisfying
the requirement explained above).  However, it is important to note that
this change by itself does NOT enable actual testing of the DNSRPS
feature as doing that requires a DNSRPS provider library to be present
on the test host.

(cherry picked from commit b396f55586)
2023-02-28 12:57:41 +01:00
Arаm Sаrgsyаn c0a72cf6fd Merge branch '3881-catz-offload-v9_18' into 'v9_18'
[9.18] Resolve "Run the catalog zone update as an offloaded work"

See merge request isc-projects/bind9!7614
2023-02-28 11:36:21 +00:00
Aram Sargsyan bc885fb489 Add CHANGES and release notes for [GL #3881]
(cherry picked from commit cb1cd67bea)
2023-02-28 11:11:17 +00:00
Ondřej SurýandArаm Sаrgsyаn 8b059b211f Pause the catz dbiterator while processing the zone
The dbiterator read-locks the whole zone and it stayed locked during
whole processing time when catz is being read.  Pause the iterator, so
the updates to catz zone are not being blocked while processing the catz
update.

(cherry picked from commit 4e7187601f)
2023-02-28 11:11:17 +00:00
Ondřej SurýandArаm Sаrgsyаn d13e7472ea Unlock catzs during dns__catz_update_cb()
Instead of holding the catzs->lock the whole time we process the catz
update, only hold it for hash table lookup and then release it.  This
should unblock any other threads that might be processing updates to
catzs triggered by extra incoming transfer.

(cherry picked from commit b1cd4a066a)
2023-02-28 11:11:17 +00:00
Aram Sargsyan 16dc8c3977 Offload catalog zone updates
Offload catalog zone processing so that the network manager threads
are not interrupted by a large catalog zone update.

Introduce a new 'updaterunning' state alongside with 'updatepending',
like it is done in the RPZ module.

Note that the dns__catz_update_cb() function currently holds the
catzs->lock during the whole process, which is far from being optimal,
but the issue is going to be addressed separately.

(cherry picked from commit 0b96c9234f)
2023-02-28 11:11:17 +00:00
Michal Nowak cb588a7b75 Merge branch 'mnowak/make-openbsd-allow_failure-true-v9_18' into 'v9_18'
[9.18] Do not fail pipeline because of failed OpenBSD system test

See merge request isc-projects/bind9!7617
2023-02-28 10:40:36 +00:00
Michal Nowak a2ccda7872 Do not fail pipeline because of failed OpenBSD system test
System test on OpenBSD is unstable even when test parallelism is
disabled.

(cherry picked from commit fc26da6d89)
2023-02-28 11:34:39 +01:00
Michal Nowak 157f098248 Revert "Disable OpenBSD system test parallelism in CI"
This reverts commit 5f21f3203d.

(cherry picked from commit a9d3ec33b3)
2023-02-28 11:34:38 +01:00
Arаm Sаrgsyаn a24a62924e Merge branch 'aram/catz-add-shutdown-signaling-v9_18' into 'v9_18'
[9.18] Add shutdown signaling for catalog zones

See merge request isc-projects/bind9!7613
2023-02-28 10:32:32 +00:00
Aram Sargsyan 5ecc4bedbe Add a CHANGES note for [GL !7571]
(cherry picked from commit c76cc58803)
2023-02-28 09:50:42 +00:00
Aram Sargsyan ed942f5536 Add shutdown signaling for catalog zones
This change should make sure that catalog zone update processing
doesn't happen when the catalog zone is being shut down. This
should help avoid races when offloading the catalog zone updates
in the follow-up commit.

(cherry picked from commit 246b7084d6)
2023-02-28 09:50:42 +00:00
Arаm Sаrgsyаn ceba260fb8 Merge branch 'aram/catz-light-refactoring-and-reference-count-tracing-v9_18' into 'v9_18'
[9.18] Implement reference count tracing for dns_catz_zone_t and dns_catz_zones_t

See merge request isc-projects/bind9!7610
2023-02-28 09:49:51 +00:00
Aram Sargsyan 396265c8fa Add a CHANGES note for [GL !7570]
(cherry picked from commit c29299aa15)
2023-02-27 20:43:48 +00:00
Aram Sargsyan f8663976ff Add reference count tracing for dns_catz_zone_t and dns_catz_zones_t
Tracing can be activated by defining DNS_RPZ_TRACE in catz.h.

(cherry picked from commit 53f0c5a9ac)
2023-02-27 20:43:48 +00:00
Aram Sargsyan 43d99eb8b8 Light refactoring of catz.c
* Change 'dns_catz_new_zones()' function's prototype (the order of the
  arguments) to synchronize it with the similar function in rpz.c.
* Rename 'refs' to 'references' in preparation of ISC_REFCOUNT_*
  macros usage for reference tracking.
* Unify dns_catz_zone_t naming to catz, and dns_catz_zones_t naming to
  catzs, following the logic of similar changes in rpz.c.
* Use C compound literals for structure initialization.
* Synchronize the "new zone version came too soon" log message with the
  one in rpz.c.
* Use more of 'sizeof(*ptr)' style instead of the 'sizeof(type_t)' style
  expressions when allocating or freeing memory for 'ptr'.

(cherry picked from commit 8cb79fec9d)
2023-02-27 20:43:48 +00:00
Arаm Sаrgsyаn ca9bbd43c6 Merge branch '3900-catz-error-path-issues' into 'v9_18'
[9.18] Resolve "Error path cleanup issues in dns_catz_new_zones() and dns_catz_new_zone()"

See merge request isc-projects/bind9!7605
2023-02-27 14:07:34 +00:00
Aram Sargsyan d96d8dc651 Add a CHANGES note for [GL #3900] 2023-02-27 13:21:41 +00:00
Aram Sargsyan 9050481d1f Fix a cleanup bug when isc_task_create() fails in dns_catz_new_zones()
Use isc_mem_putanddetach() instead of isc_mem_put() to detach from the
memory context.
2023-02-27 12:11:20 +00:00
Aram Sargsyan 6f8fb0241a Fix a memory leak when isc_timer_create() fails in dns_catz_new_zone()
Destroy 'new_zone->coos' in dns_catz_new_zone() on error path.
2023-02-27 12:04:01 +00:00
Mark Andrews 6c74ee2c89 Merge branch '3895-memory-leak-in-isc_hmac_init-v9_18' into 'v9_18'
[9.18] Resolve "memory leak in isc_hmac_init"

See merge request isc-projects/bind9!7604
2023-02-26 23:50:06 +00:00
Mark Andrews 749c13cf04 Fix memory leak in isc_hmac_init
If EVP_DigestSignInit failed 'pkey' was not freed.

(cherry picked from commit cf5f133679)
2023-02-27 10:27:32 +11:00
Michal Nowak 66d847ab4a Merge branch 'mnowak/freebsd-12.4-v9_18' into 'v9_18'
[9.18] Add FreeBSD 12.4

See merge request isc-projects/bind9!7599
2023-02-24 13:26:34 +00:00
Michal Nowak d8d283bb6f Add FreeBSD 12.4
(cherry picked from commit 2307661b1a)
2023-02-24 14:04:02 +01:00
Michal Nowak 90bdf4e95d Merge branch 'mnowak/alpine-3.17-v9_18' into 'v9_18'
[9.18] Add Alpine Linux 3.17

See merge request isc-projects/bind9!7596
2023-02-24 12:24:13 +00:00
Michal Nowak 259dd5a3ec Drop date from "Regularly Tested Platforms" section
Changing the date is easy to forget and may be outdated.

(cherry picked from commit 5783280b10)
2023-02-24 12:47:34 +01:00
Michal Nowak 9d8fe281c3 Add Alpine Linux 3.17
(cherry picked from commit 345089ad23)
2023-02-24 12:47:33 +01:00
Michal Nowak 5ebee24dde Merge branch 'mnowak/update_TEST_PARALLEL_JOBS_for_BSD-v9_18' into 'v9_18'
[9.18] Disable OpenBSD system test parallelism in CI

See merge request isc-projects/bind9!7590
2023-02-24 09:18:24 +00:00
Michal Nowak 5f21f3203d Disable OpenBSD system test parallelism in CI
Make OpenBSD system tests more stable by disabling parallelism in CI.

Accordingly, they will run 3-4 times longer.

(cherry picked from commit d73eba57bd)
2023-02-24 10:16:27 +01:00
Michal Nowak ef9b15fc50 Do not set TEST_PARALLEL_JOBS in FreeBSD system test
Setting TEST_PARALLEL_JOBS to 4 in FreeBSD system test jobs is a no-op
because it's already set to 4, one level above, on the global level.

(cherry picked from commit cf46addf51)
2023-02-24 10:16:27 +01:00
Ondřej Surý 359919b326 Merge branch 'ondrej-restore-sonarcloud-analysis-v9_18' into 'v9_18'
[9.18] Add SonarCloud GitHub Action

See merge request isc-projects/bind9!7591
2023-02-24 08:56:39 +00:00
Ondřej Surý d1213c3b99 Add SonarCloud GitHub Action
Add new SonarCloud GitHub Action and configuration; something (maybe
the way the builds were submitted) has apparently changed and the
project got deleted and the analysis wasn't working.

(cherry picked from commit 4bfbb4ddf7)
2023-02-24 09:54:20 +01:00
Tom Krizek 649e45ae00 Merge branch '3622-serve-stale-rrsig-test-v9_18' into 'v9_18'
[9.18][CVE-2022-3736] Test RRSIG queries with serve-stale enabled

See merge request isc-projects/bind9!7579
2023-02-22 13:09:08 +00:00
Mark AndrewsandTom Krizek dfaf3b7b78 Test RRSIG queries with serve-stale enabled
Make RRSIG queries where the existing tests trigger a DNS_EVENT_TRYSTALE
event.

(cherry picked from commit add40273df)
2023-02-22 13:38:59 +01:00
Tom Krizek c341f2fcfc Merge branch '3619-serve-stale-client-timeout-crash-test-v9_18' into 'v9_18'
[9.18][CVE-2022-3924] Add a reproducer for the serve-stale crash when recursive clients soft quota is reached

See merge request isc-projects/bind9!7576
2023-02-22 11:56:58 +00:00
Aram SargsyanandTom Krizek e7f03ec3ac Add tests for CVE-2022-3924
Reproduce the assertion by configuring a 'named' resolver with
'recursive-clients 10;' configuration option and running 20
queries is parallel.

Also tweak the 'ans2/ans.pl' to simulate a 50ms network latency
when qname starts with "latency". This makes sure that queries
running in parallel don't get served immediately, thus allowing
the configured recursive clients quota limitation to be activated.

(cherry picked from commit 4b52b0b4a9)
2023-02-22 10:50:44 +01:00
Matthijs Mekking 1d00ca2a11 Merge branch 'matthijs-fix-kasp-attach-detach-usage-v9_18' into 'v9_18'
[9.18] Fix dns_kasp_attach / dns_kasp_detach usage

See merge request isc-projects/bind9!7566
2023-02-21 16:37:55 +00:00
Mark AndrewsandMatthijs Mekking 87602eecd7 Fix dns_kasp_attach / dns_kasp_detach usage
The kasp pointers in dns_zone_t should consistently be changed by
dns_kasp_attach and dns_kasp_detach so the usage is balanced.

(cherry picked from commit b41882cc75)
2023-02-21 16:54:53 +01:00
Arаm Sаrgsyаn 6906a0b185 Merge branch '3880-fix-rpz-assertion-failure-during-failed-reconfiguration-v9_18' into 'v9_18'
[9.18] Detach rpzs and catzs from the previous view

See merge request isc-projects/bind9!7564
2023-02-21 09:59:58 +00:00
Aram Sargsyan 2d296a8d70 Add a CHANGES note for [GL #3880]
(cherry picked from commit b086374b1d)
2023-02-21 09:05:11 +00:00
Aram Sargsyan 722b116905 Detach rpzs and catzs from the previous view
When switching to a new view during a reconfiguration (or reverting
to the old view), detach the 'rpzs' and 'catzs' from the previuos view.

The 'catzs' case was earlier solved slightly differently, by detaching
from the new view when reverting to the old view, but we can not solve
this the same way for 'rpzs', because now in BIND 9.19 and BIND 9.18
a dns_rpz_shutdown_rpzs() call was added in view's destroy() function
before detaching the 'rpzs', so we can not leave the 'rpzs' attached to
the previous view and let it be shut down when we intend to continue
using it with the new view.

Instead, "re-fix" the issue for the 'catzs' pointer the same way as
for 'rpzs' for consistency, and also because a similar shutdown call
is likely to be implemented for 'catzs' in the near future.

(cherry picked from commit 121a095a22)
2023-02-21 09:04:19 +00:00
Aram Sargsyan 568f685856 Add an "rpz" system test check for a failed reconfiguration
The faulty "DLZ" configuration triggers a reconfiguration failure
in such a place where view reverting code is covered.

(cherry picked from commit 95f4bac002)
2023-02-21 09:04:10 +00:00
Evan Hunt 64c0a7b5d4 Merge branch 'each-cleanup-gethostname-v9_18' into 'v9_18'
[9.18] Merge branch 'each-cleanup-gethostname' into 'main'

See merge request isc-projects/bind9!7559
2023-02-18 20:52:49 +00:00
Evan Hunt 61692942b8 remove named_os_gethostname()
this function was just a front-end for gethostname(). it was
needed when we supported windows, which has a different function
for looking up the hostname; it's not needed any longer.

(cherry picked from commit 197334464e)
2023-02-18 12:27:19 -08:00
Mark Andrews 833a932928 Merge branch '3879-hmac_createctx-fails-to-free-context-on-isc_hmac_init-failure-v9_18' into 'v9_18'
[9.18] Resolve "hmac_createctx fails to free context on isc_hmac_init failure"

See merge request isc-projects/bind9!7556
2023-02-18 00:50:26 +00:00
Mark Andrews 0d56344a8e In hmac_createctx free ctx on isc_hmac_init failure
(cherry picked from commit d22257a370)
2023-02-18 10:26:55 +11:00
Michal Nowak 2536012463 Merge branch 'mnowak/qa-tools-update-v9_18' into 'v9_18'
[9.18] Python formatting updates

See merge request isc-projects/bind9!7553
2023-02-17 15:32:17 +00:00
Michal Nowak da49342f26 Fix unnecessary "else" after "raise" with pylint 2.16.2
bin/tests/system/get_algorithms.py:225:4: R1720: Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it (no-else-raise)

(cherry picked from commit 8064ac6bec)
2023-02-17 16:03:30 +01:00
Michal Nowak d89f1056df Adapt to Python scripts to black 23.1.0
(cherry picked from commit 3cd2cc6254)
2023-02-17 16:03:30 +01:00
Mark Andrews af3c4ae900 Merge branch '3869-dig-fails-to-cleanup-openssl-references-v9_18' into 'v9_18'
[9.18] Resolve "Dig fails to cleanup OpenSSL references"

See merge request isc-projects/bind9!7542
2023-02-16 23:43:12 +00:00
Mark Andrews cf5e81ed7b Cleanup OpenSSL reference on bad option
Another exit path that needs to be cleaned up.

(cherry picked from commit e27fc4bbc5)
2023-02-16 22:31:52 +00:00
Mark Andrews 4dfc183fbd Cleanup OpenSSL reference on bad domain name
Free/detach tsigkey and sig0key when exiting and then call
dst_lib_destroy if we have previously called dst_lib_init.  This will,
in theory, allow OPENSSL_cleanup to free all memory.

(cherry picked from commit 4c2525c418)
2023-02-16 22:31:52 +00:00
Michal Nowak e48b6dfc61 Merge tag 'v9_18_12' into v9_18
BIND 9.18.12
2023-02-16 17:40:52 +01:00
Mark Andrews 3090062aec Merge branch 'feature/main/fips-tests-v9_18' into 'v9_18'
[9.18] FIPS tests changes for RHEL

See merge request isc-projects/bind9!7540
2023-02-15 21:56:45 +00:00
Mark Andrews f42a203376 Add CHANGES note for [GL !7417]
(cherry picked from commit 55a6b15087)
2023-02-16 08:35:12 +11:00
Petr MenšíkandMark Andrews 0915738c46 FIPS tests changes for RHEL
Include MD5 feature detection in featuretest tool and use it in some
places. When RHEL distribution or Fedora ELN is in FIPS mode, then MD5
algorithm is unavailable completely and even hmac-md5 algorithm usage
will always fail. Work that around by checking MD5 works and if not,
skipping its usage.

Those changes were dragged as downstream patch bind-9.11-fips-tests.patch
in Fedora and RHEL.

(cherry picked from commit 6ad794a8cd)
2023-02-16 08:34:47 +11:00
Tom Krizek d0920a91dc Merge branch '3849-relax-diff-on-dig-short-output-v9_18' into 'v9_18'
[9.18] Ignore dig errors in +short comparisons in tests

See merge request isc-projects/bind9!7532
2023-02-14 13:26:11 +00:00
Tom Krizek df2a962284 Ignore dig errors in +short comparisons in tests
Tests using diff to compare outputs of dig +short shall ignore lines
starting with ";". In dig +short output, such lines should only be
present for errors such as network issues. Since we utilize dig's
default timeout/retry mechanisms, these transitory issues should be
ignored and only the final output should be considered during the diff
comparison.

(cherry picked from commit bd1ef66f83)
2023-02-14 13:41:06 +01:00
Arаm Sаrgsyаn ebd49dc674 Merge branch '3866-fix-rpz-reference-counting-bug-v9_18' into 'v9_18'
[9.18] Fix RPZ reference counting error on shutdown

See merge request isc-projects/bind9!7531
2023-02-14 12:28:31 +00:00
Aram Sargsyan e2f19d1a4b Add a CHANGES note for [GL #3866]
(cherry picked from commit a5927f1151)
2023-02-14 11:21:49 +00:00
Aram Sargsyan aafe857e48 Fix RPZ reference counting error on shutdown
A dns_rpz_unref_rpzs() call is missing when taking the 'goto unlock;'
path on shutdown, in order to compensate for the earlier
dns_rpz_ref_rpzs() call.

Move the dns_rpz_ref_rpzs() call after the shutdown check.

(cherry picked from commit afbe63565f)
2023-02-14 11:21:40 +00:00
Arаm Sаrgsyаn d68ef418f8 Merge branch '3735-fix-rpz-shutdown-bugs-v9_18' into 'v9_18'
[9.18] Fix shutdown and error path bugs in the rpz unit

See merge request isc-projects/bind9!7519
2023-02-14 11:19:02 +00:00
Aram Sargsyan b236577ccf Add a CHANGES note for [GL #3735]
(cherry picked from commit 2824422e78)
2023-02-14 10:26:37 +00:00
Aram Sargsyan c3a4e14243 Fix an error path bug in rpz.c:update_nodes()
When dns_db_createiterator() fails, 'updbit' should not be destroyed
for obvious reasons, i.e. it is NULL.

(cherry picked from commit ef4f15d2d1)
2023-02-14 10:26:37 +00:00
Aram Sargsyan c72b19b5e8 Fix a shutdown and error path bugs in rpz.c:update_nodes()
When shutting down, or when dns_dbiterator_current() fails, 'node'
shouldn't be detached, because it is NULL at that point.

(cherry picked from commit d36728e42f)
2023-02-14 10:26:37 +00:00
Aram Sargsyan cc4cb67149 Fix a shutdown bug in update_rpz_cb()
When shutting down, the cleanup path should not try to destroy
'newnodes', because it is NULL at that point.

Introduce another label for the "shuttingdown" scenario.

(cherry picked from commit 975d16230b)
2023-02-14 10:26:37 +00:00
Arаm Sаrgsyаn c8206cab0b Merge branch 'aram/ondrej-eliminitate-rpzs-irefs-v9_18' into 'v9_18'
[9.18] Refactor dns_rpz unit to use single reference counting

See merge request isc-projects/bind9!7516
2023-02-14 10:24:47 +00:00
Ondřej SurýandAram Sargsyan 5baf3ac3b6 Refactor dns_rpz unit to use single reference counting
The dns_rpz_zones structure was using .refs and .irefs for strong and
weak reference counting.  Rewrite the unit to use just a single
reference counting + shutdown sequence (dns_rpz_destroy_rpzs) that must
be called by the creator of the dns_rpz_zones_t object.  Remove the
reference counting from the dns_rpz_zone structure as it is not needed
because the zone objects are fully embedded into the dns_rpz_zones
structure and dns_rpz_zones_t object must never be destroyed before all
dns_rpz_zone_t objects.

The dns_rps_zones_t reference counting uses the new ISC_REFCOUNT_TRACE
capability - enable by defining DNS_RPZ_TRACE in the dns/rpz.h header.

Additionally, add magic numbers to the dns_rpz_zone and dns_rpz_zones
structures.

(cherry picked from commit 77659e7392)
2023-02-14 09:58:16 +00:00
Mark Andrews 8d01ece927 Merge branch '3662-extend-mkeys-system-test-to-handle-islands-of-trust-v9_18' into 'v9_18'
[9.18] Resolve "Extend mkeys system test to handle islands of trust"

See merge request isc-projects/bind9!7529
2023-02-14 00:25:24 +00:00
Mark Andrews 5817b3817a Add CHANGES note for [GL #3662]
(cherry picked from commit 2928f21733)
2023-02-14 10:44:39 +11:00
Mark Andrews 90aa1ba971 Add islands of trust to mkeys test
This adds an island of trust that is reachable from the root
where the trust anchors are added to island.conf.

This add an island of trust that is not reachable from the root
where the trust anchors are added to private.conf.

(cherry picked from commit 41bdb5b9fe)
2023-02-14 10:44:39 +11:00
Mark Andrews 4a7c78b290 Report the key name that failed in retry_keyfetch
When there are multiple managed trust anchors we need to know the
name of the trust anchor that is failing.  Extend the error message
to include the trust anchor name.

(cherry picked from commit fb7b7ac495)
2023-02-14 10:44:39 +11:00
Tony Finch a0405b3511 Merge branch 'fanf-named-compilezone-stray-backtick-v9_18' into 'v9_18'
[9.18] Fix the reference to RFC 1035 in named-compilezone(1)

See merge request isc-projects/bind9!7527
2023-02-13 18:26:25 +00:00
Tony FinchandTony Finch 6c19848836 Fix the reference to RFC 1035 in named-compilezone(1)
There was a stray backquote

(cherry picked from commit ef1170b3fc)
2023-02-13 16:33:38 +00:00
Tom Krizek 4596017ae6 Merge branch '3848-increase-wait-time-runtime-test-v9_18' into 'v9_18'
[9.18] Increase named startup wait time for runtime test

See merge request isc-projects/bind9!7524
2023-02-13 15:33:54 +00:00
Tom Krizek b4d01b0175 Increase named startup wait time for runtime test
Occasionally, the allotted 10 seconds for the "running" line to appear
in log after named is started proved insufficient in CI, especially
during increased load. Give named up to 60 seconds to start up to
mitigate this issue.

(cherry picked from commit b8bb4233e8)
2023-02-13 16:08:56 +01:00
Michal Nowak 3dc6296e2e Merge branch 'mnowak/pairwise-test-auth-recursive-servers-v9_18' into 'v9_18'
[9.18] Start named as auth and recursive server in pairwise

See merge request isc-projects/bind9!7523
2023-02-13 15:00:05 +00:00
Michal Nowak e6f5b69784 Start named as auth and recursive server in pairwise
The script will start the named process configured as both an
authoritative and recursive server for each pairwise ./configure
configuration. The test is considered successful if the named process
runs until the 5-second timeout is triggered, and there is no named.lock
file present, indicating that named did not crash on shutdown.

(cherry picked from commit a708c2f93d)
2023-02-13 13:40:47 +01:00
Arаm Sаrgsyаn 28b33b72e3 Merge branch '3190-offload-rpz-updates-2nd-round-v9_18' into 'v9_18'
[9.18] Run the RPZ update as offloaded work (2-nd round)

See merge request isc-projects/bind9!7512
2023-02-13 12:31:24 +00:00
Ondřej SurýandAram Sargsyan c9028b4976 Add CHANGES and release note for [GL #3190]
(cherry picked from commit 23a4559b34)
2023-02-13 11:41:52 +00:00
Ondřej SurýandAram Sargsyan 6873cc1c79 Run the RPZ update as offloaded work
Previously, the RPZ updates ran quantized on the main nm_worker loops.
As the quantum was set to 1024, this might lead to service
interruptions when large RPZ update was processed.

Change the RPZ update process to run as the offloaded work.  The update
and cleanup loops were refactored to do as little locking of the
maintenance lock as possible for the shortest periods of time and the db
iterator is being paused for every iteration, so we don't hold the rbtdb
tree lock for prolonged periods of time.

(cherry picked from commit f106d0ed2b)
2023-02-13 11:41:52 +00:00
Ondřej SurýandAram Sargsyan bb6029db64 Refactor the dns_rpz_add/delete to use local rpz copy
Previously dns_rpz_add() were passed dns_rpz_zones_t and index to .zones
array.  Because we actually attach to dns_rpz_zone_t, we should be using
the local pointer instead of passing the index and "finding" the
dns_rpz_zone_t again.

Additionally, dns_rpz_add() and dns_rpz_delete() were used only inside
rpz.c, so make them static.

(cherry picked from commit b6e885c97f)
2023-02-13 11:41:52 +00:00
Ondřej SurýandAram Sargsyan 74bd205177 General cleanup of dns_rpz implementation
Do a general cleanup of lib/dns/rpz.c style:

 * Removed deprecated and unused functions
 * Unified dns_rpz_zone_t naming to rpz
 * Unified dns_rpz_zones_t naming to rpzs
 * Add and use rpz_attach() and rpz_attach_rpzs() functions
 * Shuffled variables to be more local (cppcheck cleanup)

(cherry picked from commit 840179a247)
2023-02-13 11:41:52 +00:00
Ondřej Surý d726d3eeaf Merge branch 'pspacek/make-manin-on-dist-v9_18' into 'v9_18'
[9.18] Remove pregenerated manpages from the repo

See merge request isc-projects/bind9!7517
2023-02-10 11:36:43 +00:00
Ondřej Surý aa996e48b5 Test the pre-generated man pages in GitLab CI
Add an extra job for a build from tarball, but without sphinx-build and
enable RUN_MAKE_INSTALL to check that man pages were generated and
installed.

Disable the RUN_MAKE_INSTALL on the systems without sphinx-build (sid).

(cherry picked from commit 8f2e1e15cc)
2023-02-10 12:05:52 +01:00
Petr ŠpačekandOndřej Surý 596c6f4cf7 Remove pregenerated manpages from the repo
We don't need them in the repo, it's sufficient if we pregenerate them
while preparing the tarball.  That way we don't have overhead while
modifying them but they are still available for installations without
Sphinx.

I assume that this will make rebases and cherry-picks across branches
easier, with less trial and error churn required in the CI.

It's implemented in the way that we build the manpages only when we
either have pregenerated pages available at the configure time or
sphinx-build is installed and working.

(cherry picked from commit 9110465194)
2023-02-10 12:03:56 +01:00
Michał Kępień 44c3f4e249 Merge branch '3840-avoid-libuv-with-broken-recvmmsg-v9_18' into 'v9_18'
[9.18] Avoid libuv 1.35 and 1.36 that have broken recvmmsg implementation

See merge request isc-projects/bind9!7482
2023-02-09 21:38:47 +00:00
Ondřej SurýandMichał Kępień ac7d195859 Add CHANGES and release note for [GL #3840]
(cherry picked from commit 6fa48c963e)
2023-02-09 22:10:46 +01:00
Ondřej SurýandMichał Kępień 8d103f7bbc Enforce version drift limits for libuv
libuv support for receiving multiple UDP messages in a single system
call (recvmmsg()) has been tweaked several times between libuv versions
1.35.0 and 1.40.0.  Mixing and matching libuv versions within that span
may lead to assertion failures and is therefore considered harmful, so
try to limit potential damage be preventing users from mixing libuv
versions with distinct sets of recvmmsg()-related flags.

(cherry picked from commit 735d09bffe)
2023-02-09 22:10:46 +01:00
Ondřej SurýandMichał Kępień 3368e5f231 Avoid libuv 1.35 and 1.36 that have broken recvmmsg implementation
The implementation of UDP recvmmsg in libuv 1.35 and 1.36 is
incomplete and could cause assertion failure under certain
circumstances.

Modify the configure and runtime checks to report a fatal error when
trying to compile or run with the affected versions.

(cherry picked from commit 251f411fc3)
2023-02-09 22:10:46 +01:00
Evan Hunt f560541efe Merge branch 'each-remove-bind9-refvar-v9_18' into 'v9_18'
[9.18] Merge branch 'each-remove-bind9-refvar' into 'main'

See merge request isc-projects/bind9!7513
2023-02-09 18:34:13 +00:00
Evan Hunt 342286ecdb remove isc_bind9 variable
isc_bind9 was a global bool used to indicate whether the library
was being used internally by BIND or by an external caller. external
use is no longer supported, but the variable was retained for use
by dyndb, which needed it only when being built without libtool.
building without libtool is *also* no longer supported, so the variable
can go away.

(cherry picked from commit 935879ed11)
2023-02-09 10:07:39 -08:00
Mark Andrews e67adfb479 Merge branch '3857-notify-source-port-test-is-not-reliable-v9_18' into 'v9_18'
[9.18] Resolve "Notify source port test is not reliable"

See merge request isc-projects/bind9!7510
2023-02-09 09:36:47 +00:00
Mark Andrews 7ca00e674f Make notify source port test reliable
Send the test message from ns3 to ns2 instead of ns2 to ns3 as ns2
is started first and therefore the test doesn't have to wait on the
resend of the the NOTIFY message to be successful.

(cherry picked from commit e7e1f59a3a)
2023-02-09 19:40:19 +11:00
Mark Andrews c843811609 Merge branch '3831-dnssec-cds-failed-to-cleanup-properly-on-some-non-error-paths-v9_18' into 'v9_18'
[9.18] Resolve "dnssec-cds failed to cleanup properly on some non error paths"

See merge request isc-projects/bind9!7507
2023-02-09 00:36:14 +00:00
Mark Andrews ef2c69bf71 Add CHANGES note for [GL #3831]
(cherry picked from commit ae26fcb8f5)
2023-02-09 09:00:52 +11:00
Mark Andrews 66a3802507 dnssec-checkds: cleanup memory on error paths
Move and give unique names to the dns_db_t, dns_dbnode_t and
dns_dbversion_t pointers, so they have global scope and therefore
are visible to cleanup.  Unique names are not strictly necessary,
as none of the functions involved call each other.

Change free_db to handle NULL pointers and also an optional
(dns_dbversion_t **).

In match_keyset_dsset and free_keytable, ki to be handled
differently to prevent a false positive NULL pointer dereference
warning from scan.

In formatset moved dns_master_styledestroy earlier and freed
buf before calling check_result to prevent memory leak.

In append_new_ds_set freed ds on the default path before
calling check_result to prevent memory leak.

(cherry picked from commit 13f9d29954)
2023-02-09 09:00:28 +11:00
Mark Andrews af051282bc dnssec-cds failed to cleanup on non error paths
dnssec-cds failed to cleanup on non error paths which meant that
the OpenSSL libraries could not cleanup properly.

(cherry picked from commit 81bde388e4)
2023-02-09 08:58:15 +11:00
Mark Andrews 4fd22a2228 Define DNS_RDATASET_INIT for static initialisation
(cherry picked from commit ddc4d1fca4)
2023-02-09 08:58:15 +11:00
Evan Hunt a3bcab9105 Merge branch '3113-clientinfo-refactor-v9_18' into 'v9_18'
[9.18] Merge branch '3113-clientinfo-refactor' into 'main'

See merge request isc-projects/bind9!7504
2023-02-08 08:49:29 +00:00
Evan Hunt 9f1c6d9744 refactor dns_clientinfo_init(); use separate function to set ECS
Instead of using an extra rarely-used paramater to dns_clientinfo_init()
to set ECS information for a client, this commit adds a function
dns_clientinfo_setecs() which can be called only when ECS is needed.

(cherry picked from commit ff3fdaa424)
2023-02-08 00:13:12 -08:00
Evan Hunt 32623be328 Merge branch '3846-nsupdate-test-fix-v9_18' into 'v9_18'
[9.18] Merge branch '3846-nsupdate-test-fix' into 'main'

See merge request isc-projects/bind9!7503
2023-02-08 07:47:15 +00:00
Evan Hunt 1d6721c5fa increase simultaneous updates for quota test
the nsupdate system test was intermittently failing due to the update
quota not being exceeded when it should have been.  this is most likely
a timing issue: the client is sending updates too slowly, or the server
is processing them too quickly, for the quota to fill. this commit
attempts to make that the failure less likely by increasing the number
of update transactions from 10 to 20.

(cherry picked from commit 06b1faf068)
2023-02-07 23:41:24 -08:00
Evan Hunt 52d9ce038b Merge branch '854-spurious-keytype-warning-v9_18' into 'v9_18'
[9.18] Merge branch '854-spurious-keytype-warning' into 'main'

See merge request isc-projects/bind9!7502
2023-02-08 07:34:56 +00:00
Evan Hunt bc3be6dc29 silence a spurious warning during key generation
when generating a key, if a DH key already existed for the same
name, a spurious warning message was generated saying "bad key
type". this is fixed.

(cherry picked from commit 82503bec99)
2023-02-07 23:30:24 -08:00
Mark Andrews 34009f3d78 Merge branch '3852-follow-up-from-9-18-merge-branch-3790-use-configured-udp-port-into-main-v9_18' into 'v9_18'
[9.18] Allow some time to the root trust anchor to appear

See merge request isc-projects/bind9!7498
2023-02-07 22:24:05 +00:00
Mark Andrews 11065c810a Allow some time to the root trust anchor to appear
Following deleting the root trust anchor and reconfiguring the
server it takes some time to for trust anchor to appear in 'rndc
managed-keys status' output.  Retry several times.

(cherry picked from commit 71dbd09796)
2023-02-08 00:42:15 +11:00
Michal Nowak ed2f4c3a7c Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.18.13' into 'v9_18'
Set up release notes for BIND 9.18.13

See merge request isc-projects/bind9!7496
2023-02-07 10:26:25 +00:00
Michal Nowak f8d168ecf3 Set up release notes for BIND 9.18.13 2023-02-07 11:16:28 +01:00
Michal Nowak 226e35887f Update BIND version to 9.18.13-dev 2023-02-07 11:12:21 +01:00
Evan Hunt 84801fe25f Merge branch '3790-use-configured-udp-port-v9_18' into 'v9_18'
[9.18] Merge branch '3790-use-configured-udp-port' into 'main'

See merge request isc-projects/bind9!7491
2023-02-07 01:19:30 +00:00
Evan Hunt 282f44d329 CHANGES for [GL #3790]
(cherry picked from commit 4f50854e7a)
2023-02-06 17:02:02 -08:00
Evan Hunt 29ccc052dd add source port configuration tests
check in the log files of receiving servers that the originating
ports for notify and SOA query messages were set correctly from
configured notify-source and transfer-source options.

(cherry picked from commit 9cffd5c431)
2023-02-06 17:02:02 -08:00
Evan Hunt 5508e25376 use configured source ports for UDP requests
the optional 'port' option, when used with notify-source,
transfer-source, etc, is used to set up UDP dispatches with a
particular source port, but when the actual UDP connection was
established the port would be overridden with a random one. this
has been fixed.

(configuring source ports is deprecated in 9.20 and slated for
removal in 9.22, but should still work correctly until then.)

(cherry picked from commit 4d50c912ba)
2023-02-06 17:02:02 -08:00
Mark Andrews 797c665c25 Merge branch '3838-named-rrchecker-should-cleanup-when-it-detects-an-error-v9_18' into 'v9_18'
[9.18] named-rrchecker: have fatal cleanup

See merge request isc-projects/bind9!7492
2023-02-07 00:59:26 +00:00
Mark Andrews c705467d30 named-rrchecker: have fatal cleanup
It is trivial to fully cleanup memory on all the error paths in
named-rrchecker, many of which are triggered by bad user input.
This involves freeing lex and mctx if they exist when fatal is
called.

(cherry picked from commit dbe82813e6)
2023-02-07 11:15:21 +11:00
Evan Hunt ab6c0a7d7a Merge branch '3673-delay-trust-anchor-management-v9_18' into 'v9_18'
[9.18] delay trust anchor management until zones are loaded

See merge request isc-projects/bind9!7489
2023-02-06 22:30:34 +00:00
Evan Hunt ac150939d5 delay trust anchor management until zones are loaded
it was possible for a managed trust anchor needing to send a key
refresh query to be unable to do so because an authoritative zone
was not yet loaded. this has been corrected by delaying the
synchronization of managed-keys zones until after all zones are
loaded.

(cherry-picked from commit bafbbd2465)
2023-02-06 14:27:16 -08:00
Michal Nowak 99783f9a5e Update BIND version for release 2023-02-03 12:19:48 +01:00
Michal Nowak 5274f62e2a Add a CHANGES marker 2023-02-03 12:19:22 +01:00
Michal Nowak ad861b90ee Merge branch 'michal/prepare-documentation-for-bind-9.18.12' into 'v9_18_12-release'
Prepare documentation for BIND 9.18.12

See merge request isc-private/bind9!496
2023-02-03 11:17:14 +00:00
Michał Kępień 6b77e577d4 Add release note for GL #3827 2023-02-03 10:00:20 +01:00
Michał Kępień 2e1fcbd1b9 Tweak and reword release notes 2023-02-03 10:00:20 +01:00
Michał Kępień 2b9fbddf91 Prepare release notes for BIND 9.18.12 2023-02-03 10:00:20 +01:00
Tom KrizekandMichał Kępień c8b4ca8e3a Update docs to reflect 9.18 has become ESV 2023-02-03 10:00:20 +01:00
Michał Kępień 60124f85bd Merge branch '3781-deprecate-source-port-v9_18' into 'v9_18'
[9.18] mark "port" as deprecated for source address options

See merge request isc-projects/bind9!7478
2023-02-02 11:58:57 +00:00
Evan HuntandMichał Kępień 4cb762a10d CHANGES and release note for [GL #3781]
(cherry picked from commit 22d1951aa6)
2023-02-02 12:21:08 +01:00
Matthijs MekkingandMichał Kępień 64f5e83ef4 Test deprecate source port configuration
Add 'port' token to deprecated.conf. Also add options
'use-v4-udp-ports', 'use-v6-udp-ports', 'avoid-v4-udp-ports',
and 'avoid-v6-udp-ports'.

All of these should trigger warnings (except when deprecation warnings
are being ignored).

(cherry picked from commit 531914e660)
2023-02-02 12:21:08 +01:00
Evan HuntandMichał Kępień 5fa4aa2fec mark "port" as deprecated for source address options
Deprecate the use of "port" when configuring query-source(-v6),
transfer-source(-v6), notify-source(-v6), parental-source(-v6),
etc. Also deprecate use-{v4,v6}-udp-ports and avoid-{v4,v6}udp-ports.

(cherry picked from commit 470ccbc8ed)
2023-02-02 12:21:08 +01:00
Michał Kępień 5a14d4b015 Merge branch '3827-fix-dnsrps-builds-v9_18' into 'v9_18'
[9.18] Fix DNSRPS builds

See merge request isc-projects/bind9!7474
2023-02-01 10:54:46 +00:00
Michał Kępień 19bac062ad Add CHANGES entry for GL #3827
(cherry picked from commit 493eadd1ae)
2023-02-01 11:26:31 +01:00
Michał Kępień 41743a3061 Handle iterator options in rpsdb_allrdatasets()
Commit 6f998bbe51 added a new parameter,
'options', to the prototype of the 'allrdatasets' function pointer in
struct dns_dbmethods.  Handle this new parameter accordingly in
rpsdb_allrdatasets().

(cherry picked from commit f3def4e4ed)
2023-02-01 11:26:31 +01:00
Michał Kępień ef97bf534d Add DNSRPS builds to pairwise testing
The --enable-dnsrps-dl switch for ./configure enables preparing a
DNSRPS-enabled build of BIND 9 that is not directly linked against a
DNSRPS provider library (dlopen() at runtime is used instead).  Employ
this switch to test DNSRPS-enabled builds in the pairwise testing job in
GitLab CI.

(cherry picked from commit e688ca5316)
2023-02-01 11:26:31 +01:00
Mark Andrews feb6f768de Merge branch '3828-fuzz-dns_message_checksig-c-fails-to-call-dst_lib_destroy-v9_18' into 'v9_18'
[9.18] Call dst_lib_destroy if we have called dst_lib_init

See merge request isc-projects/bind9!7460
2023-01-31 22:15:26 +00:00
Mark Andrews 4666c2b0b2 Add CHANGES for [GL #3828]
(cherry picked from commit 13e0dfbae2)
2023-02-01 01:37:04 +11:00
Mark Andrews 0e89e18c4f Call dst_lib_destroy if we have called dst_lib_init
This returns BIGNUMs to OpenSSL allowing libcrypto to fully clean up.

(cherry picked from commit 897e0cd6f4)
2023-02-01 01:37:04 +11:00
Mark Andrews f56de96934 Merge branch '3830-nsupdate-failed-to-handle-primary-server-address-lookup-gracefully-v9_18' into 'v9_18'
[9.18] Handle address lookup failure more gracefully

See merge request isc-projects/bind9!7458
2023-01-31 14:34:26 +00:00
Mark Andrews 819ee39129 Add CHANGES for [GL #3830]
(cherry picked from commit fda7858e74)
2023-02-01 00:36:42 +11:00
Mark Andrews e0090d4639 Handle address lookup failure more gracefully
If the address lookup of the primary server fails just abort
the current update request rather than calling exit.  This allows
nsupdate to cleanup gracefully.

(cherry picked from commit f1387514c6)
2023-02-01 00:36:42 +11:00
Mark Andrews 5e6093210a Merge branch '3829-named-v-leaks-memory-when-shutting-down-v9_18' into 'v9_18'
[9.18] Call dns_lib_destroy in bin/named/main.c:printversion

See merge request isc-projects/bind9!7454
2023-01-30 23:32:47 +00:00
Mark Andrews caaf6a7594 Add CHANGES for [GL #3829]
(cherry picked from commit 1d258e2fb8)
2023-01-31 10:06:02 +11:00
Mark Andrews 4263afa31d Call dns_lib_destroy in bin/named/main.c:printversion
There were unbalanced calls to dns_lib_init and dns_lib_destroy
leading to an OpenSSL memory leak.

(cherry picked from commit 8b3c018f54)
2023-01-31 10:06:02 +11:00
Ondřej Surý 198615faad Merge branch '3806-give-ADB-heap-memory-context-a-name-v9_18' into 'v9_18'
[9.18] Properly name ADB hashmap memory context

See merge request isc-projects/bind9!7448
2023-01-30 11:57:38 +00:00
Ondřej Surý a25e41da02 Properly name ADB hashmap and named log memory contexts
The ADB hashmaps are stored in extra memory contexts, so the hash
tables are excluded from the overmem accounting.  The new memory
context was unnamed, give it a proper name.

Same thing has happened with extra memory context used for named
global log context - give the extra memory context a proper name.

(cherry picked from commit 3cda9f9f14)
2023-01-30 12:38:13 +01:00
Matthijs Mekking dcaf8d99c3 Merge branch '3822-rndc-dnssec-checkds-force-ds-state-v9_18' into 'v9_18'
[9.18] Force set DS state after 'rndc dnssec -checkds'

See merge request isc-projects/bind9!7437
2023-01-30 10:48:21 +00:00
Matthijs Mekking 7b69792cf7 Add CHANGES for #3822
(cherry picked from commit 38ffe5acf3)
2023-01-30 09:27:38 +01:00
Matthijs Mekking 68f0fc6309 Force set DS state after 'rndc dnssec -checkds'
Set the DS state after issuing 'rndc dnssec -checkds'. If the DS
was published, it should go in RUMOURED state, regardless whether it
is already safe to do so according to the state machine.

Leaving it in HIDDEN (or if it was magically already in OMNIPRESENT or
UNRETENTIVE) would allow for easy shoot in the foot situations.

Similar, if the DS was withdrawn, the state should be set to
UNRETENTIVE. Leaving it in OMNIPRESENT (or RUMOURED/HIDDEN)
would also allow for easy shoot in the foot situations.

(cherry picked from commit ee42f66fbe)
2023-01-30 09:27:38 +01:00
Mark Andrews 699d185176 Merge branch '3824-teach-danger-about-amend-v9_18' into 'v9_18'
[9.18] Teach danger about amend

See merge request isc-projects/bind9!7439
2023-01-27 22:58:03 +00:00
Mark Andrews 8a6b78f810 Teach danger about amend
commit --fixup=amend:<hash> produces a subject starting with amend!
by default.  Have danger look for this to ensure that it is squashed
before merging.

(cherry picked from commit 9b12473292)
2023-01-28 09:18:20 +11:00
Tom Krizek c8232051a6 Merge branch 'tkrizek/danger-improvements-v9_18' into 'v9_18'
[9.18] danger: refine existing rules

See merge request isc-projects/bind9!7435
2023-01-27 13:51:23 +00:00
Tom Krizek 11f07ca582 danger: relax rules for single-line commits
The following are not also accepted as single-line commits without
generating warnings:
- CHANGES/release note may appear in the beginning of the commit message
- Release note may be capitalized
- Allow commits with "GL #" (e.g. Update documentation for [GL #XXXX])

(cherry picked from commit 79ae467973)
2023-01-27 14:49:29 +01:00
Tom Krizek bc1bc38731 danger: update CHANGES rule to work with -S edition
When updating the -S edition, the CHANGES.SE file is modified. Make sure
danger accepts that.

(cherry picked from commit 1939e585c0)
2023-01-27 14:49:25 +01:00
Michał Kępień e819d4f966 Merge branch 'michal/extend-artifact-lifetime-for-release-related-jobs-v9_18' into 'v9_18'
[9.18] Extend artifact lifetime for release-related jobs

See merge request isc-projects/bind9!7433
2023-01-27 12:31:33 +00:00
Michał Kępień f99dd245fa Extend artifact lifetime for release-related jobs
Artifacts of the "stress" jobs in GitLab CI are used for generating the
QA summary for a given set of releases.  It happened in the past that
these artifacts were purged before the QA summary was prepared,
unnecessarily prolonging the release process.  A complete set of
artifacts from all such jobs for a single pipeline should be less than 1
GB in size, so extend their lifetime from one day to one week as a more
reasonable compromise between availability and disk space usage.  (Note:
these jobs are also run in scheduled pipelines, but that is expected to
be acceptable in the context of artifact lifetime.)

Artifacts of the "release" jobs in GitLab CI are what we eventually
publish on the FTP server.  It happened in the past that these artifacts
were purged before we copied them to their destination, unnecessarily
prolonging the release process, even though we usually press the "Keep"
button for the "release" jobs manually to keep them around indefinitely
(as they are the source of what we publish in other places).  Since
there is only one "release" job per tag pipeline and its artifacts only
take up tens of megabytes of space, keep the artifacts of the "release"
jobs around indefinitely by default.

(cherry picked from commit 71c9d69145)
2023-01-27 13:29:18 +01:00
Michał Kępień 8b4dcc27ef Merge tag 'v9_18_11' into v9_18
BIND 9.18.11
2023-01-25 21:26:22 +01:00
Artem Boldariev 245e4fd441 Merge branch 'artem-cookie-use-reuseport-socket-option-in-python-mock-server-v9-18' into 'v9_18'
[9.18] Use SO_REUSEADDR for "ans9" mock server in "cookie" system test

See merge request isc-projects/bind9!7421
2023-01-24 17:55:02 +00:00
Artem Boldariev f408cacd86 Use SO_REUSEADDR for "ans9" mock server in "cookie" system test
This commit ensures that it is possible to run the 'cookie' test
multiple times in a row.

(cherry picked from commit 8fdf7bad76)
2023-01-24 16:05:46 +02:00
Artem Boldariev b8c0b64995 Merge branch 'artem-fix-building-on-dragonflybsd-v9-18' into 'v9_18'
[9.18]Fix building BIND on DragonFly BSD

See merge request isc-projects/bind9!7416
2023-01-19 23:43:36 +00:00
Artem Boldariev cb9f8c08d5 Fix building BIND on DragonFly BSD (on both older an newer versions)
This commit ensures that BIND and supplementary tools still can be
built on newer versions of DragonFly BSD. It used to be the case, but
somewhere between versions 6.2 and 6.4 the OS developers rearranged
headers and moved some function definitions around.

Before that the fact that it worked was more like a coincidence, this
time we, at least, looked at the related man pages included with the
OS.

No in depth testing has been done on this OS as we do not really
support this platform - so it is more like a goodwill act. We can,
however, use this platform for testing purposes, too. Also, we know
that the OS users do use BIND, as it is included in its ports
directory.

Building with './configure' and './configure --without-jemalloc' have
been fixed and are known to work at the time the commit is made.

(cherry picked from commit 942569a1bb)
2023-01-20 00:56:16 +02:00
Matthijs Mekking d47890f3c8 Merge branch '3783-parental-ds-requests-need-rd-bit-set-v9_18' into 'v9_18'
[9.18] Set RD=1 on DS requests to parental-agents

See merge request isc-projects/bind9!7411
2023-01-19 15:57:35 +00:00
Matthijs Mekking 8ab8918c64 Add CHANGES and release note for GL #3783
News worthy.

(cherry picked from commit dbbacd910f)
2023-01-19 16:56:39 +01:00
Matthijs Mekking 89089817d3 Set RD bit on checkds requests
It is allowed to point parental-agents to a resolver. Therefore, the
RD bit should be set on requests.

Upon receiving a DS response, ensure that the message has either the
AA or the RA bit set.

(cherry picked from commit e34722ed43)
2023-01-19 16:56:22 +01:00
Matthijs Mekking 7ce0f7fb9e Add checkds test case with resolver parental-agent
Add a test case for a server that uses a resolver as an parental-agent.

We need two root servers, ns1 and ns10, one that delegates to the
'checkds' tld with the DS published (ns2), and one that delegates to
the 'checkds' tld with the DS removed (ns5). Both root zones are
being setup in the 'ns1/setup.sh' script.

We also need two resolvers, ns3 and ns8, that use different root hints
(one uses ns1 address as a hint, the other uses ns10).

Then add the checks to test_checkds.py is similar to the existing tests.

Update 'types' because for zones that have the DS withdrawn (or to be
withdrawn), the CDS and CDNSKEY records should not be published and
thus should not be in the NSEC bitmap.

(cherry picked from commit 0b9a9f9955)
2023-01-19 16:56:22 +01:00
Mark Andrews 5e8be202e9 Merge branch '3799-tsan-race-between-dns_rbtnode_t-bitfields-v9_18' into 'v9_18'
[9.18] Add missing node lock when setting node->wild in rbtdb.c

See merge request isc-projects/bind9!7414
2023-01-19 14:24:37 +00:00
Mark Andrews ee5da17e13 Add CHANGES for [GL #3799]
(cherry picked from commit 5c471c5d2c)
2023-01-20 00:47:51 +11:00
Mark Andrews 4508b0a1e2 Add missing node lock when setting node->wild in rbtdb.c
The write node lock needs to be held when setting node->wild in
add_wildcard_magic except when being called from loading_addrdataset
which is used to load the zone without locking during its initial
load.

(cherry picked from commit 81c24b8da2)
2023-01-20 00:46:24 +11:00
Arаm Sаrgsyаn feed44fd51 Merge branch '3808-refactor-isc_nm_xfr_allowed-v9_18' into 'v9_18'
[9.18] Refactor isc_nm_xfr_allowed()

See merge request isc-projects/bind9!7413
2023-01-19 13:37:24 +00:00
Aram Sargsyan 969811fc77 Add a CHANGES note for [GL #3808]
(cherry picked from commit 5a1707aa8d)
2023-01-19 12:20:10 +00:00
Aram Sargsyan 8f209c7dcf Refactor isc_nm_xfr_allowed()
Return 'isc_result_t' type value instead of 'bool' to indicate
the actual failure. Rename the function to something not suggesting
a boolean type result. Make changes in the places where the API
function is being used to check for the result code instead of
a boolean value.

(cherry picked from commit 41dc48bfd7)
2023-01-19 12:20:10 +00:00
Ondřej Surý 1f6d54d1fb Merge branch '3801-reduce-memory-bloat-caused-by-delayed-view-detach-lock-order-inversion-v9_18' into 'v9_18'
[9.18] Detach the zone views outside of the zone lock

See merge request isc-projects/bind9!7408
2023-01-19 10:00:49 +00:00
Ondřej Surý 3d3c8a935a Detach the zone views outside of the zone lock
Detaching the views in the zone_shutdown() could lead to
lock-order-inversion between adb->namelocks[bucket], adb->lock,
view->lock and zone->lock.  Detach the views outside of the section that
zone-locked.

(cherry picked from commit 978a0ef84c)
2023-01-19 10:21:19 +01:00
Ondřej Surý 579f3b66f1 Merge branch 'ondrej/replace-lgtm-with-codeql-add-python-ply-v9_18' into 'v9_18'
[9.18] Add python3-ply for ./configure to succeed on BIND 9.16 branch

See merge request isc-projects/bind9!7406
2023-01-19 09:16:37 +00:00
Ondřej Surý a393573300 Add python3-ply to GitHub CodeQL configuration
BIND 9.16 needs Python and PLY packages for configure to succeed.
Unless we want to tweak the build script to exclude python, we need to
add python3-ply package to the CodeQL configuration.

(cherry picked from commit 0622d11366)
2023-01-19 10:12:04 +01:00
Ondřej Surý ba1460407d Merge branch 'ondrej/replace-lgtm-with-codeql-v9_18' into 'v9_18'
[9.18] Add CodeQL GitHub Action

See merge request isc-projects/bind9!7403
2023-01-19 08:46:43 +00:00
Ondřej Surý fd8fe4ba4e Add CodeQL GitHub Action
Replace the decommissioned LGTM service with CodeQL GitHub action.

(cherry picked from commit 77abe612a1)
2023-01-19 08:46:36 +00:00
Ondřej Surý adfa48ed39 Merge branch '3795-speed-up-EVP_DigestInit_ex-v9_18' into 'v9_18'
[9.18] Avoid implicit algorithm fetch for OpenSSL EVP_MD family

See merge request isc-projects/bind9!7398
2023-01-18 23:33:53 +00:00
Ondřej Surý 9679417cfa Add CHANGES and release note for [GL #3795]
(cherry picked from commit 401294cf60)
2023-01-19 00:33:37 +01:00
Ondřej Surý bf1a29e9e1 Use OpenSSL 1.x SHA_CTX API in isc_iterated_hash()
If the OpenSSL SHA1_{Init,Update,Final} API is still available, use it.
The API has been deprecated in OpenSSL 3.0, but it is significantly
faster than EVP_MD API, so make an exception here and keep using it
until we can't.

(cherry picked from commit 25db8d0103)
2023-01-19 00:33:37 +01:00
Ondřej Surý a1dcbcab8d Use OpenSSL EVP_MD API directly in isc_iterated_hash()
Instead of going through another layer, use OpenSSL EVP_MD API directly
in the isc_iterated_hash() implementation.  This shaves off couple of
microseconds in the microbenchmark.

(cherry picked from commit 36654df732)
2023-01-19 00:32:51 +01:00
Ondřej Surý cb4453faef Merge branch '3252-repair-isc_task_purgeevent-v9_18' into 'v9_18'
[9.18] Keep the list of scheduled events on the timer

See merge request isc-projects/bind9!7396
2023-01-18 23:32:35 +00:00
Ondřej Surý a7e8e43829 Add CHANGES note for [GL #3252]
(cherry picked from commit a7cd0868a2)
2023-01-18 22:39:26 +01:00
Mark AndrewsandOndřej Surý 80a052aaf6 Unlink the timer event before trying to purge it
as far as I can determine the order of operations is not important.

    *** CID 351372:  Concurrent data access violations  (ATOMICITY)
    /lib/isc/timer.c: 227 in timer_purge()
    221     		LOCK(&timer->lock);
    222     		if (!purged) {
    223     			/*
    224     			 * The event has already been executed, but not
    225     			 * yet destroyed.
    226     			 */
    >>>     CID 351372:  Concurrent data access violations  (ATOMICITY)
    >>>     Using an unreliable value of "event" inside the second locked section. If the data that "event" depends on was changed by another thread, this use might be incorrect.
    227     			timerevent_unlink(timer, event);
    228     		}
    229     	}
    230     }
    231
    232     void

(cherry picked from commit 98718b3b4b)
2023-01-18 22:39:26 +01:00
Ondřej Surý e26aa4cbb1 Don't use reference counting in isc_timer unit
The reference counting and isc_timer_attach()/isc_timer_detach()
semantic are actually misleading because it cannot be used under normal
conditions.  The usual conditions under which is timer used uses the
object where timer is used as argument to the "timer" itself.  This
means that when the caller is using `isc_timer_detach()` it needs the
timer to stop and the isc_timer_detach() does that only if this would be
the last reference.  Unfortunately, this also means that if the timer is
attached elsewhere and the timer is fired it will most likely be
use-after-free, because the object used in the timer no longer exists.

Remove the reference counting from the isc_timer unit, remove
isc_timer_attach() function and rename isc_timer_detach() to
isc_timer_destroy() to better reflect how the API needs to be used.

The only caveat is that the already executed event must be destroyed
before the isc_timer_destroy() is called because the timer is no longet
attached to .ev_destroy_arg.

(cherry picked from commit ae01ec2823)
2023-01-18 22:39:26 +01:00
Ondřej Surý 7197cf2b7e Remove isc_task_purge() and isc_task_purgerange()
The isc_task_purge() and isc_task_purgerange() were now unused, so sweep
the task.c file.  Additionally remove unused ISC_EVENTATTR_NOPURGE event
attribute.

(cherry picked from commit c17eee034b)
2023-01-18 22:06:24 +01:00
Ondřej Surý a7055b01af Set quantum to infinity for the zone loading task
When we are loading the zones, set the quantum to UINT_MAX, which makes
task_run process all tasks at once.  After the zone loading is finished
the quantum will be dropped to 1 to not block server when we are loading
new zones after reconfiguration.

(cherry picked from commit 87c4c24cde)
2023-01-18 18:04:41 +01:00
Ondřej Surý 68abe3fa06 Add isc_task_setquantum() and use it for post-init zone loading
Add isc_task_setquantum() function that modifies quantum for the future
isc_task_run() invocations.

NOTE: The current isc_task_run() caches the task->quantum into a local
variable and therefore the current event loop is not affected by any
quantum change.

(cherry picked from commit 15ea6f002f)
2023-01-18 18:04:41 +01:00
Ondřej Surý 5f141e2c7f Keep the list of scheduled events on the timer
Instead of searching for the events to purge, keep the list of scheduled
events on the timer list and purge the events that we have scheduled.

(cherry picked from commit 3f8024b4a2f12fcd28a9dd813b6f1f3f11d506f2)
2023-01-18 18:04:41 +01:00
Ondřej Surý be99507488 Repair isc_task_purgeevent(), clean isc_task_unsend{,range}()
The isc_task_purgerange() was walking through all events on the task to
find a matching task.  Instead use the ISC_LINK_LINKED to find whether
the event is active.

Cleanup the related isc_task_unsend() and isc_task_unsendrange()
functions that were not used anywhere.

(cherry picked from commit 17aed2f895)
2023-01-18 18:04:41 +01:00
Ondřej Surý 29bc0daed1 Merge branch '3801-reduce-memory-bloat-caused-by-delayed-view-detach-v9_18' into 'v9_18'
[9.18] Detach the views in zone_shutdown(), not in zone_free()

See merge request isc-projects/bind9!7388
2023-01-17 22:17:29 +00:00
Ondřej Surý b4357fab6f Add CHANGES and release note for [GL #3801]
(cherry picked from commit b049e329ef)
2023-01-17 22:47:44 +01:00
Ondřej Surý fe0e9cf301 Commit the change of view for view->managed_keys
When we change the view in the view->managed_keys, we never commit the
change, keeping the previous view possibly attached forever.

Call the dns_zone_setviewcommit() immediately after changing the view as
we are detaching the previous view anyway and there's no way to recover
from that.

(cherry picked from commit 7e8b53720d)
2023-01-17 22:47:44 +01:00
Ondřej Surý f8b7188a42 Detach the views in zone_shutdown(), not in zone_free()
The .view (and possibly .prev_view) would be kept attached to the
removed zone until the zone is fully removed from the memory in
zone_free().  If this process is delayed because server is busy
something else like doing constant `rndc reconfig`, it could take
seconds to detach the view, possibly keeping multiple dead views in the
memory.  This could quickly lead to a massive memory bloat.

Release the views early in the zone_shutdown() call, and don't wait
until the zone is freed.

(cherry picked from commit 13bb821280)
2023-01-17 22:47:43 +01:00
Artem Boldariev 5d41338e9c Merge branch '3767-dot-no-alpn-transfer-shutdown-crash-v9-18' into 'v9_18'
[9.18](backport )XoT: properly handle the case when checking for ALPN failed

See merge request isc-projects/bind9!7387
2023-01-17 19:53:54 +00:00
Artem Boldariev 26c0dd96eb Modify CHANGES [GL #3767]
Mention that downloading a zone via TLS- from a server which does not
negotiate "dot" ALPN tag could have crashed BIND on shutdown.

(cherry picked from commit 16fa692b56)
2023-01-17 21:29:38 +02:00
Artem Boldariev dbd15f962e XoT: properly handle the case when checking for ALPN failed
During XoT it is important to check for "dot" ALPN tag to be
negotiated (according to the RFC 9103). We were doing that, however, the
situation was not handled properly, leading to non-cancelled zone
transfers that would crash (abort()) BIND on shutdown.

In this particular case 'result' might equal 'ISC_R_SUCCESS'. When
this is the case, the part of the code supposed to handle failures
will not cancel the zone transfer.

This situation cannot happen when BIND is a secondary of other BIND
instance. Only primaries following the RFC not closely enough could
trigger such a behaviour.

(cherry picked from commit 34a1aab1cb)
2023-01-17 21:27:44 +02:00
Tom Krizek ed23fd4b1f Merge branch '3804-fix-feature-detection-in-pytests-v9_18' into 'v9_18'
[9.18] Fix feature detection for pytest markers in tests

See merge request isc-projects/bind9!7385
2023-01-17 14:29:50 +00:00
Tom Krizek 58ff3b4fc0 Fix feature detection for pytest markers in tests
The condition was accidentally reversed during refactoring in
9730ac4c56 . It would result in skipped
tests on builds with proper support and false negatives on builds
without proper feature support.

Credit for reporting the issue and the fix goes to Stanislav Levin.

(cherry picked from commit 473cb530f4)
2023-01-17 14:50:23 +01:00
Ondřej Surý aee89c3454 Merge branch 'cherry-pick-d7bcdf8b' into 'v9_18'
[9.18] Merge branch 'feature/main/zt-rwlock.h' into 'main'

See merge request isc-projects/bind9!7377
2023-01-16 11:09:55 +00:00
Ondřej Surý c5c432a36a Merge branch 'feature/main/zt-rwlock.h' into 'main'
Include isc_rwlocktype_t type definition in zt.h

See merge request isc-projects/bind9!7376

(cherry picked from commit d7bcdf8bd6)

395d6fca Include isc_rwlocktype_t type definition in zt.h
2023-01-16 11:07:19 +00:00
Tom Krizek 0d0c2e466b Merge branch 'tkrizek/system-tests-pytest-prep-v9_18' into 'v9_18'
[9.18] Various tweaks of system test framework

See merge request isc-projects/bind9!7374
2023-01-16 09:42:30 +00:00
Tom Krizek f3c6217046 Update the TEST_PARALLEL_JOBS value in CI
The authoritative source for this value is in the project's CI/CD
Variables Setting. The reason to keep it in .gitlab-ci.yaml as well is
to have functional testing in forks without the need to manually specify
this variable in Settings.

The tests have been executed with 4 jobs for some time now. This
"change" only brings .gitlab-ci.yaml file up to date, it doesn't
actually change the number of jobs we currently use to test.

(cherry picked from commit 03d7b45d81)
2023-01-16 10:13:53 +01:00
Tom Krizek dd5f0d2c4c Tweak dupsigs test output
Use a different visual separator, since "====", "----" and "____" is
used by pytest to separate the log output.

(cherry picked from commit 9593ff9347)
2023-01-16 10:13:53 +01:00
Tom Krizek 8033857295 Look for ifconfig.sh.in in testsock.pl parent dir
Instead of using the current working directory to find the ifconfig.sh
script, look for the ifconfig.sh.in template in the directory where the
testsock.pl script is located. This enables the testsock.pl script to be
called from any working directory.

Using the ifconfig.sh.in template is sufficient, since it contains
the necessary information to be extracted: the max= value (which is
hard-coded in the template).

(cherry picked from commit e24d3b21d0)
2023-01-16 10:13:53 +01:00
Tom Krizek bcf1f5c808 Factor out script to handle system test core dumps
Move the core dump detection functionality for system test runs into a
separate script. This enables reuse by the pytest runner. The
functionality remains the same.

(cherry picked from commit d9a97200d5)
2023-01-16 10:13:53 +01:00
Tom Krizek db03296683 testcrypto.sh: run in TMPDIR if possible
Avoid creating any temporary files in the current workdir.

Additional/changing files in the bin/tests/system directory are
problematic for pytest/xdist collection phase, which assumes the list of
files doesn't change between the collection phase of the main pytest
thread and the subsequent collection phase of the xdist worker threads.

Since the testcrypto.sh is also called during pytest initialization
through conf.sh.common (to detect feature support), this could
occasionally cause a race condition when the list of files would be
different for the main pytest thread and the xdist worker.

(cherry picked from commit 61330a7863)
2023-01-16 10:13:51 +01:00
Michał Kępień 8b06de031e Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.12' into 'v9_18'
Set up version and release notes for BIND 9.18.12

See merge request isc-projects/bind9!7363
2023-01-13 14:47:07 +00:00
Michał Kępień b6d271a1af Set up release notes for BIND 9.18.12 2023-01-13 15:40:27 +01:00
Michał Kępień 6d89ad302b Update BIND version to 9.18.12-dev 2023-01-13 15:40:27 +01:00
Michał Kępień 1f554acee8 Update BIND version for release 2023-01-12 23:20:04 +01:00
Michał Kępień 703fefc88c Add a CHANGES marker 2023-01-12 23:20:04 +01:00
Michał Kępień 6515e69b9b Merge branch 'michal/prepare-documentation-for-bind-9.18.11' into 'security-v9_18'
Prepare documentation for BIND 9.18.11

See merge request isc-private/bind9!493
2023-01-12 22:18:44 +00:00
Michał Kępień 3b4a34ccb9 Remove reused CHANGES entry
Changes entry 6063 was added to the v9_18 branch (by commit
cb3990001f) without an associated
placeholder in the main branch.  The same entry number was subsequently
reused for a different change in the main branch (by commit
41870dccba).  To prevent confusion, remove
the entry from the v9_18 branch as the original code change whose
reversal is mentioned in entry 6063 was not accompanied by its own
CHANGES entry.
2023-01-12 22:11:14 +01:00
Michał Kępień c901270670 Add release note for GL #3678 2023-01-12 22:11:14 +01:00
Michał Kępień 3fcc021294 Reorder release notes 2023-01-12 22:11:14 +01:00
Michał Kępień 828d5d51d0 Tweak and reword release notes 2023-01-12 22:11:14 +01:00
Michał Kępień 166523fd61 Prepare release notes for BIND 9.18.11 2023-01-12 22:11:14 +01:00
Michał Kępień 1bec7e09a3 Update documentation for GL #3212 2023-01-12 22:11:14 +01:00
Michał Kępień 04b41cd54e Fix a typo in the DNSSEC Guide 2023-01-12 22:11:14 +01:00
Michał Kępień b04ab0648a Merge branch '3619-security-serve-stale-client-timeout-crash-v9_18' into 'security-v9_18'
[9.18] [CVE-2022-3924] Fix the serve-stale crash when recursive clients soft quota is reached

See merge request isc-private/bind9!478
2023-01-12 11:56:39 +00:00
Aram SargsyanandMichał Kępień 601066e854 Add CHANGES and release notes for [GL #3619]
(cherry picked from commit d08a478b42)
2023-01-12 12:54:02 +01:00
Aram SargsyanandMichał Kępień a4fc5e5158 Cancel all fetch events in dns_resolver_cancelfetch()
Although 'dns_fetch_t' fetch can have two associated events, one for
each of 'DNS_EVENT_FETCHDONE' and 'DNS_EVENT_TRYSTALE' types, the
dns_resolver_cancelfetch() function is designed in a way that it
expects only one existing event, which it must cancel, and when it
happens so that 'stale-answer-client-timeout' is enabled and there
are two events, only one of them is canceled, and it results in an
assertion in dns_resolver_destroyfetch(), when it finds a dangling
event.

Change the logic of dns_resolver_cancelfetch() function so that it
cancels both the events (if they exist), and in the right order.

(cherry picked from commit ec2098ca35)
2023-01-12 12:54:02 +01:00
Michał Kępień 72db6402f3 Merge branch '3622-serve-stale-rrsig-fix-security-v9_18' into 'security-v9_18'
[9.18] [CVE-2022-3736] Properly handle stale RRSIG lookups

See merge request isc-private/bind9!485
2023-01-12 11:31:41 +00:00
Mark AndrewsandMichał Kępień 645dd3fdf1 Add release note for [GL #3622]
(cherry picked from commit 42c42be9a9)
2023-01-12 12:27:28 +01:00
Mark AndrewsandMichał Kępień a4b760d8f6 Add CHANGES note for [GL #3622]
(cherry picked from commit 8ca018b5ec)
2023-01-12 12:27:28 +01:00
Mark AndrewsandMichał Kępień 38323f3b9f Move the mapping of SIG and RRSIG to ANY
dns_db_findext() asserts if RRSIG is passed to it and
query_lookup_stale() failed to map RRSIG to ANY to prevent this.  To
avoid cases like this in the future, move the mapping of SIG and RRSIG
to ANY for qctx->type to qctx_init().

(cherry picked from commit 56eae06418)
2023-01-12 12:27:28 +01:00
Michał Kępień 35c40a8053 Merge branch '3523-confidential-update-quota-v9_18' into 'security-v9_18'
[9.18] [CVE-2022-3094] apply quotas to updates

See merge request isc-private/bind9!490
2023-01-12 11:08:07 +00:00
Evan HuntandMichał Kępień 5a7d1d2d0c CHANGES and release notes for [GL #3523]
(cherry picked from commit 991de0aa76)
2023-01-12 12:02:35 +01:00
Evan HuntandMichał Kępień 24a684db94 test failure conditions
verify that updates are refused when the client is disallowed by
allow-query, and update forwarding is refused when the client is
is disallowed by update-forwarding.

verify that "too many DNS UPDATEs" appears in the log file when too
many simultaneous updates are processing.

(cherry picked from commit b91339b80e)
2023-01-12 12:02:35 +01:00
Evan HuntandMichał Kępień 65d70ebd20 move update ACL and update-policy checks before quota
check allow-update, update-policy, and allow-update-forwarding before
consuming quota slots, so that unauthorized clients can't fill the
quota.

(this moves the access check before the prerequisite check, which
violates the precise wording of RFC 2136. however, RFC co-author Paul
Vixie has stated that the RFC is mistaken on this point; it should have
said that access checking must happen *no later than* the completion of
prerequisite checks, not that it must happen exactly then.)

(cherry picked from commit 964f559edb)
2023-01-12 12:02:35 +01:00
Evan HuntandMichał Kępień 3d2033bb89 add a configuration option for the update quota
add an "update-quota" option to configure the update quota.

(cherry picked from commit f57758a730)
2023-01-12 12:02:35 +01:00
Evan HuntandMichał Kępień 9f1ebd25f6 add an update quota
limit the number of simultaneous DNS UPDATE events that can be
processed by adding a quota for update and update forwarding.
this quota currently, arbitrarily, defaults to 100.

also add a statistics counter to record when the update quota
has been exceeded.

(cherry picked from commit 7c47254a14)
2023-01-12 12:02:35 +01:00
Ondřej Surý dec1bf29fd Merge branch '3212-implement-incremental-rehashing-for-isc_ht-hashtables-v9_18' into 'v9_18'
[9.18] Implement incremental hash table resizing in isc_ht

See merge request isc-projects/bind9!7355
2023-01-11 17:01:00 +00:00
Ondřej Surý 68c094c59a Add CHANGES note for [GL #3212]
(cherry picked from commit 5ccb28d6d8)
2023-01-11 17:16:35 +01:00
Ondřej Surý 8c31a939c9 Implement incremental hash table resizing in isc_ht
Previously, an incremental hash table resizing was implemented for the
dns_rbt_t hash table implementation.  Using that as a base, also
implement the incremental hash table resizing also for isc_ht API
hashtables:

 1. During the resize, allocate the new hash table, but keep the old
    table unchanged.
 2. In each lookup, delete, or iterator operation, check both tables.
 3. Perform insertion operations only in the new table.
 4. At each insertion also move <r> elements from the old table to
    the new table.
 5. When all elements are removed from the old table, deallocate it.

To ensure that the old table is completely copied over before the new
table itself needs to be enlarged, it is necessary to increase the
size of the table by a factor of at least (<r> + 1)/<r> during resizing.

In our implementation <r> is equal to 1.

The downside of this approach is that the old table and the new table
could stay in memory for longer when there are no new insertions into
the hash table for prolonged periods of time as the incremental
rehashing happens only during the insertions.

(cherry picked from commit e42cb1f198)
2023-01-11 17:15:33 +01:00
Arаm Sаrgsyаn c120cc40f5 Merge branch 'aram/dns_fwdtable_addfwd-cleanup-bugfix-v9_18' into 'v9_18'
[9.18] Fix dns_fwdtable_addfwd() error path cleanup bug

See merge request isc-projects/bind9!7354
2023-01-11 14:25:44 +00:00
Aram Sargsyan 39cc597022 Use sizeof(*ptr) for allocating/freeing memory in forward.c
As shown in the previous commit, using sizeof(type_t) is a little
bit more error-prone when copy-pasting code, so extracting the
size information from the pointer which is being dealt with seems
like a better alternative.

(cherry picked from commit cf4003fa58)
2023-01-11 13:42:09 +00:00
Aram Sargsyan 64c8e63942 Fix dns_fwdtable_addfwd() error path cleanup bug
Free 'sizeof(dns_forwarder_t)' bytes of memory instead of
'sizeof(dns_sockaddr_t)' bytes, because `fwd` is a pointer
to a 'dns_forwarder_t' type structure.

(cherry picked from commit 0cc1b06d98)
2023-01-11 13:42:09 +00:00
Arаm Sаrgsyаn 6d3c38e381 Merge branch '3768-dns_zonemgr-use-after-free-v9_18' into 'v9_18'
[9.18] Fix a use-after-free bug in dns_zonemgr_releasezone()

See merge request isc-projects/bind9!7351
2023-01-11 12:53:01 +00:00
Aram Sargsyan 7643e0b60a Add a CHANGES note for [GL #3768]
(cherry picked from commit d50cb1d45d)
2023-01-11 12:16:40 +00:00
Aram Sargsyan 4121af8f7e Fix a use-after-free bug in dns_zonemgr_releasezone()
The dns_zonemgr_releasezone() function makes a decision to destroy
'zmgr' (based on its references count, after decreasing it) inside
a lock, and then destroys the object outside of the lock.

This causes a race with dns_zonemgr_detach(), which could destroy
the object in the meantime.

Change dns_zonemgr_releasezone() to detach from 'zmgr' and destroy
the object (if needed) using dns_zonemgr_detach(), outside of the
lock.

(cherry picked from commit c1fc212253)
2023-01-11 12:16:23 +00:00
Ondřej Surý 4ad0cc8118 Merge branch 'ondrej/use-pthread_barrier-if-available-v9_18' into 'v9_18'
[9.18] Prefer the pthread_barrier implementation over uv_barrier

See merge request isc-projects/bind9!7350
2023-01-11 10:21:46 +00:00
Ondřej Surý 6906b42cdd Prefer the pthread_barrier implementation over uv_barrier
Prefer the pthread_barrier implementation on platforms where it is
available over uv_barrier implementation.  This also solves the problem
with thread sanitizer builds on macOS that doesn't have pthread barrier.

(cherry picked from commit d07c4a98da)
2023-01-11 10:21:39 +00:00
Ondřej Surý fa53e4f87c Merge branch '3772-revert-fix-single-read-tlsdns-client-v9_18' into 'v9_18'
Don't honour single read per client isc_nm_read() call in the TLSDNS

See merge request isc-projects/bind9!7349
2023-01-11 10:20:49 +00:00
Ondřej Surý cb3990001f Add CHANGES and release note for [GL #3772] 2023-01-11 10:42:03 +01:00
Ondřej Surý d0d9e7dfb2 Don't honour single read per client isc_nm_read() call in the TLSDNS
This reverts commit f17f5e831b that made
following change:

> The TLSDNS transport was not honouring the single read callback for
> TLSDNS client.  It would call the read callbacks repeatedly in case the
> single TLS read would result in multiple DNS messages in the decoded
> buffer.

Turns out that this change broke XoT, so we are reverting the change
until we figure out a proper fix that will keep the design promise and
not break XoT at the same time.
2023-01-11 10:17:55 +01:00
Matthijs Mekking 614d5c3334 Merge branch '3743-unexpected-prohibited-ede-v9_18' into 'v9_18'
[9.18] Fix unexpected "Prohibited" extended DNS error on allow-recursion mismatch

See merge request isc-projects/bind9!7324
2023-01-10 10:02:22 +00:00
Matthijs Mekking 29963f4c0e Add system test for #3743
(cherry picked from commit 8db8ec1f6e)
2023-01-10 10:02:14 +00:00
Matthijs Mekking f8b7bb7c9f Add release note and CHANGES for #3743
(cherry picked from commit e43a26fd1e)
2023-01-10 10:02:14 +00:00
Matthijs Mekking f481073110 Don't set EDE in ns_client_aclchecksilent
The ns_client_aclchecksilent is used to check multiple ACLs before
the decision is made that a query is denied. It is also used to
determine if recursion is available. In those cases we should not
set the extended DNS error "Prohibited".

(cherry picked from commit 798c8f57d4)
2023-01-10 10:02:14 +00:00
Mark Andrews 81f8b8fc14 Merge branch '3787-siphash-c-105-26-runtime-error-applying-zero-offset-to-null-pointer-v9_18' into 'v9_18'
[9.18] Accept 'in=NULL' with 'inlen=0' in isc_{half}siphash24

See merge request isc-projects/bind9!7341

Backport of MR !7339
2023-01-10 08:28:15 +00:00
Mark Andrews f99593a9ca Accept 'in=NULL' with 'inlen=0' in isc_{half}siphash24
Arthimetic on NULL pointers is undefined.  Avoid arithmetic operations
when 'in' is NULL and require 'in' to be non-NULL if 'inlen' is not zero.

(cherry picked from commit 349c23dbb7)
2023-01-10 18:36:08 +11:00
Evan Hunt 12de356ed6 Merge branch '3773-remove-dscp-v9_18' into 'v9_18'
[9.18] Merge branch '3773-remove-dscp' into 'main'

See merge request isc-projects/bind9!7336
2023-01-10 00:20:14 +00:00
Evan Hunt 55d728a678 CHANGES and release note for [GL #3773]
(cherry picked from commit 34a7166029)
2023-01-09 14:24:23 -08:00
Evan Hunt 5fd93c66aa remove nonfunctional DSCP implementation
DSCP has not been fully working since the network manager was
introduced in 9.16, and has been completely broken since 9.18.
This seems to have caused very few difficulties for anyone,
so we have now marked it as obsolete and removed the
implementation.

To ensure that old config files don't fail, the code to parse
dscp key-value pairs is still present, but a warning is logged
that the feature is obsolete and should not be used. Nothing is
done with configured values, and there is no longer any
range checking.

(cherry picked from commit 916ea26ead)
2023-01-09 14:23:26 -08:00
Michal Nowak 703c799376 Merge branch 'mnowak/abort-on-ubsan-errors-v9_18' into 'v9_18'
[9.18] Abort on UBSAN errors

See merge request isc-projects/bind9!7327
2023-01-09 17:07:44 +00:00
Michal Nowak addd4141a7 Abort on UBSAN errors
Previously, UBSAN errors might slip undetected.

(cherry picked from commit 1451bb7390)
2023-01-09 17:40:32 +01:00
Matthijs Mekking 815ac08a26 Merge branch '3678-serve-stale-servfailing-unexpectedly-v9_18' into 'v9_18'
[9.18] Resolve "stale-serve and RPZ put in SERVFAIL cache unexpected record"

See merge request isc-projects/bind9!7310
2023-01-09 15:01:49 +00:00
Michał KępieńandMatthijs Mekking 90408617d7 Check for NULL before dereferencing qctx->rpz_st
Commit 9ffb4a7ba1 causes Clang Static
Analyzer to flag a potential NULL dereference in query_nxdomain():

    query.c:9394:26: warning: Dereference of null pointer [core.NullDereference]
            if (!qctx->nxrewrite || qctx->rpz_st->m.rpz->addsoa) {
                                    ^~~~~~~~~~~~~~~~~~~
    1 warning generated.

The warning above is for qctx->rpz_st potentially being a NULL pointer
when query_nxdomain() is called from query_resume().  This is a false
positive because none of the database lookup result codes currently
causing query_nxdomain() to be called (DNS_R_EMPTYWILD, DNS_R_NXDOMAIN)
can be returned by a database lookup following a recursive resolution
attempt.  Add a NULL check nevertheless in order to future-proof the
code and silence Clang Static Analyzer.

(cherry picked from commit 07592d1315)
(cherry picked from commit a4547a1093)
2023-01-09 14:26:02 +01:00
Aram SargsyanandMatthijs Mekking 096d980a87 Add a CHANGES note for [GL #3678]
(cherry picked from commit 40dee61a1e)
2023-01-09 14:26:02 +01:00
Matthijs Mekking 271bc20b1c Consider non-stale data when in serve-stale mode
With 'stale-answer-enable yes;' and 'stale-answer-client-timeout off;',
consider the following situation:

A CNAME record and its target record are in the cache, then the CNAME
record expires, but the target record is still valid.

When a new query for the CNAME record arrives, and the query fails,
the stale record is used, and then the query "restarts" to follow
the CNAME target. The problem is that the query's multiple stale
options (like DNS_DBFIND_STALEOK) are not reset, so 'query_lookup()'
treats the restarted query as a lookup following a failed lookup,
and returns a SERVFAIL answer when there is no stale data found in the
cache, even if there is valid non-stale data there available.

With this change, query_lookup() now considers non-stale data in the
cache in the first place, and returns it if it is available.

(cherry picked from commit 91a1a8efc5)
2023-01-09 14:26:02 +01:00
Aram SargsyanandMatthijs Mekking d54e7052ab Add serve-stale CNAME check with stale-answer-client-timeout off
Prime the cache with the following records:

    shortttl.cname.example.	1	IN	CNAME	longttl.target.example.
    longttl.target.example.	600	IN	A	10.53.0.2

Wait for the CNAME record to expire, disable the authoritative server,
and query 'shortttl.cname.example' again, expecting a stale answer.

(cherry picked from commit 537187bf2f)
2023-01-09 14:26:02 +01:00
Ondřej Surý bea3d7994a Merge branch '3766-pin-TCP-dispatch-to-threads-v9_18' into 'v9_18'
[9.18] Pin the dns_dispatch to threads when reusing

See merge request isc-projects/bind9!7302
2023-01-05 10:25:32 +00:00
Ondřej Surý 0e263b34c6 Pin the dns_dispatch to threads when reusing
Previously, dns_dispatch_gettcp() could pick a TCP connection created by
different thread - this breaks our contractual promise to DNS dispatch
by using the TCP connection on a different thread than it was created.
Add .tid member to the dns_dispatch_t struct and skip the dispatches
from other threads when looking up a TCP dispatch that we can reuse in
dns_request.

NOTE: This is going to be properly refactored, but this change could be
also backported to 9.18 for better stability and thread-affinity.

(cherry picked from commit 1a999353cd)
2023-01-05 10:20:47 +01:00
Tony Finch 3c411ad294 Merge branch '3745-delzone-catz-v9_18' into 'v9_18'
[9.18] Don't crash when rndc delzone encounters a catz member

See merge request isc-projects/bind9!7297
2023-01-04 18:56:07 +00:00
Tony FinchandTony Finch 03beb6e355 Don't crash when rndc delzone encounters a catz member
This bug was masked in the tests because the `catz` test script did an
`rndc addzone` before an `rndc delzone`. The `addzone` autovivified
the NZF config, so `delzone` worked OK.

This commit swaps the order of two sections of the `catz` test script
so that it uses `delzone` before `addzone`, which provokes a crash
when `delzone` requires a non-NULL NZF config.

To fix the crash, we now try to remove the zone from the NZF config
only if it was dynamically added but not by a catalog zone.

(cherry picked from commit 9fa20d6f6c)
2023-01-04 17:50:44 +00:00
Ondřej Surý f5e7192691 Merge branch '3723-dont-shutdown-invalid-tasks-v9_18' into 'v9_18'
[v9.18] Don't cleanup uninitialized dns_resolver buckets

See merge request isc-projects/bind9!7286
2023-01-03 11:54:21 +00:00
Ondřej Surý d48f5e253f Don't cleanup uninitialized dns_resolver buckets
If the isc_task_create_bound() fails in the middle of buckets
initialization - the most common case would be shutdown initialized
during reload, not all tasks would be initialized, but the cleanup
code would try to cleanup all buckets.

Make sure that we cleanup only the initialized buckets by setting
ntasks to the number of already initialized tasks on the error path.
2023-01-03 10:33:23 +01:00
Michał Kępień 04d4a608b8 Merge branch 'michal/update-copyright-year-to-2023-v9_18' into 'v9_18'
[9.18] Update copyright year to 2023

See merge request isc-projects/bind9!7283
2023-01-02 13:16:50 +00:00
Michał Kępień d72070f30e Update copyright year to 2023
(cherry picked from commit 1a5d707f52)
2023-01-02 14:12:23 +01:00
Arаm Sаrgsyаn a21562c6cf Merge branch 'aram/dns_dispatch_createtcp-bugfix-v9_18' into 'v9_18'
[9.18] Don't pass a NULL pointer to isc_sockaddr_format()

See merge request isc-projects/bind9!7278
2022-12-28 14:54:16 +00:00
Aram Sargsyan 35b5ba2ff4 Don't pass a NULL pointer to isc_sockaddr_format()
The 'localaddr' pointer can be NULL, which causes an assertion failure.

Use '&disp->local' instead when printing a debug log message.

(cherry picked from commit 41ca9d419e)
2022-12-28 14:19:37 +00:00
Tom Krizek 5102e676e7 Merge branch 'tkrizek/gitignore-fixes-v9_18' into 'v9_18'
[9.18] Don't track gitignored files in the repo

See merge request isc-projects/bind9!7274
2022-12-23 14:14:28 +00:00
Michał KępieńandTom Krizek df5c90843b Detect "ignored yet tracked" files in GitLab CI
Ensure that no .gitignore file in the tree contains patterns matching
files tracked by Git by adding a simple script that detects such
situations and running that script as part of the "misc" job in the
"precheck" stage of every GitLab CI pipeline.

(cherry picked from commit 5b28da7ea0)
2022-12-23 14:29:48 +01:00
Tom Krizek ee4a18ee23 Remove obsolete gitignore file in mysqldyn
The Makefile used to be autogenerated prior to
67f76b1269 which is the reason why the
.gitignore existed in the first place. Since then, a static Makefile is
used and is supposed to be tracked in the git repo.

(cherry picked from commit a02da6cf21)
2022-12-23 14:29:47 +01:00
Tom Krizek 6b56dad1cd Make gitignore matching in rpzrecurse more precise
The pre-defined test cases use named.$TESTCASE.conf naming convention,
where TESTCASE is a human readable name contaning actual word(s). The
autogenerated test cases' names always start with a number from 1 to 6.

(cherry picked from commit e03daf22ec)
2022-12-23 14:29:47 +01:00
Tom Krizek b9065fb187 Remove ans.pl system test files from gitignore
The ans*.pl scripts are part of system tests and should be part of the
repository. The gitignore entires for these files have been removed.

(cherry picked from commit b8616e457f)
2022-12-23 14:29:47 +01:00
Tom Krizek bff1f5af2b Rename dig reference files in the rrsetorder test
bin/tests/system/rrsetorder/dig.out* files match a gitignore expression
present in bin/tests/system/.gitignore.  Since these are meant to be
reference files that are compared to the files generated when the
"rrsetorder" system test is run, rename them to avoid listing tracked
files in .gitignore files.

(cherry picked from commit c5708044e7)
2022-12-23 14:29:44 +01:00
Artem Boldariev 5a4b3491f9 Merge branch '3748-rename-tls-caches-creation-functions-v9-18' into 'v9_18'
[9.18] Rename isc_tlsctx_cache_new() to isc_tlsctx_cache_create(), tlsctx_client_session_cache_new() to tlsctx_client_session_create()

See merge request isc-projects/bind9!7272
2022-12-23 12:43:55 +00:00
Artem Boldariev bccbf28249 tlsctx_client_session_cache_new() -> tlsctx_client_session_create()
Additionally to renaming, it changes the function definition so that
it accepts a pointer to pointer instead of returning a pointer to the
new object.

It is mostly done to make it in line with other functions in the
module.

(cherry picked from commit 7962e7f575)
2022-12-23 13:58:14 +02:00
Artem Boldariev b05b05cb48 Rename isc_tlsctx_cache_new() -> isc_tlsctx_cache_create()
Additionally to renaming, it changes the function definition so that
it accepts a pointer to pointer instead of returning a pointer to the
new object.

It is mostly done to make it in line with other functions in the
module.

(cherry picked from commit f102df96b8)
2022-12-23 13:58:14 +02:00
Arаm Sаrgsyаn 3922728175 Merge branch '3752-resolver-adb-quota-bug-v9_18' into 'v9_18'
[9.18] Fix an ADB quota management bug in the resolver

See merge request isc-projects/bind9!7273
2022-12-23 10:44:19 +00:00
Aram Sargsyan 0e849a99cf Add CHANGES and release notes for [GL #3752]
(cherry picked from commit a4def095f3)
2022-12-23 10:08:00 +00:00
Aram Sargsyan 926f0323b6 Fix an ADB quota management error in the resolver
Normally, when a 'resquery_t' object is created in fctx_query(),
we call dns_adb_beginudpfetch() (which increases the ADB quota)
only if it's a UDP query. Then, in fctx_cancelquery(), we call
dns_adb_endudpfetch() to decreases back the ADB quota, again only
if it's a UDP query.

The problem is that a UDP query can become a TCP query, preventing
the quota from adjusting back in fctx_cancelquery() later.

Call dns_adb_beginudpfetch() also when switching the query type
from UDP to TCP.

(cherry picked from commit 53afe1f978)
2022-12-23 10:08:00 +00:00
Aram Sargsyan 650f3098e1 INSIST that active quota is 0 in destroy_adbentry()
This should catch ADB quota management errors in the resolver.

(cherry picked from commit c7ba26c3d6)
2022-12-23 10:08:00 +00:00
Tom Krizek 02f775a447 Merge branch 'tkrizek/dangerfile-backport-tweaks-v9_18' into 'v9_18'
[9.18] danger CI: tweak backport check and add Affects label check

See merge request isc-projects/bind9!7270
2022-12-23 08:57:53 +00:00
Tom Krizek 893d6dc98f danger: check the Affects labels are set
Unless the MR is a backport, the Affects labels should be used to
indicate which versions are affected by the issue that prompted the MR.

(cherry picked from commit 64d71a1f5f)
2022-12-23 09:52:40 +01:00
Tom Krizek 8bc806a9f2 danger: check version in MR title
Enforce the version indicator to be at the start of the MR title.

(cherry picked from commit d1172e011c)
2022-12-23 09:52:32 +01:00
Tom Krizek 2c2148fb23 Merge tag 'v9_18_10' into v9_18
BIND 9.18.10
2022-12-22 10:06:46 +01:00
Arаm Sаrgsyаn fc122887f8 Merge branch '3750-legacy-system-test-dig-timed-out-fix-v9_18' into 'v9_18'
[9.18] Fix DiG "timed out" message check in "legacy" system test

See merge request isc-projects/bind9!7260
2022-12-21 15:09:50 +00:00
Aram Sargsyan 5e57ffbd51 Fix DiG "timed out" message check in "legacy" system test
The test expects a "connection timed out" message from DiG when it
experiences a timeout, while the current version of DiG prints just
a "timed out" message, like below:

    ;; communications error to 10.53.0.1#11314: timed out
    ;; communications error to 10.53.0.1#11314: timed out
    ;; communications error to 10.53.0.1#11314: timed out

    ; <<>> DiG 9.19.9-dev <<>> -p 11314 +tries +time +tcp +tries +time @10.53.0.1 dropedns. TXT
    ; (1 server found)
    ;; global options: +cmd
    ;; no servers could be reached

Change the expected string to match the current DiG output.

Use the '-F' switch for "grep" for matching a fixed string.

(cherry picked from commit 35988748f3)
2022-12-21 14:32:18 +00:00
Tom Krizek e64dbb578b Merge branch 'tkrizek/system-tests-conventions-v9_18' into 'v9_18'
[9.18] Unify system tests naming conventions

See merge request isc-projects/bind9!7257
2022-12-21 13:44:34 +00:00
Tom Krizek 3c29317ad3 Update tests gitignore file
The .mypy_cache was added to the system test dir gitignore, since it
should be ignored.

(cherry picked from commit 4145068bfa)
2022-12-21 14:02:47 +01:00
Tom Krizek 873feb0c53 Rename engine_pkcs11 system test
In order to have a common naming convention for system tests, rename the
only outlier "engine_pkcs11" to "enginepkcs11", which was the only
system test using an underscore in its name.

The only allowed word separators for system test names are either dash
or no separator.

(cherry picked from commit 62eea511db)
2022-12-21 14:02:47 +01:00
Tom Krizek 4652da6caf Use common name convention for pytest files
It is better to use consistent file names to avoid issue with sorting
etc.

Using underscore in filenames as opposed to dash was chosen because it
seems more common in pytest/python to use underscore for filenames.

Also rename the bin/tests/system/timeouts/tests-tcp.py file to
bin/tests/system/timeouts/tests_tcp_timeouts.py to avoid pytest name
collision (there can't be two files named tests_tcp.py).

(cherry picked from commit f6409ee6ac)
2022-12-21 14:02:45 +01:00
Ondřej Surý 6fd6686865 Merge branch '3178-dispatch-race-v9_18' into 'v9_18'
[9.18] Fix the thread safety in the dns_dispatch unit

See merge request isc-projects/bind9!7251
2022-12-21 12:41:22 +00:00
Ondřej Surý 3492dc2f0e Add CHANGES and release note for [GL #3178] and [GL #3636]
(cherry picked from commit 2df311eb21)
2022-12-21 12:41:15 +00:00
Ondřej Surý be3cf85cfe Call the connected dns_dispatch callback asynchronously
The dns_request code is very sensitive about calling the connected and
deadlocks when the timing is "right" in several places.  Move the call
to the connected callback to the (udp|tcp)_connected() functions, so
they are called asynchronously instead of directly from
the (udp|tcp)_dispentry_cancel() functions.

(cherry picked from commit 9dd8deaf01)
2022-12-21 12:41:15 +00:00
Ondřej Surý 87ad3ecaf0 Ignore TCP dispatches that have zero references
The TCP dispatches are removed from the dispatchmgr->list in the
dispatch_destroy() and there's a brief period of time where
dns_dispatch_gettcp() can find a dispatch in connected state that's
being destroyed.

Set the dispatch state to DNS_DISPATCHSTATE_NONE in the TCP connection
callback if there are no responses waiting, and ignore TCP dispatches
with zero references in dns_dispatch_gettcp().

(cherry picked from commit 3fac4ca57e)
2022-12-21 12:41:15 +00:00
Ondřej Surý 3f4970da1a Fix assignment vs comparison typo in tcp_connected()
In tcp_connected() a typo has turned a DbC check into an assignment
breaking the state machine and making the dns_dispatch_gettcp() try to
attach to dispatch in process of destruction.
2022-12-21 12:41:15 +00:00
Ondřej Surý b714033731 Don't remove dispatches in CANCELED state from the list
In dns_dispatch_gettcp(), we can't remove canceled dispatches from the
mgr->list because ISC_LIST_NEXT() would fail in the next iteration.
2022-12-21 12:41:15 +00:00
Ondřej Surý 3edccaf0c7 Ignore TCP dispatches in DNS_DISPATCHSTATE_NONE state
The TCP dispatches in DNS_DISPATCHSTATE_NONE could be either very
fresh or those could be dispatches that failed connecting to the
destination.  Ignore them when trying to connect to an existing
TCP dispatch via dns_dispatch_gettcp().
2022-12-21 12:41:15 +00:00
Ondřej Surý 5cc12ab92c Fix the thread safety in the dns_dispatch unit
The dispatches are not thread-bound, and used freely between various
threads (see the dns_resolver and dns_request units for details).

This refactoring make sure that all non-const dns_dispatch_t and
dns_dispentry_t members are accessed under a lock, and both object now
track their internal state (NONE, CONNECTING, CONNECTED, CANCELED)
instead of guessing the state from the state of various struct members.

During the refactoring, the artificial limit DNS_DISPATCH_SOCKSQUOTA on
UDP sockets per dispatch was removed as the limiting needs to happen and
happens on in dns_resolver and limiting the number of UDP sockets
artificially in dispatch could lead to unpredictable behaviour in case
one dispatch has the limit exhausted by others are idle.

The TCP artificial limit of DNS_DISPATCH_MAXREQUESTS makes even less
sense as the TCP connections are only reused in the dns_request API
that's not a heavy user of the outgoing connections.

As a side note, the fact that UDP and TCP dispatch pretends to be same
thing, but in fact the connected UDP is handled from dns_dispentry_t and
dns_dispatch_t acts as a broker, but connected TCP is handled from
dns_dispatch_t and dns_dispatchmgr_t acts as a broker doesn't really
help the clarity of this unit.

This refactoring kept to API almost same - only dns_dispatch_cancel()
and dns_dispatch_done() were merged into dns_dispatch_done() as we need
to cancel active netmgr handles in any case to not leave dangling
connections around.  The functions handling UDP and TCP have been mostly
split to their matching counterparts and the dns_dispatch_<function>
functions are now thing wrappers that call <udp|tcp>_dispatch_<function>
based on the socket type.

More debugging-level logging was added to the unit to accomodate for
this fact.

(cherry picked from commit 6f317f27ea)
2022-12-21 12:41:15 +00:00
Ondřej Surý 24847cfd3e Backport ISC_REFCOUNT{,_TRACE}_{DECL,IMPL} macros
Backport macros that can be used to implement generic attach, detach,
ref, and unref functions, so they don't have to be repeated over and
over in each unit that uses reference counting.
2022-12-21 12:41:15 +00:00
Tom Krizek 7009aa9044 Merge branch 'tkrizek/default-alg-fixups-v9_18' into 'v9_18'
[9.18] Fix minor issues with DEFAULT_ALGORITHM selection in system tests

See merge request isc-projects/bind9!7255
2022-12-21 11:43:02 +00:00
Tom Krizek 45b003316f Make Python interpreter required for system tests
This introduces a Python dependency for running system tests. It is
needed in order to:
  - write new test control scripts in Python
  - gradually rewrite old Perl scripts into Python if needed
  - eventually introduce pytest as the new test runner framework

This commit is not intended to be backported to 9.16.

(cherry picked from commit 56416ebd65)
2022-12-21 10:49:33 +01:00
Tom Krizek efa09a37f3 Make Perl interpreter required for system tests
This change has no practical impact, as Perl was already required for
all system tests, this check only makes it more explicit.

(cherry picked from commit 084d72d1d5)
2022-12-21 10:49:33 +01:00
Tom Krizek 0079745f97 Ensure test interpreters are defined before common config
Nothing from conf.sh.common is required to set these values. On the
contrary, a Python interpreter needs to be set in order to randomize the
algorithm set (which happens in conf.sh.common).

(cherry picked from commit 492992dca8)
2022-12-21 10:49:33 +01:00
Tom Krizek 54a877ef47 Force quiet mode when using testcrypto.sh directly
When testcrypto.sh is used as a standalone script, always use quiet mode
to avoid using undefined commands (such as echo_i) which require
inclusion of the entire conf.sh machinery.

(cherry picked from commit ba35a6df9c)
2022-12-21 10:42:10 +01:00
Ondřej Surý 3a78f58c55 Merge branch '3739-adb-cleans-overzealously-under-memory-pressure-v9_18' into 'v9_18'
Exclude the ADB hashmaps from ADB overmem accounting [v9.18]

See merge request isc-projects/bind9!7248
2022-12-19 08:58:27 +00:00
Ondřej Surý c3f1a0dfff Add CHANGES and release note for [GL #3739]
(cherry picked from commit 11df7f02fd)
2022-12-19 09:26:59 +01:00
Ondřej Surý 146f93ff46 Don't expire fresh ADB names and entries
The overmem cleaning in ADB could become overzealous and clean fresh ADB
names and entries.  Add a safety check to not clean any ADB names and
entries that are below ADB_CACHE_MINIMUM threshold.

(cherry picked from commit 0b661b6f95)
2022-12-19 09:26:58 +01:00
Ondřej Surý ecde82689e Exclude the ADB hashmaps from ADB overmem accounting
The ADB overmem accounting would include the memory used by hashtables
thus vastly reducing the space that can be used for ADB names and
entries when the hashtables would grow.  Create own memory context for
the ADB names and entries hash tables.

(cherry picked from commit 59dee0b078)
2022-12-16 19:22:43 +01:00
Ondřej Surý 25201365a6 Merge branch '3637-try-next-server-on-resolver-timeout-v9_18' into 'v9_18'
Try next server on resolver timeout [v9.18]

See merge request isc-projects/bind9!7249
2022-12-16 18:22:39 +00:00
Ondřej Surý 6ca03d1012 Add CHANGES and release notes for [GL #3637]
(cherry picked from commit d1f1db2f5a)
2022-12-16 18:38:02 +01:00
Ondřej Surý 2cb6001a2e Add comment why statistics/ns3 has misconfigure root.hints
To count pending queries in the statistics, we need the ns3 to be
misconfigured.  Document the fact in the statistics/ns3/root.hints.

(cherry picked from commit 32c2acf6fc)
2022-12-16 18:37:22 +01:00
Ondřej Surý 9e8c23be7e Revert the statistics system test change after we fixed the resolver
When the resolver was refactored, the statistics system test had to be
adjusted in c6b4d82557.  Unfortunately,
this change had to be done because of an error in the resolver
refactoring where timeout would not retry next server, but keep trying
the same server.  As we have now fixed this bug, revert the change to
the test back to the previous state.

(cherry picked from commit b679640950)
2022-12-16 18:37:22 +01:00
Ondřej Surý 095f634f48 Try next server on resolver timeout
Instead of resending to the same server on the (dispatch) timeout in the
resolver, try the next server.

(cherry picked from commit 5466a48fc9)
2022-12-16 18:37:22 +01:00
Tom Krizek 773517960f Merge branch 'tkrizek/danger-backports-v9_18' into 'v9_18'
Check backport workflow in danger CI [v9_18]

See merge request isc-projects/bind9!7245
2022-12-16 13:39:32 +00:00
Tom Krizek a11bcfa8ba danger: remove obsolete check for cherry pick msg
With proper backport commit detection, this check has been made
redundant.

(cherry picked from commit e8a5ebaee5)
2022-12-16 14:21:10 +01:00
Tom Krizek 90b4441e3e danger: check backport commits for original commit IDs
A full backport must have all the commit from the original MR and the
original commit IDs must be referenced in the backport commit messages.

If the criteria above is not met, the MR should be marked as a partial
backport. In that case, any discrepencies are only logged as informative
messages rather than failures.

(cherry picked from commit c617f97784)
2022-12-16 14:21:10 +01:00
Tom Krizek 8ebfcb6b5a danger: check that original MR has been merged
When checking a backport MR, ensure that the original MR has been merged
already. This is vital for followup checks that verify commit IDs from
original commits are present in backport commit messages.

(cherry picked from commit 89530f1a1c)
2022-12-16 14:21:10 +01:00
Tom Krizek eab1d81072 danger: check backport links to the original MR
When doing archeology, it is much easier to find stuff if it's properly
linked. This check ensures that backport MR are linked to their original
MR via a "Backport of !XXXX" message.

The regular expression is fairly broad and has been tested to accept the
following variants of the message:
Backport of MR !XXXX
Backport of: !XXXX
backport of mr !XXXX
Backport of   !XXXX
Backport of https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/XXXX

(cherry picked from commit 12e0b05738)
2022-12-16 14:21:10 +01:00
Tom Krizek cb6ba18aaa danger: ensure target branch is in the MR title
Having the MR title clearly marked in its title can be very useful when
looking through older issues/MRs.

This check also ensures that the version from the version label matches
the proper version branch (i.e. v9.16 must be marked with [v9_16]).

(cherry picked from commit 14b027cf83)
2022-12-16 14:21:09 +01:00
Tom Krizek 2b5b016f1e danger: support partial backport label
Treat the Backport::Partial label as a backport as well.

(cherry picked from commit 1c0c1ba8b9)
2022-12-16 14:21:07 +01:00
Tony Finch 4d8f551195 Merge branch '3740-rpz-reconfig-v9_18' into 'v9_18'
A couple of RPZ options were not reconfigured as expected

See merge request isc-projects/bind9!7238
2022-12-16 10:15:31 +00:00
Tony FinchandTony Finch 08d0d24d3b A couple of RPZ options were not reconfigured as expected
[bug]	Changes to the RPZ response-policy min-update-interval
	and add-soa options now take effect as expected when
	named is reconfigured. [GL #3740]

(cherry picked from commit d8a3d328db)
2022-12-16 09:53:01 +00:00
Arаm Sаrgsyаn 61c2337a1e Merge branch '3742-catz-update-log-incorrect-soa-serial-representation-v9_18' into 'v9_18'
[v9_18] Fix an incorrect SOA serial representation in catz

See merge request isc-projects/bind9!7236
2022-12-15 14:27:33 +00:00
Aram Sargsyan c833de15c0 Add a CHANGES note for [GL #3742]
(cherry picked from commit ac7149aa88)
2022-12-15 13:32:27 +00:00
Aram Sargsyan 19325a228c Fix logging a uint32_t SOA serial value in dns_catz_update_from_db()
The dns_catz_update_from_db() function prints serial number as a signed
number (with "%d" in the format string), but the `vers` variable's type
is 'uint32_t'. This breaks serials bigger than 2^31.

Use PRIu32 instead of "d" in the format string.

(cherry picked from commit 72b1760ea6)
2022-12-15 13:31:30 +00:00
Aram Sargsyan eae5c06e57 Add big SOA serial logging check into the catz system test
Check that the SOA serial numbers printed when updating a catalog zone
is represented correctly for numbers bigger than 2^31.

(cherry picked from commit de232ab446)
2022-12-15 13:31:04 +00:00
Artem Boldariev de9c75a532 Merge branch '3725-mutual-tls-session-resumption-fix-v9-18' into 'v9_18'
[Backport to 9.18] Fix TLS session resumption via IDs when Mutual TLS is used

See merge request isc-projects/bind9!7234
2022-12-14 17:45:52 +00:00
Artem Boldariev 055974a709 Update Release notes [GL #3725]
Mention that TLS session resumption for Mutual TLS has been fixed.

(cherry picked from commit 67d74e228f)
2022-12-14 18:32:32 +02:00
Artem Boldariev 3ce5d6c119 Update CHANGES [GL #3725]
Mention that TLS session resumption for Mutual TLS has been fixed.

(cherry picked from commit d8e04cdbc7)
2022-12-14 18:32:32 +02:00
Artem Boldariev e903ce1f3e Extend the 'doth' system test with a Mutual TLS resumption check
This commit adds a simple check to the 'doth' system test which
ensures that session resumption when Mutual TLS is used works as
expected.

(cherry picked from commit d5d31c6ba1)
2022-12-14 18:32:32 +02:00
Artem Boldariev 5de938c6cf Fix TLS session resumption via IDs when Mutual TLS is used
This commit fixes TLS session resumption via session IDs when
client certificates are used. To do so it makes sure that session ID
contexts are set within server TLS contexts. See OpenSSL documentation
for 'SSL_CTX_set_session_id_context()', the "Warnings" section.

(cherry picked from commit 837fef78b1)
2022-12-14 18:32:26 +02:00
Tony Finch 605e714438 Merge branch 'fanf-rsasha236-v9_18' into 'v9_18'
Fix a typo RSASHA236 -> RSASHA256

See merge request isc-projects/bind9!7224
2022-12-14 15:52:06 +00:00
Tony FinchandTony Finch d2fff95bc0 Fix a typo RSASHA236 -> RSASHA256
Use dns_secalg_format() to avoid error-prone repetition.

(cherry picked from commit c18a9a208d)
2022-12-14 15:51:33 +00:00
Tony Finch 1c68885cee Merge branch 'fanf-dnssec-algorithm-loglevel-v9_18' into 'v9_18'
List supported DNSSEC algorithms at log level NOTICE

See merge request isc-projects/bind9!7226
2022-12-14 12:30:14 +00:00
Tony FinchandTony Finch 24d02d0986 List supported DNSSEC algorithms at log level NOTICE
NOTICE matches the other startup messages. WARNING weirdly
suggests the list is a problem.

(cherry picked from commit 72f8d03cad)
2022-12-14 11:03:48 +00:00
Mark Andrews 18e407c712 Merge branch '3737-fix-initialisation-of-local-in-isdotlocal-in-dig-v9_18' into 'v9_18'
Resolve "fix initialisation of local. in isdotlocal in dig" [v9_18]

See merge request isc-projects/bind9!7221
2022-12-14 00:32:52 +00:00
Mark Andrews d2aa4ad87c Properly initialise local_ndata in isdotlocal in dig
Remove the trailing '\0' so that the length field of the dns_name_t
structure is correct.  The old data just happens to work with
dns_name_issubdomain but would fail with dns_name_equal.

(cherry picked from commit 8ce163bbc5)
2022-12-14 10:30:16 +11:00
Tom Krizek c5e392a226 Merge branch 'tkrizek/set-up-version-and-release-notes-for-bind-9.18.11' into 'v9_18'
Set up version and release notes for bind 9.18.11

See merge request isc-projects/bind9!7219
2022-12-13 16:18:12 +00:00
Tom Krizek 6b498a12cf Set up release notes for BIND 9.18.11 2022-12-13 17:02:14 +01:00
Tom Krizek 4d79f073b6 Update BIND version to 9.18.11-dev 2022-12-13 17:02:03 +01:00
Tom Krizek 7011eaf906 Update BIND version for release 2022-12-12 14:21:01 +01:00
Tom Krizek 08d554a913 Add a CHANGES marker 2022-12-12 14:04:01 +01:00
Tom Krizek eb67931800 Merge branch 'tkrizek/prepare-documentation-for-bind-9.18.10' into 'v9_18_10-release'
Prepare documentation for BIND 9.18.10

See merge request isc-private/bind9!488
2022-12-12 12:57:09 +00:00
Michał Kępień f799449fae Add release note for GL #3721 2022-12-12 12:53:31 +01:00
Michał Kępień d7585d507c Reorder release notes 2022-12-12 12:53:31 +01:00
Michał Kępień 91d0e488da Tweak and reword release notes 2022-12-12 12:53:31 +01:00
Michał Kępień b315fabdce Prepare release notes for BIND 9.18.10 2022-12-12 12:53:31 +01:00
Ondřej Surý e0bf7ed171 Merge branch '3731-attach-keyfileio-to-zone-v9_18' into 'v9_18'
Implement proper reference counting for dns_keyfileio_t

See merge request isc-projects/bind9!7210
2022-12-09 14:56:01 +00:00
Ondřej Surý 9ebd775e29 Implement proper reference counting for dns_keyfileio_t
Instead of relying on hash table search when using the keys, implement a
proper reference counting in dns_keyfileio_t objects, and attach/detach
the objects to the zone.

(cherry picked from commit 79115a0c3b)
2022-12-09 15:17:02 +01:00
Ondřej Surý 8b8c761a90 Merge branch 'pspacek/configure-doh-help-fix-v9_18' into 'v9_18'
Fix configure --disable-doh help text [v9_18]

See merge request isc-projects/bind9!7194
2022-12-08 10:17:41 +00:00
Petr ŠpačekandOndřej Surý 0d78be7057 Fix configure --disable-doh help text
This is technically fixup for 2bb454182b.

Related: !4926
(cherry picked from commit 5ec272007d)
2022-12-08 10:17:32 +00:00
Ondřej Surý c51cb3b390 Merge branch '3727-fix-off-by-one-reference-counting-in-zonemgr_keymgmt_delete-v9_18' into 'v9_18'
Release unused key file IO lock objects [v9.18]

See merge request isc-projects/bind9!7193
2022-12-08 10:17:15 +00:00
Ondřej Surý f79a9c856c Add CHANGES and release note for [GL #3727]
(cherry picked from commit 56a997b0b5)
2022-12-08 10:56:31 +01:00
Ondřej Surý 85f5071a6d Release unused key file IO lock objects
Due to off-by-one error in zonemgr_keymgmt_delete, unused key file IO
lock objects were never freed and they were kept until the server
shutdown.  Adjust the returned value by -1 to accomodate the fact that
the atomic_fetch_*() functions return the value before the operation and
not current value after the operation.

(cherry picked from commit fb1acd6736)
2022-12-08 10:56:31 +01:00
Tom Krizek b5d53e75b7 Merge branch 'tkrizek/revert-3678-serve-stale-servfail-v9_18' into 'v9_18'
Revert "Merge branch '3678-serve-stale-servfailing-unexpectedly-v9_18' into 'v9_18'"

See merge request isc-projects/bind9!7184
2022-12-08 09:31:50 +00:00
Tom Krizek f4d0b2dca9 Revert "Merge branch '3678-serve-stale-servfailing-unexpectedly-v9_18' into 'v9_18'"
This reverts commit 81b6f17e7c, reversing
changes made to ea47a9c100.

It also removes release note 6038, since the fix is reverted.
2022-12-08 10:22:33 +01:00
Mark Andrews aa7870cd2e Merge branch '3613-redo-dumping-expired-rdatasets-v9_18' into 'v9_18'
Resolve "TTL issue with resolver's cached and expired results for qtype ANY queries" [v9_18]

See merge request isc-projects/bind9!7188
2022-12-08 01:03:23 +00:00
Mark Andrews 2ddf710e40 Add CHANGES note for [GL #3613]
(cherry picked from commit 485e968087)
2022-12-07 23:59:36 +00:00
Mark Andrews d218c7f2f3 Remove different zero TTL handling for rdataset iterator
Zero TTL handling does not need to be different for 'rdatasetiter_first'
and 'rdatasetiter_next' and it interacts badly with 'bind_rdatadataset'
which makes different determinations.

(cherry picked from commit 1a39328feb)
2022-12-07 23:59:36 +00:00
Mark Andrews 47239b45e6 Add dns_db_allrdatasets options
'DNS_DB_STALEOK' returns stale rdatasets as well as current rdatasets.

'DNS_DB_EXPIREDOK' returns expired rdatasets as well as current
rdatasets. This option is currently only set when DNS_DB_STALEOK is
also set.

(cherry picked from commit 85048ddeee)
2022-12-07 23:59:36 +00:00
Mark Andrews 6f998bbe51 Extend dns_db_allrdatasets to control interation results
Add an options parameter to control what rdatasets are returned when
iteratating over the node.  Specific modes will be added later.

(cherry picked from commit 7695c36a5d)
2022-12-07 23:59:36 +00:00
Mark Andrews 434b53281b Properly select active rdatasets when iterating across node
Active rdatasets where not being properly selected in rdatasetiter_first
and rdatasetiter_next.

(cherry picked from commit 3bdab2d111)
2022-12-07 23:59:36 +00:00
Mark Andrews 52a9db2180 Check TTLs of mixed TTL ANY response with expired records
(cherry picked from commit e49f83499a)
2022-12-07 23:59:36 +00:00
Mark Andrews 50caecea06 Revert "Fix rndc dumpdb -expired for stuck cache contents"
This reverts commit f8d866c6ef.

(cherry picked from commit 90249e4aa5)
2022-12-07 23:59:36 +00:00
Mark Andrews 2cc91f65c4 Merge branch '3724-update-dig-tcp-documentation-v9_18' into 'v9_18'
Add reference to +tcp for +ignore [v9_18]

See merge request isc-projects/bind9!7186
2022-12-07 23:13:46 +00:00
Mark Andrews f8ce443684 Add reference to +tcp for +ignore
(cherry picked from commit b5951f0411)
2022-12-08 09:29:35 +11:00
Ondřej Surý 6c0577ad81 Merge branch 'ondrej-fix-missing-zone_check-in-checkds-system-test-v9_18' into 'v9_18'
Fix missing zone_check() call in checkds test [v9.18]

See merge request isc-projects/bind9!7182
2022-12-07 18:46:48 +00:00
Ondřej Surý 5164ba8d71 Fix missing zone_check() call in checkds test
The bad2-dswithdrawn.checkds tests were missing call to the
zone_checks() contributing to intermittent timing failures of the
checkds system test.

(cherry picked from commit 718831bfcc)
2022-12-07 19:34:42 +01:00
Ondřej Surý 31eed6a31f Merge branch '3183-send-shutdown-to-ns_client-on-shutdown-v9_18' into 'v9_18'
Propagate the shutdown event to the recursing ns_client(s) [v9.18]

See merge request isc-projects/bind9!7028
2022-12-07 18:33:27 +00:00
Ondřej Surý 2cb02a417a Add CHANGES and release notes for [GL #3183]
(cherry picked from commit d3f1639c16e7777a52d66c2dccd8b43a08a0750b)
2022-12-07 18:09:06 +01:00
Ondřej Surý 85e35d4c27 Propagate the shutdown event to the recursing ns_client(s)
Send the ns_query_cancel() on the recursing clients when we initiate the
named shutdown for faster shutdown.

When we are shutting down the resolver, we cancel all the outstanding
fetches, and the ISC_R_CANCEL events doesn't propagate to the ns_client
callback.

In the future, the better solution how to fix this would be to look at
the shutdown paths and let them all propagate from bottom (loopmgr) to
top (f.e. ns_client).

(cherry picked from commit d861d403bb9a7912e29a06aba6caf6d502839f1b)
2022-12-07 18:08:29 +01:00
Ondřej Surý d3ae26fa8e Merge branch '3386-nxdomain-serve-stale-v9_18' into 'v9_18'
don't keep stale NXDOMAIN cache entries [v9.18]

See merge request isc-projects/bind9!7180
2022-12-07 16:58:35 +00:00
Evan HuntandOndřej Surý 265d606fd3 CHANGES and release note for [GL #3386]
(cherry picked from commit 15f08ca961)
2022-12-07 17:46:53 +01:00
Evan HuntandOndřej Surý 2b78a2f9fa don't keep stale NXDOMAIN cache entries
when serve-stale is enabled, NXDOMAIN cache entries are no longer
preserved after the normal negative cache TTL, in order to reduce
unnecessary cache memory consumption.

(cherry picked from commit f1485ca145)
2022-12-07 17:21:00 +01:00
Matthijs Mekking b6df5bfe2b Merge branch 'matthijs-document-ns-minimal-responses-v9_18' into 'v9_18'
Document NS queries are excempt from minimal-responses

See merge request isc-projects/bind9!7176
2022-12-07 12:09:20 +00:00
Matthijs Mekking 7694e5019c Document NS queries are excempt from minimal-responses
Also document that DNSKEY, DS, CDNSKEY, and CDS never do additional
section processing.

(cherry picked from commit f7b477f6ea)
2022-12-07 12:06:43 +01:00
Michal Nowak f275e9896b Merge branch 'mnowak/asan-tsan-respdiff-jobs-v9_18' into 'v9_18'
[v9_18] Add ASAN- and TSAN-enabled respdiff jobs

See merge request isc-projects/bind9!7173
2022-12-07 09:40:47 +00:00
Michal Nowak af03ec8987 Add ASAN- and TSAN-enabled respdiff jobs
Neither of the new CI jobs can reliably pass at the moment; hence they
are defined with "allow_failure: true" until issues in the code base are
resolved.

(cherry picked from commit 4f23de554c)
2022-12-07 08:28:16 +01:00
Michal Nowak 865bc5c250 Extract TSAN parsing code
(cherry picked from commit 9856296666)
2022-12-07 08:27:56 +01:00
Mark Andrews 9dd77f770c Merge branch '3683-use-after-free-in-catalog-zone-processing-v9_18' into 'v9_18'
Resolve "use after free in catalog zone processing" [v9_18]

See merge request isc-projects/bind9!7170
2022-12-06 23:30:49 +00:00
Mark Andrews c8fa438768 Add release note for [GL #3683]
(cherry picked from commit 9843da3423)
2022-12-07 09:45:21 +11:00
Mark Andrews 569b7b20da Add CHANGES note for [GL #3683]
(cherry picked from commit 72402e1710)
2022-12-07 09:44:35 +11:00
Mark Andrews 814ae11d19 Check that restored catalog zone works
Using a restored catalog zone excercised a use-after-free bug.
The test checks that the use-after-free bug is gone and is just
a reasonable behaviour check in its own right.

(cherry picked from commit bca84c8601)
2022-12-07 09:44:35 +11:00
Mark Andrews 1e6a12091f Add missing DbC magic checks
Checking for value != NULL is not sufficient to detect use after
free errors.

(cherry picked from commit b1086a5561)
2022-12-07 09:44:35 +11:00
Mark Andrews 6e2a33dd4c Call dns_db_updatenotify_unregister earlier
dns_db_updatenotify_unregister needed to be called earlier to ensure
that listener->onupdate_arg always points to a valid object.  The
existing lazy cleanup in rbtdb_free did not ensure that.

(cherry picked from commit 35839e91d8)
2022-12-07 09:44:35 +11:00
Mark Andrews 90822519eb Suppress duplicate dns_db_updatenotify_register registrations
Duplicate dns_db_updatenotify_register registrations need to be
suppressed to ensure that dns_db_updatenotify_unregister is successful.

(cherry picked from commit f13e71e551)
2022-12-07 09:44:30 +11:00
Arаm Sаrgsyаn 81b6f17e7c Merge branch '3678-serve-stale-servfailing-unexpectedly-v9_18' into 'v9_18'
[v9_18] Resolve "stale-serve and RPZ put in SERVFAIL cache unexpected record"

See merge request isc-projects/bind9!7166
2022-12-06 15:01:29 +00:00
Michał KępieńandAram Sargsyan a4547a1093 Check for NULL before dereferencing qctx->rpz_st
Commit 9ffb4a7ba1 causes Clang Static
Analyzer to flag a potential NULL dereference in query_nxdomain():

    query.c:9394:26: warning: Dereference of null pointer [core.NullDereference]
            if (!qctx->nxrewrite || qctx->rpz_st->m.rpz->addsoa) {
                                    ^~~~~~~~~~~~~~~~~~~
    1 warning generated.

The warning above is for qctx->rpz_st potentially being a NULL pointer
when query_nxdomain() is called from query_resume().  This is a false
positive because none of the database lookup result codes currently
causing query_nxdomain() to be called (DNS_R_EMPTYWILD, DNS_R_NXDOMAIN)
can be returned by a database lookup following a recursive resolution
attempt.  Add a NULL check nevertheless in order to future-proof the
code and silence Clang Static Analyzer.

(cherry picked from commit 07592d1315)
2022-12-06 13:47:51 +00:00
Aram Sargsyan f92b3b496f Add a CHANGES note for [GL #3678]
(cherry picked from commit 5b5f3a0ea7)
2022-12-06 13:47:38 +00:00
Matthijs MekkingandAram Sargsyan 65443cb59f Consider non-stale data when in serve-stale mode
With 'stale-answer-enable yes;' and 'stale-answer-client-timeout off;',
consider the following situation:

A CNAME record and its target record are in the cache, then the CNAME
record expires, but the target record is still valid.

When a new query for the CNAME record arrives, and the query fails,
the stale record is used, and then the query "restarts" to follow
the CNAME target. The problem is that the query's multiple stale
options (like DNS_DBFIND_STALEOK) are not reset, so 'query_lookup()'
treats the restarted query as a lookup following a failed lookup,
and returns a SERVFAIL answer when there is no stale data found in the
cache, even if there is valid non-stale data there available.

With this change, query_lookup() now considers non-stale data in the
cache in the first place, and returns it if it is available.

(cherry picked from commit 86a80e723f)
2022-12-06 13:47:22 +00:00
Aram Sargsyan 4ae4f1fd48 Add serve-stale CNAME check with stale-answer-client-timeout off
Prime the cache with the following records:

    shortttl.cname.example.	1	IN	CNAME	longttl.target.example.
    longttl.target.example.	600	IN	A	10.53.0.2

Wait for the CNAME record to expire, disable the authoritative server,
and query 'shortttl.cname.example' again, expecting a stale answer.

(cherry picked from commit 21faf44ef7)
2022-12-06 13:46:55 +00:00
Mark Andrews ea47a9c100 Merge branch '3721-the-nslookup-command-does-not-obey-the-port-option-when-record-type-any-is-used-v9_18' into 'v9_18'
Resolve "The nslookup command does not obey the port option when record type ANY is used." [v9_18]

See merge request isc-projects/bind9!7164
2022-12-06 00:11:32 +00:00
Mark Andrews 0033c12002 Add CHANGES note for [GL #3721]
(cherry picked from commit 27168dbf43)
2022-12-06 09:22:39 +11:00
Mark Andrews 0569fa0d25 Remember that the port was set in host and nslookup
Set 'port_set = true;' so that the TCP/DOT/DOH code doesn't reset
the port when making connections.

(cherry picked from commit 8caa94bdf1)
2022-12-06 09:21:43 +11:00
Mark Andrews e1234f66c6 Add checks for 'host'
(cherry picked from commit e9c4192ee5)
2022-12-06 09:21:43 +11:00
Mark Andrews 375918493e Check ANY lookup using nslookup
(cherry picked from commit c367dd1b0b)
2022-12-06 09:21:43 +11:00
Artem Boldariev 825c40697e Merge branch 'artem-tls-tcp-compatibility-fixes-v9-18' into 'v9_18'
[Partial backport to 9.18] TLS Stream: TCP transport compatibility fixes

See merge request isc-projects/bind9!7160
2022-12-02 21:45:54 +00:00
Artem Boldariev f921cb4579 TLS: take 'sock->recv_read' flag into assumption
For compatibility with TCP this commit adds some trivial logic related
to 'sock->recv_read' flag processing.
2022-12-02 15:37:41 +02:00
Artem Boldariev c1c22ad69a TLS stream: always handle send callbacks asynchronously
This commit ensures that send callbacks are always called from within
the context of its worker thread even in the case of
shuttigdown/inactive socket, just like TCP transport does and with
which TLS attempts to be as compatible as possible.

(cherry picked from commit 2bfc079946)
2022-12-02 15:37:41 +02:00
Artem Boldariev 66bec1d886 TLS Stream: use ISC_R_CANCELLED error when shutting down
This commit changes ISC_R_NOTCONNECTED error code to ISC_R_CANCELLED
when attempting to start reading data on the shutting down socket in
order to make its behaviour compatible with that of TCP and not break
the common code in the unit tests.

(cherry picked from commit ef659365ce)
2022-12-02 15:37:41 +02:00
Artem Boldariev fbec0ece73 Merge branch 'artem-tls-check-for-recv_cb-v9-18' into 'v9_18'
TLS: check for sock->recv_cb when handling received data

See merge request isc-projects/bind9!7159
2022-12-02 13:31:42 +00:00
Artem Boldariev fc637fbdc3 TLS: check for sock->recv_cb when handling received data
This commit adds a check if 'sock->recv_cb' might have been nullified
during the call to 'sock->recv_cb'. That could happen, e.g. by an
indirect call to 'isc_nmhandle_close()' from within the callback when
wrapping up.

In this case, let's close the TLS connection.

(cherry picked from commit bed5e2bb08)
2022-12-02 14:29:36 +02:00
Tom Krizek 90b924be13 Merge branch 'tkrizek/system-tests-prereqs-v9_18' into 'v9_18'
Unify system test feature detection and add missing prerequisites [v9_18]

See merge request isc-projects/bind9!7156
2022-12-02 11:33:38 +00:00
Tom Krizek ca4ebedf02 Add dnstap prerequisite for dnstap system test
(cherry picked from commit 9846c920c3)
2022-12-02 10:45:21 +01:00
Tom Krizek 5a0d5c6e6f Add libnghttp2 prerequisite for doth system test
While some of these tests are for DoT which doesn't require nghttp2,
the server configs won't allow the server to start without nghttp2
support during compile time.

It might be possible to split these tests into DoT and DoH and only
require nghttp2 for DoH tests, but since almost all of our CI jobs are
compiled with nghttp2, we wouldn't gain a lot of coverage, so it's
probably not worth the effort.

(cherry picked from commit f514604613)
2022-12-02 10:45:21 +01:00
Tom Krizek 184f6d25e5 Add lmdb prerequisite for nzd2nzf system test
(cherry picked from commit b1e011e158)
2022-12-02 10:45:21 +01:00
Tom Krizek 8339c60346 Check for pkcs11-tool in keyfromlabel system test
pkcs11-tool which is typically part of the opensc package is required
for the keyfromlabel test.

(cherry picked from commit e9d9f11539)
2022-12-02 10:45:21 +01:00
Tom Krizek e8f1c7e1fb Use feature-test feature detection in pytests
Avoid using the environment variables for feature detection and use the
feature-test utility instead.

Remove the obsolete environment variables from conf.sh, since they're no
longer used anywhere.

(cherry picked from commit 9730ac4c56)
2022-12-02 10:45:21 +01:00
Tom Krizek a97a72fb8b Use feature-test to detect feature support in system tests
Previously, there were two different ways to detect feature support.
Either through an environment variable set by configure in conf.sh, or
using the feature-test utility.

It is more simple and consistent to have only one way of detecting the
feature support. Using the feature-test utility seems superior the the
environment variables set by configure.

(cherry picked from commit d24fb1122e)
2022-12-02 10:45:20 +01:00
Tom Krizek 418f7bb0ae Add missing options to feature-test utility
(cherry picked from commit e22d27da71)
2022-12-02 10:45:18 +01:00
Ondřej Surý 8b51844c2d Merge branch 'ondrej-fix-single-read-tlsdns-client-v9_18' into 'v9_18'
Honour single read per client isc_nm_read() call in the TLSDNS [v9.18]

See merge request isc-projects/bind9!7153
2022-12-01 18:33:06 +00:00
Ondřej Surý f17f5e831b Honour single read per client isc_nm_read() call in the TLSDNS
The TLSDNS transport was not honouring the single read callback for
TLSDNS client.  It would call the read callbacks repeatedly in case the
single TLS read would result in multiple DNS messages in the decoded
buffer.

(cherry picked from commit e3c628d562)
2022-12-01 19:07:22 +01:00
Matthijs Mekking 8b14eb577f Merge branch 'matthijs-deprecate-alt-transfer-source-v9_18' into 'v9_18'
[v9_18] Deprecate alt-transfer-source and companions

See merge request isc-projects/bind9!7149
2022-12-01 07:39:45 +00:00
Matthijs Mekking 9f73e2d6f8 Mention deprecation of alternate transfer source
In the CHANGES and release notes.

(cherry picked from commit 7920347077)
2022-12-01 08:15:45 +01:00
Matthijs Mekking 132387b658 Add missing deprecated tag to max-zone-ttl
This option was deprecated in commit 19352dd187 but at that time
we didn't mark it deprecated in the ARM reference.

(cherry picked from commit 13a16c1f4d)
2022-12-01 08:14:49 +01:00
Matthijs Mekking b4429660da Deprecate alt-transfer-source and companions
Deprecate the alternate transfer sources from BIND 8.

(cherry picked from commit 105465d316)
2022-12-01 08:14:42 +01:00
Michał Kępień 2b242cb9e3 Merge branch 'matthijs/update-serve-stale-test-messages-to-include-rrtype-v9_18' into 'v9_18'
[v9_18] Update serve-stale test messages to include RRtype

See merge request isc-projects/bind9!7146
2022-11-30 13:59:43 +00:00
Matthijs MekkingandMichał Kępień fe910b2cc0 Update serve-stale test messages to include RRtype
(cherry picked from commit 45f7a15785)
2022-11-30 14:29:30 +01:00
Michał Kępień cd195ba77e Merge branch '3707-dont-log-final-reference-detached-on-LOG_INFO-v9_18' into 'v9_18'
Don't log "final reference detached" on INFO level [v9.18]

See merge request isc-projects/bind9!7143
2022-11-30 13:27:42 +00:00
Ondřej Surý 8675a1ac53 Add CHANGES and release note for [GL #3707]
(cherry picked from commit 116d1b94a9)
2022-11-30 11:50:19 +01:00
Ondřej Surý 343e67ad39 Don't log "final reference detached" on INFO level
The "final reference detached" message was meant to be DEBUG(1), but was
instead kept at INFO level.  Move it to the DEBUG(1) logging level, so
it's not printed under normal operations.

(cherry picked from commit 1816244725)
2022-11-30 11:49:51 +01:00
Ondřej Surý 06216b0117 Merge branch '3693-crash-when-restarting-server-with-active-statschannel-connection-v9_18' into 'v9_18'
Be more resilient when destroying the httpd request [v9.18]

See merge request isc-projects/bind9!7112
2022-11-29 09:32:35 +00:00
Ondřej Surý 469579e71e Add CHANGES and release note for [GL #3693]
(cherry picked from commit 32e0df2a13)
2022-11-29 10:11:36 +01:00
Ondřej Surý 349b0f433b Be more resilient when destroying the httpd request
Handle the situation in the read and send callbacks when the
httpd->readhandle has been already detached; f.e. from the previous
iteration of the read callback.

Don't detach the httpd->readcallback from the isc_httpdmgr_shutdown()
and the send callback, but rather call isc_nm_cancelread() to shutdown
the http request from the read callback.
2022-11-29 10:11:28 +01:00
Michal Nowak bc8c055c6d Merge branch 'mnowak/llvm-15-v9_18' into 'v9_18'
[v9_18] Update clang to version 15

See merge request isc-projects/bind9!7133
2022-11-29 09:00:23 +00:00
Michal Nowak 1d7d504338 Update sources to Clang 15 formatting 2022-11-29 09:14:07 +01:00
Michal Nowak 6fac8ef4be Update clang to version 15
(cherry picked from commit 26a42ed1ac)
2022-11-29 09:05:16 +01:00
Mark Andrews 81e9636d6d Merge branch '3702-man-page-dig-1-typo-in-options-v9_18' into 'v9_18'
Fix typo in dig man page '+qr' should be '+noqr' [v9_18]

See merge request isc-projects/bind9!7132
2022-11-28 23:07:10 +00:00
Mark Andrews acdf043360 Fix typo in dig man page '+qr' should be '+noqr'
Reported by Fabian P. Schmidt

(cherry picked from commit 3769266318)
2022-11-29 09:45:36 +11:00
Michal Nowak 8abb2b780f Merge branch '3310-build-contrib-in-ci-v9_18' into 'v9_18'
[v9_18] Build contrib in CI & associated fixes

See merge request isc-projects/bind9!7113
2022-11-28 13:24:23 +00:00
Michal Nowak 65cc924042 Help gcovr find contrib files
(cherry picked from commit 445a90fb78)
2022-11-28 13:30:38 +01:00
Michal Nowak 56abbea62c Add install target for Perl DLZ module
Perl DLZ module Makefile lacked "install" target, add it as we want to
test DLZ module installation in the CI.

(cherry picked from commit 35e44978b5)
2022-11-28 13:30:38 +01:00
Michal Nowak 2d747f7312 Disable compound-token-split-by-macro warning with Clang
Perl DLZ module compilation with Clang produces the following warning:

    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:150:5: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
        ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:80:38: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
    #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                         ^~~~~~~~~~
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/perl.h:666:29: note: expanded from macro 'STMT_START'
    #   define STMT_START   (void)( /* gcc supports "({ STATEMENTS; })" */
                                  ^
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:150:5: note: '{' token is here
        ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
    #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                                    ^

(cherry picked from commit 69b7e4362d)
2022-11-28 13:30:37 +01:00
Michal Nowak c49b5d9d1d Build contrib dlz modules in the CI
(cherry picked from commit 4a4a91b012)
2022-11-28 13:30:37 +01:00
Michal Nowak d25dc23563 Leverage CFLAGS from environment in contrib Makefiles
(cherry picked from commit 4affc436d3)
2022-11-28 13:30:37 +01:00
Michal Nowak e23fb140fa Fix statement may fall through warnings in dlz_ldap_dynamic.c
dlz_ldap_dynamic.c: In function ‘dlz_create’:
    dlz_ldap_dynamic.c:971:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      971 |                 if (result != ISC_R_SUCCESS) {
          |                    ^
    dlz_ldap_dynamic.c:974:9: note: here
      974 |         case 11:
          |         ^~~~
    dlz_ldap_dynamic.c:976:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      976 |                 if (result != ISC_R_SUCCESS) {
          |                    ^
    dlz_ldap_dynamic.c:979:9: note: here
      979 |         case 10:
          |         ^~~~
    dlz_ldap_dynamic.c:980:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      980 |                 if (strlen(argv[9]) > 0) {
          |                    ^
    dlz_ldap_dynamic.c:987:9: note: here
      987 |         case 9:
          |         ^~~~

(cherry picked from commit 99912ed2f7)
2022-11-28 13:30:37 +01:00
Michal Nowak f47990aa6e Fix compilation warnings in dlz_wildcard_dynamic.c
dlz_wildcard_dynamic.c: In function ‘dlz_lookup’:
    dlz_wildcard_dynamic.c:227:14: warning: variable ‘origin’ set but not used [-Wunused-but-set-variable]
      227 |         bool origin = true;
          |              ^~~~~~
    dlz_wildcard_dynamic.c: In function ‘dlz_lookup’:
    dlz_wildcard_dynamic.c:252:28: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      252 |                 cd->record = "@";
          |                            ^
    dlz_wildcard_dynamic.c: In function ‘dlz_authority’:
    dlz_wildcard_dynamic.c:328:22: warning: unused variable ‘origin’ [-Wunused-variable]
      328 |                 bool origin;
          |                      ^~~~~~
    dlz_wildcard_dynamic.c:312:25: warning: unused variable ‘name’ [-Wunused-variable]
      312 |         const char *p, *name = "@";
          |                         ^~~~
    dlz_wildcard_dynamic.c: In function ‘dlz_create’:
    dlz_wildcard_dynamic.c:441:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
      441 |         for (i = 4; i < argc; i += 4) {
          |                       ^

(cherry picked from commit 76c8c58d54)
2022-11-28 13:30:37 +01:00
Michal Nowak 48c3891603 Fix compilation warnings in dlz_sqlite3_dynamic.c
dlz_sqlite3_dynamic.c: In function ‘dlz_sqlite3_fetch_row’:
    dlz_sqlite3_dynamic.c:447:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
      447 |                 if (rs->pnRow > 0U && rs->curRow < rs->pnRow) {
          |                               ^
    dlz_sqlite3_dynamic.c:447:50: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
      447 |                 if (rs->pnRow > 0U && rs->curRow < rs->pnRow) {
          |                                                  ^

(cherry picked from commit 60f68dc0d6)
2022-11-28 13:30:37 +01:00
Michal Nowak 2a52f343a3 Fix warnings in dlz_mysqldyn_mod.c
dlz_mysqldyn_mod.c: In function ‘dlz_findzonedb’:
    dlz_mysqldyn_mod.c:1079:73: warning: unused parameter ‘methods’ [-Wunused-parameter]
     1079 | dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
          |                                                ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    dlz_mysqldyn_mod.c:1080:34: warning: unused parameter ‘clientinfo’ [-Wunused-parameter]
     1080 |                dns_clientinfo_t *clientinfo) {
          |                ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
    dlz_mysqldyn_mod.c: In function ‘dlz_lookup’:
    dlz_mysqldyn_mod.c:1111:63: warning: unused parameter ‘methods’ [-Wunused-parameter]
     1111 |            dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
          |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    dlz_mysqldyn_mod.c: In function ‘build_query’:
    dlz_mysqldyn_mod.c:465:19: warning: pointer ‘item’ used after ‘free’ [-Wuse-after-free]
      465 |              item = DLZ_LIST_NEXT(item, link))
    dlz_mysqldyn_mod.c:470:17: note: call to ‘free’ here
      470 |                 free(item);
          |                 ^~~~~~~~~~

(cherry picked from commit 587ea10567)
2022-11-28 13:30:37 +01:00
Michal Nowak 0d8032842c Fix compilation warnings in dlz_perl_driver.c
dlz_perl_driver.c: In function ‘dlz_version’:
    dlz_perl_driver.c:116:27: warning: unused parameter ‘flags’ [-Wunused-parameter]
      116 | dlz_version(unsigned int *flags) {
          |             ~~~~~~~~~~~~~~^~~~~
    In file included from /usr/lib64/perl5/CORE/perl.h:5685,
                     from dlz_perl_driver.c:33:
    dlz_perl_driver.c: In function ‘dlz_allnodes’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:151:17: note: in expansion of macro ‘POPs’
      151 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_allowzonexfr’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:251:17: note: in expansion of macro ‘POPs’
      251 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_findzonedb’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:328:17: note: in expansion of macro ‘POPs’
      328 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_lookup’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:407:17: note: in expansion of macro ‘POPs’
      407 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c:472:1: error: no previous prototype for ‘missing_perl_method’ [-Werror=missing-prototypes]
      472 | missing_perl_method(const char *perl_class_name, PerlInterpreter *my_perl)
          | ^~~~~~~~~~~~~~~~~~~
    dlz_perl_driver.c: In function ‘missing_perl_method’:
    dlz_perl_driver.c:485:9: error: ISO C90 forbids array ‘full_name’ whose size cannot be evaluated [-Werror=vla]
      485 |         char full_name[BUF_LEN];
          |         ^~~~
    dlz_perl_driver.c: In function ‘dlz_create’:
    dlz_perl_driver.c:613:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      613 |         if (missing_method_name = missing_perl_method(perl_class_name, my_perl))
          |             ^~~~~~~~~~~~~~~~~~~
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:657:17: note: in expansion of macro ‘POPs’
      657 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c:502:15: warning: unused variable ‘init_args’ [-Wunused-variable]
      502 |         char *init_args[] = { NULL, NULL };
          |               ^~~~~~~~~

(cherry picked from commit be928dbba2)
2022-11-28 13:30:36 +01:00
Tony Finch 204387be3c Merge branch 'fanf-deduplicate-time-units-v9_18' into 'v9_18'
Deduplicate time unit conversion factors [v9_18]

See merge request isc-projects/bind9!7126
2022-11-25 15:08:39 +00:00
Tony FinchandTony Finch 303cdf8e27 Deduplicate time unit conversion factors
The various factors like NS_PER_MS are now defined in a single place
and the names are no longer inconsistent. I chose the _PER_SEC names
rather than _PER_S because it is slightly more clear in isolation;
but the smaller units are always NS, US, and MS.

(cherry picked from commit 00307fe318)
2022-11-25 14:16:09 +00:00
Tom Krizek 2c03ac2f5f Merge branch 'tkrizek/system-tests-start-stop-helpers-v9_18' into 'v9_18'
Simplify start/stop helper func in system tests [v9_18]

See merge request isc-projects/bind9!7124
2022-11-25 13:25:48 +00:00
Tom Krizek 34eda91697 Simplify start/stop helper func in system tests
The system test should never attempt to start or stop any other server
than those that belong to that system test. Therefore, it is not
necessary to specify the system test name in function calls.

Additionally, this makes it possible to run the test inside a
differently named directory, as its name is automatically detected with
the $SYSTESTDIR variable. This enables running the system tests inside a
temporary directory.

Direct use of stop.pl was replaced with a more systematic approach to
use stop_servers helper function.

(cherry picked from commit c100308b7d)
2022-11-25 12:57:46 +01:00
Mark Andrews 2c4054a2f7 Merge branch '3638-tls-settings-for-primaries-not-saved-for-catalog-zone-entries-v9_18' into 'v9_18'
Resolve "TLS settings for primaries not saved for catalog zone entries." [v9_18]

See merge request isc-projects/bind9!7122
2022-11-25 00:04:40 +00:00
Mark Andrews f21c770733 Back port @DEFAULT_HMAC@ changes for tsig_key in catz 2022-11-25 10:42:53 +11:00
Mark Andrews 567fc35fba Add release note for [GL #3638]
(cherry picked from commit 7e223f5e55)
2022-11-25 09:57:30 +11:00
Mark Andrews f19e688b73 Add CHANGES note for [GL #3638]
(cherry picked from commit de3bd0d3d6)
2022-11-25 09:57:30 +11:00
Mark Andrews 55bcdcf943 Add catalog zone that requires TLS for all transfers
Both the catalog zone (catalog-tls.example) the zone managed using
the catalog zone (tls1.example) require TLS and a TSIG for zone
transfers.

(cherry picked from commit bb66ef2a47)
2022-11-25 09:57:30 +11:00
Mark Andrews 6b8abcae4a Fix log messages incorrectly logged at error
The log message "got TLS configuration for zone transfer" is not
an error, setting to info.

(cherry picked from commit b95d089751)
2022-11-25 09:57:30 +11:00
Mark Andrews 2fcd842a82 TLS setting of primaries with catalog zones where being ignored
Extract the tlss values if present from the ipkeylist entry and add
the resulting tls setting to the constructed configuration for the
primary.

When comparing catalog zone entries for reuse also check the
masters.tlss values for equality.

(cherry picked from commit 65f2512315)
2022-11-25 09:57:30 +11:00
Michal Nowak d8027595c5 Merge branch 'mnowak/gcovr-cleanup-v9_18' into 'v9_18'
[v9_18] Various gcovr clean-ups

See merge request isc-projects/bind9!7109
2022-11-23 15:46:36 +00:00
Michal Nowak b1b1e1b4f1 Restructure inline-function helpers for code coverage
(cherry picked from commit fdad6ff7c7)
2022-11-23 15:04:21 +01:00
Michal Nowak fa3f04a7ff Drop redundant code coverage helper
The "hash.h" file does not need to be copied to "lib/dns/" for the gcovr
tool to generate the code coverage report, as it has been copied
already.

(cherry picked from commit 6b1dd7d6b1)
2022-11-23 15:04:17 +01:00
Michal Nowak 71d1e19c3c Drop buffer.h helper for fuzz directory
The "fuzz" directory is no longer included in the code coverage report
and the associated buffer.h helper is no longer needed.

(cherry picked from commit 8b9c04342d)
2022-11-23 15:04:12 +01:00
Michal Nowak 9395362503 Exclude fuzz directory from code coverage report
gcovr fails to process fuzz/old.gcda and fuzz/old.gcno files after !7045
MR with:

    (WARNING) GCOV produced the following errors processing /builds/isc-projects/bind9/fuzz/old.gcda:
    	Cannot open source file ../../fuzz/old.c
    Cannot open source file ../../lib/dns/include/dns/compress.h
    Cannot open source file ../../lib/isc/include/isc/buffer.h
    ...
    (gcovr could not infer a working directory that resolved it.)

Given that code coverage inspection is meant only for BIND 9 code and
not its tests and auxiliary tools, the "fuzz" directory should be
excluded from being included in the code coverage report.

(cherry picked from commit 3b5e9666c6)
2022-11-23 15:04:07 +01:00
Matthijs Mekking 00e776dae4 Merge branch '3667-deprecate-auto-dnssec-v9_18' into 'v9_18'
[v9_18] Deprecate auto-dnssec

See merge request isc-projects/bind9!7106
2022-11-23 11:37:01 +00:00
Matthijs Mekking 2c4e680142 Add CHANGES and release note for GL #3667
Announce deprecation of 'auto-dnssec'.

(cherry picked from commit fde1d89d03)
2022-11-23 11:21:39 +01:00
Matthijs Mekking 556acc0b85 Deprecate auto-dnssec
Deprecate auto-dnssec, add specific log warning to migrate to
dnssec-policy.

(cherry picked from commit f9845dd128)
2022-11-23 11:19:40 +01:00
Ondřej Surý 93dfa63ac2 Merge branch '3676-deprecate-operating-system-resource-limits-v9_18' into 'v9_18'
Deprecate setting operating system limits from named.conf

See merge request isc-projects/bind9!7103
2022-11-21 17:36:50 +00:00
Ondřej Surý 8145183c73 Add CHANGES and release note [GL #3676]
(cherry picked from commit 65156afb8c)
2022-11-21 15:57:40 +01:00
Ondřej Surý 0d1c3ef7c2 Deprecate setting operating system limits from named.conf
It was possible to set operating system limits (RLIMIT_DATA,
RLIMIT_STACK, RLIMIT_CORE and RLIMIT_NOFILE) from named.conf.  It's
better to leave these untouched as setting these is responsibility of
the operating system and/or supervisor.

Deprecate the configuration options and remove them in future BIND 9
release.

(cherry picked from commit 379929e052)
2022-11-21 15:57:09 +01:00
Tony Finch a2f4f9bb92 Merge branch '3655-decompress-faster-v9_18' into 'v9_18'
Simplify and speed up DNS name decompression

See merge request isc-projects/bind9!7099
2022-11-21 13:43:41 +00:00
Tony Finch 4e14f91380 Simplify and speed up DNS name decompression
The aim is to do less work per byte:

  * Check the bounds for each label, instead of checking the
    bounds for each character.

  * Instead of copying one character at a time from the wire to
    the name, copy entire runs of sequential labels using memmove()
    to make the most of its fast loop.

  * To remember where the name ends, we only need to set the end
    marker when we see a compression pointer or when we reach the
    root label. There is no need to check if we jumped back and
    conditionally update the counter for every character.

  * To parse a compression pointer, we no longer take a diversion
    around the outer loop in between reading the upper byte of the
    pointer and the lower byte.

  * The parser state machine is now implicit in the instruction
    pointer, instead of being an explicit variable. Similarly,
    when we reach the root label we break directly out of the loop
    instead of setting a second state machine variable.

  * DNS_NAME_DOWNCASE is never used with dns_name_fromwire() so
    that option is no longer supported.

I have removed this comment which dated from January 1999 when
dns_name_fromwire() was first introduced:

   /*
    * Note:  The following code is not optimized for speed, but
    * rather for correctness.  Speed will be addressed in the future.
    */

No functional change, apart from removing support for the unused
DNS_NAME_DOWNCASE option. The new code is about 2x faster than the
old code: best case 11x faster, worst case 1.4x faster.
2022-11-21 13:43:01 +00:00
Michal Nowak c8958e369f Merge branch 'mnowak/fedora-37-v9_18' into 'v9_18'
[v9_18] Add Fedora 37

See merge request isc-projects/bind9!7101
2022-11-21 13:18:11 +00:00
Michal Nowak ecd9ed84ea Add Fedora 37
(cherry picked from commit b293b2c638)
2022-11-21 13:49:27 +01:00
Michał Kępień 52269888fa Merge branch 'matthijs-tweak-kasp-test-v9_18' into 'v9_18'
[v9_18] Tweak kasp system test script

See merge request isc-projects/bind9!7094
2022-11-17 12:28:06 +00:00
Matthijs Mekking ba2ef65483 Tweak kasp system test script
The retry 3 times when checking signatures did not make sense because
at this point the input file does not change.

Raise the number of retries when checking the apex DNSKEY response to
reduce the number of intermittent failures due to unexpected delays.

(cherry picked from commit 6ef0417274)
2022-11-17 12:31:48 +01:00
Mark Andrews e1b7db99e2 Merge branch '3607-apex-in-name_external-may-be-invalid-when-using-dual-stack-servers-v9_18' into 'v9_18'
Resolve "apex in name_external may be invalid when using dual stack servers" [v9_18]

See merge request isc-projects/bind9!7092
2022-11-17 02:37:47 +00:00
Mark Andrews 55d817b0b6 Add CHANGES note for [GL #3607]
(cherry picked from commit 8a2149f502)
2022-11-17 13:05:12 +11:00
Mark Andrews 726aa21913 Add system test for dual-stack-servers with possible DNAME response
Create a zone that triggers DNAME owner name checks in a zone that
is only reachable using a dual stack server.  The answer contains
a name that is higher in the tree than the query name.

e.g.
	foo.v4only.net.	CNAME	v4only.net.
	v4only.net.	A	10.0.0.1

ns4 is serving the test zone (ipv4-only)
ns6 is the root server for this test (dual stacked)
ns7 is acting as the dual stack server (dual stacked)
ns9 is the server under test (ipv6-only)

(cherry picked from commit f946133ec9)
2022-11-17 13:05:12 +11:00
Mark Andrews c77af4be6f Support starting and stopping IPv6 only servers
Look for $testdir/$server/named.ipv6-only and use
fd92:7065:b8e:ffff::$n instead of 10.53.0.$n to
communicate with the server.

(cherry picked from commit a35c34e10f)
2022-11-17 13:05:12 +11:00
Mark Andrews 43e714336a Select the appropriate namespace when using a dual stack server
When using dual-stack-servers the covering namespace to check whether
answers are in scope or not should be fctx->domain.  To do this we need
to be able to distingish forwarding due to forwarders clauses and
dual-stack-servers.  A new flag FCTX_ADDRINFO_DUALSTACK has been added
to signal this.

(cherry picked from commit dfbffd77f9)
2022-11-17 13:05:12 +11:00
Mark Andrews eaa97f48df Merge branch '1905-check-wildcard-in-checkconf-z-v9_18' into 'v9_18'
Fix 'named-checkconf -z' was ignoring check-wildcard settings in named.conf [v9_18]

See merge request isc-projects/bind9!7090
2022-11-17 00:53:46 +00:00
Mark Andrews 4906ae9fe0 Check 'named-checkconf -z' and check-wildcard
Add tests to check the behavior of 'named-checkconf -z' and
check-wildcard setting in named.conf.

(cherry picked from commit 708dadac59)
2022-11-17 10:58:54 +11:00
Mark Andrews 27250ec8d2 named-checkzone -z ignored the check-wildcard option
Lookup and set the wildcard option according to the configuration
settings.  The default is on as per bin/named/config.c.

(cherry picked from commit dfc5c1e018)
2022-11-17 10:54:36 +11:00
Michal Nowak f0fc13e408 Merge tag 'v9_18_9' into v9_18
BIND 9.18.9
2022-11-16 15:49:55 +01:00
Michal Nowak adc93de268 Merge branch 'mnowak/openbsd-7.2-v9_18' into 'v9_18'
[v9_18] Add OpenBSD 7.2

See merge request isc-projects/bind9!7082
2022-11-15 09:52:54 +00:00
Michal Nowak 4f180ee1f6 Add OpenBSD 7.2
(cherry picked from commit b239e6870d)
2022-11-15 08:32:29 +01:00
Michal Nowak 5ddc9bd59c Merge branch '2265-fix-and-check-bashisms-v9_18' into 'v9_18'
[v9_18] Fix and check bashisms in system test

See merge request isc-projects/bind9!7080
2022-11-14 20:34:42 +00:00
Michal Nowak ebdf9336e3 Add checkbashisms CI job
(cherry picked from commit 47a7c5123a)
2022-11-14 21:03:01 +01:00
Michal Nowak e30f71f6f1 Replace "sha1sum" with "openssl sha1 -r"
"sha1sum" is part of GNU Coreutils, neither BIND 9 dependency nor POSIX.
Replace it with "openssl sha1 -r" as OpenSSL is BIND 9 dependency.

(cherry picked from commit d34c7ae227)
2022-11-14 21:03:01 +01:00
Michal Nowak 18965b6ecd Rename $HOSTNAME to $HOST_NAME to silence checkbashisms
checkbashisms warns about possible reliance on HOSTNAME environmental
variable which Bash sets to the name of the current host, and some
commands may leverage it:

    possible bashism in builtin/tests.sh line 199 ($HOST(TYPE|NAME)):
    grep "^\"$HOSTNAME\"$" dig.out.ns1.$n > /dev/null || ret=1
    possible bashism in builtin/tests.sh line 221 ($HOST(TYPE|NAME)):
    grep "^\"$HOSTNAME\"$" dig.out.ns2.$n > /dev/null || ret=1
    possible bashism in builtin/tests.sh line 228 ($HOST(TYPE|NAME)):
    grep "^; NSID: .* (\"$HOSTNAME\")$" dig.out.ns2.$n > /dev/null || ret=1

We don't use the variable this way but rename it to HOST_NAME to silence
the tool.

(cherry picked from commit ae33a8ddea)
2022-11-14 21:03:01 +01:00
Michal Nowak c13bb5a7c1 Remove no-op assignment from kasp/tests.sh
"next_key_event_threshold" is assigned with
"next_key_event_threshold+i", but "i" is empty (never set, nor used
afterwards).

posh, the Policy-compliant Ordinary SHell, failed on this assignment
with:

    tests.sh:253: : unexpected `end of expression'

(cherry picked from commit 00c3b1e309)
2022-11-14 21:03:01 +01:00
Michal Nowak d247b6c09e Remove unused $@ array from cds/setup.sh
posh, the Policy-compliant Ordinary SHell, failed with:

    setup.sh:57: @: parameter not set

(cherry picked from commit 02a4a95395)
2022-11-14 21:03:01 +01:00
Michal Nowak a55099ba5b Drop interpolated string replacement
Interpolated string is Bashism:

    possible bashism in bin/tests/system/engine_pkcs11/setup.sh line 34 ($'...' should be "$(printf '...')"):
            pkcs11-tool --module $SOFTHSM2_MODULE --token-label "softhsm2-engine_pkcs11" -l -k --key-type $type:$bits --label "${label}" --id "${p11id//$'\n'/}" --pin $(cat $PWD/pin) > pkcs11-tool.out.$zone.$id 2> pkcs11-tool.err.$zone.$id || return 1
    possible bashism in bin/tests/system/engine_pkcs11/setup.sh line 34 (${parm/?/pat[/str]}):
            pkcs11-tool --module $SOFTHSM2_MODULE --token-label "softhsm2-engine_pkcs11" -l -k --key-type $type:$bits --label "${label}" --id "${p11id//$'\n'/}" --pin $(cat $PWD/pin) > pkcs11-tool.out.$zone.$id 2> pkcs11-tool.err.$zone.$id || return 1
    possible bashism in bin/tests/system/keyfromlabel/tests.sh line 27 ($'...' should be "$(printf '...')"):
            pkcs11-tool --module $SOFTHSM2_MODULE --token-label "softhsm2-keyfromlabel" -l -k --key-type $type:$bits --label "${label}" --id "${p11id//$'\n'/}" --pin $(cat $PWD/pin) > pkcs11-tool.out.$zone.$id || return 1
    possible bashism in bin/tests/system/keyfromlabel/tests.sh line 27 (${parm/?/pat[/str]}):
            pkcs11-tool --module $SOFTHSM2_MODULE --token-label "softhsm2-keyfromlabel" -l -k --key-type $type:$bits --label "${label}" --id "${p11id//$'\n'/}" --pin $(cat $PWD/pin) > pkcs11-tool.out.$zone.$id || return 1

The replacement is actually not needed as $p11id holds only one line.

Also see https://www.shellcheck.net/wiki/SC3003 and
https://www.shellcheck.net/wiki/SC3060.

(cherry picked from commit ac3fcb612d)
2022-11-14 21:03:01 +01:00
Michal Nowak 64311314dc Join two rndc lines not to confuse checkbashisms
checkbashisms gets confused by the rndc command being on two lines:

    possible bashism in bin/tests/system/nzd2nzf/tests.sh line 37 (type):
    rndccmd 10.53.0.1 addzone "added.example { type primary; file \"added.db\";

(cherry picked from commit 9eb2f6b0e8)
2022-11-14 21:03:00 +01:00
Michal Nowak e7e0d1dd0a Replace string comparisons with integer comparisons
checkbashisms reports Bash-style ("==") string comparisons inside test/[
command:

    possible bashism in bin/tests/system/checkconf/tests.sh line 105 (should be 'b = a'):
                    if [ $? == 0 ]; then echo_i "failed"; ret=1; fi
    possible bashism in bin/tests/system/keyfromlabel/tests.sh line 62 (should be 'b = a'):
                    test $ret == 0 || continue
    possible bashism in bin/tests/system/keyfromlabel/tests.sh line 79 (should be 'b = a'):
                    test $ret == 0 || continue

(cherry picked from commit 7640fc5b39)
2022-11-14 21:02:59 +01:00
Michal Nowak 5bab6f2104 Add shell interpreter line where missing
The checkbashisms script reports errors like this one:

    script util/check-line-length.sh does not appear to have a #! interpreter line;
    you may get strange results

(cherry picked from commit 9e68997cbb)
2022-11-14 21:02:15 +01:00
Mark Andrews d4b064bd65 Merge branch '3468-statistics-xml-rendering-does-not-seem-to-protect-against-concurrent-changes-v9_18' into 'v9_18'
Resolve "Statistics XML rendering does not seem to protect against concurrent changes" [v9_18]

See merge request isc-projects/bind9!7076
2022-11-11 19:08:16 +00:00
Mark Andrews 9e1f36165c Add CHANGES note for [GL #3468]
(cherry picked from commit a4383c906c)
2022-11-11 15:58:37 +00:00
Mark Andrews 1de9c05210 Have dns_zt_apply lock the zone table
There were a number of places where the zone table should have been
locked, but wasn't, when dns_zt_apply was called.

Added a isc_rwlocktype_t type parameter to dns_zt_apply and adjusted
all calls to using it.  Removed locks in callers.

(cherry picked from commit f053d5b414)
2022-11-11 15:57:52 +00:00
Petr Špaček 7835ccd048 Merge branch '3669-update-policy-external-synchronous-doc-v9_18' into 'v9_18'
Document that update-policy external is synchronous [v9_18]

See merge request isc-projects/bind9!7073
2022-11-11 10:15:23 +00:00
Petr Špaček fb6e5c2d28 Document that update-policy external is synchronous
(cherry picked from commit 7d352741a0)
2022-11-11 10:38:17 +01:00
Ondřej Surý 0e0a86d199 Merge branch '3670-bump-statschannel-headers-v9_18' into 'v9_18'
Bump the allowed HTTP headers in statschannel to 100 [v9.18]

See merge request isc-projects/bind9!7071
2022-11-11 09:00:57 +00:00
Ondřej Surý b1d21c0ece Add CHANGES and release note for [GL #3670]
(cherry picked from commit c65666dc97)
2022-11-11 09:25:00 +01:00
Ondřej Surý 9e5299db30 Update the HTTP headers test to check for 101 headers
When we bumped the number of allowed HTTP headers to 100, we forgot to
bump the number in the system test.  Bump the number in the system test
too.
2022-11-11 09:25:00 +01:00
Ondřej Surý 882adbdc20 Bump the allowed HTTP headers in statschannel to 100
Firefox 90+ apparently sends more than 10 headers, so we need to bump
the number to some higher number.  Bump it to 100 just to be on a save
side, this is for internal use only anyway.

(cherry picked from commit e4654d1a6a)
2022-11-11 09:23:47 +01:00
Mark Andrews 59cb6fa575 Merge branch '3630-nextpart-is-not-compatible-with-set-x-v9_18' into 'v9_18'
Resolve "'nextpart' is not compatible with 'set -x'" [v9_18]

See merge request isc-projects/bind9!7060
2022-11-08 17:15:33 +00:00
Mark Andrews bc26438979 Use file descriptor 3 to save file.prev
If 'set -x' is in effect file.prev gets populated with debugging output.
To prevent this open descriptor 3 and redirect stderr from the awk
command to descriptor 3. Debugging output will stay directed to stderr.

(cherry picked from commit 10f67938db)
2022-11-08 16:43:58 +00:00
Tom Krizek 2c66f16f06 Merge branch 'tkrizek/danger-approve-v9_18' into 'v9_18'
ci: add danger checks - approve workflow & wip commits [v9_18]

See merge request isc-projects/bind9!7057
2022-11-08 13:41:23 +00:00
Tom Krizek e15f4aefab Check for cherry pick message in backport commits in danger CI
Using the -x option for cherry pick makes it easy to link commits across
branches and it is recommended to use for all backport commits (with
exceptions -- thus a warning level rather than failure).

(cherry picked from commit 5ecb277090)
2022-11-08 14:38:34 +01:00
Tom Krizek 12e03cb48d Detect work-in-progress commits in danger CI
To avoid accidentally merging unfinished work, detect prohibited
keywords at the start of the subject line. If the first word is any of
the following, fail the check:
WIP, wip, DROP, drop, TODO, todo

The only slightly controversial is the lowercase "drop" which might have
a legitimate use - seems like four commits in the history used it as a
start of a sentence. However, since people commonly use "drop" to
indicate a commit should be dropped before merging, let's prohibit it as
well. In case of false-positive, "Drop" with a capitalized first letter
can always be used.

(cherry picked from commit 402b11431c)
2022-11-08 14:38:34 +01:00
Tom Krizek 9633be904c Use approve button workflow in danger CI
Since the LGTM label was deprecated in favor of using the Approve button
in gitlab, adjust the detection in danger bot.

Unfortunately, danger-python seems no longer maintained since 2020 and
MR approvals aren't available in its Python API (even though they're
supported in its Ruby/JS APIs). Going forward, let's use the more
comprehensive python-gitlab API.

It still makes sense to utilize the danger-python, since it handles the
integration with gitlab which doesn't need to be reimplemented as long
as it works - same with the other checks.

(cherry picked from commit e901342dd9)
2022-11-08 14:38:32 +01:00
Michał Kępień d4bfa75ee1 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.10' into 'v9_18'
Set up version and release notes for BIND 9.18.10

See merge request isc-projects/bind9!7054
2022-11-08 12:30:12 +00:00
Michał Kępień 60c976267e Set up release notes for BIND 9.18.10 2022-11-08 13:23:20 +01:00
Michał Kępień 1f1c012a5f Update BIND version to 9.18.10-dev 2022-11-08 13:23:20 +01:00
Michał Kępień e83150781b Update BIND version for release 2022-11-07 23:16:44 +01:00
Michał Kępień 6b25fe9c13 Add a CHANGES marker 2022-11-07 23:16:44 +01:00
Michał Kępień 342045e9d8 Merge branch 'michal/prepare-documentation-for-bind-9.18.9' into 'v9_18_9-release'
Prepare documentation for BIND 9.18.9

See merge request isc-private/bind9!472
2022-11-07 21:41:36 +00:00
Michał Kępień 2a6be79edf Add release note for GL #3603 2022-11-07 22:33:46 +01:00
Michał Kępień 09d9b70b74 Add release note for GL #3247 2022-11-07 22:33:46 +01:00
Michał Kępień 8d752fbf6b Reorder release notes 2022-11-07 22:33:46 +01:00
Michał Kępień cb5b90c57e Tweak and reword release notes 2022-11-07 22:33:46 +01:00
Michał Kępień 82cbef953b Prepare release notes for BIND 9.18.9 2022-11-07 22:33:46 +01:00
Michał Kępień 3f04105401 Merge branch 'pspacek/doc-known-issues-reshuffle-v9_18' into 'v9_18'
[v9_18] Repeat Known Issues at the top of Release Notes page

See merge request isc-projects/bind9!7042
2022-11-07 13:49:10 +00:00
Petr ŠpačekandMichał Kępień 1275f47907 Repeat Known Issues at the top of Release Notes page
From now on all per-version notes link to the global list
of Known Issues. If there is a new note it should be listed twice:
In the per-version list, and in the global list.

(cherry picked from commit c58dd2790a)
2022-11-07 14:43:40 +01:00
Michał Kępień 641293eb45 Merge branch '3652-reference-manual-update-policies-unmatched-parenthesis-v9_18' into 'v9_18'
[v9_18] Add missing closing ')' to update-policy documentation

See merge request isc-projects/bind9!7038
2022-11-07 12:49:20 +00:00
Mark AndrewsandMichal Nowak 09dab3d924 Add missing closing ')' to update-policy documentation
The opening '(' before local was not being matched by a closing
')' after the closing '};'.

(cherry picked from commit 044c3b2bb8)
2022-11-07 12:23:17 +01:00
Ondřej Surý 4eadc05c67 Merge branch '3643-dont-use-dns_zone_attach-in-zone_refreshkeys-v9_18' into 'v9_18'
Don't use dns_zone_attach() in zone_refreshkeys() [v9.18]

See merge request isc-projects/bind9!7024
2022-11-03 15:14:58 +00:00
Ondřej Surý 21d8d5e07d Don't use dns_zone_attach() in zone_refreshkeys()
The zone_refreshkeys() could run before the zone_shutdown(), but after
the last .erefs has been "detached" causing assertion failure when doing
dns_zone_attach().  Remove the use of .erefs (dns_zone_attach/detach)
and replace it with using the .irefs and additional checks whether the
zone is exiting in the callbacks.

(cherry picked from commit 80e66fbd2d)
2022-11-03 15:22:50 +01:00
Matthijs Mekking 1a47343965 Merge branch '3591-nsec3-crash-dynamic-to-inline-signing-v9_18' into 'v9_18'
[v9_18] Fix crash where dnssec-policy zone with NSEC3 crashes when inline-signing is turned on

See merge request isc-projects/bind9!7020
2022-11-03 11:13:25 +00:00
Matthijs Mekking e4467aa841 Add release note and change for GL #3591
Breaking news.

(cherry picked from commit 1cf2f6fe68)
2022-11-03 11:51:22 +01:00
Matthijs Mekking b12572b4af If a zone is not reusable, trigger full sign
If after a reconfig a zone is not reusable because inline-signing
was turned on/off, trigger a full resign. This is necessary because
otherwise the zone maintenance may decide to only apply the changes
in the journal, leaving the zone in an inconsistent DNSSEC state.

(cherry picked from commit 4d143f2cc4)
2022-11-03 11:43:14 +01:00
Matthijs Mekking 3609dce81d Don't allow DNSSEC records in the raw zone
There was an exception for dnssec-policy that allowed DNSSEC in the
unsigned version of the zone. This however causes a crash if the
zone switches from dynamic to inline-signing in the case of NSEC3,
because we are now trying to add an NSEC3 record to a non-NSEC3 node.
This is because BIND expects none of the records in the unsigned
version of the zone to be NSEC3.

Remove the exception for dnssec-policy when copying non DNSSEC
records, but do allow for DNSKEY as this may be a published DNSKEY
from a different provider.

(cherry picked from commit 332b98ae49)
2022-11-03 11:43:08 +01:00
Matthijs Mekking bb1c40e0a3 Remove checks when going to dnssec-policy none
The changes in the code have the side effect that the CDNSKEY and CDS
records in the secure version of the zone are not reusable and thus
are thrashed from the zone. Remove the apex checks for this use case.
We only care about that the zone is not immediately goes bogus, but
a user really should use the built-in "insecure" policy when unsigning
a zone.

(cherry picked from commit bc703a12e7)
2022-11-03 11:43:02 +01:00
Matthijs Mekking 7a8eb8d035 Add nsec3 system test that transfers in NSEC3
Similar to an attempt to add NSEC through dynamic update, add a test
case that tries to add NSEC3 through zone transfer.

(cherry picked from commit ef1cb9935c)
2022-11-03 11:42:56 +01:00
Matthijs Mekking b9726ad03c Add two more nsec3 system tests
Add one more case that tests reconfiguring a zone to turn off
inline-signing. It should still be a valid DNSSEC zone and the NSEC3
parameters should not change.

Add another test to ensure that you cannot update the zone with a
NSEC3 record.

(cherry picked from commit 4cd8e8e9c3)
2022-11-03 11:42:49 +01:00
Matthijs Mekking 1815a9a4f4 Update kasp system test to work with .signed files
We no longer accept copying DNSSEC records from the raw zone to
the secure zone, so update the kasp system test that relies on this
accordingly.

Also add more debugging and store the dnssec-verify results in a file.

(cherry picked from commit 57ea9e08c6)
2022-11-03 11:42:44 +01:00
Matthijs Mekking 518218e053 Test changing from dynamic to inline-signing
Add a kasp system test that reconfigures a dnssec-policy zone from
maintaining DNSSEC records directly to the zone to using inline-signing.

Add a similar test case to the nsec3 system test, testing the same
thing but now with NSEC3 in use.

(cherry picked from commit 9018fbb205)
2022-11-03 11:42:38 +01:00
Arаm Sаrgsyаn fd77c37820 Merge branch '2895-named-can-create-unrecoverable-managed-keys-v9_18' into 'v9_18'
[v9_18] Don't trust a placeholder KEYDATA record

See merge request isc-projects/bind9!7008
2022-11-01 11:26:24 +00:00
Aram Sargsyan ac25292556 Add CHANGES and release notes for [GL #2895]
(cherry picked from commit 3bf4bc7336)
2022-11-01 10:49:58 +00:00
Aram Sargsyan 4b80324f51 Don't trust a placeholder KEYDATA record
When named starts it creates an empty KEYDATA record in the managed-keys
zone as a placeholder, then schedules a key refresh. If key refresh
fails for some reason (e.g. connectivity problems), named will load the
placeholder key into secroots as a trusted key during the next startup,
which will break the chain of trust, and named will never recover from
that state until managed-keys.bind and managed-keys.bind.jnl files are
manually deleted before (re)starting named again.

Before calling load_secroots(), check that we are not dealing with a
placeholder.

(cherry picked from commit 354ae2d7e3)
2022-11-01 10:49:51 +00:00
Aram Sargsyan 5e26074ce4 Test managed-keys placeholder
Add a dnssec test to make sure that named can correctly process a
managed-keys zone with a placeholder KEYDATA record.

(cherry picked from commit 8c48eabbc1)
2022-11-01 10:49:43 +00:00
Evan Hunt dfcbbdcb6f Merge branch '3617-keyfetch-race-v9_18' into 'v9_18'
Call dns_resolver_createfetch() asynchronously in zone_refreshkeys()

See merge request isc-projects/bind9!7006
2022-11-01 08:44:07 +00:00
Evan Hunt 67f60e5ae4 CHANGES for [GL #3617] 2022-11-01 00:23:05 -07:00
Evan Hunt 28d0c37ef0 Call dns_resolver_createfetch() asynchronously in zone_refreshkeys()
Because dns_resolver_createfetch() locks the view, it was necessary
to unlock the zone in zone_refreshkeys() before calling it in order
to maintain the lock order, and relock afterward. this permitted a race
with dns_zone_synckeyzone().

This commit moves the call to dns_resolver_createfetch() into a separate
function which is called asynchronously after the zone has been
unlocked.

The keyfetch object now attaches to the zone to ensure that
it won't be shut down before the asynchronous call completes.

This necessitated refactoring dns_zone_detach() so it always runs
unlocked. For managed zones it schedules zone_shutdown() to
run asynchronously; for unmanaged zones there is no task.
2022-11-01 00:23:05 -07:00
Ondřej Surý c8ff8108e7 Merge branch '3634-dont-enforce-jemalloc-on-NetBSD-v9_18' into 'v9_18'
Don't enforce jemalloc on NetBSD [v9.18]

See merge request isc-projects/bind9!7005
2022-10-31 15:24:25 +00:00
Ondřej Surý 0cc485faf1 Add CHANGES note for [GL #3634]
(cherry picked from commit fdf1e226fd)
2022-10-31 16:15:32 +01:00
Ondřej Surý a4341b4338 Don't enforce jemalloc on NetBSD
The NetBSD system allocator is in fact based on the jemalloc, but it
doesn't export the extended interface, so we can't use that.  Remove
the jemalloc enforcement for the NetBSD.

(cherry picked from commit feea72414b)
2022-10-31 16:15:11 +01:00
Evan Hunt 82df6b5a55 Merge branch 'each-dupsigs-test-v9_18' into 'v9_18'
make dupsigs test less timing-sensitive

See merge request isc-projects/bind9!7002
2022-10-31 11:27:06 +00:00
Evan Hunt ebacebec15 make dupsigs test less timing-sensitive
the dupsigs test is prone to failing on slow CI machines
because the first test can occur before the zone is fully
signed.

instead of just waiting ten seconds arbitrarily, we now
check every second, and allow up to 30 seconds before giving
up.

(cherry picked from commit d9b85cbaae)
2022-10-31 04:24:37 -07:00
Evan Hunt e65a34e504 Merge branch '3631-fix-zone-maintenance-race-v9_18' into 'v9_18'
fix a potential data race in zone_maintenance()

See merge request isc-projects/bind9!7001
2022-10-31 11:01:14 +00:00
Evan Hunt c7e2fae6de fix a potential data race in zone_maintenance()
zone_maintenance() accessed zone timer information without locking.

(cherry picked from commit f92b946df3)
2022-10-31 03:29:28 -07:00
Tom Krizek eae3d11cee Merge branch '3503-random-default-algorithm-in-tests-v9_18' into 'v9_18'
Random selection of DEFAULT_ALGORITHM in system tests at runtime [v9_18]

See merge request isc-projects/bind9!6992
2022-10-27 11:26:28 +00:00
Tom Krizek 05a1a0e7b5 Randomize algorithm selection for mkeys test
Use the ALGORITHM_SET option to use randomly selected default algorithm
in this test. Make sure the test works by using variables instead of
hard-coding values.

(cherry picked from commit f65f276f98)
2022-10-27 13:24:52 +02:00
Tom Krizek e3b5521845 Set algorithms for system tests at runtime
Use the get_algorithms.py script to detect supported algorithms and
select random algorithms to use for the tests.

Make sure to load common.conf.sh after KEYGEN env var is exported.

(cherry picked from commit 69b608ee9f)
2022-10-27 13:24:52 +02:00
Tom Krizek 550c0e8964 Script for random algorithm selection in system tests
Multiple algorithm sets can be defined in this script. These can be
selected via the ALGORITHM_SET environment variable. For compatibility
reasons, "stable" set contains the currently used algorithms, since our
system tests need some changes before being compatible with randomly
selected algorithms.

The script operation is similar to the get_ports.py - environment
variables are created and then printed out as `export NAME=VALUE`
commands, to be interpreted by shell. Once we support pytest runner for
system tests, this should be a fixture instead.

(cherry picked from commit 5f480c8485)
2022-10-27 13:24:52 +02:00
Tom Krizek 01b4a28d59 Export env variables in system tests
Certain variables have to be exported in order for the system tests to
work. It makes little sense to export the variables in one place/script
while they're defined in another place.

Since it makes no harm, export all the variables to make the behaviour
more predictable and consistent. Previously, some variables were
exported as environment variables, while others were just shell
variables which could be used once the configuration was sourced from
another script. However, they wouldn't be exposed to spawned processes.

For simplicity sake (and for the upcoming effort to run system tests
with pytest), export all variables that are used. TESTS, PARALLEL_UNIX
and SUBDIRS variables are automake-specific, aren't used anywhere else
and thus not exported.

(cherry picked from commit 37d14c69c0)
2022-10-27 13:24:52 +02:00
Tom Krizek 2843d32d00 Support testcrypto.sh usage without including conf.sh
The only variable really needed for the script to work is the path to
the $KEYGEN binary. Allow setting this via an environment variable to
avoid loading conf.sh (and causing a chicken-egg problem). Also make
testcrypto.sh executable to allow its use from conf.sh.

(cherry picked from commit bb1c6bbdc7)
2022-10-27 13:24:52 +02:00
Tom Krizek 798f969043 Unify indentation level in testcrypto.sh
(cherry picked from commit 01b293b055)
2022-10-27 13:24:50 +02:00
Matthijs Mekking e891053c31 Merge branch '3627-inheritance-bug-remote-server-port-v9_18' into 'v9_18'
[v9_18] Fix inheritance bug when setting port in remote server configuration

See merge request isc-projects/bind9!6993
2022-10-27 10:53:24 +00:00
Matthijs Mekking 2655ee4902 Add release note and change entry for [GL #3627]
(cherry picked from commit 5585256bf6)
2022-10-27 12:18:27 +02:00
Matthijs Mekking 9a05448f13 Fix config bug related to port setting
There are three levels there for the port value, with increasing
priority:

1. The default ports, defined by 'port' and 'tls-port' config options.
2. The primaries-level default port: primaries port <number>  { ... };
3. The primaries element-level port: primaries { <address> port
   <number>; ... };"

In 'named_config_getipandkeylist()', the 'def_port' and 'def_tlsport'
variables are extracted from level 1. The 'port' variable is extracted
from the level 2. Currently if that is unset, it defaults to the
default port ('def_port' or 'def_tlsport' depending on the transport
used), but overrides the level 2 port setting for the next primaries in
the list.

Update the code such that we inherit the port only if the level 3 port
is not set, and inherit from the default ports if the level 2 port is
also not set.

(cherry picked from commit 72d3bf8e4e)
2022-10-27 12:18:18 +02:00
Matthijs Mekking bf6961c551 Add xfer system test case
Add a test case that if the first primary fails, the fallback of a
second primary on plain DNS works. This is mainly to test that the port
configuration inheritance works correctly.

(cherry picked from commit 622a499027)
2022-10-27 12:18:12 +02:00
Tom Krizek 222a1fc4eb Merge branch '3517-serve-stale-cache-timeout-0-test-v9_18' into 'v9_18'
[v9_18] [CVE-2022-3080] Test serve stale cache with timeout 0 and CNAME

See merge request isc-projects/bind9!6976
2022-10-24 13:00:50 +00:00
Tom Krizek 9a159fc4c4 Remove misleading comment from serve-stale test
The stale-answer-client-timeout option is not set to 0 in the config
neither is it the default value. This was probably caused by a
copy-paste error.
2022-10-24 14:30:43 +02:00
Tom Krizek 3a9ae0249d Test serve stale cache with timeout 0 and CNAME
Add a couple of tests that verify the serve-stale behavior when
stale-answer-client-timeout is set to 0 and a (stale) CNAME record is
queried.

Related #3517
2022-10-24 14:30:41 +02:00
Michał Kępień b272185c38 Merge branch 'michal/bump-sphinx-version-to-5.3.0-v9_18' into 'v9_18'
[v9_18] Bump Sphinx version to 5.3.0

See merge request isc-projects/bind9!6973
2022-10-24 09:57:41 +00:00
Michał Kępień da0cd8c6db Bump Sphinx version to 5.3.0
Make the Sphinx version listed in doc/arm/requirements.txt match the
version currently used in GitLab CI, so that Read the Docs builds the
documentation using the same Python software versions as those used in
GitLab CI.

(cherry picked from commit a8f0ab7df6)
2022-10-24 11:45:11 +02:00
Arаm Sаrgsyаn 65467dfcff Merge branch '3603-resolver-prefetch-eligibility-edge-case-bug-v9_18' into 'v9_18'
[v9_18] Synchronize prefetch "trigger" and "eligibility" code and documentation

See merge request isc-projects/bind9!6969
2022-10-21 11:29:08 +00:00
Aram Sargsyan 840cad93c7 Getting the "prefetch" setting from the configuration cannot fail
The "prefetch" setting is in "defaultconf" so it cannot fail, use
INSIST to confirm that.

The 'trigger' and 'eligible' variables are now prefixed with
'prefetch_' and their declaration moved to an upper level, because
there is no more additional code block after this change.

(cherry picked from commit 0227565cf1)
2022-10-21 10:22:51 +00:00
Aram Sargsyan 6d64f9e4ec Fix prefetch "trigger" value's documentation in ARM
For the prefetch "trigger" parameter ARM states that when a cache
record with a lower TTL value is encountered during query processing,
it is refreshed. But in reality, the record is refreshed when the TTL
value is lower or equal to the configured "trigger" value.

Fix the documentation to make it match with with the code.

(cherry picked from commit ef344b1f52)
2022-10-21 10:22:44 +00:00
Aram Sargsyan b7149536ee Add a CHANGES note for [GL #3603]
(cherry picked from commit 041ffac0d7)
2022-10-21 10:22:37 +00:00
Aram Sargsyan bb9cc81dd4 Match prefetch eligibility behavior with ARM
ARM states that the "eligibility" TTL is the smallest original TTL
value that is accepted for a record to be eligible for prefetching,
but the code, which implements the condition doesn't behave in that
manner for the edge case when the TTL is equal to the configured
eligibility value.

Fix the code to check that the TTL is greater than, or equal to the
configured eligibility value, instead of just greater than it.

(cherry picked from commit 863f51466e)
2022-10-21 10:22:29 +00:00
Aram Sargsyan 9000b43d46 Add another prefetch check in the resolver system test
The test triggers a prefetch, but fails to check if it acutally
happened, which prevented it from catching a bug when the record's
TTL value matches the configured prefetch eligibility value.

Check that prefetch happened by comparing the TTL values.

(cherry picked from commit 89fa9a6592)
2022-10-21 10:22:23 +00:00
Arаm Sаrgsyаn ccbd389ed2 Merge branch '3598-adb-quota-might-not-be-decremented-v9_18' into 'v9_18'
[v9_18] Resolve "ADB quota might not be decremented"

See merge request isc-projects/bind9!6967
2022-10-21 10:09:09 +00:00
Aram Sargsyan 192373a26e Add CHANGES and release notes for [GL #3598]
(cherry picked from commit 6f50972e5f)
2022-10-21 09:04:51 +00:00
Aram Sargsyan 64feeba60f Call dns_adb_endudpfetch() on error path, if required
For UDP queries, after calling dns_adb_beginudpfetch() in fctx_query(),
make sure that dns_adb_endudpfetch() is also called on error path, in
order to adjust the quota back.

(cherry picked from commit 5da79e2be0)
2022-10-21 08:36:34 +00:00
Aram Sargsyan a83a58467d Always call dns_adb_endudpfetch() in fctx_cancelquery() for UDP queries
It is currently possible that dns_adb_endudpfetch() is not
called in fctx_cancelquery() for a UDP query, which results
in quotas not being adjusted back.

Always call dns_adb_endudpfetch() for UDP queries.

(cherry picked from commit e4569373ca)
2022-10-21 08:36:34 +00:00
Aram Sargsyan 4a311b9bb4 Unlink the query under cleanup_query
In the cleanup code of fctx_query() function there is a code path
where 'query' is linked to 'fctx' and it is being destroyed.

Make sure that 'query' is unlinked before destroying it.

(cherry picked from commit ac889684c7)
2022-10-21 08:36:34 +00:00
Ondřej Surý b55f4068ff Merge branch '3270-use-curl-in-statschannel-system-test-v9_18' into 'v9_18'
Replace some raw nc usage in statschannel system test with curl [v9.18]

See merge request isc-projects/bind9!6966
2022-10-20 16:28:29 +00:00
Ondřej Surý a06bd51bd7 Replace some raw nc usage in statschannel system test with curl
For tests where the TCP connection might get interrupted abruptly,
replace the nc with curl as the data sent from server to client might
get lost because of abrupt TCP connection.  This happens when the TCP
connection gets closed during sending the large request to the server.

As we already require curl for other system tests, replace the nc usage
in the statschannel test with curl that actually understands the
HTTP/1.1 protocol, so the same connection is reused for sending the
consequtive requests, but without client-side "pipelining".

For the record, the server doesn't support parallel processing of the
pipelined request, so it's a bit misnomer here, because what we are
actually testing is that we process all requests received in a single
TCP read callback.

(cherry picked from commit cd0e5c5784)
2022-10-20 18:06:48 +02:00
Ondřej Surý ce4528940b Merge branch '3270-serialize-statschannel-http-requests-v9_18' into 'v9_18'
Serialize the HTTP/1.1 statschannel requests [v9.18]

See merge request isc-projects/bind9!6965
2022-10-20 15:57:53 +00:00
Ondřej Surý 9274876dec Serialize the HTTP/1.1 statschannel requests
The statschannel truncated test still terminates abruptly sometimes and
it doesn't return the answer for the first query.  This might happen
when the second process_request() discovers there's not enough space
before the sending is complete and the connection is terminated before
the client gets the data.

Change the isc_http, so it pauses the reading when it receives the data
and resumes it only after the sending has completed or there's
incomplete request waiting for more data.

This makes the request processing slightly less efficient, but also less
taxing for the server, because previously all requests that has been
received via single TCP read would be processed in the loop and the
sends would be queued after the read callback has processed a full
buffer.

(cherry picked from commit 13959781cb)
2022-10-20 17:23:36 +02:00
Ondřej Surý f3847437b2 Merge branch 'ondrej-refactor-isc_httpd-v9_18' into 'v9_18'
Rewrite isc_httpd using picohttpparser and isc_url_parse [v9.18]

See merge request isc-projects/bind9!6964
2022-10-20 15:14:45 +00:00
Ondřej Surý da1e7a7ba2 Replace the statschannel truncated tests with two new tests
Now that the artificial limit on the recv buffer has been removed, the
current system test always fails because it tests if the truncation has
happened.

Add test that sending more than 10 headers makes the connection to
closed; and add test that sending huge HTTP request makes the connection
to be closed.

(cherry picked from commit cad2706cce)
2022-10-20 16:13:10 +02:00
Ondřej Surý 067502a16e Rewrite isc_httpd using picohttpparser and isc_url_parse
Rewrite the isc_httpd to be more robust.

1. Replace the hand-crafted HTTP request parser with picohttpparser for
   parsing the whole HTTP/1.0 and HTTP/1.1 requests.  Limit the number
   of allowed headers to 10 (arbitrary number).

2. Replace the hand-crafted URL parser with isc_url_parse for parsing
   the URL from the HTTP request.

3. Increase the receive buffer to match the isc_netmgr buffers, so we
   can at least receive two full isc_nm_read()s.  This makes the
   truncation processing much simpler.

4. Process the received buffer from single isc_nm_read() in a single
   loop and schedule the sends to be independent of each other.

The first two changes makes the code simpler and rely on already
existing libraries that we already had (isc_url based on nodejs) or are
used elsewhere (picohttpparser).

The second two changes remove the artificial "truncation" limit on
parsing multiple request.  Now only a request that has too many
headers (currently 10) or is too big (so, the receive buffer fills up
without reaching end of the request) will end the connection.

We can be benevolent here with the limites, because the statschannel
channel is by definition private and access must be allowed only to
administrators of the server.  There are no timers, no rate-limiting, no
upper limit on the number of requests that can be served, etc.

(cherry picked from commit beecde7120)
2022-10-20 16:10:21 +02:00
Ondřej Surý 944ddd0fb2 Add picohttpparser.{c.h} from https://github.com/h2o/picohttpparser
PicoHTTPParser is a tiny, primitive, fast HTTP request/response parser.

Unlike most parsers, it is stateless and does not allocate memory by
itself. All it does is accept pointer to buffer and the output
structure, and setups the pointers in the latter to point at the
necessary portions of the buffer.

(cherry picked from commit 3a8884f024)
2022-10-20 15:49:27 +02:00
Artem Boldariev 8e6721fe9e Merge branch '3563-fix-named-startup-on-manycore-solaris-systems-v9-18' into 'v9_18'
[Backport to v9.18] Fix named failing to start on Solaris systems with hundreds of CPUs

See merge request isc-projects/bind9!6962
2022-10-20 13:14:46 +00:00
Artem Boldariev c3ce67f994 Modify release notes [GL #3563]
Mention that a startup problem on manycore Solaris systems is fixed.

(cherry picked from commit 2c9400f116)
2022-10-20 15:15:52 +03:00
Artem Boldariev acb431b5c3 Modify CHANGES [GL #3563]
Mention that a startup problem on manycore Solaris systems is fixed.

(cherry picked from commit 03ee132e28)
2022-10-20 15:15:51 +03:00
Artem Boldariev 43c8e8b9d6 Fix named failing to start on Solaris systems with hundreds of CPUs
This commit fixes a startup issue on Solaris systems with
many (reportedly > 510) CPUs by bumping RLIMIT_NOFILE. This appears to
be a regression from 9.11.

(cherry picked from commit fff01fe7eb)
2022-10-20 15:15:10 +03:00
Michal Nowak d11843bdfc Merge tag 'v9_18_8' into v9_18
BIND 9.18.8
2022-10-20 11:47:43 +02:00
Matthijs Mekking be33035f26 Merge branch 'matthijs-fix-dnssec-signing-log-lovel-v9_18' into 'v9_18'
[v9_18] Change log level when doing rekey

See merge request isc-projects/bind9!6939
2022-10-20 08:20:49 +00:00
Matthijs Mekking 6af9d0088b Change log level when doing rekey
This log happens when BIND checks the parental-agents if the DS has
been published. But if you don't have parental-agents set up, the list
of keys to check will be empty and the result will be ISC_R_NOTFOUND.
This is not an error, so change the log level to debug in this case.

(cherry picked from commit a1d57fc8cb)
2022-10-20 10:20:14 +02:00
Evan Hunt 8138ab4611 Merge branch '3247-rpz-ip-cd-v9_18' into 'v9_18'
ensure RPZ lookups handle CD=1 correctly

See merge request isc-projects/bind9!6957
2022-10-19 20:38:34 +00:00
Evan Hunt 777aa045fc CHANGES for [GL #3247]
(cherry picked from commit 3676f6394b)
2022-10-19 13:12:52 -07:00
Evan Hunt 5c44d63979 add a test with CD=1 query for pending data
this is a regression test for [GL #3247].

(cherry picked from commit 575a924b1a)
2022-10-19 13:12:32 -07:00
Evan Hunt 2cc8874c90 ensure RPZ lookups handle CD=1 correctly
RPZ rewrites called dns_db_findext() without passing through the
client database options; as as result, if the client set CD=1,
DNS_DBFIND_PENDINGOK was not used as it should have been, and
cache lookups failed, resulting in failure of the rewrite.

(cherry picked from commit 305a50dbe1)
2022-10-19 13:12:31 -07:00
Tom Krizek ff5823fa12 Merge branch 'tkrizek/system-tests-fixes-v9_18' into 'v9_18'
Update various system tests and add them to default test suite [v9_18]

See merge request isc-projects/bind9!6949
2022-10-19 14:58:13 +00:00
Tom Krizek ba7ea2dfac Remove generated controls.conf file from system tests
The controls.conf file shouldn't be used directly without templating it
first. Remove this no longer used hard-coded file to avoid confusion.

(cherry picked from commit cbd0355328)
2022-10-19 15:32:46 +02:00
Tom Krizek 5db5f20985 Revive dupsigs system test
Correctly source conf.sh in dupsigs test scripts (fix issue introduced
by 093af1c00a).

Update dupsigs test for dnssec-dnskey-kskonly default. Since v9.17.20,
the dnssec-dnskey-kskonly is set to yes. Update the test to not expect
the additional RRSIG with ZSK for DNSKEY.

Speed up the test from 20 minutes to 2.5 minutes and make it part of the
default test suite executed in CI.
- decrease number of records to sign from 2000 to 500
- decrease the signing interval by a factor of 6
- shorten the final part of the test after last signing (since nothing
  new happens there)

Finally, clarify misleading comments about (in)sufficient time for zone
re-signing. The time used in the test is in fact sufficient for the
re-signing to happen. If it wasn't, the previous ZSK would end up being
deleted while its signatures would still be present, which is a
situation where duplicate signatures can still happen.

(cherry picked from commit cb0a2ae1dd)
2022-10-19 15:32:44 +02:00
Tom Krizek ef0eadf864 Revive the stress system test
Ensure the port numbers are dynamically filled in with copy_setports.

Clarify test fail condition.

Make the stress test part of the default test suite since it doesn't
seem to run too long or interfere with other tests any more (the
original note claiming so is more than 20 years old).

Related !6883

(cherry picked from commit 7495deea3e)
2022-10-19 15:32:44 +02:00
Tom Krizek bd8262dc35 Revive dialup system test
Properly template the port number in config files with copy_setports.

The test takes two minutes on my machine which doesn't seem like a
proper justification to exclude it from the test suite, especially
considering we run these tests in parallel nowadays. The resource usage
doesn't seems significantly increased so it shouldn't interfere with
other system tests.

There also exists a precedent for longer running system tests that are
already part of the default system test suite (e.g. serve-stale takes
almost three minutes on the same machine).

(cherry picked from commit 235ae5f344)
2022-10-19 15:32:44 +02:00
Tom Krizek 25d2d7e46e Make digdelv test work in different network envs
When a target server is unreachable, the varying network conditions may
cause different ICMP message (or no message). The host unreachable
message was discovered when attempting to run the test locally while
connected to a VPN network which handles all traffic.

Extend the dig output check with "host unreachable" message to avoid a
false negative test result in certain network environments.

(cherry picked from commit 1e7d832342)
2022-10-19 15:32:44 +02:00
Ondřej Surý 10a43eba02 Merge branch '3270-remove-time-requirement-for-statschannel-truncated-test-v9_18' into 'v9_18'
Remove the time requirement for the statschannel truncated test [v9.18]

See merge request isc-projects/bind9!6953
2022-10-19 13:31:23 +00:00
Ondřej Surý 6261ada8c2 Remove the time requirement for the statschannel truncated test
The 5 seconds requirement to finish the 'pipelined with truncated
stream' was causing spurious failures in the CI because the job runners
might be very busy and sending 128k of data might simply take some time.

Remove the time requirement altogether, there's actually no reason why
the test SHOULD or even MUST finish under 5 seconds.

(cherry picked from commit 0f56a53d66)
2022-10-19 15:30:44 +02:00
Michal Nowak 6a3d92a98c Merge branch '3394-cve-2022-2795-test-v9_18' into 'v9_18'
[v9_18] Add tests for CVE-2022-2795

See merge request isc-projects/bind9!6948
2022-10-19 13:05:22 +00:00
Michał KępieńandMichal Nowak 9c2714e27f Add tests for CVE-2022-2795
Add a test ensuring that the amount of work fctx_getaddresses() performs
for any encountered delegation is limited: delegate example.net to a set
of 1,000 name servers in the redirect.com zone, the names of which all
resolve to IP addresses that nothing listens on, and query for a name in
the example.net domain, checking the number of times the findname()
function gets executed in the process; fail if that count is excessively
large.

Since the size of the referral response sent by ans3 is about 20 kB, it
cannot be sent back over UDP (EMSGSIZE) on some operating systems in
their default configuration (e.g. FreeBSD - see the
net.inet.udp.maxdgram sysctl).  To enable reliable reproduction of
CVE-2022-2795 (retry patterns vary across BIND 9 versions) and avoid
false positives at the same time (thread scheduling - and therefore the
number of fetch context restarts - vary across operating systems and
across test runs), extend bin/tests/system/resolver/ans3/ans.pl so that
it also listens on TCP and make "ns1" in the "resolver" system test
always use TCP when communicating with "ans3".

Also add a test (foo.bar.sub.tld1/TXT) that ensures the new limitations
imposed on the resolution process by the mitigation for CVE-2022-2795 do
not prevent valid, glueless delegation chains from working properly.

(cherry picked from commit 604d8f0b96)
2022-10-19 12:36:20 +02:00
Michal Nowak 09ea1f9b3b Merge branch '3493-compression-buffer-reuse-test-v9_18' into 'v9_18'
[CVE-2022-2881] test for growth of compressed pipelined responses

See merge request isc-projects/bind9!6941
2022-10-19 08:19:06 +00:00
Evan HuntandMichal Nowak b42dfd01f1 test for growth of compressed pipelined responses
add a test to compare the Content-Length of successive compressed
messages on a single HTTP connection that should contain the same
data; fail if the size grows by more than 100 bytes from one query
to the next.

(cherry picked from commit 3c11fafadf)
2022-10-18 17:28:45 +02:00
Artem Boldariev 49c8d04c65 Merge branch 'artem-sync-multilayer-stoplistening-v9-18' into 'v9_18'
Backport to v9.18] Synchronise stop listening operation for multi-layer transports

See merge request isc-projects/bind9!6932
2022-10-18 14:24:24 +00:00
Artem Boldariev a6f14565b4 TLS Stream: handle successful TLS handshake after listener shutdown
It was possible that accept callback can be called after listener
shutdown. In such a case the callback pointer equals NULL, leading to
segmentation fault. This commit fixes that.
2022-10-18 16:40:08 +03:00
Artem Boldariev c62994e6a4 Synchronise stop listening operation for multi-layer transports
This commit introduces a primitive isc__nmsocket_stop() which performs
shutting down on a multilayered socket ensuring the proper order of
the operations.

The shared data within the socket object can be destroyed after the
call completed, as it is guaranteed to not be used from within the
context of other worker threads.

(cherry picked from commit 5ab2c0ebb3)
2022-10-18 16:40:08 +03:00
Petr Špaček 7a992cb948 Merge branch 'pspacek/ci-no-developer-mode-v9_18' into 'v9_18'
Add CI job with --disable-developer [v9_18]

See merge request isc-projects/bind9!6931
2022-10-18 13:15:49 +00:00
Petr Špaček 9a132f9e2b Allow system tests to run under root user when inside CI
https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
says variable CI_SERVER="yes" is available in all versions of Gitlab.

(cherry picked from commit ddf46056ca)
2022-10-18 15:14:54 +02:00
Petr Špaček 4f4556941c Build gcc:oraclelinux9:amd64 CI jobs with --disable-developer
Purpose of this is to guard against tests which rely on querytrace or
other optional features enabled by --enable-developer switch.

(cherry picked from commit d6db5c5335)
2022-10-18 15:14:54 +02:00
Ondřej Surý bc1acfdccb Merge branch 'ondrej-add-ISC_LIST,LINK_INITIALIZER-v9_18' into 'v9_18'
Add ISC_{LIST,LINK}_INITIALIZER for designated initializers [v9.18]

See merge request isc-projects/bind9!6934
2022-10-18 12:56:42 +00:00
Ondřej Surý 6525ebc777 Replace (void *)-1 with ISC_LINK_TOMBSTONE
Instead of having "arbitrary" (void *)-1 to define non-linked, add a
ISC_LINK_TOMBSTONE(type) macro that replaces the "magic" value with a
define.

(cherry picked from commit 5e20c2ccfb)
2022-10-18 14:30:43 +02:00
Ondřej Surý 8efe60d423 Add ISC_{LIST,LINK}_INITIALIZER for designated initializers
Since we are using designated initializers, we were missing initializers
for ISC_LIST and ISC_LINK, add them, so you can do

    *foo = (foo_t){ .list = ISC_LIST_INITIALIZER };

Instead of:

    *foo = (foo_t){ 0 };
    ISC_LIST_INIT(foo->list);

(cherry picked from commit cb3c36b8bf)
2022-10-18 14:30:43 +02:00
Arаm Sаrgsyаn c6270cefb2 Merge branch '3584-ns_statscounter_recursclients-bug-v9_18' into 'v9_18'
[v9_18] Fix ns_statscounter_recursclients counting bug

See merge request isc-projects/bind9!6876
2022-10-18 10:36:55 +00:00
Aram Sargsyan d83642b3ac Add a release note for [GL #3584] 2022-10-18 08:54:20 +00:00
Aram Sargsyan 5b1ef41897 Add a CHANGES note for [GL #3584] 2022-10-18 08:54:11 +00:00
Aram Sargsyan 82991451b4 Fix ns_statscounter_recursclients counting bug
The incrementing and decrementing of 'ns_statscounter_recursclients'
were not properly balanced: for example, it would be incremented for
a prefetch query but not decremented if the query failed.

This commit ensures that the recursion quota and the recursive clients
counter are always in sync with each other.
2022-10-18 08:54:04 +00:00
Petr Špaček 954ce9fcff Merge branch 'pspacek/doc-nsupdate-server-gsstsig-v9_18' into 'v9_18'
Document that nsupdate ignores server command in GSS-TSIG mode [v9_18]

See merge request isc-projects/bind9!6925
2022-10-18 08:17:15 +00:00
Petr Špaček dbb7856038 Document that nsupdate ignores server command in GSS-TSIG mode
This behavior is present since introduction of GSS-TSIG support,
commit 289ae548d5.

(cherry picked from commit c8a38d70f0)
2022-10-18 10:13:30 +02:00
Tony Finch 684b5e536d Merge branch 'fanf-deduplicate-file-line-v9_18' into 'v9_18'
De-duplicate __FILE__, __LINE__ plus some error reporting cleanup (backport to v9_18)

See merge request isc-projects/bind9!6922
2022-10-17 17:27:04 +00:00
Tony Finch 6adb0c32ea CHANGES for [GL !6914]
[cleanup]	Less ceremonial UNEXPECTED_ERROR() and FATAL_ERROR()
		reporting macros. [GL !6914]

(cherry picked from commit 2ffb582d2c)
2022-10-17 16:08:28 +01:00
Tony FinchandTony Finch b48c73d802 Remove redundant #include <isc/strerr.h>
Most uses are now internal to <isc/util.h>
2022-10-17 16:08:28 +01:00
Tony Finch 96b6bae5bc Include the function name when reporting unexpected errors
I.e. print the name of the function in BIND that called the system
function that returned an error. Since it was useful for pthreads
code, it seems worthwhile doing so everywhere.

(cherry picked from commit 26ed03a61e)
2022-10-17 16:00:27 +01:00
Tony Finch 8dfc078ea3 De-duplicate some calls to strerror_r()
Specifically, when reporting an unexpected or fatal error.

(cherry picked from commit a34a2784b1)
2022-10-17 16:00:27 +01:00
Tony Finch f273fdfc12 De-duplicate __FILE__, __LINE__
Mostly generated automatically with the following semantic patch,
except where coccinelle was confused by #ifdef in lib/isc/net.c

@@ expression list args; @@
- UNEXPECTED_ERROR(__FILE__, __LINE__, args)
+ UNEXPECTED_ERROR(args)
@@ expression list args; @@
- FATAL_ERROR(__FILE__, __LINE__, args)
+ FATAL_ERROR(args)

(cherry picked from commit ec50c58f52)
2022-10-17 16:00:26 +01:00
Arаm Sаrgsyаn 79a7fb6cb5 Merge branch 'aram/cfg_print_duration-uninitialized-length-v9_18' into 'v9_18'
[v9_18] Fix a logical bug in cfg_print_duration()

See merge request isc-projects/bind9!6920
2022-10-17 09:56:59 +00:00
Aram Sargsyan 24aa154b67 Handle large numbers when parsing/printing a duration
The isccfg_duration_fromtext() function is truncating large numbers
to 32 bits instead of capping or rejecting them, i.e. 64424509445,
which is 0xf00000005, gets parsed as 32-bit value 5 (0x00000005).

Fail parsing a duration if any of its components is bigger than
32 bits. Using those kind of big numbers has no practical use case
for a duration.

The isccfg_duration_toseconds() function can overflow the 32 bit
seconds variable when calculating the duration from its component
parts.

To avoid that, use 64-bit calculation and return UINT32_MAX if the
calculated value is bigger than UINT32_MAX. Again, a number this big
has no practical use case anyway.

The buffer for the generated duration string is limited to 64 bytes,
which, in theory, is smaller than the longest possible generated
duration string.

Use 80 bytes instead, calculated by the '7 x (10 + 1) + 3' formula,
where '7' is the count of the duration's parts (year, month, etc.), '10'
is their maximum length when printed as a decimal number, '1' is their
indicator character (Y, M, etc.), and 3 is two more indicators (P and T)
and the terminating NUL character.

(cherry picked from commit fddaebb285)
2022-10-17 08:54:10 +00:00
Aram Sargsyan 9a318fbc1e Add a CHANGES note for [GL !6880]
(cherry picked from commit 190aab84d7)
2022-10-17 08:53:49 +00:00
Aram Sargsyan e3fa77f577 Fix an off-by-one error in cfg_print_duration()
The cfg_print_duration() checks added previously in the 'duration_test'
unit test uncovered a bug in cfg_print_duration().

When calculating the current 'str' pointer of the generated text in the
buffer 'buf', it erroneously adds 1 byte to compensate for that part's
indicator character. For example, to add 12 minutes, it needs to add
2 + 1 = 3 characters, where 2 is the length of "12", and 1 is the length
of "M" (for minute). The mistake was that the length of the indicator
is already included in 'durationlen[i]', so there is no need to
calculate it again.

In the result of this mistake the current pointer can advance further
than needed and end up after the zero-byte instead of right on it, which
essentially cuts off any further generated text. For example, for a
5 minutes and 30 seconds duration, instead of having this:

    'P', 'T', '5', 'M', '3', '0', 'S', '\0'

The function generates this:

    'P', 'T', '5', 'M', '\0', '3', '0', 'S', '\0'

Fix the bug by adding to 'str' just 'durationlen[i]' instead of
'durationlen[i] + 1'.

(cherry picked from commit dc55f1ebb9)
2022-10-17 08:52:33 +00:00
Aram Sargsyan 98481e0a0a Test cfg_print_duration() in duration_test.c
Currently the 'duration_test' unit test checks only the
cfg_obj_asduration() function.

Extend the test so it checks also the reverse operation using the
cfg_print_duration() function, which is used in named-checkconf.

(cherry picked from commit 39290bb7cd)
2022-10-17 08:52:26 +00:00
Aram Sargsyan b6978ccbe3 Fix a logical bug in cfg_print_duration()
The cfg_print_duration() function prints a ISO 8601 duration value
converted from an array of integers, where the parts of the date and
time are stored.

durationlen[6], which holds the "seconds" part of the duration, has
a special case in cfg_print_duration() to ensure that when there are
no values in the duration, the result still can be printed as "PT0S",
instead of just "P", so it can be a valid ISO 8601 duration value.

There is a logical error in one of the two special case code paths,
when it checks that no value from the "date" part is defined, and no
"hour" or "minute" from the "time" part are defined.

Because of the error, durationlen[6] can be used uninitialized, in
which case the second parameter passed to snprintf() (which is the
maximum allowed length) can contain a garbage value.

This can not be exploited because the buffer is still big enough to
hold the maximum possible amount of characters generated by the "%u%c"
format string.

Fix the logical bug, and initialize the 'durationlen' array to zeros
to be a little safer from other similar errors.

(cherry picked from commit 9440910187)
2022-10-17 08:52:20 +00:00
Ondřej Surý e33fdd5c05 Merge branch 'mnowak/fix-grep-3.8-warnings-v9_18' into 'v9_18'
Fix GNU Grep 3.8 warnings [v9_18]

See merge request isc-projects/bind9!6918
2022-10-17 07:56:21 +00:00
Michal NowakandOndřej Surý 1751a9e191 Add CI check for Grep warnings
(cherry picked from commit 759e8a6671)
2022-10-17 09:10:29 +02:00
Michal NowakandOndřej Surý a7e2cc5dec Replace fgrep and egrep with grep -F/-E
GNU Grep 3.8 reports the following warnings:

    egrep: warning: egrep is obsolescent; using grep -E
    fgrep: warning: fgrep is obsolescent; using grep -F

(cherry picked from commit 212c4de043)
2022-10-17 09:10:29 +02:00
Michal NowakandOndřej Surý 55a866355b Remove stray backslashes
GNU Grep 3.8 reports several instances of stray backslashes in matching
patterns:

    grep: warning: stray \ before /
    grep: warning: stray \ before :

(cherry picked from commit 65e91ef5e6)
2022-10-17 09:10:29 +02:00
Tom Krizek da566ca54c Merge branch 'tkrizek/remove-system-test-delzone-v9_18' into 'v9_18'
Remove system test delzone [v9_18]

See merge request isc-projects/bind9!6911
2022-10-14 15:16:34 +00:00
Tom Krizek cfbd7431cd Remove system test delzone
There are multiple reasons to remove this test as obsolete:

- The test may not possibly work for over 2.5 years, since
  98b3b93791 removed the rndc.py python
  tool on which this test relies.
- It isn't part of the test suite either in CI or locally unless it is
  explicitly enabled. As a result, there are many issues which prevent
  the test from being executed caused by various refactoring efforts
  accumulated over time.
- Even if the test could be executed, it has no clear failure condition.
  If the python script(s) fail, the test still passes.

(cherry picked from commit 05180154d9)
2022-10-14 16:40:40 +02:00
Ondřej Surý 50ec8de8eb Merge branch 'artem-doth-reduce-listener-sockets-number-v9_18' into 'v9_18'
doth system test - decrease HTTP listener quota size

See merge request isc-projects/bind9!6900
2022-10-13 06:00:09 +00:00
Artem BoldarievandOndřej Surý 5656f681bd doth system test: increase transfers-in/out limits
Sometimes doth test could intermittently fail shortly after start due
to inability to complete a zone transfer in time. As it turned out, it
could happen due to transfers-in/out limits. Initially the defaults
were fine, but over time, especially when adding Strict/Mutual TLS, we
added more than 10 zones so it became possible to hit the limits.

This commit takes care of that by bumping the limits.

(cherry picked from commit 95a551de7b)
2022-10-13 07:39:07 +02:00
Artem BoldarievandOndřej Surý adcdbcd097 doth system test - decrease HTTP listener quota size
This commit reduces the size of HTTP listener quota from 300 (default)
to 100 so that it would make hitting any global limits in case of
running multiple tests in parallel in multiple containers unlikely.

This way the need in opening many file descriptors of different
kinds (e.g. client side connections and pipes) gets significantly
reduced while the required code paths are still verified.

(cherry picked from commit 354494cd10)
2022-10-13 07:39:07 +02:00
Artem Boldariev 064af66a0f Merge branch 'artem-clear-ssl-error-queue-for-dns-transports-v9-18' into 'v9_18'
[Backport to v9.18] TLS: clear error queue before doing IO or calling SSL_get_error()

See merge request isc-projects/bind9!6896
2022-10-12 14:53:22 +00:00
Artem Boldariev 15b7605e72 TLS DNS: fix certificate verification error message reporting
This commit fixes TLS DNS verification error message reporting which
we probably broke during one of the recent networking code
refactorings.

This prevent e.g. dig from producing useful error messages related to
TLS certificates verification.
2022-10-12 16:53:06 +03:00
Artem Boldariev e229af39e7 TLS: clear error queue before doing IO or calling SSL_get_error()
Ensure that TLS error is empty before calling SSL_get_error() or doing
SSL I/O so that the result will not get affected by prior error
statuses.

In particular, the improper error handling led to intermittent unit
test failure and, thus, could be responsible for some of the system
test failures and other intermittent TLS-related issues.

See here for more details:

https://www.openssl.org/docs/man3.0/man3/SSL_get_error.html

In particular, it mentions the following:

> The current thread's error queue must be empty before the TLS/SSL
> I/O operation is attempted, or SSL_get_error() will not work
> reliably.

As we use the result of SSL_get_error() to decide on I/O operations,
we need to ensure that it works reliably by cleaning the error queue.

TLS DNS: empty error queue before attempting I/O
2022-10-12 16:39:46 +03:00
Michał Kępień 3b9ec670f6 Merge branch '3592-fix-startup-detection-after-restart-in-start.pl-v9_18' into 'v9_18'
[v9_18] Fix startup detection after restart in start.pl

See merge request isc-projects/bind9!6890
2022-10-11 10:25:31 +00:00
Michał Kępień 9bfb9184f2 Fix startup detection after restart in start.pl
The bin/tests/system/start.pl script waits until a "running" message is
logged by a given name server instance before attempting to send a
version.bind/CH/TXT query to it.  The idea behind this was to make the
script wait until named loads all the zones it is configured to serve
before telling the system test framework that a given server is ready to
use; this prevents the need to add boilerplate code that waits for a
specific zone to be loaded to each test expecting that.

The problem is that when it looks for "running" messages, the
bin/tests/system/start.pl script assumes that the existence of any such
message in the named.run file indicates that a given named instance has
already finished loading all zones.  Meanwhile, some system tests
restart all the named instances they use throughout their lifetime (some
even do that a few times), for example to run Python-based tests.  The
bin/tests/system/start.pl script handles such a scenario incorrectly: as
soon as it finds any "running" message in the named.run file it inspects
and it gets a response to a version.bind/CH/TXT query, it tells the
system test framework that a given server is ready to use, which might
not be true - it is possible that only the "version.bind" zone is loaded
at that point and the "running" message found was logged by a
previously-shutdown named instance. This triggers intermittent failures
for Python-based tests.

Fix by improving the logic that the bin/tests/system/start.pl script
uses to detect server startup: check how many "running" lines are
present in a given named.run file before attempting to start a named
instance and only proceed with version.bind/CH/TXT queries when the
number of "running" lines found in that named.run file increases after
the server is started.

(cherry picked from commit 18e20f95f6)
2022-10-11 11:56:29 +02:00
Michał Kępień 2584413c90 Do not truncate ns2 logs in the "rrsetorder" test
In the "rrsetorder" system test, the ns2 named instance is restarted
without passing the --restart option to bin/tests/system/start.pl.  This
causes the log file for that named instance to be needlessly truncated.
Prevent this from happening by restarting the affected named instance
in the same way as all the other named instances used in system tests.

(cherry picked from commit 9146b956ae)
2022-10-11 11:56:29 +02:00
Michał Kępień bfe777613b Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.9' into 'v9_18'
Set up version and release notes for BIND 9.18.9

See merge request isc-projects/bind9!6885
2022-10-10 21:36:40 +00:00
Michał Kępień dd8872de8f Set up release notes for BIND 9.18.9 2022-10-10 23:18:40 +02:00
Michał Kępień fd028232f9 Update BIND version to 9.18.9-dev 2022-10-10 23:18:40 +02:00
Michał Kępień 35f5d35d41 Update BIND version for release 2022-10-10 09:43:12 +02:00
Michał Kępień 9419f00dc1 Add a CHANGES marker 2022-10-10 09:43:12 +02:00
Michał Kępień 499a321c7e Merge branch 'michal/prepare-documentation-for-bind-9.18.8' into 'v9_18_8-release'
Prepare documentation for BIND 9.18.8

See merge request isc-private/bind9!464
2022-10-07 11:28:52 +00:00
Michał Kępień a6ff5f9b49 Add release note for GL #3587 2022-10-07 13:22:06 +02:00
Michał Kępień d1b5ba07fd Reorder release notes 2022-10-07 13:22:06 +02:00
Michał Kępień de92c44be0 Tweak and reword release notes 2022-10-07 13:22:06 +02:00
Michał Kępień ec93236a5f Prepare release notes for BIND 9.18.8 2022-10-07 13:22:06 +02:00
Petr Špaček d2b428d8d2 Merge branch '3554-improve-dnssec-policy-inline-signing-err-msg-v9_18' into 'v9_18'
Clarify new configuration incompabitility: dnssec-policy vs. inline-signing [v9_18]

See merge request isc-projects/bind9!6871
2022-10-06 08:30:42 +00:00
Petr Špaček 49db39abfe Add Known Issue about config incompatibility
(cherry picked from commit 5589d0a49c)
2022-10-06 10:28:19 +02:00
Petr Špaček 6394f5c423 Clarify error message about missing inline-signing & dnssec-policy
(cherry picked from commit 058c1744ba)
2022-10-06 10:27:32 +02:00
Mark Andrews 7de12577ef Merge branch '3577-reloads-in-ixfr-system-test-happen-too-fast-v9_18' into 'v9_18'
Add sleeps to ixfr system test [v9_18]

See merge request isc-projects/bind9!6869
2022-10-05 22:28:16 +00:00
Mark Andrews 51bcf741fc Add sleeps to ixfr system test
ensure that at least a second has passed since a zone was last loaded
to prevent it accidentally being skipped as up to date.

(cherry picked from commit 491a8cfe96)
2022-10-06 08:36:25 +11:00
Michal Nowak 36f62900de Merge branch 'mnowak/drop-flake8-ignore-lists-v9_18' into 'v9_18'
[v9_18] Drop flake8 ignore lists

See merge request isc-projects/bind9!6867
2022-10-05 16:24:38 +00:00
Michal Nowak 8934362636 Drop flake8 ignore lists
flake8 is not used in BIND 9 CI and inline ignore lists are not needed
anymore.

(cherry picked from commit f5d9fa6ea4)
2022-10-05 18:06:38 +02:00
Petr Špaček aa8a0f761c Merge branch '3572-fix-duplicate-link-anchor-v9_18' into 'v9_18'
Deduplicate link anchors in the ARM [v9_18]

See merge request isc-projects/bind9!6861
2022-10-05 09:59:07 +00:00
Petr Špaček ce71fce811 Remove manually defined anchors pointing to statement definitions
This is hopefully end of duplication. This batch did not cause clashes
in Sphinx but it was pointless nonetheless as we have auto-generated
anchors for all statements.

(cherry picked from commit 137e0f4e0e)

Adapted for v9_18 branch by doing cleanup also in
notes/notes-9.18.0.rst.
2022-10-05 11:55:03 +02:00
Tom KrizekandPetr Špaček 6cd00258fa Remove trailing whitespaces
(cherry picked from commit ea2d213f34)
2022-10-05 11:44:33 +02:00
Petr Špaček bba3440638 Deduplicate link anchors in the ARM
Some statement names like "allow-query" had manually defined link anchor
_allow-query and also implicit anchor created by
.. namedconf:statement:: syntax. This causes warnings if a ambiguous
reference is made using :any:`allow-query` syntax.

Remove (hopefully all) manually defined anchors which pointed to
identical place as the implicit anchor. This allows :any: to work.

In rare cases where manual anchor points to descriptive text separated
from statement definition the reference was disamguated by replacing
:any:`notify` with :ref:`notify` (for manual anchor)
vs. :namedconf:ref:`notify` (for statement definition).

Please note that `options` statement is a trap: It is ambiguous even
without manual anchor because rndc.conf has its own `options`. Use
:namedconf:ref:`options` vs. :rndcconf:ref:`options` to select
appropriate target.

(cherry picked from commit 9a7c2b370e)
2022-10-05 11:44:33 +02:00
Mark Andrews cf9ef990d2 Merge branch '3338-zero-system-test-add-forensics-v9_18' into 'v9_18'
Add additional forensics to zero system test [v9_18]

See merge request isc-projects/bind9!6860
2022-10-05 08:52:08 +00:00
Mark Andrews 1d508b76cd Add additional forensics to zero system test
(cherry picked from commit 285351d4b2)
2022-10-05 19:30:38 +11:00
Mark Andrews 091be7c61d Merge branch '3569-dns-message-checksig-create-test-key-directory-v9_18' into 'v9_18'
Resolve "dns_message_checksig under oss_fuzz is not seeing the data files" [v9_18]

See merge request isc-projects/bind9!6858
2022-10-05 08:23:06 +00:00
Mark Andrews f7c2c07051 Add CHANGES note for [GL #3569]
(cherry picked from commit 1849a8a526)
2022-10-05 19:01:41 +11:00
Mark Andrews 280b863c97 Create a key directory in /tmp
Access to the source tree is not available with oss_fuzz.  Have
fuzz/dns_message_checksig build and populate a key directory for
the fuzzer to use.  This contains a key pair and a zone file which
has the public key from the key pair.  Clean it up on shutdown.

(cherry picked from commit 033057ba9d)
2022-10-05 19:01:41 +11:00
Petr Špaček 39827cfe3b Merge branch 'pspacek/tsan-ci-artifacts-fix-v9_18' into 'v9_18'
Fix TSAN artifact gathering in CI [v9_18]

See merge request isc-projects/bind9!6857
2022-10-05 07:45:12 +00:00
Petr Špaček a1d3fb98b7 Fix TSAN artifact gathering in CI
Fixup for 2c3b2dabe9.

We forgot to update TSAN paths when moving all the unit tests to
/tests/.  Let's remove paths from find to make it less dependent on
exact location, and store all untracked files as we do in the normal
unit test template.

Related: !6243
(cherry picked from commit 9559eb3b21)
2022-10-05 09:44:20 +02:00
Mark Andrews 087faf0747 Merge branch '3544-add-dohpath-parsing-to-svbc-v9_18' into 'v9_18'
Add support for 'dohpath' to SVCB (and HTTPS) [v9_18]

See merge request isc-projects/bind9!6849
2022-10-04 05:07:10 +00:00
Mark Andrews 886df1542e Use strnstr implementation from FreeBSD if not provided by OS
(cherry picked from commit 5f07fe8cbb)
2022-10-04 15:33:33 +11:00
Mark Andrews ec31057a0f Add release note for [GL #3544]
(cherry picked from commit 2f3441b40a)
2022-10-04 15:33:32 +11:00
Mark Andrews 9e8ebbbd23 Add CHANGES note for [GL #3544]
(cherry picked from commit 335b397e15)
2022-10-04 15:33:00 +11:00
Mark Andrews 10d9c040e7 Add support for 'dohpath' to SVCB (and HTTPS)
dohpath is specfied in draft-ietf-add-svcb-dns and has a value
of 7.  It must be a relative path (start with a /), be encoded
as UTF8 and contain the variable dns ({?dns}).

(cherry picked from commit 6d561d3886)
2022-10-04 15:32:22 +11:00
Matthijs Mekking c179933c09 Merge branch 'matthijs-dnssec-guide-dnssec-policy-requires-inline-signing-v9_18' into 'v9_18'
[v9_18] Add dnssec-policy inline-signing requirement to documentation

See merge request isc-projects/bind9!6832
2022-09-28 08:38:45 +00:00
Matthijs Mekking 2abb2b638a Add inline-signing to config examples
Add 'inline-signing yes;' to configuration examples to have working
copy paste configurations.

(cherry picked from commit 18d230a584)
2022-09-28 10:37:41 +02:00
Matthijs Mekking d1a01d88f9 Update inline-signing requirement to ARM
This change was made in !6403, but the appropriate documentation
changes were not applied to the ARM.

(cherry picked from commit 5d454a7158)
2022-09-28 10:37:41 +02:00
Matthijs Mekking 2305d8770b Add inline-signing requirement to DNSSEC Guide
This change was made in !6403, but the appropriate documentation
changes were not applied to the DNSSEC Guide.

(cherry picked from commit 09522c8d73)
2022-09-28 10:37:41 +02:00
Mark Andrews 79462fcb1d Merge branch '3562-assign-default-value-to-suffix-v9_18' into 'v9_18'
Suffix may be used before it is assigned a value [v9_18]

See merge request isc-projects/bind9!6836
2022-09-28 01:40:56 +00:00
Mark Andrews 750766a842 Suffix may be used before it is assigned a value
CID 350722 (#5 of 7): Bad use of null-like value (FORWARD_NULL)
        12. invalid_operation: Invalid operation on null-like value suffix.
    145        r.authority.append(
    146            dns.rrset.from_text(
    147                "icky.ptang.zoop.boing." + suffix,
    148                1,
    149                IN,
    150                NS,
    151                "a.bit.longer.ns.name." + suffix,
    152            )
    153        )

(cherry picked from commit 432064f63c)
2022-09-28 11:19:38 +10:00
Mark Andrews cff7e5acdd Merge branch '3551-missing-rsa_free-call-in-opensslrsa_verify2-v9_18' into 'v9_18'
Free 'rsa' if 'e' is NULL in opensslrsa_verify2 [v9_18]

See merge request isc-projects/bind9!6834
2022-09-28 01:06:10 +00:00
Mark Andrews 573eeea2ee Add CHANGES note for [GL #3551]
(cherry picked from commit 1e3680193a)
2022-09-28 09:49:27 +10:00
Mark Andrews 9f8eadd289 Check BN_dup results in rsa_check
(cherry picked from commit a47235f4f5)
2022-09-28 09:49:04 +10:00
Mark Andrews 6b37a69213 Free 'n' on error path in rsa_check
(cherry picked from commit 483c5a1978)
2022-09-28 09:49:04 +10:00
Mark Andrews 6c8fe060af Check that 'e' and 'n' are allocated in opensslrsa_fromdns
(cherry picked from commit db70c30213)
2022-09-28 09:49:04 +10:00
Mark Andrews 3fd8d439c6 Check that 'e' and 'n' are non-NULL in opensslrsa_todns
(cherry picked from commit 5603cd69d1)
2022-09-28 09:49:04 +10:00
Mark Andrews e9b880f648 Free 'rsa' if 'e' is NULL in opensslrsa_verify2
(cherry picked from commit a2b51ca6ac)
2022-09-28 09:49:04 +10:00
Mark Andrews ae44b22ca6 Merge branch '3541-have-named-v-report-supported-algorithms-v9_18' into 'v9_18'
Report supported crypto algorithms [v9_18]

See merge request isc-projects/bind9!6831
2022-09-27 23:27:48 +00:00
Petr ŠpačekandMark Andrews 81c8cc37aa Add release note for new crypto algorithm logging
(cherry picked from commit c138a8aa59)
2022-09-28 01:19:50 +10:00
Petr ŠpačekandMark Andrews af5f4bacf6 Document list of crypto algorithms in named -V output
(cherry picked from commit c648e280e4)
2022-09-28 01:19:50 +10:00
Mark Andrews 70606149c6 Deduplicate string formating
(cherry picked from commit d34ecdb366)
2022-09-28 01:19:50 +10:00
Mark Andrews 2f9a504998 Add CHANGES entry for [GL #3541]
(cherry picked from commit e876de442e)
2022-09-28 01:19:50 +10:00
Mark Andrews 09910d25a9 silence scan-build false positive
(cherry picked from commit 3156d36495)
2022-09-28 01:19:50 +10:00
Mark AndrewsandPetr Špaček 450a8ed5d5 Report algorithms supported by named at startup
(cherry picked from commit cb1515e71f)
2022-09-27 16:55:33 +02:00
Mark AndrewsandPetr Špaček c0e59be125 Have 'named -V' report supported algorithms
These cover DNSSEC, DS, HMAC and TKEY algorithms.

(cherry picked from commit b308f866c0)
2022-09-27 16:55:33 +02:00
Mark AndrewsandPetr Špaček 3d223e0338 Replace alg_totext with dst_hmac_algorithm_totext
The new library function will be reused by subsequent commits.

(cherry picked from commit 151cc2fff9)
2022-09-27 16:55:33 +02:00
Mark AndrewsandPetr Špaček 0bbc0c61e3 Convert DST_ALG defines to enum and group HMAC algorithms
The HMACs and GSSAPI are just using unallocated values.
Moving them around shouldn't cause issues.
Only the dnssec system test knew the internal number in use for hmacmd5.

(cherry picked from commit 09f7e0607a)
2022-09-27 16:55:33 +02:00
Tony Finch 57a773fa81 Merge branch '3548-without-system-jemalloc-v9_18' into 'v9_18'
A more helpful error when --without-jemalloc is impossible

See merge request isc-projects/bind9!6830
2022-09-27 14:17:36 +00:00
Tony Finch 9ec7f4399f A more helpful error when --without-jemalloc is impossible
When jemalloc is the system allocator (on FreeBSD and NetBSD), trying
to build --without-jemalloc caused an obscure compiler error. Instead,
complain at configure time that --without-jemalloc cannot work. (It
needs to remain an error because it is vexing when configure quietly
ignores an explicit direction.)

(cherry picked from commit f0e79458be)
2022-09-27 14:35:29 +01:00
Mark Andrews 6173e62147 Merge branch '3557-catalog-zone-check-key-names-v9_18' into 'v9_18'
Check that primary key names have not changed [v9_18]

See merge request isc-projects/bind9!6825
2022-09-27 12:42:23 +00:00
Mark Andrews 3fb4ced9aa Add release note for [GL #3557]
(cherry picked from commit eacf41a20a)
2022-09-27 22:20:21 +10:00
Mark Andrews 68336b367f Add CHANGES note for [GL #3557]
(cherry picked from commit 0774dacf2d)
2022-09-27 22:19:37 +10:00
Mark Andrews 66463ee48c Check that changing the TSIG key is successful
Switch the primary to require 'next_key' for zone transfers then
update the catalog zone to say to use 'next_key'.  Next update the
zones contents then check that those changes are seen on the
secondary.

(cherry picked from commit 176e172210)
2022-09-27 22:19:37 +10:00
Mark Andrews 83726e2fd3 Check that primary key names have not changed
When looking for changes in a catalog zone member zone we need to
also check if the TSIG key name associated with a primary server
has be added, removed or changed.

(cherry picked from commit 9172bd9b5a)
2022-09-27 22:19:37 +10:00
Petr Špaček 55726d616f Merge branch 'pspacek/fix-dns_message_checksig-out-of-tree-v9_18' into 'v9_18'
Fix dns_message_checksig fuzzer [v9_18]

See merge request isc-projects/bind9!6824
2022-09-27 11:37:01 +00:00
Ondřej SurýandPetr Špaček 6a349d5c29 Fix stack-use-after-scope in dns_message_checksig test
Previously stack with buffer for test dns message went out of scope
before the message was processed. For fuzz testing its better to avoid
allocation, so let's avoid allocations completely and use simplest
possible static buffer.

Fixes: #3565
(cherry picked from commit 16377100ae)
2022-09-27 13:23:25 +02:00
Petr Špaček a24ced44ab Fix dns_message_checksig in out-of-tree setup
Hardcoded path was missing FUZZDIR prefix.

Related: !5923
(cherry picked from commit 4108d79c9a)
2022-09-27 13:23:25 +02:00
Petr Špaček 35c5853f8a Detect errors in fuzzer initialization
Incomplete initialization typically causes mysterious failures later on,
so let's err out early.

(cherry picked from commit d102c59b96)
2022-09-27 13:23:16 +02:00
Evan Hunt a44ccdbabb Merge branch '3553-static-buffer-functions-v9_18' into 'v9_18'
change ISC__BUFFER macros to inline functions

See merge request isc-projects/bind9!6819
2022-09-27 07:46:00 +00:00
Evan Hunt 369858730a change ISC__BUFFER macros to inline functions
previously, when ISC_BUFFER_USEINLINE was defined, macros were
used to implement isc_buffer primitives (isc_buffer_init(),
isc_buffer_region(), etc). these macros were missing the DbC
assertions for those primitives, which made it possible for
coding errors to go undetected.

adding the assertions to the macros caused compiler warnings on
some platforms. therefore, this commit converts the ISC__BUFFER
macros to static inline functions instead, with assertions included,
and eliminates the non-inline implementation from buffer.c.

the --enable-buffer-useinline configure option has been removed.

(cherry picked from commit 1926ddc987)
2022-09-27 00:45:28 -07:00
Michał Kępień e442730104 Merge branch 'mnowak/add-fedora-36-v9_18' into 'v9_18'
[v9_18] Add Fedora 36

See merge request isc-projects/bind9!6820
2022-09-27 07:42:14 +00:00
Michal NowakandMichał Kępień 50405ba413 Add Fedora 36
(cherry picked from commit a313c49a3b)
2022-09-27 09:40:19 +02:00
Petr Špaček b8c92ad51f Merge branch 'bug/main/doc-arm-rhel9-v9_18' into 'v9_18'
Compatibility for building ARM on older sphinx [v9_18]

See merge request isc-projects/bind9!6817
2022-09-26 15:23:34 +00:00
Petr MenšíkandPetr Špaček ad59ef103f Simplify allowing warnings during ARM build
RHEL8 Sphinx does not support all features used in ARM building. But
with few emitted warnings it can build the documentation fine. Simplify
warnings acceptance by allowing make doc SPHINX_W=''.

(cherry picked from commit 3db7e241d2)
2022-09-26 17:16:42 +02:00
Petr MenšíkandPetr Špaček dfc7b630db Compatibility for building ARM on older sphinx
Make documentation building successful even on RHEL9 sphinx 3.4.3. It
does not like case-insensitive matching of terms, so provide lowercase
text description with Uppercase word reference.

(cherry picked from commit bc6c6b1184)
2022-09-26 17:16:38 +02:00
Petr Špaček 98ba68fe02 Merge branch 'ondrej-add-dns_message_checktsig-fuzzer-v9_18' into 'v9_18'
Add dns_message_checksig() fuzzer [v9_18]

See merge request isc-projects/bind9!6816
2022-09-26 15:16:01 +00:00
Petr Špaček c00f76b37e Add seed to reproduce issue memory leak in dns_message_checktsig
Related: #3547
(cherry picked from commit 983822abcf)
2022-09-26 16:53:06 +02:00
Mark AndrewsandPetr Špaček 431a2159e5 Add CHANGES notes for [GL !5923]
(cherry picked from commit 6237273205)
2022-09-26 16:53:06 +02:00
Mark AndrewsandPetr Špaček 339bd12c88 Add the ability to dig to specify the signing time
(cherry picked from commit 805e2ba31d)
2022-09-26 16:53:06 +02:00
Mark AndrewsandPetr Špaček 86fc284f74 Allow dig to SIG(0) sign a message
(cherry picked from commit 4d248ee78e)
2022-09-26 16:53:06 +02:00
Mark AndrewsandPetr Špaček 3a3a6367d2 Add a SIG(0) request seed
(cherry picked from commit c127a2aefc)
2022-09-26 16:53:06 +02:00
Mark AndrewsandPetr Špaček ed307fa179 Add TSIG reply seed
(cherry picked from commit 3c28608c9f)
2022-09-26 16:53:06 +02:00
Mark AndrewsandPetr Špaček 5eae4b78cc Add TSIG request seed
(cherry picked from commit f3d47bc8e0)
2022-09-26 16:53:06 +02:00
Ondřej SurýandPetr Špaček e57b933fbe Add dns_message_checksig() fuzzer
dns_message_checksig is called in a number of scenarios

	* on requests and responses
	* on multiple opcodes
	* with and without signatures
	* with TSIG signatures
	* with SIG(0) signatures
	* with and without configured TSIG keys
	* with and without KEY records being present
	* signing performed now, in the future and in the past

we use the first two octets of the seed to configure the calling
environment with the remainder of the seed being the rdata of the
TSIG/SIG(0) record.

(cherry picked from commit 4da0180ba2)

Adapted to v9_18 - removed third dns_zone_create() parameter.
2022-09-26 16:53:06 +02:00
Ondřej SurýandPetr Špaček c66c687bd6 Add the ability specify the signing / verification time
When fuzzing it is useful for all signing operations to happen
at a specific time for reproducability.  Add two variables to
the message structure (fuzzing and fuzztime) to specify if a
fixed time should be used and the value of that time.

(cherry picked from commit 3e85d8c3d6)
2022-09-26 16:30:36 +02:00
Petr Špaček c460041ad1 Merge branch '3547-dns_message_checksig-leak-fix-v9_18' into 'v9_18'
Fix memory leak in dns_message_checksig() - SIG(0) sigs [v9_18]

See merge request isc-projects/bind9!6812
2022-09-26 10:44:51 +00:00
Mark AndrewsandPetr Špaček 1488ef19f8 Stop passing mctx to dns_rdata_tostruct as it is unnecessary for SIG
dns_rdata_tostruct doesn't need a mctx passed to it for SIG (the signer
is already expanded at this point). About the only time when mctx is
needed is when the structure is to be used after the rdata has been
destroyed.

(cherry picked from commit d6ad56bd9e)
2022-09-26 12:01:44 +02:00
Petr Špaček 9a971bb8b0 Fix memory leak in dns_message_checksig() - SIG(0) sigs
Impact should be visible only in tests or tools because named never
uses view == NULL, which is a necessary condition to trigger this leak.

(cherry picked from commit 69256b3553)
2022-09-26 12:01:40 +02:00
Mark Andrews dc9c5f5cbd Merge branch 'bug/main/sha1-disabled-fedora-rhbz2122841-v9_18' into 'v9_18'
Engine pkcs11 cannot work with OSSL_PARAM on OpenSSL 3.0 [v9_18]

See merge request isc-projects/bind9!6805
2022-09-23 04:26:58 +00:00
Mark Andrews b53b69ca3c Add release note for [GL !6711]
(cherry picked from commit e27b063f67)
2022-09-23 14:07:53 +10:00
Mark Andrews e24c1f54ff Add a CHANGES note for [GL !6711]
(cherry picked from commit 54916b4e45)
2022-09-23 14:07:51 +10:00
Mark Andrews ebe0f68e99 Report how named was built
(cherry picked from commit 979062ee5d)
2022-09-23 14:07:21 +10:00
Mark Andrews 103b6948fb Build against OpenSSL 3.0 in OpenSSL 1.1.0 compatibility mode
(cherry picked from commit 9b13dd7b4d)
2022-09-23 14:07:21 +10:00
Michal NowakandMark Andrews c59c904e11 Let Debian sid image leverage PKCS#11 with OpenSSL 3
(cherry picked from commit 3dec2deebc)
2022-09-23 14:07:21 +10:00
Mark Andrews 98cc24d9fe Update reference to point to doc/arm/build.inc.rst
(cherry picked from commit 6d668b8c34)
2022-09-23 14:07:21 +10:00
Mark Andrews 7b2236c431 Document -DOPENSSL_API_COMPAT=10100 in OPTIONS.md
(cherry picked from commit f32c52c5ca)
2022-09-23 14:07:21 +10:00
Petr MenšíkandMark Andrews 8a425dbac4 Remove engine related parts for OpenSSL 3.0
OpenSSL just cannot work with mixing ENGINE_* api mixed with OSSL_PARAM
builders. But it can be built in legacy mode, where deprecated but still
working API would be used.

It can work under OpenSSL 3.0, but only if using legacy code paths
matching OpenSSL 1.1 calls and functions.

Remove fromlabel processing by OpenSSL 3.0 only functions. They can
return later with a proper provider support for pkcs11.

(cherry picked from commit 6c55ea17c6)
2022-09-23 14:07:21 +10:00
Petr MenšíkandMark Andrews d6806c9fe7 Do not use OSSL_PARAM when engine API is compiled
OpenSSL has deprecated many things in version 3.0. If pkcs11 engine
should work then no builder from OpenSSL 3.0 API can be used.

Allow switching to OpenSSL 1.1 like calls even on OpenSSL 3.0 when
OPENSSL_API_COMPAT=10100 is defined. It would still compile and allow
working keys loading from the engine passed on command line.

(cherry picked from commit f92950bb64)
2022-09-23 14:07:14 +10:00
Petr MenšíkandMark Andrews 306f1008cc Add ENGINE_init and ENGINE_finish calls
According to manual page of ENGINE_init, it should be called explicitly
before any key operations happens. Make it active whole lifetime.

(cherry picked from commit 71a8f1e7cd)
2022-09-23 14:05:16 +10:00
Petr Špaček da4eae91b5 Merge branch 'pspacek/fix-out-of-tree-junit-v9_18' into 'v9_18'
Improve JUnit test status generator for Gitlab CI [v9_18]

See merge request isc-projects/bind9!6804
2022-09-22 14:36:53 +00:00
Petr Špaček bbe089615f Unify Python interpreter used by TSAN and JUnit helpers
Reportedly we don't have python2-enabled TSAN builds, so we can remove
one more hardcoded python3 call from .gitlab-ci.yaml.

(cherry picked from commit 8d095550a8)
2022-09-22 16:17:28 +02:00
Petr Špaček 1067f114f9 Fix JUnit test status generator for out-of-tree system tests
- Use separate paths for tests results and test script
- For tarball tests include the conversion script in the `make dist`

(cherry picked from commit c46ad4aec2)
2022-09-22 16:17:25 +02:00
Arаm Sаrgsyаn 588ee1f581 Merge branch 'aram/arm-xot-and-ddns-update-forwarding-v9_18' into 'v9_18'
[v9_18] Document dynamic update forwarding limitation when XoT is enabled

See merge request isc-projects/bind9!6765
2022-09-22 11:43:53 +00:00
Aram Sargsyan f6f828989f Add a known issue release note for [GL #3512] 2022-09-22 10:54:56 +00:00
Aram Sargsyan e20cda5928 Document dynamic update forwarding limitation when XoT is enabled
BIND 9.18 does not support sending forwarded DDNS update requests
through DoT.
2022-09-22 10:54:56 +00:00
Evan Hunt f05297fe5a Merge branch '3553-httpd-cleanup-v9_18' into 'v9_18'
additional code cleanups in httpd.c

See merge request isc-projects/bind9!6799
2022-09-21 20:14:31 +00:00
Evan Hunt 357b59ec68 additional code cleanups in httpd.c
- use isc_buffer functions when appropriate, rather than converting
  to and from isc_region unnecessarily
- use the zlib total_out value instead of calculating it
- use c99 struct initialization

(cherry picked from commit 4b7248545e)
2022-09-21 12:54:27 -07:00
Michał Kępień 0a53f61727 Merge tag 'v9_18_7' into v9_18
BIND 9.18.7
2022-09-21 13:13:30 +02:00
Evan Hunt c00f22e8b2 Merge branch 'each-cleanup-dns_request-v9_18' into 'v9_18'
remove dns_request_create(), rename dns_request_createvia()

See merge request isc-projects/bind9!6784
2022-09-15 23:53:42 +00:00
Evan Hunt 8f61d07918 merge dns_request_createvia() into dns_request_create()
dns_request_create() was a front-end to dns_request_createvia() that
was only used by test binaries. dns_request_createvia() has been
renamed to dns_request_create(), and the test programs that formerly
used dns_request_create() have been updated to use the new parameters.

(cherry picked from commit ebf7b31aa3)
2022-09-15 16:49:04 -07:00
Mark Andrews af27dd052d Merge branch '3525-key-id-clashes-across-algorithms-cause-problems-with-statistics-v9_18' into 'v9_18'
Resolve "key id clashes across algorithms cause problems with statistics" [v9_18]

See merge request isc-projects/bind9!6746
2022-09-15 23:42:39 +00:00
Mark Andrews ea1d3476a8 Suppress manykeys test on duplicate key ids
If there are duplicate key ids across multiple algorithms expected
output is no met.  We have fixed this in on main but decided to not
back port the fix as it will change the statistics channel output.

This change detects when there are duplicate key id across algorithms
as skips the sub test.
2022-09-16 09:17:14 +10:00
Evan Hunt 9ac426db8f Merge branch '3522-update-detach-v9_18' into 'v9_18'
fix an incorrect detach in update processing

See merge request isc-projects/bind9!6782
2022-09-15 18:53:30 +00:00
Evan Hunt 16fbe33478 CHANGES for [GL #3522]
(cherry picked from commit fdc35928eb)
2022-09-15 11:34:33 -07:00
Evan Hunt 592c7b1049 fix an incorrect detach in update processing
when processing UDPATE requests, hold the request handle until
we either drop the request or respond to it.

(cherry picked from commit 00e0758e12)
2022-09-15 11:34:33 -07:00
Michal Nowak bc53176c54 Merge branch '3427-tcp-system-test-bump-socket.create_connection-timeout-v9_18' into 'v9_18'
[v9_18] Bump socket.create_connection() timeout to 10 seconds

See merge request isc-projects/bind9!6780
2022-09-15 10:46:58 +00:00
Michal Nowak ec3a17f718 Bump socket.create_connection() timeout to 10 seconds
The tcp Pytest on OpenBSD fairly reliably fails when receive_tcp()
on a socket is attempted:

    >           (response, rtime) = dns.query.receive_tcp(sock, timeout())

    tests-tcp.py:50:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    /usr/local/lib/python3.9/site-packages/dns/query.py:659: in receive_tcp
        ldata = _net_read(sock, 2, expiration)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
    count = 2, expiration = 1662719959.8106785

        def _net_read(sock, count, expiration):
            """Read the specified number of bytes from sock.  Keep trying until we
            either get the desired amount, or we hit EOF.
            A Timeout exception will be raised if the operation is not completed
            by the expiration time.
            """
            s = b''
            while count > 0:
                try:
    >               n = sock.recv(count)
    E               socket.timeout: timed out

This is because the socket is already closed.

Bump the socket connection timeout to 10 seconds.

(cherry picked from commit 658cae9fad)
2022-09-15 12:21:28 +02:00
Ondřej Surý 47a40b48dc Merge branch '3542-gracefuly-handle-cancelled-http-read-during-sending-v9_18' into 'v9_18'
Handle canceled read during sending data over stats channel

See merge request isc-projects/bind9!6779
2022-09-15 09:49:10 +00:00
Ondřej Surý c9c4de0626 Add CHANGES and release note for [GL #3542]
(cherry picked from commit e29563173b)
2022-09-15 10:58:28 +02:00
Ondřej Surý 474676a38c Provide stronger wording about the security of statistics channel
Add more text about the importance of properly securing the statistics
channel and what is and what is not considered a security vulnerability.

(cherry picked from commit 6869c98d36)
2022-09-15 10:58:09 +02:00
Ondřej Surý 2adaa53619 Handle canceled read during sending data over stats channel
An assertion failure would be triggered when the TCP connection
is canceled during sending the data back to the client.

Don't require the state to be `RECV` on non successful read to
gracefully handle canceled TCP connection during the SEND state of the
HTTPD channel.

(cherry picked from commit 6562227cc8)
2022-09-15 10:58:09 +02:00
Petr Špaček 5e51ccf9b6 Merge branch 'pspacek/log-no-recursion-reason-v9_18' into 'v9_18'
Log reasons why ACL denied recursion or cache peek [v9_18]

See merge request isc-projects/bind9!6775
2022-09-15 08:08:23 +00:00
Evan HuntandPetr Špaček 4bf1dcc96a Add tests for the new log messages with refusal reason
Update the allow-query test to check for the new log messages.

(cherry picked from commit a2bbe578bf)
2022-09-15 09:41:32 +02:00
Petr Špaček d1d1bc67bd CHANGES note for [GL !6669]
(cherry picked from commit 67c3a3439b)
2022-09-15 09:41:31 +02:00
Petr Špaček c095ac9ad1 Log reason why cache peek is not available
Log which ACL caused RD=0 query into cache to be refused.
Expected performance impact is negligible.

(cherry picked from commit fdf7456643)
2022-09-15 09:41:01 +02:00
Petr Špaček e067d11396 Log reason why recursion is not available
Log which ACL caused RA=0 condition.
Expected performance impact is negligible.

(cherry picked from commit 95fc05c454)
2022-09-15 09:40:57 +02:00
Evan Hunt c8ac45057b Merge branch '3399-random-device-obsolete' into 'v9_18'
flag "random-device" as obsolete

See merge request isc-projects/bind9!6768
2022-09-14 16:49:41 +00:00
Evan Hunt 90117edc49 CHANGES for [GL #3399] 2022-09-14 09:37:25 -07:00
Evan Hunt 17da7dee5c flag "random-device" as obsolete
the "random-device" option was made non-functional in 9.13, but was
not marked as obsolete at that time. this is now fixed; configuring
"random-device" will trigger a warning.
2022-09-14 09:37:25 -07:00
Tony Finch 0ffef8ceba Merge branch '3519-macos-tests-v9_18' into 'v9_18'
The system tests are using another IP address

See merge request isc-projects/bind9!6772
2022-09-14 12:06:28 +00:00
Tony Finch 1c6627f6e3 Skip the xfer test when Net::DNS is too old
This allows the system tests to run to completion on macOS
without requiring extra modules from CPAN.

(cherry picked from commit d8053785b0)
2022-09-14 11:49:43 +01:00
Tony Finch de747f9b6b The system tests are using another IP address
Reduce the number of places that know about the number of IP addresses
required by the system tests, by changing `testsock.pl` to read the
`max` from `ifconfig.sh.in`. This should make the test runner fail
early with a clear message when the interfaces have been set up by an
obsolete script.

Add comments to cross-reference `ifconfig.sh.in`, `testsock.pl`, and
`org.isc.bind.system` to make it easier to remember what needs
updating when an IP address is added.

(cherry picked from commit 258a896a0c)
2022-09-14 11:49:43 +01:00
Evan Hunt db830aa8aa Merge branch '3520-rndc-detach' into 'v9_18'
fix a possible use-after-detach bug in rndc

See merge request isc-projects/bind9!6724
2022-09-12 21:25:59 +00:00
Evan Hunt 7513aeead8 fix a possible use-after-detach bug in rndc
we need to detach the rndc task when calling isc_app_shutdown(),
otherwise it may be detached before the last reference to it.
while this does not prevent rndc from working, it causes a spurious
core dump on shutdown.
2022-09-12 14:03:05 -07:00
Evan Hunt 4252ee5c5f Merge branch '3520-rndc-shutdown-hang-v9_18' into 'v9_18'
prevent a possible shutdown hang in rndc

See merge request isc-projects/bind9!6764
2022-09-12 21:02:36 +00:00
Evan Hunt 9e0af151e9 prevent a possible shutdown hang in rndc
In rndc_recvdone(), if 'sends' was not 0, then 'recvs' was not
decremented, in which case isc_loopmgr_shutdown() was never reached,
which could cause a hang. (This has not been observed to happen, but
the code was incorrect on examination.)

(cherry picked from commit 9683439d73)
2022-09-12 13:34:58 -07:00
Tony Finch de40d702b0 Merge branch '3531-initialize-struct-server-v9_18' into 'v9_18'
Ensure that named_server_t is properly initialized

See merge request isc-projects/bind9!6762
2022-09-12 11:21:57 +00:00
Tony Finch 0470a4f521 Ensure that named_server_t is properly initialized
There was a ubsan error reporting an invalid value for interface_auto
(a boolean value cannot be 190) because it was not initialized. To
avoid this problem happening again, ensure the whole of the server
structure is initialized to zero before setting the (relatively few)
non-zero elements.
2022-09-12 11:26:33 +01:00
Michał Kępień f2fc2cef60 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.8' into 'v9_18'
Set up version and release notes for BIND 9.18.8

See merge request isc-projects/bind9!6759
2022-09-09 18:23:11 +00:00
Michał Kępień 6081ba7604 Set up release notes for BIND 9.18.8 2022-09-09 19:58:46 +02:00
Michał Kępień 7cea6c4211 Update BIND version to 9.18.8-dev 2022-09-09 19:58:46 +02:00
Michał Kępień 85a6eb108e Update BIND version for release 2022-09-08 14:39:47 +02:00
Michał Kępień 3d55ae3d2f Add a CHANGES marker 2022-09-08 14:39:47 +02:00
Michał Kępień f0f3c56cd5 Merge branch 'michal/prepare-documentation-for-bind-9.18.7' into 'security-v9_18'
Prepare documentation for BIND 9.18.7

See merge request isc-private/bind9!459
2022-09-08 12:26:53 +00:00
Michał Kępień 212c9f1239 Tweak and reword release notes 2022-09-08 14:03:54 +02:00
Michał Kępień 364bdb5ec8 Prepare release notes for BIND 9.18.7 2022-09-08 14:03:54 +02:00
Michał Kępień c58fb22a74 Merge branch '3487-eddsa-verify-leak-v9_18' into 'security-v9_18'
[v9_18] [CVE-2022-38178] eddsa verify leak

See merge request isc-private/bind9!439
2022-09-08 09:57:42 +00:00
Mark AndrewsandMichał Kępień 06e13c5a8d Add release note for [GL #3487]
(cherry picked from commit e6cb1de20b)
2022-09-08 11:55:29 +02:00
Mark AndrewsandMichał Kępień 79655301ab Add CHANGES note for [GL #3487]
(cherry picked from commit b3277f2e10)
2022-09-08 11:55:29 +02:00
Mark AndrewsandMichał Kępień 7c0028cfad Free ctx on invalid siglen
(cherry picked from commit 6ddb480a84)
2022-09-08 11:55:29 +02:00
Michał Kępień 21af7869d1 Merge branch '3517-serve-stale-client-timeout-0-cname-crash-v9_18' into 'security-v9_18'
[v9_18] [CVE-2022-3080] Fix serve-stale-client-timeout 0 CNAME crash

See merge request isc-private/bind9!447
2022-09-08 09:53:06 +00:00
Matthijs MekkingandMichał Kępień 175e4e963b Add release notes for #3517
(cherry picked from commit 97c6c3712e)
2022-09-08 11:50:44 +02:00
Matthijs MekkingandMichał Kępień 55946cebb6 Add CHANGES entry for 3517
(cherry picked from commit e394902965)
2022-09-08 11:50:44 +02:00
Matthijs MekkingandMichał Kępień b9e2f3333d Only refresh RRset once
Don't attempt to resolve DNS responses for intermediate results. This
may create multiple refreshes and can cause a crash.

One scenario is where for the query there is a CNAME and canonical
answer in cache that are both stale. This will trigger a refresh of
the RRsets because we encountered stale data and we prioritized it over
the lookup. It will trigger a refresh of both RRsets. When we start
recursing, it will detect a recursion loop because the recursion
parameters will eventually be the same. In 'dns_resolver_destroyfetch'
the sanity check fails, one of the callers did not get its event back
before trying to destroy the fetch.

Move the call to 'query_refresh_rrset' to 'ns_query_done', so that it
is only called once per client request.

Another scenario is where for the query there is a stale CNAME in the
cache that points to a record that is also in cache but not stale. This
will trigger a refresh of the RRset (because we encountered stale data
and we prioritized it over the lookup).

We mark RRsets that we add to the message with
DNS_RDATASETATTR_STALE_ADDED to prevent adding a duplicate RRset when
a stale lookup and a normal lookup conflict with each other. However,
the other non-stale RRset when following a CNAME chain will be added to
the message without setting that attribute, because it is not stale.

This is a variant of the bug in #2594. The fix covered the same crash
but for stale-answer-client-timeout > 0.

Fix this by clearing all RRsets from the message before refreshing.
This requires the refresh to happen after the query is send back to
the client.

(cherry picked from commit d939d2ecde)
2022-09-08 11:50:44 +02:00
Michał Kępień df94f18583 Merge branch '3491-security-fix-openssl-dh-memory-leaks-v9_18' into 'security-v9_18'
[v9_18] [CVE-2022-2906] Fix memory leaks in DH code

See merge request isc-private/bind9!433
2022-09-08 09:48:18 +00:00
Aram SargsyanandMichał Kępień 8ac3682c7e Add release note for [GL #3491]
(cherry picked from commit 113e949b34)
2022-09-08 11:46:20 +02:00
Aram SargsyanandMichał Kępień 919e2d195f Add CHANGES note for [GL #3491]
(cherry picked from commit 5b5f2353d4)
2022-09-08 11:46:20 +02:00
Aram SargsyanandMichał Kępień 73df5c8053 Fix memory leaks in DH code
When used with OpenSSL v3.0.0+, the `openssldh_compare()`,
`openssldh_paramcompare()`, and `openssldh_todns()` functions
fail to cleanup the used memory on some error paths.

Use `DST_RET` instead of `return`, when there is memory to be
released before returning from the functions.

(cherry picked from commit 73d6bbff4e)
2022-09-08 11:46:20 +02:00
Michał Kępień 648eca7698 Merge branch '3493-confidential-compression-buffer-reuse-v9_18' into 'security-v9_18'
[v9_18][CVE-2022-2881] compression buffer was not reused correctly

See merge request isc-private/bind9!436
2022-09-08 09:43:50 +00:00
Evan HuntandMichał Kępień 2312c45ff2 CHANGES and release notes for CVE-2022-2881 [GL #3493]
(cherry picked from commit 430ee6c427)
2022-09-08 11:40:18 +02:00
Evan HuntandMichał Kępień 13333db69f compression buffer was not reused correctly
when the compression buffer was reused for multiple statistics
requests, responses could grow beyond the correct size. this was
because the buffer was not cleared before reuse; compressed data
was still written to the beginning of the buffer, but then the size
of used region was increased by the amount written, rather than set
to the amount written. this caused responses to grow larger and
larger, potentially reading past the end of the allocated buffer.

(cherry picked from commit 47e9fa981e)
2022-09-08 11:40:18 +02:00
Michał Kępień 74ba7f89d7 Merge branch '3394-security-cve-2022-2795-mitigation-v9_18' into 'security-v9_18'
[CVE-2022-2795] [v9_18] Bound the amount of work performed for delegations

See merge request isc-private/bind9!452
2022-09-08 09:37:26 +00:00
Michał Kępień 7f6cb0d0cc Add release note for GL #3394
(cherry picked from commit 672072812c)
2022-09-08 11:11:30 +02:00
Michał Kępień 97a9f586c4 Add CHANGES entry for GL #3394
(cherry picked from commit e802beedfc)
2022-09-08 11:11:30 +02:00
Michał Kępień e2014ba9e3 Bound the amount of work performed for delegations
Limit the amount of database lookups that can be triggered in
fctx_getaddresses() (i.e. when determining the name server addresses to
query next) by setting a hard limit on the number of NS RRs processed
for any delegation encountered.  Without any limit in place, named can
be forced to perform large amounts of database lookups per each query
received, which severely impacts resolver performance.

The limit used (20) is an arbitrary value that is considered to be big
enough for any sane DNS delegation.

(cherry picked from commit 3a44097fd6)
2022-09-08 11:11:30 +02:00
Michał Kępień 7e27db0023 Merge branch '3459-rrl-wildcard-handling-v9_18' into 'v9_18'
[v9_18] Make RRL code treat all QNAMEs subject to wildcard processing within a given zone as the same name

See merge request isc-projects/bind9!6748
2022-09-08 08:14:29 +00:00
Aram SargsyanandMichał Kępień bcf0f951e0 Add CHANGES and release notes for [GL #3459]
(cherry picked from commit 0b0cf12741)
2022-09-08 09:36:50 +02:00
Aram SargsyanandMichał Kępień f2982a5d3f Document RRL processing for wildcard names
All valid wildcard domain names are interpreted as the zone's origin
name concatenated to the "*" name.

(cherry picked from commit 89c2032421)
2022-09-08 09:36:50 +02:00
Aram SargsyanandMichał Kępień 35e37505f0 Fix RRL responses-per-second bypass using wildcard names
It is possible to bypass Response Rate Limiting (RRL)
`responses-per-second` limitation using specially crafted wildcard
names, because the current implementation, when encountering a found
DNS name generated from a wildcard record, just strips the leftmost
label of the name before making a key for the bucket.

While that technique helps with limiting random requests like
<random>.example.com (because all those requests will be accounted
as belonging to a bucket constructed from "example.com" name), it does
not help with random names like subdomain.<random>.example.com.

The best solution would have been to strip not just the leftmost
label, but as many labels as necessary until reaching the suffix part
of the wildcard record from which the found name is generated, however,
we do not have that information readily available in the context of RRL
processing code.

Fix the issue by interpreting all valid wildcard domain names as
the zone's origin name concatenated to the "*" name, so they all will
be put into the same bucket.

(cherry picked from commit baa9698c9d)
2022-09-08 09:36:50 +02:00
Matthijs Mekking fe162c74c1 Merge branch 'matthijs-fix-intermittent-inline-system-test-failure-v9_18' into 'v9_18'
[v9_18]  Fix intermittent inline system test failure

See merge request isc-projects/bind9!6739
2022-09-07 15:12:22 +00:00
Matthijs Mekking d1315d1bc4 Update inline system test, zone 'retransfer3.'
The zone 'retransfer3.' tests whether zones that 'rndc signing
-nsec3param' requests are queued even if the zone is not loaded.

The test assumes that if 'rndc signing -list' shows that the zone is
done signing with two keys, and there are no NSEC3 chains pending, the
zone is done handling the '-nsec3param' queued requests. However, it
is possible that the 'rndc signing -list' command is received before
the corresponding privatetype records are added to the zone (the records
that are used to retrieve the signing status with 'rndc signing').

This is what happens in test failure
https://gitlab.isc.org/isc-projects/bind9/-/jobs/2722752.

The 'rndc signing -list retransfer3' is thus an unreliable check.
It is simpler to just remove the check and wait for a certain amount
of time and check whether ns3 has re-signed the zone using NSEC3.

(cherry picked from commit 8b71cbd09c)
2022-09-07 16:26:12 +02:00
Evan Hunt d245253eb8 Merge branch 'each-interface-magic-v9_18' into 'v9_18'
when creating an interface, set magic before linking

See merge request isc-projects/bind9!6736
2022-09-07 06:14:56 +00:00
Evan Hunt acfca3f4fa when creating an interface, set magic before linking
set the magic number in a newly-created interface object
before appending it to mgr->interfaces in order to prevent
a possible assertion.

(cherry picked from commit 8c01662048)
2022-09-06 21:48:28 -07:00
Arаm Sаrgsyаn 5c44aad640 Merge branch '3518-libxml2-deprecated-functions-v9_18' into 'v9_18'
[v9_18] Do not use libxml2 deprecated functions

See merge request isc-projects/bind9!6731
2022-09-06 10:03:31 +00:00
Aram Sargsyan 93c39696f4 Add CHANGES note for [GL #3518]
(cherry picked from commit 87920661b1)
2022-09-06 09:21:02 +00:00
Aram Sargsyan 97197ef78e Do not use libxml2 deprecated functions
The usage of xmlInitThreads() and xmlCleanupThreads() functions in
libxml2 is now marked as deprecated, and these functions will be made
private in the future.

Use xmlInitParser() and xmlCleanupParser() instead of them.

(cherry picked from commit a5d412d924)
2022-09-06 09:20:55 +00:00
Matthijs Mekking 7be0594be9 Merge branch '3381-dnssec-policy-explicit-inline-signing-v9_18' into 'v9_18'
[v9_18] dnssec-policy now requires inline-signing

See merge request isc-projects/bind9!6729
2022-09-06 08:48:46 +00:00
Matthijs Mekking b232fabe89 Add change and release note for #3381
Because folks want to know.

(cherry picked from commit 2b95c11905a1a5faff9efa97a4f2498aadfa467b)
2022-09-06 09:55:06 +02:00
Matthijs Mekking 5c4c32114f Remove implicit inline-signing code
Remove the code that sets implicit inline-signing on zones using
dnssec-policy.

(cherry picked from commit a6b09c9c69186e81a9be54e8b7bb413b1ac4d650)
2022-09-06 09:55:06 +02:00
Matthijs Mekking c6e2d7d54d Update system tests
Update checkconf and kasp related system tests after requiring
inline-signing.

(cherry picked from commit 8fd75e8a4e1035ce0e81bf47d954a3f5b8a4d571)
2022-09-06 09:55:06 +02:00
Matthijs Mekking d7175c41a7 dnssec-policy now requires inline-signing
Having implicit inline-signing set for dnssec-policy when there is no
update policy is confusing, so lets make this explicit.

(cherry picked from commit 5ca02fe6e7e591d1fb85936ea4dda720c3d741ef)
2022-09-06 09:02:59 +02:00
Ondřej Surý a6b6a1c9dd Merge branch '3485-dig-fallback-to-idna2003-v9_18' into 'v9_18'
Allow fallback to IDNA2003 processing

See merge request isc-projects/bind9!6725
2022-09-05 09:43:43 +00:00
Ondřej Surý 05499232a7 Add CHANGES and release note for [GL #3485]
(cherry picked from commit 0fe7acb4e6)
2022-09-05 10:21:28 +02:00
Ondřej Surý a22b0bebc2 Enable the IDNA2003 domain names in the idna system test
Allow the IDNA2003 tests to succeed after the fallback to IDNA2003 was
implemented.

(cherry picked from commit 87de726f5c)
2022-09-05 10:21:28 +02:00
Ondřej Surý abc0382738 Allow fallback to IDNA2003 processing
In several cases where IDNA2008 mappings do not exist whereas IDNA2003
mappings do, dig was failing to process the suplied domain name.  Take a
backwards compatible approach, and convert the domain to IDNA2008 form,
and if that fails try the IDNA2003 conversion.

(cherry picked from commit 10923f9d87)
2022-09-05 10:21:28 +02:00
Arаm Sаrgsyаn bf70a66ed8 Merge branch '3515-mctx-attach-detach-for-isc_mempool_t-v9_18' into 'v9_18'
[v9_18] Add mctx attach/detach when creating/destroying a memory pool

See merge request isc-projects/bind9!6720
2022-09-02 09:03:31 +00:00
Aram Sargsyan 1017083de7 Add CHANGES note for [GL #3515]
(cherry picked from commit 362ead8d85)
2022-09-02 08:17:54 +00:00
Aram Sargsyan 982b491d7c Add mctx attach/detach when creating/destroying a memory pool
This should make sure that the memory context is not destroyed
before the memory pool, which is using the context.

(cherry picked from commit e97c3eea95)
2022-09-02 08:17:47 +00:00
Evan Hunt 19b98dc74f Merge branch '3511-quote-yaml-addresses-v9_18' into 'v9_18'
quote addresses in YAML output

See merge request isc-projects/bind9!6717
2022-08-31 23:39:50 +00:00
Evan Hunt 3ea267f29d CHANGES for [GL #3511]
(cherry picked from commit f72bf1375a)
2022-08-31 16:17:56 -07:00
Evan Hunt 3304c694c8 quote addresses in YAML output
YAML strings should be quoted if they contain colon characters.
Since IPv6 addresses do, we now quote the query_address and
response_address strings in all YAML output.

(cherry picked from commit 66eaf6bb73)
2022-08-31 16:17:56 -07:00
Evan Hunt d84cff6d4b Merge branch '3501-dnstap-response-v9_18' into 'v9_18'
dnstap query_message field was erroneously set with responses

See merge request isc-projects/bind9!6715
2022-08-31 22:44:41 +00:00
Evan Hunt 07b3cbbba1 CHANGES for [GL #3501]
(cherry picked from commit fea9751f13)
2022-08-31 15:24:23 -07:00
Evan Hunt 7bb503ca75 dnstap query_message field was erroneously set with responses
The dnstap query_message field was in some cases being filled in
with response messages, along with the response_message field.
The query_message field should only be used when logging requests,
and the response_message field only when logging responses.

(cherry picked from commit 3ccfff8ab6)
2022-08-31 15:24:00 -07:00
Arаm Sаrgsyаn cdf1871066 Merge branch 'aram/rpz-doc-update-v9_18' into 'v9_18'
[v9_18] Update RPZ documentation in ARM

See merge request isc-projects/bind9!6709
2022-08-31 08:54:04 +00:00
Aram Sargsyan 5e868be3cc Update RPZ documentation
The RPZ documentation section with response policy rules and actions
is incomplete.

Add information about the 'RPZ-CLIENT-IP' rule, and 'TCP-Only' and
'DROP' actions.

(cherry picked from commit 0fbd07ac22)
2022-08-30 10:36:14 +00:00
Mark Andrews eb5492beeb Merge branch '3505-missing-isc_mutex_destroy-v9_18' into 'v9_18'
Call isc_mutex_destroy(&lasttime_mx); [v9_18]

See merge request isc-projects/bind9!6697
2022-08-24 07:38:01 +00:00
Mark Andrews 41cfd1c783 Call isc_mutex_destroy(&lasttime_mx);
(cherry picked from commit 8109f495c8b5d7c7f88d581f7905650add0c184e)
2022-08-24 17:03:57 +10:00
Matthijs Mekking b88762debb Merge branch '3500-nsec3-missing-detach-node-9_18' into 'v9_18'
nsec3.c: Add a missing dns_db_detachnode() call

See merge request isc-projects/bind9!6693
2022-08-23 11:24:56 +00:00
Matthijs Mekking d386ef9a0e Add CHANGES entry for #3500
There is no need for a release because this case was nearly impossible
to trigger (except for when 'sig-signing-type' was set to 0).

(cherry picked from commit 545ecb64b043617ea609f4f115d280bb5990e221)
2022-08-23 12:04:14 +02:00
Matthijs Mekking e54ab3f586 nsec3.c: Add a missing dns_db_detachnode() call
There is one case in 'dns_nsec3_activex()' where it returns but forgets
to detach the db node. Add the missing 'dns_db_detachnode()' call.

This case only triggers if 'sig-signing-type' (privatetype) is set to 0
(which by default is not), or if the function is called with 'complete'
is set to 'true' (which at this moment do not exist).

(cherry picked from commit 0cf6c18ccb2205a1fc81431f908c8310f6136bbb)
2022-08-23 12:04:08 +02:00
Matthijs Mekking 9d6de16c57 Merge branch '3486-checkconf-dnssec-policy-nsec3-incompatible-algorithm-v9_18' into 'v9_18'
[v9_18]  Graceful dnssec-policy transition from NSEC only to NSEC3

See merge request isc-projects/bind9!6691
2022-08-22 17:42:11 +00:00
Matthijs Mekking ba71f93e44 Fix nsec3 system test issues
The wait_for_zone_is_signed function was never called, which could lead
to test failures due to timing issues (where a zone was not fully signed
yet, but the test was trying to verify the zone).

Also add two missing set_nsec3param calls to ensure the ITERATIONS
value is set for these test cases.

(cherry picked from commit 08505651d1d9278314f61076ac7cd119a7790428)
2022-08-22 19:21:39 +02:00
Matthijs Mekking ffc0c321ca Add change entry and release note for #3486
News worthy.

(cherry picked from commit 2669eb2a34ef65935f8045a6c9d271af486f38d5)
2022-08-22 19:21:39 +02:00
Matthijs Mekking 73431eef8f Add test case for #3486
Add two scenarios where we change the dnssec-policy from using RSASHA1
to something with NSEC3.

The first case should work, as the DS is still in hidden state and we
can basically do anything with DNSSEC.

The second case should fail, because the DS of the predecessor is
published and we can't immediately remove the predecessor DNSKEY. So
in this case we should keep the NSEC chain for a bit longer.

Add two more scenarios where we change the dnssec-policy from using
NSEC3 to something NSEC only. Both should work because there are no
restrictions on using NSEC when it comes to algorithms, but in the
cases where the DS is published we can't bluntly remove the predecessor.

Extend the nsec3 system test by also checking the DNSKEY RRset for the
expected DNSKEY records. This requires some "kasp system"-style setup
for each test (setting key properties and key states). Also move the
dnssec-verify check inside the check_nsec/check_nsec3 functions because
we will have to do that every time.

(cherry picked from commit 21729dd94efc9fc7b7317688dd9ff0ec45181bfd)
2022-08-22 19:21:39 +02:00
Matthijs Mekking 39c0c5022d Wait with NSEC3 during a DNSSEC policy change
When doing a dnssec-policy reconfiguration from a zone with NSEC only
keys to a zone that uses NSEC3, figure out to wait with building the
NSEC3 chain.

Previously, BIND 9 would attempt to sign such a zone, but failed to
do so because the NSEC3 chain conflicted with existing DNSKEY records
in the zone that were not compatible with NSEC3.

There exists logic for detecting such a case in the functions
dnskey_sane() (in lib/dns/zone.c) and check_dnssec() (in
lib/ns/update.c). Both functions look very similar so refactor them
to use the same code and call the new function (called
dns_zone_check_dnskey_nsec3()).

Also update the dns_nsec_nseconly() function to take an additional
parameter 'diff' that, if provided, will be checked whether an
offending NSEC only DNSKEY will be deleted from the zone. If so,
this key will not be considered when checking the zone for NSEC only
DNSKEYs. This is needed to allow a transition from an NSEC zone with
NSEC only DNSKEYs to an NSEC3 zone.

(cherry picked from commit 09a81dc84ce0fee37442f03cdbd63c2398215376)
2022-08-22 19:21:39 +02:00
Matthijs Mekking b0ae2e4da7 Test checkconf NSEC3 and incompatible algorithm
The check code for this already exists, but was untested.

(cherry picked from commit 1996eaee547e046c8314cdb4a50a02eb9e59ce3f)
2022-08-22 16:37:38 +02:00
Arаm Sаrgsyаn 92fda68e22 Merge branch '3463-httpd.c-non-empty-post-requests-bugfix-v9_18' into 'v9_18'
[v9_18] Fix statistics channel multiple request processing with non-empty HTTP bodies

See merge request isc-projects/bind9!6689
2022-08-19 09:01:19 +00:00
Aram Sargsyan cbb5d4f08b Add pipelined POST requests check in the statschannel system test
Use `nc` to check that multiple POST requests with non-empty HTTP
body are serviced normally by the statistics channel.

(cherry picked from commit bc32885ba981cab6308981936f49ab625af84bf2)
2022-08-19 08:27:24 +00:00
Aram Sargsyan 8e37e5f27f Replace expr commands with $((expression)) shell constucts
Update the "statschannel" system test to use the $((expression))
shell constucts instead of executing the `expr` program.

(cherry picked from commit 8034819b53789b52dd1c80b0256880b506a3f31b)
2022-08-19 08:27:17 +00:00
Aram Sargsyan 95452d9a47 Add CHANGES not for [GL #3463]
(cherry picked from commit a00d787f2cf909fe0d8dce016488916997e8d67e)
2022-08-19 08:27:09 +00:00
Aram Sargsyan d4c5d1c650 Fix statistics channel multiple request processing with non-empty bodies
When the HTTP request has a body part after the HTTP headers, it is
not getting processed and is being prepended to the next request's data,
which results in an error when trying to parse it.

Improve the httpd.c:process_request() function with the following
additions:

1. Require that HTTP POST requests must have Content-Length header.
2. When Content-Length header is set, extract its value, and make sure
   that it is valid and that the whole request's body is received before
   processing the request.
3. Discard the request's body by consuming Content-Length worth of data
   in the buffer.

(cherry picked from commit c2bbdc8a648c9630b2c9cea5227ad5c309c2ade5)
2022-08-19 08:27:01 +00:00
Aram Sargsyan 1005dd74d9 Enhance the have_header() function to find the HTTP header's value
Add a new `const char **fvalue` parameter to the httpd.c:have_header()
function which, when set, will point to the found header's value.

(cherry picked from commit 376e698dc21f4117d6461101c4cfbaef2b724592)
2022-08-19 08:26:18 +00:00
Mark Andrews 616702ad63 Merge branch 'bug/main/delv-cfg_parser_reset-v9_18' into 'v9_18'
Reset parser before parsing of internal trust anchor [v9_18]

See merge request isc-projects/bind9!6688
2022-08-19 05:42:24 +00:00
Mark Andrews f94e658d05 Add CHANGES entry for [GL !6468]
(cherry picked from commit 23a8c15cb2efd3486a4e7ea41c1581cb2ed07912)
2022-08-19 15:21:41 +10:00
Petr MenšíkandMark Andrews fdd9e39dfe Reset parser before parsing of internal trust anchor
It might be reused if /etc/bind.keys exists, but failed correct parsing.
Release traces of previous parsing attempt of different data.

(cherry picked from commit dc07394c4724c1e1235af85dd8c044af70da93ae)
2022-08-19 15:21:41 +10:00
Mark Andrews b6caedd07c Merge branch '3499-duration-c-66-6-warning-array-subscript-is-of-type-char-on-netbsd-9-v9_18' into 'v9_18'
Silence negative array index warning with toupper [v9_18]

See merge request isc-projects/bind9!6686
2022-08-19 04:30:06 +00:00
Mark Andrews f7590c1c5a Silence negative array index warning with toupper
Cast to (unsigned char).

(cherry picked from commit d3f790340e8590ad5da1472c99d25acbc9818496)
2022-08-19 12:31:04 +10:00
Michal Nowak 8fd0b14324 Merge branch 'mnowak/freebsd-13.1-v9_18' into 'v9_18'
[v9_18] Add FreeBSD 13.1

See merge request isc-projects/bind9!6683
2022-08-18 15:57:42 +00:00
Michal Nowak 9c9f773386 Add FreeBSD 13.1
(cherry picked from commit bc425be55e1736d4f2ffada5e8d76f96b08c8351)
2022-08-18 17:30:50 +02:00
Artem Boldariev 94b129ddb7 Merge branch 'artem-dig-http-plain-get-post-support-fix-v9-18' into 'v9_18'
[Backport to 9.18] DIG: fix handling of +http-plain-get and +http-plain-post options

See merge request isc-projects/bind9!6682
2022-08-18 11:47:36 +00:00
Artem Boldariev 31435f7bc5 Modify CHANGES (+http-plain-{get, post} support fix in dig)
This commit modifies the CHANGES file to mention that +http-plain-get
and +http-plain-post options support in dig was fixed.

(cherry picked from commit 0ab40c223b524b2d65a2b67a2eb76f4d63fbfb3e)
2022-08-18 14:25:46 +03:00
Artem Boldariev c8e551299c Modify the doth system test to verify HTTP method usage
Before the commit some checks in the system test would try to verify
that different HTTP methods can be used and are functional. However,
until recently, it was not possible to tell from the output which
method was in fact used, so it turned out that +http-plain-get option
is broken.

This commit add the additional checks to prevent that from happening
in the future.

(cherry picked from commit 625991c810b4086a5fbfc48ecb54974f6b6e3f9a)
2022-08-18 14:25:03 +03:00
Artem Boldariev 3c4d6c4ee0 DIG: mark HTTP GET method in output
This commit makes dig mark the usage of HTTP(S) GET protocol usage in
its output.

(cherry picked from commit f86d8c62b01a7ae88a3543ba85c41834e64d011a)
2022-08-18 14:24:43 +03:00
Artem Boldariev bd033f92fd DIG: fix handling of +http-plain-{get, post} options
Support for parsing +http-plain-get and +http-plain-post options was
broken. This commit fixes that.

(cherry picked from commit fb135867644684a21d79bc3a5cebe3c83217a221)
2022-08-18 14:24:27 +03:00
Michal Nowak b76c2ad366 Merge tag 'v9_18_6' into v9_18
BIND 9.18.6
2022-08-18 11:43:29 +02:00
Mark Andrews f412537065 Merge branch '3494-dnssec-awk-test-is-not-precise-enough-v9_18' into 'v9_18'
Improve awk tests to prevent false negatives [v9_18]

See merge request isc-projects/bind9!6676
2022-08-18 04:40:10 +00:00
Mark Andrews d19916bde4 Improve awk tests to prevent false negatives
The old code could incorrectly match "INSOA" in the RRSIG rdata
when looking for the SOA record.

(cherry picked from commit 2fc5f6fb2831697c79f75c50a769449ac561aad0)
2022-08-18 13:43:33 +10:00
Michal Nowak 5b04e29554 Merge branch 'mnowak/coverity-scan-2022.06-v9_18' into 'v9_18'
[v9_18] Use Coverity Scan 2022.06

See merge request isc-projects/bind9!6673
2022-08-17 14:00:38 +00:00
Michal Nowak 0955942b1f Use Coverity Scan 2022.06
(cherry picked from commit 3d683c704e271f1c8107a5b108c93db4bde7db7f)
2022-08-17 15:59:21 +02:00
Arаm Sаrgsyаn a177b9494c Merge branch '3492-fix-tkey.c-buildquery-cleanup-v9_18' into 'v9_18'
[v9_18] Fix tkey.c:buildquery() function's error handling

See merge request isc-projects/bind9!6664
2022-08-17 09:10:38 +00:00
Aram Sargsyan c9ac6623cc Add CHANGES note for [GL #3492]
(cherry picked from commit 8dd12db505892640d885e81dc6701607da1df67f)
2022-08-17 08:36:08 +00:00
Aram Sargsyan b46e53a2e3 Fix tkey.c:buildquery() function's error handling
Add the missing cleanup code.

(cherry picked from commit 4237ab9550eeaea7121e3e3392fd14c26b5150f0)
2022-08-17 08:36:07 +00:00
Michal Nowak b4ab890c71 Merge branch 'mnowak/openbsd-7.1-v9_18' into 'v9_18'
[v9_18] Add OpenBSD 7.1

See merge request isc-projects/bind9!6665
2022-08-16 15:17:14 +00:00
Michal Nowak fdf85d8877 Add OpenBSD 7.1
(cherry picked from commit 7edf8ab47cfd0cc3a633e941b2880ee11d75d6cd)
2022-08-16 17:02:06 +02:00
Petr Špaček 000fb86614 Merge branch 'sgoldlust-edit-statements' into 'v9_18'
Edit tag/statement for glue-cache and reserved-sockets

See merge request isc-projects/bind9!6638
2022-08-15 07:22:05 +00:00
Suzanne GoldlustandPetr Špaček cb6bf93298 Edit tag/statement for glue-cache and reserved-sockets 2022-08-15 09:17:36 +02:00
Evan Hunt 96a66e1c61 Merge branch '3488-prevent-adb-dump-race-v9_18' into 'v9_18'
Lock the address entry bucket when dumping ADB namehook

See merge request isc-projects/bind9!6657
2022-08-13 00:10:14 +00:00
Evan Hunt f841f545b7 Lock the address entry bucket when dumping ADB namehook
When dumping an ADB address entry associated with a name,
the name bucket lock was held, but the entry bucket lock was
not; this could cause data races when other threads were updating
address entry info. (These races are probably not operationally
harmful, but they triggered TSAN error reports.)
2022-08-12 15:55:41 -07:00
Michal Nowak 1f12e1de3a Merge branch '3348-move-pkcs11-interface-test-to-debian-v9_18' into 'v9_18'
[v9_18] Move OpenSSL-based PKCS#11 interface job to Debian "bullseye"

See merge request isc-projects/bind9!6653
2022-08-11 19:18:56 +00:00
Michal Nowak f2c0c65dca Move OpenSSL-based PKCS#11 interface job to Debian "bullseye"
Fedora 36 uses OpenSSL 3.0.2 by default, but the OpenSSL engine API
which we use for PKCS#11 is deprecated in OpenSSL 3.0.0. For the
keyfromlabel system test to work operating system with OpenSSL 1.1 needs
to be used.

(cherry picked from commit 2eecebdea91868be571e3c7a5fb3324505fbd2ff)
2022-08-11 20:31:40 +02:00
Michal Nowak b1213d6a4d Merge branch '3458-reintroduce-without-cmocka-and-without-gssapi-v9_18' into 'v9_18'
[v9_18] Configure Ubuntu 18.04 "bionic" without cmocka and GSS-API

See merge request isc-projects/bind9!6651
2022-08-11 16:23:14 +00:00
Michal Nowak 2f1a3738f5 Configure Ubuntu 18.04 "bionic" without cmocka and GSS-API
--without-cmocka and --without-gssapi ./configure options have been lost
when Debian 9 "stretch" was dropped from the CI. This reintroduces them,
albeit to a slightly different platform.

(cherry picked from commit a2c8703967e7b6ba2a0d02ab414172588a3cb17a)
2022-08-11 17:57:46 +02:00
Michal Nowak 07b43da612 Merge branch 'mnowak/add-oracle-linux-9-v9_18' into 'v9_18'
[v9_18] Add Oracle Linux 9

See merge request isc-projects/bind9!6644
2022-08-10 12:27:20 +00:00
Mark AndrewsandMichal Nowak d48f9f84e3 Fix mkeys to work with DEFAULT_ALGORITHM properly
Stop using a RSASHA1 fixed key in ns3's named.conf as the
trusted key and instead compute a broken digest from the
real digest to use in trusted-keys.

(cherry picked from commit be4cbe2b80)
2022-08-10 14:06:57 +02:00
Mark Andrews 7e1b02fc4e kasp: stop using RSASHA1 unless necessary for the test
Moves tests from being RSASHA1 based to RSASHA256 based where possible
and split out the remaining RSASHA1 based tests so that they are not
run on OS's that don't support RSASHA1.

(cherry picked from commit db028684e5)
2022-08-10 17:26:29 +10:00
Mark Andrews 62ddc10933 keymgr2kasp: use FIPS compliant algorithms and key sizes
migrate-nomatch-alglen: switched to RSASHA256 instead of RSASHA1
and the key size now changes from 2048 bits to 3072 bits instead
of 1024 bits to 2048 bits.

migrate-nomatch-algnum: switched to RSASHA256 instead of RSASHA1
as initial algorithm and adjusted mininum key size to 2048 bits.

rsasha256: adjusted minimum key size to 2048 bits.

(cherry picked from commit 048b015166)
2022-08-10 17:26:29 +10:00
Mark Andrews 945f901722 dnssec/signer/general: Replace RSASHA1 keys with RSASHA512 keys
RSASHA1 is verify only in FIPS mode. Use RSASHA256 instead.

(cherry picked from commit 9c6de6d12d)
2022-08-10 17:26:29 +10:00
Mark Andrews b81e93673f Check if RSASHA1 is supported by the OS
(cherry picked from commit 1690cb7bb4)
2022-08-10 17:26:29 +10:00
Mark Andrews c652c94024 autosign: use FIPS compatible algorithms and key sizes
The nsec-only.example zone was not converted as we use it to
test nsec-only DNSSEC algorithms to nsec3 conversion failure.
The subtest is skipped in fips mode.

Update "checking revoked key with duplicate key ID" test
to use FIPS compatible algorithm.

(cherry picked from commit 99ad09975e)
2022-08-10 17:26:29 +10:00
Mark Andrews 5b3c17f330 rsabigexponent: convert the test from RSASHA1 to RSASHA256
RSASHA1 is not supported on some platforms.

(cherry picked from commit 8c3c011860)
2022-08-10 17:26:29 +10:00
Michal NowakandMark Andrews 20b7c1d49f Add Oracle Linux 9
(cherry picked from commit be08cf41d9)
2022-08-10 17:26:29 +10:00
Mark Andrews ff17c10d7d notify: remove duplicate test number
(cherry picked from commit d396aa227e)
2022-08-10 17:26:29 +10:00
Mark Andrews 69a8132d7d mkeys: use $() instead of back quotes
(cherry picked from commit 0e45a2b02c)
2022-08-10 17:26:29 +10:00
Mark Andrews aff8219f3e Upgrade uses of hmac-sha1 to DEFAULT_HMAC
where the test is not hmac-sha1 specific

(cherry picked from commit c533e8bc5b)
2022-08-10 17:26:29 +10:00
Mark Andrews 2c2fc8fdbd Add CHANGES not for [GL #3440]
(cherry picked from commit be88c583bd)
2022-08-10 17:26:27 +10:00
Mark Andrews c6adebb22c zonechecks: use $DEFAULT_ALGORITHM
(cherry picked from commit 459e6980e5)
2022-08-10 17:25:26 +10:00
Mark Andrews 2e3554fe68 wildcard: use $DEFAULT_ALGORITHM
(cherry picked from commit 3f65c9cf85)
2022-08-10 17:25:26 +10:00
Mark Andrews 23e087131a views: use $DEFAULT_ALGORITHM
(cherry picked from commit 86b29606c3)
2022-08-10 17:25:26 +10:00
Mark Andrews 0b05da9f29 verify: use $DEFAULT_ALGORITHM
(cherry picked from commit 93f7c7cdcd)
2022-08-10 17:25:26 +10:00
Mark Andrews d3a502f19e upforwd: use $DEFAULT_ALGORITHM
(cherry picked from commit 5585909904)
2022-08-10 17:25:26 +10:00
Mark Andrews 620a16bcff unknown: use $DEFAULT_ALGORITHM
(cherry picked from commit 9970d4317d)
2022-08-10 17:25:26 +10:00
Mark Andrews 6d544309a0 synthfromdnssec: use $DEFAULT_ALGORITHM
(cherry picked from commit 73fd49f8bb)
2022-08-10 17:25:26 +10:00
Mark Andrews 2144febc9d staticstub: use $DEFAULT_ALGORITHM
(cherry picked from commit 32337b9dbf)
2022-08-10 17:25:26 +10:00
Mark Andrews b380473ca2 smartsign: use $DEFAULT_ALGORITHM
(cherry picked from commit 941b95edb0)
2022-08-10 17:25:26 +10:00
Mark Andrews bb981e0d68 rpz: use $DEFAULT_ALGORITHM
(cherry picked from commit 1861c3e503)
2022-08-10 17:25:26 +10:00
Mark Andrews b57457e754 rootkeysentinel: use $DEFAULT_ALGORITHM
(cherry picked from commit b0e1d9b1b3)
2022-08-10 17:25:26 +10:00
Mark Andrews e756c4c0f3 resolver: use $DEFAULT_ALGORITHM
(cherry picked from commit 05ef8c81dd)
2022-08-10 17:25:26 +10:00
Mark Andrews 62d50d3b23 redirect: use $DEFAULT_ALGORITHM
(cherry picked from commit e0e03602ba)
2022-08-10 17:25:26 +10:00
Mark Andrews c1f7fd282a pending: use $DEFAULT_ALGORITHM
(cherry picked from commit 6fd50b9fda)
2022-08-10 17:25:26 +10:00
Mark Andrews c5d5e20c8f nsupdate: use $DEFAULT_ALGORITHM
(cherry picked from commit c2d18567fc)
2022-08-10 17:25:26 +10:00
Mark Andrews 64d2dc174b mkeys: use $DEFAULT_ALGORITHM
(cherry picked from commit 78fa082999)
2022-08-10 17:25:26 +10:00
Mark Andrews 647e4c0d9b mirror: use $DEFAULT_ALGORITHM
(cherry picked from commit ff95bafa39)
2022-08-10 17:25:26 +10:00
Mark Andrews 7c100effd2 metadata: use $DEFAULT_ALGORITHM
(cherry picked from commit 3f1dc83bfb)
2022-08-10 17:25:26 +10:00
Mark Andrews db5eb04f4a inline: use $DEFAULT_ALGORITHM
(cherry picked from commit e3acddefd1)
2022-08-10 17:25:26 +10:00
Mark Andrews 73f2c501a5 dsdigest: use $DEFAULT_ALGORITHM
(cherry picked from commit 49de14cb9e)
2022-08-10 17:25:26 +10:00
Mark Andrews 5aad0a38e8 dnssec: use $DEFAULT_ALGORITHM
(cherry picked from commit d0b0139c90)
2022-08-10 17:25:26 +10:00
Mark Andrews 642d5963d9 dns64: use $DEFAULT_ALGORITHM
(cherry picked from commit 5cbf1e1598)
2022-08-10 17:25:26 +10:00
Mark Andrews f3658af717 chain: use $DEFAULT_ALGORITHM
(cherry picked from commit 3419178bd2)
2022-08-10 17:25:26 +10:00
Mark Andrews 2cbfb22d2f cds: use $DEFAULT_ALGORITHM
(cherry picked from commit 6cf0b73ede)
2022-08-10 17:25:26 +10:00
Mark Andrews f970186979 autosign: use $DEFAULT_ALGORITHM
(cherry picked from commit bb810b0ac9)
2022-08-10 17:25:26 +10:00
Mark Andrews c06815dede Use DEFAULT_HMAC for rndc
(cherry picked from commit ce324ae8ba)
2022-08-10 17:25:26 +10:00
Evan Hunt 55d0fd0a11 Merge branch '3483-memstat-assertion-v9_18' into 'v9_18'
fix overflow error in mem_putstats()

See merge request isc-projects/bind9!6645
2022-08-09 18:42:48 +00:00
Evan Hunt 1843780151 fix overflow error in mem_putstats()
an integer overflow could cause an assertion failure when
freeing memory.

(cherry picked from commit 0401e0867b)
2022-08-09 11:21:35 -07:00
Matthijs Mekking 5d200cb2bd Merge branch '2982-servfail-servestale-duplicate-queries-v9_18' into 'v9_18'
[v9_18] Don't enable serve-stale on duplicate queries

See merge request isc-projects/bind9!6642
2022-08-09 09:02:41 +00:00
Matthijs Mekking 350cc2df28 Add release note and change entry for #2982
News worthy.

(cherry picked from commit 2bd4486766)
2022-08-09 09:36:17 +02:00
Matthijs Mekking 5e908a988f Don't enable serve-stale on duplicate queries
When checking if we should enable serve-stale, add an early out case
when the result is an error signalling a duplicate query or a query
that would be dropped.

(cherry picked from commit 059a4c2f4d)
2022-08-09 09:36:11 +02:00
Arаm Sаrgsyаn 18bdce8477 Merge branch '3478-dig-lookup-reference-counting-bug-v9_18' into 'v9_18'
[v9_18] DiG: fix lookup reference counting bug

See merge request isc-projects/bind9!6640
2022-08-08 11:43:13 +00:00
Aram Sargsyan b83ff9cb20 Add CHANGES note for [GL #3478]
(cherry picked from commit 8eea655053)
2022-08-08 10:48:46 +00:00
Aram Sargsyan b23d88947a DiG: fix lookup reference counting bug
When DiG finishes its work with a lookup (due to success or error), it
calls the clear_current_lookup() function, which decreases the lookup's
reference count. That decrease action is the counterpart of the initial
creation of the reference counter, so this function was designed in such
a way that it should decrease the reference count only once, when there
are no more active queries in the lookup.

The way it checks whether there are any active queries is by looking
at the queries list of the lookup object - if it's NULL then there are
no active queries. But that is not always true - the cancel_lookup()
function, when canceling the queries one by one, also removes them
from the lookup's list, but in NSSEARCH mode, when the queries are
working in parallel, some of those queries can be still active. And
when their recv_done() callback gets called, it sees that the lookup
has been canceled, calls clear_current_lookup(), which decreases the
reference count every time for each query that was still active
(because ISC_LIST_HEAD(lookup->q) is NULL) and results in a reference
counting error.

Fix the issue by introducing a new "cleared" property for the lookup,
which will ensure that the clear_current_lookup() function does its
job only once per lookup.

(cherry picked from commit 08ba2732e0)
2022-08-08 10:48:38 +00:00
Matthijs Mekking e8758c0d81 Merge branch '3479-mysql-is-not-ldap-v9_18' into 'v9_18'
[v9_18] Fix mysql bindings

See merge request isc-projects/bind9!6639
2022-08-08 08:47:57 +00:00
Matthijs Mekking 4078990717 Fix mysql bindings
There was a copy paste error in the Makefile of the mysql dlz modules,
instead of setting the MYSQL_LIBS, LDAP_LIBS where set. This caused
the mysql bindings not to be generated.

(cherry picked from commit 38c740053b)
2022-08-08 09:45:49 +02:00
Michał Kępień 5cb75e3c7a Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.7' into 'v9_18'
Set up version and release notes for BIND 9.18.7

See merge request isc-projects/bind9!6633
2022-08-05 06:40:36 +00:00
Michał Kępień 3cd90c9a39 Set up release notes for BIND 9.18.7 2022-08-05 06:57:18 +02:00
Michał Kępień f63ffe40bb Update BIND version to 9.18.7-dev 2022-08-05 06:57:18 +02:00
Michał Kępień 8dbd488a50 Update BIND version for release 2022-08-04 23:46:28 +02:00
Michał Kępień 63c748406a Add a CHANGES marker 2022-08-04 23:46:28 +02:00
Michał Kępień 8bf5b66670 Merge branch 'michal/prepare-documentation-for-bind-9.18.6' into 'v9_18_6-release'
Prepare documentation for BIND 9.18.6

See merge request isc-private/bind9!419
2022-08-04 21:44:58 +00:00
Michał Kępień 8aaf84dad7 Tweak and reword release notes 2022-08-04 23:37:41 +02:00
Michał Kępień dc0d7027cf Prepare release notes for BIND 9.18.6 2022-08-04 23:37:41 +02:00
Artem Boldariev 4552658d1b Merge branch 'tls-fix-readpaused-usage-v9-18' into 'v9_18'
[Backport v9.18] TLS: do not ignore readpaused flag in certain circumstances

See merge request isc-projects/bind9!6629
2022-08-02 16:17:21 +00:00
Artem Boldariev c2fa72027c TLS: do not ignore readpaused flag in certain circumstances
In some circumstances generic TLS code could have resumed data reading
unexpectedly on the TCP layer code. Due to this, the behaviour of
isc_nm_pauseread() and isc_nm_resumeread() might have been
unexpected. This commit fixes that.

The bug does not seems to have real consequences in the existing code
due to the way the code is used. However, the bug could have lead to
unexpected behaviour and, at any rate, makes the TLS code behave
differently from the TCP code, with which it attempts to be as
compatible as possible.

(cherry picked from commit ec0647d546)
2022-08-02 17:31:15 +03:00
Arаm Sаrgsyаn 097a57e804 Merge branch '3461-fetches-per-zone-final-log-message-v9_18' into 'v9_18'
[v9_18] Resolve "Do a better job of logging when fetches-per-zone is triggered"

See merge request isc-projects/bind9!6625
2022-08-01 14:34:27 +00:00
Aram Sargsyan 0179459d83 Add CHANGES and release notes for [GL #3461]
(cherry picked from commit 0d64f55f5d)
2022-08-01 13:55:03 +00:00
Aram Sargsyan 47e4ef0696 Improve fetch limit logging
When initially hitting the `fetches-per-zone` value, a log message
is being generated for the event of dropping the first fetch, then
any further log events occur only when another fetch is being dropped
and 60 seconds have been passed since the last logged message.

That logic isn't ideal because when the counter of the outstanding
fetches reaches zero, the structure holding the counters' values will
get deleted, and the information about the dropped fetches accumulated
during the last minute will not be logged.

Improve the fcount_logspill() function to makie sure that the final
values are getting logged before the counter object gets destroyed.

(cherry picked from commit 039871ceb7)
2022-08-01 13:54:46 +00:00
Petr Špaček 8801d2668e Merge branch 'ron-tags-3-v9_18' into 'v9_18'
Add tags and short descriptions to all configuration statements [v9_18]

See merge request isc-projects/bind9!6624
2022-08-01 09:00:46 +00:00
Petr Špaček a2c59b949f Add tags and short description to statements not documented in v9_19 2022-08-01 10:53:25 +02:00
Petr Špaček 67e8e8ff20 Add last missing tags, finishing touches
(cherry picked from commit 43c6a6a48b)
2022-08-01 10:12:13 +02:00
Suzanne GoldlustandPetr Špaček c0177bfe4a Add descriptions of each tag
(cherry picked from commit 8d76584090)
2022-08-01 10:12:13 +02:00
Suzanne GoldlustandPetr Špaček b2159d42b2 Text edits to Statements and Statements by Tag sections
(cherry picked from commit d4b93c4bd6)
2022-08-01 10:12:13 +02:00
Suzanne GoldlustandPetr Špaček 17d5e43e71 Reorder Statements and Statements by Tag sections
(cherry picked from commit 2cd32eb06d)
2022-08-01 10:12:13 +02:00
Suzanne GoldlustandPetr Špaček ac7d65557b Rephrase parental-agents description
(cherry picked from commit 21c9166abb)
2022-08-01 10:12:12 +02:00
Suzanne GoldlustandPetr Špaček 7e13992ee7 Add short description for plugin statement
(cherry picked from commit d14828c5a7)
2022-08-01 10:12:12 +02:00
Suzanne GoldlustandPetr Špaček 16773a53ed Add tag and short description for dyndb statement
(cherry picked from commit 5b90f4caa4)
2022-08-01 10:12:12 +02:00
Suzanne GoldlustandPetr Špaček 8b0b402ec8 Add tags and short descriptions for dlz and search statements
(cherry picked from commit 93bb1a42f9)
2022-08-01 10:12:12 +02:00
Suzanne GoldlustandPetr Špaček c1c0197c9a Add tag and short description for catalog-zones statement
(cherry picked from commit e4f991c1d4)
2022-08-01 10:12:12 +02:00
Suzanne GoldlustandPetr Špaček 3c45f366a6 Add short descriptions and some tags to statements through line 1766
(cherry picked from commit 21b8988f80)
2022-08-01 10:12:07 +02:00
Arаm Sаrgsyаn d82f56b972 Merge branch '3471-dig-add-qid-into-usage-summary-v9_18' into 'v9_18'
[v9_18] DiG: document +qid=<num> option in the usage summary

See merge request isc-projects/bind9!6621
2022-07-28 10:16:39 +00:00
Aram Sargsyan 80094e4503 DiG: document +qid=<num> option in the usage summary
The +qid=<num> option, which sets the outgoing query ID, was missing
from the usage summary printed using `dig -h` command.

(cherry picked from commit 4dcc855093)
2022-07-28 09:14:56 +00:00
Mark Andrews 78a14a5f07 Merge branch 'marka-set-suffix-in-ans.py-v9_18' into 'v9_18'
Ensure suffix is always valid in bin/tests/system/qmin/ans4/ans.py [v9_18]

See merge request isc-projects/bind9!6619
2022-07-27 19:07:11 +00:00
Mark Andrews 8fa29c5699 Ensure suffix is always valid in bin/tests/system/qmin/ans4/ans.py
initalise suffix to ""

    170        r.answer.append(
    171            dns.rrset.from_text(
    172                lqname + suffix, 1, IN, NS, "a.bit.longer.ns.name." + suffix
    173            )
    174        )
    175        r.flags |= dns.flags.AA
           15. Condition endswith(lqname, "icky.ptang.zoop.boing."), taking true branch.
    176    elif endswith(lqname, "icky.ptang.zoop.boing."):
           CID 350722 (#7 of 7): Bad use of null-like value (FORWARD_NULL)
           16. invalid_operation: Invalid operation on null-like value suffix.
    177        r.authority.append(
    178            dns.rrset.from_text(
    179                "icky.ptang.zoop.boing." + suffix,
    180                1,
    181                IN,
    182                SOA,
    183                "ns2." + suffix + " hostmaster.arpa. 2018050100 1 1 1 1",
    184            )
    185        )

(cherry picked from commit eb798d0478)
2022-07-27 14:27:18 -04:00
Artem Boldariev a524cef8af Merge branch 'artem-tls-streamdns-fixes-part2-v9-18' into 'v9_18'
[Backport to v9.18] TLS-related fixes from Stream DNS and Loop Manager branches

See merge request isc-projects/bind9!6617
2022-07-26 13:03:42 +00:00
Artem Boldariev a957511734 TLS: fix double resumption in isc__nm_tls_resumeread()
This commit fixes an obvious error in isc__nm_tls_resumeread() so that
read cannot be resumed twice.
2022-07-26 15:27:40 +03:00
Artem Boldariev a165b66fc7 TLS: clear 'errno' when handling SSL status
Sometimes tls_do_bio() might be called when there is no new data to
process (most notably, when resuming reads), in such a case internal
TLS session state will remain untouched and old value in 'errno' will
alter the result of SSL_get_error() call, possibly making it to return
SSL_ERROR_SYSCALL. This value will be treated as an error, and will
lead to closing the connection, which is not what expected.
2022-07-26 15:27:40 +03:00
Mark Andrews 80f777ccfe Merge branch '3469-auto-disable-rsasha1-and-nsec3rsasha1-when-not-supported-by-the-os-v9_18' into 'v9_18'
Check that we can verify a signature at initialisation time [v9_18]

See merge request isc-projects/bind9!6614
2022-07-25 15:51:23 +00:00
Mark Andrews 676a6456e8 Add release note for [GL #3469]
(cherry picked from commit 16b133af40)
2022-07-25 10:59:38 -04:00
Mark Andrews d0b48df8ea CHANGES note for [GL #3469]
(cherry picked from commit c549249cb9)
2022-07-25 10:59:38 -04:00
Mark Andrews f3a0dac057 Check that we can verify a signature at initialisation time
Fedora 33 doesn't support RSASHA1 in future mode.  There is no easy
check for this other than by attempting to perform a verification
using known good signatures.  We don't attempt to sign with RSASHA1
as that would not work in FIPS mode.  RSASHA1 is verify only.

The test vectors were generated using OpenSSL 3.0 and
util/gen-rsa-sha-vectors.c.  Rerunning will generate a new set of
test vectors as the private key is not preserved.

e.g.
	cc util/gen-rsa-sha-vectors.c -I /opt/local/include \
		-L /opt/local/lib -lcrypto

(cherry picked from commit cd3f00874f)
2022-07-25 10:59:38 -04:00
Matthijs Mekking c3ab2a25ef Merge branch '3462-rndc-dumpdb-expired-doesnt-always-work-v9_18' into 'v9_18'
[v9_18] Fix rndc dumpdb -expired for stuck cache contents

See merge request isc-projects/bind9!6612
2022-07-25 14:54:30 +00:00
Matthijs Mekking acdde6f0a4 Add change entry and release note for #3462
News worthy.

(cherry picked from commit 44bbc0175c)
2022-07-25 16:29:41 +02:00
Matthijs Mekking 56f1bf250d Fix rndc dumpdb -expired for stuck cache contents
The command 'rndc dumpdb -expired' will include expired RRsets in the
output, but only for the RBTDB_VIRTUAL time (of 5 minutes). This means
that if there is a cache cleaning problem and contents are not cleaned
up, the rndc command has little diagnostic value. Fix this by including
all RRsets in the dumpdb output if the '-expired' flag is set.

(cherry picked from commit 930ba2c914)
2022-07-25 16:28:18 +02:00
Evan Hunt 78ea0a36a4 Merge branch '2918-deprecate-max-zone-ttl-v9_18' into 'v9_18'
dnssec-policy max-zone-ttl was not fully effective

See merge request isc-projects/bind9!6599
2022-07-22 20:34:16 +00:00
Evan Hunt 3c533374da CHANGES and release note for [GL #2918] 2022-07-22 13:13:43 -07:00
Evan Hunt 4720f13730 warn about zones with both dnssec-policy and max-zone-ttl
max-zone-ttl in zone/view/options is a no-op if dnssec-policy
is in use, so generate a warning.
2022-07-22 13:13:24 -07:00
Evan Hunt a8e596e32c clarify "max-zone-ttl" documentation
The "max-zone-ttl" option should now be configured as part of
dnssec-policy. Use of this option in zone/view/options will be ignored
in any zone that also has dnssec-policy configured.
2022-07-22 13:13:24 -07:00
Matthijs MekkingandEvan Hunt 793554c6ce Reject zones with TTL higher than dnssec-policy max-zone-ttl
Reject loading of zones with TTL higher than the max-zone-ttl
from the dnssec-policy.

With this change, any zone with a dnssec-policy in use will ignore
the max-zone-ttl option in zone/view/options.
2022-07-22 13:13:24 -07:00
Matthijs MekkingandEvan Hunt 9c872756c3 Test dnssec-policy max-zone-ttl rejects zone with too high TTL
Similar to the 'max-zone-ttl' zone option, the 'dnssec-policy' option
should reject zones with TTLs that are out of range.
2022-07-22 13:13:24 -07:00
Arаm Sаrgsyаn d8acad751e Merge branch '3419-dig-nssearch-query-failure-robustness-v9_18' into 'v9_18'
[v9_18] Fix DiG query error handling robustness in NSSEARCH mode

See merge request isc-projects/bind9!6609
2022-07-22 10:24:48 +00:00
Aram Sargsyan 525c0e9d38 Add CHANGES note for [GL #3419]
(cherry picked from commit e038970872)
2022-07-22 09:41:53 +00:00
Aram Sargsyan ab8343a5f6 dig +nssearch: send more queries even if setting up one of them fails
In the NSSEARCH followup lookup, when one of the queries fails to be
set up (UDP) or connected (TCP), DiG doesn't start the next query.
This is a mistake, because in NSSEARCH mode the queries are independent
and DiG shouldn't stop the lookup process just because setting up (or
connecting to) one of the name servers returns an error code in the
`udp_ready()` or `tcp_connected()` callbacks.

Write a new `nssearch_next()` function which takes care of starting the
next query in NSSEARCH mode, so it can be used in several places without
code repetition.

Make sure that the `udp_ready()` and `tcp_connected()` functions call
`nssearch_next()` in case they won't be calling `send_udp()` and
`send_tcp()` respectively, because in that case the `send_done()`
callback, which usually does the job, won't be called.

Refactor `send_done()` to use the newly written `nssearch_next()`
function.

(cherry picked from commit 76bee507b7)
2022-07-22 09:41:47 +00:00
Aram Sargsyan 8fecc9dc1e dig +nssearch: send more queries even if sending the previous one fails
In the NSSEARCH followup lookup, when one of the queries fails to be
sent, DiG doesn't start the next query. This is a mistake, because in
NSSEARCH mode the queries are independent and DiG shouldn't stop the
lookup process just because sending a query to one of the name servers
returns an error code.

Restructure the `send_done()` function to unconditionally send the next
query in NSSEARCH mode, if it exists.

(cherry picked from commit 49ac879dfa)
2022-07-22 09:41:41 +00:00
Arаm Sаrgsyаn 5d47d4e342 Merge branch '3407-dighost-udp-fail-over-other-nameservers-v9_18' into 'v9_18'
[v9_18] Fix DiG UDP query retry and fail-over bug

See merge request isc-projects/bind9!6608
2022-07-22 09:37:53 +00:00
Aram Sargsyan c0bb75e9ef Suppress warning/error comments in dig outputs for "rrsetorder" test
In the CI dig sometimes produces warning/error comments when
communicating with the server, which produces problems when comparing
the outputs.

Here is an example of a dig output with a warning message which
is benign, because dig, after a retry, managed to query the server.

;; communications error to 10.53.0.3#7529: timed out
1.2.3.1
1.2.3.2
1.2.3.3
1.2.3.4

When comparing this to the expected output, which doesn't contain
the comment line (starting with double ';'), the outputs don't match.

Use grep inverse logic to strip the comments from the dig outputs.

(cherry picked from commit a5b2aa7c97)
2022-07-22 09:03:54 +00:00
Aram Sargsyan 8bdc4e40de Add CHANGES note for [GL #3407]
(cherry picked from commit 1554faa476)
2022-07-22 09:03:39 +00:00
Aram Sargsyan 048a035267 Add "digdelv" test to simulate DiG network unreachable error
There are existing tests for simulating timeouts, read errors, and
refused connecion errors. Implement also "network unreachable"
simulation.

Use "fixed" string search mode `-F` for `grep` in more places where
it is appropriate to do so.

(cherry picked from commit 626fbf325e)
2022-07-22 09:00:31 +00:00
Aram Sargsyan 29057d9911 DiG: use the same retry and fail-over logic for different failure types
DiG implements different logic in the `recv_done()` callback function
when processing a failure:

1. For a timed-out query it applies the "retries" logic first, then,
   when it fails, fail-overs to the next server.

2. For an EOF (end-of-file, or unexpected disconnect) error it tries to
   make a single retry attempt (even if the user has requested more
   retries), then, when it fails, fail-overs to the next server.

3. For other types of failures, DiG does not apply the "retries" logic,
   and tries to fail-over to the next servers (again, even if the user
   has requested to make retries).

Simplify the logic and apply the same logic (1) of first retries, and
then fail-over, for different types of failures in `recv_done()`.

(cherry picked from commit abfd0d363f)
2022-07-22 09:00:21 +00:00
Aram Sargsyan 6efb73d4bb Fix DiG query retry and fail-over bug
When the `send_done()` callback function gets called with a failure
result code, DiG erroneously cancels the lookup.

Stop canceling the lookup and give DiG a chance to retry the failed
query, or fail-over to another server, using the logic implemented in
the `recv_done()` callback function.

(cherry picked from commit c2329dd110)
2022-07-22 09:00:15 +00:00
Aram Sargsyan be8ec6ef18 Fix DiG UDP query retry and fail-over bug
When the `udp_ready()` callback function gets called with a failure
result code, DiG erroneously cancels the lookup.

Copy the logic behind `tcp_connected()` callback function into
`udp_ready()` so that DiG will now retry the failed query (if retries
are enabled) and then, if it fails again, it will fail-over to the next
server in the list, which synchronizes the behavior between TCP and UDP
modes.

Also, `udp_ready()` was calling `lookup_detach()` without calling
`lookup_attach()` first, but the issue was masked behind the fact
that `clear_current_lookup()` wasn't being called when needed, and
`lookup_detach()` was compensating for that. This also has been fixed.

(cherry picked from commit 3f31085525)
2022-07-22 09:00:08 +00:00
Petr Špaček c003127717 Merge branch 'pspacek/arm-zombie-support-v9_18' into 'v9_18'
Support ancient build tools for the ARM [v9_18]

See merge request isc-projects/bind9!6605
2022-07-21 13:30:27 +00:00
Petr Špaček c56bcbdb6a Support Sphinx 1.6.7
Luckily we don't rely on SphinxDirective functionality which does not
exist in 1.6.7. Replace it with docutils Directive.

transform_content() callback was added only in Sphinx 3.0.0.
Detect if it was not called and call it manually.
The transform_content() function requires access to inner "contentnode"
which is created inside run(). This workaround relies on the order of
node as it was in the pre-3.0.0 versions, but it should not matter as
new versions will not trigger the workaround.

(cherry picked from commit 8796ad7fe8)
2022-07-21 15:26:26 +02:00
Petr Špaček 5864cac5d4 Support docutils 0.14+dfsg-4
Ancient versions of docutils cannot cope with bare text inside a table
cell. Wrap text in a paragraph to work around that.

(cherry picked from commit af5bbb433a)
2022-07-21 15:26:22 +02:00
Petr Špaček 3818a87e95 Merge branch 'pspacek/minor-arm-tweaks-and-fixes-v9_18' into 'v9_18'
Fix dnssec-signzone examples in DNSSEC Guide [v9_18]

See merge request isc-projects/bind9!6603
2022-07-21 13:19:24 +00:00
Petr Špaček d40615d881 Avoid opt-out flag in dnssec-signzone examples
Since !6413 we discourage opt-out, so we should not be advertising it in
the examples. Even worse, it was just thrown into the command line
without even mentioning its meaning in the surrounding text.

Related: !6413
(cherry picked from commit beae857288)
2022-07-21 15:18:55 +02:00
Petr Špaček a927799e84 Remove errorneous shell output redirection from dnssec-signzone example
The > looked like shell output redirection. It was present since we
imported DNSSEC Guide into the ARM.

(cherry picked from commit 1ab564d605)
2022-07-21 15:18:50 +02:00
Michal Nowak d4b00b1dc1 Merge tag 'v9_18_5' into v9_18
BIND 9.18.5
2022-07-21 12:31:03 +02:00
Michał Kępień 98258e21b5 Merge branch 'michal/run-a-short-respdiff-test-for-all-merge-requests-v9_18' into 'v9_18'
[v9_18] Run a short respdiff test for all merge requests

See merge request isc-projects/bind9!6590
2022-07-18 13:33:49 +00:00
Michał Kępień f3e647a4c1 Run a short respdiff test for all merge requests
Running a respdiff test for every merge request would be useful for
catching protocol-breaking changes before they are applied to the source
code.  However, the existing respdiff-based tests take a while to
complete (about half an hour with our current CI infrastructure), which
does not make them a good fit for this purpose.  Add a new GitLab CI
job, "respdiff-short", which uses a smaller query set that gets
processed within a couple of minutes on our current CI infrastructure.
Rename the existing respdiff-based jobs to make distinguishing them
easier.

(cherry picked from commit 31ee43a314)
2022-07-18 15:25:17 +02:00
Michał Kępień 82b6a388fc Extract respdiff job definition to a YAML anchor
Ensure the common parts of all jobs using respdiff are available in the
form of a reusable YAML anchor, to reduce code duplication and to
simplify adding more respdiff-based jobs to GitLab CI.

(cherry picked from commit ca20a189f7)
2022-07-18 15:25:17 +02:00
Michał Kępień 7d02e1088c Use a pre-built executable as the reference named
The "respdiff" GitLab CI job compares DNS responses produced by the
current version of named with those produced by a reference version.
The latter is built from source in each "respdiff" job, despite the fact
that the reference version changes very rarely.  Use a pre-built named
executable as the reference version instead, assuming it is available in
the OS image used for "respdiff" tests.

(cherry picked from commit ab90a4705a)
2022-07-18 15:25:17 +02:00
Ondřej Surý 116b825b8d Merge branch '3453-cope-with-too-small-BUFSIZ-v9_18' into 'v9_18'
Increase the BUFSIZ-long buffers [v9.18]

See merge request isc-projects/bind9!6586
2022-07-15 20:40:03 +00:00
Ondřej Surý 3c1d6e164e Increase the BUFSIZ-long buffers
The BUFSIZ value varies between platforms, it could be 8K on Linux and
512 bytes on mingw.  Make sure the buffers are always big enough for the
output data to prevent truncation of the output by appropriately
enlarging or sizing the buffers.

(cherry picked from commit b19d932262)
2022-07-15 21:16:51 +02:00
Michał Kępień c447008196 Merge branch '3443-memory-related-cleanups-v9_18' into 'v9_18'
[v9_18] Memory-related cleanups

See merge request isc-projects/bind9!6568
2022-07-15 08:36:18 +00:00
Michał Kępień 93ded5cca2 Update documentation for named's -M option
Remove "external" from the list of legal values for the -M command-line
option as it has not been allowed since the internal memory allocator
was removed by commit 55ace5d3aa.

Make the style of the relevant paragraph more in line with the next one
and split its contents up into an unordered list of options for improved
readability.

(cherry picked from commit f0c31ceb3b)
2022-07-15 10:31:53 +02:00
Evan Hunt ba16ff2da5 Merge branch '3456-dispatch-connect-race-v9_18' into 'v9_18'
remove unnecessary assertion in dns_dispatch_connect()

See merge request isc-projects/bind9!6584
2022-07-15 04:18:05 +00:00
Evan Hunt 7903bffbc4 remove unnecessary assertion in dns_dispatch_connect()
When a thread calls dns_dispatch_connect() on an unconnected TCP socket
it sets `tcpstate` from `DNS_DISPATCHSTATE_NONE` to `_CONNECTING`.
Previously, it then INSISTed that there were no pending connections
before calling isc_nm_tcpdnsconnect().

If a second thread called dns_dispatch_connect() during that window
of time, it could add a pending connection to the list, and trigger
an assertion failure.

This commit removes the INSIST since the condition is actually
harmless.

(cherry picked from commit 25ddec8a0a)
2022-07-14 19:27:24 -07:00
Ondřej Surý 93757acfe5 Merge branch 'ondrej-fix-timing-error-in-statistics-system-test-v9_18' into 'v9_18'
Wait for TCP connection refused in the statistics system test [v9.18]

See merge request isc-projects/bind9!6583
2022-07-14 20:53:10 +00:00
Ondřej Surý c6b4d82557 Wait for TCP connection refused in the statistics system test
The statistics system test makes a query to foo.info to check for the
pending connections because the ans4 doesn't respond to the query.

This might or might not (depending on exact timing) increment the failed
TCP connection counter when the query is retried over TCP because ans4
doesn't listen on the TCP.

Wait for the 'connection refused' in the ns3 log file to be able to
count the exactly 1 failed TCP connection.

(cherry picked from commit 0227d82dc8)
2022-07-14 22:34:08 +02:00
Ondřej Surý 54ec179723 Merge branch '3451-handle-transient-TCP-connect-EADDRINUSE-on-BSDs-v9_18' into 'v9_18'
Handle the transient TCP connect() failures on FreeBSD [v9.18]

See merge request isc-projects/bind9!6582
2022-07-14 20:13:12 +00:00
Ondřej Surý c79ee8daa1 Add CHANGES note for [GL #3451]
(cherry picked from commit a9c54ecdc6)
2022-07-14 21:48:48 +02:00
Ondřej Surý d242ced18f Cleanup the STATID_CONNECT and STATID_CONNECTFAIL stat counters
The STATID_CONNECT and STATID_CONNECTFAIL statistics were used
incorrectly. The STATID_CONNECT was incremented twice (once in
the *_connect_direct() and once in the callback) and STATID_CONNECTFAIL
would not be incremented at all if the failure happened in the callback.

Closes: #3452
(cherry picked from commit 59e1703b50)
2022-07-14 21:48:44 +02:00
Ondřej Surý 259f4481bd Handle the transient TCP connect() failures on FreeBSD
On FreeBSD (and perhaps other *BSD) systems, the TCP connect() call (via
uv_tcp_connect()) can fail with transient UV_EADDRINUSE error.  The UDP
code already handles this by trying three times (is a charm) before
giving up.  Add a code for the TCP, TCPDNS and TLSDNS layers to also try
three times before giving up by calling uv_tcp_connect() from the
callback two more time on UV_EADDRINUSE error.

Additionally, stop the timer only if we succeed or on hard error via
isc__nm_failed_connect_cb().

(cherry picked from commit b21f507c0a)
2022-07-14 21:47:47 +02:00
Mark Andrews 5ba1038a1b Merge branch '3447-lib-dns-tkey-c-free_namelist-should-be-disassociating-associated-rdatatsets-v9_18' into 'v9_18'
disassociate rdatasets when cleaning up [v9_18]

See merge request isc-projects/bind9!6577
2022-07-14 00:58:59 +00:00
Mark Andrews 937794c2da disassociate rdatasets when cleaning up
free_namelist could be passed names with associated rdatasets
when handling errors.  These need to be disassociated before
calling dns_message_puttemprdataset.

(cherry picked from commit 745d5edc3a)
2022-07-14 10:21:38 +10:00
Mark Andrews 4ae0a18a51 Merge branch '3449-kasp-system-test-failed-to-log-some-zones-during-setup-v9_18' into 'v9_18'
kasp: add missing logging during setup [v9_18]

See merge request isc-projects/bind9!6575
2022-07-14 00:13:30 +00:00
Mark Andrews 190784a779 kasp: add missing logging during setup
Some zones where not being logged when just DNSSEC keys where being
generated in system test setup phase.  Add logging for these zones.

(cherry picked from commit 04627997eb)
2022-07-14 09:46:06 +10:00
Ondřej Surý 7af589693f Merge branch 'ondrej-update-dir-locals-for-libtest-v9_18' into 'v9_18'
Update the .dir-locals.el for libtest [v9.18]

See merge request isc-projects/bind9!6566
2022-07-13 10:22:55 +00:00
Ondřej Surý d2bdb6fe3d Update the .dir-locals.el for libtest
The tests/libtest directory is missing from the .dir-locals.el, so the
emacs flycheck would not work for the unit tests.  Add it to the
configuration.

(cherry picked from commit 80fbd849d5)
2022-07-13 12:20:16 +02:00
Michał Kępień 788939a510 Merge branch '3439-stop-resolving-invalid-names-in-resume_dslookup-v9_18' into 'v9_18'
[v9_18] Stop resolving invalid names in resume_dslookup()

See merge request isc-projects/bind9!6564
2022-07-13 09:32:55 +00:00
Michał Kępień 410456d3d8 Add CHANGES entry and release note for GL #3439
(cherry picked from commit cfa398ad37)
2022-07-13 11:00:32 +02:00
Michał Kępień b855c6b6c9 Stop resolving invalid names in resume_dslookup()
Commit 7b2ea97e46 introduced a logic bug
in resume_dslookup(): that function now only conditionally checks
whether DS chasing can still make progress.  Specifically, that check is
only performed when the previous resume_dslookup() call invokes
dns_resolver_createfetch() with the 'nameservers' argument set to
something else than NULL, which may not always be the case.  Failing to
perform that check may trigger assertion failures as a result of
dns_resolver_createfetch() attempting to resolve an invalid name.

Example scenario that leads to such outcome:

 1. A validating resolver is configured to forward all queries to
    another resolver.  The latter returns broken DS responses that
    trigger DS chasing.

 2. rctx_chaseds() calls dns_resolver_createfetch() with the
    'nameservers' argument set to NULL.

 3. The fetch fails, so resume_dslookup() is called.  Due to
    fevent->result being set to e.g. DNS_R_SERVFAIL, the default branch
    is taken in the switch statement.

 4. Since 'nameservers' was set to NULL for the fetch which caused the
    resume_dslookup() callback to be invoked
    (fctx->nsfetch->private->nameservers), resume_dslookup() chops off
    one label off fctx->nsname and calls dns_resolver_createfetch()
    again, for a name containing one label less than before.

 5. Steps 3-4 are repeated (i.e. all attempts to find the name servers
    authoritative for the DS RRset being chased fail) until fctx->nsname
    becomes stripped down the the root name.

 6. Since resume_dslookup() does not check whether DS chasing can still
    make progress, it strips off a label off the root name and continues
    its attempts at finding the name servers authoritative for the DS
    RRset being chased, passing an invalid name to
    dns_resolver_createfetch().

Fix by ensuring resume_dslookup() always checks whether DS chasing can
still make progress when a name server fetch fails.  Update code
comments to ensure the purpose of the relevant dns_name_equal() check is
clear.

(cherry picked from commit 1a79aeab44)
2022-07-13 11:00:32 +02:00
Evan Hunt 2d5ad9cd49 Merge branch '2962-invalid-fctx-v9_18' into 'v9_18'
clear fctx->magic and fetch->magic when destroying

See merge request isc-projects/bind9!6554
2022-07-13 05:43:04 +00:00
Evan HuntandMark Andrews b66cd7b2fc clear fctx->magic and fetch->magic when destroying
fctx_destroy() and dns_resolver_destroyfetch() did not clear the
'magic' field during destruction.

(cherry picked from commit 5ec077e6aa)
2022-07-13 02:12:35 +00:00
Mark Andrews b8d5763494 Merge branch '3446-autosign-s-checking-revoked-key-with-duplicate-key-id-test-was-incomplete-v9_18' into 'v9_18'
Make "checking revoked key with duplicate key ID" work [v9_18]

See merge request isc-projects/bind9!6559
2022-07-13 01:54:03 +00:00
Mark Andrews 484c74f5f4 Make "checking revoked key with duplicate key ID" work
There should be 2 keys with the same key id after the numerically
lower one is revoked (serial space arithmetic).  The DS points
at the non-revoked key so validation should still succeed.

(cherry picked from commit 513cb24b55)
2022-07-13 11:22:52 +10:00
Mark Andrews f62e6d870d Merge branch '3445-update-libdns_la_libadd-instead-of-libdns_la_ldflags-v9_18' into 'v9_18'
Update libdns_la_LIBADD rather than libdns_la_LDFLAGS [v9_18]

See merge request isc-projects/bind9!6557
2022-07-13 01:02:14 +00:00
Mark Andrews 7f101aeb53 Update libdns_la_LIBADD rather than libdns_la_LDFLAGS
the wrong macro was being update with MAXMINDDB_LIBS making
it difficult to adjust link order.

(cherry picked from commit 5b51610174)
2022-07-13 10:46:37 +10:00
Evan Hunt 7994f1368c Merge branch '2683-ixfr-logging-v9_18' into 'v9_18'
log the reason for falling back to AXFR from IXFR at level info

See merge request isc-projects/bind9!6551
2022-07-12 23:52:38 +00:00
Evan Hunt cc3070a0b3 log the reason for falling back to AXFR from IXFR at level info
messages indicating the reason for a fallback to AXFR (i.e, because
the requested serial number is not present in the journal, or because
the size of the IXFR response would exceeed "max-ixfr-ratio") are now
logged at level info instead of debug(4).

(cherry picked from commit df1d81cf96)
2022-07-12 16:26:13 -07:00
Matthijs Mekking 06c6c3d2f3 Merge branch '3438-dnssec-policy-does-not-set-inline-signing-v9_18' into 'v9_18'
[v9_18] Fix inheritance for dnssec-policy when checking for inline-signing

See merge request isc-projects/bind9!6546
2022-07-12 15:23:09 +00:00
Matthijs Mekking 383fe2f4ba Add release note and change entry for #3438
Bug worth mentioning.

(cherry picked from commit 689215a675)
2022-07-12 17:22:39 +02:00
Matthijs Mekking 235b89dbcd Inherit dnssec-policy in check for inline-signing
When dnssec-policy is used, and the zone is not dynamic, BIND will
assume that the zone is inline-signed. But the function responsible
for this did not inherit the dnssec-policy option from the view or
options level, and thus never enabled inline-signing, while the zone
should have been.

This is fixed by this commit.

(cherry picked from commit 576b21b168)
2022-07-12 17:22:39 +02:00
Matthijs Mekking 718d7bdeb9 Test setting of inline-signing with dnssec-policy
When dnssec-policy is used, and the zone is not dynamic, BIND will
assume that the zone is inline-signed. Add test cases to verify this.

(cherry picked from commit efa8a4e88d)
2022-07-12 17:22:39 +02:00
Matthijs Mekking 3f54a0f051 Fix kasp system test bugs
Fix a comment, ensuring the right parameters are used (zone is
parameter $3, not $2) and add view and policy parameters to the comment.

Fix the view tests and test the correct view (example3 instead of
example2).

Fix placement of "n=$((n+1)" for two test cases.

(cherry picked from commit ff65f07779)
2022-07-12 17:22:39 +02:00
Artem Boldariev 3d98312a7b Merge branch 'artem-backport-tls-related-fixes-from-loopmgr-branch-v9-18' into 'v9_18'
[Backport to 9.18] Backport TLS-related fixes from the loopmgr-branch

See merge request isc-projects/bind9!6550
2022-07-12 13:13:39 +00:00
Artem Boldariev 814baa3e6b TLS: do not ignore accept callback result
Before this change the TLS code would ignore the accept callback result,
and would not try to gracefully close the connection. This had not been
noticed, as it is not really required for DoH. Now the code tries to
shut down the TLS connection gracefully when accepting it is not
successful.

(cherry picked from commit ffcb54211e)
2022-07-12 15:32:45 +03:00
Artem Boldariev d6041e5d45 *_noresponse, tlsdns_listen_noalpn: csends == 1 is not guaranteed
This commit removes an assertion from the unit test which cannot be
guaranteed.

According to the test, exactly one client send must succeed. However,
it cannot really be guaranteed, as do not start to read data in the
accept callback on the server nor attach to the accepted handle. Thus,
we can expect the connection to be closed soon after we have returned
from the callback.

Interestingly enough, the test would pass just fine on TCP because:

a) there are fewer layers involved and thus there is less processing;

b) it is possible for the data to be sent and end up in an internal OS
socket buffer without being touched by an application's code on the
server. In such a case the client's write callback still would be
called successfully;

There is a chance for the test to succeed over TLS as well (as it
happily did before), but as the code has been changed to close unused
connections as soon as possible, the chance is far slimmer now.

What can be guaranteed is:

* cconnects == 1 (number client connections equals 1);
* saccepts == 1 (number of accepted connections equals 1).

(cherry picked from commit 0f9b6a7bc1)
2022-07-12 15:31:20 +03:00
Artem Boldariev c85949fbe1 TLSDNS: try pass incoming data to OpenSSL if there are any
Otherwise the code path will lead to a call to SSL_get_error()
returning SSL_ERROR_SSL, which in turn might lead to closing
connection to early in an unexpected way, as it is clearly not what is
intended.

The issue was found when working on loppmgr branch and appears to
be timing related as well. Might be responsible for some unexpected
transmission failures e.g. on zone transfers.

(cherry picked from commit 8585b92f98)
2022-07-12 15:29:36 +03:00
Artem Boldariev ba7fabde01 TLS: bail out earlier when NM is stopping
In some operations - most prominently when establishing connection -
it might be beneficial to bail out earlier when the network manager
is stopping.

The issue is backported from loopmgr branch, where such a change is
not only beneficial, but required.

(cherry picked from commit fc74b15e67)
2022-07-12 15:28:15 +03:00
Artem Boldariev 0754def85d TLS: sometimes TCP conn. handle might be NULL on when connecting
In some cases - in particular, in case of errors, NULL might be passed
to a connection callback instead of a handle that could have led to
an abort. This commit ensures that such a situation will not occur.

The issue was found when working on the loopmgr branch.

(cherry picked from commit ac4fb34f18)
2022-07-12 15:26:50 +03:00
Artem Boldariev c44633feb2 TLS: try to close sockets whenever there are no pending operations
This commit ensures that the underlying TCP socket of a TLS connection
gets closed earlier whenever there are no pending operations on it.

In the loop-manager branch, in some circumstances the connection
could have remained opened for far too long for no reason. This
commit ensures that will not happen.

(cherry picked from commit 88524e26ec)
2022-07-12 15:25:30 +03:00
Artem Boldariev 3e69cc35b8 TLS: Implement isc_nmhandle_setwritetimeout()
This commit adds a proper implementation of
isc_nmhandle_setwritetimeout() for TLS connections. Now it passes the
value to the underlying TCP handle.

(cherry picked from commit 237ce05b89)
2022-07-12 15:22:57 +03:00
Michal Nowak 4884ac3355 Merge branch 'mnowak/alpine-3.16-v9_18' into 'v9_18'
[v9_18] Add Alpine Linux 3.16

See merge request isc-projects/bind9!6548
2022-07-12 11:33:24 +00:00
Michal Nowak 1e386c5489 Add Alpine Linux 3.16
(cherry picked from commit 0d0ab3db10)
2022-07-12 13:11:48 +02:00
Mark Andrews bcc5fc4a10 Merge branch '3389-unexpected-badkey-in-upforwd-system-test-v9_18' into 'v9_18'
Clone the message buffer before forwarding UPDATE messages [v9_18]

See merge request isc-projects/bind9!6544
2022-07-12 10:05:54 +00:00
Mark Andrews 4be9aba39e Add CHANGES note for [GL #3389]
(cherry picked from commit 09d8ed3970)
2022-07-12 19:01:18 +10:00
Mark Andrews 44bfc8a9b2 Clone the message buffer before forwarding UPDATE messages
this prevents named forwarding a buffer that may have been over
written.

(cherry picked from commit 7a42417d61)
2022-07-12 19:00:38 +10:00
Michał Kępień 068741dbe6 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.6' into 'v9_18'
Set up version and release notes for BIND 9.18.6

See merge request isc-projects/bind9!6539
2022-07-11 07:05:55 +00:00
Michał Kępień c7f1ee665b Set up release notes for BIND 9.18.6 2022-07-11 08:51:32 +02:00
Michał Kępień be9c6f44f3 Update BIND version to 9.18.6-dev 2022-07-11 08:51:32 +02:00
Michał Kępień 6593103e39 Update BIND 9 version for release 2022-07-07 16:47:02 +02:00
Michał Kępień 6160acd95f Add a CHANGES marker 2022-07-07 16:47:02 +02:00
Michał Kępień ca10113ebc Merge branch 'michal/prepare-documentation-for-bind-9.18.5' into 'v9_18_5-release'
Prepare documentation for BIND 9.18.5

See merge request isc-private/bind9!413
2022-07-07 14:45:28 +00:00
Michał Kępień a6e2b60441 Add release note for GL #3415 2022-07-07 16:34:14 +02:00
Michał Kępień 26fb108f1a Add release note for GL #3152 2022-07-07 16:34:14 +02:00
Michał Kępień 6fbda28db5 Reorder release notes 2022-07-07 16:34:14 +02:00
Michał Kępień 9eb6e06f57 Tweak and reword release notes 2022-07-07 16:34:14 +02:00
Michał Kępień f213447546 Prepare release notes for BIND 9.18.5 2022-07-07 16:34:14 +02:00
Mark Andrews a93f5ed51d Merge branch '3433-support-default-hmac-v9_18' into 'v9_18'
Support DEFAULT_HMAC [v9_18]

See merge request isc-projects/bind9!6533
2022-07-07 05:06:48 +00:00
Mark Andrews ba45075acb Add DEFAULT_HMAC to conf.sh.common
(cherry picked from commit 972d7fd682)
2022-07-07 13:26:16 +10:00
Mark Andrews d4297eed9c Merge branch '3061-ifconfig-sh-down-messes-up-loopback-interfaces-v9_18' into 'v9_18'
update ifconfig.sh [v9_18]

See merge request isc-projects/bind9!6530
2022-07-07 00:52:51 +00:00
Mark Andrews 6311d9d2f6 Add CHANGES note for [GL #3061]
(cherry picked from commit e0708c8950)
2022-07-07 10:13:00 +10:00
Mark Andrews 5a58e8af8d update ifconfig.sh
* make it harder to get the interface numbers wrong by using 'max'
to specify the upper bound of the sequence of interfaces and use 'max'
when calculating the interface number
* extract the platform specific instruction into 'up' and 'down'
and call them from the inner loop so that the interface number is
calculated in one place.
* calculate the A and AAAA address in a single place rather than
in each command
* use /sbin/ipadm on Solaris 2.11 and greater

(cherry picked from commit abfb5b1173)
2022-07-07 10:13:00 +10:00
Evan Hunt 382cac0f4f Merge branch '3152-retry-on-formerr-v9_18' into 'v9_18'
try other servers when receiving FORMERR

See merge request isc-projects/bind9!6529
2022-07-06 22:39:36 +00:00
Evan HuntandMark Andrews 19be66772c CHANGES for [GL #3152]
(cherry picked from commit 43e38a21ef)
2022-07-06 22:19:20 +00:00
Evan HuntandMark Andrews 30534b125e try other servers when receiving FORMERR
previously, when an iterative query returned FORMERR, resolution
would be stopped under the assumption that other servers for
the same domain would likely have the same capabilities. this
assumption is not correct; some domains have been reported for
which some but not all servers will return FORMERR to a given
query; retrying allows recursion to succeed.

(cherry picked from commit f6abb80746)
2022-07-06 22:19:20 +00:00
Mark Andrews 12224771d0 Merge branch '3402-create-synth-from-dnssec-namespaces-v9_18' into 'v9_18'
Add a mechanism to record namespaces for synth-from-dnssec [v9_18]

See merge request isc-projects/bind9!6528
2022-07-06 22:18:23 +00:00
Mark Andrews 1872105f09 Add release note for [GL #3402]
(cherry picked from commit 07d5c23cac)
2022-07-07 07:47:45 +10:00
Mark Andrews fa4eb975b8 Add CHANGES note for [GL #3402]
(cherry picked from commit 682c6eb533)
2022-07-07 07:47:45 +10:00
Mark Andrews 443fb79a2c Test grafting and synth-from-dnssec using primary zone
(cherry picked from commit 33454fb0e9)
2022-07-07 07:47:45 +10:00
Mark Andrews 00db079f79 Add system test for forward only grafted zone with synth-from-dnssec
We are grafting on an unsigned zone "example.internal" where the higher
zone (".") is signed and would otherwise cause named to synthesise a
NXDOMAIN for example.internal.  We prime the cache by performing a
lookup for "internal" and then lookup "example.internal".

(cherry picked from commit 8af5d0ad68)
2022-07-07 07:47:45 +10:00
Mark Andrews 30d4e3ee89 Add synth-from-dnssec namespaces for keytable entries
We do this by adding callbacks for when a node is added or deleted
from the keytable.  dns_keytable_add and dns_keytable_delete where
extended to take a callback.  dns_keytable_deletekey does not remove
the node so it was not extended.

(cherry picked from commit a5b57ed293)
2022-07-07 07:47:45 +10:00
Mark Andrews 90467f4127 Add synth-from-dnssec namespace entries for forward only namespaces
Currently forward entries are only removed on view destruction so
there is no matching dns_view_sfd_del call.

(cherry picked from commit a559d6fdd1)
2022-07-07 07:47:45 +10:00
Mark Andrews 107c3a452a Add entries to the synth-from-dnssec namespace tree for zones
When a zone is attached or detached from the view (zone->view is
updated) update the synth-from-dnssec namespace tree.

(cherry picked from commit f716bd68d4)
2022-07-07 07:47:45 +10:00
Mark Andrews 4d9287dca5 Check the synth-form-dnssec namespace when synthesising responses
Call dns_view_sfd_find to find the namespace to be used to verify
the covering NSEC records returned for the given QNAME.  Check that
the NSEC owner names are within that namespace.

(cherry picked from commit 228dadb026)
2022-07-07 07:47:45 +10:00
Mark Andrews b979b6be40 Add a mechanism to record namespaces for synth-from-dnssec
When namespace is grafted on, the DNSSEC proofs for non existance
need to come from that namespace and not a higher namespace.  We
add 3 function dns_view_sfd_add, dns_view_sfd_del and dns_view_sfd_find
to add, remove and find the namespace that should be used when
checking NSEC records.

dns_view_sfd_add adds a name to a tree, creating the tree if needed.
If the name already existed in the tree the reference count is
increased otherwise it is initalised to 1.

dns_view_sfd_del removes a reference to a name in the tree, if the
count goes to 0 the node is removed.

dns_view_sfd_find returns the namespace to be used to entered name.
If there isn't an enclosing name in the tree, or the tree does not
yet exist, the root name is returned.

Access to the tree is controlled by a read/write lock.

(cherry picked from commit 3619cad141)
2022-07-07 07:47:45 +10:00
Mark Andrews f94fb633ef Merge branch '3429-detect-overflow-in-generate-directive-v9_18' into 'v9_18'
Check for overflow in $GENERATE computations [v9_18]

See merge request isc-projects/bind9!6526
2022-07-06 02:04:45 +00:00
Mark Andrews ea80e643f7 Add CHANGES note for [GL #3429]
(cherry picked from commit d935ead14b)
2022-07-06 11:26:02 +10:00
Evan HuntandMark Andrews 2936264dc4 Improve $GENERATE documentation
Clarify the documentation of $GENERATE modifiers and add an example.

(cherry picked from commit 13fb2faf7a)
2022-07-06 11:25:20 +10:00
Mark Andrews 656e33ce18 Tighten $GENERATE directive parsing
The original sscanf processing allowed for a number of syntax errors
to be accepted.  This included missing the closing brace in
${modifiers}

Look for both comma and right brace as intermediate seperators as
well as consuming the final right brace in the sscanf processing
for ${modifiers}.  Check when we got right brace to determine if
the sscanf consumed more input than expected and if so behave as
if it had stopped at the first right brace.

(cherry picked from commit 7be64c0e94)
2022-07-06 11:25:20 +10:00
Mark Andrews 72999440bd Check for overflow in $GENERATE computations
$GENERATE uses 'int' for its computations and some constructions
can overflow values that can be represented by an 'int' resulting
in undefined behaviour.  Detect these conditions and return a
range error.

(cherry picked from commit 5327b9708f)
2022-07-06 11:25:20 +10:00
Evan Hunt 301d8f9fe0 Merge branch 'each-require-has-side-effects-v9_18' into 'v9_18'
REQUIRE should not have side effects

See merge request isc-projects/bind9!6525
2022-07-05 21:08:17 +00:00
Evan Hunt b061e86d17 REQUIRE should not have side effects
it's a style violation to have REQUIRE or INSIST contain code that
must run for the server to work. this was being done with some
atomic_compare_exchange calls. these have been cleaned up.  uses
of atomic_compare_exchange in assertions have been replaced with
a new macro atomic_compare_exchange_enforced, which uses RUNTIME_CHECK
to ensure that the exchange was successful.

(cherry picked from commit a499794984)
2022-07-05 13:04:17 -07:00
Mark Andrews e8a5d0444e Merge branch '3437-cds-error-window-too-small-v9_18' into 'v9_18'
Only report not matching stderr content when we look for it [v9_18]

See merge request isc-projects/bind9!6523
2022-07-05 18:34:20 +00:00
Mark Andrews aedcc7c725 Increase the amount of time allowed for signing to occur in
On slow systems we have seen this take 9 seconds.  Increased the
allowance from 3 seconds to 10 seconds to reduce the probabilty of
a false negative from the system test.

(cherry picked from commit 4db847e80e)
2022-07-05 23:12:12 +10:00
Mark Andrews 287241d449 Only report not matching stderr content when we look for it
The previous test code could emit "D:cds:stderr did not match ''" rather
that just showing the contents of stderr.  Moved the debug line inside
the if/else block.

Replaced backquotes with $() and $(()) as approriate.

(cherry picked from commit 304d33fb32)
2022-07-05 23:12:12 +10:00
Petr Špaček 5f382729bf Merge branch 'pspacek/arm-hyperlinks-v9_18' into 'v9_18'
ARM hyperlinking [v9_18]

See merge request isc-projects/bind9!6519
2022-07-04 14:27:33 +00:00
Petr Špaček 5b8fe7d47e Hyperlink adjustments for v9_18
Release notes subdirectory did not match content of the main branch so
we had to do couple more manual tweaks to replace obsolete explicit
links with references to statement link anchors.
2022-07-04 16:22:12 +02:00
Petr Špaček 8db3a6789b Manually hyperlink algorithm, key, options, secret, and server
These statements/block are ambiguos because they occur in named.conf and
rndc.conf as well. All occurences now link link to the matching
definition.

(cherry picked from commit c3fed5ce40)
2022-07-04 16:09:25 +02:00
Petr Špaček 61ecaf55f5 Remove links from logging category names
Some logging categories have the same names as configuration statements.
This caused some category names to be replaced with links to statement
definitions, which confuses util/check-categories.sh script.

(cherry picked from commit e5a12144bd)
2022-07-04 16:09:25 +02:00
Suzanne GoldlustandPetr Špaček e78ef65ef7 Grammar fixes and assorted text edits in the ARM
(cherry picked from commit 6db988e7e3)
2022-07-04 16:09:25 +02:00
Petr Špaček 9ee192d412 Add tables with statements by tag
(cherry picked from commit dd4dc78899)
2022-07-04 16:09:24 +02:00
Petr Špaček 6ef0b58026 Define topmost configuration blocks
(cherry picked from commit f91cbcf996)
2022-07-04 16:09:24 +02:00
Petr Špaček 6e8ee641a0 Alphabetize grammar glossary
(cherry picked from commit 8aea6694bf)
2022-07-04 16:09:24 +02:00
Petr Špaček 53993da1d9 Rename yes_or_no to boolean
The name yes_or_no was used only in two places and rest of the ARM
(except for the grammar glossary...) uses term boolean. Let's stick to
it.

(cherry picked from commit 0138e5c1d5)
2022-07-04 16:09:24 +02:00
Petr Špaček 40a060e22e Deduplicate definitions of address_match_list and address_match_element
It would be better if it fit into the grammar glossary, but it is too
long. A link must do.

(cherry picked from commit decb4643d1)
2022-07-04 16:09:24 +02:00
Petr Špaček 845a2870df Rework size_spec and size_or_percentage definitions
Except for a single case they were not referenced in the text, but at
the same time doc/misc grammar uses terms "size", "sizeval", and
"percetage".

Keywords "default" and "unlimited" are expanded in statement's grammar
anyway, but I kept their description in place because they are generally
allowed at places which accept sizes.

Percentage is also expanded in doc/misc grammars and thus requires
separate definition.

(cherry picked from commit 4915b1f3a1)
2022-07-04 16:09:24 +02:00
Petr Špaček 0edd5bf77b Remove incorrect hyperlinks to file and unix definitions
Terms file and unix have overloaded meaning and were incorrectly linked
during the mass-linking campain.

(cherry picked from commit 1233c86ff7)
2022-07-04 16:09:24 +02:00
Petr Špaček eeb05d5665 Rename port_list to portrange
The old name was not referenced anywhere but the new name is used in
grammar of {avoid,use}-v{4,6}-udp-ports statement.

(cherry picked from commit 8d9c2368a9)
2022-07-04 16:09:24 +02:00
Petr Špaček 2f0c9d4570 Remove path_name grammar definition
It was literally not used anywhere.

(cherry picked from commit 443fb5f34b)
2022-07-04 16:09:24 +02:00
Petr Špaček 4d62710be5 Hyperlink integer to its definition
(cherry picked from commit 55bc6d02a0)
2022-07-04 16:09:24 +02:00
Petr Špaček 69cda54461 Rename number to integer
The term number was used only in other definitions, and at the same time
doc/misc grammar uses term integer.

(cherry picked from commit 9885bf658d)
2022-07-04 16:09:24 +02:00
Petr Špaček 051d72a7ee Clarify and hyperlink tls_id definition
(cherry picked from commit 6f754dae20)
2022-07-04 16:09:24 +02:00
Petr Špaček 2fd8ce0c46 Hyperlink server_id to its definition
(cherry picked from commit 116573a4a7)
2022-07-04 16:09:24 +02:00
Petr Špaček 830e118d6b Rename key_id to server_key
The old name was used in the ARM and rndc manual page but was
inconsistent with doc/misc grammar.

(cherry picked from commit c972fad7b0)
2022-07-04 16:09:23 +02:00
Petr Špaček 3f93e5d9f9 Remove key_list grammar definition
It was used in a single place (inet statement) and it defined it in the
text anyway. Let's not clutter the glossary.

(cherry picked from commit 818219b36a)
2022-07-04 16:09:23 +02:00
Petr Špaček 38436b58d3 Hyperlink port references to appropriate definitions
``port`` used to refer to grammar elements and also to named.conf
option. Both cases are now linked to respective definitions.

(cherry picked from commit 686a15d30f)
2022-07-04 16:09:23 +02:00
Petr Špaček 388e36a4c4 Rename ip_port to port
The old name was used only in couple places, and was inconsistent with
doc/misc grammar.

(cherry picked from commit 7b51a027e7)
2022-07-04 16:09:23 +02:00
Petr Špaček 441e94fe48 Rename ip_dscp to dscp
The old name was literally not used anywhere, not even in the source
code. The new name is used by doc/misc grammar.

(cherry picked from commit d1644f420c)
2022-07-04 16:09:23 +02:00
Petr Špaček aec7ae2d96 Hyperlink netprefix grammar references to the definition
(cherry picked from commit 5ce45d1c04)
2022-07-04 16:09:23 +02:00
Petr Špaček f005a870d9 Hyperlink ip??_address grammar references to their definition
(cherry picked from commit a35c1ae0c2)
2022-07-04 16:09:23 +02:00
Petr Špaček 5268de4007 Rename ip_prefix to netprefix
Let's standardize on netprefix which matches grammar used in doc/misc.

(cherry picked from commit b22bdb3a1b)
2022-07-04 16:09:23 +02:00
Petr Špaček e1757784de Rename ip_addr, ipv4_addr, and ipv6_addr to *_address
The longer variant matches grammar used in doc/misc.

(cherry picked from commit 57f218e65e)
2022-07-04 16:09:23 +02:00
Petr Špaček 70ba197538 Remove dotted_decimal from grammar glossary
This definition was dererenced only once, from ip4_addr definition on
the next line. These two are now collapsed into new ip4_addr definition.

(cherry picked from commit 44c24f3c94)
2022-07-04 16:09:23 +02:00
Petr Špaček a6e4dbe741 Remove namelist from grammar glossary
This definition was used only for deny-answer-aliases statement
description, and moreover the term did not match grammar listed in
doc/misc/options.

I've replaced it with textual expansion of "list of `domain_name`s"
which is used more often.

(cherry picked from commit fe427a8460)
2022-07-04 16:09:23 +02:00
Petr Špaček 77345f7180 Rename remoteserver_list to remote-servers
Name remoteserver_list was not referenced anywhere but the grammar uses
name remote-servers. Rename and add a reference to primaries for more
information.

(cherry picked from commit e59cedea1f)
2022-07-04 16:09:23 +02:00
Petr Špaček da9a247057 Hyperlink domain_name grammar elements
Hyperlinked manually to avoid needless repetition in the Rset ordering
chapter.

(cherry picked from commit 309dbeac7b)
2022-07-04 16:09:22 +02:00
Petr Špaček b6948bf7ce Hyperlink ACL grammar elements
Manual edit required to restore the first occurence of "definition"
inside .. glossary directive.

Generated using:
    N=acl_name; sed -i -e "s/\`\`$N\`\`/:term:\`$N\`/g" $ARMFILES
    N=address_match_list; sed -i -e "s/\`\`$N\`\`/:term:\`$N\`/g" $ARMFILES

(cherry picked from commit 69d0632dc0)
2022-07-04 16:09:22 +02:00
Petr Špaček 557d674583 Remove unreferences dialup_option grammar
I dunno why it was a separate entity in the grammar glossary. It is not
referenced anywhere else except for the the dialup statement, and the
statement describes all its possible values verbosely.

(cherry picked from commit 14c7fb36e7)
2022-07-04 16:09:22 +02:00
Petr Špaček d28f6972ce Manual fixups for new hyperlinks
It turns out that many manual edits were required:
- Heading underlines were too short because :any:`` is longer than ````
- Some statement names clashed with manually defined _link_anchors
  (notify, trust-anchors etc.)
- Zone types are defined like "type primary" in the internal grammar and
  that caused mayhem in the replacement script as it took "type" and
  individual types ("primary", "secondary") as separate statements.
  For that reason :any:`primary` had to be manually replaced with
  :any:`primary <type primary>` where appropriate.
- Sometimes option name is also the same as a value name (e.g. "notify")
  and then it did not make sense to do the replacement.

(cherry picked from commit 9bbcff225b)
2022-07-04 16:09:22 +02:00
Petr Špaček dba86ce710 Add hyperlinks to all unique statement names
This shell script added hyperlinks to all unique statement names:

    UNIQSTATEMENTS=$(\
        sort \
            <(git grep '.. namedconf:statement::' '*.rst' | sed -e 's/^.*:: //') \
            <(git grep '.. rndcconf:statement::' '*.rst' | sed -e 's/^.*:: //') \
        | uniq --unique)
    ARMFILES=$(git ls-files 'doc/*.rst' | grep -v 'doc/man')
    for STATEMENT in $UNIQSTATEMENTS; \
        do sed -i -e "s/\`\`$STATEMENT\`\`/:any:\`$STATEMENT\`/g" $ARMFILES; \
    done

This needs manual cleanup (see next commit) to fix syntax errors.
2022-07-04 16:08:59 +02:00
Petr Špaček f238a5d820 Use the new term Block in ARM headings "Statement Definition and Usage"
The underline is not shortened on purpose, see subsequent commits.

Generated by:
    sed -i -e 's/ Statement Definition and Usage$/ Block Definition and Usage/g' doc/arm/reference.rst

(cherry picked from commit 9804cdc4de)
2022-07-04 16:07:37 +02:00
Petr Špaček bbedf1bc95 Use the new term Block in ARM headings "Statement Grammar"
Long live new terminology.
The underline is now shortened on purpose, see subsequent commits.

Generated by:
    sed -i -e 's/ Statement Grammar$/ Block Grammar/g' doc/arm/reference.rst

(cherry picked from commit 452593fc94)
2022-07-04 16:07:33 +02:00
Petr Špaček 79249d3539 Merge branch 'pspacek/arm-tables-parse-short-rst-v9_18' into 'v9_18'
Parse and render rst syntax in auto-generated tables [v9_18]

See merge request isc-projects/bind9!6518
2022-07-04 13:50:05 +00:00
Petr Špaček 96691c5873 Parse and render rst syntax in :short: statement descriptions in tables
Without this change tables generated by .. namedconf:statementlist::
contained raw text and displayed rst syntax to users.

The raw docutil node returned by rst parser can contain unresolved
references (pending_xref nodes). We just store those nodes and let
Sphinx to resolve them later on.

Beware: This would not work if we injected nodes in later stages of
processing. All unresolved references must be in place before
'doctree-resolved' event is emitted (i.e. before resolve_references() is
called inside Sphinx).

(cherry picked from commit 62f3cf98d3)
2022-07-04 15:36:44 +02:00
Petr Špaček 6ac047cfaa Generate tables of statements in doctree-read phase
This change allows us to generate "unresolved" references and let Sphinx
deal with dereferencing them in later stages. It is not useful by itself
but it serves as preparation for the next commit.

(cherry picked from commit b109c86805)
2022-07-04 15:36:44 +02:00
Petr Špaček 824ff41f32 Optimize resolve_xref to avoid O(n^2) iteration
Formerly resolve_xref() in Sphinx extension called get_objects() from
Sphinx API which subsequently iterated the whole list of objects,
causing single iteration per single reference, which is essentially.
O(n^2). Avoid using get_objects() and access internal dictionary
directly intead.

The docs build time was still dominated by other factors but speedup is
about 10 % on my machine.

(cherry picked from commit 8a5f20121e)
2022-07-04 15:36:40 +02:00
Petr Špaček 6d3c318538 Merge branch 'marka-cobertura-replaced-by-coverage_report-v9_18' into 'v9_18'
Fix for GitLab 15.0: cobertura replaced by coverage_report [v9_18]

See merge request isc-projects/bind9!6513
2022-07-04 05:31:05 +00:00
Mark AndrewsandPetr Špaček 9ca645bdaf Fix for GitLab 15.0: cobertura replaced by coverage_report
From Gitlab 15.0 release notes:

   artifacts:reports:cobertura keyword

   As of GitLab 15.0, the artifacts:reports:cobertura keyword has
   been replaced by artifacts:reports:coverage_report. Cobertura
   is the only supported report file, but this is the first step
   towards GitLab supporting other report types.

(cherry picked from commit 008032d268)
2022-07-04 07:11:14 +02:00
Petr Špaček 34a1e3db92 Merge branch 'pspacek/arm-grammar-render-v9_18' into 'v9_18'
Render grammar snippets in the ARM [v9_18]

See merge request isc-projects/bind9!6507
2022-07-01 08:43:16 +00:00
Petr Špaček 85626adeb8 Add note that named.conf man page is not a complete manual
We cannot simply do URL because it would make our lives more complicated
with -S edition.

(cherry picked from commit 908acd5d70)
2022-07-01 10:21:06 +02:00
Petr Špaček e8cb9cceb7 Cleanup tag filtering code for statementlist:: RST directive
Technically this is fixup for
33931c97fa
but that commit is already merged.

(cherry picked from commit f5faddd08a)
2022-07-01 10:21:06 +02:00
Petr Špaček 666f0f1d40 Add link anchor and hyperlinks to keys statement
This is super confusing because statement "keys" exists in context
controls and server blocks where it refers to symmetric TSIG key, and it
_also_ exists in dnssec-policy block where it specifies public-private
key pair parameters.

In an (unsuccessful) attempt to disambiguate these two I added bunch of
hyperlinks and a warning.

(cherry picked from commit d88fefbb4a)
2022-07-01 10:21:06 +02:00
Petr Špaček af15c21bc3 Describe rndc server block using .. rndcconf syntax
We need to split the description to silence warnings about undescribed
statements.

(cherry picked from commit 82e2f0b37e)
2022-07-01 10:21:06 +02:00
Petr Špaček 990ec8f15b Define default-source-address, default-source-address-v6 for rndc
(cherry picked from commit 10f88bffe5)
2022-07-01 10:21:06 +02:00
Petr Špaček 763e40de22 Document ipv4only-* options in the ARM
Statements ipv4only-contact, ipv4only-enable, ipv4only-server did not
have their own section in the ARM. Now they have.

(cherry picked from commit 1687b40849)
2022-07-01 10:21:06 +02:00
Petr Špaček d6005488b8 Add missing link anchor for dlz search statement
(cherry picked from commit 40b3ce727c)
2022-07-01 10:21:06 +02:00
Petr Špaček 07cfcf8691 Special-case zone in-view
It is not really a zone type, so let's not generate "type in-view"
anchor for it.

(cherry picked from commit 261bdc7358)
2022-07-01 10:21:06 +02:00
Petr Špaček e55682f6f7 Remove extra whitespace in grammar for null statement
(cherry picked from commit 1af157eb20)
2022-07-01 10:21:06 +02:00
Petr Špaček fa871ffa67 Add ability to filter tables using blocks
A new syntax
.. namedconf:statementlist::
   :filter_blocks: type secondary
allows to generate tables with statements allowed within specified
blocks.

(cherry picked from commit 08a8acffdc)
2022-07-01 10:21:06 +02:00
Petr Špaček ca866c7e92 Sort grammar map keys while pretty printing them
It would be too easy if we could just call sorted(). Thanks to zone
grammar the most important key "type" gets sorted near end, so we pull
it up to the top using a hack.

(cherry picked from commit 5c04e3c524)
2022-07-01 10:21:05 +02:00
Petr Špaček 9b2bf0f8be Pretty-print grammar for zones
It turns out the tree of dictionaries is not the best structure to
represent our grammar, unfortunatelly. The problem is that "zone" has
several context-dependent variants which change meaning of "zone" based
on inner field "type".

Redesigning the whole structure does not seem to be worth, so I settled
on this terrible hack.

(cherry picked from commit 0392144e99)
2022-07-01 10:21:05 +02:00
Petr Špaček c4133e8779 Add zone definitions into the view grammar
I cannot see a reasonable way to achieve this without the hack in this
commit.

(cherry picked from commit 435cbb61ba)
2022-07-01 10:21:05 +02:00
Petr Špaček bc729e39da Add option to suppress grammar rendering
A new flag
.. namedconf:statement::
   :suppress_grammar:
suppresses pretty-printing grammar.

It is useful mostly for zones because each zone has it's own grammar, so
printing all of them at once usually does not make sense.

(cherry picked from commit 1f5bc4fe3b)
2022-07-01 10:21:05 +02:00
Petr Špaček 243ae3b6a7 Remove auto-generated rst files in repo in favour of grammar pretty printer
(cherry picked from commit 0bbbdc6244)
2022-07-01 10:20:56 +02:00
Petr Špaček f34c1034f2 Warn about experimental and deprecated options
(cherry picked from commit 7b4ad8a3ff)
2022-07-01 10:00:28 +02:00
Petr Špaček 3a692b068c Render statement's grammar
This is replacement for auto-generated *.rst files stored in the repo.

(cherry picked from commit c6fe8970f6)
2022-07-01 10:00:28 +02:00
Petr Špaček 2df4072d43 Render list of blocks accepting a given statement
(cherry picked from commit eba3b1ad16)
2022-07-01 10:00:28 +02:00
Petr Špaček a486e6e294 Detect unsupported statement:: directives with multiple names
(cherry picked from commit d61d998e3b)
2022-07-01 10:00:28 +02:00
Petr Špaček 4c53d6f906 Warn about statements not found in the grammar
(cherry picked from commit ebe6ede2ec)
2022-07-01 10:00:28 +02:00
Petr Špaček b11b1c6414 Warn about statements in grammar not described in docs
Skip over obsolete options.

(cherry picked from commit cbad1803a5)
2022-07-01 10:00:27 +02:00
Petr Špaček 7fe582629a Give Sphinx configuration domains access to grammar
(cherry picked from commit 1c6f2c5ad1)
2022-07-01 10:00:27 +02:00
Petr Špaček 160428a0f7 Add helper to unify options and zone block grammars
A helper is needed to combine cfg_test output for generic options and
all the type-dependent zone block variants.

(cherry picked from commit a691ebd0c9)
2022-07-01 10:00:27 +02:00
Petr Špaček ec9af7dbc7 Add pretty printer for JSON grammar
It produces the same format as cfg_test --grammar. The advantage is that
it allows to print any node in configuration the tree, not just whole
blocks.

(cherry picked from commit 190004e46c)
2022-07-01 10:00:27 +02:00
Petr Špaček aabdff9551 Add utility to search for context-dependent configuration statements
The utility detects statements which use the same name (e.g.
max-zone-ttl) but use different grammar in different contexts. These
typically need special case in docs.

(cherry picked from commit 8960d51aa3)
2022-07-01 10:00:27 +02:00
Petr Špaček a78b461653 Add a new library to parse grammar format produced by cfg_test
It transforms named.conf/rndc.conf grammar from text format into Python
dictionary. This allows granular access to grammar elements.

Beware: It heavity depens on cfg_test output format!
(cherry picked from commit df08982930)
2022-07-01 10:00:27 +02:00
Petr Špaček e9d21cee3b Add rndc.conf grammar into doc/misc
It uses the same mechanism as all other grammars, but the file is named
differently to distinguish it from named.conf grammars.

(cherry picked from commit fb474de3ab)
2022-07-01 10:00:27 +02:00
Petr Špaček 214da1de67 Un-format grammar files in doc/misc
The next commit is going to add parser for ISC configuration format.
To simplify the parser the grammar files in doc/misc are no longer
line-wrapped as handling it would make the grammar parser unnecessairly
complicated.

This affects visible output in the ARM, but in the end we are going to
replace the auto-generated .rst files with grammar pretty printed, so
formatting of these files does not matter in practical terms.

(cherry picked from commit 699570cdec)
2022-07-01 10:00:20 +02:00
Petr Špaček a46f671a30 Add missing comment markers to doc/misc/ grammar files
These files can be consumed by scripts, so obviously missing comment
markers wreak havoc.

(cherry picked from commit af3683f436)
2022-07-01 09:26:18 +02:00
Petr Špaček 19e40f34bc Merge branch 'sgoldlust/arm-tag-query-transfer-v9_18' into 'v9_18'
Add tags and short descriptions for query and transfer statements [v9_18]

See merge request isc-projects/bind9!6504
2022-06-30 16:16:00 +00:00
Petr Špaček 364a15da16 Accept rst syntax in .. statement:: short: text
Nested rst syntax is now parsed and rendered. E.g.:

.. namedconf:statement:: example
   :short: Use ``this`` **cool** syntax!

(cherry picked from commit 563eb8e1b9)
2022-06-30 18:12:01 +02:00
Petr Špaček 5513f47e53 Disambiguate address_match_list link anchor
Let's keep just the :term: produced by grammar glossary.

(cherry picked from commit 0e7ca5b5e0)
2022-06-30 18:12:01 +02:00
Suzanne GoldlustandPetr Špaček d4b1916a59 Add the :tags: and :short: descriptions for the category "transfer"
(cherry picked from commit 3cf976bd78)
2022-06-30 18:12:01 +02:00
Suzanne GoldlustandPetr Špaček 51057d3c85 Add the :tags: and :short: descriptions for the category "query"
(cherry picked from commit 7187a5cf77)
2022-06-30 18:12:01 +02:00
Petr Špaček 62958590cd Resurrect DNS NOTIFY chapter in the ARM
It was accidentally removed in the heat of
25eb91d23c.

(cherry picked from commit 2630cf8e76)
2022-06-30 18:11:54 +02:00
Michal Nowak 783be731bf Merge branch '2371-add-stress-testing-with-rpz-v9_18' into 'v9_18'
[v9_18] Add stress testing with RPZ

See merge request isc-projects/bind9!6497
2022-06-28 19:47:05 +00:00
Michal Nowak 46a8cf94c6 Add stress testing with RPZ
(cherry picked from commit d272574653)
2022-06-28 20:37:40 +02:00
Petr Špaček 2de747d246 Merge branch '3408-drop-debian-9-stretch-v9_18' into 'v9_18'
Drop support for Debian 9 (Stretch) [v9_18]

See merge request isc-projects/bind9!6495
2022-06-28 15:57:20 +00:00
Petr Špaček ccb608ebea Declare Debian 9 (Stretch) community-maintained
(cherry picked from commit 4ce1f25210)
2022-06-28 17:56:34 +02:00
Petr Špaček 85de8f8c15 Drop Debian 9 (Stretch) from CI
(cherry picked from commit aa86a8bcf0)
2022-06-28 17:56:34 +02:00
Artem Boldariev 07cbd5500e Merge branch '3415-update-http-listeners-on-reconfig-v9-18' into 'v9_18'
[Backport to 9.18]: Update HTTP listeners settings on reconfiguration

See merge request isc-projects/bind9!6494
2022-06-28 14:27:31 +00:00
Artem Boldariev 69e1d3804e doth test: extend with HTTP endpoints reconfiguration check
This commit add a check which verifies that HTTP endpoints are being
picked up properly by the BIND instance on a reconfiguration.

(cherry picked from commit 7822670d0f)
2022-06-28 16:38:21 +03:00
Artem Boldariev 12a6fafae2 Update CHANGES [GL #3415]
Mention that the settings are now applied properly on reconfiguration.

(cherry picked from commit 502c78c339)
2022-06-28 16:38:18 +03:00
Artem Boldariev b6b07c5646 Update the set of HTTP endpoints on reconfiguration
This commit ensures that on reconfiguration the set of HTTP
endpoints (=paths) is being updated within HTTP listeners.

(cherry picked from commit d2e13ddf22)
2022-06-28 16:37:31 +03:00
Artem Boldariev bb8ba2c027 Update max concurrent streams limit in HTTP listeners on reconfig
This commit ensures that HTTP listeners concurrent streams limit gets
updated properly on reconfiguration.

(cherry picked from commit e72962d5f1)
2022-06-28 16:37:31 +03:00
Artem Boldariev 1ccbb24078 Update HTTP listeners quotas on reconfiguration
This commit ensures that on reconfiguration a proper value for HTTP
connections limit is picked up.

The commit also refactors how listeners settings are updated so that
there is less code duplication.

(cherry picked from commit a2379135fa)
2022-06-28 16:37:31 +03:00
Artem Boldariev 63a4c12227 Store HTTP quota size inside a listenlist instead of the quota
This way only quota size is passed to the interface/listener
management code instead of a quota object. Thus, we can implement
updating the quota object size instead of recreating the object.

(cherry picked from commit 3f0b310772)
2022-06-28 16:37:31 +03:00
Matthijs Mekking 1330732872 Merge branch 'matthijs-dnssec-policy-defaults-in-config-dot-c-v9_18' into 'v9_18'
[v9_18] Move built-in dnssec-policies into defaultconf

See merge request isc-projects/bind9!6493
2022-06-28 13:30:26 +00:00
Matthijs Mekking 35f6cabab4 Add isccfg duration utility functions
Add function isccfg_duration_toseconds and isccfg_parse_duration to get
rid of code duplication.

(cherry picked from commit d8dae61832)
2022-06-28 14:37:26 +02:00
Matthijs Mekking feaf3950fd Fix a bug in the duration_fromtext function
The function actually did not enforce that the duration string starts
with a P (or p), just that there is a P (or p) in the string.

(cherry picked from commit 8e18fa5874)
2022-06-28 14:37:19 +02:00
Matthijs Mekking 8af88d4111 Also inherit from "default" for "insecure" policy
Remove the duplication from the defaultconf and inherit the values
not set in the "insecure" policy from the "default" policy. Therefore,
we must insist that the first read built-in policy is the default one.

(cherry picked from commit c2a7950417)
2022-06-28 14:37:10 +02:00
Matthijs Mekking bd15b7c3c6 Add change entry for dnssec-policy in defaultconf
(cherry picked from commit 80b55f9cfa)
2022-06-28 14:37:02 +02:00
Matthijs Mekking fd34ea8523 Nit changes in keymgr and kasp
Use the ISC_MAX define instead of "x = a > b ? a : b" paradigm.

Remove an unneeded include.

(cherry picked from commit 5d6f0de84b)
2022-06-28 14:36:53 +02:00
Matthijs Mekking e16cfce91d When loading dnssec-policies, inherit from default
Most of the settings (durations) are already inheriting from the default
because they use the constants from lib/dns/kasp.h. We need them as
constants so we can use them in named-checkconf to verify the policy
parameters.

The NSEC(3) parameters and keys should come from the actual default
policy. Change the call to cfg_kasp_fromconfig() to include the default
kasp. We also no longer need to corner case where config is NULL we load
the built-in policy: the built-in policies are now loaded when config is
set to named_g_config.

Finally, add a debug log (it is useful to see which policies are being
loaded).

(cherry picked from commit 20acb8d3a3)
2022-06-28 14:36:45 +02:00
Matthijs Mekking 03c0c72aeb Store built-in dnssec-policies in defaultconf
Update the defaultconf with the built-in policies. These will now be
printed with "named -C".

Change the defines in kasp.h to be strings, so they can be concatenated
in the defaultconf. This means when creating a kasp structure, we no
longer initialize the defaults (this is fine because only kaspconf.c
uses dns_kasp_create() and it inherits from the default policy).

In kaspconf.c, the default values now need to be parsed from string.

Introduce some variables so we don't need to do get_duration multiple
times on the same configuration option.

Finally, clang-format-14 decided to do some random formatting changes.

(cherry picked from commit 5ff414e986)
2022-06-28 14:36:38 +02:00
Matthijs Mekking 4fb2ecd444 Move duration structure to libisccfg/duration
Having the duration structure and parsing code here, it becomes
more accessible to be used in other places.

(cherry picked from commit a28d919503)
2022-06-28 14:36:31 +02:00
Michał Kępień d75ce232a6 Merge branch '3216-run-sslyze-in-gitlab-ci-v9_18' into 'v9_18'
[CVE-2022-1183] [v9_18] Run sslyze in GitLab CI

See merge request isc-projects/bind9!6492
2022-06-27 21:19:49 +00:00
Michał Kępień a649bd2148 Also test DNS-over-TLS code using sslyze
Since sslyze can test any TLS-enabled server, also use it for exercising
DNS-over-TLS code rather than just DNS-over-HTTPS code.

(cherry picked from commit 4f12892740)
2022-06-27 23:10:00 +02:00
Michał Kępień 4cda066de2 Add regression test for CVE-2022-1183
If sslyze is available in PATH, run it in a loop as part of the "doth"
system test.

(cherry picked from commit e97b4697cf)
2022-06-27 23:10:00 +02:00
Matthijs Mekking 11abb69fb4 Merge branch '3422-dnssec-policy-clarifications-v9_18' into 'v9_18'
[v9_18] Add some clarifications wrt dynamic zones

See merge request isc-projects/bind9!6489
2022-06-27 09:54:52 +00:00
Matthijs Mekking f2fc0e9c9e Add some clarifications wrt dynamic zones
These were suggested by GitLab user @elmaimbo.

(cherry picked from commit fb517eb52a)
2022-06-27 11:04:11 +02:00
Tom Krizek def7601987 Merge branch '3169-named-conf-intro-and-links-v9_18' into 'v9_18'
Reworked named.conf introduction and link anchors [v9_18]

See merge request isc-projects/bind9!6488
2022-06-24 14:55:08 +00:00
Ron AitchisonandPetr Špaček 22ac5003b5 Added explanations or Argument, Value, and Directive to the ARM
(cherry picked from commit d44cb9f194)
2022-06-24 16:47:28 +02:00
Petr Špaček 5fbeebc6f3 Add link to glob definition for include directive
(cherry picked from commit bb2a19d655)
2022-06-24 16:47:28 +02:00
Suzanne GoldlustandPetr Špaček 1fc681cce6 Minor text nitpicking around dnssec-policy grammar reference
(cherry picked from commit f4503061ba)
2022-06-24 16:47:28 +02:00
Petr Špaček 19fde8b8f1 Remove ambiguous link anchors for logging { file } statement
Unfortunatelly logging and zone blocks use file statements with
different semantics but the same name.

There is no sane way to disambiguate them in text, so let's remove the
link anchor from logging so we can link to the file statement in zone.

My assumption is that linking to logging { file } is very unlikely
because logging is self-contained in one block but zone config is all
over the place.

(cherry picked from commit fbcaa44851)
2022-06-24 16:47:28 +02:00
Petr Špaček 1b9c74152e Remove ambiguous link anchors for keys statement
Unfortunatelly dnssec-policy and servers blocks use keys statements with
a totally different grammar and semantics but the same name.
There is no sane way to disambiguate them in text, so let's remove the
link anchors to prevent errorneous linking.

(cherry picked from commit d6b2423c99)
2022-06-24 16:47:28 +02:00
Petr Špaček a7da2d4993 Change statement->argument terminology for control channel
control { inet ... allow keys read-only }; are not actual statements
but in fact arguments of a statement. Remove .. namedconf:statement::
syntax to avoid collisions with other statements of the same name.

(cherry picked from commit caf2675ef8)
2022-06-24 16:47:28 +02:00
Petr Špaček 70924290ca Deduplicate dnssec-policy definition in the ARM
(cherry picked from commit 3233414a53)
2022-06-24 16:47:28 +02:00
Petr Špaček b023b62b8d Deduplicate null definition in the ARM logging section
(cherry picked from commit fa2ba5423b)
2022-06-24 16:47:28 +02:00
Petr Špaček c496ffe4f4 Deduplicate {use,avoid}-v{4,6}-udp-ports definitions in the ARM
Statements affected:
use-v4-udp-ports
use-v6-udp-ports
avoid-v4-udp-ports
avoid-v6-udp-ports

(cherry picked from commit cd1b9aa052)
2022-06-24 16:47:28 +02:00
Petr Špaček df2c19c19b Deduplicate request-expire definition in the ARM
(cherry picked from commit 6e634c43cd)
2022-06-24 16:47:27 +02:00
Petr Špaček 8af0d9eca7 Deduplicate provide-ixfr definition in the ARM
(cherry picked from commit 22e6c8a29e)
2022-06-24 16:47:27 +02:00
Petr Špaček 98445cc32b Deduplicate request-ixfr definition in the ARM
Let's be consistent and put all definitions in the options block.

(cherry picked from commit 14389bc446)
2022-06-24 16:47:27 +02:00
Petr Špaček 0dd45cb17f Deduplicate notify-source, notify-source-v6 definitions in the ARM
(cherry picked from commit 08a3cd7ae4)
2022-06-24 16:47:27 +02:00
Petr Špaček 3688d706da Deduplicate request-nsid definition in the ARM
(cherry picked from commit e91529a48b)
2022-06-24 16:47:27 +02:00
Petr Špaček c611110c9b Deduplicate query-source, query-source-v6 definitions in the ARM
(cherry picked from commit 92a125b9c4)
2022-06-24 16:47:27 +02:00
Petr Špaček 8e5925c25a Deduplicate transfer-source, transfer-source-v6 definitions in the ARM
(cherry picked from commit 538f5a7520)
2022-06-24 16:47:27 +02:00
Petr Špaček 8a2470d559 Deduplicate transfer-format definition in the ARM
(cherry picked from commit b6eb0b298d)
2022-06-24 16:47:27 +02:00
Petr Špaček 97530e74e0 Deduplicate send-cookie definition in the ARM
(cherry picked from commit 7937c4bc9c)
2022-06-24 16:47:27 +02:00
Petr Špaček 7390e1e113 Deduplicate max-udp-size definition in the ARM
(cherry picked from commit 8ac82b4f30)
2022-06-24 16:47:27 +02:00
Petr Špaček 9ccadcc310 Deduplicate edns-udp-size definition in the ARM
(cherry picked from commit 624bbf403c)
2022-06-24 16:47:27 +02:00
Petr Špaček 40b9aa2e0b Deduplicate max-zone-ttl definition in the ARM
This is confusing as hell, but we cannot fix that in the manual itself.
At least now the user is made aware of two distinct defaults.

(cherry picked from commit 405a0931ea)
2022-06-24 16:47:27 +02:00
Petr Špaček e28050e7a4 Deduplicate allow-update definition in the ARM
(cherry picked from commit 420a7331a8)
2022-06-24 16:47:27 +02:00
Ron AitchisonandPetr Špaček 0c52d244ba Reference new named.conf description instead of man page
(cherry picked from commit cf85e776c6)
2022-06-24 16:47:26 +02:00
Ron AitchisonandPetr Špaček b8fa35789e Remove line numbering from config file examples
(cherry picked from commit 31e3d1aaf7)
2022-06-24 16:47:26 +02:00
Ron AitchisonandPetr Špaček 309a75e56b Changed all references from clause to block
(cherry picked from commit c40a983334)
2022-06-24 16:47:26 +02:00
Ron AitchisonandPetr Špaček f16cfcebe4 Restructure introduction to named.conf in the ARM
(cherry picked from commit b01262b7f2)
2022-06-24 16:47:26 +02:00
Petr Špaček 667335bd1c Add link anchors to statements and blocks in the ARM
All statements now use .. namedconf:statement:: or
.. rndcconf:statement:: syntax provided by our Sphinx extension.

This has several consequences:
- It changes how statement headings are rendered
- Statements are indexed and show up as separate items in doc
  search results (in the HTML version)
- Statements can be linked to using either :any:`statement` or
  :namedconf:ref:`statement` syntax (not used in this commit)
- Statements can be categorized and printed using ..
  namedconf:statatementlist:: syntax (not used in this commit)

(cherry picked from commit e5b7022dcb)
2022-06-24 16:47:25 +02:00
Michał Kępień 22ac7b0a4a Merge branch '3416-document-key-lifetime-min-length-v9_18' into 'v9_18'
[v9_18] Document what is a too short key lifetime

See merge request isc-projects/bind9!6483
2022-06-23 10:53:54 +00:00
Matthijs Mekking b18e6455d1 Document what is a too short key lifetime
To give a hint to users that get an error that the key lifetime is
shorter than the time it takes to do a rollover.

(cherry picked from commit c47735b86b)
2022-06-23 12:40:47 +02:00
Mark Andrews 9d8972ce72 Merge branch '3420-rrsetorder-update-status-v9_18' into 'v9_18'
Add missing update of status variable in rrsetorder system test [v9_18]

See merge request isc-projects/bind9!6480
2022-06-23 07:53:27 +00:00
Mark Andrews 7901261121 Replace expr's with $((expression)) shell constucts
Also make indenting consistent.

(cherry picked from commit 669c42cd95)
2022-06-23 17:27:13 +10:00
Mark Andrews f7d5957f95 Add missing update of status variable in rrsetorder system test
(cherry picked from commit da63e63c41)
2022-06-23 17:27:13 +10:00
Michał Kępień b372af4de8 Merge branch '3143-add-a-note-to-the-arm-on-dnstap-and-resolver-traffic-v9_18' into 'v9_18'
[v9_18] Add a note to the ARM on dnstap & resolver traffic

See merge request isc-projects/bind9!6479
2022-06-22 19:46:56 +00:00
Michał Kępień 35840d2d03 Check IPs in a dnstap capture of resolver traffic
Add a system test that checks whether IP addresses are present in a
dnstap capture of resolver traffic if "query-source" is explicitly set.

(cherry picked from commit 1f5c2ea8e5)
2022-06-22 21:14:40 +02:00
Michał Kępień 40aceeb96a Add a note to the ARM on dnstap & resolver traffic
Warn users that server-side IP addresses are not stored in dnstap
captures of resolver traffic unless "query-source(-v6)" is explicitly
set, explaining why it is so.

(cherry picked from commit 366f7a938b)
2022-06-22 21:14:40 +02:00
Matthijs Mekking 2eddca913e Merge branch '3320-rewrite-arm-dnssec-chapter-v9_18' into 'v9_18'
[v9_18] Rewrite DNSSEC ARM Chapter

See merge request isc-projects/bind9!6478
2022-06-22 14:45:33 +00:00
Petr ŠpačekandMatthijs Mekking 504cbd2353 Mention zone storage in the DNSSEC chapter
Let's not duplicate texts, link to description elsewhere instead.

(cherry picked from commit 146c125988)
2022-06-22 15:58:59 +02:00
Suzanne GoldlustandMatthijs Mekking 003423974b Minor grammar improvements in the Signing chapter of the DNSSEC Guide
(cherry picked from commit 6b1ad4dcfb)
2022-06-22 15:58:51 +02:00
Matthijs Mekking 342baee607 Add a section about key rollover
Describe how to do key rollovers with dnssec-policy. Update the
revert to unsigned recipe in the DNSSEC guide.

(cherry picked from commit f721986589)
2022-06-22 15:58:45 +02:00
Petr ŠpačekandMatthijs Mekking 595eb27b7e Deduplicate Manual Signing between DNSSEC chapter and DNSSEC Guide
The two procedures were essentially the same, but each instance was
missing some details from the other. They are now combined into one text
in the DNSSEC Guide and linked from DNSSEC chapter.

(cherry picked from commit 7d25027898)
2022-06-22 15:58:39 +02:00
Petr ŠpačekandMatthijs Mekking 99ef4f254f Deduplicate key filename description in the DNSSEC Guide
Third time ...

(cherry picked from commit 7e96801841)
2022-06-22 15:58:31 +02:00
Petr ŠpačekandMatthijs Mekking 06b02f2b4a Use ECDSAP256SHA256 in DNSSEC signing examples
(cherry picked from commit 3eb6898a14)
2022-06-22 15:58:08 +02:00
Petr ŠpačekandMatthijs Mekking eda822a1fc Use code-block directive for complete command lines
Minor rendering nit, not really important.

(cherry picked from commit 915237a28f)
2022-06-22 15:58:00 +02:00
Petr ŠpačekandMatthijs Mekking f1d71dff5a Deduplicate key filename description in the DNSSEC chapter
(cherry picked from commit 1dcc34f076)
2022-06-22 15:57:53 +02:00
Petr ŠpačekandMatthijs Mekking 5b30bffaaa Move Private Type Records in DNSSEC chapter to higher level
Private Type Records are not specific to manually signing, so it is
better to move it to the end of the "Zone Signing" section shared by all
three methods.

(cherry picked from commit 5ba618fd28)
2022-06-22 15:57:45 +02:00
Petr ŠpačekandMatthijs Mekking 1d07cf4883 Rewrite DNSSEC Validation subchapter in the ARM
Mostly deduplicating and linking information across the ARM.
Generally people should not touch it unless they what they are doing, so
let's try to discourage them a bit.

(cherry picked from commit bffa3063f0)
2022-06-22 15:57:37 +02:00
Petr ŠpačekandMatthijs Mekking c6a82e0ff1 Add hints about secure delegation to DNSSEC chapter of the ARM
Let's not duplicate texts from elsewhere, just point to different parts
of documentation.

(cherry picked from commit 29030fa5d7)
2022-06-22 15:57:29 +02:00
Petr ŠpačekandMatthijs Mekking b51c7be326 Reorder chapters about Zone Signing in the DNSSEC chapter of ARM
Let's make more automated methods more prominent:
- KASP first
- dynamic updates second
- command-line tools only as last resort

(cherry picked from commit 28a533322b)
2022-06-22 15:57:21 +02:00
Petr ŠpačekandMatthijs Mekking b288a7e48a Rewrite KASP section of DNSSEC chapter in the ARM
The goal is simplicity. Copy&paste to do the right thing, or read
referenced material and make up your mind if you need specialities.

NSEC discussion is already present in the DNSSEC guide so I merged
KASP examples with example for NSEC3 and removed NSEC text from the
DNSSEC chapter.

(cherry picked from commit 744763f8f2)
2022-06-22 15:57:14 +02:00
Petr ŠpačekandMatthijs Mekking b502211060 Rewrite introduction for DNSSEC chapter of the ARM
I've attempted to drop most of DNSSEC-specific jargon from the intro
paragraph, and to convince readers to read on.

(cherry picked from commit 0dc9c33149)
2022-06-22 15:57:07 +02:00
Matthijs Mekking 72ad0ed7cf Use NSEC3 guidance values in nsec3 config examples
Use best practice values in examples that follow new guidance from
draft-ietf-dnsop-nsec3-guidance:

   ; SHA-1, no extra iterations, empty salt:
   ;
   bcp.example. IN NSEC3PARAM 1 0 0 -

(cherry picked from commit 93601d8325)
2022-06-22 15:57:00 +02:00
Matthijs Mekking ef9dcad036 Move "DNSSEC" chapter before "Advanced" and "Security"
DNSSEC is mainstream nowadays, so let's give it more attention.

(cherry picked from commit 024c15f03b)
2022-06-22 15:56:49 +02:00
Matthijs Mekking cd348f3d60 Move Dynamic Zones section up
Move this section up so that DNSSEC signing topics are grouped together
(and not split by the DNSSEC Validation chapter).

(cherry picked from commit 7824c5c967)
2022-06-22 15:56:40 +02:00
Matthijs Mekking 205805f5ca Rewrite Dynamic Zones section
Restructure the section about dynamic zones and automatic signing:
- Focus on dynamic zones with 'auto-dnssec allow;'.
- Add a section about multi-signer models.
- Move NSEC3 related topics into one section.
- Remove any text that does not concern dynamic zones (mostly duplicate
  text anyway).

(cherry picked from commit be54c08d2b)
2022-06-22 15:56:34 +02:00
Matthijs Mekking 966645c3a7 Add a section about Denial of Existence
Move bits from the "DNSSEC, Dynamic Zones, and Automatic Signing"
about denial of existence to a separate section below the "Key and
Signing Policy" section.

Add a brief introduction about denial of existence to this section.

(cherry picked from commit 71490a5a2d)
2022-06-22 15:56:27 +02:00
Matthijs Mekking 65498441b0 Rewrap a paragraph in DNSSEC Validation section
No textual changes, just rewrapping to 80 characters.

(cherry picked from commit 34dea43f9c)
2022-06-22 15:56:19 +02:00
Matthijs Mekking 63c0f70266 Rewrite DNSSEC chapter - signing
Restructure the first part of the DNSSEC chapter that deals with zone
signing. Put dnssec-policy first. Mention Key and Signing Policy.
Only then talk about the DNSSEC tools.

(cherry picked from commit a1c95e8e7c)
2022-06-22 15:56:12 +02:00
Matthijs Mekking e0c12a4bd5 Nit changes in introduction of DNSSEC chapter
DNSSEC-bis is an uncommon term. Other servers are typically resolvers
and they usually are configured with the root key.

(cherry picked from commit fb24454c58)
2022-06-22 15:55:18 +02:00
Michal Nowak a8502a0ad9 Merge branch 'mnowak/add-system_gcc_bullseye_unstable_amd64-ci-job-v9_18' into 'v9_18'
[v9_18] Add system:gcc:bullseye:unstable:amd64 CI job

See merge request isc-projects/bind9!6476
2022-06-22 13:27:55 +00:00
Michal Nowak 77f71e4ad4 Put default-triggering-rules anchor in alphabetical order
(cherry picked from commit db1a72d581)
2022-06-22 14:51:34 +02:00
Michal Nowak 2438566964 Rename schedules_tags_web_triggering_rules anchor
The schedules_tags_web_triggering_rules anchor name should match it's
content, hence api_schedules_tags_triggers_web_triggering_rules anchor
name.

(cherry picked from commit 0629f53431)
2022-06-22 14:51:30 +02:00
Michal Nowak d67a62cb24 Extract API, schedules, triggers, and web triggering rules
(cherry picked from commit fbc1345dd7)
2022-06-22 14:51:24 +02:00
Michal Nowak 6984b1a61e Add system:gcc:bullseye:unstable:amd64 CI job
Without this CI job long pytest jobs are not being run in the CI.

(cherry picked from commit d606f39022)
2022-06-22 14:51:19 +02:00
Michał Kępień d1c94a70c8 Merge branch '3309-fix-destination-port-extraction-for-client-queries-v9_18' into 'v9_18'
[v9_18] Fix destination port extraction for client queries

See merge request isc-projects/bind9!6474
2022-06-22 11:59:17 +00:00
Michał Kępień 1cc7d243c6 Add CHANGES entry for GL #3309
(cherry picked from commit 58c3513fa6)
2022-06-22 13:46:42 +02:00
Mark AndrewsandMichał Kępień 5b56aa68af Check that the UDP destination port is logged via dnstap
(cherry picked from commit 8d8396c3a7)
2022-06-22 13:46:42 +02:00
Michał Kępień 457b666c6f Fix destination port extraction for client queries
The current logic for determining the address of the socket to which a
client sent its query is:

 1. Get the address:port tuple from the netmgr handle using
    isc_nmhandle_localaddr().

 2. Convert the address:port tuple from step 1 into an isc_netaddr_t
    using isc_netaddr_fromsockaddr().

 3. Convert the address from step 2 back into a socket address with the
    port set to 0 using isc_sockaddr_fromnetaddr().

Note that the port number (readily available in the netmgr handle) is
needlessly lost in the process, preventing it from being recorded in
dnstap captures of client traffic produced by named.

Fix by first storing the address:port tuple returned by
isc_nmhandle_localaddr() in client->destsockaddr and then creating an
isc_netaddr_t from that structure.  This allows the port number to be
retained in client->destsockaddr, which is what subsequently gets passed
to dns_dt_send().

(cherry picked from commit 2f945703f2)
2022-06-22 13:46:42 +02:00
Michał Kępień 423516b812 Merge branch 'ondrej-fix-out-of-tree-artifacts-v9_18' into 'v9_18'
[v9_18] Move the out of tree directory into the project directory

See merge request isc-projects/bind9!6473
2022-06-22 11:04:32 +00:00
Michał Kępień 3777b4b6c0 Clean up convert-trs-to-junit.py invocations
- Use absolute paths when invoking the convert-trs-to-junit.py script
    so that it also works correctly for out-of-tree and tarball-based
    test jobs.

  - Quote the variables used in convert-trs-to-junit.py invocations to
    future-proof the code.

  - Use "&&" instead of ";" in shell pipelines invoking the
    convert-trs-to-junit.py script in order to prevent "source" errors
    from being silently ignored.

  - Ensure convert-trs-to-junit.py is invoked from the correct directory
    for out-of-tree and tarball-based unit test jobs by adding
    appropriate "cd" invocations.

  - Ensure the convert-trs-to-junit.py invocations are always the last
    step in each 'after_script', in order to run that script from the
    correct directory for out-of-tree and tarball-based system test jobs
    and to ensure that any potential errors in that script do not
    prevent more important steps in the 'after_script' from being
    executed.

(cherry picked from commit 2cd20ee370)
2022-06-22 13:01:42 +02:00
Michał Kępień 024d1980dd Move out-of-tree workspace back to $CI_PROJECT_DIR
Out-of-tree build & test jobs currently defined in GitLab CI use
/tmp/out_of_tree_workspace as the working directory.  This requires
juggling that directory around as it gets passed from the build job to
the test jobs and then again after the test jobs are finished, so that
artifacts can be collected for the purpose of investigating test
failures.  The original intention of doing this was to ensure that
bin/tests/system/run.sh does not rely on being executed from within a
Git working copy (which happens e.g. if the out-of-tree workspace is a
subdirectory of $CI_PROJECT_DIR, i.e. the path into which GitLab
Runner clones the project in each job).

However, even with these complications in place, not all possible
scenarios that should be handled properly by the system test framework
(e.g. invoking a given test one time after another from the same
out-of-tree build directory) are tested in GitLab CI anyway.  Meanwhile,
the requirement for moving the out-of-tree workspace into
$CI_PROJECT_DIR in the 'after_script' for each out-of-tree job makes
these jobs less robust than they could be; for example, if any step in
the 'after_script' returns a non-zero exit code, the job's artifacts
will not include the out-of-tree workspace, hindering troubleshooting.

Simplify job definitions in .gitlab-ci.yml by moving the workspace used
by out-of-tree build & test jobs back to a subdirectory of
$CI_PROJECT_DIR.  Whether the out-of-tree workspace exists within a Git
working copy or not does not matter for Autotools, so this is considered
to be a reasonable trade-off in terms of test coverage.

(cherry picked from commit e6aebf10cc)
2022-06-22 13:01:42 +02:00
Michal Nowak 81f02e27b6 Merge branch 'mnowak/ubuntu-22.04-jammy-jellyfish-v9_18' into 'v9_18'
[v9_18] Add Ubuntu 22.04 LTS (Jammy Jellyfish)

See merge request isc-projects/bind9!6470
2022-06-22 10:25:03 +00:00
Michal Nowak 4265c0e6d6 Do not run Ubuntu 18.04 jobs in MR-triggered pipelines
With the addition of Ubuntu 22.04 three more CI jobs were added. To
compensate for that, move Ubuntu 18.04 jobs out of MR-triggered
pipelines to schedule-triggered ones.

Also, move --disable-geoip ./configure options from Ubuntu 18.04 to
Ubuntu 20.04 jobs to keep these options in the more frequent
MR-triggered pipelines.

(cherry picked from commit 06c591667e)
2022-06-22 11:38:53 +02:00
Michal Nowak 9b78663110 Add Ubuntu 22.04 LTS (Jammy Jellyfish)
(cherry picked from commit 4c2af3bdfa)
2022-06-22 11:38:53 +02:00
Matthijs Mekking 15bf7deec1 Merge branch '3412-system-test-passthru-virtualenv-perl5lib-v9_18' into 'v9_18'
[v9_18] System tests pass through virtualenv and perlmods

See merge request isc-projects/bind9!6469
2022-06-22 09:28:02 +00:00
Matthijs Mekking de5b25b386 System tests pass through virtualenv and perlmods
Have system tests use required Python (dnspython) and PERL modules
(Digest::HMAC and Net::DNS) from user directories, avoid using
privileges.

Note: The pythonenv must be setup to use the same version of python as
the test uses, for example /usr/bin/python.

Thanks to Stacey Marshall.

(cherry picked from commit 53eb127be1)
2022-06-22 10:24:03 +02:00
Matthijs Mekking 9d05898483 Merge branch '3397-document-interaction-dnssec-update-config-options-v9_18' into 'v9_18'
[v9_18] Document where updates and DNSSEC records are stored

See merge request isc-projects/bind9!6463
2022-06-20 14:20:57 +00:00
Matthijs Mekking ea50826dca Add comment on DNSSEC signing zone configuration
I was slightly confused here, so IMO it can use a comment.

(cherry picked from commit c80531758c)
2022-06-20 15:29:05 +02:00
Matthijs Mekking 0ba0ef4e20 Document where updates and DNSSEC records are stored
Make clear that inline-signing stores DNSSEC records in a signed
version of the zone, using the zone's filename plus ".signed" extension.

Tell that dynamic zones store updates in the zone's filename.

DNSSEC records for dynamic zones also go in the zone's filename, unless
inline-signing is enabled.

Then, dnssec-policy assumes inline-signing, but only if the zone is
not dynamic.

(cherry picked from commit 8860f6b4ff)
2022-06-20 15:28:58 +02:00
Michal Nowak d2b83e8b4a Merge branch 'mnowak/bump-clang-to-version-14-v9_18' into 'v9_18'
[v9_18] Update clang to version 14

See merge request isc-projects/bind9!6455
2022-06-17 06:35:09 +00:00
Michal Nowak 0819f7ecac Extract Clang version to $CLANG_VERSION
Extracting Clang version helps with updating Clang version in one place
and not missing one of its instances.

(cherry picked from commit bd17dec045)
2022-06-16 18:09:33 +02:00
Michal Nowak 82268504c9 Fix external_symbolizer_path on Fedora
The external_symbolizer_path was wrong on Fedora since moving gcc:tsan
jobs from Debian to Fedora.

(cherry picked from commit e98b9c5009)
2022-06-16 18:09:33 +02:00
Michal Nowak d3eb307e3c Update clang to version 14
(cherry picked from commit 1c45a9885a)
2022-06-16 18:09:33 +02:00
Michal Nowak b8134e4c78 Merge branch 'mnowak/checkds-pylint-implicit-str-concat-fixes-v9_18' into 'v9_18'
[v9_18] Fix implicit string concatenation in tests-checkds.py

See merge request isc-projects/bind9!6453
2022-06-16 11:47:29 +00:00
Michal Nowak 8b77533ac3 Fix implicit string concatenation in tests-checkds.py
pylint 2.14.2 reports the following warnings:

    bin/tests/system/checkds/tests-checkds.py:265:0: W1404: Implicit string concatenation found in call (implicit-str-concat)
    bin/tests/system/checkds/tests-checkds.py:273:0: W1404: Implicit string concatenation found in call (implicit-str-concat)

(cherry picked from commit 831ac8add1)
2022-06-16 13:41:06 +02:00
Tom Krizek b7ff587512 Merge branch 'tkrizek/pytest-skipped-reason-v9_18' into 'v9_18'
Report reasons for skipped/xfailed system pytests [v9_18]

See merge request isc-projects/bind9!6451
2022-06-16 07:55:08 +00:00
Tom Krizek 1d847def2a Report reasons for skipped/xfailed system pytests
If skip/xfail is used in pytest, it can have a reason string associated
with it. When evaluating these tests, it can be useful to be able to
differentiate the reason why the test was skipped/xfailed/xpassed,
because there might be multiple possible reasons for that.

The extra options passed to pytest ensure that the string with the
reason appears in the test summary and thus we're able to find the
string with the reason in the log output.

See https://docs.pytest.org/en/7.1.x/how-to/skipping.html for more info

(cherry picked from commit f6d368167a)
2022-06-16 09:19:50 +02:00
Petr Špaček 6d46fa4052 Merge branch 'pspacek/nsec3-doc-update-v9_18' into 'v9_18'
Update NSEC3 guidance to match draft-ietf-dnsop-nsec3-guidance-10 [v9_18]

See merge request isc-projects/bind9!6447
2022-06-15 16:11:24 +00:00
Petr Špaček bd1ad27ff4 Update NSEC3 guidance to match draft-ietf-dnsop-nsec3-guidance-10
https://datatracker.ietf.org/doc/html/draft-ietf-dnsop-nsec3-guidance-10
is on it's way to become RFC, so let's update our recommendations in the
docs to be in line with it.

(cherry picked from commit 2ee3f4e6c8)
2022-06-15 17:57:40 +02:00
Artem Boldariev 63aef08ea2 Merge branch 'artem-client-tls-sessions-reuse-backport-v9_18' into 'v9_18'
[Backport to 9.18]: TLS session resumption support

See merge request isc-projects/bind9!6445
2022-06-15 15:08:11 +00:00
Artem Boldariev b3490213eb CID 352848: split xfrin_start() and remove dead code
This commit separates TLS context creation code from xfrin_start() as
it has become too large and hard to follow into a new
function (similarly how it is done in dighost.c)

The dead code has been removed from the cleanup section of the TLS
creation code:

* there is no way 'tlsctx' can equal 'found';
* there is no way 'sess_cache' can be non-NULL in the cleanup section.

Also, it fixes a bug in the older version of the code, where TLS
client session context fetched from the cache would not get passed to
isc_nm_tlsdnsconnect().

(cherry picked from commit 98f758ed4f)
2022-06-15 17:02:45 +03:00
Artem Boldariev a954eacbac CID 352849: refactor get_create_tls_context() within dighost.c
This commit removes dead code from cleanup handling part of the
get_create_tls_context().

In particular, currently:

* there is no way 'found_ctx' might equal 'ctx';
* there is no way 'session_cache' might equal a non-NULL value while
cleaning up after a TLS initialisation error.

(cherry picked from commit 095b608412)
2022-06-15 17:02:45 +03:00
Artem Boldariev 334eeef5a1 Do not provide a shim for SSL_SESSION_is_resumable()
The recently added TLS client session cache used
SSL_SESSION_is_resumable() to avoid polluting the cache with
non-resumable sessions. However, it turned out that we cannot provide
a shim for this function across the whole range of OpenSSL versions
due to the fact that OpenSSL 1.1.0 does uses opaque pointers for
SSL_SESSION objects.

The commit replaces the shim for SSL_SESSION_is_resumable() with a non
public approximation of it on systems shipped with OpenSSL 1.1.0. It
is not turned into a proper shim because it does not fully emulate the
behaviour of SSL_SESSION_is_resumable(), but in our case it is good
enough, as it still helps to protect the cache from pollution.

For systems shipped with OpenSSL 1.0.X and derivatives (e.g. older
versions of LibreSSL), the provided replacement perfectly mimics the
function it is intended to replace.

(cherry picked from commit 40be3c9263)
2022-06-15 17:02:45 +03:00
Artem Boldariev 7bd5f4972f Dig: Do not call isc_nm_cancelread() for HTTP sockets
This commit ensures that isc_nm_cancelread() is not called from within
dig code for HTTP sockets, as these lack its implementation.

It does not have much sense to have it due to transactional nature of
HTTP.

Every HTTP request-response pair is represented by a virtual socket,
where read callback is called only when full DNS message is received
or when an error code is being passed there. That is, there is nothing
to cancel at the time of the call.

(cherry picked from commit 90c52ca12b)
2022-06-15 17:02:45 +03:00
Artem Boldariev 0cec9cca37 Fix an abort in DoH (client-side) when writing on closing sock
The commit fixes a corner case in client-side DoH code, when a write
attempt is done on a closing socket (session).

The change ensures that the write call-back will be called with a
proper error code (see failed_send_cb() call in client_httpsend()).

(cherry picked from commit 9abb00bb5f)
2022-06-15 17:02:45 +03:00
Artem Boldariev cb6591f277 Avoid aborting when uv_timer_start() is used on a closing socket
In such a case it will return UV_EINVAL (-EINVAL), leading to
aborting, as the code expects the function to succeed.

(cherry picked from commit 245f7cec2e)
2022-06-15 17:02:45 +03:00
Artem Boldariev 3393ec19c2 Modify CHANGES
Mention that TLS session resumption is now fully supported in the
client side code.

(cherry picked from commit aa8c258fba)
2022-06-15 17:02:45 +03:00
Artem Boldariev 5154bac7c5 Add SSL_SESSION_is_resumable() implementation shim
This commit adds SSL_SESSION_is_resumable() implementation if it is
missing.

(cherry picked from commit 35338b4105)
2022-06-15 17:02:45 +03:00
Artem Boldariev e02284354a DoT: implement TLS client session resumption
This commit extends DoT code with TLS client session resumption
support implemented on top of the TLS client session cache.

(cherry picked from commit 86465c1dac)
2022-06-15 17:02:45 +03:00
Artem Boldariev 0a4a76ff7a TLS stream/DoH: implement TLS client session resumption
This commit extends TLS stream code and DoH code with TLS client
session resumption support implemented on top of the TLS client
session cache.

(cherry picked from commit 90bc13a5d5)
2022-06-15 17:02:45 +03:00
Artem Boldariev 6ec48f1e78 Extend TLS context cache with TLS client session cache
This commit extends TLS context cache with TLS client session cache so
that an associated session cache can be stored alongside the TLS
context within the context cache.

(cherry picked from commit 987892d113)
2022-06-15 17:02:45 +03:00
Artem Boldariev 7c8d76c458 Add TLS client session cache implementation
This commit adds an implementation of a client TLS session cache. TLS
client session cache is an object which allows efficient storing and
retrieval of previously saved TLS sessions so that they can be
resumed. This object is supposed to be a foundation for implementing
TLS session resumption - a standard technique to reduce the cost of
re-establishing a connection to the remote server endpoint.

OpenSSL does server-side TLS session caching transparently by
default. However, on the client-side, a TLS session to resume must be
manually specified when establishing the TLS connection. The TLS
client session cache is precisely the foundation for that.

(cherry picked from commit 4ef40988f3)
2022-06-15 17:02:45 +03:00
Michał Kępień 64fcf1e464 Merge tag 'v9_18_4' into v9_18
BIND 9.18.4
2022-06-15 15:58:14 +02:00
Artem Boldariev 8cea314705 Merge branch 'artem-tlsdns-do-not-call-acceptcb-twice-v9_18' into 'v9_18'
[Backport to 9.18] TLS DNS: do not call accept callback twice

See merge request isc-projects/bind9!6440
2022-06-15 13:40:30 +00:00
Artem Boldariev 9b320b1682 TLS DNS: do not call accept callback twice
Before the changes from this commit were introduced, the accept
callback function will get called twice when accepting connection
during two of these stages:

* when accepting the TCP connection;
* when handshake has completed.

That is clearly an error, as it should have been called only once. As
far as I understand it the mistake is a result of TLS DNS transport
being essentially a fork of TCP transport, where calling the accept
callback immediately after accepting TCP connection makes sense.

This commit fixes this mistake. It did not have any very serious
consequences because in BIND the accept callback only checks an ACL
and updates stats.

(cherry picked from commit e616d7f240)
2022-06-15 15:32:49 +03:00
Petr Špaček b0ac324a02 Merge branch 'pspacek/doc-cleanup-dnssec-prereq-v9_18' into 'v9_18'
Update intro texts in the DNSSEC Guide [v9_18]

See merge request isc-projects/bind9!6434
2022-06-14 16:24:18 +00:00
Petr Špaček d1d5531c6a Update FAQ in the DNSSEC Guide
Mention DoT/DoH, update stats, remove mentions of early stages of
deployment.

(cherry picked from commit fd3a2c7854)
2022-06-14 18:20:50 +02:00
Petr Špaček a04d6200e0 Update Authoritative Server Hardware requirements in DNSSEC Guide
Based on measurements done on BIND v9_19_2 using bank. TLD and a
synthetitc fullly signed zone, using RSASHA256 and ECDSAP256SHA256
algorithms with NSEC and NSEC3 without opt-out.

(cherry picked from commit 635885afe6)
2022-06-14 18:20:50 +02:00
Petr Špaček 08a5f5cea2 Update DNSSEC validation deployment stats in DNSSEC Guide
(cherry picked from commit 832c172985)
2022-06-14 18:20:50 +02:00
Petr Špaček 8961105b98 Rewrite Recursive Server Hardware requirements in DNSSEC Guide
This section was completely out of date. Current measurements on dataset
Telco EU 2022-02 and BIND 9.19.1 indicate absolutely different results
than described in the old version of the text.

(cherry picked from commit 6cf8066b9c)
2022-06-14 18:20:50 +02:00
Petr Špaček a85d0286a9 Remove outdated software requirements from DNSSEC Guide
Guide in this repo is tied to latest version anyway, so let's not even
mention ancient versions of BIND.

This also solves the OpenSSL question because it is now mandatory for
build, which subsequently removes the entropy problem - so let's not
mention it either.

(cherry picked from commit 6e79877759)
2022-06-14 18:20:50 +02:00
Arаm Sаrgsyаn 2d85fda569 Merge branch '3401-race-condition-in-route_connected-v9_18' into 'v9_18'
[v9_18] Resolve "race condition in route_connected() leads to crash on startup/shutdown"

See merge request isc-projects/bind9!6433
2022-06-14 15:55:46 +00:00
Aram Sargsyan 7d5ec4b6a5 Add CHANGES note for [GL #3401]
(cherry picked from commit 4b0e7e41fc)
2022-06-14 14:57:32 +00:00
Aram Sargsyan 12aefe6ced Fix a race condition between shutdown and route_connected()
When shutting down, the interface manager can be destroyed
before the `route_connected()` callback is called, which is
unexpected for the latter and can cause a crash.

Move the interface manager attachment code from the callback
to the place before the callback is registered using
`isc_nm_routeconnect()` function, which will make sure that
the interface manager will live at least until the callback
is called.

Make sure to detach the interface manager if the
`isc_nm_routeconnect()` function is not implemented, or when
the callback is called with a result value which differs from
`ISC_R_SUCCESS`.

(cherry picked from commit f6e729635f)
2022-06-14 14:57:23 +00:00
Aram Sargsyan e92b261235 Do not use the interface manager until it is ready
The `ns_interfacemgr_create()` function, when calling
`isc_nm_routeconnect()`, uses the newly created `ns_interfacemgr_t`
instance before initializing its reference count and the magic value.

Defer the `isc_nm_routeconnect()` call until the initializations
are complete.

(cherry picked from commit 1d93fe973b)
2022-06-14 14:55:57 +00:00
Arаm Sаrgsyаn e781c394d8 Merge branch '3207-dig-nssearch-crash-fix-v9_18' into 'v9_18'
[v9_18]  Resolve "dig +nssearch org crashes when network is unreachable"

See merge request isc-projects/bind9!6432
2022-06-14 14:51:16 +00:00
Aram Sargsyan cb25d5b80d Add CHANGES note for [GL #3207]
(cherry picked from commit 0450c9bd32)
2022-06-14 13:22:39 +00:00
Aram Sargsyan 7917e1866a Fix a crash in dig NS search mode
In special NS search mode, after the initial lookup, dig starts the
followup lookup with discovered NS servers in the queries list. If one
of those queries then fail, dig, as usual, tries to start the next query
in the list, which results in a crash, because the NS search mode is
special in a way that the queries are running in parallel, so the next
query is usually already started.

Apply some special logic in `recv_done()` function to deal with the
described situation when handling the query result for the NS search
mode. Particularly, print a warning message for the failed query,
and do not try to start the next query in the list. Also, set a non-zero
exit code if all the queries in the followup lookup fail.

(cherry picked from commit 1290863c22)
2022-06-14 13:21:47 +00:00
Michal Nowak 74ca068877 Merge branch '3138-capture-scripts-to-coverity-scan-v9_18' into 'v9_18'
[v9_18] Capture scripts for Coverity Scan analysis

See merge request isc-projects/bind9!6430
2022-06-14 12:24:17 +00:00
Michal Nowak e1a463e98d Capture scripts for Coverity Scan analysis
With the recent Coverity Scan 2021.12 version, Python 3 scripts are
being analyzed in addition to C files. The --fs-capture-search option
scripts for Coverity Scan analysis should be added to leverage this
feature.

(cherry picked from commit b4a2674d98)
2022-06-14 14:19:26 +02:00
Michal Nowak bed115211e Download Coverity Scan analysis tool to /tmp
Downloading and unpacking Coverity Scan analysis tool tarball
(cov-analysis-linux64.tgz) to $CI_PROJECT_DIR interferes with the
execution of the analysis tool when the --fs-capture-search option is
used because the tool starts to analyze some of its Javascript files.
(There's the --fs-capture-search-exclude-regex <path> option, but I
failed to find a way to make it work.)

(cherry picked from commit 1333bdf67e)
2022-06-14 14:19:21 +02:00
Michal Nowak 36780e07f6 Drop coverity cache feature
The coverity CI job cache feature is used to ensure that the 1 GB
cov-analysis-linux64.tgz file is being cached on GitLab CI runner, where
it was downloaded in the past. This feature does not seem to work
anymore; given that the proper solution to creating distributed cache is
complicated, better to drop the feature altogether.

(cherry picked from commit c966304e90)
2022-06-14 14:19:17 +02:00
Petr Špaček 5cc296bfb2 Merge branch 'pspacek/dnssec-guide-keymgr-removal-v9_18' into 'v9_18'
Remove description of dnssec-keymgr from DNSSEC Guide [v9_18]

See merge request isc-projects/bind9!6428
2022-06-14 11:32:57 +00:00
Petr Špaček 782f3b6845 Remove description of dnssec-keygmr from DNSSEC Guide
dnssec-keymgr is not included in the distribution since BIND 9.17 so
there is no point in keeping usage instructions around.

(cherry picked from commit 0e1306374e)
2022-06-14 13:12:59 +02:00
Ondřej Surý f5405826f1 Merge branch '3400-gracefully-handle-the-errors-from-uv_start_read-v9_18' into 'v9_18'
Gracefully handle uv_read_start() failures [v9.18]

See merge request isc-projects/bind9!6426
2022-06-14 10:41:27 +00:00
Ondřej Surý e644acbfae Add CHANGES and release note for [GL #3400]
(cherry picked from commit 646df5cbbc)
2022-06-14 11:54:11 +02:00
Ondřej Surý 579270509f Gracefully handle uv_read_start() failures
Under specific rare timing circumstances the uv_read_start() could
fail with UV_EINVAL when the connection is reset between the connect (or
accept) and the uv_read_start() call on the nmworker loop.  Handle such
situation gracefully by propagating the errors from uv_read_start() into
upper layers, so the socket can be internally closed().

(cherry picked from commit b432d5d3bc)
2022-06-14 11:54:11 +02:00
Michal Nowak d3658fcb6f Merge branch 'mnowak/fix-statistics-system-test-on-ol7-v9_18' into 'v9_18'
[v9_18] Fix statistics system test on Oracle Linux 7

See merge request isc-projects/bind9!6425
2022-06-14 08:10:15 +00:00
Michal Nowak 152343e221 Fix statistics system test on Oracle Linux 7
The statistics system test fails on Oracle Linux 7 when libxml2, Curl,
and xsltproc are present:

    I:statistics:checking bind9.xsl vs xml (17)
    diff: curl.out.17.xsl: No such file or directory
    tests.sh: line 183: curl.out.17.xml: No such file or directory
    cp: cannot stat 'curl.out.17.xml': No such file or directory
    grep: xsltproc.out.17: No such file or directory

This is because the Oracle Linux 7 Curl does not know about the
--http1.1 option and silently fails with:

    + /usr/bin/curl --http1.1 http://10.53.0.3:7252
    curl: option --http1.1: is unknown
    curl: try 'curl --help' or 'curl --manual' for more information

The following test "checking bind9.xml socket statistics" then needs to
check for existence of stats.xml.out file which is artifact of the
previous test.

(cherry picked from commit 49cb896929)
2022-06-14 09:42:02 +02:00
Petr Špaček 6234936395 Merge branch '3395-dnssec-signzone-default-0-iterations-v9_18' into 'v9_18'
Set default number of additional NSEC3 iterations to 0 in dnssec-signzone [v9_18]

See merge request isc-projects/bind9!6423
2022-06-14 07:33:52 +00:00
Petr Špaček 47c214644b Set default number of additional NSEC3 iterations to 0 in dnssec-signzone
We forgot to update dnssec-signzone while updating KASP defaults.

Closes: #3395
Related: #2956
(cherry picked from commit d029d6374d)
2022-06-14 09:08:07 +02:00
Mark Andrews 0590dd43c7 Merge branch 'typo-in-log-on-update-forward-opcode-mismatch-v9_18' into 'v9_18'
corrected the opcode param to opcode_totext

See merge request isc-projects/bind9!6421
2022-06-14 02:57:34 +00:00
Mark Andrews 2a4bdcd8a3 Add CHANGES note for [GL !6420]
(cherry picked from commit bd508194be)
2022-06-14 12:07:21 +10:00
JINMEI TatuyaandMark Andrews 5068ee73d6 make the fix more complete
(cherry picked from commit a58647df6a)
2022-06-14 12:06:54 +10:00
JINMEI TatuyaandMark Andrews 430a52883d corrected the opcode param to opcode_totext
(cherry picked from commit 2b81a69659)
2022-06-14 12:06:54 +10:00
Petr Špaček f64cbe3086 Merge branch 'pspacek/keyfromlabel-doc-alg-clarif-v9_18' into 'v9_18'
Clarify dnssec-keyfromlabel -a in man page [v9_18]

See merge request isc-projects/bind9!6414
2022-06-10 05:59:05 +00:00
Petr Špaček 4630d50f83 Clarify dnssec-keyfromlabel -a in man page
(cherry picked from commit 5f53003dae)
2022-06-10 07:55:12 +02:00
Petr Špaček 87ec530daa Merge branch 'pspacek/arm-statement-syntax-v9_18' into 'v9_18'
Add Sphinx extension to help with ARM maintenance and cross-linking [v9_18]

See merge request isc-projects/bind9!6411
2022-06-09 12:59:40 +00:00
Petr Špaček e949ac7bbc Add tag filter to .. statementlist:: RST directive
Introduce a new syntax:
.. namedconf:statementlist::
   :filter_tags: acl, resolver

The resulting table contains only items tagged as acl OR resolver.

(cherry picked from commit 33931c97fa)
2022-06-09 14:56:21 +02:00
Petr Špaček ed4634c5a4 Warn about duplicate .. statement:: definitions
(cherry picked from commit ff577462f9)
2022-06-09 14:56:21 +02:00
Petr Špaček 0078fa1058 Refactor and unite internal data structures for iscconf Sphinx extension
It turns out it is easier to regenerate Sphinx-mandated structure in
get_objects than to maintain two separate data structures. I should have
realized that before.

(cherry picked from commit 2f2aa1d21c)
2022-06-09 14:56:21 +02:00
Petr Špaček 851b513e45 Render optional statement metadata in the ARM
Optional values :short: and :tags: are now rendered right after the
statement heading.

(cherry picked from commit 475f7a9603)
2022-06-09 14:56:21 +02:00
Petr Špaček 90ced1c6a8 Add table generator into Sphinx config extension
New directive .. statementlist:: generates table of statements in a
the given domain (named.conf or rndc.conf). The table contains link to
definition, short description, and also list of tags.
Short description and tags have to be provided by user using optional
parameters. E.g.:

.. statement:: max-cache-size
   :tags: resolver, cache
   :short: Short description

.. statementlist:: is currently not parametrized.

This modification is based on Sphinx "tutorial" extension "TODO".
The main trick is to use placeholder node for .. statementlist:: and
replace it with table at later stage, when all source files were
processed and all cross-references can be resolved.

Beware, some details in Sphinx docs are not up-to-date, it's better
to read Sphinx and docutil sources.

(cherry picked from commit 976aef030a)
2022-06-09 14:56:21 +02:00
Petr Špaček 5919415e4a Extend .. statement:: directive with optional values
New and currently unused values can be provided using this syntax:

.. statement:: max-cache-size
   :tags: resolver, cache
   :short: Short description

The domain stores them in its internal structures for further use.

(cherry picked from commit b12606cebe)
2022-06-09 14:56:20 +02:00
Petr Špaček 29d78932ea Add Sphinx extension to help with ARM maintenance and cross-linking
The extension provides a "Sphinx domain factory". Each new Sphinx domain
defines a namespace for configuration statements so named.conf and
rndc.conf do not clash. Currently the Sphinx domains are instantiated
twice and resuling domains are named "namedconf" and "rndcconf".

This commit adds a single new directive:

.. statement:: max-cache-size

It is namespaced like this:

.. namedconf:statement:: max-cache-size

This directive generates a new anchor for configuration statement and it
can be referenced like :any:`max-cache-size` (if the identifier is
unique), or more specific :namedconf:ref:`max-cache-size`.

It is based on Sphinx "tutorial" extension "recipe".
Beware, some details in Sphinx docs are not up-to-date, it's better
to read Sphinx and docutil sources.

(cherry picked from commit a23fa7edc9)
2022-06-09 14:56:15 +02:00
Arаm Sаrgsyаn 130d54476e Merge branch '2506-catz-member-zone-vs-configured-forward-zone-v9_18' into 'v9_18'
[v9_18] Check that catz member zone is not a configured forward zone

See merge request isc-projects/bind9!6409
2022-06-09 12:38:21 +00:00
Aram Sargsyan 8e8b44649f Cleanup dns_fwdtable_delete()
The conversion of `DNS_R_PARTIALMATCH` into `DNS_R_NOTFOUND` is done
in the `dns_rbt_deletename()` function so there is no need to do that
in `dns_fwdtable_delete()`.

Add a possible return value of `ISC_R_NOSPACE` into the header file's
function description comment.

(cherry picked from commit 887aa7a290)
2022-06-09 10:52:04 +00:00
Aram Sargsyan b870d52970 Add CHANGES and release note for [GL #2506]
(cherry picked from commit 3191eabbc7)
2022-06-09 10:51:45 +00:00
Aram Sargsyan 56cc6545dc Add forward zone checks in the catz system test
Add a new test to check that a catalog zone member zone does not
get processed when there is a pre-existing forward zone with that
same name.

(cherry picked from commit b27969ee0b)
2022-06-09 10:50:48 +00:00
Aram Sargsyan 1626f61815 Convert some catz error messages from ISC_LOG_INFO to ISC_LOG_WARNING
There is no reason for these two messages to be `ISC_LOG_INFO` while all
the other similar messages in `catz_addmodzone_taskaction()` and
`catz_delzone_taskaction()` functions are logged as `ISC_LOG_WARNING`.

(cherry picked from commit 8156c46bd2)
2022-06-09 10:50:41 +00:00
Aram Sargsyan 475e790e03 Check that catz member zone is not a configured forward zone
When processing a catalog zone member zone make sure that there is no
configured pre-existing forward zone with that name.

Refactor the `dns_fwdtable_find()` function to not alter the
`DNS_R_PARTIALMATCH` result (coming from `dns_rbt_findname()`) into
`DNS_R_SUCCESS`, so that now the caller can differentiate partial
and exact matches. Patch the calling sites to expect and process
the new return value.

(cherry picked from commit 2aff264fb1)
2022-06-09 10:50:32 +00:00
Tom Krizek ea1744b55e Merge branch 'tkrizek/python-codestyle-v9_18' into 'v9_18'
Enforce Python codestyle with black [v9_18]

See merge request isc-projects/bind9!6405
2022-06-08 12:03:35 +00:00
Tom Krizek 3f902ea9a8 Move pylint CI job to precheck stage
Historically, some *.py files were generated, so Python checks required
running ./configure beforehand. This is no longer the case since v9_18,
so let's run the job ASAP without the unnecessary extra dependency on
autoconf job.

(cherry picked from commit c2275d9f6e)
2022-06-08 13:18:27 +02:00
Tom Krizek 2a2b939f1f Remove flake8 linter for Python from CI
Python codestyle is now handled by black and other issues are checked by
pylint. Flake8 checking has been made redundant and is thus removed as
obsolete.

(cherry picked from commit dae340a4a5)
2022-06-08 13:18:27 +02:00
Tom Krizek e4bb3c3637 Auto-format Python files with black
This patch is strictly the result of:
$ black $(git ls-files '*.py')

There have been no manual changes.

(cherry picked from commit c9cb8ae9eb)
2022-06-08 13:18:27 +02:00
Tom Krizek 1af7372fc0 Enforce Python codestyle with black
Black is an opinionated tool for auto-formatting Python code so we no
longer have to worry about the codestyle.

For the codestyle decisions and discussion, refer to the upstream
documentation [1].

[1] https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html

(cherry picked from commit 5d2b7cab08)
2022-06-08 13:18:27 +02:00
Tom Krizek d73ede61f6 Remove trailing whitespace
My editor doesn't like that!

(cherry picked from commit 5d64d05be9)
2022-06-08 13:18:27 +02:00
Matthijs Mekking 885199c807 Merge branch '3362-kasp-system-test-timing-issue-v9_18' into 'v9_18'
[v9_18] Fix another kasp test timing issue

See merge request isc-projects/bind9!6400
2022-06-07 09:22:47 +00:00
Matthijs Mekking 2174c566ff Retry quiet to deal with kasp test timing issue
In the cases where we test SOA serial updates and TTL updates, we check
if for "all zones loaded" to ensure the new zone content is loaded. But
this is the unsigned zone, the signed zone still needs to be produced.

There is thus a timing issue where the dig request comes in before
the signing process has finished.

Add a retry quiet to mitigate against it.

(cherry picked from commit 827bba05a0)
2022-06-07 09:35:40 +02:00
Petr Špaček b442b9521b Merge branch 'pspacek/danger-log-level-v9_18' into 'v9_18'
Flag new user-visible log messages for manual review [v9_18]

See merge request isc-projects/bind9!6392
2022-06-03 10:12:24 +00:00
Petr Špaček e716e51296 Flag new user-visible log messages for review
Messages with log levels INFO or higher are flagged for manual review.
Purpose of this check is to prevent debug logs to being released with
too-high log level.

(cherry picked from commit b0f59cb5cb)
2022-06-03 12:11:29 +02:00
Michał Kępień b020a19563 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.5' into 'v9_18'
Set up version and release notes for BIND 9.18.5

See merge request isc-projects/bind9!6390
2022-06-03 09:27:03 +00:00
Michał Kępień 05a320b476 Set up release notes for BIND 9.18.5 2022-06-03 11:03:26 +02:00
Michał Kępień cb817234b2 Update BIND version to 9.18.5-dev 2022-06-03 11:03:26 +02:00
Michał Kępień 727d0d68d8 Update BIND 9 version for release 2022-06-02 21:06:44 +02:00
Michał Kępień 93a8f1766e Add a CHANGES marker 2022-06-02 21:06:44 +02:00
Michał Kępień 8c7809e840 Merge branch 'michal/prepare-documentation-for-bind-9.18.4' into 'v9_18_4-release'
Prepare documentation for BIND 9.18.4

See merge request isc-private/bind9!407
2022-06-02 19:05:30 +00:00
Michał Kępień 9a36774aee Add release note for GL #3327 2022-06-02 20:43:07 +02:00
Michał Kępień f353ea526b Reorder release notes 2022-06-02 20:43:07 +02:00
Michał Kępień 71d315a461 Tweak and reword release notes 2022-06-02 20:43:07 +02:00
Michał Kępień 16006e959f Prepare release notes for BIND 9.18.4 2022-06-02 20:43:07 +02:00
Petr Špaček e9ceb03db9 Merge branch 'pspacek/rtd-style-changes-v9_18' into 'v9_18'
ReadTheDocs style changes [v9_18]

See merge request isc-projects/bind9!6386
2022-06-02 15:27:08 +00:00
Petr Špaček 58a7e19c59 ARM style change: render literals in black color
After enormous amount of bikesheding about colors we decided to override
ReadTheDocs default style for literals (``literal`` in the RST markup).

Justification:
- The default RTD "light red literal on white background" is hard to
  read.  https://webaim.org/resources/contrastchecker/ reports that text
  colored as rgb(231, 76, 60) on white background has insufficient
  contrast.
- The ARM has enormous amount of literals all over the place and thus
  one sentence can contain several black/red/black color changes. This
  is distracting. As a consequence, the ARM looks like a Geronimo
  Stilton book.

What we experimented with as replacements for red:
- Green - way too distracting
- Blue - too similar to "usual clickable link"
- Violet - too Geronimo Stilton style
- Brown - better but still distracting

After all the bikesheding we settled on black, i.e. the same as all
"normal" text. I.e. the color is now the same and literals are denoted
by monospaced font and a box around the literal. This has best contrast
and is way less distracting than it used to be.

This lead to a new problem: Internal references to "term definitions"
defined using directives like .. option:: were rendered almost the same
as literals:
- References: monospaced + box + bold + clickable
- Literals: monospaced + box To distinguish these two we added black
  dotted underline to clickable references.

I hereby declare the bikeshed painted.

(cherry picked from commit 833af31e7b)
2022-06-02 17:23:31 +02:00
Petr Špaček 15f1517727 Allow wrapping for ARM table content
RTD style default never wraps <th> and <td> elements and that just does
not work for real sentences or any other long lines.

We can reconsider styling some tables separately, but at the moment we
do not have use for tables with long but unwrappable lines so it's
easier to allow wrapping globally.

(cherry picked from commit a5dd98ac1b)
2022-06-02 17:23:27 +02:00
Arаm Sаrgsyаn 8bef862607 Merge branch 'aram/catz-processing-skip-warnings-for-some-rrset-types-v9_18' into 'v9_18'
[v9_18] Don't process DNSSEC-related and ZONEMD records in catz

See merge request isc-projects/bind9!6383
2022-06-02 10:56:24 +00:00
Aram Sargsyan ee7d54164e Add CHANGES and release note for [GL #3380]
(cherry picked from commit b8073cbe72)
2022-06-02 10:21:35 +00:00
Aram Sargsyan 1355fc6a04 Don't process DNSSEC-related and ZONEMD records in catz
When processing a catalog zone update, skip processing records with
DNSSEC-related and ZONEMD types, because we are not interested in them
in the context of a catalog zone, and processing them will fail and
produce an unnecessary warning message.

(cherry picked from commit 73d6643137)
2022-06-02 10:20:11 +00:00
Mark Andrews 58760fb7d5 Merge branch '3388-missing-indent-call-v9_18' into 'v9_18'
Add missing INDENT call for UPDATE messages [v9_18]

See merge request isc-projects/bind9!6380
2022-06-01 22:50:59 +00:00
Mark Andrews 7d14346e5f Add missing INDENT call for UPDATE messages
Reported by Peter <pmc@citylink.dinoex.sub.org> on bind-users.

(cherry picked from commit 03132c93ca)
2022-06-02 08:28:15 +10:00
Ondřej Surý 81ac722b24 Merge branch 'fanf-tests-build-deps-v9_18' into 'v9_18'
Add missing CFLAGS and LDADD to unit tests [v9.18]

See merge request isc-projects/bind9!6378
2022-06-01 16:51:18 +00:00
Ondřej Surý 33057fc891 Properly adjust the srcdir vs builddir paths
Affected unit tests load testdata from the srcdir.  Previously, there
was a kludge that chdir()ed to the tests srcdir, but that get removed
during refactoring.  Instead of introducing the kludge again, the paths
were fixed to be properly prefixed with TESTS_DIR as needed.

(cherry picked from commit 16595cdde0)
2022-06-01 17:45:34 +02:00
Ondřej Surý c4fd0c3e4b Don't list libtest.la headers in HEADERS variable
The libtest.la headers were installed in very weird place, in fact, we
don't need to list them in the HEADERS variable, listing them in SOURCES
is enough for autotools to figure out how to compile the convenience
library.

(cherry picked from commit 714fe2f617)
2022-06-01 17:45:34 +02:00
Ondřej Surý 36184beb10 Fix the path to tsan files in the tsan unit test job
The tsan unit test job still referenced lib/*/tests/tsan.*, change this
to the correct tests/*/tsan.*.

(cherry picked from commit 90f0a765d8)
2022-06-01 17:45:34 +02:00
Ondřej Surý 1cc234f5d8 Add tests/isc/uv_wrap.h to Makefile.am
The automake was missing reference to uv_wrap.h, so it was not added to
the distribution.  Add uv_wrap.h to SOURCES for both doh and netmgr unit
tests.

(cherry picked from commit dec845017b)
2022-06-01 17:45:34 +02:00
Tony FinchandOndřej Surý 3ae606932d Add missing CFLAGS and LDADD to unit tests
A number of unit tests needed to be told where to find their libraries
and matching headers.

(cherry picked from commit 24d420f20b)
2022-06-01 17:45:34 +02:00
Arаm Sаrgsyаn 1d8689f936 Merge branch 'aram/update-top-level-gitignore-add-ide-files-v9_18' into 'v9_18'
[v9_18] Update top-level .gitignore to ignore files generated by some IDEs

See merge request isc-projects/bind9!6374
2022-06-01 11:41:00 +00:00
Aram Sargsyan aab7ed38a8 Update top-level .gitignore to ignore files generated by some IDEs
(cherry picked from commit ec3bc4142b)
2022-06-01 10:21:26 +00:00
Mark Andrews a6456581ce Merge branch '3345-fix-keyless-example-generation-v9_18' into 'v9_18'
Make modifications to keyless.example deterministic

See merge request isc-projects/bind9!6370
2022-06-01 01:08:35 +00:00
Mark Andrews 23c46338ef Make modifications to keyless.example deterministic
The perl modifation code for keyless.example was not deterministic
(/NXT/ matched part of signature) resulting in different error
strings being returned.  Replaced /NXT/ with /A RRSIG NSEC/ and
updated expected error string,

(cherry picked from commit 69d5e22e58)
2022-06-01 10:42:44 +10:00
Matthijs Mekking ca0faba3fd Merge branch '1611-detect-insane-dnssec-policies-v9_18' into 'v9_18'
[v9_18] Add some dnssec-policy configuration checks

See merge request isc-projects/bind9!6367
2022-05-31 15:59:56 +00:00
Matthijs Mekking 42711dae88 Only log "new successor in ..." if prepub != 0
If 'prepub' is 0, this has the special meaning that no rollover is
scheduled. If so, don't log "new successor in x seconds".

(cherry picked from commit 955a69109e)
2022-05-31 17:17:05 +02:00
Matthijs Mekking c18dce4c49 Add CHANGE and release note for #1611
Feature change.

(cherry picked from commit 92f98002e7)
2022-05-31 17:16:59 +02:00
Matthijs Mekking 3cfbe31176 Error if key lifetime is too short
The key lifetime should not be shorter than the time it costs to
introduce the successor key, otherwise keys will be created faster than
they are removed, resulting in a large key set.

The time it takes to replace a key is determined by the publication
interval (Ipub) of the successor key and the retire interval of the
predecessor key (Iret).

For the ZSK, Ipub is the sum of the DNSKEY TTL and zone propagation
delay (and publish safety). Iret is the sum of Dsgn, the maximum zone
TTL and zone propagation delay (and retire safety). The sign delay is
the signature validity period minus the refresh interval: The time to
ensure that all existing RRsets have been re-signed with the new key.
The ZSK lifetime should be larger than both values.

For the KSK, Ipub is the sum of the DNSKEY TTL and zone propagation
delay (and publish safety). Iret is the sum of the DS TTL and parent
zone propagation delay (and retire safety). The KSK lifetime should be
larger than both values.

(cherry picked from commit 8134d46cdb)
2022-05-31 17:16:53 +02:00
Matthijs Mekking 2036a8b161 Update signatures-refresh documentation
Mention in the ARM the new restriction about signatures-refresh.

(cherry picked from commit 74d2e7704f)
2022-05-31 17:16:46 +02:00
Matthijs Mekking 46636b8563 Error if signatures-refresh is too high
The signatures-refresh should not near the signatures-validity value,
to prevent operational instability. Same is true when checking against
signatures-validity-dnskey.

(cherry picked from commit 82fd89107f)
2022-05-31 17:16:40 +02:00
Matthijs Mekking b32a39dd27 Warn if key lifetime is short
Log a warning if the key lifetime is less than 30 days.

(cherry picked from commit e7322e8f78)
2022-05-31 17:16:35 +02:00
Matthijs Mekking 58690ec11c Warn if multiple keys have same role
If a dnssec-policy has multiple keys configured with the
same algorithm and role.

(cherry picked from commit f54dad005e)
2022-05-31 17:16:29 +02:00
Matthijs Mekking 125cad030b Merge branch '3341-servestale-extendederrors-test-failure-v9_18' into 'v9_18'
[v9_18] Tweak timings in serve-stale system test

See merge request isc-projects/bind9!6350
2022-05-31 14:27:39 +00:00
Matthijs Mekking 659804eab0 Tweak timings in serve-stale system test
Give a little bit more time if we wait on a time out from the
authoritative (aka resolver failure), and give up after one try
(because the second attempt will likely result in a different EDE).

(cherry picked from commit f764cee136)
2022-05-31 13:51:51 +00:00
Ondřej Surý 178442f735 Merge branch 'ondrej-unit-tests-refactoring-v9_18' into 'v9_18'
Give the unit tests a big overhaul [v9.18]

See merge request isc-projects/bind9!6366
2022-05-31 10:31:58 +00:00
Ondřej Surý 45584af257 Add CHANGES note for [GL !6243]
(cherry picked from commit cd1f9c3d36)
2022-05-31 12:06:00 +02:00
Evan HuntandOndřej Surý a0bf5ab2c5 Exclude unit tests from gcov
Modify the .gitlab-ci.yml to match the previous lib/.*/tests/.* pattern
for excluding the unit tests from the gcov.

(cherry picked from commit 2321cab4ee)
2022-05-31 12:06:00 +02:00
Evan HuntandOndřej Surý a67ba6e0b9 Stop the unit tests from running twice
Move the libtest code into a 'libtest' subdirectory and make it
one of the SUBDIRS in the tests Makefile. having it at the top level
required having "." as one of the subdirs, and that caused the
unit tests to be executed twice.

(cherry picked from commit 568f65cc56)
2022-05-31 12:06:00 +02:00
Ondřej Surý f128a9bcf2 Move all the unit tests to /tests/<libname>/
The unit tests are now using a common base, which means that
lib/dns/tests/ code now has to include lib/isc/include/isc/test.h and
link with lib/isc/test.c and lib/ns/tests has to include both libisc and
libdns parts.

Instead of cross-linking code between the directories, move the
/lib/<foo>/test.c to /tests/<foo>.c and /lib/<foo>/include/<foo>test.h
to /tests/include/tests/<foo>.h and create a single libtest.la
convenience library in /tests/.

At the same time, move the /lib/<foo>/tests/ to /tests/<foo>/ (but keep
it symlinked to the old location) and adjust paths accordingly.  In few
places, we are now using absolute paths instead of relative paths,
because the directory level has changed.  By moving the directories
under the /tests/ directory, the test-related code is kept in a single
place and we can avoid referencing files between libns->libdns->libisc
which is unhealthy because they live in a separate Makefile-space.

In the future, the /bin/tests/ should be merged to /tests/ and symlink
kept, and the /fuzz/ directory moved to /tests/fuzz/.

(cherry picked from commit 2c3b2dabe9)
2022-05-31 12:06:00 +02:00
Ondřej Surý f0df0d679a Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.

This commit does several things:

1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
   conditionals.

2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
   implementations, test lists, and the main test routine, so we don't
   have to repeat this all over again.  The macros were modeled after
   libuv test suite but adapted to cmocka as the test driver.

   A simple example of a unit test would be:

    ISC_RUN_TEST_IMPL(test1) { assert_true(true); }

    ISC_TEST_LIST_START
    ISC_TEST_ENTRY(test1)
    ISC_TEST_LIST_END

    ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)

   For more complicated examples including group setup and teardown
   functions, and per-test setup and teardown functions.

3. The macros prefix the test functions and cmocka entries, so the name
   of the test can now match the tested function name, and we don't have
   to append `_test` because `run_test_` is automatically prepended to
   the main test function, and `setup_test_` and `teardown_test_` is
   prepended to setup and teardown function.

4. Update all the unit tests to use the new syntax and fix a few bits
   here and there.

5. In the future, we can separate the test declarations and test
   implementations which are going to greatly help with uncluttering the
   bigger unit tests like doh_test and netmgr_test, because the test
   implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
   and `ISC_RUN_TEST_IMPL` for more details.

NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros.  There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.

(cherry picked from commit 63fe9312ff)
2022-05-31 11:34:54 +02:00
Ondřej Surý 5e9c9e3539 Merge branch '2801-unittest-isc-netmgr-s390x-v9_18' into 'v9_18'
Fix failures in isc netmgr_test on big endian machines

See merge request isc-projects/bind9!6353
2022-05-24 18:28:09 +00:00
Petr MenšíkandOndřej Surý d074386ef1 Fix failures in isc netmgr_test on big endian machines
Typing from libuv structure to isc_region_t is not possible, because
their sizes differ on 64 bit architectures. Little endian machines seems
to be lucky and still result in test passed. But big endian machine such
as s390x fails the test reliably.

Fix by directly creating the buffer as isc_region_t and skipping the
type conversion. More readable and still more correct.

(cherry picked from commit 057438cb45)
2022-05-24 20:22:57 +02:00
Tony Finch 44c4ff2d2d Merge branch '3361-dnssec-settime-unset-v9_18' into 'v9_18'
Teach dnssec-settime to read unset times that it writes (backport to v9.18)

See merge request isc-projects/bind9!6349
2022-05-23 14:01:23 +00:00
Tony Finch 84113b237a Teach dnssec-settime to read unset times that it writes
When there is no time in a key file, `dnssec-settime` will print
"UNSET", but to unset a time the user must specify "none" or "never".
This change allows "unset" or "UNSET" as well as "none" or "never".
The "UNSET" output remains the same to avoid compatibility problems
with wrapper scripts.

I have also re-synchronized the "Timing Options" sections of the man
pages.

(cherry picked from commit 4c96efac5c)
2022-05-23 15:15:10 +02:00
Tony Finch 0486bdeae3 Merge branch 'u/fanf2/dnssec-settime-ctime-v9_18' into 'v9_18'
Teach dnssec-settime to read times that it writes

See merge request isc-projects/bind9!6324
2022-05-23 12:58:50 +00:00
Tony FinchandTony Finch fa5d44becf Add CHANGES note for [GL !6324]
(cherry picked from commit fcca62859d)
2022-05-23 13:46:07 +02:00
Tony FinchandTony Finch f84cd02b0c Teach dnssec-settime to read times that it writes
The dnssec-settime -p and -up options print times in asctime() and
UNIX time_t formats, respectively. The asctime() format can also be
found inside K*.key public key files. Key files also contain times in
the YYYYMMDDHHMMSS format that can be used in timing parameter
options.

The dnssec-settime -p and -up time formats are now acceptable in
timing parameter options to dnssec-settime and dnssec-keygen, so it is
no longer necessary to parse key files to retrieve times that are
acceptable in timing parameter options.

(cherry picked from commit c38a323082)
2022-05-23 13:44:50 +02:00
Matthijs Mekking 1b15ff89b5 Merge branch '3354-cid-352776-missing_lock-v9_18' into 'v9_18'
[v9_18] Fix CID 352776: Concurrent data access violations

See merge request isc-projects/bind9!6344
2022-05-23 10:39:43 +00:00
Matthijs Mekking 0ae48af8b2 Require valid key for dst_key functions
Make sure that the key structure is valid when calling the following
functions:
- dst_key_setexternal
- dst_key_isexternal
- dst_key_setmodified
- dst_key_ismodified

(cherry picked from commit 888ec4e0d4)
2022-05-23 12:00:53 +02:00
Matthijs Mekking ca7e3e25c4 Fix CID 352776: Concurrent data access violations
*** CID 352776:  Concurrent data access violations  (MISSING_LOCK)
/lib/dns/dst_api.c: 474 in dst_key_setmodified()
468     dst_key_isexternal(dst_key_t *key) {
469		return (key->external);
470     }
471
472     void
473     dst_key_setmodified(dst_key_t *key, bool value) {
>>>     CID 352776:  Concurrent data access violations  (MISSING_LOCK)
>>>     Accessing "key->modified" without holding lock
>>>	"dst_key.mdlock". Elsewhere, "dst_key.modified" is accessed with
>>>	"dst_key.mdlock" held 8 out of 11 times (8 of these accesses
>>>	strongly imply that it is necessary).
474		key->modified = value;
475     }
476
477     bool
478     dst_key_ismodified(dst_key_t *key) {
479		return (key->modified);

(cherry picked from commit 1fa24d0afb)
2022-05-23 12:00:45 +02:00
Ondřej Surý 18881c15aa Merge branch '3344-threadsanitizer-data-race-in-isc__nm_tcpdns_send-v9_18' into 'v9_18'
Move setting the sock->write_timeout to the async_*send [v9.18]

See merge request isc-projects/bind9!6341
2022-05-19 20:53:11 +00:00
Ondřej Surý eabee4d7d9 Move setting the sock->write_timeout to the async_*send
Setting the sock->write_timeout from the TCP, TCPDNS, and TLSDNS send
functions could lead to (harmless) data race when setting the value for
the first time when the isc_nm_send() function would be called from
thread not-matching the socket we are sending to.  Move the setting the
sock->write_timeout to the matching async function which is always
called from the matching thread.

(cherry picked from commit 61117840c1)
2022-05-19 22:37:52 +02:00
Ondřej Surý acfec1bff0 Merge branch '3371-check-for-__attribute__-fallthrough-support-is-sometimes-incorrect-v9_18' into 'v9_18'
Use C2x [[fallthrough]] when supported by LLVM/clang [v9.18]

See merge request isc-projects/bind9!6339
2022-05-19 20:34:20 +00:00
Ondřej Surý b4521486ed Use C2x [[fallthrough]] when supported by LLVM/clang
Clang added support for the gcc-style fallthrough
attribute (i.e. __attribute__((fallthrough))) in version 10.  However,
__has_attribute(fallthrough) will return 1 in C mode in older versions,
even though they only support the C++11 fallthrough attribute. At best,
the unsupported attribute is simply ignored; at worst, it causes errors.

The C2x fallthrough attribute has the advantages of being supported in
the broadest range of clang versions (added in version 9) and being easy
to check for support. Use C2x [[fallthrough]] attribute if possible, and
fall back to not using an attribute for clang versions that don't have
it.

Courtesy of Joshua Root

(cherry picked from commit 14c8d43863)
2022-05-19 22:01:59 +02:00
Michal Nowak 4dde80f655 Merge tag 'v9_18_3' into v9_18
BIND 9.18.3
2022-05-19 12:07:45 +02:00
Evan Hunt c00545a168 Merge branch '3350-rndc-dnssec-checkds-doc-v9_18' into 'v9_18'
specify time format in the documentation for 'rdnc dnssec -checkds'

See merge request isc-projects/bind9!6331
2022-05-18 22:37:35 +00:00
Evan Hunt dfe196844c specify time format in the documentation for 'rdnc dnssec -checkds'
also clarified the writing in the surrounding paragraph.

(cherry picked from commit 83f9466d61)
2022-05-18 15:30:18 -07:00
Ondřej Surý 98e13fbc09 Merge branch '3366-configure-fails-to-find-uv-h-on-bsd-v9_18' into 'v9_18'
Use libuv CFLAGS and LIBS when checking for features [v9.18]

See merge request isc-projects/bind9!6329
2022-05-18 20:01:50 +00:00
Ondřej Surý a50231adc1 Use libuv CFLAGS and LIBS when checking for features
When autoconf was checking for libuv features, the LIBUV_CFLAGS was not
added to CFLAGS and LIBUV_LIBS to LIBS which resulted in false
negatives.

Use AX_SAVE_FLAGS and AX_RESTORE_FLAGS to temporarily add LIBUV_CFLAGS
and LIBUV_LIBS to their respective variables.

(cherry picked from commit f063ee276e)
2022-05-18 21:22:03 +02:00
Michal Nowak 48012449de Merge branch 'mnowak/fix-typo-in-ednscompliance-test-v9_18' into 'v9_18'
[v9_18] Fix typo in ednscompliance test

See merge request isc-projects/bind9!6327
2022-05-18 17:19:23 +00:00
Michal Nowak 9c8fdec57b Fix typo in ednscompliance test
Caused by ba0313e649, an incomplete fix of
spelling errors.

(cherry picked from commit 9de2c06a21)
2022-05-18 19:16:43 +02:00
Mark Andrews d7fd8faa57 Merge branch '3356-wrong-path-for-geoip-directory-v9_18' into 'v9_18'
Remove extraneous '$' in AS_VAR_COPY([MAXMINDDB_PREFIX], [with_maxminddb])

See merge request isc-projects/bind9!6318
2022-05-17 19:34:40 +00:00
Mark Andrews d6b07d2787 Remove extraneous '$' in AS_VAR_COPY([MAXMINDDB_PREFIX], [with_maxminddb])
(cherry picked from commit 686d691fa9)
2022-05-18 05:03:05 +10:00
Matthijs Mekking d4d516ca89 Merge branch '3352-kasp-test-broken-on-freebsd-v9_18' into 'v9_18'
[v9_18] Fix "kasp test broken on freebsd"

See merge request isc-projects/bind9!6312
2022-05-16 16:38:55 +00:00
Matthijs Mekking 646e00fbb2 Replace stat with PERL stat in kasp system test
7249bad7 introduced the -c option to stat(1) command, but BSD systems
do not know about it. Replace the stat(1) command with a PERL script
that achieves the same.

Why PERL? For consistency purposes, there are more places in the
system test where we use the same method.

(cherry picked from commit fe601c5915)
2022-05-16 18:02:38 +02:00
Matthijs Mekking b777649fda Merge branch '3302-keymgr-updates-key-files-each-run-v9_18' into 'v9_18'
[v9_18] Fix "keymgr updates key files each run"

See merge request isc-projects/bind9!6300
2022-05-16 15:36:50 +00:00
Matthijs Mekking 7cfc5e51ed Add changes and release notes for #3302
Add a comment to make danger happy.

(cherry picked from commit 0f89f0b134)
2022-05-16 10:37:39 +02:00
Matthijs Mekking 9b6a20b42e Check if key metadata is modified before writing
Add a new parameter to the dst_key structure, mark a key modified if
dst_key_(un)set[bool,num,state,time] is called. Only write out key
files during a keymgr run if the metadata has changed.

(cherry picked from commit 1da91b3ab4)
2022-05-16 10:37:23 +02:00
Matthijs Mekking 90ceb24b1c Add kasp test for #3302
Add a test case that triggers a keymgr run that will not trigger any
metadata changes. Ensure that the last status change of the key files
is unmodified.

(cherry picked from commit 7249bad706)
2022-05-16 10:37:23 +02:00
Evan Hunt c77fcc61eb Merge branch '3327-fetches-per-server-quota-v9_18' into 'v9_18'
fix the fetches-per-server quota calculation

See merge request isc-projects/bind9!6307
2022-05-14 08:29:03 +00:00
Evan Hunt ef963cf5e4 Add CHANGES note for [GL #3327]
(cherry picked from commit 3f478a3bed)
2022-05-14 00:59:12 -07:00
Evan Hunt 37bd035d39 Add lower bound checks to fetchlimit test
Check that the recursing client count is above a reasonable
minimum, as well as below a maximum, so that we can detect
bugs that cause recursion to fail too early or too often.

(cherry picked from commit 8834c44683)
2022-05-14 00:59:12 -07:00
Evan Hunt 60e25826c6 Cleanup: always count ns_statscounter_recursclients
The ns_statscounter_recursclients counter was previously only
incremented or decremented if client->recursionquota was non-NULL.
This was harmless, because that value should always be non-NULL if
recursion is enabled, but it made the code slightly confusing.

(cherry picked from commit 0201eab655)
2022-05-14 00:59:09 -07:00
Evan Hunt fa8b33ce56 Disable EDNS for the fetchlimit test server
The fetchlimit test depends on a resolver continuing to try UDP
and timing out while the client waits for resolution to succeed.
but since commit bb990030 (flag day 2020), a fetch will always
switch to TCP after two timeouts, unless EDNS was disabled for
the query.

This commit adds "edns no;" to server statements in the fetchlimit
resolver, to restore the behavior expected by the test.

(cherry picked from commit 81deb24deb)
2022-05-14 00:43:17 -07:00
Evan Hunt bca7f19541 Fix the fetches-per-server quota calculation
Since commit bad5a523c2, when the fetches-per-server quota
was increased or decreased, instead of the value being set to
the newly calculated quota, it was set to the *minimum* of
the new quota or 1 - which effectively meant it was always set to 1.
it should instead have been the maximum, to prevent the value from
ever dropping to zero.

(cherry picked from commit 694bc50273)
2022-05-14 00:43:17 -07:00
Evan Hunt eaf5745554 Merge branch '3351-checkconf-overflow-v9_18' into 'v9_18'
prevent a possible buffer overflow in configuration check

See merge request isc-projects/bind9!6304
2022-05-14 03:49:45 +00:00
Evan Hunt e117244850 prevent a possible buffer overflow in configuration check
corrected code that could have allowed a buffer overfow while
parsing named.conf.

(cherry picked from commit 921043b541)
2022-05-13 20:29:36 -07:00
Ondřej Surý 57f50fcd13 Merge branch 'ondrej-fix-trampoline-locking-v9_18' into 'v9_18'
Lock the trampoline when attaching [v9.18]

See merge request isc-projects/bind9!6298
2022-05-13 12:05:47 +00:00
Ondřej Surý 71b0e9e5b7 Lock the trampoline when attaching
When attaching to the trampoline, the isc__trampoline_max was access
unlocked.  This would not manifest under normal circumstances because we
initialize 65 trampolines by default and that's enough for most
commodity hardware, but there are ARM machines with 128+ cores where
this would be reported by ThreadSanitizer.

Add locking around the code in isc__trampoline_attach().  This also
requires the lock to leak on exit (along with memory that we already)
because a new thread might be attaching to the trampoline while we are
running the library destructor at the same time.

(cherry picked from commit 933162ae14)
2022-05-13 13:21:49 +02:00
Matthijs Mekking 9eb02cc50a Merge branch '3335-confusing-parental-source-documentation-v9_18' into 'v9_18'
[v9_18] Remove confusing parental-source line

See merge request isc-projects/bind9!6286
2022-05-11 15:06:50 +00:00
Matthijs Mekking 4dbfa40e95 Remove confusing parental-source line
Remove the line "This address must appear in the secondary server’s
parental-agents zone clause". This line is a copy paste error from
notify-source.

Rewrap.

(cherry picked from commit 313f606692)
2022-05-11 15:02:58 +00:00
Michał Kępień 8d42fda54b Merge branch 'michal/drop-post-merge-pipelines-v9_18' into 'v9_18'
[v9_18] Drop post-merge pipelines

See merge request isc-projects/bind9!6293
2022-05-11 13:06:02 +00:00
Michał Kępień 3d59d61291 Drop post-merge pipelines
Commit 24961f6068 introduced the concept
of post-merge pipelines.  These were used to build documentation after
each merge to any of the maintained branches, to allow up-to-date
documentation to be subsequently published on the bind.isc.org
microsite.  As the latter no longer downloads documentation from GitLab,
instead linking to Read the Docs for all currently maintained branches,
post-merge pipelines have become redundant since running the
"autoreconf" and "docs" jobs after each merge is not necessary any more.
Drop the "release_branch_triggering_rules" YAML anchor and revert to
default triggering rules for the "autoconf" and "docs" jobs, effectively
preventing pipelines from being created after each merge to any of the
maintained branches.

(cherry picked from commit 7b8c9e04fc)
2022-05-11 15:03:55 +02:00
Michał Kępień ecaf773652 Merge branch '565-do-not-trigger-gitlab-pages-pipelines-any-more-v9_18' into 'v9_18'
Do not trigger GitLab Pages pipelines any more

See merge request isc-projects/bind9!6290
2022-05-11 12:17:33 +00:00
Michał Kępień 6d1d244f17 Do not set up ccache in CI jobs building docs
Building documentation for Automake-based BIND 9 versions does not
require running "make all" beforehand.  Drop ccache setup code from the
definitions of GitLab CI jobs building documentation as it is redundant.

(cherry picked from commit 59c8321ac9)
2022-05-11 14:11:47 +02:00
Michał Kępień 6c2827eac6 Do not trigger GitLab Pages pipelines any more
The bind.isc.org microsite no longer downloads documentation from
GitLab, instead linking to Read the Docs for all currently maintained
branches.  This makes it redundant to trigger GitLab Pages pipelines
after each merge to any of the maintained branches.  Revert changes
introduced by commit 31bde118db: remove
the "push:docs" job along with the "push" stage it is associated with
and revert artifact expiry time for the "docs" job to the default value.

(cherry picked from commit a7fccaee82)
2022-05-11 14:11:47 +02:00
Petr Špaček 5bd62835dd Merge branch 'pspacek/arm-remove-solaris251-v9_18' into 'v9_18'
Remove ARM notes about Solaris 2.5.1 [v9_18]

See merge request isc-projects/bind9!6288
2022-05-11 10:53:41 +00:00
Petr Špaček be7ee4137c Remove ARM notes about Solaris 2.5.1
It was released in May 1996 and hopefully is not used to run BIND
anymore.

(cherry picked from commit 4388656f60)
2022-05-11 12:53:05 +02:00
Petr Špaček 767b36b9c5 Merge branch '3169-arm-restructuring-v9_18' into 'v9_18'
Restructure ARM [v9_18]

See merge request isc-projects/bind9!6284
2022-05-11 09:12:50 +00:00
Suzanne GoldlustandPetr Špaček 1369885c2b Add RPZ section to the ARM
Closes: #1223

(cherry picked from commit 8a3c4cbcdd)
2022-05-11 11:08:18 +02:00
Ron AitchisonandPetr Špaček 3f816768cc Rewrite Configurations and Zone Files section in the ARM
(cherry picked from commit 5d432d40a1)
2022-05-11 11:07:32 +02:00
Ron AitchisonandPetr Špaček 55d325e420 Tweak zones.inc.rst now separated from Reference section
(cherry picked from commit 178fc50b42)
2022-05-11 11:07:32 +02:00
Ron AitchisonandPetr Špaček 98143a2b93 Move zone file material from Reference to new subsection of chapter 3
(cherry picked from commit d505090965)
2022-05-11 11:07:32 +02:00
Ron AitchisonandPetr Špaček f43ff3f9c8 Minor DNSSEC guide tweaks
(cherry picked from commit 4ac383e9ae)
2022-05-11 11:07:32 +02:00
Ron AitchisonandPetr Špaček 0040b99c6f Restructure includes for chapter 9 Troubleshooting
(cherry picked from commit 7842a0ca8f)
2022-05-11 11:07:32 +02:00
Ron AitchisonandPetr Špaček 820cdffbc6 Split chapter Advanced DNS Features in the ARM into chapters 5, 6, 7
(cherry picked from commit 25eb91d23c)
2022-05-11 11:07:32 +02:00
Ron AitchisonandPetr Špaček 8e49e918db Split Configuration chapter in the ARM into chapters 3 and 4
(cherry picked from commit cd1c230ff6)
2022-05-11 11:07:32 +02:00
Ron AitchisonandPetr Špaček 4f95b81888 Add new ARM section Installing BIND 9
(cherry picked from commit 63e12b511f)
2022-05-11 11:07:29 +02:00
Ron AitchisonandPetr Špaček 7a57b24289 Rewrite Introduction chapters of the ARM
(cherry picked from commit 0951922028)
2022-05-11 11:05:43 +02:00
Petr Špaček d012689eee License PNG and DIA images in the ARM under MPL-2.0 as usual
(cherry picked from commit 647318c9b7)
2022-05-11 11:05:43 +02:00
Petr Špaček f82a42559e Remove build from chapter 2 and move it to the end of ARM
(cherry picked from commit 9d15decc41)
2022-05-11 11:05:43 +02:00
Ron AitchisonandPetr Špaček 2f53384e84 Change title and add extra link to Resource Requirements in the ARM
(cherry picked from commit 0c3b75f80b)
2022-05-11 11:05:43 +02:00
Ron AitchisonandPetr Špaček daaab5fc52 Add link anchors into Configuration Reference section of the ARM
(cherry picked from commit dc7efb8e60)
2022-05-11 11:05:43 +02:00
Petr Špaček 90c5127f2a Restructure includes for ARM chapters 1 (Intro) and 2 (Requirements)
We have had perpetual problem with Sphinx implicitly double-including
files. To avoid that problem all files with name suffix .inc.rst are now
ignored by Sphinx, and writter can conveniently include them without
modifying conf.py for each and every file.

(cherry picked from commit 1322372a0c)
2022-05-11 11:05:43 +02:00
Michal Nowak f100a34b0e Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.18.4' into 'v9_18'
Set up version and release notes for BIND 9.18.4

See merge request isc-projects/bind9!6282
2022-05-11 09:00:33 +00:00
Michal Nowak bcd564089a Set up release notes for BIND 9.18.4 2022-05-11 10:52:47 +02:00
Michal Nowak 8134aac39c Update BIND version to 9.18.4-dev 2022-05-11 10:50:38 +02:00
Michal Nowak 16aefa34b0 Update BIND 9 version for release 2022-05-09 18:07:17 +02:00
Michal Nowak eea876716f Add a CHANGES marker 2022-05-09 18:06:43 +02:00
Michal Nowak 350829f21c Merge branch 'mnowak/prepare-documentation-for-bind-9.18.3' into 'security-v9_18'
Prepare documentation for BIND 9.18.3

See merge request isc-private/bind9!403
2022-05-09 16:05:38 +00:00
Michal Nowak 87f017bec3 Reorder release notes 2022-05-09 11:29:18 +02:00
Michal Nowak b2e3ecf859 Tweak and reword release notes 2022-05-09 11:26:57 +02:00
Michal Nowak 46819373e3 Prepare release notes for BIND 9.18.3 2022-05-06 17:02:29 +02:00
Michal Nowak edcf58c800 Merge branch '3216-sslyze-crash-fix-v9_18' into 'security-v9_18'
[CVE-2022-1183][v9_18] Fix a crash by avoiding destroying TLS stream socket too early

See merge request isc-private/bind9!401
2022-05-05 08:49:44 +00:00
Artem BoldarievandMichal Nowak ea223b9b44 Add release note entry for [GL #3216]
(cherry picked from commit 6791500e96)
2022-05-04 19:57:37 +02:00
Artem BoldarievandMichal Nowak 6edbd0692f Add CHANGES entry for [GL #3216]
(cherry picked from commit 65c0de8e6f)
2022-05-04 19:57:25 +02:00
Artem BoldarievandMichal Nowak bd41100295 Fix a crash by avoiding destroying TLS stream socket too early
This commit fixes a crash in generic TLS stream code, which could be
reproduced during some runs of the 'sslyze' tool.

The intention of this commit is twofold.

Firstly, it ensures that the TLS socket object cannot be destroyed too
early. Now it is being deleted alongside the underlying TCP socket
object.

Secondly, it ensures that the TLS socket object cannot be destroyed as
a result of calling 'tls_do_bio()' (the primary function which
performs encryption/decryption during the IO) as the code did not
expect that. This code path is fixed now.

(cherry picked from commit a696be6a2d)
2022-05-04 19:56:57 +02:00
Mark Andrews 2d44b863cc Merge branch '3232-rpz-rpz-nsip-rules-seem-not-to-understand-stub-and-static-stub-zones-and-don-t-handle-v9_18' into 'v9_18'
Add test cases using static and static-stub zones

See merge request isc-projects/bind9!6262
2022-05-04 14:13:06 +00:00
Mark Andrews 4513c21f77 Add CHANGES entry for [GL #3232]
(cherry picked from commit 63f420c89a)
2022-05-04 23:52:59 +10:00
Mark Andrews 3b490950af Allow DNS_RPZ_POLICY_ERROR to be converted to a string
(cherry picked from commit f498d2db0d)
2022-05-04 23:52:29 +10:00
Mark Andrews a742b7c5d7 Check the cache as well when glue NS are returned processing RPZ
(cherry picked from commit 8fb72012e3)
2022-05-04 23:52:29 +10:00
Mark Andrews 83cb796dcd Process learned records as well as glue
(cherry picked from commit 07c828531c)
2022-05-04 23:52:29 +10:00
Mark Andrews 9b467801ac Process the delegating NS RRset when checking rpz rules
(cherry picked from commit cf97c61f48)
2022-05-04 23:52:29 +10:00
Mark Andrews de5814ba8a Add test cases using static and static-stub zones
RPZ NSIP and NSDNAME checks were failing with "unrecognized NS
rpz_rrset_find() failed: glue" when static or static-stub zones
where used to resolve the query name.

Add tests using stub and static-stub zones that are expected to
be filtered and not-filtered against NSIP and NSDNAME rules.

stub and static-stub queries are expected to be filtered

stub-nomatch and static-stub-nomatch queries are expected to be passed

(cherry picked from commit 30cb70c826)
2022-05-04 23:52:29 +10:00
Ondřej Surý 3562fc9887 Merge branch 'ondrej-add-missing-void-in-named_config_default-v9_18' into 'v9_18'
Add missing void in named_config_getdefault() definition [v9.18]

See merge request isc-projects/bind9!6260
2022-05-04 11:05:47 +00:00
Ondřej Surý 79b045d03d Add missing void in named_config_getdefault() definition
The named_config_getdefault() was missing void in the function
definition.  This broke clang-15 that didn't match the declaration that
had the void in the argument with the definition that hadn't.
2022-05-04 13:03:21 +02:00
Ondřej Surý bef3c76b51 Merge branch 'ondrej-use--Wl,--export-dynamic-v9_18' into 'v9_18'
Add -Wl,--export-dynamic to standard LDFLAGS if supported

See merge request isc-projects/bind9!6255
2022-05-03 22:16:06 +00:00
Ondřej Surý 7fef5fc46c Add -Wl,--export-dynamic to standard LDFLAGS if supported
From the ld man page:

  When creating a dynamically linked executable, using the -E option or
  the --export-dynamic option causes the linker to add all symbols to
  the dynamic symbol table.  The dynamic symbol table is the set of
  symbols which are visible from dynamic objects at run time.

This should allow the backtrace(3) to fully resolve the symbols when
creating backtrace on an assertion failure.

(cherry picked from commit b05e20c968)
2022-05-03 21:14:25 +02:00
Arаm Sаrgsyаn ae8b335c11 Merge branch 'aram/catz-schema-v2-release-note-v9_18' into 'v9_18'
[v9_18] Add release note for catalog zones schema version 2 support

See merge request isc-projects/bind9!6254
2022-05-03 17:24:06 +00:00
Aram Sargsyan 50b804cf4c Add release note for catalog zones schema version 2 support
(cherry picked from commit bc3dc2eb41)
2022-05-03 16:44:14 +00:00
Artem Boldariev 79a6952346 Merge branch 'artem-rename-tls-hostname-to-tls-remote-hostname-backport-v9_18' into 'v9_18'
Rename "hostname" to "remote-hostname" within "tls" (backport to v9.18)

See merge request isc-projects/bind9!6253
2022-05-03 15:33:56 +00:00
Artem Boldariev 4bb410de98 Rename "hostname" to "remote-hostname" within "tls"
This commit renames "hostname" to "remote-hostname" within "tls"
options to avoid semantic conflicts with generic "options"
configuration.
2022-05-03 17:42:43 +03:00
Artem Boldariev 7fb09a23c6 Merge branch 'artem-update-arm-tls-warnings-backport-v9_18' into 'v9_18'
Update TLS-related warnings within ARM (backport to v9.18)

See merge request isc-projects/bind9!6251
2022-05-03 11:27:44 +00:00
Artem Boldariev 8828e003d4 Update TLS-related warnings within ARM
This commit updates TLS-related warnings so that the fact that Strict
and Mutual TLS are implemented is taken into consideration.
2022-05-03 14:20:28 +03:00
Mark Andrews 4798db16c0 Merge branch '3266-rndc-system-test-fails-due-to-rate-limit-of-built-in-_bind-view-v9_18' into 'v9_18'
Improve forensics for the querylog section of rndc system test

See merge request isc-projects/bind9!6245
2022-05-02 23:44:42 +00:00
Mark Andrews 542661cc7c Improve forensics for the querylog section of rndc system test
The dig commands appear to be failing unexpectedly on some platforms
when rate limiting kicks in and the response is dropped.  Correct
behaviour should be for dig to retry the query.  Set +qr and capture
stdout and stderr of each of the dig commands involved.

(cherry picked from commit 614cf5a030)
2022-05-02 19:51:11 +00:00
Petr Špaček 02f49fbf2d Merge branch 'pspacek/fix-rtd-file-path-substitution-v9_18' into 'v9_18'
Fix default file path substitution in the ARM and man pages [v9_18]

See merge request isc-projects/bind9!6247
2022-05-02 15:15:11 +00:00
Petr Špaček 005a535bf6 Fix default file path substitution in the ARM and man pages
Default paths were not substituted correctly when Python-only build was
used, i.e. it affected only ReadTheDocs. The incorrect rst_epilog was
overriden by Makefile for all "ordinary" builds.

This error was introduced by 3f78c60539.

Related: !5815
(cherry picked from commit cd31391294)
2022-05-02 17:11:44 +02:00
Mark Andrews c28ee3521a Merge branch '3317-cid-352554-1-of-1-dereference-before-null-check-reverse_inull-v9_18' into 'v9_18'
Remove unnecessary NULL pointer check

See merge request isc-projects/bind9!6244
2022-05-02 14:17:32 +00:00
Mark Andrews fde1294d05 Remove unnecessary NULL pointer check
3034                next = ISC_LIST_NEXT(query, link);
    3035        } else {
    3036                next = NULL;
    3037        }

    CID 352554 (#1 of 1): Dereference before null check (REVERSE_INULL)
    check_after_deref: Null-checking connectquery suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    3038        if (connectquery != NULL) {
    3039                query_detach(&connectquery);
    3040        }

(cherry picked from commit 30f3d51368)
2022-05-02 23:58:41 +10:00
Mark Andrews c0282b7d56 Merge branch 'bug/main/dlz-modules-v9_18' into 'v9_18'
Fix few warnings in DLZ modules

See merge request isc-projects/bind9!6242
2022-05-02 05:27:35 +00:00
Mark Andrews 06d9fa4419 Add CHANGES entry for [GL !5778]
(cherry picked from commit c938d41976)
2022-05-02 15:08:56 +10:00
Petr MensikandMark Andrews ae42ff5c15 Fix few warnings in DLZ modules
Also make similar change to ldap module. Change few public functions in
module to dlz_<module> prefix, so they cannot collide with used library.

(cherry picked from commit be39b3d84c)
2022-05-02 15:08:17 +10:00
Mark Andrews 7cff5ce8fe Merge branch '3318-typo-in-rndc-man-page-v9_18' into 'v9_18'
Fix typo, withdraw should be withdrawn

See merge request isc-projects/bind9!6241
2022-05-02 04:18:21 +00:00
Mark Andrews 41cf041b55 Fix typo, withdraw should be withdrawn
(cherry picked from commit 22c2402393)
2022-05-02 13:05:09 +10:00
Matthijs Mekking 18a344208b Merge branch 'matthijs-kasp-system-test-failure-v9_18' into 'v9_18'
[v9_18] Fix kasp system test failures

See merge request isc-projects/bind9!6236
2022-04-29 13:11:32 +00:00
Matthijs Mekking 7803319cfd Fix a kasp system test bug
In '_check_apex_dnskey' we check for each key (KEY1 to KEY4) if they
are present in the DNSKEY RRset if they should be.

However, we only grep the dig output for the first seven fields (owner,
ttl, class, type, flags, protocol, algorithm). This can be the same
for different keys.

For example, KEY1 may be KSK predecessor and KEY2 a KSK successor,
both DNSKEY records for these keys are the same up to the public key
field. This can cause test failures if KEY1 needs to be present, but
KEY2 not, because when grepping for KEY2 we will falsely detect the
key to be present (because the grep matches KEY1).

Fix the function by grepping looking for the first seven fields in the
corresponding key file and retrieve the public key part. Grep for this
in the dig output.

(cherry picked from commit 3e1d09ac66)
2022-04-29 13:57:31 +02:00
Matthijs Mekking a7aedd5bca Minor fixes in kasp system test
Fix two typos and two grep calls.

(cherry picked from commit 2b34b326fc)
2022-04-29 13:57:26 +02:00
Petr Špaček f8737d2a1a Merge branch 'feature/main/default-config-print-v9_18' into 'v9_18'
Export built-in default configuration for named binary [v9_18]

See merge request isc-projects/bind9!6233
2022-04-29 08:49:42 +00:00
Petr MenšíkandPetr Špaček 1c04a88a1e Export built-in default configuration for named binary
It might be useful to display built-in configuration with all its
values. It should make it easier to test what default values has changed
in a new release.

Related: #1326
(cherry picked from commit cf722d18b3)
2022-04-29 10:33:31 +02:00
Mark Andrews d8146be859 Merge branch 'bug/main/new-zones-dir-null-v9_18' into 'v9_18'
Don't test new-zones-directory argument validity

See merge request isc-projects/bind9!6230
2022-04-29 02:06:12 +00:00
Petr MenšíkandMark Andrews 02f80b4c75 Additional safety check for negative array index
inet_ntop result should always protect against empty string accepted
without an error. Make additional check to satisfy coverity scans.

(cherry picked from commit 656a0f076f)
2022-04-29 11:46:22 +10:00
Petr MenšíkandMark Andrews 2cdebaf702 Initialize printed buffer
- var_decl: Declaring variable "tbuf" without initializer
- assign: Assigning: "target.base" = "tbuf", which points to
  uninitialized data
- assign: Assigning: "r.base" = "target.base", which points to
  uninitialized data

I expect it would correctly initialize length always. Add simple
initialization to silent coverity.

(cherry picked from commit 59132bd3ec)
2022-04-29 11:46:22 +10:00
Petr MenšíkandMark Andrews ca952e22ff Ensure diff variable is not read uninitialized
Coverity detected issues:
- var_decl: Declaring variable "diff" without initializer.
- uninit_use_in_call: Using uninitialized value "diff.tuples.head" when
  calling "dns_diff_clear".

(cherry picked from commit 67e773c93c)
2022-04-29 11:46:22 +10:00
Petr MenšíkandMark Andrews 5e635d4c84 Don't test new-zones-directory argument validity
Parser ensures new-zones-directory has qstring parameter before it can
reach this place. dir == NULL then should never happen on any
configuration. Replace silent check with insist.

(cherry picked from commit 0a7d04367a)
2022-04-29 11:46:22 +10:00
Mark Andrews f1f94d1159 Merge branch '3306-undefined-macros-in-contrib-dlz-modules-wildcard-dlz_wildcard_dynamic-c-v9_18' into 'v9_18'
Define local instances of FALLTHROUGH and UNREACHABLE

See merge request isc-projects/bind9!6228
2022-04-29 01:13:57 +00:00
Mark Andrews ac5f018d8f Add CHANGES note for [GL #3306]
(cherry picked from commit c57363fb7d)
2022-04-29 10:53:40 +10:00
Mark Andrews 9ced9a6202 Define local instances of FALLTHROUGH and UNREACHABLE
FALLTHOUGH is a copy of how it is defined in <isc/util.h>

UNREACHABLE follows the model used in MacOS /usr/include/c++/v1/cstdlib
to determine if __builtin_ureachable is available

(cherry picked from commit 6d68a22954)
2022-04-29 10:53:12 +10:00
Arаm Sаrgsyаn 3e74a046db Merge branch '3225-catz-member-zone-reset-v9_18' into 'v9_18'
[v9_18] [5/5] Document catalog zones member zone reset by change of unique label

See merge request isc-projects/bind9!6224
2022-04-28 16:58:47 +00:00
Aram Sargsyan e3839fc3e8 Document catalog zones member zone reset by change of unique label
The DNS catalog zones draft version 5 document requires that catalog
zones consumers must reset the member zone's internal zone state when
its unique label changes (either within the same catalog zone or
during change of ownership performed using the "coo" property).

BIND already behaves like that, and, in fact, doesn't support keeping
the zone state during change of ownership even if the unique label
has been kept the same, because BIND always removes the member zone
and adds it back during unique label renaming or change of ownership.

Document the described behavior and add a log message to inform when
unique label renaming occurs.

Add a system test case with unique label renaming.

(cherry picked from commit 2f2e02ff0c)
2022-04-28 16:10:23 +00:00
Ondřej Surý 982103594c Merge branch '2813-build-named-with-dlz-is-broken-with-MariaDB-10-v9_18' into 'v9_18'
Use MARIADB_BASE_VERSION instead of LIBMARIADB to detect Maria DB [v9.18]

See merge request isc-projects/bind9!6225
2022-04-28 16:06:20 +00:00
Ondřej SurýandOndřej Surý cf4e08d9cb Use MARIADB_BASE_VERSION instead of LIBMARIADB to detect Maria DB
It was discovered that MariaDB 10 didn't define LIBMARIADB leading
to compilation errors of MySQL DLZ modules on Debian stretch.

Use MARIADB_BASE_VERSION instead which is defined in all tested MariaDB
versions.

(cherry picked from commit 5835aae694)
2022-04-28 18:05:17 +02:00
Arаm Sаrgsyаn d04fb79f1f Merge branch '3224-catz-broken-catalog-zones-concept-support-v9_18' into 'v9_18'
[v9_18] [4/5] Introduce the concept of broken catalog zones

See merge request isc-projects/bind9!6214
2022-04-28 13:22:44 +00:00
Aram Sargsyan 2dac9b119a Remove reduntant checks of 'rdclass' in catz.c
We check the `rdclass` to be of type IN in `dns_catz_update_process()`
function, and all the other static functions where similar checks exist
are called after (and in the result of) that function being called,
so they are effectively redundant.

(cherry picked from commit 84d3aba4f3)
2022-04-28 12:49:30 +00:00
Aram Sargsyan a8f9d4e418 Add new catz system test to check a version property with invalid type
There is already a check for the missing version property case
(catalog-bad1.example), and this new test should result in the same
outcome, but differs in a way that there exists a version record in the
zone, but it is of a wrong type (A instead of the expected TXT).

(cherry picked from commit 5bfe655835)
2022-04-28 12:49:24 +00:00
Aram Sargsyan 7dc8b2f79b Add a system test to check catalog zones with non-IN rdata class fail
According to DNS catalog zones draft version 5 document, the CLASS field
of every RR in a catalog zone MUST be IN.

Add a new check in the catz system test to verify that a non-IN class
catalog zone (in this case CH) fails to load.

BIND does not support having a non-IN class RR in an IN class zone, or
non-IN class zone in an IN class view, so to verify that BIND respects
the mentioned restriction we must try to add a non-IN class catalog
zone and check that it didn't succeed.

The `named` configuration files had to be restructured to put all the
zones inside views, which also resulted in some corresponding changes
in the tests.sh script.

(cherry picked from commit 247ae534a0)
2022-04-28 12:49:17 +00:00
Aram Sargsyan 951d582593 Add a new warning message when processing view configuration
When parsing the configuration file, log a warning message in
configure_view() function when encountering a `catalog-zones`
option in a view with non-IN rdata class.

(cherry picked from commit dfd5a01eba)
2022-04-28 12:49:08 +00:00
Aram Sargsyan f0bb090afe Add CHANGES note for [GL #3224]
(cherry picked from commit 92d1e1e347)
2022-04-28 12:48:51 +00:00
Aram Sargsyan 6539f73e3a Introduce the concept of broken catalog zones
The DNS catalog zones draft version 5 document describes various
situations when a catalog zones must be considered as "broken" and
not be processed.

Implement those checks in catz.c and add corresponding system tests.

(cherry picked from commit a8228d5f19)
2022-04-28 12:48:41 +00:00
Artem Boldariev 9a11c7a570 Merge branch 'artem-strict-tls-backport-v9_18' into 'v9_18'
Add remote TLS certificate verification support, implement Strict and Mutual TLS authentication in BIND and dig (backport to v9.18)

See merge request isc-projects/bind9!6210
2022-04-28 11:02:32 +00:00
Artem Boldariev 02208acbb5 Dig: do not hang on TLS context creation errors
There was a query_detach() call missing in dig, which could lead to
dig hanging on TLS context creation errors. This commit fixes.

The error was introduced because the Strict TLS implementation was
initially made over an older version of the code, where this extra
query_detach() call was not needed.
2022-04-28 13:39:22 +03:00
Artem Boldariev 4637b72da6 Change X509_STORE_up_ref() shim return value
X509_STORE_up_ref() must return 1 on success, while the previous
implementation would return the references count. This commit fixes
that.
2022-04-28 13:39:22 +03:00
Artem Boldariev 26feac0c61 Implement shim for SSL_CTX_set1_cert_store() (affects Debian 9)
This commit implements a shim for SSL_CTX_set1_cert_store() for
OpenSSL/LibreSSL versions where it is not available.
2022-04-28 13:39:22 +03:00
Artem Boldariev a86575034c Mention TLS certs verification in the CHANGES and Release Notes
This commit adds points to the CHANGES and the release notes about
supporting remote TLS certificates verification and support for Strict
and Mutual TLS transport connections verification.
2022-04-28 13:39:21 +03:00
Artem Boldariev 8c9532f8cf Update the "Known Issues"
Mention that some old cryptographic library versions lack the
functionality to implement ignoring the Subject field (and thus the
Common Name) when establishing DoT connections.
2022-04-28 13:39:21 +03:00
Artem Boldariev 337943c047 Extend the 'doth' system test with Strict/Mutual TLS checks
This commit extends the 'doth' system test with a set of Strict/Mutual
TLS related checks.

This commit also makes each doth NS instance use its own TLS
certificate that includes FQDN, IPv4, and IPv6 addresses, issued using
a common Certificate Authority, instead of ad-hoc certs.

Extend servers initialisation timeout to 60 seconds to improve the
tests stability in the CI as certain configurations could fail to
initialise on time under load.
2022-04-28 13:39:21 +03:00
Artem Boldariev d03b4026d5 Add missing plain HTTP options to dig's help output
A couple of dig options were missing in the help output, while been
properly documented and supported. This commit fixes this overlook.
2022-04-28 13:39:21 +03:00
Artem Boldariev 2b3b8f354b Document supported TLS authentication modes
This commit updates the reference manual with short descriptions of
different TLS authentication modes, as mentioned in the RFC 9103,
Section 9.3 (Opportunistic TLS, Strict TLS, Mutual TLS), and mentions
how these authentication modes can be achieved via BIND's
configuration file.
2022-04-28 13:39:21 +03:00
Artem Boldariev 6c05fb09c3 Add support for Strict/Mutual TLS into BIND
This commit adds support for Strict/Mutual TLS into BIND. It does so
by implementing the backing code for 'hostname' and 'ca-file' options
of the 'tls' statement. The commit also updates the documentation
accordingly.
2022-04-28 13:39:21 +03:00
Artem Boldariev 05091f0095 Restore disabled unused 'tls' options: 'ca-file' and 'hostname'
This commit restores the 'tls' options disabled in
78b73d0865.
2022-04-28 13:39:21 +03:00
Artem Boldariev 1f60b32a51 Add support for Strict/Mutual TLS to dig
This commit adds support for Strict/Mutual TLS to dig.

The new command-line options and their behaviour are modelled after
kdig (+tls-ca, +tls-hostname, +tls-certfile, +tls-keyfile) for
compatibility reasons. That is, using +tls-* is sufficient to enable
DoT in dig, implying +tls-ca

If there is no other DNS transport specified via command-line,
specifying any of +tls-* options makes dig use DoT. In this case, its
behaviour is the same as if +tls-ca is specified: that is, the remote
peer's certificate is verified using the platform-specific
intermediate CA certificates store. This behaviour is introduced for
compatibility with kdig.
2022-04-28 13:39:21 +03:00
Artem Boldariev 9b0eb3e5a3 Add ISC_R_TLSBADPEERCERT error code to the TLS related code
This commit adds support for ISC_R_TLSBADPEERCERT error code, which is
supposed to be used to signal for TLS peer certificates verification
in dig and other code.

The support for this error code is added to our TLS and TLS DNS
implementations.

This commit also adds isc_nm_verify_tls_peer_result_string() function
which is supposed to be used to get a textual description of the
reason for getting a ISC_R_TLSBADPEERCERT error.
2022-04-28 13:39:21 +03:00
Artem Boldariev e2a3ec2ba5 Extend TLS context cache with CA certificates store
This commit adds support for keeping CA certificates stores associated
with TLS contexts. The intention is to keep one reusable store per a
set of related TLS contexts.
2022-04-28 13:39:21 +03:00
Artem Boldariev 6fdc03102a Add foundational functions to implement Strict/Mutual TLS
This commit adds a set of functions that can be used to implement
Strict and Mutual TLS:

* isc_tlsctx_load_client_ca_names();
* isc_tlsctx_load_certificate();
* isc_tls_verify_peer_result_string();
* isc_tlsctx_enable_peer_verification().
2022-04-28 13:39:21 +03:00
Artem Boldariev b975ee7be4 Add utility functions to manipulate X509 certificate stores
This commit adds a set of high-level utility functions to manipulate
the certificate stores. The stores are needed to implement TLS
certificates verification efficiently.
2022-04-28 13:39:21 +03:00
Matthijs Mekking cfcbdb6712 Merge branch '2267-extended-errors-stale-data-v9_18' into 'v9_18'
[v9_18] Add stale answer extended errors

See merge request isc-projects/bind9!6209
2022-04-28 09:56:59 +00:00
Matthijs Mekking 7ad1603ac3 Add CHANGES and release notes for #2267
(cherry picked from commit a320f4ed04)
2022-04-28 11:21:28 +02:00
Matthijs Mekking 125603a543 Add stale answer extended errors
Add DNS extended errors 3 (Stale Answer) and 19 (Stale NXDOMAIN Answer)
to responses. Add extra text with the reason why the stale answer was
returned.

To test, we need to change the configuration such that for the first
set of tests the stale-refresh-time window does not interfer with the
expected extended errors.

(cherry picked from commit c66b9abc0b)
2022-04-28 11:21:22 +02:00
Evan Hunt 44a935cbdc Merge branch '3272-shutdown-deadlock-v9_18' into 'v9_18'
prevent a deadlock in the shutdown system test

See merge request isc-projects/bind9!6207
2022-04-28 06:58:38 +00:00
Evan Hunt d7c2752d3c CHANGES for [GL #3272]
(cherry picked from commit 6bcf3e5c31)
2022-04-27 23:57:18 -07:00
Evan Hunt af37c6f60c prevent a deadlock in the shutdown system test
The shutdown test sends 'rdnc status' commands in parallel with
'rndc stop' A new rndc connection arriving will reference the ACL
environment to see whether the client is allowed to connect.
Commit c0995bc380 added a mutex lock to ns_interfacemgr_getaclenv(),
but if the new connection arrives while the interfaces are being
purged during shutdown, that lock is already being held. If the
the connection event slips in ahead of one of the netmgr's "stop
listening" events on a worker thread, a deadlock can occur.

The fix is not to hold the interfacemgr lock while shutting down
interfaces; only while actually traversing the interface list to
identify interfaces needing shutdown.

(cherry picked from commit 5c4cf3fcc4)
2022-04-27 23:56:59 -07:00
Evan Hunt 5c97200cfb Merge branch '2969-refactor-fctx_done-v9_18' into 'v9_18'
refactor fctx_done() to set fctx to NULL

See merge request isc-projects/bind9!6202
2022-04-28 01:19:17 +00:00
Evan Hunt d3728056db CHANGES for [GL #2969]
(cherry picked from commit f8c0cabca1)
2022-04-27 16:12:55 -07:00
Evan Hunt 9296be2130 refactor resume_dsfetch()
clean up resume_dsfetch() so that the fctx reference counting is
saner and easier to follow.

(cherry picked from commit 7b2ea97e46)
2022-04-27 16:12:55 -07:00
Evan Hunt 759e0b030e refactor validated()
minor changes to ensure that fctx reference counting is clear and correct.

(cherry picked from commit d2f407cca3)
2022-04-27 16:12:55 -07:00
Evan Hunt 50ef4a8cae rename maybe_destroy() to maybe_cancel_validators()
the maybe_destroy() function no longer destroys the fctx,
so rename it and update the comments.

(cherry picked from commit 7c5afebcdc)
2022-04-27 16:12:55 -07:00
Evan Hunt 8a90a62d0f refactor fctx_done() to set fctx to NULL
previously fctx_done() detached the fctx but did not clear the pointer
passed into it from the caller.  in some conditions, when rctx_done()
was reached while waiting for a validator to complete, fctx_done()
could be called twice on the same fetch, causing a double detach.

fctx_done() now clears the fctx pointer, to reduce the chances of
such mistakes.

(cherry picked from commit b4592d02a1)
2022-04-27 16:12:55 -07:00
Artem Boldariev 24655a4704 Merge branch 'artem-tls-ctx-refcount-backport-v9_18' into 'v9_18'
Implement reference counting for TLS contexts, Resolve #3122 DoT stops working after "rndc reconfigure" when running named as non-root (backport to v9.18)

See merge request isc-projects/bind9!6204
2022-04-27 21:36:02 +00:00
Artem Boldariev 67b9f97664 Extend the doth system test
This commit adds simple checks that the TLS contexts in question are
indeed being updated on DoT and DoH listeners.
2022-04-28 00:03:22 +03:00
Artem Boldariev 70a4c8ed95 Update CHANGES [GL #3122]
Add an entry that reloading TLS certificates without destroying
underlying TCP listening sockets.
2022-04-28 00:03:22 +03:00
Artem Boldariev f39041ee65 Replace listener TLS contexts on reconfiguration
This commit makes use of isc_nmsocket_set_tlsctx(). Now, instead of
recreating TLS-enabled listeners (including the underlying TCP
listener sockets), only the TLS context in use is replaced.
2022-04-27 23:58:38 +03:00
Artem Boldariev 3a75b33287 Add isc_nmsocket_set_tlsctx()
This commit adds isc_nmsocket_set_tlsctx() - an asynchronous function
that replaces the TLS context within a given TLS-enabled listener
socket object. It is based on the newly added reference counting
functionality.

The intention of adding this function is to add functionality to
replace a TLS context without recreating the whole socket object,
including the underlying TCP listener socket, as a BIND process might
not have enough permissions to re-create it fully on reconfiguration.
2022-04-27 23:58:38 +03:00
Artem Boldariev f52c06054b Maintain a per-thread TLS ctx reference in TLS stream code
This commit changes the generic TLS stream code to maintain a
per-worker thread TLS context reference.
2022-04-27 23:58:38 +03:00
Artem Boldariev 28460151ca Use isc_tlsctx_attach() in TLS DNS code
This commit adds proper reference counting for TLS contexts into
generic TLS DNS (DoT) code.
2022-04-27 23:58:38 +03:00
Artem Boldariev ff987957e7 Use isc_tlsctx_attach() in TLS stream code
This commit adds proper reference counting for TLS contexts into
generic TLS stream code.
2022-04-27 23:58:38 +03:00
Artem Boldariev 677819d22d Add isc_tlsctx_attach()
The implementation is done on top of the reference counting
functionality found in OpenSSL/LibreSSL, which allows for avoiding
wrapping the object.

Adding this function allows using reference counting for TLS contexts
in BIND 9's codebase.
2022-04-27 23:58:38 +03:00
Arаm Sаrgsyаn 95d1e9ee62 Merge branch '3300-dispatch-udp_recv-handle-deactivated-resp-returning-success-v9_18' into 'v9_18'
[v9_18] Handle ISC_R_SUCCESS on a deactivated response in udp_recv()

See merge request isc-projects/bind9!6200
2022-04-27 19:07:45 +00:00
Aram Sargsyan e1aca8d575 Add CHANGES note for [GL #3300]
(cherry picked from commit bbdd139e20)
2022-04-27 18:08:42 +00:00
Aram Sargsyan 4de1f65e4d Handle ISC_R_SUCCESS on a deactivated response in udp_recv()
There is a possibility for `udp_recv()` to be called with `eresult`
being `ISC_R_SUCCESS`, but nevertheless with already deactivated `resp`,
which can happen when the request has been canceled in the meantime.

(cherry picked from commit e3a88862c0)
2022-04-27 18:08:42 +00:00
Artem Boldariev f46e46e730 Merge branch '3274-fix-test-server-for-solaris-backport-v9_18' into 'v9_18'
Rename yield() to the test_server_yield() (backport to 9.18)

See merge request isc-projects/bind9!6201
2022-04-27 17:23:22 +00:00
Artem Boldariev f83d128ece Rename yield() to the test_server_yield()
This commit ensures that the test_server binary will build on Solaris,
which has yield() definition within 'unistd.h'.
2022-04-27 20:13:24 +03:00
Artem Boldariev 65d929e0d3 Merge branch '3271-tlsdns-call-write-callbacks-after-send-backport-v9_18' into 'v9_18'
TLSDNS: call send callbacks only after the data was sent  (backport to 9.18)

See merge request isc-projects/bind9!6198
2022-04-27 17:06:52 +00:00
Artem Boldariev 8b19f62ac5 TLSDNS: call send callbacks after only the data was sent
This commit ensures that write callbacks are getting called only after
the data has been sent via the network.

Without this fix, a situation could appear when a write callback could
get called before the actual encrypted data would have been sent to
the network. Instead, it would get called right after it would have
been passed to the OpenSSL (i.e. encrypted).

Most likely, the issue does not reveal itself often because the
callback call was asynchronous, so in most cases it should have been
called after the data has been sent, but that was not guaranteed by
the code logic.

Also, this commit removes one memory allocation (netievent) from a hot
path, as there is no need to call this callback asynchronously
anymore.
2022-04-27 17:57:11 +03:00
Petr Špaček 66080a6d91 Merge branch 'pspacek/pin-sphinx-packages-for-rtd-v9_18' into 'v9_18'
Pin Sphinx related package versions to match ReadTheDocs and our CI [v9_18]

See merge request isc-projects/bind9!6192
2022-04-27 12:35:36 +00:00
Petr Špaček 77873b1a5a Pin Sphinx related package versions to match ReadTheDocs and our CI
This seems to be most appropriate way to ensure consistency between
release tarballs and public presentation on ReadTheDocs.

Previous attempt with removing docutils constraint, which relied on pip
depedency solver to pick the same packages as in CI was flawed. RTD
installs a bit different set of packages so it was inherently
unreliable.

As a result RTD pulled in sphinx-rtd-theme==0.4.3 while CI
had 1.0.0, and this inconsistency caused Table of Contents in Release
Notes to render incorrectly. Previous solution was to downgrade
docutils to < 0.17, but I think we should rather pin exact versions.

For the long history of messing with versions read also
isc-projects/bind9@2a8eda0084
isc-projects/images@d4435b97be
isc-projects/bind9@6a2daddf5b

(cherry picked from commit 6088ba3837)
2022-04-27 14:34:56 +02:00
Ondřej Surý 9fd2c7e66a Merge branch 'ondrej-fix-route_recv-use-after-free-v9_18' into 'v9_18'
The route socket and its storage was detached while still reading [v9_18]

See merge request isc-projects/bind9!6181
2022-04-26 14:41:39 +00:00
Ondřej Surý 192df8d2f1 The route socket and its storage was detached while still reading
The interfacemgr and the .route was being detached while the network
manager had pending read from the socket.  Instead of detaching from the
socket, we need to cancel the read which in turn will detach the route
socket and the associated interfacemgr.

(cherry picked from commit 9ae34a04e8)
2022-04-26 16:41:24 +02:00
Ondřej Surý 0cdb2f497a Merge branch '3230-remove-task-exclusive-mode-from-ns_clientmgr-v9_18' into 'v9_18'
Remove task exclusive mode from ns_clientmgr [v9.18]

See merge request isc-projects/bind9!6187
2022-04-26 14:40:42 +00:00
Ondřej Surý 4520ecc471 Add CHANGES mode for [GL #3230]
(cherry picked from commit a243860562)
2022-04-26 15:57:03 +02:00
Ondřej Surý 8beaee0b08 Remove task exclusive mode from ns_clientmgr
The .lock, .exiting and .excl members were not using for anything else
than starting task exclusive mode, setting .exiting to true and ending
exclusive mode.

Remove all the stray members and dead code eliminating the task
exclusive mode use from ns_clientmgr.

(cherry picked from commit 4f74e1010e)
2022-04-26 15:56:30 +02:00
Ondřej Surý bc36f3e723 Merge branch '3299-fix-AX_PROG_CC_FOR_BUILD-macro-v9_18' into 'v9_18'
Fix the cached value of ac_cv_c_compiler_gnu [v9.18]

See merge request isc-projects/bind9!6185
2022-04-26 13:49:31 +00:00
Ondřej Surý 1bcd20d4bb Fix the cached value of ac_cv_c_compiler_gnu
There was an error in AX_PROG_CC_FOR_BUILD macro that cached literal
name of the cache variable `saved_ac_cv_c_compiler_gnu` instead of the
value of said variable breaking the consecutive runs of ./configure
script with caching enabled.

(cherry picked from commit 4a9f899b5c)
2022-04-26 15:49:16 +02:00
Petr Špaček d5fd2a53ef Merge branch 'pspacek/rtd-requirements-update-v9_18' into 'v9_18'
Fix mismatch between docutils version in CI and ReadTheDocs [v9_18]

See merge request isc-projects/bind9!6184
2022-04-26 13:48:24 +00:00
Petr Špaček 243cd069fc Fix mismatch between docutils version in CI and ReadTheDocs
Currently our CI images we use to build docs (which subsequently get
into release tarballs) are using docutils 0.17.1, which is latest version
which fulfills Sphinx 4.5.0 requirement for docutils < 0.18.

The old requirement for docutils < 0.17 was causing discrepancy between
the way we build release artifacts and the docs on ReadTheDocs.org which
uses doc/arm/requirements.txt from our repo.

Remove the limit for RDT with hope that it will pull latest permissible
version of docutils.

For the long history of messing with docutils version read also
isc-projects/images@d4435b97be
isc-projects/bind9@6a2daddf5b

(cherry picked from commit 2a8eda0084)
2022-04-26 15:46:55 +02:00
Ondřej Surý 77fde4a112 Merge branch '3229-remove-exclusive-mode-from-ns_interfacemgr-v9_18' into 'v9_18'
Remove exclusive mode from ns_interfacemgr [v9.18]

See merge request isc-projects/bind9!6179
2022-04-26 12:22:19 +00:00
Ondřej Surý 95a55d0968 Add CHANGES note for [GL #3229]
(cherry picked from commit 70e58897c7)
2022-04-26 14:21:57 +02:00
Ondřej Surý ce8ffdda69 Remove exclusive mode from ns_interfacemgr
Now that the dns_aclenv_t has now properly rwlocked .localhost and
.localnets member, we can remove the task exclusive mode use from the
ns_interfacemgr.  Some light related cleanup has been also done.

(cherry picked from commit c0995bc380)
2022-04-26 14:21:57 +02:00
Ondřej Surý ab528a0fcb Add isc_rwlock around dns_aclenv .localhost and .localnets member
In order to modify the .localhost and .localnets members of the
dns_aclenv, all other processing on the netmgr loops needed to be
stopped using the task exclusive mode.  Add the isc_rwlock to the
dns_aclenv, so any modifications to the .localhost and .localnets can be
done under the write lock.

(cherry picked from commit 8138a595d9)
2022-04-26 14:21:57 +02:00
Petr Špaček a180f66b06 Merge branch '3301-support-sphinx-149-v9_18' into 'v9_18'
Split negative and positive dig/mdig/delv options to support Sphinx 1.4.9 [v9_18]

See merge request isc-projects/bind9!6180
2022-04-26 12:18:38 +00:00
Petr Špaček a84871ccca Add hyperlinks to dig/mdig/delv +options
(cherry picked from commit ac0c2378ca)
2022-04-26 14:06:33 +02:00
Petr Špaček 4c21534009 Split negative and positive dig/mdig/delv options to support Sphinx 1.4.9
Man pages for dig/mdig/delv used `.. option:: +[no]bla` to describe two
options at once, and very old Sphinx does not support that [] in option
names.

Solution is to split negative and positive options into `+bla, +nobla`
form. In the end it improves readability because it transforms hard to
read strings with double brackets from
`+[no]subnet=addr[/prefix-length]` to
`+subnet=addr[/prefix-length], +nosubnet`.

As a side-effect it also allows easier linking to dig/mdig/delv options
using their name directly instead of always overriding the link target
to `+[no]bla` form.

Transformation was done using regex:
    s/:: +\[no\]\(.*\)/:: +\1, +no\1
... and manual review around occurences matching regex
    +no.*=

Fixes: #3301
(cherry picked from commit 0342dddce7)
2022-04-26 14:00:38 +02:00
Ondřej Surý d751514215 Merge branch 'ondrej-enforce-minimal-libuv-version-v9_18' into 'v9_18'
Abort when libuv at runtime mismatches libuv at compile time [v9.18]

See merge request isc-projects/bind9!6177
2022-04-26 10:12:08 +00:00
Ondřej Surý 2a648b9078 Abort when libuv at runtime mismatches libuv at compile time
When we compile with libuv that has some capabilities via flags passed
to f.e. uv_udp_listen() or uv_udp_bind(), the call with such flags would
fail with invalid arguments when older libuv version is linked at the
runtime that doesn't understand the flag that was available at the
compile time.

Enforce minimal libuv version when flags have been available at the
compile time, but are not available at the runtime.  This check is less
strict than enforcing the runtime libuv version to be same or higher
than compile time libuv version.
2022-04-26 12:11:51 +02:00
Petr Špaček b3e1c9060b Merge branch '3295-support-sphinx-185-v9_18' into 'v9_18'
Use unique program + option names for link anchors to support Sphinx 1.8.5 [v9_18]

See merge request isc-projects/bind9!6170
2022-04-26 10:07:32 +00:00
Petr Špaček 355aebc6df Use unique program + option names for link anchors to support Sphinx 1.8.5
Sphinx "standard domain" provides directive types ".. program::" and
".. option::" to create link anchor for a program name + option combination.
These can be referenced using :ref:`program option` syntax.

The problem is that Sphinx 1.8.5 (e.g. in Ubuntu 18.04) generates
conflicting link targets if a page contains two option directives
starting with the same word, e.g.:

.. program:: dnssec-settime
.. option:: -P date
.. option:: -P ds date

The reason is that option directive consumes only first word as "option
name" (-P) and all the rest is considered "option argument" (date, ds
date). Newer versions of Sphinx (e.g. 4.5.0) handle this by creating
numbered link anchors, but older versions warn and BIND build system
turns the warning into a hard error.

To handle that we use method recommended by Sphinx maintainer:
https://github.com/sphinx-doc/sphinx/issues/10218#issuecomment-1059925508
As a bonus it provides more accurate link anchors for sub-options.

Alternatives considered:
- Replacing standard domain definition of .. option - causes more
  problems, see BIND issue #3294.
- Removing hyperlinks for options - that would be a step back.

Fixes: #3295
(cherry picked from commit bbb24264bb)
2022-04-25 14:46:37 +02:00
Ondřej Surý 08feb4c23e Merge branch 'ondrej-use-correct-task-for-resume_dslookup-v9_18' into 'v9_18'
Run resume_dslookup() from the correct task [v9.18]

See merge request isc-projects/bind9!6164
2022-04-22 14:57:40 +00:00
Ondřej Surý 7e72c55ff9 Run resume_dslookup() from the correct task
The rctx_chaseds() function calls dns_resolver_createfetch(), passing
fctx->task as the target task to run resume_dslookup() from.  This
breaks task-based serialization of events as fctx->task is the task that
the dns_resolver_createfetch() caller wants to receive its fetch
completion event in; meanwhile, intermediate fetches started by the
resolver itself (e.g. related to QNAME minimization) must use
res->buckets[bucketnum].task instead.  This discrepancy may cause
trouble if the resume_dslookup() callback happens to be run concurrently
with e.g. fctx_doshutdown().

Fix by passing the correct task to dns_resolver_createfetch() in
rctx_chaseds().

(cherry picked from commit 741a7096fc)
2022-04-22 15:57:22 +02:00
Michał Kępień aa3a3e7cda Merge branch 'michal/fix-loading-plugins-using-just-their-filenames-v9_18' into 'v9_18'
[v9_18] Fix loading plugins using just their filenames

See merge request isc-projects/bind9!6162
2022-04-22 11:37:07 +00:00
Michał Kępień 4ac4640c40 Fix loading plugins using just their filenames
BIND 9 plugins are installed using Automake's pkglib_LTLIBRARIES stanza,
which causes the relevant shared objects to be placed in the
$(libdir)/@PACKAGE@/ directory, where @PACKAGE@ is expanded to the
lowercase form of the first argument passed to AC_INIT(), i.e. "bind".
Meanwhile, NAMED_PLUGINDIR - the preprocessor macro that the
ns_plugin_expandpath() function uses for determining the absolute path
to a plugin for which only a filename has been provided (rather than a
path) - is set to $(libdir)/named.  This discrepancy breaks loading
plugins using just their filenames.  Fix the issue (and also prevent it
from reoccurring) by setting NAMED_PLUGINDIR to $(pkglibdir).

(cherry picked from commit 5065c4686e)
2022-04-22 13:29:10 +02:00
Michał Kępień 83eaff2851 Merge branch 'michal/regenerate-man-pages-with-sphinx-4.5.0-v9_18' into 'v9_18'
[v9_18] Regenerate man pages with Sphinx 4.5.0

See merge request isc-projects/bind9!6160
2022-04-22 11:21:11 +00:00
Michał Kępień c1ba7c685d Regenerate man pages with Sphinx 4.5.0
The Debian 11 (bullseye) Docker image, which GitLab CI uses for building
documentation, currently contains the following package versions:

  - Sphinx 4.5.0
  - sphinx-rtd-theme 1.0.0
  - docutils 0.17.1

Regenerate the man pages to match contents produced in a Sphinx
environment using the above package versions.  This is necessary to
prevent the "docs" GitLab CI job from failing.

(cherry picked from commit e80ce6cfe2)
2022-04-22 13:11:35 +02:00
Michał Kępień ccea861632 Merge branch '3297-fix-a-pylint-2.13.7-error-v9_18' into 'v9_18'
[v9_18] Fix a PyLint 2.13.7 error

See merge request isc-projects/bind9!6151
2022-04-22 10:34:57 +00:00
Michał Kępień fd1f39fe59 Fix a PyLint 2.13.7 error
PyLint 2.13.7 reports the following error:

    bin/tests/system/doth/conftest.py:34:28: E0601: Using variable 'stderr' before assignment (used-before-assignment)

The reason the current code has not caused problems before is that
invoking gnutls-cli with just the --logfile=/dev/null argument causes it
to always return with a non-zero exit code, either due to the option not
being supported or due to the hostname argument not being provided.  In
other words, the 'except' branch has always been taken.  PyLint is
obviously right on a syntactical level, though.

Instead of relying on a less than obvious code flow (where the 'except'
branch is always taken), rework the flagged code by employing
subprocess.run(..., check=False) instead of subprocess.check_output(),
making exception handling redundant.

While this issue was investigated, it was also noticed that
subprocess.check_output() was incorrectly used as a context manager:
Popen objects are context managers, but subprocess.check_output() and
subprocess.run() are not.  Fix by dropping the relevant 'with'
statement.

(cherry picked from commit 3f5318f094)
2022-04-22 12:14:50 +02:00
Michał Kępień f8d17c6263 Fix "digdelv" system test requirements
Commit f64cd23e7b added a Python-based
name server (bin/tests/system/digdelv/ans8/ans.py) to the "digdelv"
system test, but did not update bin/tests/system/Makefile.am to ensure
Python is present in the test environment before the "digdelv" system
test is run.  Update bin/tests/system/Makefile.am to enforce that
requirement.

(cherry picked from commit aaa0223752)
2022-04-22 12:14:50 +02:00
Michał Kępień 1735e589d1 Require Python 3.6+ for running Python-based tests
configure.ac currently requires Python 3.4 for running Python-based
system tests.  Meanwhile, there are some features in Python 3.6+ that we
would like to use for making our Python code cleaner (e.g. f-strings).
Update the minimum Python version required for running Python-based
system tests to 3.6, noting that:

  - Python 3.4 has reached end-of-life on March 18th, 2019.
  - Python 3.5 has reached end-of-life on September 5th, 2020.

(cherry picked from commit beaaa7f4e2)
2022-04-22 12:14:50 +02:00
Michał Kępień 0f59e1e270 Merge branch '3287-prevent-memory-bloat-caused-by-a-jemalloc-quirk-v9_18' into 'v9_18'
[v9_18] Prevent memory bloat caused by a jemalloc quirk

See merge request isc-projects/bind9!6153
2022-04-21 12:42:06 +00:00
Michał Kępień 5e4855a25d Add CHANGES entry for GL #3287
(cherry picked from commit e33aef4e39)
2022-04-21 14:22:13 +02:00
Michał Kępień 2da371d005 Prevent memory bloat caused by a jemalloc quirk
Since version 5.0.0, decay-based purging is the only available dirty
page cleanup mechanism in jemalloc.  It relies on so-called tickers,
which are simple data structures used for ensuring that certain actions
are taken "once every N times".  Ticker data (state) is stored in a
thread-specific data structure called tsd in jemalloc parlance.  Ticks
are triggered when extents are allocated and deallocated.  Once every
1000 ticks, jemalloc attempts to release some of the dirty pages hanging
around (if any).  This allows memory use to be kept in check over time.

This dirty page cleanup mechanism has a quirk.  If the first
allocator-related action for a given thread is a free(), a
minimally-initialized tsd is set up which does not include ticker data.
When that thread subsequently calls *alloc(), the tsd transitions to its
nominal state, but due to a certain flag being set during minimal tsd
initialization, ticker data remains unallocated.  This prevents
decay-based dirty page purging from working, effectively enabling memory
exhaustion over time. [1]

The quirk described above has been addressed (by moving ticker state to
a different structure) in jemalloc's development branch [2], but not in
any numbered jemalloc version released to date (the latest one being
5.2.1 as of this writing).

Work around the problem by ensuring that every thread spawned by
isc_thread_create() starts with a malloc() call.  Avoid immediately
calling free() for the dummy allocation to prevent an optimizing
compiler from stripping away the malloc() + free() pair altogether.

An alternative implementation of this workaround was considered that
used a pair of isc_mem_create() + isc_mem_destroy() calls instead of
malloc() + free(), enabling the change to be fully contained within
isc__trampoline_run() (i.e. to not touch struct isc__trampoline), as the
compiler is not allowed to strip away arbitrary function calls.
However, that solution was eventually dismissed as it triggered
ThreadSanitizer reports when tools like dig, nsupdate, or rndc exited
abruptly without waiting for all worker threads to finish their work.

[1] https://github.com/jemalloc/jemalloc/issues/2251
[2] https://github.com/jemalloc/jemalloc/commit/c259323ab3082324100c708109dbfff660d0f4b8

(cherry picked from commit 7aa7b6474b)
2022-04-21 14:22:13 +02:00
Michał Kępień 0deec48487 Merge tag 'v9_18_2' into v9_18
BIND 9.18.2
2022-04-21 09:44:56 +02:00
Tony Finch 05c88b18da Merge branch '3275-notify-test-fix-v9_18' into 'v9_18'
Avoid timeouts in the notify system test (backport to 9.18)

See merge request isc-projects/bind9!6143
2022-04-20 17:12:36 +00:00
Tony Finch 037223211c Use wait_for_log_re in the autosign system test
Fix another occurrence of the mistake of passing a regex to
wait_for_log by using the new wait_for_log_re instead.

(cherry picked from commit f4c2909353)
2022-04-20 17:51:40 +01:00
Tony Finch 19cf15313c Avoid timeouts in the notify system test
There were two problems in the notify system test when it waited for
log messages to appear: the shellcheck refactoring introduced a call
to `wait_for_log` with a regex, but `wait_for_log` only supports fixed
strings, so it always ran for the full 45 second timeout; and the new
test to ensure that notify messages time out failed to reset the
nextpart pointer, so if the notify messages timed out before the test
ran, it would fail to see them.

This change adds a `wait_for_log_re` helper that matches a regex, and
uses it where appropriate in the notify system test, which stops the
test from waiting longer than necessary; and it resets the nextpart
pointer so that the notify timeout test works reliably.

Closes #3275

(cherry picked from commit 4a30733ae5)
2022-04-20 17:51:40 +01:00
Mark Andrews e618bdd2df Merge branch '3279-lib-dns-ncache-c-rdataset_settrust-fails-to-set-trust-on-called-rdataset-v9_18' into 'v9_18'
Check that pending negative cache entries for DS can be used successfully

See merge request isc-projects/bind9!6135
2022-04-19 00:05:39 +00:00
Mark Andrews b66e00f73a Add CHANGES entry for [GL #3279]
(cherry picked from commit 14ca6270d3)
2022-04-19 09:44:09 +10:00
Mark Andrews 40bfb70d6a Update the rdataset->trust field in ncache.c:rdataset_settrust
Both the trust recorded in the slab stucture and the trust on
rdataset need to be updated.

(cherry picked from commit d043a41499)
2022-04-19 09:44:09 +10:00
Mark Andrews b597ea863e Check that pending negative cache entries for DS can be used successfully
Prime the cache with a negative cache DS entry then make a query for
name beneath that entry. This will cause the DS entry to be retieved
as part of the validation process.  Each RRset in the ncache entry
will be validated and the trust level for each will be updated.

(cherry picked from commit d2d9910da2)
2022-04-19 09:44:09 +10:00
Evan Hunt 230b2b8c56 Merge branch '3235-dig-exitcode-v9_18' into 'v9_18'
ensure dig sets exitcode after local UDP connection failure

See merge request isc-projects/bind9!6134
2022-04-15 18:10:08 +00:00
Evan Hunt 5739f13063 CHANGES for [GL #3235]
(cherry picked from commit d646aca282)
2022-04-15 11:08:46 -07:00
Evan Hunt 50dc4f1587 ensure dig sets exitcode after local UDP connection failure
dig previously set an exit code of 9 when a TCP connection failed
or when a UDP connection timed out, but when the server address is
localhost it's possible for a UDP query to fail with ISC_R_CONNREFUSED.
that code path didn't update the exit code, causing dig to exit with
status 0. we now set the exit code to 9 in this failure case.

(cherry picked from commit 4eee6460ff)
2022-04-15 11:08:46 -07:00
Arаm Sаrgsyаn 94d2d349d2 Merge branch '3223-catz-change-of-ownership-aka-coo-support-v9_18' into 'v9_18'
[v9_18] [3/5] Implement catalog zones change of ownership (coo) support

See merge request isc-projects/bind9!6133
2022-04-14 22:48:48 +00:00
Aram Sargsyan 546732546f Do not use REQUIRE in dns_catz_entry_detach() after other code
The REQUIRE checks should be at the top of the function before
any assignments or code.

Move the REQUIRE check to the top.

(cherry picked from commit 99d1ec6c4b)
2022-04-14 20:53:59 +00:00
Aram Sargsyan 5037aeb5d2 Replace CATZ_OPT_MASTERS with CATZ_OPT_PRIMARIES
Update the enum entry in the continued effort of replacing some
DNS terminology.

(cherry picked from commit 59c486391d)
2022-04-14 20:53:53 +00:00
Aram Sargsyan c5d523d8e9 Add CHANGES note for [GL #3223]
(cherry picked from commit 1c33dbd27d)
2022-04-14 20:53:46 +00:00
Aram Sargsyan c37a75df5d Implement catalog zones change of ownership (coo) support
Catalog zones change of ownership is special mechanism to facilitate
controlled migration of a member zone from one catalog to another.

It is implemented using catalog zones property named "coo" and is
documented in DNS catalog zones draft version 5 document.

Implement the feature using a new hash table in the catalog zone
structure, which holds the added "coo" properties for the catalog zone
(containing the target catalog zone's name), and the key for the hash
table being the member zone's name for which the "coo" property is being
created.

Change some log messages to have consistent zone name quoting types.

Update the ARM with change of ownership documentation and usage
examples.

Add tests which check newly the added features.

(cherry picked from commit bb837db4ee)
2022-04-14 20:53:31 +00:00
Arаm Sаrgsyаn 1a9dc2fcad Merge branch '3222-catz-options-new-syntax-based-on-custom-properties-v9_18' into 'v9_18'
[v9_18] [2/5] Implement catalog zones options new syntax based on custom properties

See merge request isc-projects/bind9!6132
2022-04-14 20:27:54 +00:00
Aram Sargsyan 581d7bece0 Do not cancel processing record datasets in catalog zone after an error
When there are multiple record datasets in a database node of a catalog
zone, and BIND encounters a soft error during processing of a dataset,
it breaks from the loop and doesn't process the other datasets in the
node.

There are cases when this is not desired. For example, the catalog zones
draft version 5 states that there must be a TXT RRset named
`version.$CATZ` with exactly one RR, but it doesn't set a limitation
on possible non-TXT RRsets named `version.$CATZ` existing alongside
with the TXT one. In case when one exists, we will get a processing
error and will not continue the loop to process the TXT RRset coming
next.

Remove the "break" statement to continue processing all record datasets.

(cherry picked from commit 0b2d5490cd)
2022-04-14 19:51:45 +00:00
Aram Sargsyan d8e1f51a04 Process the 'version' record of the catalog zone first
When processing a new or updated catalog zone, the record datasets
from the database are being processed in order. This creates a
problem because we need to know the version of the catalog zone
schema to process some of the records differently, but we do not
know the version until the 'version' record gets processed.

Find the 'version' record and process it first, only then iterate over
the database to process the rest, making sure not to process the
'version' record twice.

(cherry picked from commit 6035980bb1)
2022-04-14 19:51:37 +00:00
Aram Sargsyan 3e07e505b0 Add CHANGES note for [GL #3222]
(cherry picked from commit 321c93c05d)
2022-04-14 19:51:30 +00:00
Aram Sargsyan f75c39811d Implement catalog zones options new syntax based on custom properties
According to DNS catalog zones draft version 5 document, catalog
zone custom properties must be placed under the "ext" label.

Make necessary changes to support the new custom properties syntax in
catalog zones with version "2" of the schema.

Change the default catalog zones schema version from "1" to "2" in
ARM to prepare for the new features and changes which come starting
from this commit in order to support the latest DNS catalog zones draft
document.

Make some restructuring in ARM and rename the term catalog zone "option"
to "custom property" to better reflect the terms used in the draft.

Change the version of 'catalog1.zone.' catalog zone in the "catz" system
test to "2", and leave the version of 'catalog2.zone.' catalog zone at
version "1" to test both versions.

Add tests to check that the new syntax works only with the new schema
version, and that the old syntax works only with the legacy schema
version catalog zones.

(cherry picked from commit cedfebc64a)
2022-04-14 19:51:22 +00:00
Arаm Sаrgsyаn 55dd09098f Merge branch '3144-dig-+trace-or-+nssearch-with-+tcp-always-crashes-v9_18' into 'v9_18'
[v9_18] Unify dig +nssearch next query starting code for TCP and UDP protocols

See merge request isc-projects/bind9!6130
2022-04-14 11:30:43 +00:00
Aram Sargsyan c97b23a152 Add CHANGES note for [GL #3144]
(cherry picked from commit 2a9867d512)
2022-04-14 09:40:59 +00:00
Evan HuntandAram Sargsyan 7c0ef393d8 detach unfinished query when canceling
when a query was canceled while still in the process of connecting,
tcp_connected() and udp_ready() didn't detach the query object.

(cherry picked from commit 6bf8535542)
2022-04-14 09:40:50 +00:00
Aram Sargsyan 7683d6ce69 Unify dig +nssearch next query starting code for TCP and UDP protocols
In `+nssearch` mode `dig` starts the next query of the followup lookup
using `start_udp()` or `start_tcp()` calls without waiting for the
previous query to complete.

In UDP mode that happens in the `send_done()` callback of the previous
query, but in TCP mode that happens in the `start_tcp()` call of the
previous query (recursion) which doesn't work because `start_tcp()`
attaches the `lookup->current_query` to the query it is starting, so a
recursive call will result in an assertion failure.

Make the TCP mode to start the next query in `send_done()`, just like in
the UDP mode. During that time the `lookup->current_query` is already
detached by the `tcp_connected()`/`udp_ready()` callbacks.

(cherry picked from commit b944bf4120)
2022-04-14 09:40:37 +00:00
Matthijs Mekking da30a638a2 Merge branch '2931-cds-delete-removed-on-signing-v9_18' into 'v9_18'
[v9_18] Don't delete CDS DELETE after zone sign

See merge request isc-projects/bind9!6126
2022-04-13 13:12:04 +00:00
Matthijs Mekking bff9a568c8 Add CDS/CDNSKEY DELETE documentation
Mention in the DNSSEC guide in the "revert to unsigned" recipe that you
can publish CDS and CDNSKEY DELETE records to remove the corresponding
DS records from the parent zone.

(cherry picked from commit f088657eb1)
2022-04-13 14:44:25 +02:00
Matthijs Mekking c678065eaa Add CHANGE and release note for #2931
Release note worthy.

(cherry picked from commit ebbcf4c34f)
2022-04-13 14:44:18 +02:00
Matthijs Mekking c3ab09deb5 Update dns_dnssec_syncdelete() function
Update the function that synchronizes the CDS and CDNSKEY DELETE
records. It now allows for the possibility that the CDS DELETE record
is published and the CDNSKEY DELETE record is not, and vice versa.

Also update the code in zone.c how 'dns_dnssec_syncdelete()' is called.

With KASP, we still maintain the DELETE records our self. Otherwise,
we publish the CDS and CDNSKEY DELETE record only if they are added
to the zone. We do still check if these records can be signed by a KSK.

This change will allow users to add a CDS and/or CDNSKEY DELETE record
manually, without BIND removing them on the next zone sign.

Note that this commit removes the check whether the key is a KSK, this
check is redundant because this check is also made in
'dst_key_is_signing()' when the role is set to DST_BOOL_KSK.

(cherry picked from commit 3d05c99abb)
2022-04-13 14:43:40 +02:00
Matthijs Mekking d975d07155 Test CDS DELETE persists after zone sign
Add a test case for a dynamically added CDS DELETE record and make
sure it is not removed when signing the zone. This happens because
BIND maintains CDS and CDNSKEY publishing and it will only allow
CDS DELETE records if the zone is transitioning to insecure. This is
a state that can be identified when using KASP through 'dnssec-policy',
but not when using 'auto-dnssec'.

(cherry picked from commit f08277f9fb)
2022-04-13 14:43:34 +02:00
Michał Kępień 4a622db88d Merge branch 'michal/fix-forward-system-test-requirements-v9_18' into 'v9_18'
[v9_18] Fix "forward" system test requirements

See merge request isc-projects/bind9!6123
2022-04-12 13:32:25 +00:00
Michał Kępień 80089f52e5 Fix "forward" system test requirements
Commit 3b3495a631 added a Python-based
name server (bin/tests/system/forward/ans11/ans.py) to the "forward"
system test, but did not update bin/tests/system/Makefile.am to ensure
Python is present in the test environment before the "forward" system
test is run.  Update bin/tests/system/Makefile.am to enforce that
requirement.

(cherry picked from commit 806f457147)
2022-04-12 15:30:31 +02:00
Michał Kępień 41ddf9ce8c Merge branch 'michal/set-up-release-notes-for-bind-9.18.3' into 'v9_18'
Set up release notes for BIND 9.18.3

See merge request isc-projects/bind9!6119
2022-04-12 12:15:07 +00:00
Michał Kępień 55221e61c0 Set up release notes for BIND 9.18.3 2022-04-12 14:13:32 +02:00
Michał Kępień 4360b7532c Merge branch 'michal/update-bind-version-to-9.18.3-dev' into 'v9_18'
Update BIND version to 9.18.3-dev

See merge request isc-projects/bind9!6115
2022-04-12 11:12:20 +00:00
Michał Kępień 09ffa6cdd2 Update BIND version to 9.18.3-dev 2022-04-12 13:11:12 +02:00
Michał Kępień 3babb1557a Update BIND version to 9.18.2 2022-04-11 16:00:43 +02:00
Michał Kępień f78abdc474 Add a CHANGES marker 2022-04-11 16:00:43 +02:00
Michał Kępień 1983c3a45a Merge branch 'michal/prepare-documentation-for-bind-9.18.2' into 'v9_18_2-release'
Prepare documentation for BIND 9.18.2

See merge request isc-private/bind9!397
2022-04-11 13:59:32 +00:00
Michał Kępień 4ec20be2ae Prepare release notes for BIND 9.18.2 2022-04-11 15:56:43 +02:00
Michał Kępień b91083494e Add release note for miscellaneous dig fixes 2022-04-11 15:56:43 +02:00
Michał Kępień a4cc916c5b Reorder release notes 2022-04-11 15:56:43 +02:00
Michał Kępień 5c0e3a1d8d Tweak and reword release notes 2022-04-11 15:56:43 +02:00
Michał Kępień d0e094e81e Fix CHANGES marker location for BIND 9.17.22 2022-04-11 15:56:43 +02:00
Michal Nowak cb17d68ae7 Merge branch '3129-test-check-fetch-shutting-down-in-resume_dslookup-v9_18' into 'v9_18'
[v9_18] [CVE-2022-0667] Add a hung fetch check while chasing DS in the forward system test

See merge request isc-projects/bind9!6110
2022-04-08 10:49:59 +00:00
Aram SargsyanandMichal Nowak db3ab0b46e Add a hung fetch check while chasing DS in the forward system test
Implement TCP support in the `ans11` Python-based DNS server.

Implement a control command channel in `ans11` to support an optional
silent mode of operation, which, when enabled, will ignore incoming
queries.

In the added check, make the `ans11` the NS server of
"a.root-servers.nil." for `ns3`, so it uses `ans11` (in silent mode)
for the regular (non-forwarded) name resolutions.

This will trigger the "hung fetch" scenario, which was causing `named`
to crash.

(cherry picked from commit 848094d6f7)
2022-04-08 12:19:04 +02:00
Petr Špaček d9da0a55b9 Merge branch '2950-cache-acceptance-rules-test-v9_18' into 'v9_18'
[CVE-2021-25220] Add tests for forwarder cache poisoning scenarios [v9_18]

See merge request isc-projects/bind9!6105
2022-04-07 18:00:03 +00:00
Mark AndrewsandPetr Špaček 3b3495a631 Add tests for forwarder cache poisoning scenarios
- Check that an NS in an authority section returned from a forwarder
  which is above the name in a configured "forward first" or "forward
  only" zone (i.e., net/NS in a response from a forwarder configured for
  local.net) is not cached.
- Test that a DNAME for a parent domain will not be cached when sent
  in a response from a forwarder configured to answer for a child.
- Check that glue is rejected if its name falls below that of zone
  configured locally.
- Check that an extra out-of-bailiwick data in the answer section is
  not cached (this was already working correctly, but was not explicitly
  tested before).

(cherry picked from commit bf3fffff67)
2022-04-07 19:30:43 +02:00
Michal Nowak 4f44fe804d Merge branch '3112-test-lingering-tcp-sockets-in-closewait-v9_18' into 'v9_18'
[v9_18] Add system test lingering CLOSE_WAIT TCP sockets

See merge request isc-projects/bind9!6103
2022-04-07 16:44:16 +00:00
Ondřej SurýandMichal Nowak f1d1594e0a Add system test **/named.* modifier files to .reuse/dep5
There's couple of files that modify behaviour of named when started via
bin/tests/system/start.pl.  Add those files as CC-1.0 to .reuse/dep5 as
they are just empty placeholders.

(cherry picked from commit b6eb31a0e3)
2022-04-07 18:07:14 +02:00
Matthijs MekkingandMichal Nowak b79c04d5f6 Add system test lingering CLOSE_WAIT TCP sockets
Add a test case to check for lingering TCP sockets stuck in the
CLOSE_WAIT state. This can happen if a client sends some garbage after
its first query.

The system test runs the reproducer script and then sends another TCP
query to the resolver. The resolver is configured to allow one TCP
client only. If BIND has its TCP socket stuck in CLOSE_WAIT, it does
not have the resources available to answer the second query.

Note: A better test would be to check if the named daemon does not
have a TCP socket stuck in CLOSE_WAIT for example with netstat. When
running this test locally you can examine named with netstat manually.
But since netstat is platform specific it is not a good candidate to do
this as a system test.

If you, if you could return, don't let it burn.
Do you have to let it linger?
- Cranberries

(cherry picked from commit b9ebde705b)
2022-04-07 18:07:08 +02:00
Michał Kępień 24f8670e3a Merge branch '3208-add-CHANGES-entry-v9_18' into 'v9_18'
[v9_18] Add CHANGES entry for GL #3208

See merge request isc-projects/bind9!6100
2022-04-07 13:08:01 +00:00
Michał Kępień 3008142393 Add CHANGES entry for GL #3208
(cherry picked from commit 059a602551)
2022-04-07 15:04:19 +02:00
Petr Špaček a7c8c41172 Merge branch 'pspacek/junit-report-v9_18' into 'v9_18'
Generate JUnit reports for unit & system tests [v9_18]

See merge request isc-projects/bind9!6097
2022-04-06 19:39:59 +00:00
Petr Špaček 8961dc452e Generate JUnit reports for unit & system tests
This allows Gitlab to show nice summary for individual tests/test
directories and to expose the results in Gitlab API for consumption
elsewhere.

A catch: As of Gitlab 14.7.7, the detailed results are stored
only in artifacts and thus expire. All consumers (including API) need
to be "fast enough" to get the data before they disappear.
This also forces us to always store the artifacts intead of storing them
only on failure.

(cherry picked from commit d26d4f289f)
2022-04-06 21:16:00 +02:00
Tony Finch b6f13cd43d Merge branch '3242-notify-notimeout-v9_18' into 'v9_18'
Ensure that zone maintenance queries have a retry limit (backport to 9.18)

See merge request isc-projects/bind9!6096
2022-04-06 17:36:16 +00:00
Tony Finch 4191fd01be Ensure that dns_request_createvia() has a retry limit
There are a couple of problems with dns_request_createvia(): a UDP
retry count of zero means unlimited retries (it should mean no
retries), and the overall request timeout is not enforced. The
combination of these bugs means that requests can be retried forever.

This change alters calls to dns_request_createvia() to avoid the
infinite retry bug by providing an explicit retry count. Previously,
the calls specified infinite retries and relied on the limit implied
by the overall request timeout and the UDP timeout (which did not work
because the overall timeout is not enforced). The `udpretries`
argument is also changed to be the number of retries; previously, zero
was interpreted as infinity because of an underflow to UINT_MAX, which
appeared to be a mistake. And `mdig` is updated to match the change in
retry accounting.

The bug could be triggered by zone maintenance queries, including
NOTIFY messages, DS parental checks, refresh SOA queries and stub zone
nameserver lookups. It could also occur with `nsupdate -r 0`.
(But `mdig` had its own code to avoid the bug.)

(cherry picked from commit 71ce8b0a51)
2022-04-06 18:17:55 +01:00
Tony Finch 9bcc537882 Make notify test shellcheck clean
Use POSIX shell syntax, and use functions to reduce repetition.

(cherry picked from commit 5867c1b727)
2022-04-06 18:16:44 +01:00
Ondřej Surý 8fef3e0efd Merge branch '3249-rename-configuration-option-to-reuseport-v9_18' into 'v9_18'
Rename the configuration option to load balance sockets to reuseport [v9.18]

See merge request isc-projects/bind9!6094
2022-04-06 15:42:08 +00:00
Ondřej Surý a1f3ff0dd1 Rename the configuration option to load balance sockets to reuseport
After some back and forth, it was decidede to match the configuration
option with unbound ("so-reuseport"), PowerDNS ("reuseport") and/or
nginx ("reuseport").

(cherry picked from commit 7e71c4d0cc)
2022-04-06 17:24:13 +02:00
Ondřej Surý fd9a2fc0ba Merge branch '3190-offload-rpz-updates-revert-v9_18' into 'v9_18'
Revert "Run the RPZ update as offloaded work" [v9.18]

See merge request isc-projects/bind9!6091
2022-04-06 11:49:11 +00:00
Ondřej Surý 25bc461446 Revert "General cleanup of dns_rpz implementation"
This reverts commit bfee462403.
2022-04-06 10:42:29 +02:00
Ondřej Surý 242500909a Revert "Refactor the dns_rpz_add/delete to use local rpz copy"
This reverts commit f4cba0784e.
2022-04-06 10:42:22 +02:00
Ondřej Surý 9b78612e7d Revert "Run the RPZ update as offloaded work"
This reverts commit e128b6a951.
2022-04-06 10:30:06 +02:00
Ondřej Surý c8a0899ddd Revert "Add CHANGES and release note for [GL #3190]"
This reverts commit f3ae14d8c3.
2022-04-06 10:30:04 +02:00
Arаm Sаrgsyаn b670334e6d Merge branch '3244-dig-use-after-free-v9_18' into 'v9_18'
[v9_18] When using +qr in dig print the data of the current query

See merge request isc-projects/bind9!6085
2022-04-05 12:26:09 +00:00
Aram Sargsyan 3914408950 Add CHANGES note for [GL #3244]
(cherry picked from commit ef9bd8533a)
2022-04-05 11:54:13 +00:00
Aram Sargsyan bf9bec6f91 Fix using unset pointer when printing a debug message in dighost.c
The used `query->handle` is always `NULL` at this point.

Change the code to use `handle` instead.

(cherry picked from commit 5b2b3e589c)
2022-04-05 11:54:06 +00:00
Aram Sargsyan 927f00e15d Add a missing clear_current_lookup() call in recv_done()
The error code path handling the `ISC_R_CANCELED` code lacks a
`clear_current_lookup()` call, without which dig hangs indefinitely
when handling the error.

Add the missing call to account for all references of the lookup so
it can be destroyed.

(cherry picked from commit 2771a5b64d)
2022-04-05 11:53:52 +00:00
Aram Sargsyan 8e57030f69 When using +qr in dig print the data of the current query
In `send_udp()` and `launch_next_query()` functions, when calling
`dighost_printmessage()` to print detailed information about the
sent query, dig always prints the data of the first query in the
lookup's queries list.

The first query in the list can be already finished, having its handles
freed, and accessing this information results in assertion failure.

Print the current query's information instead.

(cherry picked from commit f831e758d1)
2022-04-05 11:53:45 +00:00
Michal Nowak b47c22677b Merge branch '3158-only-set-foundname-on-success-test-v9_18' into 'v9_18'
[v9_18] Add regression test for CVE-2022-0635

See merge request isc-projects/bind9!6082
2022-04-05 10:02:35 +00:00
Mark AndrewsandMichal Nowak 072e77dc9d Add regression test for CVE-2022-0635
(cherry picked from commit 56fbed2f0f)
2022-04-05 11:03:20 +02:00
Mark Andrews 702ab284c7 Merge branch '3220-digdelv-test-uses-address-outside-of-our-control-v9_18' into 'v9_18'
Use multiple fixed expressions for portable grep usage

See merge request isc-projects/bind9!6081
2022-04-05 05:04:18 +00:00
Mark Andrews 88265211cb Use multiple fixed expressions for portable grep usage
Additionally add "network unreachable" as an expected error message.

(cherry picked from commit 9ef4d2b583)
2022-04-05 14:34:40 +10:00
Ondřej Surý 70c8e77e36 Merge branch 'ondrej-dont-use-shutdown-function-name-v9_18' into 'v9_18'
Rename shutdown() to test_shutdown() in timer_test.c [v9.18]

See merge request isc-projects/bind9!6080
2022-04-05 00:02:04 +00:00
Ondřej Surý df91d61dc7 Rename shutdown() to test_shutdown() in timer_test.c
The shutdown() is part of standard library (POSIX-1), don't use such
name in the timer_test.c, but rather rename it to test_shutdown().

(cherry picked from commit 7868d8145b)
2022-04-05 01:56:09 +02:00
Ondřej Surý 6c7fb350d7 Merge branch '3249-add-configuration-option-to-disable-SO_REUSEPORT_LB-fix-v9_18' into 'v9_18'
Enable the load-balance-sockets configuration [v9.18]

See merge request isc-projects/bind9!6077
2022-04-04 23:54:18 +00:00
Ondřej Surý cd24556e14 Enable the load-balance-sockets configuration
Previously, HAVE_SO_REUSEPORT_LB has been defined only in the private
netmgr-int.h header file, making the configuration of load balanced
sockets inoperable.

Move the missing HAVE_SO_REUSEPORT_LB define the isc/netmgr.h and add
missing isc_nm_getloadbalancesockets() implementation.

(cherry picked from commit 142c63dda8)
2022-04-05 01:38:49 +02:00
Ondřej Surý 00d16d26b9 Merge branch '3249-add-configuration-option-to-disable-SO_REUSEPORT_LB-v9_18' into 'v9_18'
Add option to configure load balance sockets [v9.18]

See merge request isc-projects/bind9!6073
2022-04-04 22:42:26 +00:00
Ondřej Surý eef9459d87 Merge branch '3190-offload-rpz-updates-v9_18' into 'v9_18'
General cleanup of dns_rpz implementation [v9.18]

See merge request isc-projects/bind9!6072
2022-04-04 22:00:27 +00:00
Ondřej Surý 4c8e94fa71 Add CHANGES and release note for [GL #3249]
(cherry picked from commit 855f49cfba)
2022-04-05 00:00:17 +02:00
Ondřej Surý 64265f1c0e Add option to configure load balance sockets
Previously, the option to enable kernel load balancing of the sockets
was always enabled when supported by the operating system (SO_REUSEPORT
on Linux and SO_REUSEPORT_LB on FreeBSD).

It was reported that in scenarios where the networking threads are also
responsible for processing long-running tasks (like RPZ processing, CATZ
processing or large zone transfers), this could lead to intermitten
brownouts for some clients, because the thread assigned by the operating
system might be busy.  In such scenarious, the overall performance would
be better served by threads competing over the sockets because the idle
threads can pick up the incoming traffic.

Add new configuration option (`load-balance-sockets`) to allow enabling
or disabling the load balancing of the sockets.

(cherry picked from commit 85c6e797aa)
2022-04-04 23:59:59 +02:00
Ondřej Surý f3ae14d8c3 Add CHANGES and release note for [GL #3190]
(cherry picked from commit 23a4559b34)
2022-04-04 22:59:59 +02:00
Ondřej Surý e128b6a951 Run the RPZ update as offloaded work
Previously, the RPZ updates ran quantized on the main nm_worker loops.
As the quantum was set to 1024, this might lead to service
interruptions when large RPZ update was processed.

Change the RPZ update process to run as the offloaded work.  The update
and cleanup loops were refactored to do as little locking of the
maintenance lock as possible for the shortest periods of time and the db
iterator is being paused for every iteration, so we don't hold the rbtdb
tree lock for prolonged periods of time.

(cherry picked from commit f106d0ed2b)
2022-04-04 22:59:59 +02:00
Ondřej Surý f4cba0784e Refactor the dns_rpz_add/delete to use local rpz copy
Previously dns_rpz_add() were passed dns_rpz_zones_t and index to .zones
array.  Because we actually attach to dns_rpz_zone_t, we should be using
the local pointer instead of passing the index and "finding" the
dns_rpz_zone_t again.

Additionally, dns_rpz_add() and dns_rpz_delete() were used only inside
rpz.c, so make them static.

(cherry picked from commit b6e885c97f)
2022-04-04 22:59:59 +02:00
Ondřej Surý bfee462403 General cleanup of dns_rpz implementation
Do a general cleanup of lib/dns/rpz.c style:

 * Removed deprecated and unused functions
 * Unified dns_rpz_zone_t naming to rpz
 * Unified dns_rpz_zones_t naming to rpzs
 * Add and use rpz_attach() and rpz_attach_rpzs() functions
 * Shuffled variables to be more local (cppcheck cleanup)

(cherry picked from commit 840179a247)
2022-04-04 22:59:59 +02:00
Tony Finch cc1988187c Merge branch 'fanf/macos-ifconfig-v9_18' into 'v9_18'
MacOS needs more IP addresses to run the system tests (backport to 9.18)

See merge request isc-projects/bind9!6069
2022-04-04 14:24:30 +00:00
Tony Finch 541222043d MacOS needs more IP addresses to run the system tests
The launchd script only counted up to 8 whereas ifconfig.sh went all
the way up to 10, and even a bit further than that.

(cherry picked from commit 29a3e77425)
2022-04-04 15:06:31 +01:00
Arаm Sаrgsyаn 83b7563111 Merge branch '3248-dig-stuck-using-a-server-with-a-mapped-ip-address-v9_18' into 'v9_18'
[v9_18] Fix dig hanging issue in cases when the lookup's next query can't start

See merge request isc-projects/bind9!6068
2022-04-04 10:20:35 +00:00
Aram Sargsyan 5c6580b31f Add CHANGES note for [GL #3248]
(cherry picked from commit 438e9b5587)
2022-04-04 09:19:44 +00:00
Aram Sargsyan 1294de8e36 Fix dig hanging issue in cases when the lookup's next query can't start
In recv_done(), when dig decides to start the lookup's next query in
the line using `start_udp()` or `start_tcp()`, and for some reason,
no queries get started, dig doesn't cancel the lookup.

This can occur, for example, when there are two queries in the lookup,
one with a regular IP address, and another with a IPv4 mapped IPv6
address. When the regular IP address fails to serve the query, its
`recv_done()` callback starts the next query in the line (in this
case the one with a mapped IP address), but because `dig` doesn't
connect to such IP addresses, and there are no other queries in the
list, no new queries are being started, and the lookup keeps hanging.

After calling `start_udp()` or `start_tcp()` in `recv_done()`, check
if there are no pending/working queries then cancel the lookup instead
of only detaching from the current query.

(cherry picked from commit 7e2f50c369)
2022-04-04 09:18:46 +00:00
Evan Hunt 2c4e7c1702 Merge branch '3250-resolver-test-non-querytrace-v9_18' into 'v9_18'
fix resolver test when built without --enable-querytrace

See merge request isc-projects/bind9!6065
2022-04-01 17:30:01 +00:00
Evan Hunt a18c824f6a fix resolver test when built without --enable-querytrace
a test case in the 'resolver' system test was reliant on
logged output that would only be present when query tracing
was enabled, as in developer builds. that test case is now
disabled when query tracing is not available. Thanks to
Anton Castelli.

(cherry picked from commit 5319d8adea)
2022-04-01 10:17:00 -07:00
Arаm Sаrgsyаn 71201fa71e Merge branch '3145-dig-+nssearch-does-not-exit-until-interrupted-v9_18' into 'v9_18'
[v9_18] Fix "dig +nssearch" indefinitely hanging issue

See merge request isc-projects/bind9!6057
2022-04-01 12:25:54 +00:00
Aram Sargsyan cfdf95d437 Synchronze udp_ready() and tcp_connected() functions entry behavior
The `udp_ready()` and `tcp_connected()` functions in dighost.c are
used for similar purposes for UDP and TCP respectively.

Synchronize the `udp_ready()` function entry code to behave like
`tcp_connected()` by adding input validation, debug messages and
early exit code when `cancel_now` is `true`.

(cherry picked from commit 4477f71868)
2022-04-01 11:53:47 +00:00
Aram Sargsyan 09e9aabb11 Add CHANGES note for [GL #3145]
(cherry picked from commit 3a5793ece2)
2022-04-01 11:53:40 +00:00
Aram Sargsyan 16bdced2ca Fix "dig +nssearch" indefinitely hanging issue
When finishing the NSSEARCH task and there is no more followup
lookups to start, dig does not destroy the last lookup, which
causes it to hang indefinitely.

Rename the unused `first_pass` member of `dig_query_t` to `started`
and make it `true` in the first callback after `start_udp()` or
`start_tcp()` of the query to indicate that the query has been
started.

Create a new `check_if_queries_done()` function to check whether
all of the queries inside a lookup have been started and finished,
or canceled.

Use the mentioned function in the TRACE code block in `recv_done()`
to check whether the current query is the last one in the lookup and
cancel the lookup in that case to free the resources.

(cherry picked from commit 7d360bd05e)
2022-04-01 11:53:33 +00:00
Mark Andrews 49320f73df Merge branch '3191-issue-45178-in-oss-fuzz-bind9-dns_master_load_fuzzer-integer-overflow-in-generate-v9_18' into 'v9_18'
Prevent arithmetic overflow of 'i' in master.c:generate

See merge request isc-projects/bind9!6055
2022-04-01 11:01:42 +00:00
Evan HuntandMark Andrews 953f62c1e7 add a system test for $GENERATE with an integer overflow
the line "$GENERATE 19-28/2147483645 $ CNAME x" should generate
a single CNAME with the owner "19.example.com", but prior to the
overflow bug it generated several CNAMEs, half of them with large
negative values.

we now test for the bugfix by using "named-checkzone -D" and
grepping for a single CNAME in the output.

(cherry picked from commit bd814b79d4)
2022-04-01 21:42:35 +11:00
Evan HuntandMark Andrews 8ac8197f0d update shell syntax
clean up the shell syntax in the checkzone test prior to adding
a new test.

(cherry picked from commit 2261c853b5)
2022-04-01 21:42:35 +11:00
Mark Andrews 3a3219fd3f Add test case for issue-45178
(cherry picked from commit 9039aad0f8)
2022-04-01 21:42:35 +11:00
Mark Andrews 1eff9bbf37 Prevent arithmetic overflow of 'i' in master.c:generate
the value of 'i' in generate could overflow when adding 'step' to
it in the 'for' loop.  Use an unsigned int for 'i' which will give
an additional bit and prevent the overflow.  The inputs are both
less than 2^31 and and the result will be less than 2^32-1.

(cherry picked from commit 5abdee9004)
2022-04-01 21:42:35 +11:00
Tony Finch 05224c32a7 Merge branch '3209-notauth-subdomain-v9_18' into 'v9_18'
Log "not authoritative for update zone" more clearly (v9.18)

See merge request isc-projects/bind9!6047
2022-03-30 13:20:58 +00:00
Tony Finch ec54de9e47 Log "not authoritative for update zone" more clearly
Ensure the update zone name is mentioned in the NOTAUTH error message
in the server log, so that it is easier to track down problematic
update clients. There are two cases: either the update zone is
unrelated to any of the server's zones (previously no zone was
mentioned); or the update zone is a subdomain of one or more of the
server's zones (previously the name of the irrelevant parent zone was
misleadingly logged).

Closes #3209

(cherry picked from commit 84c4eb02e7)
2022-03-30 13:19:46 +01:00
Ondřej Surý d45abcbd2f Merge branch 'ondrej/cleanup-unreachable-calls-v9_18' into 'v9_18'
Consistenly use UNREACHABLE() instead of ISC_UNREACHABLE()

See merge request isc-projects/bind9!6043
2022-03-28 21:56:42 +00:00
Ondřej Surý fc500b96eb Consistenly use UNREACHABLE() instead of ISC_UNREACHABLE()
In couple places, we have missed INSIST(0) or ISC_UNREACHABLE()
replacement on some branches with UNREACHABLE().  Replace all
ISC_UNREACHABLE() or INSIST(0) calls with UNREACHABLE().
2022-03-28 23:27:33 +02:00
Arаm Sаrgsyаn 8799add75e Merge branch '3221-catz-lightweight-cleanup-v9_18' into 'v9_18'
[v9_18] [1/5] Catalog zones lightweight cleanup

See merge request isc-projects/bind9!6038
2022-03-28 11:30:48 +00:00
Aram Sargsyan 8d3141ac10 Add CHANGES note for [GL #3221]
(cherry picked from commit 7fd24ded90)
2022-03-28 10:28:32 +00:00
Aram Sargsyan a20acee77d Use 'bname' in dns_catz_update_from_db() only when it is ready
There is a possible code path of using the uninitialized `bname`
character array while logging an error message.

Initialize the `bname` buffer earlier in the function.

Also, change the initialization routine to use a helper function.

(cherry picked from commit a5a6362e92)
2022-03-28 10:26:58 +00:00
Aram Sargsyan 68bbce9813 Put some missing dns_rdata_freestruct() calls in catz.c
A successful call to `dns_rdata_tostruct()` expects an accompanying
call to `dns_rdata_freestruct()` to free up any memory that could have
been allocated during the first call.

In catz.c there are several places where `dns_rdata_freestruct()` call
is skipped.

Add the missing cleanup routines.

(cherry picked from commit f57c51fe05)
2022-03-28 10:26:49 +00:00
Aram Sargsyan 263b9d69af Cleanup the code to remove unnecessary indentation
Because of the "goto" in the "if" body the "else" part is unnecessary
and adds another level of indentation.

Cleanup the code to not have the "else" part.

(cherry picked from commit 9b84bfb5f4)
2022-03-28 10:26:42 +00:00
Aram Sargsyan c79c059c4e Log a warning when catz is told to modify a zone not added by catz
Catz logs a warning message when it is told to modify a zone which was
not added by the current catalog zone.

When logging a warning, distinguish the two cases when the zone
was not added by a catalog zone at all, and when the zone was
added by a different catalog zone.

(cherry picked from commit d29e5f197b)
2022-03-28 10:26:35 +00:00
Aram Sargsyan 3c3653ad2a Fix invalid function name in the error log
The current function's name in one of the error logs in
catz_addmodzone_taskaction() function is invalid.

Fix the name.

(cherry picked from commit e861224cf4)
2022-03-28 10:26:26 +00:00
Ondřej Surý 78d6a20c88 Merge branch '3210-dns64-errors-v9_18' into 'v9_18'
More explicit dns64 prefix errors [v9.18]

See merge request isc-projects/bind9!6030
2022-03-25 20:21:32 +00:00
Tony FinchandOndřej Surý fef36e6b6f Add CHANGES note for [GL #3210]
(cherry picked from commit 132f30b623)
2022-03-25 16:08:43 +01:00
Tony FinchandOndřej Surý 775281d14a More explicit dns64 prefix errors
Quote the dns64 prefix in error messages that complain about
problems with it, to avoid confusion with the following ACLs.

Closes #3210

(cherry picked from commit 496c02d32a)
2022-03-25 16:08:22 +01:00
Ondřej Surý 310169af9d Merge branch 'ondrej/statements-following-return-break-continue-or-goto-will-never-be-executed-v9_18' into 'v9_18'
Remove UNREACHABLE() statements after exit() [v9.18]

See merge request isc-projects/bind9!6028
2022-03-25 09:20:14 +00:00
Ondřej Surý d3727a52d7 Remove UNREACHABLE() statements after exit()
Couple of UNREACHABLE() statements following exit() were found and
removed.

(cherry picked from commit 81fdc4a822)
2022-03-25 10:07:25 +01:00
Ondřej Surý 010583541a Merge branch 'ondrej/use-newer-compiler-features-v9_18' into 'v9_18'
Use modern C and modern compiler features [v9.18]

See merge request isc-projects/bind9!6025
2022-03-25 08:41:06 +00:00
Ondřej Surý cd13d24ba2 Remove workaround for ancient clang versions (<< 3.2 and << 4.0.1)
Some ancient versions of clang reported uninitialized memory use false
positive (see https://bugs.llvm.org/show_bug.cgi?id=14461).  Since clang
4.0.1 has been long obsoleted, just remove the workarounds.

(cherry picked from commit ae508c17bc)
2022-03-25 08:42:19 +01:00
Ondřej SurýandOndřej Surý 5e19bbb48a Remove use of the inline keyword used as suggestion to compiler
Historically, the inline keyword was a strong suggestion to the compiler
that it should inline the function marked inline.  As compilers became
better at optimising, this functionality has receded, and using inline
as a suggestion to inline a function is obsolete.  The compiler will
happily ignore it and inline something else entirely if it finds that's
a better optimisation.

Therefore, remove all the occurences of the inline keyword with static
functions inside single compilation unit and leave the decision whether
to inline a function or not entirely on the compiler

NOTE: We keep the usage the inline keyword when the purpose is to change
the linkage behaviour.

(cherry picked from commit 20f0936cf2)
2022-03-25 08:42:18 +01:00
Ondřej SurýandOndřej Surý 07022525ff Replace ISC_NORETURN with C11's noreturn
C11 has builtin support for _Noreturn function specifier with
convenience noreturn macro defined in <stdnoreturn.h> header.

Replace ISC_NORETURN macro by C11 noreturn with fallback to
__attribute__((noreturn)) if the C11 support is not complete.

(cherry picked from commit 04d0b70ba2)
2022-03-25 08:42:18 +01:00
Ondřej SurýandOndřej Surý 128c550a95 Simplify way we tag unreachable code with only ISC_UNREACHABLE()
Previously, the unreachable code paths would have to be tagged with:

    INSIST(0);
    ISC_UNREACHABLE();

There was also older parts of the code that used comment annotation:

    /* NOTREACHED */

Unify the handling of unreachable code paths to just use:

    UNREACHABLE();

The UNREACHABLE() macro now asserts when reached and also uses
__builtin_unreachable(); when such builtin is available in the compiler.

(cherry picked from commit 584f0d7a7e)
2022-03-25 08:42:16 +01:00
Ondřej SurýandOndřej Surý c62a94363d Add FALLTHROUGH macro for __attribute__((fallthrough))
Gcc 7+ and Clang 10+ have implemented __attribute__((fallthrough)) which
is explicit version of the /* FALLTHROUGH */ comment we are currently
using.

Add and apply FALLTHROUGH macro that uses the attribute if available,
but does nothing on older compilers.

In one case (lib/dns/zone.c), using the macro revealed that we were
using the /* FALLTHROUGH */ comment in wrong place, remove that comment.

(cherry picked from commit fe7ce629f4)
2022-03-25 08:41:09 +01:00
Ondřej Surý 3a4f6ae775 Merge branch 'ondrej-save-tsan-files-with-txt-extension-v9_18' into 'v9_18'
Save parsed tsan files with .txt extension [v9.18]

See merge request isc-projects/bind9!6020
2022-03-23 19:32:12 +00:00
Ondřej Surý 5f56fac2b9 Save parsed tsan files with .txt extension
When the parse tsan files have text extension they can be viewed
directly in the GitLab web UI without downloading them locally.

(cherry picked from commit 80582073a5)
2022-03-23 20:30:52 +01:00
Matthijs Mekking 554d63fb51 Merge branch 'matthijs-engine_pkcs11-save-error-output-v9_18' into 'v9_18'
[v9_18] Save keyfromlabel error output

See merge request isc-projects/bind9!6008
2022-03-21 10:28:57 +00:00
Matthijs Mekking 61fcbdfd7c Save keyfromlabel error output
Save the error output from pkcs11-tool and dnssec-keyfromlabel in the
engine_pkcs11 system test.

(cherry picked from commit d6d107d804)
2022-03-21 10:36:09 +01:00
Tony Finch 54e37e89ce Merge branch '3201-no-vla-v9_18' into 'v9_18'
Avoid using C99 variable-length arrays

See merge request isc-projects/bind9!6003
2022-03-18 16:42:57 +00:00
Tony Finch 03e0083e3b Avoid using C99 variable length arrays
From an attacker's point of view, a VLA declaration is essentially a
primitive for performing arbitrary arithmetic on the stack pointer. If
the attacker can control the size of a VLA they have a very powerful
tool for causing memory corruption.

To mitigate this kind of attack, and the more general class of stack
clash vulnerabilities, C compilers insert extra code when allocating a
VLA to probe the growing stack one page at a time. If these probes hit
the stack guard page, the program will crash.

From the point of view of a C programmer, there are a few things to
consider about VLAs:

  * If it is important to handle allocation failures in a controlled
    manner, don't use VLAs. You can use VLAs if it is OK for
    unreasonable inputs to cause an uncontrolled crash.

  * If the VLA is known to be smaller than some known fixed size,
    use a fixed size array and a run-time check to ensure it is large
    enough. This will be more efficient than the compiler's stack
    probes that need to cope with arbitrary-size VLAs.

  * If the VLA might be large, allocate it on the heap. The heap
    allocator can allocate multiple pages in one shot, whereas the
    stack clash probes work one page at a time.

Most of the existing uses of VLAs in BIND are in test code where they
are benign, but there was one instance in `named`, in the GSS-TSIG
verification code, which has now been removed.

This commit adjusts the style guide and the C compiler flags to allow
VLAs in test code but not elsewhere.

(cherry picked from commit 599c1d2a6b)
2022-03-18 16:05:56 +00:00
Tony Finch ac5d61541d Remove a redundant variable-length array
In the GSS-TSIG verification code there was an alarming
variable-length array whose size came off the network, from the
signature in the request. It turned out to be safe, because the caller
had previously checked that the signature had a reasonable size.
However, the safety checks are in the generic TSIG implementation, and
the risky VLA usage was in the GSS-specific code, and they are
separated by the DST indirection layer, so it wasn't immediately
obvious that the risky VLA was in fact safe.

In fact this risky VLA was completely unnecessary, because the GSS
signature can be verified in place without being copied to the stack,
like the message covered by the signature. The `REGION_TO_GBUFFER()`
macro backwardly assigns the region in its left argument to the GSS
buffer in its right argument; this is just a pointer and length
conversion, without copying any data. The `gss_verify_mic()` call uses
both message and signature GSS buffers in a read-only manner.

(cherry picked from commit eeead1cfe7)
2022-03-18 16:05:56 +00:00
Arаm Sаrgsyаn 312bdb9e5c Merge branch '3205-dig-tcp-next-server-on-connection-error-crash-v9_18' into 'v9_18'
[v9_18] Fix dig error when trying the next server after a TCP connection failure

See merge request isc-projects/bind9!6001
2022-03-18 11:19:33 +00:00
Aram Sargsyan 964abb938f Add CHANGES note for [GL #3205]
(cherry picked from commit ced79790b3)
2022-03-18 10:31:17 +00:00
Aram Sargsyan 3c2816a5be Add various dig/host tests for TCP/UDP socket error handling cases
Rework the "ans8" server in the "digdelv" system test to support various
modes of operations using a control channel.

The supported modes are:

1. `silent` (do not respond)
2. `close` (UDP: same as `silent`; TCP: also close the connection)
3. `servfail` (always respond with `SERVFAIL`)
4. `unstable` (constantly switch between `silent` and `servfail`)

Add multiple tests to check the handling of both TCP and UDP socket
error scenarios in dig/host.

(cherry picked from commit 03697f1bcc)
2022-03-18 10:31:10 +00:00
Aram Sargsyan 19787fb752 Fix dig error when trying the next server after a TCP connection failure
When encountering a TCP connection error while trying to initiate a
connection to a server, dig erroneously cancels the lookup even when
there are other server(s) to try, which results in an assertion failure.

Cancel the lookup only when there are no more queries left in the
lookup's queries list (i.e. `next` is NULL).

(cherry picked from commit 0fb4fc1897)
2022-03-18 10:31:03 +00:00
Arаm Sаrgsyаn 893b6f2404 Merge branch '3128-dig-does-not-recover-from-a-isc_nm_udpconnect-failure-v9_18' into 'v9_18'
[v9_18] After dig request errors, try to use other servers when they exist

See merge request isc-projects/bind9!6000
2022-03-18 10:25:31 +00:00
Aram Sargsyan 956f022a2b Add CHANGES entry for [GL #3128]
(cherry picked from commit b3a058e7bb)
2022-03-18 09:21:07 +00:00
Aram Sargsyan df7616ec09 Add digdelv system test to check that dig tries other servers on error
Add a test to check whether dig tries the next query/server after
a connection error.

Add a test to check whether dig tries the next query/server after
a one or more (default is 3) connection/request timeouts.

(cherry picked from commit e8a64d0cbe)
2022-03-18 09:20:57 +00:00
Aram Sargsyan 992997967b After dig request errors, try to use other servers when they exist
When timing-out or having other types of socket errors during a query,
dig isn't trying to perform the lookup using other servers which exist
in the lookup's queries list.

After configured amount of timeout retries, or after a socket error,
check if there are other queries/servers in the lookup's queries list,
and start the next one if it exists, instead of unconditionally failing.

(cherry picked from commit bc203d6082)
2022-03-18 09:20:50 +00:00
Arаm Sаrgsyаn da7e4da2de Merge branch '3020-dighost-servfail-bug-v9_18' into 'v9_18'
[v9_18] When resending a UDP request, insert the query to the lookup's list

See merge request isc-projects/bind9!5998
2022-03-18 09:03:32 +00:00
Aram Sargsyan f64cd23e7b Add digdelv system test to check timed-out result followed by a SERVFAIL
This test ensures that `dig` retries with another attempt after a
timed-out request, and that it does not crash when the retried
request returns a SERVFAIL result. See [GL #3020] for the latter
issue.

(cherry picked from commit 3ec5d2d6ed)
2022-03-18 08:29:13 +00:00
Aram Sargsyan 1e17d5a130 Add CHANGES note for [GL #3020]
(cherry picked from commit e353700189)
2022-03-18 08:28:42 +00:00
Aram Sargsyan 58685cd573 When resending a UDP request, insert the query to the lookup's list
When a query times out, and `dig` (or `host`) creates a new query
to resend the request, it is being prepended to the lookup's queries
list, which can cause a confusion later, making `dig` (or `host`)
believe that there is another new query in the list, but that is
actually the old one, which was timed out. That mistake will result
in an assertion failure.

That can happen, in particular, when after a timed out request,
the retried request returns a SERVFAIL result, and the recursion
is enabled, and `+nofail` option was used with `dig` (that is the
default behavior in `host`, unless the `-s` option is provided).

Fix the problem by inserting the query just after the current,
timed-out query, instead of prepending to the list.

Before calling start_udp() detach `l->current_query`, like it is
done in another place in the function.

Slightly update a couple of debug messages to make them more
consistent.

(cherry picked from commit a962475948)
2022-03-18 08:27:07 +00:00
Aram Sargsyan b6bd2a5311 Fix an issue in dig when retrying with the next server after SERVFAIL
After a query results in a SERVFAIL result, and there is another
registered query in the lookup's queries list, `dig` starts the next
query to try another server, but for some reason, reports about that
also when the current query is in the head of the list, even if there
is no other query in the list to try.

Use the same condition for both decisions, and after starting the next
query, jump to the "detach_query" label instead of "next_lookup",
because there is no need to start the next lookup after we just started
a query in the current lookup.

(cherry picked from commit e888c62fbd)
2022-03-18 08:27:00 +00:00
Ondřej Surý 3d27a75eca Merge branch '3208-fix-xfrout-maxtimer-timer-log-message-log-level-v9_18' into 'v9_18'
Change xfer-out timer message log level to DEBUG(1)

See merge request isc-projects/bind9!5996
2022-03-17 20:40:26 +00:00
Ondřej Surý 5e253fd629 Change xfer-out timer message log level to DEBUG(1)
When max-transfer-*-out timeouts were reintroduced, the log message
about starting the timer was errorneously left as ISC_LOG_ERROR.
Change the log level of said message to ISC_LOG_DEBUG(1).

(cherry picked from commit 8f6e4dfa15)
2022-03-17 21:38:24 +01:00
Ondřej Surý c965b315c5 Merge branch 'ondrej/add-missing-braces-clang-format-15-v9_18' into 'v9_18'
Add couple missing braces around single-line statements [v9.18]

See merge request isc-projects/bind9!5969
2022-03-17 19:42:49 +00:00
Ondřej Surý 485a2b329e Add couple missing braces around single-line statements
The clang-format-15 has new option InsertBraces that could add missing
branches around single line statements.  Use that to our advantage
without switching to not-yet-released LLVM version to add missing braces
in couple of places.
2022-03-17 18:29:57 +01:00
Michał Kępień d5cf60ab3d Merge branch 'v9_18_1-release' into 'v9_18'
Merge 9.18.1 release branch

See merge request isc-projects/bind9!5990
2022-03-16 22:36:26 +00:00
Michał Kępień cc59e6fd3f Set up release notes for BIND 9.18.2 2022-03-16 23:18:18 +01:00
Michał Kępień bd24843fa7 Update BIND version to 9.18.1 2022-03-16 23:18:18 +01:00
Michał Kępień d76bab0c8c Add a CHANGES marker 2022-03-16 23:18:18 +01:00
Michał Kępień 6b5f682ff1 Merge branch 'michal/prepare-documentation-for-bind-9.18.1' into 'security-v9_18'
Prepare documentation for BIND 9.18.1

See merge request isc-private/bind9!392
2022-03-16 23:18:18 +01:00
Michał Kępień 29eee12ccb Merge branch '3129-check-fetch-shutting-down-in-resume_dslookup-v9_18' into 'security-v9_18'
[CVE-2022-0667] [v9_18] Check if the fetch is shutting down in resume_dslookup()

See merge request isc-private/bind9!379
2022-03-16 23:18:18 +01:00
Michał Kępień 2841d81160 Prepare release notes for BIND 9.18.1 2022-03-16 23:18:18 +01:00
Michał Kępień 4158b69eb0 Merge branch '3158-confidential-issue-only-set-foundname-on-success-v9_18' into 'security-v9_18'
[v9_18] [CVE-2022-0635] DNAME lookups can trigger INSIST when synth-from-dnssec is enabled

See merge request isc-private/bind9!391
2022-03-16 23:18:18 +01:00
Aram SargsyanandMichał Kępień 897e332b6c Add CHANGES and release note for [GL #3129] 2022-03-16 23:18:18 +01:00
Michał Kępień 4f51dc7408 Reorder release notes 2022-03-16 23:18:18 +01:00
Michał Kępień a64496ef02 Merge branch '3112-ensure-correct-ordering-in-isc__nm_process_sock_buffer-v9_18' into 'security-v9_18'
[CVE-2022-0396] [v9_18] Resolve #3112 TCP sockets stuck in CLOSE_WAIT

See merge request isc-private/bind9!375
2022-03-16 23:18:18 +01:00
Mark AndrewsandMichał Kępień 4a23672009 Add CHANGES and release note for [GL #3158] 2022-03-16 23:18:18 +01:00
Aram SargsyanandMichał Kępień 09ec28dc9e Check if the fetch is shutting down in resume_dslookup()
The fetch can be in the shutting down state when resume_dslookup() is
trying to operate on it.

This is also a security issue, because a malicious actor can set up a
name server which delays certain queries in such a way that the fetch
will time out and shut down, which will cause named to crash.

Add a check to see if the fetch has the shutting down attribute set,
and cancel any further operations on it in such case.

A similar bug had been fixed earlier for the resume_qmin() function,
see [GL #966].
2022-03-16 23:18:18 +01:00
Michał Kępień 305c5bb5fa Tweak and reword release notes 2022-03-16 23:18:18 +01:00
Michał Kępień f4a911ea5f Merge branch '2950-confidential-cache-acceptance-rules-v9_18' into 'security-v9_18'
[CVE-2021-25220] [v9_18] prevent cache poisoning from forwarder responses

See merge request isc-private/bind9!382
2022-03-16 23:18:18 +01:00
Ondřej SurýandMichał Kępień 4a025c19b9 Add CHANGES and release note for [GL #3112] 2022-03-16 23:18:18 +01:00
Mark AndrewsandMichał Kępień bc8f721d59 Skip calling find_coveringnsec if we found a DNAME
This is an optimisation as we can skip a lot of pointless work when we
know there is a DNAME there.

When we have a partial match and a DNAME above the QNAME, the closest
encloser has the same owner as the DNAME, will have the DNAME bit set
in the type map, and we wouldn't use it as we would return the
DNAME + RRSIG(DNAME) instead.

So there is no point in looking for it nor in attempting to check that
it is valid for the QNAME.
2022-03-16 23:18:18 +01:00
Michał Kępień ddd5c6aace Fix typo in CHANGES 2022-03-16 23:18:18 +01:00
Petr ŠpačekandMichał Kępień 1e11351d50 Add Release Note for [GL #2950] 2022-03-16 23:18:18 +01:00
Ondřej SurýandMichał Kępień 6ec223a539 Run .closehandle_cb asynchrounosly in nmhandle_detach_cb()
When sock->closehandle_cb is set, we need to run nmhandle_detach_cb()
asynchronously to ensure correct order of multiple packets processing in
the isc__nm_process_sock_buffer().  When not run asynchronously, it
would cause:

  a) out-of-order processing of the return codes from processbuffer();

  b) stack growth because the next TCP DNS message read callback will
     be called from within the current TCP DNS message read callback.

The sock->closehandle_cb is set to isc__nm_resume_processing() for TCP
sockets which calls isc__nm_process_sock_buffer().  If the read callback
(called from isc__nm_process_sock_buffer()->processbuffer()) doesn't
attach to the nmhandle (f.e. because it wants to drop the processing or
we send the response directly via uv_try_write()), the
isc__nm_resume_processing() (via .closehandle_cb) would call
isc__nm_process_sock_buffer() recursively.

The below shortened code path shows how the stack can grow:

 1: ns__client_request(handle, ...);
 2: isc_nm_tcpdns_sequential(handle);
 3: ns_query_start(client, handle);
 4:   query_lookup(qctx);
 5:     query_send(qctcx->client);
 6:       isc__nmhandle_detach(&client->reqhandle);
 7:         nmhandle_detach_cb(&handle);
 8:           sock->closehandle_cb(sock); // isc__nm_resume_processing
 9:             isc__nm_process_sock_buffer(sock);
10:               processbuffer(sock); // isc__nm_tcpdns_processbuffer
11:                 isc_nmhandle_attach(req->handle, &handle);
12:                 isc__nm_readcb(sock, req, ISC_R_SUCCESS);
13:                   isc__nm_async_readcb(NULL, ...);
14:                     uvreq->cb.recv(...); // ns__client_request

Instead, if 'sock->closehandle_cb' is set, we need to run detach the
handle asynchroniously in 'isc__nmhandle_detach', so that on line 8 in
the code flow above does not start this recursion. This ensures the
correct order when processing multiple packets in the function
'isc__nm_process_sock_buffer()' and prevents the stack growth.

When not run asynchronously, the out-of-order processing leaves the
first TCP socket open until all requests on the stream have been
processed.

If the pipelining is disabled on the TCP via `keep-response-order`
configuration option, named would keep the first socket in lingering
CLOSE_WAIT state when the client sends an incomplete packet and then
closes the connection from the client side.
2022-03-16 23:18:18 +01:00
Mark AndrewsandMichał Kępień 1d32fbcd34 Only update foundname if returning DNS_R_COVERINGNSEC
'setup_delegation' depends on 'foundname' being the value returned
by 'dns_rbt_findnode' in the cache and 'find_coveringnsec' was
modifying 'foundname' when a covering NSEC was not found.
2022-03-16 23:18:18 +01:00
Michał Kępień 5a7c04b520 Remove outdated release notes 2022-03-16 23:18:18 +01:00
Petr ŠpačekandMichał Kępień 7b03643483 Add CHANGES note for [GL #2950] 2022-03-16 23:18:18 +01:00
Mark AndrewsandMichał Kępień 4baf22c0f0 Look for zones deeper than the current domain or forward name
When caching glue, we need to ensure that there is no closer
source of truth for the name. If the owner name for the glue
record would be answered by a locally configured zone, do not
cache.
2022-03-16 23:18:18 +01:00
Mark AndrewsandMichał Kępień 0347eed567 Check cached names for possible "forward only" clause
When caching additional and glue data *not* from a forwarder, we must
check that there is no "forward only" clause covering the owner name
that would take precedence.  Such names would normally be allowed by
baliwick rules, but a "forward only" zone introduces a new baliwick
scope.
2022-03-16 23:18:18 +01:00
Mark AndrewsandMichał Kępień 67179e8973 Check that the forward declaration is unchanged and not overridden
If we are using a fowarder, in addition to checking that names to
be cached are subdomains of the forwarded namespace, we must also
check that there are no subsidiary forwarded namespaces which would
take precedence. To be safe, we don't cache any responses if the
forwarding configuration has changed since the query was sent.
2022-03-16 23:18:18 +01:00
Mark AndrewsandMichał Kępień f7cb79b66a Add additional name checks when using a forwarder
When using a forwarder, check that the owner name of response
records are within the bailiwick of the forwarded name space.
2022-03-16 23:18:18 +01:00
Matthijs Mekking f2c813c635 Merge branch '3185-follow-up-fix-zone-documentation-v9_18' into 'v9_18'
[v9_18] Fix zone named.conf man page documentation

See merge request isc-projects/bind9!5981
2022-03-15 16:00:07 +00:00
Matthijs Mekking 617b1d7f28 Fix named.conf man page documentation
Commit 4ca74eee49 update the zone grammar
such that the zone statement is printed with the valid options per
zone type.

This commit is a follow-up, putting back the ZONE heading and adding
a note that these zone statements may also be put inside the view
statement.

It is tricky to actually print the zone statements inside
the view statement, and so we decided that we would add a note to say
that this is possible.

(cherry picked from commit 01b125ff05)
2022-03-15 14:15:26 +01:00
Petr Špaček 5f3713852b Merge branch 'pspacek/manpage-hyperlinks-v9_18' into 'v9_18'
Add hyperlinks to manual pages [v9_18]

See merge request isc-projects/bind9!5975
2022-03-14 10:38:11 +00:00
Petr Špaček 4daef4a2a7 Fix dig option hyperlinks in the TSIG section of hte ARM
While backporting !5934 I noticed a copy&paste mistake in TSIG
chapter of the ARM.

The incorrect reference was introduced by "Add hyperlinks from
program options to definition in man pages" commit but it is not
worth creating separate MR for that when the backport is not merged
yet.
2022-03-14 11:28:02 +01:00
Tony FinchandPetr Špaček 4b96f17ab2 Regenerate the named.conf manual with hyperlinks
The named.conf grammar is exported to the manual via
doc/misc/rst-options.pl which is the ultimate source
for the non-grammar parts of the man page.

(cherry picked from commit ad5b0402c9)
2022-03-14 11:01:32 +01:00
Petr Špaček 680869cbe2 Add internal hyperlinks to See Also section of manual pages
Replace :manpage: with :iscman: to generate internal hyperlinks. That
way reader can use links even when offline, and jumps to man pages
for the same version.

Formerly HTML version of man pages did not have links in See Also
section because :manpage: role in Sphinx can generate only external
hyperlinks - and we do not have that enabled.
Enabling the Sphinx :manpage: linking could reliably create hyperlinks
only to external URLs, but that would take users to another version
of docs.

Generated by:
    find bin -name '*.rst' | xargs sed -i -e 's/:manpage:`\([^(]\+\)(\([0-9]\))`/:iscman:`\1(\2) <\1>`/g'
+ hand-edit to revert change for mmencode reference which is
  not provided in our source tree.

(cherry picked from commit 1d4d008fc9)
2022-03-14 11:01:32 +01:00
Petr Špaček 4063ed938a Remove reference to ndc utility from BIND 8
(cherry picked from commit 420a71df57)
2022-03-14 11:01:32 +01:00
Petr Špaček 07044325eb Hyperlink program names to their manual pages
Use the new role :iscman: to replace all occurences or ``binary``
with :iscman:`binary`, creating a hyperlink to the manual page.

Generated using:
    find bin -name *.rst | xargs fgrep --files-with-matches '.. iscman' | xargs -I{} -n1 basename {} .rst > /tmp/progs
    for PROG in $(cat /tmp/progs); do find -name '*.rst' | xargs sed -i -e "s/\`\`$PROG\`\`/:iscman:\`$PROG\`/g"; done

Additional hand-edits were done mainly around filter-aaaa and
filter-a which are program names and and option names at the
same time. Couple more edits was neede to fix .rst syntax broken by
automatic replacement.

(cherry picked from commit 53a5776025)
2022-03-14 11:01:31 +01:00
Petr Špaček 52a20d646d Use semantic markup for :program: self-references
Sphinx has it's own :program: syntax for refering to program names.
Use it for self-references in manual pages. These self-references are
not clickable and not as eye-cathing as links, which is a good thing.
There is no point in attracting attention to ``dig`` several times on a
single page dedicated to dig itself.

Substituted automatically using:
    find bin  -name *.rst | xargs fgrep --files-with-matches '.. program' | xargs -n1 bash /tmp/repl.sh

With /tmp/repl.sh being:
    BASE=$(basename "$1" .rst)
    sed -i -e "s/\`\`$BASE\`\`/:program:\`$BASE\`/g" "$1"

(cherry picked from commit c7085be211)
2022-03-14 10:57:29 +01:00
Petr Špaček d13066ca5b Introduce new Sphinx role iscman for ISC manual pages
The new directive and role "iscman" allow to tag & reference man pages in
our source tree. Essentially it is just namespacing for ISC man pages,
but it comes with couple benefits.

Differences from .. _man_program label we formerly used:
- Does not expand :ref:`man_program` into full text of the page header.
- Generates index entry with category "manual page".
- Rendering style is closer to ubiquitous to the one produced
  by ``named`` syntax.

Differences from Sphinx built-in :manpage: role:
- Supports all builders with support for cross-references.
- Generates internal links (unlike :manpage: which generates external
  URLs).
- Checks that target exists withing our source tree.

(cherry picked from commit 7e7a946d44)
2022-03-14 10:57:29 +01:00
Tony FinchandPetr Špaček 1538326417 More man page option hyperlinks
The dig man page wanted -h option hyperlink and anchor, and there
were a couple of missing cross-references in the rndc man page.

(cherry picked from commit ccc6378355)
2022-03-14 10:57:29 +01:00
Petr Špaček 8066485ea3 Add hyperlinks from program options to definition in man pages
Side-effect of hyperlinking is that typos in program and option names
are now detected by Sphinx.

Candidate -options were detected using:
    find -name *.rst | xargs grep '``-[^`]'
and then modified from ``-o`` to :option:`-o` using regex
    s/``\(-[^`]\+\)``/:option:`\1`/
+ manual modifications where necessary.

Non-hyphenated options were detected by looking at context around
program names:
    find bin -name *.rst | xargs -I{} -n1 basename {} .rst | sort -u
and grepping for program name with trailing whitespace.

Stand-alone program names like ``named`` are not hyperlinked in this
commit.

(cherry picked from commit a85df3ff9c)
2022-03-14 10:57:23 +01:00
Petr Špaček e0c336f337 Add semantic markup for program names into manual pages
It allows to cross-reference options in man pages from other
documents using :option:`named -g` syntax.

(cherry picked from commit 8537878c01)
2022-03-14 10:56:19 +01:00
Petr Špaček b4e46de257 Denote all command line options using semantic markup (.. option::)
The markup allows referencing individual options, and also makes them
more legible (no more thin red text on gray background).

Most of the work was done using regexes:
    s/^``-\(.*\)``$/.. option:: -\1\r/
    s/^``+\(.*\)``$/.. option:: +\1\r/
on bin/**/*.rst files along with visual inspection and hand-edits,
mostly for positional arguments.

Regex for rndc.rst:
    s/^``\(.*\)``/.. option:: \1\r/
+ hand edits to remove extra asterisk and whitespace here and there.

(cherry picked from commit ec30944aa4)
2022-03-14 10:56:19 +01:00
Michał Kępień ed7c208616 Merge branch 'michal/tidy-setup-of-python-based-tests-v9_18' into 'v9_18'
[v9_18] Tidy setup of Python-based tests

See merge request isc-projects/bind9!5973
2022-03-14 08:55:15 +00:00
Michał Kępień 0af0e49b20 Tweak Automake conditionals for pytest-based tests
Since pytest itself skips tests using dnspython if the latter is not
available, also using Automake conditionals for silently skipping
pytest-based tests requiring dnspython is redundant and hides
information.  Allow all pytest-based tests requiring dnspython to be run
whenever pytest itself is available, in order to ensure test skipping is
done in a uniform manner.

Note that the above reasoning only applies to pytest-based tests, so
similar adjustments were not made for shell-based tests using Python
scripts that require dnspython ("chain", "cookie", "dnssec", "qmin").

(cherry picked from commit 173ad9cf46)
2022-03-14 09:04:10 +01:00
Michał Kępień 3fa2cc5c3d Rework skipping long tests
The ability to conveniently mark tests which should only be run when the
CI_ENABLE_ALL_TESTS environment variable is set seems to be useful on a
general level and therefore it should not be limited to the "timeouts"
system test, where it is currently used.

pytest documentation [1] suggests to reuse commonly used test markers by
putting them all in a single Python module which then has to be imported
by test files that want to use the markers defined therein.  Follow that
advice by creating a new bin/tests/system/pytest_custom_markers.py
Python module containing the relevant marker definitions.

Note that "import pytest_custom_markers" works from a test-specific
subdirectory because pytest modifies sys.path so that it contains the
paths to all parent directories containing a conftest.py file (and
bin/tests/system/ is one).  PyLint does not like that, though, so add a
relevant PyLint suppression.

The above changes make bin/tests/system/timeouts/conftest.py redundant,
so remove it.

[1] https://docs.pytest.org/en/7.0.x/how-to/skipping.html#id1

(cherry picked from commit 00392921f0)
2022-03-14 09:04:10 +01:00
Michał Kępień ac229a2fd5 Rework imports in dnspython-based system tests
Ensure all "import dns.*" statements are always placed after
pytest.importorskip('dns') calls, in order to allow the latter to
fulfill their purpose.  Explicitly import all dnspython modules used by
each dnspython-based test to avoid relying on nested imports.  Replace
function-scoped imports with global imports to reduce code duplication.

(cherry picked from commit 49312d6bb2)
2022-03-14 09:04:10 +01:00
Michał Kępień 238781de4a Fix skipping tests requiring dnspython
The intended purpose of the @pytest.mark.dnspython{,2} decorators was to
cause dnspython-based tests to be skipped if dnspython is not available
(or not recent enough).  However, a number of system tests employing
those decorators contain global "import dns.resolver" statements which
trigger ImportError exceptions during test initialization if dnspython
is not available.  In other words, the @pytest.mark.dnspython{,2}
decorators serve no useful purpose.

Currently, whenever a Python-based test requires dnspython, that
requirement applies to all tests in a given *.py file.  Given that,
employ global pytest.importorskip() calls to ensure dnspython-based
parts of various system tests are skipped when dnspython is not
available.  Remove all occurrences of the @pytest.mark.dnspython{,2}
decorators (and all associated code) to prevent confusion.

(cherry picked from commit 05c97f2329)
2022-03-14 09:04:10 +01:00
Michał Kępień dbddc22187 Fix skipping tests requiring the requests module
The intended purpose of the @pytest.mark.requests decorator was to cause
Python-based parts of the "statschannel" system test to be skipped if
the requests Python module is not available.  However, both
tests-json.py and tests-xml.py contain a global "import requests"
statement which triggers ImportError exceptions during test
initialization if the requests module is not available.  In other words,
the @pytest.mark.requests decorator serves no useful purpose.

Since all tests in both tests-json.py and tests-xml.py depend on the
requests Python module, employ pytest.importorskip() to ensure the
Python-based parts of the "statschannel" system test are skipped when
the requests module is not available.  Remove all occurrences of the
@pytest.mark.requests decorator (and all associated code) to prevent
confusion.

(cherry picked from commit 704ad2907f)
2022-03-14 09:04:10 +01:00
Michał Kępień 4fac33c9d5 Simplify skipping tests depending on libxml2
All tests in bin/tests/system/statschannel/tests-xml.py require libxml2
support to be enabled in BIND 9 at build-time.  Instead of applying the
same pytest.mark.skipif() decorator to every test in that file, set the
'pytestmark' global accordingly in order to immediately skip all tests
in tests-xml.py if libxml2 support is not compiled in.

Remove all occurrences of the @pytest.mark.xml decorator (and all
associated code) from the "statschannel" system test as the
xml.etree.ElementTree module is a part of the Python standard library
since Python 2.5 (so checking whether it is available is redundant) and
checking for libxml2 support in the tested BIND 9 build is already
handled by setting the 'pytestmark' global accordingly.

(cherry picked from commit 286b57c7f1)
2022-03-14 09:04:10 +01:00
Michał Kępień 3680763577 Simplify skipping tests depending on json-c
All tests in bin/tests/system/statschannel/tests-json.py require json-c
support to be enabled in BIND 9 at build-time.  Instead of applying the
same pytest.mark.skipif() decorator to every test in that file, set the
'pytestmark' global accordingly in order to immediately skip all tests
in tests-json.py if json-c support is not compiled in.

Remove all occurrences of the @pytest.mark.json decorator (and all
associated code) from the "statschannel" system test as the json module
is a part of the Python standard library since Python 2.6 (so checking
whether it is available is redundant) and checking for json-c support in
the tested BIND 9 build is already handled by setting the 'pytestmark'
global accordingly.

Also remove a related excerpt from bin/tests/system/rpzextra/conftest.py
as it is a copy-paste artifact that serves no purpose in the "rpzextra"
system test.

(cherry picked from commit 0a76f186a5)
2022-03-14 09:04:10 +01:00
Michał Kępień f37e0f2cbe Refactor "statschannel" test's helper modules
The "statschannel" system test contains two Python helper modules:

  - generic.py: test functions directly invoked by both tests-json.py
    and test-xml.py,

  - helper.py: helper functions invoked by test functions in generic.py.

The above logic for splitting helper functions into Python modules
prevents selective test skipping from working due to unconditional
import statements being present in both helper modules.  For example, if
dnspython is not available on the test host, tests-json.py imports
generic.py, which in turn imports helper.py, which in turn attempts to
import various dnspython modules, triggering ImportError exceptions
during test initialization.  Various decorators used for some tests
(like @pytest.mark.dnspython) suggest that such a scenario should be
handled gracefully, but that is not the case - modifying the test
collection in conftest.py does not prevent pytest from failing due to
import errors.

Fix by moving helper functions around to achieve a different split:

  - generic.py: helper functions only relying on the Python standard
    library,

  - generic_dnspython.py: helper functions requiring dnspython.

Only two tests in tests-{json,xml}.py need dnspython to work
(test_traffic_json(), test_traffic_xml()).  Since all
dnspython-dependent code is now present in generic_dnspython.py, employ
pytest.importorskip() in those two tests to ensure they can be
selectively skipped when dnspython is not available.  Adjust other code
to account for the revised Python helper module layout.  Remove all
occurrences of the @pytest.mark.dnspython decorator (and all associated
code) from the "statschannel" system test to prevent confusion.

(cherry picked from commit 96b7f9f9aa)
2022-03-14 09:04:10 +01:00
Michał Kępień 4847de9de1 Improve test discovery logic in get_ports.sh
The find invocation used by the bin/tests/system/get_ports.sh script
("find . -maxdepth 1 -mindepth 1 -type d") assumes the list of
directories in bin/tests/system/ remains unchanged throughout the run
time of a single system test suite.  With pytest in use and the
conftest.py file now present in bin/tests/system/, that assumption is no
longer true as a __pycache__ directory may be created when the first
pytest-based test is started.  Since the list of names returned by the
above find invocation serves as a fixed-size array of "port range
slots", any changes to that list during a system test suite run may lead
to port assignment collisions [1].

Fix by making the find invocation more nuanced, so that it only returns
names of directories containing test code.  Squash a grep / cut pipeline
into a single awk invocation.

[1] see commit 31e5ca4bd9

(cherry picked from commit 4e0d576858)
2022-03-14 09:04:10 +01:00
Michał Kępień 0cc4ff04ec Reuse common port-related test fixtures
Most Python-based system tests need to know which ports were assigned to
a given test by bin/tests/system/get_ports.sh.  This is currently
handled by inspecting the values of various environment variables (set
by bin/tests/system/run.sh) and passing the port numbers to Python
scripts via pytest fixtures.  However, this glue code has so far been
copy-pasted into each system test using it, rather than reused.

Since pytest also looks for conftest.py files in parent directories,
move commonly used fixtures to bin/tests/system/conftest.py.  Set the
scope of all the moved fixtures to "session" as their return values are
only based on environment variables, so there is no point in recreating
them for every test requesting them.  Adjust test code accordingly.

(cherry picked from commit 53ef8835c1)
2022-03-14 09:04:10 +01:00
Ondřej Surý 5ac5ec11e0 Merge branch '3203-fix-the-build-flag-order-v9_18' into 'v9_18'
Fix the remaining cases of <prog>_CFLAGS -> <prog>_CPPFLAGS [v9.18]

See merge request isc-projects/bind9!5972
2022-03-13 18:23:04 +00:00
Ondřej Surý 651af0bf65 Fix the remaining cases of <prog>_CFLAGS -> <prog>_CPPFLAGS
Building BIND 9 with older version of BIND 9 installed would result in
build failure.  Fix the last two remaining cases where <prog>_CFLAGS was
being used leading to wrong order of the build flags on the command line.

(cherry picked from commit 41a60a0e21)
2022-03-13 18:53:19 +01:00
Petr Špaček c74d78a9ff Merge branch '2799-doc-build-fixes-v9_18' into 'v9_18'
Fix docs build [v9_18]

See merge request isc-projects/bind9!5964
2022-03-11 11:28:12 +00:00
Petr Špaček 7130576276 Fix docs build from tarball broken by MR !5254
Related: !5254
(cherry picked from commit 524fce77fe)
2022-03-11 12:23:20 +01:00
Petr Špaček 25328e2ca4 Shorten artifact retention for docs:tarball job to one day
We now run both docs and docs:tarball jobs at the same time and keeping
artifacts for longer period of time is a waste.

Artifacts for docs job has to be kept for long period of time because
they are used by scripts behind bind.isc.org web site.

(cherry picked from commit b0f6fc7f2f)
2022-03-11 12:23:19 +01:00
Petr Špaček 31d572d580 Always check if docs can be built from tarball
The docs:tarball job is deemed to be cheap enough to run all the time
and it catches omissions in dist targets of Makefiles.

MR !5254 was missing changes to dist target in Makefile and broke docs
build from tarball without us noticing during pipeline run on the MR,
and it manifested itself only on scheduled pipelines which include
docs:tarball job.

(cherry picked from commit 188684a31d)
2022-03-11 12:23:15 +01:00
Ondřej Surý c1f995cc17 Merge branch '3200-add-per-send-timer-v9_18' into 'v9_18'
Change single write timer to per-send timers [v9.18]

See merge request isc-projects/bind9!5963
2022-03-11 10:26:40 +00:00
Ondřej Surý ab2dfec43f Add CHANGES and release note for [GL #3200]
(cherry picked from commit 8ace9e0c62)
2022-03-11 10:52:43 +01:00
Ondřej Surý 6fbf582f18 Cleanup the nmhandle attach/detach in httpd.c
In httpd.c, the send callback can directly call read callback without
calling isc_nm_resumeread().  When per-send timeout was added, this
could lead to use-after-free when shutting down the named.

Cleanup the way how we attach to .readhandle and .sendhandle, so there's
assurance that .readhandle will be always non-NULL when reading and
.sendhandle will be always non-NULL when sending.

Additionally, it was found that the implementation ignored the
"Connection: close" header and it worked only accidentally by closing
the connection after the first read from the TCP socket.  This has been
also fixed.

(cherry picked from commit 49c804f8b7)
2022-03-11 10:52:22 +01:00
Ondřej Surý fd351a60ff On shutdown, reset the established TCP connections
Previously, the established TCP connections (both client and server)
would be gracefully closed waiting for the write timeout.

Don't wait for TCP connections to gracefully shutdown, but directly
reset them for faster shutdown.

(cherry picked from commit 6ddac2d56d)
2022-03-11 10:52:22 +01:00
Ondřej Surý 27e47c5101 Change single write timer to per-send timers
Previously, there was a single per-socket write timer that would get
restarted for every new write.  This turned out to be insufficient
because the other side could keep reseting the timer, and never reading
back the responses.

Change the single write timer to per-send timer which would in turn
reset the TCP connection on the first send timeout.

(cherry picked from commit a761aa59e3)
2022-03-11 10:52:22 +01:00
Petr Špaček 923ea06654 Merge branch '2799-documentation-for-administrative-tools-is-out-of-sync-with-manual-pages-v9_18' into 'v9_18'
Fix Administrative Tools section in the ARM [v9_18]

See merge request isc-projects/bind9!5958
2022-03-10 19:23:08 +00:00
Tony FinchandPetr Špaček 98604b21a5 Refer to RFC 4592 for DNS wildcards
The named-checkzone(1) and named-compilezone(1) manual pages used to
refer to the description of wildcards in RFC 1034.

(cherry picked from commit 178aef5b8c)
2022-03-10 20:18:52 +01:00
Petr Špaček 42069e5f16 Generate diffs in tarball-create CI job
Usually it is just nits and it is much easier to debug when you actually
can see what the differences were.

(cherry picked from commit 785f6d470f)
2022-03-10 20:18:52 +01:00
Suzanne GoldlustandPetr Špaček 3554ec4615 Fix Tools for Use With the Name Server Daemon in the ARM
Remove outdated command references from ARM section
3.3.1. Tools for Use With the Name Server Daemon
and replace them with links to man pages.

Fixes: #2799
(cherry picked from commit 2d2d87a615)
2022-03-10 20:18:52 +01:00
Tony FinchandPetr Špaček 85a8e8f21a In the ARM appendix, sort man page sections alphabetically
(cherry picked from commit 315b3c3a1a)
2022-03-10 20:18:52 +01:00
Petr Špaček 158092f9b7 Split out named-compilezone and named-checkzone man pages
Both utilities were included as one man page, but this caused a problem:
Sphinx directive .. include was used twice on the same file, which
prevented us from using labels (or anything with unique identifier) in
the man pages. This effectivelly prevented linking to them.

Splitting man pages allows us to solve the linking problems and also
clearly make text easier to follow because it does not mention two tools
at the same time.

This change causes duplication of text, but given the frequecy of changes
to these tools I think it is acceptable. I've considered deduplication
using smaller .rst snippets which get included into both man pages,
but it would require more sed scripting to handle defaults etc. and
I think it would be way too complex solution for this problem.

Related: #2799
(cherry picked from commit 9992f7808c)
2022-03-10 20:18:52 +01:00
Petr Špaček bab233d766 Split out ddns-confgen and tsig-keygen man pages
Both utilities were included as one man page, but this caused a problem:
Sphinx directive .. include was used twice on the same file, which
prevented us from using labels (or anything with unique identifier) in
the man pages. This effectivelly prevented linking to them.

Splitting man pages allows us to solve the linking problems and also
clearly make text easier to follow because it does not mention two tools
at the same time.

This change causes duplication of text, but given the frequecy of changes
to these tools I think it is acceptable.

Related: #2799
(cherry picked from commit 2e42414522)
2022-03-10 20:18:52 +01:00
Petr Špaček 1ffe6d19cb Remove nonexistent option -r from confgen man pages
Fixes omission in !269.

Fixes: #2826
(cherry picked from commit 473d5a8d03)
2022-03-10 20:18:46 +01:00
Tony Finch cb4f8d5348 Merge branch '3199-doc-dev-v9_18' into 'v9_18'
Remove documentation for `rndc keydone`

See merge request isc-projects/bind9!5957
2022-03-10 15:42:46 +00:00
Tony Finch 59372ede60 Update the status of Python
There are no longer any Python utilities in BIND: like Perl it is now
used for test scripts and generating some documentation and source
files.

(cherry picked from commit e532d39146)
2022-03-10 14:53:21 +00:00
Tony Finch 20ee59d6a9 Drop references to Windows in doc/dev
Windows is not a supported platform any more.

(cherry picked from commit 037468f6a4)
2022-03-10 14:53:21 +00:00
Tony Finch 9aeec183cf Small developer documentation cleanups
GitLab replaced RT, we don't support 1990s operating systems, we
like wrapped paragraphs, and we don't need that extra comma.

(cherry picked from commit 328d11297d)
2022-03-10 14:53:21 +00:00
Tony Finch c9b6dba4a9 Drop documents that have been folded into doc/dev/dev.md
There is no need to keep obsolete duplicate docs around.

(cherry picked from commit ec1e8e7001)
2022-03-10 14:53:21 +00:00
Tony Finch 8f7f5b5941 Remove documentation for rndc keydone
This feature never made it through the 9.9 development cycle; it is
now covered by `rndc signing` which is adequately documented
elsewhere.

(cherry picked from commit 6be83f2eb7)
2022-03-10 14:53:21 +00:00
Ondřej Surý f462590546 Merge branch 'ondrej/remove-ATOMIC_VAR_INIT-v9_18' into 'v9_18'
Remove usage of deprecated ATOMIC_VAR_INIT() macro

See merge request isc-projects/bind9!5950
2022-03-09 09:33:25 +00:00
Ondřej Surý 913e64e8e1 Remove usage of deprecated ATOMIC_VAR_INIT() macro
The C17 standard deprecated ATOMIC_VAR_INIT() macro (see [1]).  Follow
the suite and remove the ATOMIC_VAR_INIT() usage in favor of simple
assignment of the value as this is what all supported stdatomic.h
implementations do anyway:

  * MacOSX.plaform: #define ATOMIC_VAR_INIT(__v) {__v}
  * Gcc stdatomic.h: #define ATOMIC_VAR_INIT(VALUE)	(VALUE)

1. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1138r0.pdf

(cherry picked from commit f251d69eba)
2022-03-09 09:25:37 +01:00
Ondřej Surý b37b98cf3b Merge branch 'ondrej/lib/isc/ht.c-cleanup-v9_18' into 'v9_18'
Make isc_ht_init() and isc_ht_iter_create() return void [v9.18]

See merge request isc-projects/bind9!5946
2022-03-08 19:47:21 +00:00
Ondřej Surý ebe2baec95 Make dns_catz_get_iterator() return void
Previously, the function(s) in the commit subject could fail for various
reasons - mostly allocation failures, or other functions returning
different return code than ISC_R_SUCCESS.  Now, the aforementioned
function(s) cannot ever fail and they would always return ISC_R_SUCCESS.

Change the function(s) to return void and remove the extra checks in
the code that uses them.

(cherry picked from commit d128656d2e)
2022-03-08 20:47:06 +01:00
Ondřej Surý ce9908cb4e Make isc_ht_init() and isc_ht_iter_create() return void
Previously, the function(s) in the commit subject could fail for various
reasons - mostly allocation failures, or other functions returning
different return code than ISC_R_SUCCESS.  Now, the aforementioned
function(s) cannot ever fail and they would always return ISC_R_SUCCESS.

Change the function(s) to return void and remove the extra checks in
the code that uses them.

(cherry picked from commit 8fa27365ec)
2022-03-08 20:47:06 +01:00
Ondřej Surý ddc6479792 Merge branch 'ondrej/lib/isc/heap.c-cleanup-v9_18' into 'v9_18'
Make isc_heap_create() and isc_heap_insert() return void

See merge request isc-projects/bind9!5944
2022-03-08 19:25:46 +00:00
Ondřej SurýandOndřej Surý b3d0c95e68 Make isc_heap_create() and isc_heap_insert() return void
Previously, the function(s) in the commit subject could fail for various
reasons - mostly allocation failures, or other functions returning
different return code than ISC_R_SUCCESS.  Now, the aforementioned
function(s) cannot ever fail and they would always return ISC_R_SUCCESS.

Change the function(s) to return void and remove the extra checks in
the code that uses them.

(cherry picked from commit bbb4cdb92d)
2022-03-08 20:24:54 +01:00
Ondřej Surý 09aede730b Merge branch '2201-reimplement-set_tcp_maxseg-for-netmgr-v9_18' into 'v9_18'
Set minimum MTU (1280) on IPv6 sockets

See merge request isc-projects/bind9!5942
2022-03-08 10:58:04 +00:00
Ondřej Surý b1878aa2ac Add CHANGES note for [GL #2201]
(cherry picked from commit 67dbe0ae4d)
2022-03-08 11:12:44 +01:00
Ondřej SurýandOndřej Surý 445ce0c165 Set TCP maximum segment size to minimum size of 1220
Previously the socket code would set the TCPv6 maximum segment size to
minimum value to prevent IP fragmentation for TCP.  This was not yet
implemented for the network manager.

Implement network manager functions to set and use minimum MTU socket
option and set the TCP_MAXSEG socket option for both IPv4 and IPv6 and
use those to clamp the TCP maximum segment size for TCP, TCPDNS and
TLSDNS layers in the network manager to 1220 bytes, that is 1280 (IPv6
minimum link MTU) minus 40 (IPv6 fixed header) minus 20 (TCP fixed
header)

We already rely on a similar value for UDP to prevent IP fragmentation
and it make sense to use the same value for IPv4 and IPv6 because the
modern networks are required to support IPv6 packet sizes.  If there's
need for small TCP segment values, the MTU on the interfaces needs to be
properly configured.

(cherry picked from commit 8098a58581)
2022-03-08 11:12:43 +01:00
Ondřej SurýandOndřej Surý 2a31f19817 Set minimum MTU (1280) on IPv6 sockets
The IPV6_USE_MIN_MTU socket option directs the IP layer to limit the
IPv6 packet size to the minimum required supported MTU from the base
IPv6 specification, i.e. 1280 bytes.  Many implementations of TCP
running over IPv6 neglect to check the IPV6_USE_MIN_MTU value when
performing MSS negotiation and when constructing a TCP segment despite
MSS being defined to be the MTU less the IP and TCP header sizes (60
bytes for IPv6).  This leads to oversized IPv6 packets being sent
resulting in unintended Path Maximum Transport Unit Discovery (PMTUD)
being performed and to fragmented IPv6 packets being sent.

Add and use a function to set socket option to limit the MTU on IPv6
sockets to the minimum MTU (1280) both for UDP and TCP.

(cherry picked from commit 5d34a14f22)
2022-03-08 11:12:43 +01:00
Ondřej Surý fea6d595e2 Merge branch 'aram-fix-dns_request_createraw-cleanup-bug-v9_18' into 'v9_18'
[v9_18] Fix a function cleanup bug in dns_request_createraw()

See merge request isc-projects/bind9!5939
2022-03-08 09:00:50 +00:00
Aram SargsyanandOndřej Surý 8f2e287a56 Fix a function cleanup bug in dns_request_createraw
When get_dispatch() returns an error code, the dns_request_createraw()
function jumps to the `cleanup` label, which will leave a previous
attachment to the `request` pointer unattached.

Fix the issue by jumping to the `detach` label instead.

(cherry picked from commit 963f6a2203)
2022-03-08 10:00:00 +01:00
Ondřej Surý df3a9e1286 Merge branch '3193-null-pointer-dereferences-in-udp_ready-v9_18' into 'v9_18'
Fix null pointer dereferences in udp_ready() (v9.18)

See merge request isc-projects/bind9!5936
2022-03-08 08:59:21 +00:00
Ondřej Surý c13e191e52 Fix null pointer dereferences in udp_ready()
The query pointer was detached too early leading to null pointer
reference.  Move the query_detach() after the query->canceled check.

(cherry picked from commit 9d8e8a4fcc)
2022-03-08 09:59:06 +01:00
Ondřej Surý 1996d1b91b Merge branch 'ondrej/refactor-tooling-around-lib/gen/dns.c-v9_18' into 'v9_18'
Merge lib/dns/gen.h contents to lib/dns/gen.c (v9.18)

See merge request isc-projects/bind9!5933
2022-03-08 08:57:36 +00:00
Ondřej SurýandOndřej Surý 898d0f8ee2 Replace AX_CC_FOR_BUILD with AX_PROG_CC_FOR_BUILD
The AX_PROG_CC_FOR_BUILD implementation to find a native CC compiler is
slightly better because it uses AC_PROG_CC and AC_PROG_CPP to find the
native compiler instead of just defaulting to `gcc` as AX_CC_FOR_BUILD
does.

AX_PROG_CC_FOR_BUILD also sets BUILD_EXEEXT that we already use in the
Makefile.am for `lib/dns/gen` while AX_CC_FOR_BUILD uses
EXEEXT_FOR_BUILD.

(cherry picked from commit b5a5eed7a0)
2022-03-08 09:55:28 +01:00
Ondřej SurýandOndřej Surý d9e54ad0dd Merge lib/dns/gen.h contents to lib/dns/gen.c
Formerly, the gen.h header contained a compatibility layer between Win32
and POSIX platforms.  Since we have already dropped the Win32 build, we
can merged gen.h into gen.c as the header file is not used elsewhere.

(cherry picked from commit f24b26188d)
2022-03-08 09:55:28 +01:00
Ondřej Surý 22b8eaf11d Merge branch 'ondrej-use-locked-queue-v9_18' into 'v9_18'
Replace netievent lock-free queue with simple locked queue (v9.18)

See merge request isc-projects/bind9!5932
2022-03-08 08:54:46 +00:00
Ondřej Surý 6c29cba8c5 Add CHANGES note for [GL #3180]
(cherry picked from commit d75b953489)
2022-03-08 09:52:54 +01:00
Ondřej Surý 555bdb9f82 Replace netievent lock-free queue with simple locked queue
The current implementation of isc_queue uses Michael-Scott lock-free
queue that in turn uses hazard pointers.  It was discovered that the way
we use the isc_queue, such complicated mechanism isn't really needed,
because most of the time, we either execute the work directly when on
nmthread (in case of UDP) or schedule the work from the matching
nmthreads.

Replace the current implementation of the isc_queue with a simple locked
ISC_LIST.  There's a slight improvement - since copying the whole list
is very lightweight - we move the queue into a new list before we start
the processing and locking just for moving the queue and not for every
single item on the list.

NOTE: There's a room for future improvements - since we don't guarantee
the order in which the netievents are processed, we could have two lists
- one unlocked that would be used when scheduling the work from the
matching thread and one locked that would be used from non-matching
thread.

(cherry picked from commit 6bd025942c)
2022-03-08 09:52:39 +01:00
Ondřej Surý 3fff8ee18d Merge branch '3105-assertion-failure-on-shutdown-in-req_senddone-v9_18' into 'v9_18'
Add attach/detach for the dns_dispatch_send() (v9.18)

See merge request isc-projects/bind9!5931
2022-03-08 08:51:50 +00:00
Ondřej Surý 122cfb2d45 Add CHANGES file for [GL #3105]
(cherry picked from commit a53ed01d03)
2022-03-08 09:50:29 +01:00
Ondřej Surý 2e461b9012 Reorder the nsupdate shutdown code to shutdown managers early
If the dns_request send callback is delayed, the dst API would get
deinitialized and then the detach from the tsig key would cause an
assertion failure.

Shutdown the isc_managers early, and only then dereference the dst
objects when cleaning up the resources used by nsupdate.

(cherry picked from commit be34b1c535)
2022-03-08 09:50:13 +01:00
Ondřej Surý c6f8e68dd8 Add attach/detach for the dns_dispatch_send()
The order in which the netievents are processed on the network manager
loop is not guaranteed.  Therefore the recv/read callback can come
earlier than the send/write callback.

The dns_request API wasn't ready for this reordering and it was
destroying the dns_request_t object before the send callback has been
called.

Add additional attach/detach in the req_send()/req_senddone() functions
to make sure we don't destroy the dns_request_t while it's still being
references by asynchronous call.

(cherry picked from commit f3ca90a804)
2022-03-08 09:50:13 +01:00
Ondřej Surý 1687f4f243 Merge branch '3184-query-context-management-issues-in-dighost-c-v9_18' into 'v9_18'
Fix query context management issues in dighost.c (v9.18)

See merge request isc-projects/bind9!5929
2022-03-08 08:48:44 +00:00
Ondřej Surý 97608c25fd Add CHANGES note for [GL #3184]
(cherry picked from commit f3228df622)
2022-03-08 09:14:34 +01:00
Aram SargsyanandOndřej Surý 5f5e1c0ac2 Fix query context management issues in dighost.c
For the reference, the _cancel_lookup() function iterates through
the lookup's queries list and detaches them. In the ideal scenario,
that should be the last reference and the query will be destroyed
after that, but it is also possible that we are still expecting a
callback, which also holds a reference (for example, _cancel_lookup()
could have been called from recv_done(), when send_done() was still
not executed).

The start_udp() and start_tcp() functions are currently designed in
slightly different ways: start_udp() creates a new query attachment
`connectquery`, to be called in the callback function, while
start_tcp() does not, which is a bug, but is hidden by the fact
that when the query is being erroneously destroyed prematurely (before
_cancel_lookup() is called) in the result of that, it also gets
de-listed from the lookup's queries' list, so _cancel_lookup() doesn't
even try to detach it.

For better understanding, here's an illustration of the query's
references count changes, and from where it was changed:

UDP
---
 1. _new_query()        -> refcount = 1 (initial)
 2. start_udp()         -> refcount = 2 (lookup->current_query)
 3. start_udp()         -> refcount = 3 (connectquery)
 4. udp_ready()         -> refcount = 4 (readquery)
 5. udp_ready()         -> refcount = 5 (sendquery)
 6. udp_ready()         -> refcount = 4 (lookup->current_query)
 7. udp_ready()         -> refcount = 3 (connectquery)
 8. send_done()         -> refcount = 2 (sendquery)
 9. recv_done()         -> refcount = 1 (readquery)
10. _cancel_lookup()    -> refcount = 0 (initial)
11. the query gets destroyed and removed from `lookup->q`

TCP, fortunate scenario
-----------------------

 1. _new_query()        -> refcount = 1 (initial)
 2. start_tcp()         -> refcount = 2 (lookup->current_query)
 3. launch_next_query() -> refcount = 3 (readquery)
 4. launch_next_query() -> refcount = 4 (sendquery)
 5. tcp_connected()     -> refcount = 3 (lookup->current_query)
 6. tcp_connected()     -> refcount = 2 (bug, there was no connectquery)
 7. send_done()         -> refcount = 1 (sendquery)
 8. recv_done()         -> refcount = 0 (readquery)
 9. the query gets prematurely destroyed and removed from `lookup->q`
10. _cancel_lookup()    -> the query is not in `lookup->q`

TCP, unfortunate scenario, revealing the bug
--------------------------------------------

 1. _new_query()        -> refcount = 1 (initial)
 2. start_tcp()         -> refcount = 2 (lookup->current_query)
 3. launch_next_query() -> refcount = 3 (readquery)
 4. launch_next_query() -> refcount = 4 (sendquery)
 5. tcp_connected()     -> refcount = 3 (lookup->current_query)
 6. tcp_connected()     -> refcount = 2 (bug, there was no connectquery)
 7. recv_done()         -> refcount = 1 (readquery)
 8. _cancel_lookup()    -> refcount = 0 (the query was in `lookup->q`)
 9. we hit an assertion here when trying to destroy the query, because
    sendhandle is not detached (which is done by send_done()).
10. send_done()         -> this never happens

This commit does the following:

1. Add a `connectquery` attachment in start_tcp(), like done in
   start_udp().
2. Add missing _cancel_lookup() calls for error scenarios, which
   were possibly missing because before fixing the bug, calling
   _cancel_lookup() and then calling query_detach() would cause
   an assertion.
3. Log a debug message and call isc_nm_cancelread(query->readhandle)
   for every query in the lookup from inside the _cancel_lookup()
   function, like it is done in _cancel_all().
4. Add a `canceled` property for the query which becomes `true` when
   the lookup (and subsequently, its queries) are canceled.
5. Use the `canceled` property in the network manager callbacks to
   know that the query was canceled, and act like `eresult` was equal
   to `ISC_R_CANCELED`.

(cherry picked from commit 4043fe9090)
2022-03-08 09:14:06 +01:00
Aram SargsyanandOndřej Surý 8b6245e298 Add a missing UNLOCK_LOOKUP
There was a missing UNLOCK_LOOKUP in the recv_done() callback when
the operation had been canceled. That omission could result in a
deadlock situation.

(cherry picked from commit 98820aef7e)
2022-03-08 09:14:06 +01:00
Mark Andrews 74c98d82f0 Merge branch '3142-add-checkconf-check-for-dnssec-policy-keys-algorithm-v9_18' into 'v9_18'
Add test configurations with invalid dnssec-policy clauses

See merge request isc-projects/bind9!5941
2022-03-08 04:06:24 +00:00
Mark Andrews 63f194995a Add release note for [GL #3142]
(cherry picked from commit e48af36981)
2022-03-08 14:29:32 +11:00
Mark Andrews d1766d4515 Add CHANGES entry for [GL #3142]
(cherry picked from commit d4c2395fff)
2022-03-08 14:29:30 +11:00
Mark Andrews d752bbfb22 Check dnssec-policy key roles for validity
For each algorithm there must be a key performing the KSK and
ZSK rolls.  After reading the keys from named.conf check that
each algorithm present has both rolls.  CSK implicitly has both
rolls.

(cherry picked from commit 9bcf45f4ce)
2022-03-08 14:28:53 +11:00
Mark Andrews 1b54642535 Add test configurations with invalid dnssec-policy clauses
bad-ksk-without-zsk.conf only has a ksk defined without a
matching zsk for the same algorithm.

bad-zsk-without-ksk.conf only has a zsk defined without a
matching ksk for the same algorithm.

bad-unpaired-keys.conf has two keys of different algorithms
one ksk only and the other zsk only

(cherry picked from commit f23e86b96b)
2022-03-08 14:28:53 +11:00
Petr Špaček abdc967ce8 Merge branch 'pspacek/relnote-python-tools-removal' into 'v9_18'
Add release note about removal of Python tools [v9_18]

See merge request isc-projects/bind9!5803
2022-03-03 09:38:21 +00:00
Petr Špaček 51180dc3e4 Add release note about removal of Python tools
The release note should have been added in commit
98b3b93791.

Related: !985
2022-03-03 10:36:07 +01:00
Arаm Sаrgsyаn 3ea74d43e5 Merge branch '3172-libressl-3.5.0-compat-v9_18' into 'v9_18'
[v9_18] Resolve "BIND is not compatible with LibreSSL 3.5.0"

See merge request isc-projects/bind9!5913
2022-03-02 11:39:58 +00:00
Aram Sargsyan 9fb6bb9e9d Add CHANGES entry for [GL #3172]
(cherry picked from commit 0f399851d88b7958a45bfbc4f626e82bdc34c771)
2022-03-02 10:50:11 +00:00
Aram Sargsyan 8336e9b90d Use autoconf check for BN_GENCB_new()
BIND unconditionally uses shims for BN_GENCB_new(), BN_GENCB_free(),
and BN_GENCB_get_arg() for all LibreSSL versions and, correctly, for
OpenSSL <1.1.0 versions.

This breaks LibreSSL compilation starting with LibreSSL 3.5.0.

Use autoconf check instead to check whether the family of the functions
are available.

(cherry picked from commit 749973f3259b7638a6af02b7da2f40ae28bdd402)
2022-03-02 10:49:47 +00:00
Aram Sargsyan b7e84e8a26 Remove EVP_CIPHER_CTX_new() and EVP_CIPHER_CTX_free() shims
LibreSSL 3.5.0 fails to compile with these shims. We could have just
removed the LibreSSL check from the pre-processor condition, but it
seems that these shims are no longer needed because all the supported
versions of OpenSSL and LibreSSL have those functions.

According to EVP_ENCRYPTINIT(3) manual page in LibreSSL,
EVP_CIPHER_CTX_new() and EVP_CIPHER_CTX_free() first appeared in
OpenSSL 0.9.8b, and have been available since OpenBSD 4.5.

(cherry picked from commit a3789053682b57a2031de8c544134f1923e76cf3)
2022-03-02 10:49:47 +00:00
Evan Hunt b8c1ba897f Merge branch '3174-fix-zone-documentation-v9_18' into 'v9_18'
fix zone documentation in named.conf man page

See merge request isc-projects/bind9!5922
2022-03-02 10:13:29 +00:00
Evan Hunt 0a8dece1be document zone grammar more correctly
the "zone" clause can be documented using, for instance,
`cfg_test --zonegrammar primary", which prints only
options that are valid in primary zones. this was not
the method being used when generating the named.conf
man page; instead, "zone" was documented with all possible
options, and no zone types at all.

this commit removes "zone" from the generic documentation
and adds include statements in named.conf.rst so that
correct zone grammars will be included in the man page.

(cherry picked from commit 4ca74eee49)
2022-03-02 01:58:18 -08:00
Mark Andrews 5d84a24082 Merge branch '3175-add-missing-grow-data-call-in-isc-lex-gettoken-v9_18' into 'v9_18'
Grow the lex token buffer in one more place

See merge request isc-projects/bind9!5920
2022-03-02 02:13:46 +00:00
Mark Andrews ba3862197b Add CHANGES note for [GL #3175]
(cherry picked from commit ce8703a79e)
2022-03-02 01:05:14 +00:00
Mark Andrews bc9aa8aa42 Add seed that demonstrated INSIST triggered in isc_lex_gettoken
this is similar to the input found by ClusterFuzz Issue 45027 with
the 0xff characters replaced for readability.

(cherry picked from commit d36938321e)
2022-03-02 01:05:14 +00:00
Mark Andrews 651ef3ebb8 Grow the lex token buffer in one more place
when parsing key pairs, if the '=' character fell at max_token
a protective INSIST preventing buffer overrun could be triggered.
Attempt to grow the buffer immediately before the INSIST.

Also removed an unnecessary INSIST on the opening double quote
of key buffer pair.

(cherry picked from commit 4c356d2770)
2022-03-02 01:05:14 +00:00
Mark Andrews 9668d72f3c Merge branch '3176-issue-45110-by-clusterfuzz-external-bind9-dns_master_load_fuzzer-undefined-shift-in-soa_get-v9_18' into 'v9_18'
Use unsigned arithmetic when shifting by 24

See merge request isc-projects/bind9!5917
2022-03-02 01:01:51 +00:00
Mark Andrews c5519265df Use unsigned arithmetic when shifting by 24
By default C promotes short unsigned values to signed int which
leads to undefined behaviour when the value is shifted by too much.
Force unsigned arithmetic to be perform by explicitly casting to a
unsigned type.

(cherry picked from commit b8b99603f1)
2022-03-02 11:06:39 +11:00
Ondřej Surý 69ebb69b0e Merge branch '3177-add-missing-isc_nm_tcpsocket-to-isc__nmsocket_reset-v9_18' into 'v9_18'
Handle TCP sockets in isc__nmsocket_reset()

See merge request isc-projects/bind9!5911
2022-02-28 11:13:57 +00:00
Ondřej Surý 806848a440 Handle TCP sockets in isc__nmsocket_reset()
The isc__nmsocket_reset() was missing a case for raw TCP sockets (used
by RNDC and DoH) which would case a assertion failure when write timeout
would be triggered.

TCP sockets are now also properly handled in isc__nmsocket_reset().

(cherry picked from commit b220fb32bd)
2022-02-28 11:17:41 +01:00
Evan Hunt 8ebce219f5 Merge branch '2802-fix-missed-occurrences-of-renaming-masters-to-primaries-v9_18' into 'v9_18'
Resolve "Fix missed occurrences of renaming masters to primaries"

See merge request isc-projects/bind9!5908
2022-02-26 00:57:13 +00:00
Evan Hunt 7b604df69d remove old zone type documentation
we now document zone type as either "primary" or "secondary",
omitting the old terms (though they are still accepted).

(cherry picked from commit 0bde07261b)
2022-02-25 16:51:44 -08:00
Evan Hunt 87be8fea0d add a CFG_CLAUSEFLAG_NODOC flag for use with outdated terms
"masters" and "default-masters" are now flagged so they will
not be included in the named.conf man page, despite being
accepted as valid options by the parser for backward
compatibiility.

(cherry picked from commit 0e57fc160e)
2022-02-25 16:51:44 -08:00
Mark Andrews bb98147d7a Merge branch '3170-tiny-typo-in-doc-build-script-v9_18' into 'v9_18'
correctly exclude logging-categories.rst

See merge request isc-projects/bind9!5902
2022-02-24 22:14:07 +00:00
Mark Andrews 76a16e319c correctly exclude logging-categories.rst
(cherry picked from commit 0069a689a6)
2022-02-25 01:20:45 +11:00
Petr Špaček 56096360be Merge branch 'pspacek/fuzz-rdata-from-text-v9_18' into 'v9_18'
Add dns_rdata_fromtext() fuzzer [v9_18]

See merge request isc-projects/bind9!5901
2022-02-24 10:54:55 +00:00
Petr Špaček e2c627a067 Add dns_rdata_fromtext() fuzzer
... along with dns_rdataclass_fromtext and dns_rdatatype_fromtext

Most of the test binary is modified named-rrchecker. Main differences:
- reads single RR and exists
- does not refuse meta classes and rr types
We actually do have some fromtext code for meta-things so erroring out
in named-rrchecker would prevent us from testing this code.

Corpus has examples of all currently supported RR types. I did not do
any minimization.

In future use command

    diff -U0 \
	<(sed -n -e 's/^.*fromtext_\(.*\)(.*$/\1/p' lib/dns/code.h | \
		sort) \
	<(ls fuzz/dns_rdata_fromtext.in/)

to check for missing RR types.

(cherry picked from commit dc9ba2d3ef)
2022-02-24 11:40:19 +01:00
Petr Špaček 5da2913ee9 Fix configure options in FUZZING.md
(cherry picked from commit 759ad04eb8)
2022-02-24 11:40:19 +01:00
Petr Špaček 0323234e8e Merge branch 'pspacek/fuzz_zonefile-v9_18' into 'v9_18'
Add dns_master_loadbuffer() fuzzer [v9_18]

See merge request isc-projects/bind9!5900
2022-02-24 09:16:38 +00:00
Petr Špaček e6befc2ad5 Add dns_master_loadbuffer() fuzzer
Corpus focuses on "extra" things in master files like $GENERATE etc.
Text encoding for RRs is thoroughly tested in dns_rdata_fromtext
fuzzer.

(cherry picked from commit 5076355822)
2022-02-24 10:13:10 +01:00
Ondřej Surý 3d3b7de309 Merge branch '3166-disable-inactivehandles-caching-with-address-sanitizer-v9_18' into 'v9_18'
Disable inactive handles caching when compiled with sanitizers

See merge request isc-projects/bind9!5896
2022-02-23 23:50:18 +00:00
Ondřej Surý 408b79ba24 Disable inactive uvreqs caching when compiled with sanitizers
When isc__nm_uvreq_t gets deactivated, it could be just put onto array
stack to be reused later to save some initialization time.
Unfortunately, this might hide some use-after-free errors.

Disable the inactive uvreqs caching when compiled with Address or
Thread Sanitizer.

(cherry picked from commit be339b3c83)
2022-02-24 00:16:25 +01:00
Ondřej Surý dad941a288 Disable inactive handles caching when compiled with sanitizers
When isc_nmhandle_t gets deactivated, it could be just put onto array
stack to be reused later to safe some initialization time.
Unfortunately, this might hide some use-after-free errors.

Disable the inactive handles caching when compiled with Address or
Thread Sanitizer.

(cherry picked from commit 92cce1da65)
2022-02-24 00:11:03 +01:00
Ondřej Surý c90af66acd Merge branch '3167-remove-isc__nmsocket_t-ah_handles-v9_18' into 'v9_18'
Remove active handles tracking from isc__nmsocket_t

See merge request isc-projects/bind9!5894
2022-02-23 22:55:16 +00:00
Ondřej Surý 51040c2806 Remove active handles tracking from isc__nmsocket_t
The isc__nmsocket_t has locked array of isc_nmhandle_t that's not used
for anything.  The isc__nmhandle_get() adds the isc_nmhandle_t to the
locked array (and resized if necessary) and removed when
isc_nmhandle_put() finally destroys the handle.  That's all it does, so
it serves no useful purpose.

Remove the .ah_handles, .ah_size, and .ah_frees members of the
isc__nmsocket_t and .ah_pos member of the isc_nmhandle_t struct.

(cherry picked from commit e2555a306f)
2022-02-23 23:49:13 +01:00
Ondřej Surý 405559e4f3 Merge branch '3166-delay-isc__nm_uvreq_t-deallocation-v9_18' into 'v9_18'
Delay isc__nm_uvreq_t deallocation to connection callback

See merge request isc-projects/bind9!5892
2022-02-23 22:47:48 +00:00
Ondřej Surý afe8a60f98 Delay isc__nm_uvreq_t deallocation to connection callback
When the TCP, TCPDNS or TLSDNS connection times out, the isc__nm_uvreq_t
would be pushed into sock->inactivereqs before the uv_tcp_connect()
callback finishes.  Because the isc__nmsocket_t keeps the list of
inactive isc__nm_uvreq_t, this would cause use-after-free only when the
sock->inactivereqs is full (which could never happen because the failure
happens in connection timeout callback) or when the sock->inactivereqs
mechanism is completely removed (f.e. when running under Address or
Thread Sanitizer).

Delay isc__nm_uvreq_t deallocation to the connection callback and only
signal the connection callback should be called by shutting down the
libuv socket from the connection timeout callback.

(cherry picked from commit 3268627916)
2022-02-23 23:31:18 +01:00
Ondřej Surý dc750e090b Merge branch 'ondrej-cleanup-nm_destroy-dequeue-v9_18' into 'v9_18'
Properly free up enqueued netievents in nm_destroy()

See merge request isc-projects/bind9!5889
2022-02-23 22:25:42 +00:00
Ondřej Surý 74948421a6 Properly free up enqueued netievents in nm_destroy()
When the isc_netmgr is being destroyed, the normal and priority queues
should be dequeued and netievents properly freed.  This wasn't the case.

(cherry picked from commit 88418c3372)
2022-02-23 22:53:31 +01:00
Michał Kępień 9862265cc9 Merge branch '3147-fix-more-ns_statscounter_recursclients-underflows-v9_18' into 'v9_18'
[v9_18] Fix more ns_statscounter_recursclients underflows

See merge request isc-projects/bind9!5880
2022-02-23 14:02:57 +00:00
Michał Kępień 87d5dff4a3 Add CHANGES entry for GL #3147
(cherry picked from commit 600f9010d2)
2022-02-23 14:43:09 +01:00
Michał Kępień d1f27a336a Add release note for GL #3147
(cherry picked from commit 1c462a63ec)
2022-02-23 14:43:09 +01:00
Michał Kępień 5929411f90 Fix more ns_statscounter_recursclients underflows
Commit aab691d512 did not fix all possible
scenarios in which the ns_statscounter_recursclients counter underflows.
The solution implemented therein can be ineffective e.g. when CNAME
chaining happens with prefetching enabled.

Here is an example recursive resolution scenario in which the
ns_statscounter_recursclients counter can underflow with the current
logic in effect:

 1. Query processing starts, the answer is not found in the cache, so
    recursion is started.  The NS_CLIENTATTR_RECURSING attribute is set.
    ns_statscounter_recursclients is incremented (Δ = +1).

 2. Recursion completes, returning a CNAME.  client->recursionquota is
    non-NULL, so the NS_CLIENTATTR_RECURSING attribute remains set.
    ns_statscounter_recursclients is decremented (Δ = 0).

 3. Query processing restarts.

 4. The current QNAME (the target of the CNAME from step 2) is found in
    the cache, with a TTL low enough to trigger a prefetch.

 5. query_prefetch() attaches to client->recursionquota.
    ns_statscounter_recursclients is not incremented because
    query_prefetch() does not do that (Δ = 0).

 6. Query processing restarts.

 7. The current QNAME (the target of the CNAME from step 4) is not found
    in the cache, so recursion is started.  client->recursionquota is
    already attached to (since step 5) and the NS_CLIENTATTR_RECURSING
    attribute is set (since step 1), so ns_statscounter_recursclients is
    not incremented (Δ = 0).

 8. The prefetch from step 5 completes.  client->recursionquota is
    detached from in prefetch_done().  ns_statscounter_recursclients is
    not decremented because prefetch_done() does not do that (Δ = 0).

 9. Recursion for the current QNAME completes.  client->recursionquota
    is already detached from, i.e. set to NULL (since step 8), and the
    NS_CLIENTATTR_RECURSING attribute is set (since step 1), so
    ns_statscounter_recursclients is decremented (Δ = -1).

Another possible scenario is that after step 7, recursion for the target
of the CNAME from step 4 completes before the prefetch for the CNAME
itself.  fetch_callback() then notices that client->recursionquota is
non-NULL and decrements ns_statscounter_recursclients, even though
client->recursionquota was attached to by query_prefetch() and therefore
not accompanied by an incrementation of ns_statscounter_recursclients.
The net result is also an underflow.

Instead of trying to properly handle all possible orderings of events
set into motion by normal recursion and prefetch-triggered recursion,
adjust ns_statscounter_recursclients whenever the recursive clients
quota is successfully attached to or detached from.  Remove the
NS_CLIENTATTR_RECURSING attribute altogether as its only purpose is made
obsolete by this change.

(cherry picked from commit f7482b68b9)
2022-02-23 14:43:09 +01:00
Petr Špaček e5cc4be4b4 Merge branch 'pspacek/windows-bat-removal-v9_18' into 'v9_18'
Remove leftover .bat file [v9_18]

See merge request isc-projects/bind9!5876
2022-02-22 15:09:37 +00:00
Petr Špaček 414cbdbee3 Remove last .bat file from the source tree
This fixes an omission in !5739, "Remove leftover test code for Windows".

(cherry picked from commit 653db956f0)
2022-02-22 16:05:29 +01:00
Matthijs Mekking 2c972005f6 Merge branch '3164-fix-parental-agents-documentation-v9_18' into 'v9_18'
Fix typo in DNSSEC guide parental-agents example

See merge request isc-projects/bind9!5873
2022-02-22 13:47:02 +00:00
Matthijs Mekking 7012680a11 Fix typo in DNSSEC guide parental-agents example
The example will not load because of the typo, the comma should be a
semicolon.

(cherry picked from commit fd5e39cc76)
2022-02-22 14:06:59 +01:00
Michał Kępień 01074e26f2 Merge branch 'michal/handle-fctx-in-FCTXTRACE-macro-stubs-v9_18' into 'v9_18'
[v9_18] Add "UNUSED(fctx);" to FCTXTRACE*() macro stubs

See merge request isc-projects/bind9!5871
2022-02-21 10:09:04 +00:00
Michał Kępień 08b2c1be44 Add "UNUSED(fctx);" to FCTXTRACE*() macro stubs
Commit 21ae6bb1b2 removed most uses of the
'fctx' variable from the rctx_dispfail() function: it is now only needed
by the FCTXTRACE3() macro.  However, when --enable-querytrace is not in
effect, that macro evaluates to a list of UNUSED() macros that does not
include "UNUSED(fctx);".  This triggers the following compilation
warning when building without --enable-querytrace:

    resolver.c: In function 'rctx_dispfail':
    resolver.c:7888:21: warning: unused variable 'fctx' [-Wunused-variable]
     7888 |         fetchctx_t *fctx = rctx->fctx;
          |                     ^~~~

Fix by adding "UNUSED(fctx);" lines to all FCTXTRACE*() macros.  This is
safe to do because all of those macros use the 'fctx' local variable, so
there is no danger of introducing new errors caused by use of undeclared
identifiers.

(cherry picked from commit b645e28167)
2022-02-21 11:06:28 +01:00
Evan Hunt 92fc6c2221 Merge branch '3141-remove-the-artificial-stream-clients-limit-v9_18' into 'v9_18'
Remove the limit on the number of simultaneous TCP queries

See merge request isc-projects/bind9!5865
2022-02-18 02:36:35 +00:00
Ondřej SurýandEvan Hunt bf21c4de6a Add CHANGES and release note for [GL #3141]
(cherry picked from commit 2bcf5a5315)
2022-02-17 16:57:34 -08:00
Ondřej SurýandEvan Hunt 780a89012d Remove the limit on the number of simultaneous TCP queries
There was an artificial limit of 23 on the number of simultaneous
pipelined queries in the single TCP connection.  The new network
managers is capable of handling "unlimited" (limited only by the TCP
read buffer size ) queries similar to "unlimited" handling of the DNS
queries receive over UDP.

Don't limit the number of TCP queries that we can process within a
single TCP read callback.

(cherry picked from commit 4f5b4662b6)
2022-02-17 16:57:34 -08:00
Ondřej Surý d96ac73bd4 Merge branch '1897-fix-max-transfer-timeouts-v9_18' into 'v9_18'
Reimplement the max-transfer-time-out and max-transfer-idle-out (v9.18)

See merge request isc-projects/bind9!5862
2022-02-17 22:00:20 +00:00
Ondřej Surý c625e791af Merge branch 'ondrej/v9_18-is-not-a-main-branch' into 'v9_18'
Disable main branch checking for v9_18 branch

Closes #3120 and #1918

See merge request isc-projects/bind9!5864
2022-02-17 21:29:36 +00:00
Ondřej Surý f66edb7ee9 Add CHANGES and release note for [GL #1897]
(cherry picked from commit 987ad32fac)
2022-02-17 22:29:29 +01:00
Ondřej Surý 9157fcdec6 Add XFR max-transfer-time-out and max-tranfer-idle-out system tests
Extend the timeouts system test to ensure that the maximum outgoing
transfer time (max-transfer-time-out) and maximum outgoing transfer idle
time (max-transfer-idle-out) works as expected.  This is done by
lowering the limits to 5/1 minutes and testing that the connection has
been dropped while sleeping between the individual XFR messages.

(cherry picked from commit 8fed1b6461)
2022-02-17 22:29:29 +01:00
Ondřej Surý 0ccc14fae9 Reimplement the max-transfer-time-out and max-transfer-idle-out
While refactoring the libns to use the new network manager, the
max-transfer-*-out options were not implemented and they were turned
non-operational.

Reimplement the max-transfer-idle-out functionality using the write
timer and max-transfer-time-out using the new isc_nm_timer API.

(cherry picked from commit 8643bbab84)
2022-02-17 22:29:29 +01:00
Ondřej Surý 8f39c9a8d7 Remove unused client->shutdown and client->shutdown_arg
While refactoring the lib/ns/xfrout.c, it was discovered that .shutdown
and .shutdown_arg members of ns_client_t structure are unused.

Remove the unused members and associated code that was using in it in
the ns_xfrout.

(cherry picked from commit 037549c405)
2022-02-17 22:29:29 +01:00
Ondřej Surý 8b2ae8cc84 Add network manager based timer API
This commits adds API that allows to create arbitrary timers associated
with the network manager handles.

(cherry picked from commit 3c7b04d015)
2022-02-17 22:29:29 +01:00
Ondřej Surý 7d12f734f1 Disable main branch checking for v9_18 branch
The util/check-changes script has two modes of operation - more relaxed
release branch mode and strict development branch mode.  When we forked
the v9_18 branch, the stricter mode stayed enabled.

Disable the strict CHANGES file checking suitable only for development
branch.
2022-02-17 22:24:51 +01:00
Ondřej Surý aec1ce9f52 Merge branch '3149-drop-TCP-connection-when-garbage-is-received-v9_18' into 'v9_18'
Reset the TCP connection when garbage is received

See merge request isc-projects/bind9!5861
2022-02-17 20:24:00 +00:00
Ondřej Surý c5f4887ee8 Add CHANGES and release note for [GL #3149]
(cherry picked from commit 9f1c439335)
2022-02-17 21:02:02 +01:00
Ondřej Surý 8a66d6d58d Add TCP garbage system test
Test if the TCP connection gets reset when garbage instead of DNS
message is sent.

I'm only happy when it rains
Pour some misery down on me
- Garbage

(cherry picked from commit ebfdb50ac7)
2022-02-17 21:02:02 +01:00
Ondřej Surý 2514f41ade Reset the TCP connection when garbage is received
When invalid DNS message is received, there was a handling mechanism for
DoH that would be called to return proper HTTP response.

Reuse this mechanism and reset the TCP connection when the client is
blackholed, DNS message is completely bogus or the ns_client receives
response instead of query.

(cherry picked from commit 4716c56ebb)
2022-02-17 21:02:02 +01:00
Ondřej Surý d7bcb0b5b7 Merge branch '3133-tcp-error-handling-v9_18' into 'v9_18'
correct TCP error handling in dispatch and resolver

See merge request isc-projects/bind9!5857
2022-02-17 15:50:26 +00:00
Evan HuntandOndřej Surý 4a448d09ee Add CHANGES note for [GL #3133]
(cherry picked from commit 1b25b76921)
2022-02-17 16:03:39 +01:00
Evan HuntandOndřej Surý 21ae6bb1b2 correct TCP error handling in dispatch and resolver
- certain TCP result codes, including ISC_R_EOF and
  ISC_R_CONNECTIONRESET, were being mapped to ISC_R_SHUTTINGDOWN
  before calling the response handler in tcp_recv_cancelall().
  the result codes should be passed through to the response handler
  without being changed.

- the response handlers, resquery_response() and req_response(), had
  code to return immediately if encountering ISC_R_EOF, but this is
  not the correct behavior; that should only happen in the case of
  ISC_R_CANCELED when it was the caller that canceled the operation

- ISC_R_CONNECTIONRESET was not being caught in rctx_dispfail().

- removed code in rctx_dispfail() to retry queries without EDNS
  when receiving ISC_R_EOF; this is now treated the same as any
  other connection failure.

(cherry picked from commit b6d40b3c4e)
2022-02-17 16:03:39 +01:00
Ondřej Surý 4d912e0dec Merge branch '3132-add-send-timeout-v9_18' into 'v9_18'
Add TCP, TCPDNS and TLSDNS write timer

See merge request isc-projects/bind9!5855
2022-02-17 09:07:25 +00:00
Ondřej Surý 6a0e82b379 Add CHANGES and release note for [GL #3132]
(cherry picked from commit 0c35bda762)
2022-02-17 09:47:43 +01:00
Ondřej Surý a0bc051782 Update writetimeout to be T_IDLE in netmgr_test.c
Use the isc_nmhandle_setwritetimeout() function in the netmgr unit test
to allow more time for writing and reading the responses because some of
the intervals that are used in the unit tests are really small leaving a
little room for any delays.

(cherry picked from commit ee359d6ffa)
2022-02-17 09:47:43 +01:00
Ondřej Surý da34d1d69c Add isc_nmhandle_setwritetimeout() function
In some situations (unit test and forthcoming XFR timeouts MR), we need
to modify the write timeout independently of the read timeout.  Add a
isc_nmhandle_setwritetimeout() function that could be called before
isc_nm_send() to specify a custom write timeout interval.

(cherry picked from commit a89d9e0fa6)
2022-02-17 09:47:43 +01:00
Ondřej Surý 531406c2b1 Add TCP write timeout system test
Extend the timeouts system test that bursts the queries for large TXT
record and never read any responses back filling up the server TCP write
buffer.  The test should work with the default wmem_max value on
Linux (208k).

(cherry picked from commit b735182ae0)
2022-02-17 09:47:43 +01:00
Ondřej Surý b5265eedfb Add TCP, TCPDNS and TLSDNS write timer
When the outgoing TCP write buffers are full because the other party is
not reading the data, the uv_write() could wait indefinitely on the
uv_loop and never calling the callback.  Add a new write timer that uses
the `tcp-idle-timeout` value to interrupt the TCP connection when we are
not able to send data for defined period of time.

(cherry picked from commit 408b362169)
2022-02-17 09:47:43 +01:00
Ondřej Surý e262aff29b Add uv_tcp_close_reset compat
The uv_tcp_close_reset() function was added in libuv 1.32.0 and since we
support older libuv releases, we have to add a shim uv_tcp_close_reset()
implementation loosely based on libuv.

(cherry picked from commit cd3b58622c)
2022-02-17 09:47:43 +01:00
Ondřej Surý a532533aab Rename sock->timer to sock->read_timer
Before adding the write timer, we have to remove the generic sock->timer
to sock->read_timer.  We don't touch the function names to limit the
impact of the refactoring.

(cherry picked from commit 45a73c113f)
2022-02-17 09:47:43 +01:00
Ondřej Surý 091284936b Merge branch '3157-blackhole-request-v9_18' into 'v9_18'
negative match on the 'blackhole' ACL could be treated as positive

See merge request isc-projects/bind9!5854
2022-02-17 08:46:56 +00:00
Evan Hunt 839a17186e CHANGES and release note for [GL #3157]
(cherry picked from commit 04361b0ad5)
2022-02-16 22:20:25 -08:00
Evan Hunt da029f10ba negative 'blackhole' ACL match could be treated as positive
There was a bug in the checking of the "blackhole" ACL in
dns_request_create*(), causing an address to be treated as included
in the ACL if it was explicitly *excluded*. Thus, leaving "blackhole"
unset had no effect, but setting it to "none" would cause any
destination addresses to be rejected for dns_request purposes. This
would cause zone transfer requests and SOA queries to fail, among
other things.

The bug has been fixed, and "blackhole { none; };" was added to the
xfer system test as a regression test.

(cherry picked from commit 4444b168db)
2022-02-16 22:20:25 -08:00
Michał Kępień 01529bf791 Merge branch '3139-log-the-result-of-each-resolver-priming-attempt-v9_18' into 'v9_18'
[v9_18] Log the result of each resolver priming attempt

See merge request isc-projects/bind9!5847
2022-02-16 12:54:03 +00:00
Michał Kępień 899e5a7e3f Add CHANGES entry for [GL #3139]
(cherry picked from commit 39df399d9f)
2022-02-16 13:28:00 +01:00
Michał Kępień a74e60a325 Log the result of each resolver priming attempt
When a resolver priming attempt completes, the following message is
currently logged:

    resolver priming query complete

This message is identical for both successful and failed priming
attempts.  Consider the following log excerpts:

  - successful priming attempt:

        10-Feb-2022 11:33:11.272 all zones loaded
        10-Feb-2022 11:33:11.272 running
        10-Feb-2022 11:33:19.722 resolver priming query complete

  - failed priming attempt:

        10-Feb-2022 11:33:29.978 all zones loaded
        10-Feb-2022 11:33:29.978 running
        10-Feb-2022 11:33:38.432 timed out resolving '_.org/A/IN': 2001:500:9f::42#53
        10-Feb-2022 11:33:38.522 timed out resolving './NS/IN': 2001:500:9f::42#53
        10-Feb-2022 11:33:42.132 timed out resolving '_.org/A/IN': 2001:500:12::d0d#53
        10-Feb-2022 11:33:42.285 timed out resolving './NS/IN': 2001:500:12::d0d#53
        10-Feb-2022 11:33:44.685 resolver priming query complete

Include the result of each priming attempt in the relevant log message
to give the administrator better insight into named's resolver priming
process.

(cherry picked from commit f286c845b0)
2022-02-16 13:28:00 +01:00
Ondřej Surý 5f77292475 Merge branch 'ondrej/add-UV_RUNTIME_CHECK-macro-v9_18' into 'v9_18'
Add UV_RUNTIME_CHECK() macro to print uv_strerror()

See merge request isc-projects/bind9!5845
2022-02-16 11:19:55 +00:00
Ondřej Surý c30735707c Add semantic patch to keep UV_RUNTIME_CHECK in sync
The UV_RUNTIME_CHECK() macro requires to keep the function name in sync
like this:

    r = func(...);
    UV_RUNTIME_CHECK(func, r);

Add semantic patch to keep the function name and return variable in sync
with the previous line.

(cherry picked from commit 62bd5cb08c)
2022-02-16 11:46:00 +01:00
Ondřej Surý f641507022 Use UV_RUNTIME_CHECK() as appropriate
Replace the RUNTIME_CHECK() calls for libuv API calls with
UV_RUNTIME_CHECK() to get more detailed error message when
something fails and should not.

(cherry picked from commit 8715be1e4b)
2022-02-16 11:46:00 +01:00
Ondřej Surý b8be8048b5 Add UV_RUNTIME_CHECK() macro to print uv_strerror()
When libuv functions fail, they return correct return value that could
be useful for more detailed debugging.  Currently, we usually just check
whether the return value is 0 and invoke assertion error if it doesn't
throwing away the details why the call has failed.  Unfortunately, this
often happen on more exotic platforms.

Add a UV_RUNTIME_CHECK() macro that can be used to print more detailed
error message (via uv_strerror() before ending the execution of the
program abruptly with the assertion.

(cherry picked from commit 62e15bb06d)
2022-02-16 11:46:00 +01:00
Ondřej Surý 33b5f979ba Merge branch 'ondrej/remove-dns_timer-API-v9_18' into 'v9_18'
Remove unused dns_timer API

See merge request isc-projects/bind9!5844
2022-02-16 10:10:01 +00:00
Ondřej Surý aed1a0497d Remove unused dns_timer API
The dns_timer API was unused, and this commit just removes it.

(cherry picked from commit cdce681cf7)
2022-02-16 11:07:04 +01:00
Matthijs Mekking d360a273af Merge branch 'matthijs-document-dnssec-policy-keys-algorithm-match-v9_18' into 'v9_18'
Update documentation wrt key algorithms

See merge request isc-projects/bind9!5842
2022-02-16 10:00:36 +00:00
Matthijs Mekking 3060ffb7d0 Update documentation wrt key algorithms
Add a note to the DNSSEC guide and to the ARM reference that A ZSK/KSK
pair used for signing your zone should have the same algorithm.

This commit also updates the 'dnssec-policy/keys' example to use the
slightly more modern 'rsasha256' algorithm.

(cherry picked from commit 7365400610)
2022-02-16 10:22:40 +01:00
Michal Nowak 588c60208e Merge branch 'mnowak/make-cocci-parallel-v9_18' into 'v9_18'
[v9_18] Run spatch jobs in parallel

See merge request isc-projects/bind9!5832
2022-02-14 19:01:12 +00:00
Michal Nowak 35ce85fa0b Run spatch jobs in parallel
Also make the script more verbose to identify which patch is being
processed and check for failures in spatch standard error output.

(cherry picked from commit 48c44fe6d4)
2022-02-14 19:50:41 +01:00
Michal Nowak 2093ca16aa Merge branch 'mnowak/coverity-scan-2021.12-v9_18' into 'v9_18'
[v9_18] Update Coverity Scan CI job to 2021.12.1

See merge request isc-projects/bind9!5829
2022-02-14 17:45:09 +00:00
Michal Nowak d63da7431d Update Coverity Scan CI job to 2021.12.1
(cherry picked from commit f0edf07fbc)
2022-02-14 17:38:08 +01:00
Petr Špaček 1aecd7b093 Merge branch 'pspacek/rfc-nits-v9_18' into 'v9_18'
Update and deduplicate list of RFCs in documentation [v9_18]

See merge request isc-projects/bind9!5827
2022-02-14 11:15:37 +00:00
Artem BoldarievandPetr Špaček 02aa76a2ad Mention DoT/DoH related RFCs in the ARM
Mention RFC 7858 (DoT), 8484 (DoH), and 8945 (XoT).

(cherry picked from commit 8058d64dda)
2022-02-14 12:11:24 +01:00
Petr Špaček 9703df2058 Remove rfc-compliance list in plaintext - ARM deduplication
The plaintext version is now fully replaced by the doc/arm/general.rst.

(cherry picked from commit 63989e98ac)
2022-02-14 12:11:24 +01:00
Petr Špaček 5f10218e6f Reorder list of supported RFCs in more user-oriented manner
For users it's not really important if a RFC is Internet Standard,
Proposed Standard, or Experimental. RFCs are now regrouped by
"Protocol", Best Current Practice, and "catch all" category FYI.

(cherry picked from commit 7fd61f9403)
2022-02-14 12:11:24 +01:00
Petr Špaček 0aacacbb38 Replace obsolete RFC2845 reference with RFC8945 (TSIG)
(cherry picked from commit 4dbad65bfd)
2022-02-14 12:11:23 +01:00
Petr Špaček 8582c49ea5 Remove special chapter about IPv6 address formats from ARM
In 2022, IPv6 is not anything unusual, and it was really odd
to have it in a separate section next to a huge list of RFCs.

Fixes: #1918
(cherry picked from commit 2774b497a6)
2022-02-14 12:11:23 +01:00
Petr Špaček 6191cf8abf Replace obsolete RFC6944 reference with RFC8624 (DNSSEC algorithm status)
(cherry picked from commit 3c83a9d503)
2022-02-14 12:11:23 +01:00
Petr Špaček 841ac7dd03 Replace obsolete RFC5966 reference with RFC7766 (TCP)
(cherry picked from commit bd3b310eae)
2022-02-14 12:11:23 +01:00
Petr Špaček d01ff38e58 Replace obsolete RFC4408 reference with RFC7208 (SPF)
(cherry picked from commit f8cb0ac141)
2022-02-14 12:11:23 +01:00
Petr Špaček d5c4c2d4b5 Replace obsolete RFC2915 reference with RFC3403 (NAPTR)
(cherry picked from commit 16dec1ff58)
2022-02-14 12:11:23 +01:00
Petr Špaček 69271cae55 Add link to RFC8749 (DLV is historic)
(cherry picked from commit f7225db822)
2022-02-14 12:11:23 +01:00
Petr Špaček 7c07656dc4 Add newer version of IDNA RFC to docs
(cherry picked from commit 09d6cf89df)
2022-02-14 12:11:23 +01:00
Petr Špaček 4141a7dfd7 Remove obsolete RFCs from documentation
There is little point of listing all of the obsolete RFCs. I think it is
more likely confuse people than to do anything useful.

(cherry picked from commit 9437ea08e1)
2022-02-14 12:11:23 +01:00
Petr Špaček 7a7c90e72e Replace obsolete RFC6488 reference with RFC8659 (CAA)
(cherry picked from commit 2b5b777c07)
2022-02-14 12:11:23 +01:00
Petr Špaček 3cafc168b8 Remove obsolete book reference from ARM
(cherry picked from commit b686b5c161)
2022-02-14 12:11:23 +01:00
Petr Špaček 6d56ef50ba Use Sphinx footnotes for DNS Reference Information
It limits risk of errors while doing updates, which are next in the
pipeline.

(cherry picked from commit f713984886)
2022-02-14 12:11:18 +01:00
Ondřej Surý 953a31cdf4 Merge branch '3151-bump-minimal-automake-version-to-1.14-v9_18' into 'v9_18'
Bump the required automake version to 1.14

See merge request isc-projects/bind9!5826
2022-02-14 09:04:55 +00:00
Ondřej Surý a8718a782a Bump the required automake version to 1.14
After the build system refactoring, we no longer call AM_PROG_CC_C_O
because it is obsolescent macro.  According to the automake manual the
`AC_PROG_CC` has been rewritten in automake 1.14 to not required the
call, thus we need to require at least automake version 1.14.

(cherry picked from commit 4abd58aa8f)
2022-02-14 09:46:35 +01:00
Ondřej Surý bdefa08a8d Merge branch 'ondrej/change-bug-reporting-address-v9_18' into 'v9_18'
Change the bug reporting address from email to gitlab URI

See merge request isc-projects/bind9!5821
2022-02-11 08:19:53 +00:00
Ondřej Surý 8f5a1f3f22 Change the bug reporting address from email to gitlab URI
In autoconf, the AC_INIT() accepts bugreport address for reporting
issues (f.e. when the test suite fails).  Instead of providing generic
emails address, change this to the address where to report with the
default Bug template applied.

(cherry picked from commit bb60622250)
2022-02-11 08:53:26 +01:00
Ondřej Surý 38da361408 Merge branch '3137-create-new-log-messages-when-entering-and-exiting-exlusive-task-mode-v9_18' into 'v9_18'
Log when starting and ending task exclusive mode

See merge request isc-projects/bind9!5819
2022-02-10 20:42:29 +00:00
Ondřej Surý 5d48602479 Add CHANGES and release note for [GL #3137]
(cherry picked from commit 44aa8ef997)
2022-02-10 21:22:35 +01:00
Ondřej Surý 1591d78559 Log when starting and ending task exclusive mode
The task exclusive mode stops all processing (tasks and networking IO)
except the designated exclusive task events.  This has impact on the
operation of the server.  Add log messages indicating when we start the
exclusive mode, and when we end exclusive task mode.

(cherry picked from commit b9cb29076f)
2022-02-10 21:22:35 +01:00
Ondřej Surý 5d7a6c0bf8 Merge branch '2717-fix-sysconfdir-in-manpages-v9_18' into 'v9_18'
Use compile-time paths in the manual pages

See merge request isc-projects/bind9!5815
2022-02-10 16:33:28 +00:00
Ondřej Surý 74b1c37f2c Add CHANGES note for [GL #2717]
(cherry picked from commit 9e70c6887a)
2022-02-10 17:08:24 +01:00
Ondřej Surý 3f78c60539 Use compile-time paths in the manual pages
Replace the hard-coded paths for various BIND 9 files (configuration,
pid, etc.) in the man pages and ARM with compile-time values using the
sphinx-build replace system.

This is more complicated, because the restructured text specification
doesn't allow |substitions| inside ``code-blocks``, so for each specific
file we had to create own substition which is sub-optimal, but it is
only way how to do this without adding Sphinx extension.

(cherry picked from commit b42681c4e9)
2022-02-10 17:08:24 +01:00
Ondřej Surý faf395ce98 Merge branch '3130-cleanup-pthread-api-usage-v9_18' into 'v9_18'
Remove unused functions from isc_thread API

See merge request isc-projects/bind9!5808
2022-02-09 17:02:22 +00:00
Ondřej Surý 67af3c7a3b Remove unused functions from isc_thread API
The isc_thread_setaffinity call was removed in !5265 and we are not
going to restore it because it was proven that the performance is better
without it.  Additionally, remove the already disabled cpu system test.

The isc_thread_setconcurrency function is unused and also calling
pthread_setconcurrency() on Linux has no meaning, formerly it was
added because of Solaris in 2001 and it was removed when taskmgr was
refactored to run on top of netmgr in !4918.

(cherry picked from commit 0500345513)
2022-02-09 17:41:34 +01:00
Michal Nowak d69b3b3ec1 Merge branch '2599-run-less-stable-unit-tests-in-aws-v9_18' into 'v9_18'
[v9_18] Run unstable unit tests in CI

See merge request isc-projects/bind9!5806
2022-02-09 12:01:17 +00:00
Michal Nowak 4084dd1dd5 Run unstable unit tests in CI
Running unstable unit tests in CI should help with making sure they
don't fail permanently without the fact being noticed in daily
pipelines.

(cherry picked from commit 1d8788464e)
2022-02-09 12:34:04 +01:00
Michal Nowak 7e8073dea2 Merge branch 'mnowak/fix-lsan-suppression-file-path-v9_18' into 'v9_18'
[v9_18] Fix path to suppr-lsan.txt file

See merge request isc-projects/bind9!5804
2022-02-07 14:04:36 +00:00
Michal Nowak cd20453576 Fix path to suppr-lsan.txt file
The "suppr-lsan.txt" file needs to be referenced with GitLab-specific
variable, otherwise AddressSanitizer won't find it outside the
"isc-projects" project group.

This has been introduced in c3f35147a3.

(cherry picked from commit 3de17e9185)
2022-02-07 13:40:56 +01:00
Matthijs Mekking 7f466b049e Merge branch 'matthijs-engine_pkcs11-system-test-v9_18' into 'v9_18'
Add system test for engine_pkcs11

See merge request isc-projects/bind9!5799
2022-02-04 14:43:49 +00:00
Matthijs Mekking 9f2b89fa77 Fix keyfromlabel test, missing status update
Fix a missing status=$((status+ret)) in the keyfromlabel system test,
which would ignore the error if ZSK key creation failed.

(cherry picked from commit 7845f51178)
2022-02-04 15:08:41 +01:00
Aram SargsyanandMatthijs Mekking 25cb2704b4 Use unique SoftHSMv2 token label for the "keyfromlabel" test
When there are more than one tokens initialized in SoftHSMv2,
care must be taken to correctly identify them.

Use a SoftHSMv2 token label which will uniquely identify the
token used for this test.

Use the "--token-label" parameter for the `pkcs11-tool` program
to make sure that it finds and uses the correct token.

(cherry picked from commit a449709441)
2022-02-04 15:08:33 +01:00
Matthijs Mekking b3e5e12ddf Fix keyfromlabel echo output
The 'id' variable is either keyfromlabel-ksk or keyfromlabel-zsk and is
set in the 'keygen' and 'keyfromlabel' functions. It should not be used
outside these functions.

(cherry picked from commit 468cf3cdc2)
2022-02-04 15:08:27 +01:00
Matthijs Mekking a9f7e4badb Add test for assertion failure in pk11_numbits
This test was originally in the pkcs11 system test. While this crash
happened in the native pkcs11 of BIND 9, and that code has been
removed in 9.17, there is no need for this test. Nevertheless, it
doesn't hurt having the test case persist.

(cherry picked from commit bfe287f4a4)
2022-02-04 15:08:21 +01:00
Matthijs Mekking 28093e56a9 Add system test for engine_pkcs11
Add a system test for engine_pkcs11 interactions that replaces the
tests that are done in the native PKCS#11 system test.

The native PKCS#11 code was removed in 9.17 but without copying the
pkcs11 system test.

(cherry picked from commit 11a0b41370)
2022-02-04 15:08:15 +01:00
Evan Hunt 6089dc5ba5 Merge branch 'each-missing-relnotes-v9_18' into 'v9_18'
Release notes for [GL #3082] and [GL #3111]

See merge request isc-projects/bind9!5797
2022-02-02 20:04:28 +00:00
Evan Hunt 4c205fb69a Release notes for [GL #3082] and [GL #3111]
(cherry picked from commit d45f0e1d9e)
2022-02-02 12:02:06 -08:00
Petr Špaček 478a10e318 Merge branch '2974-improve-directory-documentation-v9_18' into 'v9_18'
Clarify effect of "directory" configuration option [v9_18]

See merge request isc-projects/bind9!5793
2022-02-02 11:33:46 +00:00
Ondřej SurýandPetr Špaček faafbfa98f Clarify effect of "directory" configuration option
The "directory" configuration options affects the configuration listed
after the directive but not before which may affect ``include``
directive with relative file paths.

(cherry picked from commit 00ba6967b1)
2022-02-02 12:29:30 +01:00
Ondřej Surý cc94730ab9 Merge branch '3125-log-hard-quota-when-not-accepting-the-connection-v9_18' into 'v9_18'
Add log message when hard quota is reached in TCP accept

See merge request isc-projects/bind9!5789
2022-02-01 20:42:11 +00:00
Ondřej Surý b7fb29397a Add CHANGES and release notes for [GL #3125]
(cherry picked from commit 932fc7b826703f8b0f30ed11c496f94a02e6ebbb)
2022-02-01 21:13:07 +01:00
Ondřej Surý 916b301fd4 Add log message when hard quota is reached in TCP accept
When isc_quota_attach_cb() API returns ISC_R_QUOTA (meaning hard quota
was reached) the accept_connection() would return without logging a
message about quota reached.

Change the connection callback to log the quota reached message.

(cherry picked from commit 2ae84702ad)
2022-02-01 21:02:44 +01:00
Petr Špaček f1923ed6cd Merge branch '3120-recent-editions-9-17-22-onwards-of-arm-have-many-empty-grammar-descriptions-v9_18' into 'v9_18'
Fix empty grammar descriptions in the ARM [v9_18]

See merge request isc-projects/bind9!5785
2022-02-01 17:49:28 +00:00
Petr Špaček 724a051820 Add missing parental-agents grammar generation
Formerly parental-agents grammar was an exception and it did not
auto-generate itself from source code. From now on it is generated using
the same mechanism as other grammars.

For consistency with rest of the system, I've also renamed the grammar
file and the link anchors from "parentals" to "parental-agents".

Technically this is fixup for commit
0311705d4b.

Related: !5234
(cherry picked from commit 34a3b35b08)
2022-02-01 18:25:08 +01:00
Mark AndrewsandPetr Špaček 2262bb9538 Regenerate .rst files with grammars after changes to rst generators
$ make -C doc/misc all

(cherry picked from commit e97c35b3bc)
2022-02-01 18:25:08 +01:00
Mark AndrewsandPetr Špaček f51fe1e714 Fix grammar generators to produce renderable include files in rst format
The missing `::` in the .rst files caused grammar section in docs to
render empty.

The `::` was accidentally removed in an unrelated commit
58bd26b6cf which was supposed to update
only copyright headers.

Fixes: #3120
(cherry picked from commit d975e6630f)
2022-02-01 18:25:07 +01:00
Mark AndrewsandPetr Špaček 9eac4401b4 Add missing rst-grammars.pl dependecy to config grammar build
(cherry picked from commit f5c66f311a)
2022-02-01 18:25:03 +01:00
Mark Andrews 9e1aba9cbc Merge branch '3117-9-18-0-nslookup-debugging-output-v9_18' into 'v9_18'
Remove spurious 'debugging = true;'

See merge request isc-projects/bind9!5783
2022-01-31 23:40:29 +00:00
Mark Andrews 4a6078673b Check that no debugging / errors are reported normally
(cherry picked from commit 123b57db36)
2022-02-01 10:22:41 +11:00
Evan HuntandMark Andrews 84baff1d00 make nslookup test shellcheck safe
(cherry picked from commit 6de4dfcc8c)
2022-02-01 10:22:41 +11:00
Mark Andrews ccfa2562a5 Remove spurious 'debugging = true;'
This appears to be left over from the developement phase while
adding reference counting to the lookup structure.

(cherry picked from commit c068c3c771)
2022-02-01 10:22:41 +11:00
Evan Hunt f1977e5017 Merge branch 'each-dlz-pthreads-v9_18' into 'v9_18'
complete removal of !PTHREADS code from DLZ modules

See merge request isc-projects/bind9!5781
2022-01-31 18:41:20 +00:00
Evan Hunt 7923f86bdd complete removal of !PTHREADS code from DLZ modules
DLZ modules no longer support being built without threads,
so the "#if PTHREADS" conditionals were no longer necessary,
and were also causing errors in some of the modules due to
PTHREADS no longer being defined in dlz_pthread.h.

(cherry picked from commit c3a715123b)
2022-01-31 10:37:45 -08:00
Evan Hunt 9b0ffbbe2d Merge branch 'each-fix-contrib-dlz-v9_18' into 'v9_18'
update dlz_minimal.h

See merge request isc-projects/bind9!5777
2022-01-28 00:25:32 +00:00
Evan Hunt 8bd431a251 update dlz_minimal.h
the addition of support for ECS client information in DLZ
modules omitted some necessary changes to build modules
in contrib.

(cherry picked from commit d3fed6f400)
2022-01-27 16:18:34 -08:00
Evan Hunt 9d5e023cc5 Merge branch 'each-dns-clientinfo-v9_18' into 'v9_18'
allow dns_clientinfo to store client ECS data

See merge request isc-projects/bind9!5773
2022-01-27 22:52:23 +00:00
Evan Hunt cee56e3a53 CHANGES for [GL #3082]
(cherry picked from commit e42f7d2722)
2022-01-27 14:51:11 -08:00
Evan Hunt 60f97b6432 test ECS information is passed in dlzexternal
the dlzexternal test driver now includes ECS, if present in the
query, in the TXT record returned for QNAME "source-addr".

(cherry picked from commit 79ddedabf8)
2022-01-27 14:51:11 -08:00
Petr ŠpačekandEvan Hunt 34f6cce2c6 extend DLZ interface and example with ECS support
Apparently we forgot about DLZ when updating DNS_CLIENTINFO_VERSION
constant for ECS, which is at value "3" since ECS was introduced.

The code in example drivers and tests now hardcodes version numbers
2 (without ECS) and 3 (with ECS) depending on what a given code path
requires.

(cherry picked from commit f81debe1c8)
2022-01-27 14:51:11 -08:00
Evan Hunt 317ef804c0 allow dns_clientinfo to store client ECS data
this brings DNS_CLIENTINFO_VERSION into line with the subscription
branch so that fixes applied to clientinfo processing can also be
applied to the main branch without diverging.

(cherry picked from commit 737e658602)
2022-01-27 14:51:11 -08:00
Ondřej Surý f9926228e1 Merge branch '3108-cacheline-detection-propagate-v9_18' into 'v9_18'
Use detected cache line size

See merge request isc-projects/bind9!5771
2022-01-27 12:37:14 +00:00
Ondřej Surý 6c578f232e Add CHANGES note for [GL #3108]
(cherry picked from commit f386fab2e2)
2022-01-27 13:07:31 +01:00
Petr MenšíkandOndřej Surý b465b29eaf Use detected cache line size
IBM power architecture has L1 cache line size equal to 128.  Take
advantage of that on that architecture, do not force more common value
of 64.  When it is possible to detect higher value, use that value
instead.  Keep the default to be 64.

(cherry picked from commit f00f521e9c)
2022-01-27 13:07:31 +01:00
Ondřej Surý 5e25081edc Merge branch '3115-qname-wait-recurse-typo-v9_18' into 'v9_18'
Fix typo in qname-wait-recurse

See merge request isc-projects/bind9!5769
2022-01-27 11:58:08 +00:00
Ondřej Surý 6b681e7019 Fix typo in qname-wait-recurse
In the RPZ documentation, there's a mistake where it states that the
default behavior will be disabled by setting `qname-wait-recurse yes;`
while in fact it's opposite `qname-wait-recurse no;`.

This affects only the RST documentation.

(cherry picked from commit 1e711dcccb)
2022-01-27 12:55:40 +01:00
Matthijs Mekking dbf55d5ebd Merge branch 'matthijs-keyfromlabel-system-test-9_18' into 'v9_18'
keyfromlabel system test (9.18)

See merge request isc-projects/bind9!5767
2022-01-27 11:24:50 +00:00
Matthijs Mekking 79d14cacd3 Update pkcs11 documentation on openssl_conf
The user should make sure there are no other 'openssl_conf = ...' lines
in the file.

(cherry picked from commit a90f4c4ffa)
2022-01-27 12:23:22 +01:00
Matthijs Mekking 4895b10884 Create keys with pkcs11-tool --id
The keyfromlabel system ECDSA tests sometimes fail. When this happens
the ZSK and KSK key id values differ by 1, which is an indication that
the same key is used for both DNSKEY records.

When the private key is retrieved with 'ENGINE_load_private_key()', the
public key is already set. But sometimes that key differs from the key
which was retrieved with 'ENGINE_load_public_key()'.

The libp11 source code uses id to find the key and without IDs all the
keys are "equal", so it is returning the first key in the array of the
enumerated keys instead of the matching key. In our test we didn't use
'--id', just '--label'. With this change, the system test should no
longer fail intermittently.

Note this is only an issue for ECDSA keys, not RSA keys.

(cherry picked from commit 0af8bbd49b)
2022-01-27 12:23:22 +01:00
Matthijs Mekking c3f35147a3 Suppressing memory leaks procuded by LeakSanitizer
These memory leaks are a known issue in libp11: From Timo Teras:

The relevant code is:

  https://github.com/OpenSC/libp11/blob/master/src/eng_front.c#L114-L123

The authors of libp11 did not get the locking right and decided
that having intentional memory leaks is better than risking a deadlock.

The leak logs indicate that it is the cached structures that should
have been freed.

These are not a run-time leaks, so suppressing these leaks is probably
okay.

(cherry picked from commit 8a4f098dee)
2022-01-27 12:23:22 +01:00
Matthijs Mekking 9926ea647f Add system test for dnssec-keyfromlabel
Add missing system test for dnssec-keyfromlabel. Test for various
algorithms that we can generate key files from a key that is stored in a
HSM, and that those keys can be used for signing with dnssec-signzone.

(cherry picked from commit eba66665a5)
2022-01-27 12:23:12 +01:00
Matthijs Mekking 1329e89927 Update .gitlab-ci.yml with openssl setup
GitLab CI needs to know about some environment variables that will
tell where OpenSSL and SoftHSM2 is installed. This is done in the
image, making the prepare-softhsm2.sh script obsolete.

The SoftHSM2 module location is system specific.

(cherry picked from commit 221e1bc2a3)
2022-01-27 12:21:58 +01:00
Matthijs Mekking a373b821ee Remove prepare-softhsm2.sh from runtime test
This script is obsoleted because SoftHSM2 is now installed in the
image.

(cherry picked from commit 0725fcad38)
2022-01-27 12:21:58 +01:00
Matthijs Mekking 90480c0d54 Add CHANGES for keyfromlabel test
(cherry picked from commit ad01bca9fd)
2022-01-27 12:21:58 +01:00
Michal Nowak 612341a1da Merge branch 'mnowak/drop-some-system-test-scrips-v9_18' into 'v9_18'
[v9_18] Remove leftover test code for Windows

See merge request isc-projects/bind9!5766
2022-01-27 10:49:21 +00:00
Evan HuntandMichal Nowak 018f8be52a Remove leftover test code for Windows
- Removed all code that only runs under CYGWIN, and made all
  code that doesn't run under CYGWIN non-optional.
- Removed the $TP variable which was used to add optional
  trailing dots to filenames; they're no longer optional.
- Removed references to pssuspend and dos2unix.
- No need to use environment variables for diff and kill.
- Removed uses of "tr -d '\r'"; this was a workaround for
  a cygwin regex bug that is no longer needed.

(cherry picked from commit 1d706f328c)
2022-01-27 10:35:54 +01:00
Michał Kępień c2c7b36f5e Merge branch 'ondrej/use-utc-for-reproducible-builds-v9_18' into 'v9_18'
[v9_18] Use UTC datetime for reproducible builds

See merge request isc-projects/bind9!5765
2022-01-27 05:56:35 +00:00
Ondřej SurýandMichał Kępień 9bfbff4a3c Use UTC datetime for reproducible builds
For reproducible builds, we use last modification time of the CHANGES
file.  This works pretty well, unless the builds are made in different
timezones.

Use UTC option to date command to make the builds reproducible.

(cherry picked from commit 8c4d5d5623)
2022-01-27 06:53:15 +01:00
Arаm Sаrgsyаn ab061cbc69 Merge branch '3087-tls-ephemeral-certificate-set-not-before-in-past-v9_18' into 'v9_18'
[v9_18] Set the ephemeral certificate's "not before" a short time in the past

See merge request isc-projects/bind9!5762
2022-01-26 18:29:16 +00:00
Aram Sargsyan 3d835107af Set the ephemeral certificate's "not before" a short time in the past
TLS clients can have their clock a short time in the past which will
result in not being able to validate the certificate.

Setting the "not before" property 5 minutes in the past will
accommodate with some possible clock skew across systems.

(cherry picked from commit 81d3584116)
2022-01-26 17:28:37 +00:00
Michał Kępień e82c8c6105 Merge branch 'michal/misc-test-framework-fixes-v9_18' into 'v9_18'
[v9_18] Miscellaneous test framework fixes

See merge request isc-projects/bind9!5763
2022-01-26 14:40:46 +00:00
Michał Kępień 7d7199f18c Fix waiting for lock file removal upon exit
Commit c787a539d2 fixed a certain class of
intermittent system test failures caused by named instances unable to
restart.  The root cause was bin/tests/system/stop.pl returning without
waiting for a named instance to remove its lock file.

Later on, it turned out that the above change causes other issues on
Windows due to the way named handles signals on that platform.  Commit
761ba4514f intended to address those
issues by making the server_lock_file() subroutine in
bin/tests/system/stop.pl return an empty value on Windows, in order to
prevent the script for waiting for lock file cleanup on that platform.
Note, however, that Windows detection in that subroutine is limited to
checking whether the CYGWIN environment variable is set.

While that environment variable was not set on Unix-like systems before
commit 761ba4514f, another commit
(a33237f070, merged a few weeks later)
changed that by setting the CYGWIN environment variable to an empty
value on Unix-like systems.  This made the defined($ENV{'CYGWIN'}) check
in server_lock_file() return true, inadvertently preventing
bin/tests/system/stop.pl from waiting for lock file removal before
exiting on Unix-like systems and therefore reintroducing the original
issue.

Fix by making server_lock_file() only return an empty value when the
CYGWIN environment variable is set to a non-empty value (which is what
bin/tests/system/conf.sh.win32 does).  Adjust a similar check in the
pid_file_exists() subroutine in the same way for consistency.

(cherry picked from commit a938db2170)
2022-01-26 15:21:14 +01:00
Michał Kępień 17fbf25676 Do not strip leading whitespace from test output
The echo_*() and cat_*() functions in bin/tests/system/conf.sh.common
call the "read" builtin command without specifying the field separator
to use.  This results in leading whitespace getting stripped from each
line of the texts passed to those functions, which mangles e.g. pytest
output, hindering test failure troubleshooting.

Address by setting IFS to an empty value for the "read" calls used in
the aforementioned helper functions.

(cherry picked from commit fb87022115)
2022-01-26 15:21:14 +01:00
Michał Kępień b1063d2de6 Retain all named.run files from each test run
The bin/tests/system/start.pl script truncates the named.run file for a
given named instance unless it is invoked with the --restart
command-line option.  Ever since Python-based tests were introduced,
bin/tests/system/run.sh may start named instances used by a given system
test multiple times within a single run, causing the
bin/tests/system/start.pl script to truncate some of the log files
written during the test.  This makes troubleshooting certain test
failures hard or even impossible.

Fix by calling bin/tests/system/start.pl with the --restart command-line
option for every start_servers() invocation except the first one.

(cherry picked from commit 65abbca79b)
2022-01-26 15:21:14 +01:00
Arаm Sаrgsyаn 1447ae57f5 Merge branch '3060-revert-view-on-failed-reconfig-v9_18' into 'v9_18'
[v9_18] Improve the view configuration error handling and reverting logic

See merge request isc-projects/bind9!5761
2022-01-26 12:47:14 +00:00
Aram Sargsyan b31c836e1b Fix a memory leak in dns_dlzcreate()
dns_dlzcreate() fails to free the memory allocated for dlzname
when an error occurs.

Free dlzname's memory (acquired earlier with isc_mem_strdup())
by calling isc_mem_free() before returning an error code.

(cherry picked from commit 4a6c66288f)
2022-01-26 12:08:01 +00:00
Aram Sargsyan bb76e644c1 Fix invalid control port number in the catz system test
When failure is expected, the `rndc` command in the catz system test
is being called directly instead of using a function, i.e.:

    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reconfig \
        > /dev/null 2>&1 && ret=1

... instead of:

    rndccmd 10.53.0.2 reconfig && ret=1

This is done to suppress messages like "lt-rndc: 'reconfig' failed:
failure" appearing in the message log of the test, because failure
is actually expected, and the appearance of that message can be
confusing.

The port value used in this case is not correct, making the
`rndc reload` command to fail.  This error was not detected earlier
only because the failure of the command is actually expected, but
the failure happens for a "wrong" reason, and the test still passes.

Fix the error by using the existing variable instead of the fixed
number.

(cherry picked from commit 5f9d4b5db4)
2022-01-26 12:07:53 +00:00
Aram Sargsyan 7f6dc9ba4d Add a system test for view reverting after a failed reconfiguration
Test the view reverting code by introducing a faulty dlz configuration
in named.conf and using `rndc reconfig` to check if named handles the
situation correctly.

We use "dlz" because the dlz processing code is located in an ideal
place in the view configuration function for the test to cover the
view reverting code.

This test is specifically added to the catz system test to additionally
cover the catz reconfiguration during the mentioned failed
reconfiguration attempt.

(cherry picked from commit 62337d433f)
2022-01-26 12:07:45 +00:00
Aram Sargsyan 5e98b3c202 Add CHANGES and release notes for [GL #3060]
(cherry picked from commit d7dfa2dc4b)
2022-01-26 12:07:29 +00:00
Aram Sargsyan 3aa0c56d4c Improve the zones' view reverting logic when a zone is a catalog zone
When a zone is being configured with a new view, the catalog zones
structure will also be linked to that view. Later on, in case of some
error, should the zone be reverted to the previous view, the link
between the catalog zones structure and the view won't be reverted.

Change the dns_zone_setviewrevert() function so it calls
dns_zone_catz_enable() during a zone revert, which will reset the
link between `catzs` and view.

(cherry picked from commit 2fd967136a)
2022-01-26 12:06:17 +00:00
Aram Sargsyan 2d570f7343 Separate the locked parts of dns_zone_catz_enable/disable functions
Separate the locked parts of dns_zone_catz_enable() and
dns_zone_catz_disable() functions into static functions.  This will
let us perform those tasks from the other parts of the module while
the zone is locked, avoiding one pair of additional unlocking and
locking operations.

(cherry picked from commit 6b937ed5f6)
2022-01-26 12:06:05 +00:00
Aram Sargsyan b7fd46f50a Improve the view configuration error handling and reverting logic
If a view configuration error occurs during a named reconfiguration
procedure, BIND can end up having twin views (old and new), with some
zones and internal structures attached to the old one, and others
attached to the new one, which essentially creates chaos.

Implement some additional view reverting mechanisms to avoid the
situation described above:

 1. Revert rpz configuration.

 2. Revert catz configuration.

 3. Revert zones to view attachments.

(cherry picked from commit 3697560f04)
2022-01-26 12:05:53 +00:00
Michał Kępień 8db45afa1a Update BIND version to 9.18.0 2022-01-24 21:04:14 +01:00
Michał Kępień cbf9916216 Add a CHANGES marker 2022-01-24 21:04:14 +01:00
Michał Kępień 006923ec16 Merge branch 'pspacek/prepare-documentation-for-bind-9.18.0' into 'v9_18_0-release'
Prepare documentation for BIND 9.18.0

See merge request isc-private/bind9!347
2022-01-24 20:02:55 +00:00
Petr ŠpačekandMichał Kępień 4b0ac74137 Create release notes for 9.18.0
We started with compilation of _all_ 9.17.z notes into one file:
$ ls *.17*.rst | sort -V | xargs cat > notes-9.18.0.rst

Then removed removed duplicate extra copyright headers:
$ grep -v '^\.\. [^_]' notes-9.18.0.rst  > notes-9.18.0.rst.copy
$ grep -v '^\.\.$' notes-9.18.0.rst.copy > notes-9.18.0.rst
$ vim notes-9.17.0.rst notes-9.18.0.rst

Next step was to find notes referencing the changes which were
backported to 9.16.25 and remove these. Duplicites were checked
by diffing corresponding texts in 9.16 and 9.17, and it revealed that
some backports were either partial, or code was backported but the
release note was lost in 9.16 branch. In that case we did not
re-introduce the relnote and considered it also duplicate.

Most notable cases of "missing in 9.16 relnote but in fact fixed"
were notes for CVE-2020-8616 and CVE-2020-8617.
These were accidentally omitted from 9.16 release docs, and we are going
to fix it in separate MR !5722.

Further removals include:
- Security issue #2787: The bug was introduced & fixed in 9.17.z,
  so there is no need to tell about it to people upgrading to 9.18.0.
- Bugfix !3135: Backported but with unclear reference in relnotes.
- Bugfix !3137: Backported but with unclear reference in relnotes.
- Bugfix #2460: Introduced & fixed in 9.17.z.
- Bugfix #2504: The bug was introduced & fixed in 9.17.z.
- Bugfix #2562: Introduced & fixed in 9.17.z.
- Bugfix #2917: Introduced & fixed in 9.17.z
- Bugfix #3040: Introduced & fixed in 9.17.z.
- Bugfix #3062: Introduced & fixed in 9.17.z.
- Change #4: Introduced & "finished" in 9.17.z.
- Change #1610: Introduced & reverted in 9.17.z.
- Change #1958: No user visible impact.
- Change #2016: No user visible impact.
- Change #2022: No user visible impact.
- Change #2264: Affects a feature introduced only to 9.17 branch.
- Change #2401: No user visible impact.
- Known issue about libuv: Got fixed later in the cycle.
- Known issue about port clash: It is now config error.

Then tweaking started to clarify meaning of various notes to people
upgrading from 9.16.

While doing so, bugfix #2927 was omited because the change just makes
9.18 SERVFAIL faster than 9.16, so even though it is technically bugfix
it is so minor that it is not worth bragging about in release notes.

TLS/DoT/DoH features were summarized from many independent
notes into one giant note per feature.

All notes were rearranged according to their "perceived priority".
2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień caa2be37b4 Update boilerplate text in Release Notes
It's taken from 9.16 branch, with dates updated and reference to CHANGES
file removed. Note on Version Numbering was was already removed in !3517.
2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień f8850e1188 Fix incorrect RFC footnote about A6 RR type in RFC4033
A6 type is not mentioned anywhere in RFC4033.
2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień 7eb0428d1f Remove RFCs not implemented in BIND from list in the ARM
This commit partially removes extra RFCs which are not listed in
file doc/misc/rfc-compliance.

Most of the removed RFCs are either outright obsolete, irrelevant,
or not implemented. Rationale:
- 974 - obsolete
- 1033 - ops info, hardly followed today
- 1464 - ops info
- 1591 - policy
- 1537 - obsolete
- 1713 - obsolete
- 1794 - notimp
- 2010 - ops info
- 2052 - obsolete
- 2065 - obsolete
- 2137 - obsolete
- 2168 - obsolete
- 2240 - obsolete
- 2345 - not dns
- 2352 - not dns
- 2540 - notimp
- 2825 - notimp, info, obsolete
- 2826 - notimp
- 2929 - obsolete
- 3071 - policy
- 3090 - obsolete
- 3258 - notimp
- 6594 - iana, SSHFP
- 7216 - not dns
- 8482 - notimp
- 8490 - notimp

Probably most notable RFCs removed are:
- 8482 for special ANY handling
- 8490 for Stateful Operations
As far as I can tell BIND does not implement those.
2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień 164272ae77 Reword RFC section in the ARM
Add couple links and caveant for uninitiated readers.
2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień 6908b46011 Add RFCs listed in doc/misc/rfc-compliance to doc/arm/general.rst
There were three RFCs listed in list of "RFCs we implement" but missing
in the ARM.

Command to compare lists in the two documents:

    diff <(grep -o '^  RFC[0-9]\+' doc/misc/rfc-compliance | sed -e 's/[^0-9]//g' | sort -n) <(grep  '^:rfc:`' doc/arm/general.rst | sed -e 's/^.*`\([0-9]*\)`.*$/\1/' | sort -n)
2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień 0841a12742 Rework doc/arm/build.rst
- Revise the list of required libraries.
  - Apply miscellaneous tweaks to style, formatting, and ordering.
2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień e8a29b0b7f Deduplicate text between Building BIND 9 / Supported Platforms in the ARM
Supported Platforms section is now really only about platforms and not
libraries. Libraries were moved to the Building BIND section.

We now have section for required libraries, and second with optional
features.  Wordy explanations were taken verbatim from the original
README.md.
2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień 7ac8fb317d Replace Building BIND 9 section in README with reference to ARM 2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień a8a1fbf421 Convert "Building BIND" section from README.md to reStructuredText
Converted using pandoc 2.14.2-9 on Arch Linux:

    $ pandoc --shift-heading-level-by=-1 -f markdown -t rst README.md > doc/arm/build.rst

Plus hand-edit to remove sections other than Building BIND 9, remove
misindentation in section headers, and add a standard copyright header.
2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień 2e7a13515f Link to ISC KB for most up-to-date platform support statuses 2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień 626affbbc2 Replace all occurences of PLATFORMS file with reference to the ARM
The conf.py exclude_patterns now includes platforms.rst to avoid
problems with redefining labels:
https://github.com/sphinx-doc/sphinx/issues/1668#issuecomment-71376208
2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień d5b82c9877 Replace duplicate Supported Operating Systems in the ARM by PLATFORMS.rst 2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień 627ac5a88a Convert PLATFORMS file from Markdown to reStructuredText
Converted using pandoc 2.14.2-9 on Arch Linux:

    $ pandoc -f markdown -t rst PLATFORMS.md > PLATFORMS.rst

The pandoc-generated copyright header was subsequently replaced with
usual one for .rst files.
2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień aebb209461 Update BIND version number in PLATFORMS.md to 9.18 2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień 7dc14372f2 Document that tls statement is subject to change 2022-01-24 09:27:55 +01:00
Petr ŠpačekandMichał Kępień 6d279ad49a Clarify XoT usage and warn about the unauthenticated mode 2022-01-24 09:27:55 +01:00
2458 changed files with 165228 additions and 1241551 deletions
+4 -9
View File
@@ -34,10 +34,6 @@ PointerAlignment: Right
PointerBindsToType: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<(urcu\.h|urcu/urcu-|urcu-)'
Priority: 2
- Regex: '^<urcu/'
Priority: 3
- Regex: '^<isc/'
Priority: 5
- Regex: '^<(pk11|pkcs11)/'
@@ -54,6 +50,8 @@ IncludeCategories:
Priority: 35
- Regex: '^<irs/'
Priority: 40
- Regex: '^<bind9/'
Priority: 45
- Regex: '^<(dig|named|rndc|confgen|dlz)/'
Priority: 50
- Regex: '^<dlz_'
@@ -63,9 +61,9 @@ IncludeCategories:
- Regex: '^<tests/'
Priority: 100
- Regex: '<openssl/'
Priority: 4
Priority: 1
- Regex: '<(mysql|protobuf-c)/'
Priority: 4
Priority: 1
- Regex: '.*'
Priority: 0
IndentExternBlock: NoIndent
@@ -78,6 +76,3 @@ PenaltyBreakString: 80
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
+15 -31
View File
@@ -34,40 +34,26 @@ PointerAlignment: Right
PointerBindsToType: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<(urcu/urcu-|urcu-)'
Priority: 2
- Regex: '^<urcu/'
Priority: 3
- Regex: '^<isc/'
Priority: 5
- Regex: '^<(pk11|pkcs11)/'
Priority: 10
Priority: 2
- Regex: '^<dns/'
Priority: 15
- Regex: '^<dst/'
Priority: 20
- Regex: '^<isccc/'
Priority: 25
Priority: 3
- Regex: '^<iscccc/'
Priority: 4
- Regex: '^<isccfg/'
Priority: 30
Priority: 5
- Regex: '^<ns/'
Priority: 35
- Regex: '^<irs/'
Priority: 40
- Regex: '^<(dig|named|rndc|confgen|dlz)/'
Priority: 50
- Regex: '^<dlz_'
Priority: 55
- Regex: '^".*"'
Priority: 99
Priority: 6
- Regex: '^<bind9/)'
Priority: 7
- Regex: '^(<[^/]*)/)'
Priority: 8
- Regex: '^<tests/'
Priority: 100
- Regex: '<openssl/'
Priority: 4
- Regex: '<(mysql|protobuf-c)/'
Priority: 4
- Regex: '.*'
Priority: 0
Priority: 10
- Regex: '<[[:alnum:].]+>'
Priority: 1
- Regex: '".*"'
Priority: 9
IndentExternBlock: NoIndent
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
@@ -78,5 +64,3 @@ PenaltyBreakString: 80
PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8
RemoveParentheses: ReturnStatement
RemoveSemicolon: true
+6 -1534
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -10,4 +10,4 @@
/util/** export-ignore
/util/bindkeys.pl -export-ignore
/util/check-make-install.in -export-ignore
/util/dtrace.sh -export-ignore
/util/mksymtbl.pl -export-ignore
-1
View File
@@ -1 +0,0 @@
contrib/gitchangelog/changelog.rc.py
+1 -1
View File
@@ -27,7 +27,7 @@ jobs:
- name: Install build dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: liburcu-dev libuv1-dev libssl-dev libnghttp2-dev libxml2-dev liblmdb-dev libjson-c-dev pkg-config autoconf automake autotools-dev libtool-bin libjemalloc-dev libedit-dev libcap-dev libidn2-dev libkrb5-dev libmaxminddb-dev zlib1g-dev python3-ply
packages: libuv1-dev libssl-dev libnghttp2-dev libxml2-dev liblmdb-dev libjson-c-dev pkg-config autoconf automake autotools-dev libtool-bin libjemalloc-dev libedit-dev libcap-dev libidn2-dev libkrb5-dev libmaxminddb-dev zlib1g-dev python3-ply
version: 1.0
# Initializes the CodeQL tools for scanning.
+1 -1
View File
@@ -30,7 +30,7 @@ jobs:
- name: Install build dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: liburcu-dev libuv1-dev libssl-dev libnghttp2-dev libxml2-dev liblmdb-dev libjson-c-dev pkg-config autoconf automake autotools-dev libtool-bin libjemalloc-dev libedit-dev libcap-dev libidn2-dev libkrb5-dev libmaxminddb-dev zlib1g-dev python3-ply
packages: libuv1-dev libssl-dev libnghttp2-dev libxml2-dev liblmdb-dev libjson-c-dev pkg-config autoconf automake autotools-dev libtool-bin libjemalloc-dev libedit-dev libcap-dev libidn2-dev libkrb5-dev libmaxminddb-dev zlib1g-dev python3-ply
version: 1.0
- name: Install sonar-scanner and build-wrapper
-2
View File
@@ -75,7 +75,6 @@ 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
@@ -96,7 +95,6 @@ doc/man/pkcs11-tokens.8in
/GPATH
/GRTAGS
/GTAGS
TAGS
# Emacs specific files
\.dir-locals-2.el
/emacs.desktop
+550 -539
View File
File diff suppressed because it is too large Load Diff
+21 -38
View File
@@ -1,63 +1,46 @@
<!--
If the bug you are reporting is potentially security-related - for example,
if it involves an assertion failure or other crash in `named` that can be
triggered repeatedly - then please make sure that you make the new issue
confidential by clicking the checkbox at the bottom!
triggered repeatedly - then please do *NOT* report it here, but send an
email to [security-officer@isc.org](security-officer@isc.org).
-->
### Summary
<!-- Concisely summarize the bug encountered. -->
(Summarize the bug encountered concisely.)
### BIND version affected
<!--
Make sure you are testing with the **latest** supported version of BIND
for a given branch. Many bugs have been fixed over time!
### BIND version used
See https://kb.isc.org/docs/supported-platforms for the current list.
The latest source is available from https://www.isc.org/download/#BIND
Paste the output of `named -V` here.
-->
(Paste the output of `named -V`.)
### Steps to reproduce
<!--
This is extremely important! Be precise and use itemized lists, please.
Even if a default configuration is affected, please include the full configuration
files _you were testing with_.
Example:
1. Use _attached_ configuration file
2. Start BIND server with command: `named -g -c named.conf ...`
3. Simulate legitimate clients using command `dnsperf -S1 -d legit-queries ...`
4. Simulate attack traffic using command `dnsperf -S1 -d attack-queries ...`
-->
1.
2.
3.
(How one can reproduce the issue - this is very important.)
### What is the current *bug* behavior?
<!-- What actually happens. -->
(What actually happens.)
### What is the expected *correct* behavior?
<!-- What you should see instead. -->
(What you should see instead.)
### Relevant configuration files
<!-- Paste any relevant configuration files here - please use code blocks (```)
(Paste any relevant configuration files - please use code blocks (```)
to format console output. If submitting the contents of your
configuration file in a non-confidential issue, it is advisable to
obscure key secrets; this can be done automatically by using
`named-checkconf -px`. -->
configuration file in a non-confidential Issue, it is advisable to
obscure key secrets: this can be done automatically by using
`named-checkconf -px`.)
### Relevant logs
### Relevant logs and/or screenshots
<!-- Paste any relevant logs here - please use code blocks (```) to format console
output, logs, and code, as it's very hard to read otherwise. -->
(Paste any relevant logs - please use code blocks (```) to format console
output, logs, and code, as it's very hard to read otherwise.)
/label ~Bug
### Possible fixes
(If you can, link to the line of code that might be responsible for the
problem.)
/label ~bug
+37
View File
@@ -0,0 +1,37 @@
<!--
THIS ISSUE TEMPLATE IS INTENDED ONLY FOR INTERNAL USE.
If the bug you are reporting is potentially security-related - for example,
if it involves an assertion failure or other crash in `named` that can be
triggered repeatedly - then please do *NOT* report it here, but send an
email to [security-officer@isc.org](security-officer@isc.org).
-->
### CVE-specific actions
- [ ] Assign a CVE identifier
- [ ] Determine CVSS score
- [ ] Determine the range of BIND versions affected (including the Subscription Edition)
- [ ] Determine whether workarounds for the problem exists
- [ ] Create a draft of the security advisory and put the information above in there
- [ ] Prepare a detailed description of the problem which should include the following by default:
- instructions for reproducing the problem (a system test is good enough)
- explanation of code flow which triggers the problem (a system test is *not* good enough)
- [ ] Prepare a private merge request containing the following items in separate commits:
- a test for the issue (may be moved to a separate merge request for deferred merging)
- a fix for the issue
- documentation updates (`CHANGES`, release notes, anything else applicable)
- [ ] Ensure the merge request from the previous step is reviewed by SWENG staff and has no outstanding discussions
- [ ] Ensure the documentation changes introduced by the merge request addressing the problem are reviewed by Support and Marketing staff
- [ ] Prepare backports of the merge request addressing the problem for all affected (and still maintained) BIND branches (backporting might affect the issue's scope and/or description)
- [ ] Prepare a standalone patch for the last stable release of each affected (and still maintained) BIND branch
### Release-specific actions
- [ ] Create/update the private issue containing links to fixes & reproducers for all CVEs fixed in a given release cycle
- [ ] Reserve a block of `CHANGES` placeholders once the complete set of vulnerabilities fixed in a given release cycle is determined
- [ ] Ensure the merge requests containing CVE fixes are merged into `security-*` branches in CVE identifier order
### Post-disclosure actions
- [ ] Merge a regression test reproducing the bug into all affected (and still maintained) BIND branches
-8
View File
@@ -1,8 +0,0 @@
Hi and thanks for filing an issue! It will be read with care by human beings.
It would be a tremendous help if you could follow these steps first:
- [ ] Search the existing issues in GitLab (both open and closed) to see if your report might be a duplicate. We have a large database here and many issues have already been fixed in the latest versions!
- [ ] Make sure this is **not** a support question. If you have specific trouble configuring or debugging your setup, please use the bind-users mailing list: https://lists.isc.org/mailman/listinfo/bind-users
- [ ] You have read and understood the "out in the open" support policy: https://blog.powerdns.com/2016/01/18/open-source-support-out-in-the-open/ . Even though it was written by the PowerDNS folks, we follow it as well!
Before continuing, **please select the appropriate issue template in the drop-down menu above, under the heading _Description_**.
+1 -1
View File
@@ -8,4 +8,4 @@
### Links / references
/label ~Feature
/label ~"feature request"
@@ -1,122 +0,0 @@
<!--
THIS ISSUE TEMPLATE IS INTENDED ONLY FOR INTERNAL USE.
If the bug you are reporting is potentially security-related - for example,
if it involves an assertion failure or other crash in `named` that can be
triggered repeatedly - then please make sure that you make the new issue
confidential!
-->
| Quick Links | :link: |
| ------------------------ | ------------------------------------ |
| Incident Manager: | @user |
| Deputy Incident Manager: | @user |
| Public Disclosure Date: | YYYY-MM-DD |
| CVSS Score: | [0.0][cvss_score] |
| Security Advisory: | isc-private/printing-press!NNN |
| Mattermost Channel: | [CVE-YYYY-NNNN][mattermost_url] |
| Support Ticket: | [URL] |
| Release Checklist: | #NNNN |
[cvss_score]: https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=AV:X/AC:X/PR:X/UI:X/S:X/C:X/I:X/A:X&version=3.1
[mattermost_url]:
:bulb: **Click [here][checklist_explanations] (internal resource) for general information about the security incident handling process.**
[checklist_explanations]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations
### Earlier Than T-5
- [ ] [:link:][step_deputy] **(IM)** Pick a Deputy Incident Manager
- [ ] [:link:][step_respond] **(IM)** Respond to the bug reporter
- [ ] [:link:][step_public_mrs] **(SwEng)** Ensure there are no public merge requests which inadvertently disclose the issue
- [ ] [:link:][step_assign_cve_id] **(IM)** Assign a CVE identifier
- [ ] [:link:][step_note_cve_info] **(SwEng)** Update this issue with the assigned CVE identifier and the CVSS score
- [ ] [:link:][step_versions_affected] **(SwEng)** Determine the range of product versions affected (including the Subscription Edition)
- [ ] [:link:][step_workarounds] **(SwEng)** Determine whether workarounds for the problem exist
- [ ] [:link:][step_coordinate] **(SwEng)** If necessary, coordinate with other parties
- [ ] [:link:][step_earliest_prepare] **(Support)** Prepare "earliest" notification text and hand it off to Marketing
- [ ] [:link:][step_earliest_send] **(Marketing)** Update "earliest" notification document in SF portal and send bulk email to earliest customers
- [ ] [:link:][step_advisory_mr] **(Support)** Create a merge request for the Security Advisory and include all readily available information in it
- [ ] [:link:][step_reproducer_mr] **(SwEng)** Prepare a private merge request containing a system test reproducing the problem
- [ ] [:link:][step_notify_support] **(SwEng)** Notify Support when a reproducer is ready
- [ ] [:link:][step_code_analysis] **(SwEng)** Prepare a detailed explanation of the code flow triggering the problem
- [ ] [:link:][step_fix_mr] **(SwEng)** Prepare a private merge request with the fix
- [ ] [:link:][step_review_fix] **(SwEng)** Ensure the merge request with the fix is reviewed and has no outstanding discussions
- [ ] [:link:][step_review_docs] **(Support)** Review the documentation changes introduced by the merge request with the fix
- [ ] [: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_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)
### At T-5
- [ ] [:link:][step_asn_documents] **(Marketing)** Update the text on the T-5 (from the Printing Press project) and "earliest" ASN documents in the SF portal
- [ ] [:link:][step_asn_links] **(Marketing)** (BIND 9 only) Update the BIND -S information document in SF with download links to the new versions
- [ ] [:link:][step_asn_send] **(Marketing)** Bulk email eligible customers to check the SF portal
- [ ] [:link:][step_preannouncement] **(Marketing)** (BIND 9 only) Send a pre-announcement email to the *bind-announce* mailing list to alert users that the upcoming release will include security fixes
### At T-1
- [ ] [:link:][step_packager_emails] **(First IM)** Send notifications to OS packagers
### On the Day of Public Disclosure
- [ ] [:link:][step_clearance] **(IM)** Grant QA & Marketing clearance to proceed with public release
- [ ] [:link:][step_publish] **(QA/Marketing)** Publish the releases (as outlined in the release checklist)
- [ ] [:link:][step_matrix] **(Support)** (BIND 9 only) Add the new CVEs to the vulnerability matrix in the Knowledge Base
- [ ] [:link:][step_publish_advisory] **(Support)** Bump Document Version for the Security Advisory and publish it in the Knowledge Base
- [ ] [:link:][step_notifications] **(First IM)** Send notification emails to third parties
- [ ] [:link:][step_mitre] **(First IM)** Advise MITRE about the disclosed CVEs
- [ ] [:link:][step_merge_advisory] **(First IM)** Merge the Security Advisory merge request
- [ ] [:link:][step_embargo_end] **(IM)** Inform original reporter (if external) that the security disclosure process is complete
- [ ] [:link:][step_asn_clear] **(Marketing)** Update the SF portal to clear the ASN
- [ ] [:link:][step_customers] **(Marketing)** Email ASN recipients that the embargo is lifted
### After Public Disclosure
- [ ] [:link:][step_regression] **(QA)** Merge a regression test reproducing the bug into all affected (and still maintained) branches
[step_deputy]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#pick-a-deputy-incident-manager
[step_respond]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#respond-to-the-bug-reporter
[step_public_mrs]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#ensure-there-are-no-public-merge-requests-which-inadvertently-disclose-the-issue
[step_assign_cve_id]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#assign-a-cve-identifier
[step_note_cve_info]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-this-issue-with-the-assigned-cve-identifier-and-the-cvss-score
[step_versions_affected]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#determine-the-range-of-product-versions-affected-including-the-subscription-edition
[step_workarounds]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#determine-whether-workarounds-for-the-problem-exist
[step_coordinate]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#if-necessary-coordinate-with-other-parties
[step_earliest_prepare]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-earliest-notification-text-and-hand-it-off-to-marketing
[step_earliest_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-earliest-notification-document-in-sf-portal-and-send-bulk-email-to-earliest-customers
[step_advisory_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-a-merge-request-for-the-security-advisory-and-include-all-readily-available-information-in-it
[step_reproducer_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-private-merge-request-containing-a-system-test-reproducing-the-problem
[step_notify_support]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#notify-support-when-a-reproducer-is-ready
[step_code_analysis]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-detailed-explanation-of-the-code-flow-triggering-the-problem
[step_fix_mr]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-private-merge-request-with-the-fix
[step_review_fix]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#ensure-the-merge-request-with-the-fix-is-reviewed-and-has-no-outstanding-discussions
[step_review_docs]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#review-the-documentation-changes-introduced-by-the-merge-request-with-the-fix
[step_backports]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-backports-of-the-merge-request-addressing-the-problem-for-all-affected-and-still-maintained-branches-of-a-given-product
[step_finish_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#finish-preparing-the-security-advisory
[step_meta_issue]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-or-update-the-private-issue-containing-links-to-fixes-reproducers-for-all-cves-fixed-in-a-given-release-cycle
[step_changes]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-reserve-a-block-of-changes-placeholders-once-the-complete-set-of-vulnerabilities-fixed-in-a-given-release-cycle-is-determined
[step_merge_fixes]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-the-cve-fixes-in-cve-identifier-order
[step_patches]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-a-standalone-patch-for-the-last-stable-release-of-each-affected-and-still-maintained-product-branch
[step_asn_releases]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-asn-releases-as-outlined-in-the-release-checklist
[step_asn_documents]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-the-text-on-the-t-5-from-the-printing-press-project-and-earliest-asn-documents-in-the-sf-portal
[step_asn_links]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-update-the-bind-s-information-document-in-sf-with-download-links-to-the-new-versions
[step_asn_send]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bulk-email-eligible-customers-to-check-the-sf-portal
[step_preannouncement]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-send-a-pre-announcement-email-to-the-bind-announce-mailing-list-to-alert-users-that-the-upcoming-release-will-include-security-fixes
[step_packager_emails]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-notifications-to-os-packagers
[step_clearance]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#grant-qa-marketing-clearance-to-proceed-with-public-release
[step_publish]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#publish-the-releases-as-outlined-in-the-release-checklist
[step_matrix]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bind-9-only-add-the-new-cves-to-the-vulnerability-matrix-in-the-knowledge-base
[step_publish_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#bump-document-version-for-the-security-advisory-and-publish-it-in-the-knowledge-base
[step_notifications]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-notification-emails-to-third-parties
[step_mitre]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#advise-mitre-about-the-disclosed-cves
[step_merge_advisory]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-the-security-advisory-merge-request
[step_embargo_end]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#inform-original-reporter-if-external-that-the-security-disclosure-process-is-complete
[step_asn_clear]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#update-the-sf-portal-to-clear-the-asn
[step_customers]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#email-asn-recipients-that-the-embargo-is-lifted
[step_regression]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#merge-a-regression-test-reproducing-the-bug-into-all-affected-and-still-maintained-branches
/confidential
+98
View File
@@ -0,0 +1,98 @@
## 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)*** Inform Support and Marketing of impending release (and give estimated release dates).
- [ ] ***(QA)*** Ensure there are no permanent test failures on any platform.
- [ ] ***(QA)*** Check charts from `shotgun:*` jobs in the scheduled pipelines to verify there is no unexplained performance drop for any protocol.
- [ ] ***(QA)*** Check Perflab 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[^1] (Subscription Edition only).
- [ ] ***(QA)*** Ensure all merge requests marked for backporting have been indeed backported.
- [ ] ***(QA)*** Announce (on Mattermost) that the code freeze is in effect.
### Before the Tagging Deadline
- [ ] ***(QA)*** Look for outstanding documentation issues (e.g. `CHANGES` mistakes) and address them if any are found.
- [ ] ***(QA)*** Ensure release notes are correct, ask Support and Marketing to check them as well.
- [ ] ***(QA)*** Update API files for libraries with new version information.
- [ ] ***(QA)*** Change software version and library versions in `configure.ac` (new major release only).
- [ ] ***(QA)*** Rebuild `configure` using Autoconf on `docs.isc.org`.
- [ ] ***(QA)*** Update `CHANGES`.
- [ ] ***(QA)*** Update `CHANGES.SE` (Subscription Edition only).
- [ ] ***(QA)*** Update `README.md`.
- [ ] ***(QA)*** Update `version`.
- [ ] ***(QA)*** Build documentation on `docs.isc.org`.
- [ ] ***(QA)*** Check that the formatting is correct for text, PDF, and HTML versions of release notes.
- [ ] ***(QA)*** Check that the formatting of the generated man pages is correct.
- [ ] ***(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)*** Verify GitLab CI results for the tags created and prepare a QA report for the releases to be published.
- [ ] ***(QA)*** Announce (on Mattermost) that the code freeze is over.
- [ ] ***(QA)*** Request signatures for the tarballs, providing their location and checksums.
- [ ] ***(Signers)*** Validate tarball checksums, sign tarballs, and upload signatures.
- [ ] ***(QA)*** Verify tarball signatures and check tarball checksums again.
- [ ] ***(Support)*** Pre-publish ASN and/or Subscription Edition tarballs so that packages can be built.
- [ ] ***(QA)*** Build and test ASN and/or Subscription Edition packages.
- [ ] ***(QA)*** Notify Support that the releases have been prepared.
- [ ] ***(Support)*** Send out ASNs (if applicable).
### On the Day of Public Release
- [ ] ***(Support)*** Wait for clearance from Security Officer to proceed with the public release (if applicable).
- [ ] ***(Support)*** Place tarballs in public location on FTP site.
- [ ] ***(Support)*** Publish links to downloads on ISC website.
- [ ] ***(Support)*** Write release email to *bind-announce*.
- [ ] ***(Support)*** Write email to *bind-users* (if a major release).
- [ ] ***(Support)*** Send eligible customers updated links to the Subscription Edition (update the -S edition delivery tickets, even if those links were provided earlier via an ASN ticket).
- [ ] ***(Support)*** Update tickets in case of waiting support customers.
- [ ] ***(QA)*** Build and test any outstanding private packages.
- [ ] ***(QA)*** Build public RPMs.
- [ ] ***(SwEng) *** Build Debian/Ubuntu packages.
- [ ] ***(SwEng) *** Update Docker images.
- [ ] ***(QA)*** Inform Marketing of the release.
- [ ] ***(QA)*** Update the internal [BIND release dates wiki page](https://wiki.isc.org/bin/view/Main/BindReleaseDates) when public announcement has been made.
- [ ] ***(Marketing)*** Post short note to Twitter.
- [ ] ***(Marketing)*** Update [Wikipedia entry for BIND](https://en.wikipedia.org/wiki/BIND).
- [ ] ***(Marketing)*** Write blog article (if a major release).
- [ ] ***(QA)*** Ensure all new tags are annotated and signed.
- [ ] ***(QA)*** Push tags for the published releases to the public repository.
- [ ] ***(QA)*** Merge the automatically prepared `prep 9.x.y` commit which updates `version` and documentation on the release branch into the relevant maintenance branch (`v9_x`).
- [ ] ***(QA)*** For each maintained branch, update the `BIND_BASELINE_VERSION` variable for the `abi-check` job in `.gitlab-ci.yml` to the latest published BIND version tag for a given branch.
- [ ] ***(QA)*** Prepare empty release notes for the next set of releases.
- [ ] ***(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 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) by modifying the relevant `Dockerfile`.
[^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.
-139
View File
@@ -1,139 +0,0 @@
### Summary
<!--
Concisely summarize the bug encountered,
preferably in one paragraph or less.
-->
### BIND versions affected
<!--
Make sure you are testing with the **latest** supported version of BIND.
See https://kb.isc.org/docs/supported-platforms for the current list.
The latest source is available from https://www.isc.org/download/#BIND
Paste the output of `named -V` here.
-->
### Preconditions and assumptions
<!--
Is a specific setup needed?
Please check the BIND Security Assumptions chapter in the ARM:
https://bind9.readthedocs.io/en/latest/chapter7.html#security-assumptions
E.g. DNSSEC validation must be disabled, etc.
E.g. Resolver must be configured to forward to attacker's server via DNS-over-TLS, etc.
E.g. Authoritative server must be configured to transfer specific primary zone.
E.g. Attacker must be in posession of a key authorized to modify at least one zone.
E.g. Attacker can affect system clock on the server running BIND.
-->
### Attacker's abilities
<!--
What resources does an attacker need to have under their control to mount this attack?
E.g. If attacking an authoritative server, does the attacked have to have prior
relationship with it? "The authoritative server under attack needs to
transfer a malicious zone from attacker's authoritative server via TLS."
E.g. If attacking a resolver, does the attacker need the ability to send
arbitrary queries to the resolver under attack? Do they need to _also_ control
an authoritative server at the same time?
-->
### Impact
<!--
Who or what is the victim of the attack and what is the impact?
Is a third party receiving many packets generated by a reflection attack?
If the affected party is the BIND server itself, please quantify the impact
on legitimate clients:
E.g. After launching the attack, the answers-per-second metric for legitimate
traffic drops to 1/1000 within the first minute of the attack.
-->
### Steps to reproduce
<!--
This is extremely important! Be precise and use itemized lists, please.
Even if a default configuration is affected, please include the full configuration
files _you were testing with_.
Example:
1. Use the _attached_ configuration file
2. Start the BIND server with command: `named -g -c named.conf ...`
3. Simulate legitimate clients using the command `dnsperf -S1 -d legit-queries ...`
4. Simulate attack traffic using the command `dnsperf -S1 -d attack-queries ...`
-->
1.
2.
3.
### What is the current *bug* behavior?
<!--
Examples:
Legitimate QPS drops 1000x.
Memory consumption increases out of bounds and the server crashes.
The server crashes immediately.
-->
### What is the expected *correct* behavior?
<!--
If the attack causes resource exhaustion, what do you think the correct
behavior should be? Should BIND refuse to process more requests?
What heuristic do you propose to distinguish legitimate and attack traffic?
-->
### Relevant logs
<!--
Please provide log files from your testing. Include full named logs and also
the output from any testing tools (e.g. dnsperf, DNS Shotgun, kxdpgun, etc.)
If multiple log files are needed, make sure all the files have matching timestamps
so we can correlate log events across log files.
In the case of resource exhaustion attacks, please _also_ include system monitoring
data. You can use https://gitlab.isc.org/isc-projects/resource-monitor/ to
gather system-wide statistics.
-->
### Coordination
- Does this issue affect multiple implementations?
<!--
Issues affecting multiple implementations require very careful coordination. We
have to make sure the information does not leak to the public until vendors are ready to
release fixed versions. If it is a multi-vendor issue, we need to know about the situation
as soon as possible to start the (confidential!) coordination process within
DNS-OARC and other suitable fora.
Please list implementations you have tested.
-->
- Have you shared the information with anyone else?
<!--
Have you informed other affected vendors? Or maybe submitted a paper for
review?
-->
- What is your plan to publicize this issue?
<!--
E.g. we plan to go public during conference XYZ on 20XX-XX-XX
-->
### Acknowledgements
<!--
Please specify whether and how you would like to be publicly credited with
discovering the issue. We normally use the format:
First_name Last_name, Company_or_Team.
-->
<!-- DO NOT modify the following two lines. -->
/label ~Bug ~Security
/confidential
-27
View File
@@ -1,27 +0,0 @@
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>
+1 -19
View File
@@ -1,28 +1,10 @@
[IMPORTS]
deprecated-modules=
dns.resolver,
[MESSAGES CONTROL]
[MASTER]
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
+5 -3
View File
@@ -6,9 +6,6 @@ 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:
@@ -16,3 +13,8 @@ sphinx:
# Build all formats
formats: all
# Explicitly set the version of Python and its requirements
python:
install:
- requirements: doc/arm/requirements.txt
+4 -44
View File
@@ -24,8 +24,8 @@ Files: **/*.after*
**/testdata/*
.github/*
.gitlab/*
.mailmap
AUTHORS
CHANGES
COPYRIGHT
Makefile
Makefile.*
@@ -38,31 +38,10 @@ 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/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/notify/ns4/named.port.in
bin/tests/system/formerr/nametoolong
bin/tests/system/formerr/noquestions
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/formerr/twoquestions
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
@@ -70,20 +49,6 @@ Files: **/*.after*
bin/tests/system/keepalive/expected
bin/tests/system/legacy/ns6/edns512.db.signed
bin/tests/system/legacy/ns7/edns512-notcp.db.signed
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
bin/tests/system/nsupdate/CA/index.txt.attr
bin/tests/system/nsupdate/CA/serial
bin/tests/system/nsupdate/commandlist
bin/tests/system/nsupdate/verylarge.in
bin/tests/system/org.isc.bind.system.plist
@@ -106,10 +71,7 @@ Files: **/*.after*
bin/tests/system/unknown/large.out
bin/tests/system/xfer/ans5/badkeydata
bin/tests/system/xfer/ans5/badmessageid
bin/tests/system/xfer/ans5/ednsformerr
bin/tests/system/xfer/ans5/ednsnotimp
bin/tests/system/xfer/ans5/goodaxfr
bin/tests/system/xfer/ans5/ixfrnotimp
bin/tests/system/xfer/ans5/partial
bin/tests/system/xfer/ans5/soamismatch
bin/tests/system/xfer/ans5/unknownkey
@@ -123,6 +85,7 @@ 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
@@ -194,13 +157,10 @@ 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
sonar-project.properties
tests/bench/names.csv
Copyright: Internet Systems Consortium, Inc. ("ISC")
License: CC0-1.0
+1 -2
View File
@@ -1,3 +1,2 @@
# Uninstrumented libraries
# Uninstrumented library.
called_from_lib:libfstrm.so
race:dummyrpz
-1
View File
@@ -51,4 +51,3 @@ Anay Panvalkar
colleen
Robert Edmonds
João Damas
Artem Boldariev (Артем Болдарєв)
+20895
View File
File diff suppressed because it is too large Load Diff
+12 -13
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
*Nov 26, 2024*
*May 28, 2020*
### 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.20
number in the BIND 9 version number. So, to check out the BIND 9.18
branch, use:
> $ git checkout bind-9.20
> $ git checkout bind-9.18
Whenever a branch is ready for publication, a tag is placed of the
form `v9.X.Y`. The 9.20.0 release, for instance, is tagged as `v9.20.0`.
form `v9.X.Y`. The 9.18.0 release, for instance, is tagged as `v9.18.0`.
The branch in which the next major release is being developed is called
`main`.
@@ -121,9 +121,8 @@ 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. Please contact ISC and provide your GitLab username in order to be allowed
to fork the project and submit merge requests.
[ISC's GitLab](https://gitlab.isc.org/isc-projects/bind9/) source
repository for BIND.
Patches can also be submitted as diffs against a specific version of
BIND -- preferably the current top of the `main` branch. Diffs may
@@ -145,8 +144,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 unit and system tests to ensure your change hasn't caused any
functional regressions (these can be checked in the CI pipeline).
* Run `make check` to ensure your change hasn't caused any
functional regressions.
* Document your work, both in the patch itself and in the
accompanying email.
* In patches that make non-trivial functional changes, include system
@@ -157,12 +156,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.ac`, then run `autoconf`. Similarly,
instead of editing `config.h.in` directly, edit `configure.ac` and run
directly; instead, edit `configure.in`, then run `autoconf`. Similarly,
instead of editing `config.h.in` directly, edit `configure.in` 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.ac` diffs and we'll
diffs to save space. Just send the `configure.in` diffs and we'll
generate the new `configure` during the review process.
##### Documentation
@@ -174,7 +173,7 @@ of documentation in the BIND source tree:
they document, in files ending in `.rst`: for example, the
`named` man page is `bin/named/named.rst`.
* The *BIND 9 Administrator Reference Manual* is in the .rst files in
`doc/arm/`; the HTML version is automatically generated from
`doc/arm/`; the PDF and HTML versions are automatically generated from
the `.rst` files.
* API documentation is in the header file describing the API, in
Doxygen-formatted comments.
+1 -1
View File
@@ -1 +1 @@
doc/arm/changelog.rst
CHANGES
+8 -9
View File
@@ -1,26 +1,25 @@
include $(top_srcdir)/Makefile.top
SUBDIRS = . lib doc
SUBDIRS = . lib doc bin fuzz
# build libtest before fuzz/* and bin/tests
if HAVE_CMOCKA
SUBDIRS += tests
endif HAVE_CMOCKA
# run fuzz tests before system tests
SUBDIRS += fuzz bin
BUILT_SOURCES += bind.keys.h
CLEANFILES += bind.keys.h
BUILT_SOURCES = bind.keys.h
CLEANFILES = bind.keys.h
bind.keys.h: bind.keys Makefile
${PERL} ${top_srcdir}/util/bindkeys.pl ${top_srcdir}/bind.keys > $@
dist_sysconf_DATA = bind.keys
.PHONY: doc
EXTRA_DIST = \
bind.keys \
util/bindkeys.pl \
util/dtrace.sh \
contrib \
CHANGES \
COPYRIGHT \
LICENSE \
*.md
+4
View File
@@ -14,6 +14,7 @@ LF = \n
RNDC_CONF = .. |rndc_conf| replace:: ``$(sysconfdir)/rndc.conf``
RNDC_KEY = .. |rndc_key| replace:: ``$(sysconfdir)/rndc.key``
NAMED_CONF = .. |named_conf| replace:: ``$(sysconfdir)/named.conf``
BIND_KEYS = .. |bind_keys| replace:: ``$(sysconfdir)/bind.keys``
NAMED_PID = .. |named_pid| replace:: ``$(runstatedir)/named.pid``
SESSION_KEY = .. |session_key| replace:: ``$(runstatedir)/session.key``
@@ -25,8 +26,11 @@ common_SPHINXOPTS = \
-a \
$(SPHINX_V)
# The "today" variable set below is not directly used in the ARM, but its value
# is implicitly inserted on the title page of the PDF file produced by Sphinx.
ALLSPHINXOPTS = \
$(common_SPHINXOPTS) \
-D today="$(RELEASE_DATE)" \
-D rst_epilog="$$(printf "$${RST_EPILOG}")" \
$(SPHINXOPTS) \
$(srcdir)
-20
View File
@@ -1,20 +0,0 @@
# Hey Emacs, this is -*- makefile-automake -*- file!
# vim: filetype=automake
AM_V_DTRACE = $(AM_V_DTRACE_@AM_V@)
AM_V_DTRACE_ = $(AM_V_DTRACE_@AM_DEFAULT_V@)
AM_V_DTRACE_0 = @echo " DTRACE $@";
BUILT_SOURCES += probes.h
CLEANFILES += probes.h probes.o
probes.h: Makefile probes.d
$(AM_V_DTRACE)$(DTRACE) -s $(srcdir)/probes.d -h -o $@
probes.lo: Makefile probes.d $(DTRACE_DEPS)
$(AM_V_DTRACE)$(LIBTOOL) --mode=compile --tag=CC $(DTRACE) -s $(srcdir)/probes.d -G -o $@ $(DTRACE_OBJS)
if HAVE_DTRACE
if !HOST_MACOS
DTRACE_LIBADD = probes.lo
endif
endif
-5
View File
@@ -21,8 +21,3 @@ AM_CPPFLAGS += \
LDADD += \
$(top_builddir)/tests/libtest/libtest.la \
$(CMOCKA_LIBS)
if HAVE_JEMALLOC
AM_CFLAGS += $(JEMALLOC_CFLAGS)
LDADD += $(JEMALLOC_LIBS)
endif
+14 -22
View File
@@ -15,31 +15,17 @@ AM_LDFLAGS = \
$(STD_LDFLAGS)
LDADD =
BUILT_SOURCES =
CLEANFILES =
if HOST_MACOS
AM_LDFLAGS += \
-Wl,-flat_namespace
endif HOST_MACOS
if HAVE_JEMALLOC
LIBISC_CFLAGS = $(JEMALLOC_CFLAGS)
LIBISC_LIBS = $(JEMALLOC_LIBS)
else
LIBISC_CFLAGS =
LIBISC_LIBS =
endif
LIBISC_CFLAGS += \
LIBISC_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/isc/include \
-I$(top_builddir)/lib/isc/include
LIBISC_LIBS += $(top_builddir)/lib/isc/libisc.la
if HAVE_DTRACE
LIBISC_DTRACE = $(top_builddir)/lib/isc/probes.lo
endif
LIBISC_LIBS = $(top_builddir)/lib/isc/libisc.la
LIBDNS_CFLAGS = \
-I$(top_srcdir)/lib/dns/include \
@@ -47,18 +33,18 @@ LIBDNS_CFLAGS = \
LIBDNS_LIBS = \
$(top_builddir)/lib/dns/libdns.la
if HAVE_DTRACE
LIBDNS_DTRACE = $(top_builddir)/lib/dns/probes.lo
endif
LIBNS_CFLAGS = \
-I$(top_srcdir)/lib/ns/include
LIBNS_LIBS = \
$(top_builddir)/lib/ns/libns.la
if HAVE_DTRACE
LIBNS_DTRACE = $(top_builddir)/lib/ns/probes.lo
endif
LIBIRS_CFLAGS = \
-I$(top_srcdir)/lib/irs/include
LIBIRS_LIBS = \
$(top_builddir)/lib/irs/libirs.la
LIBISCCFG_CFLAGS = \
-I$(top_srcdir)/lib/isccfg/include
@@ -71,3 +57,9 @@ LIBISCCC_CFLAGS = \
LIBISCCC_LIBS = \
$(top_builddir)/lib/isccc/libisccc.la
LIBBIND9_CFLAGS = \
-I$(top_srcdir)/lib/bind9/include
LIBBIND9_LIBS = \
$(top_builddir)/lib/bind9/libbind9.la
+1 -1
View File
@@ -1 +1 @@
doc/arm/changelog.rst
CHANGES
+35 -13
View File
@@ -20,6 +20,7 @@ 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
@@ -48,7 +49,8 @@ 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 [changelog](doc/arm/changelog.rst).
the file [CHANGES](CHANGES). See [below](#changes) for details on the
CHANGES file format.
For up-to-date versions and release notes, see
[https://www.isc.org/download/](https://www.isc.org/download/).
@@ -126,7 +128,7 @@ multiple servers to run locally and communicate with each other). These
IP addresses can be configured by running the command
`bin/tests/system/ifconfig.sh up` as root.
Some tests require Perl and the `Net::DNS` and/or `IO::Socket::IP` modules,
Some tests require Perl and the `Net::DNS` and/or `IO::Socket::INET6` modules,
and are skipped if these are not available. Some tests require Python
and the `dnspython` module and are skipped if these are not available.
See bin/tests/system/README for further details.
@@ -139,18 +141,9 @@ parallel test driver; unit tests are also run by `make check`.
The *BIND 9 Administrator Reference Manual* (ARM) is included with the source
distribution, and in .rst format, in the `doc/arm`
directory. The HTML version is automatically generated and can
directory. HTML and PDF versions are automatically generated and can
be viewed at [https://bind9.readthedocs.io/en/latest/index.html](https://bind9.readthedocs.io/en/latest/index.html).
The PDF version can be built by running:
cd doc/arm/
sphinx-build -b latex . pdf/
make -C pdf/ all-pdf
The above requires TeX Live in order to work. The PDF will be written to
`doc/arm/pdf/Bv9ARM.pdf`.
Man pages for some of the programs in the BIND 9 distribution
are also included in the BIND ARM.
@@ -161,9 +154,38 @@ 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 ARM Changelog appendix include a reference to a bug report or
Most notes in the CHANGES file 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,
+4 -2
View File
@@ -4,7 +4,8 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBNS_CFLAGS) \
$(LIBISCCFG_CFLAGS)
$(LIBISCCFG_CFLAGS) \
$(LIBBIND9_CFLAGS)
AM_CPPFLAGS += \
-DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
@@ -20,7 +21,8 @@ LDADD += \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBNS_LIBS) \
$(LIBISCCFG_LIBS)
$(LIBISCCFG_LIBS) \
$(LIBBIND9_LIBS)
bin_PROGRAMS = named-checkconf named-checkzone
+23 -23
View File
@@ -14,7 +14,6 @@
/*! \file */
#include <inttypes.h>
#include <netdb.h>
#include <stdbool.h>
#include <stdio.h>
@@ -22,6 +21,8 @@
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netdb.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/stdio.h>
@@ -73,7 +74,7 @@
#define ERR_IS_MXCNAME 6
#define ERR_IS_SRVCNAME 7
static const char *dbtype[] = { ZONEDB_DEFAULT };
static const char *dbtype[] = { "rbt" };
int debug = 0;
const char *journal = NULL;
@@ -88,13 +89,12 @@ bool dochecksrv = false;
bool docheckns = false;
#endif /* if CHECK_LOCAL */
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_CHECKMX |
DNS_ZONEOPT_CHECKDUPRR | DNS_ZONEOPT_CHECKSPF |
DNS_ZONEOPT_MANYERRORS | DNS_ZONEOPT_CHECKNAMES |
DNS_ZONEOPT_CHECKINTEGRITY |
#if CHECK_SIBLING
DNS_ZONEOPT_CHECKSIBLING |
#endif /* if CHECK_SIBLING */
DNS_ZONEOPT_CHECKSVCB | DNS_ZONEOPT_CHECKWILDCARD |
DNS_ZONEOPT_CHECKWILDCARD |
DNS_ZONEOPT_WARNMXCNAME | DNS_ZONEOPT_WARNSRVCNAME;
/*
@@ -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 */
@@ -596,7 +596,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
zonename, filename, classname);
}
dns_zone_create(&zone, mctx, 0);
CHECK(dns_zone_create(&zone, mctx));
dns_zone_settype(zone, dns_zone_primary);
@@ -617,7 +617,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
CHECK(dns_zone_setjournal(zone, journal));
}
region.base = UNCONST(classname);
DE_CONST(classname, region.base);
region.length = strlen(classname);
CHECK(dns_rdataclass_fromtext(&rdclass, &region));
@@ -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);
}
+69 -88
View File
@@ -24,6 +24,7 @@
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -36,14 +37,17 @@
#include <dns/rootns.h>
#include <dns/zone.h>
#include <isccfg/check.h>
#include <isccfg/grammar.h>
#include <isccfg/namedconf.h>
#include <bind9/check.h>
#include "check-tool.h"
static const char *program = "named-checkconf";
static bool loadplugins = true;
isc_log_t *logc = NULL;
#define CHECK(r) \
@@ -60,10 +64,10 @@ usage(void);
static void
usage(void) {
fprintf(stderr,
"usage: %s [-achijlvz] [-p [-x]] [-t directory] "
"usage: %s [-chijlvz] [-p [-x]] [-t directory] "
"[named.conf]\n",
program);
exit(EXIT_SUCCESS);
exit(1);
}
/*% directory callback */
@@ -86,10 +90,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 +101,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 +120,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 +129,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 +143,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 +156,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);
DE_CONST(zclass, r.base);
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,33 +228,33 @@ 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);
}
/*
* Skip checks when using an alternate data source.
*/
cfg_map_get(zoptions, "database", &dbobj);
if (dbobj != NULL &&
strcmp(ZONEDB_DEFAULT, cfg_obj_asstring(dbobj)) != 0)
if (dbobj != NULL && strcmp("rbt", cfg_obj_asstring(dbobj)) != 0 &&
strcmp("rbt64", 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 +268,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 +286,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;
@@ -399,17 +403,6 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
zone_options |= DNS_ZONEOPT_CHECKSPF;
}
obj = NULL;
if (get_maps(maps, "check-svcb", &obj)) {
if (cfg_obj_asboolean(obj)) {
zone_options |= DNS_ZONEOPT_CHECKSVCB;
} else {
zone_options &= ~DNS_ZONEOPT_CHECKSVCB;
}
} else {
zone_options |= DNS_ZONEOPT_CHECKSVCB;
}
obj = NULL;
if (get_maps(maps, "check-wildcard", &obj)) {
if (cfg_obj_asboolean(obj)) {
@@ -465,7 +458,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 +493,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 +503,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));
DE_CONST(cfg_obj_asstring(classobj), r.base);
r.length = strlen(r.base);
return dns_rdataclass_fromtext(classp, &r);
return (dns_rdataclass_fromtext(classp, &r));
}
/*% load zones from the configuration */
@@ -572,15 +565,15 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
}
cleanup:
return result;
return (result);
}
static void
output(void *closure, const char *text, int textlen) {
UNUSED(closure);
if (fwrite(text, 1, textlen, stdout) != (size_t)textlen) {
isc_result_t *result = closure;
perror("fwrite");
*result = ISC_R_FAILURE;
exit(1);
}
}
@@ -592,21 +585,20 @@ main(int argc, char **argv) {
cfg_obj_t *config = NULL;
const char *conffile = NULL;
isc_mem_t *mctx = NULL;
isc_result_t result = ISC_R_SUCCESS;
bool cleanup_dst = false;
isc_result_t result;
int exit_status = 0;
bool load_zones = false;
bool list_zones = false;
bool print = false;
bool nodeprecate = false;
unsigned int flags = 0;
unsigned int checkflags = BIND_CHECK_PLUGINS | BIND_CHECK_ALGORITHMS;
isc_commandline_errprint = false;
/*
* Process memory debugging argument first.
*/
#define CMDLINE_FLAGS "acdhijlm:t:pvxz"
#define CMDLINE_FLAGS "cdhijlm:t:pvxz"
while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (c) {
case 'm':
@@ -633,12 +625,8 @@ main(int argc, char **argv) {
while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != EOF) {
switch (c) {
case 'a':
checkflags &= ~BIND_CHECK_ALGORITHMS;
break;
case 'c':
checkflags &= ~BIND_CHECK_PLUGINS;
loadplugins = false;
break;
case 'd':
@@ -665,7 +653,7 @@ main(int argc, char **argv) {
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "isc_dir_chroot: %s\n",
isc_result_totext(result));
CHECK(result);
exit(1);
}
break;
@@ -675,8 +663,7 @@ main(int argc, char **argv) {
case 'v':
printf("%s\n", PACKAGE_VERSION);
result = ISC_R_SUCCESS;
goto cleanup;
exit(0);
case 'x':
flags |= CFG_PRINTER_XKEY;
@@ -696,27 +683,25 @@ main(int argc, char **argv) {
}
FALLTHROUGH;
case 'h':
isc_mem_detach(&mctx);
usage();
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
CHECK(ISC_R_FAILURE);
exit(1);
}
}
if (((flags & CFG_PRINTER_XKEY) != 0) && !print) {
fprintf(stderr, "%s: -x cannot be used without -p\n", program);
CHECK(ISC_R_FAILURE);
exit(1);
}
if (print && list_zones) {
fprintf(stderr, "%s: -l cannot be used with -p\n", program);
CHECK(ISC_R_FAILURE);
exit(1);
}
if (isc_commandline_index + 1 < argc) {
isc_mem_detach(&mctx);
usage();
}
if (argv[isc_commandline_index] != NULL) {
@@ -726,48 +711,44 @@ main(int argc, char **argv) {
conffile = NAMED_CONFFILE;
}
CHECK(setup_logging(mctx, stdout, &logc));
RUNTIME_CHECK(setup_logging(mctx, stdout, &logc) == ISC_R_SUCCESS);
CHECK(dst_lib_init(mctx, NULL));
cleanup_dst = true;
CHECK(cfg_parser_create(mctx, logc, &parser));
RUNTIME_CHECK(cfg_parser_create(mctx, logc, &parser) == ISC_R_SUCCESS);
if (nodeprecate) {
cfg_parser_setflags(parser, CFG_PCTX_NODEPRECATED, true);
}
cfg_parser_setcallback(parser, directory_callback, NULL);
CHECK(cfg_parse_file(parser, conffile, &cfg_type_namedconf, &config));
CHECK(isccfg_check_namedconf(config, checkflags, logc, mctx));
if (load_zones || list_zones) {
CHECK(load_zones_fromconfig(config, mctx, list_zones));
if (cfg_parse_file(parser, conffile, &cfg_type_namedconf, &config) !=
ISC_R_SUCCESS)
{
exit(1);
}
if (print) {
cfg_printx(config, flags, output, &result);
result = bind9_check_namedconf(config, loadplugins, nodeprecate, logc,
mctx);
if (result != ISC_R_SUCCESS) {
exit_status = 1;
}
cleanup:
if (config != NULL) {
cfg_obj_destroy(parser, &config);
if (result == ISC_R_SUCCESS && (load_zones || list_zones)) {
result = load_zones_fromconfig(config, mctx, list_zones);
if (result != ISC_R_SUCCESS) {
exit_status = 1;
}
}
if (parser != NULL) {
cfg_parser_destroy(&parser);
if (print && exit_status == 0) {
cfg_printx(config, flags, output, NULL);
}
cfg_obj_destroy(parser, &config);
if (cleanup_dst) {
dst_lib_destroy();
}
cfg_parser_destroy(&parser);
if (logc != NULL) {
isc_log_destroy(&logc);
}
isc_log_destroy(&logc);
if (mctx != NULL) {
isc_mem_destroy(&mctx);
}
isc_mem_destroy(&mctx);
return result == ISC_R_SUCCESS ? 0 : 1;
return (exit_status);
}
+5 -13
View File
@@ -21,7 +21,7 @@ named-checkconf - named configuration file syntax checking tool
Synopsis
~~~~~~~~
:program:`named-checkconf` [**-achjlvz**] [**-p** [**-x** ]] [**-t** directory] {filename}
:program:`named-checkconf` [**-chjlvz**] [**-p** [**-x** ]] [**-t** directory] {filename}
Description
~~~~~~~~~~~
@@ -32,22 +32,14 @@ errors. If no file is specified,
|named_conf| is read by default.
Note: files that :iscman:`named` reads in separate parser contexts, such as
``rndc.conf`` or ``rndc.key``, are not automatically read by
:program:`named-checkconf`. Configuration errors in these files may cause
:iscman:`named` to fail to run, even if :program:`named-checkconf` was
successful. However, :program:`named-checkconf` can be run on these files
explicitly.
``rndc.key`` and ``bind.keys``, are not automatically read by
:program:`named-checkconf`. Configuration errors in these files may cause
:iscman:`named` to fail to run, even if :program:`named-checkconf` was successful.
However, :program:`named-checkconf` can be run on these files explicitly.
Options
~~~~~~~
.. option:: -a
Don't check the `dnssec-policy`'s DNSSEC key algorithms against
those supported by the crypto provider. This is useful when checking
a `named.conf` intended to be run on another machine with possibly a
different set of supported DNSSEC key algorithms.
.. option:: -h
This option prints the usage summary and exits.
+33 -39
View File
@@ -17,6 +17,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <isc/app.h>
#include <isc/attributes.h>
#include <isc/commandline.h>
#include <isc/dir.h>
@@ -24,8 +25,10 @@
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
@@ -79,7 +82,7 @@ usage(void) {
"%s zonename [ (filename|-) ]\n",
prog_name,
progmode == progmode_check ? "[-o filename]" : "-o filename");
exit(EXIT_FAILURE);
exit(1);
}
static void
@@ -147,12 +150,15 @@ main(int argc, char **argv) {
UNREACHABLE();
}
/* When compiling, disable checks by default */
/* Compilation specific defaults */
if (progmode == progmode_compile) {
zone_options = 0;
docheckmx = false;
docheckns = false;
dochecksrv = false;
zone_options |= (DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_FATALNS |
DNS_ZONEOPT_CHECKSPF | DNS_ZONEOPT_CHECKDUPRR |
DNS_ZONEOPT_CHECKNAMES |
DNS_ZONEOPT_CHECKNAMESFAIL |
DNS_ZONEOPT_CHECKWILDCARD);
} else {
zone_options |= (DNS_ZONEOPT_CHECKDUPRR | DNS_ZONEOPT_CHECKSPF);
}
#define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
@@ -160,8 +166,8 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
while ((c = isc_commandline_parse(argc, argv,
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:C:"
"DF:M:S:T:W:")) != EOF)
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:DF:"
"M:S:T:W:")) != EOF)
{
switch (c) {
case 'c':
@@ -206,7 +212,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -i: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -240,7 +246,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -k: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -251,7 +257,7 @@ main(int argc, char **argv) {
if (*endp != '\0') {
fprintf(stderr, "source serial number "
"must be numeric");
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -262,7 +268,7 @@ main(int argc, char **argv) {
if (*endp != '\0') {
fprintf(stderr, "maximum TTL "
"must be numeric");
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -279,7 +285,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -n: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -296,7 +302,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -m: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -321,7 +327,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -r: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -334,7 +340,7 @@ main(int argc, char **argv) {
fprintf(stderr,
"unknown or unsupported style: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -344,30 +350,18 @@ main(int argc, char **argv) {
fprintf(stderr, "isc_dir_chroot: %s: %s\n",
isc_commandline_argument,
isc_result_totext(result));
exit(EXIT_FAILURE);
exit(1);
}
break;
case 'v':
printf("%s\n", PACKAGE_VERSION);
exit(EXIT_SUCCESS);
exit(0);
case 'w':
workdir = isc_commandline_argument;
break;
case 'C':
if (ARGCMP("check-svcb:fail")) {
zone_options |= DNS_ZONEOPT_CHECKSVCB;
} else if (ARGCMP("check-svcb:ignore")) {
zone_options &= ~DNS_ZONEOPT_CHECKSVCB;
} else {
fprintf(stderr, "invalid argument to -C: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
}
break;
case 'D':
dumpzone++;
break;
@@ -385,7 +379,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -M: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -402,7 +396,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -S: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -414,7 +408,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -T: %s\n",
isc_commandline_argument);
exit(EXIT_FAILURE);
exit(1);
}
break;
@@ -438,7 +432,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", prog_name,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -447,7 +441,7 @@ main(int argc, char **argv) {
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "isc_dir_chdir: %s: %s\n", workdir,
isc_result_totext(result));
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -463,7 +457,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "unknown file format: %s\n",
inputformatstr);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -481,12 +475,12 @@ main(int argc, char **argv) {
rawversion > 1U)
{
fprintf(stderr, "unknown raw format version\n");
exit(EXIT_FAILURE);
exit(1);
}
} else {
fprintf(stderr, "unknown file format: %s\n",
outputformatstr);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -571,5 +565,5 @@ main(int argc, char **argv) {
}
isc_mem_destroy(&mctx);
return (result == ISC_R_SUCCESS) ? 0 : 1;
return ((result == ISC_R_SUCCESS) ? 0 : 1);
}
+1 -10
View File
@@ -23,7 +23,7 @@ named-checkzone - zone file validation tool
Synopsis
~~~~~~~~
:program:`named-checkzone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-C** mode] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-o** filename] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {zonename} {filename}
:program:`named-checkzone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-o** filename] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {zonename} {filename}
Description
~~~~~~~~~~~
@@ -68,15 +68,6 @@ Options
This option specifies the class of the zone. If not specified, ``IN`` is assumed.
.. option:: -C mode
This option controls check mode on zone files when loading.
Possible modes are ``check-svcb:fail`` and ``check-svcb:ignore``.
``check-svcb:fail`` turns on additional checks on ``_dns`` SVCB
records and ``check-svcb:ignore`` disables these checks. The
default is ``check-svcb:fail``.
.. option:: -i mode
This option performs post-load zone integrity checks. Possible modes are
+17 -32
View File
@@ -23,23 +23,17 @@ named-compilezone - zone file converting tool
Synopsis
~~~~~~~~
:program:`named-compilezone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-C** mode] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {**-o** filename} {zonename} {filename}
:program:`named-compilezone` [**-d**] [**-h**] [**-j**] [**-q**] [**-v**] [**-c** class] [**-f** format] [**-F** format] [**-J** filename] [**-i** mode] [**-k** mode] [**-m** mode] [**-M** mode] [**-n** mode] [**-l** ttl] [**-L** serial] [**-r** mode] [**-s** style] [**-S** mode] [**-t** directory] [**-T** mode] [**-w** directory] [**-D**] [**-W** mode] {**-o** filename} {zonename} {filename}
Description
~~~~~~~~~~~
:program:`named-compilezone` checks the syntax and integrity of a zone file,
and dumps the zone contents to a specified file in a specified format.
Unlike :program:`named-checkzone`, zone contents are not strictly checked
by default. If the output is to be used as an actual zone file to be loaded
by :iscman:`named`, then the check levels should be manually configured to
be at least as strict as those specified in the :iscman:`named` configuration
file.
Running :program:`named-checkzone` on the input prior to compiling will
ensure that the zone compiles with the default requirements of
:iscman:`named`.
It applies strict check levels by default, since the
dump output is used as an actual zone file loaded by :iscman:`named`.
When manually specified otherwise, the check levels must at least be as
strict as those specified in the :iscman:`named` configuration file.
Options
~~~~~~~
@@ -76,20 +70,11 @@ Options
This option specifies the class of the zone. If not specified, ``IN`` is assumed.
.. option:: -C mode
This option controls check mode on zone files when loading.
Possible modes are ``check-svcb:fail`` and ``check-svcb:ignore``.
``check-svcb:fail`` turns on additional checks on ``_dns`` SVCB
records and ``check-svcb:ignore`` disables these checks. The
default is ``check-svcb:ignore``.
.. option:: -i mode
This option performs post-load zone integrity checks. Possible modes are
``full``, ``full-sibling``, ``local``,
``local-sibling``, and ``none`` (the default).
``full`` (the default), ``full-sibling``, ``local``,
``local-sibling``, and ``none``.
Mode ``full`` checks that MX records refer to A or AAAA records
(both in-zone and out-of-zone hostnames). Mode ``local`` only
@@ -133,7 +118,7 @@ Options
.. option:: -k mode
This option performs ``check-names`` checks with the specified failure mode.
Possible modes are ``fail``, ``warn``, and ``ignore`` (the default).
Possible modes are ``fail`` (the default), ``warn``, and ``ignore``.
.. option:: -l ttl
@@ -150,19 +135,19 @@ Options
.. option:: -m mode
This option specifies whether MX records should be checked to see if they are
addresses. Possible modes are ``fail``, ``warn``, and
``ignore`` (the default).
addresses. Possible modes are ``fail``, ``warn`` (the default), and
``ignore``.
.. option:: -M mode
This option checks whether a MX record refers to a CNAME. Possible modes are
``fail``, ``warn``, and ``ignore`` (the default).
``fail``, ``warn`` (the default), and ``ignore``.
.. option:: -n mode
This option specifies whether NS records should be checked to see if they are
addresses. Possible modes are ``fail``, ``warn``, and
``ignore`` (the default).
addresses. Possible modes are ``fail`` (the default), ``warn``, and
``ignore``.
.. option:: -o filename
@@ -173,7 +158,7 @@ Options
This option checks for records that are treated as different by DNSSEC but are
semantically equal in plain DNS. Possible modes are ``fail``,
``warn``, and ``ignore`` (the default).
``warn`` (the default), and ``ignore``.
.. option:: -s style
@@ -186,7 +171,7 @@ Options
.. option:: -S mode
This option checks whether an SRV record refers to a CNAME. Possible modes are
``fail``, ``warn``, and ``ignore`` (the default).
``fail``, ``warn`` (the default), and ``ignore``.
.. option:: -t directory
@@ -198,7 +183,7 @@ Options
This option checks whether Sender Policy Framework (SPF) records exist and issues a
warning if an SPF-formatted TXT record is not also present. Possible
modes are ``warn`` and ``ignore`` (the default).
modes are ``warn`` (the default) and ``ignore``.
.. option:: -w directory
@@ -216,7 +201,7 @@ Options
This option specifies whether to check for non-terminal wildcards. Non-terminal
wildcards are almost always the result of a failure to understand the
wildcard matching algorithm (:rfc:`4592`). Possible modes are ``warn``
and ``ignore`` (the default).
(the default) and ``ignore``.
.. option:: zonename
+16 -15
View File
@@ -21,6 +21,7 @@
#include <isc/buffer.h>
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -44,24 +45,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 +72,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);
}
}
@@ -124,7 +125,7 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
DO("generate key",
dst_key_generate(dns_rootname, alg, keysize, 0, 0, DNS_KEYPROTO_ANY,
dns_rdataclass_in, NULL, mctx, &key, NULL));
dns_rdataclass_in, mctx, &key, NULL));
isc_buffer_init(&key_rawbuffer, &key_rawsecret, sizeof(key_rawsecret));
+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));
}
+7 -7
View File
@@ -34,6 +34,7 @@
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
@@ -146,8 +147,7 @@ main(int argc, char **argv) {
keyfile = isc_commandline_argument;
break;
case 'h':
usage(EXIT_SUCCESS);
break;
usage(0);
case 'k':
case 'y': /* Compatible with rndc -y. */
keyname = isc_commandline_argument;
@@ -193,15 +193,15 @@ main(int argc, char **argv) {
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
usage(EXIT_FAILURE);
usage(1);
} else {
usage(EXIT_SUCCESS);
usage(0);
}
break;
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -210,7 +210,7 @@ main(int argc, char **argv) {
POST(argv);
if (argc > 0) {
usage(EXIT_FAILURE);
usage(1);
}
if (alg == DST_ALG_HMACMD5) {
@@ -290,5 +290,5 @@ options {\n\
isc_mem_destroy(&mctx);
return 0;
return (0);
}
+12 -11
View File
@@ -30,6 +30,7 @@
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
@@ -138,13 +139,13 @@ main(int argc, char **argv) {
keysize = alg_bits(alg);
break;
case 'h':
usage(EXIT_SUCCESS);
usage(0);
case 'k':
case 'y':
if (progmode == progmode_confgen) {
keyname = isc_commandline_argument;
} else {
usage(EXIT_FAILURE);
usage(1);
}
break;
case 'M':
@@ -157,7 +158,7 @@ main(int argc, char **argv) {
if (progmode == progmode_confgen) {
quiet = true;
} else {
usage(EXIT_FAILURE);
usage(1);
}
break;
case 'r':
@@ -167,29 +168,29 @@ main(int argc, char **argv) {
if (progmode == progmode_confgen) {
self_domain = isc_commandline_argument;
} else {
usage(EXIT_FAILURE);
usage(1);
}
break;
case 'z':
if (progmode == progmode_confgen) {
zone = isc_commandline_argument;
} else {
usage(EXIT_FAILURE);
usage(1);
}
break;
case '?':
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
usage(EXIT_FAILURE);
usage(1);
} else {
usage(EXIT_SUCCESS);
usage(0);
}
break;
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -200,11 +201,11 @@ main(int argc, char **argv) {
POST(argv);
if (self_domain != NULL && zone != NULL) {
usage(EXIT_FAILURE); /* -s and -z cannot coexist */
usage(1); /* -s and -z cannot coexist */
}
if (argc > isc_commandline_index) {
usage(EXIT_FAILURE);
usage(1);
}
/* Use canonical algorithm name */
@@ -296,5 +297,5 @@ nsupdate -k <keyfile>\n");
isc_mem_destroy(&mctx);
return 0;
return (0);
}
+3 -4
View File
@@ -27,10 +27,9 @@ Synopsis
Description
~~~~~~~~~~~
:program:`tsig-keygen` is an utility that generates keys for use with TSIG
(Transaction Signatures) as defined in :rfc:`2845`. The resulting keys can be used,
for example, to secure dynamic DNS updates to a zone, or for the :iscman:`rndc`
command channel.
:program:`tsig-keygen` is an utility that generates keys for use in TSIG signing.
The resulting keys can be used, for example, to secure dynamic DNS updates
to a zone, or for the :iscman:`rndc` command channel.
A domain name can be specified on the command line to be used as the name
of the generated key. If no name is specified, the default is ``tsig-key``.
+3 -5
View File
@@ -13,15 +13,13 @@
/*! \file */
#include "util.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/tls.h>
#include "util.h"
#include <isc/print.h>
extern bool verbose;
extern const char *progname;
@@ -47,5 +45,5 @@ fatal(const char *format, ...) {
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr, "\n");
_exit(EXIT_FAILURE);
exit(1);
}
+3 -5
View File
@@ -4,9 +4,8 @@ AM_CPPFLAGS += \
-I$(top_builddir)/include \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(OPENSSL_CFLAGS)
$(LIBIRS_CFLAGS)
AM_CPPFLAGS += \
-DSYSCONFDIR=\"${sysconfdir}\"
@@ -15,9 +14,8 @@ bin_PROGRAMS = delv
delv_SOURCES = \
delv.c
delv_LDADD = \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBNS_LIBS) \
$(LIBISCCFG_LIBS)
$(LIBISCCFG_LIBS) \
$(LIBIRS_LIBS)
+217 -691
View File
File diff suppressed because it is too large Load Diff
+22 -80
View File
@@ -102,21 +102,20 @@ Options
.. option:: -a anchor-file
This option specifies a file from which to read an alternate
DNSSEC root zone trust anchor.
This option specifies a file from which to read DNSSEC trust anchors. The default
is |bind_keys|, which is included with BIND 9 and contains one
or more trust anchors for the root zone (".").
By default, keys that do not match the root zone name (`.`) are
ignored. If an alternate key name is desired, it can be
specified using the :option:`+root` option.
Keys that do not match the root zone name are ignored. An alternate
key name can be specified using the :option:`+root` option.
Note: When reading trust anchors, :program:`delv` treats
``trust-anchors``, ``initial-key``, and ``static-key`` identically. That
is, for a managed key, it is the *initial* key that is trusted;
:rfc:`5011` key management is not supported. :program:`delv` does not
consult the managed-keys database maintained by :iscman:`named`. This
means that if the default key built in to :program:`delv` is revoked,
:program:`delv` must be updated to a newer version in order to continue
validating.
Note: When reading the trust anchor file, :program:`delv` treats ``trust-anchors``,
``initial-key``, and ``static-key`` identically. That is, for a managed key,
it is the *initial* key that is trusted; :rfc:`5011` key management is not
supported. :program:`delv` does not consult the managed-keys database maintained by
:iscman:`named`, which means that if either of the keys in |bind_keys| is
revoked and rolled over, |bind_keys| must be updated to
use DNSSEC validation in :program:`delv`.
.. option:: -b address
@@ -230,36 +229,6 @@ assign values to options like the timeout interval. They have the form
This option controls whether to display the CLASS when printing a record. The
default is to display the CLASS.
.. option:: +hint=FILE, +nohint
This option specifies a filename from which to load root hints;
this will be used to find the root name servers when name server
mode (``delv +ns``) is in use. If the option is not specified,
built-in root hints will be used.
.. option:: +ns, +nons
This option toggles name server mode. When this option is in use,
the ``delv`` process instantiates a full recursive resolver, and uses
that to look up the requested query name and type. Turning on this
option also activates ``+mtrace``, ``+strace`` and ``+rtrace``, so that
every iterative query will be logged, including the full response messages
from each authoritatve server. These logged messages will be written
to ``stdout`` rather than ``stderr`` as usual, so that the full trace
can be captured more easily.
This is intended to be similar to the behavior of ``dig +trace``, but
because it uses the same code as ``named``, it much more accurately
replicates the behavior of a recursive name server with a cold cache
that is processing a recursive query.
.. option:: +qmin[=MODE], +noqmin
When used with ``+ns``, this option enables QNAME minimization mode.
Valid options of MODE are ``relaxed`` and ``strict``. By default,
QNAME minimization is disabled. If ``+qmin`` is specified but MODE
is omitted, then ``relaxed`` mode will be used.
.. option:: +ttl, +nottl
This option controls whether to display the TTL when printing a record. The
@@ -267,11 +236,11 @@ assign values to options like the timeout interval. They have the form
.. option:: +rtrace, +nortrace
This option toggles resolver fetch logging. This reports the name and
type of each query sent by :program:`delv` in the process of carrying
out the resolution and validation process, including the original query
and all subsequent queries to follow CNAMEs and to establish a chain of
trust for DNSSEC validation.
This option toggles resolver fetch logging. This reports the name and type of each
query sent by :program:`delv` in the process of carrying out the resolution
and validation process, including the original query
and all subsequent queries to follow CNAMEs and to establish a chain
of trust for DNSSEC validation.
This is equivalent to setting the debug level to 1 in the "resolver"
logging category. Setting the systemwide debug level to 1 using the
@@ -280,27 +249,15 @@ assign values to options like the timeout interval. They have the form
.. option:: +mtrace, +nomtrace
This option toggles logging of messages received. This produces
a detailed dump of the responses received by :program:`delv` in the
process of carrying out the resolution and validation process.
This option toggles message logging. This produces a detailed dump of the
responses received by :program:`delv` in the process of carrying out the
resolution and validation process.
This is equivalent to setting the debug level to 10 for the "packets"
module of the "resolver" logging category. Setting the systemwide
debug level to 10 using the :option:`-d` option produces the same
output, but affects other logging categories as well.
.. option:: +strace, +nostrace
This option toggles logging of messages sent. This produces a detailed
dump of the queries sent by :program:`delv` in the process of carrying
out the resolution and validation process. Turning on this option
also activates ``+mtrace``.
This is equivalent to setting the debug level to 11 for the "packets"
module of the "resolver" logging category. Setting the systemwide
debug level to 11 using the :option:`-d` option produces the same
output, but affects other logging categories as well.
.. option:: +vtrace, +novtrace
This option toggles validation logging. This shows the internal process of the
@@ -337,23 +294,6 @@ 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.
@@ -414,6 +354,8 @@ assign values to options like the timeout interval. They have the form
Files
~~~~~
|bind_keys|
``/etc/resolv.conf``
See Also
+5 -3
View File
@@ -4,15 +4,17 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBIDN2_CFLAGS) \
$(LIBUV_CFLAGS) \
$(OPENSSL_CFLAGS)
$(LIBIRS_CFLAGS) \
$(LIBBIND9_CFLAGS) \
$(LIBIDN2_CFLAGS)
LDADD += \
libdighost.la \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBIRS_LIBS) \
$(LIBBIND9_LIBS) \
$(LIBIDN2_LIBS)
noinst_LTLIBRARIES = libdighost.la
+169 -499
View File
File diff suppressed because it is too large Load Diff
+56 -57
View File
@@ -347,6 +347,11 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
enables search list processing as if the :option:`+search` option were
given.
.. option:: +dscp=value
This option formerly set the DSCP value used when sending a query.
It is now obsolete, and has no effect.
.. option:: +edns[=#], +noedns
This option specifies the EDNS version to query with. Valid values are 0 to 255.
@@ -436,19 +441,28 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
form answers are requested, the default is not to show the source
address and port number of the server that provided the answer.
.. option:: +idn, +noidn
.. option:: +idnin, +noidnin
Enable or disable IDN processing. By default IDN is enabled for
input query names, and for display when the output is a terminal.
This option processes [or does not process] IDN domain names on input. This requires
``IDN SUPPORT`` to have been enabled at compile time.
You can also turn off :program:`dig`'s IDN processing by setting
the ``IDN_DISABLE`` environment variable.
The default is to process IDN input when standard output is a tty.
The IDN processing on input is disabled when :program:`dig` output is redirected
to files, pipes, and other non-tty file descriptors.
.. option:: +idnout, +noidnout
This option converts [or does not convert] puny code on output. This requires
``IDN SUPPORT`` to have been enabled at compile time.
The default is to process puny code on output when standard output is
a tty. The puny code processing on output is disabled when :program:`dig` output
is redirected to files, pipes, and other non-tty file descriptors.
.. option:: +ignore, +noignore
This option ignores [or does not ignore] truncation in UDP
responses instead of retrying with TCP. By default, TCP retries are
performed.
This option ignores [or does not ignore] truncation in UDP responses instead of retrying with TCP. By
default, TCP retries are performed.
.. option:: +keepalive, +nokeepalive
@@ -507,44 +521,6 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
mandatory. Responses to padded queries may also be padded, but only
if the query uses TCP or DNS COOKIE.
.. option:: +proxy[=src_addr[#src_port]-dst_addr[#dst_port]], +noproxy
When this option is set, :program:`dig` adds PROXYv2 headers to the
queries. When source and destination addresses are specified, the
headers contain them and use the ``PROXY`` command. It means for
the remote peer that the queries were sent on behalf of another
node and that the PROXYv2 header reflects the original connection
endpoints. The default source port is ``0`` and destination port is
`53`.
For encrypted DNS transports, to prevent accidental information
leakage, encryption is applied to the PROXYv2 headers: the headers
are sent right after the handshake process has been completed.
For plain DNS transports, no encryption is applied to the PROXYv2
headers.
If the addressees are omitted, PROXYv2 headers, that use the
``LOCAL`` command set, are added instead. For the remote peer, that
means that the queries were sent on purpose without being relayed,
so the real connection endpoint addresses must be used.
.. option:: +proxy-plain[=src_addr[#src_port]-dst_addr[#dst_port], +noproxy-plain
The same as ``+[no]proxy``, but instructs ``dig`` to send PROXYv2
headers ahead of any encryption, before any handshake messages are
sent. That makes :program:`dig` behave exactly how it is described
in the PROXY protocol specification, but not all software expects
such behaviour.
Please consult the software documentation to find out if you need
this option. (for example, ``dnsdist`` expects encrypted PROXYv2
headers sent over TLS when encryption is used, while ``HAProxy``
and many other software packages expect plain ones).
For plain DNS transports the option is effectively an alias for the
``+[no]proxy`` described above.
.. option:: +qid=value
This option specifies the query ID to use when sending queries.
@@ -614,6 +590,11 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
This option performs [or does not perform] a search showing intermediate results.
.. option:: +sigchase, +nosigchase
This feature is now obsolete and has been removed; use :iscman:`delv`
instead.
.. option:: +split=W
This option splits long hex- or base64-formatted fields in resource records into
@@ -683,23 +664,25 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
server TLS certificate verification. Otherwise, the DNS server name
is used. This option has no effect if :option:`+tls-ca` is not specified.
.. option:: +topdown, +notopdown
This feature is related to :option:`dig +sigchase`, which is obsolete and
has been removed. Use :iscman:`delv` instead.
.. option:: +trace, +notrace
This option toggles tracing of the delegation path from the root name
servers for the name being looked up. Tracing is disabled by default.
When tracing is enabled, :program:`dig` makes iterative queries to
resolve the name being looked up. It follows referrals from the root
servers, showing the answer from each server that was used to resolve
the lookup.
This option toggles tracing of the delegation path from the root name servers for
the name being looked up. Tracing is disabled by default. When
tracing is enabled, :program:`dig` makes iterative queries to resolve the
name being looked up. It follows referrals from the root servers,
showing the answer from each server that was used to resolve the
lookup.
If ``@server`` is also specified, it affects only the initial query for
the root zone name servers.
:option:`+dnssec` is set when :option:`+trace` is set, to better
emulate the default queries from a name server.
Note that the ``delv +ns`` option can also be used for tracing the
resolution of a name from the root (see :iscman:`delv`).
:option:`+dnssec` is also set when :option:`+trace` is set, to better emulate the
default queries from a name server.
.. option:: +tries=T
@@ -707,6 +690,11 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
instead of the default, 3. If ``T`` is less than or equal to zero,
the number of tries is silently rounded up to 1.
.. option:: +trusted-key=####
This option formerly specified trusted keys for use with :option:`dig +sigchase`. This
feature is now obsolete and has been removed; use :iscman:`delv` instead.
.. option:: +ttlid, +nottlid
This option displays [or does not display] the TTL when printing the record.
@@ -772,6 +760,17 @@ each lookup. The final query has a local query option of :option:`+noqr` which
means that :program:`dig` does not print the initial query when it looks up the
NS records for ``isc.org``.
IDN Support
~~~~~~~~~~~
If :program:`dig` has been built with IDN (internationalized domain name)
support, it can accept and display non-ASCII domain names. :program:`dig`
appropriately converts character encoding of a domain name before sending
a request to a DNS server or displaying a reply from the server.
To turn off IDN support, use the parameters
:option:`+idnin` and :option:`+idnout`, or define the ``IDN_DISABLE`` environment
variable.
Return Codes
~~~~~~~~~~~~
+484 -394
View File
File diff suppressed because it is too large Load Diff
+12 -16
View File
@@ -23,10 +23,10 @@
#include <isc/formatcheck.h>
#include <isc/lang.h>
#include <isc/list.h>
#include <isc/loop.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/netmgr.h>
#include <isc/print.h>
#include <isc/refcount.h>
#include <isc/sockaddr.h>
#include <isc/time.h>
@@ -187,13 +187,6 @@ struct dig_lookup {
char *tls_key_file;
isc_tlsctx_cache_t *tls_ctx_cache;
};
struct {
bool proxy_mode;
bool proxy_plain;
bool proxy_local;
isc_sockaddr_t proxy_src_addr;
isc_sockaddr_t proxy_dst_addr;
};
isc_stdtime_t fuzztime;
};
@@ -266,12 +259,12 @@ extern isc_sockaddr_t localaddr;
extern char keynametext[MXNAME];
extern char keyfile[MXNAME];
extern char keysecret[MXNAME];
extern dst_algorithm_t hmac_alg;
extern const dns_name_t *hmacname;
extern unsigned int digestbits;
extern dns_tsigkey_t *tsigkey;
extern bool validated;
extern isc_loopmgr_t *loopmgr;
extern isc_loop_t *mainloop;
extern isc_taskmgr_t *taskmgr;
extern isc_task_t *global_task;
extern bool free_now;
extern bool debugging, debugtiming, memdebugging;
extern bool keep_open;
@@ -324,10 +317,7 @@ void
start_lookup(void);
void
onrun_callback(void *arg);
void
run_loop(void *arg);
onrun_callback(isc_task_t *task, isc_event_t *event);
int
dhmain(int argc, char **argv);
@@ -348,7 +338,7 @@ isc_result_t
parse_netprefix(isc_sockaddr_t **sap, const char *value);
void
parse_hmac(const char *algname);
parse_hmac(const char *hmacstr);
dig_lookup_t *
requeue_lookup(dig_lookup_t *lookold, bool servers);
@@ -452,6 +442,12 @@ dig_query_setup(bool, bool, int argc, char **argv);
void
dig_startup(void);
/*%
* Initiates the next lookup cycle
*/
void
dig_query_start(void);
/*%
* Activate/deactivate IDN filtering of output.
*/
+39 -40
View File
@@ -19,11 +19,13 @@
#include <stdbool.h>
#include <stdlib.h>
#include <isc/app.h>
#include <isc/attributes.h>
#include <isc/commandline.h>
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/byaddr.h>
@@ -80,7 +82,6 @@ struct rtype rtypes[] = { { 1, "has address" },
{ 25, "has key" },
{ 28, "has IPv6 address" },
{ 29, "location" },
{ dns_rdatatype_https, "has HTTP service bindings" },
{ 0, NULL } };
static char *
@@ -97,7 +98,7 @@ rcode_totext(dns_rcode_t rcode) {
} else {
totext.consttext = rcodetext[rcode];
}
return totext.deconsttext;
return (totext.deconsttext);
}
noreturn static void
@@ -133,12 +134,12 @@ show_usage(void) {
" -W specifies how long to wait for a reply\n"
" -4 use IPv4 query transport only\n"
" -6 use IPv6 query transport only\n");
exit(EXIT_FAILURE);
exit(1);
}
static void
host_shutdown(void) {
isc_loopmgr_shutdown(loopmgr);
(void)isc_app_shutdown();
}
static void
@@ -150,9 +151,9 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
char fromtext[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_format(from, fromtext, sizeof(fromtext));
if (query->lookup->use_usec) {
now = isc_time_now_hires();
TIME_NOW_HIRES(&now);
} else {
now = isc_time_now();
TIME_NOW(&now);
}
diff = (int)isc_time_microdiff(&now, &query->time_sent);
printf("Received %u bytes from %s in %d ms\n", bytes, fromtext,
@@ -184,7 +185,6 @@ 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;
}
@@ -223,9 +223,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 (;;) {
@@ -263,7 +263,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) {
@@ -318,11 +318,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
@@ -342,12 +342,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
@@ -424,7 +424,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) {
@@ -458,16 +458,6 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
lookup->retries = tries;
ISC_LIST_APPEND(lookup_list, lookup, link);
}
lookup = clone_lookup(query->lookup, false);
if (lookup != NULL) {
strlcpy(lookup->textname, namestr,
sizeof(lookup->textname));
lookup->rdtype = dns_rdatatype_https;
lookup->rdtypeset = true;
lookup->origin = NULL;
lookup->retries = tries;
ISC_LIST_APPEND(lookup_list, lookup, link);
}
}
if (!short_form) {
@@ -528,7 +518,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])) {
@@ -538,7 +528,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);
}
}
@@ -549,7 +539,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]) &&
@@ -559,7 +549,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) {
@@ -567,7 +557,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) {
@@ -585,11 +575,17 @@ 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:";
/*% version */
static void
version(void) {
fprintf(stderr, "host %s\n", PACKAGE_VERSION);
}
static void
pre_parse_args(int argc, char **argv) {
int c;
@@ -665,8 +661,8 @@ pre_parse_args(int argc, char **argv) {
case 'v':
break;
case 'V':
printf("host %s\n", PACKAGE_VERSION);
exit(EXIT_SUCCESS);
version();
exit(0);
break;
case 'w':
break;
@@ -896,6 +892,8 @@ parse_args(bool is_batchfile, int argc, char **argv) {
int
main(int argc, char **argv) {
isc_result_t result;
tries = 2;
ISC_LIST_INIT(lookup_list);
@@ -913,6 +911,8 @@ main(int argc, char **argv) {
debug("main()");
progname = argv[0];
pre_parse_args(argc, argv);
result = isc_app_start();
check_result(result, "isc_app_start");
setup_libs();
setup_system(ipv4only, ipv6only);
parse_args(false, argc, argv);
@@ -921,12 +921,11 @@ main(int argc, char **argv) {
} else if (keysecret[0] != 0) {
setup_text_key();
}
isc_loopmgr_setup(loopmgr, run_loop, NULL);
isc_loopmgr_run(loopmgr);
result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
check_result(result, "isc_app_onrun");
isc_app_run();
cancel_all();
destroy_libs();
return (seen_error == 0) ? 0 : 1;
isc_app_finish();
return ((seen_error == 0) ? 0 : 1);
}
+1 -1
View File
@@ -122,7 +122,7 @@ Options
CNAME, NS, SOA, TXT, DNSKEY, AXFR, etc.
When no query type is specified, :program:`host` automatically selects an
appropriate query type. By default, it looks for A, AAAA, MX, and HTTPS
appropriate query type. By default, it looks for A, AAAA, and MX
records. If the :option:`-C` option is given, queries are made for SOA
records. If ``name`` is a dotted-decimal IPv4 address or
colon-delimited IPv6 address, :program:`host` queries for PTR records.
+92 -94
View File
@@ -16,17 +16,17 @@
#include <stdlib.h>
#include <unistd.h>
#include <isc/async.h>
#include <isc/app.h>
#include <isc/attributes.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/condition.h>
#include <isc/loop.h>
#include <isc/event.h>
#include <isc/netaddr.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <isc/work.h>
#include <dns/byaddr.h>
#include <dns/fixedname.h>
@@ -41,9 +41,6 @@
#include "dighost.h"
#include "readline.h"
static char cmdlinebuf[COMMSIZE];
static char *cmdline = NULL;
static bool short_form = true, tcpmode = false, tcpmode_set = false,
identify = false, stats = true, comments = true,
section_question = true, section_answer = true,
@@ -56,6 +53,7 @@ static bool interactive;
static bool in_use = false;
static char defclass[MXRD] = "IN";
static char deftype[MXRD] = "A";
static isc_event_t *global_event = NULL;
static int query_error = 1, print_error = 0;
static char domainopt[DNS_NAME_MAXTEXT];
@@ -114,6 +112,9 @@ static const char *rtypetext[] = {
#define N_KNOWN_RRTYPES (sizeof(rtypetext) / sizeof(rtypetext[0]))
static void
getinput(isc_task_t *task, isc_event_t *event);
static char *
rcode_totext(dns_rcode_t rcode) {
static char buf[sizeof("?65535")];
@@ -128,7 +129,21 @@ rcode_totext(dns_rcode_t rcode) {
} else {
totext.consttext = rcodetext[rcode];
}
return totext.deconsttext;
return (totext.deconsttext);
}
static void
query_finished(void) {
isc_event_t *event = global_event;
debug("dighost_shutdown()");
if (!in_use) {
isc_app_shutdown();
return;
}
isc_task_send(global_task, &event);
}
static void
@@ -189,7 +204,6 @@ printrdata(dns_rdata_t *rdata) {
check_result(result, "dns_rdata_totext");
}
isc_buffer_free(&b);
INSIST(size <= (UINT_MAX / 2));
size *= 2;
}
}
@@ -210,9 +224,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;
@@ -256,10 +270,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
@@ -294,9 +308,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;
@@ -338,10 +352,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
@@ -387,6 +401,8 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
static isc_result_t
printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
bool headers) {
char servtext[ISC_SOCKADDR_FORMATSIZE];
UNUSED(msgbuf);
/* I've we've gotten this far, we've reached a server. */
@@ -395,7 +411,6 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
debug("printmessage()");
if (!default_lookups || query->lookup->rdtype == dns_rdatatype_a) {
char servtext[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_format(&query->sockaddr, servtext,
sizeof(servtext));
printf("Server:\t\t%s\n", query->userarg);
@@ -424,7 +439,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) {
@@ -478,7 +493,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
@@ -537,10 +552,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);
}
}
@@ -554,10 +569,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);
}
}
@@ -598,6 +613,11 @@ set_ndots(const char *value) {
}
}
static void
version(void) {
fprintf(stderr, "nslookup %s\n", PACKAGE_VERSION);
}
static void
setoption(char *opt) {
size_t l = strlen(opt);
@@ -791,8 +811,10 @@ do_next_command(char *input) {
} else if ((strcasecmp(ptr, "server") == 0) ||
(strcasecmp(ptr, "lserver") == 0))
{
isc_app_block();
set_nameserver(arg);
check_ra = false;
isc_app_unblock();
show_settings(true, true);
} else if (strcasecmp(ptr, "exit") == 0) {
in_use = false;
@@ -809,31 +831,28 @@ do_next_command(char *input) {
}
static void
readline_next_command(void *arg) {
char *ptr = NULL;
get_next_command(void) {
char cmdlinebuf[COMMSIZE];
char *cmdline, *ptr = NULL;
UNUSED(arg);
isc_loopmgr_blocking(loopmgr);
ptr = readline("> ");
isc_loopmgr_nonblocking(loopmgr);
if (ptr == NULL) {
return;
isc_app_block();
if (interactive) {
cmdline = ptr = readline("> ");
if (ptr != NULL && *ptr != 0) {
add_history(ptr);
}
} else {
cmdline = fgets(cmdlinebuf, COMMSIZE, stdin);
}
if (*ptr != 0) {
add_history(ptr);
strlcpy(cmdlinebuf, ptr, COMMSIZE);
cmdline = cmdlinebuf;
isc_app_unblock();
if (cmdline == NULL) {
in_use = false;
} else {
do_next_command(cmdline);
}
if (ptr != NULL) {
free(ptr);
}
free(ptr);
}
static void
fgets_next_command(void *arg) {
UNUSED(arg);
cmdline = fgets(cmdlinebuf, COMMSIZE, stdin);
}
noreturn static void
@@ -850,7 +869,7 @@ usage(void) {
"'host' using default server\n");
fprintf(stderr, " nslookup [-opt ...] host server # just look up "
"'host' using 'server'\n");
exit(EXIT_FAILURE);
exit(1);
}
static void
@@ -862,8 +881,8 @@ parse_args(int argc, char **argv) {
debug("main parsing %s", argv[0]);
if (argv[0][0] == '-') {
if (strncasecmp(argv[0], "-ver", 4) == 0) {
printf("nslookup %s\n", PACKAGE_VERSION);
exit(EXIT_SUCCESS);
version();
exit(0);
} else if (argv[0][1] != 0) {
setoption(&argv[0][1]);
} else {
@@ -886,54 +905,25 @@ parse_args(int argc, char **argv) {
}
static void
start_next_command(void);
static void
process_next_command(void *arg ISC_ATTR_UNUSED) {
isc_loop_t *loop = isc_loop_main(loopmgr);
if (cmdline == NULL) {
in_use = false;
} else {
do_next_command(cmdline);
getinput(isc_task_t *task, isc_event_t *event) {
UNUSED(task);
if (global_event == NULL) {
global_event = event;
}
while (in_use) {
get_next_command();
if (ISC_LIST_HEAD(lookup_list) != NULL) {
isc_async_run(loop, run_loop, NULL);
start_lookup();
return;
}
}
start_next_command();
}
static void
start_next_command(void) {
isc_loop_t *loop = isc_loop_main(loopmgr);
if (!in_use) {
isc_loopmgr_shutdown(loopmgr);
return;
}
cmdline = NULL;
isc_loopmgr_pause(loopmgr);
if (interactive) {
isc_work_enqueue(loop, readline_next_command,
process_next_command, loop);
} else {
isc_work_enqueue(loop, fgets_next_command, process_next_command,
loop);
}
isc_loopmgr_resume(loopmgr);
}
static void
read_loop(void *arg) {
UNUSED(arg);
start_next_command();
isc_app_shutdown();
}
int
main(int argc, char **argv) {
isc_result_t result;
interactive = isatty(0);
ISC_LIST_INIT(lookup_list);
@@ -946,7 +936,10 @@ main(int argc, char **argv) {
dighost_printmessage = printmessage;
dighost_received = received;
dighost_trying = trying;
dighost_shutdown = start_next_command;
dighost_shutdown = query_finished;
result = isc_app_start();
check_result(result, "isc_app_start");
setup_libs();
progname = argv[0];
@@ -962,18 +955,23 @@ main(int argc, char **argv) {
set_search_domain(domainopt);
}
if (in_use) {
isc_loopmgr_setup(loopmgr, run_loop, NULL);
result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
} else {
isc_loopmgr_setup(loopmgr, read_loop, NULL);
result = isc_app_onrun(mctx, global_task, getinput, NULL);
}
check_result(result, "isc_app_onrun");
in_use = !in_use;
isc_loopmgr_run(loopmgr);
(void)isc_app_run();
puts("");
debug("done, and starting to shut down");
if (global_event != NULL) {
isc_event_free(&global_event);
}
cancel_all();
destroy_libs();
isc_app_finish();
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,7 +2,6 @@ dnssec-cds
dnssec-dsfromkey
dnssec-keyfromlabel
dnssec-keygen
dnssec-ksr
dnssec-makekeyset
dnssec-revoke
dnssec-settime
+3 -15
View File
@@ -2,7 +2,6 @@ include $(top_srcdir)/Makefile.top
AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBDNS_CFLAGS)
AM_CPPFLAGS += \
@@ -13,9 +12,7 @@ noinst_LTLIBRARIES = libdnssectool.la
LDADD += \
libdnssectool.la \
$(LIBISC_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBDNS_LIBS) \
$(OPENSSL_LIBS)
$(LIBDNS_LIBS)
bin_PROGRAMS = \
dnssec-cds \
@@ -23,7 +20,6 @@ bin_PROGRAMS = \
dnssec-importkey \
dnssec-keyfromlabel \
dnssec-keygen \
dnssec-ksr \
dnssec-revoke \
dnssec-settime \
dnssec-signzone \
@@ -35,16 +31,8 @@ libdnssectool_la_SOURCES = \
dnssec_keygen_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(OPENSSL_CFLAGS)
$(LIBISCCFG_CFLAGS)
dnssec_keygen_LDADD = \
$(LDADD) \
$(OPENSSL_LIBS)
dnssec_signzone_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(OPENSSL_CFLAGS)
dnssec_signzone_LDADD = \
$(LDADD) \
$(OPENSSL_LIBS)
$(LIBISCCFG_LIBS)
+42 -40
View File
@@ -30,6 +30,7 @@
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/serial.h>
#include <isc/string.h>
@@ -247,8 +248,8 @@ static void
load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
isc_result_t result;
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, dbp);
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, dbp);
check_result(result, "dns_db_create()");
result = dns_db_load(*dbp, filename, dns_masterformat_text,
@@ -345,7 +346,8 @@ load_parent_set(const char *path) {
}
notbefore = isc_time_seconds(&modtime);
if (startstr != NULL) {
isc_stdtime_t now = isc_stdtime_now();
isc_stdtime_t now;
isc_stdtime_get(&now);
notbefore = strtotime(startstr, now, notbefore, NULL);
}
verbose_time(1, "child records must not be signed before", notbefore);
@@ -395,7 +397,7 @@ formatset(dns_rdataset_t *rdataset) {
}
isc_buffer_putuint8(buf, 0);
return buf;
return (buf);
}
static void
@@ -505,14 +507,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 +523,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);
}
/*
@@ -537,7 +539,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
nkey = dns_rdataset_count(keyset);
keytable = isc_mem_cget(mctx, nkey, sizeof(keytable[0]));
keytable = isc_mem_get(mctx, sizeof(keyinfo_t) * nkey);
for (result = dns_rdataset_first(keyset), i = 0, ki = keytable;
result == ISC_R_SUCCESS;
@@ -575,7 +577,7 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
}
}
return keytable;
return (keytable);
}
static void
@@ -593,7 +595,7 @@ free_keytable(keyinfo_t **keytable_p) {
}
}
isc_mem_cput(mctx, keytable, nkey, sizeof(keytable[0]));
isc_mem_put(mctx, keytable, sizeof(keyinfo_t) * nkey);
}
/*
@@ -614,7 +616,8 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
REQUIRE(keytbl != NULL);
algo = isc_mem_cget(mctx, nkey, sizeof(algo[0]));
algo = isc_mem_get(mctx, nkey);
memset(algo, 0, nkey);
for (result = dns_rdataset_first(sigset); result == ISC_R_SUCCESS;
result = dns_rdataset_next(sigset))
@@ -681,7 +684,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
}
}
return algo;
return (algo);
}
/*
@@ -697,8 +700,8 @@ signed_loose(dns_secalg_t *algo) {
ok = true;
}
}
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
return ok;
isc_mem_put(mctx, algo, nkey);
return (ok);
}
/*
@@ -739,8 +742,8 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
}
}
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
return all_ok;
isc_mem_put(mctx, algo, nkey);
return (all_ok);
}
/*
@@ -761,10 +764,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 +780,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 +788,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,26 +819,25 @@ 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
make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl,
dns_rdataset_t *crdset) {
isc_result_t result;
dns_rdatalist_t *dslist;
unsigned int size = 16;
unsigned i, n;
for (;;) {
isc_result_t result = ISC_R_SUCCESS;
dns_rdatalist_t *dslist = NULL;
size_t n;
dslist = isc_mem_get(mctx, sizeof(*dslist));
dns_rdatalist_init(dslist);
dslist->rdclass = rdclass;
@@ -843,12 +845,13 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl,
dslist->ttl = ttl;
dns_rdataset_init(&new_ds_set);
dns_rdatalist_tordataset(dslist, &new_ds_set);
result = dns_rdatalist_tordataset(dslist, &new_ds_set);
check_result(result, "dns_rdatalist_tordataset(dslist)");
isc_buffer_allocate(mctx, &new_ds_buf, size);
n = sizeof(dtype) / sizeof(dtype[0]);
for (size_t i = 0; i < n && dtype[i] != 0; i++) {
for (i = 0; i < n && dtype[i] != 0; i++) {
result = append_new_ds_set(ds_from_rdata, new_ds_buf,
dslist, dtype[i], crdset);
if (result != ISC_R_SUCCESS) {
@@ -868,8 +871,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));
}
/*
@@ -894,7 +897,7 @@ consistent_digests(dns_rdataset_t *dsset) {
n = dns_rdataset_count(dsset);
arrdata = isc_mem_cget(mctx, n, sizeof(dns_rdata_t));
arrdata = isc_mem_get(mctx, n * sizeof(dns_rdata_t));
for (result = dns_rdataset_first(dsset), i = 0; result == ISC_R_SUCCESS;
result = dns_rdataset_next(dsset), i++)
@@ -908,7 +911,7 @@ consistent_digests(dns_rdataset_t *dsset) {
/*
* Convert sorted arrdata to more accessible format
*/
ds = isc_mem_cget(mctx, n, sizeof(dns_rdata_ds_t));
ds = isc_mem_get(mctx, n * sizeof(dns_rdata_ds_t));
for (i = 0; i < n; i++) {
result = dns_rdata_tostruct(&arrdata[i], &ds[i], NULL);
@@ -947,10 +950,10 @@ consistent_digests(dns_rdataset_t *dsset) {
/*
* Done!
*/
isc_mem_cput(mctx, ds, n, sizeof(dns_rdata_ds_t));
isc_mem_cput(mctx, arrdata, n, sizeof(dns_rdata_t));
isc_mem_put(mctx, ds, n * sizeof(dns_rdata_ds_t));
isc_mem_put(mctx, arrdata, n * sizeof(dns_rdata_t));
return match;
return (match);
}
static void
@@ -979,8 +982,8 @@ update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
dns_rdataset_t diffset;
uint32_t save;
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &update_db);
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &update_db);
check_result(result, "dns_db_create()");
result = dns_db_newversion(update_db, &update_version);
@@ -1056,7 +1059,7 @@ usage(void) {
" -T <ttl> TTL of DS records\n"
" -V print version\n"
" -v <verbosity>\n");
exit(EXIT_FAILURE);
exit(1);
}
static void
@@ -1354,6 +1357,5 @@ main(int argc, char *argv[]) {
cleanup:
print_mem_stats = true;
cleanup();
return 0;
exit(0);
}
+18 -22
View File
@@ -23,6 +23,7 @@
#include <isc/dir.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -54,7 +55,6 @@ 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) {
@@ -66,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
@@ -101,8 +101,8 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
dns_name_format(name, setname, sizeof(setname));
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
if (result != ISC_R_SUCCESS) {
fatal("can't create database");
}
@@ -138,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
@@ -153,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] != '/') {
@@ -162,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
@@ -275,13 +275,13 @@ emit(dns_dsdigest_t dt, bool showall, bool cds, dns_rdata_t *rdata) {
fatal("can't build record");
}
result = dns_name_totext(name, 0, &nameb);
result = dns_name_totext(name, false, &nameb);
if (result != ISC_R_SUCCESS) {
fatal("can't print name");
}
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, split_width,
"", &textb);
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, 0, "",
&textb);
if (result != ISC_R_SUCCESS) {
fatal("can't print rdata");
@@ -314,7 +314,7 @@ emit(dns_dsdigest_t dt, bool showall, bool cds, dns_rdata_t *rdata) {
static void
emits(bool showall, bool cds, dns_rdata_t *rdata) {
unsigned int i, n;
unsigned i, n;
n = sizeof(dtype) / sizeof(dtype[0]);
for (i = 0; i < n; i++) {
@@ -348,14 +348,13 @@ 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"
" -V: print version information\n");
fprintf(stderr, "Output: DS or CDS RRs\n");
exit(EXIT_FAILURE);
exit(-1);
}
int
@@ -382,7 +381,7 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:whV"
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:hV"
while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
switch (ch) {
case '1':
@@ -434,9 +433,6 @@ 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;
@@ -457,7 +453,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -558,8 +554,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);
}
}
+11 -9
View File
@@ -21,6 +21,7 @@
#include <isc/commandline.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -68,7 +69,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
@@ -103,8 +104,8 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
dns_name_format(name, setname, sizeof(setname));
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
if (result != ISC_R_SUCCESS) {
fatal("can't create database");
}
@@ -141,7 +142,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
if (db != NULL) {
dns_db_detach(&db);
}
return result;
return (result);
}
static void
@@ -289,7 +290,7 @@ usage(void) {
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
"CDS and CDNSKEY deletion date\n");
exit(EXIT_FAILURE);
exit(-1);
}
int
@@ -302,9 +303,10 @@ main(int argc, char **argv) {
isc_log_t *log = NULL;
dns_rdataset_t rdataset;
dns_rdata_t rdata;
isc_stdtime_t now = isc_stdtime_now();
isc_stdtime_t now;
dns_rdata_init(&rdata);
isc_stdtime_get(&now);
if (argc == 1) {
usage();
@@ -395,7 +397,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -468,8 +470,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 -26
View File
@@ -22,6 +22,7 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -43,8 +44,6 @@
const char *program = "dnssec-keyfromlabel";
static uint16_t tag_min = 0, tag_max = 0xffff;
noreturn static void
usage(void);
@@ -58,7 +57,7 @@ usage(void) {
fprintf(stderr, " name: owner of the key\n");
fprintf(stderr, "Other options:\n");
fprintf(stderr, " -a algorithm: \n"
" RSASHA1 |\n"
" DH | RSASHA1 |\n"
" NSEC3RSASHA1 |\n"
" RSASHA256 | RSASHA512 |\n"
" ECDSAP256SHA256 | ECDSAP384SHA384 |\n"
@@ -72,7 +71,6 @@ 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");
@@ -105,7 +103,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<id>.key, "
"K<name>+<alg>+<id>.private\n");
exit(EXIT_FAILURE);
exit(-1);
}
int
@@ -138,6 +136,7 @@ main(int argc, char **argv) {
dns_ttl_t ttl = 0;
isc_stdtime_t publish = 0, activate = 0, revoke = 0;
isc_stdtime_t inactive = 0, deltime = 0;
isc_stdtime_t now;
int prepub = -1;
bool setpub = false, setact = false;
bool setrev = false, setinact = false;
@@ -153,7 +152,6 @@ main(int argc, char **argv) {
isc_stdtime_t syncadd = 0, syncdel = 0;
bool unsetsyncadd = false, setsyncadd = false;
bool unsetsyncdel = false, setsyncdel = false;
isc_stdtime_t now = isc_stdtime_now();
if (argc == 1) {
usage();
@@ -163,7 +161,9 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
#define CMDLINE_FLAGS "3A:a:Cc:D:E:Ff:GhI:i:kK:L:l:M:n:P:p:R:S:t:v:Vy"
isc_stdtime_get(&now);
#define CMDLINE_FLAGS "3A:a:Cc:D:E:Ff:GhI:i:kK:L:l:n:P:p:R:S:t:v:Vy"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
case '3':
@@ -210,20 +210,6 @@ 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;
@@ -348,7 +334,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -402,6 +388,9 @@ main(int argc, char **argv) {
if (ret != ISC_R_SUCCESS) {
fatal("unknown algorithm %s", algname);
}
if (alg == DST_ALG_DH) {
options |= DST_TYPE_KEY;
}
if (use_nsec3) {
switch (alg) {
@@ -609,6 +598,13 @@ main(int argc, char **argv) {
}
}
if ((flags & DNS_KEYFLAG_OWNERMASK) == DNS_KEYOWNER_ZONE &&
alg == DNS_KEYALG_DH)
{
fatal("a key with algorithm '%s' cannot be a zone key",
algname);
}
isc_buffer_init(&buf, filename, sizeof(filename) - 1);
/* associate the key */
@@ -623,7 +619,7 @@ main(int argc, char **argv) {
fatal("failed to get key %s/%s: %s", namestr, algstr,
isc_result_totext(ret));
UNREACHABLE();
exit(EXIT_FAILURE);
exit(-1);
}
/*
@@ -703,8 +699,7 @@ 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, tag_min, tag_max, &exact))
{
if (key_collision(key, name, directory, mctx, &exact)) {
isc_buffer_clear(&buf);
ret = dst_key_buildfilename(key, 0, directory, &buf);
if (ret != ISC_R_SUCCESS) {
@@ -761,5 +756,5 @@ main(int argc, char **argv) {
free(freeit);
}
return 0;
return (0);
}
+1 -13
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] [**-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}
: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}
Description
~~~~~~~~~~~
@@ -133,18 +133,6 @@ 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
+138 -183
View File
@@ -33,13 +33,11 @@
#include <stdlib.h>
#include <unistd.h>
#include <openssl/opensslv.h>
#include <isc/attributes.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/fips.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -56,21 +54,16 @@
#include <dst/dst.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
#include <openssl/err.h>
#include <openssl/provider.h>
#endif
#include <isccfg/cfg.h>
#include <isccfg/grammar.h>
#include <isccfg/kaspconf.h>
#include <isccfg/namedconf.h>
#include "dnssectool.h"
const char *program = "dnssec-keygen";
#define MAX_RSA 4096 /* should be long enough... */
/*
* These are are set here for backwards compatibility. They are
* raised to 2048 in FIPS mode.
*/
static int min_rsa = 1024;
static int min_dh = 128;
const char *program = "dnssec-keygen";
isc_log_t *lctx = NULL;
@@ -85,22 +78,19 @@ struct keygen_ctx {
const char *policy;
const char *configfile;
const char *directory;
dns_keystore_t *keystore;
char *algname;
char *nametype;
char *type;
int generator;
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;
bool wantzsk;
bool wantksk;
bool wantrev;
uint16_t kskflag;
uint16_t revflag;
dns_secalg_t alg;
/* timing data */
int prepub;
@@ -151,22 +141,17 @@ usage(void) {
fprintf(stderr, " -l <file>: configuration file with dnssec-policy "
"statement\n");
fprintf(stderr, " -a <algorithm>:\n");
if (!isc_fips_mode()) {
fprintf(stderr, " RSASHA1 | NSEC3RSASHA1 |\n");
}
fprintf(stderr, " RSASHA1 | NSEC3RSASHA1 |\n");
fprintf(stderr, " RSASHA256 | RSASHA512 |\n");
fprintf(stderr, " ECDSAP256SHA256 | ECDSAP384SHA384 |\n");
fprintf(stderr, " ED25519 | ED448\n");
fprintf(stderr, " ED25519 | ED448 | DH\n");
fprintf(stderr, " -3: use NSEC3-capable algorithm\n");
fprintf(stderr, " -b <key size in bits>:\n");
if (!isc_fips_mode()) {
fprintf(stderr, " RSASHA1:\t[%d..%d]\n", min_rsa,
MAX_RSA);
fprintf(stderr, " NSEC3RSASHA1:\t[%d..%d]\n", min_rsa,
MAX_RSA);
}
fprintf(stderr, " RSASHA256:\t[%d..%d]\n", min_rsa, MAX_RSA);
fprintf(stderr, " RSASHA512:\t[%d..%d]\n", min_rsa, MAX_RSA);
fprintf(stderr, " RSASHA1:\t[1024..%d]\n", MAX_RSA);
fprintf(stderr, " NSEC3RSASHA1:\t[1024..%d]\n", MAX_RSA);
fprintf(stderr, " RSASHA256:\t[1024..%d]\n", MAX_RSA);
fprintf(stderr, " RSASHA512:\t[1024..%d]\n", MAX_RSA);
fprintf(stderr, " DH:\t\t[128..4096]\n");
fprintf(stderr, " ECDSAP256SHA256:\tignored\n");
fprintf(stderr, " ECDSAP384SHA384:\tignored\n");
fprintf(stderr, " ED25519:\tignored\n");
@@ -180,10 +165,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>: ZSK | KSK | REVOKE\n");
fprintf(stderr, " -F: FIPS mode\n");
fprintf(stderr, " -f <keyflag>: KSK | REVOKE\n");
fprintf(stderr, " -g <generator>: use specified generator "
"(DH only)\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");
@@ -194,7 +179,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\n");
fprintf(stderr, " usage | trace | record | size | mctx\n");
fprintf(stderr, " -v <level>: set verbosity level (0 - 10)\n");
fprintf(stderr, " -V: print version information\n");
fprintf(stderr, "Timing options:\n");
@@ -224,7 +209,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<id>.key, "
"K<name>+<alg>+<id>.private\n");
exit(EXIT_FAILURE);
exit(-1);
}
static void
@@ -251,6 +236,53 @@ progress(int p) {
(void)fflush(stderr);
}
static void
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, const char *name,
dns_kasp_t **kaspp) {
const cfg_listelt_t *element;
const cfg_obj_t *kasps = NULL;
dns_kasp_t *kasp = NULL, *kasp_next;
isc_result_t result = ISC_R_NOTFOUND;
dns_kasplist_t kasplist;
ISC_LIST_INIT(kasplist);
(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, mctx, lctx,
&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);
}
}
static void
keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
char filename[255];
@@ -291,15 +323,8 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
fatal("unsupported algorithm: %s", algstr);
}
if (isc_fips_mode()) {
/* verify only in FIPS mode */
switch (ctx->alg) {
case DST_ALG_RSASHA1:
case DST_ALG_NSEC3RSASHA1:
fatal("unsupported algorithm: %s", algstr);
default:
break;
}
if (ctx->alg == DST_ALG_DH) {
ctx->options |= DST_TYPE_KEY;
}
if (ctx->use_nsec3) {
@@ -344,11 +369,6 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
switch (ctx->alg) {
case DST_ALG_RSASHA1:
case DST_ALG_NSEC3RSASHA1:
if (isc_fips_mode()) {
fatal("key size not specified (-b "
"option)");
}
FALLTHROUGH;
case DST_ALG_RSASHA256:
case DST_ALG_RSASHA512:
ctx->size = 2048;
@@ -504,18 +524,23 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
switch (ctx->alg) {
case DNS_KEYALG_RSASHA1:
case DNS_KEYALG_NSEC3RSASHA1:
if (isc_fips_mode()) {
fatal("SHA1 based keys not supported in FIPS mode");
}
FALLTHROUGH;
case DNS_KEYALG_RSASHA256:
case DNS_KEYALG_RSASHA512:
if (ctx->size != 0 &&
(ctx->size < min_rsa || ctx->size > MAX_RSA))
if (ctx->size != 0 && (ctx->size < 1024 || ctx->size > MAX_RSA))
{
fatal("RSA key size %d out of range", ctx->size);
}
break;
case DNS_KEYALG_RSASHA512:
if (ctx->size != 0 && (ctx->size < 1024 || ctx->size > MAX_RSA))
{
fatal("RSA key size %d out of range", ctx->size);
}
break;
case DNS_KEYALG_DH:
if (ctx->size != 0 && (ctx->size < 128 || ctx->size > 4096)) {
fatal("DH key size %d out of range", ctx->size);
}
break;
case DST_ALG_ECDSA256:
ctx->size = 256;
break;
@@ -530,6 +555,10 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
break;
}
if (ctx->alg != DNS_KEYALG_DH && ctx->generator != 0) {
fatal("specified DH generator for a non-DH key");
}
if (ctx->nametype == NULL) {
if ((ctx->options & DST_TYPE_KEY) != 0) { /* KEY */
fatal("no nametype specified");
@@ -558,12 +587,8 @@ 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 */
if (ctx->ksk || ctx->wantksk) {
flags |= DNS_KEYFLAG_KSK;
}
if (ctx->wantrev) {
flags |= DNS_KEYFLAG_REVOKE;
}
flags |= ctx->kskflag;
flags |= ctx->revflag;
}
if (ctx->protocol == -1) {
@@ -583,6 +608,12 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
}
}
if ((flags & DNS_KEYFLAG_OWNERMASK) == DNS_KEYOWNER_ZONE &&
ctx->alg == DNS_KEYALG_DH)
{
fatal("a key with algorithm %s cannot be a zone key", algstr);
}
switch (ctx->alg) {
case DNS_KEYALG_RSASHA1:
case DNS_KEYALG_NSEC3RSASHA1:
@@ -591,6 +622,10 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
show_progress = true;
break;
case DNS_KEYALG_DH:
param = ctx->generator;
break;
case DST_ALG_ECDSA256:
case DST_ALG_ECDSA384:
case DST_ALG_ED25519:
@@ -610,27 +645,16 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
if (!ctx->quiet && show_progress) {
fprintf(stderr, "Generating key pair.");
}
if (ctx->keystore != NULL && ctx->policy != NULL) {
ret = dns_keystore_keygen(
ctx->keystore, name, ctx->policy, ctx->rdclass,
mctx, ctx->alg, ctx->size, flags, &key);
} else if (!ctx->quiet && show_progress) {
ret = dst_key_generate(name, ctx->alg, ctx->size, param,
flags, ctx->protocol,
ctx->rdclass, NULL, mctx, &key,
ctx->rdclass, mctx, &key,
&progress);
putc('\n', stderr);
fflush(stderr);
} else {
ret = dst_key_generate(name, ctx->alg, ctx->size, param,
flags, ctx->protocol,
ctx->rdclass, NULL, mctx, &key,
NULL);
}
if (!ctx->quiet && show_progress) {
putc('\n', stderr);
fflush(stderr);
ctx->rdclass, mctx, &key, NULL);
}
if (ret != ISC_R_SUCCESS) {
@@ -686,7 +710,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
}
if (ctx->setrev) {
if (!ctx->wantksk) {
if (ctx->kskflag == 0) {
fprintf(stderr,
"%s: warning: Key is "
"not flagged as a KSK, but -R "
@@ -761,9 +785,7 @@ 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, ctx->tag_min,
ctx->tag_max, NULL))
{
if (key_collision(key, name, ctx->directory, mctx, NULL)) {
conflict = true;
if (null_key) {
dst_key_free(&key);
@@ -828,18 +850,6 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
}
}
static void
check_keystore_options(keygen_ctx_t *ctx) {
ctx->directory = dns_keystore_directory(ctx->keystore, NULL);
if (ctx->directory != NULL) {
isc_result_t ret = try_dir(ctx->directory);
if (ret != ISC_R_SUCCESS) {
fatal("cannot open directory %s: %s", ctx->directory,
isc_result_totext(ret));
}
}
}
int
main(int argc, char **argv) {
char *algname = NULL, *freeit = NULL;
@@ -851,17 +861,12 @@ main(int argc, char **argv) {
const char *engine = NULL;
unsigned char c;
int ch;
bool set_fips_mode = false;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
OSSL_PROVIDER *fips = NULL, *base = NULL;
#endif
keygen_ctx_t ctx = {
.options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC,
.prepub = -1,
.protocol = -1,
.size = -1,
.now = isc_stdtime_now(),
};
if (argc == 1) {
@@ -873,8 +878,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:m:n:P:p:qR:r:S:s:" \
#define CMDLINE_FLAGS \
"3A:a:b:Cc:D:d:E:eFf:Gg:hI:i:K:k:L:l:m:n:P:p:qR:r:S:s:" \
"T:t:v:V"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
@@ -899,6 +904,7 @@ main(int argc, char **argv) {
isc_commandline_reset = true;
isc_mem_create(&mctx);
isc_stdtime_get(&ctx.now);
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
@@ -929,19 +935,28 @@ main(int argc, char **argv) {
case 'E':
engine = isc_commandline_argument;
break;
case 'e':
fprintf(stderr, "phased-out option -e "
"(was 'use (RSA) large exponent')\n");
break;
case 'f':
c = (unsigned char)(isc_commandline_argument[0]);
if (toupper(c) == 'K') {
ctx.wantksk = true;
} else if (toupper(c) == 'Z') {
ctx.wantzsk = true;
ctx.kskflag = DNS_KEYFLAG_KSK;
} else if (toupper(c) == 'R') {
ctx.wantrev = true;
ctx.revflag = DNS_KEYFLAG_REVOKE;
} else {
fatal("unknown flag '%s'",
isc_commandline_argument);
}
break;
case 'g':
ctx.generator = strtol(isc_commandline_argument, &endp,
10);
if (*endp != '\0' || ctx.generator <= 0) {
fatal("-g requires a positive number");
}
break;
case 'K':
ctx.directory = isc_commandline_argument;
ret = try_dir(ctx.directory);
@@ -963,21 +978,6 @@ 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':
@@ -1113,8 +1113,8 @@ main(int argc, char **argv) {
ctx.prepub = strtottl(isc_commandline_argument);
break;
case 'F':
set_fips_mode = true;
break;
/* Reserved for FIPS mode */
FALLTHROUGH;
case '?':
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
@@ -1132,7 +1132,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -1140,40 +1140,11 @@ main(int argc, char **argv) {
ctx.quiet = true;
}
if (set_fips_mode) {
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
fips = OSSL_PROVIDER_load(NULL, "fips");
if (fips == NULL) {
ERR_clear_error();
fatal("Failed to load FIPS provider");
}
base = OSSL_PROVIDER_load(NULL, "base");
if (base == NULL) {
OSSL_PROVIDER_unload(fips);
ERR_clear_error();
fatal("Failed to load base provider");
}
#endif
if (!isc_fips_mode()) {
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
fatal("setting FIPS mode failed");
}
}
}
ret = dst_lib_init(mctx, engine);
if (ret != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s", isc_result_totext(ret));
}
/*
* After dst_lib_init which will set FIPS mode if requested
* at build time. The minumums are both raised to 2048.
*/
if (isc_fips_mode()) {
min_rsa = min_dh = 2048;
}
setup_logging(mctx, &lctx);
ctx.rdclass = strtoclass(classname);
@@ -1225,8 +1196,8 @@ main(int argc, char **argv) {
if (ctx.size != -1) {
fatal("-k and -b cannot be used together");
}
if (ctx.wantrev) {
fatal("-k and -fR cannot be used together");
if (ctx.kskflag || ctx.revflag) {
fatal("-k and -f cannot be used together");
}
if (ctx.options & DST_TYPE_KEY) {
fatal("-k and -T KEY cannot be used together");
@@ -1241,13 +1212,12 @@ 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 {
@@ -1267,8 +1237,7 @@ main(int argc, char **argv) {
ctx.policy, ctx.configfile);
}
kasp_from_conf(config, mctx, lctx, ctx.policy,
ctx.directory, engine, &kasp);
kasp_from_conf(config, mctx, ctx.policy, &kasp);
if (kasp == NULL) {
fatal("failed to load dnssec-policy '%s'",
ctx.policy);
@@ -1282,28 +1251,22 @@ main(int argc, char **argv) {
ctx.ttl = dns_kasp_dnskeyttl(kasp);
ctx.setttl = true;
for (kaspkey = ISC_LIST_HEAD(dns_kasp_keys(kasp));
kaspkey != NULL;
kaspkey = ISC_LIST_NEXT(kaspkey, link))
{
kaspkey = ISC_LIST_HEAD(dns_kasp_keys(kasp));
while (kaspkey != NULL) {
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);
ctx.keystore = dns_kasp_key_keystore(kaspkey);
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);
@@ -1321,17 +1284,9 @@ main(int argc, char **argv) {
}
isc_mem_destroy(&mctx);
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
if (base != NULL) {
OSSL_PROVIDER_unload(base);
}
if (fips != NULL) {
OSSL_PROVIDER_unload(fips);
}
#endif
if (freeit != NULL) {
free(freeit);
}
return 0;
return (0);
}
+14 -29
View File
@@ -21,13 +21,15 @@ 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] [**-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}
: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] [**-G**] [**-g** generator] [**-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}
Description
~~~~~~~~~~~
:program:`dnssec-keygen` generates keys for DNSSEC (Secure DNS), as defined in
:rfc:`2535` and :rfc:`4034`.
:rfc:`2535` and :rfc:`4034`. It can also generate keys for use with TSIG
(Transaction Signatures) as defined in :rfc:`2845`, or TKEY (Transaction
Key) as defined in :rfc:`2930`.
The ``name`` of the key is specified on the command line. For DNSSEC
keys, this must match the name of the zone for which the key is being
@@ -47,7 +49,9 @@ Options
This option selects the cryptographic algorithm. For DNSSEC keys, the value of
``algorithm`` must be one of RSASHA1, NSEC3RSASHA1, RSASHA256,
RSASHA512, ECDSAP256SHA256, ECDSAP384SHA384, ED25519, or ED448.
RSASHA512, ECDSAP256SHA256, ECDSAP384SHA384, ED25519, or ED448. For
TKEY, the value must be DH (Diffie-Hellman); specifying this value
automatically sets the :option:`-T KEY <-T>` option as well.
These values are case-insensitive. In some cases, abbreviations are
supported, such as ECDSA256 for ECDSAP256SHA256 and ECDSA384 for
@@ -105,25 +109,19 @@ Options
.. option:: -f flag
This option sets the specified flag in the flag field of the KEY/DNSKEY record.
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
This options turns on FIPS (US Federal Information Processing Standards)
mode if the underlying crytographic library supports running in FIPS
mode.
The only recognized flags are KSK (Key-Signing Key) and REVOKE.
.. option:: -G
This option generates a key, but does not publish it or sign with it. This option is
incompatible with :option:`-P` and :option:`-A`.
.. option:: -g generator
This option indicates the generator to use if generating a Diffie-Hellman key. Allowed
values are 2 and 5. If no generator is specified, a known prime from
:rfc:`2539` is used if possible; otherwise the default is 2.
.. option:: -h
This option prints a short summary of the options and arguments to
@@ -158,19 +156,6 @@ 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
@@ -1,172 +0,0 @@
.. 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.
+6 -4
View File
@@ -24,6 +24,7 @@
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -58,7 +59,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
"K<name>+<alg>+<new id>.private\n");
exit(EXIT_FAILURE);
exit(-1);
}
int
@@ -130,7 +131,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -190,7 +191,7 @@ main(int argc, char **argv) {
flags = dst_key_flags(key);
if ((flags & DNS_KEYFLAG_REVOKE) == 0) {
isc_stdtime_t now = isc_stdtime_now();
isc_stdtime_t now;
if ((flags & DNS_KEYFLAG_KSK) == 0) {
fprintf(stderr,
@@ -200,6 +201,7 @@ main(int argc, char **argv) {
program);
}
isc_stdtime_get(&now);
dst_key_settime(key, DST_TIME_REVOKE, now);
dst_key_setflags(key, flags | DNS_KEYFLAG_REVOKE);
@@ -257,5 +259,5 @@ cleanup:
}
isc_mem_destroy(&mctx);
return 0;
return (0);
}
+7 -4
View File
@@ -26,6 +26,7 @@
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
@@ -101,7 +102,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
"K<name>+<alg>+<new id>.private\n");
exit(EXIT_FAILURE);
exit(-1);
}
static void
@@ -202,6 +203,7 @@ main(int argc, char **argv) {
int prepub = -1;
int options;
dns_ttl_t ttl = 0;
isc_stdtime_t now;
isc_stdtime_t dstime = 0, dnskeytime = 0;
isc_stdtime_t krrsigtime = 0, zrrsigtime = 0;
isc_stdtime_t pub = 0, act = 0, rev = 0, inact = 0, del = 0;
@@ -237,7 +239,6 @@ main(int argc, char **argv) {
bool unsetdsadd = false, setdsadd = false;
bool unsetdsdel = false, setdsdel = false;
bool printdsadd = false, printdsdel = false;
isc_stdtime_t now = isc_stdtime_now();
options = DST_TYPE_PUBLIC | DST_TYPE_PRIVATE | DST_TYPE_STATE;
@@ -251,6 +252,8 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
isc_stdtime_get(&now);
#define CMDLINE_FLAGS "A:D:d:E:fg:hI:i:K:k:L:P:p:R:r:S:suv:Vz:"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
@@ -536,7 +539,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -960,5 +963,5 @@ main(int argc, char **argv) {
isc_mem_free(mctx, directory);
isc_mem_destroy(&mctx);
return 0;
return (0);
}
File diff suppressed because it is too large Load Diff
+8 -31
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] [**-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...]
:program:`dnssec-signzone` [**-a**] [**-c** class] [**-d** directory] [**-D**] [**-E** engine] [**-e** end-time] [**-f** output-file] [**-g**] [**-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...]
Description
~~~~~~~~~~~
@@ -71,29 +71,11 @@ Options
engine identifier that drives the cryptographic accelerator or
hardware service module (usually ``pkcs11``).
.. option:: -F
This options turns on FIPS (US Federal Information Processing Standards)
mode if the underlying crytographic library supports running in FIPS
mode.
.. option:: -g
This option indicates that DS records for child zones should be generated from a ``dsset-`` or ``keyset-``
file. Existing DS records are removed.
.. option:: -G sync-records
This option indicates which CDS and CDNSKEY records should be generated. ``sync-records`` is a
comma-separated string with the following allowed items: ``cdnskey``, and ``cds:<digest-type>``,
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
@@ -183,11 +165,6 @@ 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
@@ -283,7 +260,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:`6781#section-4.1.1.1` ("Pre-Publish Zone Signing Key Rollover").
:rfc:`4641#4.2.1.1` ("Pre-Publish Key Rollover").
.. option:: -q
@@ -300,7 +277,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:`6781#section-4.1.1.2` ("Double Signature Zone Signing Key
:rfc:`4641#4.2.1.2` ("Double Signature Zone Signing Key
Rollover").
.. option:: -S
@@ -369,12 +346,15 @@ Options
.. option:: -x
This option indicates that BIND 9 should only sign the DNSKEY, CDNSKEY, and CDS RRsets with key-signing keys,
and should omit signatures from zone-signing keys.
and should omit signatures from zone-signing keys. (This is similar to the
``dnssec-dnskey-kskonly yes;`` zone option in :iscman:`named`.)
.. option:: -z
This option indicates that BIND 9 should ignore the KSK flag on keys when determining what to sign. This causes
KSK-flagged keys to sign all records, not just the DNSKEY RRset.
(This is similar to the ``update-check-ksk no;`` zone option in
:iscman:`named`.)
.. option:: -3 salt
@@ -384,7 +364,6 @@ Options
.. note::
``-3 -`` is the recommended configuration. Adding salt provides no practical benefits.
See :rfc:`9276`.
.. option:: -H iterations
@@ -393,7 +372,6 @@ Options
.. warning::
Values greater than 0 cause interoperability issues and also increase the risk of CPU-exhausting DoS attacks.
See :rfc:`9276`.
.. option:: -A
@@ -402,7 +380,6 @@ 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
@@ -456,4 +433,4 @@ See Also
~~~~~~~~
:iscman:`dnssec-keygen(8) <dnssec-keygen>`, BIND 9 Administrator Reference Manual, :rfc:`4033`,
:rfc:`6781`.
:rfc:`4641`.
+17 -18
View File
@@ -17,15 +17,18 @@
#include <stdlib.h>
#include <time.h>
#include <isc/app.h>
#include <isc/attributes.h>
#include <isc/base32.h>
#include <isc/commandline.h>
#include <isc/event.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/hex.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/os.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/result.h>
#include <isc/rwlock.h>
@@ -67,10 +70,10 @@ const char *program = "dnssec-verify";
static isc_stdtime_t now;
static isc_mem_t *mctx = NULL;
static dns_masterformat_t inputformat = dns_masterformat_text;
static dns_db_t *gdb = NULL; /* The database */
static dns_dbversion_t *gversion = NULL; /* The database version */
static dns_rdataclass_t gclass; /* The class */
static dns_name_t *gorigin = NULL; /* The database origin */
static dns_db_t *gdb; /* The database */
static dns_dbversion_t *gversion; /* The database version */
static dns_rdataclass_t gclass; /* The class */
static dns_name_t *gorigin; /* The database origin */
static bool ignore_kskflag = false;
static bool keyset_kskonly = false;
@@ -109,8 +112,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
isc_result_totext(result));
}
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, db);
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, db);
check_result(result, "dns_db_create()");
result = dns_db_load(*db, file, inputformat, 0);
@@ -162,7 +165,7 @@ usage(void) {
fprintf(stderr, "\t-x:\tDNSKEY record signed with KSKs only, "
"not ZSKs\n");
fprintf(stderr, "\t-z:\tAll records signed with KSKs\n");
exit(EXIT_SUCCESS);
exit(0);
}
int
@@ -177,7 +180,7 @@ main(int argc, char *argv[]) {
char *endp;
int ch;
#define CMDLINE_FLAGS "c:E:hJ:m:o:I:qv:Vxz"
#define CMDLINE_FLAGS "c:E:hm:o:I:qv:Vxz"
/*
* Process memory debugging argument first.
@@ -203,6 +206,7 @@ main(int argc, char *argv[]) {
}
}
isc_commandline_reset = true;
check_result(isc_app_start(), "isc_app_start");
isc_mem_create(&mctx);
@@ -222,10 +226,6 @@ main(int argc, char *argv[]) {
inputformatstr = isc_commandline_argument;
break;
case 'J':
journal = isc_commandline_argument;
break;
case 'm':
break;
@@ -271,7 +271,7 @@ main(int argc, char *argv[]) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(EXIT_FAILURE);
exit(1);
}
}
@@ -281,7 +281,7 @@ main(int argc, char *argv[]) {
isc_result_totext(result));
}
now = isc_stdtime_now();
isc_stdtime_get(&now);
rdclass = strtoclass(classname);
@@ -319,9 +319,6 @@ main(int argc, char *argv[]) {
gdb = NULL;
report("Loading zone '%s' from file '%s'\n", origin, file);
loadzone(file, origin, rdclass, &gdb);
if (journal != NULL) {
loadjournal(mctx, gdb, journal);
}
gorigin = dns_db_origin(gdb);
gclass = dns_db_class(gdb);
@@ -342,5 +339,7 @@ main(int argc, char *argv[]) {
}
isc_mem_destroy(&mctx);
return result == ISC_R_SUCCESS ? 0 : 1;
(void)isc_app_finish();
return (result == ISC_R_SUCCESS ? 0 : 1);
}
+1 -6
View File
@@ -21,7 +21,7 @@ dnssec-verify - DNSSEC zone verification tool
Synopsis
~~~~~~~~
:program:`dnssec-verify` [**-c** class] [**-E** engine] [**-I** input-format] [**-J** filename] [**-o** origin] [**-q**] [**-v** level] [**-V**] [**-x**] [**-z**] {zonefile}
:program:`dnssec-verify` [**-c** class] [**-E** engine] [**-I** input-format] [**-o** origin] [**-q**] [**-v** level] [**-V**] [**-x**] [**-z**] {zonefile}
Description
~~~~~~~~~~~
@@ -53,11 +53,6 @@ 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
+64 -181
View File
@@ -20,7 +20,6 @@
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/base32.h>
#include <isc/buffer.h>
@@ -30,10 +29,10 @@
#include <isc/heap.h>
#include <isc/list.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/time.h>
#include <isc/tls.h>
#include <isc/tm.h>
#include <isc/util.h>
@@ -41,7 +40,6 @@
#include <dns/dbiterator.h>
#include <dns/dnssec.h>
#include <dns/fixedname.h>
#include <dns/journal.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/name.h>
@@ -67,7 +65,6 @@ static const char *keystates[KEYSTATES_NVALUES] = {
int verbose = 0;
bool quiet = false;
const char *journal = NULL;
dns_dsdigest_t dtype[8];
static fatalcallback_t *fatalcallback = NULL;
@@ -84,7 +81,7 @@ fatal(const char *format, ...) {
if (fatalcallback != NULL) {
(*fatalcallback)();
}
_exit(EXIT_FAILURE);
exit(1);
}
void
@@ -113,8 +110,8 @@ vbprintf(int level, const char *fmt, ...) {
void
version(const char *name) {
printf("%s %s\n", name, PACKAGE_VERSION);
exit(EXIT_SUCCESS);
fprintf(stderr, "%s %s\n", name, PACKAGE_VERSION);
exit(0);
}
void
@@ -202,16 +199,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 +220,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 +252,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 +260,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);
@@ -291,14 +288,18 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
struct tm tm;
if (isnone(str)) {
SET_IF_NOT_NULL(setp, false);
return (isc_stdtime_t)0;
if (setp != NULL) {
*setp = false;
}
return ((isc_stdtime_t)0);
}
SET_IF_NOT_NULL(setp, true);
if (setp != NULL) {
*setp = true;
}
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') {
return (isc_stdtime_t)0;
return ((isc_stdtime_t)0);
}
/*
@@ -347,7 +348,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 +361,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,15 +371,15 @@ strtoclass(const char *str) {
isc_result_t result;
if (str == NULL) {
return dns_rdataclass_in;
return (dns_rdataclass_in);
}
r.base = UNCONST(str);
DE_CONST(str, r.base);
r.length = strlen(str);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS) {
fatal("unknown class %s", str);
}
return rdclass;
return (rdclass);
}
unsigned int
@@ -387,25 +388,25 @@ strtodsdigest(const char *str) {
dns_dsdigest_t alg;
isc_result_t result;
r.base = UNCONST(str);
DE_CONST(str, r.base);
r.length = strlen(str);
result = dns_dsdigest_fromtext(&alg, &r);
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
add_dtype(unsigned int dt) {
unsigned int i, n;
unsigned i, n;
/* ensure there is space for a zero terminator */
n = sizeof(dtype) / sizeof(dtype[0]) - 1;
@@ -432,7 +433,7 @@ try_dir(const char *dirname) {
if (result == ISC_R_SUCCESS) {
isc_dir_close(&d);
}
return result;
return (result);
}
/*
@@ -472,14 +473,15 @@ set_keyversion(dst_key_t *key) {
* set the creation date
*/
if (major < 1 || (major == 1 && minor <= 2)) {
isc_stdtime_t now = isc_stdtime_now();
isc_stdtime_t now;
isc_stdtime_get(&now);
dst_key_settime(key, DST_TIME_CREATED, now);
}
}
bool
key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
isc_mem_t *mctx, uint16_t min, uint16_t max, bool *exact) {
isc_mem_t *mctx, bool *exact) {
isc_result_t result;
bool conflict = false;
dns_dnsseckeylist_t matchkeys;
@@ -487,34 +489,38 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
uint16_t id, oldid;
uint32_t rid, roldid;
dns_secalg_t alg;
isc_stdtime_t now = isc_stdtime_now();
char filename[NAME_MAX];
isc_buffer_t fileb;
isc_stdtime_t now;
SET_IF_NOT_NULL(exact, false);
if (exact != 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;
/*
* For Diffie Hellman just check if there is a direct collision as
* they can't be revoked. Additionally dns_dnssec_findmatchingkeys
* only handles DNSKEY which is not used for HMAC.
*/
if (alg == DST_ALG_DH) {
isc_buffer_init(&fileb, filename, sizeof(filename));
result = dst_key_buildfilename(dstkey, DST_TYPE_PRIVATE, dir,
&fileb);
if (result != ISC_R_SUCCESS) {
return (true);
}
return (isc_file_exists(filename));
}
ISC_LIST_INIT(matchkeys);
result = dns_dnssec_findmatchingkeys(name, NULL, dir, NULL, now, mctx,
&matchkeys);
isc_stdtime_get(&now);
result = dns_dnssec_findmatchingkeys(name, dir, now, mctx, &matchkeys);
if (result == ISC_R_NOTFOUND) {
return false;
return (false);
}
while (!ISC_LIST_EMPTY(matchkeys) && !conflict) {
@@ -558,7 +564,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
dns_dnsseckey_destroy(mctx, &key);
}
return conflict;
return (conflict);
}
bool
@@ -573,130 +579,7 @@ 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 false;
}
void
loadjournal(isc_mem_t *mctx, dns_db_t *db, const char *file) {
dns_journal_t *jnl = NULL;
isc_result_t result;
result = dns_journal_open(mctx, file, DNS_JOURNAL_READ, &jnl);
if (result == ISC_R_NOTFOUND) {
fprintf(stderr, "%s: journal file %s not found\n", program,
file);
goto cleanup;
} else if (result != ISC_R_SUCCESS) {
fatal("unable to open journal %s: %s\n", file,
isc_result_totext(result));
}
if (dns_journal_empty(jnl)) {
dns_journal_destroy(&jnl);
return;
}
result = dns_journal_rollforward(jnl, db, 0);
switch (result) {
case ISC_R_SUCCESS:
case DNS_R_UPTODATE:
break;
case ISC_R_NOTFOUND:
case ISC_R_RANGE:
fatal("journal %s out of sync with zone", file);
default:
fatal("journal %s: %s\n", file, isc_result_totext(result));
}
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);
return (true);
}
return (false);
}
+1 -20
View File
@@ -20,18 +20,10 @@
#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;
@@ -40,9 +32,6 @@ extern bool quiet;
/*! program name, statically initialized in each program */
extern const char *program;
/*! journal file */
extern const char *journal;
/*!
* List of DS digest types used by dnssec-cds and dnssec-dsfromkey,
* defined in dnssectool.c. Filled in by add_dtype() from -a
@@ -109,15 +98,7 @@ set_keyversion(dst_key_t *key);
bool
key_collision(dst_key_t *key, dns_name_t *name, const char *dir,
isc_mem_t *mctx, uint16_t min, uint16_t max, bool *exact);
isc_mem_t *mctx, 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);
+5 -9
View File
@@ -7,13 +7,13 @@ AM_CPPFLAGS += \
$(LIBNS_CFLAGS) \
$(LIBISCCC_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBBIND9_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(LIBCAP_CFLAGS) \
$(LMDB_CFLAGS) \
$(MAXMINDDB_CFLAGS) \
$(DNSTAP_CFLAGS) \
$(LIBUV_CFLAGS) \
$(LIBSYSTEMD_CFLAGS) \
$(ZLIB_CFLAGS)
if HAVE_JSON_C
@@ -38,8 +38,8 @@ AM_CPPFLAGS += \
sbin_PROGRAMS = named
nodist_named_SOURCES = xsl.c
BUILT_SOURCES += xsl.c
CLEANFILES += xsl.c
BUILT_SOURCES = xsl.c
CLEANFILES = xsl.c
EXTRA_DIST = bind9.xsl
@@ -102,13 +102,14 @@ named_LDADD = \
$(LIBNS_LIBS) \
$(LIBISCCC_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBBIND9_LIBS) \
$(OPENSSL_LIBS) \
$(LIBCAP_LIBS) \
$(LMDB_LIBS) \
$(MAXMINDDB_LIBS) \
$(DNSTAP_LIBS) \
$(LIBUV_LIBS) \
$(LIBSYSTEMD_LIBS) \
$(LIBXML2_LIBS) \
$(ZLIB_LIBS)
if HAVE_JSON_C
@@ -120,8 +121,3 @@ if HAVE_LIBNGHTTP2
named_LDADD += \
$(LIBNGHTTP2_LIBS)
endif HAVE_LIBNGHTTP2
if HAVE_LIBXML2
named_LDADD += \
$(LIBXML2_LIBS)
endif HAVE_LIBXML2
+123 -60
View File
@@ -15,7 +15,7 @@
<xsl:output method="html" indent="yes" version="4.0"/>
<!-- the version number **below** must match version in bin/named/statschannel.c -->
<!-- don't forget to update "/xml/v<STATS_XML_VERSION_MAJOR>" in the HTTP endpoints listed below -->
<xsl:template match="statistics[@version=&quot;3.14&quot;]">
<xsl:template match="statistics[@version=&quot;3.13&quot;]">
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
@@ -156,6 +156,29 @@
background-color: #99ddff;
}
table.tasks {
border: 1px solid grey;
width: 500px;
}
table.tasks th {
text-align: center;
border: 1px solid grey;
width: 150px;
}
table.tasks td {
text-align: right;
font-family: monospace;
}
table.tasks td:nth-child(2) {
text-align: center;
}
table.tasks td:nth-child(4) {
text-align: center;
}
table.tasks tr:hover{
background-color: #99ddff;
}
table.netstat {
border: 1px solid grey;
width: 500px;
@@ -303,8 +326,8 @@
<a href="/xml/v3/status">Status</a>,
<a href="/xml/v3/server">Server</a>,
<a href="/xml/v3/zones">Zones</a>,
<a href="/xml/v3/xfrins">Incoming Zone Transfers</a>,
<a href="/xml/v3/net">Network</a>,
<a href="/xml/v3/tasks">Tasks</a>,
<a href="/xml/v3/mem">Memory</a> and
<a href="/xml/v3/traffic">Traffic Size</a></p>
<hr/>
@@ -908,64 +931,84 @@
</xsl:for-each>
</xsl:for-each>
</xsl:if>
<xsl:if test="views/view/xfrins/xfrin">
<xsl:for-each select="views/view">
<h3>Incoming Zone Transfers for View <xsl:value-of select="@name"/></h3>
<table class="xfrins">
<thead>
<tr>
<th>Zone Name</th>
<th>Zone Type</th>
<th>Local Serial</th>
<th>Remote Serial</th>
<th>IXFR</th>
<th>First Refresh</th>
<th>State</th>
<th>Additional Refresh Queued</th>
<th>Local Address</th>
<th>Remote Address</th>
<th>SOA Transport</th>
<th>Transport</th>
<th>TSIG Key Name</th>
<th>Duration (s)</th>
<th>Messages Received</th>
<th>Records Received</th>
<th>Bytes Received</th>
<th>Transfer Rate (B/s)</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="xfrins/xfrin">
<xsl:variable name="css-class16">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when>
<xsl:otherwise>odd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr class="{$css-class16}">
<td><xsl:value-of select="@name"/></td>
<td><xsl:value-of select="type"/></td>
<td><xsl:value-of select="serial"/></td>
<td><xsl:value-of select="remoteserial"/></td>
<td><xsl:value-of select="ixfr"/></td>
<td><xsl:value-of select="firstrefresh"/></td>
<td><xsl:value-of select="state"/></td>
<td><xsl:value-of select="refreshqueued"/></td>
<td><xsl:value-of select="localaddr"/></td>
<td><xsl:value-of select="remoteaddr"/></td>
<td><xsl:value-of select="soatransport"/></td>
<td><xsl:value-of select="transport"/></td>
<td><xsl:value-of select="tsigkeyname"/></td>
<td><xsl:value-of select="duration"/></td>
<td><xsl:value-of select="nmsg"/></td>
<td><xsl:value-of select="nrecs"/></td>
<td><xsl:value-of select="nbytes"/></td>
<td><xsl:value-of select="rate"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>
<xsl:if test="taskmgr/thread-model/type">
<h2>Task Manager Configuration</h2>
<table class="counters">
<tr>
<th class="even">Thread-Model</th>
<td>
<xsl:value-of select="taskmgr/thread-model/type"/>
</td>
</tr>
<tr class="odd">
<th>Worker Threads</th>
<td>
<xsl:value-of select="taskmgr/thread-model/worker-threads"/>
</td>
</tr>
<tr class="even">
<th>Default Quantum</th>
<td>
<xsl:value-of select="taskmgr/thread-model/default-quantum"/>
</td>
</tr>
<tr class="odd">
<th>Tasks Running</th>
<td>
<xsl:value-of select="taskmgr/thread-model/tasks-running"/>
</td>
</tr>
<tr class="even">
<th>Tasks Ready</th>
<td>
<xsl:value-of select="taskmgr/thread-model/tasks-ready"/>
</td>
</tr>
</table>
<br/>
</xsl:if>
<xsl:if test="taskmgr/tasks/task">
<h2>Tasks</h2>
<table class="tasks">
<tr>
<th>ID</th>
<th>Name</th>
<th>References</th>
<th>State</th>
<th>Quantum</th>
<th>Events</th>
</tr>
<xsl:for-each select="taskmgr/tasks/task">
<xsl:sort select="name"/>
<xsl:variable name="css-class14">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when>
<xsl:otherwise>odd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr class="{$css-class14}">
<td>
<xsl:value-of select="id"/>
</td>
<td>
<xsl:value-of select="name"/>
</td>
<td>
<xsl:value-of select="references"/>
</td>
<td>
<xsl:value-of select="state"/>
</td>
<td>
<xsl:value-of select="quantum"/>
</td>
<td>
<xsl:value-of select="events"/>
</td>
</tr>
</xsl:for-each>
</table>
<br/>
</xsl:if>
<xsl:if test="memory/summary">
<h2>Memory Usage Summary</h2>
@@ -996,7 +1039,12 @@
<th>ID</th>
<th>Name</th>
<th>References</th>
<th>TotalUse</th>
<th>InUse</th>
<th>MaxUse</th>
<th>Malloced</th>
<th>MaxMalloced</th>
<th>BlockSize</th>
<th>Pools</th>
<th>HiWater</th>
<th>LoWater</th>
@@ -1019,9 +1067,24 @@
<td>
<xsl:value-of select="references"/>
</td>
<td>
<xsl:value-of select="total"/>
</td>
<td>
<xsl:value-of select="inuse"/>
</td>
<td>
<xsl:value-of select="maxinuse"/>
</td>
<td>
<xsl:value-of select="malloced"/>
</td>
<td>
<xsl:value-of select="maxmalloced"/>
</td>
<td>
<xsl:value-of select="blocksize"/>
</td>
<td>
<xsl:value-of select="pools"/>
</td>
+276 -919
View File
File diff suppressed because it is too large Load Diff
+228 -150
View File
@@ -49,12 +49,17 @@ static char defaultconf[] = "\
options {\n\
answer-cookie true;\n\
automatic-interface-scan yes;\n\
# blackhole {none;};\n\
cookie-algorithm siphash24;\n\
bindkeys-file \"" NAMED_SYSCONFDIR "/bind.keys\";\n\
# blackhole {none;};\n"
" cookie-algorithm siphash24;\n"
" coresize default;\n\
datasize default;\n"
"\
# directory <none>\n\
dnssec-policy \"none\";\n\
dump-file \"named_dump.db\";\n\
edns-udp-size 1232;\n"
edns-udp-size 1232;\n\
files unlimited;\n"
#if defined(HAVE_GEOIP2)
"\
geoip-directory \"" MAXMINDDB_PREFIX "/share/GeoIP\";\n"
@@ -65,8 +70,10 @@ options {\n\
"\
heartbeat-interval 60;\n\
interface-interval 60;\n\
# keep-response-order {none;};\n\
listen-on {any;};\n\
listen-on-v6 {any;};\n\
# lock-file \"" NAMED_LOCALSTATEDIR "/run/named/named.lock\";\n\
match-mapped-addresses no;\n\
max-ixfr-ratio 100%;\n\
max-rsa-exponent-size 0; /* no limit */\n\
@@ -96,12 +103,11 @@ options {\n\
#endif
"\
prefetch 2 9;\n\
# querylog <boolean>;\n\
recursing-file \"named.recursing\";\n\
recursive-clients 1000;\n\
request-nsid false;\n\
reserved-sockets 512;\n\
resolver-query-timeout 10;\n\
# responselog <boolean>;\n\
rrset-order { order random; };\n\
secroots-file \"named.secroots\";\n\
send-cookie true;\n\
@@ -110,10 +116,8 @@ options {\n\
session-keyalg hmac-sha256;\n\
# session-keyfile \"" NAMED_LOCALSTATEDIR "/run/named/session.key\";\n\
session-keyname local-ddns;\n\
stacksize default;\n\
startup-notify-rate 20;\n\
sig0checks-quota 1;\n\
sig0key-checks-limit 16;\n\
sig0message-checks-limit 2;\n\
statistics-file \"named.stats\";\n\
tcp-advertised-timeout 300;\n\
tcp-clients 150;\n\
@@ -123,6 +127,7 @@ options {\n\
tcp-listen-queue 10;\n\
tcp-receive-buffer 0;\n\
tcp-send-buffer 0;\n\
# tkey-dhkey <none>\n\
# tkey-domain <none>\n\
# tkey-gssapi-credential <none>\n\
transfer-message-size 20480;\n\
@@ -137,8 +142,6 @@ options {\n\
/* view */\n\
allow-new-zones no;\n\
allow-notify {none;};\n\
allow-proxy {none;};\n\
allow-proxy-on {any;};\n\
allow-query-cache { localnets; localhost; };\n\
allow-query-cache-on { any; };\n\
allow-recursion { localnets; localhost; };\n\
@@ -151,13 +154,9 @@ options {\n\
check-names response ignore;\n\
check-names secondary warn;\n\
check-spf warn;\n\
check-svcb yes;\n\
clients-per-query 10;\n\
dnssec-accept-expired no;\n\
dnssec-validation " VALIDATION_DEFAULT "; \n"
#ifdef USE_DNSRPS
" dnsrps-library \"" DNSRPS_LIBRPZ_PATH "\";\n"
#endif /* ifdef USE_DNSRPS */
#ifdef HAVE_DNSTAP
" dnstap-identity hostname;\n"
#endif /* ifdef HAVE_DNSTAP */
@@ -165,6 +164,7 @@ options {\n\
fetch-quota-params 100 0.1 0.3 0.7;\n\
fetches-per-server 0;\n\
fetches-per-zone 0;\n\
glue-cache yes;\n\
lame-ttl 0;\n"
#ifdef HAVE_LMDB
" lmdb-mapsize 32M;\n"
@@ -174,9 +174,7 @@ options {\n\
max-clients-per-query 100;\n\
max-ncache-ttl 10800; /* 3 hours */\n\
max-recursion-depth 7;\n\
max-recursion-queries 50;\n\
max-query-count 200;\n\
max-query-restarts 11;\n\
max-recursion-queries 100;\n\
max-stale-ttl 86400; /* 1 day */\n\
message-compression yes;\n\
min-ncache-ttl 0; /* 0 hours */\n\
@@ -196,6 +194,8 @@ options {\n\
request-expire true;\n\
request-ixfr true;\n\
require-server-cookie no;\n\
resolver-nonbackoff-tries 3;\n\
resolver-retry-interval 800; /* in milliseconds */\n\
root-key-sentinel yes;\n\
servfail-ttl 1;\n\
# sortlist <none>\n\
@@ -207,39 +207,40 @@ options {\n\
synth-from-dnssec yes;\n\
# topology <none>\n\
transfer-format many-answers;\n\
resolver-use-dns64 false;\n\
v6-bias 50;\n\
zero-no-soa-ttl-cache no;\n\
\n\
/* zone */\n\
allow-query {any;};\n\
allow-query-on {any;};\n\
allow-transfer {none;};\n\
allow-transfer {any;};\n\
# also-notify <none>\n\
alt-transfer-source *;\n\
alt-transfer-source-v6 *;\n\
check-integrity yes;\n\
check-mx-cname warn;\n\
check-sibling yes;\n\
check-srv-cname warn;\n\
check-wildcard yes;\n\
dialup no;\n\
dnssec-dnskey-kskonly yes;\n\
dnssec-loadkeys-interval 60;\n\
dnssec-secure-to-insecure no;\n\
dnssec-update-mode maintain;\n\
# forward <none>\n\
# forwarders <none>\n\
# inline-signing no;\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\
max-transfer-time-out 120;\n\
min-refresh-time 300;\n\
min-retry-time 500;\n\
min-transfer-rate-in 10240 5;\n\
multi-master no;\n\
notify yes;\n\
notify-delay 5;\n\
@@ -248,9 +249,12 @@ options {\n\
sig-signing-nodes 100;\n\
sig-signing-signatures 10;\n\
sig-signing-type 65534;\n\
sig-validity-interval 30; /* days */\n\
dnskey-sig-validity 0; /* default: sig-validity-interval */\n\
transfer-source *;\n\
transfer-source-v6 *;\n\
try-tcp-refresh yes; /* BIND 8 compat */\n\
update-check-ksk yes;\n\
zero-no-soa-ttl yes;\n\
zone-statistics terse;\n\
};\n\
@@ -301,15 +305,10 @@ dnssec-policy \"default\" {\n\
csk key-directory lifetime unlimited algorithm 13;\n\
};\n\
\n\
cdnskey yes;\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\
@@ -322,7 +321,6 @@ dnssec-policy \"default\" {\n\
dnssec-policy \"insecure\" {\n\
max-zone-ttl 0; \n\
keys { };\n\
inline-signing yes;\n\
};\n\
\n\
"
@@ -338,7 +336,7 @@ dnssec-policy \"insecure\" {\n\
"# END TRUST ANCHORS\n\
\n\
remote-servers " DEFAULT_IANA_ROOT_ZONE_PRIMARIES " {\n\
primaries " 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\
@@ -362,15 +360,13 @@ 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 | CFG_PCTX_NOOBSOLETE |
CFG_PCTX_NOEXPERIMENTAL,
conf);
return (cfg_parse_buffer(parser, &b, __FILE__, 0, &cfg_type_namedconf,
CFG_PCTX_NODEPRECATED, conf));
}
const char *
named_config_getdefault(void) {
return defaultconf;
return (defaultconf);
}
isc_result_t
@@ -380,10 +376,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
@@ -409,7 +405,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))
@@ -423,13 +419,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
@@ -441,7 +437,7 @@ named_config_listcount(const cfg_obj_t *list) {
i++;
}
return i;
return (i);
}
isc_result_t
@@ -452,16 +448,16 @@ 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));
DE_CONST(cfg_obj_asstring(classobj), r.base);
r.length = strlen(r.base);
result = dns_rdataclass_fromtext(classp, &r);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(classobj, named_g_lctx, ISC_LOG_ERROR,
"unknown class '%s'", r.base);
}
return result;
return (result);
}
isc_result_t
@@ -472,16 +468,16 @@ 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));
DE_CONST(cfg_obj_asstring(typeobj), r.base);
r.length = strlen(r.base);
result = dns_rdatatype_fromtext(typep, &r);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(typeobj, named_g_lctx, ISC_LOG_ERROR,
"unknown type '%s'", r.base);
}
return result;
return (result);
}
dns_zonetype_t
@@ -507,12 +503,78 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
} else {
UNREACHABLE();
}
return ztype;
return (ztype);
}
isc_result_t
named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
const char *name, const cfg_obj_t **ret) {
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
in_port_t defport, isc_mem_t *mctx,
isc_sockaddr_t **addrsp, uint32_t *countp) {
int count, i = 0;
const cfg_obj_t *addrlist = NULL;
const cfg_obj_t *portobj = NULL;
const cfg_listelt_t *element = NULL;
isc_sockaddr_t *addrs = NULL;
in_port_t port;
isc_result_t result;
INSIST(addrsp != NULL && *addrsp == NULL);
INSIST(countp != NULL);
addrlist = cfg_tuple_get(list, "addresses");
count = named_config_listcount(addrlist);
portobj = cfg_tuple_get(list, "port");
if (cfg_obj_isuint32(portobj)) {
uint32_t val = cfg_obj_asuint32(portobj);
if (val > UINT16_MAX) {
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
"port '%u' out of range", val);
return (ISC_R_RANGE);
}
port = (in_port_t)val;
} else if (defport != 0) {
port = defport;
} else {
result = named_config_getport(config, "port", &port);
if (result != ISC_R_SUCCESS) {
return (result);
}
}
addrs = isc_mem_get(mctx, count * sizeof(isc_sockaddr_t));
for (element = cfg_list_first(addrlist); element != NULL;
element = cfg_list_next(element), i++)
{
const cfg_obj_t *addr;
INSIST(i < count);
addr = cfg_listelt_value(element);
addrs[i] = *cfg_obj_assockaddr(addr);
if (isc_sockaddr_getport(&addrs[i]) == 0) {
isc_sockaddr_setport(&addrs[i], port);
}
}
INSIST(i == count);
*addrsp = addrs;
*countp = count;
return (ISC_R_SUCCESS);
}
void
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
uint32_t count) {
INSIST(addrsp != NULL && *addrsp != NULL);
isc_mem_put(mctx, *addrsp, count * sizeof(isc_sockaddr_t));
*addrsp = NULL;
}
static isc_result_t
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;
@@ -523,7 +585,7 @@ named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
result = cfg_map_get(cctx, list, &obj);
if (result != ISC_R_SUCCESS) {
return result;
return (result);
}
elt = cfg_list_first(obj);
while (elt != NULL) {
@@ -532,11 +594,28 @@ named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
name) == 0)
{
*ret = obj;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
elt = cfg_list_next(elt);
}
return ISC_R_NOTFOUND;
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);
}
static isc_result_t
@@ -551,7 +630,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));
@@ -566,50 +645,59 @@ 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) \
if (newlen >= oldlen) { \
array = isc_mem_creget(mctx, array, oldlen, newlen + 16, \
sizeof(array[0])); \
oldlen = newlen + 16; \
#define grow_array(mctx, array, newlen, oldlen) \
if (newlen >= oldlen) { \
size_t newsize = (newlen + 16) * sizeof(array[0]); \
size_t oldsize = oldlen * sizeof(array[0]); \
void *tmp = isc_mem_get(mctx, newsize); \
memset(tmp, 0, newsize); \
if (oldlen != 0) { \
memmove(tmp, array, oldsize); \
isc_mem_put(mctx, array, oldsize); \
} \
array = tmp; \
oldlen = newlen + 16; \
}
#define shrink_array(mctx, array, newlen, oldlen) \
if (newlen < oldlen) { \
array = isc_mem_creget(mctx, array, oldlen, newlen, \
sizeof(array[0])); \
oldlen = newlen; \
#define shrink_array(mctx, array, newlen, oldlen) \
if (newlen < oldlen) { \
void *tmp = NULL; \
size_t newsize = newlen * sizeof(array[0]); \
size_t oldsize = oldlen * sizeof(array[0]); \
if (newlen != 0) { \
tmp = isc_mem_get(mctx, newsize); \
memset(tmp, 0, newsize); \
memmove(tmp, array, newsize); \
} else { \
tmp = NULL; \
} \
isc_mem_put(mctx, array, oldsize); \
array = tmp; \
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 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;
named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
const cfg_obj_t *list, isc_mem_t *mctx,
dns_ipkeylist_t *ipkl) {
uint32_t addrcount = 0, keycount = 0, tlscount = 0, i = 0;
uint32_t listcount = 0, l = 0, j;
uint32_t stackcount = 0, pushed = 0;
isc_result_t result;
const cfg_listelt_t *element;
const cfg_obj_t *addrlist;
const cfg_obj_t *portobj;
const cfg_obj_t *src4obj;
const cfg_obj_t *src6obj;
in_port_t port = (in_port_t)0;
in_port_t def_port;
in_port_t def_tlsport;
isc_sockaddr_t src4;
isc_sockaddr_t src6;
isc_sockaddr_t *addrs = NULL;
isc_sockaddr_t *sources = NULL;
dns_name_t **keys = NULL;
dns_name_t **tlss = NULL;
struct {
@@ -621,8 +709,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
struct {
const cfg_listelt_t *element;
in_port_t port;
isc_sockaddr_t src4;
isc_sockaddr_t src6;
} *stack = NULL;
REQUIRE(ipkl != NULL);
@@ -649,8 +735,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
newlist:
addrlist = cfg_tuple_get(list, "addresses");
portobj = cfg_tuple_get(list, "port");
src4obj = cfg_tuple_get(list, "source");
src6obj = cfg_tuple_get(list, "source-v6");
if (cfg_obj_isuint32(portobj)) {
uint32_t val = cfg_obj_asuint32(portobj);
@@ -663,17 +747,7 @@ newlist:
port = (in_port_t)val;
}
if (src4obj != NULL && cfg_obj_issockaddr(src4obj)) {
src4 = *cfg_obj_assockaddr(src4obj);
} else {
isc_sockaddr_any(&src4);
}
if (src6obj != NULL && cfg_obj_issockaddr(src6obj)) {
src6 = *cfg_obj_assockaddr(src6obj);
} else {
isc_sockaddr_any6(&src6);
}
result = ISC_R_NOMEMORY;
element = cfg_list_first(addrlist);
resume:
@@ -690,7 +764,6 @@ resume:
if (!cfg_obj_issockaddr(addr)) {
const char *listname = cfg_obj_asstring(addr);
isc_result_t tresult;
uint32_t j;
/* Grow lists? */
grow_array(mctx, lists, l, listcount);
@@ -705,22 +778,17 @@ resume:
continue;
}
list = NULL;
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;
}
}
tresult = named_config_getremotesdef(config, listtype,
listname, &list);
if (tresult == ISC_R_NOTFOUND) {
cfg_obj_log(addr, named_g_lctx, ISC_LOG_ERROR,
"remote-servers \"%s\" not found",
"%s \"%s\" not found", listtype,
listname);
result = tresult;
goto cleanup;
}
if (tresult != ISC_R_SUCCESS) {
result = tresult;
goto cleanup;
}
lists[l++].name = listname;
@@ -732,8 +800,6 @@ resume:
*/
stack[pushed].element = cfg_list_next(element);
stack[pushed].port = port;
stack[pushed].src4 = src4;
stack[pushed].src6 = src6;
pushed++;
goto newlist;
}
@@ -741,7 +807,6 @@ resume:
grow_array(mctx, addrs, i, addrcount);
grow_array(mctx, keys, i, keycount);
grow_array(mctx, tlss, i, tlscount);
grow_array(mctx, sources, i, srccount);
addrs[i] = *cfg_obj_assockaddr(addr);
@@ -775,62 +840,43 @@ resume:
isc_sockaddr_setport(&addrs[i], addr_port);
}
switch (isc_sockaddr_pf(&addrs[i])) {
case PF_INET:
sources[i] = src4;
break;
case PF_INET6:
sources[i] = src6;
break;
default:
i++; /* Increment here so that cleanup on error works.
*/
result = ISC_R_NOTIMPLEMENTED;
goto cleanup;
}
i++;
}
if (pushed != 0) {
pushed--;
element = stack[pushed].element;
port = stack[pushed].port;
src4 = stack[pushed].src4;
src6 = stack[pushed].src6;
goto resume;
}
shrink_array(mctx, addrs, i, addrcount);
shrink_array(mctx, keys, i, keycount);
shrink_array(mctx, tlss, i, tlscount);
shrink_array(mctx, sources, i, srccount);
if (lists != NULL) {
isc_mem_cput(mctx, lists, listcount, sizeof(lists[0]));
isc_mem_put(mctx, lists, listcount * sizeof(lists[0]));
}
if (stack != NULL) {
isc_mem_cput(mctx, stack, stackcount, sizeof(stack[0]));
isc_mem_put(mctx, stack, stackcount * sizeof(stack[0]));
}
INSIST(keycount == addrcount);
INSIST(tlscount == addrcount);
INSIST(srccount == addrcount);
ipkl->addrs = addrs;
ipkl->keys = keys;
ipkl->tlss = tlss;
ipkl->sources = sources;
ipkl->count = addrcount;
ipkl->allocated = addrcount;
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
cleanup:
if (addrs != NULL) {
isc_mem_cput(mctx, addrs, addrcount, sizeof(addrs[0]));
isc_mem_put(mctx, addrs, addrcount * sizeof(addrs[0]));
}
if (keys != NULL) {
for (size_t j = 0; j < i; j++) {
for (j = 0; j < i; j++) {
if (keys[j] == NULL) {
continue;
}
@@ -839,10 +885,10 @@ cleanup:
}
isc_mem_put(mctx, keys[j], sizeof(*keys[j]));
}
isc_mem_cput(mctx, keys, keycount, sizeof(keys[0]));
isc_mem_put(mctx, keys, keycount * sizeof(keys[0]));
}
if (tlss != NULL) {
for (size_t j = 0; j < i; j++) {
for (j = 0; j < i; j++) {
if (tlss[j] == NULL) {
continue;
}
@@ -851,18 +897,15 @@ cleanup:
}
isc_mem_put(mctx, tlss[j], sizeof(*tlss[j]));
}
isc_mem_cput(mctx, tlss, tlscount, sizeof(tlss[0]));
}
if (sources != NULL) {
isc_mem_cput(mctx, sources, srccount, sizeof(sources[0]));
isc_mem_put(mctx, tlss, tlscount * sizeof(tlss[0]));
}
if (lists != NULL) {
isc_mem_cput(mctx, lists, listcount, sizeof(lists[0]));
isc_mem_put(mctx, lists, listcount * sizeof(lists[0]));
}
if (stack != NULL) {
isc_mem_cput(mctx, stack, stackcount, sizeof(stack[0]));
isc_mem_put(mctx, stack, stackcount * sizeof(stack[0]));
}
return result;
return (result);
}
isc_result_t
@@ -888,10 +931,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 {
@@ -918,8 +961,14 @@ struct keyalgorithms {
{ NULL, hmacnone, DST_ALG_UNKNOWN, 0 } };
isc_result_t
named_config_getkeyalgorithm(const char *str, unsigned int *typep,
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
uint16_t *digestbits) {
return (named_config_getkeyalgorithm2(str, name, NULL, digestbits));
}
isc_result_t
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
unsigned int *typep, uint16_t *digestbits) {
int i;
size_t len = 0;
uint16_t bits;
@@ -935,22 +984,51 @@ 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;
} else {
bits = algorithms[i].size;
}
SET_IF_NOT_NULL(typep, algorithms[i].type);
SET_IF_NOT_NULL(digestbits, bits);
return ISC_R_SUCCESS;
if (name != NULL) {
switch (algorithms[i].hmac) {
case hmacmd5:
*name = dns_tsig_hmacmd5_name;
break;
case hmacsha1:
*name = dns_tsig_hmacsha1_name;
break;
case hmacsha224:
*name = dns_tsig_hmacsha224_name;
break;
case hmacsha256:
*name = dns_tsig_hmacsha256_name;
break;
case hmacsha384:
*name = dns_tsig_hmacsha384_name;
break;
case hmacsha512:
*name = dns_tsig_hmacsha512_name;
break;
default:
UNREACHABLE();
}
}
if (typep != NULL) {
*typep = algorithms[i].type;
}
if (digestbits != NULL) {
*digestbits = bits;
}
return (ISC_R_SUCCESS);
}
+26 -26
View File
@@ -15,6 +15,8 @@
#include <stdbool.h>
#include <isc/app.h>
#include <isc/event.h>
#include <isc/lex.h>
#include <isc/mem.h>
#include <isc/result.h>
@@ -43,23 +45,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 +87,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,10 +95,13 @@ 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);
result = isc_lex_create(named_g_mctx, strlen(cmdline), &lex);
if (result != ISC_R_SUCCESS) {
return (result);
}
isc_buffer_init(&src, cmdline, strlen(cmdline));
isc_buffer_add(&src, strlen(cmdline));
@@ -170,14 +175,14 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
named_smf_want_disable = 1;
}
/*
* If named_smf_got_instance = 0, named_smf_chroot is
* not relevant and we fall through to shutdown below.
* If named_smf_got_instance = 0, named_smf_chroot
* is not relevant and we fall through to
* isc_app_shutdown below.
*/
#endif /* ifdef HAVE_LIBSCF */
/* Do not flush master files */
named_server_flushonshutdown(named_g_server, false);
named_os_shutdownmsg(cmdline, *text);
isc_loopmgr_shutdown(named_g_loopmgr);
result = ISC_R_SHUTTINGDOWN;
} else if (command_compare(command, NAMED_COMMAND_STOP)) {
/*
@@ -195,7 +200,6 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
#endif /* ifdef HAVE_LIBSCF */
named_server_flushonshutdown(named_g_server, true);
named_os_shutdownmsg(cmdline, *text);
isc_loopmgr_shutdown(named_g_loopmgr);
result = ISC_R_SHUTTINGDOWN;
} else if (command_compare(command, NAMED_COMMAND_ADDZONE) ||
command_compare(command, NAMED_COMMAND_MODZONE))
@@ -210,11 +214,10 @@ 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)) {
result = named_server_dumpdb(named_g_server, lex, text);
named_server_dumpdb(named_g_server, lex, text);
result = ISC_R_SUCCESS;
} else if (command_compare(command, NAMED_COMMAND_DUMPSTATS)) {
result = named_server_dumpstats(named_g_server);
} else if (command_compare(command, NAMED_COMMAND_FETCHLIMIT)) {
result = named_server_fetchlimit(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_FLUSH)) {
result = named_server_flushcache(named_g_server, lex);
} else if (command_compare(command, NAMED_COMMAND_FLUSHNAME)) {
@@ -223,14 +226,10 @@ 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)) {
@@ -244,9 +243,7 @@ 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_setortoggle(named_g_server,
"query logging",
NS_SERVER_LOGQUERIES, lex);
result = named_server_togglequerylog(named_g_server, lex);
} else if (command_compare(command, NAMED_COMMAND_RECONFIG)) {
result = named_server_reconfigcommand(named_g_server);
} else if (command_compare(command, NAMED_COMMAND_RECURSING)) {
@@ -255,10 +252,6 @@ 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);
@@ -285,8 +278,15 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
command_compare(command, NAMED_COMMAND_UNFREEZE))
{
result = named_server_freeze(named_g_server, false, lex, text);
} else if (command_compare(command, NAMED_COMMAND_TIMERPOKE)) {
isc_timermgr_poke(named_g_timermgr);
result = ISC_R_SUCCESS;
} else if (command_compare(command, NAMED_COMMAND_TRACE)) {
result = named_server_setdebuglevel(named_g_server, lex);
} else if (command_compare(command, NAMED_COMMAND_TSIGDELETE)) {
result = named_server_tsigdelete(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_TSIGLIST)) {
result = named_server_tsiglist(named_g_server, text);
} else if (command_compare(command, NAMED_COMMAND_VALIDATION)) {
result = named_server_validation(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_ZONESTATUS)) {
@@ -303,5 +303,5 @@ cleanup:
isc_lex_destroy(&lex);
}
return result;
return (result);
}
+356 -248
View File
File diff suppressed because it is too large Load Diff
+33 -31
View File
@@ -16,11 +16,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <uv.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/util.h>
#include <isc/uv.h>
#include <dns/dlz_dlopen.h>
#include <dns/log.h>
@@ -98,13 +99,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 +117,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 +135,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 +156,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 +173,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 +196,7 @@ dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
}
}
return ptr;
return (ptr);
}
static void
@@ -219,16 +220,17 @@ 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);
cd = isc_mem_get(mctx, sizeof(*cd));
*cd = (dlopen_data_t){
.mctx = mctx,
.dl_path = isc_mem_strdup(mctx, argv[1]),
.dlzname = isc_mem_strdup(mctx, dlzname),
};
memset(cd, 0, sizeof(*cd));
cd->mctx = mctx;
cd->dl_path = isc_mem_strdup(cd->mctx, argv[1]);
cd->dlzname = isc_mem_strdup(cd->mctx, dlzname);
/* Initialize the lock */
isc_mutex_init(&cd->lock);
@@ -319,14 +321,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 +365,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 +406,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 +415,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 +431,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 +439,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 +454,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 +476,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 +498,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 +537,7 @@ dlz_dlopen_init(isc_mem_t *mctx) {
result = ISC_R_UNEXPECTED;
}
return result;
return (result);
}
/*
+12 -12
View File
@@ -25,8 +25,8 @@
#include <string.h>
#include <unistd.h>
#include <isc/app.h>
#include <isc/condition.h>
#include <isc/loop.h>
#include <isc/mutex.h>
#include <isc/thread.h>
#include <isc/util.h>
@@ -126,8 +126,8 @@ fuzz_thread_client(void *arg) {
close(sockfd);
named_server_flushonshutdown(named_g_server,
false);
isc_loopmgr_shutdown(named_g_loopmgr);
return NULL;
isc_app_shutdown();
return (NULL);
}
raise(SIGSTOP);
goto next;
@@ -159,9 +159,9 @@ fuzz_thread_client(void *arg) {
close(sockfd);
named_server_flushonshutdown(named_g_server, false);
isc_loopmgr_shutdown(named_g_loopmgr);
isc_app_shutdown();
return NULL;
return (NULL);
}
/*
@@ -374,8 +374,8 @@ fuzz_thread_resolver(void *arg) {
close(listenfd);
named_server_flushonshutdown(named_g_server,
false);
isc_loopmgr_shutdown(named_g_loopmgr);
return NULL;
isc_app_shutdown();
return (NULL);
}
raise(SIGSTOP);
continue;
@@ -574,7 +574,7 @@ fuzz_thread_resolver(void *arg) {
close(sockfd);
close(listenfd);
named_server_flushonshutdown(named_g_server, false);
isc_loopmgr_shutdown(named_g_loopmgr);
isc_app_shutdown();
#ifdef __AFL_LOOP
/*
@@ -587,7 +587,7 @@ fuzz_thread_resolver(void *arg) {
__AFL_LOOP(0);
#endif /* ifdef __AFL_LOOP */
return NULL;
return (NULL);
}
/*
@@ -716,9 +716,9 @@ fuzz_thread_tcp(void *arg) {
free(buf);
close(sockfd);
named_server_flushonshutdown(named_g_server, false);
isc_loopmgr_shutdown(named_g_loopmgr);
isc_app_shutdown();
return NULL;
return (NULL);
}
#endif /* ENABLE_AFL */
@@ -733,7 +733,7 @@ named_fuzz_notify(void) {
#ifdef ENABLE_AFL
if (getenv("AFL_CMIN")) {
named_server_flushonshutdown(named_g_server, false);
isc_loopmgr_shutdown(named_g_loopmgr);
isc_app_shutdown();
return;
}
+4 -3
View File
@@ -18,6 +18,7 @@
#endif /* if defined(HAVE_GEOIP2) */
#include <isc/dir.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -43,7 +44,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 +52,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 +60,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 */
-11
View File
@@ -15,19 +15,8 @@
/*! \file */
#include <inttypes.h>
#include <isc/lang.h>
#include <isc/types.h>
#include <dns/clientinfo.h>
#include <dns/types.h>
/***
*** Functions
***/
/* Initialization functions for builtin zone databases */
isc_result_t
named_builtin_init(void);
+16 -3
View File
@@ -52,18 +52,31 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
dns_zonetype_t
named_config_getzonetype(const cfg_obj_t *zonetypeobj);
isc_result_t
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
in_port_t defport, isc_mem_t *mctx,
isc_sockaddr_t **addrsp, uint32_t *countp);
void
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
uint32_t count);
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
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
isc_mem_t *mctx, dns_ipkeylist_t *ipkl);
named_config_getipandkeylist(const cfg_obj_t *config, const char *listtype,
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,
in_port_t *portp);
isc_result_t
named_config_getkeyalgorithm(const char *str, unsigned int *typep,
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
uint16_t *digestbits);
isc_result_t
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
unsigned int *typep, uint16_t *digestbits);
+37 -39
View File
@@ -20,59 +20,57 @@
#include <stdbool.h>
#include <isccc/types.h>
#include <isccfg/aclconf.h>
#include <isccc/types.h>
#include <named/types.h>
#define NAMED_CONTROL_PORT 953
#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_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_FETCHLIMIT "fetchlimit"
#define NAMED_COMMAND_QUERYLOG "querylog"
#define NAMED_COMMAND_DUMPDB "dumpdb"
#define NAMED_COMMAND_SECROOTS "secroots"
#define NAMED_COMMAND_TRACE "trace"
#define NAMED_COMMAND_NOTRACE "notrace"
#define NAMED_COMMAND_FLUSH "flush"
#define NAMED_COMMAND_FLUSHNAME "flushname"
#define NAMED_COMMAND_FLUSHTREE "flushtree"
#define NAMED_COMMAND_FREEZE "freeze"
#define NAMED_COMMAND_HALT "halt"
#define NAMED_COMMAND_LOADKEYS "loadkeys"
#define NAMED_COMMAND_MEMPROF "memprof"
#define NAMED_COMMAND_MKEYS "managed-keys"
#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_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_TSIGLIST "tsig-list"
#define NAMED_COMMAND_TSIGDELETE "tsig-delete"
#define NAMED_COMMAND_FREEZE "freeze"
#define NAMED_COMMAND_UNFREEZE "unfreeze"
#define NAMED_COMMAND_THAW "thaw"
#define NAMED_COMMAND_TIMERPOKE "timerpoke"
#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_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_MKEYS "managed-keys"
#define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
#define NAMED_COMMAND_DNSTAP "dnstap"
#define NAMED_COMMAND_TCPTIMEOUTS "tcp-timeouts"
#define NAMED_COMMAND_SERVESTALE "serve-stale"
isc_result_t
named_controls_create(named_server_t *server, named_controls_t **ctrlsp);
+33 -20
View File
@@ -18,7 +18,6 @@
#include <stdbool.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/net.h>
#include <isc/netmgr.h>
#include <isc/rwlock.h>
@@ -26,11 +25,10 @@
#include <dns/acl.h>
#include <dns/zone.h>
#include <dst/dst.h>
#include <isccfg/aclconf.h>
#include <isccfg/cfg.h>
#include <dst/dst.h>
#include <named/fuzz.h>
#include <named/types.h>
@@ -50,9 +48,8 @@
EXTERN isc_mem_t *named_g_mctx INIT(NULL);
EXTERN unsigned int named_g_cpus INIT(0);
EXTERN isc_loop_t *named_g_mainloop INIT(NULL);
EXTERN isc_loopmgr_t *named_g_loopmgr INIT(NULL);
EXTERN bool named_g_loopmgr_running INIT(false);
EXTERN unsigned int named_g_udpdisp INIT(0);
EXTERN isc_taskmgr_t *named_g_taskmgr INIT(NULL);
EXTERN dns_dispatchmgr_t *named_g_dispatchmgr INIT(NULL);
EXTERN unsigned int named_g_cpus_detected INIT(1);
@@ -64,19 +61,20 @@ EXTERN bool named_g_run_done INIT(false);
* for really short timers, another for client timers, and one
* for zone timers.
*/
EXTERN isc_nm_t *named_g_netmgr INIT(NULL);
EXTERN cfg_parser_t *named_g_parser INIT(NULL);
EXTERN cfg_parser_t *named_g_addparser INIT(NULL);
EXTERN const char *named_g_version INIT(PACKAGE_VERSION);
EXTERN const char *named_g_product INIT(PACKAGE_NAME);
EXTERN const char *named_g_description INIT(PACKAGE_DESCRIPTION);
EXTERN const char *named_g_srcid INIT(PACKAGE_SRCID);
EXTERN const char *named_g_configargs INIT(PACKAGE_CONFIGARGS);
EXTERN const char *named_g_builder INIT(PACKAGE_BUILDER);
EXTERN in_port_t named_g_port INIT(0);
EXTERN in_port_t named_g_tlsport INIT(0);
EXTERN in_port_t named_g_httpsport INIT(0);
EXTERN in_port_t named_g_httpport INIT(0);
EXTERN isc_timermgr_t *named_g_timermgr INIT(NULL);
EXTERN isc_nm_t *named_g_netmgr INIT(NULL);
EXTERN cfg_parser_t *named_g_parser INIT(NULL);
EXTERN cfg_parser_t *named_g_addparser INIT(NULL);
EXTERN const char *named_g_version INIT(PACKAGE_VERSION);
EXTERN const char *named_g_product INIT(PACKAGE_NAME);
EXTERN const char *named_g_description INIT(PACKAGE_DESCRIPTION);
EXTERN const char *named_g_srcid INIT(PACKAGE_SRCID);
EXTERN const char *named_g_configargs INIT(PACKAGE_CONFIGARGS);
EXTERN const char *named_g_builder INIT(PACKAGE_BUILDER);
EXTERN in_port_t named_g_port INIT(0);
EXTERN in_port_t named_g_tlsport INIT(0);
EXTERN in_port_t named_g_httpsport INIT(0);
EXTERN in_port_t named_g_httpport INIT(0);
EXTERN in_port_t named_g_http_listener_clients INIT(0);
EXTERN in_port_t named_g_http_streams_per_conn INIT(0);
@@ -97,12 +95,22 @@ EXTERN unsigned int named_g_debuglevel INIT(0);
EXTERN cfg_obj_t *named_g_config INIT(NULL);
EXTERN const cfg_obj_t *named_g_defaults INIT(NULL);
EXTERN const char *named_g_conffile INIT(NAMED_SYSCONFDIR "/named.conf");
EXTERN const char *named_g_defaultbindkeys INIT(NULL);
EXTERN const char *named_g_defaultbindkeys INIT(NAMED_SYSCONFDIR "/bind.keys");
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);
/*
* Initial resource limits.
*/
EXTERN isc_resourcevalue_t named_g_initstacksize INIT(0);
EXTERN isc_resourcevalue_t named_g_initdatasize INIT(0);
EXTERN isc_resourcevalue_t named_g_initcoresize INIT(0);
EXTERN isc_resourcevalue_t named_g_initopenfiles INIT(0);
/*
* Misc.
*/
@@ -116,6 +124,11 @@ EXTERN const char *named_g_logfile INIT(NULL);
EXTERN const char *named_g_defaultsessionkeyfile INIT(NAMED_LOCALSTATEDIR
"/run/named/"
"session.key");
EXTERN const char *named_g_defaultlockfile INIT(NAMED_LOCALSTATEDIR "/run/"
"named/"
"named."
"lock");
EXTERN bool named_g_forcelock INIT(false);
#if NAMED_RUN_PID_DIR
EXTERN const char *named_g_defaultpidfile INIT(NAMED_LOCALSTATEDIR "/run/named/"
-3
View File
@@ -34,6 +34,3 @@ named_main_earlywarning(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
void
named_main_setmemstats(const char *);
void
named_main_shutdown(void *arg, int signum);
+5 -5
View File
@@ -39,13 +39,10 @@ void
named_os_inituserinfo(const char *username);
void
named_os_changeuser(bool permanent);
void
named_os_restoreuser(void);
named_os_changeuser(void);
uid_t
named_os_uid(void);
ns_os_uid(void);
void
named_os_adjustnofile(void);
@@ -59,6 +56,9 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user);
void
named_os_writepidfile(const char *filename, bool first_time);
bool
named_os_issingleton(const char *filename);
void
named_os_shutdown(void);
+41 -50
View File
@@ -21,7 +21,6 @@
#include <isc/log.h>
#include <isc/magic.h>
#include <isc/quota.h>
#include <isc/signal.h>
#include <isc/sockaddr.h>
#include <isc/tls.h>
#include <isc/types.h>
@@ -38,6 +37,12 @@
#include <named/types.h>
#define NAMED_EVENTCLASS ISC_EVENTCLASS(0x4E43)
#define NAMED_EVENT_RELOAD (NAMED_EVENTCLASS + 0)
#define NAMED_EVENT_DELZONE (NAMED_EVENTCLASS + 1)
#define NAMED_EVENT_COMMAND (NAMED_EVENTCLASS + 2)
#define NAMED_EVENT_TATSEND (NAMED_EVENTCLASS + 3)
/*%
* Name server state. Better here than in lots of separate global variables.
*/
@@ -47,25 +52,27 @@ struct named_server {
ns_server_t *sctx;
isc_task_t *task;
char *statsfile; /*%< Statistics file name */
char *dumpfile; /*%< Dump file name */
char *secrootsfile; /*%< Secroots file name */
char *bindkeysfile; /*%< bind.keys file name */
char *bindkeysfile; /*%< bind.keys file name
* */
char *recfile; /*%< Recursive file name */
bool version_set; /*%< User has set version */
bool version_set; /*%< User has set version
* */
char *version; /*%< User-specified version */
bool hostname_set; /*%< User has set hostname */
char *hostname; /*%< User-specified hostname */
#ifdef USE_DNSRPS
char *dnsrpslib;
#endif /* ifdef USE_DNSRPS */
bool hostname_set; /*%< User has set hostname
* */
char *hostname; /*%< User-specified hostname
* */
/* Server data structures. */
dns_loadmgr_t *loadmgr;
dns_zonemgr_t *zonemgr;
dns_viewlist_t viewlist;
dns_kasplist_t kasplist;
dns_keystorelist_t keystorelist;
ns_interfacemgr_t *interfacemgr;
dns_db_t *in_roothints;
@@ -104,10 +111,10 @@ struct named_server {
dns_dtenv_t *dtenv; /*%< Dnstap environment */
char *lockfile;
isc_tlsctx_cache_t *tlsctx_server_cache;
isc_tlsctx_cache_t *tlsctx_client_cache;
isc_signal_t *sighup;
};
#define NAMED_SERVER_MAGIC ISC_MAGIC('S', 'V', 'E', 'R')
@@ -128,7 +135,7 @@ named_server_destroy(named_server_t **serverp);
*/
void
named_server_reloadwanted(void *arg, int signum);
named_server_reloadwanted(named_server_t *server);
/*%<
* Inform a server that a reload is wanted. This function
* may be called asynchronously, from outside the server's task.
@@ -184,20 +191,10 @@ named_server_retransfercommand(named_server_t *server, isc_lex_t *lex,
*/
isc_result_t
named_server_setortoggle(named_server_t *server, const char *optname,
unsigned int option, isc_lex_t *lex);
named_server_togglequerylog(named_server_t *server, isc_lex_t *lex);
/*%<
* 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.
* Enable/disable logging of queries. (Takes "yes" or "no" argument,
* but can also be used as a toggle for backward comptibility.)
*/
/*%
@@ -258,6 +255,19 @@ named_server_flushnode(named_server_t *server, isc_lex_t *lex, bool tree);
isc_result_t
named_server_status(named_server_t *server, isc_buffer_t **text);
/*%
* Report a list of dynamic and static tsig keys, per view.
*/
isc_result_t
named_server_tsiglist(named_server_t *server, isc_buffer_t **text);
/*%
* Delete a specific key (with optional view).
*/
isc_result_t
named_server_tsigdelete(named_server_t *server, isc_lex_t *lex,
isc_buffer_t **text);
/*%
* Enable or disable updates for a zone.
*/
@@ -287,6 +297,12 @@ named_server_rekey(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
isc_result_t
named_server_dumprecursing(named_server_t *server);
/*%
* Maintain a list of dispatches that require reserved ports.
*/
void
named_add_reserved_dispatch(named_server_t *server, const isc_sockaddr_t *addr);
/*%
* Enable or disable dnssec validation.
*/
@@ -378,28 +394,3 @@ named_server_tcptimeouts(isc_lex_t *lex, isc_buffer_t **text);
isc_result_t
named_server_servestale(named_server_t *server, isc_lex_t *lex,
isc_buffer_t **text);
/*%
* Report fetch-limited ADB server addresses.
*/
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);
+1 -2
View File
@@ -18,10 +18,9 @@
* The statistics channels built-in the name server.
*/
#include <isccc/types.h>
#include <isccfg/aclconf.h>
#include <isccc/types.h>
#include <named/types.h>
#define NAMED_STATSCHANNEL_HTTPPORT 80
+1 -1
View File
@@ -22,7 +22,7 @@ ISC_LANG_BEGINDECLS
isc_result_t
named_tsigkeyring_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
isc_mem_t *mctx, dns_tsigkeyring_t **ringp);
isc_mem_t *mctx, dns_tsig_keyring_t **ringp);
/*%<
* Create a TSIG key ring and configure it according to the 'key'
* statements in the global and view configuration objects.
+5 -9
View File
@@ -28,8 +28,8 @@ ISC_LANG_BEGINDECLS
isc_result_t
named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
const cfg_obj_t *zconfig, cfg_aclconfctx_t *ac,
dns_kasplist_t *kasplist, dns_keystorelist_t *keystores,
dns_zone_t *zone, dns_zone_t *raw);
dns_kasplist_t *kasplist, dns_zone_t *zone,
dns_zone_t *raw);
/*%<
* Configure or reconfigure a zone according to the named.conf
* data.
@@ -44,9 +44,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
*/
bool
named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig,
const cfg_obj_t *vconfig, const cfg_obj_t *config,
dns_kasplist_t *kasplist);
named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig);
/*%<
* If 'zone' can be safely reconfigured according to the configuration
* data in 'zconfig', return true. If the configuration data is so
@@ -55,12 +53,10 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig,
*/
bool
named_zone_inlinesigning(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
const cfg_obj_t *config, dns_kasplist_t *kasplist);
named_zone_inlinesigning(const cfg_obj_t *zconfig);
/*%<
* Determine if zone uses inline-signing. This is true if inline-signing
* is set to yes, in the zone clause or in the zone's dnssec-policy clause.
* By default, dnssec-policy uses inline-signing.
* is set to yes.
*/
isc_result_t
+5 -9
View File
@@ -51,7 +51,6 @@ isc_result_t
named_log_init(bool safe) {
isc_result_t result;
isc_logconfig_t *lcfg = NULL;
isc_mem_t *log_mctx = NULL;
named_g_categories = categories;
named_g_modules = modules;
@@ -59,10 +58,7 @@ named_log_init(bool safe) {
/*
* Setup a logging context.
*/
isc_mem_create(&log_mctx);
isc_mem_setname(log_mctx, "named_log");
isc_log_create(log_mctx, &named_g_lctx, &lcfg);
isc_mem_detach(&log_mctx);
isc_log_create(named_g_mctx, &named_g_lctx, &lcfg);
/*
* named-checktool.c:setup_logging() needs to be kept in sync.
@@ -89,14 +85,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 +233,7 @@ named_log_setdefaultcategory(isc_logconfig_t *lcfg) {
}
cleanup:
return result;
return (result);
}
isc_result_t
@@ -246,7 +242,7 @@ named_log_setunmatchedcategory(isc_logconfig_t *lcfg) {
result = isc_log_usechannel(lcfg, "null", NAMED_LOGCATEGORY_UNMATCHED,
NULL);
return result;
return (result);
}
void
+14 -12
View File
@@ -17,6 +17,8 @@
#include <stdbool.h>
#include <isc/file.h>
#include <isc/offset.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/stdio.h>
#include <isc/string.h>
@@ -57,11 +59,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 +82,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 +133,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;
@@ -144,14 +146,14 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
const cfg_obj_t *suffixobj = cfg_tuple_get(fileobj, "suffix");
int32_t versions = ISC_LOG_ROLLNEVER;
isc_log_rollsuffix_t suffix = isc_log_rollsuffix_increment;
off_t size = 0;
isc_offset_t size = 0;
uint64_t maxoffset;
/*
* off_t is a signed integer type, so the maximum
* isc_offset_t is a signed integer type, so the maximum
* value is all 1s except for the MSB.
*/
switch (sizeof(off_t)) {
switch (sizeof(isc_offset_t)) {
case 4:
maxoffset = 0x7fffffffULL;
break;
@@ -176,7 +178,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
if (sizeobj != NULL && cfg_obj_isuint64(sizeobj) &&
cfg_obj_asuint64(sizeobj) < maxoffset)
{
size = (off_t)cfg_obj_asuint64(sizeobj);
size = (isc_offset_t)cfg_obj_asuint64(sizeobj);
}
if (suffixobj != NULL && cfg_obj_isstring(suffixobj) &&
strcasecmp(cfg_obj_asstring(suffixobj), "timestamp") == 0)
@@ -310,7 +312,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
}
done:
return result;
return (result);
}
isc_result_t
@@ -365,8 +367,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);
}
+176 -152
View File
@@ -19,30 +19,31 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <uv.h>
#ifdef HAVE_DNSTAP
#include <protobuf-c/protobuf-c.h>
#endif
#include <isc/app.h>
#include <isc/attributes.h>
#include <isc/backtrace.h>
#include <isc/commandline.h>
#include <isc/dir.h>
#include <isc/file.h>
#include <isc/fips.h>
#include <isc/hash.h>
#include <isc/httpd.h>
#include <isc/managers.h>
#include <isc/netmgr.h>
#include <isc/os.h>
#include <isc/print.h>
#include <isc/resource.h>
#include <isc/result.h>
#include <isc/signal.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <isc/uv.h>
#include <isc/xml.h>
#include <dns/dispatch.h>
#include <dns/dyndb.h>
@@ -86,12 +87,7 @@
#endif /* ifdef HAVE_LIBSCF */
#include <openssl/crypto.h>
#include <openssl/evp.h>
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
#include <openssl/err.h>
#include <openssl/provider.h>
#endif
#ifdef HAVE_LIBXML2
#include <libxml/parser.h>
#include <libxml/xmlversion.h>
@@ -102,20 +98,18 @@
#ifdef HAVE_LIBNGHTTP2
#include <nghttp2/nghttp2.h>
#endif
/* On DragonFly BSD the header does not provide jemalloc API */
#if defined(HAVE_MALLOC_NP_H) && !defined(__DragonFly__)
#include <malloc_np.h>
#include <sys/malloc.h> /* For M_VERSION */
#elif defined(HAVE_JEMALLOC)
#include <jemalloc/jemalloc.h>
#endif
/*
* Include header files for database drivers here.
*/
/* #include "xxdb.h" */
/*
* The maximum number of stack frames to dump on assertion failure.
*/
#ifndef BACKTRACE_MAXFRAME
#define BACKTRACE_MAXFRAME 128
#endif /* ifndef BACKTRACE_MAXFRAME */
extern unsigned int dns_zone_mkey_hour;
extern unsigned int dns_zone_mkey_day;
extern unsigned int dns_zone_mkey_month;
@@ -152,10 +146,6 @@ static bool transferstuck = false;
static bool disable6 = false;
static bool disable4 = false;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
static OSSL_PROVIDER *fips = NULL, *base = NULL;
#endif
void
named_main_earlywarning(const char *format, ...) {
va_list args;
@@ -194,7 +184,7 @@ named_main_earlyfatal(const char *format, ...) {
}
va_end(args);
_exit(EXIT_FAILURE);
exit(1);
}
noreturn static void
@@ -204,6 +194,9 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
static void
assertion_failed(const char *file, int line, isc_assertiontype_t type,
const char *cond) {
void *tracebuf[BACKTRACE_MAXFRAME];
int nframes;
/*
* Handle assertion failures.
*/
@@ -215,12 +208,24 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
*/
isc_assertion_setcallback(NULL);
nframes = isc_backtrace(tracebuf, BACKTRACE_MAXFRAME);
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL,
"%s:%d: %s(%s) failed", file, line,
isc_assertion_typetotext(type), cond);
isc_backtrace_log(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL);
"%s:%d: %s(%s) failed%s", file, line,
isc_assertion_typetotext(type), cond,
(nframes > 0) ? ", back trace" : "");
if (nframes > 0) {
char **strs = isc_backtrace_symbols(tracebuf, nframes);
if (strs != NULL) {
for (int i = 0; i < nframes; i++) {
isc_log_write(named_g_lctx,
NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN,
ISC_LOG_CRITICAL, "%s",
strs[i]);
}
}
}
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL,
"exiting (due to assertion failure)");
@@ -233,7 +238,7 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
if (named_g_coreok) {
abort();
}
_exit(EXIT_FAILURE);
exit(1);
}
noreturn static void
@@ -273,7 +278,7 @@ library_fatal_error(const char *file, int line, const char *func,
if (named_g_coreok) {
abort();
}
_exit(EXIT_FAILURE);
exit(1);
}
static void
@@ -312,8 +317,8 @@ usage(void) {
"[-p port] [-s]\n"
" [-S sockets] [-t chrootdir] [-u "
"username] [-U listeners]\n"
" [-m "
"{usage|trace|record}]\n"
" [-X lockfile] [-m "
"{usage|trace|record|size|mctx}]\n"
" [-M fill|nofill]\n"
"usage: named [-v|-V|-C]\n");
}
@@ -406,7 +411,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 {
@@ -465,7 +470,7 @@ set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) {
static void
list_dnssec_algorithms(isc_buffer_t *b) {
for (dst_algorithm_t i = DST_ALG_UNKNOWN; i < DST_MAX_ALGS; i++) {
if (i == DST_ALG_GSSAPI ||
if (i == DST_ALG_DH || i == DST_ALG_GSSAPI ||
(i >= DST_ALG_HMAC_FIRST && i <= DST_ALG_HMAC_LAST))
{
continue;
@@ -543,7 +548,11 @@ format_supported_algorithms(void (*emit)(isc_buffer_t *b)) {
(*emit)(&b);
isc_buffer_init(&b, buf, sizeof(buf));
isc_buffer_printf(&b, "TKEY mode 2 support (Diffie-Hellman): %s", "no");
isc_buffer_printf(&b, "TKEY mode 2 support (Diffie-Hellman): %s",
(dst_algorithm_supported(DST_ALG_DH) &&
dst_algorithm_supported(DST_ALG_HMACMD5))
? "yes"
: "non");
(*emit)(&b);
isc_buffer_init(&b, buf, sizeof(buf));
@@ -586,6 +595,9 @@ printversion(bool verbose) {
#endif /* ifdef __GNUC__ */
#endif /* if defined(__ICC) || defined(__INTEL_COMPILER) */
#endif /* ifdef __clang__ */
#ifdef _MSC_VER
printf("compiled by MSVC %d\n", _MSC_VER);
#endif /* ifdef _MSC_VER */
#ifdef __SUNPRO_C
printf("compiled by Solaris Studio %x\n", __SUNPRO_C);
#endif /* ifdef __SUNPRO_C */
@@ -603,14 +615,6 @@ printversion(bool verbose) {
printf("compiled with libuv version: %d.%d.%d\n", UV_VERSION_MAJOR,
UV_VERSION_MINOR, UV_VERSION_PATCH);
printf("linked to libuv version: %s\n", uv_version_string());
printf("compiled with %s version: %s\n", RCU_FLAVOR, RCU_VERSION);
#if defined(JEMALLOC_VERSION)
printf("compiled with jemalloc version: %u.%u.%u\n",
JEMALLOC_VERSION_MAJOR, JEMALLOC_VERSION_MINOR,
JEMALLOC_VERSION_BUGFIX);
#elif defined(M_VERSION)
printf("compiled with system jemalloc version: %u\n", M_VERSION);
#endif
#if HAVE_LIBNGHTTP2
nghttp2_info *nginfo = NULL;
printf("compiled with libnghttp2 version: %s\n", NGHTTP2_VERSION);
@@ -669,8 +673,10 @@ printversion(bool verbose) {
printf("default paths:\n");
printf(" named configuration: %s\n", named_g_conffile);
printf(" rndc configuration: %s\n", rndcconf);
printf(" DNSSEC root key: %s\n", named_g_defaultbindkeys);
printf(" nsupdate session key: %s\n", named_g_defaultsessionkeyfile);
printf(" named PID file: %s\n", named_g_defaultpidfile);
printf(" named lock file: %s\n", named_g_defaultlockfile);
#if defined(HAVE_GEOIP2)
#define RTC(x) RUNTIME_CHECK((x) == ISC_R_SUCCESS)
RTC(cfg_parser_create(mctx, named_g_lctx, &parser));
@@ -892,7 +898,7 @@ parse_command_line(int argc, char *argv[]) {
printf("# Built-in default values. "
"This is NOT the run-time configuration!\n");
printf("%s", named_config_getdefault());
exit(EXIT_SUCCESS);
exit(0);
case 'd':
named_g_debuglevel = parse_int(isc_commandline_argument,
"debug "
@@ -948,53 +954,38 @@ parse_command_line(int argc, char *argv[]) {
parse_T_opt(isc_commandline_argument);
break;
case 'U':
/* Obsolete. No longer in use. Ignore. */
named_main_earlywarning("option '-U' has been removed");
named_g_udpdisp = parse_int(isc_commandline_argument,
"number of UDP listeners "
"per interface");
break;
case 'u':
named_g_username = isc_commandline_argument;
break;
case 'v':
printversion(false);
exit(EXIT_SUCCESS);
exit(0);
case 'V':
printversion(true);
exit(EXIT_SUCCESS);
exit(0);
case 'x':
/* Obsolete. No longer in use. Ignore. */
break;
case 'X':
/* Obsolete. No longer in use. Abort. */
named_main_earlyfatal("option '-X' has been removed");
named_g_forcelock = true;
if (strcasecmp(isc_commandline_argument, "none") != 0) {
named_g_defaultlockfile =
isc_commandline_argument;
} else {
named_g_defaultlockfile = NULL;
}
break;
case 'F':
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
fips = OSSL_PROVIDER_load(NULL, "fips");
if (fips == NULL) {
ERR_clear_error();
named_main_earlyfatal(
"Failed to load FIPS provider");
}
base = OSSL_PROVIDER_load(NULL, "base");
if (base == NULL) {
OSSL_PROVIDER_unload(fips);
ERR_clear_error();
named_main_earlyfatal(
"Failed to load base provider");
}
#endif
if (isc_fips_mode()) { /* Already in FIPS mode. */
break;
}
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
named_main_earlyfatal(
"setting FIPS mode failed");
}
break;
/* Reserved for FIPS mode */
FALLTHROUGH;
case '?':
usage();
if (isc_commandline_option == '?') {
exit(EXIT_SUCCESS);
exit(0);
}
p = strchr(NAMED_MAIN_ARGS, isc_commandline_option);
if (p == NULL || *++p != ':') {
@@ -1024,31 +1015,51 @@ parse_command_line(int argc, char *argv[]) {
static isc_result_t
create_managers(void) {
/*
* Set the default named_g_cpus if it was not set from the command line
*/
isc_result_t result;
INSIST(named_g_cpus_detected > 0);
if (named_g_cpus == 0) {
named_g_cpus = named_g_cpus_detected;
}
isc_log_write(
named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_INFO, "found %u CPU%s, using %u worker thread%s",
named_g_cpus_detected, named_g_cpus_detected == 1 ? "" : "s",
named_g_cpus, named_g_cpus == 1 ? "" : "s");
if (named_g_udpdisp == 0) {
named_g_udpdisp = named_g_cpus_detected;
}
if (named_g_udpdisp > named_g_cpus) {
named_g_udpdisp = named_g_cpus;
}
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
"using %u UDP listener%s per interface", named_g_udpdisp,
named_g_udpdisp == 1 ? "" : "s");
isc_managers_create(&named_g_mctx, named_g_cpus, &named_g_loopmgr,
&named_g_netmgr);
result = isc_managers_create(named_g_mctx, named_g_cpus,
0 /* quantum */, &named_g_netmgr,
&named_g_taskmgr, &named_g_timermgr);
if (result != ISC_R_SUCCESS) {
return (result);
}
isc_nm_maxudp(named_g_netmgr, maxudp);
return ISC_R_SUCCESS;
return (ISC_R_SUCCESS);
}
static void
destroy_managers(void) {
isc_managers_destroy(&named_g_netmgr, &named_g_taskmgr,
&named_g_timermgr);
}
static void
setup(void) {
isc_result_t result;
isc_resourcevalue_t old_openfiles;
ns_server_t *sctx;
#ifdef HAVE_LIBSCF
char *instance = NULL;
@@ -1116,6 +1127,16 @@ setup(void) {
named_os_daemonize();
}
/*
* We call isc_app_start() here as some versions of FreeBSD's fork()
* destroys all the signal handling it sets up.
*/
result = isc_app_start();
if (result != ISC_R_SUCCESS) {
named_main_earlyfatal("isc_app_start() failed: %s",
isc_result_totext(result));
}
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"starting %s%s <id:%s>", PACKAGE_STRING,
@@ -1150,6 +1171,11 @@ setup(void) {
#endif /* ifdef __GNUC__ */
#endif /* if defined(__ICC) || defined(__INTEL_COMPILER) */
#endif /* ifdef __clang__ */
#ifdef _MSC_VER
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"compiled by MSVC %d", _MSC_VER);
#endif /* ifdef _MSC_VER */
#ifdef __SUNPRO_C
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
@@ -1179,30 +1205,6 @@ setup(void) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"linked to libuv version: %s", uv_version_string());
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"compiled with %s version: %s", RCU_FLAVOR, RCU_VERSION);
#if defined(JEMALLOC_VERSION)
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"compiled with jemalloc version: %u.%u.%u",
JEMALLOC_VERSION_MAJOR, JEMALLOC_VERSION_MINOR,
JEMALLOC_VERSION_BUGFIX);
#elif defined(M_VERSION)
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"compiled with system jemalloc version: %u", M_VERSION);
#endif
#if HAVE_LIBNGHTTP2
nghttp2_info *nginfo = NULL;
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"compiled with libnghttp2 version: %s", NGHTTP2_VERSION);
nginfo = nghttp2_version(1);
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"linked to libnghttp2 version: %s", nginfo->version_str);
#endif
#ifdef HAVE_LIBXML2
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
@@ -1228,21 +1230,6 @@ setup(void) {
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"linked to zlib version: %s", zlibVersion());
#endif /* if defined(HAVE_ZLIB) && defined(ZLIB_VERSION) */
#if defined(HAVE_GEOIP2)
/* Unfortunately, no version define on link time */
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"linked to maxminddb version: %s", MMDB_lib_version());
#endif /* if defined(HAVE_GEOIP2) */
#if defined(HAVE_DNSTAP)
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"compiled with protobuf-c version: %s",
PROTOBUF_C_VERSION);
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"linked to protobuf-c version: %s", protobuf_c_version());
#endif /* if defined(HAVE_DNSTAP) */
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"----------------------------------------------------");
@@ -1262,11 +1249,39 @@ setup(void) {
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"----------------------------------------------------");
/*
* Get the initial resource limits.
*/
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_stacksize,
&named_g_initstacksize) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_datasize,
&named_g_initdatasize) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_coresize,
&named_g_initcoresize) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_openfiles,
&named_g_initopenfiles) ==
ISC_R_SUCCESS);
/*
* System resources cannot effectively be tuned on some systems.
* Raise the limit in such cases for safety.
*/
old_openfiles = named_g_initopenfiles;
named_os_adjustnofile();
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_openfiles,
&named_g_initopenfiles) ==
ISC_R_SUCCESS);
if (old_openfiles != named_g_initopenfiles) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"adjusted limit on open files from "
"%" PRIu64 " to "
"%" PRIu64,
old_openfiles, named_g_initopenfiles);
}
/*
* If the named configuration filename is relative, prepend the current
@@ -1288,7 +1303,11 @@ setup(void) {
/*
* Record the server's startup time.
*/
named_g_boottime = isc_time_now();
result = isc_time_now(&named_g_boottime);
if (result != ISC_R_SUCCESS) {
named_main_earlyfatal("isc_time_now() failed: %s",
isc_result_totext(result));
}
result = create_managers();
if (result != ISC_R_SUCCESS) {
@@ -1377,6 +1396,8 @@ setup(void) {
static void
cleanup(void) {
destroy_managers();
if (named_g_mapped != NULL) {
dns_acl_detach(&named_g_mapped);
}
@@ -1437,7 +1458,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) {
@@ -1446,7 +1467,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) {
@@ -1455,7 +1476,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) {
@@ -1463,7 +1484,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) {
@@ -1473,12 +1494,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 */
@@ -1495,6 +1516,10 @@ main(int argc, char *argv[]) {
(void)ProfilerStart(NULL);
#endif /* ifdef HAVE_GPERFTOOLS_PROFILER */
#ifdef HAVE_LIBXML2
xmlInitParser();
#endif /* HAVE_LIBXML2 */
/*
* Technically, this call is superfluous because on startup of the main
* program, the portable "C" locale is selected by default. This
@@ -1559,20 +1584,30 @@ main(int argc, char *argv[]) {
}
}
setup();
isc_mem_create(&named_g_mctx);
isc_mem_setname(named_g_mctx, "main");
setup();
INSIST(named_g_server != NULL);
/*
* Start things running
* Start things running and then wait for a shutdown request
* or reload.
*/
isc_signal_start(named_g_server->sighup);
do {
result = isc_app_run();
/*
* Pause the loop manager in fatal.
*/
named_g_loopmgr_running = true;
isc_loopmgr_run(named_g_loopmgr);
if (result == ISC_R_RELOAD) {
named_server_reloadwanted(named_g_server);
} else if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR("isc_app_run(): %s",
isc_result_totext(result));
/*
* Force exit.
*/
result = ISC_R_SUCCESS;
}
} while (result != ISC_R_SUCCESS);
#ifdef HAVE_LIBSCF
if (named_smf_want_disable == 1) {
@@ -1605,35 +1640,24 @@ main(int argc, char *argv[]) {
(void)isc_stdio_close(fp);
}
}
isc_managers_destroy(&named_g_mctx, &named_g_loopmgr, &named_g_netmgr);
#if ENABLE_LEAK_DETECTION
isc__tls_setdestroycheck(true);
isc__uv_setdestroycheck(true);
isc__xml_setdestroycheck(true);
#endif
isc_mem_destroy(&named_g_mctx);
isc_mem_checkdestroyed(stderr);
named_main_setmemstats(NULL);
isc_app_finish();
named_os_closedevnull();
named_os_shutdown();
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_API_LEVEL >= 30000
if (base != NULL) {
OSSL_PROVIDER_unload(base);
}
if (fips != NULL) {
OSSL_PROVIDER_unload(fips);
}
#endif
#ifdef HAVE_LIBXML2
xmlCleanupParser();
#endif /* HAVE_LIBXML2 */
#ifdef HAVE_GPERFTOOLS_PROFILER
ProfilerStop();
#endif /* ifdef HAVE_GPERFTOOLS_PROFILER */
return 0;
return (0);
}
+1
View File
@@ -52,6 +52,7 @@ Any of these zone statements can also be set inside the view statement.
.. literalinclude:: ../../doc/misc/redirect.zoneopt
.. literalinclude:: ../../doc/misc/static-stub.zoneopt
.. literalinclude:: ../../doc/misc/stub.zoneopt
.. literalinclude:: ../../doc/misc/delegation-only.zoneopt
.. literalinclude:: ../../doc/misc/in-view.zoneopt
Files

Some files were not shown because too many files have changed in this diff Show More