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

Don't use static stub when returning best NS

If we find a static stub zone in query_addbestns look for a parent
zone which isn't a static stub.

(cherry picked from commit 40816e4e35)
This commit is contained in:
Mark Andrews
2024-02-28 18:01:55 +11:00
parent f0f8f41751
commit 7498db6366

View File

@@ -11246,21 +11246,50 @@ query_addbestns(query_ctx_t *qctx) {
isc_buffer_t b;
dns_clientinfomethods_t cm;
dns_clientinfo_t ci;
dns_name_t qname;
CTRACE(ISC_LOG_DEBUG(3), "query_addbestns");
dns_clientinfomethods_init(&cm, ns_client_sourceip);
dns_clientinfo_init(&ci, client, NULL);
dns_name_init(&qname, NULL);
dns_name_clone(client->query.qname, &qname);
/*
* Find the right database.
*/
result = query_getdb(client, client->query.qname, dns_rdatatype_ns, 0,
&zone, &db, &version, &is_zone);
do {
result = query_getdb(client, &qname, dns_rdatatype_ns, 0, &zone,
&db, &version, &is_zone);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
/*
* If this is a static stub zone look for a parent zone.
*/
if (zone != NULL &&
dns_zone_gettype(zone) == dns_zone_staticstub)
{
unsigned int labels = dns_name_countlabels(&qname);
dns_db_detach(&db);
dns_zone_detach(&zone);
version = NULL;
if (labels != 1) {
dns_name_split(&qname, labels - 1, NULL,
&qname);
continue;
}
if (!USECACHE(client)) {
goto cleanup;
}
dns_db_attach(client->view->cachedb, &db);
is_zone = false;
}
break;
} while (true);
db_find:
/*
* We'll need some resources...