]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agoEnsure test interpreters are defined before common config
Tom Krizek [Mon, 7 Nov 2022 15:38:49 +0000 (16:38 +0100)] 
Ensure test interpreters are defined before common config

Nothing from conf.sh.common is required to set these values. On the
contrary, a Python interpreter needs to be set in order to randomize the
algorithm set (which happens in conf.sh.common).

3 years agoForce quiet mode when using testcrypto.sh directly
Tom Krizek [Mon, 7 Nov 2022 14:58:40 +0000 (15:58 +0100)] 
Force quiet mode when using testcrypto.sh directly

When testcrypto.sh is used as a standalone script, always use quiet mode
to avoid using undefined commands (such as echo_i) which require
inclusion of the entire conf.sh machinery.

3 years agoMerge branch 'artem-stream-dns' into 'main'
Artem Boldariev [Tue, 20 Dec 2022 20:59:50 +0000 (20:59 +0000)] 
Merge branch 'artem-stream-dns' into 'main'

StreamDNS - unified transport for DNS over TLS and DNS over TCP (and possibly more)

Closes #3374

See merge request isc-projects/bind9!6707

3 years agoConvert Stream DNS to use isc_buffer API
Ondřej Surý [Fri, 16 Dec 2022 12:01:18 +0000 (13:01 +0100)] 
Convert Stream DNS to use isc_buffer API

Drop the whole isc_dnsbuffer API and use new improved isc_buffer API
that provides same functionality as the isc_dnsbuffer unit now.

3 years agoModify release notes [GL #3374]
Artem Boldariev [Wed, 23 Nov 2022 13:44:33 +0000 (15:44 +0200)] 
Modify release notes [GL #3374]

Mention that DNS over TCP and DNS over TLS transports are superseded.

3 years agoModify CHANGES [GL #3374]
Artem Boldariev [Wed, 23 Nov 2022 13:41:21 +0000 (15:41 +0200)] 
Modify CHANGES [GL #3374]

Mention that DNS over TCP and DNS over TLS transports are superseded.

3 years agoModify AUTHORS
Artem Boldariev [Tue, 29 Nov 2022 11:03:56 +0000 (13:03 +0200)] 
Modify AUTHORS

Add "Artem Boldariev" to the list of BIND9 authors.

3 years agoStreamDNS: Use isc__nm_senddns() to send DNS messages
Artem Boldariev [Wed, 7 Dec 2022 12:32:20 +0000 (14:32 +0200)] 
StreamDNS: Use isc__nm_senddns() to send DNS messages

This commit modifies the Stream DNS message so that it uses the
optimised code path (isc__nm_senddns()) for sending DNS messages over
the underlying transport. This way we avoid allocating any
intermediate memory buffers needed to render a DNS message with its
length pre-pended ahead of the contents (TCP DNS message format).

3 years agoTLS: isc__nm_senddns() support
Artem Boldariev [Wed, 7 Dec 2022 12:18:33 +0000 (14:18 +0200)] 
TLS: isc__nm_senddns() support

This commit adds support for isc_nm_senddns() to the generic TLS code.

3 years agoAdd isc__nm_senddns()
Artem Boldariev [Wed, 7 Dec 2022 11:33:52 +0000 (13:33 +0200)] 
Add isc__nm_senddns()

The new internal function works in the same way as isc_nm_send()
except that it sends a DNS message size ahead of the DNS message
data (the format used in DNS over TCP).

The intention is to provide a fast path for sending DNS messages over
streams protocols - that is, without allocating any intermediate
memory buffers.

3 years agoTLS: try to avoid allocating send request objects
Artem Boldariev [Mon, 5 Dec 2022 18:19:03 +0000 (20:19 +0200)] 
TLS: try to avoid allocating send request objects

This commit optimises TLS send request object allocation to enable
send request object reuse, somewhat reducing pressure on the memory
manager. It is especially helpful in the case when Stream DNS uses the
TLS implementation as the transport.

3 years agoRemove TLS DNS transport (and parts common with TCP DNS)
Artem Boldariev [Tue, 22 Nov 2022 19:03:02 +0000 (21:03 +0200)] 
Remove TLS DNS transport (and parts common with TCP DNS)

This commit removes TLS DNS transport superseded by Stream DNS.

3 years agoRemove TCP DNS transport
Artem Boldariev [Tue, 22 Nov 2022 18:43:05 +0000 (20:43 +0200)] 
Remove TCP DNS transport

This commit removes TCP DNS transport superseded by Stream DNS.

3 years agoMake dispatch unit tests use Stream DNS
Artem Boldariev [Fri, 7 Oct 2022 19:23:06 +0000 (22:23 +0300)] 
Make dispatch unit tests use Stream DNS

This commit replaces usage of TCP DNS and TLS DNS in the dispatch unit
tests with Stream DNS transport.

3 years agoMake isc_nm_tlssocket unit tests available in non DoH-enabled builds
Artem Boldariev [Tue, 23 Aug 2022 19:15:54 +0000 (22:15 +0300)] 
Make isc_nm_tlssocket unit tests available in non DoH-enabled builds

This commit ensures that generic TLS unit tests are available in non
DoH-enabled builds, as isc_nm_tlssocket is not tied exclusively to the
DoH implementation anymore.

3 years agoMake isc_nm_tlssocket non-optional
Artem Boldariev [Tue, 18 Oct 2022 12:36:00 +0000 (15:36 +0300)] 
Make isc_nm_tlssocket non-optional

This commit unties generic TLS code (isc_nm_tlssocket) from DoH, so
that it will be available regardless of the fact if BIND was built
with DNS over HTTP support or not.

3 years agoDoH: use isc_nmhandle_set_tcp_nodelay()
Artem Boldariev [Thu, 25 Aug 2022 19:44:59 +0000 (22:44 +0300)] 
DoH: use isc_nmhandle_set_tcp_nodelay()

This commit replaces ad-hoc code for disabling Nagle's algorithm with
a call to isc_nmhandle_set_tcp_nodelay().

3 years agoStreamDNS: opportunistically disable Nagle's algorithm
Artem Boldariev [Thu, 27 Oct 2022 18:14:35 +0000 (21:14 +0300)] 
StreamDNS: opportunistically disable Nagle's algorithm

This commit ensures that Stream DNS code attempts to disable Nagle's
algorithm regardless of underlying stream transport (TCP or TLS), as
we are not interested in trading latency for throughout when dealing
with DNS messages.

3 years agoDisable Nagle's algorithm for TLS connections by default
Artem Boldariev [Thu, 25 Aug 2022 19:37:26 +0000 (22:37 +0300)] 
Disable Nagle's algorithm for TLS connections by default

This commit ensures that Nagle's algorithm is disabled by default for
TLS connections on best effort basis, just like other networking
software (e.g. NGINX) does, as, in the case of TLS, we are not
interested in trading latency for throughput, rather vice versa.

We attempt to disable it as early as we can, right after TCP
connections establishment, as an attempt to speed up handshake
handling.

3 years agoTCP: make it possible to set Nagle's algorithms state via handle
Artem Boldariev [Thu, 25 Aug 2022 19:18:15 +0000 (22:18 +0300)] 
TCP: make it possible to set Nagle's algorithms state via handle

This commit adds ability to turn the Nagle's algorithm on or off via
connections handle. It adds the isc_nmhandle_set_tcp_nodelay()
function as the public interface for this functionality.

3 years agoExtend isc__nm_socket_tcp_nodelay() to accept value
Artem Boldariev [Thu, 25 Aug 2022 18:59:23 +0000 (21:59 +0300)] 
Extend isc__nm_socket_tcp_nodelay() to accept value

This makes it possible to both enable and disable Nagle's algorithm
for a TCP socket descriptor, before the change it was possible only to
disable it.

3 years agoBIND: use Stream DNS for DNS over TCP connections
Artem Boldariev [Fri, 5 Aug 2022 16:43:34 +0000 (19:43 +0300)] 
BIND: use Stream DNS for DNS over TCP connections

This commit makes BIND use the new Stream DNS transport for DNS over
TCP.

3 years agoBIND: use Stream DNS for DNS over TLS connections
Artem Boldariev [Tue, 29 Nov 2022 16:15:54 +0000 (18:15 +0200)] 
BIND: use Stream DNS for DNS over TLS connections

This commit makes BIND use the new Stream DNS transport for DNS over
TLS.

3 years agoUse Stream DNS in dig for DNS over TCP
Artem Boldariev [Tue, 23 Aug 2022 16:18:31 +0000 (19:18 +0300)] 
Use Stream DNS in dig for DNS over TCP

This commit makes dig use the new Stream DNS transport for DNS over
TCP.

3 years agoUse Stream DNS in dig for DNS over TLS
Artem Boldariev [Tue, 12 Jul 2022 20:08:07 +0000 (23:08 +0300)] 
Use Stream DNS in dig for DNS over TLS

This commit makes dig use the new Stream DNS transport for DNS over
TLS.

3 years agoRe-purpose TLS DNS and TCP DNS unit tests for Stream DNS
Artem Boldariev [Tue, 8 Nov 2022 14:43:01 +0000 (16:43 +0200)] 
Re-purpose TLS DNS and TCP DNS unit tests for Stream DNS

This commit modifies the existing unit tests for TLS DNS and TCP DNS
in such a way that the new Stream DNS transport is used as it is
intended to be a drop-in replacement for these two transports.

3 years agoAdd isc_nm_streamdnssocket (aka Stream DNS)
Artem Boldariev [Mon, 20 Jun 2022 17:30:12 +0000 (20:30 +0300)] 
Add isc_nm_streamdnssocket (aka Stream DNS)

This commit adds an initial implementation of isc_nm_streamdnssocket
transport: a unified transport for DNS over stream protocols messages,
which is capable of replacing both TCP DNS and TLS DNS
transports. Currently, the interface it provides is a unified set of
interfaces provided by both of the transports it attempts to replace.

The transport is built around "isc_dnsbuffer_t" and
"isc_dnsstream_assembler_t" objects and attempts to minimise both the
number of memory allocations during network transfers as well as
memory usage.

3 years agoAdd a set of unit tests for dnsbuffer_t and dnsstream_assembler_t
Artem Boldariev [Thu, 2 Jun 2022 11:19:12 +0000 (14:19 +0300)] 
Add a set of unit tests for dnsbuffer_t and dnsstream_assembler_t

This commit adds a set of unit tests for isc_dnsbuffer_t and
isc_dnsstream_assembler_t which help to verify that they work as
expected.

3 years agoAdd isc_dnsstream_assembler_t implementation
Artem Boldariev [Mon, 13 Jun 2022 16:20:08 +0000 (19:20 +0300)] 
Add isc_dnsstream_assembler_t implementation

This commit adds the implementation for an "isc_dnsstream_assembler_t"
object. The object is built on top of "isc_dnsbuffer_t" and is
intended to encapsulate the state machine used for handling DNS
messages received in the format used for messages transmitted over
TCP.

The idea is that the object accepts the input data received from a
socket, tries to assemble DNS messages from the incoming data and
calls the callback which contains the status of the incoming data as
well as a pointer to the memory region referencing the data of the
assembled message. It is capable of assembling DNS messages no matter
how torn apart they are when sent over network.

The following statuses might be passed to the callback:

* ISC_R_SUCCESS - a message has been successfully assembled;
* ISC_R_NOMORE  - not enough data has been processed to assemble a
message;
* ISC_R_RANGE - there was an attempt to process a zero-sized DNS
message (someone attempts to send us junk data).

One could say that the object replaces the implementation of
"isc__nm_*_processbuffer()" functions used by the old TCP DNS and TLS
DNS transports with a better defined state machine completely
decoupled from the networking code itself.

Such a design makes it trivial to write unit tests for it, leading to
better verification of its correctness.

Another important difference is directly related to the fact that it
is built on top of "isc_dnsbuffer_t", which tries to manage memory in
a smart way. In particular:

* It tries to use a static buffer for smaller messages, reducing
pressure on the memory manager (hot path);
* When allocating dynamic memory for larger messages, it tries to
allocate memory conservatively (generic path).

These characteristics is a significant upgrade over the older logic
where a 64KB(+2 bytes) buffer was allocated from dynamic memory
regardless of the fact if we need a buffer this large or not. That is,
lesser memory usage is expected in a generic case for DNS transports
built on top of "isc_dnsstream_assembler_t."

3 years agoAdd isc_dnsbuffer_t implementation
Artem Boldariev [Tue, 7 Jun 2022 10:14:29 +0000 (13:14 +0300)] 
Add isc_dnsbuffer_t implementation

This commit adds "isc_dnsbuffer_t" object implementation, a thin
wrapper on top of "isc_buffer_t" which has the following
characteristics:

* provides interface specifically atuned for handling/generating DNS
messages, especially in the format used for DNS messages over TCP;
* avoids allocating dynamic memory when handling small DNS messages,
while transparently switching to using dynamic memory when handling
larger messages. This approach significantly reduces pressure on the
memory allocator, as most of the DNS messages are small.

3 years agoTLS: add an internal function isc__nmhandle_get_selected_alpn()
Artem Boldariev [Wed, 3 Aug 2022 11:46:33 +0000 (14:46 +0300)] 
TLS: add an internal function isc__nmhandle_get_selected_alpn()

The added function provides the interface for getting an ALPN tag
negotiated during TLS connection establishment.

The new function can be used by higher level transports.

3 years agoTLS: add manual read timer control mode
Artem Boldariev [Thu, 20 Oct 2022 12:40:51 +0000 (15:40 +0300)] 
TLS: add manual read timer control mode

This commit adds manual read timer control mode, similarly to TCP.
This way the read timer can be controlled manually using:

* isc__nmsocket_timer_start();
* isc__nmsocket_timer_stop();
* isc__nmsocket_timer_restart().

The change is required to make it possible to implement more
sophisticated read timer control policies in DNS transports, built on
top of TLS.

3 years agoTCP: add manual read timer control mode
Artem Boldariev [Tue, 18 Oct 2022 12:21:10 +0000 (15:21 +0300)] 
TCP: add manual read timer control mode

This commit adds a manual read timer control mode to the TCP
code (adding isc__nmhandle_set_manual_timer() as the interface to it).

Manual read timer control mode suppresses read timer restarting the
read timer when receiving any amount of data. This way the read timer
can be controlled manually using:

* isc__nmsocket_timer_start();
* isc__nmsocket_timer_stop();
* isc__nmsocket_timer_restart().

The change is required to make it possible to implement more
sophisticated read timer control policies in DNS transports, built on
top of TCP.

3 years agoTLS: expose the ability to (re)start and stop underlying read timer
Artem Boldariev [Wed, 27 Jul 2022 13:26:55 +0000 (16:26 +0300)] 
TLS: expose the ability to (re)start and stop underlying read timer

This commit adds implementation of isc__nmsocket_timer_restart() and
isc__nmsocket_timer_stop() for generic TLS code in order to make its
interface more compatible with that of TCP.

3 years agoTLS: add isc__nmsocket_timer_running() support
Artem Boldariev [Tue, 26 Jul 2022 14:36:32 +0000 (17:36 +0300)] 
TLS: add isc__nmsocket_timer_running() support

This commit adds isc__nmsocket_timer_running() support to the generic
TLS code in order to make it more compatible with TCP.

3 years agoTLS: isc_nm_bad_request() and isc__nmsocket_reset() support
Artem Boldariev [Tue, 26 Jul 2022 14:07:19 +0000 (17:07 +0300)] 
TLS: isc_nm_bad_request() and isc__nmsocket_reset() support

This commit adds implementations of isc_nm_bad_request() and
isc__nmsocket_reset() to the generic TLS stream code in order to make
it more compatible with TCP code.

3 years agoMerge branch 'ondrej-refactor-isc_buffer-for-dnsstream' into 'main'
Ondřej Surý [Tue, 20 Dec 2022 19:22:12 +0000 (19:22 +0000)] 
Merge branch 'ondrej-refactor-isc_buffer-for-dnsstream' into 'main'

Change the isc_buffer_reserve() to take just buffer pointer

See merge request isc-projects/bind9!7235

3 years agoUse 'restrict' and 'const' for 'isc_buffer_t'
Artem Boldariev [Tue, 20 Dec 2022 18:56:22 +0000 (20:56 +0200)] 
Use 'restrict' and 'const' for 'isc_buffer_t'

The purpose of this commit is to aid compiler in generating better
code when working with `isc_buffer_t` objects by using restricted
pointers (and, to a lesser extent, 'const' modifier for read-only
arguments).

This way we, basically, instruct the compiler that the members of
structured passed by pointers into the functions can be treated as
local variables in the scope of a function. That should reduce the
number of load/store operations emitted by compilers when accessing
objects (e.g. 'isc_buffer_t') via pointers.

3 years agoAdd isc_buffer_trycompact() function needed for StreamDNS
Ondřej Surý [Fri, 16 Dec 2022 10:43:20 +0000 (11:43 +0100)] 
Add isc_buffer_trycompact() function needed for StreamDNS

Add isc_buffer_trycompact() that's an optimization; it will compact the
buffer only when the remaining length is smaller than used length.

3 years agoAdd isc_buffer_setmctx() and isc_buffer_clearmctx() function
Ondřej Surý [Fri, 16 Dec 2022 10:43:20 +0000 (11:43 +0100)] 
Add isc_buffer_setmctx() and isc_buffer_clearmctx() function

Add two extra functions needed by StreamDNS:

1. isc_buffer_setmctx() sets the buffer internal memory context, so we
   can use isc_buffer_reserve() on the buffer.  For this, we also need
   to track whether the .base was dynamically allocated or not.  This
   needs to be called after isc_buffer_init() and before first
   isc_buffer_reserve() call.

2. isc_buffer_clearmctx() clears the buffer internal memory context, and
   frees any dynamically allocated buffer.  This needs to be called
   after the last isc_buffer_reserve() call and before calling the
   isc_buffer_invalidate()

3 years agoMake the isc_buffer unit header-only
Ondřej Surý [Fri, 16 Dec 2022 10:17:25 +0000 (11:17 +0100)] 
Make the isc_buffer unit header-only

The isc_buffer is often used in the hot-path, so make it header-only
implementation.

3 years agoCleanup the isc_buffer_reserve() usage in put*() helpers
Ondřej Surý [Fri, 16 Dec 2022 10:11:59 +0000 (11:11 +0100)] 
Cleanup the isc_buffer_reserve() usage in put*() helpers

There are couple places where we use putstr(), putmem(), ... helpers
that tries to reserve space and only if successful puts the data onto
the buffer.  Cleanup the double reference as it's not needed there.

3 years agoAdd a static pre-allocated buffer to isc_buffer_t
Ondřej Surý [Thu, 15 Dec 2022 21:51:52 +0000 (22:51 +0100)] 
Add a static pre-allocated buffer to isc_buffer_t

When the buffer is allocated via isc_buffer_allocate() and the size is
smaller or equal ISC_BUFFER_STATIC_SIZE (currently 512 bytes), the
buffer will be allocated as a flexible array member in the buffer
structure itself instead of allocating it on the heap.  This should help
when the buffer is used on the hot-path with small allocations.

3 years agoEnable auto-reallocation for all isc_buffer_allocate() buffers
Ondřej Surý [Thu, 15 Dec 2022 21:27:12 +0000 (22:27 +0100)] 
Enable auto-reallocation for all isc_buffer_allocate() buffers

When isc_buffer_t buffer is created with isc_buffer_allocate() assume
that we want it to always auto-reallocate instead of having an extra
call to enable auto-reallocation.

3 years agoRemove single use isc_buffer_putdecint() function
Ondřej Surý [Thu, 15 Dec 2022 21:15:37 +0000 (22:15 +0100)] 
Remove single use isc_buffer_putdecint() function

The isc_buffer_putdecint() could be easily replaced with
isc_buffer_printf() with just a small overhead of calling vsnprintf()
twice instead once.  This is not on a hot-path (dns_catz unit), so we
can ignore the overhead and instead have less single-use code in favor
of using reusable more generic function.

3 years agoRefactor the isc_buffer_{get,put}uintN, add isc_buffer_peekuintN
Ondřej Surý [Thu, 15 Dec 2022 11:38:31 +0000 (12:38 +0100)] 
Refactor the isc_buffer_{get,put}uintN, add isc_buffer_peekuintN

The Stream DNS implementation needs a peek methods that read the value
from the buffer, but it doesn't advance the current position.  Add
isc_buffer_peekuintX methods, refactor the isc_buffer_{get,put}uintN
methods to modern integer types, and move the isc_buffer_getuintN to the
header as static inline functions.

3 years agoMove and extend the uint8_t low-endian to uint{32,64}t to endian.h
Ondřej Surý [Thu, 15 Dec 2022 11:58:31 +0000 (12:58 +0100)] 
Move and extend the uint8_t low-endian to uint{32,64}t to endian.h

Move the U8TO{32,64}_LE and U{32,64}TO8_LE macros to endian.h and extend
the macros for 16-bit and Big-Endian variants.

Use the macros both in isc_siphash (LE) and isc_buffer (BE) units.

3 years agoChange the isc_buffer_reserve() to take just buffer pointer
Ondřej Surý [Thu, 15 Dec 2022 10:54:51 +0000 (11:54 +0100)] 
Change the isc_buffer_reserve() to take just buffer pointer

The isc_buffer_reserve() would be passed a reference to the buffer
pointer, which was unnecessary as the pointer would never be changed
in the current implementation.  Remove the extra dereference.

3 years agoMerge branch '3178-dispatch-race' into 'main'
Ondřej Surý [Mon, 19 Dec 2022 12:07:12 +0000 (12:07 +0000)] 
Merge branch '3178-dispatch-race' into 'main'

Fix the thread safety in the dns_dispatch unit

Closes #3178

See merge request isc-projects/bind9!7025

3 years agoAdd CHANGES and release note for [GL #3178] and [GL #3636]
Ondřej Surý [Wed, 30 Nov 2022 17:48:06 +0000 (18:48 +0100)] 
Add CHANGES and release note for [GL #3178] and [GL #3636]

3 years agoFix the thread safety in the dns_dispatch unit
Ondřej Surý [Wed, 30 Nov 2022 16:58:35 +0000 (17:58 +0100)] 
Fix the thread safety in the dns_dispatch unit

The dispatches are not thread-bound, and used freely between various
threads (see the dns_resolver and dns_request units for details).

This refactoring make sure that all non-const dns_dispatch_t and
dns_dispentry_t members are accessed under a lock, and both object now
track their internal state (NONE, CONNECTING, CONNECTED, CANCELED)
instead of guessing the state from the state of various struct members.

During the refactoring, the artificial limit DNS_DISPATCH_SOCKSQUOTA on
UDP sockets per dispatch was removed as the limiting needs to happen and
happens on in dns_resolver and limiting the number of UDP sockets
artificially in dispatch could lead to unpredictable behaviour in case
one dispatch has the limit exhausted by others are idle.

The TCP artificial limit of DNS_DISPATCH_MAXREQUESTS makes even less
sense as the TCP connections are only reused in the dns_request API
that's not a heavy user of the outgoing connections.

As a side note, the fact that UDP and TCP dispatch pretends to be same
thing, but in fact the connected UDP is handled from dns_dispentry_t and
dns_dispatch_t acts as a broker, but connected TCP is handled from
dns_dispatch_t and dns_dispatchmgr_t acts as a broker doesn't really
help the clarity of this unit.

This refactoring kept to API almost same - only dns_dispatch_cancel()
and dns_dispatch_done() were merged into dns_dispatch_done() as we need
to cancel active netmgr handles in any case to not leave dangling
connections around.  The functions handling UDP and TCP have been mostly
split to their matching counterparts and the dns_dispatch_<function>
functions are now thing wrappers that call <udp|tcp>_dispatch_<function>
based on the socket type.

More debugging-level logging was added to the unit to accomodate for
this fact.

3 years agoMerge branch '3712-fix-reference-counting-in-dns_adb-get_attached_entry-v2' into...
Ondřej Surý [Fri, 16 Dec 2022 20:49:49 +0000 (20:49 +0000)] 
Merge branch '3712-fix-reference-counting-in-dns_adb-get_attached_entry-v2' into 'main'

Fix reference counting in get_attached_entry (again)

Closes #3712

See merge request isc-projects/bind9!7250

3 years agoFix reference counting in get_attached_entry (again)
Ondřej Surý [Fri, 16 Dec 2022 20:46:50 +0000 (21:46 +0100)] 
Fix reference counting in get_attached_entry (again)

When get_attached_entry() encounters entry that would be expired, it
needs to get reference to the entry before calling maybe_expire_entry(),
so the ADB entry doesn't get destroyed inside the its own lock.

This creeped into the code base again during review, so I am adding
an extra comment to prevent this.

3 years agoMerge branch 'tkrizek/danger-backports' into 'main'
Tom Krizek [Fri, 16 Dec 2022 13:18:01 +0000 (13:18 +0000)] 
Merge branch 'tkrizek/danger-backports' into 'main'

Check backport workflow in danger CI

See merge request isc-projects/bind9!7243

3 years agodanger: remove obsolete check for cherry pick msg
Tom Krizek [Thu, 15 Dec 2022 16:55:54 +0000 (17:55 +0100)] 
danger: remove obsolete check for cherry pick msg

With proper backport commit detection, this check has been made
redundant.

3 years agodanger: check backport commits for original commit IDs
Tom Krizek [Thu, 15 Dec 2022 16:52:52 +0000 (17:52 +0100)] 
danger: check backport commits for original commit IDs

A full backport must have all the commit from the original MR and the
original commit IDs must be referenced in the backport commit messages.

If the criteria above is not met, the MR should be marked as a partial
backport. In that case, any discrepencies are only logged as informative
messages rather than failures.

3 years agodanger: check that original MR has been merged
Tom Krizek [Thu, 15 Dec 2022 16:51:24 +0000 (17:51 +0100)] 
danger: check that original MR has been merged

When checking a backport MR, ensure that the original MR has been merged
already. This is vital for followup checks that verify commit IDs from
original commits are present in backport commit messages.

3 years agodanger: check backport links to the original MR
Tom Krizek [Thu, 15 Dec 2022 16:48:34 +0000 (17:48 +0100)] 
danger: check backport links to the original MR

When doing archeology, it is much easier to find stuff if it's properly
linked. This check ensures that backport MR are linked to their original
MR via a "Backport of !XXXX" message.

The regular expression is fairly broad and has been tested to accept the
following variants of the message:
Backport of MR !XXXX
Backport of: !XXXX
backport of mr !XXXX
Backport of   !XXXX
Backport of https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/XXXX

3 years agodanger: ensure target branch is in the MR title
Tom Krizek [Thu, 15 Dec 2022 16:45:54 +0000 (17:45 +0100)] 
danger: ensure target branch is in the MR title

Having the MR title clearly marked in its title can be very useful when
looking through older issues/MRs.

This check also ensures that the version from the version label matches
the proper version branch (i.e. v9.16 must be marked with [v9_16]).

3 years agodanger: support partial backport label
Tom Krizek [Thu, 15 Dec 2022 16:39:58 +0000 (17:39 +0100)] 
danger: support partial backport label

Treat the Backport::Partial label as a backport as well.

3 years agoMerge branch '3740-rpz-reconfig' into 'main'
Tony Finch [Fri, 16 Dec 2022 09:48:35 +0000 (09:48 +0000)] 
Merge branch '3740-rpz-reconfig' into 'main'

A couple of RPZ options were not reconfigured as expected

Closes #3740

See merge request isc-projects/bind9!7230

3 years agoA couple of RPZ options were not reconfigured as expected
Tony Finch [Wed, 14 Dec 2022 15:47:03 +0000 (15:47 +0000)] 
A couple of RPZ options were not reconfigured as expected

[bug] Changes to the RPZ response-policy min-update-interval
and add-soa options now take effect as expected when
named is reconfigured. [GL #3740]

3 years agoMerge branch '3739-adb-cleans-overzealously-under-memory-pressure' into 'main'
Ondřej Surý [Thu, 15 Dec 2022 15:44:01 +0000 (15:44 +0000)] 
Merge branch '3739-adb-cleans-overzealously-under-memory-pressure' into 'main'

Exclude the ADB hashmaps from ADB overmem accounting

Closes #3739

See merge request isc-projects/bind9!7228

3 years agoAdd CHANGES and release note for [GL #3739]
Ondřej Surý [Wed, 14 Dec 2022 13:25:23 +0000 (14:25 +0100)] 
Add CHANGES and release note for [GL #3739]

3 years agoDon't expire fresh ADB names and entries
Ondřej Surý [Tue, 13 Dec 2022 13:32:19 +0000 (14:32 +0100)] 
Don't expire fresh ADB names and entries

The overmem cleaning in ADB could become overzealous and clean fresh ADB
names and entries.  Add a safety check to not clean any ADB names and
entries that are below ADB_CACHE_MINIMUM threshold.

3 years agoExclude the ADB hashmaps from ADB overmem accounting
Ondřej Surý [Tue, 13 Dec 2022 13:14:21 +0000 (14:14 +0100)] 
Exclude the ADB hashmaps from ADB overmem accounting

The ADB overmem accounting would include the memory used by hashtables
thus vastly reducing the space that can be used for ADB names and
entries when the hashtables would grow.  Create own memory context for
the ADB names and entries hash tables.

3 years agoMerge branch 'ondrej-fix-data-race-in-dns_adb' into 'main'
Ondřej Surý [Thu, 15 Dec 2022 14:58:56 +0000 (14:58 +0000)] 
Merge branch 'ondrej-fix-data-race-in-dns_adb' into 'main'

Lock the adbname and adbentry prior to unlocking hash locks

See merge request isc-projects/bind9!7216

3 years agoLock the adbname and adbentry prior to unlocking hash locks
Ondřej Surý [Tue, 13 Dec 2022 12:48:55 +0000 (13:48 +0100)] 
Lock the adbname and adbentry prior to unlocking hash locks

There was a datarace that could expire a freshly created ADB names and
entries between the return from get_attached_{name,entry} and locking it
again.  Lock the ADB name and ADB entry inside the hash table lock, so
they won't get expired until the full initialization has been complete.

3 years agoMerge branch '3742-catz-update-log-incorrect-soa-serial-representation' into 'main'
Arаm Sаrgsyаn [Thu, 15 Dec 2022 13:51:18 +0000 (13:51 +0000)] 
Merge branch '3742-catz-update-log-incorrect-soa-serial-representation' into 'main'

Fix an incorrect SOA serial representation in catz

Closes #3742

See merge request isc-projects/bind9!7229

3 years agoAdd a CHANGES note for [GL #3742]
Aram Sargsyan [Wed, 14 Dec 2022 14:46:26 +0000 (14:46 +0000)] 
Add a CHANGES note for [GL #3742]

3 years agoFix logging a uint32_t SOA serial value in dns_catz_update_from_db()
Aram Sargsyan [Wed, 14 Dec 2022 14:40:31 +0000 (14:40 +0000)] 
Fix logging a uint32_t SOA serial value in dns_catz_update_from_db()

The dns_catz_update_from_db() function prints serial number as a signed
number (with "%d" in the format string), but the `vers` variable's type
is 'uint32_t'. This breaks serials bigger than 2^31.

Use PRIu32 instead of "d" in the format string.

3 years agoAdd big SOA serial logging check into the catz system test
Aram Sargsyan [Wed, 14 Dec 2022 14:37:06 +0000 (14:37 +0000)] 
Add big SOA serial logging check into the catz system test

Check that the SOA serial numbers printed when updating a catalog zone
is represented correctly for numbers bigger than 2^31.

3 years agoMerge branch 'aram/dns_adb_getcookie-cleanup' into 'main'
Arаm Sаrgsyаn [Thu, 15 Dec 2022 13:22:54 +0000 (13:22 +0000)] 
Merge branch 'aram/dns_adb_getcookie-cleanup' into 'main'

Clean up and refactor dns_adb_getcookie()

See merge request isc-projects/bind9!7211

3 years agoClean up and refactor dns_adb_getcookie()
Aram Sargsyan [Fri, 9 Dec 2022 15:09:12 +0000 (15:09 +0000)] 
Clean up and refactor dns_adb_getcookie()

The dns_adb_getcookie() doesn't use the 'adb' parameter, remove it.

Refactor the dns_adb_getcookie() function to just return the size of
the cookie when the caller passes 'NULL' as the 'cookie' argument.

3 years agoMerge branch 'ondrej-use-isc_hashmap-for-zonemgr_keymgmt' into 'main'
Ondřej Surý [Wed, 14 Dec 2022 18:39:41 +0000 (18:39 +0000)] 
Merge branch 'ondrej-use-isc_hashmap-for-zonemgr_keymgmt' into 'main'

Replace zonemgr_keymgmt own hash table with isc_hashmap

See merge request isc-projects/bind9!7191

3 years agoReplace zonemgr_keymgmt own hash table with isc_hashmap
Ondřej Surý [Thu, 8 Dec 2022 09:04:41 +0000 (10:04 +0100)] 
Replace zonemgr_keymgmt own hash table with isc_hashmap

Instead of maintaining own hashtable implementation for zonemgr_keymgmt,
use isc_hashmap that already can resize (grow and shrink).

3 years agoMerge branch 'ondrej-add-more-logging-to-netmgr' into 'main'
Ondřej Surý [Wed, 14 Dec 2022 18:35:17 +0000 (18:35 +0000)] 
Merge branch 'ondrej-add-more-logging-to-netmgr' into 'main'

Add internal logging functions to the netmgr

See merge request isc-projects/bind9!7233

3 years agoAdd internal logging functions to the netmgr
Ondřej Surý [Wed, 7 Dec 2022 08:45:34 +0000 (09:45 +0100)] 
Add internal logging functions to the netmgr

Add internal logging functions isc__netmgr_log, isc__nmsocket_log(), and
isc__nmhandle_log() that can be used to add logging messages to the
netmgr, and change all direct use of isc_log_write() to use those
logging functions to properly prefix them with netmgr, nmsocket and
nmsocket+nmhandle.

3 years agoMerge branch '3637-try-next-server-on-resolver-timeout' into 'main'
Ondřej Surý [Wed, 14 Dec 2022 17:52:32 +0000 (17:52 +0000)] 
Merge branch '3637-try-next-server-on-resolver-timeout' into 'main'

Try next server on resolver timeout

Closes #3637

See merge request isc-projects/bind9!7212

3 years agoAdd CHANGES and release notes for [GL #3637]
Ondřej Surý [Mon, 12 Dec 2022 19:05:54 +0000 (20:05 +0100)] 
Add CHANGES and release notes for [GL #3637]

3 years agoExpire names in shutdown_names() under the lock
Ondřej Surý [Wed, 14 Dec 2022 14:07:58 +0000 (15:07 +0100)] 
Expire names in shutdown_names() under the lock

Since there could be fetches running, we need to run expire_name() under
the lock when shutting down the names.

3 years agoAdd comment why statistics/ns3 has misconfigure root.hints
Ondřej Surý [Tue, 13 Dec 2022 14:23:54 +0000 (15:23 +0100)] 
Add comment why statistics/ns3 has misconfigure root.hints

To count pending queries in the statistics, we need the ns3 to be
misconfigured.  Document the fact in the statistics/ns3/root.hints.

3 years agoRevert the statistics system test change after we fixed the resolver
Ondřej Surý [Tue, 13 Dec 2022 14:20:10 +0000 (15:20 +0100)] 
Revert the statistics system test change after we fixed the resolver

When the resolver was refactored, the statistics system test had to be
adjusted in c6b4d8255775a24a12b832a90a78cbf86e9faa8d.  Unfortunately,
this change had to be done because of an error in the resolver
refactoring where timeout would not retry next server, but keep trying
the same server.  As we have now fixed this bug, revert the change to
the test back to the previous state.

3 years agoTry next server on resolver timeout
Ondřej Surý [Mon, 12 Dec 2022 11:06:01 +0000 (12:06 +0100)] 
Try next server on resolver timeout

Instead of resending to the same server on the (dispatch) timeout in the
resolver, try the next server.

3 years agoMerge branch 'ondrej-allow-zero-length-keys-in-isc_hashmap' into 'main'
Ondřej Surý [Wed, 14 Dec 2022 17:01:54 +0000 (17:01 +0000)] 
Merge branch 'ondrej-allow-zero-length-keys-in-isc_hashmap' into 'main'

Allow zero length keys in isc_hashmap

See merge request isc-projects/bind9!7198

3 years agoAllow zero length keys in isc_hashmap
Ondřej Surý [Thu, 8 Dec 2022 09:46:09 +0000 (10:46 +0100)] 
Allow zero length keys in isc_hashmap

In case, we are trying to hash the empty key into the hashmap, the key
is going to have zero length.  This might happen in the unit test.
Allow this and add a unit test to ensure the empty zero-length key
doesn't hash to slot 0 as SipHash 2-4 (our hash function of choice) has
no problem with zero-length inputs.

3 years agoMerge branch '3725-mutual-tls-session-resumption-fix' into 'main'
Artem Boldariev [Wed, 14 Dec 2022 16:36:53 +0000 (16:36 +0000)] 
Merge branch '3725-mutual-tls-session-resumption-fix' into 'main'

Fix TLS session resumption via IDs when Mutual TLS is used

Closes #3725

See merge request isc-projects/bind9!7215

3 years agoUpdate Release notes [GL #3725]
Artem Boldariev [Wed, 14 Dec 2022 16:07:40 +0000 (18:07 +0200)] 
Update Release notes [GL #3725]

Mention that TLS session resumption for Mutual TLS has been fixed.

3 years agoUpdate CHANGES [GL #3725]
Artem Boldariev [Tue, 13 Dec 2022 12:14:43 +0000 (14:14 +0200)] 
Update CHANGES [GL #3725]

Mention that TLS session resumption for Mutual TLS has been fixed.

3 years agoExtend the 'doth' system test with a Mutual TLS resumption check
Artem Boldariev [Fri, 9 Dec 2022 16:47:07 +0000 (18:47 +0200)] 
Extend the 'doth' system test with a Mutual TLS resumption check

This commit adds a simple check to the 'doth' system test which
ensures that session resumption when Mutual TLS is used works as
expected.

3 years agoFix TLS session resumption via IDs when Mutual TLS is used
Artem Boldariev [Fri, 9 Dec 2022 16:44:01 +0000 (18:44 +0200)] 
Fix TLS session resumption via IDs when Mutual TLS is used

This commit fixes TLS session resumption via session IDs when
client certificates are used. To do so it makes sure that session ID
contexts are set within server TLS contexts. See OpenSSL documentation
for 'SSL_CTX_set_session_id_context()', the "Warnings" section.

3 years agoMerge branch 'fanf-dnssec-algorithm-loglevel' into 'main'
Tony Finch [Wed, 14 Dec 2022 11:02:15 +0000 (11:02 +0000)] 
Merge branch 'fanf-dnssec-algorithm-loglevel' into 'main'

List supported DNSSEC algorithms at log level NOTICE

See merge request isc-projects/bind9!7217

3 years agoList supported DNSSEC algorithms at log level NOTICE
Tony Finch [Tue, 13 Dec 2022 13:02:19 +0000 (13:02 +0000)] 
List supported DNSSEC algorithms at log level NOTICE

NOTICE matches the other startup messages. WARNING weirdly
suggests the list is a problem.

3 years agoMerge branch '3736-fix-intermittent-memory-leak-in-forward-system-test' into 'main'
Ondřej Surý [Wed, 14 Dec 2022 09:48:37 +0000 (09:48 +0000)] 
Merge branch '3736-fix-intermittent-memory-leak-in-forward-system-test' into 'main'

Fix intermittent memory leak in dns_resolver unit

Closes #3736

See merge request isc-projects/bind9!7214

3 years agoFix intermittent memory leak in dns_resolver unit
Ondřej Surý [Tue, 13 Dec 2022 10:02:47 +0000 (11:02 +0100)] 
Fix intermittent memory leak in dns_resolver unit

A rdataset could have been left unassociated on the error path in the
resume_dslookup() in the dns_resolver unit.  Clone the rdataset after
the error check, so it's not cloned before we check whether we can make
further progress chasing DS records.

3 years agoMerge branch '3737-fix-initialisation-of-local-in-isdotlocal-in-dig' into 'main'
Mark Andrews [Tue, 13 Dec 2022 23:27:50 +0000 (23:27 +0000)] 
Merge branch '3737-fix-initialisation-of-local-in-isdotlocal-in-dig' into 'main'

Resolve "fix initialisation of local. in isdotlocal in dig"

Closes #3737

See merge request isc-projects/bind9!7213

3 years agoProperly initialise local_ndata in isdotlocal in dig
Mark Andrews [Tue, 13 Dec 2022 01:03:49 +0000 (12:03 +1100)] 
Properly initialise local_ndata in isdotlocal in dig

Remove the trailing '\0' so that the length field of the dns_name_t
structure is correct.  The old data just happens to work with
dns_name_issubdomain but would fail with dns_name_equal.

3 years agoMerge branch 'fanf-rsasha236' into 'main'
Tony Finch [Tue, 13 Dec 2022 16:58:59 +0000 (16:58 +0000)] 
Merge branch 'fanf-rsasha236' into 'main'

Fix a typo RSASHA236 -> RSASHA256

See merge request isc-projects/bind9!7206

3 years agoFix a typo RSASHA236 -> RSASHA256
Tony Finch [Fri, 9 Dec 2022 12:52:05 +0000 (12:52 +0000)] 
Fix a typo RSASHA236 -> RSASHA256

Use dns_secalg_format() to avoid error-prone repetition.

3 years agoMerge branch 'tkrizek/set-up-version-and-release-notes-for-bind-9.19.9' into 'main'
Tom Krizek [Tue, 13 Dec 2022 16:18:03 +0000 (16:18 +0000)] 
Merge branch 'tkrizek/set-up-version-and-release-notes-for-bind-9.19.9' into 'main'

Set up version and release notes for bind  9.19.9

See merge request isc-projects/bind9!7218