mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-04 08:35:31 +00:00
use dns_view_findzonecut()
This commit is contained in:
@@ -1237,7 +1237,7 @@ cache_message(fetchctx_t *fctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline isc_result_t
|
static inline isc_result_t
|
||||||
ncache_message(fetchctx_t *fctx, dns_rdatatype_t covers) {
|
ncache_message(fetchctx_t *fctx, dns_rdatatype_t covers, isc_stdtime_t now) {
|
||||||
isc_result_t result, eresult;
|
isc_result_t result, eresult;
|
||||||
dns_name_t *name;
|
dns_name_t *name;
|
||||||
dns_resolver_t *res;
|
dns_resolver_t *res;
|
||||||
@@ -1249,11 +1249,6 @@ ncache_message(fetchctx_t *fctx, dns_rdatatype_t covers) {
|
|||||||
dns_name_t *fname, *aname;
|
dns_name_t *fname, *aname;
|
||||||
dns_fetchevent_t *event;
|
dns_fetchevent_t *event;
|
||||||
void *data;
|
void *data;
|
||||||
isc_stdtime_t now;
|
|
||||||
|
|
||||||
result = isc_stdtime_get(&now);
|
|
||||||
if (result != ISC_R_SUCCESS)
|
|
||||||
return (result);
|
|
||||||
|
|
||||||
res = fctx->res;
|
res = fctx->res;
|
||||||
need_validation = ISC_FALSE;
|
need_validation = ISC_FALSE;
|
||||||
@@ -2033,6 +2028,9 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
|
|||||||
dns_message_t *message;
|
dns_message_t *message;
|
||||||
fetchctx_t *fctx;
|
fetchctx_t *fctx;
|
||||||
dns_rdatatype_t covers;
|
dns_rdatatype_t covers;
|
||||||
|
dns_name_t *fname;
|
||||||
|
dns_fixedname_t foundname;
|
||||||
|
isc_stdtime_t now;
|
||||||
|
|
||||||
REQUIRE(VALID_QUERY(query));
|
REQUIRE(VALID_QUERY(query));
|
||||||
fctx = query->fctx;
|
fctx = query->fctx;
|
||||||
@@ -2042,6 +2040,10 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
|
|||||||
(void)task;
|
(void)task;
|
||||||
QTRACE("response");
|
QTRACE("response");
|
||||||
|
|
||||||
|
result = isc_stdtime_get(&now);
|
||||||
|
if (result != ISC_R_SUCCESS)
|
||||||
|
goto done;
|
||||||
|
|
||||||
(void)isc_timer_touch(fctx->timer);
|
(void)isc_timer_touch(fctx->timer);
|
||||||
|
|
||||||
keep_trying = ISC_FALSE;
|
keep_trying = ISC_FALSE;
|
||||||
@@ -2150,7 +2152,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
|
|||||||
* This may also cause work to be queued to the
|
* This may also cause work to be queued to the
|
||||||
* DNSSEC validator.
|
* DNSSEC validator.
|
||||||
*/
|
*/
|
||||||
result = ncache_message(fctx, covers);
|
result = ncache_message(fctx, covers, now);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
goto done;
|
goto done;
|
||||||
} else {
|
} else {
|
||||||
@@ -2200,15 +2202,38 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
|
|||||||
* decrease its 'goodness', possibly add a 'lame'
|
* decrease its 'goodness', possibly add a 'lame'
|
||||||
* entry, and maybe log a message.
|
* entry, and maybe log a message.
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
* Do we need to find the best nameservers for this fetch?
|
|
||||||
*/
|
|
||||||
if (get_nameservers) {
|
if (get_nameservers) {
|
||||||
result = dns_view_find(fctx->res->view, &fctx->domain,
|
dns_fixedname_init(&foundname);
|
||||||
dns_rdatatype_ns, 0,
|
fname = dns_fixedname_name(&foundname);
|
||||||
DNS_DBFIND_GLUEOK,
|
if (result != ISC_R_SUCCESS) {
|
||||||
ISC_FALSE, &fctx->nameservers,
|
fctx_done(fctx, DNS_R_SERVFAIL);
|
||||||
NULL);
|
return;
|
||||||
|
}
|
||||||
|
result = dns_view_findzonecut(fctx->res->view,
|
||||||
|
&fctx->domain,
|
||||||
|
fname,
|
||||||
|
now, 0, ISC_TRUE,
|
||||||
|
&fctx->nameservers,
|
||||||
|
NULL);
|
||||||
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
fctx_done(fctx, DNS_R_SERVFAIL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!dns_name_issubdomain(fname, &fctx->domain)) {
|
||||||
|
/*
|
||||||
|
* The best nameservers are now above our
|
||||||
|
* previous QDOMAIN.
|
||||||
|
*
|
||||||
|
* XXXRTH What should we do here?
|
||||||
|
*/
|
||||||
|
QTRACE("avoiding upward referral");
|
||||||
|
fctx_done(fctx, DNS_R_SERVFAIL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dns_name_free(&fctx->domain, fctx->res->mctx);
|
||||||
|
dns_name_init(&fctx->domain, NULL);
|
||||||
|
result = dns_name_dup(fname, fctx->res->mctx,
|
||||||
|
&fctx->domain);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
fctx_done(fctx, DNS_R_SERVFAIL);
|
fctx_done(fctx, DNS_R_SERVFAIL);
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user