]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
13 months agoAdd option request-zoneversion
Mark Andrews [Fri, 14 Jun 2024 01:23:53 +0000 (11:23 +1000)] 
Add option request-zoneversion

This can be set at the option, view and server levels and causes
named to add an EDNS ZONEVERSION option to requests.  Replies are
logged to the 'zoneversion' category.

13 months agoAdd system tests for EDNS zoneversion
Mark Andrews [Thu, 13 Jun 2024 00:32:49 +0000 (10:32 +1000)] 
Add system tests for EDNS zoneversion

13 months agoReturn EDNS ZONEVERSION if requested
Mark Andrews [Wed, 12 Jun 2024 22:36:32 +0000 (08:36 +1000)] 
Return EDNS ZONEVERSION if requested

If there was an EDNS ZONEVERSION option in the DNS request and the
answer was from a zone, return the zone's serial and number of
labels excluding the root label with the type set to 0 (ZONE-SERIAL).

13 months agoAdd dns_zone_getzoneversion
Mark Andrews [Thu, 29 Aug 2024 01:05:09 +0000 (11:05 +1000)] 
Add dns_zone_getzoneversion

Returns the EDNS ZONEVERSION for the zone.  Return the database
specific version otherwise return a type 0 version (serial).

13 months agoAdd dns_db_getzoneversion
Mark Andrews [Thu, 29 Aug 2024 01:26:58 +0000 (11:26 +1000)] 
Add dns_db_getzoneversion

Provides a database method to return a database specific EDNS
ZONEVERSION option.  The default EDNS ZONEVERSION is serial.

13 months agoAdd EDNS ZONEVERSION option counter
Mark Andrews [Wed, 12 Jun 2024 22:13:28 +0000 (08:13 +1000)] 
Add EDNS ZONEVERSION option counter

13 months agoAdd support for EDNS ZONEVERSION to dig
Mark Andrews [Wed, 12 Jun 2024 21:53:59 +0000 (07:53 +1000)] 
Add support for EDNS ZONEVERSION to dig

This add the +[no]zoneversion option to dig which adds the
EDNS ZONEVERSION option to requests.

13 months agoExtend message code to display ZONEVERSION
Mark Andrews [Wed, 12 Jun 2024 21:34:59 +0000 (07:34 +1000)] 
Extend message code to display ZONEVERSION

13 months agoCheck EDNS ZONEVERSION when parsing OPT record
Mark Andrews [Wed, 12 Jun 2024 06:23:05 +0000 (16:23 +1000)] 
Check EDNS ZONEVERSION when parsing OPT record

13 months agofix: ci: Set more lenient respdiff limits
Michal Nowak [Mon, 24 Mar 2025 14:11:03 +0000 (14:11 +0000)] 
fix: ci: Set more lenient respdiff limits

After !9950, respdiff's maximal disagreement percentage needs to be
adjusted as target disagreements between the tested version of the
"main" branch and the reference one jumped for the respdiff,
respdiff:asan, and respdiff:tsan jobs from on average 0.07% to 0.16% and
from 0.12% to 0.17% for the respdiff-third-party job.

In !9950, we concluded setting MAX_DISAGREEMENTS_PERCENTAGE to double
the average disagreement percentage works fine in the CI.

Merge branch 'mnowak/more-lenient-respdiff-limits' into 'main'

See merge request isc-projects/bind9!10293

13 months agoSet more lenient respdiff limits
Michal Nowak [Wed, 19 Mar 2025 13:02:32 +0000 (14:02 +0100)] 
Set more lenient respdiff limits

After !9950, respdiff's maximal disagreement percentage needs to be
adjusted as target disagreements between the tested version of the
"main" branch and the reference one jumped for the respdiff,
respdiff:asan, and respdiff:tsan jobs from on average 0.07% to 0.16% and
from 0.12% to 0.17% for the respdiff-third-party job.

In !9950, we concluded setting MAX_DISAGREEMENTS_PERCENTAGE to double
the average disagreement percentage works fine in the CI.

13 months agofix: dev: Fix adbname reference
Mark Andrews [Fri, 21 Mar 2025 00:26:25 +0000 (00:26 +0000)] 
fix: dev: Fix adbname reference

Call `dns_adbname_ref` before calling `dns_resolver_createfetch` to
ensure `adbname->name` remains stable for the life of the fetch.

Closes #5239

Merge branch '5239-fix-adb-reference-counting' into 'main'

See merge request isc-projects/bind9!10290

13 months agoFix gaining adbname reference
Mark Andrews [Wed, 19 Mar 2025 02:31:35 +0000 (13:31 +1100)] 
Fix gaining adbname reference

Call dns_adbname_ref before calling dns_resolver_createfetch to
ensure adbname->name remains stable for the life of the fetch.

13 months agofix: dev: Optimize key ID check when searching for matching keys
Evan Hunt [Thu, 20 Mar 2025 18:25:05 +0000 (18:25 +0000)] 
fix: dev: Optimize key ID check when searching for matching keys

When searching through a DNSKEY or KEY rrset for the key matching a particular algorithm and ID, it's a waste of time to convert every key into a `dst_key` object; it's faster to compute the key ID from the rdata, then do the full key conversion after determining that we've found the right key. This optimization was already used in the validator, but it's been refactored for code clarity, and is now also used in query.c and message.c.

Merge branch 'each-refactor-key-search' into 'main'

See merge request isc-projects/bind9!10258

13 months agooptimize key ID check when searching for matching keys
Evan Hunt [Fri, 14 Mar 2025 23:41:47 +0000 (16:41 -0700)] 
optimize key ID check when searching for matching keys

when searching a DNSKEY or KEY rrset for the key that matches
a particular algorithm and ID, it's a waste of time to convert
every key into a dst_key object; it's faster to compute the key
ID by checksumming the region, and then only do the full key
conversion once we know we've found the correct key.

this optimization was already in use in the validator, but it's
been refactored for code clarity, and is now also used in query.c
and message.c.

13 months agomove dns_zonekey_iszonekey() to dns_dnssec module
Evan Hunt [Thu, 13 Mar 2025 20:01:47 +0000 (13:01 -0700)] 
move dns_zonekey_iszonekey() to dns_dnssec module

dns_zonekey_iszonekey() was the only function defined in the
dns_zonekey module, and was only called from one place. it
makes more sense to group this with dns_dnssec functions.

13 months agochg: dev: Switch symtab to use fxhash hashing
Alessio Podda [Thu, 20 Mar 2025 13:00:12 +0000 (13:00 +0000)] 
chg: dev: Switch symtab to use fxhash hashing

This merge request resolves some performance regressions introduced
with the change from isc_symtab_t to isc_hashmap_t.

The key improvements are:

1. Using a faster hash function than both isc_hashmap_t and
   isc_symtab_t. The previous implementation used SipHash, but the
   hashflood resistance properties of SipHash are unneeded for config
   parsing.
2. Shrinking the initial size of the isc_hashmap_t used inside
   isc_symtab_t. Symtab is mainly used for config parsing, and the
   when used that way it will have between 1 and 50 keys, but the
   previous implementation initialized a map with 128 slots.
   By initializing a smaller map, we speed up mallocs and optimize for
   the typical case of few config keys.
3. Slight optimization of the string matching in the hashmap, so that
   the tail is handled in a single load + comparison, instead of byte
   by byte.
   Of the three improvements, this is the least important.

Merge branch 'alessio/fxhash-symtab' into 'main'

See merge request isc-projects/bind9!10204

13 months agoSwitch symtab to use fxhash hashing
alessio [Thu, 27 Feb 2025 06:37:04 +0000 (07:37 +0100)] 
Switch symtab to use fxhash hashing

This merge request resolves some performance regressions introduced
with the change from isc_symtab_t to isc_hashmap_t.

The key improvements are:

1. Using a faster hash function than both isc_hashmap_t and
   isc_symtab_t. The previous implementation used SipHash, but the
   hashflood resistance properties of SipHash are unneeded for config
   parsing.
2. Shrinking the initial size of the isc_hashmap_t used inside
   isc_symtab_t. Symtab is mainly used for config parsing, and the
   when used that way it will have between 1 and ~50 keys, but the
   previous implementation initialized a map with 128 slots.
   By initializing a smaller map, we speed up mallocs and optimize for
   the typical case of few config keys.
3. Slight optimization of the string matching in the hashmap, so that
   the tail is handled in a single load + comparison, instead of byte
   by byte.
   Of the three improvements, this is the least important.

13 months agofix: usr: Fix several small DNSSEC timing issues
Matthijs Mekking [Thu, 20 Mar 2025 10:13:22 +0000 (10:13 +0000)] 
fix: usr: Fix several small DNSSEC timing issues

The following small issues related to `dnssec-policy` have been fixed:
- In some cases the key manager inside BIND 9 could run every hour, while it could have run less often.
- While `CDS` and `CDNSKEY` records will be removed correctly from the zone when the corresponding `DS` record needs to be updated, the expected timing metadata when this will happen was never set.
- There were a couple of cases where the safety intervals are added inappropriately, delaying key rollovers longer than necessary.
- If you have identical `keys` in your `dnssec-policy`, they may be retired inappropriately. Note that having keys with identical properties is discouraged in all cases.

Closes #5242

Merge branch '5242-several-keymgr-issues' into 'main'

See merge request isc-projects/bind9!10251

13 months agoUpdate Retired and Removed if we update lifetime
Matthijs Mekking [Tue, 18 Mar 2025 11:23:34 +0000 (12:23 +0100)] 
Update Retired and Removed if we update lifetime

If we are updating the lifetime, and it was not set before, also
set/update the Retired and Removed timing metadata.

13 months agoFix a key generation issue in the tests
Matthijs Mekking [Mon, 24 Feb 2025 10:36:53 +0000 (11:36 +0100)] 
Fix a key generation issue in the tests

The dnssec-keygen command for the ZSK generation for the zone
multisigner-model2.kasp was wrong (no ZSK was generated in the setup
script, but when 'named' is started, the missing ZSK was created
anyway by 'dnssec-policy'.

13 months agoFix keymgr bug wrt setting the next time
Matthijs Mekking [Tue, 4 Mar 2025 16:18:36 +0000 (17:18 +0100)] 
Fix keymgr bug wrt setting the next time

Only set the next time the keymgr should run if the value is non zero.
Otherwise we default back to one hour. This may happen if there is one
or more key with an unlimited lifetime.

13 months agokeymgr: also set DeleteCDS when setting PublishCDS
Matthijs Mekking [Tue, 4 Mar 2025 16:14:33 +0000 (17:14 +0100)] 
keymgr: also set DeleteCDS when setting PublishCDS

The keymgr never set the expected timing metadata when CDS/CDNSKEY
records for the corresponding key will be removed from the zone. This
is not troublesome, as key states dictate when this happens, but with
the new pytest we use the timing metadata to determine if the CDS and/or
CDNSKEY for the given key needs to be published.

13 months agoFix wrong usage of safety intervals in keymgr
Matthijs Mekking [Mon, 3 Mar 2025 11:07:03 +0000 (12:07 +0100)] 
Fix wrong usage of safety intervals in keymgr

There are a couple of cases where the safety intervals are added
inappropriately:

1. When setting the PublishCDS/SyncPublish timing metadata, we don't
   need to add the publish-safety value if we are calculating the time
   when the zone is completely signed for the first time. This value
   is for when the DNSKEY has been published and we add a safety
   interval before considering the DNSKEY omnipresent.

2. The retire-safety value should only be added to ZSK rollovers if
   there is an actual rollover happening, similar to adding the sign
   delay.

3. The retire-safety value should only be added to KSK rollovers if
   there is an actual rollover happening. We consider the new DS
   omnipresent a bit later, so that we are forced to keep the old DS
   a bit longer.

13 months agoFix a small keymgr bug
Matthijs Mekking [Tue, 25 Feb 2025 07:40:33 +0000 (08:40 +0100)] 
Fix a small keymgr bug

While converting the kasp system test to pytest, I encountered a small
bug in the keymgr code. We retire keys when there is more than one
key matching a 'keys' line from the dnssec-policy. But if there are
multiple identical 'keys' lines, as is the case for the test zone
'checkds-doubleksk.kasp', we retire one of the two keys that have the
same properties.

Fix this by checking if there are double matches. This is not fool proof
because there may be many keys for a few identical 'keys' lines, but it
is good enough for now. In practice it makes no sense to have a policy
that dictates multiple keys with identical properties.

13 months agofix: usr: Fix write after free in validator code
Mark Andrews [Thu, 20 Mar 2025 01:30:11 +0000 (01:30 +0000)] 
fix: usr: Fix write after free in validator code

Raw integer pointers were being used for the validator's nvalidations
and nfails values but the memory holding them could be freed before
they ceased to be used.  Use reference counted counters instead.

Closes #5239

Merge branch '5239-use-counter-for-nvalidations-and-nfailss' into 'main'

See merge request isc-projects/bind9!10248

14 months agoUse reference counted counters for nfail and nvalidations
Mark Andrews [Fri, 14 Mar 2025 04:23:43 +0000 (15:23 +1100)] 
Use reference counted counters for nfail and nvalidations

The fetch context that held these values could be freed while there
were still active pointers to the memory.  Using a reference counted
pointer avoids this.

14 months agoMerge tag 'v9.21.6'
Andoni Duarte Pintado [Wed, 19 Mar 2025 16:36:14 +0000 (17:36 +0100)] 
Merge tag 'v9.21.6'

14 months agofix: test: Fix the log-report-channel zones check
Michal Nowak [Wed, 19 Mar 2025 08:00:42 +0000 (08:00 +0000)] 
fix: test: Fix the log-report-channel zones check

The check looks for logs that are not present, fails to make the
possible failure visible, and fails to bump the check enumerator:

    I:checking that log-report-channel zones fail if '*._er/TXT' is missing (129)
    grep: test.out4.129: No such file or directory
    grep: test.out4.129: No such file or directory
    I:checking that raw zone with bad class is handled (129)

The issue appeared in #3659.

Merge branch 'mnowak/checkzone-test-fix' into 'main'

See merge request isc-projects/bind9!10286

14 months agoFix the log-report-channel zones check
Michal Nowak [Tue, 18 Mar 2025 15:10:49 +0000 (16:10 +0100)] 
Fix the log-report-channel zones check

The check looks for logs that are not present, fails to make the
possible failure visible, and fails to bump the check enumerator:

    I:checking that log-report-channel zones fail if '*._er/TXT' is missing (129)
    grep: test.out4.129: No such file or directory
    grep: test.out4.129: No such file or directory
    I:checking that raw zone with bad class is handled (129)

14 months agofix: test: Fix failing grep invocation on OpenBSD
Mark Andrews [Wed, 19 Mar 2025 00:04:39 +0000 (00:04 +0000)] 
fix: test: Fix failing grep invocation on OpenBSD

Lines starting with A or NSEC are expected but not matched with the
OpenBSD grep. Extended regular expressions with direct use of
parentheses and the pipe symbol is more appropriate.

    I:checking RRSIG query from cache (154)
    I:failed

The issue appeared in #4805.

Merge branch 'mnowak/openbsd-grep-fix' into 'main'

See merge request isc-projects/bind9!10285

14 months agoFix failing grep invocation on OpenBSD
Michal Nowak [Tue, 18 Mar 2025 15:00:53 +0000 (16:00 +0100)] 
Fix failing grep invocation on OpenBSD

Lines starting with A or NSEC are expected but not matched with the
OpenBSD grep. Extended regular expressions with direct use of
parentheses and the pipe symbol is more appropriate.

    I:checking RRSIG query from cache (154)
    I:failed

14 months agofix: usr: Fix resolver statistics counters for timed out responses
Arаm Sаrgsyаn [Tue, 18 Mar 2025 17:05:23 +0000 (17:05 +0000)] 
fix: usr: Fix resolver statistics counters for timed out responses

When query responses timed out, the resolver could incorrectly increase the regular responses counters, even if no response was received. This has been fixed.

Closes #5193

Merge branch '5193-resolver-statistics-counters-fix' into 'main'

See merge request isc-projects/bind9!10227

14 months agoTest resolver statistics when responses time out
Aram Sargsyan [Thu, 6 Mar 2025 14:37:09 +0000 (14:37 +0000)] 
Test resolver statistics when responses time out

Add a test to check that the timed out responses do not skew the
normal responses statistics counters, and that they do update the
timeouts counter.

14 months agoFix the resolvers RTT-ranged responses statistics counters
Aram Sargsyan [Thu, 6 Mar 2025 14:28:48 +0000 (14:28 +0000)] 
Fix the resolvers RTT-ranged responses statistics counters

When a response times out the fctx_cancelquery() function
incorrectly calculates it in the 'dns_resstatscounter_queryrtt5'
counter (i.e. >=1600 ms). To avoid this, the rctx_timedout()
function should make sure that 'rctx->finish' is NULL. And in order
to adjust the RTT values for the timed out server, 'rctx->no_response'
should be true. Update the rctx_timedout() function to make those
changes.

14 months agoFix resolver responses statistics counter
Aram Sargsyan [Thu, 6 Mar 2025 14:26:23 +0000 (14:26 +0000)] 
Fix resolver responses statistics counter

The resquery_response() function increases the response counter without
checking if the response was successful. Increase the counter only when
the result indicates success.

14 months agochg: test: asyncserver.py: TCP improvements
Michał Kępień [Tue, 18 Mar 2025 15:30:35 +0000 (15:30 +0000)] 
chg: test: asyncserver.py: TCP improvements

This branch started off as `michal/upforwd-asyncserver`.  It quickly
turned out that the critical `asyncserver.py` change that was needed for
the `upforwd` system test was for the server to be able to read multiple
TCP queries on a single connection.  As currently present in `main`,
`asyncserver.py` closes every client connection after servicing a single
query.  Retaining that behavior would cause the `upforwd` system test to
fail and, in general, capturing all data sent by a client seems more
useful in tests than just closing connections quickly.  `asyncserver.py`
can always be extended in the future (e.g. by adding a new
`ResponseAction` that the networking code would react to) to reinstate
the original behavior, if it turns out to be necessary.

While working on changing that particular `asyncserver.py` behavior, I
noticed a couple of other deficiencies in the TCP connection handling
code, so I started addressing them.  One thing led to another and before
I noticed, enough changes were applied to be worth doing a separate
merge request, particularly given that the actual rewrite of
`upforwd/ans4/ans.pl` using `asyncserver.py` is trivial once the
required changes to `asyncserver.py` itself are applied.

Merge branch 'michal/asyncserver-tcp-improvements' into 'main'

See merge request isc-projects/bind9!10276

14 months agoHandle queries indefinitely on each TCP connection
Michał Kępień [Tue, 18 Mar 2025 15:28:18 +0000 (16:28 +0100)] 
Handle queries indefinitely on each TCP connection

Instead of closing every incoming TCP connection after handling a single
query, continue receiving queries on each TCP connection until the
client disconnects itself.  When coupled with response dropping, this
enables silently receiving all incoming data, simulating an unresponsive
server.

14 months agoEnable receiving chunked TCP DNS messages
Michał Kępień [Tue, 18 Mar 2025 15:28:18 +0000 (16:28 +0100)] 
Enable receiving chunked TCP DNS messages

A TCP DNS client may send its queries in chunks, causing
StreamReader.read() to return less data than previously declared by the
client as the DNS message length; even the two-octet DNS message length
itself may be split up into two single-octet transmissions.  Sending
data in chunks is valid client behavior that should not be treated as an
error.  Add a new helper method for reading TCP data in a loop, properly
distinguishing between chunked queries and client disconnections.  Use
the new method for reading all TCP data from clients.

14 months agoExtend TCP logging
Michał Kępień [Tue, 18 Mar 2025 15:28:18 +0000 (16:28 +0100)] 
Extend TCP logging

Emit more log messages from TCP connection handling code and extend
existing ones to improve debuggability of servers using asyncserver.py.

14 months agoHandle connection resets during reading
Michał Kępień [Tue, 18 Mar 2025 15:28:18 +0000 (16:28 +0100)] 
Handle connection resets during reading

A TCP peer may reset the connection at any point, but asyncserver.py
currently only handles connection resets when it is sending data to the
client.  Handle connection resets during reading in the same way.

14 months agoRefactor AsyncDnsServer._handle_tcp()
Michał Kępień [Tue, 18 Mar 2025 15:28:18 +0000 (16:28 +0100)] 
Refactor AsyncDnsServer._handle_tcp()

Split up AsyncDnsServer._handle_tcp() into a set of smaller methods to
improve code readability.

14 months agoGracefully handle TCP client disconnections
Michał Kępień [Tue, 18 Mar 2025 15:28:18 +0000 (16:28 +0100)] 
Gracefully handle TCP client disconnections

Prevent premature client disconnections during reading from triggering
unhandled exceptions in TCP connection handling code.

14 months agoSimplify peer address formatting
Michał Kępień [Tue, 18 Mar 2025 15:28:18 +0000 (16:28 +0100)] 
Simplify peer address formatting

Add a helper class, Peer, which holds the <host, port> tuple of a
connection endpoint and gets pretty-printed when formatted as a string.
This enables passing instances of this new class directly to logging
functions, eliminating the need for the AsyncDnsServer._format_peer()
helper method.

14 months agochg: ci: Allow re-run of the shotgun jobs to reduce false positives
Nicki Křížek [Tue, 18 Mar 2025 09:29:10 +0000 (09:29 +0000)] 
chg: ci: Allow re-run of the shotgun jobs to reduce false positives

The false positive rate is about 10-20 % when evaluating shotgun results
from a single run. Attempt to reduce the false positive rate by allowing
a re-run of failed jobs.

Merge branch 'nicki/ci-shotgun-reduce-false-positives' into 'main'

See merge request isc-projects/bind9!10271

14 months agoAllow re-run of the shotgun jobs to reduce false positive
Nicki Křížek [Wed, 12 Mar 2025 16:24:05 +0000 (17:24 +0100)] 
Allow re-run of the shotgun jobs to reduce false positive

The false positive rate is about 10-20 % when evaluating shotgun results
from a single run. Attempt to reduce the false positive rate by allowing
a re-run of failed jobs.

While there is a slight risk that barely noticable decreases in
performance might slip by more easily in MRs, they'd still likely pop up
during nightly or pre-release testing.

Also increase the tolerance threshold for DoH latency comparisons, as
those tests often experience increased jitter in the tail end latencies.

14 months agoAdjust the load factor for shotgun:tcp test
Nicki Křížek [Wed, 12 Mar 2025 16:03:50 +0000 (17:03 +0100)] 
Adjust the load factor for shotgun:tcp test

With the slightly decreased load for the TCP test, the results appear to
be a little bit more stable.

14 months agochg: test: Use isctest.asyncserver in the "qmin" test
Michał Kępień [Tue, 18 Mar 2025 05:55:17 +0000 (05:55 +0000)] 
chg: test: Use isctest.asyncserver in the "qmin" test

Replace custom DNS servers used in the "qmin" system test with new code
based on the isctest.asyncserver module.  The revised code employs zone
files and a limited amount of custom logic, which massively improves
test readability and maintainability, extends logging, and fixes
non-compliant replies sent by some of the custom servers in response to
certain queries (e.g. AA=0 in authoritative empty non-terminal
responses, non-glue address records in ADDITIONAL section).

Merge branch 'michal/qmin-asyncserver' into 'main'

See merge request isc-projects/bind9!10195

14 months agoBroaden vulture exclude glob for ans.py servers
Michał Kępień [Tue, 18 Mar 2025 05:19:01 +0000 (06:19 +0100)] 
Broaden vulture exclude glob for ans.py servers

The vulture tool seems to be unable to follow how the parent classes
defined in bin/tests/system/qmin/qmin_ans.py use mandatory properties
specified by child classes in bin/tests/system/qmin/ans*/ans.py.  Make
the tool ignore not just ans.py servers, but also *_ans.py utility
modules above the ansX/ subdirectories to prevent false positives about
unused code from causing CI pipeline failures.

14 months agoIgnore .hypothesis files created by system tests
Michał Kępień [Tue, 18 Mar 2025 05:19:01 +0000 (06:19 +0100)] 
Ignore .hypothesis files created by system tests

Some versions of the Hypothesis Python library - notably the one
included in stock OS repositories for Ubuntu 20.04 Focal Fossa - cause a
.hypothesis file to be created in a Python script's working directory
when the hypothesis module is present in its import chain.  Ignore such
files by adding them to the list of expected test artifacts to prevent
pytest teardown checks from failing due to these files appearing in the
file system after running system tests.

14 months agoFix PYTHONPATH set for ans.py servers by start.pl
Michał Kępień [Tue, 18 Mar 2025 05:19:01 +0000 (06:19 +0100)] 
Fix PYTHONPATH set for ans.py servers by start.pl

Commit 6c010a5644324947c8c13b5600cd8d988ae7684f caused the PYTHONPATH
environment variable to be set for ans.py servers started using
start.pl.  However, no system test has actually used the new
isctest.asyncserver module since that change was applied, so it has not
been noticed until now that including the source directory in PYTHONPATH
is only sufficient for in-tree builds.  Include the build directory
instead of the source directory in the PYTHONPATH environment variable
set for ans.py servers started by start.pl so that they work correctly
for both in-tree and out-of-tree builds.

14 months agoUse isctest.asyncserver in the "qmin" test
Michał Kępień [Tue, 18 Mar 2025 05:19:01 +0000 (06:19 +0100)] 
Use isctest.asyncserver in the "qmin" test

Replace custom DNS servers used in the "qmin" system test with new code
based on the isctest.asyncserver module.  The revised code employs zone
files and a limited amount of custom logic, which massively improves
test readability and maintainability, extends logging, and fixes
non-compliant replies sent by some of the custom servers in response to
certain queries (e.g. AA=0 in authoritative empty non-terminal
responses, non-glue address records in ADDITIONAL section).

14 months agorem: dev: Cleanup BIND 8 compatibility code
Ondřej Surý [Tue, 18 Mar 2025 00:12:31 +0000 (00:12 +0000)] 
rem: dev: Cleanup BIND 8 compatibility code

There was some code in dns_resolver unit meant to keep compatibility with BIND 8 breaking the DNS protocol.  These should not be needed anymore.

Merge branch 'ondrej/resolver-bind-8-cleanup' into 'main'

See merge request isc-projects/bind9!10270

14 months agoRemove a kludge to process non-authoritative CNAME response
Ondřej Surý [Mon, 17 Mar 2025 15:31:14 +0000 (16:31 +0100)] 
Remove a kludge to process non-authoritative CNAME response

A BIND 8 server could return a non-authoritative answer when a CNAME is
followed.  This is no longer handled as a valid answer.

14 months agoRemove the kludges for records in the bad sections
Ondřej Surý [Mon, 17 Mar 2025 14:27:38 +0000 (15:27 +0100)] 
Remove the kludges for records in the bad sections

There were kludges to help process responses from authoritative servers
giving RRs in wrong sections (mentioning BIND 8).  These should just go
away and such responses should not be processed.

14 months agoSmall cleanup in dns_adb unit
Ondřej Surý [Mon, 17 Mar 2025 14:23:00 +0000 (15:23 +0100)] 
Small cleanup in dns_adb unit

14 months agochg: ci: Disable linkcheck on dl.acm.org
Michal Nowak [Mon, 17 Mar 2025 17:07:40 +0000 (17:07 +0000)] 
chg: ci: Disable linkcheck on dl.acm.org

The check fails with the following error for some time:

    403 Client Error: Forbidden for url: https://dl.acm.org/doi/10.1145/1315245.1315298

Merge branch 'mnowak/linkcheck-disable-dl-acm-org' into 'main'

See merge request isc-projects/bind9!10272

14 months agoDisable linkcheck on dl.acm.org
Michal Nowak [Mon, 17 Mar 2025 16:39:36 +0000 (17:39 +0100)] 
Disable linkcheck on dl.acm.org

The check fails with the following error for some time:

    403 Client Error: Forbidden for url: https://dl.acm.org/doi/10.1145/1315245.1315298

14 months agonew: dev: Implement -T cookiealwaysvalid
Arаm Sаrgsyаn [Mon, 17 Mar 2025 11:36:57 +0000 (11:36 +0000)] 
new: dev: Implement -T cookiealwaysvalid

When `-T cookiealwaysvalid` is passed to `named`, DNS cookie checks for
the incoming queries always pass, given they are structurally correct.

Merge branch 'aram/new-named-minus-T-option-of-cookiealwaysvalid' into 'main'

See merge request isc-projects/bind9!10232

14 months agoTest -T cookiealwaysvalid
Aram Sargsyan [Tue, 11 Mar 2025 14:29:22 +0000 (14:29 +0000)] 
Test -T cookiealwaysvalid

Add a check in the "cookie" system test to make sure that the new
'-T cookiealwaysvalid' option works.

14 months agoImplement -T cookiealwaysvalid
Aram Sargsyan [Tue, 11 Mar 2025 14:03:56 +0000 (14:03 +0000)] 
Implement -T cookiealwaysvalid

When -T cookiealwaysvalid is passed to named, DNS cookie checks for
the incoming queries always pass, given they are structurally correct.

14 months agofix: dev: Add missing locks when returning addresses
Mark Andrews [Sat, 15 Mar 2025 06:04:34 +0000 (06:04 +0000)] 
fix: dev: Add missing locks when returning addresses

Add missing locks in dns_zone_getxfrsource4 et al.  Addresses CID 468706, 468708, 468741, 468742, 468785, and 468778.

Cleanup dns_zone_setxfrsource4 et al to now return void.

Remove double copies with dns_zone_getprimaryaddr and dns_zone_getsourceaddr.

Closes #4933

Merge branch '4933-add-missing-locks-when-returning-addresses' into 'main'

See merge request isc-projects/bind9!9485

14 months agoAdd missing locks when returning addresses
Mark Andrews [Thu, 12 Sep 2024 02:54:25 +0000 (12:54 +1000)] 
Add missing locks when returning addresses

Add missing locks in dns_zone_getxfrsource4 et al. Addresses CID
468706, 468708, 468741, 468742, 468785 and 468778.

Cleanup dns_zone_setxfrsource4 et al to now return void.

Remove double copies with dns_zone_getprimaryaddr and dns_zone_getsourceaddr.

14 months agofix: nil: Add new convenience functions to classify rdata types
Evan Hunt [Sat, 15 Mar 2025 01:26:35 +0000 (01:26 +0000)] 
fix: nil: Add new convenience functions to classify rdata types

- `dns_rdatatype_ismulti()` returns true if a given type can have
  multiple answers: ANY, RRSIG, or SIG.
- `dns_rdatatype_issig()` returns true for a signature: RRSIG or SIG.
- `dns_rdatatype_isaddr()` returns true for an address: A or AAAA.
- `dns_rdatatype_isalias()` returns true for an alias: CNAME or DNAME.

Code has been modified to use these functions where applicable.

These and all similar functions (e.g., `dns_rdatatype_ismeta()`, `dns_rdatatype_issingleton()`, etc) are now `static inline` functions defined in `rdata.h`.

Merge branch 'each-rdatatype-functions' into 'main'

See merge request isc-projects/bind9!10216

14 months agouse new dns_rdatatype classification functions
Evan Hunt [Tue, 4 Mar 2025 23:51:49 +0000 (15:51 -0800)] 
use new dns_rdatatype classification functions

modify code to use dns_rdatatype_ismulti(), dns_rdatatype_issig(),
dns_rdatatype_isaddr(), and dns_rdatatype_isalias() where applicable.

14 months agoconvert rdatatype classification routines to inline
Evan Hunt [Wed, 5 Mar 2025 00:21:50 +0000 (16:21 -0800)] 
convert rdatatype classification routines to inline

turn the dns_rdatatype_is*() functions into static inline
functions in rdata.h.

14 months agoadd new functions to classify rdata types
Evan Hunt [Tue, 4 Mar 2025 23:51:49 +0000 (15:51 -0800)] 
add new functions to classify rdata types

- dns_rdatatype_ismulti() returns true if a given type can have
  multiple answers: ANY, RRSIG, or SIG.
- dns_rdatatype_issig() returns true for a signature: RRSIG or SIG.
- dns_rdatatype_isaddr() returns true for an address: A or AAAA.
- dns_rdatatype_isalias() returns true for an alias: CNAME or DNAME.

14 months agofix: dev: step() could ignore rollbacks
Evan Hunt [Fri, 14 Mar 2025 23:19:36 +0000 (23:19 +0000)] 
fix: dev: step() could ignore rollbacks

The `step()` function (used for stepping to the prececessor or successor of a database node) could overlook a node if there was an rdataset that was marked IGNORE because it had been rolled back, covering an active rdataset under it.

Closes #5170

Merge branch '5170-step-ignores-rollback' into 'main'

See merge request isc-projects/bind9!10103

14 months agoadd a unit test with an empty node
Evan Hunt [Wed, 5 Mar 2025 23:46:17 +0000 (15:46 -0800)] 
add a unit test with an empty node

the db_test unit test now looks up an empty nonterminal node
to exercise the behavior of the step() function in qpzone.

14 months agoadd a unit test to check database rollback
Evan Hunt [Wed, 5 Mar 2025 04:21:04 +0000 (20:21 -0800)] 
add a unit test to check database rollback

check that a database rollback works and the correct
(original) data is found on lookup.

14 months agoqpzone.c:step() could ignore rollbacks
Evan Hunt [Sat, 15 Feb 2025 05:42:34 +0000 (21:42 -0800)] 
qpzone.c:step() could ignore rollbacks

the step() function (used for stepping to the prececessor or
successor of a database node) could overlook a node because
there was an rdataset marked IGNORE because it had been rolled
back, covering an active rdataset under it.

14 months agofix: dev: Fix handling of revoked keys
Evan Hunt [Fri, 14 Mar 2025 22:26:36 +0000 (22:26 +0000)] 
fix: dev: Fix handling of revoked keys

When a key is revoked, its key ID changes due to the inclusion of the "revoked" flag. A collision between this changed key ID
and an unrelated public-only key could cause a crash in `dnssec-signzone`.

Closes #5231

Merge branch '5231-fix-keyid-collision' into 'main'

See merge request isc-projects/bind9!10233

14 months agofix handling of revoked keys
Evan Hunt [Tue, 11 Mar 2025 20:36:00 +0000 (13:36 -0700)] 
fix handling of revoked keys

when a key is revoked its key ID changes, due to the inclusion
of the "revoke" flag. a collision between this changed key ID and
that of an unrelated public-only key could cause a crash in
dnssec-signzone.

14 months agofix: test: Tune many types tests in reclimit test
Mark Andrews [Fri, 14 Mar 2025 05:28:01 +0000 (05:28 +0000)] 
fix:  test:  Tune many types tests in reclimit test

The `I:checking that lifting the limit will allow everything to get
cached (20)` test was failing due to the TTL of the records being
too short for the elapsed time of the test.  Raise the TTL to fix
this and adjust other tests as needed.

Closes #5206

Merge branch '5206-tune-last-sub-test-of-reclimit' into 'main'

See merge request isc-projects/bind9!10177

14 months agoTune many types tests in reclimit test
Mark Andrews [Wed, 26 Feb 2025 21:36:54 +0000 (08:36 +1100)] 
Tune many types tests in reclimit test

The 'I:checking that lifting the limit will allow everything to get
cached (20)' test was failing due to the TTL of the records being
too short for the elapsed time of the test.  Raise the TTL to fix
this and adjust other tests as needed.

14 months agofix: usr: QNAME minimization could leak the query type
Mark Andrews [Fri, 14 Mar 2025 02:02:52 +0000 (02:02 +0000)] 
fix: usr: QNAME minimization could leak the query type

When performing QNAME minimization, `named` now sends an NS query for the original query name, before sending the final query. This prevents the parent zone from learning the original query type, in the event that the query name is a delegation point.

For example, when looking up an address record for `example.com`, NS queries are now sent to the servers for both `com` and `example.com`, before the address query is sent to the servers for `example.com`.  Previously, an address query would have been sent to the servers for `com`.

Closes #4805

Merge branch '4805-missing-qname-ns-query-when-using-qname-minimisation' into 'main'

See merge request isc-projects/bind9!9155

14 months agoDon't leak the original QTYPE to parent zone
Mark Andrews [Thu, 18 Jul 2024 03:27:23 +0000 (13:27 +1000)] 
Don't leak the original QTYPE to parent zone

When performing QNAME minimization, named now sends an NS
query for the original QNAME, to prevent the parent zone from
receiving the QTYPE.

For example, when looking up example.com/A, we now send NS queries
for both com and example.com before sending the A query to the
servers for example.com.  Previously, an A query for example.com
would have been sent to the servers for com.

Several system tests needed to be adjusted for the new query pattern:

- Some queries in the serve-stale test were sent to the wrong server.
- The synthfromdnssec test could fail due to timing issues; this
  has been addressed by adding a 1-second delay.
- The cookie test could fail due to the a change in the count of
  TSIG records received in the "check that missing COOKIE with a
  valid TSIG signed response does not trigger TCP fallback" test case.
- The GL #4652 regression test case in the chain system test depends
  on a particular query order, which no longer occurs when QNAME
  minimization is active. We now disable qname-minimization
  for that test.

14 months agoFix handling of ISC_R_TIMEOUT in resume_qmin()
Mark Andrews [Thu, 15 Aug 2024 13:34:59 +0000 (23:34 +1000)] 
Fix handling of ISC_R_TIMEOUT in resume_qmin()

If a timeout occurs when sending a QMIN query, QNAME
minimization should be disabled. This now causes a hard
failure in strict mode, or a fallback to non-minimized queries
in relaxed mode.

14 months agoExempt QNAME minimization queries from fetches-per-zone
Mark Andrews [Fri, 6 Sep 2024 04:41:26 +0000 (14:41 +1000)] 
Exempt QNAME minimization queries from fetches-per-zone

The calling fetch has already called fcount_incr() for this zone;
calling it again for a QMIN query results in double counting.

When resuming after a QMIN query is answered, however, we do now
ensure before continuing that the fetches-per-zone limit has not
been exceeded.

14 months agonew: usr: dig can now display the received BADVERS message during negotiation
Mark Andrews [Fri, 14 Mar 2025 00:45:20 +0000 (00:45 +0000)] 
new: usr: dig can now display the received BADVERS message during negotiation

Dig +showbadvers now displays the received BADVERS message and
continues the EDNS version negotiation.  Previously to see the
BADVERS message +noednsneg had to be specified which terminated the
EDNS negotiation.  Additionally the specified EDNS value (+edns=value)
is now used when making all the initial queries with +trace. i.e EDNS
version negotiation will be performed with each server when performing
the trace.

Closes #5234

Merge branch '5234-have-dig-display-the-badvers-message' into 'main'

See merge request isc-projects/bind9!10234

14 months agocheck that dig +showbadvers works
Mark Andrews [Wed, 12 Mar 2025 00:16:10 +0000 (11:16 +1100)] 
check that dig +showbadvers works

14 months agoAdd "+showbadvers" to dig and reset EDNS version
Mark Andrews [Tue, 11 Mar 2025 23:02:05 +0000 (10:02 +1100)] 
Add "+showbadvers" to dig and reset EDNS version

Add "+showbadvers" to display the BADVERS response similarly
to "+showbadcookie".  Additionally reset the EDNS version to
the requested version in "dig +trace" so that EDNS version
negotiation can be tested at all levels of the trace rather
that just when requesting the root nameservers.

14 months agofix: usr: Ensure max-clients-per-query is at least clients-per-query
Matthijs Mekking [Thu, 13 Mar 2025 13:02:48 +0000 (13:02 +0000)] 
fix: usr: Ensure max-clients-per-query is at least clients-per-query

If the `max-clients-per-query` option is set to a lower value than `clients-per-query`, the value is adjusted to match `clients-per-query`.

Closes #5224

Merge branch '5224-raise-max-clients-per-query-to-be-at-least' into 'main'

See merge request isc-projects/bind9!10241

14 months agoRaise max-clients-per-query to be at least
Matthijs Mekking [Thu, 13 Mar 2025 08:28:37 +0000 (09:28 +0100)] 
Raise max-clients-per-query to be at least

In the case where 'clients-per-query' is larger than
'max-clients-per-query', raise 'max-clients-per-query' so that
'clients-per-query' equals 'max-clients-per-query' and log a warning
that this is what happened.

14 months agoTest new max-clients-per-query log warning
Matthijs Mekking [Thu, 13 Mar 2025 08:27:41 +0000 (09:27 +0100)] 
Test new max-clients-per-query log warning

Make sure the new warning is logged.

14 months agoUpdate max-clients-per-query documentation
Matthijs Mekking [Wed, 12 Mar 2025 15:48:54 +0000 (16:48 +0100)] 
Update max-clients-per-query documentation

The new intended behavior is that 'max-clients-per-query' value is
raised to equal 'clients-per-query' if it is lower.

14 months agonew: usr: Add support for EDE 20 (Not Authoritative)
Colin Vidal [Thu, 13 Mar 2025 11:56:37 +0000 (11:56 +0000)] 
new: usr: Add support for EDE 20 (Not Authoritative)

Support was added for EDE codes 20 (Not Authoritative) when client requests recursion (RD) but the server has recursion disabled.

RFC 8914 mention EDE 20 should also be returned if the client doesn't have the RD bit set (and recursion is needed) but it doesn't apply for
BIND as BIND would try to resolve from the "deepest" referral in AUTHORITY section. For example, if the client asks for "www.isc.org/A" but the server only knows the root domain, it will return NOERROR but no answer for "www.isc.og/A", just the list of other servers to ask.

See #1836

Merge branch '1836-not-authoritative' into 'main'

See merge request isc-projects/bind9!10228

14 months agoadd system test covering EDE 20
Colin Vidal [Wed, 12 Mar 2025 09:29:10 +0000 (10:29 +0100)] 
add system test covering EDE 20

Add system test to cover extended DNS error 20 (Not authoritative).

14 months agoadd support for EDE 20 (Not Authoritative)
Colin Vidal [Wed, 12 Mar 2025 09:28:27 +0000 (10:28 +0100)] 
add support for EDE 20 (Not Authoritative)

Extended DNS Error message EDE 20 (Not Authoritative) is now sent when
client request recursion (RD) but the server has recursion disabled.

RFC 8914 mention EDE 20 should also be returned if the client doesn't
have the RD bit set (and recursion is needed) but it doesn't apply for
BIND as BIND would try to resolve from the "deepest" referral in
AUTHORITY section. For example, if the client asks for "www.isc.org/A"
but the server only knows the root domain, it will returns NOERROR but
no answer for "www.isc.og/A", just the list of other servers to ask.

14 months agonew: usr: Add support for EDE 7 and EDE 8
Colin Vidal [Thu, 13 Mar 2025 10:13:36 +0000 (10:13 +0000)] 
new: usr: Add support for EDE 7 and EDE 8

Support was added for EDE codes 7 (Signature Expired) and 8 (Signature Not Yet Valid) which might occur during DNSSEC validation.

See #2715

Merge branch '2715-expired-future-keys' into 'main'

See merge request isc-projects/bind9!10225

14 months agoadd system tests covering EDE 7 and 8
Colin Vidal [Wed, 12 Mar 2025 09:53:33 +0000 (10:53 +0100)] 
add system tests covering EDE 7 and 8

Add DNSSEC system tests to cover extended DNS error 7 (Signature
Expired) and 8 (Signature Not Yet Valid).

14 months agoadd support for EDE 7 and 8
Colin Vidal [Wed, 12 Mar 2025 09:53:11 +0000 (10:53 +0100)] 
add support for EDE 7 and 8

Extended DNS Error messages EDE 7 (expired key) and EDE 8 (validity
period of the key not yet started) are now sent in case of such DNSSEC
validation failures.

Refactor the existing validator extended error APIs in order to make it
easy to have a consisdent extra info (with domain/type) in the various
use case (i.e. when the EDE depends on validator state,
validate_extendederror or when the EDE doesn't depend of any state but
can be called directly in a specific flow).

14 months agofix: test: Take into account key collisions in ksr system test
Matthijs Mekking [Thu, 13 Mar 2025 08:19:05 +0000 (08:19 +0000)] 
fix: test: Take into account key collisions in ksr system test

Closes #5229

Merge branch '5229-ksr-system-test-can-fail-on-key-collision' into 'main'

See merge request isc-projects/bind9!10238

14 months agoksr: Take into account key collisions
Matthijs Mekking [Wed, 12 Mar 2025 15:14:52 +0000 (16:14 +0100)] 
ksr: Take into account key collisions

When generating new key pairs, one test checks if existing keys that
match the time bundle are selected, rather than extra keys being
generated. Part of the test is to check the verbose output, counting
the number of "Selecting" and "Generating" occurences. But if there
is a key collision, the ksr tool will output that the key already
exists and includes the substring "already exists, or might collide
with another key upon revokation.  Generating a new key".

So substract by one the generated counter if there is a "collide"
occurrence.

14 months agofix: dev: Fix CID 544147: Code maintainability issues (UNUSED_VALUE)
Matthijs Mekking [Thu, 13 Mar 2025 08:18:35 +0000 (08:18 +0000)] 
fix: dev: Fix CID 544147: Code maintainability issues (UNUSED_VALUE)

Assigning value "NULL" to "newstr", but that stored value is overwritten
before it can be used.

Setting "newstr" to NULL does not have any effect, so the line can
safely be removed.

Closes #5227

Merge branch '5227-cid-544147' into 'main'

See merge request isc-projects/bind9!10239

14 months agoFix CID 544147
Matthijs Mekking [Wed, 12 Mar 2025 15:39:36 +0000 (16:39 +0100)] 
Fix CID 544147

Assigning value "NULL" to "newstr", but that stored value is overwritten
before it can be used.

Setting "newstr" to NULL does not have any effect, so the line can
safely be removed.

14 months agochg: doc: Set up version for BIND 9.21.7
Andoni Duarte [Wed, 12 Mar 2025 13:07:00 +0000 (13:07 +0000)] 
chg: doc: Set up version for BIND 9.21.7

Merge branch 'andoni/set-up-version-for-bind-9.21.7' into 'main'

See merge request isc-projects/bind9!10237

14 months agoUpdate BIND version to 9.21.7-dev
Andoni Duarte Pintado [Wed, 12 Mar 2025 11:09:35 +0000 (12:09 +0100)] 
Update BIND version to 9.21.7-dev

14 months agoUpdate BIND version for release v9.21.6
Andoni Duarte Pintado [Tue, 11 Mar 2025 10:37:59 +0000 (11:37 +0100)] 
Update BIND version for release

14 months agonew: doc: Prepare documentation for BIND 9.21.6
Andoni Duarte [Tue, 11 Mar 2025 10:10:19 +0000 (10:10 +0000)] 
new: doc: Prepare documentation for BIND 9.21.6

Merge branch 'andoni/prepare-documentation-for-bind-9.21.6' into 'v9.21.6-release'

See merge request isc-private/bind9!784