Commit Graph

37145 Commits

Author SHA1 Message Date
Aram Sargsyan
5e57ffbd51 Fix DiG "timed out" message check in "legacy" system test
The test expects a "connection timed out" message from DiG when it
experiences a timeout, while the current version of DiG prints just
a "timed out" message, like below:

    ;; communications error to 10.53.0.1#11314: timed out
    ;; communications error to 10.53.0.1#11314: timed out
    ;; communications error to 10.53.0.1#11314: timed out

    ; <<>> DiG 9.19.9-dev <<>> -p 11314 +tries +time +tcp +tries +time @10.53.0.1 dropedns. TXT
    ; (1 server found)
    ;; global options: +cmd
    ;; no servers could be reached

Change the expected string to match the current DiG output.

Use the '-F' switch for "grep" for matching a fixed string.

(cherry picked from commit 35988748f3)
2022-12-21 14:32:18 +00:00
Tom Krizek
e64dbb578b Merge branch 'tkrizek/system-tests-conventions-v9_18' into 'v9_18'
[9.18] Unify system tests naming conventions

See merge request isc-projects/bind9!7257
2022-12-21 13:44:34 +00:00
Tom Krizek
3c29317ad3 Update tests gitignore file
The .mypy_cache was added to the system test dir gitignore, since it
should be ignored.

(cherry picked from commit 4145068bfa)
2022-12-21 14:02:47 +01:00
Tom Krizek
873feb0c53 Rename engine_pkcs11 system test
In order to have a common naming convention for system tests, rename the
only outlier "engine_pkcs11" to "enginepkcs11", which was the only
system test using an underscore in its name.

The only allowed word separators for system test names are either dash
or no separator.

(cherry picked from commit 62eea511db)
2022-12-21 14:02:47 +01:00
Tom Krizek
4652da6caf Use common name convention for pytest files
It is better to use consistent file names to avoid issue with sorting
etc.

Using underscore in filenames as opposed to dash was chosen because it
seems more common in pytest/python to use underscore for filenames.

Also rename the bin/tests/system/timeouts/tests-tcp.py file to
bin/tests/system/timeouts/tests_tcp_timeouts.py to avoid pytest name
collision (there can't be two files named tests_tcp.py).

(cherry picked from commit f6409ee6ac)
2022-12-21 14:02:45 +01:00
Ondřej Surý
6fd6686865 Merge branch '3178-dispatch-race-v9_18' into 'v9_18'
[9.18] Fix the thread safety in the dns_dispatch unit

See merge request isc-projects/bind9!7251
2022-12-21 12:41:22 +00:00
Ondřej Surý
3492dc2f0e Add CHANGES and release note for [GL #3178] and [GL #3636]
(cherry picked from commit 2df311eb21)
2022-12-21 12:41:15 +00:00
Ondřej Surý
be3cf85cfe Call the connected dns_dispatch callback asynchronously
The dns_request code is very sensitive about calling the connected and
deadlocks when the timing is "right" in several places.  Move the call
to the connected callback to the (udp|tcp)_connected() functions, so
they are called asynchronously instead of directly from
the (udp|tcp)_dispentry_cancel() functions.

(cherry picked from commit 9dd8deaf01)
2022-12-21 12:41:15 +00:00
Ondřej Surý
87ad3ecaf0 Ignore TCP dispatches that have zero references
The TCP dispatches are removed from the dispatchmgr->list in the
dispatch_destroy() and there's a brief period of time where
dns_dispatch_gettcp() can find a dispatch in connected state that's
being destroyed.

Set the dispatch state to DNS_DISPATCHSTATE_NONE in the TCP connection
callback if there are no responses waiting, and ignore TCP dispatches
with zero references in dns_dispatch_gettcp().

(cherry picked from commit 3fac4ca57e)
2022-12-21 12:41:15 +00:00
Ondřej Surý
3f4970da1a Fix assignment vs comparison typo in tcp_connected()
In tcp_connected() a typo has turned a DbC check into an assignment
breaking the state machine and making the dns_dispatch_gettcp() try to
attach to dispatch in process of destruction.
2022-12-21 12:41:15 +00:00
Ondřej Surý
b714033731 Don't remove dispatches in CANCELED state from the list
In dns_dispatch_gettcp(), we can't remove canceled dispatches from the
mgr->list because ISC_LIST_NEXT() would fail in the next iteration.
2022-12-21 12:41:15 +00:00
Ondřej Surý
3edccaf0c7 Ignore TCP dispatches in DNS_DISPATCHSTATE_NONE state
The TCP dispatches in DNS_DISPATCHSTATE_NONE could be either very
fresh or those could be dispatches that failed connecting to the
destination.  Ignore them when trying to connect to an existing
TCP dispatch via dns_dispatch_gettcp().
2022-12-21 12:41:15 +00:00
Ondřej Surý
5cc12ab92c 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.

(cherry picked from commit 6f317f27ea)
2022-12-21 12:41:15 +00:00
Ondřej Surý
24847cfd3e Backport ISC_REFCOUNT{,_TRACE}_{DECL,IMPL} macros
Backport macros that can be used to implement generic attach, detach,
ref, and unref functions, so they don't have to be repeated over and
over in each unit that uses reference counting.
2022-12-21 12:41:15 +00:00
Tom Krizek
7009aa9044 Merge branch 'tkrizek/default-alg-fixups-v9_18' into 'v9_18'
[9.18] Fix minor issues with DEFAULT_ALGORITHM selection in system tests

See merge request isc-projects/bind9!7255
2022-12-21 11:43:02 +00:00
Tom Krizek
45b003316f Make Python interpreter required for system tests
This introduces a Python dependency for running system tests. It is
needed in order to:
  - write new test control scripts in Python
  - gradually rewrite old Perl scripts into Python if needed
  - eventually introduce pytest as the new test runner framework

This commit is not intended to be backported to 9.16.

(cherry picked from commit 56416ebd65)
2022-12-21 10:49:33 +01:00
Tom Krizek
efa09a37f3 Make Perl interpreter required for system tests
This change has no practical impact, as Perl was already required for
all system tests, this check only makes it more explicit.

(cherry picked from commit 084d72d1d5)
2022-12-21 10:49:33 +01:00
Tom Krizek
0079745f97 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).

(cherry picked from commit 492992dca8)
2022-12-21 10:49:33 +01:00
Tom Krizek
54a877ef47 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.

(cherry picked from commit ba35a6df9c)
2022-12-21 10:42:10 +01:00
Ondřej Surý
3a78f58c55 Merge branch '3739-adb-cleans-overzealously-under-memory-pressure-v9_18' into 'v9_18'
Exclude the ADB hashmaps from ADB overmem accounting [v9.18]

See merge request isc-projects/bind9!7248
2022-12-19 08:58:27 +00:00
Ondřej Surý
c3f1a0dfff Add CHANGES and release note for [GL #3739]
(cherry picked from commit 11df7f02fd)
2022-12-19 09:26:59 +01:00
Ondřej Surý
146f93ff46 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.

(cherry picked from commit 0b661b6f95)
2022-12-19 09:26:58 +01:00
Ondřej Surý
ecde82689e 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.

(cherry picked from commit 59dee0b078)
2022-12-16 19:22:43 +01:00
Ondřej Surý
25201365a6 Merge branch '3637-try-next-server-on-resolver-timeout-v9_18' into 'v9_18'
Try next server on resolver timeout [v9.18]

See merge request isc-projects/bind9!7249
2022-12-16 18:22:39 +00:00
Ondřej Surý
6ca03d1012 Add CHANGES and release notes for [GL #3637]
(cherry picked from commit d1f1db2f5a)
2022-12-16 18:38:02 +01:00
Ondřej Surý
2cb6001a2e 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.

(cherry picked from commit 32c2acf6fc)
2022-12-16 18:37:22 +01:00
Ondřej Surý
9e8c23be7e 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 c6b4d82557.  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.

(cherry picked from commit b679640950)
2022-12-16 18:37:22 +01:00
Ondřej Surý
095f634f48 Try next server on resolver timeout
Instead of resending to the same server on the (dispatch) timeout in the
resolver, try the next server.

(cherry picked from commit 5466a48fc9)
2022-12-16 18:37:22 +01:00
Tom Krizek
773517960f Merge branch 'tkrizek/danger-backports-v9_18' into 'v9_18'
Check backport workflow in danger CI [v9_18]

See merge request isc-projects/bind9!7245
2022-12-16 13:39:32 +00:00
Tom Krizek
a11bcfa8ba danger: remove obsolete check for cherry pick msg
With proper backport commit detection, this check has been made
redundant.

(cherry picked from commit e8a5ebaee5)
2022-12-16 14:21:10 +01:00
Tom Krizek
90b4441e3e 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.

(cherry picked from commit c617f97784)
2022-12-16 14:21:10 +01:00
Tom Krizek
8ebfcb6b5a 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.

(cherry picked from commit 89530f1a1c)
2022-12-16 14:21:10 +01:00
Tom Krizek
eab1d81072 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

(cherry picked from commit 12e0b05738)
2022-12-16 14:21:10 +01:00
Tom Krizek
cb6ba18aaa 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]).

(cherry picked from commit 14b027cf83)
2022-12-16 14:21:09 +01:00
Tom Krizek
2b5b016f1e danger: support partial backport label
Treat the Backport::Partial label as a backport as well.

(cherry picked from commit 1c0c1ba8b9)
2022-12-16 14:21:07 +01:00
Tony Finch
4d8f551195 Merge branch '3740-rpz-reconfig-v9_18' into 'v9_18'
A couple of RPZ options were not reconfigured as expected

See merge request isc-projects/bind9!7238
2022-12-16 10:15:31 +00:00
Tony Finch
08d0d24d3b 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]

(cherry picked from commit d8a3d328db)
2022-12-16 09:53:01 +00:00
Arаm Sаrgsyаn
61c2337a1e Merge branch '3742-catz-update-log-incorrect-soa-serial-representation-v9_18' into 'v9_18'
[v9_18] Fix an incorrect SOA serial representation in catz

See merge request isc-projects/bind9!7236
2022-12-15 14:27:33 +00:00
Aram Sargsyan
c833de15c0 Add a CHANGES note for [GL #3742]
(cherry picked from commit ac7149aa88)
2022-12-15 13:32:27 +00:00
Aram Sargsyan
19325a228c 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.

(cherry picked from commit 72b1760ea6)
2022-12-15 13:31:30 +00:00
Aram Sargsyan
eae5c06e57 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.

(cherry picked from commit de232ab446)
2022-12-15 13:31:04 +00:00
Artem Boldariev
de9c75a532 Merge branch '3725-mutual-tls-session-resumption-fix-v9-18' into 'v9_18'
[Backport to 9.18] Fix TLS session resumption via IDs when Mutual TLS is used

See merge request isc-projects/bind9!7234
2022-12-14 17:45:52 +00:00
Artem Boldariev
055974a709 Update Release notes [GL #3725]
Mention that TLS session resumption for Mutual TLS has been fixed.

(cherry picked from commit 67d74e228f)
2022-12-14 18:32:32 +02:00
Artem Boldariev
3ce5d6c119 Update CHANGES [GL #3725]
Mention that TLS session resumption for Mutual TLS has been fixed.

(cherry picked from commit d8e04cdbc7)
2022-12-14 18:32:32 +02:00
Artem Boldariev
e903ce1f3e 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.

(cherry picked from commit d5d31c6ba1)
2022-12-14 18:32:32 +02:00
Artem Boldariev
5de938c6cf 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.

(cherry picked from commit 837fef78b1)
2022-12-14 18:32:26 +02:00
Tony Finch
605e714438 Merge branch 'fanf-rsasha236-v9_18' into 'v9_18'
Fix a typo RSASHA236 -> RSASHA256

See merge request isc-projects/bind9!7224
2022-12-14 15:52:06 +00:00
Tony Finch
d2fff95bc0 Fix a typo RSASHA236 -> RSASHA256
Use dns_secalg_format() to avoid error-prone repetition.

(cherry picked from commit c18a9a208d)
2022-12-14 15:51:33 +00:00
Tony Finch
1c68885cee Merge branch 'fanf-dnssec-algorithm-loglevel-v9_18' into 'v9_18'
List supported DNSSEC algorithms at log level NOTICE

See merge request isc-projects/bind9!7226
2022-12-14 12:30:14 +00:00
Tony Finch
24d02d0986 List supported DNSSEC algorithms at log level NOTICE
NOTICE matches the other startup messages. WARNING weirdly
suggests the list is a problem.

(cherry picked from commit 72f8d03cad)
2022-12-14 11:03:48 +00:00