From: Bert Hubert Date: Tue, 10 Jun 2008 19:49:33 +0000 (+0000) Subject: improve selection criterion for accepting returned data, ANY and ADDR record types... X-Git-Tag: rec-3.1.7.1~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf7e4a70987a63f9ec209ad3b73ec76ab1618ba3;p=thirdparty%2Fpdns.git improve selection criterion for accepting returned data, ANY and ADDR record types, fixing g++ warning in the process. Plus log use of TCP git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1189 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 3d3d24f4be..71415c78b5 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -581,7 +581,12 @@ struct TCacheComp } }; - +static bool magicAddrMatch(const QType& query, const QType& answer) +{ + if(query.getCode() != QType::ADDR) + return false; + return answer.getCode() == QType::A || answer.getCode() == QType::AAAA; +} /** returns -1 in case of no results, rcode otherwise */ int SyncRes::doResolveAt(set nameservers, string auth, bool flawedNSSet, const string &qname, const QType &qtype, @@ -673,6 +678,7 @@ int SyncRes::doResolveAt(set nameservers, string auth, s_outqueries++; d_outqueries++; TryTCP: if(doTCP) { + LOG<toStringWithPort() < nameservers, string auth, } // for ANY answers we *must* have an authoritive answer else if(i->d_place==DNSResourceRecord::ANSWER && !Utility::strcasecmp(i->qname.c_str(),qname.c_str()) && - (i->qtype==qtype || - ( - lwr.d_aabit && - ( qtype == QType(QType::ADDR) && (i->qtype.getCode()==QType::A || i->qtype.getCode()==QType::AAAA) ) || qtype==QType(QType::ANY) - ) - ) - ) { - + ( + i->qtype==qtype || (lwr.d_aabit && (qtype==QType(QType::ANY) || magicAddrMatch(qtype, i->qtype) ) ) + ) + ) + { + LOG<content<<"|"<qtype.getName()<<"'"<