2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

36567 Commits

Author SHA1 Message Date
Michal Nowak
e98b9c5009
Fix external_symbolizer_path on Fedora
The external_symbolizer_path was wrong on Fedora since moving gcc:tsan
jobs from Debian to Fedora.
2022-06-16 17:21:12 +02:00
Michal Nowak
1c45a9885a
Update clang to version 14 2022-06-16 17:21:11 +02:00
Michal Nowak
51ebc6e1e8 Merge branch 'mnowak/checkds-pylint-implicit-str-concat-fixes' into 'main'
Fix implicit string concatenation in tests-checkds.py

See merge request isc-projects/bind9!6452
2022-06-16 11:40:27 +00:00
Michal Nowak
831ac8add1
Fix implicit string concatenation in tests-checkds.py
pylint 2.14.2 reports the following warnings:

    bin/tests/system/checkds/tests-checkds.py:265:0: W1404: Implicit string concatenation found in call (implicit-str-concat)
    bin/tests/system/checkds/tests-checkds.py:273:0: W1404: Implicit string concatenation found in call (implicit-str-concat)
2022-06-16 11:42:29 +02:00
Tom Krizek
636d561926 Merge branch 'tkrizek/pytest-skipped-reason' into 'main'
Report reasons for skipped/xfailed system pytests

See merge request isc-projects/bind9!6441
2022-06-16 07:17:37 +00:00
Tom Krizek
f6d368167a
Report reasons for skipped/xfailed system pytests
If skip/xfail is used in pytest, it can have a reason string associated
with it. When evaluating these tests, it can be useful to be able to
differentiate the reason why the test was skipped/xfailed/xpassed,
because there might be multiple possible reasons for that.

The extra options passed to pytest ensure that the string with the
reason appears in the test summary and thus we're able to find the
string with the reason in the log output.

See https://docs.pytest.org/en/7.1.x/how-to/skipping.html for more info
2022-06-16 09:13:53 +02:00
Petr Špaček
a1cbe71ab2 Merge branch 'pspacek/nsec3-doc-update' into 'main'
Update NSEC3 guidance to match draft-ietf-dnsop-nsec3-guidance-10

See merge request isc-projects/bind9!6413
2022-06-15 15:56:53 +00:00
Petr Špaček
2ee3f4e6c8
Update NSEC3 guidance to match draft-ietf-dnsop-nsec3-guidance-10
https://datatracker.ietf.org/doc/html/draft-ietf-dnsop-nsec3-guidance-10
is on it's way to become RFC, so let's update our recommendations in the
docs to be in line with it.
2022-06-15 17:53:33 +02:00
Michał Kępień
529a7c0c1a BIND 9.19.2
-----BEGIN PGP SIGNATURE-----
 
 iQJDBAABCgAtFiEENKwGS3ftSQfs1TU17QVz/8hFYQUFAmKY50MPHG1pY2hhbEBp
 c2Mub3JnAAoJEO0Fc//IRWEFWu0QAJ2gYn5ShpLt98L9yknezjUBVzeB/yiz8xLC
 gjXKs8OIdqvQV4N2lqdqdvaHUpLmK6tWQVFyiVfcQehKVu0z0PZfM1+iphBRn1ES
 laVL1ZyRvncAPxRZPztYngeESZnMDeEObcKw4bGaB+Fs7S8ZqvaEDBs6GShYMnYR
 AeBsdqeUVUZTMJC+D5AdCfvutd6LMiS4mB1uE4bWfjxZkeOCaLUJZB11JCMw8uMQ
 HUjpvIwq5eDUFVA4flKi0YwCfUeZdrkdgcn+YtGJHNQFY8quWMdE26IrfKM/oUF+
 NOuD5SZurh/ShETL68zsSiQoWxlnuIPjsfdjYArmUdMuBoBHtAqq9keHGU1sU02J
 joxRcDX2ltEzdD+sGeUgZ1BEXGC9n0wK+XKCRICZ6+axr08NJhvViuVplK+g1U08
 wbz9PWHowQ3yd/dDeTz9jda5oFMeTHHd7C8mUhdvf2aQqJ+u1dlJ9Rn7s/mtZGEq
 TEIGdIkXncmMFhs38562i2RncueFOHeM5ZY5g8o7mmNcr3RerxkaGQeg6xIY1PUN
 xIjTsoa8odvZP4pW1uKMmKhBfSIG+yYnZgBo1y/zJgjbeQ7EHZVqLAeKDTuAIxSB
 7tnvXvrHdQ9yo0Kn82e93Y+QYJ1GHL4UdHynH2B3T4JGgDYFqyrfbWSCTh6FpgWS
 VhLaoT4d
 =rNzV
 -----END PGP SIGNATURE-----

Merge tag 'v9_19_2'

BIND 9.19.2
2022-06-15 15:53:59 +02:00
Artem Boldariev
f3cb438091 Merge branch 'artem-tlsdns-do-not-call-acceptcb-twice' into 'main'
TLS DNS: do not call accept callback twice

See merge request isc-projects/bind9!6439
2022-06-15 12:29:35 +00:00
Artem Boldariev
e616d7f240 TLS DNS: do not call accept callback twice
Before the changes from this commit were introduced, the accept
callback function will get called twice when accepting connection
during two of these stages:

* when accepting the TCP connection;
* when handshake has completed.

That is clearly an error, as it should have been called only once. As
far as I understand it the mistake is a result of TLS DNS transport
being essentially a fork of TCP transport, where calling the accept
callback immediately after accepting TCP connection makes sense.

This commit fixes this mistake. It did not have any very serious
consequences because in BIND the accept callback only checks an ACL
and updates stats.
2022-06-15 14:21:11 +03:00
Petr Špaček
f397803ec4 Merge branch 'pspacek/doc-cleanup-dnssec-prereq' into 'main'
Update intro texts in the DNSSEC Guide

See merge request isc-projects/bind9!6418
2022-06-14 16:11:54 +00:00
Petr Špaček
fd3a2c7854
Update FAQ in the DNSSEC Guide
Mention DoT/DoH, update stats, remove mentions of early stages of
deployment.
2022-06-14 18:08:23 +02:00
Petr Špaček
635885afe6
Update Authoritative Server Hardware requirements in DNSSEC Guide
Based on measurements done on BIND v9_19_2 using bank. TLD and a
synthetitc fullly signed zone, using RSASHA256 and ECDSAP256SHA256
algorithms with NSEC and NSEC3 without opt-out.
2022-06-14 18:08:22 +02:00
Petr Špaček
832c172985
Update DNSSEC validation deployment stats in DNSSEC Guide 2022-06-14 18:08:22 +02:00
Petr Špaček
6cf8066b9c
Rewrite Recursive Server Hardware requirements in DNSSEC Guide
This section was completely out of date. Current measurements on dataset
Telco EU 2022-02 and BIND 9.19.1 indicate absolutely different results
than described in the old version of the text.
2022-06-14 18:08:22 +02:00
Petr Špaček
6e79877759
Remove outdated software requirements from DNSSEC Guide
Guide in this repo is tied to latest version anyway, so let's not even
mention ancient versions of BIND.

This also solves the OpenSSL question because it is now mandatory for
build, which subsequently removes the entropy problem - so let's not
mention it either.
2022-06-14 18:08:15 +02:00
Arаm Sаrgsyаn
6923f7973b Merge branch '3401-race-condition-in-route_connected' into 'main'
Resolve "race condition in route_connected() leads to crash on startup/shutdown"

Closes #3401

See merge request isc-projects/bind9!6429
2022-06-14 15:31:40 +00:00
Aram Sargsyan
4b0e7e41fc Add CHANGES note for [GL #3401] 2022-06-14 14:31:55 +00:00
Aram Sargsyan
f6e729635f Fix a race condition between shutdown and route_connected()
When shutting down, the interface manager can be destroyed
before the `route_connected()` callback is called, which is
unexpected for the latter and can cause a crash.

Move the interface manager attachment code from the callback
to the place before the callback is registered using
`isc_nm_routeconnect()` function, which will make sure that
the interface manager will live at least until the callback
is called.

Make sure to detach the interface manager if the
`isc_nm_routeconnect()` function is not implemented, or when
the callback is called with a result value which differs from
`ISC_R_SUCCESS`.
2022-06-14 14:31:24 +00:00
Aram Sargsyan
1d93fe973b Do not use the interface manager until it is ready
The `ns_interfacemgr_create()` function, when calling
`isc_nm_routeconnect()`, uses the newly created `ns_interfacemgr_t`
instance before initializing its reference count and the magic value.

Defer the `isc_nm_routeconnect()` call until the initializations
are complete.
2022-06-14 14:31:24 +00:00
Arаm Sаrgsyаn
8f4b11773b Merge branch '3207-dig-nssearch-crash-fix' into 'main'
Resolve "dig +nssearch org crashes when network is unreachable"

Closes #3207

See merge request isc-projects/bind9!6343
2022-06-14 14:03:04 +00:00
Aram Sargsyan
0450c9bd32 Add CHANGES note for [GL #3207] 2022-06-14 13:20:55 +00:00
Aram Sargsyan
1290863c22 Fix a crash in dig NS search mode
In special NS search mode, after the initial lookup, dig starts the
followup lookup with discovered NS servers in the queries list. If one
of those queries then fail, dig, as usual, tries to start the next query
in the list, which results in a crash, because the NS search mode is
special in a way that the queries are running in parallel, so the next
query is usually already started.

Apply some special logic in `recv_done()` function to deal with the
described situation when handling the query result for the NS search
mode. Particularly, print a warning message for the failed query,
and do not try to start the next query in the list. Also, set a non-zero
exit code if all the queries in the followup lookup fail.
2022-06-14 13:20:25 +00:00
Michal Nowak
99baab6268 Merge branch '3138-capture-scripts-to-coverity-scan' into 'main'
Capture scripts for Coverity Scan analysis

Closes #3138

See merge request isc-projects/bind9!5984
2022-06-14 12:18:12 +00:00
Michal Nowak
b4a2674d98
Capture scripts for Coverity Scan analysis
With the recent Coverity Scan 2021.12 version, Python 3 scripts are
being analyzed in addition to C files. The --fs-capture-search option
scripts for Coverity Scan analysis should be added to leverage this
feature.
2022-06-14 14:05:13 +02:00
Michal Nowak
1333bdf67e
Download Coverity Scan analysis tool to /tmp
Downloading and unpacking Coverity Scan analysis tool tarball
(cov-analysis-linux64.tgz) to $CI_PROJECT_DIR interferes with the
execution of the analysis tool when the --fs-capture-search option is
used because the tool starts to analyze some of its Javascript files.
(There's the --fs-capture-search-exclude-regex <path> option, but I
failed to find a way to make it work.)
2022-06-14 14:05:13 +02:00
Michal Nowak
c966304e90
Drop coverity cache feature
The coverity CI job cache feature is used to ensure that the 1 GB
cov-analysis-linux64.tgz file is being cached on GitLab CI runner, where
it was downloaded in the past. This feature does not seem to work
anymore; given that the proper solution to creating distributed cache is
complicated, better to drop the feature altogether.
2022-06-14 14:05:12 +02:00
Michał Kępień
8b48172d82 Merge branch '3168-5-tidy-check_recursionquota' into 'main'
[5/5] Tidy check_recursionquota()

Closes #3168

See merge request isc-projects/bind9!5886
2022-06-14 11:44:56 +00:00
Michał Kępień
296587903a Merge branch '3168-4-refactor-recursion-quota-handling' into 'main'
[4/5] Refactor recursion quota handling

See merge request isc-projects/bind9!5885
2022-06-14 11:43:14 +00:00
Michał Kępień
a4e92e3d0c Merge branch '3168-3-separate-all-recursions' into 'main'
[3/5] Separate all recursions

See merge request isc-projects/bind9!5884
2022-06-14 11:42:21 +00:00
Michał Kępień
7611b05e4f Merge branch '3168-2-untangle-prefetch-and-rpz' into 'main'
[2/5] Untangle prefetch and RPZ code

See merge request isc-projects/bind9!5883
2022-06-14 11:41:09 +00:00
Michał Kępień
b7285e4fee Merge branch '3168-1-add-recursionquota-helper-functions' into 'main'
[1/5] Add recursionquota_*() helper functions

See merge request isc-projects/bind9!5882
2022-06-14 11:39:15 +00:00
Michał Kępień
0d7e5d513c Assert on unknown isc_quota_attach() return values
The only values that the isc_quota_attach() function (called from
check_recursionquota() via recursionquotatype_attach_soft()) can
currently return are: ISC_R_SUCCESS, ISC_R_SOFTQUOTA, and ISC_R_QUOTA.
Instead of just propagating any other (unexpected) error up the call
stack, assert immediately, so that if the isc_quota_* API gets updated
in the future to return values currently matching the "default"
statement, check_recursionquota() can be promptly updated to handle such
new return values as desired.
2022-06-14 13:13:32 +02:00
Michał Kępień
cd8a687e5a Add CHANGES entry for GL #3168 2022-06-14 13:13:32 +02:00
Michał Kępień
95e703121d Ensure ns_query_cancel() handles all recursions
Previously, multiple code paths reused client->query.fetch, so it was
enough for ns_query_cancel() to issue a single call to
dns_resolver_cancelfetch() with that fetch as an argument.  Now, since
each slot in the 'recursions' array can hold a reference to a separate
resolver fetch, ns_query_cancel() needs to handle all of them, so that
all recursion callbacks get a chance to clean up the associated
resources when a query is canceled.
2022-06-14 13:13:32 +02:00
Michał Kępień
9eaddf2e4f Separate prefetch handling from RPZ fetch handling
Both prefetch code and RPZ code ignore recursion results (caching the
response notwithstanding).  RPZ code has been (ab)using that fact since
commit 08e36aa5a5c7697a839f83831fccf8fb3f792848 by employing
prefetch_done() as the fetch completion callback.  This is only
seemingly a simplification as it makes the code harder to follow ("why
is prefetch code used for handling RPZ-triggered recursion?").

Turn prefetch_done() into a new function whose name clearly conveys its
purpose.  Add a parameter to its prototype in order to allow callers to
specify which slot in the 'recursions' array it should use.  Reintroduce
prefetch_done() as a wrapper for that function.  Add rpzfetch_done(), an
RPZ-exclusive wrapper for that function (using a distinct recursion
type).

Since each slot in the 'recursions' array needs to be initialized before
getting cleaned up when recursion completes, rework fetch_and_forget()
so that it takes recursion type rather than extra fetch options as the
last parameter and make it use the requested slot in the 'recursions'
array rather than a fixed slot (RECTYPE_PREFETCH) for all callers.  This
makes fetch_and_forget() a logical complement of cleanup_after_fetch().

Collectively, these changes make prefetch and RPZ code logically
separate (except for reusing client->recursionquota, which will be
refactored later).
2022-06-14 13:13:32 +02:00
Ondřej Surý
4232a281c8 Add recursionquota_attach*()
Add a set of new helper functions for attaching to the recursion quota
in order to reduce code duplication and to ensure that the recursive
clients counter is always adjusted properly.  Since some callers
(query_prefetch(), query_rpzfetch()) treat exceeding the soft quota as
an error while others (check_recursionquota()) do not, also add two
wrapper functions whose names help convey their purpose, in order to
improve code readability.
2022-06-14 13:13:32 +02:00
Michał Kępień
8d64beb06f Use a switch statement in check_recursionquota()
Improve readability of the check_recursionquota() function by replacing
a sequence of conditional statements with a switch statement.
2022-06-14 13:13:32 +02:00
Michał Kępień
7bc4425e2a Remove redundant recursion quota pointer checks
When the client->recursionquota pointer was overloaded by different
features, each of those features had to be aware of that fact and handle
any updates of that pointer gracefully.  Example: prefetch code
initiates recursion, attaching to client->recursionquota, then query
processing restarts due to a CNAME being encountered, then that CNAME is
not found in the cache, so another recursion is triggered, but
client->recursionquota is already attached to; even though it is not
CNAME chaining code that attached to that pointer, that code still has
to handle such a situation gracefully.

However, all features that can initiate recursion have now been updated
to use separate slots in the 'recursions' array, so keeping the old
checks in place means masking future programming errors that could
otherwise be caught - and should be caught because each feature needs to
properly maintain its own quota reference.

Remove outdated recursion quota pointer checks to enable the assertions
in isc_quota_*() functions to detect programming errors in code paths
that can start recursion.  Remove an outdated comment to prevent
confusion.
2022-06-14 13:13:32 +02:00
Michał Kępień
9e187b893d Drop the 'fetchhandle' and 'fetch' fields
Drop the 'fetchhandle' field from ns_client_t as all code using it has
been migrated to use the recursion-type-specific HANDLE_RECTYPE_*()
macros.

Drop the 'fetch' field from ns_query_t as all code using it has been
migrated to use the recursion-type-specific FETCH_RECTYPE_*() macros.
2022-06-14 13:13:32 +02:00
Michał Kępień
30ace0663d Make prefetch code use the 'recursions' array
Replace:

  - client->prefetchhandle with HANDLE_RECTYPE_PREFETCH(client)
  - client->query.prefetch with FETCH_RECTYPE_PREFETCH(client)

This is preparatory work for separating prefetch code from RPZ code.
2022-06-14 13:13:32 +02:00
Ondřej Surý
70254724e7 Add recursionquota_detach()
Add a new helper function for detaching from the recursion quota in
order to reduce code duplication and to ensure that detaching from that
quota is always accompanied by decreasing the recursive clients counter.
2022-06-14 13:13:32 +02:00
Michał Kępień
a06cdfc7b7 Add helper function for recursive-clients logging
Reduce code duplication in check_recursionquota() by extracting its
parts responsible for logging to a separate helper function.

Remove result text from the "no more recursive clients" message because
it always says "quota reached" (as the relevant branch is only evaluated
when 'result' is set to ISC_R_QUOTA) and therefore brings no additional
value.
2022-06-14 13:13:32 +02:00
Michał Kępień
ccee3507c2 Check recursions at the end of request processing
ns_client_endrequest() currently contains code that looks for
outstanding quota references and cleans them up if necessary.  This
approach masks programming errors because ns_client_endrequest() is only
called from ns__client_reset_cb(), which in turn is only called when all
references to the client's netmgr handle are released, which in turn
only happens after all recursion completion callbacks are invoked
(because isc_nmhandle_attach() is called before every call to
dns_resolver_createfetch() in lib/ns/query.c and the completion callback
is expected to detach from the handle), which in turn is expected to
happen for all recursions attempts, even those that get canceled.

Furthermore, declaring the prototype of ns_client_endrequest() at the
top of lib/ns/client.c is redundant because the definition of that
function is placed before its first use in that file.  Remove the
redundant function prototype.

Finally, remove INSIST assertions ensuring quota pointers are NULL in
ns__client_reset_cb() because the latter calls ns_client_endrequest() a
few lines earlier.
2022-06-14 13:13:32 +02:00
Michał Kępień
e0be643f50 Make async hooks code use the 'recursions' array
Async hooks are the last feature using the client->fetchhandle and
client->query.fetch pointers.  Update ns_query_hookasync() and
query_hookresume() so that they use a dedicated slot in the 'recursions'
array.  Note that async hooks are still not expected to initiate
recursion if one was already started by a prior ns_query_recurse() call,
so the REQUIRE assertion in ns_query_hookasync() needs to check the
RECTYPE_NORMAL slot rather than the RECTYPE_HOOK one.
2022-06-14 13:13:32 +02:00
Michał Kępień
0fd787c8b8 Enable ns_query_t to track multiple recursions
When a client waits for a prefetch- or RPZ-triggered recursion to
complete, its netmgr handle is attached to client->prefetchhandle and a
reference to the resolver fetch is stored in client->query.prefetch.
Both of these features use the same fields mentioned above.  This makes
the code fragile and hard to follow as its logically distinct parts
become intertwined for no obvious reason.

Furthermore, storing pointers related to a specific recursion process in
two different structures makes their purpose harder to grasp than it has
to be.

To alleviate the problem, extend ns_query_t with an array of structures
containing recursion-related pointers.  Each feature able to initiate
recursion is supposed to use its own slot in that array, allowing
logically unrelated code paths to be untangled.  Prefetch and RPZ will
be the first users of that array.

Define helper macros for accessing specific recursion-related pointers
in order to improve code readability.
2022-06-14 13:13:32 +02:00
Michał Kępień
e09b36f2cc Adjust recursion quota when starting a fetch fails
Some functions fail to detach from the recursion quota if an error
occurs while initiating recursion.  This causes the recursive client
counter to be off.  Add missing recursionquota_detach() calls, reworking
cleanup code where appropriate.
2022-06-14 13:13:32 +02:00
Michał Kępień
af6fcf5641 Make resolver glue code use the 'recursions' array
With prefetch and RPZ code updated to use separate slots in the
'recursions' array, the code responsible for starting recursion in
ns_query_recurse() and resuming query handling in fetch_callback()
should follow suit, so that it does not need to explicitly cooperate
with other code paths that may initiate recursion.

Replace:

  - client->fetchhandle with HANDLE_RECTYPE_NORMAL(client)
  - client->query.fetch with FETCH_RECTYPE_NORMAL(client)

Also update other functions using client->fetchhandle and
client->query.fetch (ns_query_cancel(), query_usestale()) so that those
two fields can shortly be dropped altogether.
2022-06-14 13:13:32 +02:00
Michał Kępień
76070fbf33 Simplify client->query initialization
Initialize client->query using a compound literal in order to make the
ns_query_init() function shorter and more readable.  This also prevents
the need to explicitly initialize any newly added fields in the future.
2022-06-14 13:13:32 +02:00