2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00
Commit Graph

4629 Commits

Author SHA1 Message Date
Michal Nowak
093af1c00a Drop $SYSTEMTESTTOP from bin/tests/system/
The $SYSTEMTESTTOP shell variable if often set to .. in various shell
scripts inside bin/tests/system/, but most of the time it is only
used one line later, while sourcing conf.sh. This hardly improves
code readability.

$SYSTEMTESTTOP is also used for the purpose of referencing
scripts/files living in bin/tests/system/, but given that the
variable is always set to a short, relative path, we can drop it and
replace all of its occurrences with the relative path without adversely
affecting code readability.
2020-07-30 15:58:50 +02:00
Michał Kępień
3ef106f69d Only run system tests as root in developer mode
Running system tests with root privileges is potentially dangerous.
Only allow it when explicitly requested (by building with
--enable-developer).
2020-07-30 14:07:49 +02:00
Diego Fronza
c5a4bc8bcc Add test for RPZ wildcard passthru ignored fix 2020-07-24 11:48:14 -07:00
Mark Andrews
78db46d746 Check walking the hip rendezvous servers.
Also fixes extraneous white space at end of record when
there are no rendezvous servers.
2020-07-24 04:15:56 +00:00
Michal Nowak
2064e01cd0 Drop feature test for dlopen()
With libtool being mandatory from 9.17 on, so is dlopen() (via libltdl).
2020-07-21 11:22:13 +02:00
Ondřej Surý
e24bc324b4 Fix the rbt hashtable and grow it when setting max-cache-size
There were several problems with rbt hashtable implementation:

1. Our internal hashing function returns uint64_t value, but it was
   silently truncated to unsigned int in dns_name_hash() and
   dns_name_fullhash() functions.  As the SipHash 2-4 higher bits are
   more random, we need to use the upper half of the return value.

2. The hashtable implementation in rbt.c was using modulo to pick the
   slot number for the hash table.  This has several problems because
   modulo is: a) slow, b) oblivious to patterns in the input data.  This
   could lead to very uneven distribution of the hashed data in the
   hashtable.  Combined with the single-linked lists we use, it could
   really hog-down the lookup and removal of the nodes from the rbt
   tree[a].  The Fibonacci Hashing is much better fit for the hashtable
   function here.  For longer description, read "Fibonacci Hashing: The
   Optimization that the World Forgot"[b] or just look at the Linux
   kernel.  Also this will make Diego very happy :).

3. The hashtable would rehash every time the number of nodes in the rbt
   tree would exceed 3 * (hashtable size).  The overcommit will make the
   uneven distribution in the hashtable even worse, but the main problem
   lies in the rehashing - every time the database grows beyond the
   limit, each subsequent rehashing will be much slower.  The mitigation
   here is letting the rbt know how big the cache can grown and
   pre-allocate the hashtable to be big enough to actually never need to
   rehash.  This will consume more memory at the start, but since the
   size of the hashtable is capped to `1 << 32` (e.g. 4 mio entries), it
   will only consume maximum of 32GB of memory for hashtable in the
   worst case (and max-cache-size would need to be set to more than
   4TB).  Calling the dns_db_adjusthashsize() will also cap the maximum
   size of the hashtable to the pre-computed number of bits, so it won't
   try to consume more gigabytes of memory than available for the
   database.

   FIXME: What is the average size of the rbt node that gets hashed?  I
   chose the pagesize (4k) as initial value to precompute the size of
   the hashtable, but the value is based on feeling and not any real
   data.

For future work, there are more places where we use result of the hash
value modulo some small number and that would benefit from Fibonacci
Hashing to get better distribution.

Notes:
a. A doubly linked list should be used here to speedup the removal of
   the entries from the hashtable.
b. https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/
2020-07-21 08:44:26 +02:00
Michal Nowak
1b13123c45 Check tests for core files regardless of test status
Failed test should be checked for core files et al. and have
backtrace generated.
2020-07-17 10:04:59 +02:00
Michal Nowak
05c13e50d3 Rationalize backtrace logging
GDB backtrace generated via "thread apply all bt full" is too long for
standard output, lets save them to .txt file among other log files.
2020-07-17 10:04:04 +02:00
Michal Nowak
b232e8585a Ensure various test issues are treated as failures
Make sure bin/tests/system/run.sh returns a non-zero exit code if any of
the following happens:

  - the test being run produces a core dump,
  - assertion failures are found in the test's logs,
  - ThreadSanitizer reports are found after the test completes,
  - the servers started by the test fail to shut down cleanly.

This change is necessary to always fail a test in such cases (before the
migration to Automake, test failures were determined based on the
presence of "R:<test-name>:FAIL" lines in the test suite output and thus
it was not necessary for bin/tests/system/run.sh to return a non-zero
exit code).
2020-07-17 10:00:21 +02:00
Mark Andrews
11ecf7901b Add regression test for [GL !3735]
Check that resign interval is actually in days rather than hours
by checking that RRSIGs are all within the allowed day range.
2020-07-14 10:59:59 +10:00
Mark Andrews
a0e8a11cc6 Don't verify the zone when setting expire to "now+1s" as it can fail
as too much wall clock time may have elapsed.

Also capture signzone output for forensic analysis
2020-07-13 01:39:13 +00:00
Evan Hunt
ba52377b37 use 'tsig-keygen' as the primary name for the tool
'ddns-confgen' is now an alias for 'tsig-keygen', rather than
the other way around.
2020-07-06 01:41:52 -07:00
Ondřej Surý
f8b5958d28 Don't fail the system tests when shutdown test is missing pytest 2020-07-02 16:55:55 +02:00
Matthijs Mekking
24e07ae98e Fix kasp test set_keytime
While the creation and publication times of the various keys
in this policy are nearly at the same time there is a chance that
one key is created a second later than the other.

The `set_keytimes_algorithm_policy` mistakenly set the keytimes
for KEY3 based of the "published" time from KEY2.
2020-07-01 22:42:29 +02:00
Evan Hunt
e43b3c1fa1 further tidying of primary/secondary terminology in system tests
this changes most visble uses of master/slave terminology in tests.sh
and most uses of 'type master' or 'type slave' in named.conf files.
files in the checkconf test were not updated in order to confirm that
the old syntax still works. rpzrecurse was also left mostly unchanged
to avoid interference with DNSRPS.
2020-07-01 11:12:12 -07:00
Evan Hunt
f619708bbf prevent "primaries" lists from having duplicate names
it is now an error to have two primaries lists with the same
name. this is true regardless of whether the "primaries" or
"masters" keywords were used to define them.
2020-07-01 11:11:34 -07:00
Evan Hunt
424a3cf3cc add "primary-only" as a synonym for "master-only"
update the "notify" option to use RFC 8499 terminology as well.
2020-07-01 11:11:34 -07:00
Evan Hunt
16e14353b1 add "primaries" as a synonym for "masters" in named.conf
as "type primary" is preferred over "type master" now, it makes
sense to make "primaries" available as a synonym too.

added a correctness check to ensure "primaries" and "masters"
cannot both be used in the same zone.
2020-07-01 11:11:34 -07:00
Diego Fronza
042e509753 Added test for the fix
This test ensures that named will correctly shutdown
when receiving multiple control connections after processing
of either "rncd stop" or "kill -SIGTERM" commands.

Before the fix, named was crashing due to a race condition happening
between two threads, one running shutdown logic in named/server.c
and other handling control logic in controlconf.c.

This test tries to reproduce the above scenario by issuing multiple
queries to a target named instance, issuing either rndc stop or kill
-SIGTERM command to the same named instance, then starting multiple rndc
status connections to ensure it is not crashing anymore.
2020-07-01 11:59:01 +02:00
Evan Hunt
e3ee138098 update the acl system test to include a blackhole test case
this ACL was previously untested, which allowed a regression to
go undetected.
2020-06-30 17:29:09 -07:00
Matthijs Mekking
19ce9ec1d4 Output rndc dnssec -status
Implement the 'rndc dnssec -status' command that will output
some information about the key states, such as which policy is
used for the zone, what keys are in use, and when rollover is
scheduled.

Add loose testing in the kasp system test, the actual times are
already tested via key file inspection.
2020-06-30 09:51:04 +02:00
Matthijs Mekking
f0b5eb03bb Add one more RFC 4592 test
This deals with the SRV example.
2020-06-30 05:22:24 +00:00
Mark Andrews
b3215125ea Fix the dnstap roll test by:
* fixing the find call.
* checking that we rolled a file.
2020-06-30 08:27:58 +10:00
Matthijs Mekking
a47192ed5b kasp tests: fix wait for reconfig done
The wait until zones are signed after rndc reconfig is broken
because the zones are already signed before the reconfig.  Fix
by having a different way to ensure the signing of the zone is
complete.  This does require a call to the "wait_for_done_signing"
function after each "check_keys" call after the ns6 reconfig.

The "wait_for_done_signing" looks for a (newly added) debug log
message that named will output if it is done signing with a certain
key.
2020-06-26 08:43:45 +00:00
Matthijs Mekking
cf76d839ae kasp tests: Replace while loops with retry_quiet 2020-06-26 08:43:45 +00:00
Evan Hunt
a8baf79e33 append "0" to IPv6 addresses ending in "::" when printing YAML
such addresses broke some YAML parsers.
2020-06-25 16:42:13 -07:00
Matthijs Mekking
c6345fffe9 Add todo in dnssec system test for [GL #1689]
Add a note why we don't have a test case for the issue.

It is tricky to write a good test case for this if our tools are
not allowed to create signatures for unsupported algorithms.
2020-06-25 13:46:36 +02:00
Mark Andrews
a289a57c7f Check that 'rndc dnstap -roll <value>' works 2020-06-23 20:20:39 +10:00
Evan Hunt
a9154f2aab reorder system tests to shorten runtime
if tests that take a particularly long time to complete
(serve-stale, dnssec, rpzrecurse) are run first, a parallel
run of the system tests can finish 1-2 minutes faster.
2020-06-22 12:05:32 +00:00
Evan Hunt
ba31b189b4 "check-names primary" and "check-names secondary" were ignored
these keywords were added to the parser as synonyms for "master"
and "slave" but were never hooked in to the configuration of named,
so they were ignored. this has been fixed and the option is now
checked for correctness.
2020-06-22 12:32:32 +02:00
Mark Andrews
3632b3c282 Add checking RFC 4592 responses examples to wildcard system test 2020-06-18 09:59:20 +02:00
Michał Kępień
fef15bc33d Disable temporarily unsupported tests on Windows
Due to the changes introduced by the Automake migration, system tests
requiring Python (chain, pipelined, qmin, tcp), dynamic loading of
shared objects (dlzexternal, dyndb, filter-aaaa), or LMDB (nzd2nzf)
currently do not work on Windows.  Temporarily disable them on that
platform by moving them from the PARALLEL_COMMON list to the
PARALLEL_UNIX list until the situation is rectified.
2020-06-09 15:35:54 +02:00
Michał Kępień
1861866f63 Fix SYSTEMTESTTOP on Windows
Without SYSTEMTESTTOP=.. lines in tests.sh scripts, SYSTEMTESTTOP is
being set to an absolute path.  On Windows, this means that an absolute
Cygwin path gets passed as a command line argument to native Windows
binaries, which cannot work and causes system tests to break.  Fix by
passing SYSTEMTESTTOP through cygpath on Windows, which causes that
variable to be set to an absolute "mixed mode" path (Windows path with
forward slashes).
2020-06-09 15:35:54 +02:00
Michal Nowak
5bbc6dd7f1 Fix "make dist"
Make various adjustments necessary to enable "make dist" to build a BIND
source tarball whose contents are complete enough to build binaries, run
unit & system tests, and generate documentation on Unix systems.

Known outstanding issues:

  - "make distcheck" does not work yet.
  - Tests do not work for out-of-tree source-tarball-based builds.
  - Source tarballs are not complete enough for building on Windows.

All of the above will be addressed in due course.
2020-06-05 13:19:49 +02:00
Mark Andrews
9e72266705 Improve the behaviour of yamlget.py when run with python2 2020-06-05 10:01:08 +10:00
Mark Andrews
0ec77c2b92 Add +yaml support for EDE 2020-06-05 08:34:51 +10:00
Evan Hunt
be2972438c Add a test with an incorrect question in a continuation message 2020-06-04 16:10:41 +02:00
Mark Andrews
ae55fbbe9c Ignore attempts to add DS records at zone apex
DS records belong in the parent zone at a zone cut and
are not retrievable with modern recursive servers.
2020-06-04 16:00:33 +02:00
Mark Andrews
35a58d30c9 Reject primary zones with an DS record at the zone apex.
DS records only belong at delegation points and if present
at the zone apex are invariably the result of administrative
errors.  Additionally they can't be queried for with modern
resolvers as the parent servers will be queried.
2020-06-04 16:00:33 +02:00
Mark Andrews
d9b29fcd9d Preserve PATH and LD_LIBRARY_PATH when calling make
When ./run.sh <test> is invoked, it acts as a wrapper around
`env - TESTS="<test>" make -e check` to preserve the ability to build
files defined only in the `check` target.  Unfortunately, cleaning the
full environment had a side-effect of some tests failing due to missing
binaries and libraries.  We now preserve the two most important
variables - PATH and LD_LIBRARY_PATH.
2020-06-04 15:20:08 +02:00
Ondřej Surý
13fd3ecfab Reduce the default value for max-stale-ttl from 1 week to 12 hours
Originally, the default value for max-stale-ttl was 1 week, which could
and in some scenarios lead to cache exhaustion on a busy resolvers.
Picking the default value will always be juggling between value that's
useful (e.g. keeping the already cached records after they have already
expired and the upstream name servers are down) and not bloating the
cache too much (e.g. keeping everything for a very long time).  The new
default reflects what we think is a reasonable to time to react on both
sides (upstream authoritative and downstream recursive).
2020-06-03 09:48:54 +02:00
Matthijs Mekking
0d578097ef Fix bug in keymgr_key_has_successor
The logic in `keymgr_key_has_successor(key, keyring)` is flawed, it
returns true if there is any key in the keyring that has a successor,
while what we really want here is to make sure that the given key
has a successor in the given keyring.

Rather than relying on `keymgr_key_exists_with_state`, walk the
list of keys in the keyring and check if the key is a successor of
the given predecessor key.
2020-06-02 10:00:51 +02:00
Matthijs Mekking
5b3decaf48 Replace date -d with python script
The usage of 'date -d' in the kasp system test is not portable,
replace with a python script.  Also remove some leftover
"set_keytime 'yes'" calls.
2020-06-02 09:14:27 +02:00
Matthijs Mekking
61c1040ae5 Test keytimes on algorithm rollover
This improves keytime testing on algorithm rollover.  It now
tests for specific times, and also tests for SyncPublish and
Removed keytimes.
2020-06-02 09:14:24 +02:00
Matthijs Mekking
da5e1e3a0f Test keytimes on policy changes
This improves keytime testing on reconfiguration of the
dnssec-policy.
2020-06-02 09:14:22 +02:00
Matthijs Mekking
e233433772 Test keytimes on CSK rollover
This improves keytime testing on CSK rollover.  It now
tests for specific times, and also tests for SyncPublish and
Removed keytimes.

Since an "active key" for ZSK and KSK means something
different, this makes it tricky to decide when a CSK is
active. An "active key" intuitively means the key is signing
so we say a CSK is active when it is creating zone signatures.

This change means a lot of timings for the CSK rollover tests
need to be adjusted.

The keymgr code needs a slight change on calculating the
prepublication time: For a KSK we need to include the parent
registration delay, but for CSK we look at the zone signing
property and stick with the ZSK prepublication calculation.
2020-06-02 09:14:18 +02:00
Matthijs Mekking
649d0833ce Test keytimes on KSK rollover
This improves keytime testing on KSK rollover.  It now
tests for specific times, and also tests for SyncPublish and
Removed keytimes.
2020-06-02 09:14:16 +02:00
Matthijs Mekking
50bbbb76a8 kasp: registration delay adjustments
Registration delay is not part of the Iret retire interval, thus
removed from the calculation when setting the Delete time metadata.

Include the registration delay in prepublication time, because
we need to prepublish the key sooner than just the Ipub
publication interval.
2020-06-02 09:14:15 +02:00
Matthijs Mekking
e01fcbbaf8 Test keytimes on ZSK rollover
This improves keytime testing on ZSK rollover.  It now
tests for specific times, and also tests for SyncPublish and
Removed keytimes.
2020-06-02 09:14:13 +02:00
Matthijs Mekking
cf51c87fad Test keytimes on enable-dnssec case
This improves keytime testing for enabling DNSSEC.  It now
tests for specific times, and also tests for SyncPublish.
2020-06-02 09:14:11 +02:00