Changeset 1438

Show
Ignore:
Timestamp:
10/15/09 22:56:09 (11 months ago)
Author:
ahu
Message:

implement max-cache-ttl, patch by Winfried Angele, for BIND compatability. Thanks!

Location:
trunk/pdns/pdns
Files:
3 modified

Legend:

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

    r1433 r1438  
    18101810 
    18111811  SyncRes::s_maxnegttl=::arg().asNum("max-negative-ttl"); 
     1812  SyncRes::s_maxcachettl=::arg().asNum("max-cache-ttl"); 
    18121813  SyncRes::s_serverID=::arg()["server-id"]; 
    18131814  if(SyncRes::s_serverID.empty()) { 
     
    20832084    ::arg().set("max-cache-entries", "If set, maximum number of entries in the main cache")="1000000"; 
    20842085    ::arg().set("max-negative-ttl", "maximum number of seconds to keep a negative cached entry in memory")="3600"; 
     2086    ::arg().set("max-cache-ttl", "maximum number of seconds to keep a cached entry in memory")="86400"; 
    20852087    ::arg().set("server-id", "Returned when queried for 'server.id' TXT or NSID, defaults to hostname")=""; 
    20862088    ::arg().set("remotes-ringbuffer-entries", "maximum number of packets to store statistics for")="0"; 
  • trunk/pdns/pdns/syncres.cc

    r1436 r1438  
    5151 
    5252unsigned int SyncRes::s_maxnegttl; 
     53unsigned int SyncRes::s_maxcachettl; 
    5354unsigned int SyncRes::s_queries; 
    5455unsigned int SyncRes::s_outgoingtimeouts; 
     
    946947 
    947948      // reap all answers from this packet that are acceptable 
    948       for(LWResult::res_t::const_iterator i=lwr.d_result.begin();i != lwr.d_result.end();++i) { 
     949      for(LWResult::res_t::iterator i=lwr.d_result.begin();i != lwr.d_result.end();++i) { 
    949950        if(i->qtype.getCode() == QType::OPT) { 
    950951          LOG<<prefix<<qname<<": skipping OPT answer '"<<i->qname<<"' from '"<<auth<<"' nameservers" <<endl; 
     
    965966          else { 
    966967            LOG<<"YES!"<<endl; 
     968 
     969            i->ttl=min(s_maxcachettl, i->ttl); 
    967970             
    968971            DNSResourceRecord rr=*i; 
    969972            rr.d_place=DNSResourceRecord::ANSWER; 
    970973 
    971             rr.ttl=min(86400*14U, rr.ttl); // limit TTL to two weeks 
    972974            rr.ttl += d_now.tv_sec; 
    973975 
  • trunk/pdns/pdns/syncres.hh

    r1430 r1438  
    386386  struct timeval d_now; 
    387387  static unsigned int s_maxnegttl; 
     388  static unsigned int s_maxcachettl; 
    388389  static string s_serverID; 
    389390