From: Wouter Wijngaards Date: Thu, 16 Aug 2007 13:35:37 +0000 (+0000) Subject: Fixup bug in response type calculation. X-Git-Tag: release-0.5~114 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=568f0699dca31ed5c69f133f5ec511964688a2b0;p=thirdparty%2Funbound.git Fixup bug in response type calculation. git-svn-id: file:///svn/unbound/trunk@527 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index 4585c67e4..92001aa43 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -5,7 +5,12 @@ - This makes a key-prime succeed in validator, with DS or DNSKEY as trust-anchor. - fixup canonical compare byfield routine, fix bug and also neater. - + - fixed iterator response type classification for queries of type + ANY and NS. + dig ANY gives sometimes NS rrset in AN and NS section, and parser + removes the NS section duplicate. dig NS gives sometimes the NS + in the answer section, as referral. + 15 August 2007: Wouter - crypto calls to verify signatures. - unit test for rrsig verification. diff --git a/iterator/iter_resptype.c b/iterator/iter_resptype.c index fc2d7031b..94e98a5a3 100644 --- a/iterator/iter_resptype.c +++ b/iterator/iter_resptype.c @@ -138,6 +138,18 @@ response_type_from_server(struct dns_msg* msg, struct query_info* request, for(i=0; irep->an_numrrsets; i++) { struct ub_packed_rrset_key* s = msg->rep->rrsets[i]; + /* if the answer section has NS rrset, and qtype ANY + * and the delegation is lower, and no CNAMEs followed, + * this is a referral where the NS went to AN section */ + if((request->qtype == LDNS_RR_TYPE_ANY || + request->qtype == LDNS_RR_TYPE_NS) && + ntohs(s->rk.type) == LDNS_RR_TYPE_NS && + ntohs(s->rk.rrset_class) == request->qclass && + dname_strict_subdomain_c(s->rk.dname, + origzone)) { + return RESPONSE_TYPE_REFERRAL; + } + /* If we have encountered an answer (before or * after a CNAME), then we are done! Note that * if qtype == CNAME then this will be noted as an