From: Colin Vidal Date: Tue, 16 Dec 2025 13:20:32 +0000 (+0100) Subject: findzonecut: helper function for hints lookup X-Git-Tag: v9.21.18~34^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b6863844819bccb30873a7408dcb2c7cde047ec;p=thirdparty%2Fbind9.git findzonecut: helper function for hints lookup Extract `view_dns_findzonecut()` hints lookup parts in a separate helper function. --- diff --git a/lib/dns/view.c b/lib/dns/view.c index 9f707b3171b..40b473dd4a8 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -983,6 +983,26 @@ dns_view_simplefind(dns_view_t *view, const dns_name_t *name, return result; } +static isc_result_t +findzonecut_hints(dns_view_t *view, dns_name_t *fname, dns_name_t *dcname, + isc_stdtime_t now, dns_rdataset_t *rdataset) { + isc_result_t result = ISC_R_NOTFOUND; + + if (view->hints == NULL) { + return result; + } + + result = dns_db_find(view->hints, dns_rootname, NULL, dns_rdatatype_ns, + 0, now, NULL, fname, rdataset, NULL); + if (result != ISC_R_SUCCESS) { + dns_rdataset_cleanup(rdataset); + } else if (dcname != NULL) { + dns_name_copy(fname, dcname); + } + + return result; +} + isc_result_t dns_view_findzonecut(dns_view_t *view, const dns_name_t *name, dns_name_t *fname, dns_name_t *dcname, isc_stdtime_t now, @@ -1149,22 +1169,7 @@ finish: dns_rdataset_clone(&zsigrdataset, sigrdataset); } } else if (try_hints) { - /* - * We've found nothing so far, but we have hints. - */ - result = dns_db_find(view->hints, dns_rootname, NULL, - dns_rdatatype_ns, 0, now, NULL, fname, - rdataset, NULL); - if (result != ISC_R_SUCCESS) { - /* - * We can't even find the hints for the root - * nameservers! - */ - dns_rdataset_cleanup(rdataset); - result = ISC_R_NOTFOUND; - } else if (dcname != NULL) { - dns_name_copy(fname, dcname); - } + result = findzonecut_hints(view, fname, dcname, now, rdataset); } cleanup: