Changeset 1329

Show
Ignore:
Timestamp:
02/07/09 16:09:11 (6 years ago)
Author:
ahu
Message:

deal with remote authoritative servers that send back responses w/o a question section, and pass on any errors to appropriate mthreads

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/pdns_recursor.cc

    r1319 r1329  
    12711271 
    12721272  len=recvfrom(fd, data, sizeof(data), 0, (sockaddr *)&fromaddr, &addrlen); 
    1273   //  HTimerSentinel hts=s_timer.getSentinel(); 
     1273 
    12741274  if(len < (int)sizeof(dnsheader)) { 
    12751275    if(len < 0) 
     
    12961296  memcpy(&dh, data, sizeof(dh)); 
    12971297   
    1298   if(!dh.qdcount) // UPC, Nominum? 
    1299     return; 
    1300    
    13011298  if(dh.qr) { 
    13021299    PacketID pident; 
     
    13041301    pident.id=dh.id; 
    13051302    pident.fd=fd; 
    1306     pident.domain=questionExpand(data, len, pident.type); // don't copy this from above - we need to do the actual read 
     1303    if(!dh.qdcount) { // UPC, Nominum, very old BIND on FormErr, NSD 
     1304      pident.domain.clear(); 
     1305      pident.type = 0; 
     1306    } 
     1307    else { 
     1308      pident.domain=questionExpand(data, len, pident.type); // don't copy this from above - we need to do the actual read 
     1309    } 
    13071310    string packet; 
    13081311    packet.assign(data, len); 
     
    13131316    } 
    13141317 
    1315     //    s_timer.stop(); 
     1318  retryWithName: 
     1319 
    13161320    if(!MT->sendEvent(pident, &packet)) { 
    1317       //      s_timer.start(); 
    13181321//      if(g_logCommonErrors) 
    1319 //        L<<Logger::Warning<<"Discarding unexpected packet from "<<fromaddr.toString()<<": "<<pident.type<<endl; 
     1322//      L<<Logger::Warning<<"Discarding unexpected packet from "<<fromaddr.toString()<<": "<<pident.type<<endl; 
    13201323      g_stats.unexpectedCount++; 
    13211324       
     
    13251328          mthread->key.nearMisses++; 
    13261329        } 
     1330 
     1331        // be a bit paranoid here since we're weakening our matching 
     1332        if(pident.domain.empty() && !mthread->key.domain.empty() && !pident.type && mthread->key.type &&  
     1333           pident.id  == mthread->key.id && mthread->key.remote == pident.remote) { 
     1334            cerr<<"Empty response, rest matches though, sending to a waiter"<<endl; 
     1335          pident.domain = mthread->key.domain; 
     1336          pident.type = mthread->key.type; 
     1337          g_stats.unexpectedCount--; 
     1338          goto retryWithName; 
     1339        } 
    13271340      } 
    13281341    } 
    13291342    else if(fd >= 0) { 
    1330       //      s_timer.start(); 
    13311343      g_udpclientsocks.returnSocket(fd); 
    13321344    }