From: Wouter Wijngaards Date: Thu, 9 Aug 2018 13:00:06 +0000 (+0000) Subject: use closer of stub and forward if both configured. X-Git-Tag: release-1.8.0rc1~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1e61604aab7566e596bd3f0e4551770faacf7b5a;p=thirdparty%2Funbound.git use closer of stub and forward if both configured. git-svn-id: file:///svn/unbound/trunk@4849 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/iterator/iterator.c b/iterator/iterator.c index 34c33e055..7a55980a9 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -1135,6 +1135,19 @@ iter_stub_fwd_no_cache(struct module_qstate *qstate, struct iter_qstate *iq) /* Check for stub. */ stub = hints_lookup_stub(qstate->env->hints, iq->qchase.qname, iq->qchase.qclass, iq->dp); + dp = forwards_lookup(qstate->env->fwds, iq->qchase.qname, iq->qchase.qclass); + + /* see if forward or stub is more pertinent */ + if(stub && stub->dp && dp) { + if(dname_strict_subdomain(dp->name, dp->namelabs, + stub->dp->name, stub->dp->namelabs)) { + stub = NULL; /* ignore stub, forward is lower */ + } else { + dp = NULL; /* ignore forward, stub is lower */ + } + } + + /* check stub */ if (stub != NULL && stub->dp != NULL) { if(stub->dp->no_cache) { char qname[255+1]; @@ -1147,7 +1160,6 @@ iter_stub_fwd_no_cache(struct module_qstate *qstate, struct iter_qstate *iq) } /* Check for forward. */ - dp = forwards_lookup(qstate->env->fwds, iq->qchase.qname, iq->qchase.qclass); if (dp) { if(dp->no_cache) { char qname[255+1]; @@ -1158,12 +1170,7 @@ iter_stub_fwd_no_cache(struct module_qstate *qstate, struct iter_qstate *iq) } return (dp->no_cache); } - -#if 0 - verbose(VERB_ALGO, "%s: no stub or fwd for '%s' found no_cache 0", - __func__, iq->qchase.qname); -#endif - return (0); + return 0; } /**