2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00
Commit Graph

43002 Commits

Author SHA1 Message Date
Michal Nowak
0dc9b4573d Drop OpenBSD from the CI
With the ongoing process of moving CI workloads to AWS, OpenBSD poses a
challenge, as there is no OpenBSD AMI image in the AWS catalog. Building
our image from scratch is disproportionately complicated, given that
OpenBSD is not a common deployment platform for BIND 9. Otherwise,
OpenBSD stays at the "Best-Effort" level of support.
2025-04-29 10:54:31 +00:00
Alessio Podda
962b75dca4 fix: dev: Call rcu_barrier earlier in the destructor
If a call_rcu thread is running, there is a possible race condition
where the destructors run before all call_rcu callbacks have finished
running. This can happen, for example, if the call_rcu callback tries to
log something after the logging context has been torn down.

In !10394, we tried to counter this by explicitely creating a call_rcu
thread an shutting it down before running the destructors, but it is
possible for things to "slip" and end up on the default call_rcu thread.

As a quickfix, this commit moves an rcu_barrier() that was in the mem
context destructor earlier, so that it "protects" all libisc
destructors.

Closes #5296

Merge branch '5296-join-rcu-thread-on-shutdown' into 'main'

See merge request isc-projects/bind9!10423
2025-04-25 12:30:49 +00:00
Your Name
59086c33e2 Call rcu_barrier earlier in the destructor
If a call_rcu thread is running, there is a possible race condition
where the destructors run before all call_rcu callbacks have finished
running. This can happen, for example, if the call_rcu callback tries to
log something after the logging context has been torn down.

In !10394, we tried to counter this by explicitely creating a call_rcu
thread an shutting it down before running the destructors, but it is
possible for things to "slip" and end up on the default call_rcu thread.

As a quickfix, this commit moves an rcu_barrier() that was in the mem
context destructor earlier, so that it "protects" all libisc
destructors.
2025-04-25 13:13:44 +02:00
Matthijs Mekking
336c9d5114 chg: test: Rewrite kasp system test to pytest (4)
These tests do not easily fit in the standard test case framework, so they go into their own suite.
- zsk retired case
- checkds cases
- reload/restart
- inheritance tests

Merge branch 'matthijs-pytest-rewrite-kasp-system-test-4' into 'main'

See merge request isc-projects/bind9!10278
2025-04-25 10:23:59 +00:00
Matthijs Mekking
2e4cc70626 Convert kasp inheritance tests
These tests ensure that if dnssec-policy is set on a higher level, the
zone is still signed (or unsigned) as expected. Or if a higher level
has an override, the new policy is honored as expected.
2025-04-25 10:20:46 +02:00
Matthijs Mekking
bff7453e50 Convert reload/restart kasp test case
This test checks that the SOA SERIAL and TTL are adjusted correctly
after a reload/restart.
2025-04-25 10:20:46 +02:00
Matthijs Mekking
44b4d5ebd6 Convert kasp checkds test cases to pytest
This converts the checkds test cases that deal with the 'rndc checkds'
command and setting the 'DSPublish' and 'DSRemoved' metadata.
2025-04-25 10:20:46 +02:00
Matthijs Mekking
1940aa1d0b Convert kasp zsk retired test case
This test case does not easily fit in the standard test case framework,
so it goes into its own suite.
2025-04-25 10:20:46 +02:00
Arаm Sаrgsyаn
2054186f40 new: usr: Implement tcp-primaries-timeout
The new `tcp-primaries-timeout` configuration option works the same way
as the older `tcp-initial-timeout` option, but applies only to the TCP
connections made to the primary servers, so that the timeout value can
be set separately for them. By default, it's set to 150, which is 15
seconds.

Closes #3649

Merge branch '3649-configurable-xfr-tcp-timeouts' into 'main'

See merge request isc-projects/bind9!9376
2025-04-23 18:26:34 +00:00
Aram Sargsyan
e3417d55fd Fix delv default timeout value
The isc_nm_getinitialtimeout() function (and also the previously used
isc_nm_gettimeouts() function) returns timeout value(s) in milliseconds,
while the dns_request_create() function expects timeout values in
seconds. Fix the bug by dividing the timeout value by MS_PER_SEC.

There is no added test, because it turns out delv doesn't support
setting custom timeout values (as opposed to what is suggested in
its man page). Tests should be added later when the '+timeout=T'
option is implemented.
2025-04-23 17:03:05 +00:00
Aram Sargsyan
74a8acdc8d Separate the single setter/getter functions for TCP timeouts
Previously all kinds of TCP timeouts had a single getter and setter
functions. Separate each timeout to its own getter/setter functions,
because in majority of cases only one is required at a time, and it's
not optimal expanding those functions every time a new timeout value
is implemented.
2025-04-23 17:03:05 +00:00
Aram Sargsyan
797d865121 Fix the notify system test after the newly applied timeout value
Since notify messages now use the configured 'tcp-initial-timeout'
connect timeout value, the existing "checking notify retries expire
within 30 seconds" check in the "notify" system test is failing. Set
the 'tcp-initial-timeout' option for ns3 to the previously hardcoded
value of 15 seconds for the test to pass successfully.
2025-04-23 17:03:05 +00:00
Aram Sargsyan
b9e9b98d55 Use the configured TCP connect timeout in checkds_send_toaddr()
The checkds_send_toaddr() function uses hardcoded timeout values
for both UDP and TCP, however, with TCP named has configurable
timeout values. Slightly refactor the timeouts calculation part
and use the configured 'tcp-initial-timeout' value as the connect
timeout.
2025-04-23 17:03:05 +00:00
Aram Sargsyan
daede6876b Use the configured TCP connect timeout in notify_send_toaddr()
The notify_send_toaddr() function uses hardcoded timeout values
for both UDP and TCP, however, with TCP named has configurable
timeout values. Slightly refactor the timeouts calculation part
and use the configured 'tcp-initial-timeout' value as the connect
timeout.
2025-04-23 17:03:05 +00:00
Aram Sargsyan
70ad94257d Implement tcp-primaries-timeout
The new 'tcp-primaries-timeout' configuration option works the same way
as the existing 'tcp-initial-timeout' option, but applies only to the
TCP connections made to the primary servers, so that the timeout value
can be set separately for them. The default is 15 seconds.

Also, while accommodating zone.c's code to support the new option, make
a light refactoring with the way UDP timeouts are calculated by using
definitions instead of hardcoded values.
2025-04-23 17:03:05 +00:00
Matthijs Mekking
699db3b5b9 chg: test: Rewrite kasp system test to pytest (3)
Write python-based tests for the many test cases from the kasp system test with the same pattern.

Merge branch 'matthijs-pytest-rewrite-kasp-system-test-3' into 'main'

See merge request isc-projects/bind9!10268
2025-04-23 15:52:50 +00:00
Matthijs Mekking
7d670b7fe7 Parametrize the default kasp test cases
Make use of pytest.mark.parametrize to split up the many default kasp
test cases into separate tests.
2025-04-23 15:22:04 +00:00
Matthijs Mekking
ee7120eb34 Convert keystore and rumoured kasp test cases
For 'keystore.kasp', a setting 'key-directories' is used. If set, this
will expect a list of two directories, the first one is where the KSKs
will be stored, the second in the list is the ZSK key directory. This
may be expanded in the future to test more complex key storage cases.

The 'rumoured.kasp' zone is weird, the key timings can never match
those key states. But it is a regression test for an early day bug,
so we convert it, but skip the expected key times check.
2025-04-23 15:22:04 +00:00
Matthijs Mekking
5f23f750c2 Convert more kasp test cases to pytest
These test cases follow the same pattern as many other, but all require
some additional checks. These are set in "additional-tests".

The "zsk-missing.autosign" zone is special handled, as it expects the
KSK to sign the SOA RRset (because the ZSK is unavailable).

The kasp/ns3/setup.sh script is updated so the SyncPublish is not set
(named will initialize it correctly). For the test zones that have
missing private key files we do need to set the expected key timing
metadata.

Remove the counterparts for the newly added test from the kasp shell
tests script.
2025-04-23 15:22:04 +00:00
Matthijs Mekking
fddf9f778b Update kasp check_signatures for dnssec-policy
The check_signatures code was initially created to be suitable for
the ksr system test, to test the Offline KSK feature. For that, a
key is expected to be signing if the current time is between
the timing metadata Active and Retired.

With dnssec-policy, the key timing metadata is indicative, the key
states determine the actual signing behavior.

Update the check_signatures function so that by default the signing
is derived from the key states (ksigning and zsigning). Add an
argument 'offline_ksk', if set the make sure that the zsigning is set
if the current time is between the Active and Retired timing metadata,
and for ksigning we just use the timing metadata (as the key is offline,
we cannot check the key states).

Another (upcoming) test case is where key files are missing. When the
ZSK private key file is missing, the KSK takes over. Add an argument
'zsk_missing', when set to True the expected zone signing (zsigning)
is reversed.
2025-04-23 15:22:04 +00:00
Matthijs Mekking
43ded45ae9 Two more kasp test cases converted to pytest
The zone 'pregenerated.kasp' is a case where there already exist more
keys than required. For this we set the 'pregenerated' setting. This
will change the 'keydir_to_keylist' function behavior: Only keys in use
are considered. A key is in use if all of the states are either
undefined, or set to 'hidden'.

The 'some-keys.kasp' zone is similar to 'pregenerated.kasp', except
only some keys have been pregenerated.
2025-04-23 15:22:04 +00:00
Matthijs Mekking
41481af144 Convert many kasp test cases to pytst
Write python-based tests for the many test cases from the kasp system
test. These test cases all follow the same pattern:

- Wait until the zone is signed.
- Check the keys from the key-directory against expected properties.
- Set the expected key timings derived from when the key was created.
- Check the key timing metadata against expected timings.
- Check the 'rndc dnssec -status' output.
- Check the apex is signed correctly.
- Check a subdomain is signed correctly.
- Verify that the zone is DNSSEC correct.

Remove the counterparts for the newly added test from the kasp shell
tests script.
2025-04-23 15:22:04 +00:00
Arаm Sаrgsyаn
47ccf613eb fix: dev: Fix a date race in qpcache_addrdataset()
The 'qpnode->nsec' structure member isn't protected by a lock and
there's a data race between the reading and writing parts in the
qpcache_addrdataset() function. Use a node read lock for accessing
'qpnode->nsec' in qpcache_addrdataset(). Add an additional
'qpnode->nsec != DNS_DB_NSEC_HAS_NSEC' check under a write lock
to be sure that no other competing thread changed it in the time
when the read lock is unlocked and a write lock is not acquired
yet.

Closes #5285

Merge branch '5285-data-race-in-qpcache_addrdataset' into 'main'

See merge request isc-projects/bind9!10397
2025-04-23 13:42:10 +00:00
Aram Sargsyan
e1a415b412 Fix a date race in qpcache_addrdataset()
The 'qpnode->nsec' structure member isn't protected by a lock and
there's a data race between the reading and writing parts in the
qpcache_addrdataset() function. Use a node read lock for accessing
'qpnode->nsec' in qpcache_addrdataset(). Add an additional
'qpnode->nsec != DNS_DB_NSEC_HAS_NSEC' check under a write lock
to be sure that no other competing thread changed it in the time
when the read lock is unlocked and a write lock is not acquired
yet.
2025-04-23 13:02:43 +00:00
Arаm Sаrgsyаn
58a0e6cc61 fix: usr: Fix a serve-stale issue with a delegated zone
When ``stale-answer-client-timeout 0`` option was enabled, it could be ignored
when resolving a zone which is a delegation of an authoritative zone belonging
to the resolver. This has been fixed.

Closes #5275

Merge branch '5275-stale-answer-client-timeout-0-and-delegation-fix' into 'main'

See merge request isc-projects/bind9!10381
2025-04-23 12:59:15 +00:00
Aram Sargsyan
441b7d53f4 Test 'stale-answer-client-timeout 0' with a delegation
Add a new test which gets an answer for a delegated zone, then
checks whether the 'stale-answer-client-timeout 0' mode (i.e. the
'stalefirst' mode) works for it.
2025-04-23 11:46:16 +00:00
Aram Sargsyan
412aa881f2 Fix a serve-stale issue with a delegated zone
When 'stale-answer-client-timeout' is 0, named is allowed to return
a stale answer immediately, while also initiating a new query to get
the real answer. This mode is activated in ns__query_start() by setting
the 'qctx->options.stalefirst' optoin to 'true' before calling the
query_lookup() function, but not when the zone is known to be
authoritative to the server. When the zone is authoritative, and
query_looup() finds out that the requested name is a delegation,
then before proceeding with the query, named tries to look it up
in the cache first. Here comes the issue that it doesn't consider
enabling 'qctx->options.stalefirst' in this case, and so the
'stale-answer-client-timeout 0' setting doesn't work for those
delegated zones - instead of immediately returning the stale answer
(if it exists), named tries to resolve it.

Fix this issue by enabling 'qctx->options.stalefirst' in the
query_zone_delegation() function just before named looks up the name
in the cache using a new query_lookup() call. Also, if nothing was
found in the cache, don't initiate another query_lookup() from inside
query_notfound(), and let query_notfound() do its work, i.e. it will
call query_delegation() for further processing.
2025-04-23 11:46:16 +00:00
Mark Andrews
6285cc3476 fix: usr: Fix EDNS yaml output
`dig` was producing invalid YAML when displaying some EDNS options. This has been corrected.

Several other improvements have been made to the display of EDNS option data:
- We now use the correct name for the UPDATE-LEASE option, which was previously displayed as "UL", and split it into separate LEASE and LEASE-KEY components in YAML mode.
- Human-readable durations are now displayed as comments in YAML mode so as not to interfere with machine parsing.
- KEY-TAG options are now displayed as an array of integers in YAML mode.
- EDNS COOKIE options are displayed as separate CLIENT and SERVER components, and cookie STATUS is a retrievable variable in YAML mode.

Closes #5014

Merge branch '5014-improve-edns-yaml-processing' into 'main'

See merge request isc-projects/bind9!9695
2025-04-22 00:58:14 +00:00
Mark Andrews
5424b30d7a Fix a typo in a test description
The test description "checking delv -c CH is ignored, and
treated like IN" in digdelv was garbled.
2025-04-22 09:24:18 +10:00
Mark Andrews
2efb15b54a Check EDNS CLIENT-TAG and SERVER-TAG are emitted using valid YAML
Check that when an EDNS CLIENT-TAG or EDNS SERVER-TAG option is
present in the message, the emitted YAML is valid.
2025-04-22 09:24:18 +10:00
Mark Andrews
e611e2044a Check EDNS EXPIRE option is emitted using valid YAML
Check that when an EDNS EXPIRE option is present in the message,
the emitted YAML is valid.
2025-04-22 09:24:18 +10:00
Mark Andrews
641ca9044f Check EDNS CLIENT-SUBNET option is emitted using valid YAML
Check that when there is an EDNS CLIENT-SUBNET option in the
message, the emitted YAML is valid.
2025-04-22 09:24:18 +10:00
Mark Andrews
5eeb31f0b9 Split EDNS COOKIE YAML into separate parts
Split the YAML display of the EDNS COOKIE option into CLIENT and SERVER
parts.  The STATUS of the EDNS COOKIE in the reply is now a YAML element
rather than a comment.
2025-04-22 09:24:18 +10:00
Mark Andrews
07c28652a3 Fix EDNS TCP-KEEPALIVE option YAML output
There was missing white space between the option name and its value.
2025-04-22 09:24:18 +10:00
Mark Andrews
81334113c3 Fix EDNS LLQ option YAML output
The EDNS LLQ option was not being emitted as valid YAML. Correct
the output to be valid YAML with each field of the LLQ being
individually selectable.
2025-04-22 09:24:18 +10:00
Mark Andrews
27e8732c17 Change the EDNS KEY-TAG YAML output format
When using YAML, print the EDNS KEY-TAG as an array of integers
for easier machine parsing. Check the validity of the YAML output.
2025-04-22 09:24:18 +10:00
Mark Andrews
378bc7cfa6 Use YAML comments for durations rather than parentheses
This will allow the values to be parsed using standard yaml processing
tools, and still provide the value in a human friendly form.
2025-04-22 09:24:18 +10:00
Mark Andrews
68cdc4774c Change the name and YAML format of EDNS UL
The offical EDNS option name for "UL" is "UPDATE-LEASE".  We now
emit "UPDATE-LEASE" instead of "UL", when printing messages, but
"UL" has been retained as an alias on the command line.

Update leases consist of 1 or 2 values, LEASE and KEY-LEASE.  These
components are now emitted separately so they can be easily extracted
from YAML output.  Tests have been added to check YAML correctness.
2025-04-22 09:24:18 +10:00
Mark Andrews
280e9b7cf4 Add YAML escaping where needed
When rendering text, such as domain names or the EXTRA-TEXT
field of the EDE option, backslashes and quotation marks must
be escaped to ensure that the emitted message is valid YAML.
2025-04-22 09:24:18 +10:00
Mark Andrews
e7ef4e41eb Collapse common switch cases when emitting EDNS options
The CHAIN and REPORT-CHANNEL EDNS options are both domain names, so they
can be combined.  THE CLIENT-TAG and SERVER-TAG EDNS options are both 16
bit integers, so they can be combined.
2025-04-22 09:23:53 +10:00
Ondřej Surý
6f3fea837f fix: usr: Disable own memory context for libxml2 on macOS
Apple broke custom memory allocation functions in the system-wide libxml2 starting with macOS Sequoia 15.4.  Usage of the custom memory allocation functions has been disabled on macOS.

Closes #5268

Merge branch '5268-disable-libxml2-memory-management-on-macos' into 'main'

See merge request isc-projects/bind9!10374
2025-04-18 18:50:18 +00:00
Ondřej Surý
bf1b8824ac Disable own memory context for libxml2 on macOS 15.4 Sequoia
The custom allocation API for libxml2 is deprecated starting in macOS
Sequoia 15.4, iOS 18.4, tvOS 18.4, visionOS 2.4, and tvOS 18.4.

Disable the memory function override for libxml2 when
LIBXML_HAS_DEPRECATED_MEMORY_ALLOCATION_FUNCTIONS is defined as Apple
broke the system-wide libxml2 starting with macOS Sequoia 15.4.
2025-04-18 20:16:13 +02:00
Matthijs Mekking
7211ba147a chg: test: Rewrite kasp system test to pytest (2)
Convert the first batch of tests from `kasp/tests.sh` to `kasp/tests_kasp.py`.

Merge branch 'matthijs-pytest-rewrite-kasp-system-test-2' into 'main'

See merge request isc-projects/bind9!10253
2025-04-17 12:25:36 +00:00
Matthijs Mekking
62a6b9faa7 Fix bugs in isctest.kasp
isctest.util was not imported so file_contents_contain could not be
found. And rename verify_keys to check_keys because it asserts in
isctest.run.retry_with_timeout.
2025-04-17 13:50:49 +02:00
Matthijs Mekking
46aead5a6d The kasp tests require dnspython >= 2.0.0
The kasp tests make use of dns.update.UpdateMessage and dns.tsig.Key,
that are introduced in dnspython 2.0.0.
2025-04-17 13:50:49 +02:00
Matthijs Mekking
07ac0e6036 Convert some special kasp test cases to pytest
This converts a special characters test case, a max-zone-ttl error
check, and two cases of insecure zones.

We no longer assert for having more than one DNSKEY and/or RRSIG
records. If the zone is insecure, this is no longer always true. And
we already check for the expected number of records in the
check_dnskeys/check_signatures functions.
2025-04-17 13:50:49 +02:00
Matthijs Mekking
0b41afbd15 Convert dynamic zone test cases to pytest
This commit deals with converting the dynamic zone test cases to
pytest. The tests for 'inline-signing.kasp' are similar to the default
case, so these are added to 'test_kasp_default'.

Unfortunately I need to add sleep calls in between freezing, updating,
and thawing a zone. Without it the intermittent failures are too
frequent.
2025-04-17 13:50:49 +02:00
Matthijs Mekking
4e22b019f5 Convert kasp default test cases to pytest
This commit deals with converting the test cases related to the default
dnssec-policy.

This requires a new method 'check_update_is_signed'. This method will
be used in future tests as well, and checks if an expected record is
in the zone and is properly signed.

Remove the counterparts for the newly added test from the kasp shell
tests script.
2025-04-17 13:50:49 +02:00
Matthijs Mekking
00ea2c2564 Convert kasp dnssectools tests to pytest
Convert the first couple of tests from 'kasp/tests.sh' to
'kasp/tests_kasp.py', those are test cases related to 'dnssec-keygen'
and 'dnssec-settime'.

For this, we also add a new KeyProperties method,
'policy_to_properties', that takes a list of strings which represent
the keys according to the dnssec-policy and the expected key states.
2025-04-17 13:50:49 +02:00
Michal Nowak
3a38a5fcad new: ci: Add Fedora 42
Merge branch 'mnowak/fedora-42' into 'main'

See merge request isc-projects/bind9!10404
2025-04-17 08:04:07 +00:00