2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00
Commit Graph

40757 Commits

Author SHA1 Message Date
Michal Nowak
1fc56d705e Add Alpine Linux 3.19 2023-12-12 10:36:03 +01:00
Evan Hunt
f6b9bc7da6 Merge branch 'matthijs-qp-lookup-iterator' into 'main'
Follow-up on !8468, more dns_qp_lookup bug fixes related to the iterator

See merge request isc-projects/bind9!8558
2023-12-11 21:01:46 +00:00
Matthijs Mekking
3c397a5d68 Add CHANGES 2023-12-11 21:01:29 +00:00
Matthijs Mekking
21867f200a Refactor getpred code
Move the code to find the predecessor into one function, as it is shares
quite some similarities: In both cases we first need to find the
immediate predecessor/successor, then we need to find the immediate
predecessor if the iterator is not already pointing at it.
2023-12-11 21:01:29 +00:00
Matthijs Mekking
ab8a0c4b5a and fix yet another dns_qp_lookup() iterator bug
This one is similar to the bug when searching for a key, reaching a
dead-end branch that doesn't match, because the branch offset point
is after the point where the search key differs.

This fixes the case where we are multiple levels deep. In other
words, we had a more-than-one matches *after* the point where the
search key differs.

For example, consider the following qp-trie:

branch: "[e]", "[m]":
 - leaf: "a.b.c.d.e"
 - branch: "moo[g]", "moo[k]", "moo[n]":
   - leaf: "moog"
   - branch: "mook[e]", "mook[o]"
     - leaf: "mooker"
     - leaf: "mooko"
   - leaf: "moon"

If searching for a key "monky", we would reach the branch with
twigs "moo[k]" and "moo[n]". The key matches on the 'k' on offset=4,
and reaches the branch with twigs "mook[e]" and "mook[o]". This time
we cannot find a twig that matches our key at offset=5, there is no
twig for 'y'. The closest name we found was "mooker".

Note that on a branch it can't detect it is on a dead branch because the
key is not encapsulated in a branch node.

In the previous code we considered "mooker" to be the successor of
"monky" and so we needed to the predecessor of "mooker" to find the
predecessor for "monky". However, since the search key alread differed
before entering this branch, this is not enough. We would be left with
"moog" as the predecessor of "monky", while in this example "a.b.c.d.e"
is the actual predecessor.

Instead, we need to go up a level, find the predecessor and check
again if we are on the right branch, and repeat the process until we
are.

Unit tests to cover the scenario are now added.
2023-12-11 21:01:29 +00:00
Matthijs Mekking
276bdcf5cf and fix another dns_qp_lookup() iterator bug
There was yet another edge case in which an iterator could be
positioned at the wrong node after dns_qp_lookup(). When searching for
a key, it's possible to reach a leaf that matches at the given offset,
but because the offset point is *after* the point where the search key
differs from the leaf's contents, we are now at the wrong leaf.

In other words, the bug fixed the previous commit for dead-end branches
must also be applied on matched leaves.

For example, if searching for the key "monpop", we could reach a branch
containing "moop" and "moor". the branch offset point - i.e., the point
after which the branch's leaves differ from each other - is the
fourth character ("p" or "r"). The search key matches the fourth
character "p", and takes that twig to the next node (which can be
a branch for names starting with "moop", or could be a leaf node for
"moop").

The old code failed to detect this condition, and would have
incorrectly left the iterator pointing at some successor, and not
at the predecessor of the "moop".

To find the right predecessor in this case, we need to get to the
previous branch and get the previous from there.

This has been fixed and the unit test now includes several new
scenarios for testing search names that match and unmatch on the
offset but have a different character before the offset.
2023-12-11 21:01:29 +00:00
Michal Nowak
a71c0f5338 Merge branch 'mnowak/replace-danger-python-with-hazard' into 'main'
Replace danger-python with Hazard

See merge request isc-projects/bind9!8548
2023-12-11 17:02:47 +00:00
Tom Krizek
4f70f5bd7c Handle empty MR description in dangerfile
A merge request might have no description at all (i.e. None, rather than
an empty string). This might happen when the MR is created via an API.
Check a description is present before trying to find a backport string
in it.
2023-12-11 17:22:03 +01:00
Michał Kępień
43126e81e6 Improve determining the lines added by a branch
Since the list of lines added to Git-tracked text files in a given
branch is not part of the Danger DSL [1], it is determined using custom
code in dangerfile.py.  The current implementation of that logic is less
than perfect as it examines the diff between the current tip of the
target branch and the source branch rather than the diff between the
merge base of the two branches and the source branch.  Consider a Git
history like this:

    *   F (target)
    ...
    *   E
    *   D
    *   C
    | * B (source)
    |/
    *   A (merge base)

If danger-python or Hazard are run for commit B, the current logic for
determining the list of added lines in dangerfile.py examines the diff
between commits F and B rather than between commits A and B.  Therefore,
the added_lines() function returns not just the lines added by commit B
on top of commit A, but also the list of lines that were removed between
commits A and F, which leads to confusing results.

Fix by using the triple-dot diff operator in the Git invocation whose
output is used as the source of information for determining the list of
lines added by a given branch.

Since Hazard fetches the target branch itself when it is run, remove the
explicit "git fetch" invocation that fetches the target branch from
GitLab (shortening its local history to a single commit in the process)
before "git diff" is invoked.

[1] https://danger.systems/js/reference.html#GitDSL
2023-12-11 17:22:03 +01:00
Michal Nowak
08ce1bc45f Replace danger-python with Hazard
Hazard is a minimal danger-python replacement.
2023-12-11 17:22:03 +01:00
Tom Krizek
dc6200ed87 Merge branch 'tkrizek/set-up-version-and-release-notes-for-bind-9.19.20' into 'main'
Set up version and release notes for BIND 9.19.20

See merge request isc-projects/bind9!8560
2023-12-08 15:04:58 +00:00
Tom Krizek
9f82448ab5 Set up release notes for BIND 9.19.20 2023-12-08 15:51:48 +01:00
Tom Krizek
2964019558 Update BIND version to 9.19.20-dev 2023-12-08 15:51:48 +01:00
Tom Krizek
18a05caf55 Update BIND version for release v9.19.19 2023-12-08 12:39:04 +01:00
Tom Krizek
8ce8c1c503 Add a CHANGES marker 2023-12-08 12:38:59 +01:00
Tom Krizek
64d5751891 Merge branch 'michal/prepare-documentation-for-bind-9.19.19' into 'v9.19.19-release'
Prepare documentation for BIND 9.19.19

See merge request isc-private/bind9!598
2023-12-08 11:38:30 +00:00
Tom Krizek
874329b3b1 Temporarily allow failure of respdiff-long:tsan job
There was a change in the branch that uncovered preexisting data races
when testing with respdiff under TSAN. This isn't a new issue that
should stop the releases. Allow the check to temporarily fail until the
underlying issue GL #4475 is addressed.
2023-12-07 16:42:43 +01:00
Michał Kępień
b6e8419045 Tweak and reword release notes 2023-12-07 15:34:47 +01:00
Michał Kępień
51706a1f16 Prepare release notes for BIND 9.19.19 2023-12-07 14:53:14 +01:00
Tom Krizek
7ec5f494e2 Merge branch '4405-cleanup-resolver-nonbackoff-tries-check' into 'main'
Remove obsolete check for resolver-nonbackoff-tries

See merge request isc-projects/bind9!8557
2023-12-07 12:53:32 +00:00
Tom Krizek
059a63793a Remove obsolete check for resolver-nonbackoff-tries
With the resolver-nonbackoff-tries statement being removed in #4405,
this check can no longer be reached and can be safely removed.
2023-12-07 13:10:58 +01:00
Mark Andrews
28d5de9046 Merge branch '4448-improve-lur-cleaning-behaviour' into 'main'
Resolve "Improve LRU cleaning behaviour"

Closes #4448 and #4269

See merge request isc-projects/bind9!8516
2023-12-07 09:48:55 +00:00
Mark Andrews
6ef8d8d699 Add CHANGES for [GL #4448] 2023-12-07 02:59:04 +00:00
Mark Andrews
7e462c2b26 Also cleanup the space for the rbt nodes
As we are in overmem state we want to free more memory than we are
adding so we need to add in an allowance for the rbtnodes that may
have been added and the names stored with them.  There is the node
for the owner name and a possible ENT node if there was a node split.
2023-12-07 02:59:04 +00:00
Mark Andrews
5e8f0e9ceb Process the combined LRU lists in LRU order
Only cleanup headers that are less than equal to the rbt's last_used
time.  Adjust the rbt's last_used time when the target cleaning was
not achieved to the oldest value of the remaining set of headers.

When updating delegating NS and glue records last_used was not being
updated when it should have been.

When adding zero TTL records to the tail of the LRU lists set
last_used to rbtdb->last_used + 1 rather than now.  This appoximately
preserves the lists LRU order.
2023-12-07 02:59:04 +00:00
Evan Hunt
8af6fc44e0 Merge branch 'each-cleanup-trivia' into 'main'
assorted trivial cleanups

See merge request isc-projects/bind9!8450
2023-12-07 02:40:05 +00:00
Evan Hunt
c8f43b9160 remove some long-deprecated arguments from dig
certain dig options which were deprecated and became nonoperational
several releases ago still had documentation in the dig man page and
warnings printed when they were used: these included +mapped,
+sigchase, +topdown, +unexpected, +trusted-key, and the -i and -n
options. these are now all fatal errors.

another option was described as deprecated in the man page, but
the code to print a warning was never added. it has been added now.
2023-12-06 17:32:09 -08:00
Evan Hunt
ced8a82503 fix consistency check for delv +ns and +qmin
the code to prevent +qmin from being used without +ns was
in the wrong place, resulting in it only working correctly
if +ns was specified first.
2023-12-06 17:31:39 -08:00
Evan Hunt
90a16b3e65 fix unnecessary capitalization
there was a typo in the copyright header.
2023-12-06 17:31:38 -08:00
Evan Hunt
03daed4d11 remove bin/rndc/rndc.conf
this file was no longer used.
2023-12-06 17:31:38 -08:00
Evan Hunt
7d05590a6f clean up client.c
- make dns_client_startresolve() static since it's only used internally
- remove outdated comments
2023-12-06 17:31:38 -08:00
Evan Hunt
50dd6aad34 remove unused functions in dns_master
dns_master_dumpnode() and dns_master_dumpnodetostream() were
never used and can be removed.
2023-12-06 17:31:38 -08:00
Evan Hunt
b92c3d9864 Merge branch '4405-remove-resolver-opts' into 'main'
deprecate/remove resolver-retry-interval and resolver-nonbackoff-tries

Closes #4405

See merge request isc-projects/bind9!8448
2023-12-06 21:39:05 +00:00
Evan Hunt
66496d550b remove resolver-retry-interval and resolver-nonbackoff-tries
fully remove these options and mark them as ancient.
2023-12-06 11:54:59 -08:00
Evan Hunt
4aaa4f7dca deprecate resolver-retry-interval and resolver-nonbackoff-tries
these options control default timing of retries in the resolver
for experimental purposes; they are not known to useful in production
environments.  they will be removed in the future; for now, we
only log a warning if they are used.
2023-12-06 11:51:22 -08:00
Evan Hunt
70bebce4dd Merge branch 'each-qp-lookup-iterator' into 'main'
add an iterator argument to dns_qp_lookup()

See merge request isc-projects/bind9!8468
2023-12-06 19:17:20 +00:00
Evan Hunt
60a33ae6bb fix another dns_qp_lookup() iterator bug
there was another edge case in which an iterator could be positioned at
the wrong node after dns_qp_lookup().  when searching for a key, it's
possible to reach a dead-end branch that doesn't match, because the
branch offset point is *after* the point where the search key differs
from the branch's contents.

for example, if searching for the key "mop", we could reach a branch
containing "moon" and "moor". the branch offset point - i.e., the
point after which the branch's leaves differ from each other - is the
fourth character ("n" or "r"). however, both leaves differ from the
search key at position *three* ("o" or "p"). the old code failed to
detect this condition, and would have incorrectly left the iterator
pointing at some lower value and not at "moor".

this has been fixed and the unit test now includes this scenario.
2023-12-06 11:03:30 -08:00
Evan Hunt
8612902476 fix dns_qp_lookup() iterator bug
in some cases it was possible for the iterator to be positioned in the
wrong place by dns_qp_lookup(). previously, when a leaf node was found
which matched the search key at its parent branch's offset point, but
did not match after that point, the code incorrectly assumed the leaf
it had found was a successor to the searched-for name, and stepped the
iterator back to find a predecessor.  however, it was possible for the
non-matching leaf to be the predecessor, in which case stepping the
iterator back was wrong.

(for example: a branch contains "aba" and "abcd", and we are searching
for "abcde". we step down to the twig matching the letter "c" in
position 3. "abcd" is the predecessor of "abcde", so the iterator is
already correctly positioned, but because the twig was an exact match,
we would have moved it back one step to "aba".)

this previously went unnoticed due to a mistake in the qp_test unit
test, which had the wrong expected result for the test case that should
have detected the error. both the code and the test have been fixed.
2023-12-06 11:03:30 -08:00
Evan Hunt
947bc0a432 add an iterator argument to dns_qp_lookup()
the 'predecessor' argument to dns_qp_lookup() turns out not to
be sufficient for our needs: the predecessor node in a QP database
could have become "empty" (for the current version) because of an
update or because cache data expired, and in that case the caller
would have to iterate more than one step back to find the predecessor
node that it needs.

it may also be necessary for a caller to iterate forward, in
order to determine whether a node has any children.

for both of these reasons, we now replace the 'predecessor'
argument with an 'iter' argument. if set, this points to memory
with enough space for a dns_qpiter object.

when an exact match is found by the lookup, the iterator will be
pointing to the matching node. if not, it will be pointing to the
lexical predecessor of the nae that was searched for.

a dns_qpiter_current() method has been added for examining
the current value of the iterator without moving it in either
direction.
2023-12-06 11:03:30 -08:00
Tom Krizek
e81f49d13b Merge branch 'tkrizek/add-changes-entry-for-4462' into 'main'
Add CHANGES entry for #4462

See merge request isc-projects/bind9!8551
2023-12-06 16:33:51 +00:00
Tom Krizek
d3be215655 Add CHANGES entry for #4462 2023-12-06 17:24:50 +01:00
Artem Boldariev
6aba9faddd Merge branch '4464-multithread-tls-initialisation-crash-fix' into 'main'
Fix TLS certs store deletion on concurrent access

Closes #4464

See merge request isc-projects/bind9!8531
2023-12-06 15:29:05 +00:00
Artem Boldariev
f7de766168 Update CHANGES [GL #4464]
Mention that BIND crashing due to a `tls` multithreaded entry
initialisation attempts has been fixed.
2023-12-06 16:02:22 +02:00
Artem Boldariev
10e626111f doth test: add a secondary NS instance that reuses a 'tls' entry
This commit extends the 'doth' system tests with additional secondary
NS instance that reuses the same 'tls' entry for connecting the the
primary to download zones. This configurations were known to crash
secondaries in some cases.
2023-12-06 16:01:20 +02:00
Artem Boldariev
b109fa9192 Fix TLS certs store deletion on concurrent access
During initialisation or reconfiguration, it is possible that multiple
threads are trying to create a TLS context and associated data (like
TLS certs store) concurrently. In some cases, a thread might be too
late to add newly created data to the TLS contexts cache, in which
case it needs to be discarded. In the code that handles that case, it
was not taken into account that, in some cases, the TLS certs store
could not have been created or should not be deleted, as it is being
managed by the TLS contexts cache already. Deleting the store in such
cases might lead to crashes.

This commit fixes the issue.
2023-12-06 16:01:20 +02:00
Artem Boldariev
57a5e2285f Merge branch '4388-initial-proxyv2-support-in-bind-and-dig' into 'main'
Make it possible to accept PROXYv2 in BIND (and send it in dig)

Closes #4388

See merge request isc-projects/bind9!8417
2023-12-06 13:49:01 +00:00
Artem Boldariev
8a9b4721a6 Update CHANGES [GL #4388]
Mention the initial support for PROXYv2.
2023-12-06 15:15:26 +02:00
Artem Boldariev
5f7ca686c6 Update release notes [GL #4388]
Mention the initial support for PROXYv2.
2023-12-06 15:15:25 +02:00
Artem Boldariev
71219882ed DoH unit test: do not increase 'active_cconnects' too much
Theoretically, the value could get too big, not letting the test to
finish. This commit fixes that omission.
2023-12-06 15:15:25 +02:00
Artem Boldariev
019555fb1d System test for PROXYv2
This commit adds a system test suite for PROXYv2. The idea on which it
is based is simple:

1. Firstly we check that 'allow-proxy' and 'allow-proxy-on' (whatever
is using the new 'isc_nmhandle_real_localaddr/peeraddr()') do what
they intended to do.

2. Anything else that needs an interface or peer address (ACL
functionality, for example) is using the old
'isc_nmhandle_localaddr/peeraddr()' - which are now returning
addresses received via PROXY (if any) instead of the real connection
addresses. The beauty of it that we DO NOT need to verify every bit of
the code relying on these functions: whatever works in one place will
work everywhere else, as these were the only functions that allowed
any higher level code to get peer and interface addresses.

This way it is relatively easy to see if PROXYv2 works as intended.
2023-12-06 15:15:25 +02:00