2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

36294 Commits

Author SHA1 Message Date
Ondřej Surý
714fe2f617 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.
2022-06-01 17:08:37 +02:00
Ondřej Surý
90f0a765d8 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.*.
2022-06-01 17:08:37 +02:00
Ondřej Surý
dec845017b 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.
2022-06-01 17:08:37 +02:00
Tony Finch
24d420f20b 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.
2022-06-01 17:08:37 +02:00
Artem Boldariev
a6d364deec Merge branch '3269-increase-server-start-timeout' into 'main'
Resolve #3269: Increase server start timeout for unit tests

Closes #3269

See merge request isc-projects/bind9!6356
2022-06-01 14:33:34 +00:00
Artem Boldariev
705f0d1ed1 Increase server start timeout for system tests
This commit increases server start timeout from 60 to 90 seconds in
order to avoid system test failures on some platforms due to inability
to initialise TLS contexts in time.
2022-06-01 15:27:36 +03:00
Tony Finch
f2dafeba60 Merge branch 'fanf-compression-relic' into 'main'
Clean up the dns_compress API

See merge request isc-projects/bind9!6270
2022-06-01 12:02:16 +00:00
Tony Finch
1d1114fe0a CHANGES note for [GL !6270]
[cleanup]	Simplify BIND's internal DNS name compression API. As
		RFC 6891 explains, it isn't practical to deploy new
		label types or compression methods, so it isn't
		necessary to have an API designed to support them.
		Remove compression terminology that refers to Internet
		Drafts that expired in the 1990s.
2022-06-01 13:00:40 +01:00
Tony Finch
64e801243e Clean up remaining references to global compression
It is simply called "compression" now, without any qualifiers. Also,
improve some variable names in dns_name_towire2() so they are not two
letter abbreviations for global something.
2022-06-01 13:00:40 +01:00
Tony Finch
1d807d84f1 Shrink decompression contexts
It's wasteful to use 20 bytes and a pointer indirection to represent
two bits of information, so turn the struct into an enum. And change
the names of the enumeration constants to make the intent more clear.

This change introduces some inline functions into another header,
which confuses `gcovr` when it is trying to collect code coverage
statistics. So, in the CI job, copy more header files into a directory
where `gcovr` looks for them.
2022-06-01 13:00:40 +01:00
Tony Finch
129a522d88 There can no longer be multiple compression methods
The aim is to get rid of the obsolete term "GLOBAL14" and instead just
refer to DNS name compression.

This is mostly mechanically renaming

from	dns_(de)compress_(get|set)methods()
to	dns_(de)compress_(get|set)permitted()

and replacing the related enum by a simple flag, because compression
is either on or off.
2022-06-01 13:00:40 +01:00
Tony Finch
e37b782c1a DNS name compression does not depend on the EDNS version
There was a proposal in the late 1990s that it might, but it turned
out to be unworkable. See RFC 6891, Extension Mechanisms for
DNS (EDNS(0)), section 5, Extended Label Types.

The remnants of the code that supported this in BIND are redundant.
2022-06-01 13:00:40 +01:00
Tony Finch
dded5a2612 Remove obsolete notes on name compression
These notes describe the initial compression design for BIND 9 in
1998/1999, when the IETF had some over-optimistic plans for using EDNS
to change the wire format of domain names. (Another example was
bitstring labels for IPv6 reverse DNS.) By the end of 2000 the EDNS
name compression schemes had been abandoned, and BIND 9's compression
code was rewritten to use a hash table.

There is nothing left of the implementation described here, and the
API functions are better described in `compress.h`, so these notes are
more misleading than helpful. Those who are interested in the past can
look at the version control history.
2022-06-01 13:00:40 +01:00
Arаm Sаrgsyаn
358940cd96 Merge branch 'aram/update-top-level-gitignore-add-ide-files' into 'main'
Update top-level .gitignore to ignore files generated by some IDEs

See merge request isc-projects/bind9!6361
2022-06-01 10:19:14 +00:00
Aram Sargsyan
ec3bc4142b Update top-level .gitignore to ignore files generated by some IDEs 2022-06-01 09:48:31 +00:00
Mark Andrews
fa7e0360cf Merge branch '3345-fix-keyless-example-generation' into 'main'
Resolve "Insecurity proof failed resolving 'a.b.keyless.example/A/IN' in dnssec test"

Closes #3345

See merge request isc-projects/bind9!6280
2022-06-01 00:36:15 +00:00
Mark Andrews
69d5e22e58 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,
2022-06-01 10:16:37 +10:00
Evan Hunt
728ea7cce5 Merge branch '3349-managed-keys' into 'main'
don't create managed-keys zone unless dnssec-validation is "auto"

Closes #3349

See merge request isc-projects/bind9!6306
2022-05-31 18:18:13 +00:00
Evan Hunt
dc524ad392 CHANGES for [GL #3349] 2022-05-31 10:55:31 -07:00
Evan Hunt
3e0d9bd6d2 don't create managed-keys zone unless dnssec-validation is "auto"
previously, a managed-keys zone was created for every view
regardless of whether rfc5011 was in use; when it was not in
use, the zone would be left empty. this made for some confusing
log messages.

we now only set up the managed-keys zone if dnssec-validation is
set to the default value of "auto".

certain system test servers have had their dnssec-validation settings
changed to auto because the tests depended on the existence of the
zone.
2022-05-31 10:51:17 -07:00
Matthijs Mekking
9a13884aaf Merge branch '1611-detect-insane-dnssec-policies' into 'main'
Add some dnssec-policy configuration checks

Closes #1611 and #1601

See merge request isc-projects/bind9!6273
2022-05-31 14:36:32 +00:00
Matthijs Mekking
955a69109e 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".
2022-05-31 15:45:14 +02:00
Matthijs Mekking
92f98002e7 Add CHANGE and release note for #1611
Feature change.
2022-05-31 15:45:14 +02:00
Matthijs Mekking
8134d46cdb 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.
2022-05-31 15:45:14 +02:00
Matthijs Mekking
74d2e7704f Update signatures-refresh documentation
Mention in the ARM the new restriction about signatures-refresh.
2022-05-31 15:45:14 +02:00
Matthijs Mekking
82fd89107f 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.
2022-05-31 15:45:14 +02:00
Matthijs Mekking
e7322e8f78 Warn if key lifetime is short
Log a warning if the key lifetime is less than 30 days.
2022-05-31 15:45:14 +02:00
Matthijs Mekking
f54dad005e Warn if multiple keys have same role
If a dnssec-policy has multiple keys configured with the
same algorithm and role.
2022-05-31 15:45:14 +02:00
Ondřej Surý
51a299d1fd Merge branch 'ondrej-unit-tests-refactoring' into 'main'
Give the unit tests a big overhaul and move all the unit tests to /tests/<libname>/

See merge request isc-projects/bind9!6243
2022-05-31 08:56:05 +00:00
Ondřej Surý
cd1f9c3d36 Add CHANGES note for [GL !6243] 2022-05-28 14:53:02 -07:00
Evan Hunt
2321cab4ee 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.
2022-05-28 14:53:02 -07:00
Evan Hunt
568f65cc56 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.
2022-05-28 14:53:02 -07:00
Ondřej Surý
2c3b2dabe9 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/.
2022-05-28 14:53:02 -07:00
Ondřej Surý
63fe9312ff 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.
2022-05-28 14:52:56 -07:00
Ondřej Surý
3b757aa749 Merge branch 'ondrej-make-all-tasks-bound-to-thread' into 'main'
Make all tasks to be bound to a thread

See merge request isc-projects/bind9!6347
2022-05-25 14:45:32 +00:00
Ondřej Surý
1fe391fd40 Make all tasks to be bound to a thread
Previously, tasks could be created either unbound or bound to a specific
thread (worker loop).  The unbound tasks would be assigned to a random
thread every time isc_task_send() was called.  Because there's no logic
that would assign the task to the least busy worker, this just creates
unpredictability.  Instead of random assignment, bind all the previously
unbound tasks to worker 0, which is guaranteed to exist.
2022-05-25 16:04:51 +02:00
Ondřej Surý
9da46f3947 Merge branch 'ondrej-remove-dns_byaddr-API' into 'main'
Remove dns_lookup and unused functions in dns_byaddr

See merge request isc-projects/bind9!6348
2022-05-25 12:50:25 +00:00
Ondřej Surý
c06b661130 Remove dns_lookup and unused functions in dns_byaddr
Clean up unused functions from the dns_byaddr API and completely remove
the dns_lookup API.
2022-05-25 14:44:32 +02:00
Artem Boldariev
b6f1c242a4 Merge branch '3375-cids-352848-352849-handle-deadcode-flow-errors' into 'main'
Resolve: CID 352848, CID 352849: Control flow issues (DEADCODE)

Closes #3375

See merge request isc-projects/bind9!6351
2022-05-25 10:20:05 +00:00
Artem Boldariev
98f758ed4f CID 352848: split xfrin_start() and remove dead code
This commit separates TLS context creation code from xfrin_start() as
it has become too large and hard to follow into a new
function (similarly how it is done in dighost.c)

The dead code has been removed from the cleanup section of the TLS
creation code:

* there is no way 'tlsctx' can equal 'found';
* there is no way 'sess_cache' can be non-NULL in the cleanup section.

Also, it fixes a bug in the older version of the code, where TLS
client session context fetched from the cache would not get passed to
isc_nm_tlsdnsconnect().
2022-05-25 12:38:38 +03:00
Artem Boldariev
095b608412 CID 352849: refactor get_create_tls_context() within dighost.c
This commit removes dead code from cleanup handling part of the
get_create_tls_context().

In particular, currently:

* there is no way 'found_ctx' might equal 'ctx';
* there is no way 'session_cache' might equal a non-NULL value while
cleaning up after a TLS initialisation error.
2022-05-25 12:38:38 +03:00
Ondřej Surý
06b27a54f8 Merge branch '2801-unittest-isc-netmgr-s390x' into 'main'
Fix failures in isc netmgr_test on big endian machines

Closes #2801

See merge request isc-projects/bind9!6352
2022-05-24 18:22:54 +00:00
Petr Menšík
057438cb45 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.
2022-05-24 19:51:30 +02:00
Artem Boldariev
d50cb13d4d Merge branch '3064-avoid-periodic-interface-rescans' into 'main'
Disable periodic interface re-scans on Linux

Closes #3064

See merge request isc-projects/bind9!6111
2022-05-24 13:55:33 +00:00
Artem Boldariev
dad38620e5 Modify CHANGES [GL #3064]
Mention that "interface-interval" might be ignored if a reliable,
event-based mechanism to detect interface state changes is available.
2022-05-24 15:26:35 +03:00
Artem Boldariev
b58c4b8462 Disable periodic interface re-scans on modern platforms
This commit disables periodic interface re-scans timer on Linux where
a kernel-based dynamic interface mechanisms make it a thing of the
past in most cases.
2022-05-24 15:26:35 +03:00
Artem Boldariev
9da576c2ba Merge branch '3376-fix-openssl-1.1.0-unimplementable-SSL-SESSION-is-resumable' into 'main'
Resolve #3376: Do not provide a shim for SSL_SESSION_is_resumable()

Closes #3376

See merge request isc-projects/bind9!6346
2022-05-24 10:52:06 +00:00
Artem Boldariev
40be3c9263 Do not provide a shim for SSL_SESSION_is_resumable()
The recently added TLS client session cache used
SSL_SESSION_is_resumable() to avoid polluting the cache with
non-resumable sessions. However, it turned out that we cannot provide
a shim for this function across the whole range of OpenSSL versions
due to the fact that OpenSSL 1.1.0 does uses opaque pointers for
SSL_SESSION objects.

The commit replaces the shim for SSL_SESSION_is_resumable() with a non
public approximation of it on systems shipped with OpenSSL 1.1.0. It
is not turned into a proper shim because it does not fully emulate the
behaviour of SSL_SESSION_is_resumable(), but in our case it is good
enough, as it still helps to protect the cache from pollution.

For systems shipped with OpenSSL 1.0.X and derivatives (e.g. older
versions of LibreSSL), the provided replacement perfectly mimics the
function it is intended to replace.
2022-05-23 18:25:18 +03:00
Matthijs Mekking
31f937cb05 Merge branch '3341-servestale-extendederrors-test-failure' into 'main'
Tweak timings in serve-stale system test

Closes #3341

See merge request isc-projects/bind9!6276
2022-05-23 14:01:47 +00:00
Matthijs Mekking
f764cee136 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).
2022-05-23 14:23:07 +02:00