From: Pieter Lexis Date: Wed, 13 Mar 2019 09:43:23 +0000 (+0100) Subject: DNAME: find CNAME first X-Git-Tag: rec-4.2.0-beta1~6^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e686a798d15e886416e7875ec02769cf1cf1a7a1;p=thirdparty%2Fpdns.git DNAME: find CNAME first --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index e7002c20f7..fc8dc8d9fe 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -944,7 +944,14 @@ bool SyncRes::doCNAMECacheCheck(const DNSName &qname, const QType &qtype, vector DNSName foundName; QType foundQT = QType(0); // 0 == QTYPE::ENT - if (qname != g_rootdnsname) { + LOG(prefix<get(d_now.tv_sec, qname, QType(QType::CNAME), !wasForwardRecurse && d_requireAuthData, &cset, d_cacheRemote, d_doDNSSEC ? &signatures : nullptr, d_doDNSSEC ? &authorityRecs : nullptr, &d_wasVariable, &state, &wasAuth) > 0) { + foundName = qname; + foundQT = QType(QType::CNAME); + } + + if (foundName.empty() && qname != g_rootdnsname) { // look for a DNAME cache hit auto labels = qname.getRawLabels(); DNSName dnameName(g_rootdnsname); @@ -964,15 +971,6 @@ bool SyncRes::doCNAMECacheCheck(const DNSName &qname, const QType &qtype, vector } while(!labels.empty()); } - if (foundName.empty()) { - LOG(prefix<get(d_now.tv_sec, qname, QType(QType::CNAME), !wasForwardRecurse && d_requireAuthData, &cset, d_cacheRemote, d_doDNSSEC ? &signatures : nullptr, d_doDNSSEC ? &authorityRecs : nullptr, &d_wasVariable, &state, &wasAuth) > 0) { - foundName = qname; - foundQT = QType(QType::CNAME); - } - } - if(!foundName.empty()) { for(auto j=cset.cbegin() ; j != cset.cend() ; ++j) { if (j->d_class != QClass::IN) {