]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
17 months agochg: dev: Separate the connect and the read TCP timeouts in dispatch
Arаm Sаrgsyаn [Wed, 22 Jan 2025 12:58:29 +0000 (12:58 +0000)] 
chg: dev: Separate the connect and the read TCP timeouts in dispatch

The network manager layer has two different timers with their
own timeout values for TCP connections: connect timeout and read
timeout. Separate the connect and the read TCP timeouts in the
dispatch module too.

Closes #5009

Merge branch '5009-dispatch-separate-connect-and-read-timeouts' into 'main'

See merge request isc-projects/bind9!9698

17 months agoRemove dispatch timeout INT16_MAX limitation
Aram Sargsyan [Wed, 30 Oct 2024 13:31:34 +0000 (13:31 +0000)] 
Remove dispatch timeout INT16_MAX limitation

In some places there was a limitation of the maximum timeout
value of INT16_MAX, which is only about 32 seconds. Refactor
the code to remove the limitation.

17 months agoSeparate the connect and the read timeouts in dispatch
Aram Sargsyan [Wed, 30 Oct 2024 09:23:33 +0000 (09:23 +0000)] 
Separate the connect and the read timeouts in dispatch

The network manager layer has two different timers with their
own timeout values for TCP connections: connect timeout and read
timeout. Separate the connect and the read TCP timeouts in the
dispatch module too.

17 months agodispatch_test: make client timeouts shorter
Aram Sargsyan [Tue, 29 Oct 2024 16:25:36 +0000 (16:25 +0000)] 
dispatch_test: make client timeouts shorter

Use shorter timeouts for the client to ensure that the clients
time out before the server.

17 months agoUpdate the dns_dispatch_add() function's documentation
Aram Sargsyan [Fri, 25 Oct 2024 13:35:03 +0000 (13:35 +0000)] 
Update the dns_dispatch_add() function's documentation

The 'timedout' callback no longer exists. Remove the mentioning of
the 'timedout' callback.

17 months agonew: nil: ignore TAGS files
Colin Vidal [Wed, 22 Jan 2025 11:22:41 +0000 (11:22 +0000)] 
new: nil: ignore TAGS files

Merge branch 'colin/ignoreTAGS' into 'main'

See merge request isc-projects/bind9!9956

17 months agoignore TAGS files
Colin Vidal [Wed, 15 Jan 2025 13:53:28 +0000 (14:53 +0100)] 
ignore TAGS files

TAGS file are generated from `make tags` using etags. Other index tags
are already ignored (GTAGS, GPATH, etc.). Also ignoring `TAGS`.

17 months agorem: dev: remove fields from struct fetchctx
Colin Vidal [Wed, 22 Jan 2025 10:31:22 +0000 (10:31 +0000)] 
rem: dev: remove fields from struct fetchctx

struct fetchctx does have several fields which are now unused or confusing, removing those.

Merge branch 'colin/remove-fctx-validator' into 'main'

See merge request isc-projects/bind9!9945

17 months agoremove ISC_LINK(link) property from fetchctx
Colin Vidal [Fri, 10 Jan 2025 16:31:46 +0000 (17:31 +0100)] 
remove ISC_LINK(link) property from fetchctx

Likely because of historical reasons, struct fetchctx does have a list
link property but is never used as a list. Remove this link property.

17 months agoremove validator link form fetchctx
Colin Vidal [Thu, 9 Jan 2025 11:01:28 +0000 (12:01 +0100)] 
remove validator link form fetchctx

struct fetchctx does have a list of pending validators as well as a
pointer to the HEAD validator. Remove the validator pointer to avoid
confusion, as there is no perticular reasons to have it directly
accessible outside of the list.

17 months agochg: doc: Set up version for BIND 9.21.5
Andoni Duarte [Wed, 22 Jan 2025 08:33:12 +0000 (08:33 +0000)] 
chg: doc: Set up version for BIND 9.21.5

Merge branch 'andoni/set-up-version-for-bind-9.21.5' into 'main'

See merge request isc-projects/bind9!9968

17 months agoUpdate BIND version to 9.21.5-dev
Andoni Duarte Pintado [Tue, 21 Jan 2025 14:58:51 +0000 (15:58 +0100)] 
Update BIND version to 9.21.5-dev

17 months agoUpdate BIND version for release 216580 v9.21.4
Nicki Křížek [Mon, 20 Jan 2025 12:54:00 +0000 (13:54 +0100)] 
Update BIND version for release

17 months agonew: doc: Prepare documentation for BIND 9.21.4
Nicki Křížek [Mon, 20 Jan 2025 12:52:22 +0000 (12:52 +0000)] 
new: doc: Prepare documentation for BIND 9.21.4

Merge branch 'andoni/prepare-documentation-for-bind-9.21.4' into 'v9.21.4-release'

See merge request isc-private/bind9!772

17 months agoReorder release notes
Michał Kępień [Fri, 17 Jan 2025 21:53:57 +0000 (22:53 +0100)] 
Reorder release notes

17 months agoAdd release note for GL #5099
Michał Kępień [Fri, 17 Jan 2025 21:53:57 +0000 (22:53 +0100)] 
Add release note for GL #5099

17 months agoTweak and reword release notes
Andoni Duarte Pintado [Thu, 16 Jan 2025 09:41:20 +0000 (10:41 +0100)] 
Tweak and reword release notes

17 months agoFix broken option reference in the ARM
Andoni Duarte Pintado [Thu, 16 Jan 2025 09:41:20 +0000 (10:41 +0100)] 
Fix broken option reference in the ARM

17 months agoPrepare release notes for BIND 9.21.4
Andoni Duarte Pintado [Thu, 16 Jan 2025 09:39:11 +0000 (10:39 +0100)] 
Prepare release notes for BIND 9.21.4

17 months agoGenerate changelog for BIND 9.21.4
Andoni Duarte Pintado [Thu, 16 Jan 2025 09:20:01 +0000 (10:20 +0100)] 
Generate changelog for BIND 9.21.4

17 months ago[CVE-2024-12705] sec: usr: DNS-over-HTTP(s) flooding fixes
Andoni Duarte [Wed, 15 Jan 2025 14:42:44 +0000 (14:42 +0000)] 
[CVE-2024-12705] sec: usr: DNS-over-HTTP(s) flooding fixes

Fix DNS-over-HTTP(S) implementation issues that arise under heavy
query load. Optimize resource usage for :iscman:`named` instances
that accept queries over DNS-over-HTTP(S).

Previously, :iscman:`named` would process all incoming HTTP/2 data
at once, which could overwhelm the server, especially when dealing
with clients that send requests but don't wait for responses. That
has been fixed. Now, :iscman:`named` handles HTTP/2 data in smaller
chunks and throttles reading until the remote side reads the
response data. It also throttles clients that send too many requests
at once.

Additionally, :iscman:`named` now carefully processes data sent by
some clients, which can be considered "flooding." It logs these
clients and drops connections from them.
:gl:`#4795`

In some cases, :iscman:`named` could leave DNS-over-HTTP(S)
connections in the `CLOSE_WAIT` state indefinitely. That also has
been fixed. ISC would like to thank JF Billaud for thoroughly
investigating the issue and verifying the fix.
:gl:`#5083`

See https://gitlab.isc.org/isc-projects/bind9/-/issues/4795

Closes https://gitlab.isc.org/isc-projects/bind9/-/issues/5083

Merge branch 'artem-improve-doh-resource-usage' into 'v9.21.4-release'

See merge request isc-private/bind9!732

17 months agoDoH: reduce excessive bad request logging
Artem Boldariev [Thu, 18 Jul 2024 17:21:53 +0000 (20:21 +0300)] 
DoH: reduce excessive bad request logging

We started using isc_nm_bad_request() more actively throughout
codebase. In the case of HTTP/2 it can lead to a large count of
useless "Bad Request" messages in the BIND log, as often we attempt to
send such request over effectively finished HTTP/2 sessions.

This commit fixes that.

17 months agoDo not stop timer in isc_nm_read_stop() in manual timer mode
Artem Boldariev [Tue, 16 Jul 2024 13:38:56 +0000 (16:38 +0300)] 
Do not stop timer in isc_nm_read_stop() in manual timer mode

A call to isc_nm_read_stop() would always stop reading timer even in
manual timer control mode which was added with StreamDNS in mind. That
looks like an omission that happened due to how timers are controlled
in StreamDNS where we always stop the timer before pausing reading
anyway (see streamdns_on_complete_dnsmessage()). That would not work
well for HTTP, though, where we might want pause reading without
stopping the timer in the case we want to split incoming data into
multiple chunks to be processed independently.

I suppose that it happened due to NM refactoring in the middle of
StreamDNS development (at the time isc_nm_cancelread() and
isc_nm_pauseread() were removed), as the StreamDNS code seems to be
written as if timers are not stoping during a call to
isc_nm_read_stop().

17 months agoDoH: introduce manual read timer control
Artem Boldariev [Tue, 9 Jul 2024 20:23:11 +0000 (23:23 +0300)] 
DoH: introduce manual read timer control

This commit introduces manual read timer control as used by StreamDNS
and its underlying transports. Before that, DoH code would rely on the
timer control provided by TCP, which would reset the timer any time
some data arrived. Now, the timer is restarted only when a full DNS
message is processed in line with other DNS transports.

That change is required because we should not stop the timer when
reading from the network is paused due to throttling. We need a way to
drop timed-out clients, particularly those who refuse to read the data
we send.

17 months agoDoH: floodding clients detection
Artem Boldariev [Mon, 8 Jul 2024 20:27:29 +0000 (23:27 +0300)] 
DoH: floodding clients detection

This commit adds logic to make code better protected against clients
that send valid HTTP/2 data that is useless from a DNS server
perspective.

Firstly, it adds logic that protects against clients who send too
little useful (=DNS) data. We achieve that by adding a check that
eventually detects such clients with a nonfavorable useful to
processed data ratio after the initial grace period. The grace period
is limited to processing 128 KiB of data, which should be enough for
sending the largest possible DNS message in a GET request and then
some. This is the main safety belt that would detect even flooding
clients that initially behave well in order to fool the checks server.

Secondly, in addition to the above, we introduce additional checks to
detect outright misbehaving clients earlier:

The code will treat clients that open too many streams (50) without
sending any data for processing as flooding ones; The clients that
managed to send 1.5 KiB of data without opening a single stream or
submitting at least some DNS data will be treated as flooding ones.
Of course, the behaviour described above is nothing else but
heuristical checks, so they can never be perfect. At the same time,
they should be reasonable enough not to drop any valid clients,
realatively easy to implement, and have negligible computational
overhead.

17 months agoDoH: process data chunk by chunk instead of all at once
Artem Boldariev [Thu, 4 Jul 2024 11:58:10 +0000 (14:58 +0300)] 
DoH: process data chunk by chunk instead of all at once

Initially, our DNS-over-HTTP(S) implementation would try to process as
much incoming data from the network as possible. However, that might
be undesirable as we might create too many streams (each effectively
backed by a ns_client_t object). That is too forgiving as it might
overwhelm the server and trash its memory allocator, causing high CPU
and memory usage.

Instead of doing that, we resort to processing incoming data using a
chunk-by-chunk processing strategy. That is, we split data into small
chunks (currently 256 bytes) and process each of them
asynchronously. However, we can process more than one chunk at
once (up to 4 currently), given that the number of HTTP/2 streams has
not increased while processing a chunk.

That alone is not enough, though. In addition to the above, we should
limit the number of active streams: these streams for which we have
received a request and started processing it (the ones for which a
read callback was called), as it is perfectly fine to have more opened
streams than active ones. In the case we have reached or surpassed the
limit of active streams, we stop reading AND processing the data from
the remote peer. The number of active streams is effectively decreased
only when responses associated with the active streams are sent to the
remote peer.

Overall, this strategy is very similar to the one used for other
stream-based DNS transports like TCP and TLS.

17 months ago[CVE-2024-11187] sec: usr: Limit the additional processing for large RDATA sets
Andoni Duarte [Wed, 15 Jan 2025 11:56:06 +0000 (11:56 +0000)] 
[CVE-2024-11187] sec: usr: Limit the additional processing for large RDATA sets

When answering queries, don't add data to the additional section if the answer has more than 13 names in the RDATA. This limits the number of lookups into the database(s) during a single client query, reducing query processing load.

See isc-projects/bind9#5034

Merge branch '5034-security-limit-additional' into 'v9.21.4-release'

See merge request isc-private/bind9!750

17 months agoLimit the additional processing for large RDATA sets
Ondřej Surý [Thu, 14 Nov 2024 09:37:29 +0000 (10:37 +0100)] 
Limit the additional processing for large RDATA sets

Limit the number of records appended to ADDITIONAL section to the names
that have less than 14 records in the RDATA.  This limits the number
of the lookups into the database(s) during single client query.

Also don't append any additional data to ANY queries.  The answer to ANY
is already big enough.

17 months agoIsolate using the -T noaa flag only for part of the resolver test
Ondřej Surý [Tue, 7 Jan 2025 14:22:40 +0000 (15:22 +0100)] 
Isolate using the -T noaa flag only for part of the resolver test

Instead of running the whole resolver/ns4 server with -T noaa flag,
use it only for the part where it is actually needed.  The -T noaa
could interfere with other parts of the test because the answers don't
have the authoritative-answer bit set, and we could have false
positives (or false negatives) in the test because the authoritative
server doesn't follow the DNS protocol for all the tests in the resolver
system test.

17 months agoRename the qpzone and qpcache methods that implement DB api
Ondřej Surý [Thu, 14 Nov 2024 10:18:00 +0000 (11:18 +0100)] 
Rename the qpzone and qpcache methods that implement DB api

All the database implementations share the same names for the methods
implementing the database.  That has some advantages like knowing what
to expect, but it turns out that any time such method shows up in any
kind of tracing - be it perf record, backtrace or anything else that
uses symbol names, it is very hard to distinguish whether the find()
belongs to qpcache, qpzone, builtin or sdlz implementation.

Make at least the names for qpzone and qpcache unique.

17 months agofix: usr: querying an NSEC3-signed zone for an empty record could trigger an assertion
Nicki Křížek [Tue, 14 Jan 2025 08:34:16 +0000 (08:34 +0000)] 
fix: usr: querying an NSEC3-signed zone for an empty record could trigger an assertion

A bug in the qpzone database could trigger a crash when querying for a deleted name, or a newly-added empty non-terminal name, in an NSEC3-signed zone. This has been fixed.

Closes #5108

Merge branch '5108-nsec3-empty-node' into 'main'

See merge request isc-projects/bind9!9928

17 months agodetect when closest-encloser name is too long
Evan Hunt [Thu, 9 Jan 2025 02:08:05 +0000 (18:08 -0800)] 
detect when closest-encloser name is too long

there was a database bug in which dns_db_find() could get a partial
match for the query name, but still set foundname to match the full
query name.  this triggered an assertion when query_addwildcardproof()
assumed that foundname would be shorter.

the database bug has been fixed, but in case it happens again, we
can just copy the name instead of splitting it. we will also log a
warning that the closest-encloser name was invalid.

17 months agodns_nsec3_addnsec3() can fail when iterating back
Evan Hunt [Sat, 21 Dec 2024 02:31:30 +0000 (18:31 -0800)] 
dns_nsec3_addnsec3() can fail when iterating back

when adding a new NSEC3 record, dns_nsec3_addnsec3() uses a
dbiterator to seek to the newly created node and then find its
predecessor.  dbiterators in the qpzone use snapshots, so changes
to the database are not reflected in an already-existing iterator.
consequently, when we add a new node, we have to create a new iterator
before we can seek to it.

17 months agoadd a regression test for a new ENT node
Evan Hunt [Sat, 21 Dec 2024 01:25:10 +0000 (17:25 -0800)] 
add a regression test for a new ENT node

this test adds a record with empty non-terminal nodes above it. this
has also been observed to trigger the crash in NSEC3 zones.

NOTE: the test currently fails, because while there is no crash, the
query results are not as expected.  when we add a node below an ENT,
receive_secure_serial() gets DNS_R_PARTIALMATCH, and the signed
zone is never updated. this is not a regression from fixing the
crash bug; it's a separate inline-signing bug.

17 months agoadd a regression test for record deletion
Evan Hunt [Sat, 21 Dec 2024 00:39:49 +0000 (16:39 -0800)] 
add a regression test for record deletion

test that there's no crash when querying for a newly-deleted node.

(incidentally also renamed ns3/named.conf.in to ns3/named1.conf.in,
because named2.conf.in does exist, and they should match.)

17 months agoqpzone find() function could set foundname incorrectly
Evan Hunt [Thu, 19 Dec 2024 22:19:43 +0000 (14:19 -0800)] 
qpzone find() function could set foundname incorrectly

when a requested name is found in the QP trie during a lookup, but its
records have been marked as nonexistent by a previous deletion, then
it's treated as a partial match, but the foundname could be left
pointing to the original qname rather than the parent. this could
lead to an assertion failure in query_findclosestnsec3().

17 months agofix: nil: Fix default IANA root zone mirror configuration
Michał Kępień [Thu, 9 Jan 2025 11:22:07 +0000 (11:22 +0000)] 
fix: nil: Fix default IANA root zone mirror configuration

Closes #5115

Merge branch '5115-fix-default-iana-root-zone-mirror-configuration' into 'main'

See merge request isc-projects/bind9!9934

17 months agoFix default IANA root zone mirror configuration
Michał Kępień [Thu, 9 Jan 2025 11:16:48 +0000 (12:16 +0100)] 
Fix default IANA root zone mirror configuration

Commit b121f02eac342ee285b6ab1292a0136448a91ee0 renamed the top-level
"primaries" block in bin/named/config.c to "remote-servers".  This
configuration block lists the primary servers used for an IANA root zone
mirror when no primary servers are explicitly specified for it in the
configuration.  However, the relevant part of the named_zone_configure()
function only looks for a top-level "primaries" block and not for any of
its synonyms.  As a result, configuring an IANA root zone mirror with
just:

    zone "." {
        type mirror;
    };

now results in a cryptic fatal error on startup:

    loading configuration: not found
    exiting (due to fatal error)

Fix by using the correct top-level block name in named_zone_configure().

18 months agofix: usr: Fix response policy zones and catalog zones with an $INCLUDE statement...
Arаm Sаrgsyаn [Wed, 8 Jan 2025 14:01:36 +0000 (14:01 +0000)] 
fix: usr: Fix response policy zones and catalog zones with an $INCLUDE statement defined

Response policy zones (RPZ) and catalog zones were not working correctly if they had an $INCLUDE statement defined. This has been fixed.

Closes #5111

Merge branch '5111-includes-disable-rpz-and-catz-fix' into 'main'

See merge request isc-projects/bind9!9930

18 months agoFix a typo in dns/master.h
Aram Sargsyan [Wed, 25 Dec 2024 14:33:39 +0000 (14:33 +0000)] 
Fix a typo in dns/master.h

The ISC_R_SEENINCLUDE definition does not exist, the correct one
is DNS_R_SEENINCLUDE.

18 months agoDon't disable RPZ and CATZ for zones with an $INCLUDE statement
Aram Sargsyan [Wed, 25 Dec 2024 14:30:53 +0000 (14:30 +0000)] 
Don't disable RPZ and CATZ for zones with an $INCLUDE statement

The code in zone_startload() disables RPZ and CATZ for a zone if
dns_master_loadfile() returns anything other than ISC_R_SUCCESS,
which makes sense, but it's an error because zone_startload() can
also return DNS_R_SEENINCLUDE upon success when the zone had an
$INCLUDE statement.

18 months agonew: ci: Add shotgun perf test of DoH GET to CI
Nicki Křížek [Wed, 8 Jan 2025 13:43:40 +0000 (13:43 +0000)] 
new: ci: Add shotgun perf test of DoH GET to CI

Add performance tests of DoH using the GET protocol to nightly pipelines.

Merge branch 'nicki/ci-shotgun-doh-get' into 'main'

See merge request isc-projects/bind9!9926

18 months agoAdd shotgun perf test of DoH GET to CI
Nicki Křížek [Thu, 19 Dec 2024 11:45:04 +0000 (12:45 +0100)] 
Add shotgun perf test of DoH GET to CI

18 months agofix: test: Fix "checking startup notify rate limit" fails on OL 8 FIPS
Michal Nowak [Thu, 2 Jan 2025 15:32:55 +0000 (15:32 +0000)] 
fix: test: Fix "checking startup notify rate limit" fails on OL 8 FIPS

Adjust number of zones down to 23 to match those present when testing in FIPS mode.

Closes #5097

Merge branch '5097-checking-startup-notify-rate-limit-fails-on-ol-8-fips' into 'main'

See merge request isc-projects/bind9!9919

18 months agoAdjust number of zones to those in FIPS mode
Mark Andrews [Mon, 16 Dec 2024 04:11:03 +0000 (15:11 +1100)] 
Adjust number of zones to those in FIPS mode

18 months agonew: dev: Log both "from" and "to" socket in debug messages
Michał Kępień [Tue, 31 Dec 2024 04:42:41 +0000 (04:42 +0000)] 
new: dev: Log both "from" and "to" socket in debug messages

Debug messages logging network traffic now include information about both sides of each communication channel rather than just one of them.

Closes #4345

Merge branch '4345-log-both-from-and-to-socket-in-debug-messages' into 'main'

See merge request isc-projects/bind9!8349

18 months agoAccount for revised log messages in test code
Michał Kępień [Tue, 31 Dec 2024 04:40:48 +0000 (05:40 +0100)] 
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.

18 months agoAdjust dns_message_logpacketfrom() log prefixes
Michał Kępień [Tue, 31 Dec 2024 04:40:48 +0000 (05:40 +0100)] 
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.

18 months agoAdjust dns_message_logpacketfromto() log prefixes
Michał Kępień [Tue, 31 Dec 2024 04:40:48 +0000 (05:40 +0100)] 
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.

18 months agoLog both "from" and "to" socket in debug messages
Michał Kępień [Tue, 31 Dec 2024 04:40:48 +0000 (05:40 +0100)] 
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.

18 months agoRename dns_message_logpacket()
Michał Kępień [Tue, 31 Dec 2024 04:40:48 +0000 (05:40 +0100)] 
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.

18 months agoRename dns_message_logfmtpacket()
Michał Kępień [Tue, 31 Dec 2024 04:40:48 +0000 (05:40 +0100)] 
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.

18 months agoEnable logging both "from" and "to" socket
Michał Kępień [Tue, 31 Dec 2024 04:40:48 +0000 (05:40 +0100)] 
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.)

18 months agodns_message_logfmtpacket(): drop 'style' parameter
Michał Kępień [Tue, 31 Dec 2024 04:40:48 +0000 (05:40 +0100)] 
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.

18 months agologfmtpacket(): drop useless local variables
Michał Kępień [Tue, 31 Dec 2024 04:40:48 +0000 (05:40 +0100)] 
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.

18 months agonew: dev: Enable extraction of exact local socket addresses
Michał Kępień [Tue, 31 Dec 2024 04:40:12 +0000 (04:40 +0000)] 
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

18 months agoEnable extraction of exact local socket addresses
Michał Kępień [Sun, 29 Dec 2024 11:32:05 +0000 (12:32 +0100)] 
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.

18 months agochg: nil: Improve reuse of outgoing TCP connections
Michał Kępień [Sun, 29 Dec 2024 11:31:29 +0000 (11:31 +0000)] 
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

18 months agoImprove reuse of outgoing TCP connections
Michał Kępień [Sun, 29 Dec 2024 09:22:20 +0000 (10:22 +0100)] 
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.

18 months agochg: dev: Add TLS SNI extension to all outgoing TLS connections
Artem Boldariev [Thu, 26 Dec 2024 15:57:10 +0000 (15:57 +0000)] 
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

18 months agoBIND - enable TLS SNI support for outgoing TLS connections
Artem Boldariev [Tue, 17 Dec 2024 14:24:29 +0000 (16:24 +0200)] 
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.

18 months agoDig - enable TLS SNI support
Artem Boldariev [Tue, 17 Dec 2024 14:02:05 +0000 (16:02 +0200)] 
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.

18 months agoTLS SNI - add low level support for SNI to the networking code
Artem Boldariev [Tue, 17 Dec 2024 13:52:18 +0000 (15:52 +0200)] 
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.

18 months agofix: dev: Use CMM_{STORE,LOAD}_SHARED to store/load glue in gluelist
Ondřej Surý [Wed, 25 Dec 2024 15:06:09 +0000 (15:06 +0000)] 
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

18 months agoUse CMM_{STORE,LOAD}_SHARED to store/load glue in gluelist
Ondřej Surý [Wed, 25 Dec 2024 14:14:10 +0000 (15:14 +0100)] 
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

18 months agochg: dev: Detect and possibly define constexpr using Autoconf
Ondřej Surý [Wed, 25 Dec 2024 14:22:27 +0000 (14:22 +0000)] 
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

18 months agoDetect and possibly define constexpr using Autoconf
Ondřej Surý [Wed, 18 Dec 2024 10:53:48 +0000 (11:53 +0100)] 
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.

18 months agorem: dev: Remove C++ support from the public header
Ondřej Surý [Wed, 18 Dec 2024 16:34:37 +0000 (16:34 +0000)] 
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

18 months agoRemove C++ support from the public header
Ondřej Surý [Wed, 18 Dec 2024 11:00:54 +0000 (12:00 +0100)] 
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.

18 months agofix: usr: Resolve the spurious drops in performance due GLUE cache
Ondřej Surý [Fri, 13 Dec 2024 23:11:04 +0000 (23:11 +0000)] 
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

18 months agoRewrite the GLUE cache in QP zone database
Ondřej Surý [Thu, 5 Dec 2024 12:45:24 +0000 (13:45 +0100)] 
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.

18 months agoRevert "Fix the glue table in the QP and RBT zone databases"
Ondřej Surý [Tue, 3 Dec 2024 14:07:30 +0000 (15:07 +0100)] 
Revert "Fix the glue table in the QP and RBT zone databases"

This reverts commit 5beae5faf9c6b46f4cee23e4ea2557bef6afa711.

18 months agofix: test: Various coccinelle fixes
Michal Nowak [Fri, 13 Dec 2024 13:48:20 +0000 (13:48 +0000)] 
fix: test: Various coccinelle fixes

Merge branch 'mnowak/cocci-more-set-if-not-null-changes' into 'main'

See merge request isc-projects/bind9!9836

18 months agoDrop superfluous isc_mem_get() NULL check
Michal Nowak [Thu, 12 Dec 2024 16:42:50 +0000 (17:42 +0100)] 
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

18 months agoMove coccinelle job to "sid" image
Michal Nowak [Thu, 5 Dec 2024 16:15:34 +0000 (17:15 +0100)] 
Move coccinelle job to "sid" image

The "sid" image has newer coccinelle 1.2 that identifies more issues.

18 months agoDisable unsigned-int spatch in models.c and sdlz.c
Michal Nowak [Thu, 5 Dec 2024 16:10:25 +0000 (17:10 +0100)] 
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

18 months agoApply more SET_IF_NOT_NULL() changes
Michal Nowak [Thu, 5 Dec 2024 15:15:50 +0000 (16:15 +0100)] 
Apply more SET_IF_NOT_NULL() changes

coccinelle v1.2 found more cases where the SET_IF_NOT_NULL macro
applies.

18 months agorem: dev: Remove DLV remnants
Matthijs Mekking [Fri, 13 Dec 2024 11:00:54 +0000 (11:00 +0000)] 
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

18 months agoRemove DLV remnants
Matthijs Mekking [Tue, 10 Dec 2024 10:10:02 +0000 (11:10 +0100)] 
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.

18 months agoMerge tag 'v9.21.3'
Andoni Duarte Pintado [Fri, 13 Dec 2024 09:53:33 +0000 (10:53 +0100)] 
Merge tag 'v9.21.3'

18 months agochg: usr: The configuration clauses parental-agents and primaries are renamed to...
Matthijs Mekking [Fri, 13 Dec 2024 09:10:56 +0000 (09:10 +0000)] 
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

18 months agoRename remote-servers standard term to server-list
Matthijs Mekking [Fri, 6 Dec 2024 13:39:35 +0000 (14:39 +0100)] 
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.

18 months agoAdd primaries, parental-agents as synonyms
Matthijs Mekking [Fri, 6 Dec 2024 11:50:09 +0000 (12:50 +0100)] 
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.

18 months agoUnify parental-agents, primaries to remote-servers
Matthijs Mekking [Thu, 5 Dec 2024 07:52:03 +0000 (08:52 +0100)] 
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.

18 months agofix: test: Fix "checking startup notify rate limit" failure
Mark Andrews [Fri, 13 Dec 2024 00:07:23 +0000 (00:07 +0000)] 
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

18 months agoFix startup notify rate test
Mark Andrews [Wed, 11 Dec 2024 02:32:18 +0000 (13:32 +1100)] 
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.

18 months agofix: test: tests/irs/resconf_test.c is missing check callbacks
Mark Andrews [Thu, 12 Dec 2024 22:49:50 +0000 (22:49 +0000)] 
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

18 months agoMove resconf_test.c to tests/dns and cleanup
Mark Andrews [Wed, 11 Dec 2024 01:28:40 +0000 (12:28 +1100)] 
Move resconf_test.c to tests/dns and cleanup

18 months agoCheck that nameservers are parsed correctly
Mark Andrews [Tue, 10 Dec 2024 06:35:16 +0000 (17:35 +1100)] 
Check that nameservers are parsed correctly

Add checks that the expected nameservers where actuall addes when
parsing resolv.conf.

18 months agofix: ci: Disable tracing otherwise gcovr fails
Michal Nowak [Thu, 12 Dec 2024 14:51:52 +0000 (14:51 +0000)] 
fix: ci: Disable tracing otherwise gcovr fails

Merge branch 'mnowak/gcovr-disable-tracing' into 'main'

See merge request isc-projects/bind9!9809

18 months agoDisable tracing for gcovr-enabled builds
Michal Nowak [Tue, 26 Nov 2024 14:49:15 +0000 (15:49 +0100)] 
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.

18 months agochg: doc: Update CONTRIBUTING.md and developer docs
Nicki Křížek [Thu, 12 Dec 2024 12:45:40 +0000 (12:45 +0000)] 
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

18 months agoUpdate CONTRIBUTING.md and developer doc
Nicki Křížek [Tue, 26 Nov 2024 15:33:33 +0000 (16:33 +0100)] 
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

18 months agofix: test: Wait for "all zones loaded" after rndc reload in "database" test
Michal Nowak [Thu, 12 Dec 2024 12:08:13 +0000 (12:08 +0000)] 
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

18 months agoWait for "all zones loaded" after rndc reload in "database" test
Michal Nowak [Thu, 5 Dec 2024 10:58:12 +0000 (11:58 +0100)] 
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.

18 months agorem: usr: Remove 'sortlist' option
Evan Hunt [Thu, 12 Dec 2024 02:35:18 +0000 (02:35 +0000)] 
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

18 months agoremove "sortlist"
Evan Hunt [Thu, 5 Dec 2024 21:16:02 +0000 (13:16 -0800)] 
remove "sortlist"

this commit removes the deprecated "sortlist" option. the option
is now marked as ancient; it is a fatal error to use it in
named.conf.

the sortlist system test has been removed, and other tests that
referenced the option have been modified.

the enabling functions, dns_message_setsortorder() and
dns_rdataset_towiresorted(), have also been removed.

18 months agonew: usr: Add "Zone has [AAAA/A] records but is not served by IPv[6/4]" warnings
Mark Andrews [Wed, 11 Dec 2024 22:06:34 +0000 (22:06 +0000)] 
new: usr: Add "Zone has [AAAA/A] records but is not served by IPv[6/4]" warnings

Check that zones with AAAA records are served by IPv6 servers and that zones with A records are served by IPv4 servers.
Sometimes, IPv6 services are accidentally misconfigured and zones with IPv6 (AAAA) address records are not served by DNS servers with IPv6 addresses, which means they need to use translation devices to look up those IPv6 addresses. The reverse is also sometimes true: zones with A records are not resolvable over IPv4 when they should be.
To prevent this, BIND now looks for these misconfigured zones and issues a warning if they are found.

Closes #4370

Merge branch '4370-check-that-a-zone-is-served-by-ipv6-servers-if-it-has-aaaa-records' into 'main'

See merge request isc-projects/bind9!8393

18 months agoCheck "records but is not served by" warnings
Mark Andrews [Tue, 17 Oct 2023 04:28:22 +0000 (15:28 +1100)] 
Check "records but is not served by" warnings

This checks that "zone has A records but is not served by IPv4
servers" and "zone has AAAA records but is not served by IPv6
servers" are emitted when they should be and not when they shouldn't
be.

18 months agoCheck that a zone that serves A/AAAA is served over IPv4/IPv6
Mark Andrews [Tue, 17 Oct 2023 03:49:14 +0000 (14:49 +1100)] 
Check that a zone that serves A/AAAA is served over IPv4/IPv6

named-checkzone will now, as part of the zone's integrity checks,
look to see if there are A or AAAA records being served and if so
check that the nameservers have A or AAAA records respectively.

These are a sometimes overlooked checks that, if not met, can mean
that a service that is supposed to reachable over IPv6 will not be
resolvable when the recursive resolver is IPv6 only.  Similarly for
IPv4 servers when there are IPv4 only resolvers.