2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

42258 Commits

Author SHA1 Message Date
Nicki Křížek
842abe9fbf Revert "Double the number of threadpool threads"
This reverts commit 6857df20a40f4e05f465a7a3f5d24eeedce8fc6c.
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šík
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šík
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 Hunt
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 Hunt
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 Hunt
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 b396f555861 and 37b9511ce1d
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 Risk
f47bc5923f Add CWE category to Internal_use_only-CVE.md template 2024-09-12 10:51:18 +02:00