Commit Graph

41161 Commits

Author SHA1 Message Date
Matthijs Mekking
03e8747aaa Retrieve DNSKEY TTL from policy
The desired DNSKEY TTL is configured in the policy so set it to that
value on new RRsets. Note that the same TTL is used for CDS and CDNSKEY.
2024-05-06 10:54:41 +02:00
Matthijs Mekking
d9fb2054f1 Rename create_cds to create_ksk
Now that this function also creates the DNSKEY record for the KSKs,
as well as other associated records such as CDS and CDNSKEY, rename
the function to something slightly better.
2024-05-06 10:54:41 +02:00
Matthijs Mekking
30ce8abd30 Add DNSKEY rr corresponding to the KSK to the SKR
When signing a KSR, add the DNSKEY records from the signing KSK(s) to
the DNSKEY RRset prior to signing.
2024-05-06 10:54:41 +02:00
Matthijs Mekking
6b7bd77596 Don't add KSKs to the KSR
Creating the KSR happens on the "ZSK side". The KSK is offline and while
the public key and state file may be present, draft-icann-dnssec-keymgmt-01.txt
suggest that the KSR only contains ZSKs.

This is also what knot dns does, so it would also be in the spirit of
interoperability.
2024-05-06 10:54:41 +02:00
Matthijs Mekking
3bf4ec95dd Merge branch 'matthijs-fix-dnssec-ksr-version-missing' into 'main'
Fix missing version in KSR

See merge request isc-projects/bind9!8983
2024-05-06 08:40:46 +00:00
Matthijs Mekking
0071e6c10a Fix missing version in KSR
The final line in a KSR ";; KeySigningRequest generated at ..." was
missing the version number, that has now been fixed.

Thanks Libor Peltan for reporting.
2024-05-06 09:52:01 +02:00
Michal Nowak
b327da30f8 Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.19.25' into 'main'
Set up version and release notes for BIND 9.19.25

See merge request isc-projects/bind9!9005
2024-05-03 14:01:59 +00:00
Michal Nowak
4fae72e2de Set up release notes for BIND 9.19.25 2024-05-03 15:51:53 +02:00
Michal Nowak
fd880c29f2 Update BIND version to 9.19.25-dev 2024-05-03 15:51:53 +02:00
Arаm Sаrgsyаn
265b08b98e Merge branch '4710-qpcache-crash-on-assert-in-decref' into 'main'
Fix a bug in expireheader() call arguments order

Closes #4710

See merge request isc-projects/bind9!9001
2024-05-02 10:25:55 +00:00
Aram Sargsyan
8052848d50 Fix a bug in expireheader() call arguments order
The expireheader() call in the expire_ttl_headers() function
is erroneous as it passes the 'nlocktypep' and 'tlocktypep'
arguments in a wrong order, which then causes an assertion
failure.

Fix the order of the arguments so it corresponds to the function's
prototype.
2024-05-02 08:38:35 +00:00
Evan Hunt
f8f0f45043 Merge branch '4702-qpiter-fix' into 'main'
dns_qp_lookup() doesn't handle searches for escaped characters well

Closes #4702

See merge request isc-projects/bind9!8999
2024-05-01 08:13:58 +00:00
Evan Hunt
9bbba20fbf CHANGES for [GL #4702] 2024-05-01 00:36:51 -07:00
Evan Hunt
f81bf6bafd handle QP lookups involving escaped characters better
in QP keys, characters that are not common in DNS names are
encoded as two-octet sequences. this caused a glitch in iterator
positioning when some lookups failed.

consider the case where we're searching for "\009" (represented
in a QP key as {0x03, 0x0c}) and a branch exists for "\000"
(represented as {0x03, 0x03}). we match on the 0x03, and continue
to search down. at the point where we find we have no match,
we need to pop back up to the branch before the 0x03 - which may
be multiple levels up the stack - before we position the iterator.
2024-05-01 00:36:51 -07:00
Evan Hunt
a23ce2c53c add another test case for an incorrect QP iterator position
build a database tree with names containing control characters,
search for another control character, and verify the iterator is
positioned correctly.
2024-05-01 00:36:16 -07:00
Matthijs Mekking
ada46eb9f5 Add a unit test case for converting \000\009
Sanity checking that this domain converts to the key I am expecting.

Also fix some of the other names that had trailing 0x02 bits.
2024-04-30 16:00:13 -07:00
Evan Hunt
a0bd1e67cd add a test method to print QP keys
add a method qp_test_printkey() to print the name encoded in a QP key.
2024-04-30 15:58:17 -07:00
Evan Hunt
539518bfba Merge branch 'each-qpcache-cleanup' into 'main'
clean up and speed up qpcache

See merge request isc-projects/bind9!8987
2024-04-30 20:28:52 +00:00
Evan Hunt
4b02246130 fix more ambiguous struct names
there were some structure names used in qpcache.c and qpzone.c that
were too similar to each other and could be confusing when debugging.
they have been changed as follows:

in qcache.c:
- changed_t was unused, and has been removed
- search_t -> qpc_search_t
- qpdb_rdatasetiter_t -> qpc_rditer_t
- qpdb_dbiterator_t -> qpc_dbiter_t

in qpzone.c:
- qpdb_changed_t -> qpz_changed_t
- qpdb_changedlist_t -> qpz_changedlist_t
- qpdb_version_t -> qpz_version_t
- qpdb_versionlist_t -> qpz_versionlist_t
- qpdb_search_t -> qpz_search_t
- qpdb_load_t -> qpz_search_t
2024-04-30 12:50:01 -07:00
Evan Hunt
e300dfce46 use dns_qp_getname() where possible
some calls to dns_qp_lookup() do not need partial matches, QP chains
or QP iterators. in these cases it's more efficient to use
dns_qp_getname().
2024-04-30 12:50:01 -07:00
Evan Hunt
2789e58473 get foundname from the node
when calling dns_qp_lookup() from qpcache, instead of passing
'foundname' so that a name would be constructed from the QP key,
we now just use the name field in the node data. this makes
dns_qp_lookup() run faster.

the same optimization has also been added to qpzone.

the documentation for dns_qp_lookup() has been updated to
discuss this performance consideration.
2024-04-30 12:50:01 -07:00
Evan Hunt
04d319afe4 include the nodenames when calculating memory to purge
when the cache is over memory, we purge from the LRU list until
we've freed the approximate amount of memory to be added. this
approximation could fail because the memory allocated for nodenames
wasn't being counted.

add a dns_name_size() function so we can look up the size of nodenames,
then add that to the purgesize calculation.
2024-04-30 12:50:01 -07:00
Evan Hunt
a8bda6ff1e simplify qpcache iterators
in a cache database, unlike zones, NSEC3 records are stored in
the main tree. it is not necessary to maintain a separate 'nsec3'
tree, nor to have code in the dbiterator implementation to traverse
from one tree to another.

(if we ever implement synth-from-dnssec using NSEC3 records, we'll
need to revert this change. in the meantime, simpler code is better.)
2024-04-30 12:50:01 -07:00
Evan Hunt
7ff43befb7 clean up unnecessary dbiterator code related to origin
the QP database doesn't support relative names as the RBTDB did, so
there's no need for a 'new_origin' flag or to handle `DNS_R_NEWORIGIN`
result codes.
2024-04-30 12:42:32 -07:00
Evan Hunt
85ab92b6e0 more cleanups in qpcache.c
- remove unneeded struct members and misleading comments.
- remove unused parameters for static functions.
- rename 'find_callback' to 'delegating' for consistency with qpzone;
  the find callback mechanism is not used in QP databases.
2024-04-30 12:42:31 -07:00
Evan Hunt
3acab71d46 rename QPDB_HEADERNODE to HEADERNODE
this makes the macro consistent between qpcache.c and qpzone.c.

also removed a redundant definition of HEADERNODE in qpzone.c.
2024-04-30 12:42:31 -07:00
Evan Hunt
46d40b3dca fix structure names in qpcache.c and qpzone.c
- change dns_qpdata_t to qpcnode_t (QP cache node), and dns_qpdb_t to
  qpcache_t, as these types are only accessed locally.
- also change qpdata_t in qpzone.c to qpznode_t (QP zone node), for
  consistency.
- make the refcount declarations for qpcnode_t and qpznode_t static,
  using the new ISC_REFCOUNT_STATIC macros.
2024-04-30 12:42:07 -07:00
Evan Hunt
20d32512ca clean up unnecessary requirements in qpcache.c
qpcache can only support cache semantics now, so there's
no longer any need to check for that internally.
2024-04-30 12:31:48 -07:00
Evan Hunt
a5d0e6c4ba add static macros for ISC_REFCOUNT_DECL/IMPL
this commit adds a mechanism to statically declare attach/detach
and ref/unref methods, for objects that are only accessed within
a single C file.
2024-04-30 12:31:48 -07:00
Ondřej Surý
bc8095311a Merge branch 'ondrej/improve-newref-checks' into 'main'
Improve the reference counting in newref()

See merge request isc-projects/bind9!8914
2024-04-30 18:43:39 +00:00
Ondřej Surý
c13a1d8b01 Improve the reference counting checks in newref()
In qpcache (and rbtdb), there are some functions that acquire
neither the tree lock nor the node lock when calling newref().
In theory, this could lead to a race in which a new reference
is added to a node that was about to be deleted.

We now detect this condition by passing the current tree and node
lock status to newref(). If the node was previously unreferenced
and we don't hold at least one read lock, we will assert.
2024-04-30 08:41:56 +02:00
Michal Nowak
b1b9ac1cba Merge branch 'mnowak/stress-tests-freebsd-instance-autoscaler' into 'main'
Use FreeBSD autoscaler for "stress" tests

See merge request isc-projects/bind9!8968
2024-04-29 18:10:52 +00:00
Michal Nowak
65a93b77e1 Use FreeBSD autoscaler for "stress" tests
The FreeBSD autoscaler has been configured to utilize the new "instance"
GitLab Runner executor to spawn "stress" test CI jobs on AWS EC2
dynamically. A shared GitLab Runner named "freebsd-instance-autoscaler"
has been set up in GitLab CI/CD to communicate with EC2, provisioning VM
instances on demand based on a FreeBSD 13 AMI image. This image is the
same as the one previously used for FreeBSD "stress" tests before the
implementation of autoscaling (specifically, the
"freebsd13-amd64-bind9stress.aws.lab.isc.org" GitLab Runner in CI/CD).
2024-04-29 19:53:51 +02:00
Michał Kępień
29cef34a34 Merge branch 'michal/update-urls-and-paths-for-the-bind-9-qa-repository' into 'main'
Update URLs and paths for the BIND 9 QA repository

See merge request isc-projects/bind9!8990
2024-04-29 09:48:06 +00:00
Michał Kępień
25ec1d79e4 Update URLs and paths for the BIND 9 QA repository
Since the BIND 9 QA repository has been made public, adjust the relevant
URLs and paths used in .gitlab-ci.yml so that they work with the public
version of that repository.
2024-04-26 18:43:07 +02:00
Aydın Mercan
79573f1390 Merge branch '4523-dnstap-support-for-new-transport-protocols' into 'main'
Emit and read correct DoT and DoH dnstap entries

Closes #4523

See merge request isc-projects/bind9!8697
2024-04-26 15:47:46 +00:00
Aydın Mercan
042bb98846 Add CHANGES and release note for [GL #4523] 2024-04-26 16:12:29 +03:00
Aydın Mercan
f30008a71c Provide an early escape hatch for ns_client_transport_type
Because some tests don't have a legtimate handle, provide a temporary
return early that should be fixed and removed before squashing. This
short circuiting is still correct until DoQ/DoH3 support is introduced.
2024-04-26 16:12:29 +03:00
Aydın Mercan
b5478654a2 Add fallback to ns_client_get_type despite unreachable
GCC might fail to compile because it expects a return after UNREACHABLE.
It should ideally just work anyway since UNREACHABLE is either a
noreturn or UB (__builtin_unreachable / C23 unreachable).

Either way, it should be optimized almost always so the fallback is
free or basically free anyway when it isn't optimized out.
2024-04-26 16:12:29 +03:00
Aydın Mercan
4a3f7fe1ef Emit and read correct DoT and DoH dnstap entries
Other protocols still pretend to be TCP/UDP.
This only causes a difference when using dnstap-read on a file with DoQ
or DNSCrypt entries
2024-04-26 16:12:29 +03:00
Aydın Mercan
9d1a8a98c6 Update the dnstap protobuf definition
The new definition includes the missing protocol definitions and
specifies the protobuf version.
2024-04-26 16:08:46 +03:00
Evan Hunt
657ee2b997 Merge branch 'each-qpzone-oneheap' into 'main'
simplify qpzone database by using only one heap for resigning

See merge request isc-projects/bind9!8889
2024-04-26 01:19:42 +00:00
Ondřej Surý
6c54337f52 avoid a race in the qpzone getsigningtime() implementation
the previous commit introduced a possible race in getsigningtime()
where the rdataset header could change between being found on the
heap and being bound.

getsigningtime() now looks at the first element of the heap, gathers the
locknum, locks the respective lock, and retrieves the header from the
heap again.  If the locknum has changed, it will rinse and repeat.
Theoretically, this could spin forever, but practically, it almost never
will as the heap changes on the zone are very rare.

we simplify matters further by changing the dns_db_getsigningtime()
API call. instead of passing back a bound rdataset, we pass back the
information the caller actually needed: the resigning time, owner name
and type of the rdataset that was first on the heap.
2024-04-25 15:48:43 -07:00
Evan Hunt
7e6be9f1b5 simplify qpzone database by using only one heap for resigning
in RBTDB, the heap was used by zone databases for resigning, and
by the cache for TTL-based cache cleaning. the cache use case required
very frequent updates, so there was a separate heap for each of the
node lock buckets.

qpzone is for zones only, so it doesn't need to support the cache
use case; the heap will only be touched when the zone is updated or
incrementally signed. we can simplify the code by using only a single
heap.
2024-04-25 15:41:39 -07:00
Evan Hunt
7d289e5333 Merge branch '4659-rootkeysentinel-test-fails-for-certain-values-of-oldid' into 'main'
fix_iterator() bug causes DNSSEC NXDOMAIN responses to be broken

Closes #4659

See merge request isc-projects/bind9!8942
2024-04-25 18:10:29 +00:00
Evan Hunt
6f4ef40ccd CHANGES for [GL #4659] 2024-04-25 10:30:47 -07:00
Evan Hunt
237123e500 simplify code by removing return values where possible
fix_iterator() and related functions are quite difficult to read.
perhaps it would be a little clearer if we didn't assign values
to variables that won't subsequently be used, or unnecessarily
pop the stack and then push the same value back onto it.

also, in dns_qp_lookup() we previously called fix_iterator(),
removed the leaf from the top of the iterator stack, and then
added it back on. this would be clearer if we just push the leaf
onto the stack when we need to, but leave the stack alone when
it's already complete.
2024-04-25 10:29:07 -07:00
Evan Hunt
b1b1ca8ca4 add another broken testcase 2024-04-25 10:29:07 -07:00
Evan Hunt
66dbff596b clean up fix_iterator() arguments
the value passed as 'start' was redundant; it's always the same
as the current top of the iterator stack.
2024-04-25 10:29:07 -07:00
Evan Hunt
2dff926624 yet another fix_iterator() bug
under some circumstances it was possible for the iterator to
be set to the first leaf in a set of twigs, when it should have
been set to the last.

a unit test has been added to test this scenario. if there is a
a tree containing the following values: {".", "abb.", "abc."}, and
we query for "acb.", previously the iterator would be positioned at
"abb." instead of "abc.".

the tree structure is:
    branch (offset 1, ".")
      branch (offset 3, ".ab")
        leaf (".abb")
        leaf (".abc")

we find the branch with offset 3 (indicating that its twigs differ
from each other in the third position of the label, "abB" vs "abC").
but the search key differs from the found keys at position 2
("aC" vs "aB").  we look up the bit value in position 3 of the
search key ("B"), and incorrectly follow it onto the wrong twig
("abB").

to correct for this, we need to check for the case where the search
key is greater than the found key in a position earlier than the
branch offset. if it is, then we need to pop from the current leaf
to its parent, and get the greatest leaf from there.

a further change is needed to ensure that we don't do this twice;
when we've moved to a new leaf and the point of difference between
it and the search key even earlier than before, then we're definitely
at a predecessor node and there's no need to continue the loop.
2024-04-25 10:29:07 -07:00