2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Revert "Use a binary search to find the NSEC3 closest encloser"

This reverts commit ae718fab53.
This commit is contained in:
Michał Kępień
2025-05-06 09:14:18 +02:00
parent d0e0706797
commit 5df876e968

View File

@@ -11367,33 +11367,24 @@ again:
* No NSEC proof available, return NSEC3 proofs instead. * No NSEC proof available, return NSEC3 proofs instead.
*/ */
cname = dns_fixedname_initname(&cfixed); cname = dns_fixedname_initname(&cfixed);
/* /*
* Find the closest encloser using a binary search. * Find the closest encloser.
* maxlabels: suffix length of NXDOMAIN result
* minlabels: suffix length of non NXDOMAIN result
*/ */
unsigned int maxlabels = dns_name_countlabels(name);
unsigned int minlabels = dns_name_countlabels(fname);
bool search = result == DNS_R_NXDOMAIN;
dns_name_copy(name, cname); dns_name_copy(name, cname);
while (search) { while (result == DNS_R_NXDOMAIN) {
labels = (maxlabels + minlabels) / 2; labels = dns_name_countlabels(cname) - 1;
dns_name_split(name, labels, NULL, cname); /*
if (labels == minlabels) { * Sanity check.
break; */
if (labels == 0U) {
goto cleanup;
} }
dns_name_split(cname, labels, NULL, cname);
result = dns_db_findext(qctx->db, cname, qctx->version, result = dns_db_findext(qctx->db, cname, qctx->version,
dns_rdatatype_nsec, options, 0, dns_rdatatype_nsec, options, 0,
NULL, fname, &cm, &ci, NULL, NULL, fname, &cm, &ci, NULL,
NULL); NULL);
if (result == DNS_R_NXDOMAIN) {
maxlabels = labels;
} else {
minlabels = labels;
}
} }
/* /*
* Add closest (provable) encloser NSEC3. * Add closest (provable) encloser NSEC3.
*/ */