Commit graph

36068 commits

Author SHA1 Message Date
Aram Sargsyan
1355fc6a04 Don't process DNSSEC-related and ZONEMD records in catz
When processing a catalog zone update, skip processing records with
DNSSEC-related and ZONEMD types, because we are not interested in them
in the context of a catalog zone, and processing them will fail and
produce an unnecessary warning message.

(cherry picked from commit 73d6643137)
2022-06-02 10:20:11 +00:00
Mark Andrews
58760fb7d5 Merge branch '3388-missing-indent-call-v9_18' into 'v9_18'
Add missing INDENT call for UPDATE messages [v9_18]

See merge request isc-projects/bind9!6380
2022-06-01 22:50:59 +00:00
Mark Andrews
7d14346e5f Add missing INDENT call for UPDATE messages
Reported by Peter <pmc@citylink.dinoex.sub.org> on bind-users.

(cherry picked from commit 03132c93ca)
2022-06-02 08:28:15 +10:00
Ondřej Surý
81ac722b24 Merge branch 'fanf-tests-build-deps-v9_18' into 'v9_18'
Add missing CFLAGS and LDADD to unit tests [v9.18]

See merge request isc-projects/bind9!6378
2022-06-01 16:51:18 +00:00
Ondřej Surý
33057fc891 Properly adjust the srcdir vs builddir paths
Affected unit tests load testdata from the srcdir.  Previously, there
was a kludge that chdir()ed to the tests srcdir, but that get removed
during refactoring.  Instead of introducing the kludge again, the paths
were fixed to be properly prefixed with TESTS_DIR as needed.

(cherry picked from commit 16595cdde0)
2022-06-01 17:45:34 +02:00
Ondřej Surý
c4fd0c3e4b Don't list libtest.la headers in HEADERS variable
The libtest.la headers were installed in very weird place, in fact, we
don't need to list them in the HEADERS variable, listing them in SOURCES
is enough for autotools to figure out how to compile the convenience
library.

(cherry picked from commit 714fe2f617)
2022-06-01 17:45:34 +02:00
Ondřej Surý
36184beb10 Fix the path to tsan files in the tsan unit test job
The tsan unit test job still referenced lib/*/tests/tsan.*, change this
to the correct tests/*/tsan.*.

(cherry picked from commit 90f0a765d8)
2022-06-01 17:45:34 +02:00
Ondřej Surý
1cc234f5d8 Add tests/isc/uv_wrap.h to Makefile.am
The automake was missing reference to uv_wrap.h, so it was not added to
the distribution.  Add uv_wrap.h to SOURCES for both doh and netmgr unit
tests.

(cherry picked from commit dec845017b)
2022-06-01 17:45:34 +02:00
Tony Finch
3ae606932d Add missing CFLAGS and LDADD to unit tests
A number of unit tests needed to be told where to find their libraries
and matching headers.

(cherry picked from commit 24d420f20b)
2022-06-01 17:45:34 +02:00
Arаm Sаrgsyаn
1d8689f936 Merge branch 'aram/update-top-level-gitignore-add-ide-files-v9_18' into 'v9_18'
[v9_18] Update top-level .gitignore to ignore files generated by some IDEs

See merge request isc-projects/bind9!6374
2022-06-01 11:41:00 +00:00
Aram Sargsyan
aab7ed38a8 Update top-level .gitignore to ignore files generated by some IDEs
(cherry picked from commit ec3bc4142b)
2022-06-01 10:21:26 +00:00
Mark Andrews
a6456581ce Merge branch '3345-fix-keyless-example-generation-v9_18' into 'v9_18'
Make modifications to keyless.example deterministic

See merge request isc-projects/bind9!6370
2022-06-01 01:08:35 +00:00
Mark Andrews
23c46338ef Make modifications to keyless.example deterministic
The perl modifation code for keyless.example was not deterministic
(/NXT/ matched part of signature) resulting in different error
strings being returned.  Replaced /NXT/ with /A RRSIG NSEC/ and
updated expected error string,

(cherry picked from commit 69d5e22e58)
2022-06-01 10:42:44 +10:00
Matthijs Mekking
ca0faba3fd Merge branch '1611-detect-insane-dnssec-policies-v9_18' into 'v9_18'
[v9_18] Add some dnssec-policy configuration checks

See merge request isc-projects/bind9!6367
2022-05-31 15:59:56 +00:00
Matthijs Mekking
42711dae88 Only log "new successor in ..." if prepub != 0
If 'prepub' is 0, this has the special meaning that no rollover is
scheduled. If so, don't log "new successor in x seconds".

(cherry picked from commit 955a69109e)
2022-05-31 17:17:05 +02:00
Matthijs Mekking
c18dce4c49 Add CHANGE and release note for #1611
Feature change.

(cherry picked from commit 92f98002e7)
2022-05-31 17:16:59 +02:00
Matthijs Mekking
3cfbe31176 Error if key lifetime is too short
The key lifetime should not be shorter than the time it costs to
introduce the successor key, otherwise keys will be created faster than
they are removed, resulting in a large key set.

The time it takes to replace a key is determined by the publication
interval (Ipub) of the successor key and the retire interval of the
predecessor key (Iret).

For the ZSK, Ipub is the sum of the DNSKEY TTL and zone propagation
delay (and publish safety). Iret is the sum of Dsgn, the maximum zone
TTL and zone propagation delay (and retire safety). The sign delay is
the signature validity period minus the refresh interval: The time to
ensure that all existing RRsets have been re-signed with the new key.
The ZSK lifetime should be larger than both values.

For the KSK, Ipub is the sum of the DNSKEY TTL and zone propagation
delay (and publish safety). Iret is the sum of the DS TTL and parent
zone propagation delay (and retire safety). The KSK lifetime should be
larger than both values.

(cherry picked from commit 8134d46cdb)
2022-05-31 17:16:53 +02:00
Matthijs Mekking
2036a8b161 Update signatures-refresh documentation
Mention in the ARM the new restriction about signatures-refresh.

(cherry picked from commit 74d2e7704f)
2022-05-31 17:16:46 +02:00
Matthijs Mekking
46636b8563 Error if signatures-refresh is too high
The signatures-refresh should not near the signatures-validity value,
to prevent operational instability. Same is true when checking against
signatures-validity-dnskey.

(cherry picked from commit 82fd89107f)
2022-05-31 17:16:40 +02:00
Matthijs Mekking
b32a39dd27 Warn if key lifetime is short
Log a warning if the key lifetime is less than 30 days.

(cherry picked from commit e7322e8f78)
2022-05-31 17:16:35 +02:00
Matthijs Mekking
58690ec11c Warn if multiple keys have same role
If a dnssec-policy has multiple keys configured with the
same algorithm and role.

(cherry picked from commit f54dad005e)
2022-05-31 17:16:29 +02:00
Matthijs Mekking
125cad030b Merge branch '3341-servestale-extendederrors-test-failure-v9_18' into 'v9_18'
[v9_18] Tweak timings in serve-stale system test

See merge request isc-projects/bind9!6350
2022-05-31 14:27:39 +00:00
Matthijs Mekking
659804eab0 Tweak timings in serve-stale system test
Give a little bit more time if we wait on a time out from the
authoritative (aka resolver failure), and give up after one try
(because the second attempt will likely result in a different EDE).

(cherry picked from commit f764cee136)
2022-05-31 13:51:51 +00:00
Ondřej Surý
178442f735 Merge branch 'ondrej-unit-tests-refactoring-v9_18' into 'v9_18'
Give the unit tests a big overhaul [v9.18]

See merge request isc-projects/bind9!6366
2022-05-31 10:31:58 +00:00
Ondřej Surý
45584af257 Add CHANGES note for [GL !6243]
(cherry picked from commit cd1f9c3d36)
2022-05-31 12:06:00 +02:00
Evan Hunt
a0bf5ab2c5 Exclude unit tests from gcov
Modify the .gitlab-ci.yml to match the previous lib/.*/tests/.* pattern
for excluding the unit tests from the gcov.

(cherry picked from commit 2321cab4ee)
2022-05-31 12:06:00 +02:00
Evan Hunt
a67ba6e0b9 Stop the unit tests from running twice
Move the libtest code into a 'libtest' subdirectory and make it
one of the SUBDIRS in the tests Makefile. having it at the top level
required having "." as one of the subdirs, and that caused the
unit tests to be executed twice.

(cherry picked from commit 568f65cc56)
2022-05-31 12:06:00 +02:00
Ondřej Surý
f128a9bcf2 Move all the unit tests to /tests/<libname>/
The unit tests are now using a common base, which means that
lib/dns/tests/ code now has to include lib/isc/include/isc/test.h and
link with lib/isc/test.c and lib/ns/tests has to include both libisc and
libdns parts.

Instead of cross-linking code between the directories, move the
/lib/<foo>/test.c to /tests/<foo>.c and /lib/<foo>/include/<foo>test.h
to /tests/include/tests/<foo>.h and create a single libtest.la
convenience library in /tests/.

At the same time, move the /lib/<foo>/tests/ to /tests/<foo>/ (but keep
it symlinked to the old location) and adjust paths accordingly.  In few
places, we are now using absolute paths instead of relative paths,
because the directory level has changed.  By moving the directories
under the /tests/ directory, the test-related code is kept in a single
place and we can avoid referencing files between libns->libdns->libisc
which is unhealthy because they live in a separate Makefile-space.

In the future, the /bin/tests/ should be merged to /tests/ and symlink
kept, and the /fuzz/ directory moved to /tests/fuzz/.

(cherry picked from commit 2c3b2dabe9)
2022-05-31 12:06:00 +02:00
Ondřej Surý
f0df0d679a Give the unit tests a big overhaul
The unit tests contain a lot of duplicated code and here's an attempt
to reduce code duplication.

This commit does several things:

1. Remove #ifdef HAVE_CMOCKA - we already solve this with automake
   conditionals.

2. Create a set of ISC_TEST_* and ISC_*_TEST_ macros to wrap the test
   implementations, test lists, and the main test routine, so we don't
   have to repeat this all over again.  The macros were modeled after
   libuv test suite but adapted to cmocka as the test driver.

   A simple example of a unit test would be:

    ISC_RUN_TEST_IMPL(test1) { assert_true(true); }

    ISC_TEST_LIST_START
    ISC_TEST_ENTRY(test1)
    ISC_TEST_LIST_END

    ISC_TEST_MAIN (Discussion: Should this be ISC_TEST_RUN ?)

   For more complicated examples including group setup and teardown
   functions, and per-test setup and teardown functions.

3. The macros prefix the test functions and cmocka entries, so the name
   of the test can now match the tested function name, and we don't have
   to append `_test` because `run_test_` is automatically prepended to
   the main test function, and `setup_test_` and `teardown_test_` is
   prepended to setup and teardown function.

4. Update all the unit tests to use the new syntax and fix a few bits
   here and there.

5. In the future, we can separate the test declarations and test
   implementations which are going to greatly help with uncluttering the
   bigger unit tests like doh_test and netmgr_test, because the test
   implementations are not declared static (see `ISC_RUN_TEST_DECLARE`
   and `ISC_RUN_TEST_IMPL` for more details.

NOTE: This heavily relies on preprocessor macros, but the result greatly
outweighs all the negatives of using the macros.  There's less
duplicated code, the tests are more uniform and the implementation can
be more flexible.

(cherry picked from commit 63fe9312ff)
2022-05-31 11:34:54 +02:00
Ondřej Surý
5e9c9e3539 Merge branch '2801-unittest-isc-netmgr-s390x-v9_18' into 'v9_18'
Fix failures in isc netmgr_test on big endian machines

See merge request isc-projects/bind9!6353
2022-05-24 18:28:09 +00:00
Petr Menšík
d074386ef1 Fix failures in isc netmgr_test on big endian machines
Typing from libuv structure to isc_region_t is not possible, because
their sizes differ on 64 bit architectures. Little endian machines seems
to be lucky and still result in test passed. But big endian machine such
as s390x fails the test reliably.

Fix by directly creating the buffer as isc_region_t and skipping the
type conversion. More readable and still more correct.

(cherry picked from commit 057438cb45)
2022-05-24 20:22:57 +02:00
Tony Finch
44c4ff2d2d Merge branch '3361-dnssec-settime-unset-v9_18' into 'v9_18'
Teach dnssec-settime to read unset times that it writes (backport to v9.18)

See merge request isc-projects/bind9!6349
2022-05-23 14:01:23 +00:00
Tony Finch
84113b237a Teach dnssec-settime to read unset times that it writes
When there is no time in a key file, `dnssec-settime` will print
"UNSET", but to unset a time the user must specify "none" or "never".
This change allows "unset" or "UNSET" as well as "none" or "never".
The "UNSET" output remains the same to avoid compatibility problems
with wrapper scripts.

I have also re-synchronized the "Timing Options" sections of the man
pages.

(cherry picked from commit 4c96efac5c)
2022-05-23 15:15:10 +02:00
Tony Finch
0486bdeae3 Merge branch 'u/fanf2/dnssec-settime-ctime-v9_18' into 'v9_18'
Teach dnssec-settime to read times that it writes

See merge request isc-projects/bind9!6324
2022-05-23 12:58:50 +00:00
Tony Finch
fa5d44becf Add CHANGES note for [GL !6324]
(cherry picked from commit fcca62859d)
2022-05-23 13:46:07 +02:00
Tony Finch
f84cd02b0c Teach dnssec-settime to read times that it writes
The dnssec-settime -p and -up options print times in asctime() and
UNIX time_t formats, respectively. The asctime() format can also be
found inside K*.key public key files. Key files also contain times in
the YYYYMMDDHHMMSS format that can be used in timing parameter
options.

The dnssec-settime -p and -up time formats are now acceptable in
timing parameter options to dnssec-settime and dnssec-keygen, so it is
no longer necessary to parse key files to retrieve times that are
acceptable in timing parameter options.

(cherry picked from commit c38a323082)
2022-05-23 13:44:50 +02:00
Matthijs Mekking
1b15ff89b5 Merge branch '3354-cid-352776-missing_lock-v9_18' into 'v9_18'
[v9_18] Fix CID 352776: Concurrent data access violations

See merge request isc-projects/bind9!6344
2022-05-23 10:39:43 +00:00
Matthijs Mekking
0ae48af8b2 Require valid key for dst_key functions
Make sure that the key structure is valid when calling the following
functions:
- dst_key_setexternal
- dst_key_isexternal
- dst_key_setmodified
- dst_key_ismodified

(cherry picked from commit 888ec4e0d4)
2022-05-23 12:00:53 +02:00
Matthijs Mekking
ca7e3e25c4 Fix CID 352776: Concurrent data access violations
*** CID 352776:  Concurrent data access violations  (MISSING_LOCK)
/lib/dns/dst_api.c: 474 in dst_key_setmodified()
468     dst_key_isexternal(dst_key_t *key) {
469		return (key->external);
470     }
471
472     void
473     dst_key_setmodified(dst_key_t *key, bool value) {
>>>     CID 352776:  Concurrent data access violations  (MISSING_LOCK)
>>>     Accessing "key->modified" without holding lock
>>>	"dst_key.mdlock". Elsewhere, "dst_key.modified" is accessed with
>>>	"dst_key.mdlock" held 8 out of 11 times (8 of these accesses
>>>	strongly imply that it is necessary).
474		key->modified = value;
475     }
476
477     bool
478     dst_key_ismodified(dst_key_t *key) {
479		return (key->modified);

(cherry picked from commit 1fa24d0afb)
2022-05-23 12:00:45 +02:00
Ondřej Surý
18881c15aa Merge branch '3344-threadsanitizer-data-race-in-isc__nm_tcpdns_send-v9_18' into 'v9_18'
Move setting the sock->write_timeout to the async_*send [v9.18]

See merge request isc-projects/bind9!6341
2022-05-19 20:53:11 +00:00
Ondřej Surý
eabee4d7d9 Move setting the sock->write_timeout to the async_*send
Setting the sock->write_timeout from the TCP, TCPDNS, and TLSDNS send
functions could lead to (harmless) data race when setting the value for
the first time when the isc_nm_send() function would be called from
thread not-matching the socket we are sending to.  Move the setting the
sock->write_timeout to the matching async function which is always
called from the matching thread.

(cherry picked from commit 61117840c1)
2022-05-19 22:37:52 +02:00
Ondřej Surý
acfec1bff0 Merge branch '3371-check-for-__attribute__-fallthrough-support-is-sometimes-incorrect-v9_18' into 'v9_18'
Use C2x [[fallthrough]] when supported by LLVM/clang [v9.18]

See merge request isc-projects/bind9!6339
2022-05-19 20:34:20 +00:00
Ondřej Surý
b4521486ed Use C2x [[fallthrough]] when supported by LLVM/clang
Clang added support for the gcc-style fallthrough
attribute (i.e. __attribute__((fallthrough))) in version 10.  However,
__has_attribute(fallthrough) will return 1 in C mode in older versions,
even though they only support the C++11 fallthrough attribute. At best,
the unsupported attribute is simply ignored; at worst, it causes errors.

The C2x fallthrough attribute has the advantages of being supported in
the broadest range of clang versions (added in version 9) and being easy
to check for support. Use C2x [[fallthrough]] attribute if possible, and
fall back to not using an attribute for clang versions that don't have
it.

Courtesy of Joshua Root

(cherry picked from commit 14c8d43863)
2022-05-19 22:01:59 +02:00
Michal Nowak
4dde80f655 BIND 9.18.3
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEIz+ZTe/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nDiPWMNBCvOU9ThPAKcGIHCwvk5rkcno771d/izvLbBWrtQh/8iKqMP6gyT
 dsB8Oq4mlPJ5gh4yv0LLmyUiNFg4CSEVxfWd6PRmZlvXtwOQqA1tKR7srPXwrHxd
 bx+5bbZtQKqEi8l/UYdHhyqaPdPWnUaydzU1LzhUSHJK2f9pEDOfBlOj82Z0hMm2
 T6EaoyykIqyhngSFK9Ef+sCAZ3qrss96bRPSN8gOpn6I6sioH+Bp+E3cBDVTkyRA
 rVKTA0HLegRH2/QnPJjHAu7I6YPE36LZu7kZdEiw8ysqWcIEva8E/PFv2YBJxAv1
 SjEdhzfxVf9ncWndrgC1OjsoDucxYolg1sUCZ776e/E7MzAkOo1cqTXqhi6pcHT0
 OGMmJVitPXJ5bxiZpK1QZ46DqxwHLolk9gImnNvE01vJRxltWKqtdV1dH6Ca6MWo
 s6qMxFcIwmI4Zgq3V933CoD8HCmYW8W7UQ1tEXmDfPwEueqzoTs=
 =/ei9
 -----END PGP SIGNATURE-----

Merge tag 'v9_18_3' into v9_18

BIND 9.18.3
2022-05-19 12:07:45 +02:00
Evan Hunt
c00545a168 Merge branch '3350-rndc-dnssec-checkds-doc-v9_18' into 'v9_18'
specify time format in the documentation for 'rdnc dnssec -checkds'

See merge request isc-projects/bind9!6331
2022-05-18 22:37:35 +00:00
Evan Hunt
dfe196844c specify time format in the documentation for 'rdnc dnssec -checkds'
also clarified the writing in the surrounding paragraph.

(cherry picked from commit 83f9466d61)
2022-05-18 15:30:18 -07:00
Ondřej Surý
98e13fbc09 Merge branch '3366-configure-fails-to-find-uv-h-on-bsd-v9_18' into 'v9_18'
Use libuv CFLAGS and LIBS when checking for features [v9.18]

See merge request isc-projects/bind9!6329
2022-05-18 20:01:50 +00:00
Ondřej Surý
a50231adc1 Use libuv CFLAGS and LIBS when checking for features
When autoconf was checking for libuv features, the LIBUV_CFLAGS was not
added to CFLAGS and LIBUV_LIBS to LIBS which resulted in false
negatives.

Use AX_SAVE_FLAGS and AX_RESTORE_FLAGS to temporarily add LIBUV_CFLAGS
and LIBUV_LIBS to their respective variables.

(cherry picked from commit f063ee276e)
2022-05-18 21:22:03 +02:00
Michal Nowak
48012449de Merge branch 'mnowak/fix-typo-in-ednscompliance-test-v9_18' into 'v9_18'
[v9_18] Fix typo in ednscompliance test

See merge request isc-projects/bind9!6327
2022-05-18 17:19:23 +00:00
Michal Nowak
9c8fdec57b
Fix typo in ednscompliance test
Caused by ba0313e649, an incomplete fix of
spelling errors.

(cherry picked from commit 9de2c06a21)
2022-05-18 19:16:43 +02:00