]> granicus.if.org Git - pdns/commitdiff
implement improved control channel error logging
authorBert Hubert <bert.hubert@netherlabs.nl>
Sat, 6 May 2006 12:21:46 +0000 (12:21 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sat, 6 May 2006 12:21:46 +0000 (12:21 +0000)
implement 2 week max ttl

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@820 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/pdns_recursor.cc
pdns/rec_channel.cc
pdns/syncres.cc

index d68b4532519c7160d61e2644737a7be3cfa6e5b5..e715a7ef5ed27d24cf30d976e451987b44957a98 100644 (file)
@@ -987,8 +987,16 @@ void handleRCC(int fd, boost::any& var)
   RecursorControlParser rcp;
   RecursorControlParser::func_t* command;
   string answer=rcp.getAnswer(msg, &command);
-  s_rcc.send(answer, &remote);
-  command();
+  try {
+    s_rcc.send(answer, &remote);
+    command();
+  }
+  catch(exception& e) {
+    L<<Logger::Error<<"Error dealing with control socket request: "<<e.what()<<endl;
+  }
+  catch(AhuException& ae) {
+    L<<Logger::Error<<"Error dealing with control socket request: "<<ae.reason<<endl;
+  }
 }
 
 void handleTCPClientReadable(int fd, boost::any& var)
index 5432f291ed0653db3d58f9fcbb34bb4e9aadcede..b3df25c01c159289ce7ca0316efa4aed513441ed 100644 (file)
@@ -114,7 +114,7 @@ void RecursorControlChannel::send(const std::string& msg, const std::string* rem
     strcpy(remoteaddr.sun_path, remote->c_str());
 
     if(::sendto(d_fd, msg.c_str(), msg.length(), 0, (struct sockaddr*) &remoteaddr, sizeof(remoteaddr) ) < 0)
-      throw AhuException("Unable to send message over control channel: "+string(strerror(errno)));
+      throw AhuException("Unable to send message over control channel '"+*remote+"': "+string(strerror(errno)));
   }
   else if(::send(d_fd, msg.c_str(), msg.length(), 0) < 0)
     throw AhuException("Unable to send message over control channel: "+string(strerror(errno)));
index a207f16303b696136f4875c4904d7e701af1031e..5df6f31d505431ad5792905bb5350df5b2319941 100644 (file)
@@ -103,6 +103,7 @@ int SyncRes::beginResolve(const string &qname, const QType &qtype, uint16_t qcla
   return res;
 }
 
+//! This is the 'out of band resolver', in other words, the authoritative server
 bool SyncRes::doOOBResolve(const string &qname, const QType &qtype, vector<DNSResourceRecord>&ret, int depth, int& res)
 {
   string prefix;
@@ -701,7 +702,7 @@ int SyncRes::doResolveAt(set<string, CIStringCompare> nameservers, string auth,
            rr.d_place=DNSResourceRecord::ANSWER;
            //      if(rr.ttl < 5)
            //  rr.ttl=60;
-
+           rr.ttl=min(86400*14U, rr.ttl); // limit TTL to two weeks
            rr.ttl += d_now.tv_sec;
            if(rr.qtype.getCode() == QType::NS) // people fiddle with the case
              rr.content=toLower(rr.content); // this must stay!
@@ -714,7 +715,7 @@ int SyncRes::doResolveAt(set<string, CIStringCompare> nameservers, string auth,
     
       // supplant
       for(tcache_t::const_iterator i=tcache.begin();i!=tcache.end();++i) {
-       if(i->second.size() > 1) {
+       if(i->second.size() > 1) {  // need to group the ttl to be the minimum of the RRSET (RFC 2181, 5.2)
          uint32_t lowestTTL=numeric_limits<uint32_t>::max();
          for(tcache_t::value_type::second_type::iterator j=i->second.begin(); j != i->second.end(); ++j)
            lowestTTL=min(lowestTTL, j->ttl);
@@ -742,7 +743,7 @@ int SyncRes::doResolveAt(set<string, CIStringCompare> nameservers, string auth,
          ne.d_qname=i->qname;
          ne.d_ttd=d_now.tv_sec + min(i->ttl, s_maxnegttl); // controversial
          ne.d_name=qname;
-         ne.d_qtype=QType(0);
+         ne.d_qtype=QType(0); // this encodes 'whole record'
          
          replacing_insert(s_negcache, ne);
          negindic=true;