mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 07:35:26 +00:00
2221. [bug] Set the event result code to reflect the actual
record content when a cache update is rejected due to a more credible answer existing. [RT #17017]
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,3 +1,7 @@
|
|||||||
|
2221. [bug] Set the event result code to reflect the actual
|
||||||
|
record content when a cache update is rejected
|
||||||
|
due to a more credible answer existing. [RT #17017]
|
||||||
|
|
||||||
2220. [bug] win32: Address a race condition in final shutdown of
|
2220. [bug] win32: Address a race condition in final shutdown of
|
||||||
the Windows socket code. [RT #17028]
|
the Windows socket code. [RT #17028]
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: resolver.c,v 1.349 2007/06/18 23:47:41 tbox Exp $ */
|
/* $Id: resolver.c,v 1.350 2007/08/28 01:37:18 marka Exp $ */
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
@@ -56,6 +56,8 @@
|
|||||||
#include <dns/tsig.h>
|
#include <dns/tsig.h>
|
||||||
#include <dns/validator.h>
|
#include <dns/validator.h>
|
||||||
|
|
||||||
|
#define inline /* XXXMPA remove for 9.4.2 */
|
||||||
|
|
||||||
#define DNS_RESOLVER_TRACE
|
#define DNS_RESOLVER_TRACE
|
||||||
#ifdef DNS_RESOLVER_TRACE
|
#ifdef DNS_RESOLVER_TRACE
|
||||||
#define RTRACE(m) isc_log_write(dns_lctx, \
|
#define RTRACE(m) isc_log_write(dns_lctx, \
|
||||||
@@ -3595,7 +3597,12 @@ validated(isc_task_t *task, isc_event_t *event) {
|
|||||||
if (result != ISC_R_SUCCESS &&
|
if (result != ISC_R_SUCCESS &&
|
||||||
result != DNS_R_UNCHANGED)
|
result != DNS_R_UNCHANGED)
|
||||||
goto noanswer_response;
|
goto noanswer_response;
|
||||||
if (vevent->sigrdataset != NULL) {
|
if (ardataset != NULL && ardataset->type == 0) {
|
||||||
|
if (NXDOMAIN(ardataset))
|
||||||
|
eresult = DNS_R_NCACHENXDOMAIN;
|
||||||
|
else
|
||||||
|
eresult = DNS_R_NCACHENXRRSET;
|
||||||
|
} else if (vevent->sigrdataset != NULL) {
|
||||||
result = dns_db_addrdataset(fctx->cache, node, NULL, now,
|
result = dns_db_addrdataset(fctx->cache, node, NULL, now,
|
||||||
vevent->sigrdataset, 0,
|
vevent->sigrdataset, 0,
|
||||||
asigrdataset);
|
asigrdataset);
|
||||||
@@ -3711,7 +3718,8 @@ validated(isc_task_t *task, isc_event_t *event) {
|
|||||||
|
|
||||||
static inline isc_result_t
|
static inline isc_result_t
|
||||||
cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo,
|
cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo,
|
||||||
isc_stdtime_t now) {
|
isc_stdtime_t now)
|
||||||
|
{
|
||||||
dns_rdataset_t *rdataset, *sigrdataset;
|
dns_rdataset_t *rdataset, *sigrdataset;
|
||||||
dns_rdataset_t *addedrdataset, *ardataset, *asigrdataset;
|
dns_rdataset_t *addedrdataset, *ardataset, *asigrdataset;
|
||||||
dns_rdataset_t *valrdataset = NULL, *valsigrdataset = NULL;
|
dns_rdataset_t *valrdataset = NULL, *valsigrdataset = NULL;
|
||||||
@@ -3893,8 +3901,29 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo,
|
|||||||
result = dns_db_addrdataset(fctx->cache, node, NULL,
|
result = dns_db_addrdataset(fctx->cache, node, NULL,
|
||||||
now, rdataset, 0,
|
now, rdataset, 0,
|
||||||
addedrdataset);
|
addedrdataset);
|
||||||
if (result == DNS_R_UNCHANGED)
|
if (result == DNS_R_UNCHANGED) {
|
||||||
result = ISC_R_SUCCESS;
|
result = ISC_R_SUCCESS;
|
||||||
|
if (!need_validation &&
|
||||||
|
ardataset != NULL &&
|
||||||
|
ardataset->type == 0) {
|
||||||
|
/*
|
||||||
|
* The answer in the cache is better
|
||||||
|
* than the answer we found, and is
|
||||||
|
* a negative cache entry, so we
|
||||||
|
* must set eresult appropriately.
|
||||||
|
*/
|
||||||
|
if (NXDOMAIN(ardataset))
|
||||||
|
eresult = DNS_R_NCACHENXDOMAIN;
|
||||||
|
else
|
||||||
|
eresult = DNS_R_NCACHENXRRSET;
|
||||||
|
/*
|
||||||
|
* We have a negative response from
|
||||||
|
* the cache so don't attempt to
|
||||||
|
* add the RRSIG rrset.
|
||||||
|
*/
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
break;
|
break;
|
||||||
if (sigrdataset != NULL) {
|
if (sigrdataset != NULL) {
|
||||||
@@ -4011,12 +4040,10 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo,
|
|||||||
* a negative cache entry, so we
|
* a negative cache entry, so we
|
||||||
* must set eresult appropriately.
|
* must set eresult appropriately.
|
||||||
*/
|
*/
|
||||||
if (NXDOMAIN(ardataset))
|
if (NXDOMAIN(ardataset))
|
||||||
eresult =
|
eresult = DNS_R_NCACHENXDOMAIN;
|
||||||
DNS_R_NCACHENXDOMAIN;
|
else
|
||||||
else
|
eresult = DNS_R_NCACHENXRRSET;
|
||||||
eresult =
|
|
||||||
DNS_R_NCACHENXRRSET;
|
|
||||||
}
|
}
|
||||||
result = ISC_R_SUCCESS;
|
result = ISC_R_SUCCESS;
|
||||||
} else if (result != ISC_R_SUCCESS)
|
} else if (result != ISC_R_SUCCESS)
|
||||||
@@ -4027,11 +4054,19 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo,
|
|||||||
if (valrdataset != NULL)
|
if (valrdataset != NULL)
|
||||||
result = valcreate(fctx, addrinfo, name, fctx->type,
|
result = valcreate(fctx, addrinfo, name, fctx->type,
|
||||||
valrdataset, valsigrdataset, valoptions,
|
valrdataset, valsigrdataset, valoptions,
|
||||||
task);
|
task);
|
||||||
|
|
||||||
if (result == ISC_R_SUCCESS && have_answer) {
|
if (result == ISC_R_SUCCESS && have_answer) {
|
||||||
fctx->attributes |= FCTX_ATTR_HAVEANSWER;
|
fctx->attributes |= FCTX_ATTR_HAVEANSWER;
|
||||||
if (event != NULL) {
|
if (event != NULL) {
|
||||||
|
/*
|
||||||
|
* Negative results must be indicated in event->result.
|
||||||
|
*/
|
||||||
|
if (dns_rdataset_isassociated(event->rdataset) &&
|
||||||
|
event->rdataset->type == dns_rdatatype_none) {
|
||||||
|
INSIST(eresult == DNS_R_NCACHENXDOMAIN ||
|
||||||
|
eresult == DNS_R_NCACHENXRRSET);
|
||||||
|
}
|
||||||
event->result = eresult;
|
event->result = eresult;
|
||||||
dns_db_attach(fctx->cache, adbp);
|
dns_db_attach(fctx->cache, adbp);
|
||||||
dns_db_transfernode(fctx->cache, &node, anodep);
|
dns_db_transfernode(fctx->cache, &node, anodep);
|
||||||
@@ -6283,14 +6318,14 @@ dns_resolver_create(dns_view_t *view,
|
|||||||
task = NULL;
|
task = NULL;
|
||||||
result = isc_task_create(taskmgr, 0, &task);
|
result = isc_task_create(taskmgr, 0, &task);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
goto cleanup_poollock;
|
goto cleanup_poollock;
|
||||||
|
|
||||||
result = isc_timer_create(timermgr, isc_timertype_inactive, NULL, NULL,
|
result = isc_timer_create(timermgr, isc_timertype_inactive, NULL, NULL,
|
||||||
task, spillattimer_countdown, res,
|
task, spillattimer_countdown, res,
|
||||||
&res->spillattimer);
|
&res->spillattimer);
|
||||||
isc_task_detach(&task);
|
isc_task_detach(&task);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
goto cleanup_poollock;
|
goto cleanup_poollock;
|
||||||
|
|
||||||
#if USE_ALGLOCK
|
#if USE_ALGLOCK
|
||||||
result = isc_rwlock_init(&res->alglock, 0, 0);
|
result = isc_rwlock_init(&res->alglock, 0, 0);
|
||||||
|
Reference in New Issue
Block a user