chg: dev: remove sigrdataset from dns_view_findzonecut()

Since the `sigrdataset` "output" parameter of `dns_view_findzonecut()` is never used (always called with NULL), it is now removed. As the resolver is moving towards a parent-centric direction, there is no point having a signature for the NS record (which is not authoritative in the parent, so never signed) when `dns_view_findzonecut()` is called.

Also, rename `dns_view_findzonecut()` as `dns_view_bestzonecut()` as it is used only in the context where the closest name servers for a name need to be queried and to avoid ambiguities with other code flows using `dns_db_findzonecut()`.

Merge branch 'colin/findzonecut-removesig' into 'main'

See merge request isc-projects/bind9!11444
This commit is contained in:
Colin Vidal 2026-01-16 08:29:45 +01:00
commit b40f92eb26
6 changed files with 26 additions and 40 deletions

View file

@ -6590,8 +6590,8 @@ tat_send(void *arg) {
*/
domain = dns_fixedname_initname(&fdomain);
dns_rdataset_init(&nameservers);
result = dns_view_findzonecut(tat->view, keyname, domain, NULL, 0, 0,
true, true, &nameservers, NULL);
result = dns_view_bestzonecut(tat->view, keyname, domain, NULL, 0, 0,
true, true, &nameservers);
if (result == ISC_R_SUCCESS) {
result = dns_resolver_createfetch(
tat->view->resolver, tatname, dns_rdatatype_null,

View file

@ -2738,8 +2738,8 @@ fetch_name(dns_adbname_t *adbname, bool start_at_zone, bool no_validation,
DP(ENTER_LEVEL, "fetch_name: starting at zone for name %p",
adbname);
name = dns_fixedname_initname(&fixed);
CHECK(dns_view_findzonecut(adb->view, adbname->name, name, NULL,
0, 0, true, false, &rdataset, NULL));
CHECK(dns_view_bestzonecut(adb->view, adbname->name, name, NULL,
0, 0, true, false, &rdataset));
nameservers = &rdataset;
options |= DNS_FETCHOPT_UNSHARED;
} else if (adb->view->qminimization) {

View file

@ -684,10 +684,10 @@ dns_view_simplefind(dns_view_t *view, const dns_name_t *name,
*/
isc_result_t
dns_view_findzonecut(dns_view_t *view, const dns_name_t *name,
dns_view_bestzonecut(dns_view_t *view, const dns_name_t *name,
dns_name_t *fname, dns_name_t *dcname, isc_stdtime_t now,
unsigned int options, bool use_hints, bool use_cache,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
dns_rdataset_t *rdataset);
/*%<
* Find the best known zonecut containing 'name'.
*
@ -704,9 +704,6 @@ dns_view_findzonecut(dns_view_t *view, const dns_name_t *name,
*\li If 'use_cache' is true, and the view has a cache, then it will be
* searched.
*
*\li If 'sigrdataset' is not NULL, and there is a SIG rdataset which
* covers 'type', then 'sigrdataset' will be bound to it.
*
*\li If the DNS_DBFIND_NOEXACT option is set, then the zonecut returned
* (if any) will be the deepest known ancestor of 'name'.
*

View file

@ -4496,9 +4496,9 @@ resume_qmin(void *arg) {
if (dns_rdatatype_atparent(fctx->type)) {
findoptions |= DNS_DBFIND_NOEXACT;
}
result = dns_view_findzonecut(res->view, fctx->name, fname, dcname,
result = dns_view_bestzonecut(res->view, fctx->name, fname, dcname,
fctx->now, findoptions, true, true,
&fctx->nameservers, NULL);
&fctx->nameservers);
FCTXTRACEN("resume_qmin findzonecut", fname, result);
if (result != ISC_R_SUCCESS) {
@ -4943,10 +4943,10 @@ fctx__create(dns_resolver_t *res, isc_loop_t *loop, const dns_name_t *name,
if (dns_rdatatype_atparent(fctx->type)) {
findoptions |= DNS_DBFIND_NOEXACT;
}
result = dns_view_findzonecut(
result = dns_view_bestzonecut(
res->view, name, fctx->fwdname, dcname,
fctx->now, findoptions, true, true,
&fctx->nameservers, NULL);
&fctx->nameservers);
if (result != ISC_R_SUCCESS) {
goto cleanup_nameservers;
}
@ -9219,9 +9219,9 @@ rctx_nextserver(respctx_t *rctx, dns_message_t *message,
} else {
name = fctx->domain;
}
result = dns_view_findzonecut(
fctx->res->view, name, fname, dcname, fctx->now,
findoptions, true, true, &fctx->nameservers, NULL);
result = dns_view_bestzonecut(fctx->res->view, name, fname,
dcname, fctx->now, findoptions,
true, true, &fctx->nameservers);
if (result != ISC_R_SUCCESS) {
FCTXTRACE("couldn't find a zonecut");
fctx_failure_detach(&rctx->fctx, DNS_R_SERVFAIL);

View file

@ -3234,9 +3234,8 @@ seek_ds(dns_validator_t *val, isc_result_t *resp) {
*/
if (result == DNS_R_NXRRSET &&
!dns_rdataset_isassociated(&val->frdataset) &&
dns_view_findzonecut(val->view, tname, found, NULL, 0, 0,
false, false, NULL,
NULL) == ISC_R_SUCCESS &&
dns_view_bestzonecut(val->view, tname, found, NULL, 0, 0,
false, false, NULL) == ISC_R_SUCCESS &&
dns_name_equal(tname, found))
{
*resp = markanswer(val, "seek_ds (2)");

View file

@ -986,7 +986,7 @@ dns_view_simplefind(dns_view_t *view, const dns_name_t *name,
static isc_result_t
findzonecut_zone(dns_view_t *view, const dns_name_t *name, dns_name_t *fname,
dns_name_t *dcname, isc_stdtime_t now, unsigned int options,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) {
dns_rdataset_t *rdataset) {
dns_db_t *db = NULL;
dns_zone_t *zone = NULL;
unsigned int ztoptions = DNS_ZTFIND_MIRROR;
@ -1016,7 +1016,7 @@ findzonecut_zone(dns_view_t *view, const dns_name_t *name, dns_name_t *fname,
}
result = dns_db_find(db, name, NULL, dns_rdatatype_ns, options, now,
NULL, fname, rdataset, sigrdataset);
NULL, fname, rdataset, NULL);
if (result != DNS_R_DELEGATION && result != ISC_R_SUCCESS) {
/*
* The zone exists, but there is no delegation. Here again
@ -1043,7 +1043,6 @@ findzonecut_zone(dns_view_t *view, const dns_name_t *name, dns_name_t *fname,
cleanup:
if (result != ISC_R_SUCCESS) {
dns_rdataset_cleanup(rdataset);
dns_rdataset_cleanup(sigrdataset);
}
if (db != NULL) {
@ -1060,13 +1059,13 @@ cleanup:
static isc_result_t
findzonecut_cache(dns_view_t *view, const dns_name_t *name, dns_name_t *fname,
dns_name_t *dcname, isc_stdtime_t now, unsigned int options,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) {
dns_rdataset_t *rdataset) {
isc_result_t result = DNS_R_NXDOMAIN;
if (view->cachedb != NULL) {
result = dns_db_findzonecut(view->cachedb, name, options, now,
NULL, fname, dcname, rdataset,
sigrdataset);
NULL);
}
/*
@ -1076,7 +1075,6 @@ findzonecut_cache(dns_view_t *view, const dns_name_t *name, dns_name_t *fname,
*/
if (result != ISC_R_SUCCESS) {
dns_rdataset_cleanup(rdataset);
dns_rdataset_cleanup(sigrdataset);
result = DNS_R_NXDOMAIN;
}
@ -1087,16 +1085,15 @@ static void
findzonecut_zoneorcache(dns_view_t *view, const dns_name_t *name,
dns_name_t *fname, dns_name_t *dcname,
isc_stdtime_t now, unsigned int options,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) {
dns_rdataset_t *rdataset) {
isc_result_t result;
dns_rdataset_t crdataset = DNS_RDATASET_INIT;
dns_rdataset_t csigrdataset = DNS_RDATASET_INIT;
dns_fixedname_t f, dc;
dns_name_t *cfname = dns_fixedname_initname(&f);
dns_name_t *cdcname = dns_fixedname_initname(&dc);
CHECK(findzonecut_cache(view, name, cfname, cdcname, now, options,
&crdataset, &csigrdataset));
&crdataset));
bool cacheclosest = dns_name_issubdomain(cfname, fname);
bool staticstub = rdataset->attributes.staticstub &&
@ -1104,12 +1101,7 @@ findzonecut_zoneorcache(dns_view_t *view, const dns_name_t *name,
if (cacheclosest && !staticstub) {
dns_rdataset_cleanup(rdataset);
dns_rdataset_cleanup(sigrdataset);
dns_rdataset_clone(&crdataset, rdataset);
if (sigrdataset != NULL) {
dns_rdataset_clone(&csigrdataset, sigrdataset);
}
dns_name_copy(cfname, fname);
if (dcname != NULL) {
@ -1119,7 +1111,6 @@ findzonecut_zoneorcache(dns_view_t *view, const dns_name_t *name,
cleanup:
dns_rdataset_cleanup(&crdataset);
dns_rdataset_cleanup(&csigrdataset);
}
static isc_result_t
@ -1143,17 +1134,17 @@ findzonecut_hints(dns_view_t *view, dns_name_t *fname, dns_name_t *dcname,
}
isc_result_t
dns_view_findzonecut(dns_view_t *view, const dns_name_t *name,
dns_view_bestzonecut(dns_view_t *view, const dns_name_t *name,
dns_name_t *fname, dns_name_t *dcname, isc_stdtime_t now,
unsigned int options, bool usehints, bool usecache,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) {
dns_rdataset_t *rdataset) {
isc_result_t result;
REQUIRE(DNS_VIEW_VALID(view));
REQUIRE(view->frozen);
result = findzonecut_zone(view, name, fname, dcname, now, options,
rdataset, sigrdataset);
rdataset);
if (result == DNS_R_NXDOMAIN && usecache) {
/*
@ -1161,14 +1152,14 @@ dns_view_findzonecut(dns_view_t *view, const dns_name_t *name,
* delegation.
*/
result = findzonecut_cache(view, name, fname, dcname, now,
options, rdataset, sigrdataset);
options, rdataset);
} else if (result == ISC_R_SUCCESS && usecache) {
/*
* A zone with a (possibly partial) delegation match but the
* cache can have a more precise delegation.
*/
findzonecut_zoneorcache(view, name, fname, dcname, now, options,
rdataset, sigrdataset);
rdataset);
}
/*
@ -1181,7 +1172,6 @@ dns_view_findzonecut(dns_view_t *view, const dns_name_t *name,
if (result != ISC_R_SUCCESS) {
result = DNS_R_NXDOMAIN;
dns_rdataset_cleanup(rdataset);
dns_rdataset_cleanup(sigrdataset);
}
return result;