Compare commits

...
Author SHA1 Message Date
Petr Špaček 8ba45d6840 WIP: setsockopt IP_LOCAL_PORT_RANGE(1,65535) 2024-10-08 16:28:28 +02:00
Michal Nowak 40dc5ae27f chg: doc: Set up version for BIND 9.21.3
Merge branch 'mnowak/set-up-version-for-bind-9.21.3' into 'main'

See merge request isc-projects/bind9!9595
2024-10-08 08:40:41 +00:00
Michal Nowak 63775b2288 Update BIND version to 9.21.3-dev 2024-10-08 10:30:48 +02:00
Ondřej Surý 27c4d7ef6d fix: dev: Don't enable REUSEADDR on outgoing UDP sockets
The outgoing UDP sockets enabled `SO_REUSEADDR` that allows sharing of the UDP sockets, but with one big caveat - the socket that was opened the last would get all traffic.  The dispatch code would ignore the invalid responses in the dns_dispatch, but this could lead to unexpected results.

Merge branch 'ondrej/fix-outgoing-UDP-port-selection' into 'main'

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

Disable setting the SO_REUSEADDR on the outgoing UDP sockets.  This
needs to be done explicitly because `uv_udp_open()` silently enables the
option on the socket.
2024-10-02 12:15:53 +00:00
Ondřej Surý fe305f96c9 fix: usr: Fix assertion failure when receiving DNS responses over TCP
When matching the received Query ID in the TCP connection,
an invalid received Query ID can very rarely cause assertion
failure.

Closes #4952

Merge branch '4952-check-whether-QID-is-not-deleted' into 'main'

See merge request isc-projects/bind9!9580
2024-10-02 10:41:26 +00:00
Ondřej Surý 4ef316e21e Skip TCP dispatch responses that are not ours
When matching the TCP dispatch responses, we should skip the responses
that do not belong to our TCP connection.  This can happen with faulty
upstream server that sends invalid QID back to us.
2024-10-02 10:41:04 +00:00
Arаm Sаrgsyаn 41f4c620c2 fix: dev: Don't ignore the local port number in dns_dispatch_add() for TCP
The dns_dispatch_add() function registers the 'resp' entry in
'disp->mgr->qids' hash table with 'resp->port' being 0, but in
tcp_recv_success(), when looking up an entry in the hash table
after a successfully received data the port is used, so if the
local port was set (i.e. it was not 0) it fails to find the
entry and results in an unexpected error.

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

Closes #4969

Merge branch '4969-dispatch-tcp-source-port-bug-fix' into 'main'

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

Set the 'resp->port' to the given local port value extracted from
'disp->local'.
2024-10-02 08:53:44 +00:00
Alessio Podda e618cdddf8 new: usr: Support ISO timestamps with timezone information
The configuration option `print-time` can now be set to `iso8601-tzinfo` in order to use the ISO 8601 timestamp with timezone information when logging. This is used as a default for `named -g`.

Closes #4963

Merge branch '4963-provide-timezone-information-in-log-timestamps' into 'main'

See merge request isc-projects/bind9!9563
2024-10-02 08:16:17 +00:00
Alessio Podda cc167266aa Support ISO timestamps with timezone information
This commit adds support for timestamps in iso8601 format with timezone
when logging. This is exposed through the iso8601-tzinfo printtime
suboption.
It also makes the new logging format the default for -g output,
hopefully removing the need for custom timestamp parsing in scripts.
2024-10-01 15:09:43 +00:00
Michal Nowak 1db4ebd983 chg: test: Replace dns.query module with isctest.query
The `dns.query.udp` and `dns.query.tcp` methods are [prone to timeouts](https://gitlab.isc.org/isc-projects/bind9/-/jobs/4785053); their `isctest.query` equivalents should be used in system tests instead.

Merge branch 'mnowak/convert-dns-query-udp-and-tcp-to-isctest-query' into 'main'

See merge request isc-projects/bind9!9560
2024-10-01 12:05:39 +00:00
Michal Nowak dfec69b4a2 Replace dns.query module with isctest.query 2024-10-01 13:25:56 +02:00
Michal Nowak a2d2d9c0d3 Add isctest.check.notimp() 2024-10-01 13:25:56 +02:00
Michal Nowak 4cb52f072e Report expected and last returned rcode on query timeout
Sometimes it's useful to see what was the server returning that did not
match the expected rcode.
2024-10-01 13:25:56 +02:00
Alessio Podda 474398a5a9 fix: dev: Null clausedefs for ancient options
This commit nulls all type fields for the clausedef lists that are
declared ancient, and removes the corresponding cfg_type_t and parsing
functions when they are found to be unused after the change.

Among others, it removes some leftovers from #1913.

Closes #4962

Merge branch '4962-null-clausedef-types-for-ancient-options' into 'main'

See merge request isc-projects/bind9!9552
2024-10-01 10:33:56 +00:00
alessio bc63758d70 Null clausedefs for ancient options
This commit nulls all type fields for the clausedef lists that are
declared ancient, and removes the corresponding cfg_type_t and parsing
functions when they are found to be unused after the change.
2024-10-01 10:17:04 +02:00
Matthijs Mekking 516b098220 fix: doc: Restore text about sig validity and SOA expire
When `sig-validity-interval` was obsoleted, the text that the signature validity interval should be multiples of the SOA expire interval was removed. Restore this text to the description of the `signatures-validity` option.

Closes #4951

Merge branch '4951-document-signatures-validity-soa-expire' into 'main'

See merge request isc-projects/bind9!9566
2024-10-01 06:32:48 +00:00
Matthijs Mekking 8aa94931c3 Update example.com zone SOA expire value
The example.com zone file given in the "Configurations and Zone Files"
chapter has an SOA expire of 3 weeks, which is not a multiple of
the default signatures-validity value. Adjust the SOA expire so that
it is much lower than the signatures-validity default.
2024-10-01 06:32:28 +00:00
Matthijs Mekking b09230004b Restore text about sig validity and SOA expire
When `sig-validity-interval` was obsoleted, the text that the signature
validity interval should be multiples of the SOA expire interval was
removed. Restore this text to the description of the
`signatures-validity` option.
2024-10-01 06:32:28 +00:00
Mark Andrews 3304e1dc76 fix: usr: Fix a bug in the static-stub implementation
Static-stub addresses and addresses from other sources were being
mixed together, resulting in static-stub queries going to addresses
not specified in the configuration, or alternatively, static-stub
addresses being used instead of the correct server addresses.

Closes #4850

Merge branch '4850-add-an-additional-class-of-names-to-adb' into 'main'

See merge request isc-projects/bind9!9314
2024-10-01 01:26:56 +00:00
Mark Andrews b3a2c790f3 Store static-stub addresses seperately in the adb
Static-stub address and addresses from other sources where being
mixed together resulting in static-stub queries going to addresses
not specified in the configuration or alternatively static-stub
addresses being used instead of the real addresses.
2024-10-01 00:19:13 +00:00
Petr Špaček 4d759a251b rem: dev: Remove unused function dns_zonemgr_resumexfrs()
Merge branch 'pspacek/zone-xfr-cleanup' into 'main'

See merge request isc-projects/bind9!9565
2024-09-30 12:42:22 +00:00
Petr Špaček a0f3b0c5de Remove unused function dns_zonemgr_resumexfrs() 2024-09-30 12:42:08 +00:00
Ondřej Surý b1be0145a5 chg: dev: Use release memory ordering when incrementing reference counter
As the relaxed memory ordering doesn't ensure any memory
synchronization, it is possible that the increment will succeed even
in the case when it should not - there is a race between
atomic_fetch_sub(..., acq_rel) and atomic_fetch_add(..., relaxed).
Only the result is consistent, but the previous value for both calls
could be same when both calls are executed at the same time.

Merge branch 'ondrej/use-release-memory-ordering-for-reference-counting' into 'main'

See merge request isc-projects/bind9!9460
2024-09-30 12:22:05 +00:00
Ondřej Surý 88227ea665 Use release memory ordering when incrementing reference counter
As the relaxed memory ordering doesn't ensure any memory
synchronization, it is possible that the increment will succeed even
in the case when it should not - there is a race between
atomic_fetch_sub(..., acq_rel) and atomic_fetch_add(..., relaxed).
Only the result is consistent, but the previous value for both calls
could be same when both calls are executed at the same time.
2024-09-30 11:03:01 +02:00
Arаm Sаrgsyаn d7d1804f16 fix: dev: Add a missing rcu_read_unlock() call on exit path
An exit path in the dns_dispatch_add() function fails to get out of
the RCU critical section when returning early. Add the missing
rcu_read_unlock() call.

Merge branch 'aram/add-missing-rcu_read_unlock-in-dns_dispatch_add' into 'main'

See merge request isc-projects/bind9!9561
2024-09-27 13:50:54 +00:00
Aram Sargsyan 4123d59fbc Add a missing rcu_read_unlock() call on exit path
An exit path in the dns_dispatch_add() function fails to get out of
the RCU critical section when returning early. Add the missing
rcu_read_unlock() call.
2024-09-27 13:48:33 +00:00
Ondřej Surý 62c49db973 dev: Add full Alessio's name to .mailmap to fix some of the older commits
Merge branch 'ondrej/add-alessio-to-.mailmap' into 'main'

See merge request isc-projects/bind9!9557
2024-09-26 11:48:16 +00:00
Ondřej Surý 1bc9eb0fc8 Add full Alessio's name to .mailmap to fix some of the older commits 2024-09-26 11:48:02 +00:00
Ondřej Surý f48b86871f chg: usr: Honour the Control Group memory contraints on Linux
On Linux, the system administrator can use Control Group ``cgroup``
mechanism to limit the amount of available memory to the process.  This
limit will be honoured when calculating the percentage-based values.

Merge branch 'ondrej/use-uv_get_available_memory-doc' into 'main'

See merge request isc-projects/bind9!9556
2024-09-26 11:20:14 +00:00
Ondřej Surý 37552ce9ae Document that we now honour the cgroup memory limit
On Linux, the system administrator can use Control Group ``cgroup``
mechanism to limit the amount of available memory to the process.  This
limit will be honoured when calculating the percentage-based values.
2024-09-26 12:55:11 +02:00
Mark Andrews d0d4c6dae7 new: usr: Added WALLET type
Add the new record type WALLET (262).  This provides a mapping from a domain name to a cryptographic currency wallet.  Multiple mappings can exist if multiple records exist.

Closes #4947

Merge branch '4947-add-wallet-type-to-named' into 'main'

See merge request isc-projects/bind9!9521
2024-09-25 12:03:45 +00:00
Mark Andrews 9b358e6e8b Add examples of WALLET records 2024-09-25 10:32:38 +00:00
Mark Andrews b919b9b4f3 Add the new record type WALLET (262)
This provides a mapping from a domain name to a cryptographic
currency wallet and is a clone of TXT.
2024-09-25 10:32:38 +00:00
Arаm Sаrgsyаn 4498c0216f fix: usr: Fix the 'rndc dumpdb' command's error reporting
The 'rndc dumpdb' command wasn't reporting errors which
occurred when starting up the database dump process by named,
like, for example, a permission denied error for the
'dump-file' file. This has been fixed. Note, however, that
'rndc dumpdb' performs asynchronous writes, so errors can
also occur during the dumping process, which will not be
reported back to 'rndc', but which will still be logged by
named.

Closes #4944

Merge branch '4944-rndc-dumpdb-do-not-ignore-errors' into 'main'

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

Also add a couple of missing entries in the cleaning script.
2024-09-25 08:02:17 +00:00
Aram Sargsyan 8b866ba8a0 Do not ignore named_server_dumpdb() result code
The named_server_dumpdb() function, which is called when a 'rndc dumpdb'
command is issued, returns a 'isc_result_t' result code and it has been
always ignored since its introduction in
eb8713ed94, where it was still called
ns_server_dumpdb(). The orignal reasoning is not preserved, but it could
have been also a simple copy-paste mistake, as there are commands, which
return 'void' and require manually setting 'result = ISC_R_SUCCESS;', as
it was done here. Anyway, named will now return the actual result, and
'rndc' will report an error, when the 'dumpdb' command fails.
2024-09-25 08:02:17 +00:00
Nicki Křížek 812f0031bf chg: doc: Track changes in separate files
Keep the changelog for each version in a separate source file to avoid
rebase conflicts when handling the -S version.

---

Related !9528

Closes #4946

Merge branch 'nicki/reorganize-changelog-docfiles-9.21' into 'main'

See merge request isc-projects/bind9!9549
2024-09-24 14:12:29 +00:00
Nicki Křížek 3d49a10d78 Fix changelog entry for [GL #4759] 2024-09-24 16:11:08 +02:00
Nicki Křížek 49128fc173 Generate changelog to stdout
Since the changes aren't tracked in the single changelog.rst file,
generate the changelog to stdout instead, so it can be easily redirected
to the proper file.
2024-09-24 16:11:08 +02:00
Nicki Křížek f85a3e41aa Track changes in separate files
Keep the changelog for each version in a separate source file to avoid
rebase conflicts when handling the -S version.
2024-09-24 16:11:08 +02:00
Ondřej Surý aed7f552d5 chg: dev: Use libuv functions to get memory available to BIND 9
This change uses uv_get_available_memory() if available with fallback
to uv_get_constrained_memory() with fallback to uv_get_total_memory().

Merge branch 'ondrej/use-uv_get_available_memory' into 'main'

See merge request isc-projects/bind9!9527
2024-09-24 13:51:55 +00:00
Ondřej Surý 06e5ada4be Use libuv functions to get memory available to BIND 9
This change uses uv_get_total_memory() to get the memory available to
BIND 9 with possible modification by uv_get_constrained_memory() if the
libuv version is recent enough to honour constraints created by
f.e. cgroups.
2024-09-24 15:51:14 +02:00
Nicki Křížek 0d0d61ce3c chg: ci: Increase the load TCP/DoT shotgun perf tests
Due to the recent improvements to the TCP processing, much higher loads
can be handled by BIND9 without causing client timeouts. The updated
parameters give us useful data for both cold and hot cache testing.

Merge branch 'nicki/increase-tcp-dot-shotgun-load' into 'main'

See merge request isc-projects/bind9!9494
2024-09-24 11:15:12 +00:00
Nicki Křížek e89afd3349 Increase the load TCP/DoT shotgun perf tests
Due to the recent improvements to the TCP processing, much higher loads
can be handled by BIND9 without causing client timeouts. The updated
parameters give us useful data for both cold and hot cache testing.
2024-09-24 09:27:14 +02:00
Mark Andrews 467f9bf5c5 fix: test: Check read value in upforwd/ans4
The ans4 server wasn't shutting down cleanly sometimes.  Check that read returns the
expected value for the message length or exit read loop.

Closes #4301

Merge branch '4301-check-read-value-in-ans4' into 'main'

See merge request isc-projects/bind9!9537
2024-09-24 07:26:27 +00:00
Mark Andrews 21baad0a8f Check read value in upforwd/ans4
The ans4 server wasn't shutting down cleanly sometimes.  Check that
read returns the expected value for the message length or exit read
loop.
2024-09-24 05:33:06 +00:00
Michal Nowak 30b6ac4192 chg: test: Downgrade "timeout" and "attempts" arguments in shutdown
The shutdown system test sends queries when named is shutting down, not
in an attempt to get answers but to destabilize the server into a crash.
With isctest.query.udp() defaulting to try up to ten times with a
ten-second timeout to get a response we don't care about from a likely
terminated server, we make the test run much longer than needed because
of retries and long timeouts.

Also, see isc-projects/bind9#4943.

Merge branch 'mnowak/shutdown-downgrade-timeout-and-attempts-arguments' into 'main'

See merge request isc-projects/bind9!9507
2024-09-23 15:39:16 +00:00
Michal Nowak 1c637e96d1 Print correct udp/tcp function name in generic_query() 2024-09-23 13:06:42 +00:00
Michal Nowak 463ab2f3f5 Downgrade "timeout" and "attempts" arguments in shutdown
The shutdown system test sends queries when named is shutting down, not
in an attempt to get answers but to destabilize the server into a crash.
With isctest.query.udp() defaulting to try up to ten times with a
ten-second timeout to get a response we don't care about from a likely
terminated server, we make the test run much longer than needed because
of retries and long timeouts.
2024-09-23 13:06:42 +00:00
Michal Nowak 59cce28320 chg: ci: Exclude some RPZ files from long stress test artifacts
This fixes 6f86885304, that excluded files
only from short stress tests.

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

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

See merge request isc-projects/bind9!9522
2024-09-23 11:20:10 +00:00
Michal Nowak 871eeed519 Exclude some RPZ files from long stress test artifacts
This fixes 6f86885304, that excluded files
only from short stress tests.
2024-09-23 11:19:35 +00:00
Ondřej Surý 59e85a022d chg: dev: Use uv_available_parallelism() if available
Instead of cooking up our own code for getting the number of available
CPUs for named to use, make use of uv_available_parallelism() from
libuv >= 1.44.0.

Merge branch 'ondrej/use-uv_available_parallelism-if-available' into 'main'

See merge request isc-projects/bind9!9524
2024-09-21 11:31:26 +00:00
Ondřej Surý 31458d405a Add support to read number of online CPUs on OpenBSD
The OpenBSD doesn't have sysctlbyname(), but sysctl() can be used to
read the number of online/available CPUs by reading following MIB(s):
[CTL_HW, HW_NCPUONLINE] with fallback to [CTL_HW, HW_NCPU].
2024-09-21 12:38:33 +02:00
Ondřej Surý 3a91c0a4e3 Cleanup the sysctlbyname and friends configure checks and ifdefs
Cleanup various checks and cleanups that are available on the all
platforms like sysctlbyname() and various related <sys/*.h> headers
that are either defined in POSIX or available on Linux and all BSDs.
2024-09-21 12:38:33 +02:00
Ondřej Surý 26e7358b16 Use uv_available_parallelism() if available
Instead of cooking up our own code for getting the number of available
CPUs for named to use, make use of uv_available_parallelism() from
libuv >= 1.44.0.
2024-09-21 12:38:33 +02:00
Ondřej Surý f0accc8f61 fix: usr: Fix long-running incoming transfers
Incoming transfers that took longer than 30 seconds would stop reading from the TCP stream and the incoming transfer would be indefinitely stuck causing BIND 9 to hang during shutdown.

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

Closes #4949

Merge branch '4949-fix-ignored-and-invalid-dispatch-timeout-in-dns_xfrin' into 'main'

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

Call the dns_dispatch_add() without a timeout and properly handle the
result code from the dns_dispatch_getnext().
2024-09-21 10:15:47 +02:00
Ondřej Surý 0f810b3144 Modify dns_dispatch API to accept zero timeout
The dns_dispatch_add() has timeout parameter that could not be 0 (for
not timeout).  Modify the dns_dispatch implementation to accept a zero
timeout for cases where the timeouts are undesirable because they are
managed externally.
2024-09-21 10:15:37 +02:00
Ondřej Surý 1dd4310082 chg: ci: Update code formatting
Merge branch 'nicki/update-code-format' into 'main'

See merge request isc-projects/bind9!9533
2024-09-21 07:16:00 +00:00
Nicki KřížekandOndřej Surý 28d4e866c7 Ignore clang-format reformatting commit 2024-09-21 08:39:43 +02:00
Nicki Křížek 833ea7926c Fix arguments-renamed pylint issue in iscconf.py
The argument name was different in the base class.
2024-09-20 17:26:33 +02:00
Nicki Křížek ebb5bd9c0f Update code formatting
clang 19 was updated in the base image.
2024-09-20 17:26:33 +02:00
Nicki Křížek 28badd8ed4 chg: dev: Restore the number of threadpool threads back to original value
The issue of long-running operations potentially blocking query resolution has been fixed. Revert this temporary workaround and restore the number of threadpool threads.

Related #4898

Merge branch '4898-remove-workaround-and-note' into 'main'

See merge request isc-projects/bind9!9530
2024-09-20 14:47:24 +00:00
Nicki Křížek 9fc773ce4c Remove fixed known issue [GL #4898] 2024-09-20 14:31:57 +02:00
Nicki Křížek 842abe9fbf Revert "Double the number of threadpool threads"
This reverts commit 6857df20a4.
2024-09-20 14:31:25 +02:00
Nicki Křížek 958d306f52 chg: doc: Update sphinx to 7.4.7
Merge branch 'nicki/update-sphinx' into 'main'

See merge request isc-projects/bind9!9529
2024-09-20 12:02:32 +00:00
Nicki Křížek 3d65fa2740 Update sphinx to 7.4.7 2024-09-20 14:01:03 +02:00
Mark Andrews a4b9625196 new: usr: Log query response status to the query log
Log a query response summary using the new category `responses`.  Logging can be controlled by the option `responselog` and `rndc responselog`.

Closes #459

Merge branch '459-log-query-response-status' into 'main'

See merge request isc-projects/bind9!9449
2024-09-19 23:09:07 +00:00
Mark Andrews 452db02c19 Document 'responselog' in the ARM 2024-09-19 21:44:06 +00:00
Mark Andrews 61415432ec Check responselog behaviour
Extends the resolver system test to to check whether responses are
logged to the query log in addition to the queries.
2024-09-19 21:44:06 +00:00
Petr MenšíkandMark Andrews e6b19af2dd Move common flags logging to shared functions
Query and response log shares the same flags. Move flags logging out of
log_query to share it with log_response. Use buffer instead of snprintf
to fill flags a bit faster.

Signed-off-by: Petr Menšík <pemensik@redhat.com>
2024-09-19 21:44:06 +00:00
Petr MenšíkandMark Andrews 6f879aba65 Make responselog flags similar to querylog
Remove answer flag from log, log instead count of records for each
message section. Include EDNS version and few flags of response. Add
also status of result.

Still does not include body of responses rrset.
2024-09-19 21:44:06 +00:00
Evan HuntandMark Andrews c4b7dce376 Reduce code duplication
combined named_server_togglequerylog() and
named_server_toggleresponselog() into named_server_setortoggle().
2024-09-19 21:44:06 +00:00
Mark Andrews 5fad79c92f Log the rcode returned to for a query
Log to the querylog the rcode of a previous query using
the identifier 'response:' to diffenciate queries from
responses.
2024-09-19 21:44:06 +00:00
Evan Hunt 9ab6de22a5 chg: minor cleanup in qpcache
when the QP cache was adapted from the RBTDB, some variable names weren't changed, and still incorrectly reference the RBT.

Merge branch 'each-qpcache-nits' into 'main'

See merge request isc-projects/bind9!9515
2024-09-19 21:42:33 +00:00
Evan Hunt 5a444838db rename 'rbtiterator' and similar names in qpcache
when the QP cache was adapted from the RBT database, some names
weren't changed. this could be confusing, so let's change them now.
also, we no longer need to include rbt.h.
2024-09-19 19:32:27 +00:00
Nicki Křížek 377831a290 Merge tag 'v9.21.1' 2024-09-18 18:02:41 +02:00
Ondřej Surý 20024a28c0 rem: usr: Remove DNSRPS implementation from the open-source version
DNSRPS was the API for a commercial implementation of Response-Policy
Zones that was supposedly better.  However, it was never open-sourced
and has only ever been available from a single vendor.  This goes against
the principle that the open-source edition of BIND 9 should contain only
features that are generally available and universal.

This commit removes the DNSRPS implementation from BIND 9.  It may be
reinstated in the subscription edition if there's enough interest from
customers, but it would have to be rewritten as a plugin (hook) instead
of hard-wiring it again in so many places.

Merge branch 'ondrej/remove-DNSRPS-from-open-source-edition' into 'main'

See merge request isc-projects/bind9!9358
2024-09-18 15:39:40 +00:00
Ondřej Surý 62d59766d6 Remove DNSRPS implementation
DNSRPS was the API for a commercial implementation of Response-Policy
Zones that was supposedly better.  However, it was never open-sourced
and has only ever been available from a single vendor.  This goes against
the principle that the open-source edition of BIND 9 should contain only
features that are generally available and universal.

This commit removes the DNSRPS implementation from BIND 9.  It may be
reinstated in the subscription edition if there's enough interest from
customers, but it would have to be rewritten as a plugin (hook) instead
of hard-wiring it again in so many places.
2024-09-18 17:39:14 +02:00
Ondřej Surý 4187ef28e2 fix: dev: Clean up DNSRPS
Addressed several build and test errors when DNSRPS is enabled.

Merge branch 'each-dnsrps-cleanup' into 'main'

See merge request isc-projects/bind9!9374
2024-09-18 15:38:11 +00:00
Evan HuntandOndřej Surý 98ae5dfc7e fix DNSRPS errors
silence some reported snprintf() overrun warnings that prevented
DNSRPS from building on some platforms.
2024-09-18 17:24:13 +02:00
Evan HuntandOndřej Surý dc13333957 use uv_dlopen() instead of dlopen() when linking DNSRPZ
take advantage of libuv's shared library handling capability
when linking to a DNSRPS library.  (see b396f55586 and 37b9511ce1
for prior related work.)
2024-09-18 17:24:13 +02:00
Ondřej Surý d7bff3c0f9 Remove old cruft from dnsrps code
There was some old cruft for ancient compilers checking for attributes
that we regularly use, etc.  Just remove the cruft.
2024-09-18 17:24:13 +02:00
Arаm Sаrgsyаn 796f886173 chg: usr: Set logging category for notify/xfer-in related messages
Some 'notify' and 'xfer-in' related log messages were logged at the
'general' category instead of their own category. This has been fixed.

Closes #2730

Merge branch '2730-logging-category-for-notify-and-xfer-related-messages' into 'main'

See merge request isc-projects/bind9!9451
2024-09-17 15:52:20 +00:00
Aram Sargsyan 7c45caa8a5 Set logging category for notify/xfer related messages
Some notify/xfer related log messages are logged at the general
category. Set a more suitable caterogry for those messages.
2024-09-17 15:08:40 +00:00
Ondřej Surý 3b26732781 fix: usr: Limit the outgoing UDP send queue size
If the operating system UDP queue gets full and the outgoing UDP sending
starts to be delayed, BIND 9 could exhibit memory spikes as it tries to
enqueue all the outgoing UDP messages.  Try a bit harder to deliver the
outgoing UDP messages synchronously and if that fails, drop the outgoing
DNS message that would get queued up and then timeout on the client side.

Closes #4930

Merge branch '4930-limit-the-UDP-send-queue' into 'main'

See merge request isc-projects/bind9!9506
2024-09-17 14:02:16 +00:00
Ondřej Surý b576c4c977 Limit the outgoing UDP send queue size
If the operating system UDP queue gets full and the outgoing UDP sending
starts to be delayed, BIND 9 could exhibit memory spikes as it tries to
enqueue all the outgoing UDP messages.  As those are not going to be
delivered anyway (as we argued when we stopped enlarging the operating
system send and receive buffers), try to send the UDP messages directly
using `uv_udp_try_send()` and if that fails, drop the outgoing UDP
message.
2024-09-17 14:02:03 +00:00
Ondřej Surý ddec5beb90 dev: Ignore commit that reformatted sh script in git blame
Merge branch 'ondrej/ignore-shfmt-git-blame' into 'main'

See merge request isc-projects/bind9!9510
2024-09-17 11:44:49 +00:00
Ondřej Surý 40548e7177 Ignore commit that reformatted sh script in git blame 2024-09-17 13:42:53 +02:00
Alessio Podda f93934dea7 fix: usr: Do not set SO_INCOMING_CPU
We currently set SO_INCOMING_CPU incorrectly, and testing by Ondrej
shows that fixing the issue by setting affinities is worse than letting
the kernel schedule threads without constraints. So we should not set
SO_INCOMING_CPU anymore.

Closes #4936

Merge branch '4936-remove-so-incoming-cpu' into 'main'

See merge request isc-projects/bind9!9497
2024-09-16 12:56:25 +00:00
alessio 8b8149cdd2 Do not set SO_INCOMING_CPU
We currently set SO_INCOMING_CPU incorrectly, and testing by Ondrej
shows that fixing the issue and setting affinities is worse than letting
the kernel schedule threads without constraints. So we should not set
SO_INCOMING_CPU anymore.
2024-09-16 12:18:22 +00:00
Arаm Sаrgsyаn 3efa17ee01 new: usr: Implement the ForwardOnlyFail statistics channel counter
The new ForwardOnlyFail statistics channel counter indicates the
number of queries failed due to bad forwarders for 'forward only'
zones.

Related to #1793

Merge branch 'aram/add-new-stats-channel-counter-forwardonlyfail' into 'main'

See merge request isc-projects/bind9!9498
2024-09-16 12:17:42 +00:00
Aram Sargsyan 136ed023fd Update the statistics channel check in the forward system test
Check that the ForwardOnlyFail increases as expected.
2024-09-16 09:31:14 +00:00
Aram Sargsyan 00a3d91e2d Document the ForwardOnlyFail statistics channel counter
Update ARM with the information about the new ForwardOnlyFail
counter.
2024-09-16 09:31:14 +00:00
Aram Sargsyan a018b4e36f Implement the ForwardOnlyFail statistics channel counter
The new ForwardOnlyFail statistics channel counter indicates the
number of queries failed due to bad forwarders for 'forward only'
zones.
2024-09-16 09:31:14 +00:00
Arаm Sаrgsyаn b82957376d fix: usr: Fix a statistics channel counter bug when 'forward only' zones are used
When resolving a zone with a 'forward only' policy, and
finding out that all the forwarders are marked as "bad",
the 'ServerQuota' counter of the statistics channel was
incorrectly increased. This has been fixed.

Closes #1793

Merge branch '1793-serverquota-counter-bug-with-forward-only' into 'main'

See merge request isc-projects/bind9!9493
2024-09-16 09:30:56 +00:00
Aram Sargsyan 81b3c5d908 Add a statistics channel check in the forward system test
Check that the fix in the previous commit works and that the
'ServerQuota' counter in the statistics channel is still unset
after a SERVFAIL result in a 'forward only' zone.
2024-09-16 08:23:12 +00:00
Aram Sargsyan e430ce7039 Fix a 'serverquota' counter calculation bug
The 'all_spilled' local variable in resolver.c:fctx_getaddresses()
is 'true' by default, and only becomes false when there is at least
one successfully found NS address. However, when a 'forward only;'
configuration is used, the code jumps over the part where it looks
for NS addresses and doesn't reset the 'all_spilled' to false, which
results in incorretly increased 'serverquota' statistics variable,
and also in invalid return error code from the function. The result
code error didn't make any differences, because all codes other than
'ISC_R_SUCCESS' or 'DNS_R_WAIT' were treated in the same way, and
the result code was never logged anywhere.

Set the default value of 'all_spilled' to 'false', and only make it
'true' before actually starting to look up NS addresses.
2024-09-16 08:23:12 +00:00
Mark Andrews f466e32fdb chg: dev: Remove statslock from dnssec-signzone
Silence Coverity CID 468757 and 468767 (DATA RACE read not locked) by converting dnssec-signzone to use atomics for statistics counters rather than using a lock.

Closes #4939

Merge branch '4939-remove-stats-lock-from-dnssec-signzone' into 'main'

See merge request isc-projects/bind9!9496
2024-09-16 02:49:11 +00:00
Mark Andrews 473cbd4e87 Remove 'statslock' from dnssec-signzone
Silence Coverity CID 468757 and 468767 (DATA RACE read not locked)
by converting dnssec-signzone to use atomics for statistics counters
rather than using a lock.  This should be marginally faster than
using the lock as well when statistics are requested.
2024-09-13 13:30:34 +10:00
Ondřej Surý 23b2ce56e5 fix: usr: Separate DNSSEC validation from the long-running tasks
As part of the KeyTrap \[CVE-2023-50387\] mitigation, the DNSSEC CPU-intensive operations were offloaded to a separate threadpool that we use to run other tasks that could affect the networking latency.

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

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

Closes #4898

Merge branch '4898-move-offloaded-DNSSEC-to-own-threads' into 'main'

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

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

As this is undesireable, this commit moves the CPU-intensive operations
from the isc_work API to the isc_helper API that only runs fast memory
cleanups now.
2024-09-12 12:09:45 +00:00
Ondřej Surý 6370e9b311 Add isc_helper API that adds 1:1 thread for each loop
Add an extra thread that can be used to offload operations that would
affect latency, but are not long-running tasks; those are handled by
isc_work API.

Each isc_loop now has matching isc_helper thread that also built on top
of uv_loop.  In fact, it matches most of the isc_loop functionality, but
only the `isc_helper_run()` asynchronous call is exposed.
2024-09-12 12:09:45 +00:00
Michal Nowak 91bc0b439a chg: test: Replace dns.resolver module in system tests
Closes #4634

Merge branch '4634-drop-dns.resolver-module-from-system-tests' into 'main'

See merge request isc-projects/bind9!9150
2024-09-12 09:57:22 +00:00
Michal Nowak 8b55d0709d Extract dns.rcode compatibility code to isctest.compat 2024-09-12 11:42:22 +02:00
Michal Nowak d2e0043ec3 Turn off deadline for wildcard tests
Tests that query BIND need much longer deadline to account for retries,
the default 200ms won't work.
2024-09-12 11:42:22 +02:00
Michal Nowak 2cec1de43b Extract "custom" named instances support to isctest.run module 2024-09-12 11:42:22 +02:00
Michal Nowak 5929ba0f54 Rework query functions to retry by default 2024-09-12 11:42:22 +02:00
Michal Nowak cb3ffac9a7 Deprecate dns.resolver module in BIND 9 system tests 2024-09-12 11:42:22 +02:00
Michal Nowak bfe338b965 Replace dns.resolver module in system tests 2024-09-12 11:42:22 +02:00
Arаm Sаrgsyаn 3808567de1 fix: dev: Fix data race in offloaded dns_message_checksig()
When verifying a message in an offloaded thread there is a race with
the worker thread which writes to the same buffer. Clone the message
buffer before offloading.

Closes #4929

Merge branch '4929-data-race-in-dns_dnssec_verifymessage-memmove' into 'main'

See merge request isc-projects/bind9!9481
2024-09-12 09:08:59 +00:00
Aram Sargsyan 35ef25e5ea Fix data race in offloaded dns_message_checksig()
When verifying a message in an offloaded thread there is a race with
the worker thread which writes to the same buffer. Clone the message
buffer before offloading.
2024-09-12 09:08:35 +00:00
Nicki Křížek 149b3d552e chg: doc: Add CWE category to the security issue template
Merge branch 'vicky-main-patch-72181' into 'main'

See merge request isc-projects/bind9!9482
2024-09-12 08:51:36 +00:00
Vicky RiskandNicki Křížek f47bc5923f Add CWE category to Internal_use_only-CVE.md template 2024-09-12 10:51:18 +02:00
Alessio Podda dc3578ee84 rem: usr: Remove "port" from source address options
Remove the use of "port" when configuring query-source(-v6),
transfer-source(-v6), notify-source(-v6), parental-source(-v6),
etc. Remove the use of source ports for parental-agents.

Also remove the deprecated options use-{v4,v6}-udp-ports and
avoid-{v4,v6}udp-ports.

Closes #3843

Merge branch '3843-remove-deprecated-source-port-options' into 'main'

See merge request isc-projects/bind9!9469
2024-09-12 07:45:18 +00:00
alessio da0e48b611 Remove "port" from source address options
Remove the use of "port" when configuring query-source(-v6),
transfer-source(-v6), notify-source(-v6), parental-source(-v6),
etc. Remove the use of source ports for parental-agents.

Also remove the deprecated options use-{v4,v6}-udp-ports and
avoid-{v4,v6}udp-ports.
2024-09-12 08:15:58 +02:00
Mark Andrews 0d4accd07f fix: usr: Don't allow statistics-channel if libxml2 and libjson-c are unsupported
When the libxml2 and libjson-c libraries are not supported, the statistics channel can't return anything useful, so it is now disabled. Use of `statistics-channel` in `named.conf` is a fatal error.

Closes #4895

Merge branch '4895-link-style-sheet-to-libxml2-support' into 'main'

See merge request isc-projects/bind9!9423
2024-09-12 03:27:10 +00:00
Mark Andrews b9246418e8 Fix named-checkconf and statistics-channels
If neither libxml2 nor libjson_c are available have named-checkconf
fail if a statistics-channels block is specified.
2024-09-12 09:21:44 +10:00
Mark Andrews d0c8c6d7ef Only configure statistics-channels if supported 2024-09-12 09:21:44 +10:00
Mark Andrews 31650d9440 Don't create the HTTP server if libxml and libjson-c are unavailable 2024-09-12 09:21:44 +10:00
Mark Andrews ed81b3ae93 Don't return the style sheet unless libxml2 is supported
If not statistics are available we don't want the style sheet
returned.
2024-09-12 09:21:44 +10:00
Mark Andrews 29263b115b fix: test: The statschannel tests fails if one of libxml2 or json-c is configured
The `statschannel` system test failed if only one of `libxml2` or `json-c` is
available / configured as checks were being run against the non available
statistics page.

Closes #4919

Merge branch '4919-fix-statschannel-system-test' into 'main'

See merge request isc-projects/bind9!9454
2024-09-11 23:05:34 +00:00
Mark Andrews 7de939609b Properly detect when libxml2 or json-c is not available 2024-09-11 20:51:24 +00:00
Nicki Křížek c6cb9d83dd [9.21] chg: doc: Review BIND ARM (9.18 updates)
Forward-port of !9375

Closes #4832

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

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

(cherry picked from commit b6e4b512dd)
2024-09-11 16:23:30 +02:00
Aydın Mercan 19b23b3ed8 new: doc: Document TCP4Clients/TCP6Clients
Future port the missing TCP4Clients/TCP6Clients documentation entry.

Commit abc47f5ce4 added two new statistics
counters without documenting them.  Add the missing counter descriptions
to the ARM.

(cherry picked from commit cb79240091)

Merge branch 'aydin/tcpclient-doc' into 'main'

See merge request isc-projects/bind9!9078
2024-09-11 10:06:37 +00:00
Aydın Mercan c62b6c82c0 make the tcp client counter documentation consistent with others 2024-09-11 12:51:34 +03:00
Aydın Mercan 3be2d25e54 alphabetically sort socket i/o counters 2024-09-11 12:51:34 +03:00
Michał KępieńandAydın Mercan 9bc152dd25 Document TCP4Clients/TCP6Clients
Commit abc47f5ce4 added two new statistics
counters without documenting them.  Add the missing counter descriptions
to the ARM.

(cherry picked from commit cb79240091)
2024-09-11 12:51:34 +03:00
Michal Nowak 0962fbd200 chg: ci: Update code formatting
clang 19 was updated in the base image.

Merge branch 'mnowak/fix-clang-format' into 'main'

See merge request isc-projects/bind9!9475
2024-09-11 09:28:55 +00:00
Mark Andrews 8ff039e3eb Update to ignore ff69d07fed 2024-09-11 15:08:37 +10:00
Michal Nowak ff69d07fed Update code formatting
clang 19 was updated in the base image.
2024-09-10 17:31:32 +02:00
Nicki Křížek b343484ddb chg: usr: allow IXFR-to-AXFR fallback on DNS_R_TOOMANYRECORDS
This change allows fallback from an IXFR failure to AXFR when the reason is `DNS_R_TOOMANYRECORDS`. This is because this error condition could be temporary only in an intermediate version of IXFR transactions and it's possible that the latest version of the zone doesn't have that condition. In such a case, the secondary would never be able to update the zone (even if it could) without this fallback.

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

Closes #4928

Merge branch 'fallback-ixfr-to-axfr-on-toomanyrecords' into 'main'

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

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

This change also fixes a minor glitch that DNS_R_TOOMANYRECORDS wasn't
logged in xfrin_fail.
2024-09-10 14:02:38 +02:00
Arаm Sаrgsyаn 6bb4070685 fix: usr: Fix assertion failure when processing access control lists
The named process could terminate unexpectedly when processing ACL. This has been fixed.

Closes #4908

Merge branch '4908-acl-assertion-failure' into 'main'

See merge request isc-projects/bind9!9458
2024-09-10 10:33:56 +00:00
Aram Sargsyan 0367c60759 Fix RCU API usage in acl.c
The rcu_xchg_pointer() function can be used outside of a critical
section, and usually must be followed by a synchronize_rcu() or
call_rcu() call to detach from the resource, unless if there are
some guarantees in place because of our own reference counting.
2024-09-10 09:54:20 +00:00
Mark Andrews 0d2482c62e new: usr: Add flag to named-checkconf to ignore "not configured" errors
`named-checkconf` now takes "-n" to ignore "not configured" errors. This allows named-checkconf to check the syntax of configurations from other builds which have support for more options.

Merge branch '4913-add-option-to-named-checkconf-to-override-notconfigured-flag' into 'main'

See merge request isc-projects/bind9!9446
2024-09-10 00:08:51 +00:00
Mark Andrews 61faffd06f Add flag to named-checkconf to ignore "not configured" errors
named-checkconf now takes "-n" to ignore "not configured" errors.
This allows named-checkconf to check the syntax of configurations
from other builds which have support for more options.
2024-09-09 23:32:16 +00:00
Nicki Křížek 004a5329e2 chg: test: Remove test.skr unit test file
This file was initially created for unit testing, but later code was added to generate the file. The static file should have been removed from the git repo.

Closes #4916

Merge branch '4916-skr-unit-test-rm-test-file' into 'main'

See merge request isc-projects/bind9!9450
2024-09-09 17:41:34 +00:00
Matthijs MekkingandNicki Křížek 903534c9a9 Remove test.skr unit test file
This file was initially created for unit testing, but later code was
added to generate the file. The static file should have been removed
from the git repo.
2024-09-09 19:41:03 +02:00
Nicki Křížek 3f61f69c52 chg: doc: Set up version for BIND 9.21.2
Merge branch 'nicki/set-up-version-for-bind-9.21.2' into 'main'

See merge request isc-projects/bind9!9462
2024-09-09 17:23:50 +00:00
Nicki Křížek 7ba966ee9a Update BIND version to 9.21.2-dev 2024-09-09 19:15:54 +02:00
Nicki Křížek 2e24083c79 Update BIND version for release 2024-09-09 15:04:19 +02:00
Nicki Křížek 30ac92318c new: doc: Prepare documentation for BIND 9.21.1
Merge branch 'nicki/prepare-documentation-for-bind-9.21.1' into 'v9.21.1-release'

See merge request isc-private/bind9!737
2024-09-09 12:58:59 +00:00
Nicki Křížek bd944476d2 Tweak and reword release notes 2024-09-06 15:48:07 +02:00
Nicki Křížek 0d97fe02bc Fix dnssec-policy options formatting and links in ARM
The statements that already exist in the grammar can't be created with
the namedconf:statement. Use a plain definition list for these
statements and add a manual anchor for each one so links to them can be
created.

Avoid using the :any: syntax in the definition lists, as that just
creates a link to the duplicate and completely unrelated statement,
which just makes the documentation more confusing.
2024-09-06 15:48:07 +02:00
Nicki Křížek c779edf78b Add Known Issue [#GL 4898] 2024-09-06 15:48:07 +02:00
Nicki Křížek 0314131499 Remove a fixed known issue [GL #4793] 2024-09-06 15:08:29 +02:00
Nicki Křížek 466939abcf Prepare release notes for BIND 9.21.1 2024-09-06 15:08:29 +02:00
Nicki Křížek 95b824f505 Generate release notes 2024-09-06 15:08:29 +02:00
Nicki Křížek fadea7dd2f Generate changelog 2024-09-06 15:08:29 +02:00
Nicki Křížek cfdded4667 chg: dev: Double the number of threadpool threads
Introduce this temporary workaround to reduce the impact of long-running
tasks in offload threads which can block the resolution of queries.

Related isc-projects/bind9#4898

Merge branch '4898-workaround-double-threadpool-threads' into 'v9.21.1-release'

See merge request isc-private/bind9!740
2024-09-06 13:03:20 +00:00
Nicki Křížek 6857df20a4 Double the number of threadpool threads
Introduce this temporary workaround to reduce the impact of long-running
tasks in offload threads which can block the resolution of queries.
2024-09-06 14:15:21 +02:00
Matthijs Mekking 3e11c4a873 fix: usr: Fix bug in Offline KSK that is using ZSK with unlimited lifetime
If the ZSK has unlimited lifetime, the timing metadata "Inactive" and "Delete" cannot be found and is treated as an error, preventing the zone to be signed. This has been fixed.

Closes #4914

Merge branch '4914-offline-ksk-zsk-lifetime-unlimited-bug' into 'main'

See merge request isc-projects/bind9!9447
2024-09-04 14:40:02 +00:00
Nicki Křížek 31245213a0 fix: usr: Fix an assertion failure in validate_dnskey_dsset_done()
Under rare circumstances, named could terminate unexpectedly
when validating a DNSKEY resource record if the validation
was canceled in the meantime. This has been fixed.

Closes isc-projects/bind9#4911

Merge branch '4911-assertion-failure-in-validate_dnskey_dsset_done' into 'v9.21.1-release'

See merge request isc-private/bind9!731
2024-09-04 14:18:25 +00:00
Matthijs Mekking 911daeb306 Nit logging change
Fix wrong function name (dns_dnssec_keymgr -> dns_keymgr_run).

Add error log if dns_keymgr_offline() fails.
2024-09-03 12:01:21 +02:00
Matthijs Mekking 5af53a329f Fix bug in dns_keymgr_offline
If the ZSK has lifetime unlimited, the timing metadata "Inactive" and
"Delete" cannot be found and is treated as an error. Fix by allowing
these metadata to not exist.
2024-09-03 11:57:56 +02:00
Aram Sargsyan d85918aebf Process canceled/shut down results in validate_dnskey_dsset_done()
When a validator is already shut down, val->name becomes NULL. We
need to process and keep the ISC_R_CANCELED or ISC_R_SHUTTINGDOWN
result code before calling validate_async_done(), otherwise, when it
is called with the hardcoded DNS_R_NOVALIDSIG result code, it can
cause an assetion failure when val->name (being NULL) is used in
proveunsecure().
2024-09-02 15:40:30 +00:00
Evan Hunt 8a09d54d6b fix: usr: Delay release of root privileges until after configuring controls
Delay relinquishing root privileges until the control channel has been configured, for the benefit of systems that require root to use privileged port numbers.  This mostly affects systems without fine-grained privilege systems (i.e., other than Linux).

Closes #4793

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

Closes #4793

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

named_os_changeuser() now takes a boolean argument 'permanent'.
This allows us to switch the effective userid temporarily with
named_os_changeuser(false) and restore it with named_os_restoreuser(),
before permanently dropping privileges with named_os_changeuser(true).
2024-08-29 10:34:38 -07:00
Ondřej Surý 9afcdc2b18 chg: usr: Follow the number of CPU set by taskset/cpuset
Administrators may wish to constrain the set of cores that BIND 9 runs on via the 'taskset', 'cpuset' or 'numactl' programs (or equivalent on other O/S).

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

Closes #4884

Merge branch '4884-use-cpuset-to-get-number-of-cpus' into 'main'

Closes #4884

See merge request isc-projects/bind9!9398
2024-08-29 14:43:34 +00:00
Ondřej SurýandRay Bellis 5a2df8caf5 Follow the number of CPU set by taskset/cpuset
Administrators may wish to constrain the set of cores that BIND 9 runs
on via the 'taskset', 'cpuset' or 'numactl' programs (or equivalent on
other O/S), for example to achieve higher (or more stable) performance
by more closely associating threads with individual NIC rx queues. If
the admin has used taskset, it follows that BIND ought to
automatically use the given number of CPUs rather than the system wide
count.

Co-Authored-By: Ray Bellis <ray@isc.org>
2024-08-29 14:43:18 +00:00
Michal Nowak b65533beff chg: test: Bump max-recursion-queries to 100 in resolver system test
With max-recursion-queries set to 50 the resolver system test was
unstable in the "checking query resolution for a domain with a valid
glueless delegation chain" check as ns1 replied with SERVFAIL.

Closes #4897

Merge branch '4897-resolver-ns1-max-recursion-queries-100' into 'main'

Closes #4897

See merge request isc-projects/bind9!9435
2024-08-29 14:38:06 +00:00
Michal Nowak 8e0244d300 Bump max-recursion-queries to 100 in resolver system test
With max-recursion-queries set to 50 the resolver system test was
unstable in the "checking query resolution for a domain with a valid
glueless delegation chain" check as ns1 replied with SERVFAIL.
2024-08-29 14:37:37 +00:00
Mark Andrews 78d48f7ae2 fix: chg: Improve performance when looking for the closest encloser when returning NSEC3 proofs
Use the fact that the database returns the longest matching part of the requested name to find the required NSEC3 record. If there are multiple versions present in the database we may have to search further.

Closes #4460

Merge branch '4460-auth-nsec3-many-labels' into 'main'

Closes #4460

See merge request isc-projects/bind9!9436
2024-08-29 13:24:09 +00:00
Mark Andrews d42ea08f16 Return partial match when requested
Return partial match from dns_db_find/dns_db_find when requested
to short circuit the closest encloser discover process.  Most of the
time this will be the actual closest encloser but may not be when
there yet to be committed / cleaned up versions of the zone with
names below the actual closest encloser.
2024-08-29 12:48:20 +00:00
Mark Andrews 7ea6b16d0d fix: Accessing fctx->state without holding lock
Move lock earlier in the call sequence to address access without lock report.

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

Closes #4902

Merge branch '4902-accessing-fctx-state-without-holding-lock' into 'main'

Closes #4902

See merge request isc-projects/bind9!9427
2024-08-29 12:46:12 +00:00
Mark Andrews 43f0b0e8eb Move lock earlier in the call sequence
fctx->state should be read with the lock held.

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

    CID 468796: (#1 of 1): Data race condition (MISSING_LOCK)
    1. missing_lock: Accessing fctx->state without holding lock fetchctx.lock.
       Elsewhere, fetchctx.state is written to with fetchctx.lock held 2 out of 2 times.
    1562        REQUIRE(fctx->state == fetchstate_done);
    1563
    1564        FCTXTRACE("sendevents");
    1565
    1566        LOCK(&fctx->lock);
    1567
2024-08-29 04:33:56 +00:00
Mark Andrews 15b2f0125d fix: Address potential TSAN issue with find->status
find->status is a private field of dns_adbfind_t so it now has an accessor function and has been made atomic.

Closes #4802

Merge branch '4802-address-potential-tsan-issue-with-find-status' into 'main'

Closes #4802

See merge request isc-projects/bind9!9137
2024-08-29 03:58:50 +00:00
Mark Andrews a45e39d114 Use atomics to access find->status 2024-08-28 22:42:16 +00:00
Mark Andrews c900300f21 Use an accessor fuction to access find->status
find->status is marked as private and access is controlled
by find->lock.
2024-08-28 22:42:16 +00:00
Michal Nowak d32b65b699 chg: ci: Generate TSAN stress test
Merge branch 'mnowak/generate-tsan-stress-jobs' into 'main'

See merge request isc-projects/bind9!9334
2024-08-28 09:39:32 +00:00
Michal Nowak 338d4c8dd3 Generate TSAN stress test 2024-08-28 11:01:11 +02:00
Michal Nowak fa5d85f29d chg: ci: Cleanup stress test artifacts
Merge branch 'mnowak/avoid-some-artifacts-in-stress-tests' into 'main'

See merge request isc-projects/bind9!9424
2024-08-28 07:58:03 +00:00
Michal Nowak 6f86885304 Some stress test artifacts should not be saved in CI artifact 2024-08-27 12:56:04 +02:00
Arаm Sаrgsyаn 4cd73e2536 chg: usr: Exempt prefetches from the fetches-per-zone and fetches-per-server quotas
Fetches generated automatically as a result of 'prefetch' are now
exempt from the 'fetches-per-zone' and 'fetches-per-server' quotas.
This should help in maintaining the cache from which query responses
can be given.

Closes #4219

Merge branch '4219-exempt-good-queries-from-fetch-limits' into 'main'

Closes #4219

See merge request isc-projects/bind9!9095
2024-08-26 15:50:50 +00:00
Aram Sargsyan ad329ddcaa Document that prefeteches are exempt from select quotas
Add notes to the 'fetches-per-zone' and 'fetches-per-server' clauses
documentation to document that prefetches are exempted.
2024-08-26 15:50:21 +00:00
Aram Sargsyan c7e8b7cf63 Exempt prefetches from the fetches-per-server quota
Give prefetches a free pass through the quota so that the cache
entries for popular zones could be updated successfully even if the
quota for is already reached.
2024-08-26 15:50:21 +00:00
Aram Sargsyan cada2de31f Exempt prefetches from the fetches-per-zone quota
Give prefetches a free pass through the quota so that the cache entry
for a popular zone could be updated successfully even if the quota for
it is already reached.
2024-08-26 15:50:21 +00:00
Ondřej Surý f99da39934 fix: dev: Stop using malloc_usable_size and malloc_size
The `malloc_usable_size()` can return size larger than originally allocated and when these sizes disagree the fortifier enabled by `_FORTIFY_SOURCE=3` detects overflow and stops the `named` execution abruptly.  Stop using these convenience functions as they are primary used for introspection-only.

Closes #4880

Merge branch '4880-dont-use-malloc_usable_size' into 'main'

Closes #4880

See merge request isc-projects/bind9!9400
2024-08-26 15:01:03 +00:00
Ondřej Surý d61712d14e Stop using malloc_usable_size and malloc_size
Although the nanual page of malloc_usable_size says:

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

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

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

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

Remove usage of both malloc_usable_size() and malloc_size() to be on the
safe size and only use the internal size tracking mechanism when
jemalloc is not available.
2024-08-26 15:00:44 +00:00
Michal Nowak b37c15d244 chg: ci: Drop removed system tests from cross-version-config-tests
The cross-version-config-tests job fails when a system test is removed
from the upcoming release. To avoid this, remove the system test also
from the $BIND_BASELINE_VERSION.

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

Merge branch 'mnowak/remove-dialup-from-cross-version-config-tests-job' into 'main'

See merge request isc-projects/bind9!9413
2024-08-26 14:28:47 +00:00
Michal Nowak 60f5f2a9d9 Drop removed system tests from $BIND_BASELINE_VERSION
The cross-version-config-tests job fails when a system test is removed
from the upcoming release. To avoid this, remove the system test also
from the $BIND_BASELINE_VERSION.
2024-08-26 13:41:47 +02:00
Petr Špaček 0b9ce9c05b fix: dev: Preserve statement tag order in documentation
This supports bit-for-bit reproducibility of built documentation.

Closes #4886

Merge branch 'issue-4886/order-preserving-documentation-tags' into 'main'

Closes #4886

See merge request isc-projects/bind9!9399
2024-08-23 13:57:31 +00:00
Petr Špaček 5b832126b3 Disallow duplicate statement tags in docs
I can't think of a use-case for them, so let's simplify code and treat
them as an invalid input.
2024-08-23 15:34:54 +02:00
James AddisonandPetr Špaček 5a79b36f56 Preserve de-duplicated tag order in documentation
The 'set' datatype in Python does not provide iteration-order
guarantees related to insertion-order.  That means that its
usage in the 'split_csv' helper function during documentation
build can produce nondeterministic results.

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

This patch implements order-preserving de-duplication of tags,
allowing authors to specify tags using intentional priority
ordering, while also removing tags that appear more than once.
2024-08-23 15:34:00 +02:00
Petr Špaček 5c5d4eb40a new: ci: Automate parts of MR workflow
Merge branch 'pspacek/post-merge-ci' into 'main'

See merge request isc-projects/bind9!9244
2024-08-23 07:50:22 +00:00
Petr Špaček 73b950dc29 Remove milestone check from dangerfile
Milestone is automatically set by 'merged-metadata' CI job to 'Not
released yet' so it does not matter what the original value was.
2024-08-23 07:38:27 +00:00
Petr Špaček 146743d5a3 Remove 'Release notes' label check from dangerfile
This label is now handled automatically by 'merged-metadata' CI job.
2024-08-23 07:38:27 +00:00
Petr Špaček edf0e6415a Remove 'No CHANGES' check from dangerfile
This label is now handled automatically by 'merged-metadata' CI job.
2024-08-23 07:38:27 +00:00
Petr Špaček d1c64d588b Automatically adjust MR metadata after merge
1. Set milestone to 'Not released yet' after merge
   We will set milestone to actual version number when we actually tag a
   particular version. This will get rid of mass MR reassignment when we
   do last minute changes to a release plan etc.

2. Adjust No CHANGES and Release Notes MR labels to match gitchangelog
   workflow.
2024-08-23 07:38:27 +00:00
Petr Špaček 3165261ecd Mark backports CI job as non-interruptible
Previously CI job for the autobackport bot inherited "interruptible:
true" global configuration. This caused premature termination of the job
when another merge was finished before the autobackport job ran to
completion.
2024-08-23 07:38:27 +00:00
Evan Hunt a133a33b65 rem: usr: Remove the 'dialup' and 'heartbeat-interval' options
The `dialup` and `heartbeat-interval` options have been removed, along with all code implementing them. Using these options is now a fatal error.

Closes #4237

Merge branch '4237-remove-dialup' into 'main'

Closes #4237

See merge request isc-projects/bind9!8160
2024-08-22 19:43:49 +00:00
Evan Hunt 642a1b985d remove the "dialup" and "heartbeat-interval" options
mark "dialup" and "heartbeat-interval" options as ancient and
remove the documentation and the code implementing them.
2024-08-22 11:11:10 -07:00
Arаm Sаrgsyаn 99b18bab7e new: usr: implement the 'request-ixfr-max-diffs' configuration option
The new 'request-ixfr-max-diffs' configuration option sets the
maximum number of incoming incremental zone transfer (IXFR) differences,
exceeding which triggers a full zone transfer (AXFR).

Closes #4389

Merge branch '4389-request-ixfr-max-diffs' into 'main'

Closes #4389

See merge request isc-projects/bind9!9094
2024-08-22 15:33:17 +00:00
Aram Sargsyan 397e007a8e Document the 'request-ixfr-max-diffs' configuration option
Document the new configuration option and its default value.
2024-08-22 13:42:27 +00:00
Aram Sargsyan 49505cb93d Test the 'request-ixfr-max-diffs' configuration option
Configure a maximum of 3 allowed differences and add 5 new records.
Check that named detected that the differences exceed the allowed
limit and successfully retries with AXFR.
2024-08-22 13:42:27 +00:00
Aram Sargsyan c05a823e8b Implement the 'request-ixfr-max-diffs' configuration option
This limits the maximum number of received incremental zone
transfer differences for a secondary server. Upon reaching the
confgiured limit, the secondary aborts IXFR and initiates a full
zone transfer (AXFR).
2024-08-22 13:42:27 +00:00
Mark Andrews d40b722d46 new: usr: Support restricted key tag range when generating new keys
It is useful when multiple signers are being used
to sign a zone to able to specify a restricted
range of range of key tags that will be used by an
operator to sign the zone.  This adds controls to
named (dnssec-policy), dnssec-signzone, dnssec-keyfromlabel and
dnssec-ksr (dnssec-policy) to specify such ranges.

Closes #4830

Merge branch '4830-support-restricted-key-tag-range-when-generating-new-keys' into 'main'

Closes #4830

See merge request isc-projects/bind9!9258
2024-08-22 12:55:46 +00:00
Mark Andrews bb653d37e0 Add bad dnssec-policy range variants test examples 2024-08-22 12:12:02 +00:00
Mark Andrews 62469afe71 Add a multi-signer where the key tag range changes 2024-08-22 12:12:02 +00:00
Mark Andrews 266530d473 Use key tag ranges when generating multisigner keys 2024-08-22 12:12:02 +00:00
Mark Andrews d165466125 Check that dnssec-keygen honours key tag ranges 2024-08-22 12:12:02 +00:00
Mark AndrewsandSuzanne Goldlust c088772191 Document dnssec-policy keys range directive
Co-authored-by: Suzanne Goldlust <sgoldlust@isc.org>
2024-08-22 12:12:02 +00:00
Mark Andrews e7decd7a65 Add good dnssec-policy tag-range variants test examples 2024-08-22 12:12:02 +00:00
Mark Andrews 035289be71 Check key tag range when matching dnssec keys to kasp keys 2024-08-22 12:12:02 +00:00
Mark Andrews c5bc0a1805 Add optional range directive to keys in dnssec-policy 2024-08-22 12:12:02 +00:00
Mark Andrews 25bf77fac6 Add the concept of allowed key tag ranges to kasp 2024-08-22 12:12:02 +00:00
Mark AndrewsandSuzanne Goldlust 0c347fb321 Document -M tag_min:tag_max
A new argument has been added to dnssec-keygen and dnssec-keyfromlabel
to restrict the tag value of key generated / imported to a particular
range.  This is intended to be used by multi-signers.

Co-authored-by: Suzanne Goldlust <sgoldlust@isc.org>
2024-08-22 12:12:02 +00:00
Mark Andrews 329e5eee9b Add restrict key tag range support
to dnssec-keygen and dnssec-keyfromlabel.
2024-08-22 12:12:02 +00:00
Michal Nowak 479c7d5a61 chg: ci: Revert "Workaround temporary cross-version-config-tests limitation"
With the release of BIND 9.19.25 this workaround is not needed anymore.

This reverts commit c58dd6e78f.

Merge branch 'mnowak/revert-workaround-temporary-cross-version-config-tests-limitation' into 'main'

See merge request isc-projects/bind9!9065
2024-08-22 10:20:04 +00:00
Michal Nowak 125059caef Revert "Workaround temporary cross-version-config-tests limitation"
With the release of BIND 9.19.25 this workaround is not needed anymore.

This reverts commit c58dd6e78f.
2024-08-22 10:19:52 +00:00
Matthijs Mekking 8dbd57116b fix: usr: Fix algoritm rollover bug when there are two keys with the same keytag
If there is an algorithm rollover and two keys of different algorithm share the same keytags, then there is a possibility that if we check that a key matches a specific state, we are checking against the wrong key. This has been fixed by not only checking for matching key tag but also key algorithm.

Closes #4878

Merge branch '4878-fix-algorithm-rollover-keytag-conflict-bug' into 'main'

Closes #4878

See merge request isc-projects/bind9!9381
2024-08-22 10:11:29 +00:00
Matthijs Mekking f37eb33f29 Fix algorithm rollover bug wrt keytag conflicts
If there is an algorithm rollover and two keys of different algorithm
share the same keytags, then there is a possibility that if we check
that a key matches a specific state, we are checking against the wrong
key.

Fix this by not only checking for matching key id but also key
algorithm.
2024-08-22 11:29:43 +02:00
Matthijs Mekking 7bb6d82505 Adjust kasp system test to get keys which signed
If there is a keytag conflict between keys with different algorithms,
we need to supply what key algorithm is used so we can get the right
public key.

For clarity, print the algorithm on the found keys after 'check_keys'.
2024-08-22 11:29:43 +02:00
Michal Nowak b9bb0528f6 chg: ci: Update Clang to version 19
These Clang 19-identified issues need to be addressed first:
- [x] isc-projects/bind9!9313
- [x] isc-projects/bind9!9317
- [x] isc-projects/bind9!9316
- [x] isc-projects/bind9!9315

Validation pipelines for backports:
- [x] ~"v9.21" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191211
- [x] ~"v9.20" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191512
- [x] ~"v9.18" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191904

Prereq: isc-projects/images!328

Merge branch 'mnowak/llvm-19' into 'main'

See merge request isc-projects/bind9!9296
2024-08-22 08:06:56 +00:00
Ondřej SurýandMichal Nowak 7b756350f5 Use clang-format-19 to update formatting
This is purely result of running:

    git-clang-format-19 --binary clang-format-19 origin/main
2024-08-22 09:21:55 +02:00
Michal Nowak ec62fc1399 Update Clang to version 19 2024-08-22 09:21:55 +02:00
Matthijs Mekking bfa206beec new: usr: Support for Offline KSK implemented
Add a new configuration option `offline-ksk` to enable Offline KSK key management. Signed Key Response (SKR) files created with `dnssec-ksr` (or other program) can now be imported into `named` with the new `rndc skr -import` command. Rather than creating new DNSKEY, CDS and CDNSKEY records and generating signatures covering these types, these records are loaded from the currently active bundle from the imported SKR. 

The implementation is loosely based on: https://www.iana.org/dnssec/archive/files/draft-icann-dnssec-keymgmt-01.txt

Closes #1128

Merge branch '1128-offline-ksk-rndc-import-skr' into 'main'

Closes #1128

See merge request isc-projects/bind9!9119
2024-08-22 07:15:00 +00:00
Matthijs Mekking d504f4f20b Add a section for Offline KSK to the DNSSEC Guide
This will describe in more detail the operational practices of
Offline KSK.
2024-08-22 08:21:53 +02:00
Matthijs Mekking 1ce163795e Add skr unit test
Add a test file for testing the skr related code.
2024-08-22 08:21:52 +02:00
Matthijs Mekking 2e3068ed60 Disable some behavior in offline-ksk mode
Some things we no longer want to do when we are in offline-ksk mode.

1. Don't check for inactive and private keys if the key is a KSK.
2. Don't update the TTL of DNSKEY, CDS and CDNSKEY RRset, these come
   from the SKR.
2024-08-22 08:21:52 +02:00
Matthijs Mekking 61cf599fbf Retrieve RRSIG from SKR
When it is time to generate a new signature (dns_dnssec_sign), rather
than create a new one, retrieve it from the SKR.
2024-08-22 08:21:52 +02:00
Matthijs Mekking 30d20b110e Don't read private key files for offline KSKs
When we are appending contents of a DNSKEY rdataset to a keylist,
don't attempt to read the private key file of a KSK when we are in
offline-ksk mode.
2024-08-22 08:21:52 +02:00
Matthijs Mekking 2190aa904f Update key states in offline-ksk mode
With offline-ksk enabled, we don't run the keymgr because the key
timings are determined by the SKR. We do update the key states but
we derive them from the timing metadata.

Then, we can skip a other tasks in offline-ksk mode, like DS checking
at the parent and CDS synchronization, because the CDS and CDNSKEY
RRsets also come from the SKR.
2024-08-22 08:21:52 +02:00
Matthijs Mekking 63e058c29e Apply SKR bundle on rekey
When a zone has a skr structure, lookup the currently active bundle
that contains the right key and signature material.
2024-08-22 08:21:52 +02:00
Matthijs Mekking 037382c4a5 Implement SKR import
When 'rndc skr import' is called, read the file contents and store the
data in the zone's skr structure.
2024-08-22 08:21:52 +02:00
Matthijs Mekking 445722d2bf Add code to store SKR
This added source code stores SKR data. It is loosely based on:
https://www.iana.org/dnssec/archive/files/draft-icann-dnssec-keymgmt-01.txt

A SKR contains a list of signed DNSKEY RRsets. Each change in data
should be stored in a separate bundle. So if the RRSIG is refreshed that
means it is stored in the next bundle. Likewise, if there is a new ZSK
pre-published, it is in the next bundle.

In addition (not mentioned in the draft), each bundle may contain
signed CDS and CDNSKEY RRsets.

Each bundle has an inception time. These will determine when we need
to re-sign or re-key the zone.
2024-08-22 08:21:52 +02:00
Matthijs Mekking afe093258c Test rndc skr import
Test importing a Signed Key Response. Files should be loaded and once
loaded the correct bundle should be used. Alsoe test cases where the
bundle is not the first bundle in the SKR.
2024-08-22 08:21:52 +02:00
Matthijs Mekking ecd2b79106 Add option to kasp.sh check_keys to retain found keys
This will come in handy when we are testing offline-ksk where first
we check for ZSKs and then the KSK.
2024-08-22 08:21:52 +02:00
Matthijs Mekking edbb219fda Implement dummy 'rndc skr -import' command
Add the code and documentation required to provide KSR import using
rndc.  This is just the command, and the feature is at this point in
time still not implemented.
2024-08-22 08:21:52 +02:00
Matthijs Mekking 748d98e387 Add a common setup script for ksr
The previous setup.sh has been moved to ns1/setup.sh, we need a common
setup script to invoke ns1/setup.sh.
2024-08-22 08:21:52 +02:00
Matthijs Mekking 367154c1de Update ksr system test to include server
Prepare the system test for tests that require a server to import
created SKR files. This means the test script needs adjustments to
take into account the directory test files are located.

In addition, the check_keys function is renamed to ksr_check_keys
because the name clashes with check_keys from kasp.sh. It also has an
extra parameter added, offset, that can be used to check ksr files that
are created in the past or future.
2024-08-22 08:21:52 +02:00
Matthijs Mekking 0598381236 Add offline-ksk option
Add a new configuration option to enable Offline KSK key management.

Offline KSK cannot work with CSK because it splits how keys with the
KSK and ZSK role operate. Therefore, one key cannot have both roles.
Add a configuration check to ensure this.
2024-08-22 08:21:52 +02:00
Mark Andrews 2299aba5c2 chg: dev: Restore the ability to select individual unit tests
This add the command line arguments: `-d` (debug), `-l` (list tests) and `-t test` (run this test) to the unit tests.

Closes #4579

Merge branch '4579-restore-the-ability-to-select-individual-unit-tests' into 'main'

Closes #4579

See merge request isc-projects/bind9!9384
2024-08-22 00:54:13 +00:00
Mark Andrews d8a6ff5c3e Extend ISC_TEST_MAIN for debugging
ISC_TEST_MAIN now supports turning on/off debugging and
running individual tests.
2024-08-22 09:54:39 +10:00
Michal Nowak 8d6b0bcc6b chg: ci: Add FreeBSD 14.1
Prereq: https://gitlab.isc.org/isc-projects/images/-/merge_requests/323

Merge branch 'mnowak/freebsd-14.1' into 'main'

See merge request isc-projects/bind9!9116
2024-08-21 16:28:48 +00:00
Michal Nowak bca3d09354 Add FreeBSD 14.1 2024-08-21 16:28:18 +00:00
Nicki Křížek 51d7c2973c chg: Merge 9.21.0 release branch
Merge branch 'main-merge-v9.21.0' into 'main'

Closes #4733

See merge request isc-projects/bind9!9378
2024-08-21 15:10:37 +00:00
Nicki Křížek 779de4ec34 Merge tag 'v9.21.0' 2024-08-21 16:23:09 +02:00
Ondřej Surý 14d2040934 fix: usr: Fix rare assertion failure when shutting down incoming transfer
A very rare assertion failure can be triggered when the incoming transfer is either forcefully shut down or it is finished during printing the details about the statistics channel.  This has been fixed.

Closes #4860

Merge branch '4860-destroy-xfrin-timers-on-the-loop' into 'main'

Closes #4860

See merge request isc-projects/bind9!9336
2024-08-21 11:56:10 +00:00
Ondřej Surý 3bca3cb5cf Destroy the dns_xfrin isc_timers on the correct loop
There are few places where we attach/detach from the dns_xfrin object
while running on a different thread than the zone's assigned thread -
xfrin_xmlrender() in the statschannel and dns_zone_stopxfr() to name the
two places where it happens now.  In the rare case, when the incoming
transfer completes (or shuts down) in the brief period between the other
thread attaches and detaches from the dns_xfrin, the isc_timer_destroy()
calls would be called by the last thread calling the xfrin_detach().
In the worst case, it would be this other thread causing assertion
failure.  Move the isc_timer_destroy() call to xfrin_end() function
which is always called on the right thread and to match this move
isc_timer_create() to xfrin_start() - although this other change makes
no difference.
2024-08-21 13:54:40 +02:00
Arаm Sаrgsyаn cf53eac46e new: usr: Print the full path of the working directory in startup log messages
named now prints its initial working directory during startup and the
changed working directory when loading or reloading its configuration
file if it has a valid 'directory' option defined.

Closes #4731

Merge branch '4731-log-workdir-full-path' into 'main'

Closes #4731

See merge request isc-projects/bind9!9362
2024-08-20 17:30:26 +00:00
Aram Sargsyan fd8e1d161f Print the full path of the working directory in startup log messages
named now prints its initial working directory during startup and the
changed working directory when loading or reloading its configuration
file if it has a valid 'directory' option defined.
2024-08-20 16:28:53 +00:00
Ondřej Surý 558ec133ea chg: dev: Use seteuid()/setegid() instead of setreseuid()/setresgid()
It looks like that all supported systems now have support for
_POSIX_SAVED_IDS, so it's safe to use setegid() and setegid() because
those will not change saved used/group IDs.

Closes #4862

Merge branch '4862-just-use-seteuid-and-setegid' into 'main'

Closes #4862

See merge request isc-projects/bind9!9363
2024-08-20 14:58:39 +00:00
Ondřej Surý ab517fc6e4 Use seteuid()/setegid() instead of setreseuid()/setresgid()
It looks like that all supported systems now have support for
_POSIX_SAVED_IDS, so it's safe to use setegid() and setegid() because
those will not change saved used/group IDs.
2024-08-20 14:58:27 +00:00
Ondřej Surý e44652a173 fix: test: Allow TTL skew in the badcache print unit test
If the machine running the job is extra loaded (or extra slow), the
print test in the badcache unit test would fail because the TTL would be
59 (possibly even lower) and the test expects the badcache.out to only
have TTL 60.  Refactor the test to check for the expected strings and
check whether the TTL is in the expected range.

Closes #4861

Merge branch '4861-allow-TTL-skew-in-badcache_test' into 'main'

Closes #4861

See merge request isc-projects/bind9!9338
2024-08-20 13:57:57 +00:00
Ondřej Surý 7860b6519d Allow TTL skew in the badcache print unit test
If the machine running the job is extra loaded (or extra slow), the
print test in the badcache unit test would fail because the TTL would be
59 (possibly even lower) and the test expects the badcache.out to only
have TTL 60.  Refactor the test to check for the expected strings and
check whether the TTL is in the expected range.
2024-08-20 15:55:35 +02:00
Ondřej Surý aa408051d6 chg: dev: Use single logging context for everything
Instead of juggling different logging context, use one single logging
context that gets initialized in the libisc constructor and destroyed in
the libisc destructor.

Closes #4848

Merge branch '4848-refactor-isc_log-api-to-use-single-global-logging-context' into 'main'

Closes #4848

See merge request isc-projects/bind9!9301
2024-08-20 12:56:04 +00:00
Evan HuntandOndřej Surý 520500d1b3 pause to let reloading complete
the rpz test frequently failed in DNSRPS mode and sometimes in native
mode as well because of an 'rndc reload' not being complete.
2024-08-20 12:50:39 +00:00
Ondřej Surý 679e90a57d Add isc_log_createandusechannel() function to simplify usage
The new
isc_log_createandusechannel() function combines following calls:

    isc_log_createchannel()
    isc_log_usechannel()

calls into a single call that cannot fail and therefore can be used in
places where we know this cannot fail thus simplifying the error
handling.
2024-08-20 12:50:39 +00:00
Ondřej Surý 091d738c72 Convert all categories and modules into static lists
Remove the complicated mechanism that could be (in theory) used by
external libraries to register new categories and modules with
statically defined lists in <isc/log.h>.  This is similar to what we
have done for <isc/result.h> result codes.  All the libraries are now
internal to BIND 9, so we don't need to provide a mechanism to register
extra categories and modules.
2024-08-20 12:50:39 +00:00
Ondřej Surý 8506102216 Remove logging context (isc_log_t) from the public namespace
Now that the logging uses single global context, remove the isc_log_t
from the public namespace.
2024-08-20 12:50:39 +00:00
Ondřej Surý 043f11de3f Remove isc_log_write1() and isc_log_vwrite1() functions
The isc_log_write1() and isc_log_vwrite1() functions were meant to
de-duplicate the messages sent to the isc_log subsystem.  However, they
were never used in an entire code base and the whole mechanism around it
was complicated and very inefficient.  Just remove those, there are
better ways to deduplicate syslog messages inside syslog daemons now.
2024-08-20 12:50:39 +00:00
Ondřej Surý b2dda86254 Replace isc_log_create/destroy with isc_logconfig_get()
Add isc_logconfig_get() function to get the current logconfig and use
the getter to replace most of the little dancing around setting up
logging in the tools. Thus:

    isc_log_create(mctx, &lctx, &logconfig);
    isc_log_setcontext(lctx);
    dns_log_setcontext(lctx);
    ...
    ...use lcfg...
    ...
    isc_log_destroy();

is now only:

    logconfig = isc_logconfig_get(lctx);
    ...use lcfg...

For thread-safety, isc_logconfig_get() should be surrounded by RCU read
lock, but since we never use isc_logconfig_get() in threaded context,
the only place where it is actually used (but not really needed) is
named_log_init().
2024-08-20 12:50:39 +00:00
Ondřej Surý a8a689531f Use single logging context for everything
Instead of juggling different logging context, use one single logging
context that gets initialized in the libisc constructor and destroyed in
the libisc destructor.

The application is still responsible for creating the logging
configuration before using the isc_log API.

This patch is first in the series in a way that it is transparent for
the users of the isc_log API as the isc_log_create() and
isc_log_destroy() are now thin shims that emulate the previous
functionality, but it isc_log_create() will always return internal
isc__lctx pointer and isc_log_destroy() will actually not destroy the
internal isc__lctx context.

Signed-off-by: Ondřej Surý <ondrej@isc.org>
2024-08-20 12:50:39 +00:00
Ondřej Surý 957af59cf8 fix: test: Ignore ISC_R_CONNECTIONRESET in the TCP tests
On FreeBSD, the TCP connection callback could spuriously receive
ISC_R_CONNECTIONRESET even when connection to the loopback interface.
Skip the other checks in such case and graciously shutdown the TCP
connection.

Closes #4849

Merge branch '4849-dispatch_test-fails-in-connected_shutdown-on-freebsd' into 'main'

Closes #4849

See merge request isc-projects/bind9!9303
2024-08-20 12:46:09 +00:00
Ondřej Surý e53cb61cf7 Ignore ISC_R_CONNECTIONRESET in the TCP tests
On FreeBSD, the TCP connection callback could spuriously receive
ISC_R_CONNECTIONRESET even when connection to the loopback interface.
Skip the other checks in such case and graciously shutdown the TCP
connection.
2024-08-20 12:45:54 +00:00
Petr Špaček db9d3b8207 chg: Update Internal_use_only-CVE.md checklist changing some tasks
Update Internal_use_only-CVE.md checklist changing some tasks and responsibilities reflecting the new ASN process with RT vs SF. Support will now be sending ASNs to customers, although Marketing will announce the new releases (both publicly and to support customers).

Merge branch 'vicky-main-patch-57381' into 'main'

See merge request isc-projects/bind9!9307
2024-08-20 12:36:36 +00:00
019f3ca185 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
5714164f6f Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
411e78d92d Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
0e17d40843 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
Vicky RiskandPetr Špaček 7e429463f5 Update Internal_use_only-CVE.md checklist changing some tasks and responsibilities reflecting the new ASN process with RT vs SF 2024-08-20 12:36:17 +00:00
Nicki Křížek e4e36e6f37 chg: doc: Improve changelog & release notes workflow
Related: #4847

Merge branch '4847-changelog-sorting-and-tweaks' into 'main'

See merge request isc-projects/bind9!9300
2024-08-20 11:50:48 +00:00
Nicki KřížekandPetr Špaček 993ba7cc7f Omit MR link from release notes
When manually handling the release notes (due to rst markup, fixups
etc.), the different MR number for backports causes needless friction.
Remove the reference from release notes and keep it only in changelog
which isn't manually redacted.
2024-08-20 11:20:15 +00:00
Nicki KřížekandPetr Špaček 759948fffe Sort changelog & relnotes entries by issue number
To reduce the friction when handling the release notes, it is preferable
to have the sections sorted by issue number, rather than merge order.
Fallback to commit subject line if unavailable (e.g. for changelog
entries).
2024-08-20 11:20:15 +00:00
Ondřej Surý 5bfed08b25 fix: dev: Fix the resesuid() shim implementation for NetBSD
The shim implementation of setresuid() was wrong - there was a copy and
paste error and it was calling setresgid() instead.  This only affects
NetBSD because Linux, FreeBSD and OpenBSD have setresuid() and
setresgid() implementation available from the system library.

Closes #4862

Merge branch '4862-fix-setresuid-shim' into 'main'

Closes #4862

See merge request isc-projects/bind9!9359
2024-08-20 10:22:08 +00:00
Ondřej Surý 5567407a82 Fix the resesuid() shim implementation for NetBSD
The shim implementation of setresuid() was wrong - there was a copy and
paste error and it was calling setresgid() instead.  This only affects
NetBSD because Linux, FreeBSD and OpenBSD have setresuid() and
setresgid() implementation available from the system library.
2024-08-20 11:32:35 +02:00
Petr Špaček 50539ae389 chg: doc: Set up version for BIND 9.21.1
Merge branch 'nicki/set-up-version-and-release-notes-for-bind-9.21.1' into 'main'

See merge request isc-projects/bind9!9355
2024-08-20 09:04:50 +00:00
Nicki Křížek c795cfec54 Remove release note draft file
Since we've started the new changelog & release notes process, the file
for drafting release notes for the version-to-be is no longer needed.
2024-08-19 18:01:54 +02:00
Nicki Křížek 6f6b53041c Update BIND version to 9.21.1-dev 2024-08-19 17:59:00 +02:00
Nicki Křížek 2b37b2ed74 chg: ci: Allow rerun of unstable statschannel tests under TSAN
The test_traffic_json and test_traffic_xml occasionally fail when
running under TSAN. This happens in CI and is most likely a result of
some instability that doesn't seem to be easily reproduced.

Closes #4598

Merge branch '4598-mark-statschannel-test-flaky' into 'main'

Closes #4598

See merge request isc-projects/bind9!9293
2024-08-19 14:10:10 +00:00
Nicki Křížek ec2fc7680a Allow rerun of unstable statschannel tests under TSAN
The test_traffic_json and test_traffic_xml occasionally fail when
running under TSAN. This happens in CI and is most likely a result of
some instability that doesn't seem to be easily reproduced.
2024-08-19 16:08:48 +02:00
Arаm Sаrgsyаn d0d6ad0c52 chg: dev: Process also the ISC_R_CANCELED result code in rpz_rewrite()
Log canceled resolver queries (e.g. when shutting down a hung
fetch) in DEBUG3 level instead of DEBUG1 which is used for the
"unrecognized" result codes.

Closes #4797

Merge branch '4797-rpz_rewrite-add-ISC_R_CANCELED-processing' into 'main'

Closes #4797

See merge request isc-projects/bind9!9148
2024-08-19 11:39:29 +00:00
Aram Sargsyan 8bb9568467 Process also the ISC_R_CANCELED result code in rpz_rewrite()
Log  canceled queries (e.g. when shutting down a hung fetch)
in DEBUG3 level instead of DEBUG1 which is used for the
"unrecognized" result codes.
2024-08-19 10:15:01 +00:00
Ondřej Surý 920530b7a3 fix: test: Add missing fclose() when applying updates failed (rpz/testlib)
In rpz system tests, we could leak file if the applying the updates has
failed.  Add the missing fclose() before returning.

Merge branch 'ondrej/add-missing-flose-to-rpz-testlib' into 'main'

See merge request isc-projects/bind9!9317
2024-08-19 10:04:29 +00:00
Ondřej Surý 2855ec8f5f Add missing fclose() when applying updates failed (rpz/testlib)
In rpz system tests, we could leak file if the applying the updates has
failed.  Add the missing fclose() before returning.
2024-08-19 10:04:19 +00:00
Ondřej Surý 661981be7b fix: dev: Check the result of dirfd() before calling unlinkat()
Instead of directly using the result of dirfd() in the unlinkat() call,
check whether the returned file descriptor is actually valid.  That
doesn't really change the logic as the unlinkat() would fail with
invalid descriptor anyway, but this is cleaner and will report the right
error returned directly by dirfd() instead of EBADF from unlinkat().

Closes #4853

Merge branch '4853-check-result-of-dirfd-in-isc_log' into 'main'

Closes #4853

See merge request isc-projects/bind9!9316
2024-08-19 09:57:48 +00:00
Ondřej Surý 59f4fdebc0 Check the result of dirfd() before calling unlinkat()
Instead of directly using the result of dirfd() in the unlinkat() call,
check whether the returned file descriptor is actually valid.  That
doesn't really change the logic as the unlinkat() would fail with
invalid descriptor anyway, but this is cleaner and will report the right
error returned directly by dirfd() instead of EBADF from unlinkat().
2024-08-19 09:57:28 +00:00
Ondřej Surý 8071384324 chg: dev: Remove code to read and parse /proc/net/if_inet6 on Linux
The getifaddr() works fine for years, so we don't have to
keep the callback to parse /proc/net/if_inet6 anymore.

Closes #4852

Merge branch '4852-handle-errors-from-rewind' into 'main'

Closes #4852

See merge request isc-projects/bind9!9315
2024-08-19 09:43:03 +00:00
Ondřej Surý 2fbf9757b8 Remove code to read and parse /proc/net/if_inet6 on Linux
The getifaddr() works fine for years, so we don't have to
keep the callback to parse /proc/net/if_inet6 anymore.
2024-08-19 09:42:55 +00:00
Ondřej Surý dda5ba53df Ignore errno returned from rewind() in the interface iterator
The clang-scan 19 has reported that we are ignoring errno after the call
to rewind().  As we don't really care about the result, just silence the
error, the whole code will be removed in the development version anyway
as it is not needed.
2024-08-19 09:42:55 +00:00
Ondřej Surý 2d12e1142a fix: dev: Change the NS_PER_SEC (and friends) from enum to static const
New version of clang (19) has introduced a stricter checks when mixing
integer (and float types) with enums.  In this case, we used enum {}
as C17 doesn't have constexpr yet.  Change the time conversion constants
to be static const unsigned int instead of enum values.

Closes #4845

Merge branch '4845-change-NS_PER_SEC-type-from-enum-to-integer' into 'main'

Closes #4845

See merge request isc-projects/bind9!9313
2024-08-19 09:09:09 +00:00
Ondřej Surý 122a142241 Use constexpr for NS_PER_SEC and friends constants
The contexpr introduced in C23 standard makes perfect sense to be used
instead of preprocessor macros - the symbols are kept, etc.  Define
ISC_CONSTEXPR to be `constexpr` for C23 and `static const` for the older
C standards.  Use the newly introduced macro for the NS_PER_SEC and
friends time constants.
2024-08-19 09:08:55 +00:00
Ondřej Surý b03e90e0d4 Change the NS_PER_SEC (and friends) from enum to static const
New version of clang (19) has introduced a stricter checks when mixing
integer (and float types) with enums.  In this case, we used enum {}
as C17 doesn't have constexpr yet.  Change the time conversion constants
to be static const unsigned int instead of enum values.
2024-08-19 09:08:55 +00:00
Ondřej Surý 9c06717429 chg: test: Retire Debian 11 "bullseye"
A follow-up to isc-projects/bind9!9324.

Merge branch 'mnowak/retire-debian-11-bullseye' into 'main'

See merge request isc-projects/bind9!9330
2024-08-16 06:48:38 +00:00
Michal Nowak 930a7515c2 Retire Debian 11 "bullseye"
A follow-up to isc-projects/bind9!9324.
2024-08-16 08:32:55 +02:00
Ondřej Surý 7cb9af430e chg: test: For TSAN builds, use libraries from /opt/tsan
The new TSAN images, the TSAN-enabled images install libraries to
opt/tsan, synchronize the configure options and CFLAGS between gcc:tsan
and clang:tsan images and set the PKG_CONFIG_PATH to /opt/tsan/lib.

Additionally, drop Debian bullseye that's EOL now.

Merge branch 'ondrej/use-staging-tsan-images' into 'main'

See merge request isc-projects/bind9!9324
2024-08-15 21:03:26 +00:00
Ondřej Surý d02d6af2b9 Remove Debian bullseye jobs
The Debian bullseye has reached end-of-life, remove it from the CI.
2024-08-15 22:23:56 +02:00
Ondřej Surý 2a46396f29 For TSAN builds, use libraries from /opt/tsan
The new TSAN images, the TSAN-enabled images install libraries to
/opt/tsan, synchronize the configure options and CFLAGS between gcc:tsan
and clang:tsan images and set the PKG_CONFIG_PATH to /opt/tsan/lib.
2024-08-15 22:23:56 +02:00
Arаm Sаrgsyаn ebd669a830 fix: dev: Check if logconfig is NULL before using it in isc_log_doit()
Check if 'lctx->logconfig' is NULL before using it in isc_log_doit(),
because it's possible that isc_log_destroy() was already called, e.g.
when a 'call_rcu' function wants to log a message during shutdown.

Closes #4842

Merge branch '4842-shutdown-crash-in-isc_log_doit' into 'main'

Closes #4842

See merge request isc-projects/bind9!9297
2024-08-15 12:55:28 +00:00
Aram Sargsyan 656e04f48a Check if logconfig is NULL before using it in isc_log_doit()
Check if 'lctx->logconfig' is NULL before using it in isc_log_doit(),
because it's possible that isc_log_destroy() was already called, e.g.
when a 'call_rcu' function wants to log a message during shutdown.
2024-08-15 12:54:37 +00:00
Arаm Sаrgsyаn 75021765f8 fix: dev: Add -Wno-psabi to CFLAGS for x86 (32-bit) builds
GCC 11.1+ emits a note during compilation when there are 64-bit
atomic fields in a structure, because it fixed a compiler bug
by changing the alignment of such fields, which caused ABI change.

Add -Wno-psabi to CFLAGS for such builds in order to silence the
warning. That shouldn't be a problem since we don't expose our
structures to the outside.

Closes #4841

Merge branch '4841-alignment-of-_Atomic-long-long-unsigned-int' into 'main'

Closes #4841

See merge request isc-projects/bind9!9319
2024-08-15 12:51:03 +00:00
Aram Sargsyan 867066aa53 Add -Wno-psabi to CFLAGS for x86 (32-bit) builds
GCC 11.1+ emits a note during compilation when there are 64-bit
atomic fields in a structure, because it fixed a compiler bug
by changing the alignment of such fields, which caused ABI change.

Add -Wno-psabi to CFLAGS for such builds in order to silence the
warning. That shouldn't be a problem since we don't expose our
structures to the outside.
2024-08-15 12:50:41 +00:00
Aydın Mercan 936975a9ae rem: do not include config.h
The build system ensures it is always included for every source file.

Merge branch 'aydin/no-include-config-h' into 'main'

See merge request isc-projects/bind9!9320
2024-08-15 12:12:15 +00:00
Aydın Mercan b330eb0af8 do not include config.h
The build system ensures it is always included for every source file.
2024-08-15 12:11:48 +00:00
Ondřej Surý 5275b6bc83 chg: test: Reduce the size of hashmap_nodes.h file
Instead of keeping the whole array of test_node_t objects, just keep the
hashvalues and generated the rest of the test_node_t on the fly.  The
test still works this way and the file size has been reduced from 2M to
90k.

Closes #4851

Merge branch '4851-generate-problematic-isc_hashmap-test-data' into 'main'

Closes #4851

See merge request isc-projects/bind9!9318
2024-08-15 11:56:49 +00:00
Ondřej Surý 2310c322c0 Reduce the size of hashmap_nodes.h file
Instead of keeping the whole array of test_node_t objects, just keep the
hashvalues and generated the rest of the test_node_t on the fly.  The
test still works this way and the file size has been reduced from 2M to
90k.
2024-08-15 10:05:32 +02:00
Ondřej Surý 43c81e2e24 fix: Change the placement of ctor/dtor attributes in the dst_api
Change the placement of the attributes to match the existing usage in
other places (after the declaration).

Merge branch 'ondrej/ISC_CONSTRUCTOR-style' into 'main'

See merge request isc-projects/bind9!9291
2024-08-14 16:21:08 +00:00
Ondřej Surý d00ff78a3e Change the placement of ctor/dtor attributes in the dst_api
Change the placement of the attributes to match the existing usage in
other places (after the declaration).
2024-08-14 15:30:18 +00:00
Nicki Křížek ac395b058c chg: ci: Check that generated changelog entry doesn't break docs build
Since changelog entries are now generated from MR title&description,
they aren't sanity checked during a regular docs build. If these contain
special sequences that will be interpreted by sphinx, it might result in
breakage that would have to be amended manually.

Add a CI check to test a doc build with changelog after the MR is merged
to ensure that the docs can be built when generating changelog from
pristine git contents.

Related #4847

Merge branch 'nicki/add-changelog-entry-check' into 'main'

See merge request isc-projects/bind9!9294
2024-08-14 15:25:26 +00:00
Nicki Křížek 480dcdef9a Use python3 in shebang lines for util scripts
Some distributions (notably, debian bookworm) have deprecated the
`python` interpreter in favor of `python3`. Since our scripts are
python3 anyway, use the proper numbered version in shebang to make
scripts easily executable.
2024-08-14 17:22:22 +02:00
Nicki Křížek bf69e8f149 Check that generated changelog entry doesn't break docs build
Since changelog entries are now generated from MR title&description,
they aren't sanity checked during a regular docs build. If these contain
special sequences that will be interpreted by sphinx, it might result in
breakage that would have to be amended manually.

Add a CI check to test a doc build with changelog after the MR is merged
to ensure that the docs can be built when generating changelog from
pristine git contents.
2024-08-14 17:22:20 +02:00
Ondřej Surý c31cd67788 fix: dev: Fix the assertion failure in the isc_hashmap iterator
When the round robin hashing reorders the map entries on deletion, we
were adjusting the iterator table size only when the reordering was
happening at the internal table boundary.  The iterator table size had
to be reduced by one to prevent seeing the entry that resized on
position [0] twice because it migrated to [iter->size - 1] position.

However, the same thing could happen when the same entry migrates a
second time from [iter->size - 1] to [iter->size - 2] position (and so
on) because the check that we are manipulating the entry just in the [0]
position was insufficient.  Instead of checking the position [pos == 0],
we now check that the [pos % iter->size == 0], thus ignoring all the
entries that might have moved back to the end of the internal table.

Closes #4838

Merge branch '4838-fix-assertion-failure-in-hashmap-deletion-iterator' into 'main'

Closes #4838

See merge request isc-projects/bind9!9292
2024-08-14 15:19:11 +00:00
Ondřej Surý 3e4d153453 Skip already rehashed positions in the old hashmap table
When iterating through the old internal hashmap table, skip all the
nodes that have been already migrated to the new table.  We know that
all positions with index less than .hiter are NULL.
2024-08-14 15:19:04 +00:00
Ondřej Surý acdc57259f Fix the assertion failure in the isc_hashmap iterator
When the round robin hashing reorders the map entries on deletion, we
were adjusting the iterator table size only when the reordering was
happening at the internal table boundary.  The iterator table size had
to be reduced by one to prevent seeing the entry that resized on
position [0] twice because it migrated to [iter->size - 1] position.

However, the same thing could happen when the same entry migrates a
second time from [iter->size - 1] to [iter->size - 2] position (and so
on) because the check that we are manipulating the entry just in the [0]
position was insufficient.  Instead of checking the position [pos == 0],
we now check that the [pos % iter->size == 0], thus ignoring all the
entries that might have moved back to the end of the internal table.
2024-08-14 15:19:04 +00:00
Ondřej Surý 482eed2e31 Add known-to-crash static hashmap iterator nodes array
Add second iterator test with a well-known configuration of the nodes
array that causes the last element of the array to migrate two times to
the previous node.
2024-08-14 15:19:04 +00:00
Nicki Křížek 2c7088a48d chg: doc: Fix ordering of gitchangelog replacement regexs
Ensure the issue number in changelog isn't accidentally removed for backport MRs.

Merge branch 'nicki/fix-gitchangelog-replacement-regexs' into 'main'

See merge request isc-projects/bind9!9295
2024-08-14 15:06:08 +00:00
Nicki KřížekandPetr Špaček 37274bebe1 Fix ordering of gitchangelog replacement regexs
Prior to this change, the issue number could be accidentally removed by
the `Backport of` text, depending on the order of the MR description
contents. Ensure all the removals for text in MR descriptions happen
first, and only then run the replacement regex for issue number, which
appends it to the end of the last non-empty line (which will no longer
be removed).

The only removals that happen after the replacement are guaranteed to
always happen after the end of MR description, since they're
auto-generated by gitlab when the merge commit is created, thus won't
affect the line with the issue number.

Also remove the needless isc-private/bind9 replacement. References
to private MRs are already removed by the very first regex.
2024-08-14 14:49:43 +00:00
Ondřej Surý f4e0d0e460 fix: dev: Silence all warnings that stem from the default config
As we now setup the logging very early, parsing the default config would
always print warnings about experimental (and possibly deprecated)
options in the default config.  This would even mess with commands like
`named -V` and it is also wrong to warn users about using experimental
options in the default config, because they can't do anything about
this.  Add CFG_PCTX_NODEPRECATED and CFG_PCTX_NOEXPERIMENTAL options
that we can pass to cfg parser and silence the early warnings caused by
using experimental options in the default config.

Merge branch 'ondrej/silence-warnings-from-default-config' into 'main'

See merge request isc-projects/bind9!9304
2024-08-14 12:52:01 +00:00
Ondřej Surý 86f1ec34dc Silence all warnings that stem from the default config
As we now setup the logging very early, parsing the default config would
always print warnings about experimental (and possibly deprecated)
options in the default config.  This would even mess with commands like
`named -V` and it is also wrong to warn users about using experimental
options in the default config, because they can't do anything about
this.  Add CFG_PCTX_NODEPRECATED and CFG_PCTX_NOEXPERIMENTAL options
that we can pass to cfg parser and silence the early warnings caused by
using experimental options in the default config.
2024-08-14 12:50:31 +00:00
Ondřej Surý f73a19bb3e rem: dev: Remove outdated perllib integration
The code in conftools/ directory hasn't been touched since 2000.
Nobody knows what it does and nobody even knows how to build it
or test it.  Just remove the whole directory.

Merge branch 'ondrej/remove-outdated-perllib-integration' into 'main'

See merge request isc-projects/bind9!9302
2024-08-14 12:49:56 +00:00
Ondřej Surý 391e743c30 Remove outdated perllib integration
The code in conftools/ directory hasn't been touched since 2000.
Nobody knows what it does and nobody even knows how to build it
or test it.  Just remove the whole directory.
2024-08-14 12:49:51 +00:00
Aydın Mercan 069c6c2265 chg: usr: use deterministic ecdsa for openssl >= 3.2
OpenSSL has added support for deterministic ECDSA (RFC 6979) with
version 3.2.

Use it by default as it removes arguably its most fragile side of ECDSA.
The derandomization doesn't pose a risk for DNS usecases and is allowed by FIPS 186-5.

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

Merge branch '299-change-ecdsa-to-deterministic-usage-elliptic-curve-digital-signature-algorithm-rfc-6979' into 'main'

Closes #299

See merge request isc-projects/bind9!9128
2024-08-14 12:47:06 +00:00
Aydın Mercan 596903a6b7 use deterministic ecdsa for openssl >= 3.2
OpenSSL has added support for deterministic ECDSA (RFC 6979) with
version 3.2.

Use it by default as derandomization doesn't pose a risk for DNS
usecases and is allowed by FIPS 186-5.
2024-08-14 14:34:44 +03:00
Petr Špaček b732da695e Update BIND version for release 2024-08-13 16:27:17 +02:00
Petr Špaček 8efe101742 Add changelog entry for last-minute regression fix 2024-08-13 16:27:17 +02:00
Petr Špaček 3e86c3190d Prepare documentation for BIND 9.21.0
Merge branch 'michal/prepare-documentation-for-bind-9.21.0' into 'v9.21.0-release'

See merge request isc-private/bind9!728
2024-08-13 16:22:58 +02:00
Michał KępieńandPetr Špaček 507824e524 fix: usr: reconfigure catz member zones during named reconfiguration
During a reconfiguration named wasn't reconfiguring catalog zones'
member zones. This has been fixed.

Closes isc-projects/bind9#4733

Merge branch '4733-fix-catz-member-zones-reconfigure' into 'v9.21.0-release'

See merge request isc-private/bind9!695
2024-08-13 16:22:58 +02:00
Petr ŠpačekandGreg Choules 713f430349 Tweak and reword release notes some more
Co-authored-by: Greg Choules <greg@isc.org>
2024-08-13 16:22:58 +02:00
Aram SargsyanandPetr Špaček d197c583dd Non empty 'catalog-zones' implies that 'allow-new-zones' is true
This condition in catalog zone processing functions is checked only
for sanity, so there is no meaning for a log message that normally
shouldn't be ever logged.
2024-08-13 16:22:58 +02:00
Michał KępieńandPetr Špaček 4301d90ca2 Prepare documentation for BIND 9.21.0 2024-08-13 16:22:58 +02:00
Aram SargsyanandPetr Špaček 730fd32ee6 Reconfigure catz member zones during named reconfiguration
During a reconfiguration named doesn't reconfigure catalog zones
member zones. Implement the necessary code to reconfigure catz
member zones.
2024-08-13 16:22:58 +02:00
Michał KępieńandPetr Špaček c9b23221c4 Reorder release notes 2024-08-13 16:22:58 +02:00
Aram SargsyanandPetr Špaček f6dd701b83 Test that 'rndc reconfig' reconfigures catz member zones
Catalog zone member zones should be reconfigured as all the other
zones during a reconfiguration. Test it by checking whether the newly
added allow-query setting affects a member zone.
2024-08-13 16:22:58 +02:00
Michał KępieńandPetr Špaček e4e9616a14 Fix "make doc" for the changelog 2024-08-13 16:22:58 +02:00
Michał KępieńandPetr Špaček a47707c59d Tweak and reword release notes 2024-08-13 16:22:58 +02:00
Michał KępieńandPetr Špaček 53cdd247bb Generate release documentation 2024-08-13 16:22:58 +02:00
Ondřej Surý 8b70722fcb fix: dev: Don't skip the counting if fcount_incr() is called with force==true (v2)
The fcount_incr() was not increasing counter->count when force was set
to true, but fcount_decr() would try to decrease the counter leading to
underflow and assertion failure.  Swap the order of the arguments in the
condition, so the !force is evaluated after incrementing the .count.

Closes #4846

Merge branch '4786-forced-fcount_incr-should-still-increment-count-and-allowed-fix' into 'main'

Closes #4846

See merge request isc-projects/bind9!9298
2024-08-13 13:53:13 +00:00
Ondřej Surý c2c9d8f01b Add fetches-per-zone 40 to qmin/ns5 configuration
The simple change causes assertion failure fixed in the previous commit.
2024-08-13 14:56:48 +02:00
Ondřej Surý 8e86e55af1 Don't skip the counting if fcount_incr() is called with force==true (v2)
The fcount_incr() was not increasing counter->count when force was set
to true, but fcount_decr() would try to decrease the counter leading to
underflow and assertion failure.  Swap the order of the arguments in the
condition, so the !force is evaluated after incrementing the .count.
2024-08-13 12:51:22 +02:00
Michal Nowak f6fb9a4969 chg: Make every changelog entry a separate code block
LaTeX in CI and on ReadTheDocs [fails][1] to render a PDF version of ARM if
the Changelog section is included. The running theory is that the
verbatim section of more than twenty thousand lines is too big to meet
LaTeX self-imposed constraints, and it fails with:

    ! TeX capacity exceeded, sorry [main memory size=5000000].

Or it just hangs if extra_mem_bot=30000000 is set in
/etc/texmf/texmf.d/01main_memory_bump.cnf:

    ! Dimension too large.
    \fb@put@frame ...p \ifdim \dimen@ >\ht \@tempboxa

    \fb@putboxa #1\fb@afterfra...
    l.56913 \end{sphinxVerbatim}

Make each BIND 9 release a separate code block to work around the issue.
Further split up the sections for some exceptionally large releases, for
the same reason.

[1]: https://gitlab.isc.org/isc-projects/bind9/-/jobs/4584011

Merge branch 'mnowak/fix-arm-changelog-section' into 'main'

See merge request isc-projects/bind9!9266
2024-08-08 14:25:12 +00:00
Michal Nowak bc802359b0 Split up changelog into per-release code blocks
LaTeX in CI and on ReadTheDocs fails to render a PDF version of ARM if
the Changelog section is included. The running theory is that the
verbatim section of more than twenty thousand lines is too big to meet
LaTeX self-imposed constraints, and it fails with:

    ! TeX capacity exceeded, sorry [main memory size=5000000].

Or it just hangs if extra_mem_bot=30000000 is set in
/etc/texmf/texmf.d/01main_memory_bump.cnf:

    ! Dimension too large.
    \fb@put@frame ...p \ifdim \dimen@ >\ht \@tempboxa

    \fb@putboxa #1\fb@afterfra...
    l.56913 \end{sphinxVerbatim}

Make each BIND 9 release a separate code block to work around the issue.
Further split up the sections for some exceptionally large releases, for
the same reason.
2024-08-08 14:52:02 +02:00
Michał Kępień 9e7cd68d9f fix: dev: Move the dst__openssl_toresult to isc_tls unit
Since the enable_fips_mode() now resides inside the isc_tls unit, BIND 9
would fail to compile when FIPS mode was enabled as the DST subsystem
logging functions were missing.

Move the crypto library logging functions from the openssl_link unit to
isc_tls unit and enhance it, so it can now be used from both places
keeping the old dst__openssl_toresult* macros alive.

Merge branch 'ondrej/move-openssl-logging-to-isc_tls-unit' into 'main'

See merge request isc-projects/bind9!9286
2024-08-08 11:01:21 +00:00
Ondřej Surý 39aef50b9b Move the dst__openssl_toresult to isc_tls unit
Since the enable_fips_mode() now resides inside the isc_tls unit, BIND 9
would fail to compile when FIPS mode was enabled as the DST subsystem
logging functions were missing.

Move the crypto library logging functions from the openssl_link unit to
isc_tls unit and enhance it, so it can now be used from both places
keeping the old dst__openssl_toresult* macros alive.
2024-08-08 11:59:41 +02:00
Evan Hunt f202937078 new: usr: Tighten 'max-recursion-queries' and add 'max-query-restarts' option
There were cases in resolver.c when the `max-recursion-queries` quota was ineffective. It was possible to craft zones that would cause a resolver to waste resources by sending excessive queries while attempting to resolve a name. This has been addressed by correcting errors in the implementation of `max-recursion-queries`, and by reducing the default value from 100 to 32.

In addition, a new `max-query-restarts` option has been added which limits the number of times a recursive server will follow CNAME or DNAME records before terminating resolution. This was previously a hard-coded limit of 16, and now defaults to 11.
 
Closes #4741

Merge branch '4741-reclimit-restarts' into 'main'

Closes #4741

See merge request isc-projects/bind9!9281
2024-08-07 21:12:07 +00:00
Evan Hunt 0d010ddebe add +restarts and +maxqueries options to delv
max-query-restarts and max-recursion-queries values can now be set
on the command line in delv for testing purposes.
2024-08-07 13:20:05 -07:00
Evan Hunt 104f3b82fb implement 'max-query-restarts'
implement, document, and test the 'max-query-restarts' option
which specifies the query restart limit - the number of times
we can follow CNAMEs before terminating resolution.
2024-08-07 13:20:05 -07:00
Evan Hunt 7e3b425dc2 reduce the max-recursion-queries default to 32
the number of iterative queries that can be sent to resolve a
name now defaults to 32 rather than 100.
2024-08-07 13:19:57 -07:00
Evan Hunt c5588babaf make "max_restarts" a configurable value
MAX_RESTARTS is no longer hard-coded; ns_server_setmaxrestarts()
and dns_client_setmaxrestarts() can now be used to modify the
max-restarts value at runtime. in both cases, the default is 11.
2024-08-07 13:03:08 -07:00
Evan Hunt 05d78671bb reduce MAX_RESTARTS to 11
the number of steps that can be followed in a CNAME chain
before terminating the lookup has been reduced from 16 to 11.
(this is a hard-coded value, but will be made configurable later.)
2024-08-07 13:00:42 -07:00
Evan Hunt 825f3d68c5 add debug logging when creating or attaching to a query counter
fctx_create() now logs at debug level 9 when the fctx attaches
to an existing counter or creates a new one.
2024-08-07 11:21:44 -07:00
Evan Hunt af7db89513 apply max-recursion-queries quota to validator queries
previously, validator queries for DNSKEY and DS records were
not counted toward the quota for max-recursion-queries; they
are now.
2024-08-07 11:21:44 -07:00
Evan Hunt d3b7e92783 attach query counter to NS fetches
there were cases in resolver.c when queries for NS records were
started without passing a pointer to the parent fetch's query counter;
as a result, the max-recursion-queries quota for those queries started
counting from zero, instead of sharing the limit for the parent fetch,
making the quota ineffective in some cases.
2024-08-07 11:21:44 -07:00
Aydın Mercan cd92a145a3 chg: dev: use only c23 or c11 noreturn specifiers
Use `[[noreturn]]` when compiling with C23 or greater.

The attribute macro name has been capitalized as `NORETURN` as defining it as `noreturn` breaks external headers.
`#define noreturn __attribute__((noreturn))` wasn't used as C11's `stdnoreturn.h`/`_Noreturn` is required to build BIND9 in the first place.

Merge branch 'aydin/noreturn-c23' into 'main'

See merge request isc-projects/bind9!9149
2024-08-07 15:42:57 +00:00
Aydın Mercan f58ed932d8 use only c23 or c11 noreturn specifiers
Since we require C11 or greater, we can depend on using either _Noreturn
or [[noreturn]].
2024-08-07 18:27:40 +03:00
Ondřej Surý 7f2513a5aa chg: dev: Initialize the DST subsystem implicitly
Instead of calling dst_lib_init() and dst_lib_destroy() explicitly by
all the programs, create a separate memory context for the DST subsystem
and use the library constructor and destructor to initialize the DST
internals.

Merge branch 'ondrej/move-dst_lib_init-and-destroy-to-lib-ctor-dtor' into 'main'

See merge request isc-projects/bind9!9254
2024-08-07 15:05:13 +00:00
Ondřej Surý e6f2f2a5e6 Initialize the DST subsystem implicitly
Instead of calling dst_lib_init() and dst_lib_destroy() explicitly by
all the programs, create a separate memory context for the DST subsystem
and use the library constructor and destructor to initialize the DST
internals.
2024-08-07 17:03:27 +02:00
Ondřej Surý ab2abfc8b0 chg: test: Use new images with TSAN-enabled libraries
The new Fedora 40 TSAN images use libuv, urcu and OpenSSL libraries compiled with ThreadSanitizer.  This (in theory) should enable better detection of memory races in those (most important) libraries.

Merge branch 'ondrej/test-new-tsan-images' into 'main'

See merge request isc-projects/bind9!9264
2024-08-07 14:28:13 +00:00
Ondřej Surý ed766efc15 Add configure for libraries in /usr/local for the gcc:tsan job
The TSAN-enabled libraries are installed to /usr/local, pass the
PKG_CONFIG_PATH and few other options to CFLAGS to the configure
arguments.
2024-08-07 14:27:06 +00:00
Ondřej Surý 1d1bc3a148 fix: dev: Disassociate the SSL object from the cached SSL_SESSION
When the SSL object was destroyed, it would invalidate all SSL_SESSION
objects including the cached, but not yet used, TLS session objects.

Properly disassociate the SSL object from the SSL_SESSION before we
store it in the TLS session cache, so we can later destroy it without
invalidating the cached TLS sessions.

Closes #4834

Merge branch '4834-detach-SSL-from-cached-SSL_SESSION' into 'main'

Closes #4834

See merge request isc-projects/bind9!9271
2024-08-07 14:26:22 +00:00
c11b736e44 Disassociate the SSL object from the cached SSL_SESSION
When the SSL object was destroyed, it would invalidate all SSL_SESSION
objects including the cached, but not yet used, TLS session objects.

Properly disassociate the SSL object from the SSL_SESSION before we
store it in the TLS session cache, so we can later destroy it without
invalidating the cached TLS sessions.

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Artem Boldariev <artem@isc.org>
Co-authored-by: Aram Sargsyan <aram@isc.org>
2024-08-07 14:25:11 +00:00
Ondřej Surý ee00bddf94 fix: dev: Attach/detach to the listening child socket when accepting TLS
When TLS connection (TLSstream) connection was accepted, the children
listening socket was not attached to sock->server and thus it could have
been freed before all the accepted connections were actually closed.

In turn, this would cause us to call isc_tls_free() too soon - causing
cascade errors in pending SSL_read_ex() in the accepted connections.

Properly attach and detach the children listening socket when accepting
and closing the server connections.

Closes #4833

Merge branch '4833-tlssock-needs-to-attach-to-child-tlslistener' into 'main'

Closes #4833

See merge request isc-projects/bind9!9270
2024-08-07 14:17:50 +00:00
Ondřej Surý 684f3eb8e6 Attach/detach to the listening child socket when accepting TLS
When TLS connection (TLSstream) connection was accepted, the children
listening socket was not attached to sock->server and thus it could have
been freed before all the accepted connections were actually closed.

In turn, this would cause us to call isc_tls_free() too soon - causing
cascade errors in pending SSL_read_ex() in the accepted connections.

Properly attach and detach the children listening socket when accepting
and closing the server connections.
2024-08-07 14:17:43 +00:00
Petr Špaček ced1eb358d fix: pkg: Fix --enable-tracing build on systems without dtrace
Missing file util/dtrace.sh prevented builds on system without dtrace utility.
This has been corrected.

Fixes: #4835

Merge branch 'pspacek/gitattribute-fixes' into 'main'

Closes #4835

See merge request isc-projects/bind9!9262
2024-08-07 13:53:29 +00:00
Petr Špaček 9abedb7757 Include util/dtrace.sh in tarballs 2024-08-07 15:51:34 +02:00
Petr Špaček 50b8d9b674 Remove obsolete reference to mksymtbl.pl
This was a leftover from commit c463808992
2024-08-07 15:51:28 +02:00
Petr Špaček 5dd3c41676 fix: dev: Make hypothesis optional for system tests
Ensure that system tests can be executed without Python hypothesis
package.

Closes #4831

Merge branch '4831-isctest-make-hypothesis-optional' into 'main'

Closes #4831

See merge request isc-projects/bind9!9265
2024-08-07 10:55:21 +00:00
Nicki KřížekandPetr Špaček e6a7695600 Make hypothesis optional for system tests
Ensure that system tests can be executed without Python hypothesis
package.
2024-08-07 10:55:06 +00:00
Mark Andrews 7facf967ac fix: usr: Dig now reports missing query section for opcode QUERY
Query responses should contain the question section with some exceptions.  Dig was not reporting this.

Closes #4808

Merge branch '4808-have-dig-report-missing-question-section-in-axfr-response' into 'main'

Closes #4808

See merge request isc-projects/bind9!9233
2024-08-07 02:20:22 +00:00
Mark Andrews 327e890910 Dig now reports a missing question section
The question section should be present in the first AXFR/IXFR
response and in other QUERY responses unless no question was sent.
Issue a warning if the question section is not present.
2024-08-07 00:49:08 +00:00
Ondřej Surý b620b7e911 chg: usr: Remove OpenSSL 1.x Engine support
The OpenSSL 1.x Engines support has been deprecated in the OpenSSL 3.x
and is going to be removed from the upstream OpenSSL.  Remove the OpenSSL
Engine support from BIND 9 in favor of OpenSSL 3.x Providers.

Closes #4828

Merge branch '4828-remove-OpenSSL-engine-support' into 'main'

Closes #4828

See merge request isc-projects/bind9!9252
2024-08-06 14:04:56 +00:00
Ondřej Surý cd54f9d4b9 Always use OpenSSL_version() to print OpenSSL version
OpenSSL_version() first appeared in OpenSSL 1.1.0 and have been
available since LibreSSL 2.7.1 and OpenBSD 6.3, thus we can remove the
compatibility shims with older versions that are not supported anymore.
2024-08-06 15:17:48 +02:00
Ondřej Surý 495cf18c75 Remove checks for OPENSSL_API_LEVEL define
Since the support for OpenSSL Engines has been removed, we can now also
remove the checks for OPENSSL_API_LEVEL; The OpenSSL 3.x APIs will be
used when compiling with OpenSSL 3.x, and OpenSSL 1.1.xx APIs will be
used only when OpenSSL 1.1.x is used.
2024-08-06 15:17:48 +02:00
Ondřej Surý ef7aba7072 Remove OpenSSL Engine support
The OpenSSL 1.x Engines support has been deprecated in the OpenSSL 3.x
and is going to be removed.  Remove the OpenSSL Engine support in favor
of OpenSSL Providers.
2024-08-06 15:17:48 +02:00
Ondřej Surý 1688c96bda fix: Move matching isc_mem_destroy() outside of ifdef
The isc_mem_create() in printversion() was created outside of an #ifdef
HAVE_GEOIP, but destroyed inside the #ifdef; move it to the outside of
the #ifdef where it belongs.

This is really a nit as we immediately exit() after printing the
versions, but I found it and it would bug me for the rest of my life.

Merge branch 'ondrej/fix-missing-isc_mem_destroy-in-printversion' into 'main'

See merge request isc-projects/bind9!9255
2024-08-05 16:54:02 +00:00
Ondřej Surý 2ebcafd8c2 Move matching isc_mem_destroy() outside of ifdef
The isc_mem_create() in printversion() was created outside of an #ifdef
HAVE_GEOIP, but destroyed inside the #ifdef; move it to the outside of
the #ifdef where it belongs.

This is really a nit as we immediately exit() after printing the
versions, but I found it and it would bug me for the rest of my life.
2024-08-05 16:35:22 +02:00
Ondřej Surý 227add4c3e fix: usr: Fix assertion failure in the glue cache
Fix an assertion failure that could happen as a result of data race between free_gluetable() and addglue() on the same headers.

Closes #4691

Merge branch '4691-fix-data-race-between-free_gluetable-and-addglue' into 'main'

Closes #4691

See merge request isc-projects/bind9!9126
2024-08-05 14:24:14 +00:00
Ondřej Surý a26055f03e fix: dev: don't use 'create' flag unnecessarily in findnode()
when searching the cache for a node so that we can delete an rdataset, it isn't necessary to set the 'create' flag. if the
node doesn't exist yet, we won't be able to delete anything from it anyway.

Merge branch 'each-minor-findnode-refactor' into 'main'

See merge request isc-projects/bind9!9158
2024-08-05 13:36:54 +00:00
Ondřej Surý 5beae5faf9 Fix the glue table in the QP and RBT zone databases
When adding glue to the header, we add header to the wait-free stack to
be cleaned up later which sets wfc_node->next to non-NULL value.  When
the actual cleaning happens we would only cleanup the .glue_list, but
since the database isn't locked for the time being, the headers could be
reused while cleaning the existing glue entries, which creates a data
race between database versions.

Revert the code back to use per-database-version hashtable where keys
are the node pointers.  This allows each database version to have
independent glue cache table that doesn't affect nodes or headers that
could already "belong" to the future database version.
2024-08-05 15:36:54 +02:00
Evan HuntandOndřej Surý 6b720bfe1a minor findnode optimization
when searching the cache for a node so that we can delete an
rdataset, it is not necessary to set the 'create' flag. if the
node doesn't exist yet, we then we won't be able to delete
anything from it anyway.
2024-08-05 13:36:41 +00:00
Ondřej Surý bad8b03188 chg: Clean up calls to dns_difftuple_create()
dns_difftuple_create() could only return success, so change
its type to void and clean up all the calls to it.

Merge branch 'each-difftuple-create-cannot-fail' into 'main'

See merge request isc-projects/bind9!9151
2024-08-05 13:31:46 +00:00
Evan HuntandOndřej Surý a68a77ca86 dns_difftuple_create() cannot fail
dns_difftuple_create() could only return success, so change
its type to void and clean up all the calls to it.

other functions that only returned a result value because of it
have been cleaned up in the same way.
2024-08-05 13:31:38 +00:00
Ondřej Surý 6573276bad fix: usr: Raise the log level of priming failures
When a priming query is complete, it's currently logged at level ISC_LOG_DEBUG(1), regardless of success or failure. We are now raising it to ISC_LOG_NOTICE in the case of failure. [GL #3516]

Closes #3516

Merge branch '3516-log-priming-errors' into 'main'

Closes #3516

See merge request isc-projects/bind9!9121
2024-08-05 13:02:41 +00:00
Evan HuntandOndřej Surý a84d54c6ff raise the log level of priming failures
when a priming query is complete, it's currently logged at
level ISC_LOG_DEBUG(1), regardless of success or failure. we
are now raising it to ISC_LOG_NOTICE in the case of failure.
2024-08-05 13:56:13 +02:00
Ondřej Surý 5fafb0e7f7 chg: dev: fix the rsa exponent to 65537
There isn't a realistic reason to ever use e = 4294967297. Fortunately
its codepath wasn't reachable to users and can be safetly removed.

Keep in mind the `dns_key_generate` header comment was outdated. e = 3
hasn't been used since 2006 so there isn't a reason to panic. The
toggle was the public exponents between 65537 and 4294967297.

Merge branch 'aydin/rsa-cleanup' into 'main'

See merge request isc-projects/bind9!9133
2024-08-05 11:22:32 +00:00
Aydın MercanandOndřej Surý 2a76352b37 fix the rsa exponent to 65537
There isn't a realistic reason to ever use e = 4294967297. Fortunately
its codepath wasn't reachable to users and can be safetly removed.

Keep in mind the `dns_key_generate` header comment was outdated. e = 3
hasn't been used since 2006 so there isn't a reason to panic. The
toggle was the public exponents between 65537 and 4294967297.
2024-08-05 11:21:59 +00:00
Ondřej Surý 9397251eb3 chg: dev: remove the crc64 implementation
CRC-64 has been added for map files. Now that the map file format has
been removed, there isn't a reason to keep the implementation.

Merge branch 'aydin/cleanup-crc' into 'main'

See merge request isc-projects/bind9!9135
2024-08-05 11:21:38 +00:00
Aydın MercanandOndřej Surý 5dbb560747 remove the crc64 implementation
CRC-64 has been added for map files. Now that the map file format has
been removed, there isn't a reason to keep the implementation.
2024-08-05 11:21:25 +00:00
Ondřej Surý dcee04f70c chg: dev: call rcu_barrier() in the isc_mem_destroy() just once
The previous work in this area was led by the belief that we might be
calling call_rcu() from within call_rcu() callbacks.  After carefully
checking all the current callback, it became evident that this is not
the case and the problem isn't enough rcu_barrier() calls, but something
entirely else.

Call the rcu_barrier() just once as that's enough and the multiple
rcu_barrier() calls will not hide the real problem anymore, so we can
find it.

Merge branch '4607-call-a-single-rcu_barrier' into 'main'

See merge request isc-projects/bind9!9134
2024-08-05 10:24:53 +00:00
Ondřej Surý 13941c8ca7 Call rcu_barrier() in the isc_mem_destroy() just once
The previous work in this area was led by the belief that we might be
calling call_rcu() from within call_rcu() callbacks.  After carefully
checking all the current callback, it became evident that this is not
the case and the problem isn't enough rcu_barrier() calls, but something
entirely else.

Call the rcu_barrier() just once as that's enough and the multiple
rcu_barrier() calls will not hide the real problem anymore, so we can
find it.
2024-08-05 10:24:47 +00:00
Ondřej Surý 96ccd962b7 chg: usr: require at least OpenSSL 1.1.1
OpenSSL 1.1.1 or better (or equivalent LibreSSL version) is now required to compile BIND 9.

Closes #2806

Merge branch '2806-remove-ax_check_openssl' into 'main'

Closes #2806

See merge request isc-projects/bind9!9110
2024-08-05 10:24:23 +00:00
Ondřej SurýandAydın Mercan 8ccfbcfe72 Remove no longer needed OpenSSL shims and checks
Since the minimal OpenSSL version is now OpenSSL 1.1.1, remove all kind
of OpenSSL shims and checks for functions that are now always present in
the OpenSSL libraries.

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Aydın Mercan <aydin@isc.org>
2024-08-05 10:23:59 +00:00
Ondřej Surý 4d77eafd13 Remove AX_CHECK_OPENSSL macro
OpenSSL supports pkg-config method since the 0.9.8 version and we
already require pkg-config for other mandatory libraries.  Also
the way the AX_CHECK_OPENSSL macro was integrated into the configure
script was confusing - the macro would be used only if the libcrypto.pc
and libssl.pc file are not usable, so calling ./configure
--with-openssl=/usr/local would have no effect when PKG_CHECK_MODULES
would be successful.
2024-08-05 10:23:59 +00:00
Ondřej Surý c43b74c28b Bump the minimal OpenSSL version to 1.1.1
As BIND 9.20 does not support RHEL/CentOS 7 which just reach
end-of-life, we can safely bump the OpenSSL requirements to version
1.1.1, which in turn will allow us to simplify our OpenSSL integration.
2024-08-05 10:23:59 +00:00
Ondřej Surý 00739e99f6 fix: usr: Fix assertion failure when checking named-checkconf version
Checking the version of `named-checkconf` would end with assertion failure.  This has been fixed.

Closes #4827

Merge branch '4827-cleanup-dst-only-if-initialized' into 'main'

Closes #4827

See merge request isc-projects/bind9!9243
2024-08-05 10:16:39 +00:00
Ondřej Surý c54880e3fa Fix assertion failure when checking named-checkconf version
The dst_lib_destroy() should be called only if dst_lib_init() was called
before.  In named-checkconf, that is guarded by dst_cleanup variable
that was erroneously set to true by default.  Set the dst_cleanup to
'false' by default.
2024-08-05 10:16:33 +00:00
Ondřej Surý 7a705a3ea4 fix: usr: Valid TSIG signatures with invalid time cause crash
An assertion failure triggers when the TSIG has valid cryptographic signature, but the time is invalid. This can happen when the times between the primary and secondary servers are not synchronised.

Closes #4811

Merge branch '4811-fix-isc_buffer_putuint48-buffer-size-requirement' into 'main'

Closes #4811

See merge request isc-projects/bind9!9234
2024-08-05 09:40:10 +00:00
Ondřej Surý 8def0c3b12 Add a system test that sends TSIG with bad time
Add a system test that sets TSIG fudge to 0, waits three seconds and
then sends signed message to the server.  This tests the path where the
time difference between the client and the server is outside of the TSIG
fudge value.
2024-08-05 09:55:18 +02:00
Ondřej Surý 3835d75f00 Add tsig unit test for bad time and bad signatures
The tsig unit test was only testing if everything went ok, but it was
not testing whether the error paths work.  Add two more unit tests - one
uses the time outside of the TSIG skew, and the second trashes the
signature with random data.
2024-08-05 09:55:18 +02:00
Ondřej Surý 37dbd57c16 Fix the assertion failure when putting 48-bit number to buffer
When putting the 48-bit number into a fixed-size buffer that's exactly 6
bytes, the assertion failure would occur as the 48-bit number is
internally represented as 64-bit number and the code was checking if
there is enough space for `sizeof(val)`.  This causes assertion failure
when otherwise valid TSIG signature has a bad timing information.

Specify the size of the argument explicitly, so the 48-bit number
doesn't require 8-byte long buffer.
2024-08-05 09:55:18 +02:00
Ondřej Surý 026024a6ae fix: dev: Don't skip the counting if fcount_incr() is called with force==true
The fcount_incr() was incorrectly skipping the accounting for the
fetches-per-zone if the force argument was set to true.  We want to skip
the accounting only when the fetches-per-zone is completely disabled,
but for individual names we need to do the accounting even if we are
forcing the result to be success.

Closes #4786

Merge branch '4786-forced-fcount_incr-should-still-increment-count-and-allowed' into 'main'

Closes #4786

See merge request isc-projects/bind9!9115
2024-08-05 07:36:10 +00:00
Ondřej Surý a513d4c07f Don't skip the counting if fcount_incr() is called with force==true
The fcount_incr() was incorrectly skipping the accounting for the
fetches-per-zone if the force argument was set to true.  We want to skip
the accounting only when the fetches-per-zone is completely disabled,
but for individual names we need to do the accounting even if we are
forcing the result to be success.
2024-08-05 07:33:20 +00:00
Ondřej Surý b1c99c4458 fix: test: Use LC_ALL to override all system locales
The system tests were overriding the local locale by setting LANG to C.
This does not override the locale in case there are individual LC_<*>
variables like LC_CTYPE explicitly set.

Use LC_ALL=C instead which is the proper way of overriding all currently
set locales.

Merge branch 'ondrej/use-LC_ALL-not-LANG' into 'main'

See merge request isc-projects/bind9!9109
2024-08-05 07:33:02 +00:00
Ondřej Surý 10147efc87 Use LC_ALL to override all system locales
The system tests were overriding the local locale by setting LANG to C.
This does not override the locale in case there are individual LC_<*>
variables like LC_CTYPE explicitly set.

Use LC_ALL=C instead which is the proper way of overriding all currently
set locales.
2024-08-05 07:32:52 +00:00
Ondřej Surý 4c363393ff fix: dev: Remove superfluous memset() in isc_nmsocket_init()
The tlsstream part of the isc_nmsocket_t gets initialized via designater
initializer and doesn't need the extra memset() later; just remove it.

Merge branch 'ondrej/remove-superfluous-memset-in-isc_nmsocket_init' into 'main'

See merge request isc-projects/bind9!9120
2024-08-05 07:32:39 +00:00
Ondřej Surý 827a153d99 Remove superfluous memset() in isc_nmsocket_init()
The tlsstream part of the isc_nmsocket_t gets initialized via designater
initializer and doesn't need the extra memset() later; just remove it.
2024-08-05 07:32:12 +00:00
Ondřej Surý 4efdb8b00a fix: dev: Fix PTHREAD_MUTEX_ADAPTIVE_NP and PTHREAD_MUTEX_ERRORCHECK_NP usage
The PTHREAD_MUTEX_ADAPTIVE_NP and PTHREAD_MUTEX_ERRORCHECK_NP are
usually not defines, but enum values, so simple preprocessor check
doesn't work.

Check for PTHREAD_MUTEX_ADAPTIVE_NP from the autoconf AS_COMPILE_IFELSE
block and define HAVE_PTHREAD_MUTEX_ADAPTIVE_NP.  This should enable
adaptive mutex on Linux and FreeBSD.

As PTHREAD_MUTEX_ERRORCHECK actually comes from POSIX and Linux glibc
does define it when compatibility macros are being set, we can just use
PTHREAD_MUTEX_ERRORCHECK instead of PTHREAD_MUTEX_ERRORCHECK_NP.

Merge branch 'ondrej/fix-adaptive-mutex-use' into 'main'

See merge request isc-projects/bind9!9111
2024-08-05 07:31:54 +00:00
Ondřej Surý cc4f99bc6d Fix PTHREAD_MUTEX_ADAPTIVE_NP and PTHREAD_MUTEX_ERRORCHECK_NP usage
The PTHREAD_MUTEX_ADAPTIVE_NP and PTHREAD_MUTEX_ERRORCHECK_NP are
usually not defines, but enum values, so simple preprocessor check
doesn't work.

Check for PTHREAD_MUTEX_ADAPTIVE_NP from the autoconf AS_COMPILE_IFELSE
block and define HAVE_PTHREAD_MUTEX_ADAPTIVE_NP.  This should enable
adaptive mutex on Linux and FreeBSD.

As PTHREAD_MUTEX_ERRORCHECK actually comes from POSIX and Linux glibc
does define it when compatibility macros are being set, we can just use
PTHREAD_MUTEX_ERRORCHECK instead of PTHREAD_MUTEX_ERRORCHECK_NP.
2024-08-05 07:31:39 +00:00
Ondřej Surý f158884344 Remove ISC_MUTEX_INITIALIZER
It's hard to get it right on different platforms and it's unused
in BIND 9 anyway.
2024-08-05 07:31:39 +00:00
Ondřej Surý c33bf0de8d Remove defunct --with-locktype configure option
The --with-locktype configure option was no-op, so it was removed.
2024-08-05 07:31:39 +00:00
Ondřej Surý 246d5ccbc9 chg: dev: Don't open route socket if we don't need it
When automatic-interface-scan is disabled, the route socket was still
being opened.  Add new API to connect / disconnect from the route socket
only as needed.

Additionally, move the block that disables periodic interface rescans to
a place where it actually have access to the configuration values.
Previously, the values were being checked before the configuration was
loaded.

Closes #4757

Merge branch '4757-dont-open-routing-socket-if-not-needed' into 'main'

Closes #4757

See merge request isc-projects/bind9!9122
2024-08-05 07:31:20 +00:00
Ondřej Surý b26079fdaf Don't open route socket if we don't need it
When automatic-interface-scan is disabled, the route socket was still
being opened.  Add new API to connect / disconnect from the route socket
only as needed.

Additionally, move the block that disables periodic interface rescans to
a place where it actually have access to the configuration values.
Previously, the values were being checked before the configuration was
loaded.
2024-08-05 07:31:02 +00:00
Ondřej Surý afe406be39 chg: dev: Clarify that cds_wfcq_dequeue_blocking() doesn't block if empty
Merge branch 'ondrej/clarify-cds_wfcq_dequeue_blocking' into 'main'

See merge request isc-projects/bind9!9124
2024-08-05 07:30:41 +00:00
Ondřej Surý 912eaf6cb9 Clarify that cds_wfcq_dequeue_blocking() doesn't block if empty 2024-08-05 07:30:10 +00:00
Mark Andrews b9cbd3bc76 fix: usr: Remove extra newline from yaml output
I split this into two commits, one for the actual newline removal, and one for issues I found, ruining the yaml output when some errors were outputted.

Closes: #4772

Merge branch 'yaml-indent' into 'main'

Closes #4772

See merge request isc-projects/bind9!9112
2024-08-05 03:36:41 +00:00
Yedaya KatsmanandMark Andrews 1dd76fe780 Remove newlines from dighost errors calls
Not all invocations had it, and this makes it more consistent with
dighost_warning. Also remove the conditional newline when not outputting
yaml
2024-08-05 02:43:06 +00:00
Yedaya KatsmanandMark Andrews 8986dda74a Remove extra newline from +yaml output
The newlines weren't needed for the yaml syntax, and took up space.
2024-08-05 02:43:06 +00:00
Mark Andrews 35d93624a5 fix: dev: CID 498025 and CID 498031: Overflowed constant INTEGER_OVERFLOW
Add INSIST to fail if the multiplication would cause the variables to overflow.

Closes #4798

Merge branch '4798-cid-498025-and-cid-498031-overflowed-constant-integer_overflow' into 'main'

Closes #4798

See merge request isc-projects/bind9!9131
2024-08-04 23:48:31 +00:00
Mark Andrews 20ac13fb23 Prevent overflow of bufsize
If bufsize overflows we will have an infinite loop.  In practice
this will not happen unless we have made a coding error.  Add an
INSIST to detect this condition.

    181retry:
    182        isc_buffer_allocate(mctx, &b, bufsize);
    183        result = dns_rdata_totext(rdata, NULL, b);
    184        if (result == ISC_R_NOSPACE) {
    185                isc_buffer_free(&b);

    CID 498031: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression bufsize, which is equal to 0, overflows
    the type that receives it, an unsigned integer 32 bits wide.
    186                bufsize *= 2;
    187                goto retry;
    188        }
2024-08-03 03:39:26 +00:00
Mark Andrews e7ef0a60ab Prevent overflow of size
If size overflows we will have an infinite loop.  In practice
this will not happen unless we have made a coding error.  Add
an INSIST to detect this condition.

    181        while (!done) {
    182                isc_buffer_allocate(mctx, &b, size);
    183                result = dns_rdata_totext(rdata, NULL, b);
    184                if (result == ISC_R_SUCCESS) {
    185                        printf("%.*s\n", (int)isc_buffer_usedlength(b),
    186                               (char *)isc_buffer_base(b));
    187                        done = true;
    188                } else if (result != ISC_R_NOSPACE) {
    189                        check_result(result, "dns_rdata_totext");
    190                }
    191                isc_buffer_free(&b);

    CID 498025: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression size, which is equal to 0, overflows the type that
    receives it, an unsigned integer 32 bits wide.
    192                size *= 2;
    193        }
2024-08-03 03:39:26 +00:00
Petr Špaček 7838ca3f67 new: doc: Clarify how to print default dnssec-policy
Merge branch 'pspacek/doc-dnssec-policy-default' into 'main'

See merge request isc-projects/bind9!9092
2024-08-02 08:25:23 +00:00
Petr Špaček 1e1334a322 Clarify how to print default dnssec-policy
Reading the source tree is unnecessarily complicated, we now have
command line option to print defaults.
2024-08-02 09:51:59 +02:00
Mark Andrews 33f4ee7c36 fix: dev: Remove unnecessary operations
Decrementing optlen immediately before calling continue is unneccesary
and inconsistent with the rest of dns_message_pseudosectiontoyaml
and dns_message_pseudosectiontotext.  Coverity was also reporting
an impossible false positive overflow of optlen (CID 499061).

    4176                        } else if (optcode == DNS_OPT_CLIENT_TAG) {
    4177                                uint16_t id;
    4178                                ADD_STRING(target, "; CLIENT-TAG:");
    4179                                if (optlen == 2U) {
    4180                                        id = isc_buffer_getuint16(&optbuf);
    4181                                        snprintf(buf, sizeof(buf), " %u\n", id);
    4182                                        ADD_STRING(target, buf);

    CID 499061: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression optlen, which is equal to 65534, underflows
    the type that receives it, an unsigned integer 16 bits wide.
    4183                                        optlen -= 2;
    4184                                        POST(optlen);
    4185                                        continue;
    4186                                }
    4187                        } else if (optcode == DNS_OPT_SERVER_TAG) {

Merge branch 'marka-remove-unnecessary-operations' into 'main'

See merge request isc-projects/bind9!9130
2024-08-02 06:34:08 +00:00
Mark Andrews 47338c2c87 Remove unnecessary operations
Decrementing optlen immediately before calling continue is unneccesary
and inconsistent with the rest of dns_message_pseudosectiontoyaml
and dns_message_pseudosectiontotext.  Coverity was also reporting
an impossible false positive overflow of optlen (CID 499061).

    4176                        } else if (optcode == DNS_OPT_CLIENT_TAG) {
    4177                                uint16_t id;
    4178                                ADD_STRING(target, "; CLIENT-TAG:");
    4179                                if (optlen == 2U) {
    4180                                        id = isc_buffer_getuint16(&optbuf);
    4181                                        snprintf(buf, sizeof(buf), " %u\n", id);
    4182                                        ADD_STRING(target, buf);

    CID 499061: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression optlen, which is equal to 65534, underflows
    the type that receives it, an unsigned integer 16 bits wide.
    4183                                        optlen -= 2;
    4184                                        POST(optlen);
    4185                                        continue;
    4186                                }
    4187                        } else if (optcode == DNS_OPT_SERVER_TAG) {
2024-08-02 03:44:04 +00:00
Mark Andrews 0aee38e510 fix: test: digdelv system test can report more errors than there actually are
Closes #4770

Merge branch '4770-digdelv-system-test-can-report-more-errors-than-they-actually-are' into 'main'

Closes #4770

See merge request isc-projects/bind9!9104
2024-08-02 03:01:19 +00:00
Mark Andrews 2dc2abd00d Reset 'ret' to zero at start of tests 2024-08-02 01:23:17 +00:00
Arаm Sаrgsyаn 1661278b34 chg: usr: allow shorter resolver-query-timeout configuration
The minimum allowed value of 'resolver-query-timeout' was lowered to
301 milliseconds instead of the earlier 10000 milliseconds (which is the
default). As earlier, values less than or equal to 300 are converted to
seconds before applying the limit.

Closes #4320

Merge branch '4320-allow-shorter-resolver-query-timeout-configuration' into 'main'

Closes #4320

See merge request isc-projects/bind9!9091
2024-08-01 18:31:14 +00:00
Aram Sargsyan 63b787effe Update the resolver unit test
Before there was a gap from 301 to 9999 which would be converted
to 10000 and now there is no such gap.

This settimeout_belowmin test was checking the behavior of a value
in the gap. As there is now no gap left, the minimum is 301 and
anything below that is converted to seconds as before. In order
for this check to still test the "below minimum" behavior, change
the value from 9000 to 300.

Update the settimeout_overmax value test too so it logically aligns
with the minimum value test.
2024-08-01 18:30:35 +00:00
Aram Sargsyan 621149c50a Document shorter resolver-query-timeout configuration
The lower limit is now 301 milliseconds instead of 10000 milliseconds.
2024-08-01 18:30:35 +00:00
Aram Sargsyan d6a79cce53 Test shorter resolver-query-timeout configuration
Add two new checks which test the shorter than usual
resolver-query-timeout configuration.
2024-08-01 18:30:35 +00:00
Aram Sargsyan 5f47c2b567 Allow shorter resolver-query-timeout configuration
There are use cases for which shorter timeout values make sense.
For example if there is a load balancer which sets RD=1 and
forwards queries to a BIND resolver which is then configured to
talk to backend servers which are not visible in the public NS set.
WIth a shorter timeout value the frontend can give back SERVFAIL
early when backends are not available and the ultimate client will
not penalize the BIND-frontend for non-response.
2024-08-01 18:30:35 +00:00
Arаm Sаrgsyаn 34589811c5 new: usr: implement rndc retransfer -force
A new optional argument '-force' has been added to the command channel
command 'rndc retransfer'. When it is specified, named aborts the
ongoing zone transfer (if there is one), and starts a new transfer.

Closes #2299

Merge branch '2299-implement-rndc-force-retransfer' into 'main'

Closes #2299

See merge request isc-projects/bind9!9102
2024-08-01 16:54:45 +00:00
Aram Sargsyan 63b8a75de9 Rename dns_zone_forcereload() to dns_zone_forcexfr()
The new name describes the function more accurately.
2024-08-01 11:01:17 +00:00
Aram Sargsyan e48f4e8101 Test rndc retransfer -force
Use a big zone and the slow transfer mode. Initiate a retransfer, wait
several seconds, then initiate a retransfer using a '-force' argument,
which should cancel the previous transfer and start a new one.
2024-08-01 11:01:14 +00:00
Aram Sargsyan 3d1179501a Make dns_xfrin_shutdown() safe to run from a different loop
If the current loop is different than the zone transfer's loop then
run the shutdown operation asynchronously.
2024-08-01 10:43:47 +00:00
Aram Sargsyan 402ca316ae Implement rndc retransfer -force
With this new optional argument if there is an ongoing zone
transfer it will be aborted before a new zone transfer is scheduled.
2024-08-01 10:43:47 +00:00
Aram Sargsyan b156531b29 Do not automatically restart a canceled zone transfer
If a zone transfer is canceled there is no need to try the
next primary or retry with AXFR.
2024-08-01 10:43:47 +00:00
Mark Andrews ea2a5909a5 fix: usr: fix generation of 6to4-self name expansion from IPv4 address
The period between the most significant nibble of the encoded IPv4 address and the 2.0.0.2.IP6.ARPA suffix was missing resulting in the wrong name being checked. Add system test for 6to4-self implementation.

Closes #4766

Merge branch '4766-add-system-test-for-6to4-self' into 'main'

Closes #4766

See merge request isc-projects/bind9!9099
2024-08-01 06:40:17 +00:00
Mark Andrews 3b0de4773b check 'update-policy 6to4-self' over IPv6 2024-08-01 15:17:30 +10:00
Mark Andrews b28e5ff721 check 'update-policy 6to4-self' over IPv4 2024-08-01 15:17:30 +10:00
Mark Andrews bca63437a1 Add missing period to generated IPv4 6to4 name
The period between the most significant nibble of the IPv4 address
and the 2.0.0.2.IP6.ARPA suffix was missing resulting in the wrong
name being checked.
2024-08-01 15:17:30 +10:00
Mark Andrews 5857a4d397 fix: usr: fix false QNAME minimisation error being reported
Remove the false positive "success resolving" log message when QNAME minimisation is in effect and the final result is NXDOMAIN.

Closes #4784

Merge branch '4784-false-qname-minimisation-error-being-reported' into 'main'

Closes #4784

See merge request isc-projects/bind9!9117
2024-08-01 05:16:20 +00:00
Mark Andrews 111e285214 Test that false positive "success resolving" is not logged 2024-08-01 14:17:57 +10:00
Mark Andrews 6d1c7beb15 Cleanup old clang-format string splitting 2024-08-01 14:17:57 +10:00
Mark Andrews f78beca942 Remove false positive qname minimisation error
Don't report qname minimisation NXDOMAIN errors when the result is
NXDOMAIN.
2024-08-01 14:17:57 +10:00
Mark Andrews 93d7d221bd fix: usr: Dig +yaml was producing unexpected and/or invalid YAML output
Closes #4796

Merge branch '4796-yaml-stringify-question-and-records' into 'main'

Closes #4796

See merge request isc-projects/bind9!9127
2024-08-01 03:44:17 +00:00
Mark Andrews fadf461761 Test yaml output with yaml specials 2024-08-01 12:30:57 +10:00
Mark Andrews 393d7fa78e Fix yaml output
In yaml mode we emit a string for each question and record.  Certain
names and data could result in invalid yaml being produced.  Use single
quote string for all questions and records.  This requires that single
quotes get converted to two quotes within the string.
2024-08-01 12:30:57 +10:00
Mark Andrews 09b03d58c7 chg: test: resolver system test didn't fail on all subtest errors
Closes #4774

Merge branch '4774-resolver-system-test-didn-t-fail-on-all-subtest-errors' into 'main'

Closes #4774

See merge request isc-projects/bind9!9105
2024-08-01 02:29:19 +00:00
Mark Andrews 5843b29f47 resolver system test didn't record all failures 2024-08-01 01:15:42 +00:00
Mark Andrews 0b56763df3 fix: usr: SVBC alpn text parsing failed to reject zero length alpn
Closes #4775

Merge branch '4775-reject-zero-length-alpn-in-alpn-fromtext' into 'main'

Closes #4775

See merge request isc-projects/bind9!9106
2024-08-01 01:06:37 +00:00
Mark Andrews fa35c67301 Check invalid alpn empty value 2024-08-01 10:20:55 +10:00
Mark Andrews a49b2a3568 Check invalid alpn produced due to missing double escapes 2024-08-01 10:20:55 +10:00
Mark Andrews b51c9eb797 Properly reject zero length ALPN in commatxt_fromtext
ALPN are defined as 1*255OCTET in RFC 9460.  commatxt_fromtext was not
rejecting invalid inputs produces by missing a level of escaping
which where later caught be dns_rdata_fromwire on reception.

These inputs should have been rejected

	svcb in svcb 1 1.svcb alpn=\,abc
	svcb1 in svcb 1 1.svcb alpn=a\,\,abc

and generated 00 03 61 62 63 and 01 61 00 02 61 62 63 respectively.

The correct inputs to include commas in the alpn requires double
escaping.

	svcb in svcb 1 1.svcb alpn=\\,abc
	svcb1 in svcb 1 1.svcb alpn=a\\,\\,abc

and generate 04 2C 61 62 63 and 06 61 2C 2C 61 62 63 respectively.
2024-08-01 10:20:55 +10:00
Arаm Sаrgsyаn b80a0faf0b chg: doc: update querylog documentation in ARM
Add a note that 'rndc reload' and 'rndc reconfig' can't change the
querylog option during the runtime of named.

Closes #4801

Merge branch '4801-arm-querylog-clarification' into 'main'

Closes #4801

See merge request isc-projects/bind9!9136
2024-07-31 16:05:55 +00:00
Aram Sargsyan 8fd7da2a9e Update querylog documentation in ARM
Add a note that 'rndc reload' and 'rndc reconfig' can't change the
querylog option during the runtime of named.
2024-07-31 12:56:54 +00:00
Arаm Sаrgsyаn 020fda92b4 chg: dev: replace #define DNS_GETDB_ with struct of bools
Replace #define DNS_GETDB_ with struct of bools to make
it easier to pretty-print the attributes in a debugger.

Closes #4559

Merge branch '4559-convert-dns_getdb_x-defines-to-1-bit-long-bools' into 'main'

Closes #4559

See merge request isc-projects/bind9!9093
2024-07-31 12:53:50 +00:00
Aram Sargsyan cb5238cc62 Replace #define DNS_GETDB_ with struct of bools
This makes it easier to pretty-print the attributes in a debugger.
2024-07-31 11:52:52 +00:00
Arаm Sаrgsyаn 89ab9e948d fix: usr: return SERVFAIL for a too long CNAME chain
When cutting a long CNAME chain, named was returning NOERROR 
instead of SERVFAIL (alongside with a partial answer). This
has been fixed.

Closes #4449

Merge branch '4449-return-servfail-for-a-long-cname-chain' into 'main'

Closes #4449

See merge request isc-projects/bind9!9090
2024-07-31 11:50:33 +00:00
Aram Sargsyan 7751c7eca6 Update the chain test
Update the CNAME chain test to correspond to the changed behavior,
because now named returns SERVFAIL when hitting the maximum query
restarts limit (e.g. happening when following a long CNAME chain).

In the current test auth will hit the limit and return partial data
with a SERVFAIL code, while the resolver will return no data with
a SERVFAIL code after auth returns SERVFAIL to it.
2024-07-31 10:54:10 +00:00
Aram Sargsyan 580f872fe1 Test that a long CNAME chain causes SERVFAIL
Also check that the expected partial answer in returned too.
2024-07-31 10:54:10 +00:00
Aram Sargsyan b621f1d88e Return SERVFAIL for a too long CNAME chain
Due to the maximum query restart limitation a long CNAME chain
it is cut after 16 queries but named still returns NOERROR.

Return SERVFAIL instead and the partial answer.
2024-07-31 10:54:10 +00:00
Nicki Křížek 40f392c124 chg: test: Improve crypto support detection and algorithm selection in pytest
Ensure that the selected algorithms remains stable throughout the entire test session. Crypto support detection was rewritten to python and simplified.

Closes #4202

Closes #4422 

Related #3810

Merge branch '4202-algorithm-detection-pytest' into 'main'

Closes #4202 and #4422

See merge request isc-projects/bind9!8803
2024-07-31 09:37:51 +00:00
Nicki Křížek d7ace928b5 Initialize all environment variables when running isctest
Ensure all the variables are initialized when running the main function
of isctest module. This enables proper environment variables during test
script development when only conf.sh is sourced, rather than the script
being executed by the pytest runner.
2024-07-31 10:50:11 +02:00
Tom KrizekandNicki Křížek fc84bf80e4 Replace testcrypto.sh invocations in tests
Use the provided environment variables instead.
2024-07-31 10:50:11 +02:00
Tom KrizekandNicki Křížek 25cb39b7fc Rewrite testcrypto.sh into python
Run the crypto support checks when initializing the isctest package and
save those results in environment variable. This removes the need to
repeatedly check for crypto operation support, as it's not something
that would change at test runtime.
2024-07-31 10:50:10 +02:00
Tom KrizekandNicki Křížek 8302db407c Move test algorithm configuration to isctest
Instead of invoking get_algorithms.py script repeatedly (which may yield
different results), move the algorithm configuration to an isctest
module. This ensures the variables are consistent across the entire test
run.
2024-07-31 10:50:09 +02:00
Mark Andrews 5ff1fbe155 new: usr: add support for external log rotation tools
Add two mechanisms to close open log files.  The first is `rndc closelogs`.  The second is `kill -USR1 <pid>`.
They are intended to be used with external log rotation	tools.

Closes #4780

Merge branch '4780-add-support-for-external-log-rotation-tools' into 'main'

Closes #4780

See merge request isc-projects/bind9!9113
2024-07-31 08:48:51 +00:00
Mark Andrews 2e55a2ac69 Test that 'kill -USR1' works 2024-07-31 17:36:39 +10:00
Mark Andrews 88dfe50289 Document that SIGUSR1 closes log files 2024-07-31 17:36:39 +10:00
Mark Andrews 7a191400f9 Configure SIGUSR1 to close log files
Some external log file rotation programs use signals to tell programs
to close log files.  SIGHUP can be used to do this but it also does
a full reconfiguration.  Configure named to accept SIGUSR1 as a
signal to close log files.
2024-07-31 17:36:38 +10:00
Mark Andrews 5d26b8b71e Test that 'rndc closelogs' works 2024-07-31 17:36:38 +10:00
Mark Andrews 56c1f4aef2 Add a rndc command to close currently open log files
The new command is 'rndc closelogs'.
2024-07-31 17:36:38 +10:00
Mark Andrews 78aa4466fe Sort NAMED_COMMAND_* defines 2024-07-31 17:36:38 +10:00
Mark Andrews 48d39f7c30 Check that FILE_STREAM(channel) is not already closed
isc_log_closefilelogs can also close log files.  isc_log_doit failed
to check if the file handle was still valid before closing it.
2024-07-31 17:36:38 +10:00
Mark Andrews 6427d625ea fix: usr: Properly calculate the amount of system memory
On 32 bit machines isc_meminfo_totalphys could return an incorrect value.

Closes #4799

Merge branch '4799-cid-498034-overflowed-return-value-integer_overflow' into 'main'

Closes #4799

See merge request isc-projects/bind9!9132
2024-07-31 07:28:39 +00:00
Mark Andrews e8dbc5db92 Properly compute the physical memory size
On a 32 bit machine casting to size_t can still lead to an overflow.
Cast to uint64_t.  Also detect all possible negative values for
pages and pagesize to silence warning about possible negative value.

    39#if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
    	1. tainted_data_return: Called function sysconf(_SC_PHYS_PAGES),
           and a possible return value may be less than zero.
    	2. assign: Assigning: pages = sysconf(_SC_PHYS_PAGES).
    40        long pages = sysconf(_SC_PHYS_PAGES);
    41        long pagesize = sysconf(_SC_PAGESIZE);
    42
    	3. Condition pages == -1, taking false branch.
    	4. Condition pagesize == -1, taking false branch.
    43        if (pages == -1 || pagesize == -1) {
    44                return (0);
    45        }
    46
    	5. overflow: The expression (size_t)pages * pagesize might be negative,
           but is used in a context that treats it as unsigned.

    CID 498034: (#1 of 1): Overflowed return value (INTEGER_OVERFLOW)
    6. return_overflow: (size_t)pages * pagesize, which might have underflowed,
       is returned from the function.
    47        return ((size_t)pages * pagesize);
    48#endif /* if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE) */
2024-07-31 05:55:30 +00:00
Mark Andrews 0dcc93d87a chg: dev: Fix data race in clean_finds_at_name
Stop updating `find.result_v4` and `find.result_v4` in `clean_finds_at_name`. The values are supposed to be		static.

Closes #4118

Merge branch '4118-data-race-lib-dns-adb-c-1537-in-clean_finds_at_name' into 'main'

Closes #4118

See merge request isc-projects/bind9!9108
2024-07-31 05:34:48 +00:00
Mark Andrews 53a5f50e9d Do not update find.result_v4 and find.result_v6
These values are supposed to be static for the life of the find and
clean_finds_at_name was updating them resulting in TSAN error
reports.

    WARNING: ThreadSanitizer: data race
    Write of size 4 at 0x000000000001 by thread T1 (mutexes: write M1, write M2):
      #0 clean_finds_at_name lib/dns/adb.c:1537
      #1 fetch_callback lib/dns/adb.c:4009
      #2 task_run lib/isc/task.c:815
      #3 isc_task_run lib/isc/task.c:896
      #4 isc__nm_async_task netmgr/netmgr.c:848
      #5 process_netievent netmgr/netmgr.c:920
      #6 process_queue netmgr/netmgr.c:1013
      #7 process_all_queues netmgr/netmgr.c:767
      #8 async_cb netmgr/netmgr.c:796
      #9 uv__async_io /usr/src/libuv-v1.44.1/src/unix/async.c:163
      #10 isc__trampoline_run lib/isc/trampoline.c:189

    Previous read of size 4 at 0x000000000001 by thread T2:
      #0 findname lib/dns/resolver.c:3749
      #1 fctx_getaddresses lib/dns/resolver.c:3993
      #2 fctx_try lib/dns/resolver.c:4390
      #3 rctx_nextserver lib/dns/resolver.c:10356
      #4 rctx_done lib/dns/resolver.c:10503
      #5 resquery_response lib/dns/resolver.c:8511
      #6 udp_recv lib/dns/dispatch.c:638
      #7 isc__nm_async_readcb netmgr/netmgr.c:2885
      #8 isc__nm_readcb netmgr/netmgr.c:2858
      #9 udp_recv_cb netmgr/udp.c:650
      #10 isc__nm_udp_read_cb netmgr/udp.c:1057
      #11 uv__udp_recvmsg /usr/src/libuv-v1.44.1/src/unix/udp.c:303
      #12 isc__trampoline_run lib/isc/trampoline.c:189
2024-07-31 14:46:45 +10:00
Mark Andrews c32ddf9672 fix: test: Prevent intermittent setup.sh failures in the "statschannel" system test
Don't verify the just signed zone as the RRSIGs could have expired before the signing process completes

Closes #4781 #2476

Merge branch '4781-statschannel-setup-can-fail-due-to-short-validity-interval' into 'main'

Closes #4781 and #2476

See merge request isc-projects/bind9!9114
2024-07-31 04:42:43 +00:00
Mark Andrews 0d69afd764 Disable post zone verification for manykeys
As the expiration time is now+1 the RRSIG records may expire before
the verification step happens.
2024-07-31 03:32:14 +00:00
Matthijs Mekking 10602b1bbb chg: test: fix intermittent test failure dnssec system test
Closes #4768

Merge branch '4768-dnssec-test-is-broken' into 'main'

Closes #4768

See merge request isc-projects/bind9!9101
2024-07-30 12:01:37 +00:00
Matthijs Mekking e874632488 Fix intermittent test failure dnssec system test
The updatecheck-kskonly.secure zone is being used to test dynamic
updates while the KSK is offline. It ensures that the DNSKEY RRset
will retain the RRSIG record, while the updated data is being signed
with the currently active ZSK.

When walking through ZSK rollovers, ensure that the newest ZSK (ZSK3)
is published before doing the dynamic update, preventing timing
related test failures.

Also fix the test log line ($ZSK_ID3 was not yet created at the time
of logging).
2024-07-30 10:33:45 +00:00
Matthijs Mekking d9d882816a fix: usr: Update key lifetime and metadata after dnssec-policy reconfig
Adjust key state and timing metadata if dnssec-policy key lifetime configuration is updated, so that it also
affects existing keys.

Closes #4677

Merge branch '4677-dnssec-policy-key-lifetime-reconfigure' into 'main'

Closes #4677

See merge request isc-projects/bind9!9118
2024-07-30 10:13:01 +00:00
Mark AndrewsandMatthijs Mekking 14a76ae498 Log key calculation overflows 2024-07-30 10:58:54 +02:00
Mark AndrewsandMatthijs Mekking 25845a866e Check for overflow when adding lifetime 2024-07-30 10:58:54 +02:00
Matthijs Mekking 129973ebb0 No longer update key lifetime if key is retired
The key lifetime should no longer be adjusted if the key is being
retired earlier, for example because a manual rollover was started.

This would falsely be seen as a dnssec-policy lifetime reconfiguration,
and would adjust the retire/removed time again.

This also means we should update the status output, and the next
rollover scheduled is now calculated using (retire-active) instead of
key lifetime.
2024-07-30 10:57:14 +02:00
Matthijs Mekking 1cec0b0448 Update key lifetime and metadata after reconfig
If dnssec-policy is reconfigured and the key lifetime has changed,
update existing keys with the new lifetime and adjust the retire
and removed timing metadata accordingly.

If the key has no lifetime yet, just initialize the lifetime. It
may be that the retire/removed timing metadata has already been set.

Skip keys which goal is not set to omnipresent. These keys are already
in the progress of retiring, or still unused.
2024-07-30 10:57:14 +02:00
Matthijs Mekking 2237895bb4 Test updating dnssec-policy key lifetime
Check if the key lifetime is updated in the key files. Make sure the
inactive and removed timing metadata are adjusted accordingly.
2024-07-30 10:57:14 +02:00
Matthijs Mekking 93326e3e18 Move dnssec-policy to kasp-fips.conf.in
All dnssec-policy configurations are here, so why not this one?
2024-07-30 10:57:14 +02:00
Matthijs Mekking b2dc6edeb8 fix: doc: Fix type in key-store reference rst
Closes #4813

Merge branch '4813-fix-typo-in-reference-rst' into 'main'

Closes #4813

See merge request isc-projects/bind9!9176
2024-07-30 08:36:17 +00:00
Suzanne GoldlustandMatthijs Mekking 645cd0496e Fix backslashes on key-store block 2024-07-30 07:49:38 +00:00
Nicki Křížek f72563cc4a chg: test: Retry job in case of AWS Spot Instance interruption event
Closes #4777

Merge branch '4777-retry-job-aws-spot-instance-interruption-event' into 'main'

Closes #4777

See merge request isc-projects/bind9!9107
2024-07-29 13:25:46 +00:00
Emanuel PetrandNicki Křížek bbcce1bfc1 Retry job in case of AWS Spot Instance interruption 2024-07-29 14:16:50 +02:00
Nicki Křížek a64ecc5fdd new: dev: generate changelog from git log
Use a single source of truth, the git log, to generate the list of CHANGES. Use the .rst format and include it in the ARM for a quick reference with proper gitlab links to issues and merge requests.

Closes #75

Merge branch 'nicki/add-gitchangelog' into 'main'

Closes #75

See merge request isc-projects/bind9!9152
2024-07-29 12:15:49 +00:00
Nicki Křížek bcc99213a5 Update docs and processes to use the new changelog 2024-07-29 13:03:21 +02:00
Nicki Křížek 91be111dc7 Update dangerfile for new changelog workflow 2024-07-29 13:03:21 +02:00
Nicki Křížek 7cbb052649 Skip pylint checks for contrib directory
The files in contrib/ directory shouldn't be subject to our pylint
check. They can come from external sources and we don't subject these to
the same standards as the rest of the BIND9 code / scripts.
2024-07-29 13:03:21 +02:00
Nicki Křížek 3f1a843695 Remove changes job and related scripts
These are no longer needed, since changelog is generated using
gitchangelog.
2024-07-29 13:03:20 +02:00
Nicki Křížek 0ec8b99ea3 Add BIND9 configuration for gitchangelog
The configuration has been crafted to cater for BIND9 needs:
- Define actions that have an equivalent section in existing Release
  Notes
- Assume the commits that have the necessary changelog makrup are merge
  commits from GitLab and transform them into messages and proper links
- Put the resulting changelog into the proper place in
  doc/arm/changelog.rst
- Have a separate configuration for changelog and release notes. Both of
  these should be generated from the `git log`, with release notes being
  subject to more scrutiny and further editing
2024-07-29 13:03:20 +02:00
Nicki Křížek e9b6031e0c Add new changelog file
Create new changelog and include it in the documentation. Include the
previous CHANGES as plain text without any markup.
2024-07-29 13:03:19 +02:00
Nicki Křížek 951280bca5 Address gitchangelog deprecation warning 2024-07-24 17:43:11 +02:00
Nicki Křížek 1c95eeeb3f Adjust gitchangelog whitespace
Format the output to produce a nicer looking rst output, similar to the
former CHANGES file.
2024-07-24 17:43:11 +02:00
Nicki Křížek c2b23fa2de Allow gitchangelog to include commit sha
Add an option which can be used to put short commit sha at the end of
each commit subject line in the generated changelog.
2024-07-24 17:43:10 +02:00
Nicki Křížek a8258d1c53 Remove authors from gitchangelog output
Given our workflow, this could easily lead to misattribution. It's also
not an actionable information and it can be found in the MR / git log
instead.
2024-07-24 17:43:10 +02:00
Nicki Křížek 9f90c1c65e Reformat gitchangelog with black 2024-07-24 17:43:10 +02:00
Nicki Křížek 63247d8a73 Import gitchanglog 3.0.4
The  project hasn't seen any new development/changes since 2018 and it
seems unlikely we'd be able to get any changes into the upstream. Since
it's isolated into a single file and its task is fairly straighforward,
pull the code into our own repository and maintain it here as needed.

This also makes it easier to make any changes that are specific to our
project.
2024-07-24 17:43:08 +02:00
Nicki Křížek 315d3d771f Set up version and release notes for BIND 9.21.0
Merge branch 'nicki/set-up-version-and-release-notes-for-bind-9.21.0' into 'main'

See merge request isc-projects/bind9!9166
2024-07-23 16:33:22 +00:00
Nicki Křížek 8b153abd3c Set up release notes for BIND 9.21.0 2024-07-23 17:39:26 +02:00
Nicki Křížek 0f93a755d1 Update BIND version to 9.21.0-dev 2024-07-23 17:39:25 +02:00
Nicki Křížek 03e289030e Merge tag 'v9.20.0' 2024-07-23 17:15:41 +02:00
Nicki Křížek 14bbdfc7b9 Update BIND version to 9.20.0 2024-07-08 15:01:00 +02:00
Nicki Křížek c299dece45 Add a CHANGES marker 2024-07-08 14:58:59 +02:00
Nicki Křížek 844864041c Merge branch 'nicki/prepare-documentation-for-bind-9.20.0' into 'v9.20.0-release'
Prepare documentation for BIND 9.20.0

See merge request isc-private/bind9!710
2024-07-08 12:55:47 +00:00
Nicki Křížek 3489840948 Update documentation for 9.20.0 2024-07-08 14:53:01 +02:00
Nicki Křížek 890ebd3fd3 Create release notes for 9.20.0 2024-07-08 14:53:01 +02:00
Nicki Křížek 1fa52674e1 Extend max-types-per-name documentation 2024-07-08 14:53:01 +02:00
Nicki Křížek 322110a797 Document new -J option for dnssec-signzone and dnssec-verify 2024-07-08 14:53:01 +02:00
Nicki Křížek b3423bb347 Reorder release notes 2024-07-08 14:53:01 +02:00
Nicki Křížek 6d44c8fcbd Tweak and reword release notes 2024-07-08 14:53:00 +02:00
Nicki Křížek 10d2aceb02 Add release note for [GL #4708] 2024-07-08 14:53:00 +02:00
Nicki Křížek a624b8c541 Add release note for [GL #4736] 2024-07-08 14:53:00 +02:00
Nicki Křížek 0a584eb318 Add release note for [GL #3472] 2024-07-08 14:53:00 +02:00
Nicki Křížek e847f32a36 Prepare release notes for BIND 9.19.25
This version won't be released. This commit is just a preparation for
9.20.0.
2024-07-08 14:53:00 +02:00
Nicki Křížek 3d307f869d Add another placeholder for [GL #4480]
(cherry picked from commit 1680916d67)
2024-07-08 14:52:58 +02:00
Nicki Křížek 99309ce8ae Merge branch 'tcp-reset-connection-on-failed-send' into 'v9.20.0-release'
[CVE-2024-0760 (part 3)] Reset the TCP connection on a failed send

See merge request isc-private/bind9!721
2024-07-03 15:50:58 +00:00
Artem Boldariev 5781ff3a93 Drop expired but not accepted TCP connections
This commit ensures that we are not attempting to accept an expired
TCP connection as we are not interested in any data that could have
been accumulated in its internal buffers. Now we just drop them for
good.
2024-07-03 15:03:02 +03:00
Ondřej Surý bf9fd2a6ff Reset the TCP connection on a failed send
When sending fails, the ns__client_request() would not reset the
connection and continue as nothing is happening.  This comes from the
model that we don't care about failed UDP sends because datagrams are
unreliable anyway, but it greatly affects TCP connections with
keep-alive.

The worst case scenario is as follows:

1. the 3-way TCP handshake gets completed
2. the libuv calls the "uv_connection_cb" callback
3. the TCP connection gets queue because of the tcp-clients quota
4. the TCP client sends as many DNS messages as the buffers allow
5. the TCP connection gets dropped by the client due to the timeout
6. the TCP connection gets accepted by the server
7. the data already sent by the client gets read
8. all sending fails immediately because the TCP connection is dead
9. we consume all the data in the buffer in a very tight loop

As it doesn't make sense to trying to process more data on the TCP
connection when the sending is failing, drop the connection immediately
on the first sending error.
2024-07-03 09:07:20 +02:00
Ondřej Surý 1c0564d715 Remove ns_query_init() cannot fail, remove the error paths
As ns_query_init() cannot fail now, remove the error paths, especially
in ns__client_setup() where we now don't have to care what to do with
the connection if setting up the client could fail.  It couldn't fail
even before, but now it's formal.
2024-07-03 09:05:51 +02:00
Ondřej Surý bc3e713317 Throttle the reading when writes are asynchronous
Be more aggressive when throttling the reading - when we can't send the
outgoing TCP synchronously with uv_try_write(), we start throttling the
reading immediately instead of waiting for the send buffers to fill up.

This should not affect behaved clients that read the data from the TCP
on the other end.
2024-07-03 08:45:39 +02:00
Nicki Křížek 92a73bca2d Merge branch '3405-security-limit-the-number-of-resource-records-in-rrset-nxdomain' into 'v9.20.0-release'
[CVE-2024-1737 (part 2)] Be smarter about refusing to add many RR types to the database

See merge request isc-private/bind9!712
2024-07-02 11:05:37 +00:00
Ondřej Surý 4089f4e2c3 Add more tests for adding many RR types to the database
More reclimit tests that test various scenarios adding combinations of
priority and non-priority RR types into the database.
2024-07-01 12:49:02 +02:00
Ondřej Surý 57cd34441a Be smarter about refusing to add many RR types to the database
Instead of outright refusing to add new RR types to the cache, be a bit
smarter:

1. If the new header type is in our priority list, we always add either
   positive or negative entry at the beginning of the list.

2. If the new header type is negative entry, and we are over the limit,
   we mark it as ancient immediately, so it gets evicted from the cache
   as soon as possible.

3. Otherwise add the new header after the priority headers (or at the
   head of the list).

4. If we are over the limit, evict the last entry on the normal header
   list.
2024-07-01 12:48:51 +02:00
Ondřej Surý 58f660cf2b Make the resolver qtype ANY test order agnostic
Instead of relying on a specific order of the RR types in the databases
pick the first RR type as returned from the cache.
2024-07-01 12:47:30 +02:00
Ondřej Surý b27c6bcce8 Expand the list of the priority types and move it to db_p.h
Add HTTPS, SVCB, SRV, PTR, NAPTR, DNSKEY and TXT records to the list of
the priority types that are put at the beginning of the slabheader list
for faster access and to avoid eviction when there are more types than
the max-types-per-name limit.
2024-07-01 12:47:30 +02:00
Nicki Křížek b8522e5b8e Merge branch 'tcp-do-not-unthrottle-on_isc_nm_read' into 'v9.20.0-release'
[CVE-2024-0760 (part 2)] Do not un-throttle TCP connections on isc_nm_read()

See merge request isc-private/bind9!708
2024-06-25 08:54:47 +00:00
Artem Boldariev 55b1a093ea Do not un-throttle TCP connections on isc_nm_read()
Due to omission it was possible to un-throttle a TCP connection
previously throttled due to the peer not reading back data we are
sending.

In particular, that affected DoH code, but it could also affect other
transports (the current or future ones) that pause/resume reading
according to its internal state.
2024-06-12 13:44:37 +03:00
Nicki Křížek 392e7199df Merge branch 'nicki/add-another-placeholder-for-4480' into 'main'
Add another placeholder for [GL #4480]

See merge request isc-projects/bind9!9100
2024-06-11 07:33:46 +00:00
Nicki Křížek 1680916d67 Add another placeholder for [GL #4480] 2024-06-11 09:30:47 +02:00
Nicki Křížek 9216d0a74c Merge branch 'nicki/add-placeholder-entries' into 'main'
Add placeholder entries to CHANGES

See merge request isc-projects/bind9!9096
2024-06-10 15:52:21 +00:00
Nicki Křížek f149ecc81a Merge branch '4507-confidential-clear-zversion' into 'v9.20.0-release'
[CVE-2024-4076] serve-stale zversion crash

See merge request isc-private/bind9!631
2024-06-10 15:51:03 +00:00
Matthijs MekkingandNicki Křížek 6f58d2c6fa Add release note for [GL #4507] 2024-06-10 17:47:55 +02:00
Mark AndrewsandNicki Křížek d8a4851e90 Add CHANGES note for [GL #4507] 2024-06-10 17:47:15 +02:00
Mark AndrewsandNicki Křížek e52c2a654b Clear qctx->zversion
Clear qctx->zversion when clearing qctx->zrdataset et al in
lib/ns/query.c:qctx_freedata.  The uncleared pointer could lead to
an assertion failure if zone data needed to be re-saved which could
happen with stale data support enabled.
2024-06-10 17:45:38 +02:00
Nicki Křížek b2cfdba565 Merge branch '4480-sig0-can-be-used-to-exhaust-cpu-resources-v6' into 'v9.20.0-release'
[CVE-2024-1975] Mitigate SIG(0) CPU resources exhaustion attack vectors

See merge request isc-private/bind9!689
2024-06-10 15:44:34 +00:00
Petr ŠpačekandNicki Křížek 9370acd3a7 Require local KEYs for SIG(0) verification
This is additional hardening. There is no known use-case for KEY RRs
from DNS cache and it potentially allows attackers to put weird keys
into cache.
2024-06-10 17:36:45 +02:00
Aram SargsyanandNicki Křížek d69fab1530 Mark SIG(0) quota settings as experimantal
A different solution in the future might be adopted depending
on feedback and other new information, so it makes sense to mark
these options as EXPERIMENTAL until we have more data.
2024-06-10 17:36:45 +02:00
Aram SargsyanandNicki Křížek 54ddd848fe Avoid running get_matching_view() asynchronously on an error path
Also create a new ns_client_async_reset() static function to decrease
code duplication.
2024-06-10 17:35:40 +02:00
Aram SargsyanandNicki Křížek a2b61c0a65 Test that named checks maximum two keys for SIG(0)-signed messages
Send three updates with three different keys, and expect that one
of them should fail.

Also retain more artifacts for neighboring nsupdate calls.
2024-06-10 17:35:39 +02:00
Aram SargsyanandNicki Křížek be482311de Add a release note for [GL #4480] 2024-06-10 17:35:36 +02:00
Aram SargsyanandNicki Křížek 3bb9241bec Add a CHANGES note for [GL #4480] 2024-06-10 17:34:09 +02:00
Aram SargsyanandNicki Křížek 7ca9bd6014 Limit the number of keys for SIG(0) message verification
Check at most two KEY RRs agains a SIG(0) signature. This should
limit potential abuse and at the same time allow key rollover.
2024-06-10 17:33:11 +02:00
Aram SargsyanandNicki Křížek 70ff4a3f85 Run resolver message signature checking asynchronously 2024-06-10 17:33:11 +02:00
Aram SargsyanandNicki Křížek ad489c44df Remove sig0checks-quota-maxwait-ms support
Waiting for a quota to appear complicates things and wastes
rosources on timer management. Just answer with REFUSE if
there is no quota.
2024-06-10 17:33:11 +02:00
Aram SargsyanandNicki Křížek f0cde05e06 Implement asynchronous view matching for SIG(0)-signed queries
View matching on an incoming query checks the query's signature,
which can be a CPU-heavy task for a SIG(0)-signed message. Implement
an asynchronous mode of the view matching function which uses the
offloaded signature checking facilities, and use it for the incoming
queries.
2024-06-10 17:33:10 +02:00
Aram SargsyanandNicki Křížek 710bf9b938 Implement asynchronous message signature verification
Add support for using the offload threadpool to perform message
signature verifications. This should allow check SIG(0)-signed
messages without affecting the worker threads.
2024-06-10 17:33:10 +02:00
Aram SargsyanandNicki Křížek 7f013ad05d Remove dns_message_rechecksig()
This is a tiny helper function which is used only once and can be
replaced with two function calls instead. Removing this makes
supporting asynchronous signature checking less complicated.
2024-06-10 17:33:10 +02:00
Aram SargsyanandNicki Křížek bbc866d0cb Document the SIG(0) signature checking quota options
Add documentation entries for the 'sig0checks-quota',
'sig0checks-quota-maxwait-ms', and 'sig0checks-quota-exempt'
optoins.
2024-06-10 17:33:10 +02:00
Aram SargsyanandNicki Křížek c7f79a0353 Add a quota for SIG(0) signature checks
In order to protect from a malicious DNS client that sends many
queries with a SIG(0)-signed message, add a quota of simultaneously
running SIG(0) checks.

This protection can only help when named is using more than one worker
threads. For example, if named is running with the '-n 4' option, and
'sig0checks-quota 2;' is used, then named will make sure to not use
more than 2 workers for the SIG(0) signature checks in parallel, thus
leaving the other workers to serve the remaining clients which do not
use SIG(0)-signed messages.

That limitation is going to change when SIG(0) signature checks are
offloaded to "slow" threads in a future commit.

The 'sig0checks-quota-exempt' ACL option can be used to exempt certain
clients from the quota requirements using their IP or network addresses.

The 'sig0checks-quota-maxwait-ms' option is used to define a maximum
amount of time for named to wait for a quota to appear. If during that
time no new quota becomes available, named will answer to the client
with DNS_R_REFUSED.
2024-06-10 17:33:08 +02:00
Nicki Křížek 24e8cc7b38 Merge branch '3405-security-limit-the-number-of-resource-records-in-rrset' into 'v9.20.0-release'
Limit the number of RRs in RRSets

See merge request isc-private/bind9!694
2024-06-10 15:01:48 +00:00
Evan HuntandNicki Křížek 1bf7795b38 Add CHANGES and release note for [GL #3403] 2024-06-10 16:57:29 +02:00
Matthijs MekkingandNicki Křížek c1ac8b6ad0 Log rekey failure as error if too many records
By default we log a rekey failure on debug level. We should probably
change the log level to error. We make an exception for when the zone
is not loaded yet, it often happens at startup that a rekey is
run before the zone is fully loaded.
2024-06-10 16:55:12 +02:00
Matthijs MekkingandNicki Křížek 82635e56d8 Log error when update fails
The new "too many records" error can make an update fail without the
error being logged. This commit fixes that.
2024-06-10 16:55:12 +02:00
Evan HuntandNicki Křížek 7dd6b47ace fix a memory leak that could occur when signing
when signatures were not added because of too many types already
existing at a node, the diff was not being cleaned up; this led to
a memory leak being reported at shutdown.
2024-06-10 16:55:12 +02:00
Matthijs MekkingandNicki Křížek 4e46453035 Add new test cases with DNSSEC signing
kasp-max-types-per-name (named2.conf.in):
An unsigned zone with RR type count on a name right below the
configured limit. Then sign the zone using KASP. Adding a RRSIG would
push it over the RR type limit per name. Signing should fail, but
the server should not crash, nor end up in infinite resign-attempt loop.

kasp-max-records-per-type-dnskey (named1.conf.in):
Test with low max-record-per-rrset limit and a DNSSEC policy requiring
more than the limit. Signing should fail.

kasp-max-types-per-name (named1.conf.in):
Each RRSIG(covered type) is counted as an individual RR type. Test the
corner case where a signed zone, which is just below the limit-1,
adds a new type - doing so would trigger signing for the new type and
thus increase the number of "types" by 2, pushing it over the limit
again.
2024-06-10 16:55:11 +02:00
Matthijs MekkingandNicki Křížek 15ecd2cce6 Check if restart works 2024-06-10 16:55:11 +02:00
Matthijs MekkingandNicki Křížek ef9d5cf552 Switch to inline-signing no 2024-06-10 16:55:11 +02:00
Matthijs MekkingandNicki Křížek 6297e0d7a9 Add test cases that use DNSSEC signing
Add two new masterformat tests that use signing. In the case of
'under-limit-kasp', the signing will keep the number of records in the
RRset under the limit. In the case of 'on-limit-kasp', the signing
will push the number of records in the RRset over the limit, because
of the added RRSIG record.
2024-06-10 16:55:11 +02:00
Petr ŠpačekandNicki Křížek b2afc83040 Remove duplicated empty zone files 2024-06-10 16:55:11 +02:00
Petr ŠpačekandNicki Křížek d85f516f5b masterformat: rename zone names to reflect intended meaning 2024-06-10 16:55:10 +02:00
Petr ŠpačekandNicki Křížek 124e220579 Test owner name rename: a b c d e -> <number>-txt 2024-06-10 16:55:10 +02:00
Petr ŠpačekandNicki Křížek c080e510ab Test variable rename i->_attempt 2024-06-10 16:55:10 +02:00
Petr ŠpačekandNicki Křížek 35faf81680 Test variable rename a->rrcount 2024-06-10 16:55:10 +02:00
Ondřej SurýandNicki Křížek ccde4911ca Add test for not-loading many RRsets per name on a secondary
This tests makes sure the zone with many RRsets per name is not loaded
via XFR on the secondary server.
2024-06-10 16:55:10 +02:00
Ondřej SurýandNicki Křížek 86aa4674ab Add a test for not caching large number of RRsets
Send a recursive query for a large number of RRsets, which should
fail when using the default max-types-per-name setting of 100, but
succeed when the cap is disabled.
2024-06-10 16:55:10 +02:00
Ondřej SurýandNicki Křížek 52b3d86ef0 Add a limit to the number of RR types for single name
Previously, the number of RR types for a single owner name was limited
only by the maximum number of the types (64k).  As the data structure
that holds the RR types for the database node is just a linked list, and
there are places where we just walk through the whole list (again and
again), adding a large number of RR types for a single owner named with
would slow down processing of such name (database node).

Add a configurable limit to cap the number of the RR types for a single
owner.  This is enforced at the database (rbtdb, qpzone, qpcache) level
and configured with new max-types-per-name configuration option that
can be configured globally, per-view and per-zone.
2024-06-10 16:55:09 +02:00
Evan HuntandNicki Křížek 3dc4388f4a Add a test for not caching large RRset
Send a recursive query for a large (2500 record) RRset, which should
fail when using the default max-records-per-type setting of 100, but
succeed when the cap is disabled.
2024-06-10 16:55:09 +02:00
Ondřej SurýandNicki Křížek 5d4e57b914 Add test for not-loading and not-transfering huge RRSets
Add two new masterformat tests - the 'huge' zone fits within the ns1
limit and loads on the primary ns1 server, but must not transfer to the
ns2 secondary, and the 'uber' zone should not even load on the primary
ns1 server.
2024-06-10 16:55:09 +02:00
Ondřej SurýandNicki Křížek 32af7299eb Add a limit to the number of RRs in RRSets
Previously, the number of RRs in the RRSets were internally unlimited.
As the data structure that holds the RRs is just a linked list, and
there are places where we just walk through all of the RRs, adding an
RRSet with huge number of RRs inside would slow down processing of said
RRSets.

Add a configurable limit to cap the number of the RRs in a single RRSet.
This is enforced at the database (rbtdb, qpzone, qpcache) level and
configured with new max-records-per-type configuration option that can
be configured globally, per-view and per-zone.
2024-06-10 16:55:07 +02:00
Nicki Křížek 0b44383c5b Merge branch '4481-security-tcp-flood' into 'v9.20.0-release'
[CVE-2024-0760] Throttle reading from TCP if the sends are not getting through

See merge request isc-private/bind9!639
2024-06-10 14:53:12 +00:00
Ondřej SurýandNicki Křížek 1002f920f6 Add CHANGES and release note for [GL #4481] 2024-06-10 16:49:56 +02:00
Ondřej SurýandNicki Křížek e28266bfbc Remove the extra memory context with own arena for sending
The changes in this MR prevent the memory used for sending the outgoing
TCP requests to spike so much.  That strictly remove the extra need for
own memory context, and thus since we generally prefer simplicity,
remove the extra memory context with own jemalloc arenas just for the
outgoing send buffers.
2024-06-10 16:48:54 +02:00
Ondřej SurýandNicki Křížek 4c2ac25a95 Limit the number of DNS message processed from a single TCP read
The single TCP read can create as much as 64k divided by the minimum
size of the DNS message.  This can clog the processing thread and trash
the memory allocator because we need to do as much as ~20k allocations in
a single UV loop tick.

Limit the number of the DNS messages processed in a single UV loop tick
to just single DNS message and limit the number of the outstanding DNS
messages back to 23.  This effectively limits the number of pipelined
DNS messages to that number (this is the limit we already had before).
2024-06-10 16:48:54 +02:00
Ondřej SurýandNicki Křížek 452a2e6348 Replace the tcp_buffers memory pool with static per-loop buffer
As a single thread can process only one TCP send at the time, we don't
really need a memory pool for the TCP buffers, but it's enough to have
a single per-loop (client manager) static buffer that's being used to
assemble the DNS message and then it gets copied into own sending
buffer.

In the future, this should get optimized by exposing the uv_try API
from the network manager, and first try to send the message directly
and allocate the sending buffer only if we need to send the data
asynchronously.
2024-06-10 16:48:53 +02:00
Aram SargsyanandNicki Křížek 982eab7de0 ns_client: reuse TCP send buffers
Constantly allocating, reallocating and deallocating 64K TCP send
buffers by 'ns_client' instances takes too much CPU time.

There is an existing mechanism to reuse the ns_clent_t structure
associated with the handle using 'isc_nmhandle_getdata/_setdata'
(see ns_client_request()), but it doesn't work with TCP, because
every time ns_client_request() is called it gets a new handle even
for the same TCP connection, see the comments in
streamdns_on_complete_dnsmessage().

To solve the problem, we introduce an array of available (unused)
TCP buffers stored in ns_clientmgr_t structure so that a 'client'
working via TCP can have a chance to reuse one (if there is one)
instead of allocating a new one every time.
2024-06-10 16:48:53 +02:00
Ondřej SurýandNicki Křížek 4e7c4af17f Throttle reading from TCP if the sends are not getting through
When TCP client would not read the DNS message sent to them, the TCP
sends inside named would accumulate and cause degradation of the
service.  Throttle the reading from the TCP socket when we accumulate
enough DNS data to be sent.  Currently this is limited in a way that a
single largest possible DNS message can fit into the buffer.
2024-06-10 16:48:52 +02:00
Nicki Křížek d3609b742d Merge branch '4473-fix-doh-intermittent-crash' into 'v9.20.0-release'
DoH:  Avoid potential data races in our DoH implementation related to to HTTP/2 session object management and endpoints set object management

See merge request isc-private/bind9!614
2024-06-10 14:45:42 +00:00
Artem BoldarievandNicki Křížek cdb5ae35e8 Modify release notes [GL #4473]
Mention that an intermittent BIND process termination in DoH code has
been fixed.
2024-06-10 16:41:00 +02:00
Artem BoldarievandNicki Křížek a51ffa58d7 Modify CHANGES [GL #4473]
Mention that an intermittent BIND process termination in DoH code has
been fixed.
2024-06-10 16:40:56 +02:00
Artem BoldarievandNicki Křížek d80dfbf745 Keep the endpoints set reference within an HTTP/2 socket
This commit ensures that an HTTP endpoints set reference is stored in
a socket object associated with an HTTP/2 stream instead of
referencing the global set stored inside a listener.

This helps to prevent an issue like follows:

1. BIND is configured to serve DoH clients;
2. A client is connected and one or more HTTP/2 stream is
created. Internal pointers are now pointing to the data on the
associated HTTP endpoints set;
3. BIND is reconfigured - the new endpoints set object is created and
promoted to all listeners;
4. The old pointers to the HTTP endpoints set data are now invalid.

Instead referencing a global object that is updated on
re-configurations we now store a local reference which prevents the
endpoints set objects to go out of scope prematurely.
2024-06-10 16:40:12 +02:00
Artem BoldarievandNicki Křížek c41fb499b9 DoH: avoid potential use after free for HTTP/2 session objects
It was reported that HTTP/2 session might get closed or even deleted
before all async. processing has been completed.

This commit addresses that: now we are avoiding using the object when
we do not need it or specifically check if the pointers used are not
'NULL' and by ensuring that there is at least one reference to the
session object while we are doing incoming data processing.

This commit makes the code more resilient to such issues in the
future.
2024-06-10 16:40:10 +02:00
Nicki Křížek 662e3cd14b Add placeholder entries to CHANGES
Add placeholders for the following issues:

- [GL #4473]
- [GL #4481]
- [GL #497] [GL #3405]
- [GL #3403] [GL #4548]
- [GL #4480]
- [GL #4507]
2024-06-10 16:19:03 +02:00
Nicki Křížek 07a5e7a921 Merge branch 'nicki/add-placeholder-for-4661' into 'main'
Add a CHANGES placeholder for [GL #4661]

See merge request isc-projects/bind9!9097
2024-06-10 14:16:46 +00:00
Nicki Křížek 4fe6a6bdc0 Add a CHANGES placeholder for [GL #4661] 2024-06-10 16:14:25 +02:00
Evan Hunt 05823eb1b0 Merge branch '4728-allow-transfer-none' into 'main'
change allow-transfer default to "none"

Closes #4728

See merge request isc-projects/bind9!9046
2024-06-05 21:50:47 +00:00
Evan Hunt 2b7cbd8d95 CHANGES and relnotes for [GL #4728] 2024-06-05 10:50:06 -07:00
Evan Hunt c3d3d12911 change allow-transfer default to "none"
Changed the default value for 'allow-transfer' to 'none'; zone
transfers now require explicit authorization.

Updated all system tests to specify an allow-transfer ACL when needed.

Revised the ARM to specify that the default is 'none'.
2024-06-05 10:50:06 -07:00
Ondřej Surý 74cbaf46c9 Merge branch 'ondrej/use-rcu-stack-for-qpcache-deadnodes' into 'main'
Use RCU wait-free stack for qpcache deadnodes

See merge request isc-projects/bind9!8907
2024-06-05 17:40:30 +00:00
Ondřej Surý 086b63f56d Use isc_queue to implement wait-free deadnodes queue
Replace the ISC_LIST based deadnodes implementation with isc_queue which
is wait-free and we don't have to acquire neither the tree nor node lock
to append nodes to the queue and the cleaning process can also
copy (splice) the list into a local copy without acquiring the list.

Currently, there's little benefit to this as we need to hold those
locks anyway, but in the future as we move to RCU based implementation,
this will be ready.

To align the cleaning with our event loop based model, remove the
hardcoded count for the node locks and use the number of the event loops
instead.  This way, each event loop can have its own cleaning as part of
the process.  Use uniform random numbers to spread the nodes evenly
between the buckets (instead of hashing the domain name).
2024-06-05 09:19:56 +02:00
Ondřej Surý a9b4d42346 Add isc_queue implementation on top of cds_wfcq
Add an isc_queue implementation that hides the gory details of cds_wfcq
into more neat API.  The same caveats as with cds_wfcq.

TODO: Add documentation to the API.
2024-06-05 09:19:56 +02:00
Mark Andrews 67b9510988 Merge branch '4736-isc_r_hostdown-was-not-being-handled-by-resolver-c' into 'main'
Resolve "ISC_R_HOSTDOWN was not being handled by resolver.c"

Closes #4736

See merge request isc-projects/bind9!9055
2024-06-04 07:35:36 +00:00
Mark Andrews 71cfa8dfba Add CHANGES note for [GL #4736] 2024-06-04 00:16:30 +10:00
Mark Andrews 56c3dcc5d7 Update resquery_senddone handling of ISC_R_TIMEDOUT
Treat timed out as an address specific error.
2024-06-04 00:15:48 +10:00
Mark Andrews 4e3dd85b8d Update resquery_senddone handling of ISC_R_CONNECTIONRESET
Treat connection reset as an address specific error.
2024-06-04 00:15:48 +10:00
Mark Andrews 180b1e7939 Handle ISC_R_HOSTDOWN and ISC_R_NETDOWN in resolver.c
These error codes should be treated like other unreachable error
codes.
2024-06-04 00:15:48 +10:00
Michał Kępień e7971f6ac8 Merge branch '4706-4707-add-more-label-checks-to-dangerfile.py' into 'main'
Add more label checks to dangerfile.py

Closes #4706 and #4707

See merge request isc-projects/bind9!9040
2024-06-03 11:10:55 +00:00
Michał Kępień aae51cf28d Fail for merge requests with "Affects v9.x" labels
Setting "Affects v9.x" labels on a merge request duplicates information
already present on the GitLab issue associated with that merge request.
For trivial merge requests that are not associated with any GitLab
issue, setting the "Affects v9.x" label(s) is considered unnecessary.
Trigger a failure for every merge request marked with at least one
"Affects v9.x" label.
2024-06-03 13:07:21 +02:00
Michał Kępień 80ec57f198 Warn about auto-generated merge request titles
Merge request titles auto-generated by GitLab are often a source of
confusion regarding the actual contents of a given merge request.  Warn
for merge requests containing titles that look like auto-generated ones.
2024-06-03 13:07:21 +02:00
Michał Kępień 09851e6230 Fail for branches using old-style version suffixes
Using "-v9_x" and "-v9.x" version suffixes for branch names is now
deprecated since some automation logic does not handle these.  Fail for
any merge request using such old-style version suffixes.
2024-06-03 13:07:21 +02:00
Michał Kępień 9359cb9c99 Fail for backports with "Affects v9.x" labels set
Backports are not expected to have any "Affects v9.x" labels set since
those are only meant to be set for merge requests that should have
backports created for them.
2024-06-03 13:07:21 +02:00
Mark Andrews 89d7d52010 Merge branch '3472-ipv4-only-mode-not-respected-for-zone-transfers' into 'main'
Resolve "IPv4-only mode not respected for zone transfers"

Closes #3472

See merge request isc-projects/bind9!8522
2024-06-03 09:59:44 +00:00
Mark Andrews 3834e433f7 Add CHANGES note for [GL #6288] 2024-06-03 18:35:02 +10:00
Mark Andrews 05472e63e8 Don't do DS checks over disabled address families 2024-06-03 18:34:31 +10:00
Mark Andrews d026dbe536 Don't forward UPDATE messages over disabled address families 2024-06-03 18:34:31 +10:00
Mark Andrews 5d99625515 Don't send NOTIFY over disabled address families 2024-06-03 18:34:31 +10:00
Mark Andrews 07cdf3e945 Check that no primaries is logged with -4 or -6
When in -4 mode check that "IPv6 disabled and no IPv4 primaries"
is logged and when in -6 mode check that "IPv4 disabled and no IPv6
primaries" is logged.
2024-06-03 18:34:31 +10:00
Mark Andrews 2cd4303249 Report non-effective primaries
When named is started with -4 or -6 and the primaries for a zone
do not have an IPv4 or IPv6 address respectively issue a log message.
2024-06-03 18:34:31 +10:00
Mark Andrews ecdde04e63 Zone transfers should honour -4 and -6 options
Check if the address family has been disabled when transferring
zones.
2024-06-03 18:34:31 +10:00
Mark Andrews 9be1873ef3 Add helper function isc_sockaddr_disabled 2024-06-03 18:34:31 +10:00
Matthijs Mekking 50a2c308d6 Merge branch '4708-uv-tcp-close-reset-issue' into 'main'
Deal with uv_tcp_close_reset more gracefully

Closes #4708

See merge request isc-projects/bind9!9022
2024-06-03 08:15:35 +00:00
Matthijs Mekking 113968f3a0 Add CHANGES entry for [GL #4708] 2024-06-03 10:15:18 +02:00
Matthijs Mekking c40e5c8653 Call reset_shutdown if uv_tcp_close_reset failed
If uv_tcp_close_reset() returns an error code, this means the
reset_shutdown callback has not been issued, so do it now.
2024-06-03 10:14:47 +02:00
Matthijs Mekking 5b94bb2129 Do not runtime check uv_tcp_close_reset
When we reset a TCP connection by sending a RST packet, do not bother
requiring the result is a success code.
2024-06-03 10:14:47 +02:00
Mark Andrews 91d5c9a878 Merge branch 'marka-placeholder' into 'main'
add placeholder

See merge request isc-projects/bind9!9083
2024-06-03 07:46:04 +00:00
Mark Andrews 728e53be47 add placeholder 2024-06-03 17:18:24 +10:00
Mark Andrews 52a2fb1ab3 Merge branch '2744-warning-checkhints-unable-to-get-root-ns-rrset-from-cache-not-found' into 'main'
Resolve "warning: checkhints: unable to get root NS rrset from cache: not found"

Closes #2744

See merge request isc-projects/bind9!8745
2024-05-31 06:16:24 +00:00
Mark Andrews 5be6ceebc4 Add CHANGES entry for [GL #2744] 2024-05-31 15:40:32 +10:00
Mark Andrews 87e3b9dbf3 Pass a memory context in to dns_cache_create 2024-05-31 15:40:32 +10:00
Mark Andrews 5e77edd074 Use a new memory context when flushing the cache
When the cache's memory context was in over memory state when the
cache was flushed it resulted in LRU cleaning removing newly entered
data in the new cache straight away until the old cache had been
destroyed enough to take it out of over memory state.  When flushing
the cache create a new memory context for the new db to prevent this.
2024-05-31 15:40:32 +10:00
Ondřej Surý 5f69e0a311 Merge branch '4750-set-loop-on-incoming-transfer' into 'main'
Create the new database for AXFR from the dns_zone API

Closes #4750

See merge request isc-projects/bind9!9073
2024-05-29 06:31:28 +00:00
Ondřej Surý 3310cac2b0 Create the new database for AXFR from the dns_zone API
The `axfr_makedb()` didn't set the loop on the newly created database,
effectively killing delayed cleaning on such database.  Move the
database creation into dns_zone API that knows all the gory details of
creating new database suitable for the zone.
2024-05-29 08:30:19 +02:00
Petr Špaček 37ae380e97 Merge branch 'stepan/hypothesis' into 'main'
Expand the wildcard system test with wider use of hypothesis

See merge request isc-projects/bind9!8461
2024-05-28 13:17:32 +00:00
Štěpán BalážikandPetr Špaček 9584a7bdcd Add a helper for uncompressed length of dnspython's dns.name.Name
This is useful for generating using hypothesis but also for other
cases.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček bb1e5cfa09 Move hypothesis strategies to isctest for later reuse
`isctest.hypothesis` seems to be a nice place to have these.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček f55cacbbfd Disable deadlines for hypothesis tests when running in CI
The times it takes to run tests CI vary significantly enough
that it makes hypothesis test reach their deadlines and fail randomly
marking the tests as flaky.

This commit disables the deadlines when running in CI.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček 9943172566 Test nested wildcard special case in the respective system test
See final remark of RFC 4592 2.2.1. for details.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček d0cfbd398e Expand the wildcard system test with wider use of hypothesis
The queries are now generated more generally (i. e. they have
multiple labels, etc.).
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček 5d738cd9ed Add hypothesis strategies for generating DNS names and company
The most important being `dns_names` that generates dns.name.Name
objects based on given paramaters.

No guarantees are given when it comes the uniformity of generated
samples, however it plays nicely with the hypothesis' shrinking
algorithm.

Once we use hypothesis more widely (in at least one more test) this file
should be moved for it to be reused easily.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček e7d46ad8ba Extend isctest package with more utility functions
Check for more rcodes and various properties needed in the wildcard
test. Add a `name` module for various dns.name.Name operations (with
`prepend_label` function only now).

Expose `timeout` as a parameter of `query.tcp`/`query.udp`.
2024-05-28 12:12:16 +00:00
Štěpán BalážikandPetr Špaček 02d1c5fc89 Silent pylint's line-too-long warning as it's handled better by black
Black allows the lines with string literals to be longer, which is
convenient for descriptive error messages.
2024-05-28 12:12:16 +00:00
Nicki Křížek 8cdfccf140 Merge branch 'nicki/use-bind-team-gitlab-tokens' into 'main'
Use bind-team tokens for CI gitlab access

See merge request isc-projects/bind9!9067
2024-05-27 11:13:34 +00:00
Nicki Křížek d391f0c958 Use BIND_TEAM_WRITE_TOKEN for autobackport bot
This is done to unify the token usage across our repositories to
simplify token maintenance.
2024-05-27 13:03:13 +02:00
Nicki Křížek 6767172bc0 Use BIND_TEAM_API_TOKEN for danger bot
This is done to unify the token usage across our repositories to
simplify token maintenance.
2024-05-27 13:03:10 +02:00
Ondřej Surý b70ef5e5a4 Merge branch 'ondrej/cleanup-dns_db' into 'main'
Cleanup the dns_cache unit

See merge request isc-projects/bind9!9064
2024-05-25 09:48:34 +00:00
Aram SargsyanandOndřej Surý 4d3c31b928 fixup! Merge branch 'ondrej/light-cleanup-of-rdataslab' into 'main' 2024-05-25 11:47:33 +02:00
Ondřej Surý 3feabc8a22 Cleanup the dns_cache unit
Remove duplicate code and use ISC_REFCOUNT_{DECL,IMPL} macros.
2024-05-25 11:47:33 +02:00
Michal Nowak 08eef0fa0d Merge branch 'mnowak/cross-version-config-tests-drop-allow_failure-true' into 'main'
Drop "allow_failure: true" in cross-version-config-tests job

See merge request isc-projects/bind9!9044
2024-05-24 11:44:39 +00:00
Michal NowakandNicki Křížek c58dd6e78f Workaround temporary cross-version-config-tests limitation
The system test from the BIND 9.19.24 release does not include the
isctest/vars/autoconf.py file from 9.19.25-dev, and therefore the job
will fail before the 9.19.25 release is published. In the meantime,
consider using the conf.sh file.
2024-05-24 11:01:40 +02:00
Nicki Křížek e712cf613f Fix oversight in cross-version-config test
This is a followup for 5e7b3d9ef36b199e2d24d385593a8e2f7d541b65. The
change slipped by during refactoring and this line wasn't updated.
2024-05-24 11:00:09 +02:00
Michal NowakandNicki Křížek 8d99ce28e8 Revert "Allow failure of cross-version-config test"
This reverts commit b99cdfab9d.
2024-05-24 10:59:27 +02:00
Ondřej Surý 7e87e2657a Merge branch 'ondrej/light-cleanup-of-rdataslab' into 'main'
Refactor the common buffer manipulation in rdataslab.c in macros

See merge request isc-projects/bind9!9063
2024-05-24 08:29:54 +00:00
Ondřej Surý 03ed19cf71 Refactor the common buffer manipulation in rdataslab.c in macros
The rdataslab.c was full of code like this:

        length = raw[0] * 256 + raw[1];

and

        count2 = *current2++ * 256;
        count2 += *current2++;

Refactor code like this into peek_uint16() and get_uint16 macros
to prevent code repetition and possible mistakes when copy and
pasting the same code over and over.

As a side note for an entertainment of a careful reader of the commit
messages: The byte manipulation was changed from multiplication and
addition to shift with or.

The difference in the assembly looks like this:

MUL and ADD:

	movzx   eax, BYTE PTR [rdi]
        movzx   edi, BYTE PTR [rdi+1]
        sal     eax, 8
        or      edi, eax

SHIFT and OR:

        movzx   edi, WORD PTR [rdi]
        rol     di, 8
        movzx   edi, di

If the result and/or buffer is then being used after the macro call,
there's more differences in favor of the SHIFT+OR solution.
2024-05-24 09:52:45 +02:00
Michal Nowak c8289279f0 Merge branch 'mnowak/alpine-3.20' into 'main'
Add Alpine Linux 3.20

See merge request isc-projects/bind9!9059
2024-05-23 11:19:26 +00:00
Michal Nowak 6f22e79ef9 Add Alpine Linux 3.20 2024-05-23 10:58:25 +02:00
Michal Nowak 1f5143e066 Merge branch 'mnowak/short-stress-tests-should-keep-artifacts' into 'main'
Short stress tests should keep artifacts

See merge request isc-projects/bind9!9056
2024-05-22 10:55:18 +00:00
Michal Nowak aa72747c80 Short stress tests should keep artifacts 2024-05-22 10:46:28 +02:00
Aydın Mercan 4de93e86fa Merge branch 'aydin/fix-trace' into 'main'
Fix typing mistakes in trace macros

See merge request isc-projects/bind9!9050
2024-05-20 11:45:22 +00:00
Aydın MercanandEvan Hunt 03a59cbb04 reinsert accidentally removed + in db trace
It only affects development when using `DNS_DB_TRACE`.
2024-05-17 18:11:23 -07:00
Aydın MercanandEvan Hunt 49e62ee186 fix typing mistakes in trace macros
The detach function declaration in `ISC__REFCOUNT_TRACE_DECL` had an
returned an accidental implicit int. While not allowed since C99, it
became an error by default in GCC 14.

`ISC_REFCOUNT_TRACE_IMPL` and `ISC_REFCOUNT_STATIC_TRACE_IMPL` expanded
into the wrong macros, trying to declare it again with the wrong number
of parameters.
2024-05-17 18:11:23 -07:00
Evan Hunt 5972a80714 Merge branch '4730-clang-format-header-file-changes' into 'main'
Resolve "Clang format header file changes"

Closes #4730

See merge request isc-projects/bind9!9047
2024-05-17 23:18:47 +00:00
Mark AndrewsandEvan Hunt 1697011af6 Ignore reformat sources with up-to-date clang-format-18 2024-05-17 16:03:46 -07:00
Mark AndrewsandEvan Hunt b7de2c7cb9 Clang-format header file changes 2024-05-17 16:03:21 -07:00
Arаm Sаrgsyаn add3a6ee8c Merge branch 'aram/mr8937-changes-placeholder' into 'main'
Add a CHANGES placeholder for [GL !8937]

See merge request isc-projects/bind9!9049
2024-05-17 10:48:23 +00:00
Aram Sargsyan 563ed741bf Add a CHANGES placeholder for [GL !8937] 2024-05-17 10:20:48 +00:00
Mark Andrews 8246465513 Merge branch '4726-increase-formerr-coverage-in-message-parsing' into 'main'
Resolve "Increase FORMERR coverage in message parsing"

Closes #4726

See merge request isc-projects/bind9!9034
2024-05-17 05:16:48 +00:00
Mark Andrews 6e9ed4983e add test cases for several FORMERR code paths:
- duplicated question
  - duplicated answer
  - qtype as an answer
  - two question types
  - question names
  - nsec3 bad owner name
  - short record
  - short question
  - mismatching question class
  - bad record owner name
  - mismatched class in record
  - mismatched KEY class
  - OPT wrong owner name
  - invalid RRSIG "covers" type
  - UPDATE malformed delete type
  - TSIG wrong class
  - TSIG not the last record
2024-05-17 13:39:22 +10:00
Evan Hunt 6a9ac65f0c Merge branch '4683-qpzone-tsan-fix' into 'main'
replace qpzone node attributes with atomics

Closes #4683

See merge request isc-projects/bind9!9033
2024-05-17 00:33:48 +00:00
Evan Hunt 9c882f1e69 replace qpzone node attriutes with atomics
there were TSAN error reports because of conflicting uses of
node->dirty and node->nsec, which were in the same qword.

this could be resolved by separating them, but we could also
make them into atomic values and remove some node locking.
2024-05-17 00:33:35 +00:00
Matthijs Mekking bcc6039bf5 Merge branch 'matthijs-qp-set-iterator' into 'main'
Rewrite fix_iterator()

See merge request isc-projects/bind9!9038
2024-05-16 09:50:08 +00:00
Matthijs Mekking 82e9d93c0b Two more qp test cases
Add two more cases that should select different predecessors from
different twigs.
2024-05-16 09:49:41 +00:00
Matthijs Mekking f882101265 Rewrite qp fix_iterator()
The fix_iterator() function had a lot of bugs in it and while fixing
them, the number of corner cases and the complexity of the function
got out of hand. Rewrite the function with the following modifications:

The function now requires that the iterator is pointing to a leaf node.
This removes the cases we have to deal when the iterator was left on a
dead branch.

From the leaf node, pop up the iterator stack until we encounter the
branch where the offset point is before the point where the search key
differs. This will bring us to the right branch, or at the first
unmatched node, in which case we pop up to the parent branch. From
there it is easier to retrieve the predecessor.

Once we are at the right branch, all we have to do is find the right
twig (which is either the twig for the character at the position where
the search key differs, or the previous twig) and walk down from there
to the greatest leaf or, in case there is no good twig, get the
previous twig from the successor and get the greatest leaf from there.

If there is no previous twig to select in this branch, because every
leaf from this branch node is greater than the one we wanted, we need
to pop up the stack again and resume at the parent branch. This is
achieved by calling prevleaf().
2024-05-16 09:49:41 +00:00
Matthijs Mekking 8b8c16d7a4 Get anyleaf when qp lookup is on a dead end branch
Move the fix_iterator out of the loop and only call it when we found
a leaf node. This leaf node may be the wrong leaf node, but fix_iterator
should correct that.

Also, when we don't need to set the iterator, just get any leaf. We
only need to have a leaf for the qpkey_compare and the end result does
not matter if compare was against an ancestor leaf or any leaf below
that point.
2024-05-16 09:49:41 +00:00
Michal Nowak 6b89d66ce8 Merge tag 'v9.19.24' 2024-05-16 11:37:12 +02:00
Mark Andrews ed5b9b0898 Merge branch '4517-dnssec-verify-reports-errors-in-nsec3-chain' into 'main'
Resolve "dnssec-verify reports errors in NSEC3 chain"

Closes #4517

See merge request isc-projects/bind9!8631
2024-05-16 01:52:55 +00:00
Mark Andrews e4dbf4be8e Add CHANGES note for [GL #4517] 2024-05-16 10:28:27 +10:00
Mark Andrews dd13f41ae1 Don't sign non-apex DNSKEY records
DNSKEY can only be validated if it is signed by itself.  Stop
attempting to sign non apex DNSKEY RRsets.
2024-05-16 10:28:27 +10:00
Mark Andrews 315ad2df7a Remove invalid DNSKEY RRset from zone 2024-05-16 10:28:27 +10:00
Mark Andrews 122111f75e Add regression test data for [GL #4517]
An obscured DNSKEY RRset at a delegation was incorrectly added to
the NSEC/NSEC3 type bit map leading to zone verification failures.
This adds such a RRset to the test zone.
2024-05-16 10:28:27 +10:00
Mark Andrews b3efc15be4 Fail if there are non apex DNSKEYs
DNSSEC only works when DNSKEYs are self signed.  This only occurs
when the DNSKEY RRset is at the apex.  Cause dnssec-signzone to
fail if it attempts to sign an non-apex DNSKEY RRset.
2024-05-16 10:28:27 +10:00
Mark Andrews ec3c624814 Properly build the NSEC/NSEC3 type bit map
DNSKEY was incorrectly being added to the NESC/NSEC3 type bit map
when it was obscured by the delegation.  This lead to zone verification
failures.
2024-05-16 10:27:49 +10:00
Mark Andrews e84615629f Properly update 'maxtype'
'maxtype' should be checked to see if it should be updated whenever
a type is added to the type map.
2024-05-16 10:20:49 +10:00
Ondřej Surý 333d1881f9 Merge branch 'ondrej/isc_httpd-reference-counting' into 'main'
Properly attach/detach isc_httpd in case read ends earlier than send

See merge request isc-projects/bind9!9037
2024-05-15 12:32:15 +00:00
Ondřej Surý eb862ce509 Properly attach/detach isc_httpd in case read ends earlier than send
An assertion failure would be triggered when sending the TCP data ends
after the TCP reading gets closed.  Implement proper reference counting
for the isc_httpd object.
2024-05-15 12:22:10 +02:00
Michał Kępień 5fd3530741 Merge branch '4719-placeholder' into 'main'
Add placeholder for GL #4719

See merge request isc-projects/bind9!9036
2024-05-15 08:21:55 +00:00
Michał Kępień ea6032146c Add placeholder for GL #4719 2024-05-15 10:20:19 +02:00
Evan Hunt 0748847400 Merge branch '4717-qp-lookup-creates-incorrect-chain' into 'main'
Fix dns_qp_lookup() chain inconsistency after fix_iterator()

Closes #4717

See merge request isc-projects/bind9!9028
2024-05-14 20:36:11 +00:00
Matthijs MekkingandEvan Hunt 730e532cac Test check_predecessors with chain
In addition to testing check_qpchain in combination with qpiter,
test check_predecessors in combination with a qpchain.
2024-05-14 12:58:46 -07:00
Evan Hunt b6815de316 Fix QP chain on partial match
When searching for a requested name in dns_qp_lookup(), we may add
a leaf node to the QP chain, then subsequently determine that the
branch we were on was a dead end. When that happens, the chain can be
left holding a pointer to a node that is *not* an ancestor of the
requested name.

We correct for this by unwinding any chain links with an offset
value greater or equal to that of the node we found.
2024-05-14 12:58:46 -07:00
Petr ŠpačekandEvan Hunt 5d96f11693 Unit test to demonstrate issue #4717
Iterator in lookup() call must be non-NULL to trigger the issue.
Run chain tests twice, once without iterator and second time with
iterator.
2024-05-14 12:58:46 -07:00
Matthijs MekkingandEvan Hunt 91de4f6490 Refactor fix_iterator
The code below the if/else construction could only be run if the 'if'
code path was taken. Move the code into the 'if' code block so that
it is more easier to read.
2024-05-14 12:58:46 -07:00
Nicki Křížek ac569ad544 Merge branch 'nicki/add-mailmap' into 'main'
Add .mailmap to the git repo

See merge request isc-projects/bind9!9025
2024-05-14 11:28:00 +00:00
Nicki Křížek 986013a708 Add .mailmap to the git repo
Mailmap can be used to unify the display name in standard git tools.
2024-05-14 13:05:45 +02:00
Michal Nowak d9fbbd537d Merge branch 'mnowak/pytest_rewrite_include-multiplecfg' into 'main'
Rewrite include-multiplecfg system test to pytest

See merge request isc-projects/bind9!8806
2024-05-14 10:46:10 +00:00
Michal Nowak e9e8753306 Rewrite include-multiplecfg system test to pytest 2024-05-14 11:45:55 +02:00
Michal Nowak 77a42f8875 Use isctest.run.cmd() helper function in tests 2024-05-14 11:45:55 +02:00
Tom KrizekandMichal Nowak a9f3fb3db5 Add isctest.run.cmd() helper function 2024-05-14 11:45:55 +02:00
Aydın Mercan 4f34011ccc Merge branch 'aydin/author-expand' into 'main'
Expand list in chaos authors response

See merge request isc-projects/bind9!9026
2024-05-13 09:57:25 +00:00
Aydın Mercan df862f9fef Expand list in chaos authors response
The list isn't exactly maintained but it helped with some BIND history
tracking and is basically harmless so it might be worth holding onto it.
I have adapted the name to ASCII so IDN support won't be necessary.
2024-05-13 11:24:29 +03:00
Aydın Mercan aa860b3ab1 Merge branch '4668-request-to-add-a-new-statistic-recursive-client-high-water-in-rndc-status-and-stats-channel' into 'main'
Add new statistics variable for recursive client high-water

Closes #4668

See merge request isc-projects/bind9!9023
2024-05-10 10:52:51 +00:00
Aydın Mercan d6dd51bb1b Added CHANGES and release note for [GL #4668] 2024-05-10 12:08:52 +03:00
Aydın Mercan e037520b92 Keep track of the recursive clients highwater
The high-water allows administrators to better tune the recursive
clients limit without having to to poll the statistics channel in high
rates to get this number.
2024-05-10 12:08:52 +03:00
Aydın Mercan 09e4fb2ffa Return the old counter value in isc_stats_increment
Returning the value allows for better high-water tracking without
running into edge cases like the following:

0. The counter is at value X
1. Increment the value (X+1)
2. The value is decreased multiple times in another threads (X+1-Y)
3. Get the value (X+1-Y)
4. Update-if-greater misses the X+1 value which should have been the
   high-water
2024-05-10 12:08:52 +03:00
Nicki Křížek ced011f05a Merge branch 'tkrizek/pytest-conf-cleanup' into 'main'
Define environment variables in pytest instead of conf.sh

See merge request isc-projects/bind9!8800
2024-05-09 16:26:26 +00:00
Nicki Křížek faeec83b64 Ensure OPENSSL_CONF is a file if it exists
Prevent unexpected behavior in cases where the OPENSSL_CONF path would
exist, but it wouldn't point to a file.
2024-05-09 17:08:11 +02:00
Nicki Křížek ac7c657d19 Move isctest.var initialization to conftest.py
The environment variable initialization requires logging to be set up
first. Ensure the initialization is delayed until loggers have been set
up.
2024-05-09 17:08:11 +02:00
Tom KrizekandNicki Křížek 2a09f632ab Use a dedicated file for each autoconf variable
To avoid any escaping issues or messing with a language-specific format
when the variable has to be parsed, create a dedicated file for each
variable that is obtained from autoconf.
2024-05-09 17:08:10 +02:00
Tom KrizekandNicki Křížek b99cdfab9d Allow failure of cross-version-config test
The test is bound to fail until it is executed against a new release
which will include the pytest env var refactoring.
2024-05-09 17:08:10 +02:00
Tom KrizekandNicki Křížek 2d1f348483 Move env var initialization to isctest.vars
Make sure all initialization takes place in isctest.vars.__init__ and
export the initial env vars there. Remove the no longer needed env
fixture and use os.environ instead.
2024-05-09 17:08:10 +02:00
Tom KrizekandNicki Křížek 1f6f2234d8 Move dir env var handling to isctest.vars.dirs 2024-05-09 17:08:10 +02:00
Tom KrizekandNicki Křížek 41cb553bdd Move port env vars into isctest.vars.ports module
The fixture for port assignment isn't needed, replace it with the common
way of handling environment variables.
2024-05-09 17:08:10 +02:00
Tom KrizekandNicki Křížek cca26efe52 Don't export openssl-related env vars unless set
If OPENSSL_CONF is exported as an empty string, it will cause issues on
rhel9fips. Allow the environment variables to be set and exported, but
make sure to only export them if they have been set by the user.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek b100ce4c88 Parse openssl-related vars in pytest
The openssl config needs to be parsed for some tests that use SoftHSM2.
Rewrite the parsing to python and ensure the required variables are
properly set test-wide.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek e531bfc3b3 Adjust .gitlab-ci env var detection with sed
The environment variables set by autoconf were moved to autoconf.py.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek 46433ae17b Coalesce system test variables
Provide a single point of access to all the variables used by tests. Use
a custom dict-like structure to access the underlying data without
making a copy. This allows the individual modules to update the contents
at runtime, which is used for some variables.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek 308a8727e5 Format conf.sh with shfmt
No manual changes in this commit - simply running shfmt for proper shell
code formatting.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek 8c6e6758b5 Load env vars in shell-only processing of conf.sh
While this isn't required for pytest operation and execution of the
system test suite, it can be handy to allow test script development and
debugging. Especially setup scripts often source conf.sh and expect
environment variables to be loaded. If these scripts are executed
stand-alone, the environment variables need to be loaded from the python
package.
2024-05-09 17:08:09 +02:00
Tom KrizekandNicki Křížek ab27f504ca Move environment variables from conf.sh to pytest
Remove conf.sh.in and move the environment variables into isctest/vars
python package. This enabled the removal of an ugly pytest hack which
loaded and parsed these variables from the environment.
2024-05-09 17:08:08 +02:00
Tom KrizekandNicki Křížek b3caa9226d Remove terminal color support from conf.sh.common
Pytest processes all the output, so the terminal colors are no longer
interpreted. Remove the obsolete code.
2024-05-09 17:08:07 +02:00
Michal Nowak 91275eb6bc Merge branch '4635-add-rbt-ci-job' into 'main'
Add jobs for RBT zone- & cache-enabled GCC builds

Closes #4635

See merge request isc-projects/bind9!8997
2024-05-09 13:50:42 +00:00
Mark AndrewsandMichal Nowak 1482e9bbb9 Address qp/rbtdb backup file style differences
qp and rbtdb produce stylistically different backup files.  This
was causing the xferquota system test to fail.  This has been
addressed by making the test independent of the stylistic differences.
2024-05-09 15:03:45 +02:00
Michal Nowak 8f687fff35 Add jobs for RBT zone- & cache-enabled GCC builds 2024-05-09 15:03:45 +02:00
Mark Andrews 149c61b3ca Merge branch '4502-missing-reference' into 'main'
Resolve "Missing reference?"

Closes #4502

See merge request isc-projects/bind9!8996
2024-05-09 00:08:09 +00:00
Mark Andrews 53698ad58d Add CHANGES for [GL #4502] 2024-05-09 08:17:44 +10:00
Mark Andrews 88c48dde5e Stop processing catalog zone changes when shutting down
Abandon catz_addmodzone_cb  and catz_delzone_cb processing if the
loop is shutting down.
2024-05-09 08:17:44 +10:00
Mark Andrews 941ad2b3c5 catz should use weak attachment to the view 2024-05-09 08:17:44 +10:00
Mark Andrews 307e3ed9a6 catzs->view should maintain a view reference
Use dns_view_weakattach and dns_view_weakdetach to maintain a
reference to the view referenced through catzs->view.
2024-05-09 08:17:44 +10:00
Petr Špaček 9357019498 Merge branch 'pspacek/doc-rfc-ref-update' into 'main'
Update RFC references in documentation

See merge request isc-projects/bind9!9020
2024-05-08 07:07:48 +00:00
Petr Špaček ead4a110ad Update reference for Catalog Zones spec to RFC9432 2024-05-07 13:38:40 +02:00
Petr Špaček 153311da2d Update KSK root sentinel references
The mechanism was published as RFC 8509. I've briefly looked at diff
between versions -08 and the RFC and did not find significant protocol
change. Quick manual check confirms what we seem to comply with the
published protocol.
2024-05-07 13:38:40 +02:00
Petr Špaček 8e4c0329c3 Mention RFC 9276 Guidance for NSEC3 Parameter Settings
Draft was eventually published as RFC 9276 but we did not update our
docs. Also add couple mentions in relevant places in the ARM and
dnssec-signzone man page, mainly around "do not touch" places.
2024-05-07 13:38:40 +02:00
Petr Špaček c5d6769e11 Update DNSSEC Operational Practices references to Version 2
RFC 4641 was obsoleted by 6781.
2024-05-07 13:38:10 +02:00
Mark Andrews 12ae798bc7 Merge branch '4704-svcb-https-bind9-and-dig-fail-to-parse-packet-if-zero-svcpriority-and-existing-svcparams' into 'main'
Resolve "SVCB/HTTPS: Bind9 and Dig fail to parse packet if zero SvcPriority and existing SvcParams"

Closes #4704

See merge request isc-projects/bind9!9000
2024-05-07 02:07:21 +00:00
Mark Andrews e0b5c85f5a Add CHANGES note for [GL #4704] 2024-05-07 11:21:20 +10:00
Mark Andrews 799046929c Only check SVBC alias forms at higher levels
Allow SVBC (HTTPS) alias form with parameters to be accepted from
the wire and when transfered.  This is for possible future extensions.
2024-05-07 11:20:49 +10:00
Mark Andrews 836da75dc1 Merge branch '4357-treat-notfile-as-eof' into 'main'
Remove infinite loop on ISC_R_NOFILE

Closes #4357

See merge request isc-projects/bind9!9004
2024-05-07 01:03:00 +00:00
Mark Andrews 236a38a7c9 Add CHANGES note for [GL #4357] 2024-05-07 10:01:48 +10:00
Mark Andrews e697d20f00 Test including a directory in a zone file 2024-05-07 10:01:12 +10:00
Mark Andrews efd27bb82d Remove infinite loop on ISC_R_NOFILE
When parsing a zonefile named-checkzone (and others) could loop
infinitely if a directory was $INCLUDED.  Record the error and treat
as EOF when looking for multiple errors.

This was found by Eric Sesterhenn from X41.
2024-05-07 10:01:12 +10:00
Mark Andrews 1a12fac371 Merge branch '4353-fix-nibbles' into 'main'
Address infinite loop when processing $GENERATE

Closes #4353

See merge request isc-projects/bind9!9003
2024-05-06 23:58:36 +00:00
Mark Andrews f154187fd0 Add CHANGES note for [GL #4353] 2024-05-07 09:20:12 +10:00
Mark Andrews 32535de856 Test $GENERATE in nibble mode with a negative value
Negative values used to cause $GENERATE to loop forever.
2024-05-07 09:19:43 +10:00
Mark Andrews 371824f078 Address infinite loop when processing $GENERATE
In nibble mode if the value to be converted was negative the parser
would loop forever.  Process the value as an unsigned int instead
of as an int to prevent sign extension when shifting.

This was found by Eric Sesterhenn from X41.
2024-05-07 09:19:43 +10:00
Michal Nowak d08e3ad9d9 Merge branch 'mnowak/fedora-40' into 'main'
Add Fedora 40

See merge request isc-projects/bind9!8979
2024-05-06 17:40:55 +00:00
Michal Nowak b3a11f38b1 Supress the leak detection in xmlNewGlobalState 2024-05-06 19:35:36 +02:00
Michal Nowak 1a09f822ad Add Fedora 40 2024-05-06 19:35:29 +02:00
Michal Nowak 4247e36340 Merge branch 'mnowak/ubuntu-24.04-noble-numbat' into 'main'
Add Ubuntu 24.04 LTS (Noble Numbat)

See merge request isc-projects/bind9!8980
2024-05-06 16:35:59 +00:00
Michal Nowak d02ed1a0eb Add Ubuntu 24.04 LTS (Noble Numbat) 2024-05-06 17:58:22 +02:00
Michal Nowak 3daf2ee76e Merge branch 'mnowak/openbsd-7.5' into 'main'
Add OpenBSD 7.5

See merge request isc-projects/bind9!8965
2024-05-06 15:20:24 +00:00
Michal Nowak 102fccdcba Add OpenBSD 7.5 2024-05-06 17:11:05 +02:00
Michal Nowak c3a7d9cd29 Merge branch '4711-stress-test-finer-runtime-granularity' into 'main'
Add short version of "stress" tests to MR-triggered pipelines

Closes #4711

See merge request isc-projects/bind9!9002
2024-05-06 14:05:22 +00:00
Michal Nowak f33b746353 Add short "stress" test jobs 2024-05-06 15:36:49 +02:00
Michal Nowak 58a1a50e76 Rename "stress" tests to long "stress" tests 2024-05-06 15:36:49 +02:00
Michal Nowak 1d77a3b3c6 Revert "Drop parallel build from stress tests"
This reverts commit 3fd7e7c81f.

In AWS this is no longer a concern.
2024-05-06 15:36:49 +02:00
Nicki Křížek 12fed598ea Merge branch '4543-reenable-unreachable-dnssec-checks' into 'main'
Re-enable accidentally disabled dnssec checks

Closes #4543

See merge request isc-projects/bind9!8667
2024-05-06 13:15:49 +00:00
Matthijs MekkingandNicki Křížek 02f5d82333 Update hours-vs-days test
This test is outdated because it tested the 'sig-validity-interval'
option that has been replaced by dnssec-policy's 'signatures-validity',
'signatures-refresh', and 'signatures-jitter' options.

Nevertheless, it tests if the jitter is spread correctly.

Update the test to make use of 'signatures-jitter', set the value
to 1 day (meaning resign in 499 days since 'signatures-validity' is
set to 500 days).

Note that this previously changed erroneously the refresh value to
449 days (should have been 499 days, but that is not allowed by
checkconf, since it is above 90% of 'signatures-validity').
2024-05-06 14:44:10 +02:00
Matthijs MekkingandNicki Křížek a68f8c7cf0 Fix dnssec system test iterations too high
After we have changed the maximum allowed iterations to 51 for signing,
the NSEC3 chain has changed and requires one more NSEC to be returned
in the answer (plus corresponding RRSIG). So the expected number or
records in the authority section is now 8.
2024-05-06 14:44:10 +02:00
Matthijs MekkingandNicki Křížek fc5eb493c9 Offline KSK and dnssec-policy not yet supported
If the key is offline and the keymgr runs, it will treat it as a missing key,
and generate a new key (according to the policy). Fix the test by putting
back the KSK temporarily when we run 'rndc loadkeys'.
2024-05-06 14:44:10 +02:00
Matthijs MekkingandNicki Křížek ebb90ba77f Fix ZSK rollovers in dnssec system test
1. When generating keys, don't set timing metadata. Otherwise keys
   are considered to be in use and won't be selected when dnssec-policy
   starts a new key rollover.

2. Add an extra check to make sure the new ZSK (zsk2) is prepublished.
   Also add a check to make sure it has become active.

3. When using dnssec-settime, add -s to also write to key state files.
2024-05-06 14:44:10 +02:00
Tom KrizekandNicki Křížek 2e26eac31c Ensure dnssec test doesn't leak queries to root servers
The config was recently modified to ensure ns4 won't leak any queries to
root servers. However, the test wasn't executed and it turns out the way
this was handled actually broke the test case. Add our custom root hint
to both of the views to ensure the test can still pass without leaking
any queries.
2024-05-06 14:44:09 +02:00
Tom KrizekandNicki Křížek 672b07a503 Re-enable accidentally disabled dnssec checks
Remove the premature exit statement which made the rest of the checks
unreachable.
2024-05-06 14:44:08 +02:00
Matthijs Mekking 005c1386ea Merge branch '3323-different-rpz-soa-ttl' into 'main'
RPZ response's SOA record is incorrectly set to 1

Closes #3323

See merge request isc-projects/bind9!8998
2024-05-06 10:10:42 +00:00
Matthijs Mekking 2726b569b1 Add release note and CHANGES for #3323 2024-05-06 11:39:02 +02:00
Matthijs Mekking 5d7e613e81 RPZ response's SOA record is incorrectly set to 1
An RPZ response's SOA record TTL is set to 1 instead of the SOA TTL,
a boolean value is passed on to query_addsoa, which is supposed to be
a TTL value. I don't see what value is appropriate to be used for
overriding, so we will pass UINT32_MAX.
2024-05-06 11:38:36 +02:00
Matthijs Mekking 2e99c66a00 Merge branch 'matthijs-offline-ksk-add-ksk-on-sign' into 'main'
Add DNSKEY record for KSK when creating the SKR

See merge request isc-projects/bind9!8986
2024-05-06 09:30:10 +00:00
Matthijs Mekking 03e8747aaa Retrieve DNSKEY TTL from policy
The desired DNSKEY TTL is configured in the policy so set it to that
value on new RRsets. Note that the same TTL is used for CDS and CDNSKEY.
2024-05-06 10:54:41 +02:00
Matthijs Mekking d9fb2054f1 Rename create_cds to create_ksk
Now that this function also creates the DNSKEY record for the KSKs,
as well as other associated records such as CDS and CDNSKEY, rename
the function to something slightly better.
2024-05-06 10:54:41 +02:00
Matthijs Mekking 30ce8abd30 Add DNSKEY rr corresponding to the KSK to the SKR
When signing a KSR, add the DNSKEY records from the signing KSK(s) to
the DNSKEY RRset prior to signing.
2024-05-06 10:54:41 +02:00
Matthijs Mekking 6b7bd77596 Don't add KSKs to the KSR
Creating the KSR happens on the "ZSK side". The KSK is offline and while
the public key and state file may be present, draft-icann-dnssec-keymgmt-01.txt
suggest that the KSR only contains ZSKs.

This is also what knot dns does, so it would also be in the spirit of
interoperability.
2024-05-06 10:54:41 +02:00
Matthijs Mekking 3bf4ec95dd Merge branch 'matthijs-fix-dnssec-ksr-version-missing' into 'main'
Fix missing version in KSR

See merge request isc-projects/bind9!8983
2024-05-06 08:40:46 +00:00
Matthijs Mekking 0071e6c10a Fix missing version in KSR
The final line in a KSR ";; KeySigningRequest generated at ..." was
missing the version number, that has now been fixed.

Thanks Libor Peltan for reporting.
2024-05-06 09:52:01 +02:00
Michal Nowak b327da30f8 Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.19.25' into 'main'
Set up version and release notes for BIND 9.19.25

See merge request isc-projects/bind9!9005
2024-05-03 14:01:59 +00:00
Michal Nowak 4fae72e2de Set up release notes for BIND 9.19.25 2024-05-03 15:51:53 +02:00
Michal Nowak fd880c29f2 Update BIND version to 9.19.25-dev 2024-05-03 15:51:53 +02:00
Michal Nowak be3e3da7b2 Update BIND version for release 2024-05-03 09:11:45 +02:00
Michal Nowak b507cb7bc2 Add a CHANGES marker 2024-05-03 09:10:49 +02:00
Michal Nowak 8793a41d8f Merge branch 'mnowak/prepare-documentation-for-bind-9.19.24' into 'v9.19.24-release'
Prepare documentation for BIND 9.19.24

See merge request isc-private/bind9!684
2024-05-03 07:08:26 +00:00
Michal Nowak 0f81fbcb1f Tweak and reword release notes 2024-05-02 19:16:58 +02:00
Michal Nowak 8cdc0eafd9 Prepare release notes for BIND 9.19.24 2024-05-02 12:31:00 +02:00
Arаm Sаrgsyаn 265b08b98e Merge branch '4710-qpcache-crash-on-assert-in-decref' into 'main'
Fix a bug in expireheader() call arguments order

Closes #4710

See merge request isc-projects/bind9!9001
2024-05-02 10:25:55 +00:00
Aram Sargsyan 8052848d50 Fix a bug in expireheader() call arguments order
The expireheader() call in the expire_ttl_headers() function
is erroneous as it passes the 'nlocktypep' and 'tlocktypep'
arguments in a wrong order, which then causes an assertion
failure.

Fix the order of the arguments so it corresponds to the function's
prototype.
2024-05-02 08:38:35 +00:00
Evan Hunt f8f0f45043 Merge branch '4702-qpiter-fix' into 'main'
dns_qp_lookup() doesn't handle searches for escaped characters well

Closes #4702

See merge request isc-projects/bind9!8999
2024-05-01 08:13:58 +00:00
Evan Hunt 9bbba20fbf CHANGES for [GL #4702] 2024-05-01 00:36:51 -07:00
Evan Hunt f81bf6bafd handle QP lookups involving escaped characters better
in QP keys, characters that are not common in DNS names are
encoded as two-octet sequences. this caused a glitch in iterator
positioning when some lookups failed.

consider the case where we're searching for "\009" (represented
in a QP key as {0x03, 0x0c}) and a branch exists for "\000"
(represented as {0x03, 0x03}). we match on the 0x03, and continue
to search down. at the point where we find we have no match,
we need to pop back up to the branch before the 0x03 - which may
be multiple levels up the stack - before we position the iterator.
2024-05-01 00:36:51 -07:00
Evan Hunt a23ce2c53c add another test case for an incorrect QP iterator position
build a database tree with names containing control characters,
search for another control character, and verify the iterator is
positioned correctly.
2024-05-01 00:36:16 -07:00
Matthijs MekkingandEvan Hunt ada46eb9f5 Add a unit test case for converting \000\009
Sanity checking that this domain converts to the key I am expecting.

Also fix some of the other names that had trailing 0x02 bits.
2024-04-30 16:00:13 -07:00
Evan Hunt a0bd1e67cd add a test method to print QP keys
add a method qp_test_printkey() to print the name encoded in a QP key.
2024-04-30 15:58:17 -07:00
Evan Hunt 539518bfba Merge branch 'each-qpcache-cleanup' into 'main'
clean up and speed up qpcache

See merge request isc-projects/bind9!8987
2024-04-30 20:28:52 +00:00
Evan Hunt 4b02246130 fix more ambiguous struct names
there were some structure names used in qpcache.c and qpzone.c that
were too similar to each other and could be confusing when debugging.
they have been changed as follows:

in qcache.c:
- changed_t was unused, and has been removed
- search_t -> qpc_search_t
- qpdb_rdatasetiter_t -> qpc_rditer_t
- qpdb_dbiterator_t -> qpc_dbiter_t

in qpzone.c:
- qpdb_changed_t -> qpz_changed_t
- qpdb_changedlist_t -> qpz_changedlist_t
- qpdb_version_t -> qpz_version_t
- qpdb_versionlist_t -> qpz_versionlist_t
- qpdb_search_t -> qpz_search_t
- qpdb_load_t -> qpz_search_t
2024-04-30 12:50:01 -07:00
Evan Hunt e300dfce46 use dns_qp_getname() where possible
some calls to dns_qp_lookup() do not need partial matches, QP chains
or QP iterators. in these cases it's more efficient to use
dns_qp_getname().
2024-04-30 12:50:01 -07:00
Evan Hunt 2789e58473 get foundname from the node
when calling dns_qp_lookup() from qpcache, instead of passing
'foundname' so that a name would be constructed from the QP key,
we now just use the name field in the node data. this makes
dns_qp_lookup() run faster.

the same optimization has also been added to qpzone.

the documentation for dns_qp_lookup() has been updated to
discuss this performance consideration.
2024-04-30 12:50:01 -07:00
Evan Hunt 04d319afe4 include the nodenames when calculating memory to purge
when the cache is over memory, we purge from the LRU list until
we've freed the approximate amount of memory to be added. this
approximation could fail because the memory allocated for nodenames
wasn't being counted.

add a dns_name_size() function so we can look up the size of nodenames,
then add that to the purgesize calculation.
2024-04-30 12:50:01 -07:00
Evan Hunt a8bda6ff1e simplify qpcache iterators
in a cache database, unlike zones, NSEC3 records are stored in
the main tree. it is not necessary to maintain a separate 'nsec3'
tree, nor to have code in the dbiterator implementation to traverse
from one tree to another.

(if we ever implement synth-from-dnssec using NSEC3 records, we'll
need to revert this change. in the meantime, simpler code is better.)
2024-04-30 12:50:01 -07:00
Evan Hunt 7ff43befb7 clean up unnecessary dbiterator code related to origin
the QP database doesn't support relative names as the RBTDB did, so
there's no need for a 'new_origin' flag or to handle `DNS_R_NEWORIGIN`
result codes.
2024-04-30 12:42:32 -07:00
Evan Hunt 85ab92b6e0 more cleanups in qpcache.c
- remove unneeded struct members and misleading comments.
- remove unused parameters for static functions.
- rename 'find_callback' to 'delegating' for consistency with qpzone;
  the find callback mechanism is not used in QP databases.
2024-04-30 12:42:31 -07:00
Evan Hunt 3acab71d46 rename QPDB_HEADERNODE to HEADERNODE
this makes the macro consistent between qpcache.c and qpzone.c.

also removed a redundant definition of HEADERNODE in qpzone.c.
2024-04-30 12:42:31 -07:00
Evan Hunt 46d40b3dca fix structure names in qpcache.c and qpzone.c
- change dns_qpdata_t to qpcnode_t (QP cache node), and dns_qpdb_t to
  qpcache_t, as these types are only accessed locally.
- also change qpdata_t in qpzone.c to qpznode_t (QP zone node), for
  consistency.
- make the refcount declarations for qpcnode_t and qpznode_t static,
  using the new ISC_REFCOUNT_STATIC macros.
2024-04-30 12:42:07 -07:00
Evan Hunt 20d32512ca clean up unnecessary requirements in qpcache.c
qpcache can only support cache semantics now, so there's
no longer any need to check for that internally.
2024-04-30 12:31:48 -07:00
Evan Hunt a5d0e6c4ba add static macros for ISC_REFCOUNT_DECL/IMPL
this commit adds a mechanism to statically declare attach/detach
and ref/unref methods, for objects that are only accessed within
a single C file.
2024-04-30 12:31:48 -07:00
Ondřej Surý bc8095311a Merge branch 'ondrej/improve-newref-checks' into 'main'
Improve the reference counting in newref()

See merge request isc-projects/bind9!8914
2024-04-30 18:43:39 +00:00
Ondřej Surý c13a1d8b01 Improve the reference counting checks in newref()
In qpcache (and rbtdb), there are some functions that acquire
neither the tree lock nor the node lock when calling newref().
In theory, this could lead to a race in which a new reference
is added to a node that was about to be deleted.

We now detect this condition by passing the current tree and node
lock status to newref(). If the node was previously unreferenced
and we don't hold at least one read lock, we will assert.
2024-04-30 08:41:56 +02:00
Michal Nowak b1b9ac1cba Merge branch 'mnowak/stress-tests-freebsd-instance-autoscaler' into 'main'
Use FreeBSD autoscaler for "stress" tests

See merge request isc-projects/bind9!8968
2024-04-29 18:10:52 +00:00
Michal Nowak 65a93b77e1 Use FreeBSD autoscaler for "stress" tests
The FreeBSD autoscaler has been configured to utilize the new "instance"
GitLab Runner executor to spawn "stress" test CI jobs on AWS EC2
dynamically. A shared GitLab Runner named "freebsd-instance-autoscaler"
has been set up in GitLab CI/CD to communicate with EC2, provisioning VM
instances on demand based on a FreeBSD 13 AMI image. This image is the
same as the one previously used for FreeBSD "stress" tests before the
implementation of autoscaling (specifically, the
"freebsd13-amd64-bind9stress.aws.lab.isc.org" GitLab Runner in CI/CD).
2024-04-29 19:53:51 +02:00
Michał Kępień 29cef34a34 Merge branch 'michal/update-urls-and-paths-for-the-bind-9-qa-repository' into 'main'
Update URLs and paths for the BIND 9 QA repository

See merge request isc-projects/bind9!8990
2024-04-29 09:48:06 +00:00
Michał Kępień 25ec1d79e4 Update URLs and paths for the BIND 9 QA repository
Since the BIND 9 QA repository has been made public, adjust the relevant
URLs and paths used in .gitlab-ci.yml so that they work with the public
version of that repository.
2024-04-26 18:43:07 +02:00
Aydın Mercan 79573f1390 Merge branch '4523-dnstap-support-for-new-transport-protocols' into 'main'
Emit and read correct DoT and DoH dnstap entries

Closes #4523

See merge request isc-projects/bind9!8697
2024-04-26 15:47:46 +00:00
Aydın Mercan 042bb98846 Add CHANGES and release note for [GL #4523] 2024-04-26 16:12:29 +03:00
Aydın Mercan f30008a71c Provide an early escape hatch for ns_client_transport_type
Because some tests don't have a legtimate handle, provide a temporary
return early that should be fixed and removed before squashing. This
short circuiting is still correct until DoQ/DoH3 support is introduced.
2024-04-26 16:12:29 +03:00
Aydın Mercan b5478654a2 Add fallback to ns_client_get_type despite unreachable
GCC might fail to compile because it expects a return after UNREACHABLE.
It should ideally just work anyway since UNREACHABLE is either a
noreturn or UB (__builtin_unreachable / C23 unreachable).

Either way, it should be optimized almost always so the fallback is
free or basically free anyway when it isn't optimized out.
2024-04-26 16:12:29 +03:00
Aydın Mercan 4a3f7fe1ef Emit and read correct DoT and DoH dnstap entries
Other protocols still pretend to be TCP/UDP.
This only causes a difference when using dnstap-read on a file with DoQ
or DNSCrypt entries
2024-04-26 16:12:29 +03:00
Aydın Mercan 9d1a8a98c6 Update the dnstap protobuf definition
The new definition includes the missing protocol definitions and
specifies the protobuf version.
2024-04-26 16:08:46 +03:00
Evan Hunt 657ee2b997 Merge branch 'each-qpzone-oneheap' into 'main'
simplify qpzone database by using only one heap for resigning

See merge request isc-projects/bind9!8889
2024-04-26 01:19:42 +00:00
Ondřej SurýandEvan Hunt 6c54337f52 avoid a race in the qpzone getsigningtime() implementation
the previous commit introduced a possible race in getsigningtime()
where the rdataset header could change between being found on the
heap and being bound.

getsigningtime() now looks at the first element of the heap, gathers the
locknum, locks the respective lock, and retrieves the header from the
heap again.  If the locknum has changed, it will rinse and repeat.
Theoretically, this could spin forever, but practically, it almost never
will as the heap changes on the zone are very rare.

we simplify matters further by changing the dns_db_getsigningtime()
API call. instead of passing back a bound rdataset, we pass back the
information the caller actually needed: the resigning time, owner name
and type of the rdataset that was first on the heap.
2024-04-25 15:48:43 -07:00
Evan Hunt 7e6be9f1b5 simplify qpzone database by using only one heap for resigning
in RBTDB, the heap was used by zone databases for resigning, and
by the cache for TTL-based cache cleaning. the cache use case required
very frequent updates, so there was a separate heap for each of the
node lock buckets.

qpzone is for zones only, so it doesn't need to support the cache
use case; the heap will only be touched when the zone is updated or
incrementally signed. we can simplify the code by using only a single
heap.
2024-04-25 15:41:39 -07:00
Evan Hunt 7d289e5333 Merge branch '4659-rootkeysentinel-test-fails-for-certain-values-of-oldid' into 'main'
fix_iterator() bug causes DNSSEC NXDOMAIN responses to be broken

Closes #4659

See merge request isc-projects/bind9!8942
2024-04-25 18:10:29 +00:00
Evan Hunt 6f4ef40ccd CHANGES for [GL #4659] 2024-04-25 10:30:47 -07:00
Evan Hunt 237123e500 simplify code by removing return values where possible
fix_iterator() and related functions are quite difficult to read.
perhaps it would be a little clearer if we didn't assign values
to variables that won't subsequently be used, or unnecessarily
pop the stack and then push the same value back onto it.

also, in dns_qp_lookup() we previously called fix_iterator(),
removed the leaf from the top of the iterator stack, and then
added it back on. this would be clearer if we just push the leaf
onto the stack when we need to, but leave the stack alone when
it's already complete.
2024-04-25 10:29:07 -07:00
Evan Hunt b1b1ca8ca4 add another broken testcase 2024-04-25 10:29:07 -07:00
Evan Hunt 66dbff596b clean up fix_iterator() arguments
the value passed as 'start' was redundant; it's always the same
as the current top of the iterator stack.
2024-04-25 10:29:07 -07:00
Evan Hunt 2dff926624 yet another fix_iterator() bug
under some circumstances it was possible for the iterator to
be set to the first leaf in a set of twigs, when it should have
been set to the last.

a unit test has been added to test this scenario. if there is a
a tree containing the following values: {".", "abb.", "abc."}, and
we query for "acb.", previously the iterator would be positioned at
"abb." instead of "abc.".

the tree structure is:
    branch (offset 1, ".")
      branch (offset 3, ".ab")
        leaf (".abb")
        leaf (".abc")

we find the branch with offset 3 (indicating that its twigs differ
from each other in the third position of the label, "abB" vs "abC").
but the search key differs from the found keys at position 2
("aC" vs "aB").  we look up the bit value in position 3 of the
search key ("B"), and incorrectly follow it onto the wrong twig
("abB").

to correct for this, we need to check for the case where the search
key is greater than the found key in a position earlier than the
branch offset. if it is, then we need to pop from the current leaf
to its parent, and get the greatest leaf from there.

a further change is needed to ensure that we don't do this twice;
when we've moved to a new leaf and the point of difference between
it and the search key even earlier than before, then we're definitely
at a predecessor node and there's no need to continue the loop.
2024-04-25 10:29:07 -07:00
Michal Nowak b1184d916d Merge branch 'mnowak/fix-changes-entry-6378' into 'main'
Reformat overflowing CHANGES entry 6378

See merge request isc-projects/bind9!8981
2024-04-25 07:31:29 +00:00
Michal Nowak 84180c8ee1 Reformat overflowing CHANGES entry 6378
$ sh util/check-line-length.sh CHANGES
    CHANGES: Line Too Long
                            previously removed. An attempt to use the option now prints
2024-04-25 09:22:27 +02:00
Ondřej Surý 1359694267 Merge branch '1879-fix-documentation-on-named--U' into 'main'
Properly document that named -U <n> is no-op now

Closes #1879

See merge request isc-projects/bind9!8976
2024-04-24 20:50:09 +00:00
Ondřej Surý 9305ebdabe Add CHANGES and release note for [GL #1879] 2024-04-24 22:49:26 +02:00
Ondřej Surý d69cd51f91 Properly document that named -U <n> is no-op now
We don't create <n> UDP dispatches anymore and -U <n> option to named is
a no-op for a while.  Properly document that in the named man page.
2024-04-24 22:49:14 +02:00
Petr Špaček 0f86976672 Merge branch 'spdx-custom-test-driver' into 'main'
Use standard SPDX license for custom-test-driver

See merge request isc-projects/bind9!8971
2024-04-24 09:49:44 +00:00
Petr MenšíkandPetr Špaček 2b348a5daa Change exception SPDX to Autoconf-exception-generic
License text is in fact Autoconf generic exception, with already defined
SPDX identificator. Use that instead.

https://spdx.org/licenses/Autoconf-exception-generic.html
2024-04-24 09:46:58 +00:00
Mark Andrews ed77b61599 Merge branch '4684-unit-test-error-handling-in-dns_name_-api' into 'main'
test dns_name_fromregion

Closes #4684

See merge request isc-projects/bind9!8967
2024-04-24 02:14:05 +00:00
Mark Andrews e6984e5c07 Extract empty name in 'source' into 'name' 2024-04-24 01:38:14 +00:00
Mark Andrews 7a13fcd601 Extract non absolute name from source
The entire source region needs to be consumed for this usage.
2024-04-24 01:38:14 +00:00
Mark Andrews 7d7fc8cb2d Extract fully qualified named from source without buffer
'name.ndata' should point to the source.
2024-04-24 01:38:14 +00:00
Mark Andrews 254ba1b051 Test dns_name_fromregion
with a large source region and a large target buffer, both
larger than DNS_NAME_MAXWIRE.
2024-04-24 01:38:14 +00:00
Mark Andrews 63b93ccda2 Merge branch '4689-test-invalid-notify-source-address' into 'main'
Check behaviour using invalid notify source address

Closes #4689

See merge request isc-projects/bind9!8966
2024-04-24 01:09:35 +00:00
Mark Andrews 580c41de0d check behaviour with invalid notify-source-v6 address
This was reported as causing the server to fail to shutdown on
NetBSD.  Look for the expected informational and error messages.
2024-04-24 10:12:42 +10:00
Michal Nowak 4f7947c583 Merge branch 'mnowak/llvm-18' into 'main'
Bump the LLVM version to 18 and reformat sources

See merge request isc-projects/bind9!8827
2024-04-23 12:48:22 +00:00
Michal Nowak f454fa6dea Update sources to Clang 18 formatting 2024-04-23 13:11:52 +02:00
Michal Nowak 7107c44c7c Update Clang to version 18 2024-04-23 13:11:52 +02:00
Ondřej Surý abbc59a270 Merge branch 'ondrej/fix-adb-entries-cleaning' into 'main'
Always set ADB entry expiration to now + ADB_ENTRY_WINDOW

See merge request isc-projects/bind9!8934
2024-04-22 08:37:45 +00:00
Ondřej Surý 141e4c9805 Change the ADB_ENTRY_WINDOW to 60 seconds
The previous value of 30 minutes used to cache the ADB names and entries
was quite long.  Change the value to 60 seconds for faster recovery
after cached intermittent failure of the remote nameservers.
2024-04-22 10:36:36 +02:00
Ondřej Surý 6708da3112 Unify the expiration time handling for all ADB expiration
The algorithm from the previous commit[1] is now used to calculate all
the expiration values through the code (ncache results, cname/dname
targets).

1. ISC_MIN(cur, ISC_MAX(now + ADB_ENTRY_WINDOW, now + rdataset->ttl))
2024-04-22 10:36:36 +02:00
Ondřej Surý 53cc00ee3f Fix the expire_v4 and expire_v6 logic
Correct the logic to set the expiration period of expire_{v4,v6} as
follows:

1. If the trust is ultimate (local entry), immediately set the entry as
   expired, so the changes to the local zones have immediate effect.

3. If the expiration is already set and smaller than the new value, then
   leave the expiration value as it is.

2. Otherwise pick larger of `now + ADB_ENTRY_WINDOW` and `now + TTL` as
   the new expiration value.
2024-04-22 10:36:36 +02:00
Ondřej Surý 932665410d Always set ADB entry expiration to now + ADB_ENTRY_WINDOW
When ADB entry was created it was set to never expire.  If we never
called any of the functions that adjust the expiration, it could linger
in the ADB forever.

Set the expiration (.expires) to now + ADB_ENTRY_WINDOW when creating
the new ADB entry to ensure the ADB entry will always expire.
2024-04-22 10:36:36 +02:00
Mark Andrews 6cb6b99ae7 Merge branch '4687-validator-c-1280-insist-val-nfails-0-failed' into 'main'
Resolve "validator.c:1280: INSIST((*val->nfails) > 0) failed"

Closes #4687

See merge request isc-projects/bind9!8963
2024-04-22 04:57:45 +00:00
Mark Andrews 26375bdcf2 Break out of the switch if we have already reached the quota
This prevents consume_validation_fail being called and causing an
INSIST.
2024-04-22 12:32:36 +10:00
Michal Nowak 970ac03196 Merge branch 'mnowak/drop-respdiff-short-ci-jobs' into 'main'
Drop respdiff-short CI jobs

See merge request isc-projects/bind9!8958
2024-04-19 15:56:00 +00:00
Michal Nowak 6a045cd8ec Drop respdiff-short CI jobs
In the past, our CI infrastructure was more sensitive to the number of
CI jobs running on it. We tried to limit long-running jobs in merge
request-triggered pipelines, as there are many of them, and spawned them
only in daily scheduled ones. Moving most of the CI infrastructure to
AWS has made it way better to run jobs in parallel, and the existence of
short respdiff jobs has lost its original merit. It can also be harmful
as some problems are detected only by the longer respdiff variant when a
faulty merge request has already been merged. We should run all long
respdiff tests in merge request-triggered pipelines.

Also, move the former respdiff-long job (now just "respdiff") to AWS as
old instance memory constraints (see
f09cf69594) are no longer an issue.
2024-04-19 16:42:49 +02:00
Petr Špaček c35f00e48a Merge branch 'pspacek/auto-backports' into 'main'
Attempt automatic MR backports after every merge

See merge request isc-projects/bind9!8959
2024-04-19 13:40:51 +00:00
Petr Špaček 49f9487577 Attempt automatic MR backports after every merge 2024-04-19 13:35:19 +00:00
Matthijs Mekking b53c03d98e Merge branch '1128-offline-ksk' into 'main'
Introduce new DNSSEC tool dnssec-ksr

See merge request isc-projects/bind9!8188
2024-04-19 11:56:50 +00:00
Matthijs Mekking afda87cb08 dnssec-keygen: Change flag options into booleans
We now have ctx.kskflag, ctx.zskflag, and ctx.revflag, but zskflag is
not quite like the other two, as it doesn't have a special bit in the
DNS packet, and is used as a boolean.

This patch changes so that we use booleans for all three, and
construct the flags based on which ones are set.

patch by @aram
2024-04-19 13:52:21 +02:00
Matthijs Mekking 7007025302 Don't leak
Make tsan happy, fix memory leaks by keeping track of the buffers
to be cleaned up.
2024-04-19 13:52:21 +02:00
Matthijs Mekking d9c947c57d Add test cases for CDS/CDNSKEY
Add two more test cases to ensure that a Signed Key Response file
creates signed CDNSKEY and/or CDS RRsets according to the policy.
2024-04-19 13:52:21 +02:00
Matthijs Mekking cdf0fd2e5e Adjust system test to expect CDS and CDNSKEY
Requires storing the KSK keyfile identifier to calculate the expected
CDS and CDNSKEY.
2024-04-19 13:52:21 +02:00
Matthijs Mekking 83da52d6e4 Add option to dnssec-dsfromkey to chop up rdata
The new option 'w' allows us to print DS rdata with the base64 portions
split up in chunks. This is mainly done for testing purposes.
2024-04-19 13:52:21 +02:00
Matthijs Mekking efe4fa6fc7 Add CDS and CDNSKEY to SKR
Add signed CDS and CDNSKEY RRsets to the Signed Key Response (SKR) for the
used KSKs.

We only print one bundle header for all three RRsets.
2024-04-19 13:52:21 +02:00
Matthijs Mekking 46785dc71e sh the fmt up
Apply shfmt patch. Ideally I fixup every commit that changes testing,
but that is just too much at this point.
2024-04-19 13:52:21 +02:00
Matthijs Mekking e7525cab4f Add CHANGES and release note
Introduce the new 'dnssec-ksr' tool.
2024-04-19 13:52:21 +02:00
Matthijs Mekking 695be761b0 Test dnssec-ksr sign
Add test cases for the 'sign' command. Reuse the earlier generated KSR
files.

Also update dnssec-ksr.c to have better cleanup.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 887fa0ddc9 Implement dnssec-ksr sign
Add code that can create a Signed Key Response (SKR) given a Key
Signing Request (KSR), a DNSSEC policy, a set of keys and an interval.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 31521fade2 Change ksr format
Make the ksr format compatible with knot.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 2bf03ab7df Refactor dnssec-ksr
Refactor some more, making the cleanup a generic function.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 852ba174dd Test dnssec-ksr request
Add test cases for the 'request' command. Reuse the earlier
pregenerated ZSKs. We also need to set up some KSK files, that can
be done with 'dnssec-keygen -k <policy> -fK' now.

The 'check_keys()' function is adjusted such that the expected active
time of the successor key is set to the inactive time of the
predecessor. Some additional information is saved to make 'request'
testing easier.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 1b39172ee7 Implement dnssec-ksr request
Add code that can create a Key Signing Request (KSR) given a DNSSEC
policy, a set of keys and an interval.

Multiple keys that match the bundle and kasp parameters are sorted by
keytag, mainly for testing purposes.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 22a4bd5bbe Also free the dst_key after keygen
During cleanup, we also need to free the dst_key structure that is part
of the dns_dnsseckey.
2024-04-19 10:41:04 +02:00
Matthijs Mekking ed9704fcda Refactor dnssec-ksr keygen
Create some helper functions for code that is going to be reused by the
other commands (request, sign), such as setting and checking the context
parameters, and retrieving the dnssec-policy/kasp.
2024-04-19 10:41:04 +02:00
Matthijs Mekking e033e58a85 dnssec-keygen: allow -f and -k together
The 'dnssec-keygen' tool now allows the options '-k <dnssec-policy>'
and '-f <flags>' together to create keys from a DNSSEC policy that only
match the given role. Allow setting '-fZ' to only create ZSKs, while
'-fK' will only create KSKs.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 7508534789 Implement dnssec-ksr keygen
Add code that can pregenerate ZSKs given a DNSSEC policy and an
interval.

Fix configuration shell scripts, fixing the ksr system test.
2024-04-19 10:41:04 +02:00
Matthijs Mekking a3915e535a Move kasp key match function to kasp header
The dnssec-ksr tool needs to check if existing key files match lines
in the keys section of a dnssec-policy, so make this function publicly
available.
2024-04-19 10:41:04 +02:00
Matthijs Mekking bc31575899 Move common create key functions to dnssectool.c
The dnssec-ksr tool needs to read a dnssec-policy from configuration
too, as well as deal with FIPS mode checks.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 1cb345fa95 Add ksr system test
Add a system test for testing dnssec-ksr, initally for the keygen
command. This should be able to create or select key files given a
DNSSEC policy and a time window.
2024-04-19 10:41:04 +02:00
Matthijs Mekking 77d4afba1b Introduce new DNSSEC tool dnssec-ksr
Introduce a new DNSSEC tool, dnssec-ksr, for creating signed key
response (SKR) files, given one or more key signing requests (KSRs).

For now it is just a dummy tool, but the future purpose of this utility
is to pregenerate ZSKs and signed RRsets for DNSKEY, CDNSKEY, and CDS
for a given period that a KSK is to be offline.
2024-04-19 10:41:04 +02:00
Michal Nowak 2ca6bcc99a Merge branch 'mnowak/revert-874329b3b1a56e58e8caf61d89127441d2cc79a1' into 'main'
Revert "Temporarily allow failure of respdiff-long:tsan job"

See merge request isc-projects/bind9!8957
2024-04-19 08:37:47 +00:00
Michal Nowak 620cce8f7e Revert "Temporarily allow failure of respdiff-long:tsan job"
This reverts commit 874329b3b1.

Addressed in isc-projects/bind9#4475.
2024-04-19 10:28:51 +02:00
Ondřej Surý e4793242eb Merge branch '4416-fix-reading-multiple-rndc-messages-in-single-TCP-message' into 'main'
Rework isccc_ccmsg to support multiple messages per tcp read

Closes #4416

See merge request isc-projects/bind9!8956
2024-04-18 18:10:56 +00:00
Ondřej Surý cbbc0051a3 Add CHANGES note for [GL #4416] 2024-04-18 20:09:47 +02:00
Dominik ThalhammerandOndřej Surý 24ae1157e8 Rework isccc_ccmsg to support multiple messages per tcp read
Previously, only a single controlconf message would be processed from a
single TCP read even if the TCP read buffer contained multiple messages.
Refactor the isccc_ccmsg unit to store the extra buffer in the internal
buffer and use the already read data first before reading from the
network again.

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Dominik Thalhammer <dominik@thalhammer.it>
2024-04-18 20:08:44 +02:00
Ondřej Surý e13728413a Merge branch '4586-don-t-count-expired-future-rrsigs-in-verification-failure-quota' into 'main'
Don't count expired / future RRSIGs in verification failure quota

Closes #4586

See merge request isc-projects/bind9!8746
2024-04-18 15:07:43 +00:00
Ondřej Surý 5d4233c2c2 Add CHANGES and release notes for [GL #4586] 2024-04-18 16:05:32 +02:00
Ondřej Surý 3b9ea189b2 Don't count expired / future RRSIG against quota
These don't trigger a public key verification unless
dnssec-accept-expired is set.
2024-04-18 16:05:31 +02:00
Petr Špaček 903af2e1de Merge branch 'pspacek/update-sphinx' into 'main'
Update Sphinx version used for documentation build

See merge request isc-projects/bind9!8952
2024-04-18 14:00:33 +00:00
Petr Špaček da607d6a06 Update Sphinx version used for documentation build 2024-04-18 12:46:13 +02:00
Ondřej Surý bbb2741de8 Merge branch 'ondrej-offload-statschannel' into 'main'
Offload the isc_http response processing to worker thread

Closes #4680

See merge request isc-projects/bind9!7647
2024-04-18 08:56:06 +00:00
Ondřej Surý fbea3bb255 Add CHANGES and release note for [GL #4680] 2024-04-18 10:53:31 +02:00
Ondřej Surý c7ed858c6e Supress the leak detection in xmlGetGlobalState
The xmlGetGlobalState allocates per-thread memory that is not properly
cleaned up when the libxml2 is used from offloaded threads.  Add the
function the the LeakSanitizer suppression list.
2024-04-18 10:53:31 +02:00
Ondřej Surý 23835c4afe Use xmlMemSetup() instead of xmlGcMemSetup()
Since we don't have a specialized function for "atomic" allocations,
it's better to just use xmlMemSetup() instead of xmlGcMemSetup()
according to this:

https://mail.gnome.org/archives/xml/2007-August/msg00032.html
2024-04-18 10:53:31 +02:00
Ondřej Surý 950f828cd2 Offload the isc_http response processing to worker thread
Prepare the statistics channel data in the offloaded worker thread, so
the networking thread is not blocked by the process gathering data from
various data structures.  Only the netmgr send is then run on the
networkin thread when all the data is already there.
2024-04-18 10:53:00 +02:00
Matthijs Mekking f8a09fd91a Merge branch '4554-dnssec-policy-jitter' into 'main'
Add signatures-jitter option

Closes #4554

See merge request isc-projects/bind9!8686
2024-04-18 08:11:18 +00:00
Matthijs Mekking c3d8932f79 Add checkconf check for signatures-jitter
Having a value higher than signatures-validity does not make sense
and should be treated as a configuration error.
2024-04-18 09:50:33 +02:00
Matthijs Mekking 8b7785bc23 Add release notes and CHANGES for #4554
Mention the new signature jitter option.
2024-04-18 09:50:31 +02:00
Matthijs Mekking 67f403a423 Implement signature jitter
When calculating the RRSIG validity, jitter is now derived from the
config option rather than from the refresh value.
2024-04-18 09:50:10 +02:00
Matthijs Mekking 0438d3655b Refactor code that calculates signature validity
There are three code blocks that are (almost) similar, refactor it
to one function.
2024-04-18 09:50:10 +02:00
Matthijs Mekking 50bd729019 Update autosign test to use signatures-jitter
Now that we have an option to configure jitter, use it in system tests
that test jitter.
2024-04-18 09:50:10 +02:00
Matthijs Mekking 2a4daaedca Add signatures-jitter option
Add an option to speficy signatures jitter.
2024-04-18 09:50:10 +02:00
Petr Špaček c9ff77c067 Merge tag 'v9.19.23' 2024-04-18 09:21:47 +02:00
Mark Andrews 9360d90bf2 Merge branch '4671-calling-dns_qpkey_toname-twice-fails' into 'main'
Resolve "Calling dns_qpkey_toname twice fails."

Closes #4671

See merge request isc-projects/bind9!8948
2024-04-18 01:05:42 +00:00
Mark Andrews 36c11d9180 Check that name is properly reset by dns_qpkey_toname 2024-04-18 00:17:48 +00:00
Mark Andrews bf70d4840c dns_qpkey_toname failed to reset name correctly
This could lead to a mismatch between name->length and the rest
of the name structure.
2024-04-18 00:17:48 +00:00
Ondřej Surý fcf2919c93 Merge branch '4475-use-atomics-to-access-trust-access-in-dns_ncache' into 'main'
Use atomic operations to access the trust byte in ncache data

Closes #4475

See merge request isc-projects/bind9!8946
2024-04-17 19:18:35 +00:00
Mark AndrewsandOndřej Surý d2fd97f4da Add CHANGES note for [GL #4475] 2024-04-17 17:14:50 +02:00
Ondřej Surý eb1829b970 Use atomic operations to access the trust byte in ncache data
Protect the access to the trust byte in the ncache data with relaxed
atomic operation to mimick the current behaviour.  This will teach
TSAN that the concurrent access is fine.
2024-04-17 17:14:34 +02:00
Mark AndrewsandOndřej Surý 4ef755ffb0 Only copy the name data after we know its actual length
This prevents TSAN errors with the ncache code where the trust byte
access needs to be protected by a lock.  The old code copied the
entire region before determining where the name ended.  We now
determine where the name ends then copy just that data and in doing
so avoid reading the trust byte.
2024-04-17 17:14:34 +02:00
Artem Boldariev 90b0038ea0 Merge branch '4434-use-nm-tests-timeouts-for-the-dispatch-test' into 'main'
dispatch_test: use the NM tests timeouts

Closes #4434

See merge request isc-projects/bind9!8923
2024-04-15 14:25:13 +00:00
Artem Boldariev 7f805659c3 dispatch_test: use the NM tests timeouts
This commit makes the dispatch_test use the same timeouts that network
manager tests. We do that because the old values appear to be too
small for our heavy loaded CI machines, leading to spurious failures
on them. The network manager tests are much more stable in this
situation and they use somewhat larger timeout values.

We use a smaller connection timeouts for the tests which are expected
to timeout to not wait for too long.
2024-04-15 16:33:24 +03:00
Mark Andrews 381273f89f Merge branch '4669-error-sending-notify-to-ipv6-secondary' into 'main'
Wrong source address used for IPv6 notify messages

Closes #4669

See merge request isc-projects/bind9!8935
2024-04-12 00:16:01 +00:00
Mark Andrews 9cc6b4a68a Add CHANGES note for [GL #4669] 2024-04-11 18:05:25 +00:00
Mark Andrews 7c369ea3d9 Check that notify message was sent over IPv6 2024-04-11 18:05:25 +00:00
Mark Andrews 40fd4cd407 Wrong source address used for IPv6 notify messages
The source address field of 'newnotify' was not updated from the
default (0.0.0.0) when the destination address was an IPv6 address.
This resulted in the messages failing to be sent.  Set the source
address to :: when the destination address is an IPv6 address.
2024-04-11 18:05:25 +00:00
Petr Špaček 9c712eff0a Merge branch 'pspacek/releng-changes' into 'main'
Move Release issue template to BIND QA repo

See merge request isc-projects/bind9!8944
2024-04-11 15:15:49 +00:00
Petr Špaček d2fa9a642b Move Release issue template to BIND QA repo
It's easier to maintain the template in a single place together with
the script used to in the template.

In future use script bind9/releng/create_checklist.py
from isc-private/bind-qa to generate release issue.
2024-04-11 15:15:32 +00:00
Evan Hunt c13e8e1859 Merge branch 'each-dupwithoffsets-cannot-fail' into 'main'
dns_name_dupwithoffsets() cannot fail

See merge request isc-projects/bind9!8945
2024-04-11 03:25:07 +00:00
Evan Hunt 2c88946590 dns_name_dupwithoffsets() cannot fail
this function now always returns success; change it to void and
clean up its callers.
2024-04-10 22:51:07 -04:00
Petr Špaček 480126919a Merge branch 'pspacek/set-up-version-and-release-notes-for-bind-9.19.24' into 'main'
Set up version and release notes for BIND 9.19.24

See merge request isc-projects/bind9!8939
2024-04-04 19:15:28 +00:00
Petr Špaček 1341a1a734 Set up release notes for BIND 9.19.24 2024-04-04 19:35:03 +02:00
Petr Špaček b0b4ea3975 Update BIND version to 9.19.24-dev 2024-04-04 19:35:03 +02:00
Petr Špaček 3c0eaff4c6 Update BIND version for release 2024-04-02 18:08:00 +02:00
Petr Špaček dc9d9a8fdf Add a CHANGES marker 2024-04-02 18:06:04 +02:00
Petr Špaček 03c9e0b753 Merge branch 'pspacek/prepare-documentation-for-bind-9.19.23' into 'v9.19.23-release'
Prepare documentation for BIND 9.19.23

See merge request isc-private/bind9!677
2024-04-02 16:04:47 +00:00
Suzanne GoldlustandPetr Špaček 4c0db2ee3c Tweak and reword release notes 2024-04-02 17:45:25 +02:00
Petr Špaček e4344b7d1a Add release note for GL #4622 and #4652 2024-04-02 17:31:42 +02:00
Petr Špaček 3989b99a0b Add release note for GL #4614 2024-04-02 17:31:42 +02:00
Petr Špaček 1076bd3c78 Add release note for GL #4552 2024-04-02 17:31:42 +02:00
Petr Špaček bf92e16c0e Prepare release notes for BIND 9.19.23 2024-04-02 17:31:42 +02:00
Ondřej Surý ae2b59bfe7 Merge branch '4446-deprecate-fixed-rrset-order' into 'main'
Deprecate fixed value for the rrset-order option

Closes #4446

See merge request isc-projects/bind9!8808
2024-04-02 15:21:10 +00:00
Ondřej Surý 792ac13d60 Add CHANGES and release note for [GL #4446] 2024-04-02 15:21:00 +00:00
Ondřej Surý 304b5ec1ad Deprecate fixed value for the rrset-order option
Mark the "fixed" value for the "rrset-order" option deprecated, so we
can remove it in the future.
2024-04-02 15:21:00 +00:00
Ondřej Surý bf538b63a8 Merge branch '4593-deprecate-sortlist' into 'main'
Deprecate sortlist option

Closes #4593

See merge request isc-projects/bind9!8807
2024-04-02 15:13:26 +00:00
Ondřej Surý dfefc89b7e Add CHANGES and release note for [GL #4593] 2024-04-02 16:27:03 +02:00
Ondřej Surý 7c96bf3e71 Deprecate sortlist option
Mark the sortlist option deprecated, so we can remove it in the
future.
2024-04-02 16:26:39 +02:00
Ondřej Surý b7b69d9cf0 Merge branch '4654-validator-invalid-name' into 'main'
Rename and fix dns_validator_destroy()

Closes #4654

See merge request isc-projects/bind9!8933
2024-04-02 14:22:55 +00:00
Aram SargsyanandOndřej Surý 88d826ac5d Add a CHANGES note for [GL #4654] 2024-04-02 16:21:54 +02:00
Aram SargsyanandOndřej Surý a5ea7bcd25 Rename and fix dns_validator_destroy() to dns_validator_shutdown()
Since the dns_validator_destroy() function doesn't guarantee that
it destroys the validator, rename it to dns_validator_shutdown()
and require explicit dns_validator_detach() to follow.

Enforce the documented function requirement that the validator must
be completed when the function is called.

Make sure to set val->name to NULL when the function is called,
so that the owner of the validator may destroy the name, even if
the validator is not destroyed immediately. This should be safe,
because the name can be used further only for logging by the
offloaded work callbacks when they detect that the validator is
already canceled/complete, and the logging function has a condition
to use the name only when it is non-NULL.
2024-04-02 16:21:54 +02:00
Aram Sargsyan a6c6ad048d Remove a redundant log message and a comment
If val->result is not ISC_R_SUCCESS, a similar message is logged
further down in the function. Remove the redundant log message.

Also remove an unnecessary code comment line.
2024-04-02 10:34:31 +00:00
Ondřej Surý 424cb59a43 Merge branch 'each-isc-loop' into 'main'
use a thread-local variable to get the current running loop

See merge request isc-projects/bind9!8911
2024-04-02 09:49:06 +00:00
Ondřej Surý cad6292fc4 Merge branch '4652-dname-assertion' into 'main'
fix crash from NS target below DNAME

Closes #4652

See merge request isc-projects/bind9!8931
2024-04-02 08:36:08 +00:00
Evan HuntandOndřej Surý 63659e2e3a complete removal of isc_loop_current()
isc_loop() can now take its place.

This also requires changes to the test harness - instead of running the
setup and teardown outside of th main loop, we now schedule the setup
and teardown to run on the loop (via isc_loop_setup() and
isc_loop_teardown()) - this is needed because the new the isc_loop()
call has to be run on the active event loop, but previously the
isc_loop_current() (and the variants like isc_loop_main()) would work
even outside of the loop because it needed just isc_tid() to work, but
not the full loop (which was mainly true for the main thread).
2024-04-02 10:35:56 +02:00
Evan HuntandOndřej Surý c47fa689d4 use a thread-local variable to get the current running loop
if we had a method to get the running loop, similar to how
isc_tid() gets the current thread ID, we can simplify loop
and loopmgr initialization.

remove most uses of isc_loop_current() in favor of isc_loop().
in some places where that was the only reason to pass loopmgr,
remove loopmgr from the function parameters.
2024-04-02 10:35:56 +02:00
Evan HuntandOndřej Surý f95b890759 Add CHANGES note for [GL #4652] 2024-04-02 10:00:17 +02:00
Evan HuntandOndřej Surý ea6659a5e9 update foundname when detecting a zonecut above qname
an assertion could be triggered in the QPDB cache if a DNAME
was found above a queried NS, because the 'foundname' value was
not correctly updated to point to the zone cut.

the same mistake existed in qpzone and has been fixed there as well.
2024-04-02 10:00:03 +02:00
Evan HuntandOndřej Surý b4cc46de07 add a test for handling illegal NS below DNAME
an assertion could be triggered in the QPDB cache if an NS
was encountered that pointed to a name below a DNAME.
2024-04-02 10:00:03 +02:00
Ondřej Surý 183b3cb6aa Merge branch 'ondrej/placeholder' into 'main'
Add placeholder

See merge request isc-projects/bind9!8932
2024-04-02 07:18:53 +00:00
Ondřej Surý 40a6efae01 Add placeholder 2024-04-02 09:16:39 +02:00
Michał Kępień 86d5981dcd Merge branch 'michal/extract-changes-checks-to-a-separate-gitlab-ci-job' into 'main'
Extract CHANGES checks to a separate GitLab CI job

See merge request isc-projects/bind9!8918
2024-03-29 07:29:59 +00:00
Michał Kępień a7ece8e0bd Restore consistency in YAML anchor names
Commit a4e9ce500a added "pipelines" to CI
job trigger lists without updating the names of the YAML anchors
containing those lists accordingly.  Update YAML anchor names so that
they are consistent with their own contents.
2024-03-29 08:27:49 +01:00
Michał Kępień 8c2503947f Do not check CHANGES in pre-release pipelines
Since pre-release testing is usually carried out for branches in which
CHANGES entries are intentionally malformed to prevent entry numbering
conflicts down the road, do not run the "changes" GitLab CI job in
pipelines that are triggered by a parent pipeline (which can currently
only be a pre-release testing pipeline) to prevent triggering job
failures that would be meaningless anyway.
2024-03-29 08:27:49 +01:00
Michał Kępień 1335e139f2 Extract CHANGES checks to a separate GitLab CI job
Checking the contents of the CHANGES file currently requires invoking
multiple shell scripts.  These invocations are conflated with those for
other test scripts in the "misc" GitLab CI job.  Extract the commands
checking the contents of the CHANGES file to a separate GitLab CI job,
"changes", to improve readability.  Remove similar checks for the
CHANGES.SE file altogether as they are only relevant for BIND -S and
therefore should not be present in an open source branch.
2024-03-29 08:27:49 +01:00
Michał Kępień 7b5b3a842b Merge branch '4281-CVE-2023-5517-test' into 'main'
[CVE-2023-5517] Check nxdomain-redirect against built-in RFC-1918 zone

Closes #4281

See merge request isc-projects/bind9!8919
2024-03-28 13:42:02 +00:00
Mark AndrewsandMichał Kępień 2789906ce4 Checking nxdomain-redirect against built-in RFC-1918 zone
Check that RFC 1918 leak detection does not trigger an assertion
when nxdomain redirection is enabled in the server but not for the
RFC 1918 reverse namespace.
2024-03-28 13:15:45 +01:00
Michal Nowak 0371223343 Merge branch 'mnowak/freebsd-use-mit-kerberos5' into 'main'
Build FreeBSD with MIT Kerberos5 instead of Heimdal

See merge request isc-projects/bind9!8906
2024-03-27 08:15:26 +00:00
Michal Nowak d6df757fdc Build FreeBSD with MIT Kerberos5 instead of Heimdal
tsiggss system tests crash or are unstable with the base FreeBSD
(Heimdal-based) GSS-API.
2024-03-26 18:13:40 +01:00
Michal Nowak f0800501c7 Merge branch 'mnowak/revert-05b09f2b5bb68a916288f56bf627babad4055b90' into 'main'
Revert "Work around a TSAN issue with newer kernels"

Closes #4649

See merge request isc-projects/bind9!8905
2024-03-25 13:45:39 +00:00
Michal Nowak aba16af556 Revert "Work around a TSAN issue with newer kernels"
This reverts commit 05b09f2b5b.

The workaround has been moved to the AMI image (isc-private/packer!10).
2024-03-25 14:38:12 +01:00
Matthijs Mekking af220a5b72 Merge branch '4622-qp-hang-in-fix-iterator' into 'main'
Fix fix_iterator hang

Closes #4622 and #4632

See merge request isc-projects/bind9!8881
2024-03-25 10:53:36 +00:00
Matthijs Mekking 77d4bb9751 Fix fix_iterator hang
If there are no more previous leaves, it means the queried name
precedes the entire range of names in the database, so we should just
move the iterator one step back and return, instead of continuing our
search for the predecessor.

This is similar to an earlier bug fixed in an earlier commit:

    ea9a8cb392
2024-03-25 10:40:23 +01:00
Matthijs Mekking 2a724a808d Add a test case for fix_iterator hang
When fixing the iterator, when every leaf on this branch is greater
than the one we wanted we go back to the parent branch and iterate back
to the predecessor from that point.

But if there are no more previous leafs, it means the queried name
precedes the entire range of names in the database, so we would just
move the iterator one step back and continue from there.

This could end in a loop because the queried name precedes the entire
range of names and so none of those names are the predecessor of the
queried name.
2024-03-25 10:40:23 +01:00
Petr Špaček 948a89d591 Merge branch 'pspacek/hazard-improvements' into 'main'
CI hazard improvements

See merge request isc-projects/bind9!8843
2024-03-21 16:57:12 +00:00
Michał KępieńandPetr Špaček 5e02a007ca Warn if security fixes are not marked for testing 2024-03-21 17:38:57 +01:00
Petr Špaček 0ba29730f7 Warn about release notes without CHANGES entry 2024-03-21 17:38:57 +01:00
Petr Špaček 82cfb48295 Detect change in supported RR types and issue Hazard warning 2024-03-21 17:38:57 +01:00
Tom Krizek 087e7b590f Merge branch '4605-re-enable-enginepkcs11-test' into 'main'
Re-enable enginepkcs11 system test

Closes #4605

See merge request isc-projects/bind9!8888
2024-03-21 16:36:13 +00:00
Tom Krizek d1f1b6a934 Mark the enginepkcs11 test as flaky
There are frequent intermittent failures due to "crypto failure".
2024-03-21 16:25:02 +01:00
Tom Krizek 3712a219cb Re-enable enginepkcs11 system test
The condition in prereq.sh which attempts to match two string uses
integer equality operation. This results in an error, causing the
enginepkcs11 test to always be skipped. Use = operator for the string
comparison instead.
2024-03-21 16:25:00 +01:00
Tom Krizek da39dffd08 Merge branch 'tkrizek/autosign-flaky' into 'main'
Mark the autosign system test as flaky

Closes #4247 and #1565

See merge request isc-projects/bind9!8867
2024-03-21 15:23:27 +00:00
Tom Krizek a061fd67f6 Mark the autosign system test as flaky
The autosign test uses sleep in many cases to wait for something to
happen. This inevitably leads to an instability that manifests in our
CI. Allow an automatic rerun of the test to improve its stability.
2024-03-21 15:26:28 +01:00
Tom Krizek 32e7e0a8ee Merge branch 'tkrizek/resolver-test-export-home' into 'main'
Export variable in resolver system test

See merge request isc-projects/bind9!8799
2024-03-21 13:14:52 +00:00
Tom Krizek 86a192cece Export variable in resolver system test
Variable assignment when calling subroutines might not be portable.
Notably, it doesn't work with FreeBSD shell, where the value of HOME
would be ignored in this case.

Since the commands are already executed in a subshell, export the HOME
variable to ensure it is properly handled in all shells.
2024-03-21 13:25:00 +01:00
Michał Kępień b1ebd49f3a Merge branch 'michal/add-pipelines-to-ci-job-trigger-lists' into 'main'
Add "pipelines" to CI job trigger lists

See merge request isc-projects/bind9!8884
2024-03-21 11:29:53 +00:00
Michał Kępień a4e9ce500a Add "pipelines" to CI job trigger lists
To enable GitLab CI jobs in other projects to trigger pipelines in the
BIND 9 project using their CI_JOB_TOKEN, add "pipelines" to the relevant
GitLab CI job trigger lists.
2024-03-21 12:29:21 +01:00
Petr Špaček 225d986cdf Merge branch '4649-work-around-a-tsan-issue-with-newer-kernels' into 'main'
Work around a TSAN issue with newer kernels

Closes #4649

See merge request isc-projects/bind9!8893
2024-03-21 07:59:46 +00:00
Michał Kępień 05b09f2b5b Work around a TSAN issue with newer kernels
The ThreadSanitizer version currently available from Fedora 39
repositories is unable to cope with very high ASLR entropy, which is the
default in some recent Linux distributions [1].  This causes all
TSAN-enabled builds to fail on the affected systems with an error like:

    FATAL: ThreadSanitizer: unexpected memory mapping 0x7d00e0772000-0x7d00e0c00000

Work around the problem by reducing ASLR entropy for all TSAN-enabled
builds until the problem is resolved upstream.

[1] https://github.com/google/sanitizers/issues/1716
2024-03-21 06:47:29 +01:00
Mark Andrews ab441581b5 Merge branch '4640-checkzone-in-system-test-leaks-queries' into 'main'
Resolve "Checkzone in system test leaks queries"

Closes #4640

See merge request isc-projects/bind9!8870
2024-03-21 02:37:07 +00:00
Mark Andrews ad083897cc Stop named-checkzone leaking test queries 2024-03-21 01:10:36 +00:00
Mark Andrews c8efe7fe1d Merge branch '4580-add-resolver-arpa-to-the-built-in-empty-zones' into 'main'
Resolve "Add resolver.arpa to the built in empty zones"

Closes #4580

See merge request isc-projects/bind9!8732
2024-03-20 21:51:24 +00:00
Mark Andrews ecb043fc7b Add release note for [GL #4580] 2024-03-21 07:45:55 +11:00
Mark Andrews d12c238750 Add CHANGES entry for [GL #4580] 2024-03-21 07:45:55 +11:00
Mark Andrews 49561277de Add RESOLVER.ARPA to the built in empty zones
RFC 9462 adds RESOLVER.ARPA to the list of built in empty zones.
2024-03-21 07:45:55 +11:00
Michał Kępień 22591ae0a7 Merge tag 'v9.19.22' 2024-03-20 14:04:49 +01:00
Michał Kępień 13c6f25abb Merge branch 'michal/add-an-async-dns-server-for-use-in-system-tests' into 'main'
Add an async DNS server for use in system tests

See merge request isc-projects/bind9!8519
2024-03-20 09:28:43 +00:00
Tom KrizekandMichał Kępień 673387c4d5 Move conftest log initialization to conftest.py
Initializing the conftest logging upon importing the isctest package
isn't practical when there are standalone pieces which can be used
outside of the testing framework, such as the asyncdnsserver module.
2024-03-20 09:22:36 +01:00
Michał KępieńandTom Krizek 6c010a5644 Add an async DNS server for use in system tests
Implement a new Python class, AsyncDnsServer, which can be used by
ans.py scripts placed in ansX/ system test subdirectories.  This enables
conveniently starting a feature-limited, non-standards-compliant, custom
DNS server instance.  It can read and serve zone files, but it is also
able to evaluate any user-provided query-processing logic, allowing
query responses to be changed, delayed, or dropped altogether.  These
are all actions commonly taken by custom DNS servers written in Python
that are used in BIND 9 system tests.  Having a single "base"
implementation of such a custom DNS server reduces code duplication,
improving test maintainability.

Co-authored-by: Tom Krizek <tkrizek@isc.org>
2024-03-20 09:22:36 +01:00
Mark Andrews d3172cb47c Merge branch '4645-cid-488064-passing-null-pointer-version-to-maybe_update_recordsandsize-which-dereferences-it' into 'main'
Resolve "CID 488064: Passing null pointer "version" to "maybe_update_recordsandsize", which dereferences it"

Closes #4645 and #4646

See merge request isc-projects/bind9!8880
2024-03-19 22:41:35 +00:00
Mark Andrews 4d2d80f534 Remove remenants of cache support from qpzone.c
These where leading to Coverity errors being reported.
2024-03-19 22:04:10 +00:00
Michal Nowak e790b0cba1 Merge branch 'mnowak/pytest_rewrite_glue' into 'main'
Rewrite glue system test to pytest

See merge request isc-projects/bind9!8846
2024-03-19 19:16:53 +00:00
Michal Nowak 69d3efed89 Use bitwise operation to remove RD from default flags 2024-03-19 19:28:55 +01:00
Michal Nowak 9950f6d651 Rewrite glue system test to pytest
Limit dnspython to version 2.0.0+
(https://github.com/rthalley/dnspython/pull/503), otherwise the test
fails with:

    E   AttributeError: module 'dns.edns' has no attribute 'OptionType'
2024-03-19 19:28:55 +01:00
Michal Nowak c252ca2ce5 Merge branch 'mnowak/pytest_rewrite_masterfile' into 'main'
Rewrite masterfile system test to pytest

See merge request isc-projects/bind9!8791
2024-03-19 10:38:07 +00:00
Michal Nowak 7a161f615a Rewrite masterfile system test to pytest 2024-03-19 10:51:02 +01:00
Michal Nowak 686033e48d Add zones_equal() with optional TTL comparison 2024-03-19 10:51:02 +01:00
Michal Nowak 5af3b713af Modify rrsets_equal() to optionally compare TTL 2024-03-19 10:51:01 +01:00
Michal Nowak db272a4968 Merge branch 'mnowak/pytest_rewrite_limits' into 'main'
Rewrite limits system test to pytest

See merge request isc-projects/bind9!8798
2024-03-18 15:32:47 +00:00
Michal Nowak f90a772298 Rewrite limits system test to pytest
Also, tweak the IP ranges of A RRsets so they are more easily processed
by for loops.
2024-03-18 15:59:46 +01:00
Michal Nowak 67087b6c43 Merge branch 'mnowak/freebsd-13.3' into 'main'
Add FreeBSD 13.3

See merge request isc-projects/bind9!8826
2024-03-18 14:59:33 +00:00
Michal Nowak 9019985d2d Add FreeBSD 13.3 2024-03-18 15:36:54 +01:00
Mark Andrews 0906848ae9 Merge branch '4641-dig-ednsflags-does-not-re-enable-edns' into 'main'
Resolve "dig +ednsflags does not re-enable EDNS"

Closes #4641

See merge request isc-projects/bind9!8874
2024-03-17 03:06:22 +00:00
Mark Andrews b41d1820d2 Add CHANGES for [GL #4641 2024-03-16 16:26:47 +11:00
Mark Andrews 8babbd09a1 Test +noedns +ednsflags=non-zero-value 2024-03-16 16:26:17 +11:00
Mark Andrews d74bba4fae Re-enable EDNS if an EDNS flag gets set to 1 by +ednsflags
This is consistent with +dnssec and +nsid which only re-enable
EDNS if do is set to 1 or nsid is requested.
2024-03-16 16:07:55 +11:00
Michal Nowak cbc121ce9a Merge branch 'mnowak/move-stress-tests-to-freebsd-13' into 'main'
FreeBSD "stress" tests now run on FreeBSD 13.2

See merge request isc-projects/bind9!8689
2024-03-15 11:12:11 +00:00
Michal Nowak 176bf877e1 FreeBSD "stress" tests now run on FreeBSD 13.2 2024-03-15 12:11:08 +01:00
Michal Nowak f7f7b09d98 Merge branch 'mnowak/pytest_rewrite_rrchecker' into 'main'
Rewrite rrchecker system test to pytest

See merge request isc-projects/bind9!8832
2024-03-15 09:05:20 +00:00
Michal Nowak 6a301c1d35 Rewrite rrchecker system test to pytest 2024-03-15 09:40:01 +01:00
Mark Andrews 4be1db6e82 Merge branch '4639-add-openssl-flags-to-proxystream_test' into 'main'
Resolve "Add OpenSSL Flags to proxystream_test"

Closes #4639

See merge request isc-projects/bind9!8869
2024-03-14 23:42:25 +00:00
Mark Andrews 52b053537d Add OpenSSL libraries and flags to proxystream_test 2024-03-15 10:08:57 +11:00
Evan Hunt 120b4a9ef9 Merge branch '4614-qpdb-excess-memory' into 'main'
reduce memory consumption of QP zone and cache databases

Closes #4614

See merge request isc-projects/bind9!8849
2024-03-14 18:06:54 +00:00
Evan Hunt 1f67a3f474 CHANGES for [GL #4614] 2024-03-14 10:25:12 -07:00
Evan Hunt 17186e06bb reduce memory consumption of the remaining QP databases
use dynamically allocated names instead of fixednames in
forward.c, keytable.c, nametree.c, and nta.c
2024-03-14 10:25:07 -07:00
Evan Hunt c0fcc2899e reduce memory consumption of rpz summary database
use dynamically allocated names instead of fixednames in rpz.c
2024-03-14 10:20:52 -07:00
Evan Hunt 8b67476249 reduce memory consumption of qpcache database
as with qpzone, use a dynamically-allocated dns_name instead
of a dns_fixedname object to store node names in the QP database.
2024-03-14 10:20:52 -07:00
Evan Hunt f908d358c4 reduce memory consumption of qpzone database
every node of a QP database contains a copy of the nodename,
which is used as the key for the QP-trie. previously, the name
was stored as a dns_fixedname object, which has room for up to
255 characters. we can reduce the space consumed by dynamically
allocating a dns_name object that's just long enough for the name
to be stored.
2024-03-14 10:20:52 -07:00
Matthijs Mekking 78aa2fb64c Merge branch '4629-cid-487882-error-handling-issues' into 'main'
Resolve "CID 487882: Error handling issues in lib/dns/qpzone.c"

Closes #4629

See merge request isc-projects/bind9!8852
2024-03-14 14:12:57 +00:00
Matthijs Mekking ad33a73f83 Fix Coverity CID 487882: Error handling issues
The dns_qpiter_next() was called without checking the return value. If
we cannot move the iterator forward, there is no use in calling the
step() function.

/lib/dns/qpzone.c: 2804 in activeempty()
2798     	 * of the name we were searching for. Step the iterator
2799     	 * forward, then step() will continue forward until it
2800     	 * finds a node with active data. If that node is a
2801     	 * subdomain of the one we were looking for, then we're
2802     	 * at an active empty nonterminal node.
2803     	 */
>>>     CID 487882:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "dns_qpiter_next" without checking return value (as is done elsewhere 26 out of 27 times).
2804     	dns_qpiter_next(it, NULL, NULL, NULL);
2805     	return (step(search, it, FORWARD, next) &&
2806     		dns_name_issubdomain(next, current));
2807     }
2024-03-14 14:01:23 +01:00
Matthijs Mekking 8d3f601a6b Merge branch 'matthijs-add-rfc-9460-to-arm' into 'main'
Add RFC 9460 to list of supported RFCs

See merge request isc-projects/bind9!8847
2024-03-14 12:53:23 +00:00
Matthijs Mekking 5b5f43babc Add RFC 9460 to list of supported RFCs
The specification was implemented (#1132) when it was a draft. Now that
it is RFC, add the RFC to the list of supported RFCs.
2024-03-14 12:52:42 +00:00
Matthijs Mekking 4d560d5ffd Merge branch '4631-cid-487884-dead-code-in-qpcache' into 'main'
Resolve "CID 487884: Dead code in qpcache.c"

Closes #4631

See merge request isc-projects/bind9!8853
2024-03-14 11:50:17 +00:00
Matthijs Mekking 659fa0cbc3 Fix Coverity CID 487884: Dead code in qpcache.c
Adding a changed record is zonedb related and does not belong in
the cache code. This is a leftover dead code and can be safely
removed.

/lib/dns/qpcache.c: 3459 in add()
3453     			}
3454     			newheader->next = topheader->next;
3455     			newheader->down = topheader;
3456     			topheader->next = newheader;
3457     			qpnode->dirty = 1;
3458     			if (changed != NULL) {
>>>     CID 487884:    (DEADCODE)
>>>     Execution cannot reach this statement: "changed->dirty = true;".
3459     				changed->dirty = true;
3460     			}
3461     		} else {
3462     			/*
3463     			 * No rdatasets of the given type exist at the node.
3464     			 */
/lib/dns/qpcache.c: 3409 in add()
3403     			}
3404     			newheader->next = topheader->next;
3405     			newheader->down = topheader;
3406     			topheader->next = newheader;
3407     			qpnode->dirty = 1;
3408     			if (changed != NULL) {
>>>     CID 487884:    (DEADCODE)
>>>     Execution cannot reach this statement: "changed->dirty = true;".
3409     				changed->dirty = true;
3410     			}
3411     			mark_ancient(header);
3412     			if (sigheader != NULL) {
3413     				mark_ancient(sigheader);
3414
2024-03-14 10:42:30 +00:00
Matthijs Mekking 1102c5d552 Merge branch '4624-duration-error-checking' into 'main'
Detect invalid durations

Closes #4624

See merge request isc-projects/bind9!8844
2024-03-14 10:08:43 +00:00
Matthijs Mekking bc600ae2a1 Add CHANGES and release note for #4624 2024-03-14 09:07:44 +01:00
Matthijs Mekking e39de45adc Detect invalid durations
Be stricter in durations that are accepted. Basically we accept ISO 8601
formats, but fail to detect garbage after the integers in such strings.

For example, 'P7.5D' will be treated as 7 days. Pass 'endptr' to
'strtoll' and check if the endptr is at the correct suffix.
2024-03-14 08:51:46 +01:00
Mark Andrews fd49abf254 Merge branch '4608-ensure-static-stub-ns-records-are-not-returned' into 'main'
Resolve "Ensure static stub NS records are not returned"

Closes #4608

See merge request isc-projects/bind9!8790
2024-03-14 04:16:39 +00:00
Mark Andrews 6a91862ac5 Add CHANGES note for [GL #4608] 2024-03-14 11:40:10 +11:00
Mark Andrews 229bf863e2 Check static-stub synthesised NS is not returned 2024-03-14 11:39:27 +11:00
Mark Andrews 40816e4e35 Don't use static stub when returning best NS
If we find a static stub zone in query_addbestns look for a parent
zone which isn't a static stub.
2024-03-14 11:39:27 +11:00
Evan Hunt 5a17764a77 Merge branch '4630-deadcode-fix' into 'main'
Resolve "CID 487883: Null pointer dereference in lib/dns/qpzone.c"

Closes #4630

See merge request isc-projects/bind9!8854
2024-03-14 00:15:38 +00:00
Evan Hunt b3c8b5cfb2 remove dead code in rbtdb.c
dns_db_addrdataset() enforces a requirement that version can only
be NULL for a cache database. code that checks for zone semantics
and version == NULL can never be reached.
2024-03-13 17:15:18 -07:00
Evan Hunt 29f1c93734 support nodefullname in rbt-zonedb.c
this enables the 'dyndb' system test to pass when we
build using --with-zonedb=rbt.
2024-03-13 17:15:18 -07:00
Evan Hunt f0b164430a remove dead code in qpzone.c
qpzone does not support cache semantics, so dns_db_addrdataset(),
_deleterdataset() and _subtractrdataset() can't be run with
version == NULL; there's no need to check for it.

we can also clean up free_qpdb() a bit since current_version
is always non-NULL.
2024-03-13 17:15:18 -07:00
Mark Andrews 41eed193b2 Merge branch '4633-undefined-behaviour-in-rdataslab-c' into 'main'
Resolve "Undefined behaviour in rdataslab.c"

Closes #4633

See merge request isc-projects/bind9!8855
2024-03-13 23:40:17 +00:00
Mark Andrews 228cc557fe Only call memmove if the rdata length is non zero
This avoids undefined behaviour on zero length rdata where the
data pointer is NULL.
2024-03-13 23:04:56 +00:00
Matthijs Mekking 377bd35574 Merge branch '4552-keymgr-depends-function-bug' into 'main'
Fix bug in keymgr Depends function

Closes #4552

See merge request isc-projects/bind9!8682
2024-03-13 10:46:25 +00:00
Matthijs Mekking 32e43764dd Add CHANGES for #4552 2024-03-13 10:58:45 +01:00
Matthijs Mekking 0aac81cf80 Fix bug in keymgr Depends function
The Depends relation refers to types of rollovers in which a certain
record type is going to be swapped. Specifically, the Depends relation
says there should be no dependency on the predecessor key (the set
Dep(x, T) must be empty).

But if the key is phased out (all its states are in HIDDEN), there is
no longer a dependency. Since the relationship is still maintained
(Predecessor and Successor metadata), the keymgr_dep function still
returned true. In other words, the set Dep(x, T) is not considered
empty.

This slows down key rollovers, only retiring keys when the successor
key has been fully propagated.
2024-03-13 10:58:24 +01:00
Michał Kępień 03c040da53 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.23' into 'main'
Set up version and release notes for BIND 9.19.23

See merge request isc-projects/bind9!8856
2024-03-13 08:59:24 +00:00
Michał Kępień 33bdbfe2f5 Set up release notes for BIND 9.19.23 2024-03-13 09:51:24 +01:00
Michał Kępień df0229e7ee Update BIND version to 9.19.23-dev 2024-03-13 09:51:24 +01:00
Michał Kępień d01a4e5fc6 Update BIND version for release 2024-03-12 09:33:06 +01:00
Michał Kępień 0ba0025566 Add a CHANGES marker 2024-03-12 09:33:06 +01:00
Michał Kępień 2896a2a15e Merge branch 'pspacek/prepare-documentation-for-bind-9.19.22' into 'v9.19.22-release'
Prepare documentation for BIND 9.19.22

See merge request isc-private/bind9!671
2024-03-12 08:31:48 +00:00
Petr ŠpačekandMichał Kępień 59dd8c7de5 Tweak and reword release notes 2024-03-12 09:19:53 +01:00
Petr ŠpačekandMichał Kępień 2fac89f039 Add release note for GL #4591 2024-03-12 09:19:53 +01:00
Petr ŠpačekandMichał Kępień 1b039fdfc5 Reorder release notes 2024-03-12 09:19:53 +01:00
Petr ŠpačekandMichał Kępień cd117a932f Add release note for GL #4413 2024-03-12 09:19:53 +01:00
Petr ŠpačekandMichał Kępień 353ebedb94 Prepare release notes for BIND 9.19.22 2024-03-12 09:19:53 +01:00
Matthijs Mekking 8a8fad0cb5 Merge branch '4625-broken-trust-chain-on-corner-case-secure-chain-fixup-keytrap' into 'main'
Fix validate_dnskey_dsset when KSK is not signing

Closes #4625

See merge request isc-projects/bind9!8848
2024-03-12 08:12:07 +00:00
Matthijs Mekking c357ef900c Add CHANGES for #4625 2024-03-12 09:10:58 +01:00
Matthijs Mekking fb2f0c8168 Fix validate_dnskey_dsset when KSK is not signing
When there is a secure chain of trust with a KSK that is not actively
signing the DNSKEY RRset, the code for validating the DNSKEY RRset
against the DS RRset could potentially skip DS records, thinking the
chain of trust is broken while there is a valid DS with corresponding
DNSKEY record present.

This is because we pass the result ISC_R_NOMORE on when we are done
checking for signatures, but then treat it as "no more DS records".

Chaning the return value to something else (DNS_R_NOVALIDSIG seems the
most appropriate here) fixes the issue.
2024-03-12 09:10:41 +01:00
Matthijs Mekking f0bfd276e0 Test secure chain that includes inactive KSK
Add a regression test case for the scenario where a secure chain of
trust includes an inactive KSK, that is a KSK that is not signing the
DNSKEY RRset.
2024-03-12 09:10:41 +01:00
Evan Hunt 28536786de Merge branch 'each-qpdb-heavy' into 'main'
create dns_qpmulti-based zone database

See merge request isc-projects/bind9!8543
2024-03-11 16:45:19 +00:00
Evan Hunt 37634f2990 CHANGES for [GL #4348] 2024-03-08 15:36:56 -08:00
Evan Hunt 5709f7bad9 rename qpdb to qpcache
move qpdb.c to qpcache.c and rename the "qp" database implementation
to "qpcache", in order to make it more clearly distinguishable from
"qpzone".
2024-03-08 15:36:56 -08:00
Evan Hunt e14a116ced collapse qpdb implementation down to one file
the code in qpdb.c was previously shared by qp-cachedb.c and
qp-zonedb.c.  since qp-zonedb.c no longer exists, it's not necessary
to keep these separate any longer. the two files have been merged,
and functions that were previously globally accessible have been
changed to static and renamed.
2024-03-08 15:36:56 -08:00
Evan Hunt ab084d8c4f remove qp-zonedb.c and associated code
now that "qpzone" databases are available for use in zones, we no
longer need to retain the zone semantics in the "qp" database.

all zone-specific code has been removed from QPDB, and "configure
--with-zonedb" once again takes two values, rbt and qp.

some database API methods that are never used with a cache have
been removed from qpdb.c and qp-cachedb.c; these include newversion,
closeversion, subtractrdataset, and nodefullname.
2024-03-08 15:36:56 -08:00
Evan Hunt ac2c454f4f add a nodefullname implementation for the qpzone database
this enables the 'dyndb' system test to use a qpzone database.
2024-03-08 15:36:56 -08:00
Evan Hunt 3512cf5654 add setup/commit functions to rdatacallbacks
because dns_qpmulti_commit() can be time consuming, it's inefficient
to open and commit a qpmulti transaction for each rdataset being loaded
into a database.  we can improve load time by opening a qpmulti
transaction before adding a group of rdatasets and then committing it
afterward.

this commit adds 'setup' and 'commit' functions to dns_rdatacallbacks_t,
which can be called before and after the loops in which 'add' is
called in dns_master_load() and axfr_apply().
2024-03-08 15:36:56 -08:00
Evan Hunt 2e45866715 use DNS_DB_NONSEC3 flag when copying non-dnssec records
when copying the non-dnssec records in receive_secure_db(),
use DNS_DB_NONSEC3 so we don't accidentally create nodes in
the main tree for NSEC3 records. this was a long-standing error
in the code, but was harmless in the RBTDB.
2024-03-08 15:36:56 -08:00
Evan Hunt 55f38e34dc improve node reference counting
QP database node data is not reference counted the same way RBT nodes
were: in the RBT, node->references could be zero if the node was in the
tree but was not in use by any caller, whereas in the QP trie, the
database itself uses reference counting of nodes internally.

this caused some subtle errors. in RBTDB, when the newref() function is
called and the node reference count was zero, the node lock reference
counter would also be incremented. in the QP trie, this can never
happen - because as long as the node is in the database its reference
count cannot be zero - and so the node lock reference counter was never
incremented.

this has been addressed by maintaining a separate "erefs" counter for
external references to the node. this is the same approach used in the
"qpdb-lite" database in commit e91fbd8dea.

while troubleshooting this issue, some compile errors were discovered
when building with DNS_DB_NODETRACE; those have also been fixed.
2024-03-08 15:36:56 -08:00
Evan Hunt 2b4133a32c switch default zone database from "qp" to "qpzone"
use the dns_qpmulti-based "qpzone" by default throughout BIND,
instead of the existing dns_qp-based "qp", when creating zone
databases. (cache databases still use "qp".)

the "--with-zonedb" option has been updated in configure.ac to permit
the use of both "qp" and "qpzone" databases.

in zone.c there was a test that prevented any database type other than
"qp" from hosting an RPZ. this was outdated, and has been removed.
2024-03-08 15:36:56 -08:00
Evan Hunt 2222728a4f release RCU in dns_qpmulti_snapshot()
previously, an RCU critical section was held open for the duration
of a snapshot. this should not be necessary, as the snapshot makes
local copies of QP trie metadata, and it causes problems when a
DB iterator is held open between two loop events.  we now call
rcu_read_unlock() after setting up the snapshot.
2024-03-08 15:36:56 -08:00
Evan Hunt ab13ba2438 add qpzone_test unit test
copy the non-cache-specific tests from the old rbtdb_test.c to
qpzone_test.c.
2024-03-08 15:36:56 -08:00
Evan Hunt 6e167724e7 complete the qpzone database API implementation
finish importing the database API methods from RBTDB to qpzone:
issecure, nodecount, getnsec3parameters, findnsec3node, setsigningtime,
getsigningtime, getsize, setgluecachestats, locknode, unlocknode, and
addglue.
2024-03-08 15:36:56 -08:00
Evan Hunt f46455cfcb allow updating of records in a qpzone database
add database API methods needed to apply updates to an existing zone
database (newversion, addrdataset, subtractrdataset and deleterdataset).

it is now possible to apply journals to zone databases after loading, so
named-checkzone -J works correctly.
2024-03-08 15:36:56 -08:00
Evan Hunt 60b5422cda make the qpzone database dumpable
add database API method implementations needed to iterate and dump
a qpzone database to a file (createiterator, allrdatasets and
attachversion, plus dbiterator and rdatasetiter methods).

named-checkzone -D can now dump the contents of most zones,
but zone cuts are not correctly detected.
2024-03-08 15:36:56 -08:00
Evan Hunt 628fa8a3d6 make the qpzone database loadable
add database API methods needed for loading rdatasets into memory
(currentversion, beginload, endload), plus the methods used by
zone_postload() for zone consistency checks (getoriginnode, find,
findnode, findrdataset, attachnode, detachnode, deletedata).

the QP trie doesn't support the find callback mechanism available
in dns_rbt_findnode() which allows examination of intermediate nodes
while searching, so the detection of wildcard and delegation nodes
is now done by scanning QP chains after calling dns_qp_lookup().

Note that the lookup in previous_closest_nsec() cannot return
ISC_R_NOTFOUND. In RBTDB, we checked for this return value and
ovewrote the result with ISC_R_NOMORE if it occurred. In the
qpzone implementation, we insist that this return value cannot happen.
dns_qp_lookup() would only return ISC_R_NOTFOUND if we asked for a
name outside the zone's authoritative domain, and we never do that
when looking up a predecessor NSEC record.

named-checkzone is now able to load a zone and check it for errors,
but cannot dump it.
2024-03-08 15:36:49 -08:00
Evan Hunt d8292991fe use "qpzone" by default in named-checkzone
this is for testing of database loading/dumping features.
it doesn't work yet.
2024-03-06 20:57:31 -08:00
Evan Hunt be24feb252 stub dns_qpmulti-based zone database implementation
created files for a dns_qpmulti-based zone database, "qpzone".
currently this only has create and destroy functions.
2024-03-06 20:57:31 -08:00
Mark Andrews 9855116fb0 Merge branch '4623-dns_db_setloop-at-wrong-place-in-cache_create_db' into 'main'
Resolve "dns_db_setloop at wrong place in cache_create_db"

Closes #4623

See merge request isc-projects/bind9!8838
2024-03-07 02:50:22 +00:00
Mark Andrews 926d2e4cf2 dns_db_setloop called at wrong place on wrong db
In cache_create_db, dns_db_setloop should be called on the newly
created db only if the database creation succeeded.
2024-03-07 13:10:23 +11:00
Ondřej Surý cc12a60a6c Merge branch '4621-fix-cache-pruning-after-rndc-flush' into 'main'
Move the dns_db_setloop into cache_create_db()

Closes #4621

See merge request isc-projects/bind9!8834
2024-03-06 18:17:25 +00:00
Ondřej Surý b48dfae41a Add CHANGES and release note for [GL #4621] 2024-03-06 18:33:44 +01:00
Ondřej Surý d492d676ef Move the dns_db_setloop into cache_create_db()
The dns_cache_flush() drops the old database and creates a new one, but
it forgets to pass the loop that runs the node pruning and cleaning
the rbtdb when flushing it next time.  This causes the cleaning to skip
cleaning the parent nodes (with .down == NULL) leading to increased
memory usage over time until the database is unable to keep up and just
stays overmem all the time.
2024-03-06 18:33:33 +01:00
Ondřej Surý 58b5ef6f2a Merge branch '4621-placeholder' into 'main'
Add placeholder CHANGES note for [GL #4621]

See merge request isc-projects/bind9!8828
2024-03-06 17:33:08 +00:00
Ondřej Surý eeb4b7ae8f Add placeholder CHANGES note for [GL #4621] 2024-03-06 17:32:49 +00:00
Ondřej Surý f93e1fed67 Merge branch 'ondrej/fix-load_names-rbt-name' into 'main'
Revert the s/rbt/qp/ change in load_names, it is still rbt

See merge request isc-projects/bind9!8833
2024-03-06 16:55:25 +00:00
Ondřej Surý b0c9ca7a24 Revert the s/rbt/qp/ change in load_names, it is still rbt 2024-03-06 17:54:05 +01:00
Ondřej Surý 88a5befa25 Merge branch 'ondrej/restore-prune_tree-behaviour' into 'main'
Restore the parent cleaning logic in prune_tree()

See merge request isc-projects/bind9!8823
2024-03-06 12:04:39 +00:00
Ondřej Surý 454c75a33a Restore the parent cleaning logic in prune_tree()
Reconstruct the variant of the prune_tree() parent cleaning to consider
all elibible parents in a single loop as we were doing before all the
changes that led to this commit.

Update code comments so that they more precisely describe what the
relevant bits of code actually do.
2024-03-06 13:03:17 +01:00
Matthijs Mekking 371d7f3716 Merge branch '4411-qpdb-lite' into 'main'
Replace rbt with qp

Closes #4411

See merge request isc-projects/bind9!8726
2024-03-06 10:19:36 +00:00
Evan HuntandMatthijs Mekking 92b305be4b add a compile-time option to select default zone and cache DB
by default, QPDB is the database used by named and all tools and
unit tests. the old default of RBTDB can now be restored by using
"configure --with-zonedb=rbt --with-cachedb=rbt".

some tests have been fixed so they will work correctly with either
database.

CHANGES and release notes have been updated to reflect this change.
2024-03-06 10:49:02 +01:00
Matthijs Mekking 618c963cb7 Fix xferquota system test
The change from RBT to QP has changed the contents of generated zone
files slightly: node names are now always absolute, so instead of using
$ORIGIN and relative names, generated zone files use full names for all
records.

This caused a failure in the xferquota system test, which was looking
for a relative name in secondary zone files. Replace the string
matching with a regular expression to fix the test.
2024-03-06 10:49:02 +01:00
Matthijs Mekking 3facc5b51d Fix race condition crash
When running resolver benchmark pipeline, a crash occurred:

https://gitlab.isc.org/isc-projects/bind9-shotgun-ci/-/pipelines/163946

In the code we are doing a lookup, it fails (meaning there is no node
with lookup name), we create the node and insert it and it fails.
But dns_qp_insert can only return ISC_R_SUCCESS or ISC_R_EXISTS.
So it must have been inserted in between. This is a race condition bug.

The first lookup only requires a write lock and if the lookup failed
the lock gets upgraded to a write lock and we insert the missing data.

To fix the race condition bug, we need to do a lookup again after we
have upgraded the lock to make sure it wasn't inserted in the mean
time.
2024-03-06 10:49:02 +01:00
Matthijs Mekking 7db974b240 Remove pruning tree code
Since qp-tries does not store interior nodes, we can remove all code
related to pruning the tree.
2024-03-06 10:49:02 +01:00
Matthijs Mekking 78fd4e2b5c Update qpdb.c to make coccinelle happy
Applying semantic patch cocci/isc_mem_cget.spatch...
150 files match
diff -u -p a/lib/dns/qpdb.c b/lib/dns/qpdb.c
--- a/lib/dns/qpdb.c
+++ b/lib/dns/qpdb.c
@@ -3801,16 +3801,15 @@ dns__qpdb_create(isc_mem_t *mctx, const
		goto cleanup_tree_lock;
	}
	INSIST(qpdb->node_lock_count < (1 << DNS_RBT_LOCKLENGTH));
-	qpdb->node_locks = isc_mem_get(mctx, qpdb->node_lock_count *
-						      sizeof(db_nodelock_t));
+	qpdb->node_locks = isc_mem_cget(mctx, qpdb->node_lock_count,
+					 sizeof(db_nodelock_t));

	qpdb->common.update_listeners = cds_lfht_new(16, 16, 0, 0, NULL);

	if (IS_CACHE(qpdb)) {
		dns_rdatasetstats_create(mctx, &qpdb->rrsetstats);
-		qpdb->lru = isc_mem_get(mctx,
-					 qpdb->node_lock_count *
-						 sizeof(dns_slabheaderlist_t));
+		qpdb->lru = isc_mem_cget(mctx, qpdb->node_lock_count,
+					  sizeof(dns_slabheaderlist_t));
		for (i = 0; i < (int)qpdb->node_lock_count; i++) {
			ISC_LIST_INIT(qpdb->lru[i]);
		}
@@ -3819,8 +3818,8 @@ dns__qpdb_create(isc_mem_t *mctx, const
	/*
	 * Create the heaps.
	 */
-	qpdb->heaps = isc_mem_get(hmctx, qpdb->node_lock_count *
-						  sizeof(isc_heap_t *));
+	qpdb->heaps = isc_mem_cget(hmctx, qpdb->node_lock_count,
+				    sizeof(isc_heap_t *));
	for (i = 0; i < (int)qpdb->node_lock_count; i++) {
		qpdb->heaps[i] = NULL;
	}
@@ -3834,8 +3833,8 @@ dns__qpdb_create(isc_mem_t *mctx, const
	/*
	 * Create deadnode lists.
	 */
-	qpdb->deadnodes = isc_mem_get(mctx, qpdb->node_lock_count *
-						     sizeof(dns_qpdatalist_t));
+	qpdb->deadnodes = isc_mem_cget(mctx, qpdb->node_lock_count,
+					sizeof(dns_qpdatalist_t));
	for (i = 0; i < (int)qpdb->node_lock_count; i++) {
		ISC_LIST_INIT(qpdb->deadnodes[i]);
	}
2024-03-06 10:49:02 +01:00
Matthijs Mekking a49a211852 Add CHANGES and release notes for #4411
It is worthwile mentioning the switch to qp-tries.
2024-03-06 10:49:02 +01:00
Evan HuntandMatthijs Mekking 89c4c1aa87 add dns_db_nodefullname()
the dyndb test requires a mechanism to retrieve the name associated
with a database node, and since the database no longer uses RBT for
its underlying storage, dns_rbt_fullnamefromnode() doesn't work.
addressed this by adding dns_db_nodefullname() to the database API.
2024-03-06 10:49:02 +01:00
Matthijs Mekking cdf62a18e7 Rework dbiterator implementation
If the iterator is paused, the tree is unlocked and may change.

In an RBT tree it's always possible to resume iteration as long
as a valid node pointer was still held, but now that the underlying
database structure is a QP trie, the iterator needs to be initialized
based on the existing structure of the trie or it will return
inconsistent results. We now call dns_qp_lookup() to reinitialize
the QP iterator whenever dbiterator_next() or dbiterator_prev() is
called on a paused iterator.
2024-03-06 10:49:02 +01:00
Evan HuntandMatthijs Mekking 6df391d610 use masterfile-style full in tests where appropriate
the change from RBT to QP has changed the contents of generated zone
files slightly: node names are now always absolute, so instead of using
$ORIGIN and relative names, generated zone files use full names for all
records.

this caused a failure in the stub system test, which was grepping for a
relative name in a dumped zone file. using "masterfile-style full" makes
the test pass regardless of the database being used.
2024-03-06 10:49:02 +01:00
Matthijs Mekking e91fbd8dea Improve node reference counting
QP database node data is not reference counted the same way RBT nodes
were: in the RBT, node->references could be zero if the node was in the
tree but was not in use by any caller, whereas in the QP trie, the
database itself uses reference counting of nodes internally.

this caused some subtle errors. in RBTDB, when the newref() function is
called and the node reference count was zero, the node lock reference
counter would also be incremented. in the QP trie, this can never
happen - because as long as the node is in the database its reference
count cannot be zero - and so the node lock reference counter was never
incremented.

reference counting will probably need to be refactored in more detail
later; the node lock reference count may not be needed at all.  but
for now, as a temporary measure, we add a third reference counter,
'erefs' (external references), to the dns_qpdata structure. this is
counted separately from the main reference counter, and should match
the node reference count as it would have been in RBTDB.

this change revealed a number of places where the node reference counter
was being incremented on behalf of a caller without newref() being
called; those were cleaned up as well.

This is an adaptation of commit 3dd686261d2c4bcd15a96ebfea10baffa277732b
2024-03-06 10:49:02 +01:00
Evan HuntandMatthijs Mekking 815f54ec27 revise test for ENT NSEC3 cleanup
as a side effect of the switch from RBT to QBDB, NSEC3 records
are no longer created for empty non-terminal nodes when the
node only contains insecure delegations in an opt-out range.

such NSEC3 records are optional according to RFC 5155 (and,
for example, they are not created by dnssec-signzone), but they were
previously created by named, as a harmless side effect of the RBT
structure, which contains empty internal nodes that can be reached
by a DB iterator. these nodes are not present in the QPDB, so
NSEC3 records are not created unless they're actually required.

the autosign system test contained a test case (added in commit
ad91a70d as part of GL #4027) that checked whether ENT NSEC3
records were deleted when the delegations under the ENT removed.
this test no longer passes, because the NSEC3's are not created
in the first place, and therefore cannot be removed.

rather than "fix" the QPDB to add unnecessary NSEC3 records, this
commit instead revises the test to check for removal of ENT NSEC3
records when *not* using opt-out.
2024-03-06 10:49:02 +01:00
Matthijs Mekking 91a2755433 No special logic for relative names
Nodes in a QP-trie contain the full domain name, while nodes in a
red-black tree only contain names relative to a parent.
2024-03-06 10:49:02 +01:00
Matthijs Mekking 1a068c9656 Change free_gluetable
Fixes a crash at shutdown.
2024-03-06 09:57:25 +01:00
Matthijs Mekking 10efb6fdc2 Calculating hashsize is obsolete
We don't have hash tables for qp.
2024-03-06 09:57:25 +01:00
Matthijs Mekking 820abdb80a Add proper qp cleanup
Fix reference counting: unreference nodes that are succesfully inserted
in the tree, detach created nodes, and cleanup the interior data in
dns_qpdata_destroy().
2024-03-06 09:57:25 +01:00
Matthijs Mekking fe97aa59b9 Replace dns_rbtnode_t with dns_qpdata_t
This for now has almost the same structure contents except for
dns_qpdata_t has 'fn' and 'name' to store the domain name.
2024-03-06 09:57:25 +01:00
Matthijs Mekking cc3a40dafa Replace dns_rbt_nodecount with dns_qp_memusage
We now count the nodes by getting the memory usage and return the
number of leaves.
2024-03-06 09:57:25 +01:00
Matthijs Mekking e95dfc0119 Replace dns_rbt_namefromnode with dns_name_copy
The name will be stored inside the node now so we can just copy it.

These are leftovers, most of the namefromnode code has been replaced
already in previous commits.
2024-03-06 09:57:24 +01:00
Matthijs Mekking 6a5de6390f Replace rbtnodechain with qpchain and qpiter
The qp approach pulled apart the chain and iterator into two separate
things. Replace the rbtnodechain with qpchain and qpiter. Most of the
times we are interested in the iterator only, the rbtnodechain was
mainly used as an an iterator to get the previous and next name in the
DNS canonical order.

Since dns_qpiter_prev() and dns_qpiter_next() store the name, origin,
and node in the provided parameters, often there is no need to call
a current() function anymore.

Getting the first or last item from the iterator is done by
re-initializing the iterator and then call dns_qpiter_next() or
dns_qpiter_prev() respectively.

The dbiterator no longer needs to maintain a chain, only an iterator.
2024-03-06 09:57:24 +01:00
Matthijs Mekking 8572435a31 Replace rbt_findnode with qp_lookup
All dns_qp_lookup() calls assume it is okay to find empty data, so
we don't need to do anything special for the DNS_RBTFIND_EMPTYDATA.

You can pass a callback function to dns_rbt_findnode(), something that
qp does not support. Instead, call the function afterwards. This has
the drawback that we do more lookup work if there was a zonecut.

With dns_qp_lookup() we also don't pass any options. In this case,
when DNS_RBTFIND_NOEXACT was set, we adapt the result after the lookup.
2024-03-06 09:57:24 +01:00
Matthijs Mekking 8fcfa36660 Replace rbt_deletenode with qp_deletename
Replace dns_rbt_deletenode calls with dns_qp_deletename. For removing
the name from the nsec tree, we no longer first have to find it: we can
just remove the key (retrieved by name).
2024-03-06 09:57:24 +01:00
Matthijs Mekking c53b95e134 Replace rbt_addnode with qp_insert
Replace dns_rbt_addnode calls with dns_qp_insert. With QP, it sometimes
makes more sense to first lookup the name and see if there is an
existing node (rather than create new data, insert, find out a node
already exists, and destroy the data again). This is done with
dns_qp_getname(), which is more lightweight than dns_qp_lookup(),
and we are only interested in if there is already a leaf node for this
name or not.
2024-03-06 09:57:24 +01:00
Evan HuntandMatthijs Mekking bb4464181a switch database defaults from "rbt" to "qp"
replace the string "rbt" throughout BIND with "qp" so that
qpdb databases will be used by default instead of rbtdb.
rbtdb databases can still be used by specifying "database rbt;"
in a zone statement.
2024-03-06 09:57:24 +01:00
Evan HuntandMatthijs Mekking 845f832308 rename dns_rbtdb to dns_qpdb
this commit renames all variables and macros with the string "rbtdb"
or "RBDTB" to "qpdb" or "QPDB".
2024-03-06 09:57:24 +01:00
Matthijs Mekking 2edf73dc05 Begin replacement of rbt with qp in rbtdb
- Copy rbtdb.c, rbt-zonedb.c and rbt-cachedb.c to qp-*.
- Added qpmethods.
- Added a new structure dns_qpdata that will replace dns_rbtnode.
- Replaced normal, nsec, and nsec3 dns_rbt trees with dns_qp tries.
- Replaced dns_rbt_create() calls with dns_qp_create().
- Replaced the dns_rbt_destroy() call with dns_qp_destroy().
- Create a dns_qpdata struct and create/destroy methods.

This commit will not build.
2024-03-06 09:57:24 +01:00
Mark Andrews 522b6eced0 Merge branch '4612-resolver-crashes-on-10-0-0-38-abcdefghijklmnopqrstuvwxyz012345-plex-direct-ds-query' into 'main'
Resolve "resolver crashes on 10-0-0-38.abcdefghijklmnopqrstuvwxyz012345.plex.direct DS query"

Closes #4612

See merge request isc-projects/bind9!8794
2024-03-06 00:16:13 +00:00
Mark Andrews f4f7f23d9d Add CHANGES note for [GL #4612] 2024-03-06 10:09:05 +11:00
Mark Andrews 3fedbb1a66 test: DS query against broken NODATA responses
This is a regresssion test for GL #4621 where the NODATA responses
are SOA records that match the QNAME rather than the zone name. In
particular for NS queries.
2024-03-06 10:09:05 +11:00
Mark Andrews 5ff55e13e8 Restore the disassociate call to before the fetch
[GL #3709] reordered the dns_rdataset_disassociate call to after
the dns_resolver_createfetch call resulting in qctx->nsrrset still
being associated when dns_resolver_createfetch is called in
resume_dslookup (7e4e125e).  Revert that part of the change and add
comments as to why the multiple dns_rdataset_disassociate calls are
where they are.
2024-03-06 10:08:30 +11:00
Ondřej Surý 470bfcaa19 Merge branch '4600-call-dispatch-connect-callbacks-asynchronously' into 'main'
Pin the xfr to a specific loop

Closes #4600

See merge request isc-projects/bind9!8821
2024-03-04 15:34:51 +00:00
Ondřej Surý e74c7dcf51 Always call the TCP dispatch connected callbacks asynchronously
The TCP dispatch connected callbacks could be called synchronously which
in turn could destroy xfrin before we return from dns_xfrin_create().

Delay the calling the callback called from tcp_dispatch_connect() by
calling it always asynchronously.
2024-03-04 16:34:14 +01:00
Ondřej Surý 98d59bdf62 Pin the xfr to a specific loop
Instead of getting the loop from the zone every time, attach the xfrin
directly to the loop.  This also allows to remove the extra safety tid
checks from the dns_xfrin unit.
2024-03-04 16:34:14 +01:00
Petr Špaček 42e7f6b003 Merge branch 'pspacek/cve-bug-report-template' into 'main'
Fix typos in Security bug issue template

See merge request isc-projects/bind9!8822
2024-03-04 14:18:13 +00:00
Petr Špaček feab0d638a Fix typos in Security bug issue template 2024-03-04 15:16:10 +01:00
Petr Špaček a6da5e9faa Merge branch 'pspacek/cve-bug-report-template' into 'main'
Security bug issue template improvements

See merge request isc-projects/bind9!8820
2024-03-04 13:13:36 +00:00
Petr Špaček eb93c915d3 Adjust line breaks in CVE report template 2024-03-04 13:13:30 +00:00
Petr Špaček 30d57b93a7 Add questions about multiple implementations into CVE report template 2024-03-04 13:13:30 +00:00
Evan Hunt b62a9fd900 Merge branch 'each-move-rrl-broken-config-test-case-to-checkconf' into 'main'
Move RRL broken-config check to checkconf

See merge request isc-projects/bind9!8795
2024-03-01 23:34:05 +00:00
Evan Hunt 05398c1488 move RRL broken-config check to checkconf
the RRL test included a test case that tried to start named with
a broken configuration.  the same error could be found with
named-checkconf, so it should have been tested in the checkconf
system test.
2024-03-01 14:29:30 -08:00
Ondřej Surý 7111ea3669 Merge branch '4591-improve-ttl-based-cleaning' into 'main'
Remove expired rdataset headers from the heap

Closes #4591

See merge request isc-projects/bind9!8754
2024-02-29 12:33:58 +00:00
Ondřej Surý db69cc7891 Add CHANGES note for [GL #4591] 2024-02-29 12:57:06 +01:00
Ondřej Surý d8220ca4ca Make the TTL-based cleaning more aggressive
It was discovered that the TTL-based cleaning could build up
a significant backlog of the rdataset headers during the periods where
the top of the TTL heap isn't expired yet.  Make the TTL-based cleaning
more aggressive by cleaning more headers from the heap when we are
adding new header into the RBTDB.
2024-02-29 12:57:06 +01:00
Ondřej Surý a9383e4b95 Remove expired rdataset headers from the heap
It was discovered that an expired header could sit on top of the heap
a little longer than desireable.  Remove expired headers (headers with
rdh_ttl set to 0) from the heap completely, so they don't block the next
TTL-based cleaning.
2024-02-29 12:56:36 +01:00
Ondřej Surý 96171e9879 Merge branch '4596-regression-in-cache-cleaning' into 'main'
Reduce lock contention during RBTDB tree pruning

Closes #4596

See merge request isc-projects/bind9!8765
2024-02-29 11:33:05 +00:00
Ondřej Surý f447557667 Add CHANGES and release note for [GL #4596] 2024-02-29 11:23:04 +01:00
Ondřej Surý 0b32d323e0 Simplify the parent cleaning in the prune_tree() mechanism
Instead of juggling with node locks in a cycle, cleanup the node we are
just pruning and send any the parent that's also subject to the pruning
to the prune tree via normal way (e.g. enqueue pruning on the parent).

This simplifies the code and also spreads the pruning load across more
event loop ticks which is better for lock contention as less things run
in a tight loop.
2024-02-29 11:23:03 +01:00
Ondřej Surý eed17611d8 Reduce lock contention during RBTDB tree pruning
The log message for commit 24381cc36d
explained:

    In some older BIND 9 branches, the extra queuing overhead eliminated by
    this change could be remotely exploited to cause excessive memory use.
    Due to architectural shift, this branch is not vulnerable to that issue,
    but applying the fix to the latter is nevertheless deemed prudent for
    consistency and to make the code future-proof.

However, it turned out that having a single queue for the nodes to be
pruned increased lock contention to a level where cleaning up nodes from
the RBTDB took too long, causing the amount of memory used by the cache
to grow indefinitely over time.

This commit reverts the change to the pruning mechanism introduced by
commit 24381cc36d as BIND branches newer
than 9.16 were not affected by the excessive event queueing overhead
issue mentioned in the log message for the above commit.
2024-02-29 11:23:03 +01:00
Artem Boldariev 264a3a92b2 Merge branch '4156-docs-ephemeral-tls-recreation' into 'main'
Improve documentation on ephemeral TLS configuration

Closes #4156

See merge request isc-projects/bind9!8771
2024-02-28 19:40:35 +00:00
Artem Boldariev 1ab0f6d918 Improve documentation on ephemeral TLS configuration
This commit improves the documentation on the ephemeral TLS
configuration and describes in more detail what is happening with TLS
configurations on reconfiguration in general.
2024-02-28 20:30:38 +02:00
Mark Andrews 5b23c964e2 Merge branch '4604-fix-initial-tests-in-masterfile-system-test' into 'main'
Resolve "Fix initial tests in masterfile system test"

Closes #4604

See merge request isc-projects/bind9!8787
2024-02-28 00:16:39 +00:00
Mark Andrews e02b73c7a4 Split the first masterfile test into 3
Additionally read the correct zone for BIND 8 ttl checks
2024-02-27 15:42:06 +11:00
Michal Nowak b2c573843a Merge branch 'mnowak/dialup-watch-log-from-start' into 'main'
Watch logs from start in dialup system test

See merge request isc-projects/bind9!8782
2024-02-26 11:10:22 +00:00
Michal Nowak 283a7ab17d Watch logs from start in dialup system test
When the first parametrized test takes a bit longer than usual, the zone
transfer in ns3 may succeed before the second parametrized test is even
started, and then watch_log_from_here() won't find the "Transfer status:
success" message in the named log. Using watch_log_from_start() instead
makes sure the test is more stable.
2024-02-26 11:22:40 +01:00
Mark Andrews 078d514764 Merge branch '4413-add-resinfo-261-type-to-named' into 'main'
Resolve "Add RESINFO (261) type to named"

Closes #4413

See merge request isc-projects/bind9!8464
2024-02-26 02:16:42 +00:00
Mark Andrews 1bf03a2e9a Add CHANGES entry for [GL #4413] 2024-02-26 12:02:40 +11:00
Mark Andrews 0651063658 Add RESINFO record type
This is a TXT clone using code point 261.
2024-02-26 12:02:40 +11:00
Michal Nowak ef965acd34 Merge branch 'mnowak/pytest_rewrite_dsdigest' into 'main'
Rewrite dsdigest system test to pytest

See merge request isc-projects/bind9!8770
2024-02-23 13:18:42 +00:00
Michal Nowak cfb68bda79 Rewrite dsdigest system test to pytest 2024-02-23 13:41:04 +01:00
Michal Nowak 5830ac831f Add isctest.check.servfail() 2024-02-23 12:02:32 +01:00
Ondřej Surý 0498d0d1e0 Merge branch '4595-fix-expire-lru-headers-race' into 'main'
Do not use header_prev in expire_lru_headers

Closes #4595

See merge request isc-projects/bind9!8773
2024-02-23 11:00:56 +00:00
Mark AndrewsandOndřej Surý 4f8539ac23 Add CHANGES and release note for [GL #4495] 2024-02-23 12:00:12 +01:00
Mark AndrewsandOndřej Surý 7ce2e86024 Do not use header_prev in expire_lru_headers
dns__cacherbt_expireheader can unlink / free header_prev underneath
it.  Use ISC_LIST_TAIL after calling dns__cacherbt_expireheader
instead to get the next pointer to be processed.
2024-02-23 12:00:12 +01:00
Michal Nowak edf70d5f6c Merge branch 'mnowak/pytest_rewrite_xferquota' into 'main'
Rewrite xferquota system test to pytest

See merge request isc-projects/bind9!8676
2024-02-23 10:48:38 +00:00
Michal Nowak 69bf4432cc Rewrite xferquota system test to pytest 2024-02-23 11:04:51 +01:00
Michal Nowak 1e52a11343 Add isctest.check.rrsets_equal function 2024-02-23 11:04:51 +01:00
Michal Nowak 5694c52f52 Add retry_with_timeout() utility function 2024-02-23 11:04:51 +01:00
Michal Nowak 6dd1b3ab38 Add RegEx support to wait_for_line() and wait_for_lines() 2024-02-23 11:04:51 +01:00
Ondřej Surý c4dbf410b7 Merge branch '4597-placeholder' into 'main'
Add CHANGES placeholder for [GL #4597]

See merge request isc-projects/bind9!8772
2024-02-23 07:49:48 +00:00
Ondřej Surý e7e268c362 Add CHANGES placeholder for [GL #4597] 2024-02-23 08:40:42 +01:00
Michal Nowak e5a98f14bf Merge branch 'mnowak/pytest_rewrite_sortlist' into 'main'
Rewrite sortlist system test to pytest

See merge request isc-projects/bind9!8684
2024-02-22 17:39:02 +00:00
Michal Nowak bcbe34e22d Make pytest a bit more verbose
The "-vv" option gives us full untruncated diffs of compared data
strustures.
2024-02-22 18:03:30 +01:00
Michal Nowak e7b5cf7f79 Rewrite sortlist system test to pytest 2024-02-22 18:02:25 +01:00
Michal Nowak 4a203dcb93 Support "source" parameter in isctest.query.(tcp|udp) 2024-02-22 14:32:04 +01:00
Artem Boldariev ce33f8e941 Merge branch 'artem-transferslowly-transferstuck-via-timers' into 'main'
Do not block workers when using -T transferslowly/transferstuck

Closes #4566

See merge request isc-projects/bind9!8751
2024-02-21 23:36:31 +00:00
Artem Boldariev f8812d4184 Do not lock workers when using -T transferslowly/transferstuck
This commit ensures that worker threads are not sleeping (by using
select()) when '-T transferslowly/transferstuck' test options are
used. This commit converts synchronous implementation of the code into
an asynchronous one based on timers.
2024-02-22 00:09:04 +02:00
Artem Boldariev 6406c39edc Merge branch '4572-do-not-crash-resolver-when-tlsctx-creation-failed' into 'main'
DoT: do not crash resolver on TLS context creation failure

Closes #4572

See merge request isc-projects/bind9!8727
2024-02-21 20:41:26 +00:00
Artem Boldariev 6ce6567564 Update CHANGES [GL #4572]
Mention that BIND should not abort anymore when trying to connect to a
remote server via TLS when using an incorrect 'tls' configuration.
2024-02-21 21:42:27 +02:00
Artem Boldariev 17632ad22a Add a system test for #4572
This commit adds a test which exactly reproduces the situation give by
the bug reporter.
2024-02-21 21:05:21 +02:00
Artem Boldariev 4cbe1eb368 DoT: do not crash resolver on TLS context creation failure
The resolver's code was not ready to failures when trying to establish
a connection via TCP-based transports (e.g. when creating TLS contexts
before establishing a TLS connection).

This commit fixes that.
2024-02-21 21:05:21 +02:00
Arаm Sаrgsyаn 2616519a95 Merge branch '4588-cid-486508-control-flow-issue' into 'main'
Clean up fetch_answered

Closes #4588

See merge request isc-projects/bind9!8753
2024-02-21 10:51:32 +00:00
Aram Sargsyan 9e38d0e3af Clean up fetch_answered
After the changes in [GL #4447] the 'fetch_answered' variable is
always false now. Delete the unnecessary code.
2024-02-20 10:46:40 +00:00
Tom Krizek 366b93f835 Merge branch 'tkrizek/pytest-log' into 'main'
Simplify pytest logging

See merge request isc-projects/bind9!8742
2024-02-16 15:00:32 +00:00
Tom Krizek 8058140b67 Don't include temp testdir on each log line
This was mostly an artifact to tell which log lines belong to which test
from the time when the test output could be all mingled together. Now
this info is reduntant, because the pytest logger already includes both
the system test name, and the specific test.
2024-02-16 14:56:00 +01:00
Tom Krizek c60975f108 Add utility logging functions to isctest.log
Unify the different loggers (conftest, module, test) into a single
interface. Remove the need to select the proper logger by automatically
selecting the most-specific logger currently available.

This also removes the need to use the logger/mlogger fixtures manually
and pass these around. This was especially annoying and unwieldy when
splitting the test cases into functions, because logger had to always be
passed around. Instead, it is now possible to use the
isctest.log.(debug,info,warning,error) functions.
2024-02-16 14:56:00 +01:00
Tom Krizek 52f9e6f557 Move watchlog module into isctest.log package
Preparation for further logging improvements - keep the watchlog
contents in a separate module inside isctest.log. Export the names in
the log package so the imports don't change for the users of these
classes.
2024-02-16 14:56:00 +01:00
Tom Krizek f8fa528cdd Remove accidentally duplicated RNDCExecutor code
This code has probably been accidentally added during some rebase. The
actual RNDCExecutor and related classes are in isctest/rndc.py. Remove
the duplicated and unused code from isctest/log.py, as it doesn't belong
there.
2024-02-16 14:55:55 +01:00
Arаm Sаrgsyаn 7f924a12f4 Merge branch '4447-disallow-stale-answer-client-timeout-non-zero' into 'main'
Disallow stale-answer-client-timeout non-zero values

Closes #4447

See merge request isc-projects/bind9!8699
2024-02-16 09:35:13 +00:00
Aram Sargsyan 03b68b8c38 Address scan-build warnings
The warnings (see below) seem to be false-positives. Address them
by adding runtime checks.

    resolver.c:1627:10: warning: Access to field 'tid' results in a dereference of a null pointer (loaded from variable 'fctx') [core.NullDereference]
     1627 |         REQUIRE(fctx->tid == isc_tid());
          |                 ^~~~~~~~~
    ../../lib/isc/include/isc/util.h:332:34: note: expanded from macro 'REQUIRE'
      332 | #define REQUIRE(e)   ISC_REQUIRE(e)
          |                                  ^
    ../../lib/isc/include/isc/assertions.h:45:11: note: expanded from macro 'ISC_REQUIRE'
       45 |         ((void)((cond) ||                                                  \
          |                  ^~~~
    resolver.c:10335:6: warning: Access to field 'depth' results in a dereference of a null pointer (loaded from variable 'fctx') [core.NullDereference]
     10335 |         if (fctx->depth > depth) {
           |             ^~~~~~~~~~~
    2 warnings generated.
2024-02-16 08:42:48 +00:00
Aram Sargsyan 152c6e2274 Add CHANGES and release notes for [GL #4447] 2024-02-16 08:42:47 +00:00
Aram Sargsyan bd7463914f Disallow stale-answer-client-timeout non-zero values
Remove all the code and tests which support non-zero
stale-answer-client-timeout values, and adjust the
documentation.
2024-02-16 08:41:52 +00:00
Evan Hunt a2dc8ebcc0 Merge branch 'each-rbtdb-dbiterator-fixes' into 'main'
fix several bugs in the RBTDB dbiterator implementation

See merge request isc-projects/bind9!8741
2024-02-15 18:52:47 +00:00
Evan Hunt 32241022b5 CHANGES for [GL !8741] 2024-02-15 10:15:50 -08:00
Evan Hunt e40fd4ed06 fix several bugs in the RBTDB dbiterator implementation
- the DNS_DB_NSEC3ONLY and DNS_DB_NONSEC3 flags are mutually
  exclusive; it never made sense to set both at the same time.
  to enforce this, it is now a fatal error to do so.  the
  dbiterator implementation has been cleaned up to remove
  code that treated the two as independent: if nonsec3 is
  true, we can be certain nsec3only is false, and vice versa.
- previously, iterating a database backwards omitted
  NSEC3 records even if DNS_DB_NONSEC3 had not been set. this
  has been corrected.
- when an iterator reaches the origin node of the NSEC3 tree, we
  need to skip over it and go to the next node in the sequence.
  the NSEC3 origin node is there for housekeeping purposes and
  never contains data.
- the dbiterator_test unit test has been expanded, several
  incorrect expectations have been fixed. (for example, the
  expected number of iterations has been reduced by one; we were
  previously counting the NSEC3 origin node and we should not
  have been doing so.)
2024-02-15 10:15:50 -08:00
Evan Hunt 88c56e25a1 Merge branch 'each-zone-xfrin-race' into 'main'
prevent a possible race in setting up zone->xfr

See merge request isc-projects/bind9!8716
2024-02-14 21:50:25 +00:00
Evan Hunt 7d59a0ed81 prevent a possible race in setting up zone->xfr
the call to dns_xfrin_create() wrote to zone->xfr with
the zone unlocked.
2024-02-14 18:53:17 +00:00
Evan Hunt c05cf6d80e Merge branch 'each-fix-missing-comparison' into 'main'
test for SIGTYPE correctly

See merge request isc-projects/bind9!8733
2024-02-14 18:36:45 +00:00
Evan Hunt 3e683a9ed5 test for SIGTYPE correctly
a comparison was incorrectly removed during a previous merge.
2024-02-14 09:32:20 -08:00
Michał Kępień cc65a14d0e Merge branch 'michal/post-release-tweaks' into 'main'
Miscellaneous post-release tweaks

See merge request isc-projects/bind9!8738
2024-02-14 16:17:02 +00:00
Michał Kępień dedc5b9afb Swap CHANGES entries 6343 and 6344
Fix a CHANGES entries numbering issue that was inadvertently introduced
when change 6344 was backported.  This makes the affected CHANGES
numbers consistent across all branches and releases again.
2024-02-14 14:49:49 +01:00
Michał Kępień 01ac86f90b Retroactively add release note for CVE-2023-50868
A release note for CVE-2023-50868 was not included in BIND 9.19.21, even
though that vulnerability was already addressed in that release (by the
fix for CVE-2023-50387).  Retroactively add a relevant release note for
BIND 9.19.21.
2024-02-14 14:49:49 +01:00
Michał Kępień 2fd20bbaf5 Mention CVE-2023-50868 in CHANGES entry 6322
Since CVE-2023-50868 does not have a dedicated fix in BIND 9, mention
its CVE identifier in the CHANGES entry for CVE-2023-50387 (KeyTrap),
which accompanied the code change that addresses both of these
vulnerabilities.
2024-02-14 14:49:49 +01:00
Michał Kępień 8610799317 Merge tag 'v9.19.21'
BIND 9.19.21
2024-02-14 13:24:56 +01:00
Michal Nowak 917851ac5c Merge branch 'mnowak/accommodate-black-24.2.0' into 'main'
Accommodate black 24.2.0

See merge request isc-projects/bind9!8729
2024-02-14 11:31:34 +00:00
Michal Nowak 70163a8b3f Accommodate black 24.2.0 2024-02-14 10:49:21 +01:00
Evan Hunt 9279a1038b Merge branch 'each-cleanup-dns_rbt' into 'main'
clean up dns_rbt

See merge request isc-projects/bind9!8715
2024-02-14 09:45:58 +00:00
Evan Hunt ac9bd03a0d clean up dns_rbt
- create_node() in rbt.c cannot fail
- the dns_rbt_*name() functions, which are wrappers around
  dns_rbt_[add|find|delete]node(), were never used except in tests.

this change isn't really necessary since RBT is likely to go away
eventually anyway. but keeping the API as simple as possible while it
persists is a good thing, and may reduce confusion while QPDB is being
developed from RBTDB code.
2024-02-14 01:36:44 -08:00
Evan Hunt 7d1e622b5f Merge branch 'each-move-DNS_RBT_NSEC_-to-db.h' into 'main'
move DNS_RBT_NSEC_* to db.h

See merge request isc-projects/bind9!8714
2024-02-14 09:27:21 +00:00
Evan Hunt 78d173b548 move DNS_RBT_NSEC_* to db.h
these values pertain to whether a node is in the main, nsec, or nsec3
tree of an RBTDB. they need to be moved to a more generic location so
they can also be used by QPDB.

(this is in db.h rather than db_p.h because rbt.c needs access to it.
technically, that's a layer violation, but it's a long-existing one;
refactoring to get rid of it would be a large hassle, and eventually
we expect to remove rbt.c anyway.)
2024-02-14 01:13:44 -08:00
Matthijs Mekking 808281cf43 Merge branch 'each-separate-generic-DB-helpers' into 'main'
separate generic DB helpers into db_p.h

See merge request isc-projects/bind9!8713
2024-02-14 08:46:05 +00:00
Matthijs Mekking af5679960e Add coccinelle rule to favor DNS_SIGTYPE
This should error if DNS_TYPEPAIR_VALUE(dns_rdatatype_rrsig, type) is
used.
2024-02-14 09:00:27 +01:00
Evan HuntandMatthijs Mekking 27c862d953 separate generic DB helpers into db_p.h
when the QPDB is implemented, we will need to have both qpdb_p.h and
rbtdb_p.h. in order to prevent name collisions or code duplication,
this commit adds a generic private header file, db_p.h, containing
structures and macros that will be used by both databases.

some functions and structs have been renamed to more specifically refer
to the RBT database, in order to avoid namespace collision with similar
things that will be needed by the QPDB later.
2024-02-14 09:00:27 +01:00
Evan Hunt a22fec506a Merge branch 'each-refactor-wildcard-matching' into 'main'
Refactor wildcard matching

See merge request isc-projects/bind9!8712
2024-02-13 22:48:39 +00:00
Evan Hunt d1acc987e9 refactor wildcard matching
refactor the wildcard matching code to make it a bit easier to
understand, in hopes that it will reduce the difficulty of converting
from RBTDB to QPDB later.

there are also some minor optimizations: previously, after stepping
backward to find the predecessor, we stepped back foward *from* the
predecessor to find the successor.  we now reset the rbtnode chain to
its original starting point before stepping forward; this eliminates
some unnecessary processing. and, if neither predecessor nor successor
is found, we return early rather than carrying on with an unnecessary
effort to match labels.
2024-02-13 22:14:17 +00:00
Mark Andrews dbf29b7b5b Merge branch '4571-findnsec3proofs-failed-to-disassociate-all-rdatasets-returned-by-dns_ncache_current' into 'main'
Resolve "findnsec3proofs failed to disassociate all rdatasets returned by dns_ncache_current"

Closes #4571

See merge request isc-projects/bind9!8725
2024-02-13 13:06:32 +00:00
Mark Andrews 3b7cddfb1b Add CHANGES note for [GL #4571] 2024-02-13 11:42:56 +00:00
Mark Andrews dc94f42209 Dissassociate rdatasets returned from dns_ncache_current
lib/dns/validator.c:findnsec3proofs failed to disassociate the
temporary rdataset returned by dns_ncache_current on all paths.
2024-02-13 11:42:56 +00:00
Mark Andrews a9ceecdd9d Merge branch '4569-cid-486326-memory-corruptions-overrun' into 'main'
Resolve "** CID 486326:  Memory - corruptions  (OVERRUN)"

Closes #4569

See merge request isc-projects/bind9!8723
2024-02-13 00:07:42 +00:00
Mark Andrews 371defc357 Address CID 486326: Memory - corruptions (OVERRUN)
Coverity detected that address->type.sa was too small when copying
a struct sockaddr_sin6, use the alterative union element
address->type.sin6 instead.
2024-02-13 09:21:49 +11:00
Mark Andrews c2b7cb2cef Merge branch '4570-cid-486327-control-flow-issues-unreachable' into 'main'
Resolve "CID 486327:  Control flow issues  (UNREACHABLE)"

Closes #4570

See merge request isc-projects/bind9!8724
2024-02-12 21:59:12 +00:00
Mark Andrews dd57db2274 Remove duplicate unreachable code block
This was accidentially left in during the developement of !8299.
2024-02-12 15:18:46 +11:00
Ondřej Surý dea228d198 Merge branch '4568-fix-isc_ht-case-insensitive-matching' into 'main'
Fix case insensitive matching in isc_ht hash table implementation

Closes #4568

See merge request isc-projects/bind9!8718
2024-02-11 08:55:52 +00:00
Ondřej Surý e91884553f Add CHANGES note for [GL #4568] 2024-02-11 09:37:09 +01:00
Ondřej Surý a114042059 Add a system test for mixed-case data for the same owner
We were missing a test where a single owner name would have multiple
types with a different case.  The generated RRSIGs and NSEC records will
then have different case than the signed records and message parser have
to cope with that and treat everything as the same owner.
2024-02-11 09:36:56 +01:00
Ondřej Surý 175655b771 Fix case insensitive matching in isc_ht hash table implementation
The case insensitive matching in isc_ht was basically completely broken
as only the hashvalue computation was case insensitive, but the key
comparison was always case sensitive.
2024-02-11 09:36:56 +01:00
Evan Hunt fca10c1305 Merge branch 'each-placeholder' into 'main'
add placeholder to CHANGES [GL #4567]

See merge request isc-projects/bind9!8720
2024-02-11 07:21:08 +00:00
Evan Hunt 54fb2a72ef add placeholder to CHANGES [GL #4567] 2024-02-10 23:19:57 -08:00
Aydın Mercan eee76558ee Merge branch '4491-use-rcu-instead-of-rwlock-in-isc_log-unit' into 'main'
Convert rwlock in isc_log_t to RCU

Closes #4491

See merge request isc-projects/bind9!8593
2024-02-09 10:56:22 +00:00
Aydın Mercan a911949ebc Convert rwlock in isc_log_t to RCU
The isc_log_t contains a isc_logconfig_t that is swapped, dereferenced
or accessed its fields through a mutex. Instead of protecting it with a
rwlock, use RCU.
2024-02-09 13:11:48 +03:00
Ondřej Surý 0a7b0c3896 Merge branch 'ondrej/add-placeholder' into 'main'
Add placeholder to CHANGES

See merge request isc-projects/bind9!8717
2024-02-09 09:02:01 +00:00
Ondřej Surý 25859a6960 Add placeholder to CHANGES 2024-02-09 10:01:33 +01:00
Ondřej Surý 606f2daaa2 Merge branch '4549-heap-use-after-free-lib-isccc-ccmsg-c-160-in-ccmsg_senddone' into 'main'
Resolve "heap-use-after-free lib/isccc/ccmsg.c:160 in ccmsg_senddone"

Closes #4549

See merge request isc-projects/bind9!8692
2024-02-08 17:34:46 +00:00
Mark AndrewsandOndřej Surý 6c15e45328 Add CHANGES note for [GL #4549] 2024-02-08 17:24:11 +01:00
Ondřej Surý 315aa3135a Fix UAF in ccmsg.c when reading stopped before sending
When shutting down the whole server, the reading could stop and detach
from controlconnection before sending is done.  If send callback then
detaches from the last controlconnection handle, the ccmsg would be
invalidated after the send callback and thus we must not access ccmsg
after calling the send_cb().
2024-02-08 17:24:11 +01:00
Ondřej Surý 88a14985db Add isc_nm_read_stop() and remove .reading member from ccmsg
We need to stop reading when calling isc_ccmsg_disconnect() as the
reading handle doesn't have to be last because sending might be in
progress.  After that, we can safely remove .reading member because the
reading would not be called after the disconnect has been called.

The ccmsg_senddone() should also not call the recv callback if the
sending failed, that's the job of the caller's send callback - in fact
it already does that, so the code in ccmsg_senddone() was superfluous.
2024-02-08 17:23:39 +01:00
Ondřej Surý 5964eb4796 Refactor the normal vs error path in control_senddone()
The code flow in control_senddone() was modified to be simpler to follow
and superfluous INSIST() was zapped from control_recvmessage().
2024-02-08 17:16:41 +01:00
Ondřej Surý de25743e00 Merge branch 'ondrej/reduce-netmgr-memory-usage' into 'main'
Reduce memory sizes of common structures

See merge request isc-projects/bind9!8299
2024-02-08 14:45:25 +00:00
Ondřej Surý 15329d471e Add memory pools for isc_nmsocket_t structures
To reduce memory pressure, we can add light per-loop (netmgr worker)
memory pools for isc_nmsocket_t structures.  This will help in
situations where there's a lot of churn creating and destroying the
nmsockets.
2024-02-08 15:13:47 +01:00
Ondřej Surý 750bd364b5 Reduce the isc_nmsocket_t size from 1840 to 1208 bytes
Embedding isc_nmsocket_h2_t directly inside isc_nmsocket_t had increased
the size of isc_nmsocket_t to 1840 bytes.  Making the isc_nmsocket_h2_t
to be a pointer to the structure and allocated on demand allows us to
reduce the size to 1208 bytes.  While there are still some possible
reductions in the isc_nmsocket_t (embedded tlsstream, streamdns
structures), this was the far biggest drop in the memory usage.
2024-02-08 15:13:47 +01:00
Ondřej Surý eada7b6e13 Reduce struct isc__nm_uvreq size from 1560 to 560 bytes
The uv_req union member of struct isc__nm_uvreq contained libuv request
types that we don't use.  Turns out that uv_getnameinfo_t is 1000 bytes
big and unnecessarily enlarged the whole structure.  Remove all the
unused members from the uv_req union.
2024-02-08 15:13:47 +01:00
Ondřej Surý 2367b6a2e1 Reduce sizeof isc_sockaddr from 152 to 48 bytes
After removing sockaddr_unix from isc_sockaddr, we can also remove
sockaddr_storage and reduce the isc_sockaddr size from 152 bytes to just
48 bytes needed to hold IPv6 addresses.
2024-02-08 15:13:47 +01:00
Tom Krizek 2133e5f4f7 Merge branch '4560-pytest-junit-xml-compat' into 'main'
Support older junit XML format in test result processing

Closes #4560

See merge request isc-projects/bind9!8696
2024-02-08 13:57:07 +00:00
Tom Krizek 06a977a699 Add CHANGES note for [GL #4560] 2024-02-08 14:15:41 +01:00
Tom Krizek bec3dd10b3 Support older junit XML format in test result processing
When running `make check` on a platform which has older (but still
supported) pytest, e.g. 3.4.2 on EL8, the junit to trs conversion would
fail because the junit format has different structure. Make the junit
XML processing more lenient to support both the older and newer junit
XML formats.
2024-02-08 14:14:26 +01:00
Tom Krizek eb2e158172 Merge branch '4562-use-source-port-for-ditch-pl' into 'main'
Use a single local port for ditch.pl

Closes #4562

See merge request isc-projects/bind9!8698
2024-02-08 12:42:23 +00:00
Tom Krizek 339fa5690a Use a single local port for ditch.pl
The ditch.pl script is used to generate burst traffic without waiting
for the responses. When running other tests in parallel, this can result
in a ephemeral port clash, since the ditch.pl process closes the socket
immediately. In rare occasions when the message ID also clashes with
other tests' queries, it might result in an UnexpectedSource error from
dnspython.

Use a dedicated port EXTRAPORT8 which is reserved for each test as a
source port for the burst traffic.
2024-02-08 13:41:23 +01:00
Ondřej Surý 381763120b Merge branch '4187-auto-vectorize-compiler-optimization-causing-exception-crash' into 'main'
Use proper padding instead of using alignas()

Closes #4187

See merge request isc-projects/bind9!8530
2024-02-08 11:17:58 +00:00
Ondřej Surý 306124b385 Add CHANGES note for [GL #4187] 2024-02-08 10:54:57 +01:00
Ondřej Surý 2463e5232d Use proper padding instead of using alignas()
As it was pointed out, the alignas() can't be used on objects larger
than `max_align_t` otherwise the compiler might miscompile the code to
use auto-vectorization on unaligned memory.

As we were only using alignas() as a way to prevent false memory
sharing, we can use manual padding in the affected structures.
2024-02-08 10:54:35 +01:00
Ondřej Surý 05e60a0af6 Merge branch 'ondrej/various-rbtdb-fixes' into 'main'
Various rbtdb fixes and optimizations

See merge request isc-projects/bind9!8675
2024-02-08 07:34:07 +00:00
Ondřej Surý 8404129471 Use DNS_QPGC_MAYBE instead of DNS_QPGC_ALL for more realistic load
In the benchmarks, DNS_QPGC_ALL was trying to hard to cleanup QP
and this was slowing down QP too much.  Use DNS_QPGC_MAYBE instead
that we are going to use anyway for more realistic load - this also
shows the memory usage matching the real loads.
2024-02-08 08:33:36 +01:00
Ondřej Surý 6e81717cff Add CHANGES note for [GL !8675] 2024-02-08 08:33:36 +01:00
Ondřej Surý 3f774c2a8a Optimize cname_and_other_data to stop as earliest as possible
Stop the cname_and_other_data processing if we already know that the
result is true.  Also, we know that CNAME will be placed in the priority
headers, so we can stop looking for CNAME if we haven't found CNAME and
we are past the priority headers.
2024-02-08 08:33:36 +01:00
Ondřej Surý 3ac482be7f Optimize the slabheader placement for certain RRTypes
Mark the infrastructure RRTypes as "priority" types and place them at
the beginning of the rdataslab header data graph.  The non-priority
types either go right after the priority types (if any).
2024-02-08 08:33:36 +01:00
Ondřej Surý 5070c7f5c7 Fix missing RRSIG for CNAME with different slabheader order
The cachedb was missing piece of code (already found in zonedb) that
would make lookups in the slabheaders to miss the RRSIGs for CNAME if
the order of CNAME and RRSIG(CNAME) was reversed in the node->data.
2024-02-08 08:02:48 +01:00
Ondřej Surý f89e3e04cf Merge branch 'ondrej/isc-mem-rcu-barrier-improvements' into 'main'
Use _exit() in the fatal() function

See merge request isc-projects/bind9!8703
2024-02-08 07:02:21 +00:00
Ondřej Surý 0c18ed7ec6 Remove isc__tls_setfatalmode() function and the calls
With _exit() instead of exit() in place, we don't need
isc__tls_setfatalmode() mechanism as the atexit() calls will not be
executed including OpenSSL atexit hooks.
2024-02-08 08:01:58 +01:00
Ondřej Surý 76997983fd Use EXIT_SUCCESS and EXIT_FAILURE
Instead of randomly using -1 or 1 as a failure status, properly utilize
the EXIT_FAILURE define that's platform specific (as it should be).
2024-02-08 08:01:58 +01:00
Ondřej Surý e140743e6a Improve the rcu_barrier() call when destroying the mem context
Instead of crude 5x rcu_barrier() call in the isc__mem_destroy(), change
the mechanism to call rcu_barrier() until the memory use and references
stops decreasing.  This should deal with any number of nested call_rcu()
levels.

Additionally, don't destroy the contextslock if the list of the contexts
isn't empty.  Destroying the lock could make the late threads crash.
2024-02-08 08:01:58 +01:00
Ondřej Surý 4bec711fe3 Use _exit() in the fatal() function
Since the fatal() isn't a correct but rather abrupt termination of the
program, we want to skip the various atexit() calls because not all
memory might be freed during fatal() call, etc.  Using _exit() instead
of exit() has this effect - the program will end, but no destructors or
atexit routines will be called.
2024-02-08 08:01:58 +01:00
Ondřej Surý 4e2e2a13b7 Merge branch 'ondrej/use-error-checking-mutex-on-linux' into 'main'
Always use adaptive mutexes on Linux and use error checking mutexes in developer mode

See merge request isc-projects/bind9!8693
2024-02-07 21:55:31 +00:00
Ondřej Surý 2c98ccbdba Use error checking mutex in developer mode on Linux
When developer mode is enabled, use error checking mutex type, so we can
discover wrong use of mutexes faster.
2024-02-07 20:54:05 +01:00
Ondřej Surý 01038d894f Always use adaptive mutexes on Linux
When adaptive mutexes are available (with glibc), always use them.
Remove the autoconf switch and also fix the static initializer.
2024-02-07 20:54:05 +01:00
Ondřej Surý cb1d2e57e9 Remove unused mutex from netmgr
The netmgr->lock was dead code, remove it.
2024-02-07 20:54:05 +01:00
Mark Andrews 8c6531d326 Merge branch '4519-check-return-value-of-snprintf-in-lib-isccfg-check-c' into 'main'
Resolve "Check return value of snprintf in lib/isccfg/check.c"

Closes #4519

See merge request isc-projects/bind9!8624
2024-02-07 13:49:19 +00:00
Mark Andrews 2f87c429a2 cleanup isc_symtab_define with isc_symexists_replace 2024-02-07 13:52:10 +11:00
Mark Andrews 1fb61494a8 Add RUNTIME_CHECK 2024-02-07 13:40:03 +11:00
Mark Andrews 95de7f829c Ensure keyname buffer is big enough
Use a temporary string rather than a fixed buffer to construct
the keyname.
2024-02-07 13:39:51 +11:00
Mark Andrews 7cced1732d cleanup isc_symtab_undefine callers
isc_symtab_undefine now only return ISC_R_SUCCESS and ISC_R_EXISTS.
Cleanup callers looking for other values.
2024-02-07 12:56:39 +11:00
Mark Andrews 248b713b0c Merge branch '4561-shutdown-test-doesn-t-log-everything-to-named-run' into 'main'
Resolve "Shutdown test doesn't log everything to named.run"

Closes #4561

See merge request isc-projects/bind9!8695
2024-02-07 01:03:05 +00:00
Tom KrizekandMark Andrews fb70c4d475 Re-enable rndc shutdown test
The issue preventing a proper rndc shutdown was recently fixed and
the test now passes.
2024-02-07 11:29:47 +11:00
Mark Andrews 3651c58a6a Capture the resolver's startup and shutdown logging
Also set the debugging to 99.
2024-02-07 11:29:47 +11:00
Mark Andrews 65a3450b8b Merge branch '4529-abort-in-nsupdate-2' into 'main'
Resolve "Abort in nsupdate"

Closes #4529

See merge request isc-projects/bind9!8658
2024-02-06 23:27:05 +00:00
Mark Andrews 4087a75fd6 Add CHANGES entry for [GL #4529] 2024-02-07 09:53:03 +11:00
Mark Andrews 4b93ae74c7 Restore dns_requestmgr_shutdown re-entrancy
In the conversion to rcu the ability to call dns_requestmgr_shutdown
multiple times was lost.  nsupdate depended on this.  Restore support
for that.
2024-02-07 09:52:32 +11:00
Arаm Sаrgsyаn 97b3477d0a Merge branch '4241-expose-zone-first-time-refreshes' into 'main'
Resolve "Expose data about 'first time' zone maintenance in-progress"

Closes #4241

See merge request isc-projects/bind9!8481
2024-02-06 11:26:28 +00:00
Aram Sargsyan 1d064d3257 Add a release note for [GL #4241] 2024-02-05 17:45:19 +00:00
Aram Sargsyan e17079e375 Add a CHANGES note for [GL #4241] 2024-02-05 17:41:53 +00:00
Aram Sargsyan e3557f8661 Add a check for the 'first refresh' data in rndc status
Check that 'rndc status' correctly indicates the expected number
of the secondary zones which have the 'first refresh' flag set.
2024-02-05 17:41:14 +00:00
Aram Sargsyan 0b6ee6b953 Add a check for the 'first refresh' data in the stats channel
Currently we test the incoming zone transfers data in the statistics
channel by retransfering the zones in slow mode and capturing the XML
and JSON outputs in the meantime to check their validity. Add a new
transfer to the test, and check that the XML and JSON files correctly
indicate that we have 3 retransfers and 1 new (first time) transfer.
2024-02-05 17:41:14 +00:00
Aram Sargsyan 2ec041b719 Expose the 'first refresh' zone flag in rndc status
Expose the newly added 'first refresh' flag in the information
provided by the 'rndc staus' command, by showing the number of
zones, which are not yet fully ready, and their first refresh
is pending or is in-progress.
2024-02-05 17:41:14 +00:00
Aram Sargsyan 0a1f05987f Expose 'first refresh' zone flag in stats channel
Add a new zone flag to indicate that a secondary type zone is
not yet fully ready, and a first time refresh is pending or is
in progress.

Expose this new flag in the statistics channel's "Incoming Zone
Transfers" section.
2024-02-05 17:41:14 +00:00
Arаm Sаrgsyаn 87942ee0b4 Merge branch '4373-dnssec-validation-yes-should-fail-without-trust-anchors' into 'main'
'dnssec-validation yes' should fail when no trust anchors are configured

Closes #4373

See merge request isc-projects/bind9!8575
2024-02-02 19:55:00 +00:00
Aram Sargsyan 85f966a8f6 Document a specific 'dnssec-validation yes' usage incompatibility
Static trust anchor for the root zone can not be used with
'dnssec-validation auto'.
2024-02-02 19:54:09 +00:00
Aram Sargsyan d28fd93a58 Use trust anchors with 'dnssec-validation yes' in system tests
Explicitly use an empty 'trust-anchors' statement in the system
tests where it was used implicitly before.

In resolver/ns5/named.conf.in use the trust anchor in 'trusted.conf',
which was supposed to be used there.
2024-02-02 19:54:09 +00:00
Aram Sargsyan fdb7e4e3f5 Add CHANGES and release notes for [GL #4373] 2024-02-02 19:54:08 +00:00
Aram Sargsyan 0d47f565ea Test trusted anchors configurations for 'dnssec-validation yes'
Add checks into the  'checkconf' system test to make sure that the
'dnssec-validation yes' option fails without configured trusted
anchors, and succeeds with configured non-empty, as well as empty
trusted anchors.
2024-02-02 19:53:45 +00:00
Aram Sargsyan e8fa9aa5c7 Document new requirements for 'dnssec-validation yes'
Using the 'dnssec-validation yes' option now requires an explicitly
confgiured 'trust-anchors' statement (or 'managed-keys' or
'trusted-keys', both deprecated).
2024-02-02 19:53:45 +00:00
Aram Sargsyan 4cdef214d2 Require trust anchors for 'dnnsec-validation yes'
Using the 'dnssec-validation yes' option now requires an explicitly
confgiured 'trust-anchors' statement (or 'managed-keys' or
'trusted-keys', both deprecated).
2024-02-02 19:53:45 +00:00
Matthijs Mekking 308ed1a1ea Merge branch '4531-improve-parental-agents-definition-arm' into 'main'
Improve parental-agents definition in ARM

Closes #4531

See merge request isc-projects/bind9!8650
2024-02-02 16:19:05 +00:00
Matthijs Mekking ab9c62f4b9 Add CHANGES for #4531
Improve ARM parental-agents definition.
2024-02-02 16:45:31 +01:00
Matthijs Mekking 604f8e7797 Improve parental-agents definition in ARM
"A parental agent is the entity that is allowed to change a zone's
delegation information" is untrue, because it is possible to use some
hidden server or a validating resolver.

Also the new text makes it more clear that named sends DS queries to
these servers.
2024-02-02 16:45:11 +01:00
Arаm Sаrgsyаn a863450695 Merge branch 'aram/dns-getdb-flags-fix' into 'main'
Fix the DNS_GETDB_STALEFIRST flag

See merge request isc-projects/bind9!8683
2024-02-02 15:05:58 +00:00
Aram Sargsyan f329c1ebc9 Add a CHANGES note for [GL !8683] 2024-02-02 14:15:31 +00:00
Aram Sargsyan 0d7c7777da Improve the definition of the DNS_GETDB_* flags
Use the (1 << N) form for defining the flags, in order to avoid
errors like the one fixed in the previous commit.

Also convert the definitions to an enum, as done in some of our
recent refactoring work.
2024-02-02 14:15:31 +00:00
Aram Sargsyan be7d8fafe2 Fix the DNS_GETDB_STALEFIRST flag
The DNS_GETDB_STALEFIRST flag is defined as 0x0C, which is the
combination of the DNS_GETDB_PARTIAL (0x04) and the
DNS_GETDB_IGNOREACL (0x08) flags (0x04 | 0x08 == 0x0C) , which is
an obvious error.

All the flags should be power of two, so they don't interfere with
each other. Fix the DNS_GETDB_STALEFIRST flag by setting it to 0x10.
2024-02-02 13:50:57 +00:00
Michal Nowak c030a677ae Update BIND version for release 2024-02-02 10:56:43 +01:00
Michal Nowak 4dd683526d Add a CHANGES marker 2024-02-02 10:55:35 +01:00
Michal Nowak a4e39f1e5a Merge branch 'michal/prepare-documentation-for-bind-9.19.21' into 'v9.19.21-release'
Prepare documentation for BIND 9.19.21

See merge request isc-private/bind9!643
2024-02-02 09:54:26 +00:00
Michał Kępień 265deccb85 Prepare release notes for BIND 9.19.21 2024-02-02 09:21:49 +01:00
Michał Kępień bf6a16c17b Merge branch 'ondrej/dns-validator-async' into 'v9.19.21-release'
[CVE-2023-50387] Fix KeyTrap

See merge request isc-private/bind9!606
2024-02-01 20:47:06 +00:00
Ondřej SurýandMichał Kępień abed39ec0d Add CHANGES and release note for [GL #4424] 2024-02-01 21:45:06 +01:00
Ondřej SurýandMichał Kępień 15096aefdf Make the dns_validator validations asynchronous and limit it
Instead of running all the cryptographic validation in a tight loop,
spread it out into multiple event loop "ticks", but moving every single
validation into own isc_async_run() asynchronous event.  Move the
cryptographic operations - both verification and DNSKEY selection - to
the offloaded threads (isc_work_enqueue), this further limits the time
we spend doing expensive operations on the event loops that should be
fast.

Limit the impact of invalid or malicious RRSets that contain crafted
records causing the dns_validator to do many validations per single
fetch by adding a cap on the maximum number of validations and maximum
number of validation failures that can happen before the resolving
fails.
2024-02-01 21:45:06 +01:00
Michał Kępień 1e40c0b124 Merge branch '4234-confidential-parser-regression-main' into 'v9.19.21-release'
fix a message parsing regression

See merge request isc-private/bind9!632
2024-02-01 20:22:37 +00:00
Matthijs Mekking 3818a80bb8 Merge branch '4553-return-value-for-checkds-shadows' into 'main'
Don't also skip keymgr run if checkds is skipped

Closes #4553

See merge request isc-projects/bind9!8681
2024-02-01 11:40:59 +00:00
Matthijs Mekking 07c2acf15d Don't also skip keymgr run if checkds is skipped
Checking the DS at the parent only happens if dns_zone_getdnsseckeys()
returns success. However, if this function somehow fails, it can also
prevent the keymgr from running.

Before adding the check DS functionality, the keymgr should only run
if 'dns_dnssec_findmatchingkeys()' did not return an error (either
ISC_R_SUCCESS or ISC_R_NOTFOUND). After this change the correct
result code is used again.
2024-02-01 12:06:08 +01:00
Matthijs Mekking 6391ad4660 Merge branch '4551-dnssec-keygen-does-not-generate-tsig-keys' into 'main'
dnssec-keygen man page still says it can do TSIG

Closes #4551

See merge request isc-projects/bind9!8678
2024-02-01 10:53:41 +00:00
Matthijs Mekking 8a8c573be6 Put reference to RFC 2845 in tsig-keygen man page 2024-02-01 11:20:33 +01:00
Matthijs Mekking aabb452953 dnssec-keygen man page still says it can do TSIG
Remove text in man page that says the program can also be used for
generate TSIG keys, this was removed in 9.13.0 but this text was still
not yet removed.
2024-02-01 11:17:39 +01:00
Evan Hunt 37bd2a405f Merge branch '362-check-fetch-quota-param' into 'main'
check range of fetch-quota-param parameters

Closes #362

See merge request isc-projects/bind9!8444
2024-02-01 02:54:02 +00:00
Evan Hunt 05c0e24cbe CHANGES for [GL #362] 2024-01-31 18:20:17 -08:00
Evan Hunt 86fdc66ed3 check range of fetch-quota-param parameters
the 'low', 'high' and 'discount' parameters to 'fetch-quota-param'
are meant to be ratios with values between zero and one, but higher
values can be assigned. this could potentially lead to an assertion
in maybe_adjust_quota().
2024-01-31 18:19:38 -08:00
Michał Kępień 04ba284e1a Add a CHANGES entry 2024-01-31 15:52:46 +01:00
Aram SargsyanandMichał Kępień 510f1de8a6 fix another message parsing regression
The fix for CVE-2023-4408 introduced a regression in the message
parser, which could cause a crash if an rdata type that can only
occur in the question was found in another section.

Use 'dns__message_putassociatedrdataset()' instead of
'dns__message_puttemprdataset()', because after calling the
'dns_rdatalist_tordataset()' function earlier the 'rdataset'
is associated.
2024-01-31 15:52:46 +01:00
Evan HuntandMichał Kępień 4c19d35614 fix a message parsing regression
the fix for CVE-2023-4408 introduced a regression in the message
parser, which could cause a crash if duplicate rdatasets were found
in the question section. this commit ensures that rdatasets are
correctly disassociated and freed when this occurs.
2024-01-31 15:52:46 +01:00
Michał Kępień fec06dce51 Merge branch 'michal/shift-CHANGES-entries' into 'main'
Shift CHANGES entries by two

See merge request isc-projects/bind9!8679
2024-01-31 10:19:29 +00:00
Michał Kępień 1b48c99392 Shift CHANGES entries by two
Account for additional entries that will be included in February 2024
releases.
2024-01-31 11:11:11 +01:00
Matthijs Mekking 6b00e831e1 Merge branch 'matthijs-fix-kasp-test' into 'main'
Make max search depth variable in kasp system test

See merge request isc-projects/bind9!8674
2024-01-29 08:46:57 +00:00
Matthijs Mekking b14c0546c1 Make max search depth variable in kasp system test
In the second test we are looking for key files and extract the key
id numbers. Because keys can be in different directories, we needed
to change the maxdepth when searching for keys.

For the second kasp system test, check that 'dnssec-keygen -k' (default
policy) creates valid files, the 'get_keyids' returned more than one
keytag, namely the ones that are inside the keys/ directory, that were
created for the predecessor test, check that 'dnssec-keygen -k'
(configuredd policy) creates valid files.

This caused the system test to spew out errors that key files were
missing (we were looking for key files in the current directory, but
when looking for key id numbers we included the keys/ directory). It
could also cause the next test to fail, check that 'dnssec-settime' by
default does not edit key state file, because the STATE_FILE environment
variable was overwritten with the key file path of one of the keys that
were created with the configured policy.

We fix this by adjusting the maxdepth for the test in question. Other
tests don't need adjusting because they use unique zone names.
2024-01-29 08:45:34 +01:00
Michal Nowak 965b0a08ac Merge branch 'mnowak/drop-freebsd-12' into 'main'
Drop FreeBSD 12

See merge request isc-projects/bind9!8670
2024-01-26 09:44:17 +00:00
Michal Nowak 98bfa22381 Drop FreeBSD 12
Support for FreeBSD 12.4, the last FreeBSD 12.x release, ended on
December 31, 2023.

Link: https://www.freebsd.org/security/unsupported/

Move the --with-readline=editline ./configure option to FreeBSD 14.
2024-01-26 10:28:00 +01:00
Matthijs Mekking b51d8f2c5d Merge branch '1129-hsm-kasp' into 'main'
HSM support for dnssec-policy

Closes #1129

See merge request isc-projects/bind9!5924
2024-01-25 16:31:59 +00:00
Matthijs Mekking 8602beecd1 Replace keystore attach/detach with ISC_REFCOUNT_IMPL/ISC_REFCOUNT_DECL
This is now the default way to implement attaching to/detaching from
a pointer.

Also update cfg_keystore_fromconfig() to allow NULL value for the
keystore pointer. In most cases we detach it immediately after the
function call.
2024-01-25 15:37:40 +01:00
Matthijs Mekking 2615b8a8b5 Update pkcs11 documentation
Update the minimum required version of pkcs11-provider that contains the
fixes needed in order to make it work with dnssec-policy.

Update documentation to not recommend using engine_pkcs11 in conjunction
with dnssec-policy.
2024-01-25 15:37:40 +01:00
Matthijs Mekking daaa70f48b Refactor dns_keystore_directory()
Add a default key-directory parameter to the function that can
be returned if there is no keystore, or if the keystore directory
is NULL (the latter is also true for the built-in keystore).
2024-01-25 15:37:40 +01:00
Matthijs Mekking cb12b42839 Rename "uri" to "pkcs11-uri"
The name "uri" was considered to be too generic and could potentially
clash with a future URI configuration option. Renamed to "pkcs11-uri".

Note that this option name was also preferred over "pkcs11uri", the
dash is considered to be the more clearer form.
2024-01-25 15:37:40 +01:00
Matthijs Mekking 624034125f Add test case with special characters in zone name
Add a zone to the system test that has special characters to
ensure it does not mess up PKCS#11 labels when creating keys.
2024-01-25 15:37:40 +01:00
Matthijs Mekking 934d17255e Better PKCS#11 label creation
When using the same PKCS#11 URI for a zone that uses different
DNSSEC policies, the PKCS#11 label could collide, i.e. the same
label could be used for different keys. Add the policy name to
the label to make it more unique.

Also, the zone name could contain characters that are interpreted
as special characters when parsing the PKCS#11 URI string. Mangle
the zone name through 'dns_name_tofilenametext()' to make it
PKCS#11 safe.

Move the creation to a separate function for clarity.

Furthermore, add a log message whenever a PKCS#11 object has been
successfully created.
2024-01-25 15:37:40 +01:00
Matthijs Mekking 89cf3049d4 Test dnssec-policy/hsm with multiple views
Add test cases for zones in different views that are using PKCS#11
tokens to store its keys.

If it is using the same DNSSEC policy, only one PKCS#11 token should be
created and the same key should be used for the zone in both views.

If it is using a different DNSSEC policy, multiple PKCS#11 token should
be created and each view should use their respective key.
2024-01-25 15:37:40 +01:00
Matthijs Mekking dd6cfb464f Remove "error reading" grep from kasp system test
This log may still occur if there is a DNSKEY in the unsigned zone.
This may happen in a multi-signer setup for example.

Ideally this should not log a warning, but that requires looking up
keys a different way (by searching for key files only). However, that
requires adapting a bunch of system tests, and is out of scope for now.
2024-01-25 15:37:40 +01:00
Matthijs Mekking c59c2ac85f Minor fixes in enginepkcs11 system test
- Shell function body should be in between curly braces.
- Some erroneous '|| return 1' are replaced with '|| ret=1'.
- Fix a variable name (was 'ret', should be '_ret').
- Clean up when setting up a new test.
2024-01-25 15:37:40 +01:00
Matthijs Mekking 1ac02b0f1d The use of isc_dir_t in keymgr is not needed
The internal keymgr used 'isc_dir_open(&dir)' and 'isc_dir_close(&dir)',
but was not using the variable 'dir`, other than checking if the
directory can be opened. Errors like these will be be caught already
in the dst_api function calls.
2024-01-25 15:37:40 +01:00
Matthijs Mekking 750536f74d No longer need to get generated key from label
The pkcs11-provider did not yet support getting X/Y coordinates
on newly generated EC PKEY keys, thus we attempted to get the
key from the label after it was generated in the keystore.

This has been fixed in:

  https://github.com/latchset/pkcs11-provider/pull/293

Thus now we should be able to use the generated key structure
immediately.
2024-01-25 15:37:40 +01:00
Matthijs Mekking 2e9fd6d0c1 Only run pkcs11engine test if pkcs11-provider is available
The bullseye and bookworm images are not set up with pkcs11-provider,
so we need to add an additional prerequisite for running the
pkcs11engine test. Check the path of OPENSSL_CONF.
2024-01-25 15:37:40 +01:00
Matthijs Mekking 62e7cc66d0 Specify key usage to be digital signature
If not set, the created keys allows signing plus decrypt which is bad
practice. Setting the key usage explicitly will generate keys that
allow only signing.
2024-01-25 14:48:07 +01:00
Matthijs Mekking 1e88bb0186 Create keys with PKCS#11 URI instead of object
The pkcs11-provider has changed to take a PKCS#11 URI instead of an
object identifier. Change the BIND 9 code accordingly to pass through
the label instead of just the object identifier.

See: https://github.com/latchset/pkcs11-provider/pull/284
2024-01-25 14:48:07 +01:00
Matthijs Mekking 3dff3eac0a Fix tsan errors
When working internally on the zone, we can access the zone's
variables directly.
2024-01-25 14:48:07 +01:00
Matthijs Mekking 18b566ccea Refactor findzonekeys
Move dns_dnssec_findzonekeys from the dnssec.{c,h} source code to
zone.{c,h} (the header file already commented that this should be done
inside dns_zone_t).

Alter the function in such a way, that keys are searched for in the
key stores if a 'dnssec-policy' (kasp) is attached to the zone,
otherwise keep using the zone's key-directory.
2024-01-25 14:48:07 +01:00
Matthijs Mekking b0f14a604d dnssec-keygen: -K keydir takes priority
When using dnssec-policy with dnssec-keygen in combination with setting
the key-directory on the command line, the commandline argument takes
priority over the key-directory from the default named.conf.
2024-01-25 14:48:07 +01:00
Matthijs Mekking 224a6a6cf8 Add documentation for key-store
Add grammar and statement sections to the ARM. Add a note about
when changing dnssec-policy you should take into account the key
directory paths.
2024-01-25 14:48:07 +01:00
Matthijs Mekking 006bc4e1a7 Add CHANGES and release note for #1129
Newsworthy.
2024-01-25 14:48:06 +01:00
Matthijs Mekking 4b5bba3a99 Test dnssec-policy with multiple key stores
Make sure that if a dnssec-policy uses multiple key stores, the keys
have the right attributes and are stored in their appropriate directory.
2024-01-25 14:47:44 +01:00
Matthijs Mekking 118e545045 Add support for key-store to dnssec-keygen
If the provided policy in the configuration file uses a key-store,
use that to generate the key, instead of 'dst_key_generate()'.
2024-01-25 14:47:43 +01:00
Matthijs Mekking 49b668171a Test key-store with non-default directory
Add a test case where dnssec-policy uses key stores with a directory
other than the zone's key-directory.

This requires changing the kasp shell script to take into account that
keys can be in different directories. When looking for keys, the
'find' command now takes a maxdepth of 3 to also look for keys in
subdirectories. Note this maxdepth value is arbitrary, the added
'keystore.kasp' test only requires a maxdepth of 2.

Because of this change, the dnssec-keygen tests no longer work because
they are for the same zone (although different directories). Change
the test to use a different zone ('kasp2' instead of 'kasp').
2024-01-25 14:47:43 +01:00
Matthijs Mekking 80387532cd Use dst_key's directory when writing key files
When writing key files to disk, use the internally stored directory.

Add an access function 'dst_key_directory()'.

Most calls to keymgr functions no longer need to provide the
key-directory value. Only 'dns_keymgr_run' still needs access to
the zone's key-directory in case the key-store is set to the built-in
key-directory.
2024-01-25 14:47:43 +01:00
Matthijs Mekking 0701a140d3 Add directory to dst_key structure
Store key directory when reading the key from file. This is the
directory it was read from and can be used when saving the key back
to disk.
2024-01-25 14:41:25 +01:00
Matthijs Mekking 9081426313 Refactor findmatchingkeys and keylistfromrdataset
Refactor dns_dnssec_findmatchingkeys and dns_dnssec_keylistfromrdataset
to take into account the key store directories in case the zone is using
dnssec-policy (kasp). Add 'kasp' and 'keystores' parameters.

This requires the keystorelist to be stored inside the zone structure.

The calls to these functions in the DNSSEC tools can use NULL as the
kasp value, as dnssec-signzone does not (yet) support dnssec-policy,
and key collision is checked inside the directory where it is created.
2024-01-25 14:41:25 +01:00
Matthijs Mekking 91f18c98b3 Add tests for key-store with engine_pkcs11
Add cases for each algorithm to test the interaction between
dnssec-policy and engine_pkcs11. Ensure that named creates keys on
startup.

Also test dnssec-keygen when using a dnssec-policy with a PKCS#11
based key-store.
2024-01-25 14:41:25 +01:00
Matthijs Mekking f096472eb4 Create private keys with PKCS#11 object
If there is a keystore configured with a PKCS#11 URI, zones that
are using a dnssec-policy that uses such a keystore should create keys
via the PKCS#11 interface. Those keys are generally stored inside an
HSM.

Some changes to the code are required, to store the engine reference
into the keystore.
2024-01-25 14:41:25 +01:00
Matthijs Mekking d795710541 Add object parameter to dst_key_generate()
Add a parameter to store a possible PKCS#11 object that can later be used to
identify a key with a PKCS#11 URI string (RFC 7512).
2024-01-25 14:41:25 +01:00
Matthijs Mekking ffc41d1b14 Store key store reference instead of name
When creating the kasp structure, instead of storing the name of the
key store on keys, store a reference to the key store object instead.

This requires to build the keystore list prior to creating the kasp
structures, in the dnssec tools, the check code and the server code.

We will create a builtin keystore called "key-directory" which means
use the zone's key-directory as the key store.

The check code changes, because now the keystore is looked up before
creating the kasp structure (and if the keystore is not found, this
is an error). Instead of looking up the keystore after all
'dnssec-policy' clauses have been read.
2024-01-25 14:41:25 +01:00
Matthijs Mekking 155aba5bd5 Fix a checkconf bug
The check for printing zone list failed because of these additional
lines in the output:

good.conf:22: dnssec-policy: key algorithm 13 has predefined length; \
  ignoring length value 256

I am not sure why this failure hasn't happened before already.
2024-01-25 14:41:25 +01:00
Matthijs Mekking 792670c991 Check if key-store directory is not reused
Similar to key-directory, check for zones in different views and
different key and signing policies. Zones must be using different key
directories to store key files on disk.

Now that a key directory can be linked with a dnssec-policy key, the
'keydirexist' checking needs to be reshuffled.

Add tests for bad configuration examples, named-checkconf should catch
those. Also add test cases for a mix of key-directory and key-store
directory.
2024-01-25 14:41:24 +01:00
Matthijs Mekking 22d1fde1a5 Check if key-store directory exists
Similar to key-directory, check if the key-store directory exists and
if it is an actual directory.

This commit fixes an accidental test bug in checkconf where if
the "warn key-dir" test failed, the result was ignored.
2024-01-25 14:38:12 +01:00
Matthijs Mekking 594d4a81f1 Check if key-store exists
Add checkconf check to ensure that the used key-store in the keys
section exists. Error if that is not the case. We also don't allow
the special keyword 'key-directory' as that is internally used to
signal that the zone's key-directory should be used.
2024-01-25 14:38:12 +01:00
Matthijs Mekking f837bb2af8 Parse key-store config
Add the code that actually stores the key-store configuration into
structures, also store the reference into the kasp key.
2024-01-25 14:38:11 +01:00
Matthijs Mekking 3a86c07422 Add code for creating keystore from config
Add code for configuring keystore objects. Add this to the "kaspconf"
code, as it is related to 'dnssec-policy' and it is too small to create
a separate file for it.
2024-01-25 14:38:11 +01:00
Matthijs Mekking 0284482687 Add code to store key-stores
New files to define a structure and functions for dealing with
key-stores.
2024-01-25 14:38:11 +01:00
Matthijs Mekking a035f3b10e Add configuration for key-store
Add new configuration for setting key stores. The new 'key-store'
statement allows users to configure key store backends. These can be
of type 'file' (that works the same as 'key-directory') or of type
'pkcs11'. In the latter case, keys should be stored in a HSM that is
accessible through a PKCS#11 interface.

Keys configured within 'dnssec-policy' can now also use the 'key-store'
option to set a specific key store.

Update the checkconf test to accomodate for the new configuration.
2024-01-25 14:38:11 +01:00
Matthijs Mekking e598fb465f Merge branch '4510-doc-key-lifetime-too-short' into 'main'
Fix ZSK lifetime minimum constraints documentation

Closes #4510

See merge request isc-projects/bind9!8621
2024-01-25 13:30:45 +00:00
Matthijs Mekking 7e903c52be Add CHANGES for #4510 2024-01-25 13:47:45 +01:00
Matthijs Mekking 53f0541db6 Fix ZSK lifetime minimum constraints documentation
The ARM failed to mention that the ZSK lifetime minimum also depends
on the signing delay.
2024-01-25 13:47:27 +01:00
Michal Nowak c92b6fc5b0 Merge branch 'mnowak/pytest_rewrite_dialup' into 'main'
Rewrite dialup system test to pytest

See merge request isc-projects/bind9!8668
2024-01-24 12:54:38 +00:00
Michal Nowak bc4c29888b Rewrite dialup system test to pytest 2024-01-24 13:41:53 +01:00
Michal Nowak 6c6580ea83 Speed up test by lowering "heartbeat-interval" to 1 2024-01-23 19:47:23 +01:00
Mark Andrews 5ce1ff5214 Merge branch '4419-add-the-ability-to-add-the-ul-edns-option-to-update-messages' into 'main'
Resolve "Add the ability to add the UL EDNS option to UPDATE messages"

Closes #4419

See merge request isc-projects/bind9!8469
2024-01-23 01:17:02 +00:00
Mark Andrews 11f2b01f3f Add CHANGES note for [GL #4419] 2024-01-23 10:48:07 +11:00
Mark Andrews ac0cec1338 Add support to set the UL EDNS option in nsupdate
This adds a 'lease' command to nsupdate which sets the UL EDNS
option to the desired values.  The values are visible via show.
2024-01-23 10:47:31 +11:00
Mark Andrews 1b6f70076a Extend dns_message_setopt to clear the opt record
Use NULL to signal that the opt record, if any, set on the
message be removed.
2024-01-23 10:47:31 +11:00
Mark Andrews a8390e8ded check ednsopt UL prints as expected 2024-01-23 10:47:31 +11:00
Mark Andrews 8f0f6d05e9 Add minimal EDNS UL option support
This is defined in draft-ietf-dnssd-update-lease.  This adds the
ability to display the option and teaches dig about the name 'UL'.
2024-01-23 10:47:31 +11:00
Michal Nowak b54bdf8d78 Merge branch 'mnowak/rpz-drop-queryperf-support' into 'main'
Drop queryperf support from rpz system test

See merge request isc-projects/bind9!8649
2024-01-19 11:04:13 +00:00
Michal Nowak eaab796310 Drop queryperf support from rpz system test
The queryperf support in the rpz system test is not utilized in the CI,
is likely not unused at all, and should be dropped.
2024-01-19 11:55:09 +01:00
Mark Andrews a60a259180 Merge branch '4541-values-of-ruletype-field-for-update-policy-statement' into 'main'
Resolve "values of ruletype field for update-policy statement"

Closes #4541

See merge request isc-projects/bind9!8663
2024-01-19 05:18:33 +00:00
Mark Andrews 81f9bcefaf Fix rule count, should be 18 2024-01-19 15:35:54 +11:00
Tom Krizek 64b8ab0845 Merge branch '4445-stop-leaking-queries-to-root-in-tests' into 'main'
Ensure no test queries leak to root server

Closes #4445

See merge request isc-projects/bind9!8521
2024-01-18 16:21:08 +00:00
Tom Krizek f69df830c6 Delete unused config file in dnssec system test 2024-01-18 17:19:39 +01:00
Tom Krizek 088fcf9a61 Ensure tests use mock root server if configured
These tests have ns1 configured as a mock root server. Make sure it is
used in all config files of those tests, otherwise some queries could
leak to root nameservers.
2024-01-18 17:19:39 +01:00
Tom Krizek 8434e5abfc Blackhole queries to root servers in tests
Some tests don't have a mock root server configured, because they don't
need one. However, these tests might still leak queries to actual name
servers. Add a shared root hints file which can serve as a blackhole for
these queries.
2024-01-18 17:19:39 +01:00
Tom Krizek 7037eb96d4 Don't use root server in addzone test 2024-01-18 17:19:37 +01:00
Tom Krizek 19ccf59eeb Merge branch 'tkrizek/split-up-dnsrps-test-cases' into 'main'
Split up the dnsrps and native variants of rpz system tests

See merge request isc-projects/bind9!8420
2024-01-18 15:09:06 +00:00
Tom Krizek b1d71c4d26 Remove obsolete ckdnsrps.sh script
As dnsrps and native test cases have been properly split up, the
ckdnsrps.sh script is no longer used anywhere, as the logic for
selecting these test cases is handled by pytest.
2024-01-18 15:28:28 +01:00
Tom Krizek cb55fb2cae Split up the dnsrps and native variants of rpz system tests
Previously, dnsrps test was executed as an optional part of the rpz and
rpzrecurse system tests. This was conceptually problematic, as the test
took the responsibility of running parts of the test framework -
cleaning files and setting up servers again.

Instead, allow these tests to execute either the native variant, or the
dnsrps one. To ensure the same test coverage, trigger both of these
variants as separate test cases from pytest.
2024-01-18 15:28:28 +01:00
Ondřej Surý 1fb6e5cb97 Merge branch '4404-add-workaround-to-force-jemalloc-linking-order' into 'main'
Add workaround for jemalloc linking order

Closes #4404

See merge request isc-projects/bind9!8609
2024-01-18 09:20:21 +00:00
Ondřej Surý ec12682933 Add CHANGES note for [GL #4404] 2024-01-18 09:35:10 +01:00
Aydın MercanandOndřej Surý 6215206801 Link jemalloc again for testing unit build order 2024-01-18 09:34:36 +01:00
Aydın MercanandOndřej Surý 197de93bdc Forward declare mallocx in isc/mem.h
cmocka.h and jemalloc.h/malloc_np.h has conflicting macro definitions.
While fixing them with push_macro for only malloc is done below, we only
need the non-standard mallocx interface which is easy to just define by
ourselves.
2024-01-18 09:34:36 +01:00
Ondřej Surý 41a0ee1071 Add workaround for jemalloc linking order
Because we don't use jemalloc functions directly, but only via the
libisc library, the dynamic linker might pull the jemalloc library
too late when memory has been already allocated via standard libc
allocator.

Add a workaround round isc_mem_create() that makes the dynamic linker
to pull jemalloc earlier than libc.
2024-01-18 09:34:36 +01:00
Artem Boldariev 2ff908026d Merge branch '4527-improve-tls-framing-for-dot' into 'main'
TLS: improve framing by assembling DNS message in one buffer

Closes #4527

See merge request isc-projects/bind9!8646
2024-01-17 16:32:34 +00:00
Artem Boldariev 20d5a805e2 TLS: improve framing by assembling DNS message in one buffer
This commit improves TLS messages framing by avoiding an extra call to
SSL_write_ex(). Before that we would use an extra SSL_write_ex() call
to pass DNS message length to OpenSSL. That could create an extra TLS
frame, increasing number of bytes sent due to frame header and
padding.

This commit fixes that by making the code pass both DNS message length
and data at once, just like old TLS code did.

It should improve compatibility with some buggy clients that expect
both DNS message length and data to be in one TLS frame.

Older TLS DNS code worked like this, too.
2024-01-17 17:09:41 +02:00
Aydın Mercan 5670d8e11c Merge branch '4425-current-level-of-tcp-clients-missing-from-statistics-channel' into 'main'
Expose the TCP client count in statistics channel

Closes #4425

See merge request isc-projects/bind9!8616
2024-01-17 08:45:11 +00:00
Aydın Mercan cc2713700a Add CHANGES and release note for [GL #4425] 2024-01-17 11:11:12 +03:00
Aydın Mercan 2690dc48d3 Expose the TCP client count in statistics channel
The statistics channel does not expose the current number of TCP clients
connected, only the highwater. Therefore, users did not have an easy
means to collect statistics about TCP clients served over time. This
information could only be measured as a seperate mechanism via rndc by
looking at the TCP quota filled.

In order to expose the exact current count of connected TCP clients
(tracked by the "tcp-clients" quota) as a statistics counter, an
extra, dedicated Network Manager callback would need to be
implemented for that purpose (a counterpart of ns__client_tcpconn()
that would be run when a TCP connection is torn down), which is
inefficient. Instead, track the number of currently-connected TCP
clients separately for IPv4 and IPv6, as Network Manager statistics.
2024-01-17 11:11:12 +03:00
Artem Boldariev 8ce0956117 Merge branch '4536-remove-wrong-INSIST-fix-cipher-suites-test' into 'main'
TCP: remove wrong INSIST(csock->recv_cb != NULL), disable the "cipher-suites" test in FIPS mode

Closes #4536

See merge request isc-projects/bind9!8655
2024-01-16 13:44:00 +00:00
Artem Boldariev dbcdd868f9 Skipping portions of cipher-suites test in FIPS mode
We need to skip some portions the system test in FIPS mode as some of
the algorithms used in the test are not available when using the FIPS
mode (e.g. TLS_CHACHA20_POLY1305_SHA256)
2024-01-16 15:01:39 +02:00
Artem Boldariev dffb11f2c0 TCP: remove wrong INSIST(csock->recv_cb != NULL)
This commit removes wrong INSIST() condition as the assumption that if
'csock->recv_cb != NULL' iff 'csock->statichandle != NULL' is wrong.

There is no direct relation between 'csock->statichandle' and
'csock->recv_cb', as 'csock->statichandle' gets set when allocating a
handle regardless of 'csock->recv_cb' not being NULL, as it is
possible to attach to the handle without starting a read operation (at
the very least, it is correct to start writing before reading).

That condition made `cipher-suites` system test fail with crash on
some platforms in FIPS mode (namely, Oracle Linux 9) despite not being
related to FIPS at all.
2024-01-16 15:01:26 +02:00
Michał Kępień 84e7e5d5df Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.22' into 'main'
Set up version and release notes for BIND 9.19.22

See merge request isc-projects/bind9!8651
2024-01-15 14:41:19 +00:00
Michał Kępień c5eae03d0c Reduce duplication between checklists 2024-01-15 15:39:46 +01:00
Michał Kępień a298880d8f Account for February 2024 releases in CHANGES 2024-01-15 15:39:46 +01:00
Michał Kępień 69ca33314e Set up release notes for BIND 9.19.22 2024-01-15 15:39:46 +01:00
Michał Kępień 055802e77e Update BIND version to 9.19.22-dev 2024-01-15 15:39:46 +01:00
Artem Boldariev 4245e8e72a Merge branch '4528-honor-listen-on-changes-logic-fixup' into 'main'
Fix flawed logic when detecting same listener type

See merge request isc-projects/bind9!8648
2024-01-15 10:25:16 +00:00
Artem Boldariev 8ae661048d Fix flawed logic when detecting same listener type
The older version of the code was reporting that listeners are going
to be of the same type after reconfiguration when switching from DoT
to HTTPS listener, making BIND abort its executions.

That was happening due to the flaw in logic due to which the code
could consider a current listener and a configuration for the new one
to be of the same type (DoT) even when the new listener entry is
explicitly marked as HTTP.

The checks for PROXY in between the configuration were masking that
behaviour, but when porting it to 9.18 (when there is no PROXY
support), the behaviour was exposed.

Now the code mirrors the logic in 'interface_setup()' closely (as it
was meant to).
2024-01-12 17:59:53 +02:00
Mark Andrews 1f9f8fc568 Merge branch '4520-log-message-in-lib-ns-update-c-needs-updating' into 'main'
Resolve "Log message in lib/ns/update.c needs updating"

Closes #4520

See merge request isc-projects/bind9!8622
2024-01-12 14:53:39 +00:00
Mark Andrews 2cf6cf967d Report the type being filtered from an UPDATE
When processing UPDATE request DNSKEY, CDNSKEY and CDS record that
are managed by named are filtered out.  The log message has been
updated to report the actual type rather that just DNSKEY.
2024-01-12 14:06:58 +00:00
Artem Boldariev b75ba71f33 Merge branch '4528-honor-listen-on-changes' into 'main'
Recreate listeners on DNS transport change when editing listen-on statements before reconfiguration

Closes #4528 and #4518

See merge request isc-projects/bind9!8644
2024-01-12 13:48:39 +00:00
Artem Boldariev ad5378fad7 Update release notes [GL #4518] [GL #4528]
Mentioned that all changes to listen-on statements are now applied on
reconfiguration.
2024-01-12 14:56:14 +02:00
Artem Boldariev d1a2ad0f44 Update CHANGES [GL #4518] [GL #4528]
Mentioned that all changes to listen-on statements are now applied on
reconfiguration.
2024-01-12 14:56:00 +02:00
Artem Boldariev 211f12ff85 Add a system test to verify listener transport change functionality
This commit adds a system test that helps to verify that changing a
listener transport by editing "listen-on" statements before
reconfiguration works as expected.
2024-01-12 14:55:12 +02:00
Artem Boldariev d59cf5e0ce Recreate listeners on DNS transport change
This commit ensures that listeners are recreated on reconfiguration in
the case when their type changes (or when PROXY protocol type changes,
too).

Previously, if a "listen-on" statement was modified to represent a
different transport, BIND would not pick-up the change on
reconfiguration if listener type changes (e.g. DoH -> DoT) for a given
interface address and port combination. This commit fixes that by
recreating the listener.

Initially, that worked for most of the new transports as we would
recreate listeners on each reconfiguration for DoH and DoT. But at
some point we changed that in such a way that listeners were not
recreated to avoid rebinding a port as on some platforms only root can
do that for port numbers <1000, making some ports binding possible
only on start-up. We chose to asynchronously update listener socket
settings (like TLS contexts, HTTP settings) instead.

Now, we both avoid recreating the sockets if unnecessary and recreate
listeners when listener type changes.
2024-01-12 14:55:12 +02:00
Artem Boldariev fa2b8b0adf Merge branch '3504-tls-cipher-suites' into 'main'
Add "cipher-suites" option to the "tls" block

Closes #3504

See merge request isc-projects/bind9!8576
2024-01-12 12:35:21 +00:00
Artem Boldariev 59a57451e6 Update the release notes [GL #3504]
Mention that the 'tls' block was extended with a new 'cipher-suites'
option.
2024-01-12 13:29:14 +02:00
Artem Boldariev ac55d818c2 Update CHANGES [GL #3504]
Mention that the 'tls' block was extended with a new 'cipher-suites'
option.
2024-01-12 13:28:53 +02:00
Artem Boldariev 0867e2ea30 Update the options reference to document 'cipher-suites'
This commit documents the new 'cipher-suites' options of the 'tls'
statement.
2024-01-12 13:27:59 +02:00
Artem Boldariev 3b2b170c0e Update the documentation for the 'ciphers' option
We need to mention that the 'ciphers' option works only for TLSv1.2
because that is known to cause confusion for some of our users.
2024-01-12 13:27:59 +02:00
Artem Boldariev ed546007c9 Add TLS 'cipher-suites' checkconf test
This commit adds a set of valid and invalid configuration files
samples that use the new 'cipher-suites' option of the 'tls'
statement.
2024-01-12 13:27:59 +02:00
Artem Boldariev 53f53e9b02 Add a 'cipher-suites' option system test
This commit adds a new system test which verifies that using the
'cipher-suites' option actually works as expected (as well as adds
first TLSv1.3 specific tests).
2024-01-12 13:27:59 +02:00
Artem Boldariev eb924e460b Integrate TLS cipher suites support into BIND
This commit makes BIND use the new 'cipher-suites' option from the
'tls' statement.
2024-01-12 13:27:59 +02:00
Artem Boldariev 3818c58bf6 Add TLS cipher suites configuration option to BIND
This commit extends the 'tls' statement with 'cipher-suites' option.
2024-01-12 13:27:59 +02:00
Artem Boldariev 9d052522a0 Add TLS cipher-suites related low-level functionality
This commits adds low-level wrappers on top of
'SSL_CTX_set_ciphersuites()'. These are going to be a foundation
behind the 'cipher-suites' option of the 'tls' statement.
2024-01-12 13:27:59 +02:00
Arаm Sаrgsyаn a6fb918454 Merge branch '4508-crash-in-host' into 'main'
Fix a possible dig/host crash in "NS search" mode

Closes #4508

See merge request isc-projects/bind9!8635
2024-01-11 09:54:01 +00:00
Aram SargsyanandMark Andrews 1246d982a2 Add a CHANGES note for [GL #4508] 2024-01-10 21:54:39 +00:00
Aram SargsyanandMark Andrews 913b20abf8 Print a dig comment about the failed query consistently
Dig failed to print a comment about the reason of the unacceptable
query reply got from a server when there was no other query to
start in the lookup's chain.

Add an "else" block to print out the comment even when not starting
up the next query.
2024-01-10 21:54:39 +00:00
Aram SargsyanandMark Andrews f6658b333e Fix a possible dig/host crash in "NS search" mode
When getting a SERVFAIL reply from a query, 'host' tries to start
the next query in the lookup's list (also true for 'dig  +nofail').
However, when running with the '-C' switch (or +nssearch for 'dig'),
all the queries in the lookup start from the beginning, so that logic
brings to a crash because of the attempted start of the query which
was already started.

Don't start the next query in the affected code path when in +nssearch
mode.
2024-01-10 21:54:39 +00:00
Mark Andrews 31b1f3c3bc Merge branch '4501-defer-control-channel-message-invalidation' into 'main'
Defer control channel message invalidation

Closes #4501

See merge request isc-projects/bind9!8641
2024-01-10 21:52:03 +00:00
Mark AndrewsandMichał Kępień d5103b742b Defer control channel message invalidation
The conn_shutdown() function is called whenever a control channel
connection is supposed to be closed, e.g. after a response to the client
is sent or when named is being shut down.  That function calls
isccc_ccmsg_invalidate(), which resets the magic number in the structure
holding the messages exchanged over a given control channel connection
(isccc_ccmsg_t).  The expectation here is that all operations related to
the given control channel connection will have been completed by the
time the connection needs to be shut down.

However, if named shutdown is initiated while a control channel message
is still in flight, some netmgr callbacks might still be pending when
conn_shutdown() is called and isccc_ccmsg_t invalidated.  This causes
the REQUIRE assertion checking the magic number in ccmsg_senddone() to
fail when the latter function is eventually called, resulting in a
crash.

Fix by splitting up isccc_ccmsg_invalidate() into two separate
functions:

  - isccc_ccmsg_disconnect(), which initiates TCP connection shutdown,
  - isccc_ccmsg_invalidate(), which cleans up magic number and buffer,

and then:

  - replacing all existing uses of isccc_ccmsg_invalidate() with calls
    to isccc_ccmsg_disconnect(),

  - only calling isccc_ccmsg_invalidate() when all netmgr callbacks are
    guaranteed to have been run.

Adjust function comments accordingly.
2024-01-10 15:48:25 +01:00
Tom Krizek 57166cd3b7 Merge branch '3535-fetchlimit-test-flaky' into 'main'
Allow the fetchlimit test to be re-run

Closes #3535

See merge request isc-projects/bind9!8612
2024-01-10 14:44:05 +00:00
Tom Krizek 10827fe96c Allow the fetchlimit test to be re-run
The test is known to be unstable due to timing issues. Prevent frequent
false positives by allowing the test to be re-run by the flaky pytest
plugin.
2024-01-10 14:57:20 +01:00
Tom Krizek a65b654a23 Don't type-check the flaky plugin with mypy
Since we execute mypy for bin/tests/system/isctest package, this is now
needed because the flaky package doesn't have type hints.
2024-01-10 14:57:20 +01:00
Tom Krizek f314f1b432 Move custom pytest markers into isctest module
Keep our pytest code more organized by moving the shared code for custom
pytest markers into a dedicated isctest/mark.py module.
2024-01-10 14:57:13 +01:00
Tom Krizek d87da207fb Merge branch 'tkrizek/nsupdate-test-flaky-on-freebsd' into 'main'
Allow nsupdate test rerun on FreeBSD

See merge request isc-projects/bind9!8638
2024-01-10 13:43:08 +00:00
Tom Krizek 124882476b Allow nsupdate test rerun on FreeBSD
The "exceeded time limit waiting for literal 'too many DNS UPDATEs
queued' in ns1/named.run" is prone to fail due to a timing issue.
Despite out efforts to stabilize it, the check still often fails on
FreeBSD in our CI. Allow the test to be re-run on this platform.
2024-01-10 13:18:04 +01:00
Mark Andrews f737ca0542 Merge branch '4522-dig-in-9-19-19-accept-weird-source-and-destination-ports-within-the-proxy-statement' into 'main'
Resolve "Dig in 9.19.19 accept weird source- and destination-ports within the "proxy"-statement"

Closes #4522

See merge request isc-projects/bind9!8626
2024-01-10 00:05:24 +00:00
Mark Andrews bb75676f90 Error if proxy ports are too big 2024-01-09 23:27:45 +00:00
Arаm Sаrgsyаn c60fad36dc Merge branch 'aram/tests-dighost-fix-intermittent-failure' into 'main'
Make digdelv test work in different network envs (continued)

See merge request isc-projects/bind9!8636
2024-01-09 14:33:22 +00:00
Aram Sargsyan 96f63a9f0b Make digdelv test work in different network envs (continued)
This commit complements the 1e7d832342
commit.
2024-01-09 13:40:38 +00:00
Tom Krizek 741de8ef6d Merge branch 'tkrizek/xfer-test-dnssec-validation-no' into 'main'
Add missing dnssec-validation to ns4 in xfer test

See merge request isc-projects/bind9!8630
2024-01-08 18:49:17 +00:00
Tom Krizek 68234372a5 Add missing dnssec-validation to ns4 in xfer test
This file was missing explicit dnssec-validation. Seems like it was
missed in our previous efforts, probably because of the different
filename / extension. Rename it to end with *.in to reflect that it is a
template file used by copy_setports.
2024-01-08 18:43:45 +01:00
Tom Krizek 98b55bb85e Merge branch '4521-timeout-in-dig-not-handled-in-rndc-system-test' into 'main'
Resolve "Timeout in dig not handled in system tests"

Closes #4521

See merge request isc-projects/bind9!8623
2024-01-08 17:39:03 +00:00
Tom Krizek 7b77574b6d Handle dig timing out gracefully in upforwd 2024-01-08 17:03:36 +01:00
Tom Krizek cc7c4760aa Handle dig timing out gracefully in staticstub 2024-01-08 17:03:36 +01:00
Tom Krizek 2341934f7d Handle dig timing out gracefully in sortlist 2024-01-08 17:03:36 +01:00
Tom Krizek 99799fba60 Handle dig timing out gracefully in rpz 2024-01-08 17:03:36 +01:00
Tom Krizek de569ad97a Handle dig timing out gracefully in rootkeysentinel 2024-01-08 17:03:36 +01:00
Tom Krizek 606985d775 Handle dig timing out gracefully in qmin 2024-01-08 17:03:35 +01:00
Tom Krizek c983449e5e Handle dig timing out gracefully in padding 2024-01-08 17:03:35 +01:00
Tom Krizek 3c7291248c Handle dig timing out gracefully in nsupdate 2024-01-08 17:03:35 +01:00
Tom Krizek 410aa5aeab Handle dig timing out gracefully in names 2024-01-08 17:03:35 +01:00
Tom Krizek 0bf25138b6 Handle dig timing out gracefully in masterfile 2024-01-08 17:03:35 +01:00
Tom Krizek 8ece026848 Handle dig timing out gracefully in logfileconfig 2024-01-08 17:03:34 +01:00
Tom Krizek 2cc90a815e Handle dig timing out gracefully in legacy 2024-01-08 17:03:34 +01:00
Tom Krizek c6b267ce4d Handle dig timing out gracefully in keepalive 2024-01-08 17:03:34 +01:00
Tom Krizek fcce010045 Handle dig timing out gracefully in dnstap 2024-01-08 17:03:34 +01:00
Tom Krizek 343b3f0f84 Handle dig timing out gracefully in cookie 2024-01-08 17:03:33 +01:00
Tom Krizek 445ec7cc0f Handle dig timing out gracefully in autosign 2024-01-08 17:03:33 +01:00
Tom Krizek ddb41798d5 Handle dig timing out gracefully in auth 2024-01-08 17:03:33 +01:00
Tom Krizek 0d5df1fc02 Handle dig timing out gracefully in allow-query 2024-01-08 17:03:33 +01:00
Mark AndrewsandTom Krizek 4351076d48 Handle dig timing out gracefully in serve-stale 2024-01-08 17:03:32 +01:00
Mark AndrewsandTom Krizek 02d9f2eeb9 Handle dig timing out gracefully in rndc 2024-01-08 17:03:31 +01:00
Michal Nowak cf56a27fbf Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.19.21' into 'main'
Set up version and release notes for BIND 9.19.21

See merge request isc-projects/bind9!8627
2024-01-08 11:57:10 +00:00
Michal Nowak 1c7159c94e Set up release notes for BIND 9.19.21 2024-01-08 12:40:52 +01:00
Michal Nowak 168438c215 Update BIND version to 9.19.21-dev 2024-01-08 12:40:52 +01:00
Michal Nowak aca85323d6 Update BIND version for release 2024-01-05 14:20:36 +01:00
Michal Nowak b0b4a6f58c Add a CHANGES marker 2024-01-05 14:19:30 +01:00
Michal Nowak ed19836ecf Merge branch 'michal/prepare-documentation-for-bind-9.19.20' into 'v9.19.20-release'
Prepare documentation for BIND 9.19.20

See merge request isc-private/bind9!624
2024-01-05 13:17:42 +00:00
Michał Kępień 0fec404c64 Fix Danger rules for flagging release note issues
The logic contained in dangerfile.py incorrectly warns about missing
release note changes for merge requests preparing release documentation
as such merge requests rename files in the doc/notes/ directory.  This
(correctly) causes these files to be passed to dangerfile.py via
danger.git.created_files and danger.git.deleted_files rather than via
danger.git.modified_files, which in turn causes the logic checking the
use of the "Release Notes" label to assume that no release notes are
added, removed, or modified by a given merge request.

Fix by considering all types of file changes (modifications, additions,
and removals - which also covers file renaming) when checking whether a
given merge request modifies release notes.  Update the warning messages
accordingly.

However, when trying to find release notes added by a given merge
request, deleted files must not be considered.  Tweak the logic looking
for GitLab identifiers in the release notes added by a given merge
request so that it only scans modified and added (or renamed) files.
2024-01-05 12:51:13 +01:00
Michał Kępień 1708fe24b4 Tweak and reword release notes 2024-01-05 12:51:13 +01:00
Michał Kępień 8cad2c5923 Prepare release notes for BIND 9.19.20 2024-01-05 12:51:13 +01:00
Michał Kępień 07dce62da4 Merge branch '4383-limit-tree-pruning-overhead' into 'v9.19.20-release'
Limit isc_async_run() overhead for tree pruning

See merge request isc-private/bind9!619
2024-01-05 11:39:08 +00:00
Michał Kępień 04df558d57 Add CHANGES entry for GL #4383 2024-01-05 12:33:14 +01:00
Michał Kępień 24381cc36d Limit isc_async_run() overhead for tree pruning
Instead of issuing a separate isc_async_run() call for every RBTDB node
that triggers tree pruning, maintain a list of nodes from which tree
pruning can be started from and only issue an isc_async_run() call if
pruning has not yet been triggered by another RBTDB node.

In some older BIND 9 branches, the extra queuing overhead eliminated by
this change could be remotely exploited to cause excessive memory use.
Due to architectural shift, this branch is not vulnerable to that issue,
but applying the fix to the latter is nevertheless deemed prudent for
consistency and to make the code future-proof.
2024-01-05 12:33:14 +01:00
Michał Kępień cddf3b267b Merge branch '4334-confidential-dns64-and-serve-stale' into 'v9.19.20-release'
[CVE-2023-5679] Fix a bad interaction between DNS64 and serve-stale

See merge request isc-private/bind9!588
2024-01-05 11:22:24 +00:00
Mark AndrewsandMichał Kępień c4faf5c69f Add release note for [GL #4334] 2024-01-05 12:17:00 +01:00
Mark AndrewsandMichał Kępień 26671f8c47 Add CHANGES note for [GL #4334] 2024-01-05 12:17:00 +01:00
Mark AndrewsandMichał Kępień 1fcc483df1 Restore dns64 state during serve-stale processing
If we are in the process of looking for the A records as part of
dns64 processing and the server-stale timeout triggers, redo the
dns64 changes that had been made to the orignal qctx.
2024-01-05 12:17:00 +01:00
Michał Kępień 9fbafe83d2 Merge branch '4281-confidential-redirect-rfc1918-check-failure' into 'v9.19.20-release'
[CVE-2023-5517] Fix handling of RFC 1918 reverse queries with "nxdomain-redirect" enabled

See merge request isc-private/bind9!584
2024-01-05 11:09:29 +00:00
Mark AndrewsandMichał Kępień 2fbafc2675 Add release note for [GL #4281] 2024-01-05 12:01:28 +01:00
Mark AndrewsandMichał Kępień 0748965b7c Add CHANGES note for [GL #4281] 2024-01-05 12:01:28 +01:00
Mark AndrewsandMichał Kępień 9d0fa07c5e Save the correct result value to resume with nxdomain-redirect
The wrong result value was being saved for resumption with
nxdomain-redirect when performing the fetch.  This lead to an assert
when checking that RFC 1918 reverse queries where not leaking to
the global internet.
2024-01-05 12:01:28 +01:00
Michał Kępień 720e737de4 Merge branch '4234-confidential-use-hashmap-when-parsing' into 'v9.19.20-release'
[CVE-2023-4408] Use hashmap when parsing DNS messages

See merge request isc-private/bind9!560
2024-01-05 10:43:31 +00:00
Ondřej SurýandMichał Kępień 30d27928cf Add CHANGES and release note for [GL #4234] 2024-01-05 11:35:25 +01:00
Ondřej SurýandMichał Kępień b8a9631754 Use hashmap when parsing a message
When parsing messages use a hashmap instead of a linear search to reduce
the amount of work done in findname when there's more than one name in
the section.

There are two hashmaps:

1) hashmap for owner names - that's constructed for each section when we
hit the second name in the section and destroyed right after parsing
that section;

2) per-name hashmap - for each name in the section, we construct a new
hashmap for that name if there are more than one rdataset for that
particular name.
2024-01-05 11:35:25 +01:00
Michał Kępień e087391a96 Merge branch '4182-confidential-fix-races-in-dns-tsigkey-find' into 'v9.19.20-release'
Address races in dns_tsigkey_find()

See merge request isc-private/bind9!548
2024-01-05 10:18:28 +00:00
Mark AndrewsandMichał Kępień a62cda787f Add CHANGES note for [GL #4182] 2024-01-05 11:16:12 +01:00
Mark AndrewsandMichał Kępień d2ba96488e Address races in dns_tsigkey_find()
1) Restart the process with a write lock if we discover an expired key
while holding the read lock.

2) Move incrementing the key reference inside the lock block of code.
2024-01-05 11:16:12 +01:00
Michał Kępień 9074bfa38d Merge branch 'michal/add-placeholder-entries-to-CHANGES' into 'main'
Add placeholder entries to CHANGES

See merge request isc-projects/bind9!8625
2024-01-05 09:05:44 +00:00
Michał Kępień 82ecaabb12 Add placeholder entries to CHANGES
Add placeholders for the following issues:

  - [GL #4182]
  - [GL #4234]
  - [GL #4281]
  - [GL #4334]
  - [GL #4356]
  - [GL #4383]
2024-01-05 09:22:39 +01:00
Aydın Mercan e112d0775e Merge branch 'aydin/isc_header_atomic_fix' into 'main'
Use and check for <isc/atomic.h> instead of <stdatomic.h> directly

See merge request isc-projects/bind9!8582
2024-01-03 17:47:53 +00:00
Aydın Mercan ca9a05f9ce Check for atomic operations consistency in checklibs.sh
isc/atomic.h and its defined macros should be preferred over
stdatomic.h and explicit atomic operations.

Fix the redundant stdatomic.h header in histo.c found by the introduced
check.
2024-01-03 17:04:31 +00:00
Aydın Mercan 294329da3a Use <isc/atomic.h> instead of <stdatomic.h> directly in <isc/types.h> 2024-01-03 17:04:31 +00:00
Mark Andrews 7d170900bf Merge branch '4466-cds-is-stuck-on-an-old-key' into 'main'
Resolve "CDS is stuck on an old key."

Closes #4466

See merge request isc-projects/bind9!8565
2024-01-03 01:47:52 +00:00
Mark Andrews 531420bac0 Add CHANGES note for [GL #4466] 2024-01-03 12:09:12 +11:00
Mark Andrews 882b1a4449 Set the DNSKEY TTLs to match the dnssec policy
This prevents the DNSKEY records being updated and the statistics
not matching as a consequence
2024-01-03 12:09:12 +11:00
Mark Andrews 7a6570a911 Create keys with TTLs that match the policies TTL 2024-01-03 12:09:12 +11:00
Mark Andrews 16a720357b Make $TTL match dnskey-ttl 2024-01-03 12:09:11 +11:00
Matthijs MekkingandMark Andrews b770740b44 Write new DNSKEY TTL to key file
When the current DNSKEY TTL does not match the one from the policy,
write the new TTL to disk.
2024-01-03 12:09:11 +11:00
Mark Andrews 27e74b2e4b Only create private records for DNSKEYs that have changed
We don't need to create private records for DNSKEY records that
have only had their TTL's changed.
2024-01-03 12:09:11 +11:00
Mark Andrews d601a90ea3 sync_secure_db failed to handle some TTL changes
If the DNSKEY, CDNSKEY or CDS RRset had different TTLs then the
filtering of these RRset resulted in dns_diff_apply failing with
"not exact". Identify tuple pairs that are just TTL changes and
allow them through the filter.
2024-01-03 12:09:11 +11:00
Mark Andrews 21be35c54e Use the current CDS and CDNSKEY TTLs
When adding new CDS and CDNSKEY records use the existing RRset
TTL if they already exist.
2024-01-03 12:09:11 +11:00
Mark Andrews dcb7799061 Update the DNSKEY, CDNSKEY and CDS TTLs to match dnskey-ttl
If the TTLs of the DNSKEY, CDNSKEY and CDS do not match the
dnskey-ttl update them by removing all records and re-adding
them with the correct TTL.
2024-01-03 12:09:11 +11:00
Mark Andrews f894bf661f Test dnssec-policy dnskey-ttl behaviour
If the dnskey-ttl in the dnssec-policy doesn't match the DNSKEY's
ttl then the DNSKEY, CDNSKEY and CDS rrset should be updated by
named to reflect the expressed policy.  Check that named does this
by creating a zone with a TTL that does not match the policy's TTL
and check that it is correctly updated.
2024-01-03 12:09:11 +11:00
Mark Andrews 3fdf35bb2a Merge branch '4513-system-tests-fail-with-net-dns-1-42' into 'main'
Resolve "System tests fail with Net::DNS 1.42"

Closes #4513

See merge request isc-projects/bind9!8615
2024-01-03 00:07:07 +00:00
Mark Andrews c2c59dea60 Support Net::DNS::Nameserver 1.42
In Net::DNS 1.42 $ns->main_loop no longer loops.  Use current methods
for starting the server, wait for SIGTERM then cleanup child processes
using $ns->stop_server(), then remove the pid file.
2024-01-03 09:21:15 +11:00
Michał Kępień f0e17a92a3 Merge branch 'michal/silence-a-scan-build-warning-in-dns_rbt_addname' into 'main'
Silence a scan-build warning in dns_rbt_addname()

See merge request isc-projects/bind9!8614
2024-01-02 13:51:18 +00:00
Michał Kępień 9cf1f39b54 Silence a scan-build warning in dns_rbt_addname()
Clang Static Analyzer is unable to grasp that when dns_rbt_addnode()
returns ISC_R_EXISTS, it always sets the pointer passed to it via its
'nodep' parameter to a non-NULL value.  Add an extra safety check in the
conditional expression used in dns_rbt_addname() to silence that
warning.
2023-12-22 19:27:37 +01:00
Michal Nowak 1f78f3a586 Merge branch 'mnowak/pytest_rewrite_spf' into 'main'
Rewrite spf system test to pytest

See merge request isc-projects/bind9!8572
2023-12-22 15:07:13 +00:00
Michal NowakandMichał Kępień e67d770432 Rewrite spf system test to pytest 2023-12-22 15:02:58 +01:00
Michał Kępień 662a88055c Add wait_for_zones_loaded fixture
The wait_for_zones_loaded fixture waits for the "all zones loaded"
message in the named log file before the test function can proceed.
2023-12-22 15:02:58 +01:00
Michał Kępień 1770b37095 Ensure wait_for_line() is not called with timeout=0 2023-12-22 15:02:58 +01:00
Michał Kępień 831c5d34f9 Refactor string matching loop for readability 2023-12-22 15:02:58 +01:00
Tom KrizekandMichał Kępień 05b0ebac0f Add LogFile helper
LogFile class contains a log path and has means to find a string in the
log file.
2023-12-22 15:02:58 +01:00
Štěpán Balážik 46b7cc2ed2 Merge branch 'stepan/rndc-fixtures-for-pytest' into 'main'
Implement Python helpers for using RNDC in tests

See merge request isc-projects/bind9!8357
2023-12-21 19:33:43 +00:00
Michał KępieńandŠtěpán Balážik fdc45c70e8 Add reconfiguration support to NamedInstance
Reconfiguring named using RNDC is a common action in BIND 9 system
tests.  It involves sending the "reconfig" RNDC command to a named
instance and waiting until it is fully processed.  Add a reconfigure()
method to the NamedInstance class in order to simplify and standardize
named reconfiguration using RNDC in Python-based system tests.

TODO:

  - full reconfiguration support (w/templating *.in files)

  - add an "rndc null" before every reconfiguration to show which file
    is used (NamedInstance.add_mark_to_log() as it may be generically
    useful?)
2023-12-21 18:10:15 +00:00
Michał KępieńandŠtěpán Balážik 989d22473d Run mypy checks on Python helpers in GitLab CI
Ensure the type hints provided in helper code for Python-based system
tests are correct by continuously checking them using mypy in GitLab CI.
Check bin/tests/system/isctest.py exclusively for the time being because
it is the only Python file in the source tree which uses static typing
at the moment and working around the issues reported by mypy for other
(non-statically-typed) Python files present in the source tree would be
cumbersome.
2023-12-21 18:10:15 +00:00
Michał KępieńandŠtěpán Balážik aa31a872d0 Clean up the "checkds" system test
The "checkds" system test contains a lot of duplicated code despite
carrying out the same set of actions for every tested scenario
(zone_check() → wait for logs to appear → keystate_check()).  Extract
the parts of the code shared between all tests into a new function,
test_checkds(), and use pytest's test parametrization capabilities to
pass distinct sets of test parameters to this new function, in an
attempt to cleanly separate the fixed parts of this system test from the
variable ones.  Replace format() calls with f-strings.
2023-12-21 18:10:15 +00:00
Michał KępieńandŠtěpán Balážik cf338a7ca3 Drop use of dns.resolver.Resolver from "checkds"
The "checkds" system test only uses dns.resolver.Resolver objects to
access their 'nameservers' and 'port' attributes.  Instances of the
NamedInstance class also expose that information via their attributes,
so only pass NamedInstance objects around instead of needlessly
depending on dns.resolver.Resolver.
2023-12-21 18:10:15 +00:00
Michał KępieńandŠtěpán Balážik 2c35b839a5 Use helper Python classes for watching log files
Make log file watching in Python-based system tests consistent by
employing the helper Python classes designed for that purpose.  Drop the
custom code currently used.
2023-12-21 18:10:15 +00:00
Michał KępieńandŠtěpán Balážik bf92f33f94 Add helper Python classes for watching log files
Waiting for a specific log line to appear in a named.run file is a
common action in BIND 9 system tests.  Implement a set of Python classes
which intend to simplify and standardize this task in Python-based
system tests.

Co-authored-by: Štěpán Balážik <stepan@isc.org>
2023-12-21 18:10:15 +00:00
Michał KępieńandŠtěpán Balážik 00003e497c Simplify use of RNDC in Python-based tests
The "addzone" and "shutdown" system tests currently invoke rndc using
test-specific helper code.  Rework the relevant bits of those tests so
that they use the helper classes from bin/tests/system/isctest.py.
2023-12-21 18:10:15 +00:00
Michał KępieńandŠtěpán Balážik c38c29e84d Implement Python helpers for using RNDC in tests
Controlling named instances using RNDC is a common action in BIND 9
system tests.  However, there is currently no standardized way of doing
that from Python-based system tests, which leads to code duplication.
Add a set of Python classes and pytest fixtures which intend to simplify
and standardize use of RNDC in Python-based system tests.

For now, RNDC commands are sent to servers by invoking the rndc binary.
However, a switch to a native Python module able to send RNDC commands
without executing external binaries is expected to happen soon.  Even
when that happens, though, having the capability to invoke the rndc
binary (in order to test it) will remain useful.  Define a common Python
interface that such "RNDC executors" should implement (RNDCExecutor), in
order to make switching between them convenient.

Co-authored-by: Štěpán Balážik <stepan@isc.org>
2023-12-21 18:10:15 +00:00
Evan Hunt e997a738d6 Merge branch 'each-broken-qpiter' into 'main'
more fix_iterator() bugs

See merge request isc-projects/bind9!8606
2023-12-21 17:57:47 +00:00
Evan Hunt ea9a8cb392 prevent an infinite loop in fix_iterator()
it was possible for fix_iterator() to get stuck in a loop while
trying to find the predecessor of a missing node. this has been
fixed and a regression test has been added.
2023-12-21 09:18:30 -08:00
Evan Hunt 84f79cd164 fix_iterator() could produce incoherent iterator stacks
the fix_iterator() function moves an iterator so that it points
to the predecessor of the searched-for name when that name doesn't
exist in the database. the tests only checked the correctness of
the top of the stack, however, and missed some cases where interior
branches in the stack could be missing or duplicated. in these
cases, the iterator would produce inconsistent results when walked.

the predecessors test case in qp_test has been updated to walk
each iterator to the end and ensure that the expected number of
nodes are found.
2023-12-21 09:18:30 -08:00
Mark Andrews 93cc89e4d3 Merge branch '4495-conversion-from-nsec3-to-nsec-removes-the-nsec3param-too-early' into 'main'
Resolve "Conversion from NSEC3 to NSEC removes the NSEC3PARAM too early"

Closes #4495 and #1794

See merge request isc-projects/bind9!8578
2023-12-21 10:00:15 +00:00
Mark Andrews 9b5ed853d0 Add CHANGES for [GL #1794] and [GL #4459] 2023-12-21 20:12:51 +11:00
Matthijs MekkingandMark Andrews 1d6b892e04 Regression check for NSEC3 to NSEC3 conversion
When changing the NSEC3 chain, the new NSEC3 chain must be built before
the old NSEC3PARAM is removed.  Check each delta in the conversion to
ensure this ordering is met.
2023-12-21 20:12:09 +11:00
Mark Andrews 7d90c056b0 Regression check for NSEC3 to NSEC conversion
When transitioning from NSEC3 to NSEC the NSEC3 must be built before
the NSEC3PARAM is removed.  Check each delta in the conversion to
ensure this ordering is met.
2023-12-21 20:12:09 +11:00
Mark Andrews 0509351e92 Update the NSEC3PARAM TTL to match the SOA minimum
When building NSEC3 chains update the NSEC3PARAM TTL to match
the SOA minimum.  Delete all records using the old TTL then
re-add them using the new TTL.
2023-12-21 20:12:09 +11:00
Mark Andrews f3ae88d84e Don't delete the NSEC3PARAM immediately
Wait until the new NSEC or NSEC3 chain is generated then it should
be deleted.
2023-12-21 20:12:09 +11:00
Evan Hunt b248574f93 Merge branch '4364-compilezone-disable-checks' into 'main'
disable checks by default in named-compilezone

Closes #4364

See merge request isc-projects/bind9!8499
2023-12-21 04:26:07 +00:00
Evan Hunt 0c90d09604 CHANGES and release note for [GL #4364] 2023-12-20 16:57:49 -08:00
Evan Hunt d9ab5b9ecc disable checks by default in named-compilezone
Zone content integrity checks can significantly slow the conversion
of zones from raw to text. As this is more properly a job for
named-checkzone anyway, we now disable all zone checks by
default in named-compilezone.

Users relying on named-compilezone for integrity checks as
well as format conversion can run named-checkzone separately,
or re-enable the checks in named-compilezone by using:
"named-compilezone -n fail -k fail -r warn -T warn -W warn".
2023-12-20 16:57:19 -08:00
Mark Andrews ecd1f4a2b8 Merge branch '4488-memory-reference-leak-in-lib-dns-zone-c-zone_sign' into 'main'
Resolve "Memory/reference leak in lib/dns/zone.c:zone_sign"

Closes #4488

See merge request isc-projects/bind9!8570
2023-12-20 23:02:50 +00:00
Mark Andrews 4e4200ee2e Add CHANGES note for [GL #4488] 2023-12-21 09:19:22 +11:00
Mark Andrews a3d0476d17 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.
2023-12-21 09:18:45 +11:00
Mark Andrews 31560dce1a Merge branch '4310-require-when-changing-primaries-list' into 'main'
Resolve "REQUIRE when changing primaries list."

Closes #4310

See merge request isc-projects/bind9!8546
2023-12-20 21:50:26 +00:00
Mark Andrews 4714c65a90 Add CHANGES note for [GL #4310] 2023-12-21 08:12:43 +11:00
Mark Andrews 6ccb93884d dns_request_cancel needs to be callable from any thread
Check the tid and cancel the request immediately or pass it to the
appropriate loop for processing.  Call request->cb directly from
req_sendevent as it is now always called with the correct tid.
2023-12-21 08:11:59 +11:00
Tom Krizek 62284b4053 Merge branch 'tkrizek/update-sphinx_rtd_theme' into 'main'
Update sphinx_rtd_theme and docutils

See merge request isc-projects/bind9!8603
2023-12-20 17:01:45 +00:00
Tom Krizek 4156fa09d9 Update sphinx_rtd_theme and docutils 2023-12-20 18:00:58 +01:00
Michał Kępień c04d87f13c Merge branch '4496-do-not-destroy-ixfr-journal-in-xfrin_end' into 'main'
Do not destroy IXFR journal in xfrin_end()

Closes #4496

See merge request isc-projects/bind9!8602
2023-12-20 16:32:04 +00:00
Michał Kępień 80695e9897 Add CHANGES entry for GL #4496 2023-12-20 17:21:14 +01:00
Michał Kępień efcba4dd23 Do not destroy IXFR journal in xfrin_end()
The xfrin_end() function is run when a zone transfer is finished or
canceled.  One of the actions it takes for incremental transfers (IXFR)
is calling dns_journal_destroy() on the zone journal structure that is
stored in the relevant zone transfer context (xfr->ixfr.journal).  That
immediately invalidates that structure as it is not reference-counted.
However, since the changes present in the IXFR stream are applied to the
journal asynchronously (via isc_work_enqueue()), it is possible that
some zone changes may still be in the process of being written to the
journal by the time xfrin_end() destroys the relevant structure.  Such a
scenario leads to crashes.

Fix by not destroying the zone journal structure until the entire zone
transfer context is destroyed.  xfrin_destroy() already conditionally
calls dns_journal_destroy() and when the former is called, all
asynchronous work for a given zone transfer process is guaranteed to be
complete.
2023-12-20 17:21:14 +01:00
Tom Krizek 1349733fbc Merge tag 'v9.19.19' 2023-12-20 15:59:22 +01:00
Matthijs Mekking f249418240 Merge branch '4423-revert' into 'main'
Revert "Remove kasp mutex lock"

See merge request isc-projects/bind9!8597
2023-12-20 08:32:00 +00:00
Matthijs Mekking 6722ae9103 Revert "Add release note and CHANGES for #4423"
This reverts commit 7af2ec7e4f.
2023-12-20 08:30:44 +00:00
Matthijs Mekking 16f2c811e3 Revert "Remove kasp mutex lock"
This reverts commit 634c80ea12.
2023-12-20 08:30:44 +00:00
Mark Andrews 3f35475ab6 Merge branch '4498-gl-4495-followup-regression-test-was-too-strict' into 'main'
Resolve "[GL #4494] followup: regression test was too strict"

Closes #4498

See merge request isc-projects/bind9!8590
2023-12-19 22:48:51 +00:00
Mark Andrews 80a4dff986 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.
2023-12-19 22:05:59 +00:00
Mark Andrews e1111c5681 Merge branch '4439-add-async-restart-handle' into 'main'
Resolve "segfault in resolver when serving UDP clients"

Closes #4439

See merge request isc-projects/bind9!8594
2023-12-19 16:34:53 +00:00
Mark Andrews 5c02089bcf Add CHANGES note for [GL #4439] 2023-12-20 02:51:54 +11:00
Mark Andrews 7ab4e1537a Obtain a client->handle reference when calling async_restart
otherwise client may be freed before async_restart is called.
2023-12-20 02:50:48 +11:00
Mark Andrews 6a2ebd4f10 Merge branch '4500-log-the-change-that-generated-not-exact-when-applying-a-diff' into 'main'
Resolve "Log the change that generated "not exact" when applying a diff."

Closes #4500

See merge request isc-projects/bind9!8591
2023-12-19 15:37:45 +00:00
Mark Andrews 71d67b6fdf Add CHANGES entry for [GL #4500] 2023-12-20 01:57:25 +11:00
Mark Andrews c896e07277 Log what change generated a 'not exact' error 2023-12-20 01:56:38 +11:00
Matthijs Mekking e05e3a3448 Merge branch '4423-kasp-rwlock' into 'main'
Remove kasp mutex lock

Closes #4423

See merge request isc-projects/bind9!8571
2023-12-19 14:54:21 +00:00
Matthijs Mekking 7af2ec7e4f Add release note and CHANGES for #4423 2023-12-19 14:53:51 +01:00
Matthijs Mekking 634c80ea12 Remove kasp mutex lock
Multiple zones should be able to read the same key and signing policy
at the same time. Since writing the kasp lock only happens during
reconfiguration, and the complete kasp list is being replaced, there
is actually no need for a lock. Reference counting ensures that a kasp
structure is not destroyed when still being attached to one or more
zones.

This significantly improves the load configuration time.
2023-12-19 14:53:51 +01:00
Matthijs Mekking 034990a978 Merge branch '4234-placeholder' into 'main'
Add CHANGES placeholder for [GL #4234]

See merge request isc-projects/bind9!8592
2023-12-19 08:38:00 +00:00
Matthijs Mekking 8788c72bc3 Add CHANGES placeholder for [GL #4234] 2023-12-19 09:34:56 +01:00
Mark Andrews b1cd22c483 Merge branch '4494-add_sigs-was-using-the-wrong-time-in-kasp-mode' into 'main'
Resolve "add_sigs was using the wrong time in  kasp mode"

Closes #4494

See merge request isc-projects/bind9!8577
2023-12-19 01:02:07 +00:00
Mark Andrews 94b00f44ae Add CHANGES note for [GL #4494] 2023-12-19 11:22:17 +11:00
Mark Andrews bdb42d3838 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.
2023-12-19 11:21:46 +11:00
Mark Andrews 6066e41948 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.
2023-12-19 11:21:46 +11:00
Mark Andrews 5e2392aec2 Merge branch '4402-use-our-instance-of-bind-keys' into 'main'
Resolve "Change system tests to not use dnssec-validation auto"

Closes #4402

See merge request isc-projects/bind9!8511
2023-12-19 00:19:07 +00:00
Tom KrizekandMark Andrews 66d6394057 Turn off dnssec validation in inline test
DNSSEC validation isn't required by the inline test and would send
queries to root name servers.
2023-12-18 23:46:03 +00:00
Mark Andrews 15a433cb9d Stop sending queries to the internet's root servers
Disable automatic dnssec validation.
2023-12-18 23:46:03 +00:00
Mark Andrews 4e16bbce15 Use custom bindkeys-file in tests
Ensure the test doesn't use the system's bind.keys file by using the
bindkeys-file statement.
2023-12-18 23:46:03 +00:00
Mark Andrews de812433f5 Merge branch '4138-dig-in-9-19-13-crashes-when-cancelling-with-ctrl-c-a-pending-query-to-to-a-not-reachable-tcp' into 'main'
Resolve "dig in 9.19.13 crashes, when cancelling (with CTRL+C) a pending query to to a not reachable TCP port"

Closes #4138

See merge request isc-projects/bind9!8554
2023-12-18 23:31:00 +00:00
Mark Andrews 06e565944b Add CHANGES not for [GL #4138] 2023-12-19 09:44:05 +11:00
Mark Andrews ae24792ea2 Handle ISC_R_SHUTTINGDOWN in dighost.c:tcp_connected
dig was making further queries after SIGINT was recieved rather
than shutting down as expected.
2023-12-19 09:43:15 +11:00
Michał Kępień 270c51f328 Merge branch '4497-trust-anchor-telemetry-is-no-longer-experimental' into 'main'
"trust-anchor-telemetry" is no longer experimental

Closes #4497

See merge request isc-projects/bind9!8585
2023-12-18 14:12:22 +00:00
Michał Kępień 693fee4836 Add CHANGES entry for GL #4497 2023-12-18 15:11:39 +01:00
Michał Kępień b1baf7af3a "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.
2023-12-18 15:11:39 +01:00
Michał Kępień 67a58784b7 Merge branch '4213-fix-reference-counting-in-do_nsfetch' into 'main'
Fix reference counting in do_nsfetch()

Closes #4213

See merge request isc-projects/bind9!8580
2023-12-18 10:35:20 +00:00
Michał Kępień 2a3b6d1406 Fix reference counting in do_nsfetch()
Each function queuing a do_nsfetch() call using isc_async_run() is
expected to increase the given zone's internal reference count
(zone->irefs), which is then correspondingly decreased in either
do_nsfetch() itself (when the dns_resolver_createfetch() fails) or in
nsfetch_done() (when recursion is finished).

However, do_nsfetch() can also return early if either the zone itself or
the relevant view's resolver object is being shut down.  In that case,
do_nsfetch() simply returns without decreasing the internal reference
count for the zone.  This leaves a dangling zone reference around, which
leads to hangs during named shutdown.

Fix by executing the same cleanup code for early returns from
do_nsfetch() as for a failed dns_resolver_createfetch() call in that
function as the reference count will not be decreased in nsfetch_done()
in any of these cases.
2023-12-18 11:33:43 +01:00
Michał Kępień e0096df669 Merge branch '4060-prevent-an-infinite-loop-in-shutdown_listener' into 'main'
Prevent an infinite loop in shutdown_listener()

Closes #4060

See merge request isc-projects/bind9!8581
2023-12-18 10:07:35 +00:00
Michał Kępień 2d75c96874 Prevent an infinite loop in shutdown_listener()
The loop in shutdown_listener() assumes that the reference count for
every controlconnection_t object on the listener->connections linked
list will drop down to zero after the conn_shutdown() call in the loop's
body.  However, when the timing is just right, some netmgr callbacks for
a given control connection may still be awaiting processing by the same
event loop that executes shutdown_listener() when the latter is run.
Since these netmgr callbacks must be run in order for the reference
count for the relevant controlconnection_t objects to drop to zero, when
the scenario described above happens, shutdown_listener() runs into an
infinite loop due to one of the controlconnection_t objects on the
listener->connections linked list never going away from the head of that
list.

Fix by safely iterating through the listener->connections list and
initiating shutdown for all controlconnection_t objects found.  This
allows any pending netmgr callbacks to be run by the same event loop in
due course, i.e. after shutdown_listener() returns.
2023-12-18 11:07:04 +01:00
Arаm Sаrgsyаn 755b76aa63 Merge branch '4477-tests-statschannel-loadtime-bugfix' into 'main'
Resolve "statschannel test intermittently fails with incorrect zone loadtime"

Closes #4477

See merge request isc-projects/bind9!8569
2023-12-18 09:33:16 +00:00
Aram Sargsyan 4e94ff2541 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.
2023-12-18 08:46:31 +00:00
Arаm Sаrgsyаn ced40c48a4 Merge branch '4493-data-race-in-xfrin_send_request' into 'main'
Resolve "ThreadSanitizer: data race xfrin.c:1555:2 in xfrin_send_request"

Closes #4493

See merge request isc-projects/bind9!8579
2023-12-18 08:44:33 +00:00
Aram Sargsyan 2179224573 Add a CHANGES note for [GL #4493] 2023-12-15 09:56:44 +00:00
Aram Sargsyan 791a046cc7 Use atomic store operations instead of atomic initialize
The atomic_init() function makes sense to use with structure's
members when creating a new instance of a strucutre. In other
places, use atomic store operations instead, in order to avoid
data races.
2023-12-15 09:56:44 +00:00
Petr Špaček edcabe8030 Merge branch '4467-fix-stats-export-overflow' into 'main'
Avoid overflow during statistics dump

Closes #4467

See merge request isc-projects/bind9!8532
2023-12-14 08:13:46 +00:00
Aydın MercanandPetr Špaček 9c4dd863a6 Move atomic statscounter next to the non-atomic definition 2023-12-14 09:11:48 +01:00
Aydın MercanandPetr Špaček bb96142a17 Use a non-atomic counter when passing to stats dumper 2023-12-14 09:11:48 +01:00
Petr Špaček b57c37d8c5 Add CHANGES and release note for [GL #4467] 2023-12-14 09:11:46 +01:00
Petr Špaček 7b0115e331 Avoid overflow during statistics dump
Related: !1493
Fixes: #4467
2023-12-14 09:11:02 +01:00
Mark Andrews 3389df6d89 Merge branch '4478-redefinition-of-hmac-as-different-kind-of-symbol-on-netbsd' into 'main'
Resolve "Redefinition of 'hmac' as different kind of symbol on NetBSD"

Closes #4478

See merge request isc-projects/bind9!8555
2023-12-13 23:32:41 +00:00
Mark Andrews 648fa635f8 Add CHANGES note for [GL #4478] 2023-12-13 22:27:38 +00:00
Mark Andrews fd077c2661 NetBSD has added 'hmac' to libc so rename out uses of hmac 2023-12-13 22:27:38 +00:00
Petr Špaček f7597fa286 Merge branch 'pspacek/update-gitlab-issue-templates' into 'main'
Update Gitlab issue templates

See merge request isc-projects/bind9!8542
2023-12-13 16:30:04 +00:00
Petr Špaček 84795f3005 Add Acknowledgements into Security issue template
Hopefully it will save us one round-trip with the reporter.
2023-12-13 17:11:59 +01:00
Petr Špaček dd4a5d9668 Fix Gitlab label in Feature request template 2023-12-13 17:09:05 +01:00
Petr Špaček 6ccb07e09a Modernize Gitlab Bug template 2023-12-13 17:09:05 +01:00
Petr Špaček b77f25446d Add a default Gitlab issue template
It's an attempt to make people use correct Gitlab templates, or use them
at all.
2023-12-13 17:09:05 +01:00
Petr Špaček b862394bbb Make CVE issues confidential by default
An trivial attempt to avoid accidental disclosures.
2023-12-13 17:09:05 +01:00
Petr Špaček 51218c0cfb Label CVE issue template as internal-use only 2023-12-13 17:09:05 +01:00
Petr Špaček f72d433520 Add Gitlab template for security issues 2023-12-13 17:09:05 +01:00
Michal Nowak dc9cf795fe Merge branch 'mnowak/alpine-3.19' into 'main'
Add Alpine Linux 3.19

See merge request isc-projects/bind9!8562
2023-12-12 10:10:50 +00:00
Michal Nowak 1fc56d705e Add Alpine Linux 3.19 2023-12-12 10:36:03 +01:00
Evan Hunt f6b9bc7da6 Merge branch 'matthijs-qp-lookup-iterator' into 'main'
Follow-up on !8468, more dns_qp_lookup bug fixes related to the iterator

See merge request isc-projects/bind9!8558
2023-12-11 21:01:46 +00:00
Matthijs MekkingandEvan Hunt 3c397a5d68 Add CHANGES 2023-12-11 21:01:29 +00:00
Matthijs MekkingandEvan Hunt 21867f200a Refactor getpred code
Move the code to find the predecessor into one function, as it is shares
quite some similarities: In both cases we first need to find the
immediate predecessor/successor, then we need to find the immediate
predecessor if the iterator is not already pointing at it.
2023-12-11 21:01:29 +00:00
Matthijs MekkingandEvan Hunt ab8a0c4b5a and fix yet another dns_qp_lookup() iterator bug
This one is similar to the bug when searching for a key, reaching a
dead-end branch that doesn't match, because the branch offset point
is after the point where the search key differs.

This fixes the case where we are multiple levels deep. In other
words, we had a more-than-one matches *after* the point where the
search key differs.

For example, consider the following qp-trie:

branch: "[e]", "[m]":
 - leaf: "a.b.c.d.e"
 - branch: "moo[g]", "moo[k]", "moo[n]":
   - leaf: "moog"
   - branch: "mook[e]", "mook[o]"
     - leaf: "mooker"
     - leaf: "mooko"
   - leaf: "moon"

If searching for a key "monky", we would reach the branch with
twigs "moo[k]" and "moo[n]". The key matches on the 'k' on offset=4,
and reaches the branch with twigs "mook[e]" and "mook[o]". This time
we cannot find a twig that matches our key at offset=5, there is no
twig for 'y'. The closest name we found was "mooker".

Note that on a branch it can't detect it is on a dead branch because the
key is not encapsulated in a branch node.

In the previous code we considered "mooker" to be the successor of
"monky" and so we needed to the predecessor of "mooker" to find the
predecessor for "monky". However, since the search key alread differed
before entering this branch, this is not enough. We would be left with
"moog" as the predecessor of "monky", while in this example "a.b.c.d.e"
is the actual predecessor.

Instead, we need to go up a level, find the predecessor and check
again if we are on the right branch, and repeat the process until we
are.

Unit tests to cover the scenario are now added.
2023-12-11 21:01:29 +00:00
Matthijs MekkingandEvan Hunt 276bdcf5cf and fix another dns_qp_lookup() iterator bug
There was yet another edge case in which an iterator could be
positioned at the wrong node after dns_qp_lookup(). When searching for
a key, it's possible to reach a leaf that matches at the given offset,
but because the offset point is *after* the point where the search key
differs from the leaf's contents, we are now at the wrong leaf.

In other words, the bug fixed the previous commit for dead-end branches
must also be applied on matched leaves.

For example, if searching for the key "monpop", we could reach a branch
containing "moop" and "moor". the branch offset point - i.e., the point
after which the branch's leaves differ from each other - is the
fourth character ("p" or "r"). The search key matches the fourth
character "p", and takes that twig to the next node (which can be
a branch for names starting with "moop", or could be a leaf node for
"moop").

The old code failed to detect this condition, and would have
incorrectly left the iterator pointing at some successor, and not
at the predecessor of the "moop".

To find the right predecessor in this case, we need to get to the
previous branch and get the previous from there.

This has been fixed and the unit test now includes several new
scenarios for testing search names that match and unmatch on the
offset but have a different character before the offset.
2023-12-11 21:01:29 +00:00
Michal Nowak a71c0f5338 Merge branch 'mnowak/replace-danger-python-with-hazard' into 'main'
Replace danger-python with Hazard

See merge request isc-projects/bind9!8548
2023-12-11 17:02:47 +00:00
Tom KrizekandMichal Nowak 4f70f5bd7c 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.
2023-12-11 17:22:03 +01:00
Michał KępieńandMichal Nowak 43126e81e6 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
2023-12-11 17:22:03 +01:00
Michal Nowak 08ce1bc45f Replace danger-python with Hazard
Hazard is a minimal danger-python replacement.
2023-12-11 17:22:03 +01:00
Tom Krizek dc6200ed87 Merge branch 'tkrizek/set-up-version-and-release-notes-for-bind-9.19.20' into 'main'
Set up version and release notes for BIND 9.19.20

See merge request isc-projects/bind9!8560
2023-12-08 15:04:58 +00:00
Tom Krizek 9f82448ab5 Set up release notes for BIND 9.19.20 2023-12-08 15:51:48 +01:00
Tom Krizek 2964019558 Update BIND version to 9.19.20-dev 2023-12-08 15:51:48 +01:00
Tom Krizek 18a05caf55 Update BIND version for release 2023-12-08 12:39:04 +01:00
Tom Krizek 8ce8c1c503 Add a CHANGES marker 2023-12-08 12:38:59 +01:00
Tom Krizek 64d5751891 Merge branch 'michal/prepare-documentation-for-bind-9.19.19' into 'v9.19.19-release'
Prepare documentation for BIND 9.19.19

See merge request isc-private/bind9!598
2023-12-08 11:38:30 +00:00
Tom Krizek 874329b3b1 Temporarily allow failure of respdiff-long:tsan job
There was a change in the branch that uncovered preexisting data races
when testing with respdiff under TSAN. This isn't a new issue that
should stop the releases. Allow the check to temporarily fail until the
underlying issue GL #4475 is addressed.
2023-12-07 16:42:43 +01:00
Michał KępieńandTom Krizek b6e8419045 Tweak and reword release notes 2023-12-07 15:34:47 +01:00
Michał KępieńandTom Krizek 51706a1f16 Prepare release notes for BIND 9.19.19 2023-12-07 14:53:14 +01:00
Tom Krizek 7ec5f494e2 Merge branch '4405-cleanup-resolver-nonbackoff-tries-check' into 'main'
Remove obsolete check for resolver-nonbackoff-tries

See merge request isc-projects/bind9!8557
2023-12-07 12:53:32 +00:00
Tom Krizek 059a63793a Remove obsolete check for resolver-nonbackoff-tries
With the resolver-nonbackoff-tries statement being removed in #4405,
this check can no longer be reached and can be safely removed.
2023-12-07 13:10:58 +01:00
Mark Andrews 28d5de9046 Merge branch '4448-improve-lur-cleaning-behaviour' into 'main'
Resolve "Improve LRU cleaning behaviour"

Closes #4448 and #4269

See merge request isc-projects/bind9!8516
2023-12-07 09:48:55 +00:00
Mark Andrews 6ef8d8d699 Add CHANGES for [GL #4448] 2023-12-07 02:59:04 +00:00
Mark Andrews 7e462c2b26 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.
2023-12-07 02:59:04 +00:00
Mark Andrews 5e8f0e9ceb 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.
2023-12-07 02:59:04 +00:00
Evan Hunt 8af6fc44e0 Merge branch 'each-cleanup-trivia' into 'main'
assorted trivial cleanups

See merge request isc-projects/bind9!8450
2023-12-07 02:40:05 +00:00
Evan Hunt c8f43b9160 remove some long-deprecated arguments from dig
certain dig options which were deprecated and became nonoperational
several releases ago still had documentation in the dig man page and
warnings printed when they were used: these included +mapped,
+sigchase, +topdown, +unexpected, +trusted-key, and the -i and -n
options. these are now all fatal errors.

another option was described as deprecated in the man page, but
the code to print a warning was never added. it has been added now.
2023-12-06 17:32:09 -08:00
Evan Hunt ced8a82503 fix consistency check for delv +ns and +qmin
the code to prevent +qmin from being used without +ns was
in the wrong place, resulting in it only working correctly
if +ns was specified first.
2023-12-06 17:31:39 -08:00
Evan Hunt 90a16b3e65 fix unnecessary capitalization
there was a typo in the copyright header.
2023-12-06 17:31:38 -08:00
Evan Hunt 03daed4d11 remove bin/rndc/rndc.conf
this file was no longer used.
2023-12-06 17:31:38 -08:00
Evan Hunt 7d05590a6f clean up client.c
- make dns_client_startresolve() static since it's only used internally
- remove outdated comments
2023-12-06 17:31:38 -08:00
Evan Hunt 50dd6aad34 remove unused functions in dns_master
dns_master_dumpnode() and dns_master_dumpnodetostream() were
never used and can be removed.
2023-12-06 17:31:38 -08:00
Evan Hunt b92c3d9864 Merge branch '4405-remove-resolver-opts' into 'main'
deprecate/remove resolver-retry-interval and resolver-nonbackoff-tries

Closes #4405

See merge request isc-projects/bind9!8448
2023-12-06 21:39:05 +00:00
Evan Hunt 66496d550b remove resolver-retry-interval and resolver-nonbackoff-tries
fully remove these options and mark them as ancient.
2023-12-06 11:54:59 -08:00
Evan Hunt 4aaa4f7dca 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.
2023-12-06 11:51:22 -08:00
Evan Hunt 70bebce4dd Merge branch 'each-qp-lookup-iterator' into 'main'
add an iterator argument to dns_qp_lookup()

See merge request isc-projects/bind9!8468
2023-12-06 19:17:20 +00:00
Evan Hunt 60a33ae6bb fix another dns_qp_lookup() iterator bug
there was another edge case in which an iterator could be positioned at
the wrong node after dns_qp_lookup().  when searching for a key, it's
possible to reach a dead-end branch that doesn't match, because the
branch offset point is *after* the point where the search key differs
from the branch's contents.

for example, if searching for the key "mop", we could reach a branch
containing "moon" and "moor". the branch offset point - i.e., the
point after which the branch's leaves differ from each other - is the
fourth character ("n" or "r"). however, both leaves differ from the
search key at position *three* ("o" or "p"). the old code failed to
detect this condition, and would have incorrectly left the iterator
pointing at some lower value and not at "moor".

this has been fixed and the unit test now includes this scenario.
2023-12-06 11:03:30 -08:00
Evan Hunt 8612902476 fix dns_qp_lookup() iterator bug
in some cases it was possible for the iterator to be positioned in the
wrong place by dns_qp_lookup(). previously, when a leaf node was found
which matched the search key at its parent branch's offset point, but
did not match after that point, the code incorrectly assumed the leaf
it had found was a successor to the searched-for name, and stepped the
iterator back to find a predecessor.  however, it was possible for the
non-matching leaf to be the predecessor, in which case stepping the
iterator back was wrong.

(for example: a branch contains "aba" and "abcd", and we are searching
for "abcde". we step down to the twig matching the letter "c" in
position 3. "abcd" is the predecessor of "abcde", so the iterator is
already correctly positioned, but because the twig was an exact match,
we would have moved it back one step to "aba".)

this previously went unnoticed due to a mistake in the qp_test unit
test, which had the wrong expected result for the test case that should
have detected the error. both the code and the test have been fixed.
2023-12-06 11:03:30 -08:00
Evan Hunt 947bc0a432 add an iterator argument to dns_qp_lookup()
the 'predecessor' argument to dns_qp_lookup() turns out not to
be sufficient for our needs: the predecessor node in a QP database
could have become "empty" (for the current version) because of an
update or because cache data expired, and in that case the caller
would have to iterate more than one step back to find the predecessor
node that it needs.

it may also be necessary for a caller to iterate forward, in
order to determine whether a node has any children.

for both of these reasons, we now replace the 'predecessor'
argument with an 'iter' argument. if set, this points to memory
with enough space for a dns_qpiter object.

when an exact match is found by the lookup, the iterator will be
pointing to the matching node. if not, it will be pointing to the
lexical predecessor of the nae that was searched for.

a dns_qpiter_current() method has been added for examining
the current value of the iterator without moving it in either
direction.
2023-12-06 11:03:30 -08:00
Tom Krizek e81f49d13b Merge branch 'tkrizek/add-changes-entry-for-4462' into 'main'
Add CHANGES entry for #4462

See merge request isc-projects/bind9!8551
2023-12-06 16:33:51 +00:00
Tom Krizek d3be215655 Add CHANGES entry for #4462 2023-12-06 17:24:50 +01:00
Artem Boldariev 6aba9faddd Merge branch '4464-multithread-tls-initialisation-crash-fix' into 'main'
Fix TLS certs store deletion on concurrent access

Closes #4464

See merge request isc-projects/bind9!8531
2023-12-06 15:29:05 +00:00
Artem Boldariev f7de766168 Update CHANGES [GL #4464]
Mention that BIND crashing due to a `tls` multithreaded entry
initialisation attempts has been fixed.
2023-12-06 16:02:22 +02:00
Artem Boldariev 10e626111f 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.
2023-12-06 16:01:20 +02:00
Artem Boldariev b109fa9192 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.
2023-12-06 16:01:20 +02:00
Artem Boldariev 57a5e2285f Merge branch '4388-initial-proxyv2-support-in-bind-and-dig' into 'main'
Make it possible to accept PROXYv2 in BIND (and send it in dig)

Closes #4388

See merge request isc-projects/bind9!8417
2023-12-06 13:49:01 +00:00
Artem Boldariev 8a9b4721a6 Update CHANGES [GL #4388]
Mention the initial support for PROXYv2.
2023-12-06 15:15:26 +02:00
Artem Boldariev 5f7ca686c6 Update release notes [GL #4388]
Mention the initial support for PROXYv2.
2023-12-06 15:15:25 +02:00
Artem Boldariev 71219882ed DoH unit test: do not increase 'active_cconnects' too much
Theoretically, the value could get too big, not letting the test to
finish. This commit fixes that omission.
2023-12-06 15:15:25 +02:00
Artem Boldariev 019555fb1d System test for PROXYv2
This commit adds a system test suite for PROXYv2. The idea on which it
is based is simple:

1. Firstly we check that 'allow-proxy' and 'allow-proxy-on' (whatever
is using the new 'isc_nmhandle_real_localaddr/peeraddr()') do what
they intended to do.

2. Anything else that needs an interface or peer address (ACL
functionality, for example) is using the old
'isc_nmhandle_localaddr/peeraddr()' - which are now returning
addresses received via PROXY (if any) instead of the real connection
addresses. The beauty of it that we DO NOT need to verify every bit of
the code relying on these functions: whatever works in one place will
work everywhere else, as these were the only functions that allowed
any higher level code to get peer and interface addresses.

This way it is relatively easy to see if PROXYv2 works as intended.
2023-12-06 15:15:25 +02:00
Artem Boldariev 0e8d5c9c6b Add checkonf tests for the PROXYv2 related options
This commit adds necessary PROXYv2 configuration options checks.
2023-12-06 15:15:25 +02:00
Artem Boldariev 6d9a3b40a8 Add pre-rendered PROXY header test for PROXY over UDP
This commit extends the PROXY over UDP transport test with
a pre-rendered PROXY header handling test.
2023-12-06 15:15:25 +02:00
Artem Boldariev c9da121ece PROXY Stream pre-rendered PROXY handling test
This commit extends the PROXY Stream transport unit test suite with a
pre-rendered PROXY header handling test.
2023-12-06 15:15:25 +02:00
Artem Boldariev 5ed3a76f9d BIND: Add 'allow-proxy' and 'allow-proxy-on' options
The main intention of PROXY protocol is to pass endpoints information
to a back-end server (in our case - BIND). That means that it is a
valid way to spoof endpoints information, as the addresses and ports
extracted from PROXYv2 headers, from the point of view of BIND, are
used instead of the real connection addresses.

Of course, an ability to easily spoof endpoints information can be
considered a security issue when used uncontrollably. To resolve that,
we introduce 'allow-proxy' and 'allow-proxy-on' ACL options. These are
the only ACL options in BIND that work with real PROXY connections
addresses, allowing a DNS server operator to specify from what clients
and on which interfaces he or she is willing to accept PROXY
headers. By default, for security reasons we do not allow to accept
them.
2023-12-06 15:15:25 +02:00
Artem Boldariev 6725d36cfd Avoid using sock->iface and sock->peer from the lower transport
This commit modifies TLS Stream and DNS-over-HTTPS transports so that
they do not use the "sock->iface" and "sock->peer" of the lower level
transport directly.

That did not cause any problems before, as things worked as expected,
but with the introduction of PROXYv2 support we use handles to store
the information in both PROXY Stream and UDP Proxy
transports. Therefore, in order to propagate the information (like
addresses), extracted from PROXYv2 headers, from the lower level
transports to the higher-level ones, we need to get that information
from the lower-level handles rather than sockets. That means that we
should get the peer and interface addresses using the intended
APIs ("isc_nmhandle_peeraddr()" and "isc_nmhandle_localaddr()").
2023-12-06 15:15:25 +02:00
Artem Boldariev f650d3eb63 Add 'proxy' option to 'listen-on' statement
This commit extends "listen-on" statement with "proxy" options that
allows one to enable PROXYv2 support on a dedicated listener. It can
have the following values:

- "plain" to send PROXYv2 headers without encryption, even in the case
of encrypted transports.
- "encrypted" to send PROXYv2 headers encrypted right after the TLS
handshake.
2023-12-06 15:15:25 +02:00
Artem Boldariev c9d526d84d Increase conn. timeout in the timeout recovery tests
Due to increased number of the NM unit tests and, thus, increased load
on the system timeout recovery tests can sometimes fail, in particular
on FreeBSD. This commit fixes that. Besides, it seems that use of
T_SOFT here was unintentional to begin with.
2023-12-06 15:15:25 +02:00
Artem Boldariev e87f980d42 Document the new PROXY-related options for dig
This commit adds new documentation for +[no]proxy and +[no]proxy-plain
dig options.
2023-12-06 15:15:25 +02:00
Artem Boldariev e0afd614c3 Integrate PROXYv2 support into dig
This commit adds PROXYv2 support into dig by the means of adding
+[no]proxy and +[no]proxy-plain options. Since this commit dig
supports sending PROXYv2 headers on all supported DNS-transports.

The support for PROXYv2 is modelled after that one in kdig.
2023-12-06 15:15:25 +02:00
Artem Boldariev b6cdebcf5c PROXY over UDP unit tests
This commit adds a unit test suite for the new PROXY over UDP
transport. Most of the code is reused from the UDP unit test suite, as
the new transport aims to be fully compatible with UDP on the API
level.
2023-12-06 15:15:25 +02:00
Artem Boldariev 148cfb17d5 Refactor UDP tests
This commit mostly moves the code around to make the parts of the UDP
unit test suite reusable. That changes the unit test suite structure
to resemble that of stream based unit tests.

The motivation behind this is to reuse most of the code for the new
PROXY over UDP uni tests suite.
2023-12-06 15:15:25 +02:00
Artem Boldariev 3c45dd59cb Add a utility function to dump all active sockets on a NM instance
Add the new isc__nm_dump_active_manager() function that can be used
for debugging purposes: it dumps all active sockets withing the
network manager instance.
2023-12-06 15:15:25 +02:00
Artem Boldariev 4a88fc9d5b PROXYv2 over UDP transport
This commit adds a new transport that supports PROXYv2 over UDP. It is
built on top of PROXYv2 handling code (just like PROXY Stream). It
works by processing and stripping the PROXYv2 headers at the beginning
of a datagram (when accepting a datagram) or by placing a PROXYv2
header to the beginning of an outgoing datagram.

The transport is built in such a way that incoming datagrams are being
handled with minimal memory allocations and copying.
2023-12-06 15:15:25 +02:00
Artem Boldariev 69995bc7b7 Extend DNS over HTTP(S) unit tests with PROXY over TLS checks
This commit adds PROXY over TLS related checks to DNS over HTTP(S)
transport in order to ensure its compatibility with this mode.
2023-12-06 15:15:25 +02:00
Artem Boldariev bf3f0c45cb Adapt DNS over HTTP(S) unit tests for PROXY over TLS mode
This commit fixes the common, infrastructural code within the DNS over
HTTP unit test suite to fix and prepare it for PROXY over TLS mode.
2023-12-06 15:15:25 +02:00
Artem Boldariev 90a00d8de2 StreamDNS over TLS: Add PROXY over TLS tests
This commit extends the TLS DNS unit tests suite with checks related
to PROXY over TLS support in StreamDNS.
2023-12-06 15:15:25 +02:00
Artem Boldariev c8d4f3b565 Extend PROXY Stream tests to include checks for PROXY over TLS
This commit extends the PROXY stream unit test suite with checks
related to PROXY over TLS support within the transport.
2023-12-06 15:15:25 +02:00
Artem Boldariev 07531d102c TLS: detect ISC_R_SHUTTINGDOWN and ISC_R_CANCELED cases properly
In the previous versions of the NM, detecting the case when worker is
shutting down was not that important and actual status code did not
matter much. However, that might be not the case all the time.

This commit makes necessary modifications to the code.
2023-12-06 15:15:25 +02:00
Artem Boldariev 9a7e30b1ca PROXY over TLS: Fix stream-based DNS transports tests support
This commit fixes the infrastructural code of the stream-based DNS
transports to take PROXY over TLS support into account.
2023-12-06 15:15:25 +02:00
Artem Boldariev 9d7343cd7d DoH: add PROXY over TLS support
This commit extends DNS over HTTP(S) transport with PROXY over TLS
support.
2023-12-06 15:15:25 +02:00
Artem Boldariev eb52015db1 Stream DNS: add PROXY over TLS support
This commit extends Stream DNS with PROXY over TLS support.
2023-12-06 15:15:25 +02:00
Artem Boldariev 999923c423 Fix TLS Stream in accordance with PROXY Stream over TLS support
This commit makes TLS Stream code to take PROXY Stream over TLS
support into account.
2023-12-06 15:15:24 +02:00
Artem Boldariev e5852bea1c Fix common netmgr unit testing code for PROXY Stream over TLS
This commit fixes common netmgr unit testing code to take PROXY Stream
over TLS support into account.
2023-12-06 15:15:24 +02:00
Artem Boldariev 3d1b6c48ab Add PROXY over TLS support to PROXY Stream
This commit makes it possible to use PROXY Stream not only over TCP,
but also over TLS. That is, now PROXY Stream can work in two modes as
far as TLS is involved:

1. PROXY over (plain) TCP - PROXYv2 headers are sent unencrypted before
TLS handshake messages. That is the main mode as described in the
PROXY protocol specification (as it is clearly stated there), and most
of the software expects PROXYv2 support to be implemented that
way (e.g. HAProxy);

2. PROXY over (encrypted) TLS - PROXYv2 headers are sent after the TLS
handshake has happened. For example, this mode is being used (only ?)
by "dnsdist". As far as I can see, that is, in fact, a deviation from
the spec, but I can certainly see how PROXYv2 could end up being
implemented this way elsewhere.
2023-12-06 15:15:24 +02:00
Artem Boldariev fee8b0d8d5 Add PROXYv2 related checks to DNS over HTTP(S) unit test suite
This commit extends DNS over HTTP(S) unit test suite with PROXYv2
related checks to ensure that the transport is compatible with that
mode.
2023-12-06 15:15:24 +02:00
Artem Boldariev eccc3fe0a0 Add PROXYv2 support to DNS over HTTP(S) transport
This commit extends DNS over HTTP(S) transport with PROXYv2 support.
2023-12-06 15:15:24 +02:00
Artem Boldariev d199265e95 Add PROXYv2 related tests for TLS DNS transport
This commit adds a set of PROXYv2 related tests to ensure that Stream
DNS over TLS supports this mode.
2023-12-06 15:15:24 +02:00
Artem Boldariev 96ba4d2a9a Add PROXYv2 related tests for TCP DNS transport
This commit adds a set of PROXYv2 related tests to ensure that Stream
DNS over TCP supports this mode.
2023-12-06 15:15:24 +02:00
Artem Boldariev e97903ca14 Add PROXY support to Stream DNS
This commit makes it possible to use Stream DNS on top of PROXY Stream
either directly or indirectly (in the case when TLS is involved).
2023-12-06 15:15:24 +02:00
Artem Boldariev 2020dce326 Extend TLS Stream unit suite with PROXYv2 related tests
This commit adds a set of tests which help to verify that TLS Stream
works as expected on top of PROXY Stream.
2023-12-06 15:15:24 +02:00
Artem Boldariev 4437096ba0 Make it possible to use TLS Stream on top of PROXY Stream
This commit modifies TLS Stream to make it possible to use over PROXY
Stream. That is required to add PROVYv2 support into TLS-based
transports (DNS over HTTP, DNS over TLS).
2023-12-06 15:15:24 +02:00
Artem Boldariev 4330014fce PROXY Stream: add unit test suite
This commit adds a specialised test suite for the PROXY Stream
transport by reusing most of the testing code from other unit tests
for other stream-based transports.
2023-12-06 15:15:24 +02:00
Artem Boldariev d119d666b3 PROXY Stream transport
This commit adds a new stream-based transport with an interface
compatible with TCP. The transport is built on top of TCP transport
and the new PROXYv2 handling code. Despite being built on top of TCP,
it can be easily extended to work on top of any TCP-like stream-based
transport. The intention of having this transport is to add PROXYv2
support into all existing stream-based DNS transport (DNS over TCP,
DNS over TLS, DNS over HTTP) by making the work on top of this new
transport.

The idea behind the transport is simple after accepting the connection
or connecting to a remote server it enters PROXYv2 handling mode: that
is, it either attempts to read (when accepting the connection) or send
(when establishing a connection) a PROXYv2 header. After that it works
like a mere wrapper on top of the underlying stream-based
transport (TCP).
2023-12-06 15:15:24 +02:00
Artem Boldariev 7d9a8ddc00 Add PROXY header handling unit test suite
The commit adds a fairly comprehensive unit test suite for our new
PROXYv2 handling code. The unit tests suite ensures both the
correctness of the code and ensures that the part responsible for
handling incoming headers is very strict regarding what to accept as
valid.
2023-12-06 15:15:24 +02:00
Artem Boldariev 2c76717881 Add PROXYv2 header utilities
This commit adds a set of utilities for dealing with PROXYv2 headers,
both parsing and generating them. The code has no dependencies from
the networking code and is (for the most part) a "separate library".

The part responsible for handling incoming PROXYv2 headers is
structured as a state machine which accepts data as input and calls a
callback to notify the upper-level code about the data processing
status.

Such a design, among other things, makes it easy to write a thorough
unit test suite for that, as there are fewer dependencies as well as
will not stand in the way of any changes in the networking code.
2023-12-06 15:15:24 +02:00
Matthijs Mekking 2653e668e3 Merge branch '4476-fix-cid-469729' into 'main'
CID 469729: Remove leftover return call

Closes #4476

See merge request isc-projects/bind9!8547
2023-12-06 12:51:24 +00:00
Matthijs Mekking d08f293f11 CID 469729: Remove leftover return call
This 'return (ret);' call can never be reached and should have been
removed as part of commit 75e0d394dd.
2023-12-06 10:51:15 +01:00
Michal Nowak c4fcdbefc5 Merge branch 'mnowak/drop-openbsd-system-test-job' into 'main'
Drop OpenBSD system test CI job

See merge request isc-projects/bind9!8535
2023-12-05 15:21:57 +00:00
Michal Nowak 27d51d6ab6 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.
2023-12-05 16:14:31 +01:00
Michal Nowak 2ab292c169 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.
2023-12-05 16:14:31 +01:00
Matthijs Mekking e67bbe5c9a Merge branch '4363-lower-max-nsec3-iterations' into 'main'
Lower NSEC3 iteration limit to 50

Closes #4363

See merge request isc-projects/bind9!8515
2023-12-05 14:59:48 +00:00
Matthijs Mekking a759f7f33c Change max NSEC3 iterations in unit tests to 50
The nsec3 unit test needs to be adjusted to accept a lower maximum value
for NSEC3 iterations.
2023-12-05 14:58:58 +00:00
Matthijs Mekking 294943ba7c Add release note and CHANGES for #4363
This protocol change is definitely worth mentioning.
2023-12-05 14:58:58 +00:00
Matthijs Mekking abdaa77303 Change max NSEC3 iterations in system tests to 50
The dnssec and nsupdate system tests need to be adjusted to accept
a lower maximum value for NSEC3 iterations.
2023-12-05 14:58:58 +00:00
Matthijs Mekking ff4201e388 Lower the maximum allowed NSEC3 iterations to 50
BIND 9 will now treat the response as insecure when processing NSEC3
records with iterations larger than 50.

Earlier, we limited the number of iterations to 150 (in #2445).

RFC 9276 says: Because there has been a large growth of open (public)
DNSSEC validating resolvers that are subject to compute resource
constraints when handling requests from anonymous clients, this
document recommends that validating resolvers reduce their iteration
count limits over time. Specifically, validating resolver operators and
validating resolver software implementers are encouraged to continue
evaluating NSEC3 iteration count deployment trends and lower their
acceptable iteration limits over time.

After evaluation, we decided that the next major BIND release should
lower the maximum allowed NSEC3 iterations to 50, which should be
fine for 99,87% of the domain names.
2023-12-05 14:58:58 +00:00
Matthijs Mekking 3c08fbc79f Change NSEC3 iterations to 0 in system tests
The system tests need to be updated because non-zero iterations are no
longer accepted.

The autosign system test changes its iterations from 1 to 0 in one
test case. This requires the hash to be updated.

The checkconf system test needs to change the iterations in the good
configuration files to 0, and in the bad ones to 1 (any non-zero value
would suffice, but we test the corner case here). Also, the expected
failure message is change, so needs to be adjusted.

The nsec3 system test also needs iteration configuration adjustments.
In addition, the test script no longer needs the ITERATIONS environment
variable.

In the process of updating the system tests, I noticed an error
in the dnssec-policy "nsec3-other", where the salt length in one
configuration file is different than in the other (they need to be
the same). Furthermore, the 'rndc signing -nsec3param' test case
is operated on the zone 'nsec-change.kasp', so is moved so that the
tests on the same zone are grouped together.
2023-12-05 14:58:58 +00:00
Matthijs Mekking 75e0d394dd dnssec-policy: refuse to load non-zero iterations
According to RFC 9276, if NSEC3 must be used, then an iterations count
of 0 MUST be used to alleviate computational burdens.
2023-12-05 14:58:58 +00:00
Tom Krizek 336d99f121 Merge branch '4452-pytest-improve-assert-messages' into 'main'
Improve assert messages in pytests

Closes #4452

See merge request isc-projects/bind9!8518
2023-12-05 13:00:07 +00:00
Tom Krizek 5de2b07daa Refactor statschannel test to use isctest
Use common utility functions in favor of duplicating the code in a
test-specific file.
2023-12-05 13:26:49 +01:00
Tom Krizek cba5a1d62c 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.
2023-12-05 13:26:49 +01:00
Tom Krizek f0481c8600 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.
2023-12-05 13:26:49 +01:00
Tom Krizek a57af8163a 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.
2023-12-05 13:26:49 +01:00
Tom Krizek fc295b2b5d 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.
2023-12-05 13:26:49 +01:00
Tom Krizek 767f4670c6 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.
2023-12-05 13:26:43 +01:00
Mark Andrews 64ef6968f3 Merge branch '4462-crash-on-shutdown-when-dnssec-validation-is-running-ensure-isc_mempool_getallocated-namepoolp' into 'main'
Resolve "Crash on shutdown when DNSSEC validation is running: ENSURE(isc_mempool_getallocated(*namepoolp) == 0) failed"

Closes #4462 and #4384

See merge request isc-projects/bind9!8526
2023-12-04 22:55:50 +00:00
Mark Andrews 7ee20d7d10 Destroy the message before detaching the view
With shared name memory pools (f5af981831)
the message needs to be destroyed before the view is detached which
in turn detaches the resolver which checks that all resources have
been returned.
2023-12-04 22:00:25 +00:00
Mark Andrews f491845f5a Merge branch '4457-dig-crashes-after-sigint-if-there-are-multiple-queries' into 'main'
Resolve "dig crashes after SIGINT if there are multiple queries"

Closes #4457

See merge request isc-projects/bind9!8527
2023-12-04 21:10:00 +00:00
Mark Andrews da8a269daf Add CHANGES note for [GL #4457] 2023-12-05 07:31:19 +11:00
Mark Andrews 69f7048c89 Handle ISC_R_SHUTTINGDOWN in dighost.c:recv_done
When dighost.c:recv_done is called with ISC_R_SHUTTINGDOWN cancel
all outstanding lookups as this indicates SIGTERM was recieved.
2023-12-05 07:30:52 +11:00
Michal Nowak c21fbed5d4 Merge branch '3198-add-rr-record' into 'main'
Add support for recording named with rr

Closes #3198

See merge request isc-projects/bind9!8479
2023-12-04 18:53:07 +00:00
Michał KępieńandMichal Nowak 422286e9c2 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).
2023-12-04 18:40:52 +01:00
Michal Nowak 920af590d1 Fix process listing string of rpzextra ns3 server 2023-12-04 18:39:28 +01:00
Michal Nowak e088e8a992 Add support for recording named runtime with rr
The traces of the named process are stored in the directory
$system_test/nsX/named-Y/.
2023-12-04 18:38:29 +01:00
Ondřej SurýandMichal Nowak 658d62a6f4 Remove support for running system tests under Valgrind
Valgrind support has been scarcely used.
2023-12-04 18:27:51 +01:00
Michal Nowak d05c2e7ff4 Merge branch 'mnowak/freebsd-14.0' into 'main'
Add FreeBSD 14.0

See merge request isc-projects/bind9!8520
2023-12-04 15:26:56 +00:00
Michal Nowak 9152fc40a8 Add FreeBSD 14.0 2023-12-04 15:42:24 +01:00
Arаm Sаrgsyаn acf55e125e Merge branch '1229-dig-no-yaml-output-when-host-is-unreachable' into 'main'
Resolve "No YAML output in dig when host is unreachable"

Closes #1229

See merge request isc-projects/bind9!8501
2023-12-04 10:38:46 +00:00
Aram Sargsyan ed879c41f2 Add a CHANGES note for [GL #1229] 2023-12-04 10:38:16 +00:00
Aram Sargsyan 4d529ee12a 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.
2023-12-04 10:38:16 +00:00
Petr Špaček 2a14fa0a65 Merge branch '4417-stale-hyperlinks-in-the-arm' into 'main'
Fix stale hyperlinks in the ARM

Closes #4417

See merge request isc-projects/bind9!8525
2023-12-04 10:00:57 +00:00
Suzanne GoldlustandPetr Špaček 15eea792b9 Fix broken link to TLD DNSSEC stats 2023-12-04 10:00:30 +00:00
Suzanne GoldlustandPetr Špaček 1482f5b1ed Fix broken link to OMB memo 2023-12-04 10:00:30 +00:00
Tom Krizek ae349ef2e8 Merge branch '4251-remove-legacy-test-runner' into 'main'
Remove legacy system test runner

Closes #4251

See merge request isc-projects/bind9!8514
2023-12-01 14:21:34 +00:00
Tom Krizek 1e181cf61d Remove -U 4 from system tests
This option doesn't appear to be needed for any of the tests, so remove
it to keep things simple.
2023-12-01 14:03:35 +01:00
Tom Krizek 519e77d067 Add CHANGES note for [GL #4251] 2023-12-01 14:03:34 +01:00
Tom Krizek fba295600b Update system test documentation
Rewrite and reorganize the test documentation to focus on the pytest
runner, omit any mentions of the legacy runner which are no longer
relevant, and mention a few pytest tricks.
2023-12-01 14:03:33 +01:00
Tom Krizek 3e26d99c3c Remove obsolete system test lists
These were used by deleted legacy runner utility scripts.
2023-12-01 13:47:29 +01:00
Tom Krizek 910440d9b6 Remove legacy runner control scripts
These scripts have been used exclusively by the legacy test runner and
they're no longer needed.
2023-12-01 13:47:27 +01:00
Ondřej Surý 235659b95a Merge branch '4451-use-only-single-method-for-overmem-condition' into 'main'
Refactor the handling of isc_mem overmem condition

Closes #4451

See merge request isc-projects/bind9!8523
2023-11-29 13:21:09 +00:00
Ondřej Surý 022f1d8573 Add CHANGES note for [GL #4451] 2023-11-29 14:16:20 +01:00
Ondřej Surý 0b865c781a Add isc_mem_overmem unit test
The new unit isc_mem_overmem unit test sets hi and lo water marks and
then does allocations to go over:

0. x < lo_water
1. lo_water < x < hi_water
2. x > hi_water
3. lo_water < x < hi_water
4. < lo_water
2023-11-29 14:16:20 +01:00
Ondřej Surý 3383331d06 Cleanup unused stats_bucket() macro 2023-11-29 14:16:20 +01:00
Ondřej Surý 14bdd21e0a Refactor the handling of isc_mem overmem condition
Previously, there were two methods of working with the overmem
condition:

1. hi/lo water callback - when the overmem condition was reached
   for the first time, the water callback was called with HIWATER
   mark and .is_overmem boolean was set internally.  Similarly,
   when the used memory went below the lo water mark, the water
   callback would be called with LOWATER mark and .is_overmem
   was reset.  This check would be called **every** time memory
   was allocated or freed.

2. isc_mem_isovermem() - a simple getter for the internal
   .is_overmem flag

This commit refactors removes the first method and move the hi/lo water
checks to the isc_mem_isovermem() function, thus we now have only a
single method of checking overmem condition and the check for hi/lo
water is removed from the hot path for memory contexts that doesn't use
overmem checks.
2023-11-29 14:16:20 +01:00
Michal Nowak 669800342d Merge branch 'mnowak/drop-named-alt3.conf.in-leftover' into 'main'
Drop the last remnant of ns2/named-alt3.conf.in

See merge request isc-projects/bind9!8506
2023-11-28 20:15:10 +00:00
Matthijs MekkingandMichal Nowak 00fa7483b9 Renumber the ns2/named-alt*.conf.in files
Now that some configuration input files have been removed, rename
the filenames.
2023-11-28 17:03:08 +01:00
Matthijs MekkingandMichal Nowak 3119164e29 Drop ns2/named-alt1.conf.in and ns2/named-alt2.conf.in
These files were not being used in the system test.
2023-11-28 17:03:08 +01:00
Michal Nowak 236e5bf519 Drop the last remnant of ns2/named-alt3.conf.in
The ns2/named-alt3.conf.in config file was removed in
f8e264ba6d. From then on, system test
reports:

    sed: can't read ns2/named-alt3.conf.in: No such file or directory"

Drop the last remnant of ns2/named-alt3.conf.in.
2023-11-28 17:03:08 +01:00
Michał Kępień de2009e3c2 Merge branch 'michal/minor-gitlab-ci-cleanup' into 'main'
Minor GitLab CI cleanup

See merge request isc-projects/bind9!8505
2023-11-21 09:29:09 +00:00
Michał Kępień 192cceba5a 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.
2023-11-21 10:18:52 +01:00
Michał Kępień 832c7d4396 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.
2023-11-21 10:18:52 +01:00
Mark Andrews a1da698103 Merge branch '4432-pointers-dereferenced-before-being-checked' into 'main'
Resolve "Pointers Dereferenced before Being Checked"

Closes #4432

See merge request isc-projects/bind9!8508
2023-11-21 05:40:17 +00:00
Mark Andrews decc17d3b0 Ineffective DbC protections
Dereference before NULL checks.  Thanks to Eric Sesterhenn from X41
D-Sec GmbH for reporting this.
2023-11-21 14:48:43 +11:00
Matthijs Mekking a819d36446 Merge branch 'matthijs-lexopt-escape-public-key' into 'main'
Recognize escapes when reading the public key

See merge request isc-projects/bind9!8502
2023-11-20 08:48:06 +00:00
Matthijs Mekking 53657591fa Add CHANGES 2023-11-20 08:32:29 +01:00
Matthijs Mekking 6a4f3ec242 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.
2023-11-20 08:31:39 +01:00
Matthijs Mekking 71f023a1c3 Recognize escapes when reading the public key
Escapes are valid in DNS names, and should be recognized when reading
the public key from disk.
2023-11-20 08:31:39 +01:00
Mark Andrews 7cace4fb61 Merge branch '4396-dig-does-not-display-yaml-output-for-errors-when-using-protocols-other-than-udp' into 'main'
Resolve "dig does not display YAML output for errors when using protocols other than UDP"

Closes #4396

See merge request isc-projects/bind9!8442
2023-11-20 02:35:57 +00:00
Mark Andrews f813795c6f Add CHANGES for [GL #4396] 2023-11-20 12:24:19 +11:00
Mark Andrews 831efa40d6 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.
2023-11-20 12:23:27 +11:00
Ondřej Surý 8876b2d8a9 Merge branch '4414-shutdown-crash-in-control_recvmessage' into 'main'
Make sure we shutdown the controlconf listeners and connections once

Closes #4414

See merge request isc-projects/bind9!8470
2023-11-16 16:26:24 +00:00
Ondřej Surý 5734d6c826 Make sure we shutdown the controlconf listeners and connections once
It was possible that controlconf connections could be shutdown twice
when shutting down the server, because they would receive the
signal (ISC_R_SHUTTINGDOWN result) from netmgr and then the shutdown
procedure would be called second time via controls_shutdown().

Split the shutdown procedure from control_recvmessage(), so we can call
it independently from netmgr callbacks and make sure it will be called
only once.  Do the similar thing for the listeners.
2023-11-16 16:58:12 +01:00
Michał Kępień f4ca058a06 Merge branch 'michal/update-release-and-cve-checklists' into 'main'
Update release and CVE checklists

See merge request isc-projects/bind9!8500
2023-11-16 10:47:08 +00:00
Michał Kępień fe503854f0 Remove steps related to the post-mortem meeting
The post-mortem meeting is now considered an on-demand event.  The past
few security release cycles proved that there is rarely a need to
discuss things in this form, so there is little point in carrying out
the relevant steps for every single vulnerability - which does not
prevent us from doing so if the actual need arises.
2023-11-16 11:39:51 +01:00
Vicky RiskandMichał Kępień 2db9ab405c Revise responsibilities in the CVE checklist
Update the CVE checklist to reflect agreed-upon changes between Support
and Marketing responsibilities.
2023-11-16 11:39:51 +01:00
Michał Kępień b9443d81cb Rebase -S branches after version bumps
Applying version bumps in open source branches breaks automatic rebasing
of the bind-9.x-sub branches.  Ensure the latter are manually rebased
after each version bump to prevent the "rebase" job in GitLab CI from
failing.
2023-11-16 11:39:51 +01:00
Michał Kępień 9c744e6613 Reassign release (pre-)publishing to QA 2023-11-16 11:39:51 +01:00
Michał Kępień c8c974059d Prepare the patches/ subdirectory earlier
The patches/ subdirectory needs to be present in each prerelease
directory before the ASN releases get pre-published or else the latter
will not contain standalone patches.
2023-11-16 11:39:51 +01:00
Vicky RiskandMichał Kępień a90409bf4d Revise responsibilities in the release checklist
Update the release checklist to reflect agreed-upon changes between
Support and Marketing responsibilities.
2023-11-16 11:39:51 +01:00
Evan Hunt 0e3a75798b Merge branch '3983-secondary-loadtime' into 'main'
set loadtime during initial transfer of a secondary zone

Closes #3983

See merge request isc-projects/bind9!8485
2023-11-16 02:02:15 +00:00
Evan Hunt 9643281453 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.
2023-11-15 17:23:25 -08:00
Mark Andrews f17b94fb72 Merge branch '4433-supplied-buffer-too-large-in-wire_test-c' into 'main'
Resolve "Supplied Buffer Too Large in wire_test.c"

Closes #4433

See merge request isc-projects/bind9!8496
2023-11-16 01:19:33 +00:00
Mark Andrews 560c245971 Adjust comment to have correct message limit value 2023-11-16 11:22:47 +11:00
Mark Andrews cbfcdbc199 Adjust message buffer sizes in test code 2023-11-16 11:22:02 +11:00
Mark Andrews a069513234 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.
2023-11-16 11:15:49 +11:00
Michał Kępień dc25df18f3 Merge tag 'v9.19.18' 2023-11-15 14:54:10 +01:00
Ondřej Surý 101fad490b Merge branch '4421-remove-AES-based-DNS-cookies' into 'main'
Remove AES algorithm for DNS cookies

Closes #4421

See merge request isc-projects/bind9!8471
2023-11-15 09:36:22 +00:00
Ondřej Surý 8e230d8908 Add CHANGES and release note for [GL #4421] 2023-11-15 10:31:34 +01:00
Ondřej Surý 17da9fed58 Remove 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.  Remove both the AES
usage for DNS cookies and the AES implementation itself.
2023-11-15 10:31:16 +01:00
Michal Nowak 25cfec4d2b Merge branch 'mnowak/fedora-39' into 'main'
Add Fedora 39

See merge request isc-projects/bind9!8375
2023-11-14 18:32:09 +00:00
Michal Nowak cdb4b97b28 Add Fedora 39 2023-11-14 17:45:05 +01:00
Arаm Sаrgsyаn f6112e5c65 Merge branch '4418-catz-rbtdb-cds_lfht_destroy-failed' into 'main'
Fix catz db update callback registration logic error (take two)

Closes #4418

See merge request isc-projects/bind9!8476
2023-11-14 10:07:11 +00:00
Aram Sargsyan 2b81ef5cd5 Add a CHANGES note for [GL #4418] 2023-11-14 09:00:20 +00:00
Aram Sargsyan c584899b1a Fix catz db update callback registration logic error (take two)
Please see the 998765fea5 commit for
the description of the original issue. The commit had fixed the
logic error, but it was reintroduced again later with the
a1afa31a5a commit, where the check of
the 'db_registered' flag was removed in dns__catz_update_cb(). The
check was removed, because the registration function was made
idempotent, so double registration is not an issue, but the check
also prevented from unneeded registration, on which the original
fix relied.

This commit just removes the update callback registration code from
the dns__catz_update_cb() function instead of bringing back the check,
because after code flow analysis, it is now clear that it's not required
at all. The "call onupdate() artificially" comment (which was mentioned
by the removed code) is speaking about the dns_catz_dbupdate_callback()
function, which is called by server.c on (re)configuration, and that
function already takes care of update callback's registration since the
998765fea5 commit was applied, so there
is no need to do that here again.
2023-11-14 08:59:48 +00:00
Arаm Sаrgsyаn 4b419cec95 Merge branch 'aram/isc_hasmap-iterators-use-atomics' into 'main'
Use atomics for the the iterators number of isc_hashmap_t

See merge request isc-projects/bind9!8474
2023-11-14 08:58:04 +00:00
Aram Sargsyan b6ae7ec82b Add a CHANGES note for [GL !8474] 2023-11-14 08:57:06 +00:00
Aram Sargsyan 2826f885d5 Use atomics for the iterators number in isc_hashmap_t
Concurrent threads can access a hashmap for reading by creating and
then destroying an iterator, in which case the integer number of the
active iterators is increased or decreased from different threads,
introducing a data race. Use atomic operations to protect the variable.
2023-11-14 08:56:41 +00:00
Ondřej Surý 9ac0f2df9e Merge branch 'ondrej-clang-format-17' into 'main'
Reformat sources with up-to-date clang-format-17

See merge request isc-projects/bind9!8488
2023-11-13 16:16:48 +00:00
Ondřej Surý 2a212ffd5c Ignore clang-format reformat 2023-11-13 16:56:10 +01:00
Ondřej Surý 79d9360011 Reformat sources with up-to-date clang-format-17 2023-11-13 16:52:35 +01:00
Ondřej Surý 4ee7b803b6 Merge branch '4421-deprecate-AES-based-DNS-cookies' into 'main'
Deprecate AES algorithm for DNS cookies

Closes #4421

See merge request isc-projects/bind9!8472
2023-11-13 15:00:48 +00:00
Ondřej Surý 2a3b3beaf1 Add CHANGES and release note for [GL #4421] 2023-11-13 15:00:04 +01:00
Ondřej Surý 67d14b0ee5 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.
2023-11-13 14:59:43 +01:00
Arаm Sаrgsyаn fd4ad5f0ba Merge branch '4328-tasn-error-in-isc_hashmap_iter_create' into 'main'
Resolve "ThreadSanitizer: data race in dns_tsigkeyring_dump"

Closes #4328

See merge request isc-projects/bind9!8473
2023-11-13 13:33:38 +00:00
Aram Sargsyan 0817d42102 Add a CHANGES note for [GL #4328] 2023-11-13 12:06:26 +00:00
Aram Sargsyan 6687de854f Use a read lock when iterating over a hashmap
The 'dns_tsigkeyring_t' structure has a read/write lock to protect
its 'keys' member, which is a 'isc_hashmap_t' pointer and needs to
be protected.

The dns_tsigkeyring_dump() function, however, doesn't use the lock,
which can introduce a race with another thread, if the other thread
tries to modify the hashmap.

Add a read lock around the code, which iterates over the hashmap.
2023-11-13 12:06:26 +00:00
Petr Špaček 4c9d948365 Merge branch 'pspacek/set-up-version-and-release-notes-for-bind-9.19.19' into 'main'
Set up version and release notes for BIND 9.19.19

See merge request isc-projects/bind9!8482
2023-11-10 13:20:50 +00:00
Petr Špaček 993e53ba53 Set up release notes for BIND 9.19.19 2023-11-10 13:50:32 +01:00
Petr Špaček f5a91e2f49 Update BIND version to 9.19.19-dev 2023-11-10 13:50:32 +01:00
Michał Kępień 8dea58c390 Update BIND version for release 2023-11-09 13:02:34 +01:00
Michał Kępień 29546ae22c Add a CHANGES marker 2023-11-09 13:02:34 +01:00
Michał Kępień 69ca828f2e Merge branch 'michal/prepare-documentation-for-bind-9.19.18' into 'v9.19.18-release'
Prepare documentation for BIND 9.19.18

See merge request isc-private/bind9!591
2023-11-09 12:01:25 +00:00
Michał Kępień 46980fd8c2 Reorder release notes 2023-11-09 12:36:34 +01:00
Michał Kępień 38d0b73a37 Tweak and reword release notes 2023-11-09 12:36:34 +01:00
Michał Kępień b35f8dbbc1 Prepare release notes for BIND 9.19.18 2023-11-09 12:36:34 +01:00
Michał Kępień af544ef80e Tweak CHANGES entry for [GL #4260] 2023-11-09 12:36:34 +01:00
Michał Kępień af92841c5e Tweak CVE-2021-25219 reference 2023-11-09 12:36:34 +01:00
Petr Špaček 36aa66bfb4 Merge branch 'matthijs-remove-deprecation-warning-on-dnssec-policy-max-zone-ttl' into 'main'
Remove deprecation warning on dnssec policy max zone ttl

See merge request isc-projects/bind9!8467
2023-11-05 13:10:03 +00:00
Matthijs Mekking 91430cd59a Remove dnssec-policy/max-zone-ttl deprecation text
The readthedocs also placed a deprecation warning on 'max-zone-ttl'
that is part of 'dnssec-policy'. This option is of course not being
deprecated.
2023-11-05 11:37:33 +01:00
Evan Hunt 7d650fde89 Merge branch 'fanf-rndc-nta-newlines' into 'main'
Fix missing newlines in output of `rndc nta -dump`

See merge request isc-projects/bind9!8454
2023-11-02 16:31:25 +00:00
Evan HuntandMark Andrews 37b101b6e2 CHANGES for [GL !8454] 2023-11-02 21:31:43 +11:00
Tony FinchandMark Andrews 61b245e318 Fix missing newlines in output of rndc nta -dump
There were no newlines between each view in the list of negative trust
anchors.
2023-11-02 21:31:09 +11:00
Tom Krizek 01b1ae7bef Merge branch '4401-make-check-fix-junitxml-output-processing' into 'main'
Fix pytest junitxml output processing for make check

Closes #4401

See merge request isc-projects/bind9!8443
2023-11-02 09:02:01 +00:00
Tom Krizek ba25ecd2d2 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.
2023-11-02 09:59:23 +01:00
Michał Kępień 1a724685a0 Merge branch 'michal/add-a-release-signing-job-to-gitlab-ci' into 'main'
Add a release signing job to GitLab CI

See merge request isc-projects/bind9!8418
2023-11-02 06:23:15 +00:00
Michał Kępień a3a91a1557 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.
2023-11-02 07:22:20 +01:00
Mark Andrews 83053ea740 Merge branch '4406-cleanup-b-in-dnstap-main' into 'main'
Resolve "cleanup 'b' in dnstap-read main"

Closes #4406

See merge request isc-projects/bind9!8455
2023-11-02 04:25:19 +00:00
Mark Andrews 0482451f84 Cleanup dead code in dnstap-read
Remove 'b' from main as it is unused.
2023-11-01 20:58:22 +00:00
Mark Andrews 73b8a311a6 Merge branch '4209-turn-on-qname-minimisation-for-adb-name-fetches' into 'main'
Resolve "Turn on QNAME minimisation for adb name fetches."

Closes #4209

See merge request isc-projects/bind9!8107
2023-11-01 17:13:47 +00:00
Mark AndrewsandEvan Hunt 967bdb33be Add release note for [GL #4209] 2023-11-01 16:51:56 +01:00
Mark AndrewsandEvan Hunt 899527e357 Add CHANGES note for [GL #4209] 2023-11-01 16:51:53 +01:00
Evan Hunt 461b9a0442 if GLUEOK is set, and glue is found in a zone DB, don't check the cache
EXPERIMENT: when DNS_DB_GLUEOK is set, dns_view_find() will now return
glue if it is found it a local zone database, without checking to see
if a better answer has been cached previously.
2023-11-01 16:49:08 +01:00
Mark AndrewsandEvan Hunt 9227b82e71 Also look for additional records in dns_adb_find
If a child zone is served by the same servers as a parent zone and
a NS query is made for the zone name then the addresses of the
nameservers are returned in the additional section are tagged as
trust additional.
2023-11-01 16:49:08 +01:00
Mark AndrewsandEvan Hunt 578da93581 Turn on QNAME minimisation when fetching nameserver addresses 2023-11-01 16:49:08 +01:00
Evan Hunt a4aa93f46d Merge branch '4340-fix-max-cache-size' into 'main'
restore isc_mem_setwater() call in the cache

Closes #4340

See merge request isc-projects/bind9!8445
2023-11-01 15:18:18 +00:00
Michał KępieńandEvan Hunt 789879b572 Add release note for GL #4340 2023-11-01 15:18:02 +00:00
Evan Hunt 93f1518c80 CHANGES for [GL #4340] 2023-11-01 15:18:02 +00:00
Evan Hunt b12f709f05 restore isc_mem_setwater() call in the cache
Commit 4db150437e incorrectly removed the
call to isc_mem_setwater() from dns_cache_setcachesize().  The water()
function is a no-op, but we still need to set high- and low-water marks
in the memory context, otherwise overmem conditions will not be
detected.
2023-11-01 15:18:02 +00:00
Tom Krizek d17d9de8a2 Merge branch 'tkrizek/perf-tests-shotgun' into 'main'
Add DNS Shotgun performance tests to nightly pipelines

See merge request isc-projects/bind9!8373
2023-11-01 13:38:35 +00:00
Tom Krizek 322dfbf6a9 Update release checklist
Add a step to verify results of shotgun:* jobs.
2023-11-01 14:02:52 +01:00
Tom Krizek c7fcb1ca60 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.
2023-11-01 14:02:51 +01:00
Tom Krizek ff32421a64 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.
2023-11-01 09:47:20 +01:00
Tom Krizek ef4e2d2964 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.
2023-11-01 09:47:19 +01:00
Matthijs Mekking 3f205f3218 Merge branch '4355-serve-stale-unexpected-recursion' into 'main'
Don't ignore authoritative local zones when in serve-stale mode

Closes #4355

See merge request isc-projects/bind9!8415
2023-10-31 12:49:51 +00:00
Matthijs Mekking ac19d43a32 Add release note and CHANGES for #4355 2023-10-30 20:07:01 +01:00
Matthijs Mekking 2322425016 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.
2023-10-30 20:07:01 +01:00
Matthijs Mekking e196ba6168 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.
2023-10-30 20:07:01 +01:00
Ondřej Surý 2a24ba4618 Merge branch 'ondrej/bump-dns_message-pools-size' into 'main'
Bump the mempool sizes in dns_message

See merge request isc-projects/bind9!8439
2023-10-28 06:52:30 +00:00
Ondřej Surý c855ed6a0b Bump the mempool sizes in dns_message
Increasing the initial and freemax sizes for dns_message memory pools
restores the root zone performance.  The former sizes were suited for
per-dns_message memory pools and we need to bump the sizes up for
per-thread memory pools.
2023-10-27 15:28:27 +02:00
Michał Kępień 61e12cde05 Merge branch '4390-always-use-default-rcu-variant-in-pairwise-builds' into 'main'
Always use default RCU variant in pairwise builds

Closes #4390

See merge request isc-projects/bind9!8438
2023-10-27 11:59:46 +00:00
Michał Kępień bf518ba490 Always use default RCU variant in pairwise builds
Commit 42d43aa075 made --with-liburcu
depend on --enable-developer.  This broke pairwise testing as this new
dependency was not codified in configure.ac.  Since the --with-liburcu
option is currently just a convenience for developers, there is no need
to test building against all possible RCU variants in GitLab CI until
they actually work with BIND 9.  Update the pairwise testing
"configuration" in configure.ac so that builds with non-standard RCU
variants are not tested.
2023-10-27 13:19:03 +02:00
Ondřej Surý ff28f9f8ac Merge branch '4392-increase-dispatch_test-timeouts' into 'main'
Bump the timeouts in the dispatch_test

Closes #4392

See merge request isc-projects/bind9!8437
2023-10-27 11:00:20 +00:00
Ondřej Surý aa393b9e57 Bump the timeouts in the dispatch_test
The client connection timeout was set to just one second, which might
not be enough on busy systems (and the CI machines are oh-boy-busy).
Bump the server timeouts to 10 seconds and client timeouts to 5 seconds,
this will make the unit test run a little bit longer, but it should be
more reliable.
2023-10-27 12:55:51 +02:00
Ondřej Surý b7e793b84c Add tests/dns/badcache.out to .gitignore 2023-10-27 12:55:51 +02:00
Ondřej Surý f71ca845c1 Merge branch '4211-fix-data-race-in-controlconf' into 'main'
Call isccc_ccmsg_invalidate() when shutting down the connection

Closes #4211

See merge request isc-projects/bind9!8426
2023-10-27 10:47:57 +00:00
Ondřej Surý 2d2c249958 Call isccc_ccmsg_invalidate() when shutting down the connection
Previously, the isccc_ccmsg_invalidate() was called from conn_free() and
this could lead to netmgr calling control_recvmessage() after we
detached the reading controlconnection_t reference, but it wouldn't be
the last reference because controlconnection_t is also attached/detached
when sending response or running command asynchronously.

Instead, move the isccc_ccmsg_invalidate() call to control_recvmessage()
error handling path to make sure that control_recvmessage() won't be
ever called again from the netmgr.
2023-10-27 10:53:26 +02:00
Ondřej Surý 07f569e2f6 Replace mutex for listener->connections with TID check
The controlconf channel runs single-threaded on the main thread.
Replace the listener->connections locking with check that we are still
running on the thread with TID 0.
2023-10-27 10:21:41 +02:00
Ondřej Surý 7a37c516d4 Merge branch '4391-remove-lock-file-and--X' into 'main'
Remove the lock-file configuration and -X argument to named

Closes #4391

See merge request isc-projects/bind9!8428
2023-10-27 06:36:16 +00:00
Ondřej Surý 3a08cb5807 Add CHANGES and release note for [GL #4391] 2023-10-26 22:43:03 +02:00
Ondřej Surý f8e264ba6d Remove the lock-file configuration and -X argument to named
The lock-file configuration (both from configuration file and -X
argument to named) has better alternatives nowadays.  Modern process
supervisor should be used to ensure that a single named process is
running on a given configuration.

Alternatively, it's possible to wrap the named with flock(1).
2023-10-26 22:42:37 +02:00
Ondřej Surý d3f2766a79 Mark the lock-file configuration option as deprecated
This is first step in removing the lock-file configuration option, it
marks both the `lock-file` configuration directive and -X option to
named as deprecated.
2023-10-26 22:41:45 +02:00
Michal Nowak 40c4540cf9 Merge branch 'mnowak/openbsd-7.4' into 'main'
Add OpenBSD 7.4

See merge request isc-projects/bind9!8395
2023-10-26 14:31:13 +00:00
Michal Nowak f8733fc051 Add OpenBSD 7.4 2023-10-26 16:27:56 +02:00
Arаm Sаrgsyаn c70e9f0fef Merge branch 'aram/fix-lock-file-option-and--X-argument-issues' into 'main'
Fix assertion failure when using -X none and lock-file in configuration

See merge request isc-projects/bind9!8432
2023-10-26 13:11:30 +00:00
Aram Sargsyan 41945b32d7 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.
2023-10-26 12:34:15 +00:00
Aram Sargsyan bc891e749f 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.
2023-10-26 12:34:07 +00:00
Aram Sargsyan fc2dd09390 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'.
2023-10-26 12:21:57 +00:00
Ondřej Surý c6edfa398c Merge branch '4386-fix-assertion-failure-when-using--X-named-option' into 'main'
Fix assertion failure when using -X and lock-file in configuration

Closes #4386

See merge request isc-projects/bind9!8427
2023-10-26 11:43:13 +00:00
Ondřej Surý 8294a43acf Add CHANGES and release note for [GL #4386] 2023-10-26 12:56:40 +02:00
Ondřej Surý 4f68def5e9 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.
2023-10-26 11:01:17 +02:00
Tom Krizek f2225ca9af Merge branch 'tkrizek/shfmt' into 'main'
Enforce shell script codestyle with shfmt

See merge request isc-projects/bind9!8419
2023-10-26 09:01:06 +00:00
Tom Krizek c8fb0b48e0 Ignore shell script formatting in git blame 2023-10-26 10:25:11 +02:00
Tom Krizek bebdfa13be Add editorconfig file for shell style 2023-10-26 10:23:52 +02:00
Tom Krizek b6505ff573 Run shfmt in CI
Ensure our shell script format stays consistent in the future.
2023-10-26 10:23:52 +02:00
Tom Krizek 4cb8b13987 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)
2023-10-26 10:23:50 +02:00
Ondřej Surý dea544d651 Merge branch '4390-allow-changing-liburcu-mode-only-in-developer-mode' into 'main'
Allowing changing Userspace-RCU variant only in developer mode

Closes #4390

See merge request isc-projects/bind9!8425
2023-10-26 08:21:49 +00:00
Ondřej Surý 17f1d0e862 Remove Userspace-RCU signal variant
The signal variant of Userspace-RCU has been deprecated upstream.
Remove the support for compiling with it from configure.ac.
2023-10-26 10:20:29 +02:00
Ondřej Surý 42d43aa075 Allowing changing Userspace-RCU variant only in developer mode
The Userspace-RCU variants other than membarrier is untested and at
least in QSBR case it's broken.  Allow changing the Userspace-RCU
variant only in the developer's mode.
2023-10-26 10:20:29 +02:00
Evan Hunt 59e4c45fa5 Merge branch '4385-qp-lookup-race' into 'main'
prevent a possible race in dns_qpmulti_query()

Closes #4385

See merge request isc-projects/bind9!8421
2023-10-26 07:34:57 +00:00
Evan Hunt 03183baa6d Prevent a possible race in dns_qpmulti_query() and _snapshot()
The `.reader` member of dns_qpmulti_t was accessed without RCU
protection; reader_open() calls rcu_dereference() on it, and this
call needs to be inside an RCU critical section.

A similar problem was identified in the dns_qpmulti_snapshot() - the
RCU critical section was completely missing.

These are relicts of the isc_qsbr - in the QSBR mode the rcu_read_lock()
and rcu_read_unlock() are no-ops and whole event loop is a critical section.
2023-10-26 00:32:22 -07:00
Mark Andrews 17b0eff0cc Merge branch '4387-lock-file-is-deleted-on-exit-even-if-lock-acquisition-failed' into 'main'
Resolve "lock file is deleted on exit even if lock acquisition failed"

Closes #4387

See merge request isc-projects/bind9!8422
2023-10-26 07:02:01 +00:00
Mark Andrews c1b8279ebb Add release note for [GL #4387] 2023-10-26 16:14:02 +11:00
Mark Andrews a8613372c9 Add CHANGES note for [GL #4387] 2023-10-26 15:41:46 +11:00
Mark Andrews 811c9ee7d1 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.
2023-10-26 15:41:46 +11:00
Mark Andrews b9c789b8b3 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).
2023-10-26 14:55:31 +11:00
Ondřej Surý 8983bf8ed2 Merge branch 'ondrej/dns_message-refactoring' into 'main'
Refactor and cleanup the dns_message unit

See merge request isc-projects/bind9!8400
2023-10-25 10:37:16 +00:00
Ondřej Surý 6bb42939cf Refactor dns_message using ISC_LIST_FOREACH macros
Do a light refactoring and cleanups that replaces common list walking
patterns with ISC_LIST_FOREACH macros and split some nested loops into
separate static functions to reduce the nesting depth.
2023-10-25 12:36:37 +02:00
Ondřej Surý d2e84a4b97 Add ISC_LIST_FOREACH_REV(_SAFE) macros
Add complementary macros to ISC_LIST_FOREACH(_SAFE) that walk the lists
in reverse.

  * ISC_LIST_FOREACH_REV(list, elt, link) - walk the static list from
    tail to head
  * ISC_LIST_FOREACH_REV_SAFE(list, elt, link, next) - walk the list
    from tail to head in a manner that's safe against list member
    deletions
2023-10-25 12:36:13 +02:00
Ondřej Surý fd732a7fb5 Add dns__message_putassociatedrdataset() to deduplicate code
There was a lot of internal code looking like this:

    INSIST(dns_rdataset_isassociated(rdataset));
    dns_rdataset_disassociated(rdataset)
    isc_mempool_put(msg->rdspool, rdataset);

Deduplicate the code into local dns__message_puttemprdataset() routine,
and drop the INSIST() which is checked in dns_rdataset_disassociate().
2023-10-25 12:36:08 +02:00
Ondřej Surý 5fca0fb519 Remove unused dns_message_movename() method
Since dns_message_movename() was unused, it could be removed from the
code based to declutter the API.
2023-10-25 11:43:10 +02:00
Ondřej Surý 1b387c204c Merge branch '4379-dont-reuse-TCP-dispatches-in-dns_xfrin' into 'main'
Add option to mark TCP dispatch as unshared

Closes #4379

See merge request isc-projects/bind9!8408
2023-10-24 12:19:23 +00:00
Ondřej Surý 5a1e0dbfd1 Add CHANGES note for [GL #4379] 2023-10-24 13:07:31 +02:00
Ondřej Surý d246aa02a6 Add dispatch_getcp and dispatch_newtcp tests
Refactor the dispatch unit test to use more local variables (previously
dispatchmgr, dispatch and dispentry were all global), and add two new
tests:

* dispatch_getcp - test whether the TCP connection will get reused
* dispatch_newtcp - test that the TCP connection will not get reused
                    when DNS_DISPATCHOPT_UNSHARED is in effect
2023-10-24 13:07:03 +02:00
Ondřej Surý f213f644ed Add option to mark TCP dispatch as unshared
The current dispatch code could reuse the TCP connection when
dns_dispatch_gettcp() would be used first.  This is problematic as the
dns_resolver doesn't use TCP connection sharing, but dns_request could
get the TCP stream that was created outside of the dns_request.

Add new DNS_DISPATCHOPT_UNSHARED option to dns_dispatch_createtcp() that
would prevent the TCP stream to be reused.  Use that option in the
dns_resolver call to dns_dispatch_createtcp() to prevent dns_request
from reusing the TCP connections created by dns_resolver.

Additionally, the dns_xfrin unit added TCP connection sharing for
incoming transfers.  While interleaving *xfr streams on a TCP connection
should work this should be a deliberate change and be property of the
server that can be controlled.  Additionally some level of parallel TCP
streams is desirable.  Revert to the old behaviour by removing the
dns_dispatch_gettcp() calls from dns_xfrin and use the new option to
prevent from sharing the transfer streams with dns_request.
2023-10-24 13:07:03 +02:00
Ondřej Surý efbdee5b3a Merge branch '4380-keep-the-offloaded-work-result-local' into 'main'
Don't set the offloaded work result from main thread

Closes #4380

See merge request isc-projects/bind9!8407
2023-10-24 10:49:42 +00:00
Ondřej Surý e0e089f106 Don't set the offloaded work result from main thread
The xfrin_recv_done() was accessing xfr->result where we stored the
result of the offloaded work from a thread that could receive data while
processing the transfer on the offloaded thread.

Completely remove the offloaded result from the dns_xfrin_t structure
and keep it local for *xfr_apply() and *xfr_apply_done() as the failure
is already recorded in .shutdown_result and we now that the processing
has failed because .shuttingdown has been already set.
2023-10-24 11:14:54 +02:00
Arаm Sаrgsyаn 04304272a9 Merge branch '4377-sd_notify-RELOADING-add-MONOTONIC_USEC-field' into 'main'
Resolve "named support of a systemd unit with 'notify-reload' service type is incomplete"

Closes #4377

See merge request isc-projects/bind9!8403
2023-10-23 14:49:14 +00:00
Aram Sargsyan da97f714a2 Add a CHANGES note for [GL #4377] 2023-10-23 13:43:39 +00:00
Aram Sargsyan 71b2f40963 sd_notify(3): set the MONOTONIC_USEC field with RELOADING=1
When using sd_notify(3) to send a message to the service manager
about named being reloaded, systemd also requires the MONOTONIC_USEC
field to be set to the current monotonic time in microseconds,
otherwise the 'systemctl reload' command fails.

Add the MONOTONIC_USEC field to the message.

See 'man 5 systemd.service' for more information.
2023-10-23 13:27:59 +00:00
Arаm Sаrgsyаn 60856e65cb Merge branch '4381-assert-in-dns__catz_update_cb-on-shutdown' into 'main'
Resolve "Assertion failure in dns__catz_update_cb() on shutdown"

Closes #4381

See merge request isc-projects/bind9!8409
2023-10-23 09:39:14 +00:00
Aram Sargsyan 598107f1c2 Add a CHANGES note for [GL #4381] 2023-10-23 08:21:39 +00:00
Aram Sargsyan 4eb4fa288c 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.
2023-10-23 08:21:39 +00:00
Michal Nowak cddd9dcb53 Merge branch '4152-reproducer-stack-exhaustion' into 'main'
Add test for CVE-2023-3341

See merge request isc-projects/bind9!8410
2023-10-20 14:23:20 +00:00
Michal Nowak 7d1834b250 Add test for CVE-2023-3341 2023-10-20 15:42:10 +02:00
Mark Andrews 45f088fea7 Merge branch '4372-assertion-failure-in-dispatch-c' into 'main'
Resolve "Assertion failure in dispatch.c"

Closes #4372

See merge request isc-projects/bind9!8397
2023-10-20 09:26:07 +00:00
Mark Andrews c00c1e9a72 Add CHANGES note for [GL #4372] 2023-10-20 18:16:51 +11:00
Mark Andrews 84fd3e3808 Test xfrin's handing of EDNS failure scenarios
We test EDNS requests returning FORMERR where named is expected
to retry without EDNS.

We test EDNS requests returning NOTIMP where named is expected
to fail the transfer as the remote end is not protocol compliant.
2023-10-20 18:16:25 +11:00
Evan HuntandMark Andrews aacea440c3 handle pre-existing disp/dispentry when retrying
when xfrin_start() is called to retry a transfer, close the existing
dispatch entry and reuse the existing dispatch.
2023-10-20 18:16:25 +11:00
Mark Andrews a99adb9efa Test NOTIMP being returned to an IXFR request in xfrin
The server is expected to retry the transfer using SOA and if
the returned serial is greater than the current serial AXFR.

Check the log that IXFR is request.
2023-10-20 18:16:25 +11:00
Mark Andrews 30e182ea56 Merge branch '4101-update-b-root-server-net-addresses' into 'main'
Resolve "Update b.root-server.net addresses"

Closes #4101

See merge request isc-projects/bind9!8371
2023-10-20 03:44:36 +00:00
Mark Andrews c7a06b1fa1 Add release note for [GL #4101] 2023-10-20 14:06:25 +11:00
Mark Andrews b9bba29c5e Add CHANGES note for [GL #4101] 2023-10-20 14:06:24 +11:00
Mark Andrews b69100b747 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.
2023-10-20 14:05:56 +11:00
Mark Andrews 2ca2f7e985 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.
2023-10-20 14:05:56 +11:00
Ondřej Surý 2728b8100c Merge branch '4367-offload-ixfr-processing' into 'main'
Offload AXFR and IXFR processing

Closes #4367

See merge request isc-projects/bind9!8399
2023-10-19 13:40:09 +00:00
Ondřej Surý ec41e8c763 Add CHANGES and release note for [GL #4367] 2023-10-19 14:57:25 +02:00
Ondřej Surý 3737ea592b Offload AXFR and IXFR processing
Instead of processing received data synchronously, store the incoming
differences in the list and process them asynchronously when we need to
commit the data into the database and/or journal.
2023-10-19 14:57:25 +02:00
Ondřej Surý e5c79261c0 Remove all locking from XFR
Instead of locking the struct dns_xfrin members that get accessed from
the statistics, convert those into atomic types and use atomic accesses
to prevent ThreadSanitizer from blowing up.

In fact, even the atomic operations are not really needed here, because
all writes are done from a single thread and we don't really require
consistency from the statistics.  It's easier to use atomics here, but
it is slightly confusing as it suggests there might be multithreaded
accesses to those variables while in fact, the only off-thread access
happens when collecting the statistics.
2023-10-19 14:57:25 +02:00
Ondřej Surý 109dc883e7 Cleanup wrong whitespace in dns/diff.h 2023-10-19 14:57:25 +02:00
Ondřej Surý e3892805d6 Remove the logic that applies differences when over limit
The ixfr_putdata() and axfr_putdata() had a logic to apply dns_diff when
the number of pending tuples went over 100.  Since we are going to
offload the XFR data processing, we don't need to do that anymore.
2023-10-19 14:57:25 +02:00
Ondřej Surý 8a590d1605 Cleanup the FAIL() macro in the dns_xfrin
The FAIL() macro was just setting the result and jumping to failure,
unobfuscate the code by removing the macro.
2023-10-19 14:57:25 +02:00
Ondřej Surý d233fc1730 Merge branch 'ondrej/disable-memory-context-for-OpenSSL-1.x' into 'main'
Disable OpenSSL memory contexts for OpenSSL < 3.0.0

See merge request isc-projects/bind9!8402
2023-10-19 12:56:39 +00:00
Ondřej Surý 74f9f5f821 Disable OpenSSL memory contexts for OpenSSL < 3.0.0
OpenSSL 1.1 has already reached end-of-life and since we are
experiencing a weird memory leak in the mirror system test on just
Ubuntu 20.04 (Focal) with OpenSSL 1.1, we disable the legacy code for
enabling memory contexts for OpenSSL < 3.0.0 in this commit.
2023-10-19 12:54:40 +02:00
Arаm Sаrgsyаn d0a03db850 Merge branch '4375-qp_test-fix' into 'main'
Fix an error in the qp_test.c unit test

Closes #4375

See merge request isc-projects/bind9!8401
2023-10-19 09:30:59 +00:00
Aram Sargsyan b535843bb7 Fix an error in the qp_test.c unit test
In order to check whether there are enough inserted values the
code uses the 'tests' variable (loop counter), which is unreliable,
because the loop sometimes removes an item instead of inserting
one (when the randomly generated item already exists).

Instead of the loop counter, use the existing variable 'inserted',
which should indicate the correct number of the inserted items.
2023-10-19 08:46:58 +00:00
Mark Andrews 671e524aef Merge branch '4260-adjust-udp-refresh-timeouts' into 'main'
Adjust UDP zone maintenance timeouts

Closes #4260

See merge request isc-projects/bind9!8205
2023-10-18 06:07:32 +00:00
Mark Andrews 1a9791b4d8 add CHANGES for [GL #4260] 2023-10-18 13:07:24 +11:00
Mark Andrews 29f399797d 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.
2023-10-18 13:06:28 +11:00
Michal Nowak 85ee12f60e Merge branch 'mnowak/llvm-17' into 'main'
Update clang to version 17

See merge request isc-projects/bind9!8366
2023-10-17 15:55:09 +00:00
Michal Nowak dd234c60fe Update the source code formatting using clang-format-17 2023-10-17 17:47:46 +02:00
Michal Nowak 625a4ffc7a Update clang to version 17 2023-10-17 17:47:46 +02:00
Matthijs Mekking 591d7c32d1 Merge branch '4349-document-inline-signing-defaults' into 'main'
Resolve "Document the complex defaults of inline-signing"

Closes #4349

See merge request isc-projects/bind9!8372
2023-10-17 09:26:09 +00:00
Matthijs Mekking a97e088ec5 Add release note and CHANGES for #4349 2023-10-17 10:52:43 +02:00
Matthijs Mekking ca6171b2f5 Update addzone test
Now that inline-signing is ignored when there is no dnssec-policy,
add 'dnssec-policy default;' to the zones when attempting to add them
via 'rndc addzone'.
2023-10-17 10:52:43 +02:00
Matthijs Mekking 0512ca0ad8 Update inline-signing documentation
Add the missing documentation for 'dnssec-policy/inline-signing'.
Update the zone-only option 'inline-signing' to indicate that the
use of inline signing should be set in 'dnssec-policy' and that this
is merely a way to override the value for the given zone.

(cherry picked from commit 2b7381950d17fe4d289959e5f76f020cc462200a)
2023-10-17 10:52:43 +02:00
Matthijs Mekking e6a454ad12 Ignore inline-signing by default
Ignore the option 'inline-signing' unless there is a 'dnssec-policy'
configured for the zone. Having inline signing enabled while the zone
is not DNSSEC signed does not make sense.

If there is a 'dnssec-policy' the 'inline-signing' zone-only option
can be used to override the value for the given zone.
2023-10-17 10:52:36 +02:00
Mark Andrews 0d58ce93e5 Merge branch '4365-update-dangerfile-py-to-know-about-cve' into 'main'
Resolve "Update dangerfile.py to know about `:cve:`"

Closes #4365

See merge request isc-projects/bind9!8387
2023-10-17 01:58:06 +00:00
Mark Andrews dbc2167325 Update dangerfile.py to know about ':cve:' 2023-10-17 01:05:46 +00:00
Matthijs Mekking 86915a1f40 Merge branch 'matthijs-kasp-system-test-nit-fixes' into 'main'
Two minor fixes in the kasp system test

See merge request isc-projects/bind9!8389
2023-10-16 10:33:05 +00:00
Matthijs Mekking 21d04f556d 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.
2023-10-16 11:08:59 +02:00
Matthijs Mekking 65d97a54ef Merge branch '4350-resign-triggered-on-raw-dnssec-zone' into 'main'
Don't schedule resign for raw version of an inline-signing zone

Closes #4350

See merge request isc-projects/bind9!8385
2023-10-16 08:21:25 +00:00
Matthijs Mekking a8306b541b Add changes and release note for #4350 2023-10-16 09:26:56 +02:00
Matthijs Mekking 741ce2d07a 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.
2023-10-16 09:26:56 +02:00
Matthijs Mekking c90b622648 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.
2023-10-16 09:26:56 +02:00
Ondřej Surý 7a3ba34475 Merge branch 'ondrej/convert-dns_acl-rwlock-to-rcu' into 'main'
Convert rwlock in dns_acl to RCU

See merge request isc-projects/bind9!8378
2023-10-13 12:44:53 +00:00
Ondřej Surý 96bbf95b83 Convert rwlock in dns_acl to RCU
The dns_aclenv_t contains two dns_acl_t - localhost and localnets that
can be swapped with a different ACLs as we configure BIND 9.  Instead of
protecting those two pointers with heavyweight read-write lock, use RCU
mechanism to dereference and swap the pointers.
2023-10-13 14:44:40 +02:00
Ondřej Surý 546c327349 Convert manual dns_{acl,aclenv}_{attach,detach} to ISC_REFCOUNT_IMPL
Instead of having a manual set of functions, use ISC_REFCOUNT_IMPL macro
to implement the attach, detach, ref and unref functions.
2023-10-13 14:44:40 +02:00
Ondřej Surý b3a8f0048f Refactor dns_{acl,aclenv}_create to return void
The dns_{acl,aclenv}_create() can't fail, so change it to return void.
2023-10-13 14:44:40 +02:00
Ondřej Surý f5b0bd9b1b Convert manual dns_iptable_{attach,detach} to ISC_REFCOUNT_IMPL
Instead of having a manual set of functions, use ISC_REFCOUNT_IMPL macro
to implement the attach, detach, ref and unref functions.
2023-10-13 14:44:40 +02:00
Ondřej Surý 613ada72b6 Refactor dns_iptable_create() to return void
The dns_iptable_create() cannot fail now, so change it to return void.
2023-10-13 14:44:40 +02:00
Ondřej Surý d46d51be78 Refactor isc_radix_create to return void
The isc_radix_create() can't fail, so change it to return void.
2023-10-13 14:44:40 +02:00
Arаm Sаrgsyаn b54498abf6 Merge branch '4360-fix-undefined-behaviours-detected-by-llvm-17' into 'main'
Resolve "Undefined behaviours detected by LLVM 17 (noop_accept_cb, dns__nta_shutdown_cb)"

Closes #4360

See merge request isc-projects/bind9!8376
2023-10-13 11:15:02 +00:00
Aram Sargsyan 20fdab8667 Fix undefined behaviour occurrences
The undefined behaviour was detected by LLVM 17. Fix the affected
functions definitions to match the expected function type.
2023-10-13 09:57:28 +00:00
Ondřej Surý e17feff9a7 Merge branch 'ondrej/dont-undef-TRACE-define' into 'main'
Don't undef <unit>_TRACE, instead add comment how to enable it

See merge request isc-projects/bind9!8381
2023-10-13 09:47:11 +00:00
Ondřej Surý 6afa961534 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 */
2023-10-13 11:40:16 +02:00
Petr Špaček f1aaebc53f Merge branch 'pspacek/doc-and-build-tweaks' into 'main'
Describe BIND threat model

See merge request isc-projects/bind9!8364
2023-10-13 07:25:32 +00:00
Petr Špaček fc907baa7f 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.
2023-10-13 09:00:43 +02:00
Petr Špaček 992b87ccc1 Add qplookups test to .gitignore 2023-10-13 09:00:43 +02:00
Evan Hunt 77ea29e416 Merge branch '4362-qp-crash' into 'main'
check chain length is nonzero before examining last entry

Closes #4362

See merge request isc-projects/bind9!8370
2023-10-12 19:04:14 +00:00
Evan Hunt 3a206da456 check chain length is nonzero before examining last entry
It was possible to reach add_link() without visiting an
intermediate node first, and the check for a duplicate entry
could then cause a crash.

Credit to OSS-Fuzz for discovering this error.
2023-10-12 11:31:32 -07:00
Michał Kępień a87436d3d5 Merge branch 'michal/remove-pdf-related-bits-from-the-build-system' into 'main'
Remove PDF-related bits from the build system

See merge request isc-projects/bind9!8350
2023-10-12 12:37:48 +00:00
Michał Kępień 561a83a291 Remove PDF-related bits from the build system
Read the Docs is capable of building the PDF version of the BIND 9 ARM
using just the contents of the doc/arm/ directory - it does not need the
build system to facilitate that.  Since the BIND 9 ARM is also built in
other formats when "make doc" is run, drop the parts of the build system
that enable building the PDF version as they pull in complexity without
bringing much added value in return.  Update related files accordingly.
2023-10-12 14:24:42 +02:00
Ondřej Surý 1da0af6d2f Merge branch '4326-remove-locking-from-copy_namehook_lists' into 'main'
Replace some ADB entry locking with atomics to reduce ADB contention

Closes #4326

See merge request isc-projects/bind9!8328
2023-10-12 10:43:50 +00:00
Ondřej Surý 6b306b9deb Add CHANGES note for [GL #4326] 2023-10-12 12:35:18 +02:00
Ondřej Surý 91f3b0edee Use mul and div instead of bitshifts to calculate srtt
There was a microoptimization for smoothing srtt with bitshifts.  Revert
the code to use * 98 / 100, it doesn't really make that difference on
modern CPUs, for comparison here:

    muldiv:
	    imul    eax, edi, 98
	    imul    rax, rax, 1374389535
	    shr     rax, 37
	    ret
    shift:
	    mov     eax, edi
	    sal     eax, 9
	    sub     eax, edi
	    shr     eax, 9
	    ret
2023-10-12 12:35:00 +02:00
Ondřej Surý 0635bd01cb Skip the no-op code in adjustsrtt()
If factor == DNS_ADB_RTTADJAGE and addr->entry->lastage == now we would
load value into new_srtt and then immediatelly store it back which
triggers the synchronization between threads using .srtt values.
2023-10-12 12:35:00 +02:00
Ondřej Surý cb0db600e7 Replace some ADB entry locking with atomics to reduce ADB contention
Use atomics on couple of ADB entry members (.srtt, .flags, .expires, and
.lastage) to remove ADB entry locking from couple of hot spots.  The
most prominent place is copy_namehook_lists() that gets called under ADB
name lock and if the namehook list is long it acquires-releases quite a
few ADB entry locks.  Changing those ADB entry members to atomics
allowed us to new_adbaddrinfo() not require locked ADB entry and since
adbentry_overquota() already used atomics and handling lame information
was dropped in the previous commit, we could not make the
copy_namehook_lists() lockless.

The other hotspot is dns_adb_adjustsrtt() and dns_adb_agesrtt() that can
now use atomics because .srtt is already atomic_uint.

And the last place that could now use atomics is dns_adb_changeflags().
2023-10-12 12:35:00 +02:00
Ondřej Surý 2b20db05e3 Remove dns_adblameinfo from dns_adb
Keeping the information about lame server in the ADB was done in !322 to
fix following security issue:

    [CVE-2021-25219] Disable "lame-ttl" cache

The handling of the lame servers needs to be redesigned and it is not
going to be enabled any time soon, and the current code is just dead
code that takes up space, code and stands in the way of making ADB work
faster.

Remove all the internals needed for handling the lame servers in the ADB
for now.  It might get reintroduced later if and when we redesign ADB.
2023-10-12 12:35:00 +02:00
Arаm Sаrgsyаn 7fb4e354a9 Merge branch '4354-statschannel-test-opesbsd' into 'main'
Resolve "Checking zone transfer information in the statistics channel fails on OpenBSD"

Closes #4354

See merge request isc-projects/bind9!8367
2023-10-12 09:37:11 +00:00
Aram Sargsyan 39f46b8ca4 Make the statschannel system test portable
The usage of the newline in the replacement part of the 'sed' call
works in GNU systems, but not in OpenBSD. Use 'awk' instead.

Also use the extended syntax of regular expressions for 'grep', which
is similarly more portable across the supported systems.
2023-10-12 08:37:15 +00:00
Matthijs Mekking ba20c4fbe1 Merge branch 'matthijs-fix-build-usdt' into 'main'
Fix build error related to USDT

See merge request isc-projects/bind9!8368
2023-10-10 15:43:59 +00:00
Matthijs Mekking 746e9809a8 Fix build error related to USDT
The trace.h file is listed twice in the Makefile. This incidentally
caused an error where the build refused to replace an earlier placed
trace.h file.
2023-10-10 16:57:18 +02:00
Evan Hunt a2570851aa Merge branch 'each-qp-rpz' into 'main'
convert the RPZ summary database to to use a QP trie

See merge request isc-projects/bind9!8352
2023-10-10 06:56:21 +00:00
Evan Hunt 33a7c9b15f CHANGES for [GL !8352] 2023-10-09 13:29:02 -07:00
Evan Hunt bf81ef3fc0 reduce search_lock coverage
now that we're using qpmulti for the summary database, we
no longer need to hold search_lock for it. we do still need
it for the radix tree and the trigger counts.
2023-10-09 13:29:02 -07:00
Evan Hunt feea05d5c4 convert the RPZ summary database to to use a QP trie
now that we have the QP chain mechanism, we can convert the
RPZ summary database to use a QP trie instead of an RBT.

also revised comments throughout the file accordingly, and
incidentally cleaned up calls to new_node(), which can no
longer fail.
2023-10-09 13:29:02 -07:00
Evan Hunt 86fbfc22b4 fix build bug with DNS_RPZ_TRACE
nonstardard naming of ref/unref and attach/detach functions caused
build errors when using DNS_RPZ_TRACE; this has been fixed.
2023-10-09 13:29:02 -07:00
Evan Hunt 8f6a3f47db fix a QP chain bug
depending on how the QP trie is traversed during a lookup, it is
possible for a search to terminate on a leaf which is a partial
match, without that leaf being added to the chain. to ensure the
chain is correct in this case, when a partial match condition is
detected via qpkey_compare(), we will call add_link() again, just
in case.  (add_link() will check for a duplicated node, so it will
be harmless if it was already done.)
2023-10-09 13:29:02 -07:00
Ondřej Surý 8ca114ef88 Merge branch 'ondrej/fix-load_names-benchmark' into 'main'
Use read number of items instead of raw array size in load_names

See merge request isc-projects/bind9!8361
2023-10-09 19:09:25 +00:00
Ondřej Surý 1974a91e58 Add base testing set of names for load-names benchmark
This was generated from dnsperf queryfile with following script:

    #!/usr/bin/env python3
    names = {}

    import sys

    i = 0
    for line in iter(sys.stdin.readline, ''):
	name = line.rstrip('\n')
	if not name in names:
	    names[name] = line
	    print(f"{i},{name}")
	    i += 1
	if i >= 1024*1024:
	    break
2023-10-09 21:04:21 +02:00
Ondřej Surý 9a45fd6f33 Fix hashmap part of load-names benchmark
The name_match() was errorneously converting struct item into dns_name
pointer.  Correctly retype void *node to struct item * first and then
use item.fixed.name to pass the name to dns_name_equal() function.
2023-10-09 21:04:21 +02:00
Ondřej Surý 81f48e11e4 Use read number of items instead of raw array size in load_names
The load_names benchmark expected the input CSV with domains would fill
the whole item array and it would crash when the number of lines would
be less than that.

Fix the expectations by using the real number or lines read to calculate
the array start and end position for each benchmark thread.
2023-10-09 21:04:21 +02:00
Michał Kępień 1bd979167e Merge branch 'michal/move-linux-stress-tests-to-autoscaled-instances' into 'main'
Move Linux "stress" tests to autoscaled instances

See merge request isc-projects/bind9!8359
2023-10-06 11:09:41 +00:00
Michał Kępień 12ea994680 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.
2023-10-06 13:07:55 +02:00
Michal Nowak 7339920948 Merge branch 'mnowak/monitor-stuck-system-tests' into 'main'
Report hung system tests

See merge request isc-projects/bind9!8245
2023-10-05 16:24:37 +00:00
Michal Nowak 35792b1700 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.
2023-10-05 14:57:26 +02:00
Mark Andrews a6b5cf4c54 Merge branch '4253-detect-duplicate-controls' into 'main'
Detect duplicate "controls" configuration

Closes #4253

See merge request isc-projects/bind9!8313
2023-10-05 01:32:40 +00:00
Mark Andrews e8a822d0a7 Add CHANGES note for [GL #4253] 2023-10-05 11:32:36 +11:00
Mark Andrews 1bf62b1c88 Check that duplicate control sockets are caught 2023-10-05 11:32:01 +11:00
Mark Andrews d97dc03b8e Detect duplicate use of control sockets in named.conf
Specifying duplicate control sockets can lead to hard to diagnose
rndc connection failures.
2023-10-05 11:32:01 +11:00
Petr Špaček a2c771d994 Merge branch 'pspacek/cross-version-tests-junit' into 'main'
Generate and capture JUnit XML output from cross-version-config-tests

See merge request isc-projects/bind9!8354
2023-10-04 12:51:02 +00:00
Petr Špaček f2a3eb00b9 Generate and capture JUnit XML output from cross-version-config-tests 2023-10-04 14:50:25 +02:00
Petr Špaček bfc6b43319 Merge branch 'pspacek/fix-no-case-compression-docs' into 'main'
Fix no-case-compress description in the ARM

See merge request isc-projects/bind9!8312
2023-10-03 12:36:41 +00:00
Petr Špaček 6451462a93 Fix no-case-compress description in the ARM
We confused ourselves, it seems.
2023-10-03 14:35:49 +02:00
Arаm Sаrgsyаn 23b52fb6a0 Merge branch '4343-cid-465861-unnecessary-null-check-in-ns__client_setup' into 'main'
Remove unnecessary NULL-checks in ns__client_setup()

Closes #4343

See merge request isc-projects/bind9!8347
2023-09-28 14:49:28 +00:00
Aram Sargsyan b970556f21 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.
2023-09-28 13:43:18 +00:00
Arаm Sаrgsyаn 5a9ca612ee Merge branch '4331-resolver.c-assert-uninitialized-link' into 'main'
Don't use an uninitialized link on an error path

Closes #4331

See merge request isc-projects/bind9!8343
2023-09-28 09:32:04 +00:00
Aram Sargsyan 9c545c3513 Add a CHANGES note for [GL #4331] 2023-09-28 08:14:31 +00:00
Aram Sargsyan fb7bbbd1be 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.
2023-09-28 08:14:05 +00:00
Evan Hunt 98cbf4ebfc Merge branch 'each-qp-extensions' into 'main'
extensions to QP trie to support DNS databases

See merge request isc-projects/bind9!8338
2023-09-28 07:41:51 +00:00
Evan Hunt 9736497d8a CHANGES for [GL !8338] 2023-09-28 00:32:47 -07:00
Evan Hunt 03016902dd rename dns_qp_findname_ancestor() to dns_qp_lookup()
I am weary of typing so long a name. (plus, the name has become slightly
misleading now that the DNS_QPFIND_NOEXACT option no longer exists.)
2023-09-28 00:32:44 -07:00
Evan Hunt 6231fd66af rename QP-related types to use standard BIND nomenclature
changed type names in QP trie code to match the usual convention:
 - qp_node_t -> dns_qpnode_t
 - qp_ref_t -> dns_qpref_t
 - qp_shift_t -> dns_qpshift_t
 - qp_weight_t -> dns_qpweight_t
 - qp_chunk_t -> dns_qpchunk_t
 - qp_cell_t -> dns_qpcell_t
2023-09-28 00:32:39 -07:00
Evan Hunt 4e3e61806c get predecessor name in dns_qp_findname_ancestor()
dns_qp_findname_ancestor() now takes an optional 'predecessor'
parameter, which if non-NULL is updated to contain the DNSSEC
predecessor of the name searched for. this is done by constructing
an iterator stack while carrying out the search, so it can be used
to step backward if needed.
2023-09-28 00:32:37 -07:00
Evan Hunt 606232b8d5 remove DNS_QPFIND_NOEXACT
since dns_qp_findname_ancestor() can now return a chain object, it is no
longer necessary to provide a _NOEXACT search option. if we want to look
up the closest ancestor of a name, we can just do a normal search, and
if successful, retrieve the second-to-last node from the QP chain.

this makes ancestor lookups slightly more complicated for the caller,
but allows us to simplify the code in dns_qp_findname_ancestor(), making
it easier to ensure correctness.  this was a fairly rare use case:
outside of unit tests, DNS_QPFIND_NOEXACT was only used in the zone
table, which has now been updated to use the QP chain.  the equivalent
RBT feature is only used by the resolver for cache lookups of 'atparent'
types (i.e, DS records).
2023-09-28 00:30:57 -07:00
Evan Hunt 3bf23fadb0 improvements to the QP iterator
- make iterators reversible: refactor dns_qpiter_next() and add a new
  dns_qpiter_prev() function to support iterating both forwards and
  backwards through a QP trie.
- added a 'name' parameter to dns_qpiter_next() (as well as _prev())
  to make it easier to retrieve the nodename while iterating, without
  having to construct it from pointer value data.
2023-09-28 00:30:51 -07:00
Evan Hunt 7f0242b8c7 tidy the helper functions for retrieving twigs
- the helper functions for accessing twigs beneath a branch
  (branch_twig_pos(), branch_twig_ptr(), etc) were somewhat confusing
  to read, since several of them were implemented by calling other
  helper functions. they now all show what they're really doing.
- branch_twigs_vector() has been renamed to simply branch_twigs().
- revised some unrelated comments in qp_p.h for clarity.
2023-09-28 00:30:47 -07:00
Evan Hunt 7f766ba7c4 add a node chain traversal mechanism
dns_qp_findname_ancestor() now takes an optional 'chain' parameter;
if set, the dns_qpchain object it points to will be updated with an
array of pointers to the populated nodes between the tree root and the
requested name. the number of nodes in the chain can then be accessed
using dns_qpchain_length() and the individual nodes using
dns_qpchain_node().
2023-09-28 00:30:43 -07:00
Evan Hunt 29cf7dceb7 modify dns_qp_findname_ancestor() to return found name
add a 'foundname' parameter to dns_qp_findname_ancestor(),
and use it to set the found name in dns_nametree.

this required adding a dns_qpkey_toname() function; that was
done by moving qp_test_keytoname() from the test library to qp.c.
added some more test cases and fixed bugs with the handling of
relative and empty names.
2023-09-28 07:01:13 +00:00
Evan Hunt 06ac957c4f Merge branch 'each-qp-benchmark' into 'main'
add a QP lookups benchmark

See merge request isc-projects/bind9!8345
2023-09-28 07:00:10 +00:00
Evan Hunt e68a691904 add a "qplookups" benchmark test
this loads a file containing DNS names and measures the time it takes to:
1) iterate it,
2) look up each name with dns_qp_getname()
3) look up each name with dns_qp_findname_ancestor()
4) look up a modified name based on the name, to check performance
   when the name is not found.
2023-09-27 16:24:04 -07:00
Evan Hunt d71ebd2086 minor cleanups
- removed some commented-out code
- cleaned up uses of pval and ival that were not needed
2023-09-27 13:05:05 -07:00
Evan Hunt 5259648b3f Merge branch '4338-fix-qpmulti-benchmark' into 'main'
fix the qpmulti benchmark

Closes #4338

See merge request isc-projects/bind9!8344
2023-09-27 19:35:20 +00:00
Evan Hunt 232f90f005 fixed the qpmulti benchmark
the refactoring of isc_job_run() and isc_async_run() in 9.19.12
intefered with the way the qpmulti benchmark uses uv_idle.
it has now been modified to use isc_job/isc_async instead.
2023-09-27 11:51:03 -07:00
Arаm Sаrgsyаn f55488aa09 Merge branch '4335-xfrin_xmlrender-cleanup-path-issue' into 'main'
Resolve "CID 465814: Control flow issues (DEADCODE) in statschannel.c"

Closes #4335

See merge request isc-projects/bind9!8334
2023-09-27 11:19:51 +00:00
Aram Sargsyan f9bcabff24 Fix return value and docs for dns_zone_getxfr()
When the given zone is not associated with a zone manager, the function
currently returns ISC_R_NOTFOUND, which is documented as the return
value for the case in which no incoming zone transfer is found.  Make
the function return ISC_R_FAILURE in such a case instead.

Also update the description of the function as the value it returns is
not meant to indicate whether an ongoing incoming transfer for the given
zone exists.  The boolean variables that the function sets via the
pointers provided as its parameters, combined with either keeping
'*xfrp' set to NULL or updating it to a valid pointer, can be used by
the caller to infer all the necessary information.
2023-09-27 10:03:40 +00:00
Aram Sargsyan f1f863dd81 Fix error path issue in xfrin_xmlrender()
The TRY0 macro doesn't set the 'result' variable, so the error
log message is never printed. Remove the 'result' variable and
modify the function's control flow to be similar to the the
zone_xmlrender() function, with a separate error returning path.
2023-09-27 10:03:40 +00:00
Ondřej Surý 2a2eba74fc Merge branch 'ondrej/workaround-free_pools' into 'main'
Workaround compiler bug that optimizes setting .free_pools

See merge request isc-projects/bind9!8339
2023-09-26 13:11:44 +00:00
Ondřej Surý ca912775a5 Workaround compiler bug that optimizes setting .free_pools
The .free_pools bitfield would not be set on some levels of
optimizations - workaround the compiler bug by reordering the setting
the .freepools in the initializer.
2023-09-26 14:59:39 +02:00
Arаm Sаrgsyаn f494b21ce0 Merge branch '4332-data-race-in-dns_xfrin_getendserial' into 'main'
xfrin.c: use the statslock for more xfrin members

Closes #4332

See merge request isc-projects/bind9!8333
2023-09-26 12:57:33 +00:00
Aram Sargsyan 903a79f6ce Don't use the statslock in the destructor
Using the 'statslock' mutex in the destructor is useless, because
at this point there shouldn't be any other references to the
structure.
2023-09-26 12:23:10 +00:00
Aram Sargsyan ed2f06ea4d Remove xfr->end
The structure member is populated only moments before its
destruction, and is not used anywhere, except for the
destructor. Use a local variable instead.
2023-09-26 12:23:10 +00:00
Aram Sargsyan 5067b83116 Use the statslock for more xfrin members
The 'end_serial' and some other members of the 'dns_xfrin_t'
structure can be accessed by the statistics channel, causing
a data race with the zone transfer process.

Use the existing 'statslock' mutex for protecting those members.
2023-09-26 12:23:10 +00:00
Mark Andrews 0d85492f6b Merge branch '4316-dynamic-update-refused-shortly-after-zone-was-thawed' into 'main'
Resolve "dynamic update refused shortly after zone was thawed"

Closes #4316

See merge request isc-projects/bind9!8310
2023-09-26 03:13:57 +00:00
Mark Andrews e33dbd0cbd Document that reloading happens asynchronously 2023-09-26 02:43:51 +00:00
Mark Andrews 5b3238aa85 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.
2023-09-26 02:43:51 +00:00
Mark Andrews 9ca06af4b9 Merge branch 'marka-placeholder' into 'main'
Add placeholder entry for [GL #4336]

See merge request isc-projects/bind9!8335
2023-09-26 00:48:33 +00:00
Mark Andrews 7084313b53 Add placeholder entry for [GL #4336] 2023-09-26 10:22:10 +10:00
Ondřej Surý 65c92d001c Merge branch '4325-reduce-isc_mempool-contention' into 'main'
Change dns_message_create() function to accept memory pools

Closes #4325

See merge request isc-projects/bind9!8330
2023-09-25 05:41:53 +00:00
Ondřej Surý 15cae8d473 Add CHANGES note for [GL #4325] 2023-09-24 18:07:40 +02:00
Ondřej Surý f5af981831 Change dns_message_create() function to accept memory pools
Instead of creating new memory pools for each new dns_message, change
dns_message_create() method to optionally accept externally created
dns_fixedname_t and dns_rdataset_t memory pools.  This allows us to
preallocate the memory pools in ns_client and dns_resolver units for the
lifetime of dns_resolver_t and ns_clientmgr_t.
2023-09-24 18:07:40 +02:00
Ondřej Surý 759a977a67 Convert dns_message reference counting to ISC_REFCOUNT macros
Unify the dns_message reference counting to use ISC_REFCOUNT_{IMPL,DECL}
macros to reduce the code duplicity and add reference count tracing.
2023-09-24 10:09:04 +02:00
Ondřej Surý 3340c82b99 Improve isc_refcount with initializer and implicit destroy
Add ISC_REFCOUNT_INITIALIZER(x) macro and implicitly call
isc_refcount_destroy() in the ISC_REFCOUNT_IMPL() macros
to reduce code duplicities.
2023-09-24 10:08:56 +02:00
Arаm Sаrgsyаn 6adc0be124 Merge branch 'aram/statschannel-expose-precursory-soa-request-state' into 'main'
Add the "Refresh SOA" state for the incoming zone transfers and improve the "Duration" field

See merge request isc-projects/bind9!8305
2023-09-22 12:40:53 +00:00
Aram Sargsyan e905a05b3e Add a CHANGES note for [GL !8305] 2023-09-22 11:47:26 +00:00
Aram Sargsyan 93088fbf8b Fix the incoming transfers' "Needs Refresh" state in stats channel
The "Needs Refresh" flag is exposed in two places in the statistics
channel: first - there is a state called "Needs Refresh", when the
process hasn't started yet, but the zone needs a refresh, and second
- there there is a field called "Additional Refresh Queued", when the
process is ongoing, but another refresh is queued for the same zone.

The DNS_ZONEFLG_NEEDREFRESH flag, however, is set only when there is
an ongoing zone transfer and a new notify is received. That is, the
flag is not set for the first case above.

In order to fix the issue, use the DNS_ZONEFLG_NEEDREFRESH flag only
when the zone transfer is running, otherwise, decide whether a zone
needs a refresh using its refresh and expire times.
2023-09-22 11:47:26 +00:00
Aram Sargsyan 621a1461d9 xfrin: rename XFRST_INITIALSOA to XFRST_ZONEXFRREQUEST
The XFRST_INITIALSOA state in the xfrin module is named like that,
because the first RR in a zone transfer must be SOA. However, the
name of the state is a bit confusing (especially when exposed to
the users with statistics channel), because it can be mistaken with
the refresh SOA request step, which takes place before the zone
transfer starts.

Rename the state to XFRST_ZONEXFRREQUEST (i.e. Zone Transfer Request).
During that step the state machine performs several operations -
establishing a connection, sending a request, and receiving/parsing
the first RR in the answer.
2023-09-22 11:47:26 +00:00
Aram Sargsyan dee829d9dc Show the local and remote addresses for the "Refresh SOA" query
Currently in the statsistics channel's incoming zone transfers list
the local and remote addresses are shown only when the zone transfer
is already running. Since we have now introduced the "Refresh SOA"
state, which shows the state of the SOA query before the zone transfer
is started, this commit implements a feature to show the local and
remote addresses for the SOA query, when the state is "Refresh SOA".
2023-09-22 11:26:11 +00:00
Aram Sargsyan 979b86ecb9 Improve the "Duration (s)" field of the incoming xfers in stats channel
Improve the "Duration (s)" field, so that it can show the duration of
all the major states of an incoming zone transfer process, while they
are taking place. In particular, it will now show the duration of the
"Pending", "Refresh SOA" and "Deferred" states too, before the actual
zone transfer starts.
2023-09-22 11:24:49 +00:00
Aram Sargsyan a3916e4ed2 Add the "Refresh SOA" state for the incoming zone transfers
With adding this state to the statistics channel, it can now show
the zone transfer in this state instead of as "Pending" when the
zone.c module is performing a refresh SOA request, before actually
starting the transfer process. This will help to understand
whether the process is waiting because of the rate limiter (i.e.
"Pending"), or the rate limiter is passed and it is now waiting for
the refresh SOA query to complete or time out.
2023-09-22 11:05:52 +00:00
Arаm Sаrgsyаn 9b6949e8ec Merge branch 'aram/statschannel-expose-xfrin-soa-transport' into 'main'
Expose the SOA query transport type used before/during XFR

See merge request isc-projects/bind9!8240
2023-09-22 10:59:30 +00:00
Aram Sargsyan e92d1eeafc Check zone transfer transports in the statistics channel
Add two more secondary zones to ns3 to be transferred from ns1,
using its IPv6 address for which the 'tcp-only' is set to 'yes'.
Check the statistics channel's incoming zone transfers information
to confirm that the expected transports were used for each of the
SOA query cases (UDP, TCP, TLS), and also for zone transfers (TCP,
TLS).
2023-09-22 09:56:33 +00:00
Aram Sargsyan 8f4f82e018 Add a CHANGES note for [GL !8240] 2023-09-22 09:56:33 +00:00
Aram Sargsyan 8e2273afce Expose the SOA query transport type used before/during XFR
Add a new field in the incoming zone transfers section of the
statistics channel to show the transport used for the SOA request.

When the transfer is started beginning from the XFRST_SOAQUERY state,
it means that the SOA query will be performed by xfrin itself, using
the same transport. Otherwise, it means that the SOA query was already
performed by other means (e.g. by zone.c:soa_query()), and, in that
case, we use the SOA query transport type information passed by the
'soa_transport_type' argument, when the xfrin object was created.
2023-09-22 09:56:33 +00:00
Arаm Sаrgsyаn 2eb8afde52 Merge branch '3883-expose-data-about-transfers-in-progress' into 'main'
Draft: Implement exposing data about zone transfers in progress

Closes #3883

See merge request isc-projects/bind9!7984
2023-09-22 09:40:23 +00:00
Mark AndrewsandAram Sargsyan a60e6837fb Wait for slow zone transfer to complete before ending test
This allows the statistics channel to be viewed in a browser while
the transfer is in progress.  Also set the transfer format to
one-answer to extend the amount of time the re-transfer takes.

When running the statschannel test on its own, use
<http://10.53.0.3:5304/xml/v3/xfrins> to see the output.

Note: the port is subject to future change.
2023-09-22 08:52:13 +00:00
Mark AndrewsandAram Sargsyan bed4e36c86 Provide thread safe access to dns_xfrin_t state
dns_xfrin_t state may be accessed from different threads when
when reporting transfer state.  Ensure access is thread safe by
using atomics and locks where appropriate.
2023-09-22 08:52:13 +00:00
Aram Sargsyan 42f41f003e Add CHANGES and release notes for [GL #3883] 2023-09-22 08:52:12 +00:00
Aram Sargsyan 2f523462b8 Document zone transfers in statschannel
List the JSON and XML URLs in ARM for retrieving the incoming zone
transfers information from the statistics channel.
2023-09-22 08:51:45 +00:00
Aram Sargsyan c929127b73 Add a test case for checking zone transfers in statschannel
Use the named -T transferslowly test options to slow down a zone
transfer from the primary server, and test that it's correctly
exposed in the statistics channel of the secondary server, while
it's in-progress.
2023-09-22 08:51:45 +00:00
Aram Sargsyan 3e65dc12f7 Implement exposing data about zone transfers in progress
The data about currently in-progress zone transfers is exposed
using the statistics channel in both XML and JSON formats.
2023-09-22 08:51:45 +00:00
Aram Sargsyan bc12bcaf46 Implement various dns_xfrin_get*() functions
The information provided by those function will be needed and
used by the statistics channel in a follow-up commit.
2023-09-22 08:51:45 +00:00
Aram Sargsyan 826392f8c8 Implement dns_zone_getxfr()
The function is needed to get an attached xfrin and its current
state in statschannel.c for providing xfrin information in the
statistics channel.
2023-09-22 08:51:45 +00:00
Aram Sargsyan 35fc773632 dns_transport: use const arguments in getters when possible
In some dns_transport getter functions it's possible to use a
const dns_transport_t as the first argument instead of just
dns_transport_t. Convert the function prototypes to use const.
2023-09-22 08:51:45 +00:00
Ondřej Surý baacd2af44 Merge branch '4327-minor-warning-about-ctype-h-function' into 'main'
Add semantic patch to explicitly cast chars to unsigned for ctype.h

Closes #4327

See merge request isc-projects/bind9!8325
2023-09-22 06:30:06 +00:00
Ondřej Surý 0e49a8422f Add CHANGES note for [GL #4327] 2023-09-22 08:29:17 +02:00
Ondřej Surý 29caa6d1f0 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()).
2023-09-22 08:29:17 +02:00
Ondřej Surý 5ec65ab5d0 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.
2023-09-22 08:29:17 +02:00
Michał Kępień a0ab9c6c9e Merge branch 'mnowak/add-cve-ref-role' into 'main'
Add a Sphinx role for linking CVEs to the ISC Knowledgebase

See merge request isc-projects/bind9!8260
2023-09-21 12:22:49 +00:00
Michal NowakandMichał Kępień 41b857e567 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.
2023-09-21 14:18:02 +02:00
Michał Kępień c201835719 Merge branch 'michal/update-sphinx-and-sphinx_rtd_theme' into 'main'
Update Sphinx and sphinx_rtd_theme

See merge request isc-projects/bind9!8322
2023-09-20 15:20:25 +00:00
Michał Kępień 2f879cdec3 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.
2023-09-20 17:18:24 +02:00
Michał Kępień fc0ee66063 Merge tag 'v9.19.17' 2023-09-20 16:45:47 +02:00
Ondřej Surý 37a8cf7dae Merge branch 'ondrej/remove-isc_hash_function' into 'main'
Use incremental hashing in the isc_sockaddr_hash() function

See merge request isc-projects/bind9!8298
2023-09-19 18:48:56 +00:00
Ondřej Surý 4cf4cc484d Use the new isc_sockaddr_hash_ex() to fix QID table hashing
The QID table hashing used a custom merging of the sockaddr, port and id
into a single hashvalue.  Normalize the QID table hashing function to
use isc_hash32 API for all the values.
2023-09-19 19:56:33 +02:00
Ondřej Surý 3230c8e369 Add isc_sockaddr_hash_ex that can be used in incremental hashing
Add a sockaddr hashing function that can be used as part of incremental
hashing.
2023-09-19 19:56:33 +02:00
Ondřej Surý 9f40eee0a8 Remove isc_hash_function macro
The last two users of 64-bit isc_hash_function() macro were removed in
the previous commits, remove the macro as well.
2023-09-19 19:56:33 +02:00
Ondřej Surý 1653fa61c7 Use 32-bit hashing in isc memory debugging
Switch from 64-bit isc_hash_function() to 32-bit isc_hash32() as we were
using the 32-bit value only anyway.
2023-09-19 19:51:51 +02:00
Ondřej Surý 9d326aaba3 Use incremental hashing in the isc_sockaddr_hash() function
Instead of copying address back and forth when hashing addr+port, we can
use incremental hashing.  Additionally, switch from 64-bit
isc_hash_function to 32-bit isc_hash32() as the resulting value is
32-bit.
2023-09-19 19:51:51 +02:00
Ondřej Surý 17b08fa614 Merge branch '4311-remove-sockaddr_unix' into 'main'
Completely remove the Unix Domain Socket support from BIND 9

Closes #4311

See merge request isc-projects/bind9!8292
2023-09-19 17:29:53 +00:00
Ondřej Surý da4ba38c81 Add CHANGES and release note for [GL #4311] 2023-09-19 18:51:51 +02:00
Ondřej Surý 26685ce5a8 Remove Raw and FDWatch type of socket statistics
The isc_sockstatscounter_raw* and isc_sockstatscounter_fdwatch was just
a dead code and those counters were not used anywhere.  Remove them.
2023-09-19 18:51:35 +02:00
Ondřej Surý 7aebbec653 Completely remove the Unix Domain Socket support from BIND 9
The Unix Domain Sockets support in BIND 9 has been completely disabled
since BIND 9.18 and it has been a fatal error since then.  Cleanup the
code and the documentation that suggest that Unix Domain Sockets are
supported.
2023-09-19 18:51:35 +02:00
Tom Krizek 652f2725a0 Merge branch '4312-pytest-symlink-name-collision' into 'main'
Rename convenience symlink to pytest artifacts

Closes #4312

See merge request isc-projects/bind9!8306
2023-09-19 15:59:03 +00:00
Tom Krizek fd13dfb097 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.
2023-09-19 17:20:32 +02:00
Tom Krizek f441e68bb3 Merge branch '4250-remove-legacy-runner-support-for-python-tests' into 'main'
remove support for running python system tests with legacy test runner

Closes #4250

See merge request isc-projects/bind9!8202
2023-09-19 15:09:08 +00:00
Tom Krizek d050843a30 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.
2023-09-19 15:45:53 +02:00
Tom Krizek 363677bde7 Add CHANGES note for [GL #4250] 2023-09-19 15:45:49 +02:00
Tom Krizek 8deb026748 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.
2023-09-19 15:43:33 +02:00
Tom Krizek 197dac55a2 Reformat conftest.py with black 2023-09-19 15:43:33 +02:00
Tom Krizek d16e5fd5e5 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.
2023-09-19 15:43:33 +02:00
Tom Krizek 4af9bafb4e 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.
2023-09-19 15:43:31 +02:00
Tom Krizek 94856ade3c Merge branch '4262-make-check-pytest' into 'main'
Use pytest runner for make check

Closes #4262

See merge request isc-projects/bind9!8286
2023-09-19 13:41:16 +00:00
Tom Krizek 0a9ee342e9 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.
2023-09-19 14:47:49 +02:00
Tom Krizek f1c631f448 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.
2023-09-19 14:47:49 +02:00
Tom Krizek 295890a16b 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.
2023-09-19 14:47:49 +02:00
Tom Krizek b96c8e8062 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).
2023-09-19 14:47:49 +02:00
Tom Krizek 15fa8f1506 Prioritize long-running system tests for legacy runner
Synchronize the test priority with the pytest runner (which handles the
prioritization in conftest.py).
2023-09-19 14:47:48 +02:00
Tom Krizek 0538b7e0da Use prereq.sh for rpzrecurse system test 2023-09-19 14:47:48 +02:00
Tom Krizek c3abedc0a2 Use prereq.sh for serve-stale system test 2023-09-19 14:47:48 +02:00
Tom Krizek 5d9a09c086 Use prereq.sh for chain system test 2023-09-19 14:47:48 +02:00
Tom Krizek 00b92bd064 Use prereq.sh for digdelv, dnssec, forward system tests 2023-09-19 14:47:48 +02:00
Tom Krizek 78981cee77 Use prereq.sh for qmin, cookie system tests 2023-09-19 14:47:48 +02:00
Tom Krizek 2f962f7041 Use prereq.sh for reclimit system test 2023-09-19 14:47:48 +02:00
Tom Krizek 587129b4c0 Use prereq.sh for xfer system test 2023-09-19 14:47:48 +02:00
Tom Krizek 27281955af Use prereq.sh for statschannel system test 2023-09-19 14:47:48 +02:00
Tom Krizek 9cc821d42f 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.
2023-09-19 14:47:47 +02:00
Tom Krizek f0493890cc Use proper perl interpreter in xfer system test 2023-09-19 14:47:47 +02:00
Tom Krizek 807f67b1cd 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.
2023-09-19 14:47:47 +02:00
Tom Krizek d4502206a1 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.
2023-09-19 14:47:47 +02:00
Tom Krizek 56c1087304 Use pytest runner for make check
Make python & pytest required dependencies to run system tests and
invoke the pytest runner from the makefile.
2023-09-19 14:47:45 +02:00
Tom Krizek 9a1a10e84f Merge branch 'tkrizek/pytest-check-system-test-files-with-danger' into 'main'
enforce system test file and name conventions with danger CI

See merge request isc-projects/bind9!8254
2023-09-19 12:46:54 +00:00
Tom Krizek d1371267c6 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.
2023-09-19 13:29:30 +02:00
Tom Krizek 546212b78b Add missing pytest glue for for host system test
Without this glue file, the test isn't picked up by the pytest runner
and therefore not executed.
2023-09-19 13:29:30 +02:00
Tom Krizek c026a00696 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
2023-09-19 13:29:29 +02:00
Tom Krizek 9e13c3dbcb 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.
2023-09-19 13:29:29 +02:00
Tom Krizek 168dba163c 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.
2023-09-19 13:29:27 +02:00
Ondřej Surý 7f91925dad Merge branch '4322-hashmap-iterator-can-iterate-twice-the-same-item-if-deleting-items-via-delcurrent_next' into 'main'
Resolve "hashmap iterator can iterate twice the same item if deleting items via delcurrent_next"

Closes #4322

See merge request isc-projects/bind9!8309
2023-09-19 09:51:24 +00:00
Mark AndrewsandOndřej Surý f467dbc182 Add CHANGES note for [GL #3422] 2023-09-19 11:18:04 +02:00
Ondřej Surý 45fb84076d Add assertion failure when adding to hashmap when iterating
When iterating the table, we can't add new nodes to the hashmap because
we can't assure that we are not adding the new node before the iterator.

This also applies to rehashing - which might be triggered by both
isc_hashmap_add() and isc_hashmap_delete(), but not
isc_hashmap_iter_delcurrent_next().
2023-09-19 11:18:04 +02:00
Mark AndrewsandOndřej Surý 92a0d65a51 Fix hashmap iteration
When isc_hashmap_iter_delcurrent_next calls hashmap_delete_node
nodes from the front of the table could be added to the end of
the table resulting in them being returned twice.  Detect when
this is happening and prevent those nodes being returned twice
buy reducing the effective size of the table by one each time
it happens.
2023-09-19 11:18:03 +02:00
Mark Andrews c2b6f4357d Merge branch '4314-dns_ncache_current-fails-to-set-covered-correctly' into 'main'
Resolve "dns_ncache_current fails to set covered correctly"

Closes #4314

See merge request isc-projects/bind9!8300
2023-09-18 05:42:05 +00:00
Mark Andrews 80298ade33 Add a CHANGES note for [GL #4314] 2023-09-18 13:39:17 +10:00
Mark Andrews 8ce359652a 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.
2023-09-18 13:38:27 +10:00
Mark Andrews 779980710c 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.
2023-09-18 13:38:27 +10:00
Ondřej Surý b0b0aac505 Merge branch 'ondrej/use-cds_lfht-for-dns_dispatch' into 'main'
Rewrite the QID lookup table to cds_lfht

See merge request isc-projects/bind9!8304
2023-09-16 06:35:49 +00:00
Ondřej Surý 405860022f Add CHANGES note for [GL !8304] 2023-09-16 07:32:18 +02:00
Ondřej Surý aa0971027c Cleanup unused .localport member of dns_dispatch_t and some macros
The .localport member of dns_dispatch_t structure was unused, clean it
up.  Cleanup unused and/or redundant macros.
2023-09-16 07:32:18 +02:00
Ondřej Surý c9b4b45943 Replace the linked list of TCP dispatches with hash table
Reusing TCP connections with dns_dispatch_gettcp() used linear linked
list to lookup existing outgoing TCP connections that could be reused.
Replace the linked list with per-loop cds_lfht hashtable to speedup the
lookups.  We use cds_lfht because it allows non-unique node insertion
that we need to check for dispatches in different connection states.
2023-09-16 07:32:18 +02:00
Ondřej Surý 6fd06c461b Make dns_dispatch bound to threads
Instead of high number of dispatches (4 * named_g_udpdisp)[1], make the
dispatches bound to threads and make dns_dispatchset_t create a dispatch
for each thread (event loop).

This required couple of other changes:

1. The dns_dispatch_createudp() must be called on loop, so the isc_tid()
   is already initialized - changes to nsupdate and mdig were required.

2. The dns_requestmgr had only a single dispatch per v4 and v6.  Instead
   of using single dispatch, use dns_dispatchset_t for each protocol -
   this is same as dns_resolver.
2023-09-16 07:32:17 +02:00
Ondřej Surý 282c4709b8 Rewrite the QID lookup table to cds_lfht
Looking up unique message ID in the dns_dispatch has been using custom
hash tables.  Rewrite the custom hashtable to use cds_lfht API, removing
one extra lock in the cold-cache resolver hot path.
2023-09-16 07:32:17 +02:00
Ondřej Surý 7be52f1bad Merge branch 'ondrej-improve-isc_hashmap' into 'main'
Refactor isc_hashmap to accept custom match function

See merge request isc-projects/bind9!8289
2023-09-16 05:25:54 +00:00
Ondřej Surý e270266627 Refactor isc_hashmap to accept custom match function
Refactor isc_hashmap to allow custom matching functions.  This allows us
to have better tailored keys that don't require fixed uint8_t arrays,
but can be composed of more fields from the stored data structure.
2023-09-16 07:20:48 +02:00
Arаm Sаrgsyаn 492a4fb671 Merge branch 'aram/danger-ignore-length-warn-for-fixups' into 'main'
Don't warn about subject line length for the fixup commits (CI)

See merge request isc-projects/bind9!8282
2023-09-14 10:37:51 +00:00
Aram Sargsyan 3db2beef9f 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.
2023-09-14 09:31:32 +00:00
Mark Andrews faeffce4eb Merge branch '608-add-option-to-apply-dns64-rules-to-address-being-used-for-lookups' into 'main'
Resolve "Add option to apply dns64 rules to address being used for lookups."

Closes #608

See merge request isc-projects/bind9!2166
2023-09-13 05:31:34 +00:00
Mark Andrews 18b7db2d3a Add CHANGES for [GL #608] 2023-09-13 14:33:05 +10:00
Mark Andrews 5a0cea31c4 Document resolver-use-dns64 2023-09-13 14:33:05 +10:00
Mark Andrews d1983adc22 IO::Socket::INET6 has been replaced by IO::Socket::IP
IO::Socket::INET6 is no longer being maintained and its functionality
has been replaced by IO::Socket::IP.
2023-09-13 14:31:43 +10:00
Mark Andrews 3a87ff3dfe Test resolver-use-dns64
Test resolver-use-dns64 by simulating a connection to an IPv4-only
server through a NAT64.

This test uses EXTRAPORT1 rather than PORT for DNS traffic exchanged
between ns3 and ns4. Both servers also listen on PORT on their IPv4
addresses to support server startup testing in start.pl.
2023-09-13 14:31:43 +10:00
Mark Andrews 01b11c24ec Configure 'mapped' IPv4 address
Add a mapped IPv4 address, fd92:7065:b8e:fffe::10.53.0.4, to
ifconfig.sh for dns64 testing.
2023-09-13 14:31:43 +10:00
Mark Andrews 9f779c3996 Add the ability to use DNS64 internally
Add a configuration option, resolver-use-dns64, which when true
will cause named to map IPv4 address to IPv6 addresses using the
view's DNS64 mapping rules when making iterative queries.
2023-09-13 14:31:43 +10:00
Ondřej Surý 8805d989ec Merge branch '4306-add-incremental-isc_siphash' into 'main'
Implement incremental version of SipHash 2-4 and HalfSipHash 2-4

Closes #4306

See merge request isc-projects/bind9!8288
2023-09-12 14:21:40 +00:00
Ondřej Surý 9df9296b7a Merge branch 'ondrej/make-dns_name-mostly-header-only' into 'main'
Cleanup the dns_name macros

See merge request isc-projects/bind9!8297
2023-09-12 14:20:25 +00:00
Ondřej Surý 0f3155e0ef Add CHANGES note for [GL #4306] 2023-09-12 16:17:06 +02:00
Ondřej Surý 6ac286d4a3 Implement incremental version of isc_hash32 and isc_hash64
Add support for incremental hashing to the isc_hash unit, both 32-bit
and 64-bit incremental hashing is now supported.

This is commit second in series adding incremental hashing to libisc.
2023-09-12 16:17:06 +02:00
Ondřej Surý 4dd49ac528 Implement incremental version of SipHash 2-4 and HalfSipHash 2-4
When inserting items into hashtables (hashmaps), we might have a
fragmented key (as an example we might want to hash DNS name + class +
type).  We either need to construct continuous key in the memory and
then hash it en bloc, or incremental hashing is required.

This incremental version of SipHash 2-4 algorithm is the first building
block.

As SipHash 2-4 is often used in the hot paths, I've turned the
implementation into header-only version in the process.
2023-09-12 16:17:06 +02:00
Ondřej Surý fd25be31f0 Cleanup the dns_name macros
1. Replace the "high-performance" macros that were only used if
   DNS_NAME_USEINLINE was defined before including <dns/name.h> with
   inline header functions with assertion checks and thus use them
   everywhere.

2. Replace the old struct initializers with C99 designated initializers
   for better understanding what is happening in these macros.
2023-09-12 16:14:10 +02:00
Tom Krizek a83a4cae36 Merge branch 'tkrizek/ci-test-binaries-compilation' into 'main'
ci: omit explicit command to compile test binaries

See merge request isc-projects/bind9!8287
2023-09-12 08:22:50 +00:00
Tom Krizek 26f20b81ec 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
2023-09-12 09:52:05 +02:00
Michal Nowak d78a3774e2 Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.19.18' into 'main'
Set up version and release notes for BIND 9.19.18

See merge request isc-projects/bind9!8291
2023-09-12 07:35:00 +00:00
Michal Nowak 03505812f0 Set up release notes for BIND 9.19.18 2023-09-12 08:11:52 +02:00
Michal Nowak ee46748eea Update BIND version to 9.19.18-dev 2023-09-12 08:11:52 +02:00
Michal Nowak 464cf8ce5e Update BIND version for release 2023-09-08 10:40:19 +02:00
Michal Nowak 9f780d84e1 Add a CHANGES marker 2023-09-08 10:39:40 +02:00
Michal Nowak f0a4a725ff Merge branch 'mnowak/prepare-documentation-for-bind-9.19.17' into 'security-main'
Prepare documentation for BIND 9.19.17

See merge request isc-private/bind9!577
2023-09-08 08:38:04 +00:00
Michal Nowak cec1e232d9 Reorder release notes 2023-09-08 10:18:58 +02:00
Michal Nowak 01020d705d Tweak and reword release notes 2023-09-08 10:18:58 +02:00
Michal Nowak da05434b2d Prepare release notes for BIND 9.19.17 2023-09-08 10:18:58 +02:00
Michal Nowak 93dc606fa8 Simplify Sphinx tools installation
Pointing pip3 to the "requirements file" eliminates the necessity for
removing comments.
2023-09-08 10:18:58 +02:00
Michal Nowak 62697a1351 Merge branch '4152-confidential-limit-isccc_cc_fromwire-recursion-depth' into 'security-main'
[CVE-2023-3341] Limit isccc_cc_fromwire recursion depth

See merge request isc-private/bind9!546
2023-09-08 08:18:20 +00:00
Mark AndrewsandMichal Nowak ecd77e610b Add release note for [GL #4152] 2023-09-07 19:47:59 +02:00
Mark AndrewsandMichal Nowak 6af8d39ea2 Add CHANGES note for [GL #4152] 2023-09-07 19:47:40 +02:00
Mark AndrewsandMichal Nowak 820b0cceef 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:46:19 +02:00
Michal Nowak 6bda72d26f Merge branch '4242-placeholder' into 'main'
Add CHANGES placeholder for [GL #4242]

Closes #4242

See merge request isc-projects/bind9!8284
2023-09-07 08:21:45 +00:00
Michal Nowak a8cba9b672 Add CHANGES placeholder for [GL #4242] 2023-09-07 10:18:56 +02:00
Michal Nowak b237414ae2 Merge branch '4152-placeholder' into 'main'
Add CHANGES placeholder for [GL #4152]

See merge request isc-projects/bind9!8283
2023-09-07 08:18:01 +00:00
Michal Nowak b4ec7c79bb Add CHANGES placeholder for [GL #4152] 2023-09-06 16:03:42 +02:00
Mark Andrews b6e5960b09 Merge branch '4290-raise-log-level-to-isc_log_error-on-formerr-in-xfrin-c' into 'main'
Resolve "raise log level to ISC_LOG_NOTICE on FORMERR in xfrin.c"

Closes #4290

See merge request isc-projects/bind9!8262
2023-09-06 09:13:23 +00:00
Mark Andrews b867244305 Add a CHANGES note for [GL #4290] 2023-09-06 02:24:53 +00:00
Mark Andrews 6c3414739d 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.
2023-09-06 02:24:53 +00:00
Mark Andrews fafa7f397b Merge branch '4291-check-dig-exit-status' into 'main'
Resolve "RNDC system test failed to run to completion"

Closes #4291

See merge request isc-projects/bind9!8264
2023-09-06 01:32:21 +00:00
Mark Andrews 701ad350f8 Check dig's exist status 2023-09-06 01:03:11 +00:00
Mark Andrews 49f6bf862f Merge branch '4292-uncleared-libcrypto-error-crypto-evp-evp_fetch-c-373-inner_evp_generic_fetch' into 'main'
Resolve "Uncleared libcrypto error: crypto/evp/evp_fetch.c:373 inner_evp_generic_fetch"

Closes #4292

See merge request isc-projects/bind9!8274
2023-09-06 01:02:52 +00:00
Mark Andrews 28adcf1831 Call ERR_clear_error on EVP_MD_fetch or EVP_##alg error 2023-09-06 00:28:56 +00:00
Mark Andrews 028154d416 Merge branch '4214-uaf-in-validator-logging' into 'main'
Resolve "UAF in validator logging"

Closes #4214

See merge request isc-projects/bind9!8269
2023-09-05 23:51:25 +00:00
Mark Andrews 1fed5c8171 Add CHANGES for [GL #4214] 2023-09-06 09:23:00 +10:00
Mark Andrews cf63cb1136 Restore dns_validator_destroy and fetchctx_detach call order
7a78a85b moved the destruction of the validator from near the start
validated to the end.  This reversed the order of dns_validator_destroy
and fetchctx_detach.  Restore the order so that val->name remains
valid for the lifetime of the validator.
2023-09-06 09:23:00 +10:00
Ondřej Surý 5173849d72 Merge branch 'mnowak/statschannel-system-test-is-too-verbose' into 'main'
Disable command tracing in statschannel system test

See merge request isc-projects/bind9!8277
2023-09-05 17:05:29 +00:00
Michal NowakandOndřej Surý f0c37d861c Disable command tracing in statschannel system test
Command tracing was added recently via
26e10e8fb5 and makes the system test too
verbose.
2023-09-05 19:01:27 +02:00
Ondřej Surý fb233b3fc5 Merge branch '4296-ignore-jemalloc-versions-before-4.0.0' into 'main'
Ignore jemalloc versions before 4.0.0

Closes #4296

See merge request isc-projects/bind9!8273
2023-09-05 16:54:55 +00:00
Ondřej Surý 7423557e42 Add CHANGES and release note for [GL #4296] 2023-09-05 18:47:29 +02:00
Aram SargsyanandOndřej Surý 2084986462 Synchronize used library versions reporting functions
There are libraries which are reported in printversion(), but not
reported in setup(). Synchronize the functions, so that the log
file could have the same information as reported by the 'named -V'
command execution.
2023-09-05 18:47:29 +02:00
Ondřej Surý 2e99dcefa8 Print the used jemalloc version in autoconf and named -V output
The autoconf and named -V now prints used version of jemalloc.  This
doesn't work with system supplied jemalloc, so in it prints `system`
instead in the autoconf and nothing in named -V output.
2023-09-05 18:47:21 +02:00
Ondřej Surý d862f4bc64 Ignore jemalloc versions before 4.0.0
We now depend on explicitly creating memory arenas and disabling tcache
on those, and these features are not available with jemalloc < 4.
Instead of working around these issues, make the jemalloc >= 4.0.0 hard
requirement by looking for sdallocx() symbol that's only available from
that version.

The jemalloc < 4 was only used by RHEL 7 which is not supported since
BIND 9.19+.
2023-09-05 18:46:57 +02:00
Michal Nowak be33cfa3f6 Merge branch '4255-placeholder' into 'main'
Add CHANGES placeholder for [GL #4255]

See merge request isc-projects/bind9!8275
2023-09-05 16:08:07 +00:00
Michal Nowak e70a937b3f Add CHANGES placeholder for [GL #4255] 2023-09-05 17:57:18 +02:00
Ondřej Surý dd658c454e Merge branch '4038-specialised-arena-per-worker' into 'main'
Make it possible to create memory contexts backed by jemalloc arenas

Closes #4038

See merge request isc-projects/bind9!8270
2023-09-05 08:23:42 +00:00
Artem BoldarievandOndřej Surý 60d52a49b0 Add CHANGES and release note for [GL #4038]
Mention that send buffer allocations/deallocations are now routed
through dedicated memory arenas.
2023-09-05 09:39:41 +02:00
Artem BoldarievandOndřej Surý 01cc7edcca 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
2023-09-05 09:39:41 +02:00
Artem BoldarievandOndřej Surý 6e98b58d15 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.
2023-09-05 09:39:41 +02:00
Artem BoldarievandOndřej Surý 8550c52588 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.
2023-09-05 09:39:41 +02:00
Ondřej Surý 912d6a13e4 Merge branch '4263-deprecate-dnssec-must-be-secure-feature' into 'main'
Deprecate 'dnssec-must-be-secure' option

See merge request isc-projects/bind9!8267
2023-09-04 13:14:48 +00:00
Ondřej Surý 898f0ee3cf Add CHANGES and release note for [GL #4263] 2023-09-04 13:47:33 +02:00
Ondřej Surý 9e0b348a2b 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.
2023-09-04 13:38:14 +02:00
Michał Kępień eac0a4b3ed Merge branch 'michal/reorganize-vulnerability-docs' into 'main'
Move security-related information to SECURITY.md

See merge request isc-projects/bind9!8257
2023-09-04 09:56:54 +00:00
Michał Kępień ca9fed9143 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.
2023-09-04 11:54:57 +02:00
Ondřej Surý 00a6268c8f Merge branch 'each-cleanup-rbt' into 'main'
replace RBT usage throughout named

See merge request isc-projects/bind9!8213
2023-09-04 09:07:32 +00:00
Evan HuntandOndřej Surý 9c25a09e5d CHANGES for [GL !8213] 2023-09-04 10:19:48 +02:00
Evan HuntandOndřej Surý 1019c0c0b1 unconditionally create view and resolver nametrees
instead of allowing a NULL nametree in dns_nametree_covered(),
require nametree to exist, and ensure that the nametrees defined
for view and resolver objects are always created.
2023-09-04 10:19:48 +02:00
Evan HuntandOndřej Surý 1a238a0f86 use a count nametree for synthfromdnssec
use the count semantics for dns_nametree to support view->sfd.
2023-09-04 10:19:48 +02:00
Evan HuntandOndřej Surý b1e4e2a9ee add a 'foundname' argument to dns_nametree_covered()
when checking whether a name is covered, the ancestor name that
was found can be set into a name object passed in.
2023-09-04 10:19:48 +02:00
Evan HuntandOndřej Surý 0ebaa26da7 add semantics to name trees to support counters
name trees can now also hold trees of counters. each time a name
dns_nametree_add() is called with a given name, the counter for that
name is incremented; the name is not deleted until dns_nametree_delete()
is called the same number of times.

this is meant to be used for synth-from-dnssec, which is incremented for
each key defined at a name, and decremented when a key is removed, the
name must continue to exist until the number of keys has reached zero.
2023-09-04 10:19:48 +02:00
Evan HuntandOndřej Surý bc3fd1a2ef use bitfield name trees for disable-algorithms and disable-ds-digests
switch disable-algorithms and disable-ds-digests to use
bitfield-type name trees, replacing the RBT-based bftree.
2023-09-04 10:19:48 +02:00
Evan HuntandOndřej Surý 9ed1dba976 add semantics to dns_nametree to support bitfields
name trees can now hold either boolean values or bit fields. the
type is selected when the name tree is created.

the behavior of dns_nametree_add() differs slightly beteween the types:
in a boolean tree adding an existing name will return ISC_R_EXISTS,
but in a bitfield tree it simply sets the specified bit in the bitfield
and returns ISC_R_SUCCESS.
2023-09-04 10:19:48 +02:00
Evan Hunt 54fc02410e refactor disable_algorithm and disable_ds_digest to use one data structure
the functions for disabling DNSSEC signing algorithms and DS digest
algorithms in resolver.c had a lot of duplicated code.

this commit adds functions to implement a "bitfield tree", which is
(currently) an RBT in which the node data contains arbitrary-sized
bitfields to indicate whether a value has been added at the given
node or not. (it can be changed to a QP trie later.)

it also replaces the functions dns_resolver_disable_algorithm(),
dns_resolver_algorithm_supported(), dns_resolver_disable_ds_digest()
and dns_resolver_ds_digest_supported() with simple wrappers that call
the new functions.
2023-09-01 10:46:58 -07:00
Evan Hunt e83ac0ce65 use dns_nametree in place of RBTs
replace the use of RBTs for deny-answer-aliases, the exclude
lists for deny-answer-aliases and deny-answer-addresses, and
dnssec-must-be-secure, with name trees.
2023-09-01 10:46:53 -07:00
Evan Hunt 56114aaa0d add dns_nametree structure for policy match lookups
this is a QP trie of boolean values to indicate whether a name is
included in or excluded from some policy. this can be used for
synth-from-dnssec, deny-answer-aliases, etc.
2023-09-01 10:46:48 -07:00
Evan Hunt 9067b637d8 replace RBTs with hashmaps in dns_transport
as dns_transport_find() is only concerned with finding an exact
match on the specified name it doesn't need to use a tree data
structure internally, we can replace the RBTs with hash tables.
2023-09-01 10:39:39 -07:00
Mark Andrews 5969a7c1ac Merge branch '4159-openssl-error-queue-not-cleaned' into 'main'
Resolve "OpenSSL error queue not cleaned"

Closes #4159

See merge request isc-projects/bind9!8233
2023-09-01 03:08:20 +00:00
Mark Andrews 6a1a73759a Add release note for [GL #4159] 2023-09-01 12:01:51 +10:00
Mark Andrews 6c3d4d7aa2 Add CHANGES note for [GL #4159] 2023-09-01 12:01:50 +10:00
Mark Andrews 14727bb4b9 Detect uncleared libcrypto errors in rdata processing
If libcrypto errors are not cleared slow memory leaks occur which
are not detected at shutdown.
2023-09-01 12:01:20 +10:00
Mark Andrews b6e1650455 Style fix 2023-09-01 12:01:20 +10:00
Mark Andrews 299f519b09 Check that buf is large enough 2023-09-01 12:01:20 +10:00
Mark Andrews 9e2288208d Take ownership of pointer before freeing 2023-09-01 12:01:20 +10:00
Mark Andrews 4c4ecbc83c Address potential memory leak in dst__openssl_fromlabel 2023-09-01 12:01:20 +10:00
Mark Andrews b442ae8d3e Add missing "Design by Contract" REQUIREs 2023-09-01 12:01:20 +10:00
Mark Andrews 936b73cb57 Free evp_md_ctx and pkey at exit 2023-09-01 12:01:20 +10:00
Mark Andrews eaedba6621 Clear OpenSSL error stack when exiting 2023-09-01 12:01:20 +10:00
Mark Andrews 4f790b6c58 Clear OpenSSL errors on TSL error paths 2023-09-01 12:01:20 +10:00
Mark Andrews 96db614d69 Clear OpenSSL errors on context creation failures 2023-09-01 12:01:20 +10:00
Mark Andrews 247422c69f Clear OpenSSL errors on SHA failures 2023-09-01 12:01:20 +10:00
Mark Andrews 279973363e Clear OpenSSL errors on OSSL_PROVIDER_load failures 2023-09-01 12:01:20 +10:00
Mark Andrews 2ba62aebce Clear OpenSSL errors on engine errors 2023-09-01 12:01:19 +10:00
Mark Andrews 4ea926934a Clear OpenSSL errors on EVP failures 2023-09-01 12:01:19 +10:00
Mark Andrews 6df53cdb87 Clear OpenSSL errors on EVP_PKEY_new failures 2023-09-01 12:01:19 +10:00
Mark Andrews 86b04368b0 Clear OpenSSL errors on EC_KEY_get0_private_key failures 2023-09-01 12:01:19 +10:00
Mark Andrews abd8c03592 Clear OpenSSL errors on EVP_PKEY_get0_EC_KEY failures 2023-09-01 12:01:19 +10:00
Mark Andrews d8a9adc821 Clear OpenSSL errors on EVP_PKEY_get_bn_param failures 2023-09-01 12:01:19 +10:00
Mark Andrews 8529be30bb Clear OpenSSL errors on EVP_MD_CTX_create failures 2023-09-01 12:01:19 +10:00
Mark Andrews eafcd41120 Clear OpenSSL errors on ECDSA_SIG_new failures 2023-09-01 12:01:19 +10:00
Mark Andrews 5e09d959b0 Clear OpenSSL errors on d2i_ASN1_OBJECT failures
When d2i_ASN1_OBJECT() fails an error is pushed onto the thread's
error stack.  This is now cleared by calling ERR_clear_error().
2023-09-01 12:01:19 +10:00
Ondřej Surý 4e1630eeba Merge branch 'ondrej-isc_mem_cget' into 'main'
Checked array allocation arithmetic with isc_mem_get and friends

See merge request isc-projects/bind9!8237
2023-08-31 20:18:26 +00:00
Ondřej Surý 166cb53741 Add CHANGES note for [GL !8237] 2023-08-31 22:08:35 +02:00
Ondřej Surý d9048b3db1 Remove ISC_MEM_ZERO and isc_mem_*x() API
Use the new isc_mem_c*() calloc-like API for allocations that are
zeroed.

In turn, this also fixes couple of incorrect usage of the ISC_MEM_ZERO
for structures that need to be zeroed explicitly.

There are few places where isc_mem_cput() is used on structures with a
flexible member (or similar).
2023-08-31 22:08:35 +02:00
Ondřej Surý 8ac679a980 Remove ISC_MEM_ALIGN() memory flag
The ISC_MEM_ALIGN() was not used anywhere (except mem.c itself), so just
remove the unused flag.
2023-08-31 22:08:35 +02:00
Ondřej Surý 55c29b8d83 Do extra manual isc_mem_cget() conversions
Some of the cases weren't caught by the coccinelle and there were some
places where cget+memmove() could get converted to simple creget().
2023-08-31 22:08:35 +02:00
Ondřej Surý 89fcb6f897 Apply the isc_mem_cget semantic patch 2023-08-31 22:08:35 +02:00
Tony FinchandOndřej Surý a742fde51a A semantic patch to refactor isc_mem_cget and friends
The aim is to match unsafe patterns of allocation size arithmetic
and turn them into safe calls to the new `isc_mem_cget()`,
`isc_mem_creget()`, and `isc_mem_cput()`.
2023-08-31 22:08:35 +02:00
Ondřej Surý 6272482113 Checked array allocation arithmetic with isc_mem_get and friends
Add new isc_mem_cget(), isc_mem_creget(), and isc_mem_cput() macros to
complement the isc_mem_callocate() (which works like calloc()).

The overflow checks are implemented as macros in the <isc/mem.h>, so
that the compiler can see that the element size is constant: it should
always be `sizeof(something)`.
2023-08-31 22:08:35 +02:00
Ondřej Surý 8ff4895628 Merge branch 'each-cleanup-function-names' into 'main'
remove extra function names

See merge request isc-projects/bind9!8204
2023-08-31 20:08:13 +00:00
Evan Hunt 8bda38e7d4 remove dns_name_totext2() and dns_name_toprincipal()
we can pass option flags to dns_name_totext() to get the same
results, and eliminate the extra function names.
2023-08-31 12:53:32 -07:00
Evan Hunt 62d70966f2 remove dns_name_towire2()
we don't need two versions of dns_name_towire(), we can just add NULL
to the calls that don't need to specify a compression offset.
2023-08-31 10:29:16 -07:00
Evan Hunt a290ed5bd0 remove dns_name_fromstring2()
we don't need two versions of dns_name_fromstring() any longer; we
can just specify an origin value of dns_rootname for absolute names.
2023-08-31 10:29:16 -07:00
Evan Hunt 6909897adf remove cfg_acl_fromconfig2()
the extra option to limit ACL configuration to only one address family
was no longer in use, and has been removed.
2023-08-31 10:29:16 -07:00
Matthijs Mekking ac2b9280f2 Merge branch '4266-document-dnssec-policy-lifetime' into 'main'
Clarify BIND 9 time formats

Closes #4266

See merge request isc-projects/bind9!8228
2023-08-31 16:30:26 +00:00
Matthijs Mekking fd3d58d512 Add CHANGES entry for #4266 2023-08-31 17:43:15 +02:00
Matthijs Mekking b5a757c452 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.
2023-08-31 17:42:52 +02:00
Matthijs Mekking cc122d22b4 Add a glossary definition for duration
We don't yet explain the syntax of TTL-style suffixes or ISO 8601
duration formats.
2023-08-31 17:42:52 +02:00
Matthijs Mekking 07c70ea2bd 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.
2023-08-31 17:42:52 +02:00
Matthijs Mekking 509b911a50 Merge branch 'tt-arm-pkcs11-update' into 'main'
Update PKCS#11 section in the ARM

See merge request isc-projects/bind9!8258
2023-08-31 15:42:07 +00:00
Timo TeräsandMatthijs Mekking 38df202cdb Update PKCS#11 section in the ARM
Add instructions for pkcs11-provider and generalize common sections.
2023-08-31 15:41:39 +00:00
Michal Nowak 6f53d34201 Merge branch 'mnowak/unify-doc-tools-versions' into 'main'
Install Sphinx tools versions from BIND 9 repository

See merge request isc-projects/bind9!8251
2023-08-31 12:50:04 +00:00
Michal Nowak 520e97e2fc Install Sphinx tools versions from BIND 9 repository
The doc/arm/requirements.txt file is the single source of truth when it
comes to Sphinx tools versions used to build documentation via
util/release-tarball-comparison.sh.
2023-08-31 14:31:57 +02:00
Arаm Sаrgsyаn 3e5ccc3089 Merge branch 'aram/zone.c-got_transfer_quota-bugfix' into 'main'
Reset the 'result' before using it again in zone.c:got_transfer_quota()

See merge request isc-projects/bind9!8241
2023-08-31 09:41:34 +00:00
Ondřej SurýandArаm Sаrgsyаn 00cb151f8e 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.
2023-08-31 09:40:54 +00:00
Aram Sargsyan 6cab7fc627 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.
2023-08-31 09:40:54 +00:00
Matthijs Mekking 3f34b692e6 Merge branch '4278-rndc-flush-resets-stale-refresh-time-to-0' into 'main'
Restore serve-stale settings after cache flush

Closes #4278

See merge request isc-projects/bind9!8244
2023-08-31 09:08:52 +00:00
Matthijs Mekking 9523eb70f6 Add release note and CHANGES for #4278 2023-08-31 11:08:12 +02:00
Matthijs Mekking 3ae721db6c 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.
2023-08-31 11:07:35 +02:00
Matthijs Mekking 0f593fd70a Add serve-stale test settings after flush
Add a test case to ensure that after 'rndc flush', the serve-stale
settings are not reset.
2023-08-31 11:07:35 +02:00
Mark Andrews cd837f4e40 Merge branch '4170-extend-expire-opt-support-into-xfrin-c' into 'main'
Resolve "Extend EXPIRE opt support into xfrin.c"

Closes #4170

See merge request isc-projects/bind9!8064
2023-08-31 08:03:32 +00:00
Mark Andrews ac682009a8 Add release note for [GL #4170] 2023-08-31 11:35:16 +10:00
Mark Andrews b05fce45bf Add CHANGES note for [GL #4170] 2023-08-31 11:34:48 +10:00
Mark Andrews cf03b1ed95 Check EDNS EXPIRE is returned with AXFR 2023-08-31 11:34:14 +10:00
Mark Andrews 9e03b5f5cc Set the modification time of the zone file after dumping
For secondary, mirror and redirect zones the expiry time is set
from the zone file's modification time on restart.  As zone dumping
take time, set the modification time of the zone file to the expire
time less the expire interval.
2023-08-31 11:34:14 +10:00
Mark Andrews b04d941354 Trim the effective expire time based on expire option
and use that adjusted time to set the modification times.
2023-08-31 11:32:29 +10:00
Mark Andrews 0b4200c010 Extract the expire option from the response 2023-08-31 11:32:29 +10:00
Mark Andrews be21d31840 Handle EDNS induced FORMERR responses
If we are talking to a non EDNS aware primary that returns FORMERR
to EDNS requests retry the request without using EDNS.
2023-08-31 11:32:29 +10:00
Mark Andrews 690fd050a0 Allow EDNS to be used when making requests in xfrin
This allow for the EDNS options EXPIRE and NSID to be sent when
when making requests.  The existing controls controlling whether
EDNS is used and whether EXPIRE or NSID are sent are honoured.

Adjust the expected byte counts in the xfer system test to reflect
the EDNS overhead.  Adjust the dig call to match named's behavior
(don't set +expire as we are talking to a secondary).
2023-08-31 11:32:29 +10:00
Mark Andrews 87912e4bb8 Provide a mechanism to return the expire option value
to the zone code so that it can be used to adjust the expire time.
2023-08-31 11:32:29 +10:00
Arаm Sаrgsyаn 0cfe0a61dc Merge branch '4285-timer_test-timer_event-fix' into 'main'
Resolve "timer_test unit test intermittently fails in CI"

Closes #4285

See merge request isc-projects/bind9!8253
2023-08-30 16:34:00 +00:00
Aram Sargsyan 852e8204fe Use isc_loop_now() instead of uv_hrtime() for timestamps
The resolution of the uv_hrtime() function is bigger than the
intervals used in the timers, which can result in an unexpected
difference between the start_time and stop_time variables.

Use isc_loop_now(), which is based on uv_now() and has the same
milliseconds resolution as the functions in the uv_timer_t API.

Also fix a couple wrong numbers in the comments.
2023-08-30 16:03:39 +00:00
Mark Andrews b7c62b29d9 Merge branch 'marka-cleanup-cid-464884' into 'main'
Silence CID 464884 (REVERSE_INULL)

See merge request isc-projects/bind9!8248
2023-08-30 00:13:16 +00:00
Mark Andrews 60630fe3aa Silence CID 464884 (REVERSE_INULL)
*** CID 464884:  Null pointer dereferences  (REVERSE_INULL)
    /bin/tests/system/dyndb/driver/db.c: 644 in create_db()
    638
    639     	*dbp = (dns_db_t *)sampledb;
    640
    641     	return (ISC_R_SUCCESS);
    642
    643     cleanup:
       CID 464884:  Null pointer dereferences  (REVERSE_INULL)
       Null-checking "sampledb" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    644     	if (sampledb != NULL) {
    645     		if (dns_name_dynamic(&sampledb->common.origin)) {
    646     			dns_name_free(&sampledb->common.origin, mctx);
    647     		}
    648
    649     		isc_mem_putanddetach(&sampledb->common.mctx, sampledb,
2023-08-29 23:45:12 +00:00
Mark Andrews 62fb970d0a Merge branch '4280-isc-support-22588-bind-now-returning-servfail-for-attempted-deletions-of-non-existent-ptr-srv' into 'main'
Resolve "[ISC-support #22588] BIND now returning SERVFAIL for attempted deletions of non-existent PTR/SRV records"

Closes #4280

See merge request isc-projects/bind9!8247
2023-08-29 15:16:17 +00:00
Mark Andrews 2b4e109c6a Add release note for [GL #4280] 2023-08-30 00:48:50 +10:00
Mark Andrews bb3556baa4 Add CHANGES for [GL #4280] 2023-08-30 00:48:50 +10:00
Mark Andrews b76a15977a 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.
2023-08-30 00:48:50 +10:00
Mark Andrews 2b7192c5be 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.
2023-08-30 00:48:50 +10:00
Tom Krizek 7029f7df45 Merge branch 'tkrizek-update-sphinx-rtd-theme' into 'main'
Update sphinx_rtd_theme

See merge request isc-projects/bind9!8246
2023-08-29 08:07:34 +00:00
Tom Krizek 92143fa960 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
2023-08-29 10:07:05 +02:00
Matthijs Mekking c4bda5b592 Merge branch 'tt-improve-pkcs11-tests' into 'main'
Enable keyfromlabel and enginepkcs11 systemtests for pkcs11-provider

See merge request isc-projects/bind9!8170
2023-08-28 10:20:49 +00:00
Timo Teräs 7fbcf38a3f Enable keyfromlabel and enginepkcs11 systemtests with pkcs11-provider
- Simplify configuration management by deducing SoftHSM module path
  from openssl config

- Determine the engine flag (-E) value from openssl config

- Drop unused/unneeded environment variables

- Run pkcs11-provider tests on Debian "sid" ossl3 flavor
2023-08-25 14:59:16 +03:00
Timo Teräs 628dd278d3 Rework opensslecdsa_link to handle legacy key objects w/ openssl3
Due to bug in openssl3, the pkcs11-engine is made the default
provider if enabled. This causes key generation and load to
return legacy objects.

Openssl3 has limited glue and does not support the full set
of new style parameter to be inqueried from legacy key objects

Rewrite required functions to use first the new API (if available),
but fallback to the old API (if available). For the methods that
have proper OpenSSL compatiblity glue, ship only one version.
2023-08-25 14:59:16 +03:00
Arаm Sаrgsyаn edd9925e44 Merge branch '4273-streamdns-eagain' into 'main'
Resolve "crash while receiving 64 kiB message over TCP"

Closes #4273

See merge request isc-projects/bind9!8231
2023-08-24 12:43:31 +00:00
Aram Sargsyan a33dc921dc Fix a condition in isc_dnsstream_assembler_incoming()
Before calling isc_buffer_putmem(), there is a condition to check
that 'buf_size' is greater than 0. At this point 'buf_size' is
guaranteed to be greater than zero, so either the condition is
redundant, or 'unprocessed_size' should be checked instead, which
seems more logical, because calling isc_buffer_putmem() with
'unprocessed_size' being zero is not useful, although harmless.
2023-08-24 11:59:57 +00:00
Aram Sargsyan 9a271371d3 Handle cases when buf_size is zero
The isc_dnsstream_assembler_incoming() inline function expects that
when 'buf_size' is zero, then 'buf' must be NULL. The expectation is
not correct, because those values come from the libuv read callback,
and its documentation notes[1] that 'nread' ('buf_size' here) might
be 0, which does not indicate an error or EOF, but is equivalent to
EAGAIN or EWOULDBLOCK under read(2).

Change the isc_dnsstream_assembler_incoming() inline function to
remove the invalid expectation.

[1] https://docs.libuv.org/en/v1.x/stream.html#c.uv_read_cb
2023-08-24 11:59:57 +00:00
Aram Sargsyan 4d723c76b1 Add a a tcp system test case
The new test sends a 64 KiB message over TCP to named, and expects
it to handle it correctly.
2023-08-24 11:59:57 +00:00
Ondřej Surý 6b1ed14f17 Merge branch 'ondrej/remove-i386-as-fully-supported-platform' into 'main'
Move i386 and armhf to the Best-Effort category

See merge request isc-projects/bind9!8223
2023-08-23 14:55:14 +00:00
Ondřej Surý db94c7526c 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.
2023-08-23 16:54:22 +02:00
Ondřej Surý dda021281a Merge branch 'ondrej-cleanup-qp-in-forwarders' into 'main'
Refactor cleanup code in the qp-trie for the forwarders table

See merge request isc-projects/bind9!8212
2023-08-23 13:50:03 +00:00
Ondřej Surý 2e3eae6b91 Refactor cleanup code in the qp-trie for the forwarders table
Instead of duplicating the destroy_forwarders() code in the cleanup
sections, just call dns_forwarders_detach() every time - in case of
failure, the forwarders aren't going to be attached, and forwarders
object will be destroyed right away.
2023-08-23 15:49:17 +02:00
Ondřej Surý 01c758ea3a Merge branch 'ondrej-cleanup-mem-macros' into 'main'
Remove some unnecessary token pasting macrology

See merge request isc-projects/bind9!8236
2023-08-23 12:50:08 +00:00
Tony FinchandOndřej Surý 6271f3c054 Fix the style of an array de-allocation in dnssec-cds
Mention the element size explicitly, so that `matching_sigs()`,
`signed_loose()`, and `signed_strict()` use the same calculation.
2023-08-23 14:49:15 +02:00
Tony FinchandOndřej Surý 1d341096c1 Get rid of unnecessary macros in the system test dyndb driver
CHECKED_MEM_GET and ZERO_PTR are built-in features of isc_mem.
2023-08-23 14:49:15 +02:00
Tony FinchandOndřej Surý 52fcc9fc0f Remove some unnecessary token pasting macrology
There used to be an extra layer of indirection in the memory functions
for certain dynamic linking scenarios. This involved variant spellings
like isc__mem and isc___mem. The isc___mem variants were removed in
commit 7de846977b so the token pasting is no longer needed and
only serves to obfuscate.
2023-08-23 14:49:15 +02:00
Tom Krizek 911dd7fa36 Merge branch '3001-pytest-nitpicks' into 'main'
system tests stability tweaks and cleanup

Closes #3001

See merge request isc-projects/bind9!8239
2023-08-23 12:48:58 +00:00
Tom Krizek 40289d5440 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.
2023-08-23 14:06:20 +02:00
Tom Krizek 8c5833fe39 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.
2023-08-23 14:06:20 +02:00
Tom Krizek be2123a8e9 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.
2023-08-23 14:06:20 +02:00
Tom Krizek 7522583b57 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.
2023-08-23 14:06:20 +02:00
Tom Krizek 86043b0bbe 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.
2023-08-23 14:06:20 +02:00
Tom Krizek 1b3db25adf 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.
2023-08-23 14:06:20 +02:00
Tom Krizek 0361233b3d Skip checkds test on Python<3.7
checkds test requires the capture_output argument for subprocess.run()
which was added in Python 3.7.
2023-08-23 14:06:18 +02:00
Ondřej Surý a0801963ad Merge branch '4271-disable-DTrace-in-FIPS-jobs' into 'main'
Disable tracing in the FIPS enabled builds

Closes #4271

See merge request isc-projects/bind9!8235
2023-08-23 09:07:05 +00:00
Ondřej Surý a80608200d Disable tracing in the FIPS enabled builds
The dtrace command fails with segmentation fault in the FIPS-enabled
builds, thus we need to disable the tracing in the CI for the FIPS
jobs.
2023-08-23 11:06:14 +02:00
Matthijs Mekking 39490eccaf Merge branch '1181-nsupdate-tcp-soa-requests-main' into 'main'
Don't do TCP SOA requests for default servers

Closes #1181

See merge request isc-projects/bind9!8192
2023-08-23 08:29:08 +00:00
Matthijs Mekking 4249ebd92f Add release note and CHANGES for #1181 2023-08-23 09:56:57 +02:00
Matthijs Mekking 6502240442 Don't do DoT SOA requests for default servers
Default servers usually don't have DoT set up. Only do SOA queries if
the server is specified.
2023-08-23 09:56:38 +02:00
Ondřej Surý 6c4af7ca40 Merge branch '4275-DTrace-on-macOS-only-needs-header' into 'main'
Don't generate the probes.lo on macOS

Closes #4275

See merge request isc-projects/bind9!8234
2023-08-23 06:59:50 +00:00
Ondřej Surý 3b6db95e70 Regenerate the DTrace generated files on configure change
The DTrace generated files were missing dependency on the Makefile, so
they didn't get regenerated when ./configure was re-run.  This would
create problem especially between ./configure --enable-tracing vs
./configure --disable-tracing invocations.
2023-08-23 07:40:20 +02:00
Ondřej Surý d13ea59a3c Don't generate the probes.lo on macOS
The DTrace on macOS only needs header file and the dtrace command
doesn't have the -G option.  Skip generating the object file on macOS,
so the build doesn't fail.
2023-08-23 07:33:50 +02:00
Evan Hunt b4a3b133cc Merge branch '3835-cname-wildcard-loop-followup' into 'main'
prevent query_coveringnsec() from running twice

See merge request isc-projects/bind9!8214
2023-08-21 21:29:56 +00:00
Evan Hunt ba1f75684f CHANGES for [GL #3835] 2023-08-21 12:23:08 -07:00
Evan Hunt 0ae8b2e056 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.
2023-08-21 12:22:47 -07:00
Tom Krizek 344f0bb7ce Merge branch '4249-compile-test-files-during-make' into 'main'
Compile system test binaries during make

Closes #4249

See merge request isc-projects/bind9!8189
2023-08-21 19:13:13 +00:00
Tom Krizek 0422415500 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.
2023-08-21 20:04:50 +02:00
Tom Krizek 145bec51a0 Resolve scan-build issue in dummylib.c
Value stored to 'rdatap' is never read. Remove the line which has no
effect.
2023-08-21 20:04:50 +02:00
Tom Krizek 21980b43b8 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.
2023-08-21 20:04:48 +02:00
Ondřej Surý 664d7c642d Merge branch '4041-add-userspace-tracing' into 'main'
Add support for userspace tracing via USDT

Closes #4041

See merge request isc-projects/bind9!7872
2023-08-21 18:04:05 +00:00
Ondřej Surý 52cabc662f Add CHANGES and release note for [GL #4041] 2023-08-21 18:39:53 +02:00
Ondřej Surý 9b858769dc Add zone name to the LIBDNS_XFRIN probes
We already print the formatted zone name via the xfrin_log() function,
generate the text once and store it in xfr->info static buffer.  Then we
can reuse the string to pass it to the LIBDNS_XFRIN probes.
2023-08-21 18:39:53 +02:00
Ondřej SurýandPaul Frieden d332f07f38 Add a probe when the response rate limiting drops or slips query
Add a trace point that would report when a query gets dropped or slipped
by rate limits. It reports the client IP, the zone, and the RRL result
code.

Co-authored-by: Paul Frieden <pfrieden@yahooinc.com>
2023-08-21 18:39:53 +02:00
Ondřej Surý 96ccba5d51 Add tracing probes to the dns_xfrin unit
Add tracing probes to incoming transfers, so we can accurately measure
the individual events when sending, receiving and parsing the incoming
transfers.
2023-08-21 18:39:53 +02:00
Ondřej Surý 2484a3702a Add tracing probes to the isc_job unit
Add tracing probes to isc_job unit:

 * libisc:job_cb_before - before the job callback is called
 * libisc:job_cb_after - after the job callback is called
2023-08-21 18:39:53 +02:00
Ondřej Surý dcd60215ac Add tracing probes to the custom isc_rwlock implementation
Add tracing probes to ISC own isc_rwlock implementation to allow
fine-grained tracing.  The pthread rwlock already has probes inside
glibc, and it's difficult to add probes to headers included from the
other libraries.
2023-08-21 18:39:53 +02:00
Ondřej Surý 784d055809 Add support for User Statically Defined Tracing (USDT) probes
This adds support for User Statically Defined Tracing (USDT).  On
Linux, this uses the header from SystemTap and dtrace utility, but the
support is universal as long as dtrace is available.

Also add the required infrastructure to add probes to libisc, libdns and
libns libraries, where most of the probes will be.
2023-08-21 18:39:53 +02:00
Michal Nowak 1e16d41446 Merge branch '3893-make-debian-12-bookworm-base-image' into 'main'
Make Debian 12 "bookworm" the base image

See merge request isc-projects/bind9!8075
2023-08-21 15:19:49 +00:00
Michal Nowak 077d82403e 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.
2023-08-21 16:35:52 +02:00
Michal Nowak 55f5aa08f0 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.
2023-08-21 16:35:52 +02:00
Michal Nowak cfb06dabfe Drop PKCS11 testing from "sid", restore 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.
2023-08-21 16:35:52 +02:00
Michal Nowak 7929168295 Disable mandoc stylistic warning
We are not concerned by the "input text line longer than 80 bytes"
stylistic warning.
2023-08-21 16:35:52 +02:00
Michal Nowak a330ab221e Drop unneeded -Wno-compound-token-split-by-macro option
Debian 12 has Perl 5.36 and the option is no longer needed.
2023-08-21 16:35:52 +02:00
Michal Nowak 5e1120d9a3 Reintroduce Debian 11 "bullseye" Clang and GCC jobs 2023-08-21 16:35:52 +02:00
Michal Nowak 2d18c57c54 Make Debian 12 "bookworm" the base image
Just replace "bullseye" with "bookworm" and reintroduce Debian 11
"bullseye" later.
2023-08-21 16:35:52 +02:00
Ondřej Surý a5884c2c1d Merge branch '4265-remove-caching-of-netmgr-sockets-and-uvreqs' into 'main'
Limit the number of inactive handles and uvreqs kept for reuse

Closes #4265

See merge request isc-projects/bind9!8206
2023-08-21 14:35:37 +00:00
Ondřej Surý db7c501bd3 Add CHANGES note for [GL #4265] 2023-08-21 16:34:30 +02:00
Ondřej Surý 0c9cf8fabb Limit the memory pool for the uvreqs
Set the number of maximum free items for the uvreq memory pool to 64.
2023-08-21 16:34:30 +02:00
Ondřej Surý f36e118b9a Limit the number of inactive handles kept for reuse
Instead of growing and never shrinking the list of the inactive
handles (to be reused mostly on the UDP connections), limit the number
of maximum number of inactive handles kept to 64.  Instead of caching
the inactive handles for all listening sockets, enable the caching on on
UDP listening sockets.  For TCP, the handles were cached for each
accepted socket thus reusing the handles only for long-standing TCP
connections, but not reusing the handles across different TCP streams.
2023-08-21 16:34:30 +02:00
Tom Krizek 1a958b709a Merge branch '4252-pytest-symlink-to-test-artifacts' into 'main'
Create symlinks to test artifacts for pytest runner

Closes #4252

See merge request isc-projects/bind9!8194
2023-08-21 13:55:07 +00:00
Tom Krizek 355dc73391 .gitignore temporary directories and symlinks in system test dir 2023-08-21 15:54:40 +02:00
Tom Krizek d66ff81543 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.
2023-08-21 15:54:40 +02:00
Tom Krizek 83ddca7690 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.
2023-08-21 15:54:40 +02:00
Tom Krizek f91d0b13e8 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.
2023-08-21 15:54:40 +02:00
Tom Krizek e1ca5c8071 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.
2023-08-21 15:54:38 +02:00
Ondřej Surý 838dc9b053 Merge branch '4125-release-notes' into 'main'
Add release note for [GL #4125]

Closes #4125

See merge request isc-projects/bind9!8216
2023-08-21 13:19:00 +00:00
Ondřej Surý 58a8de5246 Add release note for [GL #4125] 2023-08-21 15:16:41 +02:00
Tom Krizek f52dd73cac Merge branch '4246-remove-legacy-test-runner-from-ci' into 'main'
Use pytest runner for out-of-tree and OpenBSD system tests in CI

Closes #4246

See merge request isc-projects/bind9!8193
2023-08-21 13:13:33 +00:00
Tom Krizek b1a9d1fe25 Improve pytest message when sanitizer report is found 2023-08-21 15:12:53 +02:00
Tom Krizek bc66bf146f ci: remove legacy system test runner template 2023-08-21 15:12:53 +02:00
Tom Krizek d49d9ec80e 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.
2023-08-21 15:12:53 +02:00
Tom Krizek 8846877dfe 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.
2023-08-21 15:12:51 +02:00
Ondřej Surý f9657267af Merge branch '4125-statschannel-content-length-overflow' into 'main'
Parse statschannel Content-Length: more carefully

Closes #4125

See merge request isc-projects/bind9!8018
2023-08-21 13:01:28 +00:00
Tony FinchandOndřej Surý 1ba538f32f Add CHANGES entry for [GL #4125] 2023-08-21 14:14:18 +02:00
Tony FinchandOndřej Surý 26e10e8fb5 Parse statschannel Content-Length: more carefully
A negative or excessively large Content-Length could cause a crash
by making `INSIST(httpd->consume != 0)` fail.
2023-08-21 14:14:18 +02:00
Michał Kępień 159c880240 Merge branch 'michal/post-release-tweaks' into 'main'
Post-release tweaks (cross-version testing cleanup, release checklist tweaks)

See merge request isc-projects/bind9!8210
2023-08-17 15:31:51 +00:00
Michał Kępień 45bf6123ef Update release checklist
Update the release checklist with links to recently implemented tools
for automating certain tasks.
2023-08-17 17:30:37 +02:00
Michał Kępień 96e4139fb8 Revert "Exclude dupsigs and keymgr2kasp from cross-version-config-tests"
This reverts commit 4eac32fe23.

With the v9.19.16 release tag merged, the "cross-version-config-tests"
GitLab CI job will no longer fail due to the two relevant system tests
being absent from the development branch.  This makes the pytest
filtering expression added to work around that issue unnecessary, so
remove it.
2023-08-17 17:30:37 +02:00
Michal Nowak 4970d0ca38 Merge branch '4139-test_send_timeout-check-can-be-unstable' into 'main'
Make the test_send_timeout check more stable

Closes #4139

See merge request isc-projects/bind9!8168
2023-08-17 13:11:04 +00:00
Michal Nowak 681b23c398 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.
2023-08-17 14:13:59 +02:00
Tom KrizekandMichal Nowak 5b703de733 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.
2023-08-17 14:13:59 +02:00
Michał Kępień e27a33e621 Merge tag 'v9.19.16' 2023-08-17 14:10:53 +02:00
Michal Nowak b88f914c79 Merge branch 'mnowak/clean-leftover-files' into 'main'
Clean leftover files in autosign and masterformat

See merge request isc-projects/bind9!8167
2023-08-16 12:45:24 +00:00
Michal Nowak 8a0da13479 Clean leftover files in autosign and masterformat
The following files were reported in CI by the legacy system test runner
and prevented job to pass. They should be removed.

    $ if git rev-parse > /dev/null 2>&1; then ( ! grep "^I:.*:file.*not removed$" *.log ); fi
    autosign.log:I:autosign:file autosign/ns3/kskonly.example.db.jbk not removed
    autosign.log:I:autosign:file autosign/ns3/optout.example.db.jbk not removed
    autosign.log:I:autosign:file autosign/ns3/reconf.example.db.jbk not removed
    masterformat.log:I:masterformat:file masterformat/ns1/signed.db.raw.jbk not removed
    masterformat.log:I:masterformat:file masterformat/ns1/signed.db.raw.signed not removed
    masterformat.log:I:masterformat:file masterformat/ns1/signed.db.raw.signed.jnl not removed

Don't print an error when the ns*/inactive directory is not
present:

    rmdir: ns*/inactive: No such file or directory

Remove nsupdate.out.test file instead of nsupdate.out, as the latter
does not exist.
2023-08-16 12:01:11 +02:00
Ondřej Surý 2c51e936e4 Merge branch '4228-fix-heap-use-after-free-in-dns_dispatch_createtcp' into 'main'
Attach to the dns_dispatchmgr in the dns_view object

Closes #4228

See merge request isc-projects/bind9!8203
2023-08-16 07:22:23 +00:00
Ondřej SurýandEvan Hunt ce1b1b4058 Add CHANGES note for [GL #4228] 2023-08-15 10:26:02 -07:00
Ondřej SurýandEvan Hunt d76ab69772 Attach to the dns_dispatchmgr in the dns_view object
The dns_dispatchmgr object was only set in the dns_view object making it
prone to use-after-free in the dns_xfrin unit when shutting down named.

Remove dns_view_setdispatchmgr() and optionally pass the dispatchmgr
directly to dns_view_create() when it is attached and not just assigned,
so the dns_dispatchmgr doesn't cease to exist too early.

The dns_view_getdnsdispatchmgr() is now protected by the RCU lock, the
dispatchmgr reference is incremented, so the caller needs to detach from
it, and the function can return NULL in case the dns_view has been
already shut down.
2023-08-15 10:25:37 -07:00
Evan Hunt cfad194e1d Merge branch 'each-qp-nta' into 'main'
Use a QP trie for the NTA table, forwarders and key tables

See merge request isc-projects/bind9!7811
2023-08-15 17:16:21 +00:00
Ondřej Surý bf1223bf13 Add CHANGES note for [GL !7811] 2023-08-15 17:34:20 +02:00
Evan HuntandOndřej Surý b466439437 use a qp-trie for the keytable
Instead of an RBT for the trust anchor tables, use a QP-trie.
2023-08-15 14:25:24 +02:00
Evan HuntandOndřej Surý dea79e7053 use a qp-trie for the forwarders table
Instead of an RBT for the forwarders table, use a QP trie.

We now use reference counting for dns_forwarders_t. When a forwarders
object is retrieved by dns_fwdtable_find(), it must now be explicitly
detached by the caller afterward.

QP tries require stored objects to include their names, so the
the forwarders object now has that. This obviates the need to
pass back a separate 'foundname' value from dns_fwdtable_find().
2023-08-15 14:25:24 +02:00
Evan HuntandOndřej Surý 5768dd96ea clean up some unused functions
dns_fwdtable_delete() was only used by dns_client_clearservers(),
which in turn was never used. both functions have now been deleted.
2023-08-15 14:24:46 +02:00
Evan HuntandOndřej Surý aff01bda54 use a qp-trie for the NTA table
replace the red-black tree used by the negative trust anchor table
with a QP trie.

because of this change, dns_ntatable_init() can no longer fail, and
neither can dns_view_initntatable(). these functions have both been
changed to type void.
2023-08-15 14:24:46 +02:00
Evan HuntandOndřej Surý 06216f4f90 rename dns_qp_findname_parent() to _findname_ancestor()
this function finds the closest matching ancestor, but the function
name could be read to imply that it returns the direct parent node;
this commit suggests a slightly less misleading name.
2023-08-15 14:24:46 +02:00
Tony FinchandOndřej Surý b38c71961d Improve qp-trie leaf return values
Make the `pval_r` and `ival_r` out arguments optional.

Add `pval_r` and `ival_r` out arguments to `dns_qp_deletekey()`
and `dns_qp_deletename()`, to return the deleted leaf.
2023-08-15 14:24:39 +02:00
Ondřej Surý 8a2763487d Merge branch 'fanf/add-SET_IF_NOT_NULL-macro' into 'main'
A SET_IF_NOT_NULL() macro for optional return values

See merge request isc-projects/bind9!8201
2023-08-15 11:23:27 +00:00
Tony FinchandOndřej Surý c622b349e4 Apply the SET_IF_NOT_NULL() semantic patch
spatch --sp-file cocci/set_if_not_null.spatch --use-gitgrep --dir "." --include-headers --in-place
2023-08-15 12:21:41 +02:00
Tony FinchandOndřej Surý 0d6dcd217d A SET_IF_NOT_NULL() macro for optional return values
The SET_IF_NOT_NULL() macro avoids a fair amount of tedious boilerplate,
checking pointer parameters to see if they're non-NULL and updating
them if they are.  The macro was already in the dns_zone unit, and this
commit moves it to the <isc/util.h> header.

I have included a Coccinelle semantic patch to use SET_IF_NOT_NULL()
where appropriate. The patch needs an #include in `openssl_shim.c`
in order to work.
2023-08-15 12:04:29 +02:00
Mark Andrews 5a36bebfce Merge branch '4259-statschannel-leftovers' into 'main'
Resolve "Statschannel leftovers"

Closes #4259

See merge request isc-projects/bind9!8199
2023-08-15 04:21:33 +00:00
Mark Andrews 7da47fd858 Remove bind9.xsl.1, bind9.xsl.2 and bind9.xsl.3 2023-08-15 10:34:19 +10:00
Mark Andrews cc491f539b Merge branch '4238-the-mkeys-system-test-can-update-the-root-zone-too-fast' into 'main'
Resolve "The mkeys system test can update the root zone too fast"

Closes #4238

See merge request isc-projects/bind9!8161
2023-08-14 23:23:33 +00:00
Mark Andrews 40e3529379 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.
2023-08-14 22:49:16 +00:00
Ondřej Surý dadc214b0f Merge branch '4124-check-statschannel-if-modified-since' into 'main'
Fix a stack buffer overflow in the statistics channel

Closes #4124

See merge request isc-projects/bind9!8195
2023-08-14 10:59:02 +00:00
Ondřej Surý 57c8bdaff5 Add CHANGES and release notes for [GL #4124] 2023-08-14 11:30:45 +02:00
Tony FinchandOndřej Surý b22c87ca61 Fix a stack buffer overflow in the statistics channel
A long timestamp in an If-Modified-Since header could overflow a
fixed-size buffer.
2023-08-14 11:30:24 +02:00
Mark Andrews bafb3f97c2 Merge branch 'marka-fix-formatting-errors' into 'main'
Follow-up: Fixes to provider/engine based ECDSA key handling

See merge request isc-projects/bind9!8186
2023-08-09 23:49:25 +00:00
Matthijs MekkingandMark Andrews fa108db279 Revert a337dbef
Revert commit that always uses OpenSSL 3.0 API when available,
the new APIs should work always, but OpenSSL has non-obvious
omissions in the automatic mappings it provides.
2023-08-09 23:48:17 +00:00
Mark Andrews 00a09e0d35 Only set key->engine if engine != NULL 2023-08-09 23:48:17 +00:00
Mark Andrews d527ae11c9 Fix clang formatting 2023-08-09 23:48:17 +00:00
Mark Andrews 3907de98ca Fix line wrap 2023-08-09 23:48:17 +00:00
Mark Andrews 0aeffb55c9 Merge branch '4245-incorrect-return-values-in-rpz-s-addr-and-drop-function' into 'main'
Resolve "Incorrect return values in rpz's addr and drop functions"

Closes #4245

See merge request isc-projects/bind9!8172
2023-08-09 23:33:25 +00:00
Mark Andrews 1394f12a1c 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.
2023-08-09 10:45:38 +10:00
Michal Nowak a5cf49c378 Merge branch 'mnowak/cross-version-test' into 'main'
Cross-version testing with named configurations

See merge request isc-projects/bind9!7863
2023-08-08 17:37:19 +00:00
Michal Nowak 4eac32fe23 Exclude dupsigs and keymgr2kasp from cross-version-config-tests
pytest should not schedule dupsigs and keymgr2kasp system tests removed
in BIND 9 mainline but still present in BIND 9 baseline version
(v9.19.15). (Can be dropped once the v9.19.16 tag is present.)
2023-08-08 19:18:36 +02:00
Michal Nowak cc54211baa 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.
2023-08-08 19:18:36 +02:00
Matthijs Mekking 9f3b5d6841 Merge branch 'tt-provider-engine' into 'main'
Fix keyfromlabel to not use engine parameter for provider keys

See merge request isc-projects/bind9!8153
2023-08-08 14:26:15 +00:00
Timo Teräs de486d0ec5 Fix keyfromlabel to not use engine parameter for provider keys
- Rework key checks to not require 'engine' tag, private key
  is valid with 'label' tag alone

- Fix _fromlabel() functions to work with engine == NULL

- Update dst__openssl_fromlabel_engine() to do provider lookup
  only when engine is not set
2023-08-08 17:16:14 +03:00
Matthijs Mekking 222f2bd11c Merge branch 'tt-ecdsa-fixes' into 'main'
Fixes to provider/engine based ECDSA key handling

See merge request isc-projects/bind9!8152
2023-08-08 14:13:21 +00:00
Timo Teräs 1b47385f58 Add CHANGES for GL !8152 2023-08-08 14:08:00 +00:00
Timo Teräs a337dbef22 Always use OpenSSL 3.0 API when available
The new APIs work always as OpenSSL provides glue to access also
old style engines using the new APIs.
2023-08-08 14:08:00 +00:00
Timo Teräs 8de089e514 Fix support for engine/provider ECDSA keys
Exporting private key of on-token keys is not possible. Fix code
to not fail in this case.
2023-08-08 14:08:00 +00:00
Timo Teräs de45aab184 Fix OpenSSL 3.0 API EC curve names
The OpenSSL man page examples used the NIST curve names which
are supported. But when querying the name, the native OpenSSL
name is returned. Use these names to pass curve type checks for
engine/provider objects.
2023-08-08 14:08:00 +00:00
Michal Nowak 349fa71a0d Merge branch 'mnowak/pytest_rewrite_stress' into 'main'
Rewrite stress test to pytest

See merge request isc-projects/bind9!7905
2023-08-08 12:29:24 +00:00
Michał KępieńandMichal Nowak 08a8906cfc 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.
2023-08-08 10:31:45 +02:00
Michal Nowak ecd7b30d0a 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.
2023-08-08 10:31:45 +02:00
Michał Kępień 448831dde2 Merge branch '4240-dnstap-system-test-fixes' into 'main'
"dnstap" system test fixes

Closes #4240

See merge request isc-projects/bind9!8177
2023-08-07 11:58:54 +00:00
Michał Kępień 67df78e518 Lower the minimum expected dnstap output file size
Lower the size requirement for the dnstap output file produced during
the "dnstap" system test from 454 to 450 bytes; while files of that size
are not generated in any GitLab CI job, they are in other environments
where the test passes.
2023-08-07 11:26:58 +02:00
Michał Kępień 26d3d97f12 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.
2023-08-07 11:26:58 +02:00
Michał Kępień bd2941fc72 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.
2023-08-07 11:26:58 +02:00
Mark Andrews ac41053d38 Merge branch '4243-_wait_for_stats-errors-not-detected-in-ixfr-system-test' into 'main'
Resolve "_wait_for_stats errors not detected in ixfr system test"

Closes #4243

See merge request isc-projects/bind9!8171
2023-08-07 09:16:55 +00:00
Mark Andrews 287a1ac09b 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.
2023-08-07 08:49:47 +00:00
Michał Kępień 638db88737 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.17' into 'main'
Set up version and release notes for BIND 9.19.17

See merge request isc-projects/bind9!8173
2023-08-07 08:26:04 +00:00
Michał Kępień c0a6068215 Set up release notes for BIND 9.19.17 2023-08-07 10:23:55 +02:00
Michał Kępień 7fffb66891 Update BIND version to 9.19.17-dev 2023-08-07 10:23:55 +02:00
Michał Kępień 5c1f9951b3 Update BIND version for release 2023-08-04 11:17:54 +02:00
Michał Kępień 0a13a5e373 Add a CHANGES marker 2023-08-04 11:17:54 +02:00
Michał Kępień 56aad07a4d Merge branch 'michal/prepare-documentation-for-bind-9.19.16' into 'v9.19.16-release'
Prepare documentation for BIND 9.19.16

See merge request isc-private/bind9!559
2023-08-04 11:17:54 +02:00
Michał Kępień 7d754c2113 Add release note for GL #4215 2023-08-04 11:17:54 +02:00
Michał Kępień f6a8008e8f Reorder release notes 2023-08-04 11:17:54 +02:00
Michał Kępień 24b45a1e03 Tweak and reword release notes 2023-08-04 11:17:54 +02:00
Michał Kępień 89617cd3d6 Prepare release notes for BIND 9.19.16 2023-08-04 11:17:54 +02:00
Evan Hunt 9aa6cd74fa Merge branch '4232-rbtdb-performance-fix' into 'main'
use read lock in rdataset_getownercase()

Closes #4232

See merge request isc-projects/bind9!8169
2023-08-04 09:12:45 +00:00
Evan Hunt b3c2b64662 use read lock in rdataset_getownercase()
we were incorrectly write-locking the node when retrieving
the owner case of an rdataset.
2023-08-03 13:26:27 -07:00
Matthijs Mekking c3fbcda5a1 Merge branch 'matthijs-followup-4032' into 'main'
Change default TTLsig to one week

See merge request isc-projects/bind9!8164
2023-08-02 10:21:32 +00:00
Matthijs Mekking 32686beabc 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.
2023-08-02 11:16:50 +02:00
Michał Kępień ffd05d82ed Merge branch 'michal/add-changes-entry-for-rbtdb-split-up' into 'main'
Add CHANGES entry for GL !7873

See merge request isc-projects/bind9!8162
2023-08-02 08:44:11 +00:00
Michał Kępień e5a0784e60 Add CHANGES entry for GL !7873 2023-08-02 10:40:09 +02:00
Evan Hunt 39f46fc128 Merge branch '3700-deprecate-dialup' into 'main'
deprecate "dialup" and "heartbeat-interval"

Closes #3700

See merge request isc-projects/bind9!8080
2023-08-02 01:38:27 +00:00
Evan Hunt d10b6a4b39 CHANGES and release note for [GL #3700] 2023-08-01 18:10:44 -07:00
Evan Hunt eeeccec67c 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.
2023-08-01 18:10:44 -07:00
Mark Andrews cd0f115082 Merge branch '4229-nextpart-failed-set-e-fallout' into 'main'
Resolve "nextpart failed, set -e fallout?"

Closes #4229

See merge request isc-projects/bind9!8149
2023-08-02 00:21:26 +00:00
Mark Andrews dd74840291 Add sleep 1 so that the signing happens in a different second 2023-08-01 23:47:55 +00:00
Mark Andrews 162db75e2b Use $() instead of backticks 2023-08-01 23:47:55 +00:00
Mark Andrews 6d0f19da7d Correctly grep nextpart output 2023-08-01 23:47:55 +00:00
Mark Andrews edd4226df2 Merge branch '4059-oracle-linux-8-shell-doesn-t-always-restore-environment-variable-correctly' into 'main'
Resolve "Oracle Linux 8 shell doesn't always restore environment variable correctly"

Closes #4059

See merge request isc-projects/bind9!7908
2023-08-01 23:47:38 +00:00
Mark Andrews 96f75bba18 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.
2023-08-01 23:17:15 +00:00
Arаm Sаrgsyаn d6cbb3d6aa Merge branch '4226-dig-help-message-https-plain-get-vs-http-plain-get' into 'main'
Fix dig help message typo in the http-plain-get option

Closes #4226

See merge request isc-projects/bind9!8148
2023-08-01 10:39:26 +00:00
Aram Sargsyan 77d1476c46 Fix dig help message typo in the http-plain-get option
The option name is misspelled as 'https-plain-get'. Fix the error.
2023-08-01 10:38:44 +00:00
Matthijs Mekking 9a4a4c6678 Merge branch '4032-ignore-max-zone-ttl-dnssec-policy-insecure' into 'main'
Ignore max-zone-ttl on dnssec-policy insecure

Closes #4032

See merge request isc-projects/bind9!8142
2023-08-01 07:46:22 +00:00
Matthijs Mekking 0bdf1980c4 Add CHANGES and release note for #4032 2023-08-01 08:57:11 +02:00
Matthijs Mekking dc6dafdad1 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.
2023-08-01 08:56:52 +02:00
Matthijs Mekking ce869a521c Merge branch '3677-dnssec-policy-inline-signing' into 'main'
Add inline-signing to dnssec-policy

Closes #3677

See merge request isc-projects/bind9!7204
2023-08-01 06:55:56 +00:00
Matthijs Mekking bd00c2ce4e Add release note and CHANGES for GL #3677
News worthy.
2023-08-01 06:55:48 +00:00
Matthijs Mekking 1e0f77b349 Remove redundant inline-signing lines from docs
Now that inline-signing is explicitly set in dnssec-policy, remove
the redundant "inline-signing yes;" lines from the documentation.
2023-08-01 06:55:48 +00:00
Matthijs Mekking 62ddc3dca0 Remove redundant inline-signing lines from tests
Now that inline-signing is explicitly set in dnssec-policy, remove
the redundant "inline-signing yes;" lines from the system tests.
2023-08-01 06:55:48 +00:00
Matthijs Mekking 495597a91b Update inline-signing checkconf code
When using automated DNSSEC management, it is required that the zone
is dynamic, or that inline-signing is enabled (or both). Update the
checkconf code to also allow inline-signing to be enabled within
dnssec-policy.
2023-08-01 06:55:48 +00:00
Matthijs Mekking bbfdcc36c8 Add inline-signing to dnssec-policy
Add an option to enable/disable inline-signing inside the
dnssec-policy clause. The existing inline-signing option that is
set in the zone clause takes priority, but if it is omitted, then the
value that is set in dnssec-policy is taken.

The built-in policies use inline-signing.

This means that if you want to use the default policy without
inline-signing you either have to set it explicitly in the zone
clause:

    zone "example" {
        ...
        dnssec-policy default;
        inline-signing no;
    };

Or create a new policy, only overriding the inline-signing option:

    dnssec-policy "default-dynamic" {
        inline-signing no;
    };

    zone "example" {
        ...
        dnssec-policy default-dynamic;
    };

This also means that if you are going insecure with a dynamic zone,
the built-in "insecure" policy needs to be accompanied with
"inline-signing no;".
2023-08-01 06:55:48 +00:00
Ondřej Surý 4bf94f4c52 Merge branch '4196-use-rculist-for-dns_db_updatenotify' into 'main'
Use cds_lfht for updatenotify mechanism in dns_db unit

Closes #4196

See merge request isc-projects/bind9!8097
2023-07-31 16:12:54 +00:00
Ondřej Surý 8c4cf5b1de fixup! Use cds_lfht for updatenotify mechanism in dns_db unit 2023-07-31 18:11:34 +02:00
Ondřej Surý a1afa31a5a Use cds_lfht for updatenotify mechanism in dns_db unit
The updatenotify mechanism in dns_db relied on unlocked ISC_LIST for
adding and removing the "listeners".  The mechanism relied on the
exclusive mode - it should have been updated only during reconfiguration
of the server.  This turned not to be true anymore in the dns_catz - the
updatenotify list could have been updated during offloaded work as the
offloaded threads are not subject to the exclusive mode.

Change the update_listeners to be cds_lfht (lock-free hash-table), and
slightly refactor how register and unregister the callbacks - the calls
are now idempotent (the register call already was and the return value
of the unregister function was mostly ignored by the callers).
2023-07-31 18:11:34 +02:00
Ondřej Surý 6856798919 Merge branch 'ondrej/add-isc_rwlock-unit-test' into 'main'
Add rwlock unit test

See merge request isc-projects/bind9!7859
2023-07-31 16:08:46 +00:00
Ondřej Surý 46d75e0004 Add rwlock unit test
Add simple rwlock unit test and rwlock benchmark.  The benchmark
compares the pthread rwlock with isc rwlock implementation, so it's
mainly useful when developing a new isc rwlock implementation.
2023-07-31 18:07:56 +02:00
Ondřej Surý ed944ba8fd Merge branch '4223-replace-dns_badcache-hashtable-implementation' into 'main'
Refactor dns_badcache to use cds_lfht lock-free hashtable

Closes #4223

See merge request isc-projects/bind9!8139
2023-07-31 13:54:11 +00:00
Ondřej Surý 10279f540d Add CHANGES note for [GL #4223] 2023-07-31 15:51:15 +02:00
Ondřej Surý c1821ccf92 Call rcu_barrier() five times in the isc__mem_destroy()
Because rcu_barrier() needs to be called as many times as the number of
nested call_rcu() calls (call_rcu() calls made from call_rcu thread),
and currently there's no mechanism to detect whether there are more
call_rcu callbacks scheduled, we simply call the rcu_barrier() multiple
times.  The overhead is negligible and it prevents rare assertion
failures caused by the check for memory leaks in isc__mem_destroy().
2023-07-31 15:51:15 +02:00
Ondřej Surý 1e3b6d2d83 Don't cleanup the dns_message_checksig fuzzer in atexit handler
After the dns_badcache refactoring, the dns_badcache_destroy() would
call call_rcu().  The dns_message_checksig cleanup which calls
dns_view_detach() happens in the atexit handler, so there might be
call_rcu threads started very late in the process.  The liburcu
registers library destructor that destroys the data structured internal
to liburcu and this clashes with the call_rcu thread that just got
started in the atexit() handler causing either (depending on timing):

 - a normal run
 - a straight segfault
 - an assertion failure from liburcu

Instead of trying to cleanup the dns_message_checksig unit, ignore the
leaked memory as we do with all the other fuzzing tests.
2023-07-31 15:51:15 +02:00
Ondřej Surý b570750382 Make the load-names benchmark multithreaded
The load-names benchmark was originally only measuring single thread
performance of the data structures.  As this is not how those are used
in the real life, it was refactored to be multi-threaded with proper
protections in place (rwlock for ht, hashmap and rbt; transactions for
qp).

The qp test has been extended to see effect of the dns_qp_compact() and
rcu_barrier() on the overall speed and memory consumption.
2023-07-31 15:51:15 +02:00
Ondřej Surý 4dacdde28f Refactor dns_badcache to use cds_lfht lock-free hashtable
The dns_badcache unit had (yet another) own locked hashtable
implementation.  Replace the hashtable used by dns_badcache with
lock-free cds_lfht implementation from liburcu.
2023-07-31 15:51:15 +02:00
Ondřej Surý c4bc43c8a7 Merge branch 'stepan/fix-check-in-ecdsa-system-test' into 'main'
Fix ecdsa256 check in ecdsa system test setup

See merge request isc-projects/bind9!8053
2023-07-28 07:14:27 +00:00
Štěpán BalážikandOndřej Surý 10194baa07 Fix ecdsa256 check in ecdsa system test setup
Probably by copy-paste mistake, ecdsa384 was checked twice.
2023-07-28 09:13:39 +02:00
Ondřej Surý baa8f81b3d Merge branch '4086-run-dispentry_destroy-on-associated-loop' into 'main'
Pin dns_request to the associated loop

Closes #4086

See merge request isc-projects/bind9!8137
2023-07-28 07:07:50 +00:00
Ondřej Surý 9908e0a664 Add CHANGES note for [GL #4086] 2023-07-28 09:01:36 +02:00
Ondřej Surý 4ca64c1799 Pin dns_request to the associated loop
When dns_request was canceled via dns_requestmgr_shutdown() the cancel
event would be propagated on different loop (loop 0) than the loop where
request was created on.  In turn this would propagate down to isc_netmgr
where we require all the events to be called from the matching isc_loop.

Pin the dns_requests to the loops and ensure that all the events are
called on the associated loop.  This in turn allows us to remove the
hashed locks on the requests and change the single .requests list to be
a per-loop list for the request accounting.

Additionally, do some extra cleanup because some race condititions are
now not possible as all events on the dns_request are serialized.
2023-07-28 09:01:22 +02:00
Ondřej Surý 0fa8d8c191 Merge branch 'ondrej/remove__tsan_acquire_release-hints' into 'main'
Cleanup the __tsan_acquire/__tsan_release

See merge request isc-projects/bind9!8114
2023-07-28 06:59:44 +00:00
Ondřej Surý b6b0d81a36 Cleanup the __tsan_acquire/__tsan_release
With ThreadSanitizer support added to the Userspace RCU, we no longer
need to wrap the call_rcu and caa_container_of with
__tsan_{acquire,release} hints.  Remove the direct calls to
__tsan_{acquire,release} and the isc_urcu_{container,cleanup} macros.
2023-07-28 08:59:08 +02:00
Mark Andrews c8b73d98e4 Merge branch '4225-return-refused-if-gssapi-not-configured' into 'main'
Resolve "SERVFAIL response to TKEY query"

Closes #4225

See merge request isc-projects/bind9!8146
2023-07-28 06:43:58 +00:00
Mark Andrews ccaefce7ca Add CHANGES for [GL #4225] 2023-07-28 14:38:20 +10:00
Mark Andrews 3a2a24903c 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.
2023-07-28 14:38:20 +10:00
Mark Andrews f244619680 Report TKEY query errors in nsupdate 2023-07-28 14:38:20 +10:00
Mark Andrews b5076014b9 Return REFUSED if GSSAPI is not configured
Return REFUSED if neither a keytab nor a gssapi credential is
configured to GSSAPI/TKEY requests.
2023-07-28 14:37:32 +10:00
Ondřej Surý 5342d6e97d Merge branch 'ondrej/workaround-the-ASAN-report-for-cds_lfht_for_each_entry' into 'main'
Workaround AddressSanitizer overzealous check

See merge request isc-projects/bind9!8116
2023-07-27 13:22:08 +00:00
Ondřej Surý dc3e07572b Workaround AddressSanitizer overzealous check
The cds_lfht_for_each_entry and cds_lfht_for_each_entry_duplicate macros
had a code that operated on the NULL pointer, at the end of the list it
was calling caa_container_of() on the NULL pointer in the init-clause
and iteration-expression, but the result wasn't actually used anywhere
because the cond-expression in the for loop has prevented executing
loop-statement.  This made AddressSanitizer notice the invalid operation
and rightfully complain.

This was reported to the upstream and fixed there.  Pull the upstream
fix into our <isc/urcu.h> header, so our CI checks pass.
2023-07-27 15:21:39 +02:00
Ondřej Surý 7c8d6a454d Merge branch '4227-free-stub_glue_request-in-stub_glue_response' into 'main'
Free struct stub_glue_request in stub_glue_response() callback

Closes #4227

See merge request isc-projects/bind9!8147
2023-07-27 10:34:20 +00:00
Ondřej Surý 7a2b4ad17b Add CHANGES note for [GL #4227] 2023-07-27 12:34:03 +02:00
Ondřej Surý 31c43d4b76 Free struct stub_glue_request in stub_glue_response() callback
When stub_glue_response() is called, the associated data is stored in
newly allocated struct stub_glue_request.  The allocated structure is
never freed in the callback, thus we leak a little bit of memory.
2023-07-27 12:34:03 +02:00
Ondřej Surý 57a568e8f9 Unify the naming for struct stub_glue_request
The stub_request_nameserver_address() used 'request' as name for
struct stub_glue_request leading to confusion between 'request'
(stub_glue_request) and 'request->request' (dns_request_t).

Unify the name to 'sgr' already used in struct stub_glue_response().
2023-07-27 12:34:03 +02:00
Ondřej Surý 8ff1729b66 Merge branch 'ondrej/cleanup-isc_stats_create-return' into 'main'
Refactor isc_stats_create() and its downstream users to return void

See merge request isc-projects/bind9!8055
2023-07-27 10:10:26 +00:00
Ondřej Surý bf44554889 Refactor ns_server_create() to return void
After isc_stats_create() change, the ns_server_create() cannot fail, so
refactor the function to return void and fix all its uses.
2023-07-27 11:37:44 +02:00
Ondřej Surý ea2fe8eea4 Refactor dns_zone_create() to return void
After isc_stats_create() change, the dns_zone_create() cannot fail, so
refactor the function to return void and fix all its uses.
2023-07-27 11:37:44 +02:00
Ondřej Surý 045d8d9ed6 Refactor dns_adb_create() to return void
After isc_stats_create() change, the dns_adb_create() cannot fail, so
refactor the function to return void and fix all its uses.
2023-07-27 11:37:44 +02:00
Ondřej Surý 5321c474ea Refactor isc_stats_create() and its downstream users to return void
The isc_stats_create() can no longer return anything else than
ISC_R_SUCCESS.  Refactor isc_stats_create() and its variants in libdns,
libns and named to just return void.
2023-07-27 11:37:44 +02:00
Tom Krizek 6a6f2e58e9 Merge branch '4055-improve-the-overmem-cache-cleaning-test' into 'main'
[CVE-2023-2828] Add test for dns_rbtdb overmem purging

Closes #4055

See merge request isc-projects/bind9!8141
2023-07-26 11:24:36 +00:00
269c03831f 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>
2023-07-26 10:30:51 +02:00
Tom Krizek 186d4cec3d Merge branch '4089-stale-query-loop-test' into 'main'
Reproducer for CVE-2023-2911

Closes #4089

See merge request isc-projects/bind9!8132
2023-07-25 08:34:00 +00:00
Tom Krizek f617512d37 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.
2023-07-25 09:23:24 +02:00
Tom Krizek ae179921e0 Merge branch 'tkrizek/checkconf-keys-dir-set-e' into 'main'
Clean up keys directory in checkconf test

See merge request isc-projects/bind9!8133
2023-07-25 07:20:31 +00:00
Tom Krizek 062dfac28e 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.
2023-07-25 09:19:55 +02:00
Matthijs Mekking 539a4581ea Merge branch '4222-inline-system-test-ns7-fails-to-start' into 'main'
Change RSASHA256 key length to be FIPS compliant

Closes #4222

See merge request isc-projects/bind9!8131
2023-07-25 06:42:17 +00:00
Matthijs Mekking 2c978017b3 Change RSASHA256 key length to be FIPS compliant
After commit f4eb3ba4, that is part of removing 'auto-dnssec', the
inline system test started to fail in FIPS CI jobs. This is because
the 'nsec3-loop' zone started to use a RSASHA256 key size of 1024 and
this is not FIPS compliant.

This commit changes the key size from 1024 to 4096, in order to
become FIPS compliant again.
2023-07-25 06:42:03 +00:00
Ondřej Surý aed4fdd7d3 Merge branch 'ondrej/cleanup-cruft-in-dns_catz' into 'main'
Cleanup the dns_catz unit API

See merge request isc-projects/bind9!8099
2023-07-24 17:54:26 +00:00
Ondřej Surý e29f9e982e Fix TSAN data race accessing zone->parentcatz
The zone->parentcatz was accessed unlocked in dns_zone_get_parentcatz(),
add a locking around it.
2023-07-24 19:49:14 +02:00
Aram SargsyanandOndřej Surý b2e84371d3 Test catz member zone fail-safe recreation
The catz module has a fail-safe code to recreate a member zone
that was expected to exist but was not found.

Improve a test case where the fail-safe code is expected to execute
to check that the log message exists.

Add a test case where the fail-safe code is not expected to execute
to check that the log message does not exist.
2023-07-24 19:49:14 +02:00
Ondřej Surý 48714a9c1d Cleanup the dns_catz unit API
1. Change the _new, _add and _copy functions to return the new object
   instead of returning 'void' (or always ISC_R_SUCCESS)

2. Cleanup the isc_ht_find() + isc_ht_add() usage - the code is always
   locked with catzs->lock (mutex), so when isc_ht_find() returns
   ISC_R_NOTFOUND, the isc_ht_add() must always succeed.

3. Instead of returning direct iterator for the catalog zone entries,
   add dns_catz_zone_for_each_entry2() function that calls callback
   for each catalog zone entry and passes two extra arguments to the
   callback.  This will allow changing the internal storage for the
   catalog zone entries.

4. Cleanup the naming - dns_catz_<fn>_<obj> -> dns_catz_<obj>_<fn>, as an
   example dns_catz_new_zone() gets renamed to dns_catz_zone_new().
2023-07-24 19:49:14 +02:00
Matthijs Mekking aad9fda87d Merge branch '4221-multisigner-add-nsupdate-return-value-checks' into 'main'
Add nsupdate retvalue checks in multisigner test

See merge request isc-projects/bind9!8130
2023-07-24 15:18:44 +00:00
Matthijs Mekking e426501a45 Add nsupdate retvalue checks in multisigner test
Ensure the nsupdate command executes with success.

Add a couple of 'n=$((n+1))' and explicit 'ret=0' to clearly mark the
start of a new check.
2023-07-24 11:48:07 +02:00
Mark Andrews f66881c995 Merge branch '4215-add-isc_r_timedout-to-the-reasons-to-call-dns_zonemgr_unreachableadd-in-xfrin' into 'main'
Resolve "Add ISC_R_TIMEDOUT to the reasons to call dns_zonemgr_unreachableadd in xfrin"

Closes #4215

See merge request isc-projects/bind9!8122
2023-07-21 22:57:38 +00:00
Mark Andrews fefc273eb0 Add CHANGES note for [GL #4215] 2023-07-22 08:18:14 +10:00
Mark Andrews 621c117101 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.
2023-07-22 08:17:11 +10:00
Ondřej Surý 2f9322f88d Merge branch '4200-placeholder' into 'main'
Add CHANGES placeholder for [GL #4200]

Closes #4200

See merge request isc-projects/bind9!8127
2023-07-20 16:40:42 +00:00
Ondřej Surý 0487d50813 Add CHANGES placeholder for [GL #4200] 2023-07-20 18:40:08 +02:00
Ondřej Surý e0aec97bcd Merge branch '4212-dead-code-in-dns_rbt-zonedb' into 'main'
Restore the IS_STUB() condition in zone_zonecut_callback

Closes #4212

See merge request isc-projects/bind9!8117
2023-07-20 16:00:13 +00:00
Ondřej Surý 40659b5978 Restore the IS_STUB() condition in zone_zonecut_callback
After the refactoring the condition whether to use DNAME or NS for the
zonecut was incorrectly simplified and the !IS_STUB() condition was
removed.  This was flagged by Coverity as:

	/lib/dns/rbt-zonedb.c: 192 in zone_zonecut_callback()
	186     		found = ns_header;
	187     		search->zonecut_sigheader = NULL;
	188     	} else if (dname_header != NULL) {
	189     		found = dname_header;
	190     		search->zonecut_sigheader = sigdname_header;
	191     	} else if (ns_header != NULL) {
	>>>     CID 462773:  Control flow issues  (DEADCODE)
	>>>     Execution cannot reach this statement: "found = ns_header;".
	192     		found = ns_header;
	193     		search->zonecut_sigheader = NULL;
	194     	}
	195
	196     	if (found != NULL) {
	197     		/*

Instead of removing the extra block, restore the !IS_STUB() condition
for the first if block.
2023-07-20 17:59:44 +02:00
Tom Krizek f03d41c6ee Merge branch 'tkrizek/multisigner-test-pytest-glue' into 'main'
Add missing pytest glue to run multisigner test

See merge request isc-projects/bind9!8126
2023-07-20 15:55:09 +00:00
Tom Krizek 47d2d5334f Add missing pytest glue to run multisigner test
Without the pytest glue file, the multisigner/tests.sh isn't picked
up by the pytest runner and the test isn't executed.

Related !6901
2023-07-20 17:53:48 +02:00
Matthijs Mekking b8e3c1bb52 Merge branch '3672-remove-auto-dnssec' into 'main'
Remove auto-dnssec

Closes #3672

See merge request isc-projects/bind9!8085
2023-07-20 14:37:30 +00:00
Matthijs Mekking f5bf8c1d30 Update autosign system test
When checking for the number of logs related to DNSKEY key maintenance
events, don't include CDNSKEY is published lines.

Also consider RSASHA1: If not supported, the key maintenance for
the nsec-only zone are not logged.
2023-07-20 15:34:53 +02:00
Matthijs Mekking 6504b563cb Add release note and CHANGES for #3672
"The king is dead. Long live the king."
2023-07-20 12:44:19 +02:00
Matthijs Mekking 042c89ac69 Obsolete dnssec-update-mode
We no longer support 'no-resign' and thus the configuration option
becomes obsolete. Remove the corresponding dnssec system test cases.
2023-07-20 12:44:19 +02:00
Matthijs Mekking 3bcb096a0e Tiny refactor revoked key check
This makes the code flow a bit more readable.
2023-07-20 12:44:19 +02:00
Matthijs Mekking 3e49223a67 Obsolete dnssec-dnskey-kskonly update-check-ksk
These two configuration options worked in conjunction with 'auto-dnssec'
to determine KSK usage, and thus are now obsoleted.

However, in the code we keep KSK processing so that when a zone is
reconfigured from using 'dnssec-policy' immediately to 'none' (without
going through 'insecure'), the zone is not immediately made bogus.

Add one more test case for going straight to none, now with a dynamic
zone (no inline-signing).
2023-07-20 12:40:54 +02:00
Matthijs Mekking a8f71f67ac Refactor KSK processing
There are multiple almost identical code blocks, time to make a
function.
2023-07-20 12:40:52 +02:00
Matthijs Mekking 88a687106f Obsolete sig-validity-interval dnskey-sig-validity
These two configuration options worked in conjunction with 'auto-dnssec'
to set the signature validity, and thus are now obsoleted.
2023-07-20 11:04:24 +02:00
Matthijs Mekking d7cc0a9f7b Remove remaining auto-dnssec bits
Remove the remaining bits related to 'auto-dnssec'.
2023-07-20 11:04:24 +02:00
Matthijs Mekking c75ddc33aa Remove auto-dnssec check
Remove the check configuration parts related to 'auto-dnssec'.
2023-07-20 11:04:24 +02:00
Matthijs Mekking 10bb8f92a1 Remove auto-dnssec from documentation
Update the ARM and DNSSEC guide, removing references to 'auto-dnssec',
replacing them with 'dnssec-policy' if needed.

The section "Alternative Ways" of signing has to be refactored, since
we now only focus on one alternative way, that is manual signing.
2023-07-20 11:04:24 +02:00
Matthijs Mekking 71af4f4e0b Remove the auto-dnssec option
Mark the "auto-dnssec" option ancient (effectively disallowing it from
the configuration).
2023-07-20 11:04:23 +02:00
Matthijs Mekking a4b6ff32e9 Update zonechecks system test
Change test configuration to make use of 'dnssec-policy' instead of
'auto-dnssec'.
2023-07-20 11:04:23 +02:00
Matthijs Mekking 4690e95d29 Update views system test
Change test configuration to make use of 'dnssec-policy' instead of
'auto-dnssec'.

Because we now use 'dnssec-policy', there is no need to create an
explicit key in the final test that adds multiple inline zones
followed by a reconfig.
2023-07-20 11:04:23 +02:00
Matthijs Mekking 62368c6a6f Update unknown system test
Change test configuration to make use of 'dnssec-policy' instead of
'auto-dnssec'.

There is no need to sign the zone in advance.
2023-07-20 11:04:23 +02:00
Matthijs Mekking 49358928b3 Update statschannel system test
Change test configuration to make use of 'dnssec-policy' instead of
'auto-dnssec'.

Because we now add a DNSKEY with dynamic update, the sign statistics
change. When adding signatures triggered by dynamic update, the
dnssec-refresh stats are not incremented (this is only incremented
when signing is triggered by resign in lib/dns/zone.c).
2023-07-20 11:04:23 +02:00
Matthijs Mekking 660d089dca Update nsupdate system test
Remove from the nsupdate system test two test cases that are no longer
supported: We no longer support adding signing keys via dynamic update.
2023-07-20 11:04:23 +02:00
Matthijs Mekking c8f61c4ac5 Alter mkeys system test
The mkeys system test configured 'auto-dnssec' on the root zone to do
smart signing and simulate root key changes that should be picked up
by the automated trust anchor management of BIND.

This does not require 'auto-dnssec' or 'dnssec-policy', so change the
tests to use manual smart signing with 'dnssec-signzone'.
2023-07-20 11:04:23 +02:00
Matthijs Mekking 730b7ac70f Update masterformat system test
Change test configuration to make use of 'dnssec-policy' instead of
'auto-dnssec'.
2023-07-20 11:04:23 +02:00
Matthijs Mekking 906dd57b68 Remove keymgr2kasp system test
The keymgr2kasp system test tests migration from auto-dnssec to
dnssec-policy. With auto-dnssec removed, we can also remove the
migration system test.
2023-07-20 11:04:23 +02:00
Matthijs Mekking ee3ae4d7d5 Remove dupsigs system test
This test uses key timing metadata to do rollovers, this is no longer
applicable with 'dnssec-policy'. Note that with 'dnssec-policy' key
timing metadata is still written, but it is not used for determining
what and when to do key rollovers.
2023-07-20 11:04:23 +02:00
Matthijs Mekking f0c164954e Copy DNSKEY record from unsigned zone db
Since external DNSKEY records may exist in the unsigned version of the
zone (for example DNSKEY records from other providers), handle these
RRsets also when copying non DNSSEC records from the unsigned zone
database to the signed version.
2023-07-20 11:04:23 +02:00
Matthijs Mekking 9ee33d99b3 Allow rndc signing commands with dnssec-policy
Some 'rndc signing' commands can still be used in conjunction with
'dnssec-policy' because it shows the progress of signing and
private type records can be cleaned up. Allow these commands to be
executed.

However, setting NSEC3 parameters is incompatible with dnssec-policy.
2023-07-20 11:04:23 +02:00
Matthijs Mekking f4eb3ba459 Change inline system test
The inline system test tests 'auto-dnssec' in conjunction with
'inline-signing'. Change the tests to make use of 'dnssec-policy'.

Remove some tests that no longer make sense:
- The 'retransfer3.' zone tests changing the parameters with
  'rndc signing -nsec3param'. This command is going away and NSEC3
  parameters now need to be configured with nsec3param within
  'dnssec-policy'.
- The 'inactivezsk.' and 'inactiveksk.' zones test whether the ZSK take
  over signing if the KSK is inactive, or vice versa. This fallback
  mode longer makes sense when using a DNSSEC policy.

Some tests need to be adapted more than just changing 'auto-dnssec'
to 'dnssec-policy':
- The 'delayedkeys.' zone first needs to be configured as insecure,
  then we can change it to start signing. Previously, no existing
  keys means that you cannot sign the zone, with 'dnssec-policy'
  new keys will be created.
- The 'updated.' zone needs to have key states in a specific state
  so that the minimal journal check still works (otherwise CDS/
  CDNSKEY and related records will be in the journal too).
- External keys are now added to the unsigned zone and no longer
  are maintained with key files. Adjust the 'externalkey.' zone
  accordingly.
- The 'nsec3-loop.' zone requires three signing keys. Since
  'dnssec-policy' will ignore duplicates in the 'keys' section,
  create RSASHA256 keys with different role and/or key length.

Finally, the 'externalkey.' zone checks for an expected number of
DNSKEY and RRSIG records in the response. This used to be 3 DNSKEY
and 2 RRSIG records. Due to logic behavior changes (key timing
metadata is no longer authoritative, these expected values are
changed to 4 DNSKEY records (two signing keys and two external keys
per algorithm) and 1 RRSIG record (one active KSK per signing
algorithm).
2023-07-20 11:04:23 +02:00
Matthijs Mekking d3bf732697 Update dnssec system test
The dnssec system test has some tests that use auto-dnssec. Update
these tests to make use of dnssec-policy.

Remove any 'rndc signing -nsec3param' commands because with
dnssec-policy you set the NSEC3 parameters in the configuration.

Remove now duplicate tests that checked if CDS and CDNSKEY RRsets
are signed with KSK only (the dnssec-dnskey-kskonly option worked
in combination with auto-dnssec).

Also remove the publish-inactive.example test case because such
use cases are no longer supported (only with manual signing).

The auto-nsec and auto-nsec3 zones need to use an alternative
algorithm because duplicate lines in dnssec-policy/keys are ignored.
2023-07-20 11:04:23 +02:00
Matthijs Mekking 9f75f472f6 Alter autosign system test
The autosign system test mainly tests the auto-dnssec configuration
option. Since this option is going to be removed, update the system
test so that it uses dnssec-policy.

We could remove the complete system test, but keeping an altered
version of the system test may still be useful to detect unexpected
behavior after code changes.

Change the ns1 (test root server) to use manual signing. This zone
has some weird corner cases that do not fit the dnssec-policy model
very well.

The ns2 bar zone also needs to use manual signing, because it revokes
its key, and RFC 5011 key revocation is not supported with
dnssec-policy.

There are also a couple of weird corner test cases that can be removed:
- Inactive KSK or ZSK. With dnssec-policy there is no such thing as
  ZSK taking over the role of a KSK when the KSK is deleted, or vice
  versa.
- The CDS and CDNSKEY DELETE records are now automated with
  dnssec-policy and so the tests for persistence are no longer required.

In tests.sh, bump the expected number of root DNSKEY records to 11,
because with manual signing the activation before publication is
actually honored.

Also remove any 'rndc signing -nsec3param' commands because with
dnssec-policy you set the NSEC3 parameters in the configuration.

Remove any check interval tests, these "next key event" times are
now calculated and tested in the kasp system test.
2023-07-20 11:04:23 +02:00
Matthijs Mekking 33db82cf20 Remove auto-dnssec checkconf tests
Any checkconf tests related to auto-dnssec can be removed, as this
option will be removed too.
2023-07-20 11:04:23 +02:00
Ondřej Surý 6df1f85f14 Merge branch '4096-uv-now' into 'main'
add isc_loop_now() to get consistent time

Closes #4096

See merge request isc-projects/bind9!7989
2023-07-19 13:32:47 +00:00
Evan HuntandOndřej Surý 6ac8723611 use isc_loop_now() for dispentry timeouts
store a pointer to the running loop when creating a dispatch entry
with dns_dispatch_add(), and use isc_loop_now() to get the timestamp for
the current event loop tick when we initialize the dispentry start time
and check for timeouts.
2023-07-19 15:32:21 +02:00
Evan HuntandOndřej Surý e37d02905c add isc_loop_now() to get consistent time
isc_loop_now() is a front-end to uv_now(), returning the start
time of the current event loop tick.
2023-07-19 15:32:21 +02:00
Arаm Sаrgsyаn e20c7d1415 Merge branch 'aram/tests-statschannel-fetch.pl-typo' into 'main'
Fix a bug in an utility script for the statschannel system test

See merge request isc-projects/bind9!8108
2023-07-19 13:24:31 +00:00
Aram Sargsyan aa7538fd38 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.
2023-07-19 13:23:40 +00:00
Tom Krizek 5b5d5f9f22 Merge tag 'v9.19.15' 2023-07-19 14:16:32 +02:00
Ondřej Surý 0e794e85c2 Merge branch 'ondrej/add-missing-headers-to-dns_rdataslab-header' into 'main'
Add missing headers to <dns/rdataslab.h>

See merge request isc-projects/bind9!8115
2023-07-19 07:40:59 +00:00
Ondřej Surý fb13b439bc Add missing headers to <dns/rdataslab.h>
The new header was not self-contained and required extra headers to be
included before including <dns/rdataslah.h>; rectify that.
2023-07-19 09:28:53 +02:00
Michal Nowak b14bb7be97 Merge branch 'mnowak/remove-windows-support-remnants' into 'main'
Remove remnants of Windows support in system test

See merge request isc-projects/bind9!8105
2023-07-18 14:40:24 +00:00
Michal Nowak ad3efede4d 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".
2023-07-18 16:39:21 +02:00
Matthijs Mekking 086d78a4f1 Merge branch 'matthijs-dont-add-signing-records-on-dnskey-update' into 'main'
Don't add signing records for DNSKEY added with dynamic update

See merge request isc-projects/bind9!8070
2023-07-18 14:37:07 +00:00
Matthijs Mekking 239c94bc08 Add CHANGES entry 2023-07-18 15:57:09 +02:00
Matthijs Mekking 2152d06c8e Don't add signing records for dyn update DNSKEY
We removed DNSSEC management via dynamic update (see issue #3686),
this means we also should no longer add signing records (of private
type) for DNSKEY records added via dynamic update.
2023-07-18 15:38:53 +02:00
Tom Krizek 66e36cf55d Merge branch 'tkrizek/readthedocs-config' into 'main'
Add configuration for readthedocs.org

See merge request isc-projects/bind9!8101
2023-07-18 13:32:14 +00:00
Tom Krizek a1a0ccda6e 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/
2023-07-18 15:30:27 +02:00
Ondřej Surý 1ea144f50f Merge branch '4185-reduce-the-recursion-in-query_lookup' into 'main'
Make the recursive query_lookup() call from query_gotanswer() async

Closes #4185

See merge request isc-projects/bind9!8073
2023-07-18 11:41:25 +00:00
Ondřej Surý d9d2527a19 Add CHANGES and release note for [GL #4185] 2023-07-18 11:57:11 +02:00
Evan HuntandOndřej Surý b2993f7b85 Make query chain processing asynchronous
Under some circumstances when processing a query response - for example,
when it contains a CNAME or DNAME - a query will have to be restarted
from the beginning to look up a new target.

This was previously handled by recursively calling the ns__query_start()
function directly from ns_query_done(). However, performance test data
indicated that chains of CNAMEs could consume quite a bit of time inside
the worker thread, increasing latency for other waiting queries.  This
has now been changed so that restarted queries are run asynchronously.
2023-07-18 11:57:11 +02:00
Mark Andrews 1c2b1c52bd Merge branch '4203-run-gdb-not-found' into 'main'
Resolve "run.gdb not found"

Closes #4203

See merge request isc-projects/bind9!8091
2023-07-18 00:34:05 +00:00
Mark Andrews 3f7723cdff Use absolute path to locate run.gdb 2023-07-18 00:01:46 +00:00
Tom Krizek dd2b7a0b2b Merge branch 'tkrizek/doth-test-curl-set-e' into 'main'
Handle curl without HTTP/2 support in doth test

See merge request isc-projects/bind9!8104
2023-07-17 15:52:58 +00:00
Tom Krizek cf3e9f8399 Handle curl without HTTP/2 support in doth test 2023-07-17 16:46:06 +02:00
Ondřej Surý 8ecae23d50 Merge branch 'each-split-rbtdb' into 'main'
Split up rbtdb.c

See merge request isc-projects/bind9!7873
2023-07-17 12:50:50 +00:00
Evan HuntandOndřej Surý 5a85135c1e split out cache-specific functions
move cache-specific functions from rbtdb.c to rbt-cachedb.c.
2023-07-17 14:50:25 +02:00
Evan HuntandOndřej Surý 9a1a1293c0 split out zone-specific functions
move zone-specific functions from rbtdb.c to rbt-zonedb.c.
2023-07-17 14:50:25 +02:00
Evan HuntandOndřej Surý 445ef1d033 move slab rdataset implementation to rdataslab.c
ultimately we want the slab implementation of dns_rdataset to
be usable by more database implementaions than just rbtdb. this
commit moves rdataset_methods to rdataslab.c, renamed
dns_rdataslab_rdatasetmethods.

new database methods have been added: locknode, unlocknode,
addglue, expiredata, and deletedata, allowing external functions to
perform functions that previously required internal access to the
database implementation.

database and heap pointers are now stored in the dns_slabheader object
so that header is the only thing that needs to be passed to some
functions; this will simplify moving functions that process slabheaders
out of rbtdb.c so they can be used by other database implementations.
2023-07-17 14:50:25 +02:00
Evan HuntandOndřej Surý 17f85f6c93 move prototypes for common functions to rbtdb_p.h
rename the existing rbtdb.h to rbtdb_p.h, and start putting
macros and declarations of dns__rbtdb functions into it.
2023-07-17 14:50:25 +02:00
Evan HuntandOndřej Surý 4db150437e clean up unused dns_db methods
to reduce the amount of common code that will need to be shared
between the separated cache and zone database implementations,
clean up unused portions of dns_db.

the methods dns_db_dump(), dns_db_isdnssec(), dns_db_printnode(),
dns_db_resigned(), dns_db_expirenode() and dns_db_overmem() were
either never called or were only implemented as nonoperational stub
functions: they have now been removed.

dns_db_nodefullname() was only used in one place, which turned out
to be unnecessary, so it has also been removed.

dns_db_ispersistent() and dns_db_transfernode() are used, but only
the default implementation in db.c was ever actually called. since
they were never overridden by database methods, there's no need to
retain methods for them.

in rbtdb.c, beginload() and endload() methods are no longer defined for
the cache database, because that was never used (except in a few unit
tests which can easily be modified to use the zone implementation
instead).  issecure() is also no longer defined for the cache database,
as the cache is always insecure and the default implementation of
dns_db_issecure() returns false.

for similar reasons, hashsize() is no longer defined for zone databases.

implementation functions that are shared between zone and cache are now
prepended with 'dns__rbtdb_' so they can become nonstatic.

serve_stale_ttl is now a common member of dns_db.
2023-07-17 14:50:25 +02:00
Evan HuntandOndřej Surý 1c21e50953 clean up rbtdb.c
in preparation for splitting up rbtdb.c, rename some types so they
can be defined in dns/types.h instead of only locally. these include:

- struct noqname, which is used to hold no-qname and closest-encloser
  proofs, and is now named dns_proof_t;
- rbtdb_rdatatype_t, which is used to hold a pair of rdatatypes and
  is now called dns_typepair_t and defined in rdatatype.h;
- rbtdb_serial_t, which is now just a uint32_t;
- rdatasetheader_t and rdatasetheaderlist_t, now called
  dns_slabheader_t and dns_slabheaderlist_t;
- rbtdb_version_t, now called dns_rbtdb_version_t.

the helper functions header_from_raw() and raw_from_header() are
renamed dns_slabheader_fromrdataset() and dns_slabheader_raw().

also made further style changes:
- fixing uninitialized pointer variables throughout rbtdb.c;
- switching some initializations to struct literals;
- renaming some functions and struct members more descriptively;
- replacing dns_db_secure_t with a simple bool since it no longer needs
  to be tri-valued.
2023-07-17 14:50:25 +02:00
Evan HuntandOndřej Surý d25d0af7f5 remove unused DNS_DBFIND options
the DNS_DBFIND_VALIDATEGLUE and DNS_DBFIND_FORCENSEC options
were never set, so the code implementing them (which in the case
of _VALIDATEGLUE appears to have been quite outdated anyway) was
never reached. they have now been removed.
2023-07-17 14:50:25 +02:00
Tony FinchandOndřej Surý 856a6e4afb Give the rdataset->privateN fields more helpful names
BIND's rdataset structure is a view of some DNS records. It is
polymorphic, so the details of how the records are stored can vary.
For instance, the records can be held in an rdatalist, or in an
rdataslab in the rbtdb.

The dns_rdataset structure previously had a number of fields called
`private1` up to `private7`, which were used by the various rdataset
implementations. It was not at all clear what these fields were for,
without reading the code and working it out from context.

This change makes the rdataset inheritance hierarchy more clear. The
polymorphic part of a `struct dns_rdataset` is now a union of structs,
each of which is named for the class of implementation using it. The
fields of these structs replace the old `privateN` fields. (Note: the
term "inheritance hierarchy" refers to the fact that the builtin and
SDLZ implementations are based on and inherit from the rdatalist
implementation, which in turn inherits from the generic rdataset.

Most of this change is mechanical, but there are a few extras.

In keynode.c there were a number of REQUIRE()ments that were not
necessary: they had already been checked by the rdataset method
dispatch code. On the other hand, In ncache.c there was a public
function which needed to REQUIRE() that an rdataset was valid.

I have removed lots of "reset iterator state" comments, because it
should now be clear from `target->iter = NULL` where before
`target->private5 = NULL` could have been doing anything.

Initialization is a bit neater in a few places, using C structure
literals where appropriate.

The pointer arithmetic for translating between an rdataslab header and
its raw contents is now fractionally safer.
2023-07-17 14:50:25 +02:00
Evan HuntandOndřej Surý 9330fada3a refactor the slab rdataset implementation
- use externally accessible functions for attachnode/detachnode
  so these functions can be moved outside rbtdb.c
- simplify and tidy up some other functions
- use struct initializers when appropriate
- remove the flag RDATASET_ATTR_RETAIN; it was never being set
- renamed the rdataset attributes to
- remove the 'slab_methods' rdataset implementation. this was
  a reduced set of slab rdataset methods, omitting 'setownercase()'
  and 'getownercase()'. we can get the identical result by using
  an DNS_RDATASETATTR_KEEPCASE attribute in rdatasets that
  shouldn't have their case modified, and then we only need one
  set of rdataset methods.
2023-07-17 14:50:25 +02:00
Tom Krizek 83a33c3555 Merge branch 'tkrizek/tkey-cleanup' into 'main'
Remove tkey test remnants

See merge request isc-projects/bind9!8102
2023-07-17 09:07:28 +00:00
Tom Krizek 87e95b2348 Remove tkey test remnants
The tkey test was removed in bd4576b3ce
and the prereq.sh bit was accidentally added in
175d0c6d85
2023-07-17 10:40:07 +02:00
Tom Krizek 02b3cb671a Merge branch 'tkrizek/run-tests-with-set-e' into 'main'
Run system tests with set -e

See merge request isc-projects/bind9!8052
2023-07-17 08:19:01 +00:00
Tom Krizek e5f2addcaa 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.
2023-07-14 17:10:58 +02:00
Tom Krizek ccc9b87f59 Ignore test cleanup commits in git blame 2023-07-14 15:51:07 +02:00
Tom Krizek 05baf7206b 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).
2023-07-14 15:49:18 +02:00
Tom Krizek d203681a75 Handle non-zero return codes in rootkeysentinel tests 2023-07-14 15:49:18 +02:00
Tom Krizek 2b8e5e1155 Handle non-zero return codes in resolver test 2023-07-14 15:49:17 +02:00
Tom Krizek cde02fdb6a Handle non-zero return codes in statschannel test 2023-07-14 15:49:17 +02:00
Tom Krizek 4a87b44196 Handle non-zero return codes in checkconf test 2023-07-14 15:49:17 +02:00
Tom Krizek 9d383dce40 Handle non-zero return codes in dnstap test 2023-07-14 15:49:17 +02:00
Tom Krizek ede8ea889b Handle non-zero return codes in kasp test 2023-07-14 15:49:17 +02:00
Tom Krizek 4e8802a22d Handle non-zero return codes in serve-stale test 2023-07-14 15:49:17 +02:00
Tom Krizek fae6808b9c Handle non-zero return codes in doth test 2023-07-14 15:49:17 +02:00
Tom Krizek 1e64749ed3 Handle non-zero return codes in acl test 2023-07-14 15:49:17 +02:00
Tom Krizek 3a36ff506d Handle non-zero return codes in statistics test 2023-07-14 15:49:16 +02:00
Tom Krizek 9fdf537f52 Handle non-zero return codes in rrsetorder test 2023-07-14 15:49:16 +02:00
Tom Krizek 45fc4cc465 Handle non-zero return codes in redirect test 2023-07-14 15:49:16 +02:00
Tom Krizek c50a9e158d Handle non-zero return codes in rndc test 2023-07-14 15:49:16 +02:00
Tom Krizek 36d74bd2e3 Handle non-zero return codes in inline test 2023-07-14 15:49:16 +02:00
Tom Krizek f3310e1731 Handle non-zero return codes unknown test 2023-07-14 15:49:16 +02:00
Tom Krizek 86765ad1d3 Handle non-zero return codes in nsupdate test 2023-07-14 15:49:16 +02:00
Tom Krizek e5933f65d6 Handle non-zero return codes in zonechecks test 2023-07-14 15:49:16 +02:00
Tom Krizek e8c61f8da4 Handle non-zero return codes in wildcard test 2023-07-14 15:49:16 +02:00
Tom Krizek 69e8876966 Handle non-zero return codes in zero test 2023-07-14 15:49:15 +02:00
Tom Krizek 3ce200ead8 Handle non-zero return codes in legacy test 2023-07-14 15:49:15 +02:00
Tom Krizek 2823d0b469 Handle non-zero return codes in forward test 2023-07-14 15:49:15 +02:00
Tom Krizek 855f5b143a Handle non-zero return codes in upforwd test 2023-07-14 15:49:15 +02:00
Tom Krizek 146cb978c5 Handle non-zero return codes in addzone test 2023-07-14 15:49:15 +02:00
Tom Krizek 247b608f62 Handle non-zero return codes in rpzrecurse test 2023-07-14 15:49:15 +02:00
Tom Krizek 1d5caafa9e Handle non-zero return codes in rpz test 2023-07-14 15:49:15 +02:00
Tom Krizek 837c190d9e 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`.
2023-07-14 15:49:15 +02:00
Tom Krizek 1436025e20 Use arithmetic expansion in system tests (followup)
These are manual edits in addition of the automated changes from the
previous commit.
2023-07-14 15:49:15 +02:00
Tom Krizek 4d42bdc245 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
2023-07-14 15:49:13 +02:00
Tom Krizek 01bc805f89 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.
2023-07-14 15:07:25 +02:00
Michal Nowak 723cb07d58 Merge branch 'mnowak/detect-core-dumps-after-server-failed-to-stop' into 'main'
Detect core dumps after BIND failed to stop cleanly

See merge request isc-projects/bind9!8096
2023-07-13 13:12:37 +00:00
Michal Nowak 89c77daddb 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.
2023-07-13 15:09:55 +02:00
Mark Andrews dd3c7e4ecb Merge branch '4194-extend-dns-cookie-support' into 'main'
Resolve "Extend DNS COOKIE support"

Closes #4194

See merge request isc-projects/bind9!8086
2023-07-13 02:31:02 +00:00
Mark Andrews cf923e4ad3 Add release note for [GL #4194] 2023-07-13 01:58:53 +00:00
Mark Andrews c2dcc2602d Add CHANGES note for [GL #4194] 2023-07-13 01:58:53 +00:00
Mark Andrews 189ca00a6e Check that BADCOOKIE is returned for a bad server COOKIE
Send a well formed, all zeros, DNS COOKIE option to a named instance
running with default cookie settings and check that BADCOOKIE is
returned.
2023-07-13 01:58:53 +00:00
Mark Andrews 3969e2c5f7 Return BADCOOKIE on validly formed bad SERVER COOKIES
The server was previously tolerant of out-of-date or otherwise bad
DNS SERVER COOKIES that where well formed unless require-cookie was
set.  BADCOOKIE is now return for these conditions.
2023-07-13 01:58:53 +00:00
Tom Krizek 4990f8ae34 Merge branch 'tkrizek/set-up-version-and-release-notes-for-bind-9.19.16' into 'main'
Set up version and release notes for BIND 9.19.16

See merge request isc-projects/bind9!8092
2023-07-10 13:45:09 +00:00
Tom Krizek c49bad79eb Set up release notes for BIND 9.19.16 2023-07-10 15:08:50 +02:00
Tom Krizek 46e917a55e Update BIND version to 9.19.16-dev 2023-07-10 15:08:50 +02:00
Michał Kępień 9127376fb1 Update BIND version for release 2023-07-06 15:58:14 +02:00
Michał Kępień 5beb2835ad Add a CHANGES marker 2023-07-06 15:58:14 +02:00
Michał Kępień eab13e60f2 Merge branch 'michal/prepare-documentation-for-bind-9.19.15' into 'v9.19.15-release'
Prepare documentation for BIND 9.19.15

See merge request isc-private/bind9!550
2023-07-06 13:54:10 +00:00
Michał Kępień 80cc7f077c Add release note for GL #4132, GL #4136, GL #4171 2023-07-06 15:38:48 +02:00
Michał Kępień c2a298245f Tweak and reword release notes 2023-07-06 15:38:48 +02:00
Michał Kępień bc8ad4e807 Prepare release notes for BIND 9.19.15 2023-07-06 15:38:48 +02:00
Michał Kępień 09a4ffa1c8 Update sample query log excerpt in the ARM 2023-07-06 15:38:48 +02:00
Michał Kępień 2b0bade81c Fix typo in tests_shutdown.py 2023-07-06 15:38:48 +02:00
Michał Kępień bf8acd4556 Merge branch 'michal/add-changes-entry-for-tsig-tkey-refactoring' into 'main'
Add CHANGES entry for !7828

See merge request isc-projects/bind9!8090
2023-07-06 13:06:51 +00:00
Michał Kępień 8f0810b2f4 Add CHANGES entry for !7828 2023-07-06 15:02:10 +02:00
Arаm Sаrgsyаn f310834fdd Merge branch '4171-add-shutdown-check-in-dns_catz_dbupdate_callback' into 'main'
Add shutdown checks in dns_catz_dbupdate_callback()

Closes #4171

See merge request isc-projects/bind9!8081
2023-07-06 11:26:31 +00:00
Aram Sargsyan 8887da60ad Add a CHANGES note for [GL #4171] 2023-07-06 10:46:46 +00:00
Aram Sargsyan 28bb419edc 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.
2023-07-06 10:46:46 +00:00
Matthijs Mekking 2f66410680 Merge branch '2471-test-three-is-a-crowd' into 'main'
Add "three is a crowd" test case

Closes #2471

See merge request isc-projects/bind9!8065
2023-07-06 08:03:34 +00:00
Matthijs Mekking 9c40cf0566 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.
2023-07-06 09:27:29 +02:00
Matthijs Mekking 674249f66a 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.
2023-07-06 09:27:29 +02:00
Evan Hunt 54d0051730 Merge branch 'each-refactor-fetchopt' into 'main'
clean up numbering of FETCHOPT and ADDRINFO flags

See merge request isc-projects/bind9!8079
2023-07-04 18:36:09 +00:00
Evan Hunt 0955cf1af5 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.
2023-07-04 18:23:57 +00:00
Tom Krizek d6d90cb4b6 Merge branch 'tkrizek-shutdown-rndc-hang' into 'main'
Split shutdown test into separate test cases

See merge request isc-projects/bind9!8058
2023-07-04 11:34:00 +00:00
Tom Krizek 5f85f63bf1 Mark the test_named_shutdown[rndc] test as xfail
It is currently affected by #4060, making the unstable as it
occassionally fails.
2023-07-04 12:58:16 +02:00
Tom Krizek ceed694659 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.
2023-07-04 12:58:16 +02:00
Tom Krizek 603c58ee28 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.
2023-07-04 12:58:14 +02:00
Evan Hunt ee75ebc711 Merge branch 'each-lock-counter' into 'main'
fix a TSAN bug in "rndc fetchlimit"

See merge request isc-projects/bind9!8067
2023-06-30 06:52:18 +00:00
Evan Hunt 5ba73c785e fix a TSAN bug in "rndc fetchlimit"
fctx counters could be accessed without locking when
"rndc fetchlimit" is called; while this is probably harmless
in production, it triggered TSAN reports in system tests.
2023-06-30 06:52:01 +00:00
Evan Hunt bbc64c14e3 Merge branch '4173-refactor-resume_qmin' into 'main'
minor refactoring of resume_qmin() for clarity

Closes #4173

See merge request isc-projects/bind9!8068
2023-06-29 17:34:20 +00:00
Evan Hunt 352d542d27 minor refactoring of resume_qmin() for clarity
make the code flow clearer by enumerating the result codes that
are treated as success conditions for an intermediate minimized
query (ISC_R_SUCCESS, DNS_R_DELEGATION, DNS_R_NXRRSET, etc), rather
than just folding them all into the 'default' branch of a switch
statement.
2023-06-29 10:14:20 -07:00
Michał Kępień 98d532abb9 Merge branch '4169-add-google-site-verification-tag-to-the-toc-page' into 'main'
Add Google Site Verification tag to the TOC page

Closes #4169

See merge request isc-projects/bind9!8076
2023-06-29 16:48:15 +00:00
Michał Kępień 13c35ab0b3 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.
2023-06-29 18:32:50 +02:00
Michał Kępień b22b318604 Merge branch 'michal/update-release-and-cve-checklists' into 'main'
Update release and CVE checklists

See merge request isc-projects/bind9!8074
2023-06-29 14:14:02 +00:00
Michał Kępień d7638d52e2 Update release and CVE checklists 2023-06-29 16:08:35 +02:00
Tom Krizek 8b17b31316 Merge branch 'tkrizek-disable-delv-in-tsan' into 'main'
Disable delv tests under TSAN

See merge request isc-projects/bind9!8062
2023-06-29 10:58:44 +00:00
Tom Krizek 76d9873ef6 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.
2023-06-29 10:35:47 +02:00
Tom Krizek 06056c44a7 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.
2023-06-29 10:35:47 +02:00
Tom Krizek 384339dbba Only use delv if available in mkeys test
Check that $DELV is an executable before using it in a test.
2023-06-29 10:35:47 +02:00
Tom Krizek fbcf37f914 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.
2023-06-29 10:35:47 +02:00
Mark Andrews 06131a8760 Merge branch '4154-restore-the-ability-to-read-old-hmac-md5-key-pair-files' into 'main'
Resolve "Restore the ability to read old HMAC-MD5 key pair files."

Closes #4154

See merge request isc-projects/bind9!8041
2023-06-29 00:20:07 +00:00
Mark Andrews e3e20ed76e 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.
2023-06-29 08:28:48 +10:00
Mark Andrews 91cb94dcbb Add release note entry for [GL #4154] 2023-06-29 08:28:48 +10:00
Mark Andrews c91a208ef5 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.
2023-06-29 08:28:48 +10:00
Mark Andrews e1fb17e72c 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.
2023-06-29 08:28:48 +10:00
Mark Andrews 3f93d3f757 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.
2023-06-29 08:28:44 +10:00
Ondřej Surý 4320c1f345 Merge branch '3325-strict-qname-minimisation-should-check-for-cached-nodata-for-ns-name' into 'main'
Refactor QNAME minimization to use NS records and check for cached NODATA

Closes #3325, #3326, and #3331

See merge request isc-projects/bind9!6267
2023-06-28 10:29:57 +00:00
Mark Andrews 2a71ed47a7 Add release note for [GL #3325] 2023-06-28 18:07:03 +10:00
Mark Andrews f378e02423 Add CHANGES note for [GL #3325] 2023-06-28 18:07:03 +10:00
Mark Andrews ea11650376 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.
2023-06-28 11:48:32 +10:00
Mark Andrews 80bc0ee075 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.
2023-06-28 11:47:56 +10:00
Mark Andrews dd00b3c50b 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.
2023-06-28 11:45:59 +10:00
Ondřej Surý f6b281f7dd Merge branch 'fanf-overflow-checks' into 'main'
Prevent integer overflow when allocating arrays

Closes #4120, #4121, and #4122

See merge request isc-projects/bind9!8007
2023-06-27 13:13:14 +00:00
Tony FinchandOndřej Surý a8dbf61bb1 CHANGES entry
[cleanup]	Ensure that the size calculation does not overflow
		when allocating memory for an array.
		[GL #4120] [GL #4121] [GL #4122]
2023-06-27 12:38:09 +02:00
Tony FinchandOndřej Surý e2eaefbf7a Check for overflow when resizing a heap
Ensure that the heap size calculations produce the correct answers,
and use `isc_mem_reget()` instead of calling `get` and `put`.

Closes #4122
2023-06-27 12:38:09 +02:00
Tony FinchandOndřej Surý 14f5b79c74 Check for overflow in jemalloc_shim
When compiled using a malloc that lacks an equivalent to sallocx(),
the jemalloc_shim adds a size prefix to each allocation. We must check
that this does not overflow.

Closes #4121
2023-06-27 12:38:09 +02:00
Tony FinchandOndřej Surý 92fcb7457c Use isc_mem_callocate() in http_calloc()
Closes #4120
2023-06-27 12:38:09 +02:00
Tony FinchandOndřej Surý 81d73600c1 Add isc_mem_callocate() for safer array allocation
As well as clearing the fresh memory, `calloc()`-like functions must
ensure that the count and size do not overflow when multiplied.

Use `isc_mem_callocate()` in `isc__uv_calloc()`.
2023-06-27 12:38:09 +02:00
Tony FinchandOndřej Surý 7474cad4ad Add <isc/overflow.h> for checked mul, add, and sub
The `ISC_OVERFLOW_XXX()` macros are usually wrappers around
`__builtin_xxx_overflow()`, with alternative implementations
for compilers that lack the builtins.

Replace the overflow checks in `isc/time.c` with the new macros.
2023-06-27 12:38:09 +02:00
Ondřej Surý bf6f8abb2a Merge branch 'ondrej-use-loop-mctx-in-dns_resolver' into 'main'
Use per-loop memory contexts for dns_resolver child objects

See merge request isc-projects/bind9!8015
2023-06-27 09:31:00 +00:00
Ondřej Surý 5e7b75c504 Add CHANGES note for [GL !8015] 2023-06-27 10:53:02 +02:00
Ondřej Surý 519481dcdb Use per-loop memory contexts for dns_resolver child objects
The dns_resolver creates a lot of smaller objects (fetch context, fetch
counter, query, response, ...) and those are all loop-bound.
Previously, those objects were allocated from the a single resolver
context, which in turn increases contention between threads - remember
"dead by thousand atomic paper cuts".  Instead of using a single memory
context, use the per-loop memory contexts that are bound to a specific
loop and thus there's no contention between them when doing the memory
accounting.
2023-06-27 10:51:54 +02:00
Ondřej Surý 6d309eed05 Merge branch '4163-dont-create-and-destroy-call_rcu-threads-by-hand' into 'main'
Remove the explicit call_rcu thread creating and destruction

Closes #4163

See merge request isc-projects/bind9!8060
2023-06-27 06:00:32 +00:00
Ondřej Surý 90d4ba2a11 Add CHANGES note for [GL #4163] 2023-06-27 07:59:00 +02:00
Ondřej Surý 5bd9343c4e Remove the explicit call_rcu thread creating and destruction
The free_all_cpu_call_rcu_data() call can consume hundreds of
milliseconds on shutdown.  Don't try to be smart and let the RCU library
handle this internally.
2023-06-27 07:59:00 +02:00
Evan Hunt bcda40db48 Merge branch '950-test-validation' into 'main'
explicitly set dnssec-validation in system tests

Closes #950

See merge request isc-projects/bind9!7999
2023-06-26 21:59:06 +00:00
Evan Hunt 0b09ee8cdc 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'.
2023-06-26 13:41:56 -07:00
Tom Krizek 73b09653d4 Merge branch 'tkrizek-system-test-fixes' into 'main'
Fix a couple of oversights in system tests

See merge request isc-projects/bind9!8051
2023-06-26 11:06:36 +00:00
Tom Krizek 5f809e50b6 Check for proper file size output in dnstap test
Previously, the first check silently failed, as 454 is apparently (in my
local 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.
2023-06-22 19:19:08 +02:00
Tom Krizek 1dd4c2b9e2 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).
2023-06-22 19:19:05 +02:00
Tom Krizek d437b7043a Merge branch 'tkrizek-forward-test-echo-i' into 'main'
Fix echo_i typo in forward test

See merge request isc-projects/bind9!8050
2023-06-22 17:15:50 +00:00
Tom Krizek 946d3131fa Fix echo_i typo in forward test 2023-06-22 19:12:46 +02:00
Michal Nowak 71439d0c3a Merge tag 'v9.19.14'
BIND 9.19.14
2023-06-21 19:31:57 +02:00
Arаm Sаrgsyаn 1bdec05d69 Merge branch '4044-placeholder' into 'main'
Add a CHANGES placeholder for [GL #4044]

See merge request isc-projects/bind9!8046
2023-06-20 10:20:43 +00:00
Aram Sargsyan 33a005e23c Add a CHANGES placeholder for [GL #4044] 2023-06-20 10:13:12 +00:00
Michał Kępień f4f1d6fddf Merge branch '2354-add-a-tool-for-reproducing-isc-spnego-bugs' into 'main'
[CVE-2020-8625] [CVE-2021-25216] Add a tool for reproducing ISC SPNEGO bugs

Closes #2354

See merge request isc-projects/bind9!7574
2023-06-19 09:06:56 +00:00
Michał Kępień a47dc810f7 Add a tool for reproducing ISC SPNEGO bugs
Extend the "tsiggss" system test with reproducers for CVE-2020-8625 and
CVE-2021-25216.
2023-06-19 09:20:03 +02:00
Tony Finch 5f9790feca Merge branch '4126-statschannel-connection-close-keepalive' into 'main'
Improve statschannel HTTP Connection: header logic

See merge request isc-projects/bind9!8014
2023-06-15 16:03:51 +00:00
Tony Finch e18ca83a3b 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.
2023-06-15 17:03:09 +01:00
Michał Kępień a0efcf0e58 Merge branch '4150-fix-entity-renumbering-in-parse_tsan.py' into 'main'
Fix entity renumbering in util/parse_tsan.py

Closes #4150

See merge request isc-projects/bind9!8037
2023-06-15 14:18:30 +00:00
Michał Kępień 7f0790c82f 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.
2023-06-15 16:17:14 +02:00
Ondřej Surý f22046d61b Merge branch '4149-make-isc_result-tables-more-compact' into 'main'
Make isc_result tables smaller

Closes #4149

See merge request isc-projects/bind9!8034
2023-06-15 13:46:52 +00:00
Ondřej Surý 0a35c0da9b Add CHANGES note for [GL #4149] 2023-06-15 15:32:24 +02:00
Ondřej Surý a8e6c3b8f7 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.
2023-06-15 15:32:04 +02:00
Ondřej Surý b53d1d7069 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.
2023-06-15 15:32:04 +02:00
Tom Krizek 189aadbab9 Merge branch 'tkrizek/ci-system-clang-tsan-disallow-failure' into 'main'
Mark CI failure of system:clang:tsan as an error again

See merge request isc-projects/bind9!8035
2023-06-15 11:09:48 +00:00
Tom Krizek e556097e81 Mark CI failure of system:clang:tsan as an error again
Both the issues causing frequent failures have been resolved. The job
seems to have stabilized and there's no longer a need to mark the
failure as a mere warnings.
2023-06-15 13:09:18 +02:00
Arаm Sаrgsyаn 14d4bf9136 Merge branch '4132-catz-data-race-in-db.c' into 'main'
Fix a data race between the dns_zone and dns_catz modules

Closes #4132

See merge request isc-projects/bind9!8031
2023-06-15 09:50:15 +00:00
Aram Sargsyan f73007afe7 Add a CHANGES note for [GL #4132] 2023-06-15 08:50:04 +00:00
Aram Sargsyan 6f1f5fc307 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.
2023-06-15 08:49:20 +00:00
Tony Finch 68cfbd2bd1 Merge branch '4134-zonefile-erofs' into 'main'
Translate POSIX errorcode EROFS to ISC_R_NOPERM

Closes #4134

See merge request isc-projects/bind9!8017
2023-06-14 12:44:54 +00:00
Tony Finch 82401f0f0e 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]
2023-06-14 13:13:39 +01:00
Midnight VeilandTony Finch dd6acc1cac 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.
2023-06-14 13:12:45 +01:00
Mark Andrews 06bbe6a2db Merge branch '4021-tsan-error-view-adb-detached-too-early' into 'main'
Resolve "TSAN error: view->adb detached too early."

Closes #4021

See merge request isc-projects/bind9!8016
2023-06-14 10:36:08 +00:00
Mark Andrews 0da3370642 Add CHANGES note for [GL #4021] 2023-06-14 19:22:00 +10:00
Mark Andrews 971f49b3ad Use RCU for view->adb access
view->adb may be referenced while the view is shutting down as the
zone uses a weak reference to the view and examines view->adb but
dns_view_detach call dns_adb_detach to clear view->adb.
2023-06-14 19:21:28 +10:00
Evan Hunt 984decc563 Merge branch 'each-tsig-refactoring' into 'main'
TSIG/TKEY refactoring

See merge request isc-projects/bind9!7828
2023-06-14 08:14:47 +00:00
Evan Hunt 885c132f4a improve code flow
the code in dns_tkey_processquery() was unnecessarily hard to follow.
2023-06-14 08:14:38 +00:00
Evan Hunt f4084ff543 minor tkey-related fixups
- style fixes and general tidying-up in tkey.c
- remove the unused 'intoken' parameter from dns_tkey_buildgssquery()
- remove an unnecessary call to dns_tkeyctx_create() in ns_server_create()
  (the TKEY context that was created there would soon be destroyed and
  another one created when the configuration was loaded).
2023-06-14 08:14:38 +00:00
Evan Hunt 96e8b0e782 rename 'ret' to 'result'
purely to assuage my desire for consistency across modules,
result variables have been renamed to 'result' as they are
throughout most of BIND. there are no other changes.
2023-06-14 08:14:38 +00:00
Evan Hunt 6105a7d360 convert TSIG keyring storage from RBT to hash table
since it is not necessary to find partial matches when looking
up names in a TSIG keyring, we can use a hash table instead of
an RBT to store them.

the tsigkey object now stores the key name as a dns_fixedname
rather than allocating memory for it.

the `name` parameter to dns_tsigkeyring_add() has been removed;
it was unneeded since the tsigkey object already contains a copy
of the name.

the opportunistic cleanup_ring() function has been removed;
it was only slowing down lookups.
2023-06-14 08:14:38 +00:00
Evan Hunt e64b44a5cb remove dns__tsig_algallocated()
this function was no longer needed, because the algorithm name is no
longer copied into the tsigkey object by dns_tsigkey_createfromkey();
it's always just a pointer to a statically defined name.
2023-06-14 08:14:38 +00:00
Evan Hunt f2d5782e89 get_key_struct() can no longer fail
remove checks for NULL return values.
2023-06-14 08:14:38 +00:00
Evan Hunt ffacf0aec6 use algorithm number instead of name to create TSIG keys
the prior practice of passing a dns_name containing the
expanded name of an algorithm to dns_tsigkey_create() and
dns_tsigkey_createfromkey() is unnecessarily cumbersome;
we can now pass the algorithm number instead.
2023-06-14 08:14:38 +00:00
Evan Hunt a6e187a8d5 further dns_tsigkey API tweaks
- remove the 'ring' parameter from dns_tsigkey_createfromkey(),
  and use dns_tsigkeyring_add() to add key objects to a keyring instead.
- add a magic number to dns_tsigkeyring_t
- change dns_tsigkeyring_dumpanddetach() to dns_tsigkeyring_dump();
  we now call dns_tsigkeyring_detach() separately.
- remove 'maxgenerated' from dns_tsigkeyring_t since it never changes.
2023-06-14 08:14:38 +00:00
Evan Hunt 404a13b4dd clean up reference counting in dns_tsigkey
the reference counter in dns_tsigkey was being computed differently
depending on whether there was a keyring or not. this is prone to
error.
2023-06-14 08:14:38 +00:00
Evan Hunt 6fa8524bba use ISC_REFCOUNT_IMPL for dns_tsigkey and dns_tsigkeyring
use the ISC_REFCOUNT attach/detach implementation in dns/tsig.c
so that detailed tracing can be used during refactoring.

dns_tsig_keyring_t has been renamed dns_tsigkeyring_t so the type
and the attach/detach function names will match.
2023-06-14 08:14:38 +00:00
Evan Hunt b1db1c1475 minor tsig.c cleanups
- style cleanups.
- simplify the function parameters to dns_tsigkey_create():
  + remove 'restored' and 'generated', they're only ever set to false.
  + remove 'creator' because it's only ever set to NULL.
  + remove 'inception' and 'expiry' because they're only ever set to
    (0, 0) or (now, now), and either way, this means "never expire".
  + remove 'ring' because we can just use dns_tsigkeyring_add() instead.
- rename dns_keyring_restore() to dns_tsigkeyring_restore() to match the
  rest of the functions operating on dns_tsigkeyring objects.
2023-06-14 08:14:38 +00:00
Matthijs Mekking dc71aab358 Merge branch '4141-find-zone_keys' into 'main'
Update find_zone_keys for dynamic update

Closes #4141

See merge request isc-projects/bind9!8029
2023-06-14 08:05:55 +00:00
Matthijs Mekking e59c6a5adc Update findzonekeys function name in log message
The "dns_dnssec_findzonekeys2" log message is a leftover from when that
was the name of the function. Rename to match the current name of the
function.
2023-06-14 09:08:56 +02:00
Matthijs Mekking 5cf91728d1 Add dynamic update prepub and doubleksk test case
Add two test cases for zones that use auto-dnssec, but not
inline-signing, and make sure that the change for find_zone_keys()
do not affect introducing a new key that is intended for signing.

See note https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/7638#note_355944
2023-06-14 09:08:56 +02:00
Matthijs Mekking 5c9a7ffbdb Add CHANGES for find_zone_keys() function update
Probably a useful point in history.
2023-06-14 09:08:56 +02:00
Matthijs Mekking 88e5bc0687 Update find_zone_keys for dynamic update
The find_zone_keys() function was not working properly for
inline-signed zones. It only worked if the DNSKEY records were also
published in the unsigned version of the zone. But this is not the
case when you use dnssec-policy, the DNSKEY records will only occur
in the signed version of the zone. Therefor, when looking for keys
to sign the zone, only the newly added keys in the dynamic update
were found (which could be zero), ignoring existing keys.

Also, if a DNSKEY was added, it would try to sign the zone with just
this new key, and this would only work if the key files for that key
were imported into the key-directory.

This is a design error, because the goal is to sign the zone with the
keys for which we actually have key files for. So instead of looking
for DNSKEY records to then search for the matching key files, call
dns_dnssec_findmatchingkeys() which just looks for the keys we have
on disk for the given zone. It will also set the correct DNSSEC
signing hints.
2023-06-14 09:08:56 +02:00
Matthijs Mekking cda1ae69ac Add log check in multisigner system test
When we add DNSKEY records via dynamic update, this should no longer
trigger signing the zone with these keys. This currently happens when
'find_zone_keys()' looks up the keys by inspecting the DNSKEY RRset,
then attempting to read the corresponding key files.

Add checks that inspect the logs whether an attempt to read the key
files for the newly added keys was done (and failed because these files
are not available).
2023-06-14 09:08:56 +02:00
Tom Krizek 2633732fb1 Merge branch 'tkrizek/remove-trailing-whitespace' into 'main'
Remove trailing whitespace from all text files

See merge request isc-projects/bind9!8012
2023-06-13 13:31:32 +00:00
Tom Krizek 034a32a4f3 Add utility script to detect trailing whitespace
Run the script in CI as well to ensure we don't accidentally add
trailing whitespace again.
2023-06-13 15:06:38 +02:00
Tom Krizek 03e981ed2c Ignore trailing whitespace removal commit in git blame 2023-06-13 15:06:38 +02:00
Tom Krizek 5893debf46 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 15:05:40 +02:00
Arаm Sаrgsyаn 589752fc69 Merge branch '4136-catz-db-update-notify-bug' into 'main'
Fix catz db update callback registration logic error

Closes #4136

See merge request isc-projects/bind9!8025
2023-06-13 13:01:05 +00:00
Aram Sargsyan 23f609ba59 Add a CHANGES note for [GL #4136] 2023-06-13 12:58:13 +00:00
Aram Sargsyan 998765fea5 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.
2023-06-13 12:58:13 +00:00
Tom Krizek b94e500d3d Merge branch '4117-serve-stale-check' into 'main'
Avoid false positive in serve-stale system test check

Closes #4117

See merge request isc-projects/bind9!8026
2023-06-13 12:10:25 +00:00
Tom Krizek dd7bcd2855 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.
2023-06-13 10:52:01 +02:00
Michal Nowak c1879b54c3 Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.19.15' into 'main'
Set up version and release notes for BIND 9.19.15

See merge request isc-projects/bind9!8021
2023-06-12 15:12:13 +00:00
Michal Nowak a04301f936 Set up release notes for BIND 9.19.15 2023-06-12 16:12:40 +02:00
Michal Nowak 8f6e77aee9 Update BIND version to 9.19.15-dev 2023-06-12 16:12:27 +02:00
Michal Nowak fce9689893 Update BIND version for release 2023-06-09 12:17:36 +02:00
Michal Nowak 3b11496941 Add a CHANGES marker 2023-06-09 12:16:22 +02:00
Michal Nowak b7982536c7 Merge branch 'michal/prepare-documentation-for-bind-9.19.14' into 'security-main'
Prepare documentation for BIND 9.19.14

See merge request isc-private/bind9!530
2023-06-09 10:11:45 +00:00
Michał KępieńandMichal Nowak 466530c73b Add release note for #4049 2023-06-09 11:53:33 +02:00
Michał KępieńandMichal Nowak f933f1856b Reorder release notes 2023-06-09 11:53:33 +02:00
Michał KępieńandMichal Nowak 76877a83be Tweak and reword release notes 2023-06-09 11:53:33 +02:00
Michał KępieńandMichal Nowak 1f48e1c998 Prepare release notes for BIND 9.19.14 2023-06-09 11:53:33 +02:00
Michał KępieńandMichal Nowak 350613af9d Drop "Known Issues" entry for #4006 as it is fixed 2023-06-09 11:53:33 +02:00
Michał KępieńandMichal Nowak eb88490e91 Re-add a code comment to the "hooks" system test
Commit 5a84c7a09b removed a useful code
comment from the "hooks" system test.  Add it back to prevent confusion.
2023-06-09 11:53:33 +02:00
Michał KępieńandMichal Nowak f251588176 Add a missing word to the release note for #4004 2023-06-09 11:53:33 +02:00
Michal Nowak f69434dc47 Merge branch '4055-improve-the-overmem-cache-cleaning' into 'security-main'
Improve RBT overmem cache cleaning

See merge request isc-private/bind9!520
2023-06-09 09:50:19 +00:00
Michal Nowak 1afde574e9 Set max-cache-size expectations for low values 2023-06-08 12:11:09 +02:00
Ondřej SurýandMichal Nowak 616bd7a96e Add CHANGES and release note for [GL #4055] 2023-06-08 12:11:09 +02:00
Ondřej SurýandMichal Nowak da0eafcdee 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 12:11:09 +02:00
Arаm Sаrgsyаn 282c5605b6 Merge branch '4105-QryDropped-stats-counter-documentation-update' into 'main'
QryDropped stats counter documentation update

Closes #4105

See merge request isc-projects/bind9!8006
2023-06-07 14:00:50 +00:00
Aram Sargsyan 27c30fe8a4 QryDropped stats counter documentation update
Document which dropped queries are calculated by the QryDropped
statistics counter.
2023-06-07 13:06:58 +00:00
Michal Nowak e15455f848 Merge branch 'mnowak/placeholder-for-issue-4055' into 'main'
Add CHANGES placeholder for [GL #4055]

See merge request isc-projects/bind9!8010
2023-06-07 11:42:58 +00:00
Michal Nowak 0856c08ae9 Add CHANGES placeholder for [GL #4055] 2023-06-07 13:39:12 +02:00
Michal Nowak 490b7bd352 Merge branch 'mnowak/placeholder-for-issue-4089' into 'main'
Add CHANGES placeholder for [GL #4089]

See merge request isc-projects/bind9!8009
2023-06-07 11:18:10 +00:00
Michal Nowak a2b3c2a386 Add CHANGES placeholder for [GL #4089] 2023-06-07 13:07:51 +02:00
Michal Nowak fd606a8ea8 Merge branch 'mnowak/placeholder-for-issue-3835' into 'main'
Add CHANGES placeholder for [GL #3835]

See merge request isc-projects/bind9!8008
2023-06-07 09:00:42 +00:00
Michal Nowak e6ed763bf3 Add CHANGES placeholder for [GL #3835] 2023-06-07 10:47:37 +02:00
Ondřej Surý 5bca79da1a Merge branch '4115-fix-extra-dns_validator-detach' into 'main'
Fix extra detach when dns_validator create_fetch() detects deadlock

Closes #4115

See merge request isc-projects/bind9!8003
2023-06-06 17:34:22 +00:00
Ondřej Surý 1d03cac78a Add CHANGES note for [GL #4115] 2023-06-06 19:04:17 +02:00
Ondřej Surý 696506e164 Fix extra detach when dns_validator create_fetch() detects deadlock
When create_fetch() in the dns_validator unit detects deadlock, it
returns DNS_R_NOVALIDSIG, but it didn't attach to the validator.  The
other condition to returning result != ISC_R_SUCCESS would be error from
dns_resolver_createfetch().  The caller (in two places out of three)
would detect the error condition and always detach from the validator.

Move the dns_validator_detach() on dns_resolver_createfetch() error
condition to create_fetch() function and cleanup the extra detaches in
seek_dnskey() and get_dsset().
2023-06-06 19:04:17 +02:00
Ondřej Surý fbab2dd45f Merge branch '4038-resize-send-buffers-to-avoid-excessive-memory-allocation' into 'main'
Use appropriately sized send buffers for DNS messages over TCP

Closes #4038

See merge request isc-projects/bind9!8004
2023-06-06 11:41:44 +00:00
Ondřej Surý dff9a56f07 Merge branch 'ondrej/print-library-versions' into 'main'
Print the libuv, liburcu and OpenSSL versions from configure script

See merge request isc-projects/bind9!7998
2023-06-06 11:40:51 +00:00
Artem BoldarievandOndřej Surý 8672d54847 Update CHANGES and release note [GL #4038]
Mention that memory usage was reduced by allocating properly sized
send buffers for stream-based transports.
2023-06-06 13:40:42 +02:00
Artem BoldarievandOndřej Surý d8a5feb556 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.
2023-06-06 13:40:42 +02:00
Ondřej Surý 920dddb729 Print the libuv, liburcu and OpenSSL versions from configure script
The configure summary now prints versions of the mandatory libraries
found when configuring.
2023-06-06 12:42:02 +02:00
Mark Andrews 8169a0ee31 Merge branch '4116-building-with-with-liburcu-qsbr-fails' into 'main'
Resolve "Building with --with-liburcu=qsbr fails"

Closes #4116

See merge request isc-projects/bind9!8002
2023-06-05 23:46:49 +00:00
Mark Andrews e6e4ac05b8 Fix typo in synchronize_rcu macro (add h)
synchronize_rcu has not been used until now in BIND9 and there
was a typo in the define (a 'h' was missing).
2023-06-06 08:10:09 +10:00
Mark Andrews c26d66604b Merge branch '4093-use-rcu-for-view-zonetable' into 'main'
Use RCU for view->zonetable

Closes #4093

See merge request isc-projects/bind9!7990
2023-06-02 00:39:07 +00:00
Mark AndrewsandOndřej Surý 47ed397806 Add CHANGES note for [GL #4093] 2023-06-01 16:51:38 +02:00
Mark AndrewsandOndřej Surý 783c6a9538 Use dns_view_findzone instead of dns_zt_find
This ensures that rcu locking is properly applied for
view->zonetable.
2023-06-01 16:51:38 +02:00
Mark AndrewsandOndřej Surý 8d86fa7135 Extend dns_view_findzone to take an options argument
This is in preparation to allow the few remaining direct
dns_zt_find(view->zonetable, ...) to use it for rcu mediated
access to view->zonetable.
2023-06-01 16:51:38 +02:00
Mark AndrewsandOndřej Surý ceb3264082 Add dns_view_apply
Add dns_view_apply to allow dns_zt_apply to be called on
view->zonetable with rcu locking applied.
2023-06-01 16:51:38 +02:00
Mark AndrewsandOndřej Surý e0f41259bd Add dns_view_delzone
dns_view_delzone performs the rcu locking required around accessing
view->zonetable.
2023-06-01 16:51:38 +02:00
Mark AndrewsandOndřej Surý ad747976bb Use rcu methods to lock access view->zonetable
dns_view_find* may be called after the final call to dns_view_detach
is made which detaches view->zonetable to permit the server to
shutdown.  We need to detect if view->zonetable is NULL during this
stage and appropriately recover.
2023-06-01 16:51:38 +02:00
Ondřej Surý f760ee3f8c Disable URCU inlining if inlined rcu_dereference() fails to compile
In some cases, the inlined version rcu_dereference() would not compile
when working on pointer to opaque struct (namely Ubuntu Jammy).  Detect
such condition in the autoconf and disable the inlining of the small
functions if it breaks the build.
2023-06-01 16:51:38 +02:00
Arаm Sаrgsyаn 1b0e7e7a50 Merge branch '4074-fix-stale-answer-client-timeout-with-clients-per-query' into 'main'
Fix a clients-per-query miscalculation bug

Closes #4074

See merge request isc-projects/bind9!7977
2023-06-01 09:21:10 +00:00
Aram Sargsyan 466a7d9b5f Add CHANGES and release notes for [GL #4074] 2023-06-01 08:14:31 +00:00
Aram Sargsyan 2ae5c4a674 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.
2023-06-01 08:13:09 +00:00
Aram Sargsyan 3bb2babcd0 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.
2023-06-01 08:13:09 +00:00
Aram Sargsyan 7ebd055c78 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.
2023-06-01 08:13:09 +00:00
Aram Sargsyan 101d829b02 Fix fetchlimit system test issues
1. Fix the numbering.
2. Fix an artifacts rewriting issue.
3. Add missing checks of 'ret' after some checks.
2023-06-01 08:13:09 +00:00
Michal Nowak a9ec626652 Merge branch 'mnowak/alpine-3.18' into 'main'
Add Alpine Linux 3.18

See merge request isc-projects/bind9!7985
2023-05-31 10:02:52 +00:00
Michal Nowak ddb846454d Add Alpine Linux 3.18 2023-05-31 12:01:26 +02:00
Arаm Sаrgsyаn 01605a7ed1 Merge branch 'aram/statschannel-spilled-clients-counter' into 'main'
Add ClientQuota statistics channel counter

See merge request isc-projects/bind9!7978
2023-05-31 09:52:29 +00:00
Aram Sargsyan fa9172d996 Add a CHANGES note for [GL !7978] 2023-05-31 09:09:35 +00:00
Aram Sargsyan 08ebf39d1e 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.
2023-05-31 09:08:58 +00:00
Aram Sargsyan 04648d7c2f Add ClientQuota statistics channel counter
This counter indicates the number of the resolver's spilled
queries due to reaching the clients per query quota.
2023-05-31 09:08:58 +00:00
Evan Hunt c8b69a0289 Merge branch '4012-remove-win2k-hacks' into 'main'
remove win2k gss-tsig hacks

Closes #4012

See merge request isc-projects/bind9!7843
2023-05-31 08:29:20 +00:00
Evan Hunt f58b9e9d2c CHANGES and release notes for [GL #4012] 2023-05-30 15:36:15 -07:00
Evan Hunt 26b4acde16 remove win2k gss-tsig hacks
Remove the code implementing nonstardard behaviors that were formerly
needed to allow GSS-TSIG to work with Windows 2000, which passed
End-of-Life in 2010.

Deprecate the "oldgsstsig" command and "-o" command line option
to nsupdate; these are now treated as synonyms for "gsstsig" and "-g"
respectively.
2023-05-30 15:36:01 -07:00
Michal Nowak 1e3bafde51 Merge branch 'mnowak/custom-userspace-rcu-library' into 'main'
Drop liburcu-related TSAN suppressions

See merge request isc-projects/bind9!7971
2023-05-30 18:27:12 +00:00
Michal Nowak 04dda8661f 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.

Also, drop liburcu-related TSAN suppressions because they are
unnecessary with TSAN-aware liburcu.
2023-05-30 20:13:19 +02:00
Michal Nowak 1b7ed2da1a Merge branch 'mnowak/look-for-core-files-in-TOP_BUILDDIR' into 'main'
Look for core files in $TOP_BUILDDIR

See merge request isc-projects/bind9!7869
2023-05-30 17:54:48 +00:00
Michal Nowak a13448a769 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.
2023-05-30 19:41:31 +02:00
Tom Krizek 7b863f9621 Merge branch 'tkrizek-fix-pytest-base-port' into 'main'
Fix base_port calculation in pytest runner

See merge request isc-projects/bind9!7981
2023-05-30 13:36:42 +00:00
Tom Krizek e8ea6b610b 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.
2023-05-30 14:11:14 +02:00
Matthijs Mekking 7b35586047 Merge branch '3950-serve-stale-strikes-again' into 'main'
Fix serve-stale bug when cache has no data

Closes #3950

See merge request isc-projects/bind9!7856
2023-05-30 11:02:13 +00:00
Matthijs Mekking 23dbb6ba72 Add release note and changes for #3950
Fixing another serve-stale bug is still news.
2023-05-30 11:58:50 +02:00
Matthijs Mekking 74d30879ba Extend serve-stale logging
Print the database lookup result in serve-stale logs for debugging
potential future serve-stale issues.
2023-05-30 11:58:19 +02:00
Matthijs Mekking bbd163acf6 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.
2023-05-30 11:58:19 +02:00
Matthijs Mekking c3d4fd3449 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).
2023-05-30 11:58:19 +02:00
Ondřej Surý efa8cbbf68 Merge branch '3905-placeholder' into 'main'
Add CHANGES placeholder for [GL #3905]

Closes #3905

See merge request isc-projects/bind9!7976
2023-05-29 06:02:51 +00:00
Ondřej Surý e497cb485c Add CHANGES placeholder for [GL #3905] 2023-05-29 08:00:16 +02:00
Ondřej Surý d98cfe7f8b Merge branch '4098-remove-cruft-epoll-kqueue-configure-options' into 'main'
Remove obsolete epoll/kqueue/devpoll configure options

Closes #4098

See merge request isc-projects/bind9!7973
2023-05-29 05:57:03 +00:00
Ondřej Surý 0266760fdd Add CHANGES note for [GL #4098] 2023-05-29 07:44:24 +02:00
Ondřej Surý 051f3d612f 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).
2023-05-29 07:44:24 +02:00
Mark Andrews 3bcc25abf0 Merge branch '4090-corrected-bad-insist-logic-in-isc_radix_remove' into 'main'
Resolve "Corrected bad INSIST logic in isc_radix_remove()"

Closes #4090

See merge request isc-projects/bind9!7966
2023-05-29 02:22:18 +00:00
Mark Andrews 03ebe96110 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.
2023-05-29 01:40:57 +00:00
Mark Andrews ac2e0bc3ff 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.
2023-05-29 01:40:57 +00:00
Evan Hunt 5c30012a83 Merge branch '4085-httpd-shutdown-issue' into 'main'
don't set SHUTTINGDOWN until after calling the request callbacks

Closes #4085

See merge request isc-projects/bind9!7961
2023-05-27 04:12:09 +00:00
Evan Hunt 512e5e786b don't set SHUTTINGDOWN until after calling the request callbacks
if we set ISC_HTTPDMGR_SHUTTINGDOWN in the http manager before
calling the pending request callbacks, it can trigger an assertion.
2023-05-27 00:41:37 +00:00
Artem Boldariev 45b3a4a4cb Merge branch '4091-syncrhonise-access-to-the-client-tlsctx-cache' into 'main'
ZMGR: TLS contexts cache - properly synchronise access

Closes #4091

See merge request isc-projects/bind9!7967
2023-05-26 12:07:43 +00:00
Artem Boldariev 0b95cf74ff 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.
2023-05-26 14:18:03 +03:00
Tom Krizek 714d722604 Merge branch '4082-rrl-would-limit-log-line' into 'main'
Disable rrl check in slow environments

Closes #4082

See merge request isc-projects/bind9!7963
2023-05-26 10:26:41 +00:00
Tom Krizek d8997db5d5 Disable rrl check in slow environments
The check for 'would limit' log message is triggered by sending at least
three messages within one second. However, in extremely slow conditions
(currently when running with clang+TSAN in CI), the individual queries
might take too much time to send enough of them within one second.

Since this is a pretty rare condition, let's just silently skip this
test in environments where a single query takes more than 500 ms, since
there's no way to perform the check under such conditions.

Closes #4082
2023-05-26 12:25:36 +02:00
Michal Nowak 6efe11bcec Merge branch 'mnowak/gitlab-runner-autoscaling' into 'main'
Run most Docker CI jobs in AWS with autoscaler

See merge request isc-projects/bind9!7960
2023-05-26 09:45:53 +00:00
Michal Nowak f09cf69594 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.
2023-05-26 11:37:58 +02:00
Evan Hunt ee5ee5a994 Merge branch '4072-tcp-dispatch-timeout' into 'main'
fix handling of TCP timeouts

Closes #4072

See merge request isc-projects/bind9!7937
2023-05-26 08:49:52 +00:00
Evan Hunt 0e800467ee 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.
2023-05-26 00:41:01 -07:00
Evan Hunt 2f75605698 Merge branch '4079-multiple-keyrings' into 'main'
prevent TSIG keys from being added to multiple rings

Closes #4079

See merge request isc-projects/bind9!7955
2023-05-25 22:01:33 +00:00
Evan Hunt 03a9aa95bf CHANGES for [GL #4079] 2023-05-25 11:59:37 -07:00
Evan Hunt e436d84408 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 11:59:02 -07:00
Arаm Sаrgsyаn 80eb7c2d21 Merge branch '3765-interfacemgr-use-after-afree-on-shutdown' into 'main'
Fix an interfacemgr use-after-free error in zoneconf.c:isself()

Closes #3765

See merge request isc-projects/bind9!7962
2023-05-25 08:29:01 +00:00
Aram Sargsyan b409db08cf Add a CHANGES note for [GL #3765] 2023-05-24 14:38:53 +00:00
Aram Sargsyan 64d69e4adc 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.
2023-05-24 14:26:04 +00:00
Tom Krizek 5f62932bb1 Merge branch 'tkrizek/ci-clang-tsan-allow-failure' into 'main'
Allow the system:clang:tsan job to fail in CI

See merge request isc-projects/bind9!7958
2023-05-24 08:38:46 +00:00
Tom Krizek 83a0c3d858 Allow the system:clang:tsan job to fail in CI
There are couple of known failures currently affecting this test:
- rrl (GL #4082)
- upforwd (GL #4072)
2023-05-24 10:37:45 +02:00
Matthijs Mekking bf6fbf9ee5 Merge branch '2710-fix-inline-signing-multisigner-bugs-matthijs' into 'main'
Make multisigner server capabilities work with inline-signing

Closes #2710

See merge request isc-projects/bind9!6901
2023-05-23 12:05:46 +00:00
Matthijs Mekking 7ab3bfd596 Fix dnssec system test
The 'update-nsec3.example' requires to be DNSSEC maintained via
dynamic update. Commit 03b22983cd20cec51ad8b9f25f2e7d0e472dc79c adds
checks to make sure the raw zone is not signed. So the test case neesd
to be updated to allow for DNSSEC maintenance.
2023-05-23 08:53:23 +02:00
Matthijs Mekking ef58f2444f Add new dns_rdatatype_iskeymaterial() function
The following code block repeats quite often:

    if (rdata.type == dns_rdatatype_dnskey ||
        rdata.type == dns_rdatatype_cdnskey ||
        rdata.type == dns_rdatatype_cds)

Introduce a new function to reduce the repetition.
2023-05-23 08:53:23 +02:00
Matthijs Mekking 81cb18b8a2 Make make_dnskey() a public funcion
It can be used to compare DNSKEY, CDNSKEY, and CDS records with
signing keys.
2023-05-23 08:53:23 +02:00
Matthijs Mekking f636aceb50 Add more multisigner tests, removing records
A zone in multisigner model 2 should also be possible to remove
previously added DNSKEY, CDS and CDNSKEY records from the zone operated
by the other provider.
2023-05-23 08:53:23 +02:00
Matthijs Mekking 70e10b3c50 Add bump in the wire multisigner test
Add a test case where updates are being made against a hidden primary
and two bump in the wire signers (the providers in the multisigner
model) serve the zone.

The test covers the same cases as for two primary providers that is:
- Add DNSKEY
- Remove (previously added) DNSKEY
- Add CDNSKEY
- Remove (previously added) CDNSKEY
- Add CDS
- Remove (previously added) CDS
2023-05-23 08:53:23 +02:00
Mark AndrewsandMatthijs Mekking d24297343f Don't sign the raw zone
The raw zone is not supposed to be signed.  DNSKEY records in a raw zone
should not trigger zone signing.  The update code needs to be able to
identify when it is working on a raw zone.  Add dns_zone_israw() and
dns_zone_issecure() enable it to do this. Also, we need to check the
case for 'auto-dnssec maintain'.
2023-05-23 08:53:23 +02:00
Matthijs Mekking 508c60ad90 Ensure no DNSSEC records are in the raw journal
Add checks to the multisigner test to make sure no DNSSEC related
records (NSEC, NSEC3, NSEC3PARAM, RRSIG) end up in the raw journal.
2023-05-23 08:53:23 +02:00
Matthijs Mekking 7a39651da5 Add notes and change entry 2023-05-23 08:53:22 +02:00
Matthijs Mekking a565cb9c31 Add more multisigner tests
A zone in multisigner model 2 should also be possible to publish the
CDS and CDNSKEY records from their KSK into the zone operated by the
other provider.
2023-05-23 08:52:01 +02:00
Matthijs Mekking b493c8505e Fix dns_zone_getkasp() function
For inline-signing zones, sometimes kasp was not detected because
the function was called on the raw (unsigned) version of the zone,
but the kasp is only set on the secure (signed) version of the zone.

Fix the dns_zone_getkasp() function to check whether the zone
structure is inline_raw(), and if so, use the kasp from the
secure version.

In zone.c we can access the kasp pointer directly.
2023-05-23 08:52:01 +02:00
Matthijs Mekking b0b3e2f12e Allow DNSKEY when syncing secure journal/db
When synchronizing the journal or database from the unsigned version of
the zone to the secure version of the zone, allow DNSKEY records to be
synced, because these may be added by the user with the sole intent to
publish the record (not used for signing). This may be the case for
example in the multisigner model 2 (RFC 8901).

Additional code needs to be added to ensure that we do not remove DNSKEY
records that are under our control. Keys under our control are keys that
are used for signing the zone and thus that we have key files for.

Same counts for CDNSKEY and CDS (records that are derived from keys).
2023-05-23 08:52:01 +02:00
Matthijs Mekking 3b6e9a5fa7 Add function to check if a DNSKEY record is in use
Add a function that checks whether a DNSKEY, CDNSKEY, or CDS record
belongs to a key that is being used for signing.
2023-05-23 08:52:01 +02:00
Matthijs Mekking 4e18991fed Add multisigner system test
Add a new system test to test multisigner model use cases. This
initial test just tests a small part of the model 2, and uses two
providers for the same zone, ns3 and ns4, each with their own unique
key set. This commit tests that each provider can import their ZSK
of the other provider into their DNSKEY RRset, using dynamic update.

Both providers use dnssec-policy, ns3 applies the DNSSEC records
directly, while ns4 uses inline-signing.
2023-05-23 08:52:01 +02:00
Mark Andrews b92d33a849 Merge branch '4053-cid-453470-use-after-free-in-lib-ns-client-c' into 'main'
Resolve "CID 453470: Use after free in lib/ns/client.c"

Closes #4053

See merge request isc-projects/bind9!7898
2023-05-23 03:02:26 +00:00
Mark Andrews c48c72343d Silence Coverity USE_AFTER_FREE warning
Use current used pointer - 16 instead of a saved pointer as Coverity
thinks the memory may be freed between assignment and use of 'cp'.
isc_buffer_put{mem,uint{8,16,32}} can theoretically free the memory
if there is a dynamic buffer in use but that is not the case here.
2023-05-23 02:13:28 +00:00
Evan Hunt 262cf2169a Merge branch 'each-placeholder' into 'main'
placeholder for [GL #3905]

See merge request isc-projects/bind9!7957
2023-05-22 23:15:59 +00:00
Evan Hunt 6b8dadaa87 placeholder for [GL #3905] 2023-05-22 16:09:49 -07:00
Tom Krizek 88dd5a9bd2 Merge branch 'tkrizek/system-tests-pytest-runner' into 'main'
System tests: support using pytest instead of run.sh

Closes #3978

See merge request isc-projects/bind9!6809
2023-05-22 14:53:00 +00:00
Tom Krizek edaa5f5d2a 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.
2023-05-22 14:24:33 +02:00
Tom Krizek fd889bf0ad Add CHANGES and release note for [GL #3978] 2023-05-22 14:11:41 +02:00
Tom Krizek 0f8a2b07a4 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.
2023-05-22 14:11:41 +02:00
Tom Krizek 1aaefc9cf4 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.
2023-05-22 14:11:41 +02:00
Tom Krizek 8d40156bb2 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.
2023-05-22 14:11:41 +02:00
Tom Krizek 68b1c6877b 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'
2023-05-22 14:11:41 +02:00
Tom Krizek 12c724ee07 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.
2023-05-22 14:11:40 +02:00
Tom Krizek 99e2e50c0e 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.
2023-05-22 14:11:40 +02:00
Tom Krizek 6f134283eb 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.
2023-05-22 14:11:40 +02:00
Tom Krizek 952776b61f 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.
2023-05-22 14:11:40 +02:00
Tom Krizek 087a9b3c97 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
2023-05-22 14:11:40 +02:00
Tom Krizek 3a20e8d990 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.
2023-05-22 14:11:40 +02:00
Petr ŠpačekandTom Krizek 37ed9ad2f8 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.
2023-05-22 14:11:40 +02:00
Tom Krizek a6559176f1 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.
2023-05-22 14:11:40 +02:00
Tom Krizek 0a063f51d3 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.
2023-05-22 14:11:40 +02:00
Tom Krizek 1cc55d01c7 Run system tests sequentially if xdist is not available 2023-05-22 14:11:39 +02:00
Petr ŠpačekandTom Krizek 8952618262 Include logs from failing tests in JUnit output 2023-05-22 14:11:39 +02:00
Petr ŠpačekandTom Krizek d0619c7a18 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.
2023-05-22 14:11:39 +02:00
Tom Krizek 8f57bce7af 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.
2023-05-22 14:11:39 +02:00
Tom Krizek 4dbe8e5347 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).
2023-05-22 14:11:39 +02:00
Tom Krizek 4bc2b3be48 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.
2023-05-22 14:11:39 +02:00
Tom Krizek d1ef51f589 Add developer docs for pytest system test runner 2023-05-22 14:11:39 +02:00
Tom Krizek dc84121004 Update user docs with pytest system test runner 2023-05-22 14:11:39 +02:00
Tom Krizek 2f5bf6d971 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.
2023-05-22 14:11:39 +02:00
Tom Krizek 8a406b73c9 Ignore tempdirs during pytest collection phase 2023-05-22 14:11:38 +02:00
Tom Krizek 527ac6ad26 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.
2023-05-22 14:11:38 +02:00
Tom Krizek 247e90c382 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.
2023-05-22 14:11:38 +02:00
Tom Krizek 2d93ed8546 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.
2023-05-22 14:11:38 +02:00
Tom Krizek 8b1a906b39 Add --noclean option to pytest runner
Support the --noclean option to allow the user to keep the artifacts
from any test run.
2023-05-22 14:11:38 +02:00
Tom Krizek c571af8c8f 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.
2023-05-22 14:11:38 +02:00
Tom Krizek 2b64618624 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.
2023-05-22 14:11:37 +02:00
Tom Krizek 6886cc1826 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.
2023-05-22 14:11:37 +02:00
Tom Krizek 0061758156 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.
2023-05-22 14:11:37 +02:00
Tom Krizek ee26066897 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.
2023-05-22 14:11:37 +02:00
Tom Krizek 2f7af791a1 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
2023-05-22 14:11:37 +02:00
Tom Krizek 08c4e35bc0 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.
2023-05-22 14:11:37 +02:00
Tom Krizek 30cb9b7e28 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.
2023-05-22 14:11:35 +02:00
Tony Finch 845fa7a849 Merge branch '4070-tsan-qpmulti-destroy' into 'main'
Acquire qpmulti->mutex during destruction

Closes #4070 and #4073

See merge request isc-projects/bind9!7938
2023-05-20 07:27:44 +00:00
Tony Finch b754c6628f Acquire qpmulti->mutex during destruction
Thread sanitizer warns that parts of the qp-trie are accessed
both with and without the mutex; the unlocked accesses happen during
destruction, so they should be benign, but there's no harm locking
anyway to convince tsan it is clean.

Also, ensure .tsan-suppress and .tsan-suppress-extra are in sync.
2023-05-20 07:26:21 +00:00
Michal Nowak 4203e1643a Merge branch 'mnowak/danger-test-pairwise-hint' into 'main'
Add a friendly Danger plea to run the pairwise CI job

See merge request isc-projects/bind9!7876
2023-05-19 12:31:28 +00:00
Michal Nowak 96563c6020 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.
2023-05-19 14:11:54 +02:00
Michal Nowak 07d2684af8 Merge branch 'mnowak/fedora-38' into 'main'
Add Fedora 38

See merge request isc-projects/bind9!7936
2023-05-19 11:53:40 +00:00
Michal Nowak 2e0550970b Add Fedora 38 2023-05-19 13:47:53 +02:00
Michal Nowak 55cec5d45d Merge branch '4077-add-RUNTIME_CHECK-around-wrap' into 'main'
Ensure "wrap" variable is non-NULL

Closes #4077

See merge request isc-projects/bind9!7948
2023-05-19 09:07:18 +00:00
Michal Nowak 1fe5c008d6 Ensure "wrap" variable is non-NULL
RUNTIME_CHECK on the "wrap" variable avoids possible NULL dereference:

    thread.c: In function 'thread_wrap':
    thread.c:60:15: error: dereference of possibly-NULL 'wrap' [CWE-690] [-Werror=analyzer-possible-null-dereference]
       60 |         *wrap = (struct thread_wrap){

The RUNTIME_CHECK was there before
7d1ceaf35d.
2023-05-19 11:02:59 +02:00
Michal Nowak 896cf6364a Merge branch 'mnowak/get_core_dumps-fix-misplaced-tsan-line' into 'main'
TSAN summarising line was misplaced in get_core_dumps.sh

See merge request isc-projects/bind9!7870
2023-05-19 07:18:11 +00:00
Michal Nowak 0c4c7ddec4 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.
2023-05-19 08:57:36 +02:00
Michał Kępień 59ea45fc48 Merge branch 'michal/cmocka-future-proofing' into 'main'
cmocka future-proofing

See merge request isc-projects/bind9!7939
2023-05-18 13:30:48 +00:00
Michał Kępień 6029010dd2 Remove <isc/cmocka.h>
The last use of the cmocka_add_test_byname() helper macro was removed in
commit 63fe9312ff.  Remove the
<isc/cmocka.h> header that defines it.
2023-05-18 15:12:23 +02:00
Michał Kępień 8d36e68c7a 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:68:45: warning: passing argument 2 of ‘_assert_ptr_equal’ makes pointer from integer without a cast [-Wint-conversion]
       68 |                 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:163:45: warning: passing argument 2 of ‘_assert_ptr_equal’ makes pointer from integer without a cast [-Wint-conversion]
      163 |                 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
2023-05-18 15:12:23 +02:00
Michał Kępień c2dcd055fe 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.
2023-05-18 15:12:23 +02:00
Michał Kępień ddbbb8612d Merge tag 'v9.19.13'
BIND 9.19.13
2023-05-18 14:06:04 +02:00
Mark Andrews 1845e8bff3 Merge branch '4022-three-dnssec-failures-on-fedora-38' into 'main'
Resolve "Three "dnssec" failures on Fedora 38"

Closes #4022

See merge request isc-projects/bind9!7932
2023-05-18 00:42:17 +00:00
Mark Andrews d360d8af8f Let RSASHA1 signing keys be ignored in FIPS mode
When the FIPS provider is available, RSASHA1 signing keys for zone
"example.com." are ignored if the zone is attempted to be signed with
the dnssec-signzone "-F" (FIPS mode) option:

    "fatal: No signing keys specified or found"
2023-05-17 23:51:39 +00:00
Michał Kępień 35094195cf Merge branch '4071-placeholder' into 'main'
Add placeholder for GL #4071

Closes #4071

See merge request isc-projects/bind9!7941
2023-05-17 14:28:22 +00:00
Michał Kępień b95f85f4a9 Add placeholder for GL #4071 2023-05-17 16:26:39 +02:00
Tony Finch 55cc071547 Merge branch '4069-upforwd-wait' into 'main'
Fix the `upforwd` system test

Closes #4069

See merge request isc-projects/bind9!7931
2023-05-16 15:29:29 +00:00
Tony Finch 725c2b12e8 CHANGES for [GL #4069]
[test]		Fix the `upforwd` system test to be more reliable,
		especially when using thread sanitizer.
2023-05-16 13:38:05 +01:00
Evan HuntandTony Finch 6bf35c2f19 Match UQ and UR stats to domain name
The upforwd test for forwarding updates to a dead primary can continue
running a little bit past its end, causing update replies to be
recorded during a subsequent test case. Correct this by only looking
for update requests and replies for the specific domain name being
tested at any given time.
2023-05-16 13:37:07 +01:00
Tony Finch 2e96d225ae Fix the upforwd system test
After the RCU changes were merged, the `upforwd` test started
consistenly failing when run under thread sanitizer. After some
investigation, it turned out that retry attempts were continuing after
the "update forwarding to dead primary" test. This caused mismatches
in the DNSTAP message counts for the subsequent tests, because they
were also counting retries.

Fix this problem by `wait`ing for the `nsupdate` processes to exit.

While investigating the bug, I replaced several fixed 15 second delays
with `wait_for_log`, so the test runs faster.
2023-05-16 13:37:02 +01:00
Mark Andrews 7d3cd47a7a Merge branch '4066-resolv-conf-parsing-eats-lines-if-more-than-3-nameservers-set' into 'main'
Resolve "resolv.conf parsing eats lines if more than 3 nameservers set"

Closes #4066

See merge request isc-projects/bind9!7922
2023-05-16 03:25:34 +00:00
Mark Andrews 36dab033dc Add CHANGES for [GL #4066] 2023-05-16 02:04:55 +00:00
Mark Andrews 864cd08052 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.
2023-05-16 02:04:55 +00:00
Tony Finch 15eaf9d3f2 Merge branch 'fanf-urcu-qsbr-build' into 'main'
Fixes for liburcu-qsbr

Closes #4067

See merge request isc-projects/bind9!7925
2023-05-15 20:49:47 +00:00
Tony Finch c319ccd4c9 Fixes for liburcu-qsbr
Move registration and deregistration of the main thread from
`isc_loopmgr_run()` into `isc__initialize()` / `isc__shutdown()`:
liburcu-qsbr fails an assertion if we try to use it from an
unregistered thread, and we need to be able to use it when the
event loops are not running.

Use `rcu_assign_pointer()` and `rcu_dereference()` in qp-trie
transactions so that they properly mark threads as online. The
RCU-protected pointer is no longer declared atomic because
liburcu does not (yet) use standard C atomics.

Fix the definition of `isc_qsbr_rcu_dereference()` to return
the referenced value, and to call the right function inside
liburcu.

Change the thread sanitizer suppressions to match any variant of
`rcu_*_barrier()`
2023-05-15 20:49:42 +00:00
Tony Finch b4326572dd Merge branch '4068-coverity-uv_async_send' into 'main'
Check the return value from uv_async_send()

Closes #4068

See merge request isc-projects/bind9!7926
2023-05-15 20:49:23 +00:00
Tony Finch afae41aa40 Check the return value from uv_async_send()
An omission pointed out by the following report from Coverity:

    /lib/isc/loop.c: 483 in isc_loopmgr_pause()
    >>>     CID 455002:  Error handling issues  (CHECKED_RETURN)
    >>>     Calling "uv_async_send" without checking return value (as is done elsewhere 5 out of 6 times).
    483     		uv_async_send(&loop->pause_trigger);
2023-05-15 18:52:04 +01:00
Michal Nowak e047508cb4 Merge branch 'mnowak/openbsd-7.3' into 'main'
Add OpenBSD 7.3

See merge request isc-projects/bind9!7847
2023-05-15 17:46:44 +00:00
Michal Nowak ff52cd9604 Add OpenBSD 7.3 2023-05-15 18:55:38 +02:00
Michal Nowak b59c58702e Merge branch 'mnowak/freebsd-13.2' into 'main'
Add FreeBSD 13.2

See merge request isc-projects/bind9!7846
2023-05-15 16:31:38 +00:00
Michal Nowak 81ad645d7d Add FreeBSD 13.2 2023-05-15 18:31:07 +02:00
Evan Hunt 996819b0a3 Merge branch '4064-read-timeout-failure' into 'main'
allow streamdns read to resume after timeout

Closes #4064

See merge request isc-projects/bind9!7921
2023-05-15 16:25:45 +00:00
Evan Hunt b4ac7faee9 allow streamdns read to resume after timeout
when reading on a streamdns socket failed due to timeout, but
the dispatch was still waiting for other responses, it would
resume reading by calling isc_nm_read() again. this caused
an assertion because the socket was already reading.

we now check that either the socket is reading, or that it was
already reading on the same handle.
2023-05-13 23:31:45 -07:00
Tony Finch 562697e703 Merge branch 'fanf-urcu-qp' into 'main'
Replace isc_qsbr with liburcu-qsbr

Closes #3936 and #4019

See merge request isc-projects/bind9!7668
2023-05-12 20:43:30 +00:00
Tony Finch 5e97ec5ead CHANGES note for [GL #3936]
[cleanup]	Refactor the loop manager and qp-trie code to remove
		isc_qsbr and use liburcu instead. [GL #3936]
2023-05-12 20:50:37 +01:00
Tony Finch fc770a8bd0 Remove the now-unused ISC_STACK
We are using the liburcu concurrent data structures instead.
2023-05-12 20:49:43 +01:00
Tony Finch f11cc83142 Use per-CPU RCU helper threads
Create and free per-CPU helper threads from the main thread and tell
thread sanitizer to suppress leaking threads. (We are not leaking
threads ourselves and we can safely ignore the Userspace-RCU thread
leaks.)
2023-05-12 20:48:31 +01:00
Tony Finch c377e0a9e3 Help thread sanitizer to cope with liburcu
All the places the qp-trie code was using `call_rcu()` needed
`__tsan_release()` and `__tsan_acquire()` annotations, so
add a couple of wrappers to encapsulate this pattern.

With these wrappers, the tests run almost clean under thread
sanitizer. The remaining problems are due to `rcu_barrier()`
which can be suppressed using `.tsan-suppress`. It does not
suppress the whole of `liburcu`, because we would like thread
sanitizer to detect problems in `call_rcu()` callbacks, which
are called from `liburcu`.

The CI jobs have been updated to use `.tsan-suppress` by
default, except for a special-case job that needs the
additional suppressions in `.tsan-suppress-extra`.

We might be able to get rid of some of this after liburcu gains
support for thread sanitizer.

Note: the `rcu_barrier()` suppression is not entirely effective:
tsan sometimes reports races that originate inside `rcu_barrier()`
but tsan has discarded the stack so it does not have the
information required to suppress the report. These "races" can
be made much easier to reproduce by adding `atexit_sleep_ms=1000`
to `TSAN_OPTIONS`. The problem with tsan's short memory can be
addressed by increasing `history_size`: when it is large enough
(6 or 7) the `rcu_barrier()` stack usually survives long enough
for suppression to work.
2023-05-12 20:48:31 +01:00
Tony Finch 2bce998b2b Avoid using the zone timer after its loop has gone
Shutdown and cleanup of zones is more asynchronous with the qp-trie
zone table. As a result it's possible that some activity is delayed
until after a zone has been released from its zonemanager.

Previously, the dns_zone code was not very strict in the way it
refers to the loop it is running on: The loop pointer was stashed when
dns_zonemgr_managezone() was called and never cleared. Now, zones
properly attach to and detach from their loops.

The zone timer depends on its loop. The shutdown crashes occurred
when asynchronous calls tried to modify the zone timer after
dns_zonemgr_releasezone() has been called and the loop was
invalidated. In these cases the attempt to set the timer is now
ignored, with a debug log message.
2023-05-12 20:48:31 +01:00
Tony Finch c890b9b124 Get the tests working with liburcu
Mostly a few qp-trie details to adjust.
2023-05-12 20:48:31 +01:00
Tony Finch 9882a6ef90 The zone table no longer depends on the loop manager
This reverts some of the changes in commit b171cacf4f
because now it isn't necessary to pass the loopmgr around.
2023-05-12 20:48:31 +01:00
Tony Finch 6217e434b5 Refactor the core qp-trie code to use liburcu
A `dns_qmpulti_t` no longer needs to know about its loopmgr. We no
longer keep a linked list of `dns_qpmulti_t` that have reclamation
work, and we no longer mark chunks with the phase in which they are to
be reclaimed. Instead, empty chunks are listed in an array in a
`qp_rcu_t`, which is passed to call_rcu().
2023-05-12 20:48:31 +01:00
Tony Finch 05ca11e122 Remove isc_qsbr (we are using liburcu instead)
This commit breaks the qp-trie code.
2023-05-12 20:48:31 +01:00
Tony Finch cd0795beea Slightly more sanitary thread dispatch
Tell thread sanitizer that the thread wrapper is released before
passing it to a new thread.
2023-05-12 20:48:31 +01:00
Tony Finch 2e0c954806 Wait for RCU to finish before destroying a memory context
Memory reclamation by `call_rcu()` is asynchronous, so during shutdown
it can lose a race with the destruction of its memory context. When we
defer memory reclamation, we need to attach to the memory context to
indicate that it is still in use, but that is not enough to delay its
destruction. So, call `rcu_barrier()` in `isc_mem_destroy()` to wait
for pending RCU work to finish before proceeding to destroy the memory
context.
2023-05-12 20:48:31 +01:00
Tony Finch 4f97a679f0 A macro for the size of a struct with a flexible array member
It can be fairly long-winded to allocate space for a struct with a
flexible array member: in general we need the size of the struct, the
size of the member, and the number of elements. Wrap them all up in a
STRUCT_FLEX_SIZE() macro, and use the new macro for the flexible
arrays in isc_ht and dns_qp.
2023-05-12 20:48:31 +01:00
Evan Hunt 5673c9912e Merge branch '4046-rndc-t-option' into 'main'
add 'rndc -t' option to set timeout

Closes #4046

See merge request isc-projects/bind9!7889
2023-05-12 19:37:36 +00:00
Evan Hunt 0ee38f905f CHANGES and release note for part 2 of [GL #4046] 2023-05-12 11:29:16 -07:00
Evan Hunt 922a390852 add 'rndc -t' option to set timeout
Allow an arbitrary TCP timeout value to be specified when running
rndc, so that commands that take a long time to execute (for example,
reloading a very large configuration) can be given time to do so.
2023-05-12 11:28:21 -07:00
Arаm Sаrgsyаn 7a2784addd Merge branch '4054-zone_resigninc-bugfix' into 'main'
zone_resigninc(): check whether zone->db is a valid pointer before attaching

Closes #4054

See merge request isc-projects/bind9!7914
2023-05-12 13:37:46 +00:00
Aram Sargsyan 00ed5f84a9 Add a CHANGES note for [GL #4054] 2023-05-12 13:37:27 +00:00
Aram Sargsyan fae0930eb8 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.
2023-05-12 13:37:27 +00:00
Ondřej Surý dee7b46a8d Merge branch 'ondrej/convert-isc_async-to-use-urcu-wfcqueue' into 'main'
Change the isc_async and isc_quota API to use cds_wfcqueue internally

See merge request isc-projects/bind9!7894
2023-05-12 13:24:27 +00:00
Ondřej Surý fd3522c37b Add Userspace-RCU to global CFLAGS and LIBS
The Userspace-RCU headers are now needed for more parts of the libisc
and libdns, thus we need to add it globally to prevent compilation
failures on systems with non-standard Userspace-RCU installation path.
2023-05-12 14:16:25 +02:00
Ondřej Surý 00f1823366 Change the isc_quota API to use cds_wfcqueue internally
The isc_quota API was using locked list of isc_job_t objects to keep the
waiting TCP accepts.  Change the isc_quota implementation to use
cds_wfcqueue internally - the enqueue is wait-free and only dequeue
needs to be locked.
2023-05-12 14:16:25 +02:00
Ondřej Surý 0759612418 Adjust the udp_shutdown_connect to delay the check
The teardown jobs are not executed immediately, so we need to delay the
check for ISC_R_SHUTTINGDOWN even more (as the UDP connect is
synchronous, it makes it harder to test it).
2023-05-12 14:16:25 +02:00
Ondřej Surý 7b1d985de2 Change the isc_async API to use cds_wfcqueue internally
The isc_async API was using lock-free stack (where enqueue operation was
not wait-free).  Change the isc_async to use cds_wfcqueue internally -
enqueue and splice (move the queue members from one list to another) is
nonblocking and wait-free.
2023-05-12 14:16:25 +02:00
Ondřej Surý c90a9d6a09 Merge branch '4045-refactor-rbtdb-glue_cache' into 'main'
Replace glue_cache hashtable with direct link in rdatasetheader

Closes #4045

See merge request isc-projects/bind9!7895
2023-05-12 11:26:58 +00:00
Ondřej Surý 575a976e48 Add CHANGES and release note for [GL #4045] 2023-05-12 13:26:00 +02:00
Ondřej Surý 7220851f67 Replace glue_cache hashtable with direct link in rdatasetheader
Instead of having a global hashtable with a global rwlock for the GLUE
cache, move the glue_list directly into rdatasetheader and use
Userspace-RCU to update the pointer when the glue_list is empty.

Additionally, the cached glue_lists needs to be stored in the RBTDB
version for early cleaning, otherwise the circular dependencies between
nodes and glue_lists will prevent nodes to be ever cleaned up.
2023-05-12 13:25:39 +02:00
Michal Nowak 6e73f29238 Merge branch 'mnowak/coverity-scan-2022.12' into 'main'
Use the latest Coverity Scan

See merge request isc-projects/bind9!7881
2023-05-12 08:13:42 +00:00
Michal Nowak 68dd458764 Use the latest Coverity Scan 2023-05-12 10:10:22 +02:00
Matthijs Mekking 41bfc299d6 Merge branch '4050-cdnskey-no' into 'main'
Add option to not generate CDNSKEY record

Closes #4050

See merge request isc-projects/bind9!7917
2023-05-12 07:46:17 +00:00
Matthijs Mekking 2a2f8b6b39 Add release note and CHANGES for cdnskey option 2023-05-11 17:07:51 +02:00
Matthijs Mekking 2c7d93d431 Read from kasp whether to publish CDNSKEY
Check the policy and feed 'dns_dnssec_syncupdate() the right value
to enable/disable CDSNKEY publication.
2023-05-11 17:07:51 +02:00
Matthijs Mekking af15e760d7 Add test case for cdnskey no;
Change one of the test cases to disable publication of CDNSKEY.
2023-05-11 17:07:51 +02:00
Matthijs Mekking 8be61d1845 Add configuration option 'cdnskey'
Add the 'cdnskey' configuration option to 'dnssec-policy'.
2023-05-11 17:07:51 +02:00
Matthijs Mekking 7960afcc0f Add functions to set CDNSKEY publication
Add kasp API functions to enable/disable publication of CDNSKEY records.
2023-05-11 17:07:51 +02:00
Michal Nowak b5f8c76811 Merge branch 'mnowak/pytest_rewrite_ttl' into 'main'
Rewrite the ttl system test to pytest

See merge request isc-projects/bind9!7896
2023-05-11 14:09:42 +00:00
Michal Nowak 0c05c3d97b Rewrite the ttl system test to pytest 2023-05-11 15:14:48 +02:00
Michal Nowak f52377ec86 Merge branch 'mnowak/clang-16' into 'main'
Bump the LLVM version to 16

See merge request isc-projects/bind9!7721
2023-05-11 12:18:16 +00:00
Michal Nowak 435b1d649e Update sources to Clang 16 formatting 2023-05-11 13:42:26 +02:00
Michal Nowak 30aa258107 Update clang to version 16 2023-05-11 13:42:26 +02:00
Michal Nowak 21a3de08a9 Merge branch '4023-nsupdate-disable-asan-for-fatal-cases' into 'main'
Disable ASAN in nsupdate for fatal cases

Closes #4023

See merge request isc-projects/bind9!7871
2023-05-11 11:41:47 +00:00
Michal Nowak 31935a3537 Disable ASAN in nsupdate for fatal cases
Clang 16 LeakSanitizer reports a memory leak when dns_request_create()
returned a TLS error in the nsupdate system test. While technically a
memory leak on error handling, it's not a problem because the program is
immediately terminated; nsupdate is not expected to run for a prolonged
time.
2023-05-11 13:39:51 +02:00
Tony Finch 318956a444 Merge branch 'fanf-noreturn-lossage' into 'main'
Avoid lossage from <stdnoreturn.h>

See merge request isc-projects/bind9!7906
2023-05-11 10:41:01 +00:00
Tony Finch 623f2fdb18 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.
2023-05-11 10:40:56 +00:00
Michal Nowak b58d4c2c2c Merge branch 'mnowak/pytest_rewrite_hooks' into 'main'
Rewrite the hooks system test to pytest

See merge request isc-projects/bind9!7883
2023-05-11 10:26:33 +00:00
Michal Nowak 5a84c7a09b Rewrite the hooks system test to pytest
Also, enable the test under TSAN.
2023-05-11 11:49:33 +02:00
Mark Andrews f68bd3f905 Merge branch '4049-detect-formerr-with-an-echoed-dns-cookie-client-cookie-and-retry-without-dns-cookie' into 'main'
Resolve "Detect FORMERR with an echoed DNS COOKIE client cookie and retry without DNS COOKIE"

Closes #4049

See merge request isc-projects/bind9!7888
2023-05-11 01:16:19 +00:00
Mark Andrews 97e1bb0e98 Add CHANGES note for [GL #4049] 2023-05-11 10:49:39 +10:00
Mark Andrews 9d95cd427d Check fallback on FORMERR to EDNS options 2023-05-11 10:49:39 +10:00
Mark Andrews 3328ddaf7a Add a server which returns FORMERR to all EDNS options
The server also echoes back the EDNS options and EDNS flags.
2023-05-11 09:32:02 +10:00
Mark Andrews f3b24ba789 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.
2023-05-11 09:32:02 +10:00
Arаm Sаrgsyаn 88cf7e7e9a Merge branch '4039-dighost-fix-double-shutdown-call' into 'main'
dighost.c: don't call check_if_done() twice successively

Closes #4039

See merge request isc-projects/bind9!7878
2023-05-10 11:36:23 +00:00
Aram Sargsyan d71299121e Add a CHANGES note for [GL #4039] 2023-05-10 11:35:51 +00:00
Aram Sargsyan e4604b71d2 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.
2023-05-10 11:35:51 +00:00
Tom Krizek ad6713f2ae Merge branch 'tkrizek/shutdown-test-exc-handling' into 'main'
Ensure named always terminates in the shutdown test

See merge request isc-projects/bind9!7819
2023-05-10 10:54:48 +00:00
Tom Krizek dee49b7a1f 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
2023-05-10 10:56:36 +02:00
Tom Krizek 836e6ed284 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.
2023-05-10 10:56:22 +02:00
Tom Krizek 9d64f1c1ed 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.
2023-05-10 10:56:19 +02:00
Michał Kępień 8d9bd808b1 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.19.14' into 'main'
Set up version and release notes for BIND 9.19.14

See merge request isc-projects/bind9!7899
2023-05-10 08:47:54 +00:00
Michał Kępień d33b7fe24d Set up release notes for BIND 9.19.14 2023-05-10 10:41:42 +02:00
Michał Kępień 41b54fa66e Update BIND version to 9.19.14-dev 2023-05-10 10:41:42 +02:00
Michał Kępień 66a3c6b318 Update BIND version for release 2023-05-08 15:34:59 +02:00
Michał Kępień 569e510db7 Add a CHANGES marker 2023-05-08 15:34:59 +02:00
Michał Kępień b9bcb280ce Merge branch 'michal/prepare-documentation-for-bind-9.19.13' into 'v9.19.13-release'
Prepare documentation for BIND 9.19.13

See merge request isc-private/bind9!515
2023-05-08 13:33:29 +00:00
Michał Kępień 677fc2257b Add release note for GL #4027 2023-05-08 15:29:07 +02:00
Michał Kępień d01834466d Add release note for GL #3985 2023-05-08 15:29:07 +02:00
Michał Kępień ce43231b9c Reorder release notes 2023-05-08 15:29:07 +02:00
Michał Kępień 893cf037f3 Tweak and reword release notes 2023-05-08 15:29:07 +02:00
Michał Kępień dce2e72f1e Prepare release notes for BIND 9.19.13 2023-05-08 15:29:07 +02:00
Michał Kępień 45377c2e7d Apply minor corrections to CHANGES 2023-05-08 15:29:07 +02:00
Michał Kępień eb3d6fcd13 Merge branch '4046-rndc-timeout' into 'main'
set the default rndc read timeout to 60 seconds

See merge request isc-projects/bind9!7885
2023-05-05 09:43:00 +00:00
Evan Hunt dfc8efc467 CHANGES and release note for [GL #4046] 2023-05-05 00:07:05 -07:00
Evan Hunt 9cacf9e336 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.
2023-05-05 00:06:50 -07:00
Matthijs Mekking af5d0a0afb Merge branch '2360-dnstap-timestamp-millis-oliverford' into 'main'
Add option to dnstap-read to print long timestamps

Closes #2360

See merge request isc-projects/bind9!7887
2023-05-04 14:17:50 +00:00
Matthijs Mekking 3eade9a6bf Add release note and CHANGES for #2360 2023-05-04 15:12:53 +02:00
Oliver FordandMatthijs Mekking 3f9b8b7dfa Add option to dnstap-read to print long timestamps
Adds a -t option to dnstap-read to print timestamps with
millisecond precision
2023-05-04 15:12:53 +02:00
Oliver FordandMatthijs Mekking 2e85d9faaa Change dnstap-read timestamp to millis 2023-05-04 15:02:03 +02:00
Mark Andrews 15abca01d4 Merge branch 'marka-placeholder' into 'main'
Add placeholder for [GL #3988]

See merge request isc-projects/bind9!7886
2023-05-04 03:50:45 +00:00
Mark Andrews 6fa6dafd1c Add placeholder for [GL #3988] 2023-05-04 13:14:24 +10:00
Ondřej Surý 909f008080 Merge branch '4031-remove-dead-code-from-dns_zone' into 'main'
Fix a logical flaw that would skip logging notify success

Closes #4031

See merge request isc-projects/bind9!7879
2023-05-03 19:52:22 +00:00
Ondřej Surý b3c6ee7b9a Fix a logical flaw that would skip logging notify success
The notify_done() would never log a success as the logging part was
always skipped.  Fix the code flow in the function.
2023-05-03 21:51:20 +02:00
Matthijs Mekking d4cf522d65 Merge branch '3991-logfile-absolutepath-bug' into 'main'
Fix purging old log files with absolute file path

Closes #3991

See merge request isc-projects/bind9!7809
2023-05-03 07:41:17 +00:00
Mark AndrewsandMatthijs Mekking 9fcd42c672 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.
2023-05-03 09:12:34 +02:00
Matthijs Mekking ab9230b383 Add release note and CHANGES for #3991
Bug worth mentioning.
2023-05-03 09:12:33 +02:00
Matthijs Mekking d9b1df3b5d 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.
2023-05-03 09:12:11 +02:00
Matthijs Mekking 9fb9670ebc 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.
2023-05-03 09:12:11 +02:00
Matthijs Mekking 70629d73da 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.
2023-05-03 09:12:11 +02:00
Evan Hunt 25a3874e1f Merge branch '4020-delv-ns-duplicate-output' into 'main'
prevent duplicate output from delv +ns

Closes #4020

See merge request isc-projects/bind9!7848
2023-05-02 20:17:41 +00:00
Evan Hunt 24802dfe93 CHANGES for [GL #4020] 2023-05-02 12:43:05 -07:00
Evan Hunt 7de2d07eb0 add a regression test for duplicate NS output
check that an NS RRset with two servers is only printed once.
2023-05-02 12:42:50 -07:00
Evan Hunt 108809ae84 prevent duplicate output from delv +ns
when printing the result of a query, delv +ns repeated the
answer RRset as many times as there were records in the RRset;
this has been fixed by suppressing the printing of records with
the same name and type as the preceding one.
2023-05-02 12:42:50 -07:00
Ondřej Surý 0d9dd5ed24 Merge branch '4043-fix-mul-check' into 'main'
configure: Fix __builtin_mul_overflow() compiler support check

Closes #4043

See merge request isc-projects/bind9!7877
2023-05-02 13:49:07 +00:00
Arjun ShankarandOndřej Surý 5d33446145 configure: Fix __builtin_mul_overflow() compiler support check
`UINT64_C(UINT64_MAX)' is redundant and leads to a compilation error
since UINT64_C involves token concatenation, causing the check to fail.

This change fixes that by using UINT64_MAX directly, and including the
appropriate header.

Signed-off-by: Arjun Shankar <arjun@redhat.com>
2023-05-02 15:48:26 +02:00
Petr Špaček 22329132ad Merge branch 'pspacek/post-release-tweaks' into 'main'
Post release tweaks

See merge request isc-projects/bind9!7840
2023-05-02 13:36:12 +00:00
Petr Špaček 585fde0474 Synchronize Sphinx package version on ReadTheDocs with our CI
Related: isc-projects/images!235
2023-05-02 15:35:29 +02:00
Petr Špaček 406595bcf2 Recommend -S edition rebase before starting out with release 2023-05-02 15:35:29 +02:00
Petr Špaček 302baae5c7 Provide examples and links for steps in release checklist 2023-05-02 15:35:29 +02:00
Petr Špaček 751062da3b Update release comparison scripts with liburcu and new Sphinx 2023-05-02 15:35:25 +02:00
Ondřej Surý 1b0512fa20 Merge branch 'mnowak/pairwise-fix-typo-in-with-liburcu-definition' into 'main'
Fix the typo in --with-liburcu=mb pairwise definition

See merge request isc-projects/bind9!7875
2023-04-28 10:12:38 +00:00
Michal Nowak 40440674b1 Fix the typo in --with-liburcu=mb pairwise definition
It was "ucru," but it should be "urcu". The pairwise CI job fails as a
result with:

    configure: error: unrecognized options: --with-libucru
2023-04-28 09:35:33 +02:00
Ondřej Surý a80daf0836 Merge branch 'each-fix-mutex-test' into 'main'
fix commit error in mutex_test

See merge request isc-projects/bind9!7874
2023-04-28 05:06:44 +00:00
Evan Hunt 3460fe73e2 fix commit error in mutex_test
when the branch implementing mutex_test was rebased and merged,
a rebasing error was missed: the isc_threadresult and isc_threadarg
types no longer exist.
2023-04-28 02:37:29 +01:00
Ondřej Surý af5ca782b7 Merge branch 'ondrej/add-isc_mutex-unit-test' into 'main'
Add mutex unit test

See merge request isc-projects/bind9!7858
2023-04-27 11:17:30 +00:00
Ondřej Surý 42c7694dfb Add mutex unit test
Add simple mutex unit test and mutex benchmark.  The benchmark compares
the pthread mutext with isc mutex implementation, so it's mainly useful
when developing a new isc mutex implementation.
2023-04-27 13:15:50 +02:00
Ondřej Surý 5b84a9492d Merge branch 'ondrej-urcu-fixes' into 'main'
Improve the Userspace RCU integration

See merge request isc-projects/bind9!7752
2023-04-27 10:39:51 +00:00
Ondřej Surý 6948060e01 Print out the Userspace-RCU flavor and version
The `named -V` now prints out the liburcu flavor used and the
compile-time version.
2023-04-27 12:38:53 +02:00
Tony FinchandOndřej Surý 7d1ceaf35d Move per-thread RCU setup into isc_thread
All the per-loop `libuv` setup remains in `isc_loop`, but the per-thread
RCU setup is moved to `isc_thread` alongside the other per-thread setup.
This avoids repeating the per-thread setup for `call_rcu()` helpers,
and explains a little better why some parts of the per-thread setup
is missing for `call_rcu()` helpers.

This also removes the per-loop `call_rcu()` helpers as we refactored the
isc__random_initialize() in the previous commit.
2023-04-27 12:38:53 +02:00
Ondřej Surý 65021dbf52 Move the isc_random API initialization to the thread_local variable
Instead of writing complicated wrappers for every thread, move the
initialization back to isc_random unit and check whether the random seed
was initialized with a thread_local variable.

Ensure that isc_entropy_get() returns a non-zero seed.

This avoids problems with thread sanitizer tests getting stuck in an
infinite loop.
2023-04-27 12:38:53 +02:00
Tony FinchandOndřej Surý e0248bf60f Simplify isc_thread a little
Remove the `isc_threadarg_t` and `isc_threadresult_t`
typedefs which were unhelpful disguises for `void *`,
and free the dummy jemalloc allocation sooner.
2023-04-27 12:38:53 +02:00
Tony FinchandOndřej Surý 06f534fa69 Avoid spurious compilation failures in liburcu headers
When liburcu is not installed from a system package, its headers are
not treated as system headers by the compiler, so BIND's -Werror and
other warning options take effect. The liburcu headers have a lot
of inline functions, some of which do not use all their arguments,
which BIND's build treats as an error.
2023-04-27 12:38:53 +02:00
Ondřej Surý c2c907d728 Improve the Userspace RCU integration
This commit allows BIND 9 to be compiled with different flavours of
Userspace RCU, and improves the integration between Userspace RCU and
our event loop:

- In the RCU QSBR, the thread is put offline when polling and online
  when rcu_dereference, rcu_assign_pointer (or friends) are called.

- In other RCU modes, we check that we are not reading when reaching the
  quiescent callback in the event loop.

- We register the thread before uv_work_run() callback is called and
  after it has finished.  The rcu_(un)register_thread() has a large
  overhead, but that's fine in this case.
2023-04-27 12:38:53 +02:00
Ondřej Surý 2aaf58a641 Merge branch '4018-use-server-socket-to-log-accept-failures' into 'main'
Use server socket to log TCP accept failures

Closes #4018

See merge request isc-projects/bind9!7851
2023-04-27 10:12:22 +00:00
Ondřej Surý 0bf70cb143 Add CHANGES note for [GL #4018] 2023-04-27 11:08:20 +02:00
Ondřej Surý 58663574b9 Use server socket to log TCP accept failures
The accept_connection() could detach from the child socket on a failure,
so we need to keep and use the server socket for logging the accept
failures.
2023-04-27 11:07:57 +02:00
Ondřej Surý 0f25d62a40 Merge branch '4030-fix-UAF-in-isc_httpd' into 'main'
Fix potential UAF when shutting down isc_httpd

Closes #4030

See merge request isc-projects/bind9!7865
2023-04-25 06:18:02 +00:00
Ondřej Surý 6f0d0c49f9 Add CHANGES note for [GL #4031] 2023-04-25 08:17:10 +02:00
Ondřej Surý 27ad3a65f9 Fix potential UAF when shutting down isc_httpd
Use the ISC_LIST_FOREACH_SAFE() macro to safely walk the running https
and shut them down in a manner safe from deletion.
2023-04-25 08:16:46 +02:00
Ondřej Surý ae997d9e21 Add ISC_LIST_FOREACH(_SAFE) macros
There's a recurring pattern walking the ISC_LISTs that just repeats over
and over.  Add two macros:

 * ISC_LIST_FOREACH(list, elt, link) - walk the static list
 * ISC_LIST_FOREACH_SAFE(list, elt, link, next) - walk the list in
   a manner that's safe against list member deletions
2023-04-25 08:16:46 +02:00
Mark Andrews f0c3881a82 Merge branch '4027-nsec3-of-removed-empty-non-terminal-remains-in-chain-breaking-validation-tools' into 'main'
Resolve "NSEC3 of removed empty-non-terminal remains in chain, breaking validation tools"

Closes #4027

See merge request isc-projects/bind9!7857
2023-04-25 05:44:08 +00:00
Mark Andrews 7dbb2b877b Add CHANGES note for [GL #4027] 2023-04-25 05:04:30 +01:00
Mark Andrews ad91a70d15 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.
2023-04-25 05:03:40 +01:00
Mark Andrews 27160c137f 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.
2023-04-25 05:03:12 +01:00
Ondřej Surý 2aff1d6efc Merge branch 'jpmens-main-patch-10650' into 'main'
ARM: replace word in TLS section

See merge request isc-projects/bind9!7864
2023-04-24 15:12:12 +00:00
JP MensandOndřej Surý 7bfffa1bd8 Fix typo in the ARM - missed -> missing 2023-04-24 16:09:48 +01:00
Ondřej Surý b226200529 Merge branch '4004-reimplemented-max-transfer--in' into 'main'
Implement maximum global and idle time for incoming XFR

Closes #4004

See merge request isc-projects/bind9!7810
2023-04-21 11:31:04 +00:00
Ondřej Surý 713e202110 Add CHANGES note for [GL #4004] 2023-04-21 12:53:34 +02:00
Aram SargsyanandOndřej Surý 5324f047b2 Implement new checks for the xfer system test
Check the max-transfer-time-in and max-transfer-idle-in options.
2023-04-21 12:53:02 +02:00
Aram SargsyanandOndřej Surý dfaecfd752 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.
2023-04-21 12:53:02 +02:00
Ondřej Surý d2377f8e04 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.
2023-04-21 12:53:02 +02:00
Ondřej Surý 599ac5bb93 Merge branch '4005-handle-ISC_R_INVALIDPROTO-from-libuv' into 'main'
Handle ISC_R_INVALIDPROTO in the dispatch

Closes #4005

See merge request isc-projects/bind9!7860
2023-04-21 10:43:14 +00:00
Ondřej Surý c233cd621b Add CHANGES and release note for [GL #4005] 2023-04-21 12:42:28 +02:00
Evan HuntandOndřej Surý 2269a3e6fb check for invalid protocol when dispatch fails
treat ISC_R_INVALIDPROTO as a networking error when it occurs.
2023-04-21 12:42:11 +02:00
Evan HuntandOndřej Surý 0393b54afb add a result code for ENOPROTOOPT, EPROTONOSUPPORT
there was no isc_result_t value for invalid protocol errors
that could be returned from libuv.
2023-04-21 12:42:10 +02:00
Ondřej Surý abc2342372 Merge branch '3977-add-isc_spinlock-implementation' into 'main'
Add isc_spinlock unit with shim pthread_spin implementation

Closes #3977

See merge request isc-projects/bind9!7749
2023-04-21 10:10:47 +00:00
Ondřej Surý ebd9188d42 Add CHANGES note for [GL #3977] 2023-04-21 12:10:02 +02:00
Ondřej Surý b497e90179 Add isc_spinlock unit with shim pthread_spin implementation
The spinlock is small (atomic_uint_fast32_t at most), lightweight
synchronization primitive and should only be used for short-lived and
most of the time a isc_mutex should be used.

Add a isc_spinlock unit which is either (most of the time) a think
wrapper around pthread_spin API or an efficient shim implementation of
the simple spinlock.
2023-04-21 12:10:02 +02:00
Ondřej Surý 32a8773ab3 Always initialize the workers in the libtest
The workers variable might be needed even to tests not using
loopmgr. Split the workers initialization into setup_workers() function
and always call it from the default main loop.
2023-04-21 09:04:24 +02:00
Ondřej Surý bd94d8c98e Merge branch '4011-fix-read_stop-in-streaming-protocols' into 'main'
Fix the streaming read callback shutdown logic

Closes #4011

See merge request isc-projects/bind9!7836
2023-04-20 12:03:52 +00:00
Ondřej Surý 9b0353e62e Add CHANGES note for [GL #4011] 2023-04-20 12:58:47 +02:00
Ondřej SurýandArtem Boldariev 3b10814569 Fix the streaming read callback shutdown logic
When shutting down TCP sockets, the read callback calling logic was
flawed, it would call either one less callback or one extra.  Fix the
logic in the way:

1. When isc_nm_read() has been called but isc_nm_read_stop() hasn't on
   the handle, the read callback will be called with ISC_R_CANCELED to
   cancel active reading from the socket/handle.

2. When isc_nm_read() has been called and isc_nm_read_stop() has been
   called on the on the handle, the read callback will be called with
   ISC_R_SHUTTINGDOWN to signal that the dormant (not-reading) socket
   is being shut down.

3. The .reading and .recv_read flags are little bit tricky.  The
   .reading flag indicates if the outer layer is reading the data (that
   would be uv_tcp_t for TCP and isc_nmsocket_t (TCP) for TLSStream),
   the .recv_read flag indicates whether somebody is interested in the
   data read from the socket.

   Usually, you would expect that the .reading should be false when
   .recv_read is false, but it gets even more tricky with TLSStream as
   the TLS protocol might need to read from the socket even when sending
   data.

   Fix the usage of the .recv_read and .reading flags in the TLSStream
   to their true meaning - which mostly consist of using .recv_read
   everywhere and then wrapping isc_nm_read() and isc_nm_read_stop()
   with the .reading flag.

4. The TLS failed read helper has been modified to resemble the TCP code
   as much as possible, clearing and re-setting the .recv_read flag in
   the TCP timeout code has been fixed and .recv_read is now cleared
   when isc_nm_read_stop() has been called on the streaming socket.

5. The use of Network Manager in the named_controlconf, isccc_ccmsg, and
   isc_httpd units have been greatly simplified due to the improved design.

6. More unit tests for TCP and TLS testing the shutdown conditions have
   been added.

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Artem Boldariev <artem@isc.org>
2023-04-20 12:58:32 +02:00
Michał Kępień 4fcbb078c1 Merge tag 'v9.19.12'
BIND 9.19.12
2023-04-20 12:43:46 +02:00
Ondřej Surý 654de3201c Merge branch '3986-handle-ISC_R_NOPERM-in-dns_dispatch-and-honour-the-source-port' into 'main'
Honour the source-port when retrying in dns_dispatch

Closes #3986

See merge request isc-projects/bind9!7806
2023-04-20 09:01:49 +00:00
Ondřej Surý 3d36e0bb89 Add CHANGES note for [GL #3986] 2023-04-20 10:57:20 +02:00
Ondřej Surý c8e8ccd026 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
2023-04-20 10:57:20 +02:00
Ondřej Surý 25962dd188 Merge branch '4001-4002-retry-over-TCP-when-notify-sending-fails' into 'main'
Handle the failure to send notify more gracefully and with log

Closes #4001 and #4002

See merge request isc-projects/bind9!7805
2023-04-20 08:41:02 +00:00
Ondřej Surý f4fcb63152 Add CHANGES and release note for [GL #4001] [GL #4002] 2023-04-20 10:09:53 +02:00
Ondřej Surý 0d48ac5a93 Handle the failure to send notify more gracefully and with log
When dns_request_create() failed in notify_send_toaddr(), sending the
notify would silently fail.  When notify_done() failed, the error would
be logged on the DEBUG(2) level.

This commit remedies the situation by:

 * Promoting several messages related to notifies to INFO level and add
   a "success" log message at the INFO level

 * Adding a TCP fallback - when sending the notify over UDP fails, named
   will retry sending notify over TCP and log the information on the
   NOTICE level

 * When sending the notify over TCP fails, it will be logged on the
   WARNING level

Closes: #4001, #4002
2023-04-20 10:09:53 +02:00
Tony Finch 6892e463bf Merge branch '3998-check-countlabels' into 'main'
Check dns_name_countlabels() wrt DNS_NAME_MAXLABELS

Closes #3998

See merge request isc-projects/bind9!7822
2023-04-18 12:58:09 +00:00
Tony Finch 3dcfad81d8 Check dns_name_countlabels() wrt DNS_NAME_MAXLABELS
This test case was omitted from [GL !7803]
2023-04-18 13:32:09 +01:00
Tony Finch 89eeca7981 Merge branch 'fanf-inane' into 'main'
Fix several typoes in name_test

See merge request isc-projects/bind9!7800
2023-04-18 12:22:55 +00:00
Tony Finch 80a153e159 Fix several typos in name_test
`nane` -> `name`
2023-04-18 12:56:29 +01:00
Arаm Sаrgsyаn 2928ab4e5f Merge branch 'aram/xfer-test-bugfix' into 'main'
Fix variable name error in the xfer system test

See merge request isc-projects/bind9!7845
2023-04-18 09:38:12 +00:00
Aram Sargsyan 613a9fc659 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.
2023-04-18 09:37:39 +00:00
Mark Andrews b23a3c7729 Merge branch '3996-in-fatal-only-pause-when-running' into 'main'
In fatal only pause loops when they are running.

Closes #3996

See merge request isc-projects/bind9!7825
2023-04-18 01:11:49 +00:00
Mark Andrews be68dd62ea isc_loopmgr_pause was called inappropriately
isc_loopmgr_pause can't be called before isc_loopmgr_run is
called as the thread ids are not yet valid.  If there is a
fatal error before isc_loopmgr_run is run then don't call
isc_loopmgr_pause.
2023-04-18 00:28:36 +00:00
Matthijs Mekking 453aaac2f0 Merge branch '3769-migrate-zsk-ksk-split-tocsk' into 'main'
kasp: Add test case for migrating KSK/ZSK to CSK

See merge request isc-projects/bind9!7306
2023-04-17 09:39:59 +00:00
Matthijs Mekking e752656a38 Add key state init debugging
When debugging an issue it can be useful to see what BIND initially
set the key states to.
2023-04-17 10:56:08 +02:00
Matthijs Mekking c42ec8a56e 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.
2023-04-17 10:56:08 +02:00
Ondřej Surý 02edb42a0a Merge branch '4015-fix-forward_cancel-from-the-wrong-loop' into 'main'
Run the forward_cancel on the appropriate zone->loop

Closes #4015

See merge request isc-projects/bind9!7835
2023-04-14 15:13:03 +00:00
Ondřej Surý 2423907b87 Add CHANGES note for [GL #4015] 2023-04-14 16:31:48 +02:00
Ondřej Surý 3df3b5efbd Run the forward_cancel on the appropriate zone->loop
If the zone forwards are canceled from dns_zonemgr_shutdown(), the
forward_cancel() would get called from the main loop, which is wrong.
It needs to be called from the matching zone->loop.

Run the dns_request_cancel() via isc_async_run() on the loop associated
with the zone instead of calling the dns_request_cancel() directly from
the main loop.
2023-04-14 16:31:33 +02:00
Ondřej Surý 36a3c87c33 Merge branch 'ondrej/remove-unused-netmgr-worker-sendbuf' into 'main'
Remove unused netmgr->worker->sendbuf

See merge request isc-projects/bind9!7841
2023-04-14 14:20:52 +00:00
Ondřej Surý f677cf6b73 Remove unused netmgr->worker->sendbuf
By inspecting the code, it was discovered that .sendbuf member of the
isc__nm_networker_t was unused and just consuming ~64k per worker.
Remove the member and the association allocation/deallocation.
2023-04-14 16:20:14 +02:00
Arаm Sаrgsyаn 9bd88df624 Merge branch '4000-openssl-attr-malloc-vs-cmocka-define-malloc' into 'main'
unit tests: include an OpenSSL header before including cmocka.h

Closes #4000

See merge request isc-projects/bind9!7820
2023-04-14 12:12:13 +00:00
Aram Sargsyan 786b0689c6 Add a CHANGES note for [GL #4000] 2023-04-14 12:11:52 +00:00
Aram Sargsyan 87db9ea84c 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.
2023-04-14 12:11:52 +00:00
Petr Špaček 9e3f7f4d53 Merge branch 'pspacek/set-up-version-and-release-notes-for-bind-9.19.13' into 'main'
Set up version and release notes for BIND 9.19.13

See merge request isc-projects/bind9!7839
2023-04-14 09:03:19 +00:00
Petr Špaček 923eb6667f Update BIND version to 9.19.13-dev 2023-04-14 10:51:44 +02:00
Petr Špaček 0fb1e00469 Set up release notes for BIND 9.19.13 2023-04-14 10:51:23 +02:00
Arаm Sаrgsyаn 546312f06c Merge branch 'aram/dns_xfrin_create-use-after-free' into 'main'
Fix a use-after-free bug in dns_xfrin_create()

See merge request isc-projects/bind9!7832
2023-04-14 07:40:01 +00:00
Aram Sargsyan bf8e93aee5 Add a CHANGES note for [GL !7832] 2023-04-14 07:39:38 +00:00
Aram Sargsyan d8a207bd00 Fix a use-after-free bug in dns_xfrin_create()
'xfr' is used after detaching the only reference, which would
have destroyed the object.

Call dns_xfrin_detach() only after the final use of 'xfr'.
2023-04-14 07:39:38 +00:00
Mark Andrews 172c678f2b Merge branch '3980-add-timeouts-to-unit-tests' into 'main'
Draft: Resolve "Add timeouts to unit tests."

Closes #3980

See merge request isc-projects/bind9!7837
2023-04-14 06:34:36 +00:00
Mark Andrews 21a3d4f762 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
2023-04-14 15:40:02 +10:00
Ondřej Surý b6c9ac75ad Merge branch '3980-revert-unit-test-forking' into 'main'
Revert "Kill unit tests that run more than 1200 seconds"

Closes #3980

See merge request isc-projects/bind9!7833
2023-04-14 04:19:40 +00:00
Ondřej Surý c60ce13127 Revert "Kill unit tests that run more than 1200 seconds"
This reverts commit 3d5c7cd46c 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 should add a custom automake test harness (log driver) that
would kill the unit test after configured timeout.
2023-04-14 06:14:19 +02:00
Mark Andrews 22fb1b115a Merge branch '4003-dump_histo-defined-but-not-used-on-fips-in-bin-named-statschannel-c' into 'main'
Resolve "'dump_histo' defined but not used on FIPS in bin/named/statschannel.c"

Closes #4003

See merge request isc-projects/bind9!7826
2023-04-12 23:49:55 +00:00
Mark Andrews 82d2434ff8 dump_histo is only used with extended stats
Wrap dump_histo with #if defined(EXTENDED_STATS)/#endif.  Reproduce
build failure with "configure --without-libxml2 --without-json-c"
2023-04-13 08:53:27 +10:00
Ondřej Surý 8117c11d09 Merge branch '3985-make-TCP-accept-a-tad-bit-faster' into 'main'
Fix the TCP accept quota code

Closes #3985

See merge request isc-projects/bind9!7823
2023-04-12 12:12:33 +00:00
Ondřej Surý b88ed40c96 Add CHANGES note for [GL #3985] 2023-04-12 14:10:37 +02:00
Ondřej Surý 1715cad685 Refactor the isc_quota code and fix the quota in TCP accept code
In e185412872, the TCP accept quota code
became broken in a subtle way - the quota would get initialized on the
first accept for the server socket and then deleted from the server
socket, so it would never get applied again.

Properly fixing this required a bigger refactoring of the isc_quota API
code to make it much simpler.  The new code decouples the ownership of
the quota and acquiring/releasing the quota limit.

After (during) the refactoring it became more clear that we need to use
the callback from the child side of the accepted connection, and not the
server side.
2023-04-12 14:10:37 +02:00
Ondřej Surý 1768522045 Convert tls_send() callback to use isc_job_run()
The tls_send() was already using uvreq; convert this to use more direct
isc_job_run() - the on-loop no-allocation method.
2023-04-12 14:10:37 +02:00
Ondřej Surý 1302345c93 Convert isc__nm_http_send() from isc_async_run() to isc_job_run()
The isc__nm_http_send() was already using uvreq; convert this to use
more direct isc_job_run() - the on-loop no-allocation method.
2023-04-12 14:10:37 +02:00
Ondřej Surý 3adba8ce23 Use isc_job_run() for reading from StreamDNS socket
Change the reading in the StreamDNS code to use isc_job_run() instead of
using isc_async_run() for less allocations and more streamlined
execution.
2023-04-12 14:10:37 +02:00
Ondřej Surý 74cbf523b3 Run closehandle_cb on run queue instead of async queue
Instead of using isc_async_run() when closing StreamDNS handle, add
isc_job_t member to the isc_nmhandle_t structure and use isc_job_run()
to avoid allocation/deallocation on the StreamDNS hot-path.
2023-04-12 14:10:37 +02:00
Ondřej Surý d27f6f2d68 Accept overquota TCP connection on local thread if possible
If the quota callback is called on a thread matching the socket, call
the TCP accept function directly instead of using isc_async_run() which
allocates-deallocates memory.
2023-04-12 14:10:37 +02:00
Ondřej Surý 0a468e7c9e Make isc_tid() a header-only function
The isc_tid() function is often called on the hot-path and it's the only
function is to return thread_local variable, make the isc_tid() function
a header-only to save several function calls during query-response
processing.
2023-04-12 14:10:37 +02:00
Tom Krizek 9ca151680c Merge branch 'tkrizek/dnsrps-test-replace-egrep' into 'main'
Replace egrep with grep -E in rpz tests

See merge request isc-projects/bind9!7821
2023-04-12 11:55:28 +00:00
Tom Krizek c977b0c81d Replace egrep with grep -E in rpz tests
GNU Grep 3.8 reports the following warnings:

    egrep: warning: egrep is obsolescent; using grep -E
2023-04-12 13:32:46 +02:00
Petr Špaček 460760ee77 Update BIND version for release 2023-04-11 16:48:56 +02:00
Petr Špaček a375f38557 Add a CHANGES marker 2023-04-11 16:48:27 +02:00
Petr Špaček 9403b5d476 Merge branch 'pspacek/prepare-documentation-for-bind-9.19.12' into 'v9.19.12-release'
Prepare documentation for BIND 9.19.12

See merge request isc-private/bind9!510
2023-04-11 14:46:17 +00:00
Petr ŠpačekandMichał Kępień 1029e929b3 Add release notes for GL #3955, #3968, and #3997 2023-04-11 16:29:22 +02:00
Petr ŠpačekandMichał Kępień 6fac8b15bc Add known issue release note for GL #3985 and #4006 2023-04-11 16:29:22 +02:00
Petr ŠpačekandMichał Kępień 4c307123a8 Add release note for GL #3998 2023-04-11 16:29:22 +02:00
Petr ŠpačekandMichał Kępień 4ca02afb31 Reorder release notes 2023-04-11 16:29:22 +02:00
Petr ŠpačekandMichał Kępień 618c5d1ec0 Tweak and reword release notes 2023-04-11 16:29:22 +02:00
Petr ŠpačekandMichał Kępień b06c5ad471 Prepare release notes for BIND 9.19.12 2023-04-11 16:29:22 +02:00
Mark Andrews eb2c8ab213 Merge branch '3975-atomically-increase-rrn-in-add-other-data' into 'main'
atomically increase rrn in add_other_data

Closes #3975

See merge request isc-projects/bind9!7824
2023-04-11 02:45:48 +00:00
Mark Andrews 6cf8a532d4 Atomically increase rrn in add_other_data
'rrn' needs to be treated atomically as it updated from multiple threads.
2023-04-11 10:44:36 +10:00
Michal Nowak ff34a1f117 Merge branch '3916-legacy-test-no-retries-in-resolution_fails' into 'main'
Do not retry in resolution_fails() on timeout

Closes #3916

See merge request isc-projects/bind9!7814
2023-04-06 09:39:22 +00:00
Michal Nowak e05460c813 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.
2023-04-06 11:35:48 +02:00
Michal Nowak a43519f7b8 Merge branch 'mnowak/looking-for-dig-errors-must-not-fail' into 'main'
Looking for errors in dig output files must not fail

See merge request isc-projects/bind9!7813
2023-04-06 09:03:31 +00:00
Michal Nowak 28a0df3081 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.
2023-04-06 09:44:49 +02:00
Ondřej Surý 3f91819bd2 Merge branch '3999-histo-div-zero' into 'main'
Fix a division by zero bug in isc_histo

Closes #3999

See merge request isc-projects/bind9!7804
2023-04-05 21:29:50 +00:00
Tony FinchandOndřej Surý 3405b43fe9 Fix a division by zero bug in isc_histo
This can occur when calculating the standard deviation of an empty
histogram.
2023-04-05 23:29:21 +02:00
Evan Hunt 426eb4ffd2 Merge branch '3972-delv-coverity-fixes' into 'main'
address coverity warnings in delv

Closes #3972

See merge request isc-projects/bind9!7780
2023-04-05 20:19:16 +00:00
Evan Hunt 1850daaed8 address coverity warnings in delv
clean up coverity warnings due to recent changes to delv:
- CID 451097: failure to check return value from inet_pton()
- CID 451098, 451100: dead code
2023-04-05 11:19:22 -07:00
Tony Finch 99c07f53eb Merge branch '3998-incorrect-maxlabels' into 'main'
Correct value of DNS_NAME_MAXLABELS

Closes #3998

See merge request isc-projects/bind9!7803
2023-04-05 14:46:48 +00:00
Tony Finch e8ff0f0c08 Correct value of DNS_NAME_MAXLABELS
It should be floor(DNS_NAME_MAXWIRE / 2) + 1 == 128

The mistake was introduced in c6bf51492d because:

  * I was refactoring an existing `DNS_MAX_LABELS` defined as 127

  * There was a longstanding bug in `dns_name_isvalid()` which
    checked the number of labels against 127U instead of 128

  * I mistakenly thought `dns_name_isvalid()` was correct and
    `dns_name_countlabels()` was incorrect, but the reverse was true.

After this commit, occurrances of `DNS_NAME_MAXLABELS` with value
128 are consistent with the use of 127 or 128 before commit
c6bf51492d except for the mistake in `dns_name_isvalid()`.
This commit adds a test case that checks the MAXLABELS case
in `dns_name_fromtext()` and `dns_name_isvalid()`.
2023-04-05 14:46:39 +00:00
Petr Špaček 3948827c0b Merge branch 'pspacek/log-roll-doc-nits' into 'main'
Log rotation doc improvements

See merge request isc-projects/bind9!7776
2023-04-05 14:02:47 +00:00
Petr Špaček 1dada31187 Remove erroneous cross-references to suffix statement
Logging section referenced to "suffix" statement definition for dns64.
2023-04-05 15:59:06 +02:00
Petr Špaček 2897a45644 Make rndc dnstap -roll docs easier to read 2023-04-05 15:58:28 +02:00
Tony Finch edb497ce4f Merge branch 'fanf-qp-zt' into 'main'
Use a qp-trie for the zone table

See merge request isc-projects/bind9!7582
2023-04-05 12:02:38 +00:00
Tony Finch b171cacf4f Use a qp-trie for the zone table
This change makes the zone table lock-free for reads. Previously, the
zone table used a red-black tree, which is not thread safe, so the hot
read path acquired both the per-view mutex and the per-zonetable
rwlock. (The double locking was to fix to cleanup races on shutdown.)

One visible difference is that zones are not necessarily shut down
promptly: it depends on when the qp-trie garbage collector cleans up
the zone table. The `catz` system test checks several times that zones
have been deleted; the test now checks for zones to be removed from
the server configuration, instead of being fully shut down. The catz
test does not churn through enough zones to trigger a gc, so the zones
are not fully detached until the server exits.

After this change, it is still possible to improve the way we handle
changes to the zone table, for instance, batching changes, or better
compaction heuristics.
2023-04-05 12:38:11 +01:00
Tony Finch b3e35fd120 A few qp-trie cleanups
Revert refcount debug tracing (commit a8b29f0365), there are better
ways to do it.

Use the dns_qpmethods_t typedef where appropriate.

Some stylistic improvements.
2023-04-05 12:35:04 +01:00
Tony Finch 39f38754e2 Compact more in dns_qp_compact(DNS_QPGC_ALL)
Commit 0858514ae8 enriched dns_qp_compact() to give callers more
control over how thoroughly the trie should be compacted.

In the DNS_QPGC_ALL case, if the trie is small it might be compacted
to a new position in the same memory chunk. In this situation it will
still be holding references to old leaf objects which have been
removed from the trie but will not be completely detached until the
chunk containing the references is freed.

This change resets the qp-trie allocator to a fresh chunk before a
DNS_QPGC_ALL compaction, so all the old memory chunks will be
evacuated and old leaf objects can be detached sooner.
2023-04-05 12:35:04 +01:00
Tony Finch 44c80c4ae1 Support for off-loop read-ony qp-trie transactions
It is sometimes necessary to access a qp-trie outside an isc_loop,
such as in tests or an isc_work callback. The best option was to use
a `dns_qpmulti_write()` transaction, but that has overheads that are
not necessary for read-only access, such as committing a new version
of the trie even when nothing changed.

So this commit adds a `dns_qpmulti_read()` transaction, which is
nearly as lightweight as a query transaction, but it takes the mutex
like a write transaction.
2023-04-05 12:35:04 +01:00
Tony Finch fa1b57ee6e Support for finding the longest parent domain in a qp-trie
This is the first of the "fancy" searches that know how the DNS
namespace maps on to the structure of a qp-trie. For example, it will
find the closest enclosing zone in the zone tree.
2023-04-05 12:35:04 +01:00
Tony Finch 8a3a216f40 Support for iterating over the leaves in a qp-trie
The iterator object records a path through the trie, in a similar
manner to the existing dns_rbtnodechain.
2023-04-05 12:35:04 +01:00
Arаm Sаrgsyаn 45893249a6 Merge branch '3993-gcc-12-fanalyzer-claim-dereference-of-NULL' into 'main'
Resolve "GCC 12 static analyzer: error: dereference of NULL 'alginfo' in openssleddsa_link.c"

Closes #3993

See merge request isc-projects/bind9!7791
2023-04-05 08:04:05 +00:00
Aram Sargsyan 48c506c274 INSIST that openssleddsa_alg_info() is successful
In the check_algorithm() function openssleddsa_alg_info() is
called with two known variants of the 'algorithm' argument, and
both are expected to return a non-NULL value.

Add an INSIST to suppress the following GCC 12 analyzer report:

    openssleddsa_link.c: In function 'raw_key_to_ossl':
    openssleddsa_link.c:92:13: error: dereference of NULL 'alginfo' [CWE-476] [-Werror=analyzer-null-dereference]
       92 |         int pkey_type = alginfo->pkey_type;
          |             ^~~~~~~~~
2023-04-05 08:03:43 +00:00
Ondřej Surý 4d1a80aea1 Merge branch '3973-dnsrps-coverity-fixes' into 'main'
silence coverity warnings

Closes #3973

See merge request isc-projects/bind9!7781
2023-04-05 07:24:44 +00:00
Evan HuntandOndřej Surý 80e2a23f9e silence coverity warnings
silence coverity warnings in the DNSPRS code:
- CID 451097, failure to check return value of rpz_ready()
- CID 451099, resource leak
2023-04-05 09:23:51 +02:00
Michal Nowak 7e17ed410e Merge branch '3996-pairwise-skip-fips-mode' into 'main'
Revert "Enable FIPS testing in Pairwise"

See merge request isc-projects/bind9!7790
2023-04-05 07:22:36 +00:00
Michal Nowak a1bd31cbae Revert "Enable FIPS testing in Pairwise"
This reverts commit e987a0c249.

--enable-fips-mode ./configure option does not work on platforms without
FIPS-enabled OpenSSL.
2023-04-05 09:20:17 +02:00
Mark Andrews 8783cd97a8 Merge branch '3994-unnecessary-null-check' into 'main'
Resolve "Unnecessary NULL check"

Closes #3994

See merge request isc-projects/bind9!7783
2023-04-05 00:25:15 +00:00
Mark Andrews 8c5539e905 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);
2023-04-04 23:51:22 +00:00
Ondřej Surý d3190485b8 Merge branch 'ondrej/require-dnspyton-2.0.0-in-shutdown-system-test' into 'main'
Bump the requirement in the shutdown test to dnspython 2.0.0

See merge request isc-projects/bind9!7796
2023-04-04 19:58:31 +00:00
Ondřej Surý 54a3f09c8f 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 21:31:58 +02:00
Ondřej Surý 82b52f5d72 Merge branch 'ondrej/require-dnspyton-2.0.0-in-dnstap-system-test' into 'main'
Bump the requirement in dnstap test to dnspython 2.0.0

See merge request isc-projects/bind9!7793
2023-04-04 16:44:01 +00:00
Ondřej Surý e123b76b0e 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 17:21:07 +02:00
Ondřej Surý d897ad29db Merge branch 'ondrej/add-tests-for-rpz-in-multiple-views' into 'main'
Add test for RPZ in multiple views

See merge request isc-projects/bind9!7711
2023-04-04 14:27:24 +00:00
Ondřej Surý 1734d4a33e 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.
2023-04-04 16:23:13 +02:00
Tom KrizekandOndřej Surý 2ed26609b8 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.
2023-04-04 16:22:26 +02:00
Ondřej Surý 1649c768e9 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
2023-04-04 16:22:26 +02:00
Ondřej Surý 3b1756d450 Replace dnspython resolver.query() with resolver.resolve()
The resolver.query() has been deprecated in favor of resolver.resolve();
used that.
2023-04-04 16:22:26 +02:00
Ondřej Surý ba1c9f1fd1 Merge branch 'ondrej/change-dns_adbentry_overquota-to-dns_adb_overquota' into 'main'
Change dns_adbentry_overquota() to dns_adb_overquota()

See merge request isc-projects/bind9!7758
2023-04-04 14:22:20 +00:00
Ondřej Surý b8d34e960b Change dns_adbentry_overquota() to dns_adb_overquota()
The dns_adbentry_overquota() was violating the layers accessing the
adbentry struct members directly.  Change it to dns_adb_overquota() to
match the dns_adb API.
2023-04-04 16:21:49 +02:00
Arаm Sаrgsyаn 71a236f6e2 Merge branch '3997-catz-shutdown-crash-in-dns_catz_zones_unref' into 'main'
Resolve "Catalog zone shutdown crash in dns_catz_zones_unref"

Closes #3997

See merge request isc-projects/bind9!7786
2023-04-04 11:09:33 +00:00
Aram Sargsyan 4a0bd69056 Add a CHANGES note for [GL #3997] 2023-04-04 10:33:28 +00:00
Ondřej SurýandAram Sargsyan 2ded876db2 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.
2023-04-04 10:33:04 +00:00
Ondřej Surý 1c5d1c91fe Merge branch '3984-fix-double-unref-when-shutting-down-dns_xfrin' into 'main'
Don't detach xfr in dns_xfrin_shutdown()

Closes #3984

See merge request isc-projects/bind9!7787
2023-04-04 10:26:10 +00:00
Ondřej Surý 69a23a557b Add CHANGES note for [GL #3984] 2023-04-04 10:32:41 +02:00
Ondřej Surý 05bb89267e Don't detach xfr in dns_xfrin_shutdown()
As we are now using dispatch instead of netmgr for XFR TCP connection,
the xfrin_recv_done() will be called when cancelling the dispatch with
ISC_R_CANCELED.  This could lead to double detach from the dns_xfrin_t,
one in the xfrin_recv_done() and one in the dns_xfrin_shutdown().

Remove the extra detach from the dns_xfrin_shutdown() and rely on the
dispatch read callback to be always called.
2023-04-04 10:26:41 +02:00
Ondřej Surý 2f76fd4142 Merge branch '3989-remove-dead-code-from-dns_xfrin' into 'main'
Fix xfrin_connect_done() error paths

Closes #3989

See merge request isc-projects/bind9!7774
2023-04-04 07:40:59 +00:00
Ondřej Surý 04b851342b Add CHANGES note for [GL #3989] 2023-04-04 09:23:51 +02:00
Ondřej Surý 536e439c79 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.
2023-04-04 09:23:51 +02:00
Evan Hunt ae3209c811 Merge branch 'each-zone-refcount' into 'main'
use ISC_REFCOUNT_IMPL for external dns_zone references

See merge request isc-projects/bind9!7784
2023-04-04 07:08:11 +00:00
Evan Hunt 361c8868b4 use ISC_REFCOUNT_IMPL for external dns_zone references
use the ISC_REFCOUNT implementation for dns_zone_attach() and
_detach(). (this applies only to external zone references, not
to dns_zone_iattach() and dns_zone_idetach().)

use dns_zone_ref() where previously a dummy zone object had been
used to increment the reference count.
2023-04-04 07:07:55 +00:00
Evan Hunt 117dccc01d Merge branch '3975-libdummy-tsan' into 'main'
suppress TSAN reports from dummy DNSRPS library

Closes #3975

See merge request isc-projects/bind9!7782
2023-04-04 07:07:09 +00:00
Evan Hunt d644c03593 suppress TSAN reports from dummy DNSRPS library
this is a test-only library that will never be used in production.
making it thread safe doesn't need to be a high priority.
2023-04-03 13:24:09 -07:00
Petr Špaček cfc154cf6a Merge branch '3981-reduce-dnssec-verify-calls' into 'main'
Reduce dns_dnssec_verify calls made checking for revoked trust anchor

Closes #3981

See merge request isc-projects/bind9!7763
2023-04-03 15:45:33 +00:00
Petr Špaček 705a9ced01 Add release note for [GL #3981] 2023-04-03 17:44:42 +02:00
Mark AndrewsandPetr Špaček 5de552d545 Add CHANGES for [GL #3981] 2023-04-03 17:44:41 +02:00
Mark AndrewsandPetr Špaček 21d828241b dns_view_untrust modifies dnskey->flags when it shouldn't
Copy the structure and declare dnskey as const.
2023-04-03 17:43:43 +02:00
Mark AndrewsandPetr Špaček b5df9b8591 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.
2023-04-03 17:43:43 +02:00
Mark AndrewsandPetr Špaček e68fecbdaa 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.
2023-04-03 17:43:43 +02:00
Mark AndrewsandPetr Špaček 7278fff579 Add new view method dns_view_istrusted
dns_view_istrusted determines if the given key is treated as
being trusted by the view.
2023-04-03 17:43:40 +02:00
Arаm Sаrgsyаn 1cda61725c Merge branch '3674-nsupdate--t-timeout-does-not-work' into 'main'
Resolve "nsupdate -t timeout does not work"

Closes #3674

See merge request isc-projects/bind9!7279
2023-04-03 15:22:25 +00:00
Aram Sargsyan 98c8135692 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.
2023-04-03 15:21:43 +00:00
Aram Sargsyan ef81775e7b Add a CHANGES note for [GL #3674] 2023-04-03 15:21:43 +00:00
Aram Sargsyan 3ef2a30c75 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.
2023-04-03 15:21:43 +00:00
Aram Sargsyan a00540ac24 Update nsupdate -t option's documentation
Add some clarifications about the -t option's behavior differences
in TCP and UDP modes.
2023-04-03 15:21:43 +00:00
Aram Sargsyan edcdb881da 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.
2023-04-03 15:21:43 +00:00
Aram Sargsyan 5b37359697 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.
2023-04-03 15:21:43 +00:00
Aram Sargsyan 643abfbba7 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.
2023-04-03 15:21:43 +00:00
Aram Sargsyan 0ef11c0ccb 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.
2023-04-03 15:21:43 +00:00
Aram Sargsyan 5ce2ed0688 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
2023-04-03 15:21:43 +00:00
Tony Finch 9211495ac9 Merge branch '3910-coverity-qp-tests' into 'main'
Fix Coverity complaints in the qp-trie tests

Closes #3910

See merge request isc-projects/bind9!7630
2023-04-03 15:11:03 +00:00
Tony Finch 3c333d02a0 More dns_qpkey_t safety checks
My original idea had been that the core qp-trie code would be mostly
independent of the storage for keys, so I did not make it check at run
time that key lengths are sensible. However, the qp-trie search
routines need to get keys out of leaf objects, for which they provide
storage on the stack, which is particularly dangerous for unchecked
buffer overflows. So this change checks that key lengths are in bounds
at the API boundary between the qp-trie code and the rest of BIND, and
there is no more pretence that keys might be longer.
2023-04-03 15:10:47 +00:00
Tony Finch 906d434aea Fix Coverity complaints in the qp-trie tests
The main problem was `qp_test_keytoname()` not using `qpkey_bit()`
to do bounds checking.
2023-04-03 15:10:47 +00:00
Petr Špaček 4f03804dc6 Merge branch 'bug/main/rndc-dnstap-roll' into 'main'
Document that rndc dnstap -roll number is optional

See merge request isc-projects/bind9!7755
2023-04-03 14:43:55 +00:00
Petr MenšíkandPetr Špaček 0627214568 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.
2023-04-03 14:42:56 +00:00
Matthijs Mekking 804f1b07d5 Merge branch '3901-parental-agents-auto' into 'main'
Automatic parental-agents (checkds yes)

Closes #3901

See merge request isc-projects/bind9!7742
2023-04-03 14:01:35 +00:00
Matthijs Mekking 3551afe361 Make checkds system test more resilient
The checkds system test could fail if some parent secondary servers did
not yet loaded all the zones before ns9 started sending DS queries. This
leads to SERVFAIL responses, while the test case expects good DS
responses. In order to mitigate against this issue, call 'rndc loadkeys'
to quickly restart the checkds procedure again.

Also refactor the checkds system test, to get rid of the many zone
name duplications. Update the functions 'zone_check' and
'keystate_check' to make the zone name an FQDN so we can just pass
the 'zone' variable into the function.
2023-04-03 14:01:22 +00:00
Matthijs Mekking 03f9e40d1b Determine checkds default from config
If the 'checkds' option is not explicitly set, check if there are
'parental-agents' for the zone configured. If so, default to "explicit",
otherwise default to "yes".
2023-04-03 14:01:22 +00:00
Matthijs Mekking 92577eaf7e Make checkds yes the default
This seems to be the more common case.
2023-04-03 14:01:22 +00:00
Matthijs Mekking 47f7cb0a36 Add two checkds test servers
Add two new checkds test servers, that are hidden secondaries (hidden
as in not published in the NS RRset), that can be used specifically
for testing explicitly configured parental-agents.
2023-04-03 14:01:22 +00:00
Matthijs Mekking a921cabb8c Remove obsoleted checkds test name servers
These resolver based parental-agents have been replaced by ns3.
2023-04-03 14:01:22 +00:00
Matthijs Mekking 148ce1f678 Add CHANGES and release notes for #3901
This is a new feature that deserves attention.
2023-04-03 14:01:22 +00:00
Matthijs Mekking e72b0df50b Implement auto parental-agents (checkds yes)
Implement the new feature, automatic parental-agents. This is enabled
with 'checkds yes'.

When set to 'yes', instead of querying the explicit configured
parental agents, look up the parental agents by resolving the parent
NS records. The found parent NS RRset is considered to be the list
of parental agents that should be queried during a KSK rollover,
looking up the DS RRset corresponding to the key signing keys.

For each NS record, look up the addresses in the ADB. These addresses
will be used to send the DS requests. Count the number of servers and
keep track of how many good DS responses were seen.
2023-04-03 14:01:22 +00:00
Matthijs Mekking dc651cbf3f Add test case with no empty non-terminals
The previous test cases already test the more complex case where there
are empty non-terminals between the child apex and the parent domain.

Add a test case where this is not the case, to execute the other code
path.
2023-04-03 14:01:22 +00:00
Matthijs Mekking a2735810d9 Add test cases for 'checkds no'
Add test cases for when checkds is disabled. Copy the test cases that
would have resulted in a DSPublish or DSRemoved and make sure that
with 'checkds no' the metadata is not set.
2023-04-03 14:01:22 +00:00
Matthijs Mekking 6bb862d10f Add test cases for 'checkds yes'
Add the test cases for automatic parental-agents, i.e. when 'checkds'
is set to 'yes'. Split out the special cases that use a reference
or a resolver as parental-agent so that the common use cases can be
tested with the same function.
2023-04-03 14:01:22 +00:00
Matthijs Mekking 226b6e385e Update checkds system test
Make the checkds system test more structured with the many more test
cases to come. Add a README for clarity.

Update the 'has_signed_apex_nsec' helper function so it can take any
domain name regardless of the number of labels.

Change the DNS tree structure such that we have different TLD names
for the various test scenarios, because we need servers that respond
differently to DS queries. Note that this isn't applicable to the
existing "checkds explicit" test cases, but is preparation work for
testing "checkds yes" (automatic parental agents).

Add a trust-anchor to the server that will be querying for parent
NS records.
2023-04-03 14:01:22 +00:00
Matthijs Mekking d842adb23f Update documenation for 'checkds' option
Add text about the 'checkds' option in the ARM reference and
DNSSEC guide.
2023-04-03 14:01:22 +00:00
Matthijs Mekking 06cd8b52db Add new 'checkds' configuration option
Add a new configuration option to set how the checkds method should
work. Acceptable values are 'yes', 'no', and 'explicit'.

When set to 'yes', the checkds method is to lookup the parental agents
by querying the NS records of the parent zone.

When set to 'no', no checkds method is enabled. Users should run
the 'rndc checkds' command to signal that DS records are published and
withdrawn.

When set to 'explicit', the parental agents are explicitly configured
with the 'parental-agents' configuration option.
2023-04-03 14:01:22 +00:00
Ondřej Surý 7d0b88ebb0 Merge branch '3930-gcc-12-static-analyzer-warning-dereference-of-null-in-in-siphash-c' into 'main'
Resolve "GCC 12 static analyzer: warning: dereference of NULL 'in' in siphash.c"

Closes #3930

See merge request isc-projects/bind9!7656
2023-04-03 13:32:53 +00:00
Mark AndrewsandOndřej Surý bf58c10dce Silence NULL pointer dereferene false positive
Only attempt to digest 'in' if it is non NULL.  This will prevent
false positives about NULL pointer dereferences against 'in' and
should also speed up the processing.
2023-04-03 13:32:40 +00:00
Ondřej Surý 94e42daa0f Merge branch '3974-rpz-testlib-test-data-c-compilation-fails-on-openbsd' into 'main'
Resolve "rpz/testlib/test-data.c compilation fails on OpenBSD"

Closes #3974

See merge request isc-projects/bind9!7748
2023-04-03 13:32:32 +00:00
Mark AndrewsandOndřej Surý da999a7a1b Define and use DLOPEN_LIBS 2023-04-03 13:31:56 +00:00
Mark AndrewsandOndřej Surý 30b9ebfa2c Handle old <arpa/nameser.h> with old API
Define the types and classes we use from the new API.
2023-04-03 13:31:56 +00:00
Ondřej Surý 8c475a1d31 Merge branch 'artem-streamdns-avoid-copying-on-reading' into 'main'
Stream DNS: try to handle incoming data directly - avoid memory copying/buffer resizing when reading data

See merge request isc-projects/bind9!7280
2023-04-03 13:31:51 +00:00
Artem BoldarievandOndřej Surý 2b3a3c21dc Stream DNS: avoid memory copying/buffer resizing when reading data
This commit optimises isc_dnsstream_assembler_t in such a way that
memory copying and reallocation are avoided when receiving one or more
complete DNS messages at once. We try to handle the data from the
messages directly, without storing them in an intermediate memory
buffer.
2023-04-03 13:31:46 +00:00
Ondřej Surý 33a0588113 Merge branch '3990-remove-dead-code-from-dst_api' into 'main'
Eliminate the dead code in dst_api.c

Closes #3990

See merge request isc-projects/bind9!7773
2023-04-03 13:29:52 +00:00
Ondřej Surý 766366e934 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.
2023-04-03 14:09:13 +02:00
Tony Finch c74f389100 Merge branch 'fanf-histo' into 'main'
Add isc_histo histograms, and use it for message size statistics

Closes #3464

See merge request isc-projects/bind9!7696
2023-04-03 11:41:25 +00:00
Tony FinchandTony Finch fdcbbc2a20 CHANGES note for [GL !7696]
[func]		Add isc_histo_t general-purpose log-linear histograms,
		and use them for message size statistics.
2023-04-03 12:08:37 +01:00
Tony FinchandTony Finch 0d353704fb Use isc_histo for the message size statistics
This should have no functional effects.

The message size stats are specified by RSSAC002 so it's best not
to mess around with how they appear in the statschannel. But it's
worth changing the implementation to use general-purpose histograms,
to reduce code size and benefit from sharded counters.
2023-04-03 12:08:05 +01:00
Tony FinchandTony Finch 2354e56ebb Remove obsolete code from dns_stats
It became obsolete in 2008
2023-04-03 12:08:05 +01:00
Tony FinchandTony Finch cd0e7f853a Simplify histogram quantiles
The `isc_histosummary_t` functions were written in the early days of
`hg64` and carried over when I brought `hg64` into BIND. They were
intended to be useful for graphing cumulative frequency distributions
and the like, but in practice whatever draws charts is better off with
a raw histogram export. Especially because of the poor performance of
the old functions.

The replacement `isc_histo_quantiles()` function is intended for
providing a few quantile values in BIND's stats channel, when the user
does not want the full histogram. Unlike the old functions, the caller
provides all the query fractions up-front, so that the values can be
found in a single scan instead of a scan per value. The scan is from
larger values to smaller, since larger quantiles are usually more
interesting, so the scan can bail out early.
2023-04-03 12:08:05 +01:00
Tony FinchandTony Finch bc2389b828 Add per-thread sharded histograms for heavy loads
Although an `isc_histo_t` is thread-safe, it can suffer
from cache contention under heavy load. To avoid this,
an `isc_histomulti_t` contains a histogram per thread,
so updates are local and low-contention.
2023-04-03 12:08:05 +01:00
Tony FinchandTony Finch 82213a48cf Add isc_histo for histogram statistics
This is an adaptation of my `hg64` experiments for use in BIND.

As well as renaming everything according to ISC style, I have
written some more extensive tests that ensure the edge cases are
correct and the fenceposts are in the right places.

I have added utility functions for working with precision in terms of
decimal significant figures as well as this code's native binary.
2023-04-03 12:08:05 +01:00
Ondřej Surý 4c7e773a31 Merge branch '3710-properly-document-DF-flag-on-outbound-UDP' into 'main'
Clarify the documentation about DF-flag

Closes #3710

See merge request isc-projects/bind9!7770
2023-04-03 10:28:47 +00:00
Ondřej Surý d5921fafed Add CHANGES note for [GL #3710] 2023-04-03 10:28:43 +00:00
Ondřej Surý 61f276d5a4 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.
2023-04-03 10:28:43 +00:00
Ondřej Surý 5e6ed08ac2 Merge branch 'ondrej/replace-DE_CONST-with-simpler-UNCONST' into 'main'
Replace DE_CONST(k, v) with v = UNCONST(k) macro

See merge request isc-projects/bind9!7760
2023-04-03 10:26:02 +00:00
Ondřej Surý 3a6a0fa867 Replace DE_CONST(k, v) with v = UNCONST(k) macro
Replace the complicated DE_CONST macro that required union with much
simple reference-dereference trick in the UNCONST() macro.
2023-04-03 10:25:56 +00:00
Ondřej Surý 2351c746a9 Merge branch 'ondrej/cleanup-windows-bits' into 'main'
Cleanup the last Windows / MSC ifdefs and comments

See merge request isc-projects/bind9!7754
2023-04-03 09:06:27 +00:00
Ondřej Surý 4ec9c4a1db Cleanup the last Windows / MSC ifdefs and comments
Cleanup the remnants of MS Compiler bits from <isc/refcount.h>, printing
the information in named/main.c, and cleanup some comments about Windows
that no longer apply.

The bits in picohttpparser.{h,c} were left out, because it's not our
code.
2023-04-03 09:06:20 +00:00
Tom Krizek 01218f16e2 Merge branch '3915-check-dig-output-for-errors' into 'main'
Find errors in dig output in system tests

Closes #3915

See merge request isc-projects/bind9!7679
2023-04-03 08:50:01 +00:00
Tom Krizek 940e160c06 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.
2023-04-03 10:25:31 +02:00
Mark Andrews 18f7d954dc Merge branch 'mnowak/fix-fips-in-tests' into 'main'
FIPS fixes and enhancements

See merge request isc-projects/bind9!4281
2023-04-03 04:30:43 +00:00
Mark Andrews 5e68be6a03 Disable leak detection in FIPS mode 2023-04-03 12:44:27 +10:00
Mark Andrews 2abd6c7ab4 Handle MD5 not being supported by lib crypto
When initialising the message digests in lib/isc/md.c no
longer assume that the initialisation cannot fail.
2023-04-03 12:44:27 +10:00
Mark Andrews f138a1447a forward: Check if TLS is working in FIPS mode
Skip test that depend on TLS working in FIPS mode
2023-04-03 12:44:27 +10:00
Mark Andrews a3172c8f9c Don't check for OPENSSL_cleanup failures by default
OPENSSL_cleanup is supposed to free all remaining memory in use
provided the application has cleaned up properly.  This is not the
case on some operating systems.  Silently ignore memory that is
freed after OPENSSL_cleanup has been called.
2023-04-03 12:44:27 +10:00
Mark Andrews 97627c554b Test whether the crypto library supports the HMAC algorithm
When initialising HMAC support check that the crypto library
supports the algorithm rather than just assuming it is supported.
2023-04-03 12:44:27 +10:00
Mark Andrews ffebd217f5 make feature-test --md5 --with-fips aware 2023-04-03 12:44:27 +10:00
Mark Andrews 4c5de4f15c Cleanup on error paths
Rather that call 'exit' cleanup on error paths as that allows OpenSSL
to cleanup properly in its exit handlers.
2023-04-03 12:44:27 +10:00
Mark Andrews e029803704 Handle fatal and FIPS provider interactions
When fatal is called we may be holding memory allocated by OpenSSL.
This may result in the reference count for the FIPS provider not
going to zero and the shared library not being unloaded during
OPENSSL_cleanup.  When the shared library is ultimately unloaded,
when all remaining dynamically loaded libraries are freed, we have
already destroyed the memory context we where using to track memory
leaks / late frees resulting in INSIST being called.

Disable triggering the INSIST when fatal has being called.
2023-04-03 12:44:27 +10:00
Mark Andrews 4e7dadd205 get_algorithms.py: use FIPS compatible bit size
The minimum RSA key size that can be used in FIPS mode is 2048 bits.
2023-04-03 12:44:27 +10:00
Mark Andrews c80ccf5a25 nsupdate: tls does not work in FIPS mode prior to OpenSSL 3.0.0 2023-04-03 12:44:27 +10:00
Mark Andrews b82811d0b5 check that 'dnssec-signzone -F' fails for rsasha1 2023-04-03 12:44:27 +10:00
Mark Andrews 826e2563b3 wildcard: Require hypothesis 4.41.2 or greater for FIPS compliance
hypothesis prior to 4.41.2 uses hashlib.md5 which is not FIPS
compliant causing the wildcard system test to fail.  Check if
we are running if FIPS mode and if so make the minimum version
of hypothesis we will accept to be 4.41.2.
2023-04-03 12:44:27 +10:00
Mark Andrews 5da1fb25b1 upforwd: use FIPS compatible key size
Don't override the default key size.
2023-04-03 12:44:27 +10:00
Mark Andrews 56d2bf1141 tsiggss: regenerate kerberos credentials
The existing set of kerberos credential used deprecated algorithms
which are not supported by some implementations in FIPS mode.
Regenerate the saved credentials using more modern algorithms.

Added tsiggss/krb/setup.sh which sets up a test KDC with the required
principals for the system test to work.  The tsiggss system test
needs to be run once with this active and KRB5_CONFIG appropriately.
set.  See tsiggss/tests.sh for an example of how to do this.
2023-04-03 12:44:27 +10:00
Mark Andrews c3ba38f89f tsiggss: skip test in FIPS mode when DH is broken
'tsiggss' depends on a working DH implementation.  This is not
properly supported in all FIPS implementations.
2023-04-03 12:44:27 +10:00
Mark Andrews e8177ac605 tsig: only use FIPS compatible HMAC in FIPS mode
HMACMD5 is not permitted in FIPS mode.  Only test HMACMD5 when not
in FIPS mode.
2023-04-03 12:44:27 +10:00
Mark Andrews 175d0c6d85 tkey: skip TKEY system test in FIPS mode
TKEY uses MD5 which is incompatible with FIPS.
2023-04-03 12:44:27 +10:00
Mark Andrews 0ed16a561e rndc: don't test hmac-md5 in FIPS mode
HMACMD5 is not permitted in FIPS mode.  Only test HMACMD5 when not
in FIPS mode.
2023-04-03 12:44:27 +10:00
Mark Andrews ff7e73db6a nsupdate: use FIPS compatible algorithms
HMACMD5 is not permitted in FIPS mode, use HMACSHA256 instead.
2023-04-03 12:44:27 +10:00
Mark Andrews bcb3846603 nsec3: use fips configuration if rsasha1 is not supported 2023-04-03 12:44:27 +10:00
Mark Andrews 1362360e8f nsec3: skip tests that depend on RSASHA1 in FIPS mode 2023-04-03 12:44:27 +10:00
Mark Andrews 2e997e2248 doth: skip 'doth' test if FIPS mode when DH is broken
'doth' depends on a working DH implementation.
2023-04-03 12:44:27 +10:00
Mark Andrews 530142b2a1 dnssec: check that dnssec-signzone -F work with allowed algorithm 2023-04-03 12:44:27 +10:00
Mark Andrews 78764f99ca dnssec: test dnssec-keygen -F switches to FIPS mode 2023-04-03 12:44:27 +10:00
Mark Andrews ba6ee5af50 dnssec: check if RSASHA1 is supported by the OS
If not skip RSASHA1 based system tests which are supposed to succeed
even in FIPS mode.
2023-04-03 12:44:27 +10:00
Mark Andrews 333693ddf5 dnssec: Check validation with short RSA key size FIPS mode
use a pregenerated zone signed with RSASHA1 keys at 1024 bits.
2023-04-03 12:44:27 +10:00
Mark Andrews ed7750be56 dnssec: Check that RSASHA1 still validates in FIPS mode
Add a pregenerated RSASHA1 signed zone and verify that
answers still validate.
2023-04-03 12:44:27 +10:00
Mark Andrews ae1109f321 dnssec: use FIPS compatible algorithms and key sizes
RSASHA1 is verify only in FIPS mode.  Use RSASHA256 instead with
key of at least 2048 bits (minimum RSA FIPS size).
2023-04-03 12:44:27 +10:00
Mark Andrews 701ffb2daa Only pass OPENSSL_CONF in the environment if it set
OPENSSL_CONF="" is treated differently to no OPENSSL_CONF in
the environment by OpenSSL.  OPENSSL_CONF="" lead to crypto
failure being reported in FIPS mode.
2023-04-03 12:44:27 +10:00
Mark Andrews a830adff1c Allow named-checkconf to selectively check dnssec-policy algorithms
There are times where you want named-checkconf to check whether the
dnssec-policies should be constrained by the cryptographic algorithms
supported by the operation system or to just accept all possible
algorithms.  This provides a mechanism to make that selection.
2023-04-03 12:15:57 +10:00
Mark Andrews 1eaff9a670 dnssec-signzone can now enable FIPS mode from the commandline
'dnssec-signzone -F' will now enable FIPS mode if supported
by the crypto provider and not already enabled.
2023-04-03 12:07:44 +10:00
Mark Andrews 439f24fc80 dnssec-keygen: enable FIPS from the command line
'dnssec-keygen -F' will now turn on FIPS mode if supported by
the crypto provider and is not already enabled.
2023-04-03 12:06:04 +10:00
Mark Andrews d42b636d5a named-checkconf needs to know if named will be running in FIPS mode
Call dst_lib_init to set FIPS mode if it was turned on at configure
time.

Check that named-checkconf report that dnssec policies that wont
work in FIPS mode are reported if named would be running in FIPS
mode.
2023-04-03 12:06:04 +10:00
Mark Andrews d7cc90c032 Add --fips-provider to feature-test
Check that an FIPS provider is available.  This only works with
OpenSSL 3
2023-04-03 12:06:04 +10:00
Mark Andrews d6d85a6a2d Add --rsasha1 to feature-test 2023-04-03 12:06:04 +10:00
Mark Andrews 6be00b3042 Add --have-fips-dh to feature-test
Diffie-Hellman key echange doesn't appear to work in FIPS mode for
OpenSSL 1.x.x.  Add feature test (--have-fips-dh) to identify builds
where DH key exchanges work (non FIPS builds and OpenSSL 3.0.0+) and
exclude test that would otherwise fail.
2023-04-03 12:06:04 +10:00
Michal NowakandMark Andrews fe8b41286f Add FIPS-detecting option to feature-test helper
The '--have-fips' option of feature-test detects FIPS mode.
2023-04-03 12:06:04 +10:00
Mark Andrews c51a39e97a Probe if ED448 and ED25519 are supported
ED448 and ED25519 may or may not be supported in FIPS mode depending
upon the implementation.
2023-04-03 12:06:04 +10:00
Mark Andrews ba34255648 Report file and line when converting OpenSSL errors
This provides more detail about which instance of specific OpenSSL
calls that have failed by reporting the file name and line numbers
involved when dst__openssl_toresult2 and dst__openssl_toresult3 are
called.
2023-04-03 12:06:04 +10:00
Mark Andrews 2baa58c59f Report when loading of dhparam-file fails
prior to this loading of the configuration could fail without
an informative error message being logged.
2023-04-03 12:06:04 +10:00
Mark Andrews 1246fd3b5f Report when dnssec-policy has an unsupported algorithn 2023-04-03 12:06:04 +10:00
Mark Andrews 805da5bf8f make cfg_kaspkey_fromconfig FIPS aware
- RSASHA1 (5) and NSEC3RSASHA1 (7) are not accepted in FIPS mode
- minimum RSA key size is set to 2048 bit

adjust kasp and checkconf system tests to ensure non FIPS
compliant configurations are not used in FIPS mode
2023-04-03 12:06:04 +10:00
Mark Andrews 07a3b5b02f Don't register FIPS incompatible algorithms in FIPS mode
HMACMD5 is not permitted in FIPS mode.

Note that RSASHA1 is only permitted for verification of signatures.
2023-04-03 12:06:03 +10:00
Mark Andrews 0a8f44a8f7 Make dnssec-keygen FIPS mode aware
- Reject SHA1 based key generation
- Increase the minimum RSA key size to 2048 bits
2023-04-03 12:05:29 +10:00
Mark Andrews e7aa100e9b Use isc_fips_mode() and isc_fips_set_mode() in
bin/named/server.c and lib/dns/openssl_link.c
2023-04-03 12:05:29 +10:00
Michal NowakandMark Andrews 4d094f6b51 Disable failing MD5 unit tests in FIPS mode
With FIPS mode enabled 'isc_hmac_init_test' and 'isc_hmac_md5_test'
tests of hmac_test and 'isc_md_init_test' and 'isc_md_md5_test' test
of md_test fail.

This is due to leveraging MD5, which is disabled in FIPS mode.
2023-04-03 12:05:29 +10:00
Mark Andrews 6e8de4bcdc Allow FIPS mode to be enabled at run time in named
If FIPS mode is supported by the OS 'named -F' will turn on FIPS
mode.
2023-04-03 12:05:29 +10:00
Mark Andrews 5a2e82557e Define isc_fips_mode() and isc_fips_set_mode()
isc_fips_mode() determines if the process is running in FIPS mode

isc_fips_set_mode() sets the process into FIPS mode
2023-04-03 12:05:28 +10:00
Mark Andrews 6e64ec2af4 Detect if FIPS mode is configured at the OS level
Always look for FIPS_mode and EVP_default_properties_enable_fips
rather than just when requested by --enable-fips.
2023-04-03 12:04:58 +10:00
Mark Andrews 7aa9b80f83 Probe for EVP_default_properties_enable_fips
FIPS_mode is not available in OpenSSL 3.0.0
2023-04-03 12:04:58 +10:00
Evan HuntandMark Andrews c774aed465 add --enable-fips-mode to configure summary
Report when FIPS mode is enabled or disabled in the configure
summary output.
2023-04-03 12:04:58 +10:00
Michal NowakandMark Andrews e987a0c249 Enable FIPS testing in Pairwise
It's useful to configure and build with FIPS mode in Pairwise testing
because it exposes some parts of the code otherwise hiden.
2023-04-03 12:04:58 +10:00
Michal NowakandMark Andrews 60e50c6e15 Add scheduled FIPS mode jobs 2023-04-03 12:04:58 +10:00
Mark Andrews e10947872a Merge branch '3980-add-timeouts-to-unit-tests' into 'main'
Resolve "Add timeouts to unit tests."

Closes #3980

See merge request isc-projects/bind9!7762
2023-04-03 00:42:27 +00:00
Mark Andrews 3d5c7cd46c 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.
2023-04-03 00:15:43 +00:00
Tony Finch 8ac962fc1c Merge branch 'fanf-trampoline-go-jump' into 'main'
Simplify thread spawning

See merge request isc-projects/bind9!7293
2023-03-31 17:11:04 +00:00
Tony Finch 555690a3c9 Simplify thread spawning
The `isc_trampoline` module had a lot of machinery to support stable
thread IDs for use by hazard pointers. But the hazard pointer code
is gone, and the `isc_loop` module now has its own per-loop thread
IDs.

The trampoline machinery seems over-complicated for its remaining
tasks, so move the per-thread initialization into `isc/thread.c`,
and delete the rest.
2023-03-31 17:21:52 +01:00
Ondřej Surý 1736900b4e Merge branch 'ondrej/simplify-isc_time_now' into 'main'
Refactor isc_time_now() to return time, and not result

See merge request isc-projects/bind9!7761
2023-03-31 15:51:15 +00:00
Ondřej Surý a5f5f68502 Refactor isc_time_now() to return time, and not result
The isc_time_now() and isc_time_now_hires() were used inconsistently
through the code - either with status check, or without status check,
or via TIME_NOW() macro with RUNTIME_CHECK() on failure.

Refactor the isc_time_now() and isc_time_now_hires() to always fail when
getting current time has failed, and return the isc_time_t value as
return value instead of passing the pointer to result in the argument.
2023-03-31 15:02:06 +02:00
Ondřej Surý da039ec2b3 Merge branch '3982-remove-isc_fsaccess-API' into 'main'
Replace isc_fsaccess API with more secure file creation

Closes #3982

See merge request isc-projects/bind9!7766
2023-03-31 12:53:22 +00:00
Ondřej Surý f853672e41 Add CHANGES note for [GL #3982] 2023-03-31 12:52:59 +00:00
Ondřej Surý 263d232c79 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.
2023-03-31 12:52:59 +00:00
Ondřej Surý aca7dd3961 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.
2023-03-31 12:52:59 +00:00
Ondřej Surý d664e3c612 Merge branch 'ondrej/squash-dns_name_fullhash-and-dns_name_hash' into 'main'
Squash dns_name_fullhash() and dns_name_hash()

See merge request isc-projects/bind9!7759
2023-03-31 12:43:50 +00:00
Ondřej Surý 956155f613 Squash dns_name_fullhash() and dns_name_hash()
The only place where dns_name_hash() was being used is the old hash
table in the dns_badcache unit.  Squash the dns_name_fullhash() and
dns_name_hash() into single dns_name_hash() function that's always
case-insensitive as it doesn't make to do case-sensitive hashing of the
domain names and we were not using this anywhere.
2023-03-31 12:43:30 +00:00
Ondřej Surý 1ca0fb0e02 Merge branch 'ondrej/add-isc_stdtime_now' into 'main'
Provide isc_stdtime_now(void) that returns value

See merge request isc-projects/bind9!7757
2023-03-31 11:58:13 +00:00
Ondřej Surý a568a3d52a Add CHANGES note for [GL !7757] 2023-03-31 13:33:18 +02:00
Ondřej Surý 4bd6096d4b Remove isc_stdtime_get() macro
Now that isc_stdtime_get() macro is unused, remove it from the header
file.
2023-03-31 13:33:16 +02:00
Ondřej Surý 46f06c1d6e Apply the semantic patch to remove isc_stdtime_get()
This is a simple replacement using the semantic patch from the previous
commit and as added bonus, one removal of previously undetected unused
variable in named/server.c.
2023-03-31 13:32:56 +02:00
Ondřej Surý 0ec8d7b6f3 Add a semantic patch to change isc_stdtime_get() to isc_stdtime_now
Add a simple semantic patch to rewrite all uses of isc_stdtime_get(&t)
to simpler t = isc_stdtime_now().
2023-03-31 13:16:28 +02:00
Ondřej Surý c11af0448a Provide isc_stdtime_now(void) that returns value
As isc_stdtime_get() cannot fail, the API seems to be too complicated,
add new isc_stdtime_now() that returns the unixtime as a return value.
2023-03-31 13:16:28 +02:00
Tony Finch 3e106b3a8f Merge branch '3970-dighost-signal-crash' into 'main'
Fix a crash when dig or host receive a signal

Closes #3970

See merge request isc-projects/bind9!7756
2023-03-31 09:54:05 +00:00
Tony Finch 194621a74e Fix a crash when dig or host receive a signal
When the loopmanager is shutting down following a signal,
`dig` and `host` should stop cleanly. Before this commit
they were oblivious to ISC_R_SHUTTINGDOWN.

The `isc_signal` callbacks now report this kind of mistake
with a stack backtrace.
2023-03-31 09:52:54 +00:00
Matthijs Mekking aacd05be4b Merge branch 'matthijs-checkconf-kasp-test-bug' into 'main'
Fix kasp system test bug

See merge request isc-projects/bind9!7750
2023-03-31 08:33:24 +00:00
Matthijs Mekking 106497b011 Fix kasp system test bug
This test was succeeding for the wrong reason (policy not found, rather
than bad key length).
2023-03-31 08:33:01 +00:00
Ondřej Surý aa760f997d Merge branch 'ondrej/add-maybe_unused-attribute-macro' into 'main'
Replace __attribute__((unused)) with ISC_ATTR_UNUSED attribute macro

See merge request isc-projects/bind9!7345
2023-03-30 22:16:49 +00:00
Ondřej Surý 2c0a9575d7 Replace __attribute__((unused)) with ISC_ATTR_UNUSED attribute macro
Instead of marking the unused entities with UNUSED(x) macro in the
function body, use a `ISC_ATTR_UNUSED` attribute macro that expans to
C23 [[maybe_unused]] or __attribute__((__unused__)) as fallback.
2023-03-30 23:29:25 +02:00
Ondřej Surý 1176bf0552 Use C23 attributes if available, add ISC_ATTR_UNUSED
Use C23 attribute styles if available:

  * Add new ISC_ATTR_UNUSED attribute macro that either expands to C23's
    [[maybe_unused]] or __attribute__((__unused__));

  * Add default expansion of the `noreturn` to [[noreturn]] if available;

  * Move the FALLTHROUGH from <isc/util.h> to <isc/attributes.h>
2023-03-30 22:43:39 +02:00
Michal Nowak 0086dcd4da Merge branch 'mnowak/replace-enable_dnsprs_dl-with-enable_dnsrps_dl' into 'main'
Replace enable_dnsprs_dl with enable_dnsrps_dl

See merge request isc-projects/bind9!7745
2023-03-30 17:51:42 +00:00
Michal Nowak 1dcfe6bfbd Replace enable_dnsprs_dl with enable_dnsrps_dl
"enable_dnsprs_dl" is a typo where "enable_dnsrps_dl" was intended.
2023-03-30 19:44:34 +02:00
Artem Boldariev f3579b1760 Merge branch 'artem-tlsstream-followup-to-2846888c573fcc610cdf71bcdd5bb6f92ffaf499' into 'main'
TLS Stream: remove incorrect/obsolete INSIST()s from tls_do_bio()

See merge request isc-projects/bind9!7751
2023-03-30 16:41:05 +00:00
Artem Boldariev 43e21d653f TLS Stream: remove incorrect/obsolete INSIST()s from tls_do_bio()
With the changes to tls_try_handshake() made in
2846888c57 there are some incorrect
INSISTS() related to handshake handling which better to be removed.
2023-03-30 18:21:50 +03:00
Ondřej Surý 696b2c8c89 Merge branch 'ondrej/reduce-atomic-use-in-netmgr' into 'main'
Refactor the use of atomics in netmgr

See merge request isc-projects/bind9!7724
2023-03-30 14:26:38 +00:00
Ondřej Surý 2846888c57 Attach the accept "client" socket to .listener member of the socket
When accepting a TCP connection in the higher layers (tlsstream,
streamdns, and http) attach to the socket the connection was accepted
on, and use this socket instead of the parent listening socket.

This has an advantage - accessing the sock->listener now doesn't break
the thread boundaries, so we can properly check whether the socket is
being closed without requiring .closing member to be atomic_bool.
2023-03-30 16:10:08 +02:00
Ondřej Surý 45365adb32 Convert sock->active to non-atomic variable, cleanup rchildren
The last atomic_bool variable sock->active was converted to non-atomic
bool by properly handling the listening socket case where we were
checking parent socket instead of children sockets.

This is no longer necessary as we properly set the .active to false on
the children sockets.

Additionally, cleanup the .rchildren - the atomic variable was used for
mutex+condition to block until all children were listening, but that's
now being handled by a barrier.

Finally, just remove dead .self and .active_child_connections members of
the netmgr socket.
2023-03-30 16:10:08 +02:00
Ondřej Surý e1a4572fd6 Refactor the use of atomics in netmgr
Now that everything runs on their own loop and we don't cross the thread
boundaries (with few exceptions), most of the atomic_bool variables used
to track the socket state have been unatomicized because they are always
accessed from the matching thread.

The remaining few have been relaxed: a) the sock->active is now using
acquire/release memory ordering; b) the various global limits are now
using relaxed memory ordering - we don't really care about the
synchronization for those.
2023-03-30 16:10:08 +02:00
Ondřej Surý ea8e00e7a5 Merge branch '3961-add-fast-isc_loop_run' into 'main'
Refactor isc_job_run to not-make any allocations

Closes #3961

See merge request isc-projects/bind9!7722
2023-03-30 14:09:50 +00:00
Ondřej Surý 5d64306b72 Add CHANGES for [GL #3961] 2023-03-30 16:07:41 +02:00
Ondřej Surý f5fc224af3 Add isc_async_current() macro to run job on current loop
Previously, isc_job_run() could have been used to run the job on the
current loop and the isc_job_run() would take care of allocating and
deallocating the job.  After the change in this MR, the isc_job_run()
is more complicated to use, so we introduce the isc_async_current()
macro to suplement isc_async_run() when we need to run the job on the
current loop.
2023-03-30 16:07:41 +02:00
Ondřej Surý 1844590ad9 Refactor isc_job_run to not-make any allocations
Change the isc_job_run() to not-make any allocations.  The caller must
make sure that it allocates isc_job_t - usually as part of the argument
passed to the callback.

For simple jobs, using isc_async_run() is advised as it allocates its
own separate isc_job_t.
2023-03-30 16:00:52 +02:00
Ondřej Surý 639d5065a3 Refactor the isc__nm_uvreq_t to have idle callback
Change the isc__nm_uvreq_t to have the idle callback as a separate
member as we always need to use it to properly close the uvreq.

Slightly refactor uvreq_put and uvreq_get to remove the unneeded
arguments - in uvreq_get(), we always use sock->worker, and in
uvreq_put, we always use req->sock, so there's not reason to pass those
extra arguments.
2023-03-29 21:16:44 +02:00
Ondřej Surý 476198f26c Use uv_idle API for calling asynchronous connect/read/send callback
Instead of using isc_job_run() that's quite heavy as it allocates memory
for every new job, add uv_idle_t to uvreq union, and use uv_idle API
directly to execute the connect/read/send callback without any
additional allocations.
2023-03-29 21:16:44 +02:00
Ondřej Surý 670df3da74 Re-add the comment to streamdns_readmore()
Put the comment back, so it's more obvious that we are only restarting
timer when there's a last handle attached to the socket; there has to be
always at least one.
2023-03-29 21:16:44 +02:00
Matthijs Mekking e0dc92b6ec Merge branch '3967-linkfix-dnssec-guide' into 'main'
Remove dead link to resolver test

Closes #3967

See merge request isc-projects/bind9!7737
2023-03-29 13:28:57 +00:00
Matthijs Mekking 5a879028fe Add CHANGES for #3967 2023-03-29 15:28:29 +02:00
Matthijs Mekking 8e78f8fc0f 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.
2023-03-29 15:28:10 +02:00
Tony Finch 1365edaf0c Merge branch 'fanf-backtrace-log' into 'main'
Ad-hoc backtrace logging with isc_backtrace_log()

See merge request isc-projects/bind9!7743
2023-03-29 11:13:32 +00:00
Tony Finch 295e7c80e8 Ad-hoc backtrace logging with isc_backtrace_log()
It's sometimes helpful to get a quick idea of the call stack when
debugging. This change factors out the backtrace logging from named's
fatal error handler so that it's easy to use in other places too.
2023-03-29 10:47:53 +00:00
Ondřej Surý cc8b9c1ff1 Merge branch 'ondrej/fix-isc_nm_httpconnect-to-check-for-shuttingdown' into 'main'
Fix isc_nm_httpconnect to check for shuttindown condition

See merge request isc-projects/bind9!7736
2023-03-29 05:50:01 +00:00
Ondřej Surý 665f8bb78d 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.
2023-03-29 05:49:57 +00:00
Mark Andrews 9317aa9608 Merge branch '3926-dns_qp-fuzz-test-is-failing-to-build-under-clusterfuzz' into 'main'
Remove unnecessary conditionals in fuzz/Makefile.am

Closes #3926

See merge request isc-projects/bind9!7649
2023-03-29 03:20:03 +00:00
Mark Andrews 64c0065986 Build libtest even if CMOCKA is not available
Be more selective about what is not built when CMOCKA is not available
so that fuzz/dns_qp and fuzz/dns_qpkey_name can link against it.
2023-03-29 02:29:18 +00:00
Evan Hunt eeba1b8793 Merge branch 'each-dnsrps-testlib' into 'main'
use a test library for DNSRPS

See merge request isc-projects/bind9!7693
2023-03-29 02:03:17 +00:00
Evan Hunt a83358c6aa CHANGES for [GL !7693] 2023-03-28 18:41:17 -07:00
Evan Hunt b573d4abf8 add --enable-dnsrps to gitlab CI
enable DNSRPS in the continuous integration tests

this triggered a build failure in OpenBSD; building with DNSRPS
causes arpa/nameser.h to be included, which defines the value
STATUS. that value was then reused in server.c  renaming the
value to STAT corrects the error.
2023-03-28 18:41:17 -07:00
Evan Hunt f43de96460 update the rpz tests to use the dummyrpz library
when testing the DNSRPS API, instead of linking to an installed
librpz.so from fastrpz, we now link to the test library. code that
ran dnsrpzd and checked the fastrpz license is now unnecessary and
has been removed.

two dnsrps-specific test cases in rpz (qname_as_ns and ip_as_ns) have
been removed, because they were only supported by fastrpz and do not
work in the test library. in rpzrecurse, nsip-wait-recurse and
nsdname-wait-recurse are now only tested in native mode, due to those
tests being specific to the native implementation.
2023-03-28 18:41:17 -07:00
Mark AndrewsandEvan Hunt b8b6b10ad2 clean up library
address style issues, unfreed memory, etc.
2023-03-28 18:41:17 -07:00
Evan Hunt bed8f85ff2 import libdummyrpz test library for DNSRPS
libdummyrpz is a limited version of the fastrpz library for use in
testing the dnsrps API.
2023-03-28 15:44:31 -07:00
Evan Hunt f2855cb664 allow configuration of dnsrps library path
for testing purposes, we need to be able to specify a library path from
which to load the dnsrps implementation. this can now be done with the
"dnsrps-library" option.

DNSRPS can now be enabled in configure regardless of whether librpz.so
is currently installed on the system.
2023-03-28 15:44:31 -07:00
Evan Hunt bd7f85c7e1 Merge branch '3842-delv-ns' into 'main'
implement "delv +ns"

Closes #3842

See merge request isc-projects/bind9!7477
2023-03-28 20:08:34 +00:00
Evan Hunt 155f6a2996 CHANGES and release note for [GL #3842] 2023-03-28 12:41:32 -07:00
Evan Hunt 8806abcaaa test "delv +ns"
add tests for "delv +ns", with and without +qmin and with and without
validation.
2023-03-28 12:41:32 -07:00
Evan Hunt 15fd74f466 add "delv +hint"
Add the ablity to specify a hints file from which to load root
name server addresses, so that "delv +ns" can be used with test
name servers.
2023-03-28 12:39:06 -07:00
Evan Hunt c277df8c1f add "delv +qmin"
add an option to enable or disable QNAME minimization in delv's
internal resolver.
2023-03-28 12:39:06 -07:00
Evan Hunt 152d25668e add "delv +strace"
"delv +strace" is similar to "delv +mtrace", but sets the logging
level to DEBUG(11) instead of DEBUG(10), so that packets sent
will be logged along with packets received. "delv +ns" turns
this option on by default.
2023-03-28 12:39:06 -07:00
Evan Hunt 32189f6a59 send delv +ns output to stdout
normally, the only output of delv that is sent to stdout is
the final answer to the query; all other output is sent to
stderr. this seems undesirable for delv +ns, which will
only be used to see the process of finding the answer. so,
for that case, we now send all the logging to stdout.
2023-03-28 12:39:06 -07:00
Evan Hunt 8ce33dca6a change the log level of "resolver priming query complete"
this log message, formerly at level INFO, is now DEBUG(1),
so it won't be printed when running "delv +ns +nortrace".
2023-03-28 12:39:06 -07:00
Evan Hunt dbadc97387 on connect error, send the actual result to the caller
formerly if a connection failed in dns_request, the callback
function was called with ISC_R_CANCELED. change this to the
actual result code so the failure is correctly reported.
2023-03-28 12:39:05 -07:00
Evan Hunt e90bb121a7 add explicit error for +trace argument
add a specific error message when someone tries to use
"delv +trace" suggesting "delv +ns" instead.
2023-03-28 12:39:05 -07:00
Evan Hunt d541ddba66 add "delv +ns" command, for full internal resolution
"delv +ns" (name server mode) instantiates a full recursive resolver
inside delv and uses it to resolve the requested name and type, logging
every authoritative response received to iterative queries in the
process. this is intended to replace "dig +trace"; it much more
accurately duplicates the behavior of named when resolving a query
with a cold cache.
2023-03-28 12:39:05 -07:00
Evan Hunt d91097e0c7 change ns__client_request() to ns_client_request()
in the future we'll want to call this function from outside named,
so change the name to one suitable for external access.
2023-03-28 12:38:28 -07:00
Evan Hunt fe7ed2ba24 update stream sockets with bound address/port
when isc_nm_listenstreamdns() is called with a local port of 0,
a random port is chosen. call uv_getsockname() to determine what
the port is as soon as the socket is bound, and add a function
isc_nmsocket_getaddr() to retrieve it, so that the caller can
connect to the listening socket. this will be used in cases
where the same process is acting as both client and server.
2023-03-28 12:38:28 -07:00
Evan Hunt 4ad95e0567 add ns_interface_create()
add a public function ns_interface_create() allowing the caller
to set up a listening interface directly without having to set
up listen-on and scan network interfaces.
2023-03-28 12:38:28 -07:00
Evan Hunt 33a741f897 add dns_view_addtrustedkey()
the new dns_view_addtrustedkey() function allows a view's trust
anchors to be updated directly. this code was formerly in
dns_client_addtrustedkey(), which is now a wrapper around
dns_view_addtrustedkey().
2023-03-28 12:38:27 -07:00
Michal Nowak 2587fefbaa Merge branch 'mnowak/drop-unit-and-system-test-jobs' into 'main'
Drop tests on amd64cross32; move "unstable" unit and system jobs; drop Tumbleweed

See merge request isc-projects/bind9!7717
2023-03-28 14:33:38 +00:00
Michal Nowak 2b9111b435 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.
2023-03-28 16:23:35 +02:00
Michal Nowak f86d4f3bd8 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.
2023-03-28 16:23:35 +02:00
Matthijs Mekking a8fbdbe400 Merge branch '3965-source-never-read-master.c' into 'main'
Fix scan-build issue: initialized value never read

Closes #3965

See merge request isc-projects/bind9!7725
2023-03-28 12:57:49 +00:00
Matthijs Mekking 357b27b04f Add CHANGES entry for #3965 2023-03-28 14:57:14 +02:00
Matthijs Mekking 4c33277446 Fix scan-build issue: initialized value never read
Value stored to 'source' during its initialization is never read.
2023-03-28 14:56:56 +02:00
Tom Krizek 91c4792527 Merge branch 'tkrizek/gh-actions-branch-name-update' into 'main'
Update branch&tag name conventions

See merge request isc-projects/bind9!7697
2023-03-27 15:12:14 +00:00
Tom Krizek 5248a3e7db Update branch&tag naming convention in CONTRIBUTING 2023-03-27 17:09:11 +02:00
Tom Krizek ee53e3c02d Update github actions to trigger on correct branches
The naming convention for maintanence branches was changed from `vX_Y`
to `bind-X.Y`.
2023-03-27 17:09:09 +02:00
Tom Krizek d942c244f5 Merge branch '3962-doc-arm-fixes' into 'main'
Documentation formatting fixes in ARM

Closes #3962

See merge request isc-projects/bind9!7723
2023-03-27 15:07:31 +00:00
Tom Krizek 36a5c098bd 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.
2023-03-27 16:51:12 +02:00
Tom Krizek 1849c02606 Add missing newline in documentation code example 2023-03-27 16:51:10 +02:00
Michal Nowak 5c39b119c9 Merge branch 'mnowak/suppress-gitlab-clean-up-output' into 'main'
Suppress Git clean output in GitLab CI

See merge request isc-projects/bind9!7702
2023-03-27 13:04:45 +00:00
Michal Nowak ddb33a12fc 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.
2023-03-27 15:02:06 +02:00
Petr Špaček 24fc7f040e Merge branch 'pspacek/qmin-docs-describe-underscore' into 'main'
Clarify qname-minimization relaxed in the ARM

See merge request isc-projects/bind9!7646
2023-03-27 12:58:48 +00:00
Petr Špaček 02430a7263 Clarify qname-minimization relaxed in the ARM
Leading underscore in qname confused some users, and it was not
documented.
2023-03-27 14:54:12 +02:00
Arаm Sаrgsyаn 6a4e1d3787 Merge branch '3968-catz-data-race-in-dns__catz_update_cb' into 'main'
Fix a data race in dns__catz_update_cb()

Closes #3968

See merge request isc-projects/bind9!7726
2023-03-27 11:35:43 +00:00
Aram Sargsyan 95cb2affaa Add a CHANGES note for [GL #3968] 2023-03-27 11:09:13 +00:00
Aram Sargsyan a2817541b3 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.
2023-03-27 11:02:25 +00:00
Evan Hunt 2c3bbf31cf Merge branch 'each-replay-merge' into 'main'
revise branch format

See merge request isc-projects/bind9!7719
2023-03-24 20:46:46 +00:00
Tom KrizekandEvan Hunt 5fbbb46a60 Update tag name convention in release checklist 2023-03-24 20:46:34 +00:00
Evan Hunt 6e9fce7a02 revise branch format
backport branches are now called "bind-9.x" instead of "v9_x".
2023-03-24 20:46:34 +00:00
Ondřej Surý 44636fd812 Merge branch 'ondrej/use-isc_job-and-isc_async-in-netmgr' into 'main'
Convert netmgr netievent to isc_job/isc_async

Closes #3964

See merge request isc-projects/bind9!7714
2023-03-24 07:59:44 +00:00
Evan HuntandOndřej Surý 5cefc52b2e CHANGES for [GL #3964] 2023-03-24 07:58:53 +01:00
Ondřej Surý a2e4a6883f Remove the netievent remnants
After removing all functional netievents, remove what has been left from
the netievents.  This also includes leftovers from previous refactorings.
2023-03-24 07:58:53 +01:00
Ondřej Surý 6b107c3fbc Convert stopping generic socket children to to isc_async callback
Simplify the stopping of the generic socket children by using the
isc_async API from the loopmgr instead of using the asychronous
netievent mechanism in the netmgr.
2023-03-24 07:58:53 +01:00
Ondřej Surý 744e93b70d Convert setting of the TLS contexts to to isc_async callback
Simplify the setting of the TLS contexts by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:53 +01:00
Ondřej Surý 7ddc49d66a Convert canceling StreamDNS socket to to isc_async callback
Simplify the canceling of the StreamDNS socket by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:53 +01:00
Ondřej Surý 2185dc75f0 Convert reading from StreamDNS socket to to isc_async callback
Simplify the reading from the StreamDNS socket by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý 4a4bd68777 Convert setting of the DoH endpoints to to isc_async callback
Simplify the setting of the DoH endpoints by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý 115160de73 Convert sending on the DoH socket to to isc_async callback
Simplify the sending on the DoH socket by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý a321d3f419 Convert closing the DoH socket to to isc_async callback
Simplify the closing the DoH socket by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý 8c48c51f71 Convert doing the TLS IO to to isc_async callback
Simplify the doing the TLS IO by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý 3d4d099ac8 Cleanup already defunct tlsconnect netievent
The netievent used for TLS connect was already defunct, just cleanup the
cruft.
2023-03-24 07:58:52 +01:00
Ondřej Surý 35b4ef0a08 Convert sending on the TLS socket to to isc_async callback
Simplify the sending on the TLS socket by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý 4f27b14cd1 Convert closing the TLS socket to to isc_async callback
Simplify the closing the TLS socket by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý e185412872 Convert accepting new TCP connection to to isc_async callback
Simplify the acception the new TCP connection by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý 1baffb6ff5 Convert canceling UDP socket to to isc_async callback
Simplify the canceling of the UDP socket by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý 4419848efd Convert stopping TCP children to to isc_async callback
Simplify the stopping of the TCP children by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý e1524f2b4e Convert starting TCP children to to isc_async callback
Simplify the starting of the TCP children by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý 8cb4cfd9db Convert stopping UDP children to to isc_async callback
Simplify the stopping of the UDP children by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý b25dd5eaf5 Convert starting UDP children to to isc_async callback
Simplify the starting of the UDP children by using the isc_async API
from the loopmgr instead of using the asychronous netievent mechanism in
the netmgr.
2023-03-24 07:58:52 +01:00
Ondřej Surý 5a43be0775 Simplify netmgr active handles accounting
The active handles accounting was both using atomic counter and ISC_LIST
to keep track of active handles.  Remove the atomic counter that was in
use before the ISC_LIST was added for better tracking of the handles
attached to the socket.
2023-03-24 07:58:52 +01:00
Ondřej Surý 96cff4fc51 Convert netmgr handle detach to synchronous callback
Instead of calling isc__nmhandle_detach calling
nmhandle_detach_cb() asynchronously when there's closehandle_cb
initialized, convert the closehandle_cb to use isc_job, and make the
isc__nmhandle_detach() to be fully synchronous.
2023-03-24 07:58:52 +01:00
Ondřej SurýandEvan Hunt 237f4af152 Convert netmgr connect, read and send callbacks to isc_job
The netmgr connect, read and send callbacks can now only be executed on
the same loop, convert it from asynchronous netievent queue event to
more direct isc_job.
2023-03-23 22:33:40 -07:00
Evan Hunt a61f3156bd Merge branch '3953-remove-delegation-only' into 'main'
remove delegation-only and root-delegation only

Closes #3953

See merge request isc-projects/bind9!7713
2023-03-23 20:21:13 +00:00
Evan Hunt 08c86c4357 revised CHANGES and release note for [GL #3953] 2023-03-23 12:57:01 -07:00
Evan Hunt 833ca463d4 remove {root-}delegation-only
complete the removal of the delegation-only and root-delegation-only
options, and the delegation-only zone type.
2023-03-23 12:57:01 -07:00
Ondřej Surý 9e7b7a5716 Merge branch '3953-deprecate-delegation-only' into 'main'
deprecate delegation-only and root-delegation only

See merge request isc-projects/bind9!7712
2023-03-23 19:06:10 +00:00
Evan HuntandOndřej Surý 8d80ee561e CHANGES and release note for [GL #3953] 2023-03-23 19:17:22 +01:00
Evan HuntandOndřej Surý 2399556bee 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).
2023-03-23 19:16:24 +01:00
Ondřej Surý c8c091b7f5 Merge branch '3960-handle-non-ISC_R_SUCCESS-in-rctx_respinit' into 'main'
Properly handle ISC_R_SHUTTINGDOWN in resquery_response()

Closes #3960

See merge request isc-projects/bind9!7715
2023-03-23 11:21:33 +00:00
Ondřej Surý 93259812dd 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.
2023-03-23 11:51:22 +01:00
Michal Nowak f68deabb31 Merge branch 'mnowak/adapt-release-tarball-comparison-to-tags-with-dots' into 'main'
Adapt release-tarball-comparison.sh to dotted tag notation

See merge request isc-projects/bind9!7698
2023-03-22 15:07:43 +00:00
Michal Nowak 0031af6035 Adapt release-tarball-comparison.sh to dotted tag notation
Recently, the tag notation format changed:

    v9_19_9     -> v9.19.9
    v9_18_13-S1 -> v9.18.13-S1

release-tarball-comparison.sh needs to adapt.
2023-03-22 15:58:15 +01:00
Tom Krizek 95e3861f31 Merge branch '3665-dupsigs-test-stability' into 'main'
Improve dupsigs test stability

Closes #3665

See merge request isc-projects/bind9!7688
2023-03-22 09:55:33 +00:00
Tom Krizek 3291c891f6 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.
2023-03-22 10:16:48 +01:00
Tom Krizek ad647dca13 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.
2023-03-22 10:16:48 +01:00
Tom Krizek fad2eee631 Store dupsigs axfr to a file for easier debugging 2023-03-22 10:16:48 +01:00
Tom Krizek cbe2559f37 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.
2023-03-22 10:16:46 +01:00
Arаm Sаrgsyаn 50f7f059eb Merge branch '3955-hold-catz-reference-during-update' into 'main'
Hold a catz reference while the update process is running

Closes #3955

See merge request isc-projects/bind9!7704
2023-03-21 11:39:46 +00:00
Aram Sargsyan aee14ee5d9 Add a CHANGES note for [GL #3955] 2023-03-21 10:39:52 +00:00
Aram Sargsyan dc2b8bb1c9 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.
2023-03-21 10:15:30 +00:00
Michal Nowak 714821bd51 Merge branch 'mnowak/respdiff-drop-allow_failure' into 'main'
respdiff jobs do not need "allow_failure: true"

See merge request isc-projects/bind9!7681
2023-03-17 10:08:40 +00:00
Michal Nowak dd97ddca6f respdiff jobs do not need "allow_failure: true"
ASAN and TSAN respdiff jobs should be stable and not require
"allow_failure: true" anymore.
2023-03-17 11:05:21 +01:00
Evan Hunt f62342e74d Merge branch 'each-key-restore-test' into 'main'
add basic test for TSIG key dump/restore functionality

See merge request isc-projects/bind9!7629
2023-03-17 06:09:28 +00:00
Evan Hunt e914c5e194 add basic test for TSIG key dump/restore functionality
stop and restart the server in the 'tsiggss' test, in order
to confirm that GSS negotiated TSIG keys are saved and restored
when named loads.

added logging to dns_tsigkey_createfromkey() to indicate whether
a key has been statically configured, generated via GSS negotiation,
or restored from a file.
2023-03-16 09:55:50 -07:00
Tom Krizek 7e4414d02d Merge branch 'tkrizek/ci-artifacts-1d' into 'main'
Use the default retention time for CI artifacts

See merge request isc-projects/bind9!7670
2023-03-16 14:04:36 +00:00
Tom Krizek 8fef5676fa 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.
2023-03-16 15:03:22 +01:00
Tom Krizek 1139907450 Move gitlab-ci.yml comment to its proper place
The comment refers to "interruptible" key, rather than the entire
"default" section.
2023-03-16 15:03:20 +01:00
Tom Krizek 48067d78fa Merge tag 'v9_19_11'
BIND 9.19.11
2023-03-15 18:23:44 +01:00
Artem Boldariev a319108aeb Merge branch 'artem-remove-tlsdns-and-tcpdns-leftouts' into 'main'
Delete old TLS DNS and TCP DNS dead code

See merge request isc-projects/bind9!7689
2023-03-15 16:55:07 +00:00
Artem Boldariev 719343348e Delete old TLS DNS and TCP DNS dead code
This commit removes old, unused TLS DNS and TCP DNS definitions from
the code. They should have been deleted earlier, but that was missed.
2023-03-15 18:40:58 +02:00
Mark Andrews 95f971b001 Merge branch '3937-zone-sign-kasp' into 'main'
Resolve "NSEC records aren't signed with both configured algorithms during NSEC3->NSEC transition"

Closes #3937

See merge request isc-projects/bind9!7682
2023-03-14 13:16:37 +00:00
Mark Andrews aafcb8611c Add CHANGES for [GL #3937] 2023-03-14 23:26:39 +11:00
Mark Andrews 4b55201459 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.
2023-03-14 23:26:39 +11:00
Arаm Sаrgsyаn bfbaef2f7b Merge branch '3928-placeholder' into 'main'
Add a CHANGES placeholder for [GL #3928]

See merge request isc-projects/bind9!7684
2023-03-14 09:58:24 +00:00
Aram Sargsyan 7211398a77 Add a CHANGES placeholder for [GL #3928] 2023-03-14 09:52:13 +00:00
Mark Andrews 4f670d1916 Merge branch '3939-insufficient-information-to-identify-key' into 'main'
Resolve "Insufficient information to identify key"

Closes #3939

See merge request isc-projects/bind9!7676
2023-03-14 03:09:25 +00:00
Mark Andrews 9f161544fd Report key name when removing it 2023-03-13 23:26:35 +00:00
Mark Andrews 7a0a2fc3e4 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.
2023-03-13 23:26:35 +00:00
Arаm Sаrgsyаn 251c0bcae3 Merge branch '3924-dnstap-test-timing-issue' into 'main'
Resolve "missing messages in `dnstap` system test after query failure"

Closes #3924

See merge request isc-projects/bind9!7674
2023-03-13 11:48:19 +00:00
Aram Sargsyan fa686fcea5 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.
2023-03-13 10:25:01 +00:00
Ondřej Surý b3029d31c0 Merge branch 'ondrej-userspace-rcu-github-actions' into 'main'
Install liburcu-dev to GitHub Actions

See merge request isc-projects/bind9!7675
2023-03-11 04:05:57 +00:00
Ondřej Surý def02029c0 Install liburcu-dev to GitHub Actions
The CodeQL and SonarCloud GitHub Actions would FTBFS because of missing
liburcu-dev package resulting.  Install the required package to both
GitHub Action files.
2023-03-11 05:03:54 +01:00
Ondřej Surý f7ae0eb544 Merge branch 'fanf-urcu' into 'main'
Build with liburcu, userspace RCU

Closes #3935

See merge request isc-projects/bind9!7662
2023-03-10 19:21:45 +00:00
Tony FinchandOndřej Surý 37c4f7f349 CHANGES and release notes for [GL #3935]
[func]		BIND now requires liburcu for lock-free data structures
		and concurrent safe memory reclamation. It replaces the
		home-grown lock-free linked list and QSBR machinery
		added in changes 6108 and 6109. The qp-trie code has
		been adjusted to use liburcu.
2023-03-10 17:31:28 +01:00
Tony FinchandOndřej Surý 7e565a87a7 Apply adjusted clang-format
The headers were slightly reordered when liburcu was added.
2023-03-10 17:31:28 +01:00
Ondřej Surý 2532b558b4 Build with liburcu, Userspace RCU
BIND needs a collection of standard lock-free data structures,
which we can find in liburcu, along with its RCU safe memory
reclamation machinery. We will use liburcu's QSBR variant instead
of the home-grown isc_qsbr.
2023-03-10 17:31:28 +01:00
Arаm Sаrgsyаn d96ff69b84 Merge branch 'aram/fix-ISC_REFCOUNT_TRACE_IMPL-usage' into 'main'
Fix ISC_REFCOUNT_TRACE_IMPL usage

See merge request isc-projects/bind9!7673
2023-03-09 22:40:44 +00:00
Aram Sargsyan fce68da460 Fix ISC_REFCOUNT_TRACE_IMPL usage
ISC_REFCOUNT_TRACE_IMPL uses isc_tid(), but the corresponding header
file is not included, which breaks, for example, compiling BIND with
DNS_CATZ_TRACE defined in lib/dns/include/dns/catz.h.

Add '#include <isc/tid.h>' in lib/isc/include/isc/refcount.h.
2023-03-09 21:38:04 +00:00
Michal Nowak 0663efc209 Merge branch 'mnowak/stress-test-drop-parallel-build' into 'main'
Drop parallel build from stress tests

See merge request isc-projects/bind9!7669
2023-03-09 17:31:33 +00:00
Michal Nowak 3fd7e7c81f 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.
2023-03-09 18:24:03 +01:00
Michal Nowak ce49dccf40 Merge branch 'mnowak/update-release-tarball-comparison.sh' into 'main'
Adapt tarball comparison to dropped pregenerated man pages

See merge request isc-projects/bind9!7661
2023-03-09 16:05:20 +00:00
Michal Nowak 0bc4fad065 Adapt tarball comparison to dropped pregenerated man pages
Since pregenerated manual pages were removed from the BIND 9 repository,
Sphinx must be present in the build environment for manual pages to be
created and placed to release tarball. release-tarball-comparison.sh
script needs to be adapted to keep up with how to release tarballs are
prepared.
2023-03-09 16:55:46 +01:00
Arаm Sаrgsyаn 9c304714e3 Merge branch '3923-doth-system-test-timing-issue' into 'main'
Resolve "timing issue with incoming XoT check in `doth` system test"

Closes #3923

See merge request isc-projects/bind9!7653
2023-03-09 10:39:14 +00:00
Aram Sargsyan 5d5d4b523b 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
2023-03-09 10:03:19 +00:00
Aram Sargsyan 9672b6be57 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.
2023-03-09 10:03:19 +00:00
Aram Sargsyan 2fdf01573c 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.
2023-03-09 10:03:19 +00:00
Michal Nowak e6af4a1030 Merge branch 'mnowak/stress-test-build-with-default-CFLAGS' into 'main'
Build BIND in stress test jobs with common CFLAGS

See merge request isc-projects/bind9!7627
2023-03-09 09:58:05 +00:00
Michal Nowak d33bdd36b4 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.
2023-03-09 10:24:50 +01:00
Mark Andrews 96d2651e83 Merge branch '3929-gcc-12-static-analyzer-use-of-uninitialized-value-ctx-val-1-in-base32-c' into 'main'
Resolve "GCC 12 static analyzer: use of uninitialized value '*ctx.val[1]' in base32.c"

Closes #3929

See merge request isc-projects/bind9!7655
2023-03-08 23:01:12 +00:00
Mark Andrews 0045b24500 Silence uninitialized value false positives
In base32_decode_char the GCC 12 static analyser fails to determine
that ctx->val[1], ctx->val[3], ctx->val[4] and ctx->val[6] are
assigned values by the previous call to base32_decode_char.  Initialise
ctx->val to zeros when initalising the rest of ctx to silence the
false positive.
2023-03-08 22:40:03 +00:00
Mark Andrews 700d5f6b0b Merge branch '3932-gcc-12-static-analyzer-warning-use-of-null-_frm-where-non-null-expected-in-cc-c' into 'main'
Resolve "GCC 12 static analyzer: warning: use of NULL '_frm' where non-null expected in cc.c"

Closes #3932

See merge request isc-projects/bind9!7658
2023-03-08 22:36:19 +00:00
Mark Andrews 2b18f6699b Silence GCC 12 NULL pointer dereference warnings
When isccc_cc_lookupstring returns ISC_R_SUCCESS the returned pointer
is non NULL.  Add INSISTS do that GCC 12 can determine this.
2023-03-08 22:14:59 +00:00
Mark Andrews 07bf332170 Merge branch '3931-gcc-12-static-analyzer-warning-use-of-uninitialized-value-svcb-svclen-in-rdata-c' into 'main'
Resolve "GCC 12 static analyzer: warning: use of uninitialized value 'svcb.svclen' in rdata.c"

Closes #3931

See merge request isc-projects/bind9!7657
2023-03-08 22:07:46 +00:00
Mark Andrews e37c9702ae Add additional contraints to dns_rdata_checksvcb
REQUIRE that rdata->type is dns_rdatatype_svcb to detect when
dns_rdata_checksvcb is called with the wrong rdata type.  There are
no code paths that currently pass the wrong rdata to dns_rdata_checksvcb.

This was found by GCC 12 static analysis.
2023-03-08 21:47:14 +00:00
Matthijs Mekking f0c8da6d31 Merge branch '3925-serve-stale-system-test-failure' into 'main'
Lower chance of intermittent serve-stale system test failure

Closes #3925

See merge request isc-projects/bind9!7659
2023-03-08 16:34:46 +00:00
Matthijs Mekking 0bf36da305 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.
2023-03-08 17:14:59 +01:00
Ondřej Surý 1c8255efea Merge branch 'tt-openssl-dh-refactoring' into 'main'
Refactor OpenSSL EDDSA code

See merge request isc-projects/bind9!7429
2023-03-08 15:13:20 +00:00
Timo TeräsandOndřej Surý 20b4d7146b Convert OpenSSL EDDSA glue to pkeypair
Finish the OpenSSL EDSSA glue refactoring to use pkeypair - this is the
same change that has been already applied to RSA and ECDSA glues.
2023-03-08 13:50:46 +01:00
Timo TeräsandOndřej Surý 28da7670b6 OpenSSL EDDSA introduce and use openssleddsa_alg_info()
Move the common code into a helper function that returns the EDDSA
parameters (pkey type, nid, keysize, sigsize).
2023-03-08 13:50:46 +01:00
Timo TeräsandOndřej Surý c0b1ac97bf Remove redundant NULL checks in OpenSSL RSA glue
The OpenSSL free functions are no-op when called with NULL argument,
thus remove the extra checks around *_free() calls in the OpenSSL RSA
glue.
2023-03-08 13:50:46 +01:00
Timo TeräsandOndřej Surý fa8343e9c9 Introduce dst__openssl_keypair_{compare,isprivate,destroy}
Rename and simplify dst__openssl_compare_keypair() to
dst__openssl_keypair_compare(), and introduce two additional functions
dst__openssl_keypair_isprivate and dst__openssl_keypair_destroy.

Use those to de-duplicated openssl{rsa,ecdsa}_isprivate, and
openssl{rsa,ecdsa}_destroy.
2023-03-08 13:50:46 +01:00
Tony Finch 61598b0cd1 Merge branch 'fanf-libbind9-remnants' into 'main'
Remove some lingering references to libbind9

See merge request isc-projects/bind9!7660
2023-03-08 12:04:35 +00:00
Tony Finch c43668f031 Remove some lingering references to libbind9
Clean up the `.clang-format` #include priority list and
the `\file` declaration in `isc/getaddresses.h`.
2023-03-08 10:06:22 +00:00
Ondřej Surý d3764f0759 Merge branch '3905-remove-TKEY-Diffie-Hellman-exchange' into 'main'
Remove TKEY Mode 2 (Diffie-Hellman)

Closes #3905

See merge request isc-projects/bind9!7626
2023-03-08 07:57:52 +00:00
Ondřej Surý cf21e05313 Add CHANGES and release note for [GL #3905] 2023-03-08 08:36:25 +01:00
Evan HuntandOndřej Surý f030831481 further cleanup after removing diffie-hellman TKEY mode
without diffie-hellman TKEY negotiation, some other code is
now effectively dead or unnecessary, and can be cleaned up:

- the rndc tsig-list and tsig-delete commands.
- a nonoperational command-line option to dnssec-keygen that
  was documented as being specific to DH.
- the section of the ARM that discussed TKEY/DH.
- the functions dns_tkey_builddeletequery(), processdeleteresponse(),
  and tkey_processgssresponse(), which are unused.
2023-03-08 08:36:25 +01:00
Ondřej Surý bd4576b3ce Remove TKEY Mode 2 (Diffie-Hellman)
Completely remove the TKEY Mode 2 (Diffie-Hellman Exchanged Keying) from
BIND 9 (from named, named.conf and all the tools).  The TKEY usage is
fringe at best and in all known cases, GSSAPI is being used as it should.

The draft-eastlake-dnsop-rfc2930bis-tkey specifies that:

    4.2 Diffie-Hellman Exchanged Keying (Deprecated)

       The use of this mode (#2) is NOT RECOMMENDED for the following two
       reasons but the specification is still included in Appendix A in case
       an implementation is needed for compatibility with old TKEY
       implementations. See Section 4.6 on ECDH Exchanged Keying.

          The mixing function used does not meet current cryptographic
          standards because it uses MD5 [RFC6151].

          RSA keys must be excessively long to achieve levels of security
          required by current standards.

We might optionally implement Elliptic Curve Diffie-Hellman (ECDH) key
exchange mode 6 if the draft ever reaches the RFC status.  Meanwhile the
insecure DH mode needs to be removed.
2023-03-08 08:36:25 +01:00
Tom Krizek 584eb79400 Merge branch 'tkrizek/set-up-version-and-release-notes-for-bind-9.19.12' into 'main'
Set up version and release notes for BIND 9.19.12

See merge request isc-projects/bind9!7650
2023-03-07 16:35:33 +00:00
Tom Krizek 7f0cb47044 Set up release notes for BIND 9.19.12 2023-03-07 14:10:26 +01:00
Tom Krizek ddd337f541 Update BIND version to 9.19.12-dev 2023-03-07 14:09:54 +01:00
Tom Krizek 5e3e7a262b Update BIND version for release 2023-03-03 15:10:56 +01:00
Tom Krizek f14d8ad78c Add a CHANGES marker 2023-03-03 15:10:10 +01:00
Tom Krizek 5fa00c7ce1 Merge branch 'tkrizek/prepare-documentation-for-bind-9.19.11' into 'v9_19_11-release'
Prepare documentation for BIND 9.19.11

See merge request isc-private/bind9!500
2023-03-03 14:05:21 +00:00
Tom Krizek 8f315605ba Add release note for GL #3673 2023-03-03 10:54:00 +01:00
Tom Krizek 86bd0c719e Reorder release notes 2023-03-03 10:53:14 +01:00
Tom Krizek 3838c56ed8 Tweak and reword release notes 2023-03-03 10:53:08 +01:00
Tom Krizek d4ab5a476c Prepare release notes for BIND 9.19.11 2023-03-03 10:11:16 +01:00
Tom Krizek 9b944eb8a5 Add release metadata update to release checklist
The release engineering automation we have relies on up-to-date
information about our upcoming release plans. Ensure these are updated
at the end of each release cycle.
2023-03-03 10:11:16 +01:00
Michal NowakandTom Krizek b08e54a0d2 Move "disallow merging to maintained branches" closer to tagging
Updating GitLab settings for all maintained branches to disallow merging
to them has an unfortunate consequence: daily scheduled pipelines won't
be executed anymore. This is a problem because we need the pipelines to
ensure no new bugs were introduced just before a code freeze.

The "Announce (on Mattermost) that the code freeze is in effect" item is
still in place but is now more of a social "disallow merging to
maintained branches".
2023-03-03 10:11:13 +01:00
Tom Krizek 0874708bbf Merge branch '3917-named-should-log-uv-version-when-starting-up' into 'main'
Resolve "Named should log UV version when starting up"

Closes #3917

See merge request isc-projects/bind9!7642
2023-03-03 08:30:14 +00:00
Mark Andrews 5fd2cd8018 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.
2023-03-03 14:04:34 +11:00
Arаm Sаrgsyаn c3a159e080 Merge branch '3907-data-race-in-rbtdb' into 'main'
Resolve "ThreadSanitizer: data race lib/dns/rbtdb.c:1365 in newversion"

Closes #3907

See merge request isc-projects/bind9!7637
2023-03-02 18:36:01 +00:00
Aram Sargsyan 6980e3b354 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.
2023-03-02 17:40:10 +00:00
Aram Sargsyan 67c77aba38 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.
2023-03-02 17:40:10 +00:00
Aram Sargsyan 3973724d67 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().
2023-03-02 17:40:10 +00:00
Aram Sargsyan cb0d6393a7 Add a CHANGES note for [GL #3907] 2023-03-02 17:40:10 +00:00
Aram Sargsyan a87859f1fa 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.
2023-03-02 17:40:10 +00:00
Aram Sargsyan d2ecff3c4a 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.
2023-03-02 17:39:43 +00:00
Aram Sargsyan e1627e1289 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.
2023-03-02 09:43:37 +00:00
Aram Sargsyan 593dea871a Revert "Process db callbacks in zone_loaddone() after zone_postload()"
This reverts commit ed268b46f1.

The commit introduced a data race, because dns_db_endload() is called
after unfreezing the zone.
2023-03-01 17:26:41 +00:00
Arаm Sаrgsyаn 0eb6657c21 Merge branch 'aram/catz-add-lock-for-dns_catz_zone_t' into 'main'
Add a lock for dns_catz_zone_t

See merge request isc-projects/bind9!7633
2023-03-01 16:59:37 +00:00
Aram Sargsyan 2ae3bc6e1d 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'.
2023-03-01 15:36:36 +00:00
Arаm Sаrgsyаn ad5b8fff05 Merge branch '3911-reconfig-zone-view-revert-bugfix' into 'main'
Fix view's zones reverting bug during reconfiguration

Closes #3911

See merge request isc-projects/bind9!7632
2023-03-01 15:35:27 +00:00
Aram Sargsyan e1036253db Add CHANGES and release notes for [GL #3911] 2023-03-01 14:10:31 +00:00
Aram Sargsyan 84c235a4b0 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.
2023-03-01 14:10:31 +00:00
Aram Sargsyan 93c4f382f4 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.
2023-03-01 13:47:56 +00:00
Mark Andrews f6f525132b Merge branch '3894-emit-coverage-summary-for-the-coverage-badge' into 'main'
Resolve "Emit coverage summary for the coverage badge"

Closes #3894

See merge request isc-projects/bind9!7587
2023-02-28 22:43:14 +00:00
Mark Andrews db7af9fcc1 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
2023-02-28 22:23:13 +00:00
Ondřej Surý bf2a1b1ca0 Merge branch '3898-shutdown-then-detach' into 'main'
Decouple view->resolver and friends shutdown and detach

Closes #3898

See merge request isc-projects/bind9!7623
2023-02-28 15:32:40 +00:00
Ondřej Surý dfd195e77c Decouple view->resolver and friends shutdown and detach
In !7538, the shutdown procedure was simplified, but the ordering was
wrong, we need to shutdown the resolver, adb and requestmgr before
detaching those objects from the view, because there are cross
dependencies between at least the resolver and the adb.

Execute the shutdown(s) first, only when all three shutdowns have been
executed, detach those objects from the view.
2023-02-28 15:32:33 +00:00
Ondřej Surý 004d2a7ad0 Remove unused .loop member from dns_view
After the last round of refactoring, the .loop member of dns_view
structure was unused, remove it.
2023-02-28 15:32:33 +00:00
Arаm Sаrgsyаn f5669e6013 Merge branch 'aram/catz-refactor-renaming-leftovers-finish' into 'main'
Finish catalog zone 'zone' and 'zones' to 'catz' and 'catzs' renaming

See merge request isc-projects/bind9!7611
2023-02-28 15:19:05 +00:00
Aram Sargsyan 580ef2e18f 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.
2023-02-28 14:43:04 +00:00
Arаm Sаrgsyаn b9d2ba8d1b Merge branch 'aram/catz-remove-redundant-declaration' into 'main'
Remove a redundant ISC_REFCOUNT_DECL in catz.h

See merge request isc-projects/bind9!7612
2023-02-28 14:42:45 +00:00
Aram Sargsyan a627cc9e0b Remove a redundant ISC_REFCOUNT_DECL in catz.h
The 'ISC_REFCOUNT_DECL(dns_catz_zone)' declaration was provided twice.
2023-02-28 13:53:16 +00:00
Michał Kępień 20428f4c77 Merge branch 'michal/add-a-dnsrps-enabled-build-to-regular-ci-pipelines' into 'main'
Add a DNSRPS-enabled build to regular CI pipelines

See merge request isc-projects/bind9!7601
2023-02-28 11:56:27 +00:00
Michał Kępień a4d6f5f6fd 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.
2023-02-28 12:54:02 +01:00
Michał Kępień b396f55586 (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.
2023-02-28 12:54:02 +01:00
Ondřej Surý dcbc659550 Merge branch 'ondrej/implement-dns_rbtnode_t-reference-tracing' into 'main'
Implement dns_db node tracing

See merge request isc-projects/bind9!7313
2023-02-28 10:45:01 +00:00
Ondřej Surý cd632ad31d Implement dns_db node tracing
This implements node reference tracing that passes all the internal
layers from dns_db API (and friends) to increment_reference() and
decrement_reference().

It can be enabled by #defining DNS_DB_NODETRACE in <dns/trace.h> header.

The output then looks like this:

    incr:node:check_address_records:rootns.c:409:0x7f67f5a55a40->references = 1
    decr:node:check_address_records:rootns.c:449:0x7f67f5a55a40->references = 0

    incr:nodelock:check_address_records:rootns.c:409:0x7f67f5a55a40:0x7f68304d7040->references = 1
    decr:nodelock:check_address_records:rootns.c:449:0x7f67f5a55a40:0x7f68304d7040->references = 0

There's associated python script to find the missing detach located at:
https://gitlab.isc.org/isc-projects/bind9/-/snippets/1038
2023-02-28 11:44:15 +01:00
Michal Nowak 5737f7bc8f Merge branch 'mnowak/make-openbsd-allow_failure-true' into 'main'
Do not fail pipeline because of failed OpenBSD system test

See merge request isc-projects/bind9!7609
2023-02-28 10:27:17 +00:00
Michal Nowak fc26da6d89 Do not fail pipeline because of failed OpenBSD system test
System test on OpenBSD is unstable even when test parallelism is
disabled.
2023-02-28 11:23:14 +01:00
Michal Nowak a9d3ec33b3 Revert "Disable OpenBSD system test parallelism in CI"
This reverts commit d73eba57bd.
2023-02-28 11:23:13 +01:00
Matthijs Mekking 36681e2c0a Merge branch '3837-cds-digest-type' into 'main'
Add cds-digest-type configuration option

Closes #3837

See merge request isc-projects/bind9!7457
2023-02-28 10:01:50 +00:00
Matthijs Mekking 78e6b8646a Test dnssec-signzone -G digests
Add test cases for the new dnssec-signzone -G option.
2023-02-28 09:38:31 +01:00
Matthijs Mekking 6c76a99c24 Require to be dereferenced arguments are non-NULL
The function 'dns_dnssec_syncupdate()' is dereferencing arguments
'keys' and 'rmkeys'. There should be a REQUIRE that those are not
null pointers.
2023-02-28 09:38:31 +01:00
Matthijs Mekking b1633b71b0 dnssec-signzone can now create multiple CDS RRs
Change the commandline option -G to take a string that determines what
sync records should be published. It is a comma-separated string with
each element being either "cdnskey", or "cds:<algorithm>", where
<algorithm> is a valid digest type. Duplicates are suppressed.
2023-02-28 09:38:31 +01:00
Matthijs Mekking ea4130d6bd Update syncupdate() function to disable CDNSKEY
Add a new function argument so you can choose whether the CDNSKEY
record should be published or not.
2023-02-28 09:38:17 +01:00
Mark AndrewsandMatthijs Mekking 59cd228216 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.
2023-02-28 09:38:17 +01:00
Matthijs Mekking 28cde5cac2 Suppress duplicate digest types
When adding CDS digest types to the kasp structure, check for
duplicates.
2023-02-28 09:38:17 +01:00
Matthijs Mekking f2c0c4ed4e Add 'dns_dnssec_syncupdate' argument descriptions 2023-02-28 09:38:17 +01:00
Matthijs Mekking c0b606885e Make cds-digest-type plural
Allow for configuring multiple CDS records with different digest
types (currently only SHA-256 and SHA-384 are allowed).
2023-02-28 09:38:17 +01:00
Matthijs Mekking 06e64821f5 New option to dnssec-signzone to ignore sync rrs
By default, CDS and CDNSKEY records are generated from the given
key list. In some cases you don't want that.
2023-02-28 09:37:38 +01:00
Matthijs Mekking e5841856f8 Add release note and change for cds-digest-type 2023-02-28 09:37:37 +01:00
Matthijs Mekking 8d20c4e95f Update code to publish CDS with other digest type
Now that we can configure a different digest type, update the code
to honor the configuration. Update 'dns_dnssec_syncupdate' so that
the correct CDS record is published, and also when deleting CDS records,
ensure that all possible CDS records are removed from the zone.
2023-02-28 09:36:50 +01:00
Matthijs Mekking 9f3e3fcfc8 Add test case for different digest type
Change one of the test cases to use a different digest type (4).  The
system tests and kasp script need to be updated to take into account
the new algorithm (instead of the hard coded 2).
2023-02-28 09:36:50 +01:00
Matthijs Mekking f1ec02a359 Test cds-digest-type configuration
Add tests for good and bad configuration values in the checkconf system
test.
2023-02-28 09:36:50 +01:00
Matthijs Mekking 2742fe656f Add configuration cds-digest-type
Add the 'cds-digest-type' configuration option to 'dnssec-policy'.
2023-02-28 09:36:49 +01:00
Matthijs Mekking 32114afc46 Add functions to set CDS digest-type
BIND dnssec-policy currently only supports CDS digest-type 2. Add
API functions to allow other digest-types.
2023-02-28 09:36:39 +01:00
Matthijs Mekking dc7818ebcb Fix CDS/CDSNKEY publication logging
The CDS and CDNSKEY "is published" logs were mixed up (CDNSKEY was
logged when CDS was published and vice versa).
2023-02-28 09:36:39 +01:00
Michał Kępień 2ef43afa5a Merge branch '3891-fix-dnsrps-code' into 'main'
Fix DNSRPS code after struct dns_db refactoring

Closes #3891

See merge request isc-projects/bind9!7595
2023-02-28 08:17:30 +00:00
Michał Kępień df3062ed52 Fix DNSRPS code after struct dns_db refactoring
Commits ffa4757c79 and
77e7eac54c inadvertently broke
DNSRPS-enabled builds:

  - the new member of struct dns_db that holds a reference count for the
    database is called 'references', not 'refcount',

  - a syntax error was introduced in the designated initializer for
    'rpsdb_rdataset_methods',

  - rpsdb_destroy() no longer takes a 'dbp' argument.

Address all of the above issues to make DNSRPS-enabled builds work
again.
2023-02-28 09:16:05 +01:00
Mark Andrews cdbdb5fcec Merge branch '3902-fetchlimit-system-test-failed' into 'main'
Resolve "'fetchlimit' system test failed"

Closes #3902

See merge request isc-projects/bind9!7615
2023-02-28 07:23:00 +00:00
Mark Andrews c7ae975ecf Fix 'checking drop statistics' test
Wait for the desired log message to appear in ns3/named.stats rather
than the creation of the file.
2023-02-28 17:46:14 +11:00
Mark Andrews af47090d99 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.
2023-02-28 17:45:59 +11:00
Tony Finch 19cffc4972 Merge branch 'fanf-qp-import' into 'main'
Import a qp-trie implementation

See merge request isc-projects/bind9!7130
2023-02-27 14:11:05 +00:00
Tony Finch 0858514ae8 Improve qp-trie compaction in write transactions
In general, it's better to do one thorough compaction when a batch of
work is complete, which is the way that `update` transactions work.
Conversely, `write` transactions are designed so that lots of little
transactions are not too inefficient, but they need explicit
compaction. This changes `dns_qp_compact()` so that it is easier to
compact any time that makes sense, if there isn't a better way to
schedule compaction. And `dns_qpmulti_commit()` only recycles garbage
when there is enough to make it worthwhile.
2023-02-27 13:47:57 +00:00
Tony Finch a8b29f0365 Improve qp-trie refcount debugging
Add some qp-trie tracing macros which can be enabled by a
developer. These print a message when a leaf is attached or
detached, indicating which part of the qp-trie implementation
did so. The refcount methods must now return the refcount value
so it can be printed by the trace macros.
2023-02-27 13:47:57 +00:00
Tony Finch 7dcde5d2fc Make the qp-trie stats logging quieter
Only log when useful work was done
2023-02-27 13:47:57 +00:00
Tony Finch 4b5ec07bb7 Refactor qp-trie to use QSBR
The first working multi-threaded qp-trie was stuck with an unpleasant
trade-off:

  * Use `isc_rwlock`, which has acceptable write performance, but
    terrible read scalability because the qp-trie made all accesses
    through a single lock.

  * Use `liburcu`, which has great read scalability, but terrible
    write performance, because I was relying on `rcu_synchronize()`
    which is rather slow. And `liburcu` is LGPL.

To get the best of both worlds, we need our own scalable read side,
which we now have with `isc_qsbr`. And we need to modify the write
side so that it is not blocked by readers.

Better write performance requires an async cleanup function like
`call_rcu()`, instead of the blocking `rcu_synchronize()`. (There
is no blocking cleanup in `isc_qsbr`, because I have concluded
that it would be an attractive nuisance.)

Until now, all my multithreading qp-trie designs have been based
around two versions, read-only and mutable. This is too few to
work with asynchronous cleanup. The bare minimum (as in epoch
based reclamation) is three, but it makes more sense to support an
arbitrary number. Doing multi-version support "properly" makes
fewer assumptions about how safe memory reclamation works, and it
makes snapshots and rollbacks simpler.

To avoid making the memory management even more complicated, I
have introduced a new kind of "packed reader node" to anchor the
root of a version of the trie. This is simpler because it re-uses
the existing chunk lifetime logic - see the discussion under
"packed reader nodes" in `qp_p.h`.

I have also made the chunk lifetime logic simpler. The idea of a
"generation" is gone; instead, chunks are either mutable or
immutable. And the QSBR phase number is used to indicate when a
chunk can be reclaimed.

Instead of the `shared_base` flag (which was basically a one-bit
reference count, with a two version limit) the base array now has a
refcount, which replaces the confusing ad-hoc lifetime logic with
something more familiar and systematic.
2023-02-27 13:47:55 +00:00
Tony Finch 549854f63b Some minor qp-trie improvements
Adjust the dns_qp_memusage() and dns_qp_compact() functions
to be more informative and flexible about handling fragmentation.

Avoid wasting space in runt chunks.

Switch from twigs_mutable() to cells_immutable() because that is the
sense we usually want.

Drop the redundant evacuate() function and rename evacuate_twigs() to
evacuate(). Move some chunk test functions closer to their point of
use.

Clarify compact_recursive(). Some small cleanups to comments.

Use isc_time_monotonic() for qp-trie timing stats.

Use #define constants to control debug logging.

Set up DNS name label offsets in dns_qpkey_fromname() so it is easier
to use in cases where the name is not fully hydrated.
2023-02-27 13:47:25 +00:00
Tony Finch 4b09c9a6ae qp-trie naming improvements
Adjust to typename_operation style
	s/VALID_QP/QP_VALID/g
	s/QP_VALIDMULTI/QPMULTI_VALID/g

Improved greppability
	s/\bctx\b/uctx/g

Less cluttered logging
	s/QP_TRACE/TRACE/g
	s/QP_LOG_STATS/LOG_STATS/g
2023-02-27 13:47:25 +00:00
Tony Finch a9d57b91db Benchmarks for the qp-trie
The main benchmark is `qpmulti`, which exercizes the qp-trie
transactional API with differing numbers of threads and differing data
sizes, to get some idea of how its performance scales.

The `load-names` benchmark compares the times to populate and query
and the memory used by various BIND data structures: qp-trie, hash
table (chained), hash map (closed), and red-black tree.

The `qp-dump` program is a test utility rather than a benchmark. It
populates a qp-trie and prints it out, either in an ad-hoc text
format, or as input to the graphviz `dot` program.
2023-02-27 13:47:25 +00:00
Tony Finch b06f6ef75a Fuzz testing the qp-trie
Ensure dns_qpkey_fromname() and dns_qpkey_toname() are inverses.

Excercise a single-threaded dns_qp_t with a fixed set of random keys
and a small chunk size. Use the table of names to ensure that the trie
is behaving as expected. This is (in effect) randomized testing like
the `qpmulti` unit test, but making use of coverage-guided fuzzing
and (in principle) test case minimization.
2023-02-27 13:47:25 +00:00
Tony Finch fbdb8b502a Test the qp-trie transactional API
Randomized testing with intensive consistency and correctness checks
make it much easier to get good coverage and to shake out bugs than
hand-written unit tests for specific cases.

These tests only run in a single thread, but each test transaction
uses both a write/update and a query/snapshot, to ensure that
modifications are not visible to concurrent readers.
2023-02-27 13:47:25 +00:00
Tony Finch c1c679b1a9 Test infrastructure for the qp-trie
This change adds a number of support routines for the unit tests, and
for benchmarks and fuzz tests to be added later. It isn't necessary to
include the support routines in libdns, since they are not needed by
BIND's installed programs. So `libtest` seems like the best place for
them.

The tests themselves verify that dns_qpkey_fromname() behaves as
expected.
2023-02-27 13:47:25 +00:00
Tony Finch df6747ee70 Fix qp-trie refcounting mistake
The error occurred when:

  * The bump chunk was re-used across multiple write transactions.
    In this situation the bump chunk is marked immutable, but the
    immutable flag is disregarded for cells after the fender, which
    were allocated in the current transaction.

  * The bump chunk fills up during an insert operation, so that the
    enlarged twigs vector is allocated from a new bump chunk.

  * Before this happened, we should have (but didn't) made the twigs
    vector mutable. This would have adjusted its refcounts as necessary.

  * However, moving to a new bump chunk has a side effect: twigs that
    were previously considered mutable because they are after the
    fender become immutable.

  * Because of this, the old twigs vector was not destroyed as expected.

  * So leaves were duplicated without their refcounts being increased.

The effect is that the refcounts were lower than they should have
been, and underflowed. The tests failed to check for refcount
underflow, so this mistake was detected much later than it ideally
could have been.

After the fix, it is now correct not to ensure the twigs are mutable,
because they are about to be copied to a larger vector. Instead, we
need to find out whether `squash_twigs()` destroyed the old twigs, and
adjust the refcounts accordingly.
2023-02-27 13:47:25 +00:00
Tony Finch 6b9ddbd1ce Add a qp-trie data structure
A qp-trie is a kind of radix tree that is particularly well-suited to
DNS servers. I invented the qp-trie in 2015, based on Dan Bernstein's
crit-bit trees and Phil Bagwell's HAMT. https://dotat.at/prog/qp/

This code incorporates some new ideas that I prototyped using
NLnet Labs NSD in 2020 (optimizations for DNS names as keys)
and 2021 (custom allocator and garbage collector).
https://dotat.at/cgi/git/nsd.git

The BIND version of my qp-trie code has a number of improvements
compared to the prototype developed for NSD.

  * The main omission in the prototype was the very sketchy outline of
    how locking might work. Now the locking has been implemented,
    using a reader/writer lock and a mutex. However, it is designed to
    benefit from liburcu if that is available.

  * The prototype was designed for two-version concurrency, one
    version for readers and one for the writer. The new code supports
    multiversion concurrency, to provide a basis for BIND's dbversion
    machinery, so that updates are not blocked by long-running zone
    transfers.

  * There are now two kinds of transaction that modify the trie: an
    `update` aims to support many very small zones without wasting
    memory; a `write` avoids unnecessary allocation to help the
    performance of many small changes to the cache.

  * There is also a single-threaded interface for situations where
    concurrent access is not necessary.

  * The API makes better use of types to make it more clear which
    operations are permitted when.

  * The lookup table used to convert a DNS name to a qp-trie key is
    now initialized by a run-time constructor instead of a programmer
    using copy-and-paste. Key conversion is more flexible, so the
    qp-trie can be used with keys other than DNS names.

  * There has been much refactoring and re-arranging things to improve
    the terminology and order of presentation in the code, and the
    internal documentation has been moved from a comment into a file
    of its own.

Some of the required functionality has been stripped out, to be
brought back later after the basics are known to work.

  * Garbage collector performance statistics are missing.

  * Fancy searches are missing, such as longest match and
    nearest match.

  * Iteration is missing.

  * Search for update is missing, for cases where the caller needs to
    know if the value object is mutable or not.
2023-02-27 13:47:25 +00:00
Evan Hunt 7975b785fd Support for relative names in unit tests
The dns_test_namefromstring() function can now generate relative
names, and all the tests that used it before it have been updated
to use FQDNs.
2023-02-27 13:47:25 +00:00
Arаm Sаrgsyаn 0165fdba5e Merge branch '3900-placeholder' into 'main'
Add a CHANGES placeholder for [GL #3900]

See merge request isc-projects/bind9!7606
2023-02-27 13:20:19 +00:00
Aram Sargsyan 4c22aae748 Add a CHANGES placeholder for [GL #3900] 2023-02-27 13:10:22 +00:00
Tony Finch 5f2f43e684 Merge branch 'fanf-dns-name-maxlabels' into 'main'
Define DNS_NAME_MAXLABELS and DNS_NAME_LABELLEN

See merge request isc-projects/bind9!7598
2023-02-27 12:08:52 +00:00
Tony Finch c6bf51492d Define DNS_NAME_MAXLABELS and DNS_NAME_LABELLEN
Some qp-trie operations will need to know the maximum number of labels
in a name, so I wanted a standard macro definition with the right
value.

Replace DNS_MAX_LABELS from <dns/resolver.h with DNS_NAME_MAXLABELS in
<dns/name.h>, and add its counterpart DNS_NAME_LABELLEN.

Use these macros in `name.c` and `resolver.c`.

Fix an off-by-one error in an assertion in `dns_name_countlabels()`.
2023-02-27 11:27:12 +00:00
Arаm Sаrgsyаn c3ae4e125c Merge branch '3777-fix-crash-after-failed-ixfr-from-differences' into 'main'
Resolve "crash after failed ixfr-from-differences on a catalog zone"

Closes #3777

See merge request isc-projects/bind9!7431
2023-02-27 11:25:00 +00:00
Aram Sargsyan 46b1c558ce Add a CHANGES note for [GL #3777] 2023-02-27 10:06:32 +00:00
Aram Sargsyan cf79692a66 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.
2023-02-27 10:06:32 +00:00
Aram Sargsyan 0ef0c86632 Searching catzs->zones requires a read lock
Lock the catzs->lock mutex before searching in the catzs->zones
hash table.
2023-02-27 10:06:32 +00:00
Aram Sargsyan ed268b46f1 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().
2023-02-27 10:06:32 +00:00
Aram Sargsyan a73b67456e 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.
2023-02-27 10:06:32 +00:00
Mark Andrews 01cd25efd8 Merge branch '3895-memory-leak-in-isc_hmac_init' into 'main'
Resolve "memory leak in isc_hmac_init"

Closes #3895

See merge request isc-projects/bind9!7588
2023-02-26 23:17:35 +00:00
Mark Andrews cf5f133679 Fix memory leak in isc_hmac_init
If EVP_DigestSignInit failed 'pkey' was not freed.
2023-02-26 22:56:07 +00:00
Arаm Sаrgsyаn 664bfb1cb6 Merge branch 'aram/catz-do-not-destroy-catzs-before-catz' into 'main'
Make sure catz->catzs isn't destroyed before catz

See merge request isc-projects/bind9!7603
2023-02-24 20:31:08 +00:00
Aram Sargsyan 030ffbf475 Make sure catz->catzs isn't destroyed before catz
Call dns_catz_unref_catzs() only after detaching 'catz'.
2023-02-24 19:40:34 +00:00
Ondřej Surý 56c543a3bc Merge branch '3881-catz-offload' into 'main'
Resolve "Run the catalog zone update as an offloaded work"

Closes #3881

See merge request isc-projects/bind9!7560
2023-02-24 16:11:58 +00:00
Aram SargsyanandOndřej Surý cb1cd67bea Add CHANGES and release notes for [GL #3881] 2023-02-24 17:06:18 +01:00
Ondřej Surý 4e7187601f 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.
2023-02-24 17:06:18 +01:00
Ondřej Surý b1cd4a066a 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.
2023-02-24 17:04:33 +01:00
Aram SargsyanandOndřej Surý 0b96c9234f 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.
2023-02-24 15:18:02 +01:00
Ondřej Surý afdb16dc01 Merge branch 'aram/catz-add-shutdown-signaling' into 'main'
Add shutdown signaling for catalog zones

See merge request isc-projects/bind9!7602
2023-02-24 14:08:20 +00:00
Aram SargsyanandOndřej Surý c76cc58803 Add a CHANGES note for [GL !7571] 2023-02-24 15:07:14 +01:00
Aram SargsyanandOndřej Surý 246b7084d6 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.
2023-02-24 15:06:54 +01:00
Ondřej Surý 94ee6f6672 Merge branch 'aram/catz-light-refactoring-and-reference-count-tracing' into 'main'
Implement reference count tracing for dns_catz_zone_t and dns_catz_zones_t

See merge request isc-projects/bind9!7570
2023-02-24 14:06:06 +00:00
Aram SargsyanandOndřej Surý c29299aa15 Add a CHANGES note for [GL !7570] 2023-02-24 15:00:44 +01:00
Aram SargsyanandOndřej Surý 2a52d30660 Call dns_catz_new_zones() only when it is needed
The configure_catz() function creates the catalog zones structure
for the view even when it is not needed, in which case it then
discards it (by detaching) later.

Instead, call dns_catz_new_zones() only when it is needed, i.e. when
there is no existing "previous" view with an existing 'catzs', that
is going to be reused.
2023-02-24 15:00:26 +01:00
Aram SargsyanandOndřej Surý 53f0c5a9ac 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.
2023-02-24 15:00:26 +01:00
Aram SargsyanandOndřej Surý 8cb79fec9d 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'.
2023-02-24 15:00:26 +01:00
Michal Nowak 52c9a5b2f5 Merge branch 'mnowak/freebsd-12.4' into 'main'
Add FreeBSD 12.4

See merge request isc-projects/bind9!7169
2023-02-24 12:58:38 +00:00
Michal Nowak 2307661b1a Add FreeBSD 12.4 2023-02-24 13:40:30 +01:00
Michal Nowak 5f805417cf Merge branch 'mnowak/alpine-3.17' into 'main'
Add Alpine Linux 3.17

See merge request isc-projects/bind9!7586
2023-02-24 11:46:50 +00:00
Michal Nowak 5783280b10 Drop date from "Regularly Tested Platforms" section
Changing the date is easy to forget and may be outdated.
2023-02-24 11:50:57 +01:00
Michal Nowak 345089ad23 Add Alpine Linux 3.17 2023-02-24 11:50:57 +01:00
Tony Finch d2a450d308 Merge branch 'fanf-prune-libirs' into 'main'
Move irs_resconf into libdns and remove libirs

See merge request isc-projects/bind9!7463
2023-02-24 10:01:05 +00:00
Tony Finch 330ff06d4a Move irs_resconf into libdns and remove libirs
`libirs` used to be a reference implementation of `getaddrinfo` and
related modern resolver APIs. It was stripped down in BIND 9.18
leaving only the `irs_resconf` module, which parses
`/etc/resolv.conf`. I have kept its include path and namespace prefix,
so it remains a little fragment of libirs now embedded in libdns.
2023-02-24 09:38:59 +00:00
Ondřej Surý 5ad1fe3570 Merge branch 'ondrej-restore-sonarcloud-analysis' into 'main'
Add SonarCloud GitHub Action

See merge request isc-projects/bind9!7589
2023-02-24 08:53:45 +00:00
Ondřej Surý 4bfbb4ddf7 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.
2023-02-24 08:53:41 +00:00
Evan Hunt 14bba4688c Merge branch '3886-xfrin-dispatch' into 'main'
refactor dns_xfrin to use dns_dispatch

Closes #3886

See merge request isc-projects/bind9!7573
2023-02-24 08:30:48 +00:00
Evan Hunt 55f00de18e CHANGES for [GL #3886] 2023-02-24 08:30:33 +00:00
Evan Hunt 4e93d44c74 fix a bug in dns_dispatch_getnext()
when a message arrives over a TCP connection matching an expected
QID, the dispatch is updated so it no longer expects that QID,
but continues reading. subsequent messages with the same QID are
ignored, unless the dispatch entry has called dns_dispatch_getnext()
or dns_dispatch_resume().

however, a coding error caused those functions to have no effect
when the dispatch was reading, so streams of messages with the same
QID could not be received over a single TCP connection, breaking *XFR.

this has been corrected by changing the order of operations in
tcp_dispatch_getnext() so that disp->reading isn't checked until
after the dispatch entry has been reactivated.
2023-02-24 08:30:33 +00:00
Evan Hunt f0c766abec refactor dns_xfrin to use dns_dispatch
the dns_xfrin module was still using the network manager directly to
manage TCP connections and send and receive messages.  this commit
changes it to use the dispatch manager instead.
2023-02-24 08:30:33 +00:00
Evan Hunt a4c8decc6a implement refcount tracing in xfrin.c
use ISC_REFCOUNT_IMPL for dns_xfrin_ctx_t (which has been renamed
to dns_xfrin_t to keep the function names dns_xfrin_attach() and
dns_xfrin_detach() unchanged).
2023-02-24 08:30:33 +00:00
Evan Hunt d72419d1f5 minor cleanups in dispatch.c
- simplified tcp_startrecv()
- removed a short function that was only called once
- removed an unnecessary if statement
2023-02-24 08:30:33 +00:00
Evan Hunt 1dd42a80d6 log the xfrin pointer address in xfrin_log()
to make it easier to trace xfrin events in the log, include
the address of the dns_xfrin_t object in all xfrin log messages.
2023-02-24 08:30:33 +00:00
Evan Hunt 9d37621012 remove dead code in dns_request
the 'connected' variable in 'dns_request_create()` was always false.
2023-02-24 08:30:33 +00:00
Evan Hunt ae5ba54fbe move dispatchmgr from resolver to view
the 'dispatchmgr' member of the resolver object is used by both
the dns_resolver and dns_request modules, and may in the future
be used by others such as dns_xfrin. it doesn't make sense for it
to live in the resolver object; this commit moves it into dns_view.
2023-02-24 08:30:33 +00:00
Michal Nowak ec33efe351 Merge branch 'mnowak/update_TEST_PARALLEL_JOBS_for_BSD' into 'main'
Disable OpenBSD system test parallelism in CI

See merge request isc-projects/bind9!7585
2023-02-24 08:16:14 +00:00
Michal Nowak d73eba57bd 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.
2023-02-24 08:59:18 +01:00
Michal Nowak cf46addf51 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.
2023-02-24 08:59:18 +01:00
Tony Finch dfed03f094 Merge branch 'fanf-qsbr' into 'main'
QSBR: safe memory reclamation for lock-free data structures

See merge request isc-projects/bind9!7290
2023-02-23 16:43:56 +00:00
Tony Finch 9b7aa536ba QSBR: safe memory reclamation for lock-free data structures
This "quiescent state based reclamation" module provides support for
the qp-trie module in dns/qp. It is a replacement for liburcu, written
without reference to the urcu source code, and in fact it works in a
significantly different way.

A few specifics of BIND make this variant of QSBR somewhat simpler:

  * We can require that wait-free access to a qp-trie only happens in
    an isc_loop callback. The loop provides a natural quiescent state,
    after the callbacks are done, when no qp-trie access occurs.

  * We can dispense with any API like rcu_synchronize(). In practice,
    it takes far too long to wait for a grace period to elapse for each
    write to a data structure.

  * We use the idea of "phases" (aka epochs or eras) from EBR to
    reduce the amount of bookkeeping needed to track memory that is no
    longer needed, knowing that the qp-trie does most of that work
    already.

I considered hazard pointers for safe memory reclamation. They have
more read-side overhead (updating the hazard pointers) and it wasn't
clear to me how to nicely schedule the cleanup work. Another
alternative, epoch-based reclamation, is designed for fine-grained
lock-free updates, so it needs some rethinking to work well with the
heavily read-biased design of the qp-trie. QSBR has the fastest read
side of the basic SMR algorithms (with no barriers), and fits well
into a libuv loop. More recent hybrid SMR algorithms do not appear to
have enough benefits to justify the extra complexity.
2023-02-23 15:57:53 +00:00
Tony Finch 5e8aa4982b Merge branch 'fanf-refcount-trace-tid' into 'main'
Include thread ID in refcount trace output

See merge request isc-projects/bind9!7584
2023-02-23 14:28:34 +00:00
Tony Finch 63cd73d43e Include thread ID in refcount trace output 2023-02-23 14:28:27 +00:00
Arаm Sаrgsyаn 4e1bddc6e0 Merge branch 'aram/catz-remove-unused-catzs-loop' into 'main'
Remove catzs->loop

See merge request isc-projects/bind9!7569
2023-02-23 09:39:17 +00:00
Aram Sargsyan 18d67fa916 Remove catzs->loop
The 'loop' member of the dns_catz_zones structure is not used.
2023-02-23 08:56:37 +00:00
Evan Hunt 211ec73f41 Merge branch '3778-empty-include' into 'main'
fix a crash from using an empty string for "include"

Closes #3778

See merge request isc-projects/bind9!7572
2023-02-22 17:36:13 +00:00
Evan Hunt dc27552c30 remove isc_glob
the isc_glob module was originally needed to support posix-style glob
processing on Windows, but is now just an unnecessary wrapper around
glob(3). this commit removes it.
2023-02-22 17:35:29 +00:00
Evan Hunt 4dfc3f056d fix a crash from using an empty string for "include"
the parser could crash when "include" specified an empty string in place
of the filename. this has been fixed by returning ISC_R_FILENOTFOUND
when the string length is 0.
2023-02-22 17:35:29 +00:00
Tony Finch 7aa0ee4f5e Merge branch 'fanf-atomic-lists' into 'main'
Simple lock-free singly-linked stack

See merge request isc-projects/bind9!7470
2023-02-22 17:05:51 +00:00
Ondřej SurýandTony Finch 6eb1340d1b Use atomic stack for async job queue
Previously, the async job queue would use a locked-list (ISC_LIST).
With introduction of atomic stack (that has to be drained at once), we
could use it to remove some contention between the threads and simplify
the async queue.

Fortunately, the reverse order still works for us - instead of append
and tail/prev operation on the list, we are now using prepend and
head/next operation on the atomic stack.
2023-02-22 16:13:37 +00:00
Tony Finch 36e56923ce Simple lock-free stack in <isc/stack.h>
Add a singly-linked stack that supports lock-free prepend and drain (to
empty the list and clean up its elements).  Intended for use with QSBR
to collect objects that need safe memory reclamation, or any other user
that works with adding objects to the stack and then draining them in
one go like various work queues.

In <isc/atomic.h>, add an `atomic_ptr()` macro to make type
declarations a little less abominable, and clean up a duplicate
definition of `atomic_compare_exchange_strong_acq_rel()`
2023-02-22 16:13:37 +00:00
Tom Krizek 29a7507b04 Merge branch '3622-serve-stale-rrsig-test' into 'main'
[CVE-2022-3736] Test RRSIG queries with serve-stale enabled

Closes #3622

See merge request isc-projects/bind9!7578
2023-02-22 12:57:09 +00:00
Mark AndrewsandTom Krizek add40273df Test RRSIG queries with serve-stale enabled
Make RRSIG queries where the existing tests trigger a DNS_EVENT_TRYSTALE
event.
2023-02-22 13:22:02 +01:00
Tom Krizek af33cd479b Merge branch '3619-serve-stale-client-timeout-crash-test' into 'main'
[CVE-2022-3924] Add a reproducer for the serve-stale crash when recursive clients soft quota is reached

Closes #3619

See merge request isc-projects/bind9!7575
2023-02-22 11:54:42 +00:00
Aram SargsyanandTom Krizek 4b52b0b4a9 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.
2023-02-22 10:39:06 +01:00
Evan Hunt 1fb5d42416 Merge branch '3873-cleanup-task-timer-refs' into 'main'
remove references to obsolete isc_task/timer functions

Closes #3873

See merge request isc-projects/bind9!7568
2023-02-22 08:13:47 +00:00
Evan Hunt b058f99cb8 remove references to obsolete isc_task/timer functions
removed references in code comments, doc/dev documentation, etc, to
isc_task, isc_timer_reset(), and isc_timertype_inactive. also removed a
coccinelle patch related to isc_timer_reset() that was no longer needed.
2023-02-22 08:13:30 +00:00
Evan Hunt ee186855bf Merge branch 'each-no-sdb' into 'main'
remove SDB API and refactor builtin databases

Closes #3882

See merge request isc-projects/bind9!7558
2023-02-22 06:32:37 +00:00
Evan Hunt dee4939299 CHANGES for [GL #3882] 2023-02-21 10:13:34 -08:00
Evan Hunt aea4f10817 make builtin a standalone dns_db implementation
instead of using the SDB API as a wrapper to register and
unregister and provide a call framework for the builtin databases,
this commit flattens things so that the builtin databases implement
dns_db directly.
2023-02-21 10:13:10 -08:00
Evan Hunt 603cdb6332 move the dns_sdb API
move all dns_sdb code into bin/named/builtin.c, which is the
only place from which it's called.

(note this is temporary: later we'll refactor builtin so that it's a
standalone dns_db implementation on its own instead of using SDB
as a wrapper.)
2023-02-21 10:13:10 -08:00
Evan Hunt 77e7eac54c enable detailed db tracing
move database attach/detach functions to db.c, instead of
requiring them to be implemented for every database type.
instead, they must implement a 'destroy' function that is
called when references go to zero.

this enables us to use ISC_REFCOUNT_IMPL for databases,
with detailed tracing enabled by setting DNS_DB_TRACE to 1.
2023-02-21 10:13:10 -08:00
Evan Hunt 8da43bb7f5 simplify dns_sdb API
SDB is currently (and foreseeably) only used by the named
builtin databases, so it only needs as much of its API as
those databases use.

- removed three flags defined for the SDB API that were always
  set the same by builtin databases.

- there were two different types of lookup functions defined for
  SDB, using slightly different function signatures. since backward
  compatibility is no longer a concern, we can eliminate the 'lookup'
  entry point and rename 'lookup2' to 'lookup'.

- removed the 'allnodes' entry point and all database iterator
  implementation code

- removed dns_sdb_putnamedrr() and dns_sdb_putnamedrdata() since
  they were never used.
2023-02-21 10:13:10 -08:00
Evan Hunt ffa4757c79 use member name initialization for methods
initialize dns_dbmethods, dns_sdbmethods and dns_rdatasetmethods
using explicit struct member names, so we don't have to keep track
of NULLs for unimplemented functions any longer.
2023-02-21 10:13:10 -08:00
Evan Hunt 8036412aaa make fewer dns_db functions mandatory-to-implement
some dns_db functions would have crashed if the DB implementation failed
to implement them, requiring the implementations to add functions that
did nothing but return ISC_R_NOTIMPLEMENTED or some obvious default
value. we can just have the dns_db wrapper functions themselves return
those values, and clean up the implementations accordingly.
2023-02-21 10:13:10 -08:00
Evan Hunt c90fafa45d remove rdatalist_p.h
make the private isc__rdatalist_* functions public dns_rdatalist
functions so that all the rdatalist primitives can be used by
callers to libdns. (this will be needed later for moving SDB and
SDLZ out of libdns.)
2023-02-21 10:13:10 -08:00
Matthijs Mekking c283850cc3 Merge branch 'matthijs-fix-kasp-attach-detach-usage' into 'main'
Fix kasp attach detach usage

See merge request isc-projects/bind9!7563
2023-02-21 15:45:12 +00:00
Mark AndrewsandMatthijs Mekking b41882cc75 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.
2023-02-21 15:47:44 +01:00
Tony Finch caafb15e1e Merge branch 'fanf-prune-libbind9' into 'main'
Move the last bits of libbind9 into libisc

See merge request isc-projects/bind9!7462
2023-02-21 13:12:44 +00:00
Tony Finch 8bb5f37fd4 Add CHANGES and release note
[cleanup]	Move bind9_getaddresses() to isc_getaddresses()
		and remove the now empty libbind9.
2023-02-21 13:12:26 +00:00
Tony Finch 4da9c582b8 Remove libbind9
It is now empty.
2023-02-21 13:12:26 +00:00
Tony Finch 3fef7c626a Move bind9_getaddresses() to isc_getaddresses()
No need to have a whole library for one function.
2023-02-21 13:12:26 +00:00
Mark Andrews b2923ce356 Merge branch '3884-cid-436299-null-pointer-dereference-in-lib-dns-resolver-c' into 'main'
Resolve "CID 436299: Null pointer dereference in lib/dns/resolver.c"

Closes #3884

See merge request isc-projects/bind9!7562
2023-02-21 12:58:25 +00:00
Mark Andrews 9c17f4353b Cleanup left over 'fctx != NULL' test following refactoring
This was causing 'CID 436299: Null pointer dereferences (REVERSE_INULL)'
in Coverity.  Also removed an 'INSIST(fctx != NULL);' that should
no longer be needed.
2023-02-21 12:22:27 +00:00
Arаm Sаrgsyаn 69b39899d5 Merge branch '3880-fix-rpz-assertion-failure-during-failed-reconfiguration' into 'main'
Detach rpzs and catzs from the previous view

Closes #3880

See merge request isc-projects/bind9!7552
2023-02-21 09:01:27 +00:00
Aram Sargsyan b086374b1d Add a CHANGES note for [GL #3880] 2023-02-21 08:23:59 +00:00
Aram Sargsyan 121a095a22 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.
2023-02-21 08:23:13 +00:00
Aram Sargsyan 95f4bac002 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.
2023-02-21 08:23:13 +00:00
Evan Hunt 1efbca6856 Merge branch 'each-cleanup-gethostname' into 'main'
remove named_os_gethostname()

See merge request isc-projects/bind9!7555
2023-02-18 20:23:56 +00:00
Evan Hunt 197334464e 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.
2023-02-18 20:23:41 +00:00
Mark Andrews 345dc4d505 Merge branch '3879-hmac_createctx-fails-to-free-context-on-isc_hmac_init-failure' into 'main'
Resolve "hmac_createctx fails to free context on isc_hmac_init failure"

Closes #3879

See merge request isc-projects/bind9!7549
2023-02-17 22:29:28 +00:00
Mark Andrews d22257a370 In hmac_createctx free ctx on isc_hmac_init failure 2023-02-17 21:58:56 +00:00
Michal Nowak b131c60bf5 Merge branch 'mnowak/qa-tools-update' into 'main'
Python formatting updates

See merge request isc-projects/bind9!7551
2023-02-17 15:00:07 +00:00
Michal Nowak 8064ac6bec 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)
2023-02-17 15:31:52 +01:00
Michal Nowak 3cd2cc6254 Adapt to Python scripts to black 23.1.0 2023-02-17 15:31:52 +01:00
Tony Finch 000f885614 Merge branch 'fanf-libbind9-libisccfg' into 'main'
Move bind9/check to isccfg/check

See merge request isc-projects/bind9!7461
2023-02-17 12:50:39 +00:00
Tony Finch dcb54af220 Move bind9/check to isccfg/check
Since it is part of the configuration machinery
2023-02-17 12:13:37 +00:00
Ondřej Surý 6ba2579c67 Merge branch 'ondrej-further-dns_validator-refactoring' into 'main'
additional refactoring of dns_validator

See merge request isc-projects/bind9!7546
2023-02-17 06:22:03 +00:00
Evan HuntandOndřej Surý e49350721f CHANGES for [GL #3797] 2023-02-17 07:18:25 +01:00
Evan HuntandOndřej Surý 1ee30be7ce remove validator lock
as every validator function is loop-synchronized, it should no longer be
necessary to use a validator lock.

calling dns_validator_send(), dns_validator_cancel() or
dns_validator_destroy() from a thread other than the one on which the
validator is running will now cause an assertion failure; this should be
fine since the validator and resolver are tightly coupled, and the fetch
contexts and validators run in the same loops.
2023-02-17 07:18:25 +01:00
Ondřej Surý 7da99414c0 Implement proper reference counting in dns_validator
use reference counting in dns_validator to prevent use after free.
2023-02-17 07:18:25 +01:00
Evan HuntandOndřej Surý b4715a34a0 additional refactoring of dns_validator
refactor validator so that the validation status object (previously
called dns_valstatus_t, which was derived from dns_validatorevent_t), is
now part of the dns_validator object.  when calling validator callbacks,
the validator itself is now sent as the argument.

(note: this necessitates caution in the callback functions that are
internal to validator.c validators spawn other validators, and it can be
confusing at times whether we need to be looking at val, val->subvalidator,
or val->parent.)
2023-02-17 07:18:25 +01:00
Ondřej Surý da0f154bc7 Merge branch '3875-dont-unlink-before-expire_entry' into 'main'
Don't remove ADB entry from LRU before trying to expire it

Closes #3875

See merge request isc-projects/bind9!7544
2023-02-17 06:18:15 +00:00
Ondřej Surý 668d287d01 Don't remove ADB entry from LRU before trying to expire it
There was a code flow error that would remove the expired ADB entry from
the LRU list and then a check in the expire_entry() would cause
assertion error because it expect the ADB entry to be linked.

Additionally, the expire mechanism would loop for cases when we would
held only a read rwlock; in such case we need to upgrade the lock and
try again, not just try again.
2023-02-17 07:16:50 +01:00
Ondřej Surý 51e0b8994e Merge branch '3797-part9-remove-isc_task-completely' into 'main'
remove isc_task completely

Closes #3797

See merge request isc-projects/bind9!7537
2023-02-16 17:35:49 +00:00
Evan HuntandOndřej Surý a52b17d39b remove isc_task completely
as there is no further use of isc_task in BIND, this commit removes
it, along with isc_taskmgr, isc_event, and all other related types.

functions that accepted taskmgr as a parameter have been cleaned up.
as a result of this change, some functions can no longer fail, so
they've been changed to type void, and their callers have been
updated accordingly.

the tasks table has been removed from the statistics channel and
the stats version has been updated. dns_dyndbctx has been changed
to reference the loopmgr instead of taskmgr, and DNS_DYNDB_VERSION
has been udpated as well.
2023-02-16 18:35:32 +01:00
Ondřej Surý b7952c6fa7 Merge branch '3797-part8-catz-delzone-refactoring' into 'main'
refactor catz and addzone/delzone to use task

See merge request isc-projects/bind9!7373
2023-02-16 17:35:09 +00:00
Evan HuntandOndřej Surý a9f9041fe6 refactor dns_catz to use loop callbacks
catz events are now scheduled using isc_task_async() instead
of isc_task_send().
2023-02-16 17:51:55 +01:00
Evan HuntandOndřej Surý 9bdf982ea6 refactor delzone to use loop callbacks
the rmzone() function is now posted using isc_async_run().

dns_zone_gettask() is no longer used anywhere, and has been
removed.
2023-02-16 17:51:55 +01:00
Evan HuntandOndřej Surý f58e7c28cd switch to using isc_loopmgr_pause() instead of task exclusive
change functions using isc_taskmgr_beginexclusive() to use
isc_loopmgr_pause() instead.

also, removed an unnecessary use of exclusive mode in
named_server_tcptimeouts().

most functions that were implemented as task events because they needed
to be running in a task to use exclusive mode have now been changed
into loop callbacks instead. (the exception is catz, which is being
changed in a separate commit because it's a particularly complex change.)
2023-02-16 17:51:55 +01:00
Ondřej Surý 5a028a40b6 Merge branch '3797-part7-resolver-refactoring' into 'main'
refactor dns_resolver to use loop callbacks

See merge request isc-projects/bind9!7372
2023-02-16 16:50:46 +00:00
Evan HuntandOndřej Surý 0312789129 refactor dns_resolver to use loop callbacks
callback events from dns_resolver_createfetch() are now posted
using isc_async_run.

other modules which called the resolver and maintained task/taskmgr
objects for this purpose have been cleaned up.
2023-02-16 17:27:59 +01:00
Ondřej Surý 8f90424d12 Merge branch '3797-part6-refactor-callbacks' into 'main'
refactor various callbacks

See merge request isc-projects/bind9!7371
2023-02-16 16:20:26 +00:00
Evan HuntandOndřej Surý bba46be63d refactor dns_client to use loop callbacks
dns_client now uses isc_async_run() internally to post
client-resume events. (a task is still used for
dns_resolver_createfetch(), however.)
2023-02-16 17:16:42 +01:00
Evan HuntandOndřej Surý 83593167cd refactor dyndb sample driver to use loop callbacks
the syncptr function in the dyndb sample driver now uses
isc_async_run().
2023-02-16 17:16:42 +01:00
Evan HuntandOndřej Surý b061c7e27f refactor plugin hook resumption to use loop callbacks
plugins supporting asynchronous operation now use a loop callback
to resume operation in query_hookresume() rather than a task.
2023-02-16 17:16:41 +01:00
Evan HuntandOndřej Surý 773d47c95c refactor TAT queries to use loop callbacks
trust anchor telemetry events are now posted via isc_async_run().
(an isc_task is still used for dns_resolver_createfetch().)
2023-02-16 17:16:41 +01:00
Ondřej Surý 90544bd5f9 Merge branch '3797-part5-update-processing' into 'main'
refactor update processing to use loop callbacks

See merge request isc-projects/bind9!7370
2023-02-16 16:11:53 +00:00
Evan HuntandOndřej Surý 327b95566d refactor update processing to use loop callbacks
update processing now uses loop callbacks instead of task events.
2023-02-16 16:34:20 +01:00
Ondřej Surý 6d7fdb884c Merge branch '3797-part3-request-refactoring' into 'main'
refactor libdns modules to use loop callbacks

See merge request isc-projects/bind9!7367
2023-02-16 15:15:18 +00:00
Evan HuntandOndřej Surý 7a78a85b35 refactor dns_validator to use loop callbacks
The validator now uses loop callbacks to post its completion
events. (A task is still used for the fetches.)
2023-02-16 14:55:06 +01:00
Evan HuntandOndřej Surý 31aee2ef9c refactor dns_adb to use loop callbacks
The callbacks from dns_abd_createfind() are now posted using
isc_async_run() instead of isc_task_send().  ADB event types
have been replaced with a new dns_adbstatus_t type which is
included as find->status.

(The ADB still uses a task for dns_resolver_createfetch().)
2023-02-16 14:55:06 +01:00
Evan HuntandOndřej Surý 106da9c190 refactor dns_request to use loopmgr callbacks
dns_request_create() and _createraw() now take a 'loop' parameter
and run the callback event on the specified loop.

as the task manager is no longer used, it has been removed from
the dns_requestmgr structure.  the dns_resolver_taskmgr() function
is also no longer used and has been removed.
2023-02-16 14:55:06 +01:00
Tony Finch d3e2b680d0 Merge branch 'fanf-simplify-view-detach' into 'main'
Simplify locking in dns_view_detach()

See merge request isc-projects/bind9!7538
2023-02-16 13:44:28 +00:00
Tony FinchandTony Finch eb6b31b6f2 Simplify locking in dns_view_detach()
Lock just once, and shut down the resolver, adb, and requestmgr after
unlocking, like the zone table, managed keys zone, and redirect zone.
2023-02-16 13:44:17 +00:00
Tony Finch 97663836ea Merge branch 'fanf-avoid-fortify-source-redefinition' into 'main'
Avoid redefining _FORTIFY_SOURCE

See merge request isc-projects/bind9!7539
2023-02-16 13:43:56 +00:00
Tony Finch b0377f798f Avoid redefining _FORTIFY_SOURCE
Some compilers have a built-in definition of the _FORTIFY_SOURCE macro
that differs from BIND's preferred setting. This causes errors like
the one quoted below. The solution is to undefine the macro before
defining it. A similar fix was recently committed to glibc.

    <command line>: error: '_FORTIFY_SOURCE' macro redefined
    #define _FORTIFY_SOURCE 2
            ^
    <built-in>: note: previous definition is here
    #define _FORTIFY_SOURCE 0
	    ^

https://sourceware.org/git/glibc.git/commitdiff/35bcb08eaa953c9b
2023-02-16 13:43:40 +00:00
Michal Nowak 3203d6c549 Merge tag 'v9_19_10'
BIND 9.19.10
2023-02-16 13:38:33 +01:00
Mark Andrews cf002b41b0 Merge branch '3869-dig-fails-to-cleanup-openssl-references' into 'main'
Resolve "Dig fails to cleanup OpenSSL references"

Closes #3869

See merge request isc-projects/bind9!7535
2023-02-16 00:16:49 +00:00
Mark Andrews e27fc4bbc5 Cleanup OpenSSL reference on bad option
Another exit path that needs to be cleaned up.
2023-02-16 10:55:42 +11:00
Mark Andrews 4c2525c418 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.
2023-02-16 10:55:41 +11:00
Tony Finch 997fde6179 Merge branch 'fanf-prune-isc-headers' into 'main'
Remove several do-nothing headers from libisc

See merge request isc-projects/bind9!7464
2023-02-15 16:45:51 +00:00
Tony Finch 9892ac791c Add CHANGES note
[cleanup]	Several nugatory headers have been removed from libisc
2023-02-15 16:44:47 +00:00
Tony Finch f9c725d7d4 Remove do-nothing header <isc/stat.h>
Use <sys/stat.h> instead
2023-02-15 16:44:47 +00:00
Tony Finch 6927a30926 Remove do-nothing header <isc/print.h>
This one really truly did nothing. No lines added!
2023-02-15 16:44:47 +00:00
Tony Finch c7615bc28d Remove do-nothing header <isc/offset.h>
And replace all uses of isc_offset_t with standard off_t
2023-02-15 16:44:47 +00:00
Tony Finch bed09c1676 Remove do-nothing header <isc/netdb.h>
Not needed since we dropped Windows support
2023-02-15 16:44:47 +00:00
Tony Finch 9bcc434dad Merge branch 'fanf-clarify-strerror' into 'main'
Explain <isc/strerr.h> a little more

See merge request isc-projects/bind9!7465
2023-02-15 16:44:30 +00:00
Tony Finch b0893ae09a Explain <isc/strerr.h> a little more
The purpose of the `strerror_r()` wrapper was not obvious.
2023-02-15 16:44:09 +00:00
Tony Finch fe8e7e5958 Merge branch 'fanf-deprecate-deprecated' into 'main'
Deprecate <isc/deprecated.h>

See merge request isc-projects/bind9!7466
2023-02-15 16:04:28 +00:00
Tony FinchandTony Finch 75f7a85a39 Deprecate <isc/deprecated.h>
We refactor more freely these days.
2023-02-15 15:36:20 +00:00
Tony FinchandTony Finch 97b64f4970 Remove deprecated dns_db_rpz_*() methods
As well as the function wrappers, their slots have been removed from
the dns_dbmethods table.
2023-02-15 15:35:50 +00:00
Ondřej Surý 137bb3cf8f Merge branch '1609-add-modified-C-RW-WP-rwlock' into 'main'
Add the reader-writer synchronization with modified C-RW-WP

Closes #1609

See merge request isc-projects/bind9!7528
2023-02-15 09:22:15 +00:00
Ondřej Surý 459db4462f Add CHANGES note for [GL #1609] 2023-02-15 09:30:21 +01:00
Ondřej Surý c194ff5d77 Use C-RW-WP lock in the dns_adb unit
Replace the isc_mutex in the dns_adb unit with isc_rwlock for better
performance.  Both ADB names and ADB entries hashtables and LRU are now
using isc_rwlock.
2023-02-15 09:30:04 +01:00
Ondřej Surý 3d3d3b8c58 Use C-RW-WP lock in the dns_resolver unit
Replace the isc_mutex with isc_rwlock in the dns_resolver unit,
specifically, both fetch context and fetch counters now uses the C-RW-WP
locks.
2023-02-15 09:30:04 +01:00
Ondřej SurýandOndřej Surý 6ffda5920e Add the reader-writer synchronization with modified C-RW-WP
This changes the internal isc_rwlock implementation to:

  Irina Calciu, Dave Dice, Yossi Lev, Victor Luchangco, Virendra
  J. Marathe, and Nir Shavit.  2013.  NUMA-aware reader-writer locks.
  SIGPLAN Not. 48, 8 (August 2013), 157–166.
  DOI:https://doi.org/10.1145/2517327.24425

(The full article available from:
  http://mcg.cs.tau.ac.il/papers/ppopp2013-rwlocks.pdf)

The implementation is based on the The Writer-Preference Lock (C-RW-WP)
variant (see the 3.4 section of the paper for the rationale).

The implemented algorithm has been modified for simplicity and for usage
patterns in rbtdb.c.

The changes compared to the original algorithm:

  * We haven't implemented the cohort locks because that would require a
    knowledge of NUMA nodes, instead a simple atomic_bool is used as
    synchronization point for writer lock.

  * The per-thread reader counters are not being used - this would
    require the internal thread id (isc_tid_v) to be always initialized,
    even in the utilities; the change has a slight performance penalty,
    so we might revisit this change in the future.  However, this change
    also saves a lot of memory, because cache-line aligned counters were
    used, so on 32-core machine, the rwlock would be 4096+ bytes big.

  * The readers use a writer_barrier that will raise after a while when
    readers lock can't be acquired to prevent readers starvation.

  * Separate ingress and egress readers counters queues to reduce both
    inter and intra-thread contention.
2023-02-15 09:30:04 +01:00
Ondřej Surý af12241f67 Add missing <isc/atomic.h> include to dns/badcache.c
The dns_badcache was pulling the <isc/atomic.h> header only indirectly
via <isc/rwlock.h>, add the direct include as the <isc/rwlock.h> no
longer pulls the header when pthread_rwlock is used.
2023-02-15 09:30:04 +01:00
Ondřej Surý 28fe8104ee Add isc_hashmap_find() DbC check for valuep
This adds DbC check, so we don't pass non-NULL memory for a valued to
the isc_hashmap_find() function.
2023-02-15 09:30:04 +01:00
Mark Andrews 998252c6dc Merge branch 'feature/main/fips-tests' into 'main'
FIPS tests changes for RHEL

Closes #3871

See merge request isc-projects/bind9!7417
2023-02-15 08:16:52 +00:00
Mark Andrews 55a6b15087 Add CHANGES note for [GL !7417] 2023-02-15 18:55:18 +11:00
Petr MenšíkandMark Andrews 6ad794a8cd 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.
2023-02-15 15:44:28 +11:00
Ondřej Surý 4787adfd33 Merge branch '3862-recusive-stress-crash' into 'main'
Fix change 6093 which broke rbtdb when it grew too large

Closes #3862

See merge request isc-projects/bind9!7533
2023-02-14 18:19:54 +00:00
Tony FinchandOndřej Surý 9d7b224201 Fix change 6093 which broke rbtdb when it grew too large
I misunderstood the purpose of the `heap_index` rdataset header
member; I thought it identified which heap to use, and could therefore
be smaller, the same size as `locknum` indexes. But in fact it is a
position within a heap, so it needs to be able to count up to the
total number of rdatasets in the rbtdb.

So this changes `heap_index` from `uint16_t` back to `unsigned int`.

To avoid re-embiggening the rdatasetheader, shrink the `count` member
from `uint32` to `uint16`. The `count` is used to rotate RRsets in
`dns_rdataset_towiresorted()`, so 16 bits is more than large enough.
This change also means we no longer need to avoid colliding with
`DNS_RDATASET_COUNT_UNDEFINED` i.e. UINT32_MAX.

Closes #3862
2023-02-14 18:19:46 +00:00
Tony Finch 49db4fb60f Merge branch 'fanf-arm-spinloop' into 'main'
Improve the spinloop pause / yield hint

See merge request isc-projects/bind9!7469
2023-02-14 17:53:26 +00:00
Tony Finch 436b76bb17 Improve the spinloop pause / yield hint
Unfortunately, C still lacks a standard function for pause (x86,
sparc) or yeild (arm) instructions, for use in spin lock or CAS loops.
BIND has its own based on vendor intrinsics or inline asm.

Previously, it was buried in the `isc_rwlock` implementation. This
commit renames `isc_rwlock_pause()` to `isc_pause()` and moves
it into <isc/pause.h>.

This commit also fixes the configure script so that it detects ARM
yield support on systems that identify as `aarch*` instead of `arm*`.

On 64-bit ARM systems we now use the ISB (instruction synchronization
barrier) instruction in preference to yield. The ISB instruction
pauses the CPU for longer, several nanoseconds, which is more like the
x86 pause instruction. There are more details in a Rust pull request,
which also refers to MySQL making the same change:
https://github.com/rust-lang/rust/pull/84725
2023-02-14 17:13:24 +00:00
Tom Krizek f32d334e41 Merge branch '3849-relax-diff-on-dig-short-output' into 'main'
Ignore dig errors in +short comparisons in tests

Closes #3849

See merge request isc-projects/bind9!7488
2023-02-14 12:39:38 +00:00
Tom Krizek bd1ef66f83 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.
2023-02-14 13:10:49 +01:00
Arаm Sаrgsyаn f5b77e734a Merge branch '3866-fix-rpz-reference-counting-bug' into 'main'
Fix RPZ reference counting error on shutdown

Closes #3866

See merge request isc-projects/bind9!7526
2023-02-14 09:59:41 +00:00
Aram Sargsyan a5927f1151 Add a CHANGES note for [GL #3866] 2023-02-14 09:13:18 +00:00
Aram Sargsyan afbe63565f 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.
2023-02-14 09:12:53 +00:00
Mark Andrews b274d388f1 Merge branch '3662-extend-mkeys-system-test-to-handle-islands-of-trust' into 'main'
Resolve "Extend mkeys system test to handle islands of trust"

Closes #3662

See merge request isc-projects/bind9!7049
2023-02-13 23:32:05 +00:00
Mark Andrews 2928f21733 Add CHANGES note for [GL #3662] 2023-02-14 10:10:39 +11:00
Mark Andrews 41bdb5b9fe 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.
2023-02-14 10:10:05 +11:00
Mark Andrews fb7b7ac495 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.
2023-02-14 10:10:05 +11:00
Evan Hunt 2f54ba3977 Merge branch '2971-cleanup-dead-functions' into 'main'
remove some unused functions

Closes #2971

See merge request isc-projects/bind9!7521
2023-02-13 19:52:05 +00:00
Evan Hunt 3a1bb8dac8 remove some unused functions
removed some functions that are no longer used and unlikely to
be resurrected, and also some that were only used to support Windows
and can now be replaced with generic versions.
2023-02-13 11:50:59 -08:00
Tom Krizek 6b8b9c0b02 Merge branch '3848-increase-wait-time-runtime-test' into 'main'
Increase named startup wait time for runtime test

Closes #3848

See merge request isc-projects/bind9!7487
2023-02-13 14:22:24 +00:00
Tom Krizek b8bb4233e8 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.
2023-02-13 14:54:12 +01:00
Michal Nowak e9272f3cdc Merge branch 'mnowak/pairwise-test-auth-recursive-servers' into 'main'
Test authoritative and recursive servers in pairwise

See merge request isc-projects/bind9!7397
2023-02-13 12:24:25 +00:00
Michal Nowak a708c2f93d 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.
2023-02-13 12:45:20 +01:00
Ondřej Surý 18f6213dc7 Merge branch '3814-tighten-the-locking-around-fctxcount' into 'main'
Add magic to fctxcount and replace the atomics with integers

Closes #3814

See merge request isc-projects/bind9!7515
2023-02-11 20:22:01 +00:00
Ondřej Surý 70439e2494 Add magic to fctxcount and replace the atomics with integers
Add magic value to the fctxcount, to check for completely invalid
counters, or counters that have been already destroyed.

Improve the locking around the counters, and because of that we can drop
the atomics and use simple integers - the counters were already locked
and the tiny bits that used the atomics were not worth the extra effort.
2023-02-11 20:21:47 +00:00
Evan Hunt ffeb8b3b2b Merge branch '3780-deprecated-obsolete-cleanup' into 'main'
clean up some deprecated/obsolete options and doc

Closes #3780

See merge request isc-projects/bind9!7506
2023-02-10 17:55:40 +00:00
Evan Hunt 362ba054cf clean up some deprecated/obsolete options and doc
- removed documentation of -S option from named man page
- removed documentation of reserved-sockets from ARM
- simplified documentation of dnssec-secure-to-insecure - it
  now just says it's obsolete rather than describing what it
  doesn't do anymore
- marked three formerly obsolete options as ancient:
  parent-registration-delay, reserved-sockets, and
  suppress-initial-notify
2023-02-10 09:52:27 -08:00
Ondřej Surý 06872bdd4e Merge branch 'pspacek/make-manin-on-dist' into 'main'
Remove pregenerated manpages from the repo

See merge request isc-projects/bind9!6520
2023-02-10 11:02:03 +00:00
Ondřej Surý 8f2e1e15cc 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).
2023-02-10 11:33:49 +01:00
Petr ŠpačekandOndřej Surý 9110465194 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.
2023-02-10 11:24:03 +01:00
Evan Hunt daf78318ed Merge branch 'each-remove-bind9-refvar' into 'main'
remove isc_bind9 variable

See merge request isc-projects/bind9!7508
2023-02-09 18:01:48 +00:00
Evan Hunt 935879ed11 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.
2023-02-09 18:00:13 +00:00
Michał Kępień 1db5dc456a Merge branch '3840-avoid-libuv-with-broken-recvmmsg' into 'main'
Avoid libuv 1.35 and 1.36 that have broken recvmmsg implementation

Closes #3840

See merge request isc-projects/bind9!7480
2023-02-09 14:10:19 +00:00
Ondřej SurýandMichał Kępień 6fa48c963e Add CHANGES and release note for [GL #3840] 2023-02-09 15:04:52 +01:00
Ondřej SurýandMichał Kępień d4d57f16c3 Sync compile-time & run-time libuv requirements
Bump the minimum libuv version required at runtime so that it matches
the compile-time requirements.
2023-02-09 15:04:52 +01:00
Ondřej SurýandMichał Kępień 735d09bffe 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.
2023-02-09 15:04:52 +01:00
Ondřej SurýandMichał Kępień 251f411fc3 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.
2023-02-09 15:04:52 +01:00
Tony Finch e239e97a0d Merge branch 'fanf-another-bitstring-remnant' into 'main'
Remove another remnant of bitstring labels

See merge request isc-projects/bind9!7511
2023-02-09 14:03:17 +00:00
Tony FinchandTony Finch 174e56a251 Fix CHANGES numbering
Oops, I broke it
2023-02-09 13:41:04 +00:00
Tony FinchandTony Finch 1637721ee9 Remove another remnant of bitstring labels
A comment referred to the mysterious label type 01000001
2023-02-09 12:16:46 +00:00
Tony Finch d39f666c7e Merge branch 'fanf-smaller-rdatasetheader' into 'main'
Reduce the size of rdatasetheader_t by 16 bytes

See merge request isc-projects/bind9!7505
2023-02-09 09:09:05 +00:00
Tony FinchandTony Finch 9721fa2153 Reduce the size of rdatasetheader_t by 16 bytes
Re-order the fields to avoid padding, and change the type of
`heap_index` to `uint16_t` to match `dns_rbtnode_t->locknum`.
2023-02-09 09:07:30 +00:00
Mark Andrews ab4f4b4df0 Merge branch '3857-notify-source-port-test-is-not-reliable' into 'main'
Resolve "Notify source port test is not reliable"

Closes #3857

See merge request isc-projects/bind9!7509
2023-02-09 08:38:12 +00:00
Mark Andrews e7e1f59a3a 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.
2023-02-09 15:11:24 +11:00
Mark Andrews d838b9f5cf Merge branch '3851-cleanup-nsupdate-system-test' into 'main'
Resolve "cleanup nsupdate system test"

Closes #3851

See merge request isc-projects/bind9!7490
2023-02-08 22:39:51 +00:00
Mark Andrews df7f3c47c6 Send grep output to /dev/null in nsupdate test 2023-02-08 22:20:21 +00:00
Mark Andrews 3a38782485 Merge branch '3831-dnssec-cds-failed-to-cleanup-properly-on-some-non-error-paths' into 'main'
Resolve "dnssec-cds failed to cleanup properly on some non error paths"

Closes #3831

See merge request isc-projects/bind9!7445
2023-02-08 21:56:11 +00:00
Mark Andrews ae26fcb8f5 Add CHANGES note for [GL #3831] 2023-02-09 08:35:27 +11:00
Mark Andrews 13f9d29954 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.
2023-02-09 08:35:27 +11:00
Mark Andrews 81bde388e4 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.
2023-02-09 08:29:43 +11:00
Mark Andrews ddc4d1fca4 Define DNS_RDATASET_INIT for static initialisation 2023-02-09 08:29:43 +11:00
Ondřej Surý 4ebf27bc19 Merge branch '3729-drop-RHEL-7-and-clones-support' into 'main'
Drop RHEL / CentOS / Oracle Linux 7 support

Closes #3729

See merge request isc-projects/bind9!7346
2023-02-08 20:34:01 +00:00
Ondřej Surý 72cfca9b3b Add CHANGES and release notes for [GL #3729] 2023-02-08 21:33:23 +01:00
Ondřej Surý baced007af Require C11 Atomic Operations via <stdatomic.h>
Make the C11 Atomic Operations mandatory and drop the Gcc __atomic
builtin shims.
2023-02-08 21:33:23 +01:00
Ondřej Surý 1c456c0284 Require C11 thread_local keyword and <threads.h> header
Change the autoconf check to require C11 <threads.h> header and
thread_local keyword.
2023-02-08 21:33:23 +01:00
Ondřej Surý 20fd0cc60b Drop RHEL / CentOS / Oracle Linux 7 support
The RHEL (and clones) 7 will reach EOL in June 2024, shortly after BIND
9.20 will be released.  Drop the support for building on those
platforms, so we can use features of modern operating systems - newer
compiler that supports at least subset of C23 and OpenSSL 1.1/3.0.

This will simplify some of the code that we are using in BIND 9.
2023-02-08 21:33:22 +01:00
Evan Hunt 87ec418e04 Merge branch '3113-clientinfo-refactor' into 'main'
refactor dns_clientinfo_init(); use separate function to set ECS

Closes #3113

See merge request isc-projects/bind9!5782
2023-02-08 08:10:20 +00:00
Evan Hunt ff3fdaa424 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.
2023-02-07 23:48:22 -08:00
Evan Hunt 0792544872 Merge branch '3846-nsupdate-test-fix' into 'main'
increase simultaneous updates for quota test

Closes #3846

See merge request isc-projects/bind9!7500
2023-02-08 07:40:35 +00:00
Evan Hunt 06b1faf068 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.
2023-02-07 23:36:02 -08:00
Evan Hunt 9ecda9bdb2 Merge branch '854-spurious-keytype-warning' into 'main'
silence a spurious warning during key generation

Closes #854

See merge request isc-projects/bind9!7501
2023-02-08 07:29:46 +00:00
Evan Hunt 82503bec99 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.
2023-02-07 12:37:47 -08:00
Mark Andrews de6dfc1eeb Merge branch '3852-follow-up-from-9-18-merge-branch-3790-use-configured-udp-port-into-main' into 'main'
Resolve "Wait longer for rndc reconfig effects to complete"

Closes #3852

See merge request isc-projects/bind9!7493
2023-02-07 13:40:22 +00:00
Mark Andrews 71dbd09796 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.
2023-02-07 12:59:49 +00:00
Mark Andrews 5746232b02 Merge branch '3836-missing-ossl_store_info_free-calls-in-dst__openssl_fromlabel_provider-on-error-path' into 'main'
Resolve "Missing OSSL_STORE_INFO_free calls in dst__openssl_fromlabel_provider on error path"

Closes #3836

See merge request isc-projects/bind9!7456
2023-02-07 12:59:06 +00:00
Mark Andrews 7f12c0884f Call OSSL_STORE_INFO_free on error path 2023-02-07 12:29:34 +00:00
Arаm Sаrgsyаn 80b88df4d3 Merge branch '3839-fix-resume_dslookup-bug' into 'main'
Fix a bug in resolver's resume_dslookup() function

Closes #3839

See merge request isc-projects/bind9!7476
2023-02-07 12:22:31 +00:00
Mark AndrewsandArаm Sаrgsyаn 4d465e9c0c check that delv handles REFUSED when chasing DS records 2023-02-07 10:41:21 +00:00
Aram Sargsyan 2a1f937536 Add a CHANGES note for [GL #3839] 2023-02-07 10:41:21 +00:00
Aram Sargsyan 410fcbfcfe Fix a bug in resolver's resume_dslookup() function
A recent refactoring in 7e4e125e5e
had introduced a logical error which could result in calling the
dns_resolver_createfetch() function with 'nameservers' pointer set
to NULL, but with 'domain' not set to NULL, which is not allowed
by the function.

Make sure 'domain' is set only when 'nsrdataset' is valid.
2023-02-07 10:41:21 +00:00
Michal Nowak 351aef8c3a Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.19.11' into 'main'
Set up version and release notes for bind 9.19.11

See merge request isc-projects/bind9!7495
2023-02-07 10:03:17 +00:00
Michal Nowak 8e7fc75a3d Set up release notes for BIND 9.19.11 2023-02-07 10:25:44 +01:00
Michal Nowak 8965002255 Update BIND version to 9.19.11-dev 2023-02-07 10:22:26 +01:00
Mark Andrews 7e6611da8f Merge branch '3838-named-rrchecker-should-cleanup-when-it-detects-an-error' into 'main'
Resolve "named-rrchecker should cleanup when it detects an error"

Closes #3838

See merge request isc-projects/bind9!7473
2023-02-07 00:00:54 +00:00
Mark Andrews dbe82813e6 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.
2023-02-06 23:29:12 +00:00
Evan Hunt a9cc88b8d6 Merge branch '3790-use-configured-udp-port' into 'main'
use configured source ports for UDP requests

Closes #3790

See merge request isc-projects/bind9!7479
2023-02-06 23:28:13 +00:00
Evan Hunt 4f50854e7a CHANGES for [GL #3790] 2023-02-06 15:04:24 -08:00
Evan Hunt 9cffd5c431 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.
2023-02-06 15:03:58 -08:00
Evan Hunt 4d50c912ba 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.)
2023-02-06 15:03:58 -08:00
Evan Hunt e46d5d84fc Merge branch 'each-remove-bindkeys' into 'main'
remove /etc/bind.keys

Closes #3850

See merge request isc-projects/bind9!7484
2023-02-06 23:03:08 +00:00
Evan Hunt c144fd2871 CHANGES for [GL #3850] 2023-02-06 14:39:43 -08:00
Evan Hunt 9bb46262af remove /etc/bind.keys
the built-in trust anchors in named and delv are sufficent for
validation. named still needs to be able to load trust anchors from
a bind.keys file for testing purposes, but it doesn't need to be
the default behavior.

we now only load trust anchors from a file if explicitly specified
via the "bindkeys-file" option in named or the "-a" command line
argument to delv. documentation has been cleaned up to remove references
to /etc/bind.keys.

Closes #3850.
2023-02-06 14:39:31 -08:00
Evan Hunt f291b77cd2 Merge branch '3673-delay-trust-anchor-management' into 'main'
delay trust anchor management until zones are loaded

Closes #3673

See merge request isc-projects/bind9!7441
2023-02-06 22:12:32 +00:00
Evan Hunt bafbbd2465 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.
2023-02-06 13:50:03 -08:00
Tony Finch 7e8e2d55b0 Merge branch 'fanf-unused-fromwire-downcase' into 'main'
Remove unused support for fromwire(DNS_NAME_DOWNCASE)

See merge request isc-projects/bind9!7467
2023-02-06 14:20:42 +00:00
Tony FinchandTony Finch 50ab648f8a Remove unused support for fromwire(DNS_NAME_DOWNCASE)
Most of this change is fixing dns_rdata_fromwire() so
it does not propagate the unused options variable.
2023-02-06 13:26:36 +00:00
Tony Finch ecd428240b Merge branch 'fanf-bitstring-cleanup' into 'main'
Remove some remnants of bitstring labels

See merge request isc-projects/bind9!7196
2023-02-06 13:23:46 +00:00
Tony Finch c70bb3deb5 Remove some remnants of bitstring labels
* rbt node chains were sized to allow for bitstring labels, so they
  had 256 levels; but in the absence of bistrings, 128 is enough.

* dns_byaddr_createptrname() had a redundant options argument,
  and a very outdated doc comment.

* A number of comments referred to bitstring labels in a way that is
  no longer helpful. (A few informative comments remain.)
2023-02-06 13:22:30 +00:00
Tony Finch 8088728c90 Merge branch 'fanf-named-compilezone-stray-backtick' into 'main'
Fix the reference to RFC 1035 in named-compilezone(1)

See merge request isc-projects/bind9!7485
2023-02-06 12:31:08 +00:00
Tony Finch ef1170b3fc Fix the reference to RFC 1035 in named-compilezone(1)
There was a stray backquote
2023-02-06 12:31:01 +00:00
Tony Finch 10ff56b345 Merge branch 'fanf-time-monotonic' into 'main'
Add isc_time_monotonic()

See merge request isc-projects/bind9!7486
2023-02-06 12:23:14 +00:00
Tony FinchandTony Finch ff63b53ff4 Add isc_time_monotonic()
This is to simplify measurements of how long things take.
2023-02-06 12:14:51 +00:00
Tony Finch 89a3ff1d06 Merge branch '3845-mem-zero-non-zero' into 'main'
Fix ISC_MEM_ZERO on allocators with malloc_usable_size()

Closes #3845

See merge request isc-projects/bind9!7481
2023-02-06 12:09:28 +00:00
Tony Finch b8e71f9580 Fix ISC_MEM_ZERO on allocators with malloc_usable_size()
ISC_MEM_ZERO requires great care to use when the space returned by
the allocator is larger than the requested space, and when memory is
reallocated. You must ensure that _every_ call to allocate or
reallocate a particular block of memory uses ISC_MEM_ZERO, to ensure
that the extra space is zeroed as expected. (When ISC_MEMFLAG_FILL
is set, the extra space will definitely be non-zero.)

When BIND is built without jemalloc, ISC_MEM_ZERO is implemented in
`jemalloc_shim.h`. This had a bug on systems that have malloc_size()
or malloc_usable_size(): memory was only zeroed up to the requested
size, not the allocated size. When an oversized allocation was
returned, and subsequently reallocated larger, memory between the
original requested size and the original allocated size could
contain unexpected nonzero junk. The realloc call does not know the
original requested size and only zeroes from the original allocated
size onwards.

After this change, `jemalloc_shim.h` always zeroes up to the
allocated size, not the requested size.
2023-02-06 11:21:12 +00:00
2332 changed files with 1219345 additions and 143421 deletions
+7 -4
View File
@@ -34,6 +34,10 @@ 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)/'
@@ -50,8 +54,6 @@ IncludeCategories:
Priority: 35
- Regex: '^<irs/'
Priority: 40
- Regex: '^<bind9/'
Priority: 45
- Regex: '^<(dig|named|rndc|confgen|dlz)/'
Priority: 50
- Regex: '^<dlz_'
@@ -61,9 +63,9 @@ IncludeCategories:
- Regex: '^<tests/'
Priority: 100
- Regex: '<openssl/'
Priority: 1
Priority: 4
- Regex: '<(mysql|protobuf-c)/'
Priority: 1
Priority: 4
- Regex: '.*'
Priority: 0
IndentExternBlock: NoIndent
@@ -76,3 +78,4 @@ 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' ]
+30 -16
View File
@@ -34,26 +34,40 @@ PointerAlignment: Right
PointerBindsToType: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<isc/'
- Regex: '^<(urcu/urcu-|urcu-)'
Priority: 2
- Regex: '^<dns/'
- Regex: '^<urcu/'
Priority: 3
- Regex: '^<iscccc/'
Priority: 4
- Regex: '^<isccfg/'
- Regex: '^<isc/'
Priority: 5
- Regex: '^<ns/'
Priority: 6
- Regex: '^<bind9/)'
Priority: 7
- Regex: '^(<[^/]*)/)'
Priority: 8
- Regex: '^<tests/'
- Regex: '^<(pk11|pkcs11)/'
Priority: 10
- Regex: '<[[:alnum:].]+>'
Priority: 1
- Regex: '".*"'
Priority: 9
- Regex: '^<dns/'
Priority: 15
- Regex: '^<dst/'
Priority: 20
- Regex: '^<isccc/'
Priority: 25
- Regex: '^<isccfg/'
Priority: 30
- Regex: '^<ns/'
Priority: 35
- Regex: '^<irs/'
Priority: 40
- Regex: '^<(dig|named|rndc|confgen|dlz)/'
Priority: 50
- Regex: '^<dlz_'
Priority: 55
- Regex: '^".*"'
Priority: 99
- Regex: '^<tests/'
Priority: 100
- Regex: '<openssl/'
Priority: 4
- Regex: '<(mysql|protobuf-c)/'
Priority: 4
- Regex: '.*'
Priority: 0
IndentExternBlock: NoIndent
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
+3 -3
View File
@@ -52,7 +52,7 @@
;; libtest
(expand-file-name
(concat directory-of-current-dir-locals-file "tests/include"))
;; bin
(expand-file-name
(concat directory-of-current-dir-locals-file "bin/check"))
@@ -61,7 +61,7 @@
(expand-file-name
(concat directory-of-current-dir-locals-file "bin/confgen"))
(expand-file-name
(concat directory-of-current-dir-locals-file "bin/confgen/include"))
(concat directory-of-current-dir-locals-file "bin/confgen/include"))
(expand-file-name
(concat directory-of-current-dir-locals-file "bin/dig/include"))
(expand-file-name
@@ -79,7 +79,7 @@
(expand-file-name "/usr/include/libxml2")
(expand-file-name "/usr/include/json-c")
(expand-file-name "/usr/local/opt/openssl@1.1/include")
(expand-file-name "/usr/local/opt/libxml2/include/libxml2")
(expand-file-name "/usr/local/opt/json-c/include/json-c/")
+5
View File
@@ -0,0 +1,5 @@
[*.sh{,.in}]
indent_style = space
indent_size = 2
binary_next_line = true
switch_case_indent = true
+18
View File
@@ -1526,3 +1526,21 @@ ffaab41a01621c0e02196e225f9269daf8b2ec8f
ffac31097d25039951063bbb9f864e223a46ad1b
# update copyright notice / whitespace
ffbe6b95371c99b7fb05e6de17a8d6b7bf4f629f
# remove trailing whitespace
5893debf46ce1b5fbe793114a59da28fac4cccb7
# arithmetic expansion in system tests
4d42bdc245a1db1654abb502a52a5a8a3a570881
# arithmetic expansion in system tests
1436025e20ae13cfe55df14d62f5812c0cea2ee9
# subshell notation in system tests
05baf7206b7baaf91cb8e049ad13e413c52cdf3f
# reformat shell scripts with shfmt
4cb8b13987b930952238cc88e84272b8cf911933
# Reformat sources with up-to-date clang-format-17
79d93600116faabd89798522817ad95a69684fff
# Reformat sources with up-to-date clang-format-18
b7de2c7cb959fa35099d72c3f9b13938348c74e6
# Reformat sources with up-to-date clang-format-19
ff69d07fed2619a9bedf5ccc18cf106b7dd49bef
# Reformat sources with up-to-date clang-format-19
ebb5bd9c0f079de8970b538fe48e5f5c60ea7ee9
+1 -1
View File
@@ -10,4 +10,4 @@
/util/** export-ignore
/util/bindkeys.pl -export-ignore
/util/check-make-install.in -export-ignore
/util/mksymtbl.pl -export-ignore
/util/dtrace.sh -export-ignore
+1
View File
@@ -0,0 +1 @@
contrib/gitchangelog/changelog.rc.py
+2 -2
View File
@@ -2,7 +2,7 @@ name: "CodeQL"
on:
push:
branches: [ "v9_16", "v9_18", "main" ]
branches: [ "bind-9.16", "bind-9.18", "main" ]
schedule:
- cron: '39 8 * * 3'
@@ -27,7 +27,7 @@ jobs:
- name: Install build dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
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
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
version: 1.0
# Initializes the CodeQL tools for scanning.
+50
View File
@@ -0,0 +1,50 @@
name: SonarCloud
on:
push:
branches: [ "bind-9.16", "bind-9.18", "main" ]
schedule:
- cron: '39 8 * * 3'
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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
version: 1.0
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1
- name: Run build-wrapper
run: |
autoreconf -fi
./configure
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make clean all
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
+2
View File
@@ -5,6 +5,7 @@
*.la
*.lo
*.log
*.log.txt
*.o
*.orig
*.plist/ # ccc-analyzer store its results in .plist directories
@@ -74,6 +75,7 @@ doc/man/dnssec-importkey.8in
doc/man/dnssec-keyfromlabel.8in
doc/man/dnssec-keygen.8in
doc/man/dnssec-keymgr.8in
doc/man/dnssec-ksr.8in
doc/man/dnssec-revoke.8in
doc/man/dnssec-settime.8in
doc/man/dnssec-signzone.8in
+830 -391
View File
File diff suppressed because it is too large Load Diff
+37 -20
View File
@@ -2,45 +2,62 @@
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!
confidential by clicking the checkbox at the bottom!
-->
### Summary
(Summarize the bug encountered concisely.)
<!-- Concisely summarize the bug encountered. -->
### BIND version used
### 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!
(Paste the output of `named -V`.)
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.
-->
### Steps to reproduce
(How one can reproduce the issue - this is very important.)
<!--
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.
### 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 - please use code blocks (```)
<!-- Paste any relevant configuration files here - 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 and/or screenshots
### Relevant logs
(Paste any relevant logs - please use code blocks (```) to format console
output, logs, and code, as it's very hard to read otherwise.)
<!-- Paste any relevant logs here - please use code blocks (```) to format console
output, logs, and code, as it's very hard to read otherwise. -->
### Possible fixes
(If you can, link to the line of code that might be responsible for the
problem.)
/label ~bug
/label ~Bug
+8
View File
@@ -0,0 +1,8 @@
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 request"
/label ~Feature
@@ -12,15 +12,15 @@ confidential!
| Deputy Incident Manager: | @user |
| Public Disclosure Date: | YYYY-MM-DD |
| CVSS Score: | [0.0][cvss_score] |
| CWE: | [CWE-NNN][cwe_category]
| Security Advisory: | isc-private/printing-press!NNN |
| Mattermost Channel: | [CVE-YYYY-NNNN][mattermost_url] |
| Support Ticket: | [URL] |
| Release Checklist: | #NNNN |
| Post-mortem Etherpad: | [postmortem-YYYY-MM][postmortem_url] |
[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
[cwe_category]: https://cwe.mitre.org/data/definitions/NNN.html
[mattermost_url]:
[postmortem_url]:
:bulb: **Click [here][checklist_explanations] (internal resource) for general information about the security incident handling process.**
@@ -30,14 +30,14 @@ confidential!
- [ ] [:link:][step_deputy] **(IM)** Pick a Deputy Incident Manager
- [ ] [:link:][step_respond] **(IM)** Respond to the bug reporter
- [ ] [:link:][step_etherpad] **(IM)** Create an Etherpad for post-mortem
- [ ] [: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_note_cve_info] **(SwEng)** Update this issue with the assigned CVE identifier, the CVSS score, and CWE category
- [ ] [: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] **(Support)** Prepare and send out "earliest" notifications
- [ ] [:link:][step_earliest_prepare] **(Support)** Prepare "earliest" notification text
- [ ] [:link:][step_earliest_send] **(Support)** Update "earliest" notification ticket in support portal Earliest queue which will notify 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
@@ -48,53 +48,50 @@ confidential!
- [ ] [:link:][step_backports] **(SwEng)** Prepare backports of the merge request addressing the problem for all affected (and still maintained) branches of a given product
- [ ] [:link:][step_finish_advisory] **(Support)** Finish preparing the Security Advisory
- [ ] [:link:][step_meta_issue] **(QA)** Create (or update) the private issue containing links to fixes & reproducers for all CVEs fixed in a given release cycle
- [ ] [:link:][step_changes] **(QA)** (BIND 9 only) Reserve a block of `CHANGES` placeholders once the complete set of vulnerabilities fixed in a given release cycle is determined
- [ ] [:link:][step_merge_fixes] **(QA)** Merge the CVE fixes in CVE identifier order
- [ ] [:link:][step_patches] **(QA)** Prepare a standalone patch for the last stable release of each affected (and still maintained) product branch
- [ ] [:link:][step_asn_releases] **(QA)** Prepare ASN releases (as outlined in the Release Checklist)
### At T-5
- [ ] [:link:][step_send_asn] **(Support)** Send ASN to eligible customers
- [ ] [:link:][step_preannouncement] **(Support)** (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
- [ ] [:link:][step_asn_links] **(Marketing)** (BIND 9 only) Update the BIND -S information document in the support portal with download links to the new versions
- [ ] [:link:][step_asn_send] **(Support)** Notify eligible customers by adding a ticket to the 5 Day queue in RT with the text of the advisory (earliest, and T-5)
- [ ] [: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-4
- [ ] [:link:][step_verify_asn] **(Support)** Verify that all ASN-eligible customers have received the notification email
### At T-3
- [ ] [:link:][step_asn_send] **(Support)** Notify eligible customers by adding a ticket to the 3 Day queue in RT with the text of the advisory (T-3)
### At T-1
- [ ] [:link:][step_check_customers] **(Support)** Verify that any new or reinstated customers have received the notification email
- [ ] [:link:][step_packager_emails] **(First IM)** Send notifications to OS packagers
### On the Day of Public Disclosure
- [ ] [:link:][step_clearance] **(IM)** Grant Support clearance to proceed with public release
- [ ] [:link:][step_publish] **(Support)** Publish the releases (as outlined in the release checklist)
- [ ] [:link:][step_matrix] **(Support)** (BIND 9 only) Update vulnerability matrix in the Knowledge Base
- [ ] [: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_customers] **(Support)** Inform customers a fix has been released
- [ ] [:link:][step_asn_clear] **(Support)** Update the tickets in the ASN queues in RT that the embargo is lifted
- [ ] [:link:][step_customers] **(Marketing)** Open a ticket in the <software name> Announce queue that the release is published
### After Public Disclosure
- [ ] [:link:][step_postmortem] **(First IM)** Organize post-mortem meeting and make sure it happens
- [ ] [:link:][step_tickets] **(Support)** Close support tickets
- [ ] [: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_etherpad]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#create-an-etherpad-for-post-mortem
[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_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-the-cvss-score-and-the-cwe-category
[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]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#prepare-and-send-out-earliest-notifications
[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
@@ -109,20 +106,21 @@ confidential!
[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_send_asn]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#send-asn-to-eligible-customers
[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_verify_asn]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#verify-that-all-asn-eligible-customers-have-received-the-notification-email
[step_check_customers]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#verify-that-any-new-or-reinstated-customers-have-received-the-notification-email
[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-support-clearance-to-proceed-with-public-release
[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-update-vulnerability-matrix-in-the-knowledge-base
[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_customers]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#inform-customers-a-fix-has-been-released
[step_postmortem]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#organize-post-mortem-meeting-and-make-sure-it-happens
[step_tickets]: https://gitlab.isc.org/isc-private/isc-wiki/-/wikis/Security-Incident-Handling-Checklist-Explanations#close-support-tickets
[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
-95
View File
@@ -1,95 +0,0 @@
## Release Schedule
**Code Freeze:**
**Tagging Deadline:**
**Public Release:**
## Documentation Review Links
**Closed issues assigned to the milestone without a release note:**
- []()
- []()
- []()
**Merge requests merged into the milestone without a release note:**
- []()
- []()
- []()
**Merge requests merged into the milestone without a `CHANGES` entry:**
- []()
- []()
- []()
## Release Checklist
### Before the Code Freeze
- [ ] ***(QA)*** 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 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)*** Update GitLab settings for all maintained branches to disallow merging to them.
- [ ] ***(QA)*** Announce (on Mattermost) that the code freeze is in effect.
### Before the Tagging Deadline
- [ ] ***(QA)*** Ensure release notes are correct, ask Support and Marketing to check them as well.
- [ ] ***(QA)*** Add a release marker to `CHANGES`.
- [ ] ***(QA)*** Add a release marker to `CHANGES.SE` (Subscription Edition only).
- [ ] ***(QA)*** Update BIND 9 version in `configure.ac` (9.18+) or `version` (9.16).
- [ ] ***(QA)*** Rebuild `configure` using Autoconf on `docs.isc.org` (9.16).
- [ ] ***(QA)*** Tag the releases in the private repository (`git tag -s -m "BIND 9.x.y" v9_x_y`).
### Before the ASN Deadline (for ASN Releases) or the Public Release Date (for Regular Releases)
- [ ] ***(QA)*** Check that the formatting is correct for HTML and PDF versions of release notes.
- [ ] ***(QA)*** Check that the formatting of the generated man pages is correct.
- [ ] ***(QA)*** Verify GitLab CI results for the tags created and sign off on the releases to be published.
- [ ] ***(QA)*** Update GitLab settings for all maintained branches to allow merging to them again.
- [ ] ***(QA)*** Prepare and merge MRs resetting the release notes and updating the version string for each maintained branch.
- [ ] ***(QA)*** Announce (on Mattermost) that the code freeze is over.
- [ ] ***(QA)*** Request signatures for the tarballs, providing their location and checksums.
- [ ] ***(Signers)*** Ensure that the contents of tarballs and tags are identical.
- [ ] ***(Signers)*** Validate tarball checksums, sign tarballs, and upload signatures.
- [ ] ***(QA)*** Verify tarball signatures and check tarball checksums again.
- [ ] ***(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)*** Prepare the `patches/` subdirectory for each security release (if applicable).
- [ ] ***(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.
- [ ] ***(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 published release tags (non-linearly) back into the their relevant development/maintenance branches.
- [ ] ***(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, Sphinx) by modifying the relevant `Dockerfile`.
- [ ] ***(QA)*** Run a pipeline to rebuild all [images](https://gitlab.isc.org/isc-projects/images) used in GitLab CI.
[^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
@@ -0,0 +1,139 @@
### 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
@@ -0,0 +1,27 @@
Alan Clegg <aclegg@isc.org>
Alessio Podda <alessio@isc.org>
Aram Sargsyan <aram@isc.org>
Artem Boldariev <artem@isc.org> <artem@boldariev.com>
Curtis Blackburn <ckb@isc.org> <ckb@freebsd11.local>
Curtis Blackburn <ckb@isc.org> <ckb@isc.org>
Diego Fronza <diego@isc.org>
Evan Hunt <each@isc.org> Evan Hunt <fanf@isc.org>
Håvard Eidnes <he@uninett.no>
Jeremy C. Reed <jreed@isc.org> <jreed@docs.lab.isc.org>
Jeremy C. Reed <jreed@isc.org> <jreed@ISC.org>
Joey Salazar <joey@isc.org>
John H. DuBois III <johnd>
Mark Andrews <marka@isc.org>
Mark Andrews <marka@isc.org> <marka@daemon.lab.isc.org>
Mark Andrews <marka@isc.org> <marka@newdocs.lab.isc.org>
Matthijs Mekking <matthijs@isc.org> <github@pletterpet.nl>
Nicki Křížek <nicki@isc.org> <tkrizek@isc.org>
Ondřej Surý <ondrej@isc.org>
Ondřej Surý <ondrej@isc.org> <ondrej@openbsd-6-9.home.sury.org>
Ondřej Surý <ondrej@isc.org> <ondrej@sury.org>
Petr Menšík <pemensik@redhat.com>
Petr Menšík <pemensik@redhat.com> <pmensik@redhat.com>
Robert Edmonds <edmonds>
Tatuya JINMEI 神明達哉 <jinmei@isc.org>
Witold Kręcicki <wpk@isc.org>
Witold Kręcicki <wpk@isc.org> <wpk@culm.net>
+9 -1
View File
@@ -1,9 +1,17 @@
[MASTER]
[IMPORTS]
deprecated-modules=
dns.resolver,
[MESSAGES CONTROL]
disable=
C0103, # invalid-name
C0114, # missing-module-docstring
C0115, # missing-class-docstring
C0116, # missing-function-docstring
C0209, # consider-using-f-string
C0301, # line-too-long, handled better by black
C0415, # import-outside-toplevel
R0801, # duplicate-code
R0903, # too-few-public-methods
+20
View File
@@ -0,0 +1,20 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
# Build documentation in doc/arm/ with Sphinx
sphinx:
configuration: doc/arm/conf.py
# Build all formats
formats: all
# Explicitly set the version of Python and its requirements
python:
install:
- requirements: doc/arm/requirements.txt
+33 -3
View File
@@ -24,6 +24,7 @@ Files: **/*.after*
**/testdata/*
.github/*
.gitlab/*
.mailmap
AUTHORS
CHANGES
COPYRIGHT
@@ -38,15 +39,31 @@ Files: **/*.after*
bin/tests/system/doth/CA/index.txt
bin/tests/system/doth/CA/index.txt.attr
bin/tests/system/doth/CA/serial
bin/tests/system/notify/ns4/named.port.in
bin/tests/system/formerr/badnsec3owner
bin/tests/system/formerr/badrecordname
bin/tests/system/formerr/dupans
bin/tests/system/formerr/dupquestion
bin/tests/system/formerr/keyclass
bin/tests/system/formerr/malformeddeltype
bin/tests/system/formerr/malformedrrsig
bin/tests/system/formerr/nametoolong
bin/tests/system/formerr/noquestions
bin/tests/system/formerr/twoquestions
bin/tests/system/formerr/optwrongname
bin/tests/system/formerr/qtypeasanswer
bin/tests/system/formerr/questionclass
bin/tests/system/formerr/shortquestion
bin/tests/system/formerr/shortrecord
bin/tests/system/formerr/tsignotlast
bin/tests/system/formerr/tsigwrongclass
bin/tests/system/formerr/twoquestionnames
bin/tests/system/formerr/twoquestiontypes
bin/tests/system/formerr/wrongclass
bin/tests/system/forward/CA/CA.cfg
bin/tests/system/forward/CA/README
bin/tests/system/forward/CA/index.txt
bin/tests/system/forward/CA/index.txt.attr
bin/tests/system/forward/CA/serial
bin/tests/system/isctest/vars/.ac_vars/*
bin/tests/system/journal/ns1/managed-keys.bind.in
bin/tests/system/journal/ns1/managed-keys.bind.jnl.in
bin/tests/system/journal/ns2/managed-keys.bind.in
@@ -54,6 +71,10 @@ 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/ns4/named.port.in
bin/tests/system/nsupdate/CA/CA.cfg
bin/tests/system/nsupdate/CA/README
bin/tests/system/nsupdate/CA/index.txt
@@ -81,7 +102,10 @@ 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
@@ -157,17 +181,23 @@ Files: **/.clang-format
.clang-format
.clang-format.headers
.dir-locals.el
.editorconfig
.git-blame-ignore-revs
.gitattributes
.gitignore
.gitlab-ci.yml
.lgtm.yml
.pylintrc
.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
tsan-suppressions.txt
sonar-project.properties
tests/bench/names.csv
Copyright: Internet Systems Consortium, Inc. ("ISC")
License: CC0-1.0
+3
View File
@@ -0,0 +1,3 @@
# Uninstrumented libraries
called_from_lib:libfstrm.so
race:dummyrpz
-20862
View File
File diff suppressed because it is too large Load Diff
Symlink
+1
View File
@@ -0,0 +1 @@
doc/arm/changelog.rst
+6 -21
View File
@@ -71,14 +71,14 @@ To clone the repository, use:
> $ git clone https://gitlab.isc.org/isc-projects/bind9.git
Release branch names are of the form `v9_X`, where X represents the second
number in the BIND 9 version number. So, to check out the BIND 9.12
Release branch names are of the form `bind-9.X`, where X represents the second
number in the BIND 9 version number. So, to check out the BIND 9.18
branch, use:
> $ git checkout v9_12
> $ git checkout bind-9.18
Whenever a branch is ready for publication, a tag is placed of the
form `v9_X_Y`. The 9.12.0 release, for instance, is tagged as `v9_12_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`.
@@ -102,22 +102,7 @@ Twitter, or Facebook.
### Reporting possible security issues
If you think you may be seeing a potential security vulnerability in BIND
(for example, a crash with REQUIRE, INSIST, or ASSERT failure), please
report it immediately by emailing to security-officer@isc.org. Plain-text
e-mail is not a secure choice for communications concerning undisclosed
security issues so please encrypt your communications to us if possible,
using the [ISC Security Officer public key](https://www.isc.org/pgpkey/).
Do not discuss undisclosed security vulnerabilities on any public mailing list.
ISC has a long history of handling reported vulnerabilities promptly and
effectively and we respect and acknowledge responsible reporters.
ISC's Security Vulnerability Disclosure Policy is documented at
[https://kb.isc.org/docs/aa-00861](https://kb.isc.org/docs/aa-00861).
If you have a crash, you may want to consult
["What to do if your BIND or DHCP server has crashed."](https://kb.isc.org/docs/aa-00340)
See `SECURITY.md`.
### <a name="contrib"></a>Contributing code
@@ -188,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 PDF and HTML versions are automatically generated from
`doc/arm/`; the HTML version is automatically generated from
the `.rst` files.
* API documentation is in the header file describing the API, in
Doxygen-formatted comments.
+25 -25
View File
@@ -133,7 +133,7 @@ modification, are permitted provided that the following conditions are met:
3. Neither the name of the University nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -149,35 +149,35 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
Copyright (c) 1997 - 2003 Kungliga Tekniska Högskolan
(Royal Institute of Technology, Stockholm, Sweden).
All rights reserved.
(Royal Institute of Technology, Stockholm, Sweden).
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the Institute nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
3. Neither the name of the Institute nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-----------------------------------------------------------------------------
+9 -7
View File
@@ -1,23 +1,25 @@
include $(top_srcdir)/Makefile.top
SUBDIRS = . lib doc bin fuzz
SUBDIRS = . lib doc
if HAVE_CMOCKA
# build libtest before fuzz/* and bin/tests
SUBDIRS += tests
endif HAVE_CMOCKA
BUILT_SOURCES = bind.keys.h
CLEANFILES = bind.keys.h
# run fuzz tests before system tests
SUBDIRS += fuzz bin
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 \
-4
View File
@@ -14,7 +14,6 @@ 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``
@@ -26,11 +25,8 @@ 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
@@ -0,0 +1,20 @@
# 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,3 +21,8 @@ AM_CPPFLAGS += \
LDADD += \
$(top_builddir)/tests/libtest/libtest.la \
$(CMOCKA_LIBS)
if HAVE_JEMALLOC
AM_CFLAGS += $(JEMALLOC_CFLAGS)
LDADD += $(JEMALLOC_LIBS)
endif
+22 -14
View File
@@ -15,17 +15,31 @@ AM_LDFLAGS = \
$(STD_LDFLAGS)
LDADD =
BUILT_SOURCES =
CLEANFILES =
if HOST_MACOS
AM_LDFLAGS += \
-Wl,-flat_namespace
endif HOST_MACOS
LIBISC_CFLAGS = \
if HAVE_JEMALLOC
LIBISC_CFLAGS = $(JEMALLOC_CFLAGS)
LIBISC_LIBS = $(JEMALLOC_LIBS)
else
LIBISC_CFLAGS =
LIBISC_LIBS =
endif
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
LIBISC_LIBS += $(top_builddir)/lib/isc/libisc.la
if HAVE_DTRACE
LIBISC_DTRACE = $(top_builddir)/lib/isc/probes.lo
endif
LIBDNS_CFLAGS = \
-I$(top_srcdir)/lib/dns/include \
@@ -33,18 +47,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
LIBIRS_CFLAGS = \
-I$(top_srcdir)/lib/irs/include
LIBIRS_LIBS = \
$(top_builddir)/lib/irs/libirs.la
if HAVE_DTRACE
LIBNS_DTRACE = $(top_builddir)/lib/ns/probes.lo
endif
LIBISCCFG_CFLAGS = \
-I$(top_srcdir)/lib/isccfg/include
@@ -57,9 +71,3 @@ 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 @@
CHANGES
doc/arm/changelog.rst
-1
View File
@@ -26,4 +26,3 @@ Some of these settings are:
| `-DISC_MEM_TRACKLINES=0` | Don't track memory allocations by file and line number; this improves performance but makes debugging more difficult |
| `-DNAMED_RUN_PID_DIR=0` | Create default PID files in `${localstatedir}/run` rather than `${localstatedir}/run/named/` |
| `-DNS_CLIENT_DROPPORT=0` | Disable dropping queries from particular well-known ports |
| `-DOPENSSL_API_COMPAT=10100` | Build using the deprecated OpenSSL APIs so that the `engine` API is available when building with OpenSSL 3.0.0 for PKCS#11 support |
+15 -45
View File
@@ -20,7 +20,6 @@ information regarding copyright ownership.
1. [Building BIND](#build)
1. [Automated testing](#testing)
1. [Documentation](#doc)
1. [Change log](#changes)
1. [Acknowledgments](#ack)
### <a name="intro"/> Introduction
@@ -49,8 +48,7 @@ ongoing maintenance and improvement. BIND is open source software
licensed under the terms of the Mozilla Public License, version 2.0.
For a detailed list of changes made throughout the history of BIND 9, see
the file [CHANGES](CHANGES). See [below](#changes) for details on the
CHANGES file format.
the [changelog](doc/arm/changelog.rst).
For up-to-date versions and release notes, see
[https://www.isc.org/download/](https://www.isc.org/download/).
@@ -74,17 +72,9 @@ 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`.
If you are reporting a bug that is a potential security issue, such as an
assertion failure or other crash in `named`, please do *NOT* use GitLab to
report it. Instead, send mail to
[security-officer@isc.org](mailto:security-officer@isc.org) using our
OpenPGP key to secure your message. (Information about OpenPGP and links
to our key can be found at
[https://www.isc.org/pgpkey](https://www.isc.org/pgpkey).) Please do not
discuss the bug on any public mailing list.
For a general overview of ISC security policies, read the Knowledgebase
article at [https://kb.isc.org/docs/aa-00861](https://kb.isc.org/docs/aa-00861).
For information about ISC's Security Vulnerability Disclosure Policy and
information about reporting potential security issues, please see
`SECURITY.md`.
Professional support and training for BIND are available from
ISC. Contact us at [https://www.isc.org/contact](https://www.isc.org/contact)
@@ -136,7 +126,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::INET6` modules,
Some tests require Perl and the `Net::DNS` and/or `IO::Socket::IP` 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.
@@ -149,9 +139,18 @@ 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. HTML and PDF versions are automatically generated and can
directory. The HTML version is 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.
@@ -162,35 +161,6 @@ can be found in the ISC Knowledgebase at
Additional information on various subjects can be found in other
`README` files throughout the source tree.
### <a name="changes"/> Change log
A detailed list of all changes that have been made throughout the
development of BIND 9 is included in the file CHANGES, with the most recent
changes listed first. Change notes include tags indicating the category of
the change that was made; these categories are:
|Category |Description |
|-------------- |-----------------------------------------------|
| [func] | New feature |
| [bug] | General bug fix |
| [security] | Fix for a significant security flaw |
| [experimental] | Used for new features when the syntax or other aspects of the design are still in flux and may change |
| [port] | Portability enhancement |
| [maint] | Updates to built-in data such as root server addresses and keys |
| [tuning] | Changes to built-in configuration defaults and constants to improve performance |
| [performance] | Other changes to improve server performance |
| [protocol] | Updates to the DNS protocol such as new RR types |
| [test] | Changes to the automatic tests, not affecting server functionality |
| [cleanup] | Minor corrections and refactoring |
| [doc] | Documentation |
| [contrib] | Changes to the contributed tools and libraries in the 'contrib' subdirectory |
| [placeholder] | Used in the main development branch to reserve change numbers for use in other branches, e.g., when fixing a bug that only exists in older releases |
In general, [func] and [experimental] tags only appear in new-feature
releases (i.e., those with version numbers ending in zero). Some new
functionality may be backported to older releases on a case-by-case basis.
All other change types may be applied to all currently supported releases.
#### Bug report identifiers
Most notes in the CHANGES file include a reference to a bug report or
+35
View File
@@ -0,0 +1,35 @@
<!--
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.
-->
# Security Policy
ISC's Security Vulnerability Disclosure Policy is documented in the
relevant [ISC Knowledgebase article][1].
## Reporting possible security issues
If you think you may be seeing a potential security vulnerability in
BIND (for example, a crash with a REQUIRE, INSIST, or ASSERT failure),
please report it immediately by [opening a confidential GitLab issue][2]
(preferred) or emailing bind-security@isc.org.
Please do not discuss undisclosed security vulnerabilities on any public
mailing list. ISC has a long history of handling reported
vulnerabilities promptly and effectively and we respect and acknowledge
responsible reporters.
If you have a crash, you may want to consult the Knowledgebase article
entitled ["What to do if your BIND or DHCP server has crashed"][3].
[1]: https://kb.isc.org/docs/aa-00861
[2]: https://gitlab.isc.org/isc-projects/bind9/-/issues/new?issue[confidential]=true&issuable_template=Bug
[3]: https://kb.isc.org/docs/aa-00340
+2 -4
View File
@@ -4,8 +4,7 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBBIND9_CFLAGS)
$(LIBISCCFG_CFLAGS)
AM_CPPFLAGS += \
-DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
@@ -21,8 +20,7 @@ LDADD += \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBBIND9_LIBS)
$(LIBISCCFG_LIBS)
bin_PROGRAMS = named-checkconf named-checkzone
+11 -40
View File
@@ -14,6 +14,7 @@
/*! \file */
#include <inttypes.h>
#include <netdb.h>
#include <stdbool.h>
#include <stdio.h>
@@ -21,8 +22,6 @@
#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>
@@ -34,7 +33,6 @@
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
@@ -44,10 +42,6 @@
#include <dns/types.h>
#include <dns/zone.h>
#include <isccfg/log.h>
#include <ns/log.h>
#include "check-tool.h"
#ifndef CHECK_SIBLING
@@ -74,7 +68,7 @@
#define ERR_IS_MXCNAME 6
#define ERR_IS_SRVCNAME 7
static const char *dbtype[] = { "rbt" };
static const char *dbtype[] = { ZONEDB_DEFAULT };
int debug = 0;
const char *journal = NULL;
@@ -89,6 +83,7 @@ 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
@@ -97,13 +92,6 @@ dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS | DNS_ZONEOPT_CHECKMX |
DNS_ZONEOPT_CHECKSVCB | DNS_ZONEOPT_CHECKWILDCARD |
DNS_ZONEOPT_WARNMXCNAME | DNS_ZONEOPT_WARNSRVCNAME;
/*
* This needs to match the list in bin/named/log.c.
*/
static isc_logcategory_t categories[] = { { "", 0 },
{ "unmatched", 0 },
{ NULL, 0 } };
static isc_symtab_t *symtab = NULL;
static isc_mem_t *sym_mctx;
@@ -549,30 +537,13 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
}
isc_result_t
setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
isc_logdestination_t destination;
isc_logconfig_t *logconfig = NULL;
isc_log_t *log = NULL;
setup_logging(FILE *errout) {
isc_logconfig_t *logconfig = isc_logconfig_get();
isc_log_createandusechannel(
logconfig, "default_stderr", ISC_LOG_TOFILEDESC,
ISC_LOG_DYNAMIC, ISC_LOGDESTINATION_FILE(errout), 0,
ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_DEFAULT);
isc_log_create(mctx, &log, &logconfig);
isc_log_registercategories(log, categories);
isc_log_setcontext(log);
dns_log_init(log);
dns_log_setcontext(log);
cfg_log_init(log);
ns_log_init(log);
destination.file.stream = errout;
destination.file.name = NULL;
destination.file.versions = ISC_LOG_ROLLNEVER;
destination.file.maximum_size = 0;
isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
ISC_LOG_DYNAMIC, &destination, 0);
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
ISC_R_SUCCESS);
*logp = log;
return (ISC_R_SUCCESS);
}
@@ -596,7 +567,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
zonename, filename, classname);
}
CHECK(dns_zone_create(&zone, mctx, 0));
dns_zone_create(&zone, mctx, 0);
dns_zone_settype(zone, dns_zone_primary);
@@ -617,7 +588,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
CHECK(dns_zone_setjournal(zone, journal));
}
DE_CONST(classname, region.base);
region.base = UNCONST(classname);
region.length = strlen(classname);
CHECK(dns_rdataclass_fromtext(&rdclass, &region));
+1 -1
View File
@@ -29,7 +29,7 @@
ISC_LANG_BEGINDECLS
isc_result_t
setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp);
setup_logging(FILE *errout);
isc_result_t
load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
+53 -49
View File
@@ -24,32 +24,25 @@
#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>
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#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) \
do { \
result = (r); \
@@ -58,16 +51,16 @@ isc_log_t *logc = NULL;
} while (0)
/*% usage */
noreturn static void
ISC_NORETURN static void
usage(void);
static void
usage(void) {
fprintf(stderr,
"usage: %s [-chijlvz] [-p [-x]] [-t directory] "
"usage: %s [-achijlvz] [-p [-x]] [-t directory] "
"[named.conf]\n",
program);
exit(1);
exit(EXIT_SUCCESS);
}
/*% directory callback */
@@ -87,7 +80,7 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
directory = cfg_obj_asstring(obj);
result = isc_dir_chdir(directory);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(obj, logc, ISC_LOG_ERROR,
cfg_obj_log(obj, ISC_LOG_ERROR,
"change directory to '%s' failed: %s\n", directory,
isc_result_totext(result));
return (result);
@@ -159,7 +152,7 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
return (ISC_R_FAILURE);
}
DE_CONST(zclass, r.base);
r.base = UNCONST(zclass);
r.length = strlen(zclass);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS) {
@@ -246,7 +239,9 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
* Skip checks when using an alternate data source.
*/
cfg_map_get(zoptions, "database", &dbobj);
if (dbobj != NULL && strcmp("rbt", cfg_obj_asstring(dbobj)) != 0) {
if (dbobj != NULL &&
strcmp(ZONEDB_DEFAULT, cfg_obj_asstring(dbobj)) != 0)
{
return (ISC_R_SUCCESS);
}
@@ -514,7 +509,7 @@ config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
*classp = defclass;
return (ISC_R_SUCCESS);
}
DE_CONST(cfg_obj_asstring(classobj), r.base);
r.base = UNCONST(cfg_obj_asstring(classobj));
r.length = strlen(r.base);
return (dns_rdataclass_fromtext(classp, &r));
}
@@ -579,10 +574,10 @@ cleanup:
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");
exit(1);
*result = ISC_R_FAILURE;
}
}
@@ -594,20 +589,21 @@ main(int argc, char **argv) {
cfg_obj_t *config = NULL;
const char *conffile = NULL;
isc_mem_t *mctx = NULL;
isc_result_t result;
int exit_status = 0;
isc_result_t result = ISC_R_SUCCESS;
bool load_zones = false;
bool list_zones = false;
bool print = false;
bool nodeprecate = false;
bool allconfigs = 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 "cdhijlm:t:pvxz"
#define CMDLINE_FLAGS "acdhijlm:nt:pvxz"
while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (c) {
case 'm':
@@ -634,8 +630,12 @@ 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':
loadplugins = false;
checkflags &= ~BIND_CHECK_PLUGINS;
break;
case 'd':
@@ -657,12 +657,16 @@ main(int argc, char **argv) {
case 'm':
break;
case 'n':
allconfigs = true;
break;
case 't':
result = isc_dir_chroot(isc_commandline_argument);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "isc_dir_chroot: %s\n",
isc_result_totext(result));
exit(1);
CHECK(result);
}
break;
@@ -672,7 +676,8 @@ main(int argc, char **argv) {
case 'v':
printf("%s\n", PACKAGE_VERSION);
exit(0);
result = ISC_R_SUCCESS;
goto cleanup;
case 'x':
flags |= CFG_PRINTER_XKEY;
@@ -692,25 +697,27 @@ 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);
exit(1);
CHECK(ISC_R_FAILURE);
}
}
if (((flags & CFG_PRINTER_XKEY) != 0) && !print) {
fprintf(stderr, "%s: -x cannot be used without -p\n", program);
exit(1);
CHECK(ISC_R_FAILURE);
}
if (print && list_zones) {
fprintf(stderr, "%s: -l cannot be used with -p\n", program);
exit(1);
CHECK(ISC_R_FAILURE);
}
if (isc_commandline_index + 1 < argc) {
isc_mem_detach(&mctx);
usage();
}
if (argv[isc_commandline_index] != NULL) {
@@ -720,43 +727,40 @@ main(int argc, char **argv) {
conffile = NAMED_CONFFILE;
}
RUNTIME_CHECK(setup_logging(mctx, stdout, &logc) == ISC_R_SUCCESS);
CHECK(setup_logging(stdout));
RUNTIME_CHECK(cfg_parser_create(mctx, logc, &parser) == ISC_R_SUCCESS);
CHECK(cfg_parser_create(mctx, &parser));
if (nodeprecate) {
cfg_parser_setflags(parser, CFG_PCTX_NODEPRECATED, true);
}
if (allconfigs) {
cfg_parser_setflags(parser, CFG_PCTX_ALLCONFIGS, true);
}
cfg_parser_setcallback(parser, directory_callback, NULL);
if (cfg_parse_file(parser, conffile, &cfg_type_namedconf, &config) !=
ISC_R_SUCCESS)
{
exit(1);
CHECK(cfg_parse_file(parser, conffile, &cfg_type_namedconf, &config));
CHECK(isccfg_check_namedconf(config, checkflags, mctx));
if (load_zones || list_zones) {
CHECK(load_zones_fromconfig(config, mctx, list_zones));
}
result = bind9_check_namedconf(config, loadplugins, logc, mctx);
if (result != ISC_R_SUCCESS) {
exit_status = 1;
if (print) {
cfg_printx(config, flags, output, &result);
}
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;
}
cleanup:
if (config != NULL) {
cfg_obj_destroy(parser, &config);
}
if (print && exit_status == 0) {
cfg_printx(config, flags, output, NULL);
if (parser != NULL) {
cfg_parser_destroy(&parser);
}
cfg_obj_destroy(parser, &config);
cfg_parser_destroy(&parser);
if (mctx != NULL) {
isc_mem_destroy(&mctx);
}
isc_log_destroy(&logc);
isc_mem_destroy(&mctx);
return (exit_status);
return (result == ISC_R_SUCCESS ? 0 : 1);
}
+17 -5
View File
@@ -21,7 +21,7 @@ named-checkconf - named configuration file syntax checking tool
Synopsis
~~~~~~~~
:program:`named-checkconf` [**-chjlvz**] [**-p** [**-x** ]] [**-t** directory] {filename}
:program:`named-checkconf` [**-achjlnvz**] [**-p** [**-x** ]] [**-t** directory] {filename}
Description
~~~~~~~~~~~
@@ -32,14 +32,22 @@ 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.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.
``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.
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.
@@ -63,6 +71,10 @@ Options
This option ignores warnings on deprecated options.
.. option:: -n
Do not error on options that are disabled in this build.
.. option:: -p
This option prints out the :iscman:`named.conf` and included files in canonical form if
+27 -38
View File
@@ -24,16 +24,13 @@
#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>
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/masterdump.h>
#include <dns/name.h>
@@ -64,7 +61,7 @@ static enum { progmode_check, progmode_compile } progmode;
} \
} while (0)
noreturn static void
ISC_NORETURN static void
usage(void);
static void
@@ -81,7 +78,7 @@ usage(void) {
"%s zonename [ (filename|-) ]\n",
prog_name,
progmode == progmode_check ? "[-o filename]" : "-o filename");
exit(1);
exit(EXIT_FAILURE);
}
static void
@@ -97,7 +94,6 @@ main(int argc, char **argv) {
int c;
char *origin = NULL;
const char *filename = NULL;
isc_log_t *lctx = NULL;
isc_result_t result;
char classname_in[] = "IN";
char *classname = classname_in;
@@ -149,15 +145,12 @@ main(int argc, char **argv) {
UNREACHABLE();
}
/* Compilation specific defaults */
/* When compiling, disable checks by default */
if (progmode == progmode_compile) {
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);
zone_options = 0;
docheckmx = false;
docheckns = false;
dochecksrv = false;
}
#define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
@@ -211,7 +204,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -i: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -245,7 +238,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -k: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -256,7 +249,7 @@ main(int argc, char **argv) {
if (*endp != '\0') {
fprintf(stderr, "source serial number "
"must be numeric");
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -267,7 +260,7 @@ main(int argc, char **argv) {
if (*endp != '\0') {
fprintf(stderr, "maximum TTL "
"must be numeric");
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -284,7 +277,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -n: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -301,7 +294,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -m: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -326,7 +319,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -r: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -339,7 +332,7 @@ main(int argc, char **argv) {
fprintf(stderr,
"unknown or unsupported style: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -349,13 +342,13 @@ main(int argc, char **argv) {
fprintf(stderr, "isc_dir_chroot: %s: %s\n",
isc_commandline_argument,
isc_result_totext(result));
exit(1);
exit(EXIT_FAILURE);
}
break;
case 'v':
printf("%s\n", PACKAGE_VERSION);
exit(0);
exit(EXIT_SUCCESS);
case 'w':
workdir = isc_commandline_argument;
@@ -369,7 +362,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -C: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -390,7 +383,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -M: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -407,7 +400,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -S: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -419,7 +412,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "invalid argument to -T: %s\n",
isc_commandline_argument);
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -443,7 +436,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", prog_name,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -452,7 +445,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(1);
exit(EXIT_FAILURE);
}
}
@@ -468,7 +461,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "unknown file format: %s\n",
inputformatstr);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -486,12 +479,12 @@ main(int argc, char **argv) {
rawversion > 1U)
{
fprintf(stderr, "unknown raw format version\n");
exit(1);
exit(EXIT_FAILURE);
}
} else {
fprintf(stderr, "unknown file format: %s\n",
outputformatstr);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -530,8 +523,7 @@ main(int argc, char **argv) {
isc_mem_create(&mctx);
if (!quiet) {
RUNTIME_CHECK(setup_logging(mctx, errout, &lctx) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(setup_logging(errout) == ISC_R_SUCCESS);
}
origin = argv[isc_commandline_index++];
@@ -571,9 +563,6 @@ main(int argc, char **argv) {
fprintf(errout, "OK\n");
}
destroy();
if (lctx != NULL) {
isc_log_destroy(&lctx);
}
isc_mem_destroy(&mctx);
return ((result == ISC_R_SUCCESS) ? 0 : 1);
+24 -18
View File
@@ -30,10 +30,16 @@ 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.
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.
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`.
Options
~~~~~~~
@@ -77,13 +83,13 @@ Options
``check-svcb:fail`` turns on additional checks on ``_dns`` SVCB
records and ``check-svcb:ignore`` disables these checks. The
default is ``check-svcb:fail``.
default is ``check-svcb:ignore``.
.. option:: -i mode
This option performs post-load zone integrity checks. Possible modes are
``full`` (the default), ``full-sibling``, ``local``,
``local-sibling``, and ``none``.
``full``, ``full-sibling``, ``local``,
``local-sibling``, and ``none`` (the default).
Mode ``full`` checks that MX records refer to A or AAAA records
(both in-zone and out-of-zone hostnames). Mode ``local`` only
@@ -127,7 +133,7 @@ Options
.. option:: -k mode
This option performs ``check-names`` checks with the specified failure mode.
Possible modes are ``fail`` (the default), ``warn``, and ``ignore``.
Possible modes are ``fail``, ``warn``, and ``ignore`` (the default).
.. option:: -l ttl
@@ -144,19 +150,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`` (the default), and
``ignore``.
addresses. Possible modes are ``fail``, ``warn``, and
``ignore`` (the default).
.. option:: -M mode
This option checks whether a MX record refers to a CNAME. Possible modes are
``fail``, ``warn`` (the default), and ``ignore``.
``fail``, ``warn``, and ``ignore`` (the default).
.. option:: -n mode
This option specifies whether NS records should be checked to see if they are
addresses. Possible modes are ``fail`` (the default), ``warn``, and
``ignore``.
addresses. Possible modes are ``fail``, ``warn``, and
``ignore`` (the default).
.. option:: -o filename
@@ -167,7 +173,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`` (the default), and ``ignore``.
``warn``, and ``ignore`` (the default).
.. option:: -s style
@@ -180,7 +186,7 @@ Options
.. option:: -S mode
This option checks whether an SRV record refers to a CNAME. Possible modes are
``fail``, ``warn`` (the default), and ``ignore``.
``fail``, ``warn``, and ``ignore`` (the default).
.. option:: -t directory
@@ -192,7 +198,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`` (the default) and ``ignore``.
modes are ``warn`` and ``ignore`` (the default).
.. option:: -w directory
@@ -210,7 +216,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``
(the default) and ``ignore``.
and ``ignore`` (the default).
.. option:: zonename
@@ -229,5 +235,5 @@ and 0 otherwise.
See Also
~~~~~~~~
:iscman:`named(8) <named>`, :iscman:`named-checkconf(8) <named-checkconf>`, :iscman:`named-checkzone(8) <named-checkzone>`, `:rfc:`1035`,
:iscman:`named(8) <named>`, :iscman:`named-checkconf(8) <named-checkconf>`, :iscman:`named-checkzone(8) <named-checkzone>`, :rfc:`1035`,
BIND 9 Administrator Reference Manual.
+2 -7
View File
@@ -21,7 +21,6 @@
#include <isc/buffer.h>
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -121,11 +120,9 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
fatal("unsupported algorithm %d\n", alg);
}
DO("initialize dst library", dst_lib_init(mctx, NULL));
DO("generate key",
dst_key_generate(dns_rootname, alg, keysize, 0, 0, DNS_KEYPROTO_ANY,
dns_rdataclass_in, mctx, &key, NULL));
dns_rdataclass_in, NULL, mctx, &key, NULL));
isc_buffer_init(&key_rawbuffer, &key_rawsecret, sizeof(key_rawsecret));
@@ -133,14 +130,12 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
isc_buffer_usedregion(&key_rawbuffer, &key_rawregion);
DO("bsse64 encode secret",
DO("base64 encode secret",
isc_base64_totext(&key_rawregion, -1, "", key_txtbuffer));
if (key != NULL) {
dst_key_free(&key);
}
dst_lib_destroy();
}
/*%
+7 -7
View File
@@ -34,7 +34,6 @@
#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>
@@ -61,7 +60,7 @@ bool verbose = false;
const char *keyfile, *keydef;
noreturn static void
ISC_NORETURN static void
usage(int status);
static void
@@ -147,7 +146,8 @@ main(int argc, char **argv) {
keyfile = isc_commandline_argument;
break;
case 'h':
usage(0);
usage(EXIT_SUCCESS);
break;
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(1);
usage(EXIT_FAILURE);
} else {
usage(0);
usage(EXIT_SUCCESS);
}
break;
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -210,7 +210,7 @@ main(int argc, char **argv) {
POST(argv);
if (argc > 0) {
usage(1);
usage(EXIT_FAILURE);
}
if (alg == DST_ALG_HMACMD5) {
+11 -12
View File
@@ -30,7 +30,6 @@
#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>
@@ -54,7 +53,7 @@ const char *progname;
static enum { progmode_keygen, progmode_confgen } progmode;
bool verbose = false; /* needed by util.c but not used here */
noreturn static void
ISC_NORETURN static void
usage(int status);
static void
@@ -139,13 +138,13 @@ main(int argc, char **argv) {
keysize = alg_bits(alg);
break;
case 'h':
usage(0);
usage(EXIT_SUCCESS);
case 'k':
case 'y':
if (progmode == progmode_confgen) {
keyname = isc_commandline_argument;
} else {
usage(1);
usage(EXIT_FAILURE);
}
break;
case 'M':
@@ -158,7 +157,7 @@ main(int argc, char **argv) {
if (progmode == progmode_confgen) {
quiet = true;
} else {
usage(1);
usage(EXIT_FAILURE);
}
break;
case 'r':
@@ -168,29 +167,29 @@ main(int argc, char **argv) {
if (progmode == progmode_confgen) {
self_domain = isc_commandline_argument;
} else {
usage(1);
usage(EXIT_FAILURE);
}
break;
case 'z':
if (progmode == progmode_confgen) {
zone = isc_commandline_argument;
} else {
usage(1);
usage(EXIT_FAILURE);
}
break;
case '?':
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option);
usage(1);
usage(EXIT_FAILURE);
} else {
usage(0);
usage(EXIT_SUCCESS);
}
break;
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -201,11 +200,11 @@ main(int argc, char **argv) {
POST(argv);
if (self_domain != NULL && zone != NULL) {
usage(1); /* -s and -z cannot coexist */
usage(EXIT_FAILURE); /* -s and -z cannot coexist */
}
if (argc > isc_commandline_index) {
usage(1);
usage(EXIT_FAILURE);
}
/* Use canonical algorithm name */
+4 -3
View File
@@ -27,9 +27,10 @@ Synopsis
Description
~~~~~~~~~~~
: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.
: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.
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``.
+5 -3
View File
@@ -13,13 +13,15 @@
/*! \file */
#include "util.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/print.h>
#include <isc/tls.h>
#include "util.h"
extern bool verbose;
extern const char *progname;
@@ -45,5 +47,5 @@ fatal(const char *format, ...) {
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr, "\n");
exit(1);
_exit(EXIT_FAILURE);
}
+1 -1
View File
@@ -36,7 +36,7 @@ ISC_LANG_BEGINDECLS
void
notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
noreturn void
ISC_NORETURN void
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
ISC_LANG_ENDDECLS
+5 -4
View File
@@ -4,8 +4,8 @@ AM_CPPFLAGS += \
-I$(top_builddir)/include \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBIRS_CFLAGS)
$(LIBNS_CFLAGS) \
$(LIBISCCFG_CFLAGS)
AM_CPPFLAGS += \
-DSYSCONFDIR=\"${sysconfdir}\"
@@ -14,8 +14,9 @@ bin_PROGRAMS = delv
delv_SOURCES = \
delv.c
delv_LDADD = \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBIRS_LIBS)
$(LIBNS_LIBS) \
$(LIBISCCFG_LIBS)
+571 -194
View File
File diff suppressed because it is too large Load Diff
+75 -22
View File
@@ -102,20 +102,21 @@ Options
.. option:: -a anchor-file
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 (".").
This option specifies a file from which to read an alternate
DNSSEC root zone trust anchor.
Keys that do not match the root zone name are ignored. An alternate
key name can be specified using the :option:`+root` option.
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.
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`.
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.
.. option:: -b address
@@ -229,6 +230,36 @@ 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
@@ -236,11 +267,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
@@ -249,15 +280,27 @@ assign values to options like the timeout interval. They have the form
.. option:: +mtrace, +nomtrace
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 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 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
@@ -294,6 +337,18 @@ 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 32.
.. option:: +trust, +notrust
This option controls whether to display the trust level when printing a record.
@@ -354,8 +409,6 @@ assign values to options like the timeout interval. They have the form
Files
~~~~~
|bind_keys|
``/etc/resolv.conf``
See Also
-4
View File
@@ -4,8 +4,6 @@ AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBDNS_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBIRS_CFLAGS) \
$(LIBBIND9_CFLAGS) \
$(LIBIDN2_CFLAGS) \
$(LIBUV_CFLAGS)
@@ -14,8 +12,6 @@ LDADD += \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBIRS_LIBS) \
$(LIBBIND9_LIBS) \
$(LIBIDN2_LIBS)
noinst_LTLIBRARIES = libdighost.la
+411 -58
View File
@@ -24,10 +24,8 @@
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/time.h>
#include <isc/util.h>
@@ -113,7 +111,7 @@ usage(void) {
fprintf(stderr, "Press <Help> for complete list of options\n");
}
#else /* if TARGET_OS_IPHONE */
noreturn static void
ISC_NORETURN static void
usage(void);
static void
@@ -121,7 +119,7 @@ usage(void) {
print_usage(stderr);
fprintf(stderr, "\nUse \"dig -h\" (or \"dig -h | more\") "
"for complete list of options\n");
exit(1);
exit(EXIT_FAILURE);
}
#endif /* if TARGET_OS_IPHONE */
@@ -227,7 +225,7 @@ help(void) {
" +[no]http-plain[=###] (DNS over plain HTTP "
"mode) "
"[/]\n"
" +[no]https-plain-get (Use GET instead of "
" +[no]http-plain-get (Use GET instead of "
"default POST method while using plain HTTP)\n"
" +[no]identify (ID responders in short "
"answers)\n"
@@ -254,6 +252,14 @@ help(void) {
"request)\n"
" +padding=### (Set padding block size "
"[0])\n"
" "
"+[no]proxy[=src_addr[#src_port]-dst_addr[#dst_port]] "
"(Add PROXYv2 headers to the queries. If addresses are omitted, "
"LOCAL PROXYv2 headers are added)\n"
" "
"+[no]proxy-plain[=src_addr[#src_port]-dst_addr[#dst_port]] "
"(The same as '+[no]proxy', but send PROXYv2 headers ahead of "
"any encryption if an encrypted transport is used)\n"
" +qid=### (Specify the query ID to "
"use when sending queries)\n"
" +[no]qr (Print question before "
@@ -300,8 +306,7 @@ help(void) {
" +[no]tls-keyfile=file (Load client TLS "
"private key from file)\n"
" +[no]trace (Trace delegation down "
"from root "
"[+dnssec])\n"
"from root [implies +dnssec])\n"
" +tries=### (Set number of UDP "
"attempts) [3]\n"
" +[no]ttlid (Control display of ttls "
@@ -367,6 +372,39 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
}
printf(";; SERVER: %s(%s) (%s)\n", fromtext, query->userarg,
proto);
if (query->lookup->proxy_mode) {
printf(";; CLIENT PROXY HEADER");
if ((dig_lookup_is_tls(query->lookup) ||
(query->lookup->https_mode &&
!query->lookup->http_plain)) &&
query->lookup->proxy_plain)
{
printf(" (plain)");
}
printf(": ");
if (!query->lookup->proxy_local) {
char src_buf[ISC_SOCKADDR_FORMATSIZE] = { 0 };
char dst_buf[ISC_SOCKADDR_FORMATSIZE] = { 0 };
isc_sockaddr_format(
&query->lookup->proxy_src_addr, src_buf,
sizeof(src_buf));
isc_sockaddr_format(
&query->lookup->proxy_dst_addr, dst_buf,
sizeof(dst_buf));
printf("source: %s, destination: %s", src_buf,
dst_buf);
} else {
printf("LOCAL");
}
printf("\n");
}
time(&tnow);
(void)localtime_r(&tnow, &tmnow);
@@ -489,7 +527,8 @@ dns64prefix_answer(dns_message_t *msg, isc_buffer_t *buf) {
size_t i, count = 10;
name = dns_fixedname_initname(&fixed);
result = dns_name_fromstring(name, "ipv4only.arpa", 0, NULL);
result = dns_name_fromstring(name, "ipv4only.arpa", dns_rootname, 0,
NULL);
check_result(result, "dns_name_fromstring");
result = dns_message_findname(msg, DNS_SECTION_ANSWER, name,
@@ -709,8 +748,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
char *hash;
int pf;
printf("-\n");
printf(" type: MESSAGE\n");
printf("- type: MESSAGE\n");
printf(" message:\n");
if (isquery) {
@@ -1053,6 +1091,323 @@ printgreeting(int argc, char **argv, dig_lookup_t *lookup) {
goto invalid_option; \
} while (0)
/*
* Parse source and destination addresses in the same format as used by "kdig":
*
* SRC_ADDR[#SRC_PORT]-DST_ADDR[#DST_PORT]
*
* This can be described (pretty closely for our purpose) using the
* following EBNF grammar:
*
* S = proxy-addrs. (* start rule *)
* proxy-addrs = addr "-" addr EOF.
* addr = addr-char { addr-char } ["#" port ].
* port = digit { digit }.
* addr-char = <aby but "#", "-", EOF >.
* EOF = '\0'.
*/
#define MATCH(ch) (st->str[0] == (ch))
#define MATCH_DIGIT() isdigit((unsigned char)(st->str[0]))
#define ADVANCE() st->str++
#define GETP() (st->str)
typedef struct isc_proxy_addrs_parser_state {
const char *str;
const char *last_addr_start;
size_t last_addr_len;
const char *last_port_start;
size_t last_port_len;
const char *src_addr_start;
size_t src_addr_len;
const char *src_port_start;
size_t src_port_len;
const char *dst_addr_start;
size_t dst_addr_len;
const char *dst_port_start;
size_t dst_port_len;
} isc_proxy_addrs_parser_state_t;
static bool
rule_proxy_addrs(isc_proxy_addrs_parser_state_t *st);
static bool
rule_addr(isc_proxy_addrs_parser_state_t *st);
static bool
rule_port(isc_proxy_addrs_parser_state_t *st);
static bool
rule_addr_char(isc_proxy_addrs_parser_state_t *st);
static void
proxy_handle_port_string(const char *port_start, const size_t port_len,
in_port_t *pport) {
char buf[512] = { 0 }; /* max */
size_t string_size = 0, max_string_bytes = 0;
unsigned int tmp;
isc_result_t result;
string_size = port_len + 1;
max_string_bytes = string_size > sizeof(buf) ? sizeof(buf)
: string_size;
(void)strlcpy(buf, port_start, max_string_bytes);
result = parse_uint(&tmp, buf, MAXPORT, "port number");
if (result != ISC_R_SUCCESS) {
fatal("Couldn't parse port number");
}
*pport = tmp;
}
static isc_result_t
proxy_handle_addr_string(const char *addr_start, const size_t addr_len,
const in_port_t addr_port, isc_sockaddr_t *addr) {
isc_result_t result = ISC_R_FAILURE;
char buf[512] = { 0 }; /* max */
size_t string_size = 0, max_string_bytes = 0;
struct in_addr ipv4 = { 0 };
struct in6_addr ipv6 = { 0 };
int ret = 0;
string_size = addr_len + 1;
max_string_bytes = string_size > sizeof(buf) ? sizeof(buf)
: string_size;
(void)strlcpy(buf, addr_start, max_string_bytes);
ret = inet_pton(AF_INET, buf, &ipv4);
if (ret == 1) {
isc_sockaddr_fromin(addr, &ipv4, addr_port);
result = ISC_R_SUCCESS;
} else {
ret = inet_pton(AF_INET6, buf, &ipv6);
if (ret == 1) {
isc_sockaddr_fromin6(addr, &ipv6, addr_port);
result = ISC_R_SUCCESS;
}
}
return (result);
}
static bool
parse_proxy_addresses(const char *addrs, isc_sockaddr_t *psrc,
isc_sockaddr_t *pdst) {
isc_result_t result = ISC_R_FAILURE;
isc_sockaddr_t src = { 0 }, dst = { 0 };
isc_proxy_addrs_parser_state_t st = { 0 };
in_port_t src_port = 0, dst_port = 53; /* Follow kdig footsteps */
REQUIRE(addrs != NULL && *addrs != '\0');
REQUIRE(psrc != NULL);
REQUIRE(pdst != NULL);
st.str = addrs;
/* start syntax analysis and verification */
if (!rule_proxy_addrs(&st)) {
warn("PROXY source and destination addresses cannot be parsed");
return (false);
}
/* get port numeric values */
if (st.src_port_len > 0) {
INSIST(st.src_port_start != NULL);
proxy_handle_port_string(st.src_port_start, st.src_port_len,
&src_port);
}
if (st.dst_port_len > 0) {
INSIST(st.dst_port_start != NULL);
proxy_handle_port_string(st.dst_port_start, st.dst_port_len,
&dst_port);
}
/* get addresses */
INSIST(st.src_addr_len > 0);
INSIST(st.src_addr_start != NULL);
INSIST(st.dst_addr_len > 0);
INSIST(st.dst_addr_start != NULL);
result = proxy_handle_addr_string(st.src_addr_start, st.src_addr_len,
src_port, &src);
if (result != ISC_R_SUCCESS) {
warn("Cannot get PROXY source address: %s",
isc_result_totext(result));
return (false);
}
result = proxy_handle_addr_string(st.dst_addr_start, st.dst_addr_len,
dst_port, &dst);
if (result != ISC_R_SUCCESS) {
warn("Cannot get PROXY destination address: %s",
isc_result_totext(result));
return (false);
}
/* addresses should be of the same type */
if (isc_sockaddr_pf(&src) != isc_sockaddr_pf(&dst)) {
warn("PROXY source and destination addresses must be of the "
"same type");
return (false);
}
*psrc = src;
*pdst = dst;
return (true);
}
static bool
rule_proxy_addrs(isc_proxy_addrs_parser_state_t *st) {
if (!rule_addr(st)) {
return (false);
}
st->src_addr_start = st->last_addr_start;
st->src_addr_len = st->last_addr_len;
st->src_port_start = st->last_port_start;
st->src_port_len = st->last_port_len;
if (!MATCH('-')) {
return (false);
}
ADVANCE();
if (!rule_addr(st)) {
return (false);
}
st->dst_addr_start = st->last_addr_start;
st->dst_addr_len = st->last_addr_len;
st->dst_port_start = st->last_port_start;
st->dst_port_len = st->last_port_len;
if (!MATCH('\0')) {
return (false);
}
return (true);
}
static bool
rule_addr(isc_proxy_addrs_parser_state_t *st) {
const char *start = GETP();
if (!rule_addr_char(st)) {
return (false);
}
while (rule_addr_char(st)) {
/* skip */
}
st->last_addr_start = start;
st->last_addr_len = GETP() - start;
if (MATCH('#')) {
ADVANCE();
if (!rule_port(st)) {
return (false);
}
}
return (true);
}
static bool
rule_port(isc_proxy_addrs_parser_state_t *st) {
const char *start = GETP();
if (!MATCH_DIGIT()) {
return (false);
}
ADVANCE();
while (MATCH_DIGIT()) {
ADVANCE();
}
st->last_port_start = start;
st->last_port_len = GETP() - start;
return (true);
}
static bool
rule_addr_char(isc_proxy_addrs_parser_state_t *st) {
if (MATCH('#') || MATCH('-') || MATCH('\0')) {
return (false);
}
ADVANCE();
return (true);
}
#undef GETP
#undef ADVANCE
#undef MATCH_DIGIT
#undef MATCH
static bool
plus_proxy_handle_addresses(const char *value, const bool state,
dig_lookup_t *lookup) {
lookup->proxy_mode = state;
if (!state) {
/*
* We are not interested in the option value in that
* case
*/
return (true);
}
if (value == NULL || *value == '\0') {
lookup->proxy_local = true;
return (true);
}
if (!parse_proxy_addresses(value, &lookup->proxy_src_addr,
&lookup->proxy_dst_addr))
{
return (false);
}
return (true);
}
static bool
plus_proxy_options(const char *cmd, const char *value, const bool state,
dig_lookup_t *lookup) {
switch (cmd[5]) {
case '-':
FULLCHECK("proxy-plain");
lookup->proxy_plain = state;
if (!plus_proxy_handle_addresses(value, state, lookup)) {
goto invalid_option;
}
break;
case '\0':
FULLCHECK("proxy");
if (!plus_proxy_handle_addresses(value, state, lookup)) {
goto invalid_option;
}
break;
default:
goto invalid_option;
}
return (true);
invalid_option:
return (false);
}
static bool
plus_tls_options(const char *cmd, const char *value, const bool state,
dig_lookup_t *lookup) {
@@ -1319,6 +1674,8 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
switch (cmd[1]) {
case 'e': /* defname */
FULLCHECK("defname");
fprintf(stderr, ";; +[no]defname option is "
"deprecated; use +[no]search\n");
if (!lookup->trace) {
usesearch = state;
}
@@ -1439,6 +1796,10 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
"ednsflags");
goto exit_or_usage;
}
if (lookup->edns == -1) {
lookup->edns =
DEFAULT_EDNS_VERSION;
}
lookup->ednsflags = num;
break;
case 'n':
@@ -1693,12 +2054,11 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
goto invalid_option;
}
break;
case 'm': /* multiline */
case 'm':
switch (cmd[1]) {
case 'a':
FULLCHECK("mapped");
fprintf(stderr, ";; +mapped option is deprecated");
break;
fatal("+mapped option no longer supported");
case 'u':
FULLCHECK("multiline");
lookup->multiline = state;
@@ -1798,19 +2158,30 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
}
break;
case 'p':
FULLCHECK("padding");
if (state && lookup->edns == -1) {
lookup->edns = DEFAULT_EDNS_VERSION;
switch (cmd[1]) {
case 'a':
FULLCHECK("padding");
if (state && lookup->edns == -1) {
lookup->edns = DEFAULT_EDNS_VERSION;
}
if (value == NULL) {
goto need_value;
}
result = parse_uint(&num, value, 512, "padding");
if (result != ISC_R_SUCCESS) {
warn("Couldn't parse padding");
goto exit_or_usage;
}
lookup->padding = (uint16_t)num;
break;
case 'r':
if (!plus_proxy_options(cmd, value, state, lookup)) {
goto invalid_option;
}
break;
default:
goto invalid_option;
}
if (value == NULL) {
goto need_value;
}
result = parse_uint(&num, value, 512, "padding");
if (result != ISC_R_SUCCESS) {
warn("Couldn't parse padding");
goto exit_or_usage;
}
lookup->padding = (uint16_t)num;
break;
case 'q':
switch (cmd[1]) {
@@ -1941,8 +2312,7 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
break;
case 'i': /* sigchase */
FULLCHECK("sigchase");
fprintf(stderr, ";; +sigchase option is deprecated");
break;
fatal("+sigchase option no longer supported");
case 'p': /* split */
FULLCHECK("split");
if (value != NULL && !state) {
@@ -2066,8 +2436,7 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
break;
case 'o':
FULLCHECK("topdown");
fprintf(stderr, ";; +topdown option is deprecated");
break;
fatal("+topdown option no longer supported");
case 'r':
switch (cmd[2]) {
case 'a': /* trace */
@@ -2108,9 +2477,8 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
break;
case 'u': /* trusted-key */
FULLCHECK("trusted-key");
fprintf(stderr, ";; +trusted-key option is "
"deprecated");
break;
fatal("+trusted-key option "
"no longer supported");
default:
goto invalid_option;
}
@@ -2147,9 +2515,8 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
switch (cmd[2]) {
case 'e':
FULLCHECK("unexpected");
fprintf(stderr, ";; +unexpected option "
"is deprecated");
break;
fatal("+unexpected option "
"no longer supported");
case 'k':
FULLCHECK("unknownformat");
lookup->print_unknown_format = state;
@@ -2157,11 +2524,7 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
default:
goto invalid_option;
}
break;
default:
goto invalid_option;
}
break;
case 'v':
FULLCHECK("vc");
@@ -2196,6 +2559,7 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
#if !TARGET_OS_IPHONE
exit_or_usage:
cleanup_openssl_refs();
digexit();
#endif /* if !TARGET_OS_IPHONE */
}
@@ -2263,17 +2627,15 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
break;
case 'h':
help();
exit(0);
exit(EXIT_SUCCESS);
break;
case 'i':
/* deprecated */
break;
fatal("-%c removed", option[0]);
case 'm': /* memdebug */
/* memdebug is handled in preparse_args() */
break;
case 'n':
/* deprecated */
break;
fatal("-%c removed", option[0]);
case 'r':
debug("digrc (late)");
digrc = false;
@@ -2283,7 +2645,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
break;
case 'v':
printf("DiG %s\n", PACKAGE_VERSION);
exit(0);
exit(EXIT_SUCCESS);
break;
}
if (strlen(option) > 1U) {
@@ -2458,7 +2820,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
ptr = ptr2;
ptr2 = ptr3;
} else {
hmacname = DNS_TSIG_HMACMD5_NAME;
hmac_alg = DST_ALG_HMACMD5;
digestbits = 0;
}
/* XXXONDREJ: FIXME */
@@ -2492,7 +2854,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
ISC_LIST_APPEND(lookup_list, *lookup, link);
} else {
fprintf(stderr, "Invalid IP address %s\n", value);
exit(1);
exit(EXIT_FAILURE);
}
return (value_from_next);
invalid_option:
@@ -2943,8 +3305,7 @@ dig_error(const char *format, ...) {
va_list args;
if (yaml) {
printf("-\n");
printf(" type: DIG_ERROR\n");
printf("- type: DIG_ERROR\n");
/*
* Print an indent before a literal block quote.
@@ -2961,10 +3322,7 @@ dig_error(const char *format, ...) {
va_start(args, format);
vprintf(format, args);
va_end(args);
if (!yaml) {
printf("\n");
}
printf("\n"); /* We get the error without a newline */
}
static void
@@ -3045,11 +3403,6 @@ dig_startup(void) {
isc_loopmgr_run(loopmgr);
}
void
dig_query_start(void) {
start_lookup();
}
void
dig_shutdown(void) {
destroy_lookup(default_lookup);
+49 -23
View File
@@ -507,6 +507,44 @@ 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.
@@ -576,11 +614,6 @@ 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
@@ -650,25 +683,23 @@ 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 also set when :option:`+trace` is set, to better emulate the
default queries from a name server.
: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:: +tries=T
@@ -676,11 +707,6 @@ 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.
+167 -132
View File
@@ -25,6 +25,7 @@
#include <inttypes.h>
#include <limits.h>
#include <locale.h>
#include <netdb.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
@@ -36,23 +37,21 @@
#include <isc/base64.h>
#include <isc/file.h>
#include <isc/getaddresses.h>
#include <isc/hex.h>
#include <isc/lang.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/managers.h>
#include <isc/netaddr.h>
#include <isc/netdb.h>
#include <isc/nonce.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/result.h>
#include <isc/safe.h>
#include <isc/serial.h>
#include <isc/sockaddr.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/tls.h>
#include <isc/types.h>
@@ -62,7 +61,6 @@
#include <dns/byaddr.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/opcode.h>
@@ -81,8 +79,6 @@
#include <irs/resconf.h>
#include <bind9/getaddresses.h>
#include "dighost.h"
#define systemlocale(l) (void)setlocale(l, "")
@@ -96,16 +92,13 @@ static bool cancel_now = false;
bool check_ra = false, have_ipv4 = false, have_ipv6 = false,
specified_source = false, free_now = false, usesearch = false,
showsearch = false, is_dst_up = false, keep_open = false, verbose = false,
yaml = false;
showsearch = false, keep_open = false, verbose = false, yaml = false;
in_port_t port = 53;
bool port_set = false;
unsigned int timeout = 0;
unsigned int extrabytes;
isc_mem_t *mctx = NULL;
isc_log_t *lctx = NULL;
isc_nm_t *netmgr = NULL;
isc_taskmgr_t *taskmgr = NULL;
isc_loopmgr_t *loopmgr = NULL;
isc_loop_t *mainloop = NULL;
isc_sockaddr_t localaddr;
@@ -142,7 +135,7 @@ char keyfile[MXNAME] = "";
char keysecret[MXNAME] = "";
unsigned char cookie_secret[33];
unsigned char cookie[8];
const dns_name_t *hmacname = NULL;
dst_algorithm_t hmac_alg = DST_ALG_UNKNOWN;
unsigned int digestbits = 0;
isc_buffer_t *namebuf = NULL;
dns_tsigkey_t *tsigkey = NULL;
@@ -328,10 +321,9 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
/* This is a valid IPv6 address. */
dns_fixedname_t fname;
dns_name_t *name;
unsigned int options = 0;
name = dns_fixedname_initname(&fname);
result = dns_byaddr_createptrname(&addr, options, name);
result = dns_byaddr_createptrname(&addr, name);
if (result != ISC_R_SUCCESS) {
return (result);
}
@@ -364,8 +356,6 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
}
}
void (*dighost_pre_exit_hook)(void) = NULL;
#if TARGET_OS_IPHONE
void
warn(const char *format, ...) {
@@ -398,10 +388,7 @@ digexit(void) {
exitcode = 10;
}
if (fatalexit != 0) {
exitcode = fatalexit;
}
if (dighost_pre_exit_hook != NULL) {
dighost_pre_exit_hook();
_exit(fatalexit);
}
exit(exitcode);
}
@@ -416,6 +403,11 @@ fatal(const char *format, ...) {
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr, "\n");
if (fatalexit == 0 && exitcode != 0) {
fatalexit = exitcode;
} else if (fatalexit == 0) {
fatalexit = EXIT_FAILURE;
}
digexit();
}
@@ -427,7 +419,7 @@ debug(const char *format, ...) {
if (debugging) {
fflush(stdout);
if (debugtiming) {
TIME_NOW(&t);
t = isc_time_now();
fprintf(stderr, "%u.%06u: ", isc_time_seconds(&t),
isc_time_nanoseconds(&t) / 1000);
}
@@ -538,8 +530,7 @@ set_nameserver(char *opt) {
}
isc_loopmgr_blocking(loopmgr);
result = bind9_getaddresses(opt, 0, sockaddrs, DIG_MAX_ADDRESSES,
&count);
result = isc_getaddresses(opt, 0, sockaddrs, DIG_MAX_ADDRESSES, &count);
isc_loopmgr_nonblocking(loopmgr);
if (result != ISC_R_SUCCESS) {
fatal("couldn't get address for '%s': %s", opt,
@@ -799,6 +790,11 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
looknew->rrcomments = lookold->rrcomments;
looknew->fuzzing = lookold->fuzzing;
looknew->fuzztime = lookold->fuzztime;
looknew->proxy_mode = lookold->proxy_mode;
looknew->proxy_plain = lookold->proxy_plain;
looknew->proxy_local = lookold->proxy_local;
looknew->proxy_src_addr = lookold->proxy_src_addr;
looknew->proxy_dst_addr = lookold->proxy_dst_addr;
if (lookold->ecs_addr != NULL) {
looknew->ecs_addr = isc_mem_get(mctx,
@@ -879,7 +875,7 @@ setup_text_key(void) {
secretsize = isc_buffer_usedlength(&secretbuf);
if (hmacname == NULL) {
if (hmac_alg == DST_ALG_UNKNOWN) {
result = DST_R_UNSUPPORTEDALG;
goto failure;
}
@@ -889,9 +885,8 @@ setup_text_key(void) {
goto failure;
}
result = dns_tsigkey_create(&keyname, hmacname, secretstore,
(int)secretsize, false, NULL, 0, 0, mctx,
NULL, &tsigkey);
result = dns_tsigkey_create(&keyname, hmac_alg, secretstore,
(int)secretsize, mctx, &tsigkey);
failure:
if (result != ISC_R_SUCCESS) {
printf(";; Couldn't create key %s: %s\n", keynametext,
@@ -1027,50 +1022,50 @@ done:
* Parse HMAC algorithm specification
*/
void
parse_hmac(const char *hmac) {
parse_hmac(const char *algname) {
char buf[20];
size_t len;
REQUIRE(hmac != NULL);
REQUIRE(algname != NULL);
len = strlen(hmac);
len = strlen(algname);
if (len >= sizeof(buf)) {
fatal("unknown key type '%.*s'", (int)len, hmac);
fatal("unknown key type '%.*s'", (int)len, algname);
}
strlcpy(buf, hmac, sizeof(buf));
strlcpy(buf, algname, sizeof(buf));
digestbits = 0;
if (strcasecmp(buf, "hmac-md5") == 0) {
hmacname = DNS_TSIG_HMACMD5_NAME;
hmac_alg = DST_ALG_HMACMD5;
} else if (strncasecmp(buf, "hmac-md5-", 9) == 0) {
hmacname = DNS_TSIG_HMACMD5_NAME;
hmac_alg = DST_ALG_HMACMD5;
digestbits = parse_bits(&buf[9], "digest-bits [0..128]", 128);
} else if (strcasecmp(buf, "hmac-sha1") == 0) {
hmacname = DNS_TSIG_HMACSHA1_NAME;
hmac_alg = DST_ALG_HMACSHA1;
digestbits = 0;
} else if (strncasecmp(buf, "hmac-sha1-", 10) == 0) {
hmacname = DNS_TSIG_HMACSHA1_NAME;
hmac_alg = DST_ALG_HMACSHA1;
digestbits = parse_bits(&buf[10], "digest-bits [0..160]", 160);
} else if (strcasecmp(buf, "hmac-sha224") == 0) {
hmacname = DNS_TSIG_HMACSHA224_NAME;
hmac_alg = DST_ALG_HMACSHA224;
} else if (strncasecmp(buf, "hmac-sha224-", 12) == 0) {
hmacname = DNS_TSIG_HMACSHA224_NAME;
hmac_alg = DST_ALG_HMACSHA224;
digestbits = parse_bits(&buf[12], "digest-bits [0..224]", 224);
} else if (strcasecmp(buf, "hmac-sha256") == 0) {
hmacname = DNS_TSIG_HMACSHA256_NAME;
hmac_alg = DST_ALG_HMACSHA256;
} else if (strncasecmp(buf, "hmac-sha256-", 12) == 0) {
hmacname = DNS_TSIG_HMACSHA256_NAME;
hmac_alg = DST_ALG_HMACSHA256;
digestbits = parse_bits(&buf[12], "digest-bits [0..256]", 256);
} else if (strcasecmp(buf, "hmac-sha384") == 0) {
hmacname = DNS_TSIG_HMACSHA384_NAME;
hmac_alg = DST_ALG_HMACSHA384;
} else if (strncasecmp(buf, "hmac-sha384-", 12) == 0) {
hmacname = DNS_TSIG_HMACSHA384_NAME;
hmac_alg = DST_ALG_HMACSHA384;
digestbits = parse_bits(&buf[12], "digest-bits [0..384]", 384);
} else if (strcasecmp(buf, "hmac-sha512") == 0) {
hmacname = DNS_TSIG_HMACSHA512_NAME;
hmac_alg = DST_ALG_HMACSHA512;
} else if (strncasecmp(buf, "hmac-sha512-", 12) == 0) {
hmacname = DNS_TSIG_HMACSHA512_NAME;
hmac_alg = DST_ALG_HMACSHA512;
digestbits = parse_bits(&buf[12], "digest-bits [0..512]", 512);
} else {
fprintf(stderr,
@@ -1099,7 +1094,7 @@ read_confkey(void) {
return (ISC_R_FILENOTFOUND);
}
result = cfg_parser_create(mctx, NULL, &pctx);
result = cfg_parser_create(mctx, &pctx);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
@@ -1171,38 +1166,29 @@ setup_file_key(void) {
switch (dst_key_alg(dstkey)) {
case DST_ALG_HMACMD5:
hmacname = DNS_TSIG_HMACMD5_NAME;
break;
case DST_ALG_HMACSHA1:
hmacname = DNS_TSIG_HMACSHA1_NAME;
break;
case DST_ALG_HMACSHA224:
hmacname = DNS_TSIG_HMACSHA224_NAME;
break;
case DST_ALG_HMACSHA256:
hmacname = DNS_TSIG_HMACSHA256_NAME;
break;
case DST_ALG_HMACSHA384:
hmacname = DNS_TSIG_HMACSHA384_NAME;
break;
case DST_ALG_HMACSHA512:
hmacname = DNS_TSIG_HMACSHA512_NAME;
hmac_alg = dst_key_alg(dstkey);
break;
default:
dst_key_attach(dstkey, &sig0key);
dst_key_free(&dstkey);
return;
}
if (hmacname != NULL) {
if (dstkey != NULL) {
result = dns_tsigkey_createfromkey(
dst_key_name(dstkey), hmacname, dstkey, false, NULL, 0,
0, mctx, NULL, &tsigkey);
dst_key_name(dstkey), hmac_alg, dstkey, false, false,
NULL, 0, 0, mctx, &tsigkey);
if (result != ISC_R_SUCCESS) {
printf(";; Couldn't create key %s: %s\n", keynametext,
isc_result_totext(result));
goto failure;
}
} else {
dst_key_attach(dstkey, &sig0key);
dst_key_free(&dstkey);
}
failure:
if (dstkey != NULL) {
dst_key_free(&dstkey);
@@ -1371,24 +1357,17 @@ setup_libs(void) {
fatal("can't find either v4 or v6 networking");
}
isc_managers_create(&mctx, 1, &loopmgr, &netmgr, &taskmgr);
isc_managers_create(&mctx, 1, &loopmgr, &netmgr);
isc_log_create(mctx, &lctx, &logconfig);
isc_log_setcontext(lctx);
dns_log_init(lctx);
dns_log_setcontext(lctx);
result = isc_log_usechannel(logconfig, "default_debug", NULL, NULL);
check_result(result, "isc_log_usechannel");
isc_log_setdebuglevel(lctx, 0);
logconfig = isc_logconfig_get();
isc_log_createandusechannel(logconfig, "debug", ISC_LOG_TOFILEDESC,
ISC_LOG_DYNAMIC, ISC_LOGDESTINATION_STDERR,
ISC_LOG_PRINTTIME, ISC_LOGCATEGORY_DEFAULT,
ISC_LOGMODULE_DEFAULT);
isc_log_setdebuglevel(0);
isc_mem_setname(mctx, "dig");
mainloop = isc_loop_main(loopmgr);
result = dst_lib_init(mctx, NULL);
check_result(result, "dst_lib_init");
is_dst_up = true;
}
typedef struct dig_ednsoptname {
@@ -1398,6 +1377,7 @@ typedef struct dig_ednsoptname {
dig_ednsoptname_t optnames[] = {
{ 1, "LLQ" }, /* draft-sekar-dns-llq */
{ 2, "UL" }, /* draft-ietf-dnssd-update-lease */
{ 3, "NSID" }, /* RFC 5001 */
{ 5, "DAU" }, /* RFC 6975 */
{ 6, "DHU" }, /* RFC 6975 */
@@ -2044,7 +2024,7 @@ next_origin(dig_lookup_t *oldlookup) {
* Check for a absolute name or ndots being met.
*/
name = dns_fixedname_initname(&fixed);
result = dns_name_fromstring2(name, oldlookup->textname, NULL, 0, NULL);
result = dns_name_fromstring(name, oldlookup->textname, NULL, 0, NULL);
if (result == ISC_R_SUCCESS &&
(dns_name_isabsolute(name) ||
(int)dns_name_countlabels(name) > ndots))
@@ -2207,7 +2187,8 @@ setup_lookup(dig_lookup_t *lookup) {
debug("setup_lookup(%p)", lookup);
dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &lookup->sendmsg);
dns_message_create(mctx, NULL, NULL, DNS_MESSAGE_INTENTRENDER,
&lookup->sendmsg);
if (lookup->new_search) {
debug("resetting lookup counter.");
@@ -2336,6 +2317,7 @@ setup_lookup(dig_lookup_t *lookup) {
clear_current_lookup();
return (false);
#else /* if TARGET_OS_IPHONE */
cleanup_openssl_refs();
digexit();
#endif /* if TARGET_OS_IPHONE */
}
@@ -2934,6 +2916,9 @@ start_tcp(dig_query_t *query) {
bool tls_mode = false;
isc_tlsctx_client_session_cache_t *sess_cache = NULL;
int local_timeout;
isc_nm_proxy_type_t proxy_type = ISC_NM_PROXY_NONE;
isc_nm_proxyheader_info_t proxy_info = { 0 };
isc_nm_proxyheader_info_t *ppi = NULL;
REQUIRE(DIG_VALID_QUERY(query));
@@ -3025,6 +3010,22 @@ start_tcp(dig_query_t *query) {
}
}
if (query->lookup->proxy_mode) {
proxy_type = ISC_NM_PROXY_PLAIN;
if ((tls_mode || (query->lookup->https_mode &&
!query->lookup->http_plain)) &&
!query->lookup->proxy_plain)
{
proxy_type = ISC_NM_PROXY_ENCRYPTED;
}
if (!query->lookup->proxy_local) {
isc_nm_proxyheader_info_init(
&proxy_info, &query->lookup->proxy_src_addr,
&query->lookup->proxy_dst_addr, NULL);
ppi = &proxy_info;
}
}
REQUIRE(query != NULL);
query_attach(query, &connectquery);
@@ -3037,7 +3038,8 @@ start_tcp(dig_query_t *query) {
}
isc_nm_streamdnsconnect(netmgr, &localaddr, &query->sockaddr,
tcp_connected, connectquery,
local_timeout, tlsctx, sess_cache);
local_timeout, tlsctx, sess_cache,
proxy_type, ppi);
#if HAVE_LIBNGHTTP2
} else if (query->lookup->https_mode) {
char uri[4096] = { 0 };
@@ -3057,12 +3059,13 @@ start_tcp(dig_query_t *query) {
isc_nm_httpconnect(netmgr, &localaddr, &query->sockaddr, uri,
!query->lookup->https_get, tcp_connected,
connectquery, tlsctx, sess_cache,
local_timeout);
local_timeout, proxy_type, ppi);
#endif
} else {
isc_nm_streamdnsconnect(netmgr, &localaddr, &query->sockaddr,
tcp_connected, connectquery,
local_timeout, NULL, NULL);
local_timeout, NULL, NULL, proxy_type,
ppi);
}
return;
@@ -3109,9 +3112,9 @@ send_udp(dig_query_t *query) {
isc_buffer_usedregion(&query->sendbuf, &r);
debug("sending a request");
if (query->lookup->use_usec) {
TIME_NOW_HIRES(&query->time_sent);
query->time_sent = isc_time_now_hires();
} else {
TIME_NOW(&query->time_sent);
query->time_sent = isc_time_now();
}
isc_nmhandle_attach(query->handle, &query->sendhandle);
@@ -3216,11 +3219,12 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
if (next != NULL) {
start_udp(next);
check_if_done();
} else {
dighost_error("no servers could be reached");
clear_current_lookup();
}
check_if_done();
return;
}
@@ -3311,9 +3315,24 @@ start_udp(dig_query_t *query) {
}
query_attach(query, &connectquery);
isc_nm_udpconnect(netmgr, &localaddr, &query->sockaddr, udp_ready,
connectquery,
(timeout ? timeout : UDP_TIMEOUT) * 1000);
if (query->lookup->proxy_mode) {
isc_nm_proxyheader_info_t proxy_info = { 0 };
isc_nm_proxyheader_info_t *ppi = NULL;
if (!query->lookup->proxy_local) {
isc_nm_proxyheader_info_init(
&proxy_info, &query->lookup->proxy_src_addr,
&query->lookup->proxy_dst_addr, NULL);
ppi = &proxy_info;
}
isc_nm_proxyudpconnect(netmgr, &localaddr, &query->sockaddr,
udp_ready, connectquery,
(timeout ? timeout : UDP_TIMEOUT) * 1000,
ppi);
} else {
isc_nm_udpconnect(netmgr, &localaddr, &query->sockaddr,
udp_ready, connectquery,
(timeout ? timeout : UDP_TIMEOUT) * 1000);
}
}
/*%
@@ -3394,10 +3413,10 @@ force_next(dig_query_t *query) {
isc_netaddr_fromsockaddr(&netaddr, &query->sockaddr);
isc_netaddr_format(&netaddr, buf, sizeof(buf));
dighost_error("no response from %s\n", buf);
dighost_error("no response from %s", buf);
} else {
printf("%s", l->cmdline);
dighost_error("no servers could be reached\n");
dighost_error("no servers could be reached");
}
if (exitcode < 9) {
@@ -3476,9 +3495,9 @@ launch_next_query(dig_query_t *query) {
dig_query_t *sendquery = NULL;
debug("sending a request in launch_next_query");
if (query->lookup->use_usec) {
TIME_NOW_HIRES(&query->time_sent);
query->time_sent = isc_time_now_hires();
} else {
TIME_NOW(&query->time_sent);
query->time_sent = isc_time_now();
}
query_attach(query, &sendquery);
@@ -3537,6 +3556,12 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
debug("tcp_connected(%p, %s, %p)", handle, isc_result_totext(eresult),
query);
if (eresult == ISC_R_SHUTTINGDOWN) {
query_detach(&query);
cancel_all();
return;
}
lookup_attach(query->lookup, &l);
if (eresult == ISC_R_CANCELED || eresult == ISC_R_TLSBADPEERCERT ||
@@ -3613,11 +3638,12 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
if (next != NULL) {
start_tcp(next);
check_if_done();
} else {
dighost_error("no servers could be reached");
clear_current_lookup();
}
check_if_done();
return;
}
@@ -3916,10 +3942,14 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
lookup_attach(query->lookup, &l);
if (eresult == ISC_R_CANCELED || query->canceled) {
if (eresult == ISC_R_CANCELED || eresult == ISC_R_SHUTTINGDOWN ||
query->canceled)
{
debug("recv_done: cancel");
isc_nmhandle_detach(&query->readhandle);
if (!query->canceled) {
if (eresult == ISC_R_SHUTTINGDOWN) {
cancel_all();
} else if (!query->canceled) {
cancel_lookup(l);
}
query_detach(&query);
@@ -3929,9 +3959,9 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
}
if (query->lookup->use_usec) {
TIME_NOW_HIRES(&query->time_recv);
query->time_recv = isc_time_now_hires();
} else {
TIME_NOW(&query->time_recv);
query->time_recv = isc_time_now();
}
if ((!l->pending && !l->ns_search_only) || cancel_now) {
@@ -4063,7 +4093,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
* and cancel the lookup.
*/
printf("%s", l->cmdline);
dighost_error("no servers could be reached\n");
dighost_error("no servers could be reached");
if (exitcode < 9) {
exitcode = 9;
@@ -4136,7 +4166,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
goto keep_query;
}
dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &msg);
dns_message_create(mctx, NULL, NULL, DNS_MESSAGE_INTENTPARSE, &msg);
if (tsigkey != NULL) {
if (l->querysig == NULL) {
@@ -4197,7 +4227,15 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
goto keep_query;
}
if (msg->counts[DNS_SECTION_QUESTION] != 0) {
if (msg->counts[DNS_SECTION_QUESTION] == 0) {
if (l->doing_xfr) {
if (query->msg_count == 0) {
dighost_warning("missing question section");
}
} else if (!l->header_only && msg->opcode == dns_opcode_query) {
dighost_warning("missing question section");
}
} else {
match = true;
for (result = dns_message_firstname(msg, DNS_SECTION_QUESTION);
result == ISC_R_SUCCESS && match;
@@ -4314,29 +4352,32 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
if ((msg->rcode == dns_rcode_servfail && !l->servfail_stops) ||
(check_ra && (msg->flags & DNS_MESSAGEFLAG_RA) == 0 && l->recurse))
{
const char *err = (msg->rcode == dns_rcode_servfail &&
!l->servfail_stops)
? "SERVFAIL reply"
: "recursion not available";
dig_query_t *next = ISC_LIST_NEXT(query, link);
if (l->current_query == query) {
query_detach(&l->current_query);
}
if (next != NULL) {
if (next != NULL && (!l->ns_search_only || l->trace_root)) {
dighost_comments(l,
"Got %s from %s, trying next server",
err, query->servname);
debug("sending query %p", next);
if (l->tcp_mode) {
start_tcp(next);
} else {
start_udp(next);
}
dighost_comments(l,
"Got %s from %s, trying next "
"server",
msg->rcode == dns_rcode_servfail
? "SERVFAIL reply"
: "recursion not available",
query->servname);
if (check_if_queries_done(l, query)) {
goto cancel_lookup;
}
goto detach_query;
} else {
dighost_comments(l, "Got %s from %s", err,
query->servname);
}
}
@@ -4531,7 +4572,7 @@ get_address(char *host, in_port_t myport, isc_sockaddr_t *sockaddr) {
isc_result_t result;
isc_loopmgr_blocking(loopmgr);
result = bind9_getaddresses(host, myport, sockaddr, 1, &count);
result = isc_getaddresses(host, myport, sockaddr, 1, &count);
isc_loopmgr_nonblocking(loopmgr);
if (result != ISC_R_SUCCESS) {
return (result);
@@ -4552,12 +4593,10 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) {
char tmp[ISC_NETADDR_FORMATSIZE];
isc_loopmgr_blocking(loopmgr);
result = bind9_getaddresses(host, 0, sockaddrs, DIG_MAX_ADDRESSES,
&count);
result = isc_getaddresses(host, 0, sockaddrs, DIG_MAX_ADDRESSES,
&count);
isc_loopmgr_nonblocking(loopmgr);
if (resultp != NULL) {
*resultp = result;
}
SET_IF_NOT_NULL(resultp, result);
if (result != ISC_R_SUCCESS) {
if (resultp == NULL) {
fatal("couldn't get address for '%s': %s", host,
@@ -4662,6 +4701,19 @@ cancel_all(void) {
}
}
void
cleanup_openssl_refs(void) {
if (tsigkey != NULL) {
debug("freeing TSIG key %p", tsigkey);
dns_tsigkey_detach(&tsigkey);
}
if (sig0key != NULL) {
debug("freeing SIG(0) key %p", sig0key);
dst_key_free(&sig0key);
}
}
/*%
* Destroy all of the libs we are using, and get everything ready for a
* clean shutdown.
@@ -4683,36 +4735,19 @@ destroy_libs(void) {
clear_searchlist();
if (tsigkey != NULL) {
debug("freeing TSIG key %p", tsigkey);
dns_tsigkey_detach(&tsigkey);
}
if (sig0key != NULL) {
debug("freeing SIG(0) key %p", sig0key);
dst_key_free(&sig0key);
}
cleanup_openssl_refs();
if (namebuf != NULL) {
debug("freeing key %p", tsigkey);
isc_buffer_free(&namebuf);
}
if (is_dst_up) {
debug("destroy DST lib");
dst_lib_destroy();
is_dst_up = false;
}
debug("Removing log context");
isc_log_destroy(&lctx);
debug("Destroy memory");
if (memdebugging != 0) {
isc_mem_stats(mctx, stderr);
}
isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
#if ENABLE_LEAK_DETECTION
isc__tls_setdestroycheck(true);
+14 -12
View File
@@ -27,7 +27,6 @@
#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>
@@ -188,6 +187,13 @@ 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;
};
@@ -260,11 +266,10 @@ extern isc_sockaddr_t localaddr;
extern char keynametext[MXNAME];
extern char keyfile[MXNAME];
extern char keysecret[MXNAME];
extern const dns_name_t *hmacname;
extern dst_algorithm_t hmac_alg;
extern unsigned int digestbits;
extern dns_tsigkey_t *tsigkey;
extern bool validated;
extern isc_taskmgr_t *taskmgr;
extern isc_loopmgr_t *loopmgr;
extern isc_loop_t *mainloop;
extern bool free_now;
@@ -288,15 +293,18 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp);
isc_result_t
get_reverse(char *reverse, size_t len, char *value, bool strict);
noreturn void
ISC_NORETURN void
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
void
warn(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
noreturn void
ISC_NORETURN void
digexit(void);
void
cleanup_openssl_refs(void);
void
debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
@@ -340,7 +348,7 @@ isc_result_t
parse_netprefix(isc_sockaddr_t **sap, const char *value);
void
parse_hmac(const char *hmacstr);
parse_hmac(const char *algname);
dig_lookup_t *
requeue_lookup(dig_lookup_t *lookold, bool servers);
@@ -444,12 +452,6 @@ 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.
*/
+6 -7
View File
@@ -23,9 +23,7 @@
#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>
@@ -101,7 +99,7 @@ rcode_totext(dns_rcode_t rcode) {
return (totext.deconsttext);
}
noreturn static void
ISC_NORETURN static void
show_usage(void);
static void
@@ -134,7 +132,7 @@ 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(1);
exit(EXIT_FAILURE);
}
static void
@@ -151,9 +149,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) {
TIME_NOW_HIRES(&now);
now = isc_time_now_hires();
} else {
TIME_NOW(&now);
now = isc_time_now();
}
diff = (int)isc_time_microdiff(&now, &query->time_sent);
printf("Received %u bytes from %s in %d ms\n", bytes, fromtext,
@@ -185,6 +183,7 @@ retry:
result = dns_rdata_totext(rdata, NULL, b);
if (result == ISC_R_NOSPACE) {
isc_buffer_free(&b);
INSIST(bufsize <= (UINT_MAX / 2));
bufsize *= 2;
goto retry;
}
@@ -656,7 +655,7 @@ pre_parse_args(int argc, char **argv) {
break;
case 'V':
printf("host %s\n", PACKAGE_VERSION);
exit(0);
exit(EXIT_SUCCESS);
break;
case 'w':
break;
+8 -9
View File
@@ -16,18 +16,15 @@
#include <stdlib.h>
#include <unistd.h>
#include <isc/async.h>
#include <isc/attributes.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/condition.h>
#include <isc/event.h>
#include <isc/job.h>
#include <isc/loop.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>
@@ -192,6 +189,7 @@ printrdata(dns_rdata_t *rdata) {
check_result(result, "dns_rdata_totext");
}
isc_buffer_free(&b);
INSIST(size <= (UINT_MAX / 2));
size *= 2;
}
}
@@ -838,7 +836,7 @@ fgets_next_command(void *arg) {
cmdline = fgets(cmdlinebuf, COMMSIZE, stdin);
}
noreturn static void
ISC_NORETURN static void
usage(void);
static void
@@ -852,7 +850,7 @@ usage(void) {
"'host' using default server\n");
fprintf(stderr, " nslookup [-opt ...] host server # just look up "
"'host' using 'server'\n");
exit(1);
exit(EXIT_FAILURE);
}
static void
@@ -865,7 +863,7 @@ parse_args(int argc, char **argv) {
if (argv[0][0] == '-') {
if (strncasecmp(argv[0], "-ver", 4) == 0) {
printf("nslookup %s\n", PACKAGE_VERSION);
exit(0);
exit(EXIT_SUCCESS);
} else if (argv[0][1] != 0) {
setoption(&argv[0][1]);
} else {
@@ -891,13 +889,14 @@ static void
start_next_command(void);
static void
process_next_command(void *arg __attribute__((__unused__))) {
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);
if (ISC_LIST_HEAD(lookup_list) != NULL) {
isc_job_run(loopmgr, run_loop, NULL);
isc_async_run(loop, run_loop, NULL);
return;
}
}
+1
View File
@@ -2,6 +2,7 @@ dnssec-cds
dnssec-dsfromkey
dnssec-keyfromlabel
dnssec-keygen
dnssec-ksr
dnssec-makekeyset
dnssec-revoke
dnssec-settime
+15 -3
View File
@@ -2,6 +2,7 @@ include $(top_srcdir)/Makefile.top
AM_CPPFLAGS += \
$(LIBISC_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBDNS_CFLAGS)
AM_CPPFLAGS += \
@@ -12,7 +13,9 @@ noinst_LTLIBRARIES = libdnssectool.la
LDADD += \
libdnssectool.la \
$(LIBISC_LIBS) \
$(LIBDNS_LIBS)
$(LIBISCCFG_LIBS) \
$(LIBDNS_LIBS) \
$(OPENSSL_LIBS)
bin_PROGRAMS = \
dnssec-cds \
@@ -20,6 +23,7 @@ bin_PROGRAMS = \
dnssec-importkey \
dnssec-keyfromlabel \
dnssec-keygen \
dnssec-ksr \
dnssec-revoke \
dnssec-settime \
dnssec-signzone \
@@ -31,8 +35,16 @@ libdnssectool_la_SOURCES = \
dnssec_keygen_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBISCCFG_CFLAGS)
$(OPENSSL_CFLAGS)
dnssec_keygen_LDADD = \
$(LDADD) \
$(LIBISCCFG_LIBS)
$(OPENSSL_LIBS)
dnssec_signzone_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(OPENSSL_CFLAGS)
dnssec_signzone_LDADD = \
$(LDADD) \
$(OPENSSL_LIBS)
+106 -83
View File
@@ -29,8 +29,8 @@
#include <isc/dir.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/serial.h>
#include <isc/string.h>
@@ -44,7 +44,6 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdata.h>
@@ -64,7 +63,6 @@ const char *program = "dnssec-cds";
/*
* Infrastructure
*/
static isc_log_t *lctx = NULL;
static isc_mem_t *mctx = NULL;
/*
@@ -125,15 +123,28 @@ typedef isc_result_t
ds_maker_func_t(isc_buffer_t *buf, dns_rdata_t *ds, dns_dsdigest_t dt,
dns_rdata_t *crdata);
static dns_rdataset_t cdnskey_set, cdnskey_sig;
static dns_rdataset_t cds_set, cds_sig;
static dns_rdataset_t dnskey_set, dnskey_sig;
static dns_rdataset_t old_ds_set, new_ds_set;
static dns_rdataset_t cdnskey_set = DNS_RDATASET_INIT;
static dns_rdataset_t cdnskey_sig = DNS_RDATASET_INIT;
static dns_rdataset_t cds_set = DNS_RDATASET_INIT;
static dns_rdataset_t cds_sig = DNS_RDATASET_INIT;
static dns_rdataset_t dnskey_set = DNS_RDATASET_INIT;
static dns_rdataset_t dnskey_sig = DNS_RDATASET_INIT;
static dns_rdataset_t old_ds_set = DNS_RDATASET_INIT;
static dns_rdataset_t new_ds_set = DNS_RDATASET_INIT;
static keyinfo_t *old_key_tbl, *new_key_tbl;
static keyinfo_t *old_key_tbl = NULL, *new_key_tbl = NULL;
isc_buffer_t *new_ds_buf = NULL; /* backing store for new_ds_set */
static dns_db_t *child_db = NULL;
static dns_dbnode_t *child_node = NULL;
static dns_db_t *parent_db = NULL;
static dns_dbnode_t *parent_node = NULL;
static dns_db_t *update_db = NULL;
static dns_dbnode_t *update_node = NULL;
static dns_dbversion_t *update_version = NULL;
static bool print_mem_stats = false;
static void
verbose_time(int level, const char *msg, isc_stdtime_t time) {
isc_result_t result;
@@ -234,8 +245,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, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, dbp);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, dbp);
check_result(result, "dns_db_create()");
result = dns_db_load(*dbp, filename, dns_masterformat_text,
@@ -251,21 +262,27 @@ load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
}
static void
free_db(dns_db_t **dbp, dns_dbnode_t **nodep) {
dns_db_detachnode(*dbp, nodep);
dns_db_detach(dbp);
free_db(dns_db_t **dbp, dns_dbnode_t **nodep, dns_dbversion_t **versionp) {
if (*dbp != NULL) {
if (*nodep != NULL) {
dns_db_detachnode(*dbp, nodep);
}
if (versionp != NULL && *versionp != NULL) {
dns_db_closeversion(*dbp, versionp, false);
}
dns_db_detach(dbp);
}
}
static void
load_child_sets(const char *file) {
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
load_db(file, &db, &node);
findset(db, node, dns_rdatatype_dnskey, &dnskey_set, &dnskey_sig);
findset(db, node, dns_rdatatype_cdnskey, &cdnskey_set, &cdnskey_sig);
findset(db, node, dns_rdatatype_cds, &cds_set, &cds_sig);
free_db(&db, &node);
load_db(file, &child_db, &child_node);
findset(child_db, child_node, dns_rdatatype_dnskey, &dnskey_set,
&dnskey_sig);
findset(child_db, child_node, dns_rdatatype_cdnskey, &cdnskey_set,
&cdnskey_sig);
findset(child_db, child_node, dns_rdatatype_cds, &cds_set, &cds_sig);
free_db(&child_db, &child_node, NULL);
}
static void
@@ -314,8 +331,6 @@ get_dsset_name(char *filename, size_t size, const char *path,
static void
load_parent_set(const char *path) {
isc_result_t result;
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
isc_time_t modtime;
char filename[PATH_MAX + 1];
@@ -328,21 +343,20 @@ load_parent_set(const char *path) {
}
notbefore = isc_time_seconds(&modtime);
if (startstr != NULL) {
isc_stdtime_t now;
isc_stdtime_get(&now);
isc_stdtime_t now = isc_stdtime_now();
notbefore = strtotime(startstr, now, notbefore, NULL);
}
verbose_time(1, "child records must not be signed before", notbefore);
load_db(filename, &db, &node);
findset(db, node, dns_rdatatype_ds, &old_ds_set, NULL);
load_db(filename, &parent_db, &parent_node);
findset(parent_db, parent_node, dns_rdatatype_ds, &old_ds_set, NULL);
if (!dns_rdataset_isassociated(&old_ds_set)) {
fatal("could not find DS records for %s in %s", namestr,
filename);
}
free_db(&db, &node);
free_db(&parent_db, &parent_node, NULL);
}
#define MAX_CDS_RDATA_TEXT_SIZE DNS_RDATA_MAXLENGTH * 2
@@ -367,17 +381,18 @@ formatset(dns_rdataset_t *rdataset) {
isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
result = dns_master_rdatasettotext(name, rdataset, style, NULL, buf);
dns_master_styledestroy(&style, mctx);
if ((result == ISC_R_SUCCESS) && isc_buffer_availablelength(buf) < 1) {
result = ISC_R_NOSPACE;
}
check_result(result, "dns_rdataset_totext()");
if (result != ISC_R_SUCCESS) {
isc_buffer_free(&buf);
check_result(result, "dns_rdataset_totext()");
}
isc_buffer_putuint8(buf, 0);
dns_master_styledestroy(&style, mctx);
return (buf);
}
@@ -420,6 +435,7 @@ write_parent_set(const char *path, const char *inplace, bool nsupdate,
result = isc_file_openunique(tmpname, &fp);
if (result != ISC_R_SUCCESS) {
isc_buffer_free(&buf);
fatal("open %s: %s", tmpname, isc_result_totext(result));
}
fprintf(fp, "%s", (char *)r.base);
@@ -514,23 +530,22 @@ static keyinfo_t *
match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
strictness_t strictness) {
isc_result_t result;
keyinfo_t *keytable;
keyinfo_t *keytable, *ki;
int i;
nkey = dns_rdataset_count(keyset);
keytable = isc_mem_getx(mctx, sizeof(keytable[0]) * nkey, ISC_MEM_ZERO);
keytable = isc_mem_cget(mctx, nkey, sizeof(keytable[0]));
for (result = dns_rdataset_first(keyset), i = 0;
result == ISC_R_SUCCESS; result = dns_rdataset_next(keyset), i++)
for (result = dns_rdataset_first(keyset), i = 0, ki = keytable;
result == ISC_R_SUCCESS;
result = dns_rdataset_next(keyset), i++, ki++)
{
keyinfo_t *ki;
dns_rdata_dnskey_t dnskey;
dns_rdata_t *keyrdata;
isc_region_t r;
INSIST(i < nkey);
ki = &keytable[i];
keyrdata = &ki->rdata;
dns_rdata_init(keyrdata);
@@ -568,14 +583,15 @@ free_keytable(keyinfo_t **keytable_p) {
keyinfo_t *ki;
int i;
for (i = 0; i < nkey; i++) {
ki = &keytable[i];
REQUIRE(keytable != NULL);
for (i = 0, ki = keytable; i < nkey; i++, ki++) {
if (ki->dst != NULL) {
dst_key_free(&ki->dst);
}
}
isc_mem_put(mctx, keytable, sizeof(keytable[0]) * nkey);
isc_mem_cput(mctx, keytable, nkey, sizeof(keytable[0]));
}
/*
@@ -594,7 +610,9 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
dns_secalg_t *algo;
int i;
algo = isc_mem_getx(mctx, nkey * sizeof(algo[0]), ISC_MEM_ZERO);
REQUIRE(keytbl != NULL);
algo = isc_mem_cget(mctx, nkey, sizeof(algo[0]));
for (result = dns_rdataset_first(sigset); result == ISC_R_SUCCESS;
result = dns_rdataset_next(sigset))
@@ -677,7 +695,7 @@ signed_loose(dns_secalg_t *algo) {
ok = true;
}
}
isc_mem_put(mctx, algo, nkey * sizeof(algo[0]));
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
return (ok);
}
@@ -719,7 +737,7 @@ signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
}
}
isc_mem_put(mctx, algo, nkey);
isc_mem_cput(mctx, algo, nkey, sizeof(algo[0]));
return (all_ok);
}
@@ -798,6 +816,7 @@ append_new_ds_set(ds_maker_func_t *ds_from_rdata, isc_buffer_t *buf,
isc_mem_put(mctx, ds, sizeof(*ds));
return (result);
default:
isc_mem_put(mctx, ds, sizeof(*ds));
check_result(result, "ds_from_rdata()");
}
}
@@ -873,7 +892,7 @@ consistent_digests(dns_rdataset_t *dsset) {
n = dns_rdataset_count(dsset);
arrdata = isc_mem_get(mctx, n * sizeof(dns_rdata_t));
arrdata = isc_mem_cget(mctx, n, sizeof(dns_rdata_t));
for (result = dns_rdataset_first(dsset), i = 0; result == ISC_R_SUCCESS;
result = dns_rdataset_next(dsset), i++)
@@ -887,7 +906,7 @@ consistent_digests(dns_rdataset_t *dsset) {
/*
* Convert sorted arrdata to more accessible format
*/
ds = isc_mem_get(mctx, n * sizeof(dns_rdata_ds_t));
ds = isc_mem_cget(mctx, n, sizeof(dns_rdata_ds_t));
for (i = 0; i < n; i++) {
result = dns_rdata_tostruct(&arrdata[i], &ds[i], NULL);
@@ -926,8 +945,8 @@ consistent_digests(dns_rdataset_t *dsset) {
/*
* Done!
*/
isc_mem_put(mctx, ds, n * sizeof(dns_rdata_ds_t));
isc_mem_put(mctx, arrdata, n * sizeof(dns_rdata_t));
isc_mem_cput(mctx, ds, n, sizeof(dns_rdata_ds_t));
isc_mem_cput(mctx, arrdata, n, sizeof(dns_rdata_t));
return (match);
}
@@ -955,32 +974,27 @@ static void
update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
dns_rdataset_t *delset) {
isc_result_t result;
dns_db_t *db;
dns_dbnode_t *node;
dns_dbversion_t *ver;
dns_rdataset_t diffset;
uint32_t save;
db = NULL;
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &update_db);
check_result(result, "dns_db_create()");
ver = NULL;
result = dns_db_newversion(db, &ver);
result = dns_db_newversion(update_db, &update_version);
check_result(result, "dns_db_newversion()");
node = NULL;
result = dns_db_findnode(db, name, true, &node);
result = dns_db_findnode(update_db, name, true, &update_node);
check_result(result, "dns_db_findnode()");
dns_rdataset_init(&diffset);
result = dns_db_addrdataset(db, node, ver, 0, addset, DNS_DBADD_MERGE,
NULL);
result = dns_db_addrdataset(update_db, update_node, update_version, 0,
addset, DNS_DBADD_MERGE, NULL);
check_result(result, "dns_db_addrdataset()");
result = dns_db_subtractrdataset(db, node, ver, delset, 0, &diffset);
result = dns_db_subtractrdataset(update_db, update_node, update_version,
delset, 0, &diffset);
if (result == DNS_R_UNCHANGED) {
save = addset->ttl;
addset->ttl = ttl;
@@ -993,9 +1007,7 @@ update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
dns_rdataset_disassociate(&diffset);
}
dns_db_detachnode(db, &node);
dns_db_closeversion(db, &ver, false);
dns_db_detach(&db);
free_db(&update_db, &update_node, &update_version);
}
static void
@@ -1015,7 +1027,7 @@ nsdiff(uint32_t ttl, dns_rdataset_t *oldset, dns_rdataset_t *newset) {
}
}
noreturn static void
ISC_NORETURN static void
usage(void);
static void
@@ -1042,7 +1054,27 @@ usage(void) {
" -T <ttl> TTL of DS records\n"
" -V print version\n"
" -v <verbosity>\n");
exit(1);
exit(EXIT_FAILURE);
}
static void
cleanup(void) {
free_db(&child_db, &child_node, NULL);
free_db(&parent_db, &parent_node, NULL);
free_db(&update_db, &update_node, &update_version);
if (old_key_tbl != NULL) {
free_keytable(&old_key_tbl);
}
if (new_key_tbl != NULL) {
free_keytable(&new_key_tbl);
}
free_all_sets();
if (mctx != NULL) {
if (print_mem_stats && verbose > 10) {
isc_mem_stats(mctx, stdout);
}
isc_mem_destroy(&mctx);
}
}
int
@@ -1050,13 +1082,14 @@ main(int argc, char *argv[]) {
const char *child_path = NULL;
const char *ds_path = NULL;
const char *inplace = NULL;
isc_result_t result;
bool prefer_cdnskey = false;
bool nsupdate = false;
uint32_t ttl = 0;
int ch;
char *endp;
setfatalcallback(cleanup);
isc_mem_create(&mctx);
isc_commandline_errprint = false;
@@ -1136,13 +1169,7 @@ main(int argc, char *argv[]) {
dtype[0] = DNS_DSDIGEST_SHA256;
}
setup_logging(mctx, &lctx);
result = dst_lib_init(mctx, NULL);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s",
isc_result_totext(result));
}
setup_logging();
if (ds_path == NULL) {
fatal("missing -d DS pathname");
@@ -1242,7 +1269,7 @@ main(int argc, char *argv[]) {
vbprintf(1, "%s has neither CDS nor CDNSKEY records\n",
namestr);
write_parent_set(ds_path, inplace, nsupdate, &old_ds_set);
exit(0);
goto cleanup;
}
/*
@@ -1308,13 +1335,9 @@ main(int argc, char *argv[]) {
write_parent_set(ds_path, inplace, nsupdate, &new_ds_set);
free_all_sets();
cleanup_logging(&lctx);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
isc_mem_destroy(&mctx);
cleanup:
print_mem_stats = true;
cleanup();
exit(0);
return (0);
}
+16 -21
View File
@@ -22,8 +22,8 @@
#include <isc/commandline.h>
#include <isc/dir.h>
#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>
@@ -34,7 +34,6 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdata.h>
@@ -55,6 +54,7 @@ static dns_name_t *name = NULL;
static isc_mem_t *mctx = NULL;
static uint32_t ttl;
static bool emitttl = false;
static unsigned int split_width = 0;
static isc_result_t
initname(char *setname) {
@@ -101,8 +101,8 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
dns_name_format(name, setname, sizeof(setname));
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
if (result != ISC_R_SUCCESS) {
fatal("can't create database");
}
@@ -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, false, &nameb);
result = dns_name_totext(name, 0, &nameb);
if (result != ISC_R_SUCCESS) {
fatal("can't print name");
}
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, 0, "",
&textb);
result = dns_rdata_tofmttext(&ds, (dns_name_t *)NULL, 0, 0, split_width,
"", &textb);
if (result != ISC_R_SUCCESS) {
fatal("can't print rdata");
@@ -324,7 +324,7 @@ emits(bool showall, bool cds, dns_rdata_t *rdata) {
}
}
noreturn static void
ISC_NORETURN static void
usage(void);
static void
@@ -348,13 +348,14 @@ 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(-1);
exit(EXIT_FAILURE);
}
int
@@ -367,7 +368,6 @@ main(int argc, char **argv) {
bool usekeyset = false;
bool showall = false;
isc_result_t result;
isc_log_t *log = NULL;
dns_rdataset_t rdataset;
dns_rdata_t rdata;
@@ -381,7 +381,7 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:hV"
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:whV"
while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
switch (ch) {
case '1':
@@ -433,6 +433,9 @@ main(int argc, char **argv) {
fatal("-v must be followed by a number");
}
break;
case 'w':
split_width = UINT_MAX;
break;
case 'F':
/* Reserved for FIPS mode */
FALLTHROUGH;
@@ -453,7 +456,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -485,13 +488,7 @@ main(int argc, char **argv) {
fatal("extraneous arguments");
}
result = dst_lib_init(mctx, NULL);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s",
isc_result_totext(result));
}
setup_logging(mctx, &log);
setup_logging();
dns_rdataset_init(&rdataset);
@@ -544,8 +541,6 @@ main(int argc, char **argv) {
if (dns_rdataset_isassociated(&rdataset)) {
dns_rdataset_disassociate(&rdataset);
}
cleanup_logging(&log);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
+8 -19
View File
@@ -20,8 +20,8 @@
#include <isc/buffer.h>
#include <isc/commandline.h>
#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>
@@ -32,7 +32,6 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdata.h>
@@ -104,8 +103,8 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
dns_name_format(name, setname, sizeof(setname));
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
if (result != ISC_R_SUCCESS) {
fatal("can't create database");
}
@@ -263,7 +262,7 @@ emit(const char *dir, dns_rdata_t *rdata) {
dst_key_free(&key);
}
noreturn static void
ISC_NORETURN static void
usage(void);
static void
@@ -290,7 +289,7 @@ usage(void) {
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
"CDS and CDNSKEY deletion date\n");
exit(-1);
exit(EXIT_FAILURE);
}
int
@@ -300,13 +299,11 @@ main(int argc, char **argv) {
char *endp;
int ch;
isc_result_t result;
isc_log_t *log = NULL;
dns_rdataset_t rdataset;
dns_rdata_t rdata;
isc_stdtime_t now;
isc_stdtime_t now = isc_stdtime_now();
dns_rdata_init(&rdata);
isc_stdtime_get(&now);
if (argc == 1) {
usage();
@@ -397,7 +394,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -410,13 +407,7 @@ main(int argc, char **argv) {
fatal("extraneous arguments");
}
result = dst_lib_init(mctx, NULL);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s",
isc_result_totext(result));
}
setup_logging(mctx, &log);
setup_logging();
dns_rdataset_init(&rdataset);
@@ -460,8 +451,6 @@ main(int argc, char **argv) {
if (dns_rdataset_isassociated(&rdataset)) {
dns_rdataset_disassociate(&rdataset);
}
cleanup_logging(&log);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
+31 -37
View File
@@ -21,8 +21,8 @@
#include <isc/attributes.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -31,7 +31,6 @@
#include <dns/dnssec.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/secalg.h>
@@ -44,7 +43,9 @@
const char *program = "dnssec-keyfromlabel";
noreturn static void
static uint16_t tag_min = 0, tag_max = 0xffff;
ISC_NORETURN static void
usage(void);
static void
@@ -57,20 +58,19 @@ usage(void) {
fprintf(stderr, " name: owner of the key\n");
fprintf(stderr, "Other options:\n");
fprintf(stderr, " -a algorithm: \n"
" DH | RSASHA1 |\n"
" RSASHA1 |\n"
" NSEC3RSASHA1 |\n"
" RSASHA256 | RSASHA512 |\n"
" ECDSAP256SHA256 | ECDSAP384SHA384 |\n"
" ED25519 | ED448\n");
fprintf(stderr, " -3: use NSEC3-capable algorithm\n");
fprintf(stderr, " -c class (default: IN)\n");
fprintf(stderr, " -E <engine>:\n");
fprintf(stderr, " name of an OpenSSL engine to use\n");
fprintf(stderr, " -f keyflag: KSK | REVOKE\n");
fprintf(stderr, " -K directory: directory in which to place "
"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");
@@ -103,7 +103,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<id>.key, "
"K<name>+<alg>+<id>.private\n");
exit(-1);
exit(EXIT_FAILURE);
}
int
@@ -113,7 +113,6 @@ main(int argc, char **argv) {
const char *directory = NULL;
const char *predecessor = NULL;
dst_key_t *prevkey = NULL;
const char *engine = NULL;
char *classname = NULL;
char *endp;
dst_key_t *key = NULL;
@@ -129,14 +128,12 @@ main(int argc, char **argv) {
isc_textregion_t r;
char filename[255];
isc_buffer_t buf;
isc_log_t *log = NULL;
dns_rdataclass_t rdclass;
int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC;
char *label = NULL;
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;
@@ -152,6 +149,7 @@ 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();
@@ -161,9 +159,7 @@ main(int argc, char **argv) {
isc_commandline_errprint = false;
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"
#define CMDLINE_FLAGS "3A:a:Cc:D:E:Ff:GhI:i:kK:L:l:M:n:P:p:R:S:t:v:Vy"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
case '3':
@@ -179,7 +175,7 @@ main(int argc, char **argv) {
classname = isc_commandline_argument;
break;
case 'E':
engine = isc_commandline_argument;
fatal("%s", isc_result_totext(DST_R_NOENGINE));
break;
case 'f':
c = (unsigned char)(isc_commandline_argument[0]);
@@ -210,6 +206,20 @@ main(int argc, char **argv) {
case 'l':
label = isc_mem_strdup(mctx, isc_commandline_argument);
break;
case 'M': {
unsigned long ul;
tag_min = ul = strtoul(isc_commandline_argument, &endp,
10);
if (*endp != ':' || ul > 0xffff) {
fatal("-M range invalid");
}
tag_max = ul = strtoul(endp + 1, &endp, 10);
if (*endp != '\0' || ul > 0xffff || tag_max <= tag_min)
{
fatal("-M range invalid");
}
break;
}
case 'n':
nametype = isc_commandline_argument;
break;
@@ -334,16 +344,11 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
ret = dst_lib_init(mctx, engine);
if (ret != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s", isc_result_totext(ret));
}
setup_logging(mctx, &log);
setup_logging();
if (predecessor == NULL) {
if (label == NULL) {
@@ -388,9 +393,6 @@ 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) {
@@ -598,18 +600,11 @@ 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 */
ret = dst_key_fromlabel(name, alg, flags, protocol, rdclass, engine,
label, NULL, mctx, &key);
ret = dst_key_fromlabel(name, alg, flags, protocol, rdclass, label,
NULL, mctx, &key);
if (ret != ISC_R_SUCCESS) {
char namestr[DNS_NAME_FORMATSIZE];
@@ -619,7 +614,7 @@ main(int argc, char **argv) {
fatal("failed to get key %s/%s: %s", namestr, algstr,
isc_result_totext(ret));
UNREACHABLE();
exit(-1);
exit(EXIT_FAILURE);
}
/*
@@ -699,7 +694,8 @@ main(int argc, char **argv) {
* is a risk of ID collision due to this key or another key
* being revoked.
*/
if (key_collision(key, name, directory, mctx, &exact)) {
if (key_collision(key, name, directory, mctx, tag_min, tag_max, &exact))
{
isc_buffer_clear(&buf);
ret = dst_key_buildfilename(key, 0, directory, &buf);
if (ret != ISC_R_SUCCESS) {
@@ -744,8 +740,6 @@ main(int argc, char **argv) {
dst_key_free(&prevkey);
}
cleanup_logging(&log);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
+14 -12
View File
@@ -21,7 +21,7 @@ dnssec-keyfromlabel - DNSSEC key generation tool
Synopsis
~~~~~~~~
:program:`dnssec-keyfromlabel` {**-l** label} [**-3**] [**-a** algorithm] [**-A** date/offset] [**-c** class] [**-D** date/offset] [**-D** sync date/offset] [**-E** engine] [**-f** flag] [**-G**] [**-I** date/offset] [**-i** interval] [**-k**] [**-K** directory] [**-L** ttl] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-R** date/offset] [**-S** key] [**-t** type] [**-v** level] [**-V**] [**-y**] {name}
:program:`dnssec-keyfromlabel` {**-l** label} [**-3**] [**-a** algorithm] [**-A** date/offset] [**-c** class] [**-D** date/offset] [**-D** sync date/offset] [**-f** flag] [**-G**] [**-I** date/offset] [**-i** interval] [**-k**] [**-K** directory] [**-L** ttl] [**-M** tag_min:tag_max] [**-n** nametype] [**-P** date/offset] [**-P** sync date/offset] [**-p** protocol] [**-R** date/offset] [**-S** key] [**-t** type] [**-v** level] [**-V**] [**-y**] {name}
Description
~~~~~~~~~~~
@@ -63,22 +63,12 @@ Options
versions, then the NSEC3 version is used; for example,
``dnssec-keygen -3a RSASHA1`` specifies the NSEC3RSASHA1 algorithm.
.. option:: -E engine
This option specifies the cryptographic hardware to use.
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:: -l label
This option specifies the label for a key pair in the crypto hardware.
When BIND 9 is built with OpenSSL-based PKCS#11 support, the label is
an arbitrary string that identifies a particular key. It may be
preceded by an optional OpenSSL engine name, followed by a colon, as
in ``pkcs11:keylabel``.
an arbitrary string that identifies a particular key.
.. option:: -n nametype
@@ -133,6 +123,18 @@ Options
place, in which case the existing TTL would take precedence. Setting
the default TTL to ``0`` or ``none`` removes it.
.. option:: -M tag_min:tag_max
This option sets the range of key tag values
that ``dnssec-keyfromlabel`` will accept. If the key tag of the new
key or the key tag of the revoked version of the new key is
outside this range, the new key will be rejected. This is
designed to be used when generating keys in a multi-signer
scenario, where each operator is given a range of key tags to
prevent collisions among different operators. The valid
values for ``tag_min`` and ``tag_max`` are [0..65535]. The
default allows all key tag values to be accepted.
.. option:: -p protocol
This option sets the protocol value for the key. The protocol is a number between
+184 -152
View File
@@ -33,11 +33,14 @@
#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/log.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -47,27 +50,29 @@
#include <dns/fixedname.h>
#include <dns/kasp.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/secalg.h>
#include <dst/dst.h>
#include <isccfg/cfg.h>
#include <isccfg/grammar.h>
#include <isccfg/kaspconf.h>
#include <isccfg/namedconf.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/err.h>
#include <openssl/provider.h>
#endif
#include "dnssectool.h"
#define MAX_RSA 4096 /* should be long enough... */
const char *program = "dnssec-keygen";
isc_log_t *lctx = NULL;
/*
* 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;
noreturn static void
ISC_NORETURN static void
usage(void);
static void
@@ -78,19 +83,22 @@ 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;
uint16_t kskflag;
uint16_t revflag;
bool wantzsk;
bool wantksk;
bool wantrev;
dns_secalg_t alg;
/* timing data */
int prepub;
@@ -141,17 +149,22 @@ usage(void) {
fprintf(stderr, " -l <file>: configuration file with dnssec-policy "
"statement\n");
fprintf(stderr, " -a <algorithm>:\n");
fprintf(stderr, " RSASHA1 | NSEC3RSASHA1 |\n");
if (!isc_fips_mode()) {
fprintf(stderr, " RSASHA1 | NSEC3RSASHA1 |\n");
}
fprintf(stderr, " RSASHA256 | RSASHA512 |\n");
fprintf(stderr, " ECDSAP256SHA256 | ECDSAP384SHA384 |\n");
fprintf(stderr, " ED25519 | ED448 | DH\n");
fprintf(stderr, " ED25519 | ED448\n");
fprintf(stderr, " -3: use NSEC3-capable algorithm\n");
fprintf(stderr, " -b <key size in bits>:\n");
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");
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, " ECDSAP256SHA256:\tignored\n");
fprintf(stderr, " ECDSAP384SHA384:\tignored\n");
fprintf(stderr, " ED25519:\tignored\n");
@@ -163,12 +176,10 @@ usage(void) {
fprintf(stderr, " (DNSKEY generation defaults to ZONE)\n");
fprintf(stderr, " -c <class>: (default: IN)\n");
fprintf(stderr, " -d <digest bits> (0 => max, default)\n");
fprintf(stderr, " -E <engine>:\n");
fprintf(stderr, " name of an OpenSSL engine to use\n");
fprintf(stderr, " -f <keyflag>: KSK | REVOKE\n");
fprintf(stderr, " -g <generator>: use specified generator "
"(DH only)\n");
fprintf(stderr, " -f <keyflag>: ZSK | KSK | REVOKE\n");
fprintf(stderr, " -F: FIPS mode\n");
fprintf(stderr, " -L <ttl>: default key TTL\n");
fprintf(stderr, " -M <min>:<max>: allowed Key ID range\n");
fprintf(stderr, " -p <protocol>: (default: 3 [dnssec])\n");
fprintf(stderr, " -s <strength>: strength value this key signs DNS "
"records with (default: 0)\n");
@@ -209,7 +220,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<id>.key, "
"K<name>+<alg>+<id>.private\n");
exit(-1);
exit(EXIT_FAILURE);
}
static void
@@ -236,59 +247,11 @@ 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];
char algstr[DNS_SECALG_FORMATSIZE];
uint16_t flags = 0;
int param = 0;
bool null_key = false;
bool conflict = false;
bool show_progress = false;
@@ -323,8 +286,15 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
fatal("unsupported algorithm: %s", algstr);
}
if (ctx->alg == DST_ALG_DH) {
ctx->options |= DST_TYPE_KEY;
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->use_nsec3) {
@@ -369,6 +339,11 @@ 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;
@@ -524,23 +499,18 @@ 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:
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))
if (ctx->size != 0 &&
(ctx->size < min_rsa || 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;
@@ -555,10 +525,6 @@ 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");
@@ -587,8 +553,12 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
if ((ctx->options & DST_TYPE_KEY) != 0) { /* KEY */
flags |= ctx->signatory;
} else if ((flags & DNS_KEYOWNER_ZONE) != 0) { /* DNSKEY */
flags |= ctx->kskflag;
flags |= ctx->revflag;
if (ctx->ksk || ctx->wantksk) {
flags |= DNS_KEYFLAG_KSK;
}
if (ctx->wantrev) {
flags |= DNS_KEYFLAG_REVOKE;
}
}
if (ctx->protocol == -1) {
@@ -608,12 +578,6 @@ 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:
@@ -622,10 +586,6 @@ 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:
@@ -645,16 +605,27 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
if (!ctx->quiet && show_progress) {
fprintf(stderr, "Generating key pair.");
ret = dst_key_generate(name, ctx->alg, ctx->size, param,
}
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, 0,
flags, ctx->protocol,
ctx->rdclass, mctx, &key,
ctx->rdclass, NULL, mctx, &key,
&progress);
} else {
ret = dst_key_generate(name, ctx->alg, ctx->size, 0,
flags, ctx->protocol,
ctx->rdclass, NULL, mctx, &key,
NULL);
}
if (!ctx->quiet && show_progress) {
putc('\n', stderr);
fflush(stderr);
} else {
ret = dst_key_generate(name, ctx->alg, ctx->size, param,
flags, ctx->protocol,
ctx->rdclass, mctx, &key, NULL);
}
if (ret != ISC_R_SUCCESS) {
@@ -710,7 +681,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
}
if (ctx->setrev) {
if (ctx->kskflag == 0) {
if (!ctx->wantksk) {
fprintf(stderr,
"%s: warning: Key is "
"not flagged as a KSK, but -R "
@@ -785,7 +756,9 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
* if there is a risk of ID collision due to this key
* or another key being revoked.
*/
if (key_collision(key, name, ctx->directory, mctx, NULL)) {
if (key_collision(key, name, ctx->directory, mctx, ctx->tag_min,
ctx->tag_max, NULL))
{
conflict = true;
if (null_key) {
dst_key_free(&key);
@@ -850,6 +823,18 @@ 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;
@@ -858,15 +843,19 @@ main(int argc, char **argv) {
isc_mem_t *mctx = NULL;
isc_result_t ret;
isc_textregion_t r;
const char *engine = NULL;
unsigned char c;
int ch;
bool set_fips_mode = false;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
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) {
@@ -878,8 +867,8 @@ main(int argc, char **argv) {
/*
* Process memory debugging argument first.
*/
#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:" \
#define CMDLINE_FLAGS \
"3A:a:b:Cc:D:d:E:Ff:GhI:i:K:k:L:l:M:m:n:P:p:qR:r:S:s:" \
"T:t:v:V"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
@@ -904,7 +893,6 @@ 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) {
@@ -933,30 +921,21 @@ main(int argc, char **argv) {
}
break;
case 'E':
engine = isc_commandline_argument;
break;
case 'e':
fprintf(stderr, "phased-out option -e "
"(was 'use (RSA) large exponent')\n");
fatal("%s", isc_result_totext(DST_R_NOENGINE));
break;
case 'f':
c = (unsigned char)(isc_commandline_argument[0]);
if (toupper(c) == 'K') {
ctx.kskflag = DNS_KEYFLAG_KSK;
ctx.wantksk = true;
} else if (toupper(c) == 'Z') {
ctx.wantzsk = true;
} else if (toupper(c) == 'R') {
ctx.revflag = DNS_KEYFLAG_REVOKE;
ctx.wantrev = true;
} else {
fatal("unknown flag '%s'",
isc_commandline_argument);
}
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);
@@ -978,6 +957,21 @@ main(int argc, char **argv) {
case 'n':
ctx.nametype = isc_commandline_argument;
break;
case 'M': {
unsigned long ul;
ctx.tag_min = ul = strtoul(isc_commandline_argument,
&endp, 10);
if (*endp != ':' || ul > 0xffff) {
fatal("-M range invalid");
}
ctx.tag_max = ul = strtoul(endp + 1, &endp, 10);
if (*endp != '\0' || ul > 0xffff ||
ctx.tag_max <= ctx.tag_min)
{
fatal("-M range invalid");
}
break;
}
case 'm':
break;
case 'p':
@@ -1113,8 +1107,8 @@ main(int argc, char **argv) {
ctx.prepub = strtottl(isc_commandline_argument);
break;
case 'F':
/* Reserved for FIPS mode */
FALLTHROUGH;
set_fips_mode = true;
break;
case '?':
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
@@ -1132,7 +1126,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -1140,12 +1134,36 @@ main(int argc, char **argv) {
ctx.quiet = true;
}
ret = dst_lib_init(mctx, engine);
if (ret != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s", isc_result_totext(ret));
if (set_fips_mode) {
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
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");
}
}
}
setup_logging(mctx, &lctx);
/*
* The DST subsystem will set FIPS mode if requested at build time.
* The minimum sizes are both raised to 2048.
*/
if (isc_fips_mode()) {
min_rsa = min_dh = 2048;
}
setup_logging();
ctx.rdclass = strtoclass(classname);
@@ -1196,8 +1214,8 @@ main(int argc, char **argv) {
if (ctx.size != -1) {
fatal("-k and -b cannot be used together");
}
if (ctx.kskflag || ctx.revflag) {
fatal("-k and -f cannot be used together");
if (ctx.wantrev) {
fatal("-k and -fR cannot be used together");
}
if (ctx.options & DST_TYPE_KEY) {
fatal("-k and -T KEY cannot be used together");
@@ -1212,12 +1230,13 @@ main(int argc, char **argv) {
ctx.use_nsec3 = false;
ctx.alg = DST_ALG_ECDSA256;
ctx.size = 0;
ctx.kskflag = DNS_KEYFLAG_KSK;
ctx.ttl = 3600;
ctx.setttl = true;
ctx.ksk = true;
ctx.zsk = true;
ctx.lifetime = 0;
ctx.tag_min = 0;
ctx.tag_max = 0xffff;
keygen(&ctx, mctx, argc, argv);
} else {
@@ -1226,7 +1245,7 @@ main(int argc, char **argv) {
dns_kasp_t *kasp = NULL;
dns_kasp_key_t *kaspkey = NULL;
RUNTIME_CHECK(cfg_parser_create(mctx, lctx, &parser) ==
RUNTIME_CHECK(cfg_parser_create(mctx, &parser) ==
ISC_R_SUCCESS);
if (cfg_parse_file(parser, ctx.configfile,
&cfg_type_namedconf,
@@ -1237,7 +1256,8 @@ main(int argc, char **argv) {
ctx.policy, ctx.configfile);
}
kasp_from_conf(config, mctx, ctx.policy, &kasp);
kasp_from_conf(config, mctx, ctx.policy, ctx.directory,
&kasp);
if (kasp == NULL) {
fatal("failed to load dnssec-policy '%s'",
ctx.policy);
@@ -1251,22 +1271,28 @@ main(int argc, char **argv) {
ctx.ttl = dns_kasp_dnskeyttl(kasp);
ctx.setttl = true;
kaspkey = ISC_LIST_HEAD(dns_kasp_keys(kasp));
while (kaspkey != NULL) {
for (kaspkey = ISC_LIST_HEAD(dns_kasp_keys(kasp));
kaspkey != NULL;
kaspkey = ISC_LIST_NEXT(kaspkey, link))
{
ctx.use_nsec3 = false;
ctx.alg = dns_kasp_key_algorithm(kaspkey);
ctx.size = dns_kasp_key_size(kaspkey);
ctx.kskflag = dns_kasp_key_ksk(kaspkey)
? DNS_KEYFLAG_KSK
: 0;
ctx.ksk = dns_kasp_key_ksk(kaspkey);
ctx.zsk = dns_kasp_key_zsk(kaspkey);
ctx.lifetime = dns_kasp_key_lifetime(kaspkey);
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);
@@ -1277,13 +1303,19 @@ main(int argc, char **argv) {
keygen(&ctx, mctx, argc, argv);
}
cleanup_logging(&lctx);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
isc_mem_destroy(&mctx);
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
if (base != NULL) {
OSSL_PROVIDER_unload(base);
}
if (fips != NULL) {
OSSL_PROVIDER_unload(fips);
}
#endif
if (freeit != NULL) {
free(freeit);
}
+29 -22
View File
@@ -21,15 +21,13 @@ 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] [**-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}
:program:`dnssec-keygen` [**-3**] [**-A** date/offset] [**-a** algorithm] [**-b** keysize] [**-C**] [**-c** class] [**-D** date/offset] [**-d** bits] [**-D** sync date/offset] [**-f** flag] [**-F**] [**-G**] [**-h**] [**-I** date/offset] [**-i** interval] [**-K** directory] [**-k** policy] [**-L** ttl] [**-l** file] [**-M** tag_min:tag_max] [**-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`. 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`.
:rfc:`2535` and :rfc:`4034`.
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
@@ -49,9 +47,7 @@ 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. For
TKEY, the value must be DH (Diffie-Hellman); specifying this value
automatically sets the :option:`-T KEY <-T>` option as well.
RSASHA512, ECDSAP256SHA256, ECDSAP384SHA384, ED25519, or ED448.
These values are case-insensitive. In some cases, abbreviations are
supported, such as ECDSA256 for ECDSAP256SHA256 and ECDSA384 for
@@ -98,30 +94,28 @@ Options
and 4096 bits. This option is ignored for algorithms ECDSAP256SHA256,
ECDSAP384SHA384, ED25519, and ED448.
.. 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:: -f flag
This option sets the specified flag in the flag field of the KEY/DNSKEY record.
The only recognized flags are KSK (Key-Signing Key) and REVOKE.
The only recognized flags are ZSK (Zone-Signing Key), KSK (Key-Signing Key)
and REVOKE.
Note that ZSK is not a physical flag in the DNSKEY record, it is merely used
to explicitly tell that you want to create a ZSK. Setting :option:`-f` in
conjunction with :option:`-k` will result in generating keys that only
match the given role set with this option.
.. option:: -F
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 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
@@ -156,6 +150,19 @@ Options
This option provides a configuration file that contains a ``dnssec-policy`` statement
(matching the policy set with :option:`-k`).
.. option:: -M tag_min:tag_max
This option sets the range of acceptable key tag values that ``dnssec-keygen``
will produce. If the key tag of the new key or the key tag of
the revoked version of the new key is outside this range,
the new key will be rejected and another new key will be generated.
This is designed to be used when generating keys in a multi-signer
scenario, where each operator is given a range of key tags to
prevent collisions among different operators. The valid values
for ``tag_min`` and ``tag_max`` are [0..65535]. The default allows all
key tag values to be produced. This option is ignored when ``-k policy``
is specified.
.. option:: -n nametype
This option specifies the owner type of the key. The value of ``nametype`` must
File diff suppressed because it is too large Load Diff
+154
View File
@@ -0,0 +1,154 @@
.. 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** date/offset] [**-F**] [**-h**] [**-i** date/offset] [**-K** directory] [**-k** policy] [**-l** file] [**-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 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:: -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:: -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 zone signing keys (ZSKs), given a DNSSEC policy and
an interval. The number of generated keys depends on the interval and the
ZSK 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 keys 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.
+5 -16
View File
@@ -24,7 +24,6 @@
#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>
@@ -39,7 +38,7 @@ const char *program = "dnssec-revoke";
static isc_mem_t *mctx = NULL;
noreturn static void
ISC_NORETURN static void
usage(void);
static void
@@ -47,7 +46,6 @@ usage(void) {
fprintf(stderr, "Usage:\n");
fprintf(stderr, " %s [options] keyfile\n\n", program);
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
fprintf(stderr, " -E engine: specify OpenSSL engine\n");
fprintf(stderr, " -f: force overwrite\n");
fprintf(stderr, " -h: help\n");
fprintf(stderr, " -K directory: use directory for key files\n");
@@ -59,13 +57,12 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
"K<name>+<alg>+<new id>.private\n");
exit(-1);
exit(EXIT_FAILURE);
}
int
main(int argc, char **argv) {
isc_result_t result;
const char *engine = NULL;
char const *filename = NULL;
char *dir = NULL;
char newname[1024], oldname[1024];
@@ -90,7 +87,7 @@ main(int argc, char **argv) {
while ((ch = isc_commandline_parse(argc, argv, "E:fK:rRhv:V")) != -1) {
switch (ch) {
case 'E':
engine = isc_commandline_argument;
fatal("%s", isc_result_totext(DST_R_NOENGINE));
break;
case 'f':
force = true;
@@ -131,7 +128,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -160,12 +157,6 @@ main(int argc, char **argv) {
}
}
result = dst_lib_init(mctx, engine);
if (result != ISC_R_SUCCESS) {
fatal("Could not initialize dst: %s",
isc_result_totext(result));
}
result = dst_key_fromnamedfile(
filename, dir, DST_TYPE_PUBLIC | DST_TYPE_PRIVATE, mctx, &key);
if (result != ISC_R_SUCCESS) {
@@ -191,7 +182,7 @@ main(int argc, char **argv) {
flags = dst_key_flags(key);
if ((flags & DNS_KEYFLAG_REVOKE) == 0) {
isc_stdtime_t now;
isc_stdtime_t now = isc_stdtime_now();
if ((flags & DNS_KEYFLAG_KSK) == 0) {
fprintf(stderr,
@@ -201,7 +192,6 @@ 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);
@@ -250,7 +240,6 @@ main(int argc, char **argv) {
cleanup:
dst_key_free(&key);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
+1 -9
View File
@@ -21,7 +21,7 @@ dnssec-revoke - set the REVOKED bit on a DNSSEC key
Synopsis
~~~~~~~~
:program:`dnssec-revoke` [**-hr**] [**-v** level] [**-V**] [**-K** directory] [**-E** engine] [**-f**] [**-R**] {keyfile}
:program:`dnssec-revoke` [**-hr**] [**-v** level] [**-V**] [**-K** directory] [**-f**] [**-R**] {keyfile}
Description
~~~~~~~~~~~
@@ -53,14 +53,6 @@ Options
This option prints version information.
.. 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:: -f
This option indicates a forced overwrite and causes :program:`dnssec-revoke` to write the new key pair,
+7 -21
View File
@@ -25,15 +25,14 @@
#include <isc/commandline.h>
#include <isc/file.h>
#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/time.h>
#include <isc/util.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dst/dst.h>
@@ -43,7 +42,7 @@ const char *program = "dnssec-settime";
static isc_mem_t *mctx = NULL;
noreturn static void
ISC_NORETURN static void
usage(void);
static void
@@ -52,7 +51,6 @@ usage(void) {
fprintf(stderr, " %s [options] keyfile\n\n", program);
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
fprintf(stderr, "General options:\n");
fprintf(stderr, " -E engine: specify OpenSSL engine\n");
fprintf(stderr, " -f: force update of old-style "
"keys\n");
fprintf(stderr, " -K directory: set key file location\n");
@@ -102,7 +100,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<new id>.key, "
"K<name>+<alg>+<new id>.private\n");
exit(-1);
exit(EXIT_FAILURE);
}
static void
@@ -187,7 +185,6 @@ writekey(dst_key_t *key, const char *directory, bool write_state) {
int
main(int argc, char **argv) {
isc_result_t result;
const char *engine = NULL;
const char *filename = NULL;
char *directory = NULL;
char keystr[DST_KEY_FORMATSIZE];
@@ -203,7 +200,6 @@ 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;
@@ -230,7 +226,6 @@ main(int argc, char **argv) {
bool epoch = false;
bool changed = false;
bool write_state = false;
isc_log_t *log = NULL;
isc_stdtime_t syncadd = 0, syncdel = 0;
bool unsetsyncadd = false, setsyncadd = false;
bool unsetsyncdel = false, setsyncdel = false;
@@ -239,6 +234,7 @@ 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;
@@ -248,12 +244,10 @@ main(int argc, char **argv) {
isc_mem_create(&mctx);
setup_logging(mctx, &log);
setup_logging();
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) {
@@ -317,7 +311,7 @@ main(int argc, char **argv) {
&setdstime);
break;
case 'E':
engine = isc_commandline_argument;
fatal("%s", isc_result_totext(DST_R_NOENGINE));
break;
case 'f':
force = true;
@@ -539,7 +533,7 @@ main(int argc, char **argv) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
@@ -558,12 +552,6 @@ main(int argc, char **argv) {
fatal("Options -g, -d, -k, -r and -z require -s to be set");
}
result = dst_lib_init(mctx, engine);
if (result != ISC_R_SUCCESS) {
fatal("Could not initialize dst: %s",
isc_result_totext(result));
}
if (predecessor != NULL) {
int major, minor;
@@ -955,11 +943,9 @@ main(int argc, char **argv) {
dst_key_free(&prevkey);
}
dst_key_free(&key);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
cleanup_logging(&log);
isc_mem_free(mctx, directory);
isc_mem_destroy(&mctx);
+2 -10
View File
@@ -21,7 +21,7 @@ dnssec-settime: set the key timing metadata for a DNSSEC key
Synopsis
~~~~~~~~
:program:`dnssec-settime` [**-f**] [**-K** directory] [**-L** ttl] [**-P** date/offset] [**-P** ds date/offset] [**-P** sync date/offset] [**-A** date/offset] [**-R** date/offset] [**-I** date/offset] [**-D** date/offset] [**-D** ds date/offset] [**-D** sync date/offset] [**-S** key] [**-i** interval] [**-h**] [**-V**] [**-v** level] [**-E** engine] {keyfile} [**-s**] [**-g** state] [**-d** state date/offset] [**-k** state date/offset] [**-r** state date/offset] [**-z** state date/offset]
:program:`dnssec-settime` [**-f**] [**-K** directory] [**-L** ttl] [**-P** date/offset] [**-P** ds date/offset] [**-P** sync date/offset] [**-A** date/offset] [**-R** date/offset] [**-I** date/offset] [**-D** date/offset] [**-D** ds date/offset] [**-D** sync date/offset] [**-S** key] [**-i** interval] [**-h**] [**-V**] [**-v** level] {keyfile} [**-s**] [**-g** state] [**-d** state date/offset] [**-k** state date/offset] [**-r** state date/offset] [**-z** state date/offset]
Description
~~~~~~~~~~~
@@ -97,14 +97,6 @@ Options
This option sets the debugging level.
.. 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``).
Timing Options
~~~~~~~~~~~~~~
@@ -148,7 +140,7 @@ All these formats are case-insensitive.
.. option:: -A date/offset
This option sets the date on which the key is to be activated. After that date,
the key is included in the zone and used to sign it.
the key is included in the zone and used to sign it.
.. option:: -R date/offset
+219 -121
View File
@@ -33,23 +33,25 @@
#include <time.h>
#include <unistd.h>
#include <openssl/opensslv.h>
#include <isc/async.h>
#include <isc/atomic.h>
#include <isc/attributes.h>
#include <isc/base32.h>
#include <isc/commandline.h>
#include <isc/dir.h>
#include <isc/event.h>
#include <isc/file.h>
#include <isc/fips.h>
#include <isc/hash.h>
#include <isc/hex.h>
#include <isc/job.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/managers.h>
#include <isc/md.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>
@@ -57,7 +59,6 @@
#include <isc/serial.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/tid.h>
#include <isc/time.h>
#include <isc/util.h>
@@ -68,8 +69,8 @@
#include <dns/dnssec.h>
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/kasp.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/masterdump.h>
#include <dns/nsec.h>
@@ -87,6 +88,10 @@
#include <dns/zoneverify.h>
#include <dst/dst.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/err.h>
#include <openssl/provider.h>
#endif
#include "dnssectool.h"
@@ -101,7 +106,7 @@ static int nsec_datatype = dns_rdatatype_nsec;
"dns_dbiterator_current()")
#define IS_NSEC3 (nsec_datatype == dns_rdatatype_nsec3)
#define OPTOUT(x) (((x)&DNS_NSEC3FLAG_OPTOUT) != 0)
#define OPTOUT(x) (((x) & DNS_NSEC3FLAG_OPTOUT) != 0)
#define REVOKE(x) ((dst_key_flags(x) & DNS_KEYFLAG_REVOKE) != 0)
@@ -135,13 +140,12 @@ static dns_masterformat_t inputformat = dns_masterformat_text;
static dns_masterformat_t outputformat = dns_masterformat_text;
static uint32_t rawversion = 1, serialnum = 0;
static bool snset = false;
static unsigned int nsigned = 0, nretained = 0, ndropped = 0;
static unsigned int nverified = 0, nverifyfailed = 0;
static atomic_uint_fast32_t nsigned = 0, nretained = 0, ndropped = 0;
static atomic_uint_fast32_t nverified = 0, nverifyfailed = 0;
static const char *directory = NULL, *dsdir = NULL;
static isc_mutex_t namelock, statslock;
static isc_mutex_t namelock;
static isc_nm_t *netmgr = NULL;
static isc_loopmgr_t *loopmgr = NULL;
static isc_taskmgr_t *taskmgr = NULL;
static dns_db_t *gdb; /* The database */
static dns_dbversion_t *gversion; /* The database version */
static dns_dbiterator_t *gdbiter; /* The database iterator */
@@ -176,12 +180,11 @@ static bool output_stdout = false;
static bool set_maxttl = false;
static dns_ttl_t maxttl = 0;
static bool no_max_check = false;
static const char *sync_records = "cdnskey,cds:sha-256";
#define INCSTAT(counter) \
if (printstats) { \
LOCK(&statslock); \
counter++; \
UNLOCK(&statslock); \
#define INCSTAT(counter) \
if (printstats) { \
atomic_fetch_add_relaxed(&counter, 1); \
}
/*%
@@ -315,9 +318,8 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dst_key_t *key,
}
tuple = NULL;
result = dns_difftuple_create(mctx, DNS_DIFFOP_ADDRESIGN, name, ttl,
&trdata, &tuple);
check_result(result, "dns_difftuple_create");
dns_difftuple_create(mctx, DNS_DIFFOP_ADDRESIGN, name, ttl, &trdata,
&tuple);
dns_diff_append(add, &tuple);
}
@@ -524,8 +526,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
if (!nosigs) {
arraysize += dns_rdataset_count(&sigset);
}
wassignedby = isc_mem_get(mctx, arraysize * sizeof(bool));
nowsignedby = isc_mem_get(mctx, arraysize * sizeof(bool));
wassignedby = isc_mem_cget(mctx, arraysize, sizeof(bool));
nowsignedby = isc_mem_cget(mctx, arraysize, sizeof(bool));
for (i = 0; i < arraysize; i++) {
wassignedby[i] = nowsignedby[i] = false;
@@ -629,24 +631,20 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
if (sigset.ttl != ttl) {
vbprintf(2, "\tfixing ttl %s\n", sigstr);
tuple = NULL;
result = dns_difftuple_create(
mctx, DNS_DIFFOP_DELRESIGN, name,
sigset.ttl, &sigrdata, &tuple);
check_result(result, "dns_difftuple_create");
dns_difftuple_create(mctx, DNS_DIFFOP_DELRESIGN,
name, sigset.ttl,
&sigrdata, &tuple);
dns_diff_append(del, &tuple);
result = dns_difftuple_create(
mctx, DNS_DIFFOP_ADDRESIGN, name, ttl,
&sigrdata, &tuple);
check_result(result, "dns_difftuple_create");
dns_difftuple_create(mctx, DNS_DIFFOP_ADDRESIGN,
name, ttl, &sigrdata,
&tuple);
dns_diff_append(add, &tuple);
}
} else {
tuple = NULL;
vbprintf(2, "\tremoving signature by %s\n", sigstr);
result = dns_difftuple_create(
mctx, DNS_DIFFOP_DELRESIGN, name, sigset.ttl,
&sigrdata, &tuple);
check_result(result, "dns_difftuple_create");
dns_difftuple_create(mctx, DNS_DIFFOP_DELRESIGN, name,
sigset.ttl, &sigrdata, &tuple);
dns_diff_append(del, &tuple);
INCSTAT(ndropped);
}
@@ -777,8 +775,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name,
}
}
isc_mem_put(mctx, wassignedby, arraysize * sizeof(bool));
isc_mem_put(mctx, nowsignedby, arraysize * sizeof(bool));
isc_mem_cput(mctx, wassignedby, arraysize, sizeof(bool));
isc_mem_cput(mctx, nowsignedby, arraysize, sizeof(bool));
}
struct hashlist {
@@ -993,8 +991,8 @@ opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass,
}
isc_buffer_putuint8(&b, 0);
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
rdclass, 0, NULL, dbp);
result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
dns_dbtype_zone, rdclass, 0, NULL, dbp);
check_result(result, "dns_db_create()");
result = dns_db_load(*dbp, filename, inputformat, DNS_MASTER_HINT);
@@ -1075,9 +1073,8 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) {
dsbuf, &ds);
check_result(result, "dns_ds_buildrdata");
result = dns_difftuple_create(mctx, DNS_DIFFOP_ADDRESIGN, name,
ttl, &ds, &tuple);
check_result(result, "dns_difftuple_create");
dns_difftuple_create(mctx, DNS_DIFFOP_ADDRESIGN, name, ttl, &ds,
&tuple);
dns_diff_append(&diff, &tuple);
}
@@ -1162,7 +1159,7 @@ has_dname(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node) {
* Signs all records at a name.
*/
static void
signname(dns_dbnode_t *node, dns_name_t *name) {
signname(dns_dbnode_t *node, bool apex, dns_name_t *name) {
isc_result_t result;
dns_rdataset_t rdataset;
dns_rdatasetiter_t *rdsiter;
@@ -1213,6 +1210,10 @@ signname(dns_dbnode_t *node, dns_name_t *name) {
dns_name_format(name, namebuf, sizeof(namebuf));
fatal("'%s': found DS RRset without NS RRset\n",
namebuf);
} else if (rdataset.type == dns_rdatatype_dnskey && !apex) {
char namebuf[DNS_NAME_FORMATSIZE];
dns_name_format(name, namebuf, sizeof(namebuf));
fatal("'%s': Non-apex DNSKEY RRset\n", namebuf);
}
signset(&del, &add, node, name, &rdataset);
@@ -1532,7 +1533,7 @@ signapex(void) {
check_result(result, "dns_dbiterator_seek()");
result = dns_dbiterator_current(gdbiter, &node, name);
check_dns_dbiterator_current(result);
signname(node, name);
signname(node, true, name);
dumpnode(name, node);
dns_db_detachnode(gdb, &node);
result = dns_dbiterator_first(gdbiter);
@@ -1661,7 +1662,7 @@ assignwork(void *arg) {
UNLOCK(&namelock);
signname(node, dns_fixedname_name(&fname));
signname(node, false, dns_fixedname_name(&fname));
/*%
* Write a node to the output file, and restart the worker task.
@@ -1669,7 +1670,7 @@ assignwork(void *arg) {
lock_and_dumpnode(dns_fixedname_name(&fname), node);
dns_db_detachnode(gdb, &node);
isc_job_run(loopmgr, assignwork, NULL);
isc_async_current(assignwork, NULL);
}
/*%
@@ -1958,7 +1959,7 @@ addnsec3param(const unsigned char *salt, size_t salt_len,
nsec3param.hash = unknownalg ? DNS_NSEC3_UNKNOWNALG : dns_hash_sha1;
nsec3param.iterations = iterations;
nsec3param.salt_length = (unsigned char)salt_len;
DE_CONST(salt, nsec3param.salt);
nsec3param.salt = UNCONST(salt);
isc_buffer_init(&b, nsec3parambuf, sizeof(nsec3parambuf));
result = dns_rdata_fromstruct(&rdata, gclass, dns_rdatatype_nsec3param,
@@ -2192,10 +2193,9 @@ rrset_cleanup(dns_name_t *name, dns_rdataset_t *rdataset, dns_diff_t *add,
{
vbprintf(2, "removing duplicate at %s/%s\n",
namestr, typestr);
result = dns_difftuple_create(
mctx, DNS_DIFFOP_DELRESIGN, name,
rdataset->ttl, &rdata2, &tuple);
check_result(result, "dns_difftuple_create");
dns_difftuple_create(mctx, DNS_DIFFOP_DELRESIGN,
name, rdataset->ttl,
&rdata2, &tuple);
dns_diff_append(del, &tuple);
} else if (set_maxttl && rdataset->ttl > maxttl) {
vbprintf(2,
@@ -2203,16 +2203,14 @@ rrset_cleanup(dns_name_t *name, dns_rdataset_t *rdataset, dns_diff_t *add,
"from %d to %d\n",
namestr, typestr, rdataset->ttl,
maxttl);
result = dns_difftuple_create(
mctx, DNS_DIFFOP_DELRESIGN, name,
rdataset->ttl, &rdata2, &tuple);
check_result(result, "dns_difftuple_create");
dns_difftuple_create(mctx, DNS_DIFFOP_DELRESIGN,
name, rdataset->ttl,
&rdata2, &tuple);
dns_diff_append(del, &tuple);
tuple = NULL;
result = dns_difftuple_create(
mctx, DNS_DIFFOP_ADDRESIGN, name,
maxttl, &rdata2, &tuple);
check_result(result, "dns_difftuple_create");
dns_difftuple_create(mctx, DNS_DIFFOP_ADDRESIGN,
name, maxttl, &rdata2,
&tuple);
dns_diff_append(add, &tuple);
}
}
@@ -2567,8 +2565,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
isc_result_totext(result));
}
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, db);
check_result(result, "dns_db_create()");
result = dns_db_load(*db, file, inputformat, 0);
@@ -2634,7 +2632,7 @@ loadzonekeys(bool preserve_keys, bool load_public) {
/* Load keys corresponding to the existing DNSKEY RRset. */
result = dns_dnssec_keylistfromrdataset(
gorigin, directory, mctx, &rdataset, &keysigs, &soasigs,
gorigin, NULL, directory, mctx, &rdataset, &keysigs, &soasigs,
preserve_keys, load_public, &keylist);
if (result != ISC_R_SUCCESS) {
fatal("failed to load the zone keys: %s",
@@ -2735,6 +2733,51 @@ clear_keylist(dns_dnsseckeylist_t *list) {
}
}
static void
add_digest(char *str, size_t dlen, dns_kasp_digestlist_t *digests,
bool *cdnskey) {
isc_result_t result;
isc_textregion_t r;
dns_dsdigest_t alg;
dns_kasp_digest_t *digest;
if (dlen == 7 && strncmp(str, "cdnskey", dlen) == 0) {
*cdnskey = true;
return;
}
if (dlen < 5 || strncmp(str, "cds:", 4) != 0) {
fatal("digest must specify cds:algorithm ('%.*s')", (int)dlen,
str);
}
r.base = str + 4;
r.length = dlen - 4;
result = dns_dsdigest_fromtext(&alg, &r);
if (result == DNS_R_UNKNOWN) {
fatal("bad digest '%.*s'", (int)dlen, str);
} else if (result != ISC_R_SUCCESS) {
fatal("bad digest '%.*s': %s", (int)dlen, str,
isc_result_totext(result));
} else if (!dst_ds_digest_supported(alg)) {
fatal("unsupported digest '%.*s'", (int)dlen, str);
}
/* Suppress duplicates */
for (dns_kasp_digest_t *d = ISC_LIST_HEAD(*digests); d != NULL;
d = ISC_LIST_NEXT(d, link))
{
if (d->digest == alg) {
return;
}
}
digest = isc_mem_get(mctx, sizeof(*digest));
digest->digest = alg;
ISC_LINK_INIT(digest, link);
ISC_LIST_APPEND(*digests, digest, link);
}
static void
build_final_keylist(void) {
isc_result_t result;
@@ -2744,19 +2787,44 @@ build_final_keylist(void) {
dns_dnsseckeylist_t rmkeys, matchkeys;
char name[DNS_NAME_FORMATSIZE];
dns_rdataset_t cdsset, cdnskeyset, soaset;
dns_kasp_digestlist_t digests;
dns_kasp_digest_t *d, *d_next;
bool cdnskey = false;
ISC_LIST_INIT(rmkeys);
ISC_LIST_INIT(matchkeys);
ISC_LIST_INIT(digests);
dns_rdataset_init(&soaset);
dns_rdataset_init(&cdsset);
dns_rdataset_init(&cdnskeyset);
if (strlen(sync_records) > 0) {
const char delim = ',';
char *digest;
char *s;
size_t dlen;
digest = UNCONST(sync_records);
next_digest:
s = strchr(digest, delim);
if (s == NULL) {
dlen = strlen(digest);
add_digest(digest, dlen, &digests, &cdnskey);
goto findkeys;
}
dlen = s - digest;
add_digest(digest, dlen, &digests, &cdnskey);
digest = s + 1;
goto next_digest;
}
findkeys:
/*
* Find keys that match this zone in the key repository.
*/
result = dns_dnssec_findmatchingkeys(gorigin, directory, now, mctx,
&matchkeys);
result = dns_dnssec_findmatchingkeys(gorigin, NULL, directory, NULL,
now, mctx, &matchkeys);
if (result == ISC_R_NOTFOUND) {
result = ISC_R_SUCCESS;
}
@@ -2793,8 +2861,9 @@ build_final_keylist(void) {
/*
* Update keylist with sync records.
*/
dns_dnssec_syncupdate(&keylist, &rmkeys, &cdsset, &cdnskeyset, now,
keyttl, &diff, mctx);
&digests, cdnskey, keyttl, &diff, mctx);
dns_name_format(gorigin, name, sizeof(name));
@@ -2818,6 +2887,13 @@ build_final_keylist(void) {
clear_keylist(&rmkeys);
clear_keylist(&matchkeys);
for (d = ISC_LIST_HEAD(digests); d != NULL; d = d_next) {
d_next = ISC_LIST_NEXT(d, link);
ISC_LIST_UNLINK(digests, d, link);
isc_mem_put(mctx, d, sizeof(*d));
}
INSIST(ISC_LIST_EMPTY(digests));
}
static void
@@ -3067,20 +3143,18 @@ writeset(const char *prefix, dns_rdatatype_t type) {
DNS_DSDIGEST_SHA256, dsbuf,
&ds);
check_result(result, "dns_ds_buildrdata");
result = dns_difftuple_create(mctx,
DNS_DIFFOP_ADDRESIGN,
name, 0, &ds, &tuple);
dns_difftuple_create(mctx, DNS_DIFFOP_ADDRESIGN, name,
0, &ds, &tuple);
} else {
result = dns_difftuple_create(
mctx, DNS_DIFFOP_ADDRESIGN, gorigin,
zone_soa_min_ttl, &rdata, &tuple);
dns_difftuple_create(mctx, DNS_DIFFOP_ADDRESIGN,
gorigin, zone_soa_min_ttl, &rdata,
&tuple);
}
check_result(result, "dns_difftuple_create");
dns_diff_append(&diff, &tuple);
}
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
gclass, 0, NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
dns_dbtype_zone, gclass, 0, NULL, &db);
check_result(result, "dns_db_create");
result = dns_db_newversion(db, &dbversion);
@@ -3125,7 +3199,7 @@ print_version(FILE *fp) {
fprintf(fp, "; %s version %s\n", program, PACKAGE_VERSION);
}
noreturn static void
ISC_NORETURN static void
usage(void);
static void
@@ -3145,9 +3219,12 @@ usage(void) {
fprintf(stderr, "\t\tdirectory to find key files (.)\n");
fprintf(stderr, "\t-d directory:\n");
fprintf(stderr, "\t\tdirectory to find dsset-* files (.)\n");
fprintf(stderr, "\t-F:\tFIPS mode\n");
fprintf(stderr, "\t-g:\t");
fprintf(stderr, "update DS records based on child zones' "
"dsset-* files\n");
fprintf(stderr, "\t-G sync-records:\t");
fprintf(stderr, "what CDNSKEY and CDS to publish\n");
fprintf(stderr, "\t-s [YYYYMMDDHHMMSS|+offset]:\n");
fprintf(stderr, "\t\tRRSIG start time "
"- absolute|offset (now - 1 hour)\n");
@@ -3184,8 +3261,6 @@ usage(void) {
fprintf(stderr, "\t-a:\t");
fprintf(stderr, "verify generated signatures\n");
fprintf(stderr, "\t-c class (IN)\n");
fprintf(stderr, "\t-E engine:\n");
fprintf(stderr, "\t\tname of an OpenSSL engine to use\n");
fprintf(stderr, "\t-P:\t");
fprintf(stderr, "disable post-sign verification\n");
fprintf(stderr, "\t-Q:\t");
@@ -3214,7 +3289,7 @@ usage(void) {
fprintf(stderr, "(default: all zone keys that have private keys)\n");
fprintf(stderr, "\tkeyfile (Kname+alg+tag)\n");
exit(0);
exit(EXIT_FAILURE);
}
static void
@@ -3232,21 +3307,24 @@ print_stats(isc_time_t *timer_start, isc_time_t *timer_finish,
uint64_t sig_ms; /* Signatures per millisecond */
FILE *out = output_stdout ? stderr : stdout;
fprintf(out, "Signatures generated: %10u\n", nsigned);
fprintf(out, "Signatures retained: %10u\n", nretained);
fprintf(out, "Signatures dropped: %10u\n", ndropped);
fprintf(out, "Signatures successfully verified: %10u\n", nverified);
fprintf(out,
"Signatures unsuccessfully "
"verified: %10u\n",
nverifyfailed);
fprintf(out, "Signatures generated: %10" PRIuFAST32 "\n",
atomic_load(&nsigned));
fprintf(out, "Signatures retained: %10" PRIuFAST32 "\n",
atomic_load(&nretained));
fprintf(out, "Signatures dropped: %10" PRIuFAST32 "\n",
atomic_load(&ndropped));
fprintf(out, "Signatures successfully verified: %10" PRIuFAST32 "\n",
atomic_load(&nverified));
fprintf(out, "Signatures unsuccessfully verified: %10" PRIuFAST32 "\n",
atomic_load(&nverifyfailed));
time_us = isc_time_microdiff(sign_finish, sign_start);
time_ms = time_us / 1000;
fprintf(out, "Signing time in seconds: %7u.%03u\n",
(unsigned int)(time_ms / 1000), (unsigned int)(time_ms % 1000));
if (time_us > 0) {
sig_ms = ((uint64_t)nsigned * 1000000000) / time_us;
sig_ms = ((uint64_t)atomic_load(&nsigned) * 1000000000) /
time_us;
fprintf(out, "Signatures per second: %7u.%03u\n",
(unsigned int)sig_ms / 1000,
(unsigned int)sig_ms % 1000);
@@ -3273,8 +3351,6 @@ main(int argc, char *argv[]) {
isc_time_t sign_start, sign_finish;
dns_dnsseckey_t *key;
isc_result_t result, vresult;
isc_log_t *log = NULL;
const char *engine = NULL;
bool free_output = false;
int tempfilelen = 0;
dns_rdataclass_t rdclass;
@@ -3284,13 +3360,17 @@ main(int argc, char *argv[]) {
bool set_optout = false;
bool set_iter = false;
bool nonsecify = false;
bool set_fips_mode = false;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
OSSL_PROVIDER *fips = NULL, *base = NULL;
#endif
atomic_init(&shuttingdown, false);
atomic_init(&finished, false);
/* Unused letters: Bb G J q Yy (and F is reserved). */
#define CMDLINE_FLAGS \
"3:AaCc:Dd:E:e:f:FghH:i:I:j:J:K:k:L:l:m:M:n:N:o:O:PpQqRr:s:ST:tuUv:" \
#define CMDLINE_FLAGS \
"3:AaCc:Dd:E:e:f:FgG:hH:i:I:j:J:K:k:L:l:m:M:n:N:o:O:PpQqRr:s:ST:tuUv:" \
"VX:xzZ:"
/*
@@ -3378,7 +3458,7 @@ main(int argc, char *argv[]) {
break;
case 'E':
engine = isc_commandline_argument;
fatal("%s", isc_result_totext(DST_R_NOENGINE));
break;
case 'e':
@@ -3396,11 +3476,15 @@ main(int argc, char *argv[]) {
generateds = true;
break;
case 'G':
sync_records = isc_commandline_argument;
break;
case 'H':
set_iter = true;
/* too-many is NOT DOCUMENTED */
if (strcmp(isc_commandline_argument, "too-many") == 0) {
nsec3iter = 151;
nsec3iter = 51;
no_max_check = true;
break;
}
@@ -3456,7 +3540,7 @@ main(int argc, char *argv[]) {
if (*endp != '\0') {
fprintf(stderr, "source serial number "
"must be numeric");
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -3471,7 +3555,7 @@ main(int argc, char *argv[]) {
if (*endp != '\0') {
fprintf(stderr, "maximum TTL "
"must be numeric");
exit(1);
exit(EXIT_FAILURE);
}
break;
@@ -3569,8 +3653,9 @@ main(int argc, char *argv[]) {
break;
case 'F':
/* Reserved for FIPS mode */
FALLTHROUGH;
set_fips_mode = true;
break;
case '?':
if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n",
@@ -3594,11 +3679,11 @@ main(int argc, char *argv[]) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
isc_stdtime_get(&now);
now = isc_stdtime_now();
if (startstr != NULL) {
starttime = strtotime(startstr, now, now, NULL);
@@ -3637,15 +3722,30 @@ main(int argc, char *argv[]) {
directory = ".";
}
isc_managers_create(&mctx, nloops, &loopmgr, &netmgr, &taskmgr);
isc_managers_create(&mctx, nloops, &loopmgr, &netmgr);
result = dst_lib_init(mctx, engine);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s",
isc_result_totext(result));
if (set_fips_mode) {
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
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");
}
}
}
setup_logging(mctx, &log);
setup_logging();
argc -= isc_commandline_index;
argv += isc_commandline_index;
@@ -3702,7 +3802,7 @@ main(int argc, char *argv[]) {
rawversion > 1U)
{
fprintf(stderr, "unknown raw format version\n");
exit(1);
exit(EXIT_FAILURE);
}
} else {
fatal("unknown file format: %s", outputformatstr);
@@ -3742,7 +3842,7 @@ main(int argc, char *argv[]) {
check_result(result, "dns_master_stylecreate");
gdb = NULL;
TIME_NOW(&timer_start);
timer_start = isc_time_now();
loadzone(file, origin, rdclass, &gdb);
if (journal != NULL) {
loadjournal(mctx, gdb, journal);
@@ -3778,7 +3878,7 @@ main(int argc, char *argv[]) {
* of keys rather early.
*/
ISC_LIST_INIT(keylist);
isc_rwlock_init(&keylist_lock, 0, 0);
isc_rwlock_init(&keylist_lock);
/*
* Fill keylist with:
@@ -3913,11 +4013,7 @@ main(int argc, char *argv[]) {
result = isc_file_mktemplate(output, tempfile, tempfilelen);
check_result(result, "isc_file_mktemplate");
if (outputformat == dns_masterformat_text) {
result = isc_file_openunique(tempfile, &outfp);
} else {
result = isc_file_bopenunique(tempfile, &outfp);
}
result = isc_file_openunique(tempfile, &outfp);
if (result != ISC_R_SUCCESS) {
fatal("failed to open temporary output file: %s",
isc_result_totext(result));
@@ -3931,12 +4027,8 @@ main(int argc, char *argv[]) {
isc_mutex_init(&namelock);
if (printstats) {
isc_mutex_init(&statslock);
}
presign();
TIME_NOW(&sign_start);
sign_start = isc_time_now();
signapex();
if (!atomic_load(&finished)) {
/*
@@ -3952,7 +4044,7 @@ main(int argc, char *argv[]) {
}
}
postsign();
TIME_NOW(&sign_finish);
sign_finish = isc_time_now();
if (disable_zone_check) {
vresult = ISC_R_SUCCESS;
@@ -4020,19 +4112,25 @@ main(int argc, char *argv[]) {
dns_master_styledestroy(&dsstyle, mctx);
cleanup_logging(&log);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr);
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
if (base != NULL) {
OSSL_PROVIDER_unload(base);
}
if (fips != NULL) {
OSSL_PROVIDER_unload(fips);
}
#endif
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
if (printstats) {
TIME_NOW(&timer_finish);
timer_finish = isc_time_now();
print_stats(&timer_start, &timer_finish, &sign_start,
&sign_finish);
isc_mutex_destroy(&statslock);
}
isc_mutex_destroy(&namelock);
+24 -15
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] [**-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...]
:program:`dnssec-signzone` [**-a**] [**-c** class] [**-d** directory] [**-D**] [**-e** end-time] [**-f** output-file] [**-F**] [**-g**] [**-G sync-records**] [**-h**] [**-i** interval] [**-I** input-format] [**-j** jitter] [**-J** filename] [**-K** directory] [**-k** key] [**-L** serial] [**-M** maxttl] [**-N** soa-serial-format] [**-o** origin] [**-O** output-format] [**-P**] [**-Q**] [**-q**] [**-R**] [**-S**] [**-s** start-time] [**-T** ttl] [**-t**] [**-u**] [**-v** level] [**-V**] [**-X** extended end-time] [**-x**] [**-z**] [**-3** salt] [**-H** iterations] [**-A**] {zonefile} [key...]
Description
~~~~~~~~~~~
@@ -62,20 +62,29 @@ Options
``$INCLUDE``. This option cannot be combined with :option:`-O raw <-O>`
or serial-number updating.
.. option:: -E engine
.. option:: -F
This option specifies the hardware to use for cryptographic
operations, such as a secure key store used for signing, 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``).
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
@@ -260,7 +269,7 @@ Options
with cached copies of the old DNSKEY RRset. The :option:`-Q` option forces
:program:`dnssec-signzone` to remove signatures from keys that are no longer
active. This enables ZSK rollover using the procedure described in
:rfc:`4641#4.2.1.1` ("Pre-Publish Key Rollover").
:rfc:`6781#4.1.1.1` ("Pre-Publish Key Rollover").
.. option:: -q
@@ -277,7 +286,7 @@ Options
This option is similar to :option:`-Q`, except it forces
:program:`dnssec-signzone` to remove signatures from keys that are no longer
published. This enables ZSK rollover using the procedure described in
:rfc:`4641#4.2.1.2` ("Double Signature Zone Signing Key
:rfc:`6781#4.1.1.2` ("Double Signature Zone Signing Key
Rollover").
.. option:: -S
@@ -346,15 +355,12 @@ 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. (This is similar to the
``dnssec-dnskey-kskonly yes;`` zone option in :iscman:`named`.)
and should omit signatures from zone-signing keys.
.. 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
@@ -364,6 +370,7 @@ Options
.. note::
``-3 -`` is the recommended configuration. Adding salt provides no practical benefits.
See :rfc:`9276`.
.. option:: -H iterations
@@ -372,6 +379,7 @@ Options
.. warning::
Values greater than 0 cause interoperability issues and also increase the risk of CPU-exhausting DoS attacks.
See :rfc:`9276`.
.. option:: -A
@@ -380,6 +388,7 @@ Options
.. warning::
Do not use this option unless all its implications are fully understood. This option is intended only for extremely large zones (comparable to ``com.``) with sparse secure delegations.
See :rfc:`9276`.
.. option:: -AA
@@ -433,4 +442,4 @@ See Also
~~~~~~~~
:iscman:`dnssec-keygen(8) <dnssec-keygen>`, BIND 9 Administrator Reference Manual, :rfc:`4033`,
:rfc:`4641`.
:rfc:`6781`.
+9 -23
View File
@@ -20,14 +20,13 @@
#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/log.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>
@@ -44,7 +43,6 @@
#include <dns/ds.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/masterdump.h>
#include <dns/nsec.h>
@@ -111,8 +109,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
isc_result_totext(result));
}
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, db);
check_result(result, "dns_db_create()");
result = dns_db_load(*db, file, inputformat, 0);
@@ -138,7 +136,7 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
}
}
noreturn static void
ISC_NORETURN static void
usage(void);
static void
@@ -159,12 +157,10 @@ usage(void) {
fprintf(stderr, "\t-I format:\n");
fprintf(stderr, "\t\tfile format of input zonefile (text)\n");
fprintf(stderr, "\t-c class (IN)\n");
fprintf(stderr, "\t-E engine:\n");
fprintf(stderr, "\t\tname of an OpenSSL engine to use\n");
fprintf(stderr, "\t-x:\tDNSKEY record signed with KSKs only, "
"not ZSKs\n");
fprintf(stderr, "\t-z:\tAll records signed with KSKs\n");
exit(0);
exit(EXIT_SUCCESS);
}
int
@@ -172,8 +168,6 @@ main(int argc, char *argv[]) {
char *origin = NULL, *file = NULL;
char *inputformatstr = NULL;
isc_result_t result;
isc_log_t *log = NULL;
const char *engine = NULL;
char *classname = NULL;
dns_rdataclass_t rdclass;
char *endp;
@@ -217,7 +211,7 @@ main(int argc, char *argv[]) {
break;
case 'E':
engine = isc_commandline_argument;
fatal("%s", isc_result_totext(DST_R_NOENGINE));
break;
case 'I':
@@ -273,21 +267,15 @@ main(int argc, char *argv[]) {
default:
fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option);
exit(1);
exit(EXIT_FAILURE);
}
}
result = dst_lib_init(mctx, engine);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s",
isc_result_totext(result));
}
isc_stdtime_get(&now);
now = isc_stdtime_now();
rdclass = strtoclass(classname);
setup_logging(mctx, &log);
setup_logging();
argc -= isc_commandline_index;
argv += isc_commandline_index;
@@ -337,8 +325,6 @@ main(int argc, char *argv[]) {
dns_db_closeversion(gdb, &gversion, false);
dns_db_detach(&gdb);
cleanup_logging(&log);
dst_lib_destroy();
if (verbose > 10) {
isc_mem_stats(mctx, stdout);
}
+6 -9
View File
@@ -21,7 +21,7 @@ dnssec-verify - DNSSEC zone verification tool
Synopsis
~~~~~~~~
:program:`dnssec-verify` [**-c** class] [**-E** engine] [**-I** input-format] [**-o** origin] [**-q**] [**-v** level] [**-V**] [**-x**] [**-z**] {zonefile}
:program:`dnssec-verify` [**-c** class] [**-I** input-format] [**-J** filename] [**-o** origin] [**-q**] [**-v** level] [**-V**] [**-x**] [**-z**] {zonefile}
Description
~~~~~~~~~~~
@@ -37,14 +37,6 @@ Options
This option specifies the DNS class of the zone.
.. 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:: -I input-format
This option sets the format of the input zone file. Possible formats are ``text``
@@ -53,6 +45,11 @@ Options
format containing updates can be verified independently.
This option is not useful for non-dynamic zones.
.. option:: -J filename
This option tells :program:`dnssec-verify` to read the journal from the given file
when loading the zone file.
.. option:: -o origin
This option indicates the zone origin. If not specified, the name of the zone file is
+116 -68
View File
@@ -20,6 +20,7 @@
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/base32.h>
#include <isc/buffer.h>
@@ -28,11 +29,12 @@
#include <isc/file.h>
#include <isc/heap.h>
#include <isc/list.h>
#include <isc/log.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>
@@ -42,7 +44,6 @@
#include <dns/fixedname.h>
#include <dns/journal.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/nsec.h>
#include <dns/nsec3.h>
@@ -83,7 +84,7 @@ fatal(const char *format, ...) {
if (fatalcallback != NULL) {
(*fatalcallback)();
}
exit(1);
_exit(EXIT_FAILURE);
}
void
@@ -113,7 +114,7 @@ vbprintf(int level, const char *fmt, ...) {
void
version(const char *name) {
printf("%s %s\n", name, PACKAGE_VERSION);
exit(0);
exit(EXIT_SUCCESS);
}
void
@@ -127,10 +128,8 @@ sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size) {
}
void
setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
isc_logdestination_t destination;
setup_logging(void) {
isc_logconfig_t *logconfig = NULL;
isc_log_t *log = NULL;
int level;
if (verbose < 0) {
@@ -152,10 +151,8 @@ setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
break;
}
isc_log_create(mctx, &log, &logconfig);
isc_log_setcontext(log);
dns_log_init(log);
dns_log_setcontext(log);
logconfig = isc_logconfig_get();
isc_log_settag(logconfig, program);
/*
@@ -164,36 +161,11 @@ setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
* - the program name and logging level are printed
* - no time stamp is printed
*/
destination.file.stream = stderr;
destination.file.name = NULL;
destination.file.versions = ISC_LOG_ROLLNEVER;
destination.file.maximum_size = 0;
isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC, level,
&destination,
ISC_LOG_PRINTTAG | ISC_LOG_PRINTLEVEL);
RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL) ==
ISC_R_SUCCESS);
*logp = log;
}
void
cleanup_logging(isc_log_t **logp) {
isc_log_t *log;
REQUIRE(logp != NULL);
log = *logp;
*logp = NULL;
if (log == NULL) {
return;
}
isc_log_destroy(&log);
isc_log_setcontext(NULL);
dns_log_setcontext(NULL);
isc_log_createandusechannel(
logconfig, "default_stderr", ISC_LOG_TOFILEDESC, level,
ISC_LOGDESTINATION_STDERR,
ISC_LOG_PRINTTAG | ISC_LOG_PRINTLEVEL, ISC_LOGCATEGORY_DEFAULT,
ISC_LOGMODULE_DEFAULT);
}
static isc_stdtime_t
@@ -290,15 +262,11 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
struct tm tm;
if (isnone(str)) {
if (setp != NULL) {
*setp = false;
}
SET_IF_NOT_NULL(setp, false);
return ((isc_stdtime_t)0);
}
if (setp != NULL) {
*setp = true;
}
SET_IF_NOT_NULL(setp, true);
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') {
return ((isc_stdtime_t)0);
@@ -375,7 +343,7 @@ strtoclass(const char *str) {
if (str == NULL) {
return (dns_rdataclass_in);
}
DE_CONST(str, r.base);
r.base = UNCONST(str);
r.length = strlen(str);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS) {
@@ -390,7 +358,7 @@ strtodsdigest(const char *str) {
dns_dsdigest_t alg;
isc_result_t result;
DE_CONST(str, r.base);
r.base = UNCONST(str);
r.length = strlen(str);
result = dns_dsdigest_fromtext(&alg, &r);
if (result != ISC_R_SUCCESS) {
@@ -475,15 +443,14 @@ set_keyversion(dst_key_t *key) {
* set the creation date
*/
if (major < 1 || (major == 1 && minor <= 2)) {
isc_stdtime_t now;
isc_stdtime_get(&now);
isc_stdtime_t now = isc_stdtime_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, bool *exact) {
isc_mem_t *mctx, uint16_t min, uint16_t max, bool *exact) {
isc_result_t result;
bool conflict = false;
dns_dnsseckeylist_t matchkeys;
@@ -491,9 +458,7 @@ 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;
char filename[NAME_MAX];
isc_buffer_t fileb;
isc_stdtime_t now;
isc_stdtime_t now = isc_stdtime_now();
if (exact != NULL) {
*exact = false;
@@ -503,24 +468,24 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
rid = dst_key_rid(dstkey);
alg = dst_key_alg(dstkey);
/*
* 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) {
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);
}
return (isc_file_exists(filename));
}
ISC_LIST_INIT(matchkeys);
isc_stdtime_get(&now);
result = dns_dnssec_findmatchingkeys(name, dir, now, mctx, &matchkeys);
result = dns_dnssec_findmatchingkeys(name, NULL, dir, NULL, now, mctx,
&matchkeys);
if (result == ISC_R_NOTFOUND) {
return (false);
}
@@ -623,3 +588,86 @@ loadjournal(isc_mem_t *mctx, dns_db_t *db, const char *file) {
cleanup:
dns_journal_destroy(&jnl);
}
void
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, const char *name,
const char *keydir, 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, &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, &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, &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);
}
}
+16 -7
View File
@@ -20,10 +20,18 @@
#include <isc/log.h>
#include <isc/stdtime.h>
#include <dns/kasp.h>
#include <dns/rdatastruct.h>
#include <dst/dst.h>
#include <isccfg/cfg.h>
#include <isccfg/kaspconf.h>
#include <isccfg/namedconf.h>
#define MAX_RSA 4096 /* should be long enough... */
#define MAX_DH 4096 /* should be long enough... */
/*! verbosity: set by -v and -q option in each program, defined in dnssectool.c
*/
extern int verbose;
@@ -46,7 +54,7 @@ extern uint8_t dtype[8];
typedef void(fatalcallback_t)(void);
noreturn void
ISC_NORETURN void
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
void
@@ -58,7 +66,7 @@ check_result(isc_result_t result, const char *message);
void
vbprintf(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
noreturn void
ISC_NORETURN void
version(const char *program);
void
@@ -67,10 +75,7 @@ sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size);
(DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + sizeof("65535"))
void
setup_logging(isc_mem_t *mctx, isc_log_t **logp);
void
cleanup_logging(isc_log_t **logp);
setup_logging(void);
dns_ttl_t
strtottl(const char *str);
@@ -101,10 +106,14 @@ set_keyversion(dst_key_t *key);
bool
key_collision(dst_key_t *key, dns_name_t *name, const char *dir,
isc_mem_t *mctx, bool *exact);
isc_mem_t *mctx, uint16_t min, uint16_t max, bool *exact);
bool
isoptarg(const char *arg, char **argv, void (*usage)(void));
void
loadjournal(isc_mem_t *mctx, dns_db_t *db, const char *journal);
void
kasp_from_conf(cfg_obj_t *config, isc_mem_t *mctx, const char *name,
const char *keydir, dns_kasp_t **kaspp);
+2 -4
View File
@@ -7,7 +7,6 @@ AM_CPPFLAGS += \
$(LIBNS_CFLAGS) \
$(LIBISCCC_CFLAGS) \
$(LIBISCCFG_CFLAGS) \
$(LIBBIND9_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(LIBCAP_CFLAGS) \
$(LMDB_CFLAGS) \
@@ -39,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
@@ -103,7 +102,6 @@ named_LDADD = \
$(LIBNS_LIBS) \
$(LIBISCCC_LIBS) \
$(LIBISCCFG_LIBS) \
$(LIBBIND9_LIBS) \
$(OPENSSL_LIBS) \
$(LIBCAP_LIBS) \
$(LMDB_LIBS) \
+57 -102
View File
@@ -156,29 +156,6 @@
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;
@@ -326,8 +303,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/>
@@ -931,84 +908,62 @@
</xsl:for-each>
</xsl:for-each>
</xsl:if>
<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 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>
</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>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>
</xsl:if>
<xsl:if test="memory/summary">
<h2>Memory Usage Summary</h2>
+914 -275
View File
File diff suppressed because it is too large Load Diff
+54 -88
View File
@@ -49,7 +49,6 @@ static char defaultconf[] = "\
options {\n\
answer-cookie true;\n\
automatic-interface-scan yes;\n\
bindkeys-file \"" NAMED_SYSCONFDIR "/bind.keys\";\n\
# blackhole {none;};\n\
cookie-algorithm siphash24;\n\
# directory <none>\n\
@@ -64,11 +63,9 @@ options {\n\
geoip-directory \".\";\n"
#endif /* if defined(HAVE_GEOIP2) */
"\
heartbeat-interval 60;\n\
interface-interval 60;\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\
@@ -98,11 +95,12 @@ 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\
@@ -112,6 +110,7 @@ options {\n\
# session-keyfile \"" NAMED_LOCALSTATEDIR "/run/named/session.key\";\n\
session-keyname local-ddns;\n\
startup-notify-rate 20;\n\
sig0checks-quota 1;\n\
statistics-file \"named.stats\";\n\
tcp-advertised-timeout 300;\n\
tcp-clients 150;\n\
@@ -121,7 +120,6 @@ 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\
@@ -136,6 +134,8 @@ 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\
@@ -168,7 +168,8 @@ options {\n\
max-clients-per-query 100;\n\
max-ncache-ttl 10800; /* 3 hours */\n\
max-recursion-depth 7;\n\
max-recursion-queries 100;\n\
max-recursion-queries 32;\n\
max-query-restarts 11;\n\
max-stale-ttl 86400; /* 1 day */\n\
message-compression yes;\n\
min-ncache-ttl 0; /* 0 hours */\n\
@@ -187,9 +188,8 @@ options {\n\
recursion true;\n\
request-expire true;\n\
request-ixfr true;\n\
request-ixfr-max-diffs 0;\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\
@@ -201,31 +201,31 @@ 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 {any;};\n\
allow-transfer {none;};\n\
# also-notify <none>\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-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\
@@ -240,12 +240,9 @@ 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\
@@ -296,10 +293,15 @@ 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\
@@ -310,7 +312,9 @@ dnssec-policy \"default\" {\n\
};\n\
\n\
dnssec-policy \"insecure\" {\n\
max-zone-ttl 0; \n\
keys { };\n\
inline-signing yes;\n\
};\n\
\n\
"
@@ -327,14 +331,14 @@ dnssec-policy \"insecure\" {\n\
"# END TRUST ANCHORS\n\
\n\
primaries " DEFAULT_IANA_ROOT_ZONE_PRIMARIES " {\n\
2001:500:200::b; # b.root-servers.net\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\
2001:500:12::d0d; # g.root-servers.net\n\
2001:7fd::1; # k.root-servers.net\n\
2620:0:2830:202::132; # xfr.cjr.dns.icann.org\n\
2620:0:2d0:202::132; # xfr.lax.dns.icann.org\n\
199.9.14.201; # b.root-servers.net\n\
170.247.170.2; # b.root-servers.net\n\
192.33.4.12; # c.root-servers.net\n\
192.5.5.241; # f.root-servers.net\n\
192.112.36.4; # g.root-servers.net\n\
@@ -351,7 +355,9 @@ named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) {
isc_buffer_init(&b, defaultconf, sizeof(defaultconf) - 1);
isc_buffer_add(&b, sizeof(defaultconf) - 1);
return (cfg_parse_buffer(parser, &b, __FILE__, 0, &cfg_type_namedconf,
CFG_PCTX_NODEPRECATED, conf));
CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
CFG_PCTX_NOEXPERIMENTAL,
conf));
}
const char *
@@ -440,12 +446,12 @@ named_config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
*classp = defclass;
return (ISC_R_SUCCESS);
}
DE_CONST(cfg_obj_asstring(classobj), r.base);
r.base = UNCONST(cfg_obj_asstring(classobj));
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);
cfg_obj_log(classobj, ISC_LOG_ERROR, "unknown class '%s'",
r.base);
}
return (result);
}
@@ -460,12 +466,12 @@ named_config_gettype(const cfg_obj_t *typeobj, dns_rdatatype_t deftype,
*typep = deftype;
return (ISC_R_SUCCESS);
}
DE_CONST(cfg_obj_asstring(typeobj), r.base);
r.base = UNCONST(cfg_obj_asstring(typeobj));
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);
cfg_obj_log(typeobj, ISC_LOG_ERROR, "unknown type '%s'",
r.base);
}
return (result);
}
@@ -576,22 +582,18 @@ named_config_getname(isc_mem_t *mctx, const cfg_obj_t *obj,
return (ISC_R_SUCCESS);
}
#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]); \
array = isc_mem_regetx(mctx, array, oldsize, newsize, \
ISC_MEM_ZERO); \
oldlen = newlen + 16; \
#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 shrink_array(mctx, array, newlen, oldlen) \
if (newlen < oldlen) { \
size_t newsize = newlen * sizeof(array[0]); \
size_t oldsize = oldlen * sizeof(array[0]); \
array = isc_mem_regetx(mctx, array, oldsize, newsize, \
ISC_MEM_ZERO); \
oldlen = newlen; \
#define shrink_array(mctx, array, newlen, oldlen) \
if (newlen < oldlen) { \
array = isc_mem_creget(mctx, array, oldlen, newlen, \
sizeof(array[0])); \
oldlen = newlen; \
}
isc_result_t
@@ -660,7 +662,7 @@ newlist:
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,
cfg_obj_log(portobj, ISC_LOG_ERROR,
"port '%u' out of range", val);
result = ISC_R_RANGE;
goto cleanup;
@@ -715,7 +717,7 @@ resume:
tresult = named_config_getremotesdef(config, listtype,
listname, &list);
if (tresult == ISC_R_NOTFOUND) {
cfg_obj_log(addr, named_g_lctx, ISC_LOG_ERROR,
cfg_obj_log(addr, ISC_LOG_ERROR,
"%s \"%s\" not found", listtype,
listname);
@@ -808,10 +810,10 @@ resume:
shrink_array(mctx, sources, i, srccount);
if (lists != NULL) {
isc_mem_put(mctx, lists, listcount * sizeof(lists[0]));
isc_mem_cput(mctx, lists, listcount, sizeof(lists[0]));
}
if (stack != NULL) {
isc_mem_put(mctx, stack, stackcount * sizeof(stack[0]));
isc_mem_cput(mctx, stack, stackcount, sizeof(stack[0]));
}
INSIST(keycount == addrcount);
@@ -829,7 +831,7 @@ resume:
cleanup:
if (addrs != NULL) {
isc_mem_put(mctx, addrs, addrcount * sizeof(addrs[0]));
isc_mem_cput(mctx, addrs, addrcount, sizeof(addrs[0]));
}
if (keys != NULL) {
for (size_t j = 0; j < i; j++) {
@@ -841,7 +843,7 @@ cleanup:
}
isc_mem_put(mctx, keys[j], sizeof(*keys[j]));
}
isc_mem_put(mctx, keys, keycount * sizeof(keys[0]));
isc_mem_cput(mctx, keys, keycount, sizeof(keys[0]));
}
if (tlss != NULL) {
for (size_t j = 0; j < i; j++) {
@@ -853,16 +855,16 @@ cleanup:
}
isc_mem_put(mctx, tlss[j], sizeof(*tlss[j]));
}
isc_mem_put(mctx, tlss, tlscount * sizeof(tlss[0]));
isc_mem_cput(mctx, tlss, tlscount, sizeof(tlss[0]));
}
if (sources != NULL) {
isc_mem_put(mctx, sources, srccount * sizeof(sources[0]));
isc_mem_cput(mctx, sources, srccount, sizeof(sources[0]));
}
if (lists != NULL) {
isc_mem_put(mctx, lists, listcount * sizeof(lists[0]));
isc_mem_cput(mctx, lists, listcount, sizeof(lists[0]));
}
if (stack != NULL) {
isc_mem_put(mctx, stack, stackcount * sizeof(stack[0]));
isc_mem_cput(mctx, stack, stackcount, sizeof(stack[0]));
}
return (result);
}
@@ -887,8 +889,7 @@ named_config_getport(const cfg_obj_t *config, const char *type,
result = named_config_get(maps, type, &portobj);
INSIST(result == ISC_R_SUCCESS);
if (cfg_obj_asuint32(portobj) >= UINT16_MAX) {
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
"port '%u' out of range",
cfg_obj_log(portobj, ISC_LOG_ERROR, "port '%u' out of range",
cfg_obj_asuint32(portobj));
return (ISC_R_RANGE);
}
@@ -920,14 +921,8 @@ struct keyalgorithms {
{ NULL, hmacnone, DST_ALG_UNKNOWN, 0 } };
isc_result_t
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
named_config_getkeyalgorithm(const char *str, unsigned int *typep,
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;
@@ -958,36 +953,7 @@ named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
} else {
bits = algorithms[i].size;
}
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;
}
SET_IF_NOT_NULL(typep, algorithms[i].type);
SET_IF_NOT_NULL(digestbits, bits);
return (ISC_R_SUCCESS);
}
+22 -14
View File
@@ -15,8 +15,8 @@
#include <stdbool.h>
#include <isc/event.h>
#include <isc/lex.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
@@ -135,7 +135,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
!command_compare(command, NAMED_COMMAND_TESTGEN) &&
!command_compare(command, NAMED_COMMAND_ZONESTATUS))
{
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
isc_log_write(NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_CONTROL, log_level,
"rejecting restricted control channel "
"command '%s'",
@@ -144,9 +144,9 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
goto cleanup;
}
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_CONTROL, log_level,
"received control channel command '%s'", cmdline);
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_CONTROL,
log_level, "received control channel command '%s'",
cmdline);
/*
* After the lengthy "halt" and "stop", the commands are
@@ -178,6 +178,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
/* 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,11 +196,15 @@ 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))
{
result = named_server_changezone(named_g_server, cmdline, text);
} else if (command_compare(command, NAMED_COMMAND_CLOSELOGS)) {
isc_log_closefilelogs();
result = ISC_R_SUCCESS;
} else if (command_compare(command, NAMED_COMMAND_DELZONE)) {
result = named_server_delzone(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_DNSSEC)) {
@@ -209,8 +214,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
{
result = named_server_dnstap(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_DUMPDB)) {
named_server_dumpdb(named_g_server, lex, text);
result = ISC_R_SUCCESS;
result = named_server_dumpdb(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_DUMPSTATS)) {
result = named_server_dumpstats(named_g_server);
} else if (command_compare(command, NAMED_COMMAND_FETCHLIMIT)) {
@@ -223,6 +227,8 @@ 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))
{
@@ -233,14 +239,16 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
result = named_server_notifycommand(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_NOTRACE)) {
named_g_debuglevel = 0;
isc_log_setdebuglevel(named_g_lctx, named_g_debuglevel);
isc_log_setdebuglevel(named_g_debuglevel);
result = ISC_R_SUCCESS;
} else if (command_compare(command, NAMED_COMMAND_NTA)) {
result = named_server_nta(named_g_server, lex, readonly, text);
} else if (command_compare(command, NAMED_COMMAND_NULL)) {
result = ISC_R_SUCCESS;
} else if (command_compare(command, NAMED_COMMAND_QUERYLOG)) {
result = named_server_togglequerylog(named_g_server, lex);
result = named_server_setortoggle(named_g_server,
"query logging",
NS_SERVER_LOGQUERIES, lex);
} else if (command_compare(command, NAMED_COMMAND_RECONFIG)) {
result = named_server_reconfigcommand(named_g_server);
} else if (command_compare(command, NAMED_COMMAND_RECURSING)) {
@@ -249,6 +257,10 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
result = named_server_refreshcommand(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_RELOAD)) {
result = named_server_reloadcommand(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_RESPONSELOG)) {
result = named_server_setortoggle(named_g_server,
"response logging",
NS_SERVER_LOGRESPONSES, lex);
} else if (command_compare(command, NAMED_COMMAND_RETRANSFER)) {
result = named_server_retransfercommand(named_g_server, lex,
text);
@@ -277,16 +289,12 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
result = named_server_freeze(named_g_server, false, lex, text);
} 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)) {
result = named_server_zonestatus(named_g_server, lex, text);
} else {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
isc_log_write(NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_CONTROL, ISC_LOG_WARNING,
"unknown control channel command '%s'", command);
result = DNS_R_UNKNOWNCOMMAND;
+257 -375
View File
File diff suppressed because it is too large Load Diff
+2 -3
View File
@@ -17,14 +17,13 @@
#include <stdlib.h>
#include <string.h>
#include <isc/log.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>
#include <dlz/dlz_dlopen_driver.h>
#include <named/globals.h>
@@ -81,7 +80,7 @@ static void
dlopen_log(int level, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
isc_log_vwrite(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ,
isc_log_vwrite(DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ,
ISC_LOG_DEBUG(level), fmt, ap);
va_end(ap);
}
+1 -2
View File
@@ -26,13 +26,12 @@
#include <unistd.h>
#include <isc/condition.h>
#include <isc/log.h>
#include <isc/loop.h>
#include <isc/mutex.h>
#include <isc/thread.h>
#include <isc/util.h>
#include <dns/log.h>
#include <named/globals.h>
#include <named/log.h>
#include <named/server.h>
+10 -11
View File
@@ -18,7 +18,6 @@
#endif /* if defined(HAVE_GEOIP2) */
#include <isc/dir.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -40,8 +39,8 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
n = snprintf(pathbuf, sizeof(pathbuf), "%s/%s", dir, dbfile);
if (n >= sizeof(pathbuf)) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_ERROR,
"GeoIP2 database '%s/%s': path too long", dir,
dbfile);
return (NULL);
@@ -49,14 +48,14 @@ open_geoip2(const char *dir, const char *dbfile, MMDB_s *mmdb) {
ret = MMDB_open(pathbuf, MMDB_MODE_MMAP, mmdb);
if (ret == MMDB_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
"opened GeoIP2 database '%s'", pathbuf);
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_INFO, "opened GeoIP2 database '%s'",
pathbuf);
return (mmdb);
}
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_DEBUG(1),
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_DEBUG(1),
"unable to open GeoIP2 database '%s' (status %d)",
pathbuf, ret);
@@ -80,9 +79,9 @@ named_geoip_load(char *dir) {
#if defined(HAVE_GEOIP2)
REQUIRE(dir != NULL);
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
"looking for GeoIP2 databases in '%s'", dir);
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_INFO, "looking for GeoIP2 databases in '%s'",
dir);
named_g_geoip->country = open_geoip2(dir, "GeoIP2-Country.mmdb",
&geoip_country);
+11
View File
@@ -15,8 +15,19 @@
/*! \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);
+1 -4
View File
@@ -66,8 +66,5 @@ named_config_getport(const cfg_obj_t *config, const char *type,
in_port_t *portp);
isc_result_t
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
named_config_getkeyalgorithm(const char *str, unsigned int *typep,
uint16_t *digestbits);
isc_result_t
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
unsigned int *typep, uint16_t *digestbits);
+39 -37
View File
@@ -20,57 +20,59 @@
#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_STOP "stop"
#define NAMED_COMMAND_HALT "halt"
#define NAMED_COMMAND_RELOAD "reload"
#define NAMED_COMMAND_RECONFIG "reconfig"
#define NAMED_COMMAND_REFRESH "refresh"
#define NAMED_COMMAND_RETRANSFER "retransfer"
#define NAMED_COMMAND_DUMPSTATS "stats"
#define NAMED_COMMAND_QUERYLOG "querylog"
#define NAMED_COMMAND_ADDZONE "addzone"
#define NAMED_COMMAND_CLOSELOGS "closelogs"
#define NAMED_COMMAND_DELZONE "delzone"
#define NAMED_COMMAND_DNSSEC "dnssec"
#define NAMED_COMMAND_DNSTAP "dnstap"
#define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
#define NAMED_COMMAND_DUMPDB "dumpdb"
#define NAMED_COMMAND_SECROOTS "secroots"
#define NAMED_COMMAND_TRACE "trace"
#define NAMED_COMMAND_NOTRACE "notrace"
#define NAMED_COMMAND_DUMPSTATS "stats"
#define NAMED_COMMAND_FETCHLIMIT "fetchlimit"
#define NAMED_COMMAND_FLUSH "flush"
#define NAMED_COMMAND_FLUSHNAME "flushname"
#define NAMED_COMMAND_FLUSHTREE "flushtree"
#define NAMED_COMMAND_STATUS "status"
#define NAMED_COMMAND_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_RECURSING "recursing"
#define NAMED_COMMAND_NULL "null"
#define NAMED_COMMAND_NOTIFY "notify"
#define NAMED_COMMAND_VALIDATION "validation"
#define NAMED_COMMAND_SCAN "scan"
#define NAMED_COMMAND_SIGN "sign"
#define NAMED_COMMAND_HALT "halt"
#define NAMED_COMMAND_LOADKEYS "loadkeys"
#define NAMED_COMMAND_ADDZONE "addzone"
#define NAMED_COMMAND_MODZONE "modzone"
#define NAMED_COMMAND_DELZONE "delzone"
#define NAMED_COMMAND_SHOWZONE "showzone"
#define NAMED_COMMAND_SYNC "sync"
#define NAMED_COMMAND_SIGNING "signing"
#define NAMED_COMMAND_DNSSEC "dnssec"
#define NAMED_COMMAND_ZONESTATUS "zonestatus"
#define NAMED_COMMAND_NTA "nta"
#define NAMED_COMMAND_TESTGEN "testgen"
#define NAMED_COMMAND_MKEYS "managed-keys"
#define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
#define NAMED_COMMAND_DNSTAP "dnstap"
#define NAMED_COMMAND_TCPTIMEOUTS "tcp-timeouts"
#define NAMED_COMMAND_MODZONE "modzone"
#define NAMED_COMMAND_NOTIFY "notify"
#define NAMED_COMMAND_NOTRACE "notrace"
#define NAMED_COMMAND_NTA "nta"
#define NAMED_COMMAND_NULL "null"
#define NAMED_COMMAND_QUERYLOG "querylog"
#define NAMED_COMMAND_RECONFIG "reconfig"
#define NAMED_COMMAND_RECURSING "recursing"
#define NAMED_COMMAND_REFRESH "refresh"
#define NAMED_COMMAND_RELOAD "reload"
#define NAMED_COMMAND_RESPONSELOG "responselog"
#define NAMED_COMMAND_RETRANSFER "retransfer"
#define NAMED_COMMAND_SCAN "scan"
#define NAMED_COMMAND_SECROOTS "secroots"
#define NAMED_COMMAND_SERVESTALE "serve-stale"
#define NAMED_COMMAND_FETCHLIMIT "fetchlimit"
#define NAMED_COMMAND_SHOWZONE "showzone"
#define NAMED_COMMAND_SIGN "sign"
#define NAMED_COMMAND_SIGNING "signing"
#define NAMED_COMMAND_SKR "skr"
#define NAMED_COMMAND_STATUS "status"
#define NAMED_COMMAND_STOP "stop"
#define NAMED_COMMAND_SYNC "sync"
#define NAMED_COMMAND_TCPTIMEOUTS "tcp-timeouts"
#define NAMED_COMMAND_TESTGEN "testgen"
#define NAMED_COMMAND_THAW "thaw"
#define NAMED_COMMAND_TRACE "trace"
#define NAMED_COMMAND_UNFREEZE "unfreeze"
#define NAMED_COMMAND_VALIDATION "validation"
#define NAMED_COMMAND_ZONESTATUS "zonestatus"
isc_result_t
named_controls_create(named_server_t *server, named_controls_t **ctrlsp);
+7 -15
View File
@@ -26,10 +26,11 @@
#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>
@@ -49,10 +50,9 @@
EXTERN isc_mem_t *named_g_mctx INIT(NULL);
EXTERN unsigned int named_g_cpus INIT(0);
EXTERN unsigned int named_g_udpdisp INIT(0);
EXTERN isc_taskmgr_t *named_g_taskmgr INIT(NULL);
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 dns_dispatchmgr_t *named_g_dispatchmgr INIT(NULL);
EXTERN unsigned int named_g_cpus_detected INIT(1);
@@ -86,10 +86,8 @@ EXTERN named_server_t *named_g_server INIT(NULL);
/*
* Logging.
*/
EXTERN isc_log_t *named_g_lctx INIT(NULL);
EXTERN isc_logcategory_t *named_g_categories INIT(NULL);
EXTERN isc_logmodule_t *named_g_modules INIT(NULL);
EXTERN unsigned int named_g_debuglevel INIT(0);
EXTERN bool named_g_logging INIT(false);
EXTERN unsigned int named_g_debuglevel INIT(0);
/*
* Current configuration information.
@@ -97,7 +95,7 @@ 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(NAMED_SYSCONFDIR "/bind.keys");
EXTERN const char *named_g_defaultbindkeys INIT(NULL);
EXTERN const char *named_g_keyfile INIT(NAMED_SYSCONFDIR "/rndc.key");
EXTERN dns_tsigkey_t *named_g_sessionkey INIT(NULL);
@@ -113,16 +111,12 @@ EXTERN const char *named_g_chrootdir INIT(NULL);
EXTERN bool named_g_foreground INIT(false);
EXTERN bool named_g_logstderr INIT(false);
EXTERN bool named_g_nosyslog INIT(false);
EXTERN unsigned int named_g_logflags INIT(0);
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/"
@@ -134,8 +128,6 @@ EXTERN const char *named_g_defaultpidfile INIT(NAMED_LOCALSTATEDIR "/run/"
EXTERN const char *named_g_username INIT(NULL);
EXTERN const char *named_g_engine INIT(NULL);
EXTERN isc_time_t named_g_boottime;
EXTERN isc_time_t named_g_configtime;
EXTERN bool named_g_memstatistics INIT(false);
-17
View File
@@ -18,22 +18,8 @@
#include <isc/log.h>
#include <isc/types.h>
#include <dns/log.h>
#include <named/globals.h> /* Required for named_g_(categories|modules). */
/* Unused slot 0. */
#define NAMED_LOGCATEGORY_UNMATCHED (&named_g_categories[1])
/*
* Backwards compatibility.
*/
#define NAMED_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL
#define NAMED_LOGMODULE_MAIN (&named_g_modules[0])
#define NAMED_LOGMODULE_SERVER (&named_g_modules[1])
#define NAMED_LOGMODULE_CONTROL (&named_g_modules[2])
isc_result_t
named_log_init(bool safe);
/*%
@@ -79,6 +65,3 @@ named_log_setunmatchedcategory(isc_logconfig_t *lcfg);
/*%
* Set up "category unmatched" to go to the right places.
*/
void
named_log_shutdown(void);
+1 -1
View File
@@ -26,7 +26,7 @@
*/
#define NAMED_MAIN_ARGS "46A:c:Cd:D:E:fFgL:M:m:n:N:p:sS:t:T:U:u:vVx:X:"
noreturn void
ISC_NORETURN void
named_main_earlyfatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
void
+5 -8
View File
@@ -39,10 +39,13 @@ void
named_os_inituserinfo(const char *username);
void
named_os_changeuser(void);
named_os_changeuser(bool permanent);
void
named_os_restoreuser(void);
uid_t
ns_os_uid(void);
named_os_uid(void);
void
named_os_adjustnofile(void);
@@ -56,15 +59,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);
isc_result_t
named_os_gethostname(char *buf, size_t len);
void
named_os_shutdownmsg(char *command, isc_buffer_t *text);
+26 -44
View File
@@ -38,14 +38,6 @@
#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)
#define NAMED_EVENT_RUN (NAMED_EVENTCLASS + 4)
#define NAMED_EVENT_SHUTDOWN (NAMED_EVENTCLASS + 5)
/*%
* Name server state. Better here than in lots of separate global variables.
*/
@@ -55,27 +47,22 @@ 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
* */
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;
@@ -85,7 +72,6 @@ struct named_server {
isc_timer_t *tat_timer;
uint32_t interface_interval;
uint32_t heartbeat_interval;
atomic_int reload_status;
@@ -103,7 +89,7 @@ struct named_server {
named_statschannellist_t statschannels;
dns_tsigkey_t *sessionkey;
dst_key_t *sessionkey;
char *session_keyfile;
dns_name_t *session_keyname;
unsigned int session_keyalg;
@@ -114,12 +100,11 @@ 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;
isc_signal_t *sigusr1;
};
#define NAMED_SERVER_MAGIC ISC_MAGIC('S', 'V', 'E', 'R')
@@ -139,12 +124,6 @@ named_server_destroy(named_server_t **serverp);
* Destroy a server object, freeing its memory.
*/
void
named_server_shutdown(named_server_t *server);
/*%<
* Initiate the server shutdown.
*/
void
named_server_reloadwanted(void *arg, int signum);
/*%<
@@ -202,10 +181,20 @@ named_server_retransfercommand(named_server_t *server, isc_lex_t *lex,
*/
isc_result_t
named_server_togglequerylog(named_server_t *server, isc_lex_t *lex);
named_server_setortoggle(named_server_t *server, const char *optname,
unsigned int option, isc_lex_t *lex);
/*%<
* Enable/disable logging of queries. (Takes "yes" or "no" argument,
* but can also be used as a toggle for backward comptibility.)
* Enable/disable, or toggle, a server option via the command channel.
* 'option' is the option value to be changed (for example,
* NS_SERVER_LOGQUERIES or NS_SERVER_LOGRESPOSNES) and 'optname' is the
* option's human-readable name for logging purposes ("query logging"
* or "response logging").
*
* If an explicit argument to enable the option was provided
* (i.e., "on", "enable", "true", or "yes") or an explicit argument
* to disable it ("off", "disable", "false", or "no"), it will be used.
*
* If no argument is provided, the option's current state will be reversed.
*/
/*%
@@ -266,19 +255,6 @@ 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.
*/
@@ -406,3 +382,9 @@ named_server_servestale(named_server_t *server, isc_lex_t *lex,
isc_result_t
named_server_fetchlimit(named_server_t *server, isc_lex_t *lex,
isc_buffer_t **text);
/*%
* Import SKR file for offline KSK signing.
*/
isc_result_t
named_server_skr(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
+2 -1
View File
@@ -18,9 +18,10 @@
* 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_tsig_keyring_t **ringp);
isc_mem_t *mctx, dns_tsigkeyring_t **ringp);
/*%<
* Create a TSIG key ring and configure it according to the 'key'
* statements in the global and view configuration objects.
+9 -5
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_zone_t *zone,
dns_zone_t *raw);
dns_kasplist_t *kasplist, dns_keystorelist_t *keystores,
dns_zone_t *zone, dns_zone_t *raw);
/*%<
* Configure or reconfigure a zone according to the named.conf
* data.
@@ -44,7 +44,9 @@ 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);
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);
/*%<
* If 'zone' can be safely reconfigured according to the configuration
* data in 'zconfig', return true. If the configuration data is so
@@ -53,10 +55,12 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig);
*/
bool
named_zone_inlinesigning(const cfg_obj_t *zconfig);
named_zone_inlinesigning(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
const cfg_obj_t *config, dns_kasplist_t *kasplist);
/*%<
* Determine if zone uses inline-signing. This is true if inline-signing
* is set to yes.
* is set to yes, in the zone clause or in the zone's dnssec-policy clause.
* By default, dnssec-policy uses inline-signing.
*/
isc_result_t

Some files were not shown because too many files have changed in this diff Show More