2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00
Commit Graph

42531 Commits

Author SHA1 Message Date
Michał Kępień
dd2c509521 Account for revised log messages in test code
Adjust test code so that it expects the extended output that the
dns_message_logpacketfromto() function now emits.
2024-12-31 05:40:48 +01:00
Michał Kępień
7bdf5152d6 Adjust dns_message_logpacketfrom() log prefixes
Ensure the log prefixes passed to the dns_message_logpacketfrom()
function by its callers do not include the word "from" as the latter is
now emitted by the logfmtpacket() helper function.
2024-12-31 05:40:48 +01:00
Michał Kępień
58d38352ee Adjust dns_message_logpacketfromto() log prefixes
Ensure the log prefixes passed to the dns_message_logpacketfromto()
function by its callers do not include the words "from" or "to" as those
are now emitted by the logfmtpacket() helper function.
2024-12-31 05:40:48 +01:00
Michał Kępień
c5555a5ca2 Log both "from" and "to" socket in debug messages
Move dns_dispentry_getlocaladdress() calls around so that they are not
only invoked when dnstap support is compiled in.  This function calls
isc_nmhandle_localaddr(), which may issue a system call, but only if the
ISC_SOCKET_DETAILS preprocessor macro is set at compile time.

Pass the value extracted by dns_dispentry_getlocaladdress() to
dns_message_logpacketfromto() so that it gets logged, adding useful
information to the relevant debug messages.
2024-12-31 05:40:48 +01:00
Michał Kępień
4ab35f6839 Rename dns_message_logpacket()
Since dns_message_logpacket() only takes a single socket address as a
parameter (and it is always the sending socket's address), rename it to
dns_message_logpacketfrom() so that its name better conveys its purpose
and so that the difference in purpose between this function and
dns_message_logpacketfromto() becomes more apparent.
2024-12-31 05:40:48 +01:00
Michał Kępień
fa073a0a63 Rename dns_message_logfmtpacket()
Since dns_message_logfmtpacket() needs to be provided with both "from"
and "to" socket addresses, rename it to dns_message_logpacketfromto() so
that its name better conveys its purpose.  Clean up the code comments
for that function.
2024-12-31 05:40:48 +01:00
Michał Kępień
bafa5d3c2e Enable logging both "from" and "to" socket
Change the function prototype for dns_message_logfmtpacket() so that it
takes two isc_sockaddr_t parameters: one for the sending side and
another one for the receiving side.  This enables debug messages to be
more precise.

Also adjust the function prototype for logfmtpacket() accordingly.
Unlike dns_message_logfmtpacket(), this function must not require both
'from' and 'to' parameters to be non-NULL as it is still going to be
used by dns_message_logpacket(), which only provides a single socket
address.  Adjust its log format to handle both of these cases properly.

Adjust both dns_message_logfmtpacket() call sites accordingly, without
actually providing the second socket address yet.  (This causes the
revised REQUIRE() assertion in dns_message_logfmtpacket() to fail; the
issue will be addressed in a separate commit.)
2024-12-31 05:40:48 +01:00
Michał Kępień
05d69bd7a4 dns_message_logfmtpacket(): drop 'style' parameter
Both existing callers of the dns_message_logfmtpacket() function set the
argument passed as 'style' to &dns_master_style_comment.  To simplify
these call sites, drop the 'style' parameter from the prototype for
dns_message_logfmtpacket() and use a fixed value of
&dns_master_style_comment in the function's body instead.
2024-12-31 05:40:48 +01:00
Michał Kępień
064b2c6889 logfmtpacket(): drop useless local variables
All callers of the logfmtpacket() helper function require the argument
passed as 'address' to be non-NULL.  Meanwhile, the 'newline' and
'space' local variables in logfmtpacket() are only set to values
different than their initial values if the 'address' parameter is NULL.
Replace the 'newline' and 'space' local variables in logfmtpacket() with
fixed strings to improve code readability.
2024-12-31 05:40:48 +01:00
Michał Kępień
44d5dbeab6 new: dev: Enable extraction of exact local socket addresses
Enable extracting the exact address/port that a local wildcard/TCP socket is bound to, improving the accuracy of dnstap logging and providing more information in debug logs produced by system tests.  Since this requires issuing an extra system call on some hot paths, this new feature is only enabled when the ``ISC_SOCKET_DETAILS`` preprocessor macro is set at compile time.

Closes #4344

Merge branch '4344-enable-extraction-of-exact-local-socket-addresses' into 'main'

See merge request isc-projects/bind9!8348
2024-12-31 04:40:12 +00:00
Michał Kępień
d6f9785ac6 Enable extraction of exact local socket addresses
Extracting the exact address that each wildcard/TCP socket is bound to
locally requires issuing the getsockname() system call, which libuv
exposes via its uv_*_getsockname() functions.  This is only required for
detailed logging and comes at a noticeable performance cost, so it
should not happen by default.  However, it is useful for debugging
certain problems (e.g. cryptic system test failures), so a convenient
way of enabling that behavior should exist.

Update isc_nmhandle_localaddr() so that it calls uv_*_getsockname() when
the ISC_SOCKET_DETAILS preprocessor macro is set at compile time.
Ensure proper handling of sockets that wrap other sockets.

Set the new ISC_SOCKET_DETAILS macro by default when --enable-developer
is passed to ./configure.  This enables detailed logging in the system
tests run in GitLab CI without affecting performance in non-development
BIND 9 builds.

Note that setting the ISC_SOCKET_DETAILS preprocessor macro at compile
time enables all callers of isc_nmhandle_localaddr() to extract the
exact address of a given local socket, which results e.g. in dnstap
captures containing more accurate information.

Mention the new preprocessor macro in the section of the ARM that
discusses why exact socket addresses may not be logged by default.
2024-12-29 12:32:05 +01:00
Michał Kępień
dc90e977fc chg: nil: Improve reuse of outgoing TCP connections
This MR is a prerequisite for !8348.

It intentionally does not have a changelog entry associated with it, to
prevent making a false impression of improving connection reuse **for
existing code**.  It will only make a difference once !8348 gets merged
(and even then, only if the new `ISC_SOCKET_DETAILS` macro will be set
during build).  That's because `isc_nmhandle_localaddr()` currently
simply returns `handle->local` and its return value will only be set to
the actual address the socket is bound to with !8348 in place.

Note that `dns_dispatch_gettcp()` is currently only used by the
`dns_request` API, so this MR's potential for introducing new breakage
is relatively low.

Closes #4693

Merge branch '4693-improve-reuse-of-outgoing-tcp-connections' into 'main'

See merge request isc-projects/bind9!8972
2024-12-29 11:31:29 +00:00
Michał Kępień
086c325ad3 Improve reuse of outgoing TCP connections
The dns_dispatch_gettcp() function is used for finding an existing TCP
connection that can be reused for sending a query from a specified local
address to a specified remote address.  The logic for matching the
provided <local address, remote address> tuple to one of the existing
TCP connections is implemented in the dispatch_match() function:

  - if the examined TCP connection already has a libuv handle assigned,
    it means the connection has already been established; therefore,
    compare the provided <local address, remote address> tuple against
    the corresponding address tuple for the libuv handle associated with
    the connection,

  - if the examined TCP connection does not yet have a libuv handle
    assigned, it means the connection has not yet been established;
    therefore, compare the provided <local address, remote address>
    tuple against the corresponding address tuple that the TCP
    connection was originally created for.

This logic limits TCP connection reuse potential as the libuv handle
assigned to an existing dispatch object may have a more specific local
<address, port> tuple associated with it than the local <address, port>
tuple that the dispatch object was originally created for.  That's
because the local address for outgoing connections can be set to a
wildcard <address, port> tuple (indicating that the caller does not care
what source <address, port> tuple will be used for establishing the
connection, thereby delegating the task of picking it to the operating
system) and then get "upgraded" to a specific <address, port> tuple when
the socket is bound (and a libuv handle gets associated with it).  When
another dns_dispatch_gettcp() caller then tries to look for an existing
TCP connection to the same peer and passes a wildcard address in the
local part of the tuple, the function will not match that request to a
previously-established TCP connection (unless isc_nmhandle_localaddr()
returns a wildcard address as well).

Simplify dispatch_match() so that the libuv handle associated with an
existing dispatch object is not examined for the purpose of matching it
to the provided <local address, remote address> tuple; instead, always
examine the <local address, remote address> tuple that the dispatch
object was originally created for.  This enables reuse of TCP
connections created without providing a specific local socket address
while still preventing other connections (created for a specific local
socket address) from being inadvertently shared.
2024-12-29 10:22:20 +01:00
Artem Boldariev
6eb77ed2b0 chg: dev: Add TLS SNI extension to all outgoing TLS connections
This change ensures that SNI extension is used in outgoing connections over TLS (e.g. for DoT and DoH) when applicable.

Closes #5099

Merge branch 'artem-outgoing-tls-sni-support' into 'main'

See merge request isc-projects/bind9!9923
2024-12-26 15:57:10 +00:00
Artem Boldariev
740292d3ec BIND - enable TLS SNI support for outgoing TLS connections
This commit ensures that BIND enables TLS SNI support for outgoing DoT
connections (when possible) in order to improve compatibility with
other DNS server software.
2024-12-26 17:23:25 +02:00
Artem Boldariev
e04fb30ee6 Dig - enable TLS SNI support
This commit ensures that dig enables TLS SNI support for outgoing
connections in order to improve compatibility with other DNS server
software.
2024-12-26 17:23:19 +02:00
Artem Boldariev
6691a1530d TLS SNI - add low level support for SNI to the networking code
This commit adds support for setting SNI hostnames in outgoing
connections over TLS.

Most of the changes are related to either adapting the code to accept
and extra argument in *connect() functions and a couple of changes to
the TLS Stream to actually make use of the new SNI hostname
information.
2024-12-26 17:23:12 +02:00
Ondřej Surý
6ce55429f1 fix: dev: Use CMM_{STORE,LOAD}_SHARED to store/load glue in gluelist
ThreadSanitizer has trouble understanding that gluelist->glue is
constant after it is assigned to the slabheader with cmpxchg.  Help
ThreadSanitizer to understand the code by using CMM_STORE_SHARED and
CMM_LOAD_SHARED on gluelist->glue.

Merge branch 'ondrej/hint-tsan-in-addglue' into 'main'

See merge request isc-projects/bind9!9929
2024-12-25 15:06:09 +00:00
Ondřej Surý
f7316b44b9 Use CMM_{STORE,LOAD}_SHARED to store/load glue in gluelist
ThreadSanitizer has trouble understanding that gluelist->glue is
constant after it is assigned to the slabheader with cmpxchg.  Help
ThreadSanitizer to understand the code by using CMM_STORE_SHARED and
CMM_LOAD_SHARED on gluelist->glue.

The ThreadSanitizer report:

    WARNING: ThreadSanitizer: data race
      Read of size 8 at 0x000000000001 by thread T0001:
	#0 addglue lib/dns/qpzone.c:5304 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#1 dns_db_addglue lib/dns/db.c:1119 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#2 query_additional lib/ns/query.c:2230 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#3 query_addrrset lib/ns/query.c:2324
	#4 query_prepare_delegation_response lib/ns/query.c:8595 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#5 query_delegation lib/ns/query.c:8780 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#6 query_notfound lib/ns/query.c:8552 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#7 query_gotanswer lib/ns/query.c:7553 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#8 query_lookup lib/ns/query.c:6020 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#9 ns__query_start lib/ns/query.c:5690 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#10 query_setup lib/ns/query.c:5239 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#11 ns_query_start lib/ns/query.c:11979 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#12 ns_client_request_continue lib/ns/client.c:2466 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#13 ns_client_request lib/ns/client.c:2142 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#14 isc___nm_readcb netmgr/netmgr.c:1859 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#15 isc__nm_readcb netmgr/netmgr.c:1874
	#16 isc__nm_udp_read_cb netmgr/udp.c:589 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#17 uv__udp_recvmmsg src/unix/udp.c:202 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#18 uv__udp_recvmsg src/unix/udp.c:245 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#19 uv__udp_io src/unix/udp.c:142
	#20 uv__io_poll src/unix/linux.c:1564 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#21 uv_run src/unix/core.c:458 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#22 loop_thread lib/isc/loop.c:328 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#23 thread_body lib/isc/thread.c:85 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#24 thread_run lib/isc/thread.c:100

      Previous write of size 8 at 0x000000000001 by thread T0002:
	#0 create_gluelist lib/dns/qpzone.c:5253 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#1 addglue lib/dns/qpzone.c:5281
	#2 dns_db_addglue lib/dns/db.c:1119 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#3 query_additional lib/ns/query.c:2230 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#4 query_addrrset lib/ns/query.c:2324
	#5 query_prepare_delegation_response lib/ns/query.c:8595 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#6 query_delegation lib/ns/query.c:8780 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#7 query_notfound lib/ns/query.c:8552 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#8 query_gotanswer lib/ns/query.c:7553 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#9 query_lookup lib/ns/query.c:6020 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#10 ns__query_start lib/ns/query.c:5690 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#11 query_setup lib/ns/query.c:5239 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#12 ns_query_start lib/ns/query.c:11979 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#13 ns_client_request_continue lib/ns/client.c:2466 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#14 ns_client_request lib/ns/client.c:2142 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#15 isc___nm_readcb netmgr/netmgr.c:1859 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#16 isc__nm_readcb netmgr/netmgr.c:1874
	#17 isc__nm_udp_read_cb netmgr/udp.c:589 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#18 uv__udp_recvmmsg src/unix/udp.c:202 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#19 uv__udp_recvmsg src/unix/udp.c:245 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#20 uv__udp_io src/unix/udp.c:142
	#21 uv__io_poll src/unix/linux.c:1564 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#22 uv_run src/unix/core.c:458 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#23 loop_thread lib/isc/loop.c:328 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#24 thread_body lib/isc/thread.c:85 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#25 thread_run lib/isc/thread.c:100

      Location is heap block of size 88 at 0x000000000024 allocated by thread T0002:
	#0 malloc <null> (BuildId: c08afb1c60772d9b4e4d4be38d0c0434c5b41990)
	#1 mallocx lib/isc/jemalloc_shim.h:41 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#2 mem_get lib/isc/mem.c:303
	#3 isc__mem_get lib/isc/mem.c:654
	#4 new_gluelist lib/dns/qpzone.c:5012 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#5 create_gluelist lib/dns/qpzone.c:5241
	#6 addglue lib/dns/qpzone.c:5281
	#7 dns_db_addglue lib/dns/db.c:1119 (BuildId: 62aa74b0423f77cc56d705f02c2412b4762577cb)
	#8 query_additional lib/ns/query.c:2230 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#9 query_addrrset lib/ns/query.c:2324
	#10 query_prepare_delegation_response lib/ns/query.c:8595 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#11 query_delegation lib/ns/query.c:8780 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#12 query_notfound lib/ns/query.c:8552 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#13 query_gotanswer lib/ns/query.c:7553 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#14 query_lookup lib/ns/query.c:6020 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#15 ns__query_start lib/ns/query.c:5690 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#16 query_setup lib/ns/query.c:5239 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#17 ns_query_start lib/ns/query.c:11979 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#18 ns_client_request_continue lib/ns/client.c:2466 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#19 ns_client_request lib/ns/client.c:2142 (BuildId: 9cc0711aeddfa6164f4f6fd94b0187f7bfa13ff2)
	#20 isc___nm_readcb netmgr/netmgr.c:1859 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#21 isc__nm_readcb netmgr/netmgr.c:1874
	#22 isc__nm_udp_read_cb netmgr/udp.c:589 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#23 uv__udp_recvmmsg src/unix/udp.c:202 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#24 uv__udp_recvmsg src/unix/udp.c:245 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#25 uv__udp_io src/unix/udp.c:142
	#26 uv__io_poll src/unix/linux.c:1564 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#27 uv_run src/unix/core.c:458 (BuildId: 355edf0d38120d6761c51ee8cab2c162dff57b0a)
	#28 loop_thread lib/isc/loop.c:328 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#29 thread_body lib/isc/thread.c:85 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#30 thread_run lib/isc/thread.c:100

      Thread T0001 'isc-loop-0002' (running) created by main thread at:
	#0 pthread_create <null> (BuildId: c08afb1c60772d9b4e4d4be38d0c0434c5b41990)
	#1 isc_thread_create lib/isc/thread.c:139 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#2 isc_loopmgr_run lib/isc/loop.c:508 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#3 main bin/named/main.c:1532 (BuildId: d03d7837520674921fd1fe7c353cb790cab69b3b)

      Thread T0002 'isc-loop-0003' (running) created by main thread at:
	#0 pthread_create <null> (BuildId: c08afb1c60772d9b4e4d4be38d0c0434c5b41990)
	#1 isc_thread_create lib/isc/thread.c:139 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#2 isc_loopmgr_run lib/isc/loop.c:508 (BuildId: de1ebc9b2642ead6bbd0f4553c7144c016b01ffc)
	#3 main bin/named/main.c:1532 (BuildId: d03d7837520674921fd1fe7c353cb790cab69b3b)

    SUMMARY: ThreadSanitizer: data race lib/dns/qpzone.c:5304 in addglue
2024-12-25 15:06:01 +00:00
Ondřej Surý
1fea227ab8 chg: dev: Detect and possibly define constexpr using Autoconf
Previously, we had an ISC_CONSTEXPR macro that was expanded to either
`constexpr` or `static const`, depending on compiler support.  To make
the code cleaner, move `constexpr` support detection to Autoconf; if
`constexpr` support is missing from the compiler, define `constexpr` as
`static const` in config.h.

Merge branch 'ondrej/rename-ISC_CONSTEXPR-to-constexpr-shim' into 'main'

See merge request isc-projects/bind9!9924
2024-12-25 14:22:27 +00:00
Ondřej Surý
7b26becec0 Detect and possibly define constexpr using Autoconf
Previously, we had an ISC_CONSTEXPR macro that was expanded to either
`constexpr` or `static const`, depending on compiler support.  To make
the code cleaner, move `constexpr` support detection to Autoconf; if
`constexpr` support is missing from the compiler, define `constexpr` as
`static const` in config.h.
2024-12-25 15:21:26 +01:00
Ondřej Surý
8d9bc93e81 rem: dev: Remove C++ support from the public header
Since BIND 9 headers are not longer public, there's no reason to keep
the ISC_LANG_BEGINDECL and ISC_LANG_ENDDECL macros to support including
them from C++ projects.

Merge branch 'ondrej/remove-C++-header-support' into 'main'

See merge request isc-projects/bind9!9925
2024-12-18 16:34:37 +00:00
Ondřej Surý
06f9163d51 Remove C++ support from the public header
Since BIND 9 headers are not longer public, there's no reason to keep
the ISC_LANG_BEGINDECL and ISC_LANG_ENDDECL macros to support including
them from C++ projects.
2024-12-18 13:10:39 +01:00
Ondřej Surý
e2c1941efd fix: usr: Resolve the spurious drops in performance due GLUE cache
For performance reasons, the returned GLUE records are cached on the first use.  The current implementation could randomly cause a performance drop and increased memory use.  This has been fixed.

Closes #5064

Merge branch '5064-rewrite-glue-cache-in-qpzone' into 'main'

See merge request isc-projects/bind9!9831
2024-12-13 23:11:04 +00:00
Ondřej Surý
29bde687b5 Rewrite the GLUE cache in QP zone database
This is a second attempt to rewrite the GLUE cache to not use per
database version hash table.  Instead of keeping a hash table indexed by
the node, use a directly linked list of GLUE records for each
slabheader.  This was attempted before, but there was a data race caused
by the fact that the thread cleaning the GLUE records could be slower
than accessing the slab headers again and reinitializing the wait-free
stack.

The improved design builds on the previous design, but adds a new
dns_gluelist structure that has a pointer to the database version.

If a dns_gluelist belonging to a different (old) version is detected, it
is just detached from the slabheader and left for the closeversion() to
clean it up later.
2024-12-13 21:48:11 +01:00
Ondřej Surý
759d59801b Revert "Fix the glue table in the QP and RBT zone databases"
This reverts commit 5beae5faf9.
2024-12-13 21:48:11 +01:00
Michal Nowak
f379e1bef9 fix: test: Various coccinelle fixes
Merge branch 'mnowak/cocci-more-set-if-not-null-changes' into 'main'

See merge request isc-projects/bind9!9836
2024-12-13 13:48:20 +00:00
Michal Nowak
cf76851c75 Drop superfluous isc_mem_get() NULL check
coccinelle v1.1 trips over a superfluous isc_mem_get() NULL check in
tests/libtest/ns.c and reports the following failure in CI:

    EXN: Failure("rule starting on line 26: already tagged token:\nC code context\nFile \"./tests/libtest/ns.c\", line 350, column 1, charpos = 7939\n  around = 'if',\n  whole content = \tif (qctx != NULL) {") in ./tests/libtest/ns.c
2024-12-13 13:52:52 +01:00
Michal Nowak
7f55041426 Move coccinelle job to "sid" image
The "sid" image has newer coccinelle 1.2 that identifies more issues.
2024-12-13 13:52:52 +01:00
Michal Nowak
7fb6be62e0 Disable unsigned-int spatch in models.c and sdlz.c
coccinelle v1.1 reports the following failure:

    EXN: Failure("./lib/dns/sdlz.c: 172: try to delete an expanded token: unsigned") in ./lib/dns/sdlz.c

coccinelle v1.2 reports the following failure:

    EXN: Failure("./util/models.c: 21: try to delete an expanded token: unsigned") in ./util/models.c
2024-12-13 13:52:52 +01:00
Michal Nowak
57b64dc397 Apply more SET_IF_NOT_NULL() changes
coccinelle v1.2 found more cases where the SET_IF_NOT_NULL macro
applies.
2024-12-13 13:52:52 +01:00
Matthijs Mekking
f4377a3cd6 rem: dev: Remove DLV remnants
DLV is long gone, so we can remove design documentation around DLV, related command line options (that were already a hard failure), and some DLV related test remnants.

Merge branch 'matthijs-remove-dlv-remnants' into 'main'

See merge request isc-projects/bind9!9888
2024-12-13 11:00:54 +00:00
Matthijs Mekking
32f8f6237c Remove DLV remnants
DLV is long gone, so we can remove design documentation around DLV,
related command line options (that were already a hard failure),
and some DLV related test remnants.
2024-12-13 11:24:47 +01:00
Andoni Duarte Pintado
3fa50a98a2 Merge tag 'v9.21.3' 2024-12-13 10:53:33 +01:00
Matthijs Mekking
858ba71eaf chg: usr: The configuration clauses parental-agents and primaries are renamed to remote-servers
The top blocks 'primaries' and 'parental-agents' are no longer preferred and should be renamed to 'remote-servers'. The zone statements 'parental-agents' and 'primaries' are still used, and may refer to any 'remote-servers' top block.

Closes #4544

Merge branch '4544-primaries-block-documentation-issues' into 'main'

See merge request isc-projects/bind9!9822
2024-12-13 09:10:56 +00:00
Matthijs Mekking
726c9cd73b Rename remote-servers standard term to server-list
The 'remote-servers' named.conf reference conflicts with the standard
term from the glossary. Rename the standard term to server-list to
make the docs build.
2024-12-13 08:50:02 +01:00
Matthijs Mekking
1b2eadb197 Add primaries, parental-agents as synonyms
Add back the top blocks 'parental-agents', 'primaries', and 'masters'
to the configuration. Do not document them as so many names for the
same clause is confusing.

This has a slight negative side effect that a top block 'primaries'
can be referred to with a zone statement 'parental-agents' for example,
but that shouldn't be a big issue.
2024-12-13 08:50:02 +01:00
Matthijs Mekking
b121f02eac Unify parental-agents, primaries to remote-servers
Having zone statements that are also top blocks is confusing, and if
we want to add more in the future (which I suspect will be for
generalized notifications, multi-signer), we need to duplicate a lot
of code.

Remove top blocks 'parental-agents' and 'primaries' and just have one
top block 'remote-servers' that you can refer to with zone statements.
2024-12-13 08:50:02 +01:00
Mark Andrews
0d5b8bfd40 fix: test: Fix "checking startup notify rate limit" failure
Fix the loop terminating condition to get consistent sample sizes and increase the minimum number of samples from 20 to 40.

Closes #5091

Merge branch '5091-investigate-checking-startup-notify-rate-limit-failure' into 'main'

See merge request isc-projects/bind9!9894
2024-12-13 00:07:23 +00:00
Mark Andrews
46388d07a2 Fix startup notify rate test
The terminating conditions for the startup notify test would
occasionally get ~20 records or get +10 seconds of records due to
a bad terminating condition.  Additionally 20 samples lead to test
failures.  Fix the terminating condition to use the correct conditional
(-eq -> -ge) and increase the minimum number of log entries to
average over to 40.
2024-12-12 23:35:30 +00:00
Mark Andrews
b0eb3ca9d2 fix: test: tests/irs/resconf_test.c is missing check callbacks
Closes #5088

Merge branch '5088-tests-irs-resconf_test-c-is-missing-check-callbacks' into 'main'

See merge request isc-projects/bind9!9884
2024-12-12 22:49:50 +00:00
Mark Andrews
b711b5b10d Move resconf_test.c to tests/dns and cleanup 2024-12-12 22:16:36 +00:00
Mark Andrews
c38eb87158 Check that nameservers are parsed correctly
Add checks that the expected nameservers where actuall addes when
parsing resolv.conf.
2024-12-12 22:16:36 +00:00
Michal Nowak
1a670a4963 fix: ci: Disable tracing otherwise gcovr fails
Merge branch 'mnowak/gcovr-disable-tracing' into 'main'

See merge request isc-projects/bind9!9809
2024-12-12 14:51:52 +00:00
Michal Nowak
7048b3ab0d Disable tracing for gcovr-enabled builds
gcovr has issues with processing files produced as part of a BIND 9
build with tracing support enabled (--enable-tracing).  Depending on the
gcovr version used, these issues may result in either warnings or
failures being reported by that tool.  Disable tracing support for
gcovr-enabled builds to work around these issues.
2024-12-12 15:49:37 +01:00
Nicki Křížek
8240781cce chg: doc: Update CONTRIBUTING.md and developer docs
Include the recent changes such as:
- changes to running system tests
- gitlab development workflow
- changelog and release note process

Closes #5045

Merge branch '5045-update-contributing' into 'main'

See merge request isc-projects/bind9!9784
2024-12-12 12:45:40 +00:00
Nicki Křížek
39485c1f70 Update CONTRIBUTING.md and developer doc
Include the recent changes such as:
- changes to running system tests
- gitlab development workflow
- changelog and release note process
2024-12-12 12:45:31 +00:00
Michal Nowak
d3765a5f35 fix: test: Wait for "all zones loaded" after rndc reload in "database" test
After the rndc reload command finished, we might have queried the
database zone sooner than it was reloaded because rndc reloads zones
asynchronously if no specific zone was provided. We should wait for "all
zones loaded" in the ns1 log to be sure.

Closes #5075

Merge branch '5075-database-rndc-reload-ensure-all-zones-loaded' into 'main'

See merge request isc-projects/bind9!9829
2024-12-12 12:08:13 +00:00
Michal Nowak
0bdd03db66 Wait for "all zones loaded" after rndc reload in "database" test
After the rndc reload command finished, we might have queried the
database zone sooner than it was reloaded because rndc reloads zones
asynchronously if no specific zone was provided. We should wait for "all
zones loaded" in the ns1 log to be sure.
2024-12-12 12:07:37 +00:00
Evan Hunt
2bce06e170 rem: usr: Remove 'sortlist' option
The `sortlist` option, which was deprecated in BIND 9.20, has now been removed.

Closes #4665

Merge branch '4665-remove-sortlist' into 'main'

See merge request isc-projects/bind9!9839
2024-12-12 02:35:18 +00:00