]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
13 months agorem: dev: Cleanup dead code: CID 548247
Mark Andrews [Mon, 31 Mar 2025 20:17:57 +0000 (20:17 +0000)] 
rem: dev:  Cleanup dead code: CID 548247

Clean up dead code following merge of !10302.

Closes #5262

Merge branch '5262-cleanup-dead-code-cid-548247' into 'main'

See merge request isc-projects/bind9!10346

13 months agoRemove dead code in dns_message_sectiontotext
Mark Andrews [Sun, 30 Mar 2025 23:36:45 +0000 (10:36 +1100)] 
Remove dead code in dns_message_sectiontotext

Following the merge of !10302 this code to reset the result code
on ISC_R_NOMORE is no longer needed.

13 months agorem: usr: Drop readline alternatives in favor of libedit
Ondřej Surý [Mon, 31 Mar 2025 14:02:59 +0000 (14:02 +0000)] 
rem: usr: Drop readline alternatives in favor of libedit

Libedit is now ubiquitous and has a license compatible with
MPL 2.0. We are now dropping readline (GPL 3.0) and editline (obsolete) support
in favor of libedit.

Merge branch 'ondrej/cleanup-various-readline-libraries' into 'main'

See merge request isc-projects/bind9!10202

13 months agoDrop readline alternatives in favor of libedit
Ondřej Surý [Mon, 3 Mar 2025 11:32:14 +0000 (12:32 +0100)] 
Drop readline alternatives in favor of libedit

The libedit is now ubiquitous and has a licences compatible with
MPL 2.0.  Drop readline (GPL 3.0) and editline (obsolete) support
in favor of libedit.

13 months agochg: dev: Carefully check if the server name used for SNI is a hostname
Artem Boldariev [Mon, 31 Mar 2025 11:57:49 +0000 (11:57 +0000)] 
chg: dev: Carefully check if the server name used for SNI is a hostname

Previously the code would not check if the string intended to be used
for SNI is a hostname.

See also: !9923

Closes #5225

Merge branch '5225-dig-sni-fix' into 'main'

See merge request isc-projects/bind9!10254

13 months agoDispatch: carefully check if the server name for SNI is a hostname
Artem Boldariev [Tue, 18 Mar 2025 10:52:18 +0000 (12:52 +0200)] 
Dispatch: carefully check if the server name for SNI is a hostname

Previously the code would not check if the string intended to be used
for SNI is a hostname.

13 months agoDig: carefully check if the server name for SNI is a hostname
Artem Boldariev [Fri, 14 Mar 2025 19:35:39 +0000 (21:35 +0200)] 
Dig: carefully check if the server name for SNI is a hostname

Previously the code would not check if the string intended to be used
for SNI is a hostname.

13 months agoAdd isc_tls_valid_sni_hostname()
Artem Boldariev [Fri, 28 Mar 2025 07:20:16 +0000 (09:20 +0200)] 
Add isc_tls_valid_sni_hostname()

Add a function that checks if a 'hostname' is not a valid IPv4 or IPv6
address. Returns 'true' if the hostname is likely a domain name, and
'false' if it represents an IP address.

13 months agofix: test: fix out-of-tree mem_test
Colin Vidal [Fri, 28 Mar 2025 14:51:59 +0000 (14:51 +0000)] 
fix: test: fix out-of-tree mem_test

Previously changed mem_test (!10320) introduces a test which checks for
the value of `__FILE__`, which is different if the build is done
out-of-tree or not, even though this is not relevant for the test (only
the base filename is). This result in a broken test for out-of-tree
builds. Fix this by changing the way the "grep" is done in the test,
ignoring the optional path prefix in the filename.

Merge branch 'colin-fix-outoftree-memtest' into 'main'

See merge request isc-projects/bind9!10343

13 months agofix out-of-tree mem_test
Colin Vidal [Fri, 28 Mar 2025 11:55:49 +0000 (12:55 +0100)] 
fix out-of-tree mem_test

Previously changed mem_test (!10320) introduces a test which checks for
the value of `__FILE__`, which is different if the build is done
out-of-tree or not, even though this is not relevant for the test (only
the base filename is). This result in a broken test for out-of-tree
builds. Fix this by changing the way the "grep" is done in the test,
ignoring the optional path prefix in the filename.

13 months agofix: nil: Fix out-of-tree test
Evan Hunt [Fri, 28 Mar 2025 04:03:42 +0000 (04:03 +0000)] 
fix: nil: Fix out-of-tree test

A recent change to the dnssec system test depended on a file
that is only in the source tree, not in the build tree, and was
therefore not available in out-of-tree builds.

Merge branch 'each-fix-dnssec-oot' into 'main'

See merge request isc-projects/bind9!10342

13 months agoFix out-of-tree test
Evan Hunt [Fri, 28 Mar 2025 02:59:53 +0000 (19:59 -0700)] 
Fix out-of-tree test

A recent change to the dnssec system test depended on a file
that is only in the source tree, not in the build tree, and was
therefore not available in out-of-tree builds.

13 months agorem: pkg: Implement the systemd notification protocol manually to remove dependency...
Aydın Mercan [Thu, 27 Mar 2025 19:54:49 +0000 (19:54 +0000)] 
rem: pkg: Implement the systemd notification protocol manually to remove dependency on libsystemd.

Merge branch 'aydin/standalone-notification' into 'main'

See merge request isc-projects/bind9!10263

13 months agoimplement the systemd notification protocol manually, drop libsystemd
Aydın Mercan [Sun, 16 Mar 2025 16:54:18 +0000 (19:54 +0300)] 
implement the systemd notification protocol manually, drop libsystemd

libsystemd, despite being useful, adds a huge surface area for just
using the sd_notify API. libsystemd's surface has been exploited in the
past [1].

Implement the systemd notification protocol by hand since it is just
sending newline-delimited datagrams to a UNIX socket. The code shouldn't
need more attention in the future since the notification protocol is
covered under systemd's stability promise [2].

We don't need to support VSOCK-backed service notifications since they
are only intended for virtual machine inits.

[1]: https://www.openwall.com/lists/oss-security/2024/03/29/4
[2]: https://systemd.io/PORTABILITY_AND_STABILITY/

13 months agofix: dev: copy __FILE__ when allocating memory
Colin Vidal [Thu, 27 Mar 2025 12:15:24 +0000 (12:15 +0000)] 
fix: dev: copy __FILE__ when allocating memory

When allocating memory under -m trace|record, the __FILE__ pointer is
stored, so it can be printed out later in order to figure out in which
file an allocation leaked. (among others, like the line number).

However named crashes when called with -m record and using a plugin
leaking memory. The reason is that plugins are unloaded earlier than
when the leaked allocations are dumped (obviously, as it's done as late
as possible). In such circumstances, `__FILE__` is dangling because the
dynamically loaded library (the plugin) is not in memory anymore.

Fix the crash by systematically copying the `__FILE__` string
instead of copying the pointer. Of course, this make each allocation to
consume a bit more memory (and longer, as it needs to calculate the
length of `__FILE__`) but this occurs only under -m trace|record debugging
flags.

Merge branch 'colin-memdump-plugins' into 'main'

See merge request isc-projects/bind9!10320

13 months agocopy __FILE__ when allocating memory
Colin Vidal [Tue, 25 Mar 2025 13:35:49 +0000 (14:35 +0100)] 
copy __FILE__ when allocating memory

When allocating memory under -m trace|record, the __FILE__ pointer is
stored, so it can be printed out later in order to figure out in which
file an allocation leaked. (among others, like the line number).

However named crashes when called with -m record and using a plugin
leaking memory. The reason is that plugins are unloaded earlier than
when the leaked allocations are dumped (obviously, as it's done as late
as possible). In such circumstances, __FILE__ is dangling because the
dynamically loaded library (the plugin) is not in memory anymore.

Fix the crash by systematically copying the __FILE__ string
instead of copying the pointer. Of course, this make each allocation to
consume a bit more memory (and longer, as it needs to calculate the
length of __FILE__) but this occurs only under -m trace|record debugging
flags.

In term of unit test, because grepping in C is not fun, and because the
whole "syntax" of the dump output is tested in other tests, this simply
search for a substring in the whole buffer to make sure the expected
allocations are found.

13 months agonew: usr: Add an rndc command to reset some statistics counters
Arаm Sаrgsyаn [Thu, 27 Mar 2025 09:35:14 +0000 (09:35 +0000)] 
new: usr: Add an rndc command to reset some statistics counters

The new ``reset-stats`` command for ``rndc`` allows some statistics
counters to be reset during runtime. At the moment only two "high-water"
counters are supported, so the ability to reset them after the
initial peaks during the server's "warm-up" phase may be useful for
some operators.

Closes #5251

Merge branch '5251-feature-rndc-reset-high-water-statistics' into 'main'

See merge request isc-projects/bind9!10318

13 months agoDocument rndc reset-stats
Aram Sargsyan [Tue, 25 Mar 2025 10:50:08 +0000 (10:50 +0000)] 
Document rndc reset-stats

Add documentation for 'rndc reset-stats'.

13 months agoTest rndc reset-stats counter-name
Aram Sargsyan [Tue, 25 Mar 2025 10:49:03 +0000 (10:49 +0000)] 
Test rndc reset-stats counter-name

A a check to test if 'rndc reset-stats' works as expected.

13 months agoImplement rndc reset-stats counter-name
Aram Sargsyan [Tue, 25 Mar 2025 10:44:20 +0000 (10:44 +0000)] 
Implement rndc reset-stats counter-name

This new rndc option allows to reset some statistics counters during
runtime. At this moment only the high-water type counters are supported
as such an ability to reset them after the initial peaks during the
server's "warm-up" phase can be useful for some operators.

13 months agofix: dev: Refactor to use list-like macro for message sections
Alessio Podda [Thu, 27 Mar 2025 03:23:47 +0000 (03:23 +0000)] 
fix: dev: Refactor to use list-like macro for message sections

In the code base it is very common to iterate over all names in a message
section and all rdatasets for each name, but various idioms are used for
iteration.

This commit standardizes them as much as possible to a single idiom,
through the macro `MSG_SECTION_FOREACH`, similar to the existing
`ISC_LIST_FOREACH`.

Merge branch 'alessio/message-namelist-refactor' into 'main'

See merge request isc-projects/bind9!10302

13 months agoRefactor to use list-like macro for message sections
alessio [Wed, 19 Mar 2025 19:29:17 +0000 (20:29 +0100)] 
Refactor to use list-like macro for message sections

In the code base it is very common to iterate over all names in a message
section and all rdatasets for each name, but various idioms are used for
iteration.

This commit standardizes them as much as possible to a single idiom,
using the macro MSG_SECTION_FOREACH, similar to the existing
ISC_LIST_FOREACH.

13 months agochg: nil: Move application of dns64 to a separate function
Evan Hunt [Thu, 27 Mar 2025 00:06:22 +0000 (00:06 +0000)] 
chg: nil: Move application of dns64 to a separate function

The code in `query_dns64()` that applies the dns64 prefixes to an A rdataset has been moved into the `dns_dns64` module, and `dns_dns64_destroy()` now unlinks the dns64 object from its containing list.

With these changes, we no longer need the list-manipulation API calls, `dns_dns64_next()` and `dns_dns64_unlink()`.

Merge branch 'each-simplify-dns64' into 'main'

See merge request isc-projects/bind9!10324

13 months agomove application of dns64 to a separate function
Evan Hunt [Sun, 23 Mar 2025 20:45:04 +0000 (13:45 -0700)] 
move application of dns64 to a separate function

the code in query_dns64() that applies the dns64 prefixes to
an A rdataset has been moved into the dns_dns64 module, and
dns_dns64_destroy() now unlinks the dns64 object from its
containing list. with these changes, we no longer need the
list-manipulation API calls dns_dns64_next() and
dns_dns64_unlink().

13 months agodns_message_gettemp*() resets objects
Evan Hunt [Sun, 23 Mar 2025 20:45:04 +0000 (13:45 -0700)] 
dns_message_gettemp*() resets objects

callers of dns_message_gettemprdata() and dns_message_getrdatalist()
initialize the objects after retrieving them. this is no longer
necessary.

13 months agochg: usr: Improve the LRU cache-expiration mechanism
Evan Hunt [Wed, 26 Mar 2025 23:21:15 +0000 (23:21 +0000)] 
chg: usr: Improve the LRU cache-expiration mechanism

Improve the LRU cache-expiration mechanism to a SIEVE-LRU based mechanism that triggers when the cache is close to the `max-cache-size` limit.  This improves the recursive server performance.

Merge branch 'ondrej/sieve' into 'main'

See merge request isc-projects/bind9!10153

13 months agoAdd isc_sieve unit implementing SIEVE-LRU algorithm
Ondřej Surý [Sun, 23 Feb 2025 13:36:35 +0000 (14:36 +0100)] 
Add isc_sieve unit implementing SIEVE-LRU algorithm

This is the core implementation of the SIEVE algorithm described in the
following paper:

  Zhang, Yazhuo, Juncheng Yang, Yao Yue, Ymir Vigfusson, and K V
  Rashmi. “SIEVE Is Simpler than LRU: An Efficient Turn-Key Eviction
  Algorithm for Web Caches,” n.d.. available online from
  https://junchengyang.com/publication/nsdi24-SIEVE.pdf

13 months agonew: test: IPv6 case to isc_netaddr_masktoprefixlen tests
Colin Vidal [Wed, 26 Mar 2025 13:30:01 +0000 (13:30 +0000)] 
new: test: IPv6 case to isc_netaddr_masktoprefixlen tests

Unit test for isc_netaddr_masktoprefixlen were missing IPv6 mask cases.
Add those and few other IPv4 cases. Also, the test is refactored in
order to make it easy to add new cases.

Merge branch 'colin-netaddrmasktest' into 'main'

See merge request isc-projects/bind9!10328

13 months agoIPv6 case to isc_netaddr_masktoprefixlen tests
Colin Vidal [Wed, 26 Mar 2025 09:44:11 +0000 (10:44 +0100)] 
IPv6 case to isc_netaddr_masktoprefixlen tests

Unit test for isc_netaddr_masktoprefixlen were missing IPv6 mask cases.
Add those and few other IPv4 cases. Also, the test is refactored in
order to make it easy to add new cases.

13 months agofix: test: Silence warning initialising compressed
Mark Andrews [Wed, 26 Mar 2025 12:42:53 +0000 (12:42 +0000)] 
fix: test: Silence warning initialising compressed

The string literal initialalising compressed was too big for the
array as it has an unwanted NUL terminator.  This is allowed for
in C for historical reasons but produces a warning with some
compilers.  Adjust the declaration to include the NUL and adjust
the users to pass in an adjusted size which excludes the NUL rather
than sizeof(compressed).

Closes #5258

Merge branch '5258-avoid-warning-initialising-compresss' into 'main'

See merge request isc-projects/bind9!10326

13 months agoSilence warning when initialising compress
Mark Andrews [Wed, 26 Mar 2025 03:31:25 +0000 (14:31 +1100)] 
Silence warning when initialising compress

The string literal initialalising compressed was too big for the
array as it has an unwanted NUL terminator.  This is allowed for
in C for historical reasons but produces a warning with some
compilers.  Adjust the declaration to include the NUL and adjust
the users to pass in an adjusted size which excludes the NUL rather
than sizeof(compressed).

13 months agofix: ci: cross-version-config-tests should allow_failure due to !10262
Michal Nowak [Wed, 26 Mar 2025 10:18:38 +0000 (10:18 +0000)] 
fix: ci: cross-version-config-tests should allow_failure due to !10262

Merge branch 'mnowak/cross-version-config-tests-allow_failure' into 'main'

See merge request isc-projects/bind9!10327

13 months agocross-version-config-tests should allow_failure due to !10262
Michal Nowak [Wed, 26 Mar 2025 09:45:13 +0000 (10:45 +0100)] 
cross-version-config-tests should allow_failure due to !10262

13 months agofix: nil: Fix broken dnssec test
Evan Hunt [Wed, 26 Mar 2025 01:37:49 +0000 (01:37 +0000)] 
fix: nil: Fix broken dnssec test

When !10262 was rebased prior to merging, there was a new
use of dnssec-keygen -n in the dnssec system test that had
not been removed in the branch, causing a test failure.
This has been fixed.

Merge branch 'each-merge-error' into 'main'

See merge request isc-projects/bind9!10325

13 months agofix broken dnssec test
Evan Hunt [Wed, 26 Mar 2025 01:01:24 +0000 (18:01 -0700)] 
fix broken dnssec test

When !10262 was rebased prior to merging, there was a
use of dnssec-keygen -n in the dnssec system test that had
not been removed, causing a test failure. This has been fixed.

13 months agorem: usr: Remove unnecessary options in dnssec-keygen and dnssec-keyfromlabel
Evan Hunt [Tue, 25 Mar 2025 23:49:11 +0000 (23:49 +0000)] 
rem: usr: Remove unnecessary options in dnssec-keygen and dnssec-keyfromlabel

The `dnssec-keygen` utility (and `dnssec-keyfromlabel`, which was derived from it) had several options dating to the time when keys in DNS were still experimental and not fully specified, and when `dnssec-keygen` had the additional function of generating TSIG keys, which are now generated by `tsig-keygen`. These options are no longer necessary in the modern DNSSEC environment, and have been removed.

The removed options are:
- `-t` (key type), which formerly set flags to disable confidentiality or authentication support in a key; these are no longer used.
- `-n` (name type), which is now always set to "ZONE" for DNSKEY and "HOST" for KEY.
- `-p` (protocol), which is now always set to 3 (DNSSEC); no other value has ever been defined.
- `-s` (signatory field), which was never fully defined.
- `-d` (digest bits), which is meaningful only for TSIG keys.

Merge branch 'each-remove-keygen-options' into 'main'

See merge request isc-projects/bind9!10262

13 months agoRemove -d option from dnssec-keygen
Evan Hunt [Sat, 15 Mar 2025 19:07:42 +0000 (12:07 -0700)] 
Remove -d option from dnssec-keygen

The -d (digestbits) option was only applicable to HMAC keys, which
are no longer created by dnssec-keygen. The option can be removed.

13 months agoRemove -s option from dnssec-keygen
Evan Hunt [Sat, 15 Mar 2025 05:50:44 +0000 (22:50 -0700)] 
Remove -s option from dnssec-keygen

The -s option (previously incorrectly documented as "strength")
actually set the signatory flags for KEY fields, which are unused.
The option is not needed.

13 months agoRemove -p option from dnssec-keygen/keyfromlabel
Evan Hunt [Sat, 15 Mar 2025 05:41:12 +0000 (22:41 -0700)] 
Remove -p option from dnssec-keygen/keyfromlabel

The -p (protocol) option for all keys defaults to 3 (DNSSEC).
There is currently no practical reason to use any other value;
we can simplify things by removing the option.

13 months agoRemove -n option from dnssec-keygen/keyfromlabel
Evan Hunt [Fri, 14 Mar 2025 02:57:24 +0000 (19:57 -0700)] 
Remove -n option from dnssec-keygen/keyfromlabel

The -n (nametype) option for keys defaults to ZONE for DNSKEY
type keys, and HOST for KEY type keys. There is currently no
practical reason to use any other name type; we can simplify
things by removing the option.

13 months agoRemove -t option from dnssec-keygen/keyfromlabel
Evan Hunt [Thu, 13 Mar 2025 19:20:55 +0000 (12:20 -0700)] 
Remove -t option from dnssec-keygen/keyfromlabel

The key type flag (indicating whether a key is valid for
authentication, confidentiality, or both) is essentially
unused. By default, all DNSKEY and KEY records are valid
for both uses. Non-authenticating DNSKEY records are undefined
and meaningless, and validity checks for flags in KEY records
are sporadic at best.

We can simplify the parameters to dnssec-keygen by removing
the -t option completely.

13 months agofix: test: Limit X-Bloat header size to 100KB
Michal Nowak [Tue, 25 Mar 2025 15:52:47 +0000 (15:52 +0000)] 
fix: test: Limit X-Bloat header size to 100KB

Otherwise curl 8.13 rejects the line with:

    I:Check HTTP/1.1 keep-alive with truncated stream (21)
    curl: option --header: error encountered when reading a file
    curl: try 'curl --help' or 'curl --manual' for more information

Also, see https://github.com/curl/curl/pull/16572.

Closes #5249

Merge branch '5249-statschannel-limit-http-header-size' into 'main'

See merge request isc-projects/bind9!10319

13 months agoLimit X-Bloat header size to 100KB
Michal Nowak [Tue, 25 Mar 2025 13:14:52 +0000 (14:14 +0100)] 
Limit X-Bloat header size to 100KB

Otherwise curl 8.13 rejects the line with:

    I:Check HTTP/1.1 keep-alive with truncated stream (21)
    curl: option --header: error encountered when reading a file
    curl: try 'curl --help' or 'curl --manual' for more information

Also, see https://github.com/curl/curl/pull/16572.

13 months agorem: dev: Remove lock upgrading from the hot path in the QP cache
Ondřej Surý [Tue, 25 Mar 2025 09:58:09 +0000 (09:58 +0000)] 
rem: dev: Remove lock upgrading from the hot path in the QP cache

In QPcache, there were two places that tried to upgrade the lock.  In `clean_stale_header()`, the code would try to upgrade the lock and clean up the header, and in `qpzonode_release()`, the tree lock would be optionally upgraded, so we can clean up the node directly if empty. These
optimizations are not needed and they have no effect on the performance.

Merge branch 'ondrej/no-lock-upgrade-in-check_stale_headers' into 'main'

See merge request isc-projects/bind9!10305

13 months agoRemove lock upgrading from the hot path in the cache
Ondřej Surý [Fri, 21 Mar 2025 02:06:16 +0000 (03:06 +0100)] 
Remove lock upgrading from the hot path in the cache

In QPcache, there were two places that tried to upgrade the lock.  In
clean_stale_header(), the code would try to upgrade the lock and cleanup
the header, and in qpzonode_release(), the tree lock would be optionally
upgraded, so we can cleanup the node directly if empty.  These
optimizations are not needed and they have no effect on the performance.

13 months agofix: dev: Fix invalid cache-line padding for qpcache buckets
Ondřej Surý [Tue, 25 Mar 2025 09:56:49 +0000 (09:56 +0000)] 
fix: dev: Fix invalid cache-line padding for qpcache buckets

The isc_queue_t was missing in the calculation of the required
padding size inside the qpcache bucket structure.

Merge branch 'ondrej/qpcache-fix-invalid-padding' into 'main'

See merge request isc-projects/bind9!10306

13 months agoFix invalid cache-line padding for qpcache buckets
Ondřej Surý [Fri, 21 Mar 2025 08:29:17 +0000 (09:29 +0100)] 
Fix invalid cache-line padding for qpcache buckets

The isc_queue_t was missing in the calculation of the required
padding size inside the qpcache bucket structure.

13 months agofix: dev: Fix a bug in the ns_query's get_key() function
Arаm Sаrgsyаn [Tue, 25 Mar 2025 09:25:15 +0000 (09:25 +0000)] 
fix: dev: Fix a bug in the ns_query's get_key() function

After a refactoring in 2e6107008dae09d32e3d34fb5423b3d78c4ff651 the
dst_key_free() call is invalid and can cause an assertion. Remove the
dst_key_free() call.

Merge branch 'aram/fix-ns_query-get_key-bug' into 'main'

See merge request isc-projects/bind9!10311

13 months agoDon't call dst_key_free(keyp) on an invalid 'keyp'
Aram Sargsyan [Mon, 24 Mar 2025 16:34:00 +0000 (16:34 +0000)] 
Don't call dst_key_free(keyp) on an invalid 'keyp'

After a refactoring in 2e6107008dae09d32e3d34fb5423b3d78c4ff651 the
dst_key_free() call is invalid and can cause an assertion. Remove the
dst_key_free() call.

13 months agofix: usr: Don't enforce NOAUTH/NOCONF flags in DNSKEYs
Evan Hunt [Tue, 25 Mar 2025 06:39:07 +0000 (06:39 +0000)] 
fix: usr: Don't enforce NOAUTH/NOCONF flags in DNSKEYs

All DNSKEY keys are able to authenticate. The `DNS_KEYTYPE_NOAUTH` (and `DNS_KEYTYPE_NOCONF`) flags were defined for the KEY rdata type, and are not applicable to DNSKEY. Previously, however, because the DNSKEY implementation was built on top of KEY, the `_NOAUTH` flag prevented authentication in DNSKEYs as well. This has been corrected.

Closes #5240

Merge branch '5240-ignore-noauth-flag' into 'main'

See merge request isc-projects/bind9!10261

13 months agoDNS_KEYTYPE_NOKEY is only applicable to KEY
Mark Andrews [Tue, 25 Mar 2025 03:15:37 +0000 (14:15 +1100)] 
DNS_KEYTYPE_NOKEY is only applicable to KEY

13 months agoDon't check DNS_KEYFLAG_NOAUTH
Evan Hunt [Fri, 14 Mar 2025 00:44:49 +0000 (17:44 -0700)] 
Don't check DNS_KEYFLAG_NOAUTH

All DNSKEY keys are able to authenticate. The DNS_KEYTYPE_NOAUTH
(and DNS_KEYTYPE_NOCONF) flags were defined for the KEY rdata type,
and are not applicable to DNSKEY.

Previously, because the DNSKEY implementation was built on top of
KEY, the NOAUTH flag prevented authentication in DNSKEYs as well.
This has been corrected.

13 months agoTidy up keyvalue.h definitions
Evan Hunt [Thu, 13 Mar 2025 19:20:40 +0000 (12:20 -0700)] 
Tidy up keyvalue.h definitions

Use enums for DNS_KEYFLAG_, DNS_KEYTYPE_, DNS_KEYOWNER_, DNS_KEYALG_,
and DNS_KEYPROTO_ values.

Remove values that are never used.

Eliminate the obsolete DNS_KEYFLAG_SIGNATORYMASK. Instead, add three
more RESERVED bits for the key flag values that it covered but which
were never used.

13 months agorem: dev: Remove dns_qpmulti_lockedread declaration
Evan Hunt [Tue, 25 Mar 2025 05:58:47 +0000 (05:58 +0000)] 
rem: dev: Remove dns_qpmulti_lockedread declaration

This function was removed in 6217e434b57bd5d60ed69f792ae9a1a65a008f57 but not from the header file.

Merge branch 'matthijs-remove-unused-qpmulti-lockedread' into 'main'

See merge request isc-projects/bind9!10308

13 months agoRemove dns_qpmulti_lockedread declaration
Matthijs Mekking [Fri, 21 Mar 2025 09:20:07 +0000 (10:20 +0100)] 
Remove dns_qpmulti_lockedread declaration

This function was removed in 6217e434b57bd5d60ed69f792ae9a1a65a008f57
but not from the header file.

13 months agochg: test: Use isctest.asyncserver in the "upforwd" test 5256-add-code-to-allow-all-key-flags-to-be-set-for-testing 10313/head
Michał Kępień [Tue, 25 Mar 2025 04:06:01 +0000 (04:06 +0000)] 
chg: test: Use isctest.asyncserver in the "upforwd" test

Replace the custom DNS server used in the "upforwd" system test with new
code based on the isctest.asyncserver module.  The ans4 server currently
used in that test is a copy of bin/tests/system/ans.pl modified to
receive queries over UDP and TCP without ever responding to any of them.

Closes #5012

Merge branch '5012-upforwd-asyncserver' into 'main'

See merge request isc-projects/bind9!10283

13 months agoUse isctest.asyncserver in the "upforwd" test
Michał Kępień [Tue, 25 Mar 2025 04:01:34 +0000 (05:01 +0100)] 
Use isctest.asyncserver in the "upforwd" test

Replace the custom DNS server used in the "upforwd" system test with new
code based on the isctest.asyncserver module.  The ans4 server currently
used in that test is a copy of bin/tests/system/ans.pl modified to
receive queries over UDP and TCP without ever responding to any of them.

13 months agoAdd a response handler for ignoring all queries
Michał Kępień [Tue, 25 Mar 2025 04:01:34 +0000 (05:01 +0100)] 
Add a response handler for ignoring all queries

Dropping all incoming queries is a typical use case for a custom server
used in BIND 9 system tests.  Add a response handler implementing that
behavior so that it can be reused.

13 months agoMake response handlers global by default
Michał Kępień [Tue, 25 Mar 2025 04:01:34 +0000 (05:01 +0100)] 
Make response handlers global by default

Instead of requiring each class inheriting from ResponseHandler to
define its match() method, make the latter non-abstract and default to
returning True for all queries.  This will reduce the amount of
boilerplate code in custom servers.

13 months agochg: usr: When forwarding, query with CD=0 first
Evan Hunt [Tue, 25 Mar 2025 01:11:07 +0000 (01:11 +0000)] 
chg: usr: When forwarding, query with CD=0 first

Previously, when queries were forwarded to a remote resolver, the CD (checking disabled) bit was used, which could lead to bogus data being retrieved that might have been corrected if validation had been permitted. The CD bit is now only used as a fallback if an initial query without CD fails. See #5132.

Merge branch '5132-cd-retry' into 'main'

See merge request isc-projects/bind9!10024

13 months agowhen forwarding, try with CD=0 first
Evan Hunt [Sat, 25 Jan 2025 02:00:14 +0000 (18:00 -0800)] 
when forwarding, try with CD=0 first

when sending a query to a forwarder for a name within a secure domain,
the first query is now sent with CD=0. when the forwarder itself
is validating, this will give it a chance to detect bogus data and
replace it with valid data before answering. this reduces our chances
of being stuck with data that can't be validated.

if the forwarder returns SERVFAIL to the initial query, the query
will be repeated with CD=1, to allow for the possibility that the
forwarder's validator is faulty or that the bogus answer is covered
by an NTA.

note: previously, CD=1 was only sent when the query name was in a
secure domain. today, validating servers have a trust anchor at the
root by default, so virtually all queries are in a secure domain.
therefore, the code has been simplified.  as long as validation is
enabled, any forward query that receives a SERVFAIL response will be
retried with CD=1.

13 months agonew: usr: Add support for EDNS ZONEVERSION option
Mark Andrews [Mon, 24 Mar 2025 23:09:39 +0000 (23:09 +0000)] 
new: usr: Add support for EDNS ZONEVERSION option

`dig` and `named` can now make requests with an EDNS `ZONEVERSION` option present.

Two new `named.conf` options have been added: `request-zoneversion` and
`provide-zoneversion`.  `request-zoneversion` is `off` by default. `provide-zoneversion`
is `on` by default.

Closes #4767

Merge branch '4767-implement-zoneversion' into 'main'

See merge request isc-projects/bind9!9103

13 months agoReturn raw zone serial for inline zones
Mark Andrews [Fri, 4 Oct 2024 01:55:58 +0000 (11:55 +1000)] 
Return raw zone serial for inline zones

13 months agoDisable ZONEVERSION for built-in chaos and empty zones
Mark Andrews [Thu, 29 Aug 2024 03:15:29 +0000 (13:15 +1000)] 
Disable ZONEVERSION for built-in chaos and empty zones

13 months agoCheck that 'provide-zoneversion no;' works
Mark Andrews [Thu, 29 Aug 2024 00:09:34 +0000 (10:09 +1000)] 
Check that 'provide-zoneversion no;' works

13 months agoAdd an option to disable ZONEVERSION responses
Mark Andrews [Wed, 28 Aug 2024 23:43:21 +0000 (09:43 +1000)] 
Add an option to disable ZONEVERSION responses

The option provide-zoneversion controls whether ZONEVERSION is
returned.  This applies to primary, secondary and mirror zones.

13 months agoCheck that received ZONEVERSION is logged
Mark Andrews [Mon, 17 Jun 2024 01:38:19 +0000 (11:38 +1000)] 
Check that received ZONEVERSION is logged

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.

14 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