From: Wouter Wijngaards Date: Thu, 7 Jun 2007 14:20:23 +0000 (+0000) Subject: RA bit on in cached responses. X-Git-Tag: release-0.4~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=162b28bea1be8d00ac883fa1f68dd6f036a2f67c;p=thirdparty%2Funbound.git RA bit on in cached responses. caches responses with CNAMEs corrected. git-svn-id: file:///svn/unbound/trunk@375 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index fadc70289..3238d43fe 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -11,6 +11,8 @@ - subreq insertion code fixup for slumber list. - VERB_DETAIL, verbosity: 2 level gives short but readable output. VERB_ALGO, verbosity: 3 gives extensive output. + - fixup RA bit in cached replies. + - fixup CNAME responses from the cache no longer partial response. 5 June 2007: Wouter - iterator state finished. diff --git a/iterator/iter_utils.c b/iterator/iter_utils.c index 64ae6f918..c9aeb125c 100644 --- a/iterator/iter_utils.c +++ b/iterator/iter_utils.c @@ -268,6 +268,11 @@ iter_dns_store(struct module_env* env, struct dns_msg* msg, int is_referral) qinf.qname = memdup(msg->qinfo.qname, msg->qinfo.qname_len); if(!qinf.qname) return 0; + /* fixup flags to be sensible for a reply based on the cache */ + /* this module means that RA is available. It is an answer QR. + * Not AA from cache. Not CD in cache (depends on client bit). */ + rep->flags |= (BIT_RA | BIT_QR); + rep->flags &= ~(BIT_AA | BIT_CD); h = query_info_hash(&qinf); dns_cache_store_msg(env, &qinf, h, rep); free(qinf.qname); diff --git a/iterator/iterator.c b/iterator/iterator.c index 6ab1de975..6dcdc0487 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -1178,7 +1178,9 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, &sname, &snamelen)) return error_response(qstate, id, LDNS_RCODE_SERVFAIL); /* cache the CNAME response under the current query */ - if(!iter_dns_store(qstate->env, iq->response, 0)) + /* NOTE : set referral=1, so that rrsets get stored but not + * the partial query answer (CNAME only). */ + if(!iter_dns_store(qstate->env, iq->response, 1)) return error_response(qstate, id, LDNS_RCODE_SERVFAIL); /* set the current request's qname to the new value. */ qstate->qinfo.qname = sname;