Commit graph

11565 commits

Author SHA1 Message Date
Aram Sargsyan
4d723c76b1 Add a a tcp system test case
The new test sends a 64 KiB message over TCP to named, and expects
it to handle it correctly.
2023-08-24 11:59:57 +00:00
Tony Finch
6271f3c054
Fix the style of an array de-allocation in dnssec-cds
Mention the element size explicitly, so that `matching_sigs()`,
`signed_loose()`, and `signed_strict()` use the same calculation.
2023-08-23 14:49:15 +02:00
Tony Finch
1d341096c1
Get rid of unnecessary macros in the system test dyndb driver
CHECKED_MEM_GET and ZERO_PTR are built-in features of isc_mem.
2023-08-23 14:49:15 +02:00
Tom Krizek
40289d5440
Allow re-runs of rrl system test
The rrl system test has been unstable and producing false positive
results for years (GL #172). Allow the test to be re-run (once) to
reduce the noise it causes.
2023-08-23 14:06:20 +02:00
Tom Krizek
8c5833fe39
Allow re-runs of reclimit system test
The reclimit system test has been unstable and producing false positive
results for years (GL #1587). Allow the test to be re-run (once) to
reduce the noise it causes.
2023-08-23 14:06:20 +02:00
Tom Krizek
be2123a8e9
Allow re-runs of qmin system test
The qmin test is inherently unstable. It fails quite often with failure
modes described in GL #904. Allow the pytest runner to re-run the test
up to 3 times to only detect a more persistent and reproducible failures
rather than random noise caused by the nature of the test.
2023-08-23 14:06:20 +02:00
Tom Krizek
7522583b57
Disable loadtime check in statschannel test
It is better to disable the specific check that causes the test to fail
rather than mark the entire test as xfail, which can mask other issues
which the test is capable of detecting.
2023-08-23 14:06:20 +02:00
Tom Krizek
1b3db25adf
Clean up pytest .gitignore file
The _last_test_run entry was accidentally added in !8194. It came from a
work-in-progress version of the MR and was left there during a rebase.
2023-08-23 14:06:20 +02:00
Tom Krizek
0361233b3d
Skip checkds test on Python<3.7
checkds test requires the capture_output argument for subprocess.run()
which was added in Python 3.7.
2023-08-23 14:06:18 +02:00
Matthijs Mekking
6502240442 Don't do DoT SOA requests for default servers
Default servers usually don't have DoT set up. Only do SOA queries if
the server is specified.
2023-08-23 09:56:38 +02:00
Tom Krizek
145bec51a0
Resolve scan-build issue in dummylib.c
Value stored to 'rdatap' is never read. Remove the line which has no
effect.
2023-08-21 20:04:50 +02:00
Tom Krizek
21980b43b8
Compile system test binaries during make
Using check_PROGRAMS would postpone compiling the binaries needed by
system tests until `make check` would be called. Since it's preferable
to invoke pytest directly to run the system test suite, compile these
binaries without installing them during `make all` instead by using
noinst_PROGRAMS.

This removes the need to use TESTS= make -e check hack invoked from
pytest to work around this issue.
2023-08-21 20:04:48 +02:00
Ondřej Surý
784d055809
Add support for User Statically Defined Tracing (USDT) probes
This adds support for User Statically Defined Tracing (USDT).  On
Linux, this uses the header from SystemTap and dtrace utility, but the
support is universal as long as dtrace is available.

Also add the required infrastructure to add probes to libisc, libdns and
libns libraries, where most of the probes will be.
2023-08-21 18:39:53 +02:00
Tom Krizek
355dc73391
.gitignore temporary directories and symlinks in system test dir 2023-08-21 15:54:40 +02:00
Tom Krizek
d66ff81543
Add clean-local target to clean pytest runner artifacts
The command finds all directories in bin/tests/system which contain an
underscore. Underscore indicates either a temporary directory (_tmp_), a
symlink to test artifacts (TESTNAME_MODULENAME), or a python-related
cache. Using underscore for a system test name is invalid and a hyphen
must be used instead.
2023-08-21 15:54:40 +02:00
Tom Krizek
83ddca7690
Silence pylint's refactoring suggestions for system_test_dir()
While it'd be fairly easy to split the function up into smaller ones,
the readability wouldn't be improved in this case. Silence the
suggestions instead.
2023-08-21 15:54:40 +02:00
Tom Krizek
f91d0b13e8
Improve tempdir logging for pytest runner
At the end of the test, display the symlink path to the artifact
directory in case it's preserved. Log the full tempdir name in debug
log.
2023-08-21 15:54:40 +02:00
Tom Krizek
e1ca5c8071
Create symlinks to test artifacts for pytest runner
While temporary directories are useful for test execution to keep
everything clean, they are difficult to work with manually. Create a
symlink for each test artifact directory with a stable and predictable
path. The symlink always either points to the latest artifacts, or is
missing in case the last run succeeded.

Ensure these symlinked directories aren't detected as test suites by the
pytest runner.
2023-08-21 15:54:38 +02:00
Tom Krizek
b1a9d1fe25
Improve pytest message when sanitizer report is found 2023-08-21 15:12:53 +02:00
Tony Finch
26e10e8fb5
Parse statschannel Content-Length: more carefully
A negative or excessively large Content-Length could cause a crash
by making `INSIST(httpd->consume != 0)` fail.
2023-08-21 14:14:18 +02:00
Michal Nowak
681b23c398
Mark test_send_timeout as flaky
In some cases, BIND is not fast enough to fill the send buffer and
manages to answer all queries, contrary to what the test expects.
Repeat the check up to 3 times to limit this test instability.
2023-08-17 14:13:59 +02:00
Tom Krizek
5b703de733
Add custom flaky decorator to handle unstable tests
If the flaky plugin for pytest is available, use its decorator to
support re-running unstable tests. In case the package is missing,
execute the test as usual without attempts to re-run it in case of
failure.

This is mostly intended to increase the test stability in CI. Using a
custom decorator enables us to keep the flaky package as an optional
dependency.
2023-08-17 14:13:59 +02:00
Michal Nowak
8a0da13479
Clean leftover files in autosign and masterformat
The following files were reported in CI by the legacy system test runner
and prevented job to pass. They should be removed.

    $ if git rev-parse > /dev/null 2>&1; then ( ! grep "^I:.*:file.*not removed$" *.log ); fi
    autosign.log:I:autosign:file autosign/ns3/kskonly.example.db.jbk not removed
    autosign.log:I:autosign:file autosign/ns3/optout.example.db.jbk not removed
    autosign.log:I:autosign:file autosign/ns3/reconf.example.db.jbk not removed
    masterformat.log:I:masterformat:file masterformat/ns1/signed.db.raw.jbk not removed
    masterformat.log:I:masterformat:file masterformat/ns1/signed.db.raw.signed not removed
    masterformat.log:I:masterformat:file masterformat/ns1/signed.db.raw.signed.jnl not removed

Don't print an error when the ns*/inactive directory is not
present:

    rmdir: ns*/inactive: No such file or directory

Remove nsupdate.out.test file instead of nsupdate.out, as the latter
does not exist.
2023-08-16 12:01:11 +02:00
Ondřej Surý
d76ab69772 Attach to the dns_dispatchmgr in the dns_view object
The dns_dispatchmgr object was only set in the dns_view object making it
prone to use-after-free in the dns_xfrin unit when shutting down named.

Remove dns_view_setdispatchmgr() and optionally pass the dispatchmgr
directly to dns_view_create() when it is attached and not just assigned,
so the dns_dispatchmgr doesn't cease to exist too early.

The dns_view_getdnsdispatchmgr() is now protected by the RCU lock, the
dispatchmgr reference is incremented, so the caller needs to detach from
it, and the function can return NULL in case the dns_view has been
already shut down.
2023-08-15 10:25:37 -07:00
Evan Hunt
b466439437
use a qp-trie for the keytable
Instead of an RBT for the trust anchor tables, use a QP-trie.
2023-08-15 14:25:24 +02:00
Evan Hunt
dea79e7053
use a qp-trie for the forwarders table
Instead of an RBT for the forwarders table, use a QP trie.

We now use reference counting for dns_forwarders_t. When a forwarders
object is retrieved by dns_fwdtable_find(), it must now be explicitly
detached by the caller afterward.

QP tries require stored objects to include their names, so the
the forwarders object now has that. This obviates the need to
pass back a separate 'foundname' value from dns_fwdtable_find().
2023-08-15 14:25:24 +02:00
Evan Hunt
aff01bda54
use a qp-trie for the NTA table
replace the red-black tree used by the negative trust anchor table
with a QP trie.

because of this change, dns_ntatable_init() can no longer fail, and
neither can dns_view_initntatable(). these functions have both been
changed to type void.
2023-08-15 14:24:46 +02:00
Tony Finch
c622b349e4
Apply the SET_IF_NOT_NULL() semantic patch
spatch --sp-file cocci/set_if_not_null.spatch --use-gitgrep --dir "." --include-headers --in-place
2023-08-15 12:21:41 +02:00
Mark Andrews
7da47fd858 Remove bind9.xsl.1, bind9.xsl.2 and bind9.xsl.3 2023-08-15 10:34:19 +10:00
Mark Andrews
40e3529379 Add sleeps so that the modification time changes
The mkeys system test could fail because root zone was resigned
within the same second as it was previously signed causing reloads
to fail.  Add delays to the test to prevent this.
2023-08-14 22:49:16 +00:00
Tony Finch
b22c87ca61
Fix a stack buffer overflow in the statistics channel
A long timestamp in an If-Modified-Since header could overflow a
fixed-size buffer.
2023-08-14 11:30:24 +02:00
Mark Andrews
1394f12a1c Fix 'addr', 'ckresult' and 'drop' functions
'addr', 'ckresult' and 'drop' should return 0 rather than 1 after
calling 'setret' as the error has been logged and these functions
are not expect to fail.
2023-08-09 10:45:38 +10:00
Michał Kępień
08a8906cfc
Convert setup.pl into static configurations
The setup.pl script has been replaced with static BIND configurations,
and in the course of this change, the unused ns1 server was removed.
This enhancement has greatly improved the overall test's readability.
2023-08-08 10:31:45 +02:00
Michal Nowak
ecd7b30d0a
Rewrite stress test to pytest
The shell version of the test was completed only after all DNS zone
updates were sent, even if the BIND server crashed while processing
them, leading to prolonged execution and potential hang in the CI
environment. The Python rewrite of the test ensures that DNS update
tasks finish within five minutes of starting, irrespective of a BIND
crash possibility or DNS zone updates not finishing in time.
2023-08-08 10:31:45 +02:00
Michał Kępień
67df78e518
Lower the minimum expected dnstap output file size
Lower the size requirement for the dnstap output file produced during
the "dnstap" system test from 454 to 450 bytes; while files of that size
are not generated in any GitLab CI job, they are in other environments
where the test passes.
2023-08-07 11:26:58 +02:00
Michał Kępień
26d3d97f12
Wait until fstrm_capture is ready
The fstrm_capture utility is started in the background during the
"dnstap" system test.  Consequently, "rndc dnstap-reopen" and similar
commands may be executed before fstrm_capture starts listening on the
Unix domain socket it is configured to receive dnstap data on.  This
results in the dnstap data sent to that socket in the meantime to be
lost; while the fstrm writer thread is able to recover from such a
scenario within a couple of seconds (by reopening the configured dnstap
destination itself), only one write attempt is made for data
successfully queued to the writer thread, so dnstap frames can still be
lost in the process.  This may happen during the "dnstap" system test,
leading to the dnstap output file being empty, which in turn causes the
test to fail.

Fix by waiting until fstrm_capture starts listening on the Unix domain
socket it is configured to use before asking named to reopen the
configured dnstap destination.  Since various fstrm_capture versions log
different messages when the listening socket is set up, wait for a
common string that works for all fstrm_capture versions released to
date.  Add a few extra debug messages indicating test progress and make
the test fail if the expected fstrm_capture log message is not generated
within 10 seconds.
2023-08-07 11:26:58 +02:00
Michał Kępień
bd2941fc72
Capture all fstrm_capture output
The fstrm_capture.out file is overwritten when the fstrm_capture utility
is restarted during the "dnstap" system test.  Use a separate output
file for each fstrm_capture instance to ensure all output produced by
that tool during the "dnstap" system test is preserved for forensic
purposes.
2023-08-07 11:26:58 +02:00
Mark Andrews
287a1ac09b Set ret=1 if _wait_for_stats does not succeed
Errors getting transfer statistics from named.run where not detected
as ret was not set to one if there hadn't been a success after looping
for a while.
2023-08-07 08:49:47 +00:00
Evan Hunt
eeeccec67c deprecate "dialup" and "heartbeat-interval"
these options concentrate zone maintenance actions into
bursts for the benefit of servers with intermittent connections.
that's no longer something we really need to optimize.
2023-08-01 18:10:44 -07:00
Mark Andrews
dd74840291 Add sleep 1 so that the signing happens in a different second 2023-08-01 23:47:55 +00:00
Mark Andrews
162db75e2b Use $() instead of backticks 2023-08-01 23:47:55 +00:00
Mark Andrews
6d0f19da7d Correctly grep nextpart output 2023-08-01 23:47:55 +00:00
Mark Andrews
96f75bba18 Use sub shell to isolate enviroment changes
'HOME=value command' should only change HOME for command but on
some platforms this occasionally sets HOME for the rest of the
test. Explicitly isolate the enviroment change using a sub shell.
2023-08-01 23:17:15 +00:00
Aram Sargsyan
77d1476c46 Fix dig help message typo in the http-plain-get option
The option name is misspelled as 'https-plain-get'. Fix the error.
2023-08-01 10:38:44 +00:00
Matthijs Mekking
dc6dafdad1 Ignore max-zone-ttl on dnssec-policy insecure
Allow larger TTL values in zones that go insecure. This is necessary
because otherwise the zone will not be loaded due to the max-zone-ttl
of P1D that is part of the current insecure policy.

In the keymgr.c code, default back to P1D if the max-zone-ttl is set
to zero.
2023-08-01 08:56:52 +02:00
Matthijs Mekking
62ddc3dca0 Remove redundant inline-signing lines from tests
Now that inline-signing is explicitly set in dnssec-policy, remove
the redundant "inline-signing yes;" lines from the system tests.
2023-08-01 06:55:48 +00:00
Matthijs Mekking
495597a91b Update inline-signing checkconf code
When using automated DNSSEC management, it is required that the zone
is dynamic, or that inline-signing is enabled (or both). Update the
checkconf code to also allow inline-signing to be enabled within
dnssec-policy.
2023-08-01 06:55:48 +00:00
Matthijs Mekking
bbfdcc36c8 Add inline-signing to dnssec-policy
Add an option to enable/disable inline-signing inside the
dnssec-policy clause. The existing inline-signing option that is
set in the zone clause takes priority, but if it is omitted, then the
value that is set in dnssec-policy is taken.

The built-in policies use inline-signing.

This means that if you want to use the default policy without
inline-signing you either have to set it explicitly in the zone
clause:

    zone "example" {
        ...
        dnssec-policy default;
        inline-signing no;
    };

Or create a new policy, only overriding the inline-signing option:

    dnssec-policy "default-dynamic" {
        inline-signing no;
    };

    zone "example" {
        ...
        dnssec-policy default-dynamic;
    };

This also means that if you are going insecure with a dynamic zone,
the built-in "insecure" policy needs to be accompanied with
"inline-signing no;".
2023-08-01 06:55:48 +00:00
Štěpán Balážik
10194baa07
Fix ecdsa256 check in ecdsa system test setup
Probably by copy-paste mistake, ecdsa384 was checked twice.
2023-07-28 09:13:39 +02:00
Ondřej Surý
4ca64c1799
Pin dns_request to the associated loop
When dns_request was canceled via dns_requestmgr_shutdown() the cancel
event would be propagated on different loop (loop 0) than the loop where
request was created on.  In turn this would propagate down to isc_netmgr
where we require all the events to be called from the matching isc_loop.

Pin the dns_requests to the loops and ensure that all the events are
called on the associated loop.  This in turn allows us to remove the
hashed locks on the requests and change the single .requests list to be
a per-loop list for the request accounting.

Additionally, do some extra cleanup because some race condititions are
now not possible as all events on the dns_request are serialized.
2023-07-28 09:01:22 +02:00