2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

41385 Commits

Author SHA1 Message Date
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
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
f09cf69594c6aab4d0c5608226424c566b833f3c) are no longer an issue.
2024-04-19 16:42:49 +02:00