From: Mark Andrews Date: Sun, 4 Jul 2010 00:48:57 +0000 (+0000) Subject: 2928. [bug] Be more selective about the non-authoritative X-Git-Tag: v9.8.0-P1~600 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=ff5864ef42c3bc55e9be20434d1f7de2f6794894;p=thirdparty%2Fbind9.git 2928. [bug] Be more selective about the non-authoritative answer we apply change 2748 to. [RT #21594] --- diff --git a/CHANGES b/CHANGES index 4f135cfbf65..f88798aec40 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2928. [bug] Be more selective about the non-authoritative + answer we apply change 2748 to. [RT #21594] + 2927. [placeholder] 2926. [placeholder] diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 1d07975eb84..f14b713abc9 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resolver.c,v 1.423 2010/06/23 23:46:58 tbox Exp $ */ +/* $Id: resolver.c,v 1.424 2010/07/04 00:48:57 marka Exp $ */ /*! \file */ @@ -5628,7 +5628,7 @@ noanswer_response(fetchctx_t *fctx, dns_name_t *oqname, * trying other servers. */ if (dns_name_equal(ns_name, &fctx->domain)) { - log_formerr(fctx, "sideways referral"); + log_formerr(fctx, "non-improving referral"); return (DNS_R_FORMERR); } @@ -6450,6 +6450,29 @@ iscname(fetchctx_t *fctx) { return (result == ISC_R_SUCCESS ? ISC_TRUE : ISC_FALSE); } +static isc_boolean_t +betterreferral(fetchctx_t *fctx) { + isc_result_t result; + dns_name_t *name; + dns_rdataset_t *rdataset; + dns_message_t *message = fctx->rmessage; + + for (result = dns_message_firstname(message, DNS_SECTION_AUTHORITY); + result == ISC_R_SUCCESS; + result = dns_message_nextname(message, DNS_SECTION_AUTHORITY)) { + name = NULL; + dns_message_currentname(message, DNS_SECTION_AUTHORITY, &name); + if (!dns_name_issubdomain(name, &fctx->domain)) + continue; + for (rdataset = ISC_LIST_HEAD(name->list); + rdataset != NULL; + rdataset = ISC_LIST_NEXT(rdataset, link)) + if (rdataset->type == dns_rdatatype_ns) + return (ISC_TRUE); + } + return (ISC_FALSE); +} + static void resquery_response(isc_task_t *task, isc_event_t *event) { isc_result_t result = ISC_R_SUCCESS; @@ -6929,6 +6952,12 @@ resquery_response(isc_task_t *task, isc_event_t *event) { * it as a valid answer. */ result = answer_response(fctx); + } else if (fctx->type != dns_rdatatype_ns && + !betterreferral(fctx)) { + /* + * Lame response !!!. + */ + result = answer_response(fctx); } else { if (fctx->type == dns_rdatatype_ns) { /*