Commit graph

12649 commits

Author SHA1 Message Date
Nicki Křížek
64199e062d Isolate rollover-zsk-prepub test case 2025-07-18 13:37:58 +02:00
Nicki Křížek
bc7be041e1 Isolate rollover-ksk-3crowd test case 2025-07-18 13:37:58 +02:00
Nicki Křížek
d6dffe6603 Use common test functions for three-is-a-crowd test
Previously, a lot of the checking was re-implemented and duplicated from
check_rollover_step(). Use that function where possible and only
override the needed checks.
2025-07-18 13:37:58 +02:00
Nicki Křížek
bd5a55c5b7 Isolate rollover-ksk-doubleksk test case 2025-07-18 13:37:58 +02:00
Nicki Křížek
296cfc8363 Isolate rollover-csk-roll1 test case 2025-07-18 13:37:58 +02:00
Nicki Křížek
9d2bd1b646 Isolate rollover-csk-roll2 test case 2025-07-18 13:37:58 +02:00
Nicki Křížek
fdecef5378 Isolate rollover-algo-csk test 2025-07-18 13:37:58 +02:00
Nicki Křížek
8be9a8b52a Isolate rollover-algo-ksk-zsk test 2025-07-18 13:37:58 +02:00
Nicki Křížek
519f9082df Isolate rollover-straight2none test 2025-07-18 13:37:58 +02:00
Nicki Křížek
a9c70c3e26 Isolate rollover-lifetime test 2025-07-18 13:37:58 +02:00
Nicki Křížek
7001056eab Isolate rollover-going-insecure test case 2025-07-18 13:37:58 +02:00
Nicki Křížek
8503a218c3 Isolate rollover-dynamic2inline test 2025-07-18 13:37:58 +02:00
Nicki Křížek
44dd5b3240 Separate common templates and test code for rollover tests
This is a preparation to split up and further isolate the various
rollover tests in a subsequent commits.
2025-07-18 13:37:58 +02:00
Nicki Křížek
b410710354 Move shared test code into isctest.kasp module
Move key calculations and rollover step checks into the shared
isctest.kasp module. Deduplicate the key interval calculations.
2025-07-18 13:37:58 +02:00
Nicki Křížek
784a252425 Use a single named.conf template in rollover test
Rather than using multiple slightly modified named.conf files, use a
single template which can be rendered differently based on an input
argument -- in this case, csk_roll.
2025-07-18 13:37:58 +02:00
Nicki Křížek
f076d0d619 Refactor configloading test
- Use WatchLog.wait_for_sequence() for the configloading test.
- Omit artifacts check, as it seems quite useless for this test case.
- Join all the tests together. The test case is fairly simple here and
  this is the easiest way to ensure the log will be in a predictable
  state for all tests. Previously, there was no way to ensure
  test_configloading_loading() won't be executed after the other tests,
  which would render the check moot. It could also be separated into
  its own module, but that seems excessive for a simple test case like
  this.
- Use jinja2 template for named.conf and remove setup.sh.
- Remove README and put the relevent comment directly next to the test.
- Remove _sh_ from the test filename to uphold the naming convention.
2025-07-18 12:13:30 +02:00
Nicki Křížek
d737986ea2 Turn on doctest in CI
Run doctests for the isctest module in a dedicated CI job.
2025-07-18 11:32:41 +02:00
Nicki Křížek
dcfb6c23da Change NamedInstance.rndc() doctest into doc example
The test is troublesome, because NamedInstance(identifier) expects that
a directory with such a name exists. While it'd be possible to mock
those directories as well, it'd make the doctest overly long and
complex, which isn't justified, given that it's only testing a couple of
options. Turn it into regular documentation instead.
2025-07-18 11:32:41 +02:00
Nicki Křížek
ee782fb4b1 Separate LineReader functionality from WatchLog
The buffered reading of finished lines deserves its own class to make
its function clearer, rather than bundling it within the WatchLog class.

Co-Authored-By: Michał Kępień <michal@isc.org>
2025-07-18 11:32:41 +02:00
Nicki Křížek
3c8432d196 Refactor WatchLog for better readability
Various improvements for typing, naming, code deduplication and better
code organization to make the code easier to read.
2025-07-18 11:32:41 +02:00
Nicki Křížek
628b47dd30 Use custom WatchLog timeout exception
The TimeoutError is raised when system functions time out. Define a
custom WatchLogTimeout to improve clarity.
2025-07-18 11:32:41 +02:00
Nicki Křížek
0a839cd0bd Add wait_for_all() and wait_for_sequence() to WatchLog
Extend the WatchLog API with a couple of new matching options.

wait_for_sequence() can be used to check a specific sequence of lines
appears in the log file in the given order.

wait_for_all() ensure that all the provided patterns appear in the log
at least once.

Co-authored-by: Colin Vidal <colin@isc.org>
2025-07-18 11:32:41 +02:00
Nicki Křížek
365f8b6af6 Split up waiting for match to a separate WatchLog method
To allow re-use in upcoming functions, isolate the line matching logic
into a separate function. Use an instance-wide deadline attribute, which
is set by the calling function.
2025-07-18 11:32:41 +02:00
Nicki Křížek
2afb3755b2 Allow WatchLog.wait_for_line() to be called more than once
In some cases, it can be useful to be able to re-use the same WatchLog
to wait for another line.
2025-07-18 11:32:41 +02:00
Nicki Křížek
5840908ead Unify the WatchLog.wait_for_line/s() API
Rather than using two distinct functions for matching either one pattern
(wait_for_line()), or any of multiple patterns (wait_for_lines()), use a
single function that handles both in the same way.

Extend the wait_for_line() API:
1. To allow for usage of one or more FlexPatterns, i.e. either plain
   strings to be matched verbatim, or regular expressions. Both can be
   used interchangeably to provide the caller to write simple and
   readable test code, while allowing for increased complexity to allow
   special cases.
2. Always return the regex match, which allows the caller to identify
   which line was matched, as well as to extract any additional
   information, such as individual regex groups.
2025-07-18 11:32:41 +02:00
Nicki Křížek
f2679bff19 Set timeout for WatchLog per-instance rather than per-call
To simplify usage of multiple wait_for_*() calls, configure the timeout
value for the WatchLog instance, rather than specifying it for each
call.

This is a preparation/cleanup for implementing multiple wait_for_*()
calls in subsequent commits.
2025-07-18 11:32:41 +02:00
Nicki Křížek
67896ddde2 Abstract WatchLog line buffering to a separate function
Move the line buffering functionality into _readline() to improve the
readability of code. This also allows reading the file contents from
other functions, since the line buffer is now an attribute of the class.
2025-07-18 11:32:41 +02:00
Colin Vidal
9778068253 fix watchlog.py doctest
Fix some broken doctest in watchlog.py (no semantic error, but API
slightly changed and broke some output messags). Also add a test for a
missing failure case.
2025-07-18 11:32:40 +02:00
Alessio Podda
fdbcdcfc06 Remove unused link field from rdatacommon
The field link in rdatacommon is unused. This change should save 16
bytes for each rdata we create.
2025-07-17 12:57:51 +02:00
Štěpán Balážik
c2b800a552 Remove contrib/scripts
The scripts are ancient, trivial and/or unmaintained.
Since switching to Meson, we don't even build `*.in` ones.
2025-07-17 07:17:12 +02:00
Mark Andrews
7ba91e3820 Fix ifconfig.sh script
Add missing test for the variable 'a' being empty on linux.
2025-07-17 07:36:40 +10:00
Mark Andrews
1a82a1999b Remove leftover test development echo 2025-07-15 23:53:57 +10:00
Mark Andrews
370d28de97 Redirect named-checkzone output to file 2025-07-15 23:53:57 +10:00
Mark Andrews
86fb638085 Check deprecated algorithms in dnssec-policy 2025-07-15 23:53:57 +10:00
Mark Andrews
95a82d0893 Check that named-checkzone reports deprecated digests 2025-07-15 23:53:57 +10:00
Mark Andrews
5d406677f1 Check that named-checkzone reports deprecated algorithms 2025-07-15 23:53:57 +10:00
Mark Andrews
1e3e61ba53 Update man pages for deprecated algorithms 2025-07-15 23:53:57 +10:00
Mark Andrews
cb6903c55e Warn about deprecated DNSKEY and DS algorithms / digest types
DNSKEY algorithms RSASHA1 and RSASHA-NSEC3-SHA1 and DS digest type
SHA1 are deprecated.  Log when these are present in primary zone
files and when generating new DNSKEYs, DS and CDS records.
2025-07-15 23:53:57 +10:00
Štěpán Balážik
e34e831cab Use isctest.asyncserver in the "tsig" test
Replace the custom DNS server used in the "tsig" system test with
new code based on the isctest.asyncserver module.
2025-07-13 10:57:04 +02:00
Štěpán Balážik
72ac1fe234 Let queries with TSIG parse in isctest.asyncserver.AsyncDnsServer
Previously, upon receiving a query with TSIG, the server would log
an error and timeout. As there is no way to set up the keyring in the
class anyway (and I believe we don't need it), this commit lets such
queries parse but logs the fact that the query has TSIG.

However, there is a bug [1] in dnspython, which causes `make_response`
and `to_wire` to crash on messages constructed by `from_wire` with
`keyring=False`, so the hack with `message.__class__` is needed to work
around this.

This makes just enough changes for the tsig system test to work with
dnspython >= 2.0.0. On older version the server gives up.

[1] https://github.com/rthalley/dnspython/issues/1205
2025-07-13 10:57:04 +02:00
Nicki Křížek
927dc5bc2b Check for FEATURETEST before running pytest
When compiling with meson, it may be easy to forget to compile system
test dependencies before running the tests. In that case, the test
results would be quite incosistent and unpredictable, with some tests
ending up with ERROR, some with FAILURE and others PASS, without a clear
indication that something is off before running the entire machinery.

Add a check to fail early on if the FEATURETEST binary isn't available,
indicating that system test dependencies were most likely not compiled.
2025-07-10 17:13:05 +02:00
Aram Sargsyan
5d1a8fe755 Fix a possible hang in dig if a send is interrupted/canceled
When send_done() is called with a ISC_R_CANCELED status (e.g. because
of a signal from ctrl+c), dig can fail to shutdown because
check_if_done() is not called in the branch. Add a check_if_done()
call.
2025-07-10 11:16:45 +00:00
Aram Sargsyan
a2685696aa Fix a query reference counting issue in dig
When reusing a TCP connection (because of the '+keepopen' option),
dig detaches from the query after launching it. This can cause a
crash in dig in rare cases when the "receive" callback is called
earlier than the "send" callback.

The '_cancel_lookup()' function detaches a query only if it's
found in the 'lookup->q' list. Before this commit, with one
additional detach happening before recv_done() -> _cancel_lookup()
is called, it didn't cause problems because an earlier _query_detach()
was unlinking the query from 'lookup->q' (because it was the last
reference), so the additional detach and the skipped detach were
undoing each other.

That is unless the "receive" callback was called earlier than the
"send" callback, in which case the additional detach wasn't destroying
the query (and wasn't unlinking it from 'lookup->q') because the "send"
callback's attachment was still there, and so _cancel_lookup() was
trying to "steal" the "send" callback's attachment and causing an
assertion on 'INSIST(query->sendhandle == NULL);'.

Delete the detachment which caused the described situation.
2025-07-10 11:16:45 +00:00
Petr Špaček
750d8a61b6 Convert DNS_RDATASETATTR_ bitfield manipulation to struct of bools
RRset ordering is now an enum inside struct rdataset attributes. This
was done to keep size to of the structure to its original value before
this MR.

I expect zero performance impact but it should be easier to deal with
attributes in debuggers and language servers.
2025-07-10 11:17:19 +02:00
Alessio Podda
e84704bd55 Improve efficiency of ns_client_t reset
The ns_client_t struct is reset and zero-ed out on every query,
but some fields (query, message, manager) are preserved.

We observe two things:
 - The sendbuf field is going to be overwritten anyway, there's
   no need to zero it out.
 - The fields are copied out when the struct is zero-ed out, and
   then copied back in. For the query field (which is 896 bytes)
   this is very inefficient.

This commit makes the reset more efficient avoiding to unnecessary
zero-ing and copy.
2025-07-10 07:19:47 +02:00
Mark Andrews
28a8933690 Use native shared library extension
For most platforms this is ".so" but for Darwin it is ".dylib".
2025-07-07 23:39:44 +10:00
Nicki Křížek
b98660e93e Remove unstable check from digdelv test
The code which checks for both IPv4 and IPv6 mixed usage is inherently
unstable, since the address family is chosen randomly for each
connection.

Closes #5406
2025-07-07 13:29:15 +02:00
Nicki Křížek
4c487c811d Use pytest.mark.flaky as the flaky marker
It's possible to use pytest.mark.flaky, which achieves the exact same
thing as our custom-defined isctest.mark.flaky -- attempts to rerun the
test on failure, but only is flaky package is available.
2025-07-07 13:29:15 +02:00
Nicki Křížek
126a59cef2 Mark secondary.kasp test case as flaky on freebsd13
The test_kasp_case[secondary.kasp] can sometimes fail on freebsd13. It
appears the test gets stuck on some operation which should be very
quick, but for some reason takes at least a few seconds, causing the
cb_ixfr_is_signed() function to time out.

In one of the cases I investigated, it wasn't a query/response that
caused a timeout, but rather some operation in between. The test
attempts to read from a keyfile/statefile, but I see no reason why that
should block.

In any case, try to increase the timeout for the verification, as that
shouldn't hurt. Also allow the test to be re-run on freebsd13, as it's
likely to be caused by some odd behaviour on that platform -- the issue
doesn't appear anywhere else.
2025-07-07 13:29:15 +02:00
Nicki Křížek
34867e1693 Allow dnstap system test rerun on freebsd13
The check "unix socket message counts" sometimes fails with "dnstap
output file smaller than expected". This only happens on freebsd13 and
can't be reproduced easily. There was an attempt to decrease the
required file size in the past, but apparently, the issue can still
occur.
2025-07-07 13:29:15 +02:00