bind9/tests
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
..
bench Update the source code formatting using clang-format-17 2023-10-17 17:47:46 +02:00
dns and fix yet another dns_qp_lookup() iterator bug 2023-12-11 21:01:29 +00:00
include/tests modify dns_qp_findname_ancestor() to return found name 2023-09-28 07:01:13 +00:00
irs Include <inttypes.h> whenever including <cmocka.h> 2023-05-18 15:12:23 +02:00
isc DoH unit test: do not increase 'active_cconnects' too much 2023-12-06 15:15:25 +02:00
isccfg Include <inttypes.h> whenever including <cmocka.h> 2023-05-18 15:12:23 +02:00
libtest Adjust message buffer sizes in test code 2023-11-16 11:22:02 +11:00
ns Change dns_message_create() function to accept memory pools 2023-09-24 18:07:40 +02:00
.gitignore Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
Makefile.am Build libtest even if CMOCKA is not available 2023-03-29 02:29:18 +00:00
unit-test-driver.sh.in Reformat shell scripts with shfmt 2023-10-26 10:23:50 +02:00