Commit Graph

34200 Commits

Author SHA1 Message Date
Ondřej Surý
b68ccdc48e Revert "Run the RPZ update as offloaded work"
This reverts commit 73a0bb8588.
2022-04-06 10:31:23 +02:00
Ondřej Surý
be936a10b0 Revert "Add CHANGES and release note for [GL #3190]"
This reverts commit 639e0600f0.
2022-04-06 10:31:21 +02:00
Ondřej Surý
d346d188ae Merge branch '3249-fix-windows-sockets-v9_16' into 'v9_16'
Fix the Windows code paths modified for load balanced sockets

See merge request isc-projects/bind9!6083
2022-04-05 14:35:22 +00:00
Ondřej Surý
d836f23f79 Fix the Windows paths modified for load balanced sockets
When backporting the load balanced sockets to BIND 9.16, the Windows
specific paths were missed.  Add the #if(n)def _WIN32 back into the
appropriate places.
2022-04-05 11:53:18 +02:00
Ondřej Surý
93d61ae5d2 Merge branch '3249-add-configuration-option-to-disable-SO_REUSEPORT_LB-fix-v9_16' into 'v9_16'
Enable the load-balance-sockets configuration [v9.16]

See merge request isc-projects/bind9!6079
2022-04-05 00:35:17 +00:00
Ondřej Surý
5f27873d01 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().
2022-04-05 02:17:47 +02:00
Ondřej Surý
9159837315 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 02:17:47 +02:00
Ondřej Surý
8f16a25522 Merge branch '3249-add-configuration-option-to-disable-SO_REUSEPORT_LB-v9_16' into 'v9_16'
Add option to configure load balance sockets [v9.16]

See merge request isc-projects/bind9!6075
2022-04-04 23:52:46 +00:00
Ondřej Surý
4026c3559b Add CHANGES and release note for [GL #3249]
(cherry picked from commit 855f49cfba)
2022-04-05 01:21:50 +02:00
Ondřej Surý
8993ebc01a 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-05 01:21:50 +02:00
Ondřej Surý
cd9dd70594 Merge branch '3190-offload-rpz-updates-v9_16' into 'v9_16'
Run the RPZ update as offloaded work [v9.16]

See merge request isc-projects/bind9!6074
2022-04-04 22:53:55 +00:00
Ondřej Surý
639e0600f0 Add CHANGES and release note for [GL #3190]
(cherry picked from commit 23a4559b34)
(cherry picked from commit f3ae14d8c3)
2022-04-05 00:30:39 +02:00
Ondřej Surý
73a0bb8588 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)
(cherry picked from commit e128b6a951)
2022-04-05 00:30:39 +02:00
Ondřej Surý
635147d01a 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)
(cherry picked from commit f4cba0784e)
2022-04-05 00:30:39 +02:00
Ondřej Surý
84e62cece5 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)
(cherry picked from commit bfee462403)
2022-04-05 00:02:35 +02:00
Tony Finch
ae34c574bb Merge branch 'fanf/macos-ifconfig-v9_16' into 'v9_16'
MacOS needs more IP addresses to run the system tests (backport to 9.16)

See merge request isc-projects/bind9!6070
2022-04-04 14:29:21 +00:00
Tony Finch
3f4a63332a 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:08:45 +01:00
Mark Andrews
e9ff292be3 Merge branch '3191-issue-45178-in-oss-fuzz-bind9-dns_master_load_fuzzer-integer-overflow-in-generate-v9_16' into 'v9_16'
Prevent arithmetic overflow of 'i' in master.c:generate

See merge request isc-projects/bind9!6056
2022-04-01 22:24:11 +00:00
Evan Hunt
975a3da84e 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:47:24 +11:00
Evan Hunt
fc7ed00d70 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:46:33 +11:00
Mark Andrews
f06c446ae8 Add test case for issue-45178
(cherry picked from commit 9039aad0f8)
2022-04-01 21:42:53 +11:00
Mark Andrews
c284112bec 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:53 +11:00
Tony Finch
6cb79ead4c Merge branch '3209-notauth-subdomain-v9_16' into 'v9_16'
Log "not authoritative for update zone" more clearly (v9.16)

See merge request isc-projects/bind9!6048
2022-03-30 13:24:49 +00:00
Tony Finch
a5d65815bc 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:24:56 +01:00
Ondřej Surý
78971e9a57 Merge branch 'ondrej/cleanup-unreachable-calls-v9_16' into 'v9_16'
Consistenly use UNREACHABLE() instead of ISC_UNREACHABLE()

See merge request isc-projects/bind9!6044
2022-03-28 22:16:38 +00:00
Ondřej Surý
79b7804ce8 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:28:05 +02:00
Ondřej Surý
3512e4985a Merge branch 'ondrej/dont-use-__builtin_unreachable-on-win32-v9_16' into 'v9_16'
Add win32 __builtin_unreachable() shim

See merge request isc-projects/bind9!6039
2022-03-28 21:22:23 +00:00
Ondřej Surý
4d1d91d709 Add win32 __builtin_unreachable() shim
The backport of using modern compiler features broken Windows debug
build because there's no __builtin_unreachable() in MSVC.

Define __builtin_unreachable() shim on MSVC using __assume(0).
2022-03-28 12:57:42 +02:00
Ondřej Surý
626c17af72 Merge branch '3210-dns64-errors-v9_16' into 'v9_16'
More explicit dns64 prefix errors [v9.16]

See merge request isc-projects/bind9!6031
2022-03-25 15:48:20 +00:00
Tony Finch
b000f5a7c1 Add CHANGES note for [GL #3210]
(cherry picked from commit 132f30b623)
2022-03-25 16:09:34 +01:00
Tony Finch
aaa923845d More explicit dns64 prefix errors
Quote the dns64 prefix in error messages that complain about
problems with it, to avoid confusion with the following ACLs.

Closes #3210

(cherry picked from commit 496c02d32a)
2022-03-25 16:09:12 +01:00
Ondřej Surý
dcf562b2cf Merge branch 'ondrej/statements-following-return-break-continue-or-goto-will-never-be-executed-v9_16' into 'v9_16'
Remove UNREACHABLE() statements after exit() [v9.16]

See merge request isc-projects/bind9!6029
2022-03-25 09:20:24 +00:00
Ondřej Surý
81614b4304 Merge branch 'ondrej/use-newer-compiler-features-v9_16' into 'v9_16'
Use modern C and modern compiler features [v9.16]

See merge request isc-projects/bind9!6026
2022-03-25 09:08:58 +00:00
Ondřej Surý
888dcc6aab Remove UNREACHABLE() statements after exit()
Couple of UNREACHABLE() statements following exit() were found and
removed.

(cherry picked from commit 81fdc4a822)
2022-03-25 10:08:39 +01:00
Ondřej Surý
8b1d60933c Remove workaround for ancient clang versions (<< 3.2 and << 4.0.1)
Some ancient versions of clang reported uninitialized memory use false
positive (see https://bugs.llvm.org/show_bug.cgi?id=14461).  Since clang
4.0.1 has been long obsoleted, just remove the workarounds.

(cherry picked from commit ae508c17bc)
2022-03-25 09:37:22 +01:00
Ondřej Surý
b624be2544 Remove use of the inline keyword used as suggestion to compiler
Historically, the inline keyword was a strong suggestion to the compiler
that it should inline the function marked inline.  As compilers became
better at optimising, this functionality has receded, and using inline
as a suggestion to inline a function is obsolete.  The compiler will
happily ignore it and inline something else entirely if it finds that's
a better optimisation.

Therefore, remove all the occurences of the inline keyword with static
functions inside single compilation unit and leave the decision whether
to inline a function or not entirely on the compiler

NOTE: We keep the usage the inline keyword when the purpose is to change
the linkage behaviour.

(cherry picked from commit 20f0936cf2)
2022-03-25 09:37:18 +01:00
Ondřej Surý
75f9dd8e82 Simplify way we tag unreachable code with only ISC_UNREACHABLE()
Previously, the unreachable code paths would have to be tagged with:

    INSIST(0);
    ISC_UNREACHABLE();

There was also older parts of the code that used comment annotation:

    /* NOTREACHED */

Unify the handling of unreachable code paths to just use:

    UNREACHABLE();

The UNREACHABLE() macro now asserts when reached and also uses
__builtin_unreachable(); when such builtin is available in the compiler.

(cherry picked from commit 584f0d7a7e)
2022-03-25 09:33:51 +01:00
Ondřej Surý
673e53f81d Add FALLTHROUGH macro for __attribute__((fallthrough))
Gcc 7+ and Clang 10+ have implemented __attribute__((fallthrough)) which
is explicit version of the /* FALLTHROUGH */ comment we are currently
using.

Add and apply FALLTHROUGH macro that uses the attribute if available,
but does nothing on older compilers.

In one case (lib/dns/zone.c), using the macro revealed that we were
using the /* FALLTHROUGH */ comment in wrong place, remove that comment.

(cherry picked from commit fe7ce629f4)
2022-03-25 09:30:16 +01:00
Ondřej Surý
374fe8c70e Merge branch 'ondrej-save-tsan-files-with-txt-extension-v9_16' into 'v9_16'
Save parsed tsan files with .txt extension [v9.16]

See merge request isc-projects/bind9!6021
2022-03-25 07:20:02 +00:00
Ondřej Surý
f2a5ba0250 Save parsed tsan files with .txt extension
When the parse tsan files have text extension they can be viewed
directly in the GitLab web UI without downloading them locally.

(cherry picked from commit 80582073a5)
2022-03-23 20:31:50 +01:00
Ondřej Surý
ae9b9ca0a1 Merge branch '3201-no-vla-v9_16' into 'v9_16'
Remove a redundant variable-length array

See merge request isc-projects/bind9!6005
2022-03-18 18:12:51 +00:00
Tony Finch
afb5f59a6f Remove a redundant variable-length array
In the GSS-TSIG verification code there was an alarming
variable-length array whose size came off the network, from the
signature in the request. It turned out to be safe, because the caller
had previously checked that the signature had a reasonable size.
However, the safety checks are in the generic TSIG implementation, and
the risky VLA usage was in the GSS-specific code, and they are
separated by the DST indirection layer, so it wasn't immediately
obvious that the risky VLA was in fact safe.

In fact this risky VLA was completely unnecessary, because the GSS
signature can be verified in place without being copied to the stack,
like the message covered by the signature. The `REGION_TO_GBUFFER()`
macro backwardly assigns the region in its left argument to the GSS
buffer in its right argument; this is just a pointer and length
conversion, without copying any data. The `gss_verify_mic()` call uses
both message and signature GSS buffers in a read-only manner.
2022-03-18 17:21:57 +00:00
Ondřej Surý
865808939b Merge branch 'ondrej/remove-ATOMIC_VAR_INIT-v9_16' into 'v9_16'
Remove usage of deprecated ATOMIC_VAR_INIT() macro

See merge request isc-projects/bind9!5951
2022-03-17 21:43:13 +00:00
Ondřej Surý
2c86bd4ed9 Remove debugging implementation of stdatomic using mutexes
Upcoming LLVM/Clang 15 has marked the ATOMIC_VAR_INIT() as deprecated
breaking the build.  In the previous commit, we have removed the use of
ATOMIC_VAR_INIT(), but as that was a prerequisite to using the
--enable-mutexatomic debugging mode, we have to remove the debugging
mode.
2022-03-17 21:44:04 +01:00
Ondřej Surý
25732d818d Remove usage of deprecated ATOMIC_VAR_INIT() macro
The C17 standard deprecated ATOMIC_VAR_INIT() macro (see [1]).  Follow
the suite and remove the ATOMIC_VAR_INIT() usage in favor of simple
assignment of the value as this is what all supported stdatomic.h
implementations do anyway:

  * MacOSX.plaform: #define ATOMIC_VAR_INIT(__v) {__v}
  * Gcc stdatomic.h: #define ATOMIC_VAR_INIT(VALUE)	(VALUE)

1. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1138r0.pdf

(cherry picked from commit f251d69eba)
2022-03-17 21:44:04 +01:00
Ondřej Surý
87cd661638 Merge branch '3208-fix-xfrout-maxtimer-timer-log-message-log-level-v9_16' into 'v9_16'
Change xfer-out timer message log level to DEBUG(1)

See merge request isc-projects/bind9!5997
2022-03-17 20:41:20 +00:00
Ondřej Surý
821be88002 Change xfer-out timer message log level to DEBUG(1)
When max-transfer-*-out timeouts were reintroduced, the log message
about starting the timer was errorneously left as ISC_LOG_ERROR.
Change the log level of said message to ISC_LOG_DEBUG(1).

(cherry picked from commit 8f6e4dfa15)
2022-03-17 21:39:20 +01:00
Ondřej Surý
dfb2e611de Merge branch 'ondrej/add-missing-braces-clang-format-15-v9_16' into 'v9_16'
Add couple missing braces around single-line statements [v9.16]

See merge request isc-projects/bind9!5970
2022-03-17 19:45:06 +00:00
Ondřej Surý
be47b2e5e4 Add couple missing braces around single-line statements
The clang-format-15 has new option InsertBraces that could add missing
branches around single line statements.  Use that to our advantage
without switching to not-yet-released LLVM version to add missing braces
in couple of places.
2022-03-17 18:31:36 +01:00
Ondřej Surý
f81b183c78 Merge branch '3200-add-per-send-timer-v9_16' into 'v9_16'
Change single write timer to per-send timers [v9.16]

See merge request isc-projects/bind9!5962
2022-03-17 16:25:04 +00:00