Commit Graph
35775 Commits
Author SHA1 Message Date
Tony Finch 4191fd01be Ensure that dns_request_createvia() has a retry limit
There are a couple of problems with dns_request_createvia(): a UDP
retry count of zero means unlimited retries (it should mean no
retries), and the overall request timeout is not enforced. The
combination of these bugs means that requests can be retried forever.

This change alters calls to dns_request_createvia() to avoid the
infinite retry bug by providing an explicit retry count. Previously,
the calls specified infinite retries and relied on the limit implied
by the overall request timeout and the UDP timeout (which did not work
because the overall timeout is not enforced). The `udpretries`
argument is also changed to be the number of retries; previously, zero
was interpreted as infinity because of an underflow to UINT_MAX, which
appeared to be a mistake. And `mdig` is updated to match the change in
retry accounting.

The bug could be triggered by zone maintenance queries, including
NOTIFY messages, DS parental checks, refresh SOA queries and stub zone
nameserver lookups. It could also occur with `nsupdate -r 0`.
(But `mdig` had its own code to avoid the bug.)

(cherry picked from commit 71ce8b0a51)
2022-04-06 18:17:55 +01:00
Tony Finch 9bcc537882 Make notify test shellcheck clean
Use POSIX shell syntax, and use functions to reduce repetition.

(cherry picked from commit 5867c1b727)
2022-04-06 18:16:44 +01:00
Ondřej Surý 8fef3e0efd Merge branch '3249-rename-configuration-option-to-reuseport-v9_18' into 'v9_18'
Rename the configuration option to load balance sockets to reuseport [v9.18]

See merge request isc-projects/bind9!6094
2022-04-06 15:42:08 +00:00
Ondřej Surý a1f3ff0dd1 Rename the configuration option to load balance sockets to reuseport
After some back and forth, it was decidede to match the configuration
option with unbound ("so-reuseport"), PowerDNS ("reuseport") and/or
nginx ("reuseport").

(cherry picked from commit 7e71c4d0cc)
2022-04-06 17:24:13 +02:00
Ondřej Surý fd9a2fc0ba Merge branch '3190-offload-rpz-updates-revert-v9_18' into 'v9_18'
Revert "Run the RPZ update as offloaded work" [v9.18]

See merge request isc-projects/bind9!6091
2022-04-06 11:49:11 +00:00
Ondřej Surý 25bc461446 Revert "General cleanup of dns_rpz implementation"
This reverts commit bfee462403.
2022-04-06 10:42:29 +02:00
Ondřej Surý 242500909a Revert "Refactor the dns_rpz_add/delete to use local rpz copy"
This reverts commit f4cba0784e.
2022-04-06 10:42:22 +02:00
Ondřej Surý 9b78612e7d Revert "Run the RPZ update as offloaded work"
This reverts commit e128b6a951.
2022-04-06 10:30:06 +02:00
Ondřej Surý c8a0899ddd Revert "Add CHANGES and release note for [GL #3190]"
This reverts commit f3ae14d8c3.
2022-04-06 10:30:04 +02:00
Arаm Sаrgsyаn b670334e6d Merge branch '3244-dig-use-after-free-v9_18' into 'v9_18'
[v9_18] When using +qr in dig print the data of the current query

See merge request isc-projects/bind9!6085
2022-04-05 12:26:09 +00:00
Aram Sargsyan 3914408950 Add CHANGES note for [GL #3244]
(cherry picked from commit ef9bd8533a)
2022-04-05 11:54:13 +00:00
Aram Sargsyan bf9bec6f91 Fix using unset pointer when printing a debug message in dighost.c
The used `query->handle` is always `NULL` at this point.

Change the code to use `handle` instead.

(cherry picked from commit 5b2b3e589c)
2022-04-05 11:54:06 +00:00
Aram Sargsyan 927f00e15d Add a missing clear_current_lookup() call in recv_done()
The error code path handling the `ISC_R_CANCELED` code lacks a
`clear_current_lookup()` call, without which dig hangs indefinitely
when handling the error.

Add the missing call to account for all references of the lookup so
it can be destroyed.

(cherry picked from commit 2771a5b64d)
2022-04-05 11:53:52 +00:00
Aram Sargsyan 8e57030f69 When using +qr in dig print the data of the current query
In `send_udp()` and `launch_next_query()` functions, when calling
`dighost_printmessage()` to print detailed information about the
sent query, dig always prints the data of the first query in the
lookup's queries list.

The first query in the list can be already finished, having its handles
freed, and accessing this information results in assertion failure.

Print the current query's information instead.

(cherry picked from commit f831e758d1)
2022-04-05 11:53:45 +00:00
Michal Nowak b47c22677b Merge branch '3158-only-set-foundname-on-success-test-v9_18' into 'v9_18'
[v9_18] Add regression test for CVE-2022-0635

See merge request isc-projects/bind9!6082
2022-04-05 10:02:35 +00:00
Mark AndrewsandMichal Nowak 072e77dc9d Add regression test for CVE-2022-0635
(cherry picked from commit 56fbed2f0f)
2022-04-05 11:03:20 +02:00
Mark Andrews 702ab284c7 Merge branch '3220-digdelv-test-uses-address-outside-of-our-control-v9_18' into 'v9_18'
Use multiple fixed expressions for portable grep usage

See merge request isc-projects/bind9!6081
2022-04-05 05:04:18 +00:00
Mark Andrews 88265211cb Use multiple fixed expressions for portable grep usage
Additionally add "network unreachable" as an expected error message.

(cherry picked from commit 9ef4d2b583)
2022-04-05 14:34:40 +10:00
Ondřej Surý 70c8e77e36 Merge branch 'ondrej-dont-use-shutdown-function-name-v9_18' into 'v9_18'
Rename shutdown() to test_shutdown() in timer_test.c [v9.18]

See merge request isc-projects/bind9!6080
2022-04-05 00:02:04 +00:00
Ondřej Surý df91d61dc7 Rename shutdown() to test_shutdown() in timer_test.c
The shutdown() is part of standard library (POSIX-1), don't use such
name in the timer_test.c, but rather rename it to test_shutdown().

(cherry picked from commit 7868d8145b)
2022-04-05 01:56:09 +02:00
Ondřej Surý 6c7fb350d7 Merge branch '3249-add-configuration-option-to-disable-SO_REUSEPORT_LB-fix-v9_18' into 'v9_18'
Enable the load-balance-sockets configuration [v9.18]

See merge request isc-projects/bind9!6077
2022-04-04 23:54:18 +00:00
Ondřej Surý cd24556e14 Enable the load-balance-sockets configuration
Previously, HAVE_SO_REUSEPORT_LB has been defined only in the private
netmgr-int.h header file, making the configuration of load balanced
sockets inoperable.

Move the missing HAVE_SO_REUSEPORT_LB define the isc/netmgr.h and add
missing isc_nm_getloadbalancesockets() implementation.

(cherry picked from commit 142c63dda8)
2022-04-05 01:38:49 +02:00
Ondřej Surý 00d16d26b9 Merge branch '3249-add-configuration-option-to-disable-SO_REUSEPORT_LB-v9_18' into 'v9_18'
Add option to configure load balance sockets [v9.18]

See merge request isc-projects/bind9!6073
2022-04-04 22:42:26 +00:00
Ondřej Surý eef9459d87 Merge branch '3190-offload-rpz-updates-v9_18' into 'v9_18'
General cleanup of dns_rpz implementation [v9.18]

See merge request isc-projects/bind9!6072
2022-04-04 22:00:27 +00:00
Ondřej Surý 4c8e94fa71 Add CHANGES and release note for [GL #3249]
(cherry picked from commit 855f49cfba)
2022-04-05 00:00:17 +02:00
Ondřej Surý 64265f1c0e Add option to configure load balance sockets
Previously, the option to enable kernel load balancing of the sockets
was always enabled when supported by the operating system (SO_REUSEPORT
on Linux and SO_REUSEPORT_LB on FreeBSD).

It was reported that in scenarios where the networking threads are also
responsible for processing long-running tasks (like RPZ processing, CATZ
processing or large zone transfers), this could lead to intermitten
brownouts for some clients, because the thread assigned by the operating
system might be busy.  In such scenarious, the overall performance would
be better served by threads competing over the sockets because the idle
threads can pick up the incoming traffic.

Add new configuration option (`load-balance-sockets`) to allow enabling
or disabling the load balancing of the sockets.

(cherry picked from commit 85c6e797aa)
2022-04-04 23:59:59 +02:00
Ondřej Surý f3ae14d8c3 Add CHANGES and release note for [GL #3190]
(cherry picked from commit 23a4559b34)
2022-04-04 22:59:59 +02:00
Ondřej Surý e128b6a951 Run the RPZ update as offloaded work
Previously, the RPZ updates ran quantized on the main nm_worker loops.
As the quantum was set to 1024, this might lead to service
interruptions when large RPZ update was processed.

Change the RPZ update process to run as the offloaded work.  The update
and cleanup loops were refactored to do as little locking of the
maintenance lock as possible for the shortest periods of time and the db
iterator is being paused for every iteration, so we don't hold the rbtdb
tree lock for prolonged periods of time.

(cherry picked from commit f106d0ed2b)
2022-04-04 22:59:59 +02:00
Ondřej Surý f4cba0784e Refactor the dns_rpz_add/delete to use local rpz copy
Previously dns_rpz_add() were passed dns_rpz_zones_t and index to .zones
array.  Because we actually attach to dns_rpz_zone_t, we should be using
the local pointer instead of passing the index and "finding" the
dns_rpz_zone_t again.

Additionally, dns_rpz_add() and dns_rpz_delete() were used only inside
rpz.c, so make them static.

(cherry picked from commit b6e885c97f)
2022-04-04 22:59:59 +02:00
Ondřej Surý bfee462403 General cleanup of dns_rpz implementation
Do a general cleanup of lib/dns/rpz.c style:

 * Removed deprecated and unused functions
 * Unified dns_rpz_zone_t naming to rpz
 * Unified dns_rpz_zones_t naming to rpzs
 * Add and use rpz_attach() and rpz_attach_rpzs() functions
 * Shuffled variables to be more local (cppcheck cleanup)

(cherry picked from commit 840179a247)
2022-04-04 22:59:59 +02:00
Tony Finch cc1988187c Merge branch 'fanf/macos-ifconfig-v9_18' into 'v9_18'
MacOS needs more IP addresses to run the system tests (backport to 9.18)

See merge request isc-projects/bind9!6069
2022-04-04 14:24:30 +00:00
Tony Finch 541222043d MacOS needs more IP addresses to run the system tests
The launchd script only counted up to 8 whereas ifconfig.sh went all
the way up to 10, and even a bit further than that.

(cherry picked from commit 29a3e77425)
2022-04-04 15:06:31 +01:00
Arаm Sаrgsyаn 83b7563111 Merge branch '3248-dig-stuck-using-a-server-with-a-mapped-ip-address-v9_18' into 'v9_18'
[v9_18] Fix dig hanging issue in cases when the lookup's next query can't start

See merge request isc-projects/bind9!6068
2022-04-04 10:20:35 +00:00
Aram Sargsyan 5c6580b31f Add CHANGES note for [GL #3248]
(cherry picked from commit 438e9b5587)
2022-04-04 09:19:44 +00:00
Aram Sargsyan 1294de8e36 Fix dig hanging issue in cases when the lookup's next query can't start
In recv_done(), when dig decides to start the lookup's next query in
the line using `start_udp()` or `start_tcp()`, and for some reason,
no queries get started, dig doesn't cancel the lookup.

This can occur, for example, when there are two queries in the lookup,
one with a regular IP address, and another with a IPv4 mapped IPv6
address. When the regular IP address fails to serve the query, its
`recv_done()` callback starts the next query in the line (in this
case the one with a mapped IP address), but because `dig` doesn't
connect to such IP addresses, and there are no other queries in the
list, no new queries are being started, and the lookup keeps hanging.

After calling `start_udp()` or `start_tcp()` in `recv_done()`, check
if there are no pending/working queries then cancel the lookup instead
of only detaching from the current query.

(cherry picked from commit 7e2f50c369)
2022-04-04 09:18:46 +00:00
Evan Hunt 2c4e7c1702 Merge branch '3250-resolver-test-non-querytrace-v9_18' into 'v9_18'
fix resolver test when built without --enable-querytrace

See merge request isc-projects/bind9!6065
2022-04-01 17:30:01 +00:00
Evan Hunt a18c824f6a fix resolver test when built without --enable-querytrace
a test case in the 'resolver' system test was reliant on
logged output that would only be present when query tracing
was enabled, as in developer builds. that test case is now
disabled when query tracing is not available. Thanks to
Anton Castelli.

(cherry picked from commit 5319d8adea)
2022-04-01 10:17:00 -07:00
Arаm Sаrgsyаn 71201fa71e Merge branch '3145-dig-+nssearch-does-not-exit-until-interrupted-v9_18' into 'v9_18'
[v9_18] Fix "dig +nssearch" indefinitely hanging issue

See merge request isc-projects/bind9!6057
2022-04-01 12:25:54 +00:00
Aram Sargsyan cfdf95d437 Synchronze udp_ready() and tcp_connected() functions entry behavior
The `udp_ready()` and `tcp_connected()` functions in dighost.c are
used for similar purposes for UDP and TCP respectively.

Synchronize the `udp_ready()` function entry code to behave like
`tcp_connected()` by adding input validation, debug messages and
early exit code when `cancel_now` is `true`.

(cherry picked from commit 4477f71868)
2022-04-01 11:53:47 +00:00
Aram Sargsyan 09e9aabb11 Add CHANGES note for [GL #3145]
(cherry picked from commit 3a5793ece2)
2022-04-01 11:53:40 +00:00
Aram Sargsyan 16bdced2ca Fix "dig +nssearch" indefinitely hanging issue
When finishing the NSSEARCH task and there is no more followup
lookups to start, dig does not destroy the last lookup, which
causes it to hang indefinitely.

Rename the unused `first_pass` member of `dig_query_t` to `started`
and make it `true` in the first callback after `start_udp()` or
`start_tcp()` of the query to indicate that the query has been
started.

Create a new `check_if_queries_done()` function to check whether
all of the queries inside a lookup have been started and finished,
or canceled.

Use the mentioned function in the TRACE code block in `recv_done()`
to check whether the current query is the last one in the lookup and
cancel the lookup in that case to free the resources.

(cherry picked from commit 7d360bd05e)
2022-04-01 11:53:33 +00:00
Mark Andrews 49320f73df Merge branch '3191-issue-45178-in-oss-fuzz-bind9-dns_master_load_fuzzer-integer-overflow-in-generate-v9_18' into 'v9_18'
Prevent arithmetic overflow of 'i' in master.c:generate

See merge request isc-projects/bind9!6055
2022-04-01 11:01:42 +00:00
Evan HuntandMark Andrews 953f62c1e7 add a system test for $GENERATE with an integer overflow
the line "$GENERATE 19-28/2147483645 $ CNAME x" should generate
a single CNAME with the owner "19.example.com", but prior to the
overflow bug it generated several CNAMEs, half of them with large
negative values.

we now test for the bugfix by using "named-checkzone -D" and
grepping for a single CNAME in the output.

(cherry picked from commit bd814b79d4)
2022-04-01 21:42:35 +11:00
Evan HuntandMark Andrews 8ac8197f0d update shell syntax
clean up the shell syntax in the checkzone test prior to adding
a new test.

(cherry picked from commit 2261c853b5)
2022-04-01 21:42:35 +11:00
Mark Andrews 3a3219fd3f Add test case for issue-45178
(cherry picked from commit 9039aad0f8)
2022-04-01 21:42:35 +11:00
Mark Andrews 1eff9bbf37 Prevent arithmetic overflow of 'i' in master.c:generate
the value of 'i' in generate could overflow when adding 'step' to
it in the 'for' loop.  Use an unsigned int for 'i' which will give
an additional bit and prevent the overflow.  The inputs are both
less than 2^31 and and the result will be less than 2^32-1.

(cherry picked from commit 5abdee9004)
2022-04-01 21:42:35 +11:00
Tony Finch 05224c32a7 Merge branch '3209-notauth-subdomain-v9_18' into 'v9_18'
Log "not authoritative for update zone" more clearly (v9.18)

See merge request isc-projects/bind9!6047
2022-03-30 13:20:58 +00:00
Tony Finch ec54de9e47 Log "not authoritative for update zone" more clearly
Ensure the update zone name is mentioned in the NOTAUTH error message
in the server log, so that it is easier to track down problematic
update clients. There are two cases: either the update zone is
unrelated to any of the server's zones (previously no zone was
mentioned); or the update zone is a subdomain of one or more of the
server's zones (previously the name of the irrelevant parent zone was
misleadingly logged).

Closes #3209

(cherry picked from commit 84c4eb02e7)
2022-03-30 13:19:46 +01:00
Ondřej Surý d45abcbd2f Merge branch 'ondrej/cleanup-unreachable-calls-v9_18' into 'v9_18'
Consistenly use UNREACHABLE() instead of ISC_UNREACHABLE()

See merge request isc-projects/bind9!6043
2022-03-28 21:56:42 +00:00
Ondřej Surý fc500b96eb Consistenly use UNREACHABLE() instead of ISC_UNREACHABLE()
In couple places, we have missed INSIST(0) or ISC_UNREACHABLE()
replacement on some branches with UNREACHABLE().  Replace all
ISC_UNREACHABLE() or INSIST(0) calls with UNREACHABLE().
2022-03-28 23:27:33 +02:00