Changeset 1189

Show
Ignore:
Timestamp:
06/10/08 21:49:33 (4 months ago)
Author:
ahu
Message:

improve selection criterion for accepting returned data, ANY and ADDR record types, fixing g++ warning in the process. Plus log use of TCP

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pdns/pdns/syncres.cc

    r1168 r1189  
    582582}; 
    583583 
    584  
     584static bool magicAddrMatch(const QType& query, const QType& answer) 
     585
     586  if(query.getCode() != QType::ADDR) 
     587    return false; 
     588  return answer.getCode() == QType::A || answer.getCode() == QType::AAAA; 
     589
    585590 
    586591/** returns -1 in case of no results, rcode otherwise */ 
     
    674679          TryTCP: 
    675680            if(doTCP) { 
     681              LOG<<prefix<<qname<<": using TCP with "<< remoteIP->toStringWithPort() <<endl; 
    676682              s_tcpoutqueries++; d_tcpoutqueries++; 
    677683            } 
     
    820826        // for ANY answers we *must* have an authoritive answer 
    821827        else if(i->d_place==DNSResourceRecord::ANSWER && !Utility::strcasecmp(i->qname.c_str(),qname.c_str()) &&  
    822                 (i->qtype==qtype ||  
    823                  ( 
    824                   lwr.d_aabit &&  
    825                      ( qtype == QType(QType::ADDR) && (i->qtype.getCode()==QType::A || i->qtype.getCode()==QType::AAAA) ) || qtype==QType(QType::ANY)  
    826                   )    
    827                  )  
    828                 )   { 
    829          
     828                ( 
     829                 i->qtype==qtype || (lwr.d_aabit && (qtype==QType(QType::ANY) || magicAddrMatch(qtype, i->qtype) ) ) 
     830                )  
     831               )    
     832          { 
     833           
    830834          LOG<<prefix<<qname<<": answer is in: resolved to '"<< i->content<<"|"<<i->qtype.getName()<<"'"<<endl; 
    831835