Changeset 2625

Show
Ignore:
Timestamp:
06/07/12 10:44:31 (12 months ago)
Author:
peter
Message:

make sure every RR actually goes in the right place in a recursor response packet

Location:
trunk/pdns/pdns
Files:
3 modified

Legend:

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

    r2307 r2625  
    560560} 
    561561 
     562static bool comparePlace(DNSResourceRecord a, DNSResourceRecord b) 
     563{ 
     564  return (a.d_place < b.d_place); 
     565} 
     566 
     567// make sure rrs is sorted in d_place order to avoid surprises later 
     568// then shuffle the parts that desire shuffling 
     569void orderAndShuffle(vector<DNSResourceRecord>& rrs) 
     570{ 
     571  std::stable_sort(rrs.begin(), rrs.end(), comparePlace); 
     572  shuffle(rrs); 
     573} 
    562574 
    563575void normalizeTV(struct timeval& tv) 
  • trunk/pdns/pdns/misc.hh

    r2246 r2625  
    289289string makeHexDump(const string& str); 
    290290void shuffle(vector<DNSResourceRecord>& rrs); 
     291void orderAndShuffle(vector<DNSResourceRecord>& rrs); 
    291292 
    292293void normalizeTV(struct timeval& tv); 
  • trunk/pdns/pdns/pdns_recursor.cc

    r2544 r2625  
    555555     
    556556      if(ret.size()) { 
    557         shuffle(ret); 
     557        orderAndShuffle(ret); 
    558558         
    559559        for(vector<DNSResourceRecord>::const_iterator i=ret.begin(); i!=ret.end(); ++i) {