Commit Graph

41274 Commits

Author SHA1 Message Date
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
Michal Nowak
b1184d916d Merge branch 'mnowak/fix-changes-entry-6378' into 'main'
Reformat overflowing CHANGES entry 6378

See merge request isc-projects/bind9!8981
2024-04-25 07:31:29 +00:00
Michal Nowak
84180c8ee1 Reformat overflowing CHANGES entry 6378
$ sh util/check-line-length.sh CHANGES
    CHANGES: Line Too Long
                            previously removed. An attempt to use the option now prints
2024-04-25 09:22:27 +02:00
Ondřej Surý
1359694267 Merge branch '1879-fix-documentation-on-named--U' into 'main'
Properly document that named -U <n> is no-op now

Closes #1879

See merge request isc-projects/bind9!8976
2024-04-24 20:50:09 +00:00
Ondřej Surý
9305ebdabe Add CHANGES and release note for [GL #1879] 2024-04-24 22:49:26 +02:00
Ondřej Surý
d69cd51f91 Properly document that named -U <n> is no-op now
We don't create <n> UDP dispatches anymore and -U <n> option to named is
a no-op for a while.  Properly document that in the named man page.
2024-04-24 22:49:14 +02:00
Petr Špaček
0f86976672 Merge branch 'spdx-custom-test-driver' into 'main'
Use standard SPDX license for custom-test-driver

See merge request isc-projects/bind9!8971
2024-04-24 09:49:44 +00:00
Petr Menšík
2b348a5daa Change exception SPDX to Autoconf-exception-generic
License text is in fact Autoconf generic exception, with already defined
SPDX identificator. Use that instead.

https://spdx.org/licenses/Autoconf-exception-generic.html
2024-04-24 09:46:58 +00:00
Mark Andrews
ed77b61599 Merge branch '4684-unit-test-error-handling-in-dns_name_-api' into 'main'
test dns_name_fromregion

Closes #4684

See merge request isc-projects/bind9!8967
2024-04-24 02:14:05 +00:00
Mark Andrews
e6984e5c07 Extract empty name in 'source' into 'name' 2024-04-24 01:38:14 +00:00
Mark Andrews
7a13fcd601 Extract non absolute name from source
The entire source region needs to be consumed for this usage.
2024-04-24 01:38:14 +00:00
Mark Andrews
7d7fc8cb2d Extract fully qualified named from source without buffer
'name.ndata' should point to the source.
2024-04-24 01:38:14 +00:00
Mark Andrews
254ba1b051 Test dns_name_fromregion
with a large source region and a large target buffer, both
larger than DNS_NAME_MAXWIRE.
2024-04-24 01:38:14 +00:00
Mark Andrews
63b93ccda2 Merge branch '4689-test-invalid-notify-source-address' into 'main'
Check behaviour using invalid notify source address

Closes #4689

See merge request isc-projects/bind9!8966
2024-04-24 01:09:35 +00:00
Mark Andrews
580c41de0d check behaviour with invalid notify-source-v6 address
This was reported as causing the server to fail to shutdown on
NetBSD.  Look for the expected informational and error messages.
2024-04-24 10:12:42 +10:00
Michal Nowak
4f7947c583 Merge branch 'mnowak/llvm-18' into 'main'
Bump the LLVM version to 18 and reformat sources

See merge request isc-projects/bind9!8827
2024-04-23 12:48:22 +00:00
Michal Nowak
f454fa6dea Update sources to Clang 18 formatting 2024-04-23 13:11:52 +02:00
Michal Nowak
7107c44c7c Update Clang to version 18 2024-04-23 13:11:52 +02:00
Ondřej Surý
abbc59a270 Merge branch 'ondrej/fix-adb-entries-cleaning' into 'main'
Always set ADB entry expiration to now + ADB_ENTRY_WINDOW

See merge request isc-projects/bind9!8934
2024-04-22 08:37:45 +00:00
Ondřej Surý
141e4c9805 Change the ADB_ENTRY_WINDOW to 60 seconds
The previous value of 30 minutes used to cache the ADB names and entries
was quite long.  Change the value to 60 seconds for faster recovery
after cached intermittent failure of the remote nameservers.
2024-04-22 10:36:36 +02:00
Ondřej Surý
6708da3112 Unify the expiration time handling for all ADB expiration
The algorithm from the previous commit[1] is now used to calculate all
the expiration values through the code (ncache results, cname/dname
targets).

1. ISC_MIN(cur, ISC_MAX(now + ADB_ENTRY_WINDOW, now + rdataset->ttl))
2024-04-22 10:36:36 +02:00
Ondřej Surý
53cc00ee3f Fix the expire_v4 and expire_v6 logic
Correct the logic to set the expiration period of expire_{v4,v6} as
follows:

1. If the trust is ultimate (local entry), immediately set the entry as
   expired, so the changes to the local zones have immediate effect.

3. If the expiration is already set and smaller than the new value, then
   leave the expiration value as it is.

2. Otherwise pick larger of `now + ADB_ENTRY_WINDOW` and `now + TTL` as
   the new expiration value.
2024-04-22 10:36:36 +02:00
Ondřej Surý
932665410d Always set ADB entry expiration to now + ADB_ENTRY_WINDOW
When ADB entry was created it was set to never expire.  If we never
called any of the functions that adjust the expiration, it could linger
in the ADB forever.

Set the expiration (.expires) to now + ADB_ENTRY_WINDOW when creating
the new ADB entry to ensure the ADB entry will always expire.
2024-04-22 10:36:36 +02:00
Mark Andrews
6cb6b99ae7 Merge branch '4687-validator-c-1280-insist-val-nfails-0-failed' into 'main'
Resolve "validator.c:1280: INSIST((*val->nfails) > 0) failed"

Closes #4687

See merge request isc-projects/bind9!8963
2024-04-22 04:57:45 +00:00
Mark Andrews
26375bdcf2 Break out of the switch if we have already reached the quota
This prevents consume_validation_fail being called and causing an
INSIST.
2024-04-22 12:32:36 +10:00
Michal Nowak
970ac03196 Merge branch 'mnowak/drop-respdiff-short-ci-jobs' into 'main'
Drop respdiff-short CI jobs

See merge request isc-projects/bind9!8958
2024-04-19 15:56:00 +00:00
Michal Nowak
6a045cd8ec Drop respdiff-short CI jobs
In the past, our CI infrastructure was more sensitive to the number of
CI jobs running on it. We tried to limit long-running jobs in merge
request-triggered pipelines, as there are many of them, and spawned them
only in daily scheduled ones. Moving most of the CI infrastructure to
AWS has made it way better to run jobs in parallel, and the existence of
short respdiff jobs has lost its original merit. It can also be harmful
as some problems are detected only by the longer respdiff variant when a
faulty merge request has already been merged. We should run all long
respdiff tests in merge request-triggered pipelines.

Also, move the former respdiff-long job (now just "respdiff") to AWS as
old instance memory constraints (see
f09cf69594) are no longer an issue.
2024-04-19 16:42:49 +02:00
Petr Špaček
c35f00e48a Merge branch 'pspacek/auto-backports' into 'main'
Attempt automatic MR backports after every merge

See merge request isc-projects/bind9!8959
2024-04-19 13:40:51 +00:00
Petr Špaček
49f9487577 Attempt automatic MR backports after every merge 2024-04-19 13:35:19 +00:00
Matthijs Mekking
b53c03d98e Merge branch '1128-offline-ksk' into 'main'
Introduce new DNSSEC tool dnssec-ksr

See merge request isc-projects/bind9!8188
2024-04-19 11:56:50 +00:00
Matthijs Mekking
afda87cb08 dnssec-keygen: Change flag options into booleans
We now have ctx.kskflag, ctx.zskflag, and ctx.revflag, but zskflag is
not quite like the other two, as it doesn't have a special bit in the
DNS packet, and is used as a boolean.

This patch changes so that we use booleans for all three, and
construct the flags based on which ones are set.

patch by @aram
2024-04-19 13:52:21 +02:00
Matthijs Mekking
7007025302 Don't leak
Make tsan happy, fix memory leaks by keeping track of the buffers
to be cleaned up.
2024-04-19 13:52:21 +02:00
Matthijs Mekking
d9c947c57d Add test cases for CDS/CDNSKEY
Add two more test cases to ensure that a Signed Key Response file
creates signed CDNSKEY and/or CDS RRsets according to the policy.
2024-04-19 13:52:21 +02:00
Matthijs Mekking
cdf0fd2e5e Adjust system test to expect CDS and CDNSKEY
Requires storing the KSK keyfile identifier to calculate the expected
CDS and CDNSKEY.
2024-04-19 13:52:21 +02:00
Matthijs Mekking
83da52d6e4 Add option to dnssec-dsfromkey to chop up rdata
The new option 'w' allows us to print DS rdata with the base64 portions
split up in chunks. This is mainly done for testing purposes.
2024-04-19 13:52:21 +02:00
Matthijs Mekking
efe4fa6fc7 Add CDS and CDNSKEY to SKR
Add signed CDS and CDNSKEY RRsets to the Signed Key Response (SKR) for the
used KSKs.

We only print one bundle header for all three RRsets.
2024-04-19 13:52:21 +02:00
Matthijs Mekking
46785dc71e sh the fmt up
Apply shfmt patch. Ideally I fixup every commit that changes testing,
but that is just too much at this point.
2024-04-19 13:52:21 +02:00
Matthijs Mekking
e7525cab4f Add CHANGES and release note
Introduce the new 'dnssec-ksr' tool.
2024-04-19 13:52:21 +02:00