Changeset 1085

Show
Ignore:
Timestamp:
08/16/07 23:42:50 (1 year ago)
Author:
ahu
Message:

implement trusted-notification-proxy, improve logging in nproxy

Files:

Legend:

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

    r944 r1085  
    110110  arg().set("soa-expire-default","Default SOA expire")="604800"; 
    111111 
     112  arg().set("trusted-notification-proxy", "IP address of incoming notification proxy")=""; 
     113 
    112114  arg().set("default-ttl","Seconds a result is valid if not set otherwise")="3600"; 
    113115  arg().set("max-tcp-connections","Maximum number of TCP connections")="10"; 
  • trunk/pdns/pdns/communicator.cc

    r1048 r1085  
    106106  } 
    107107  catch(ResolverException &re) { 
    108     L<<Logger::Error<<"Unable to AXFR zone '"+domain+"': "<<re.reason<<endl; 
     108    L<<Logger::Error<<"Unable to AXFR zone '"+domain+"' from remote '"<<remote<<"': "<<re.reason<<endl; 
    109109    if(di.backend && !first) { 
    110110      L<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl; 
  • trunk/pdns/pdns/nproxy.cc

    r1083 r1085  
    227227    throw runtime_error("Failed to connect PowerDNS socket to address "+pdns.toStringWithPort()+": "+stringerror()); 
    228228 
    229   syslogFmt(boost::format("Sending notifications to internal address %s") % pdns.toStringWithPort()); 
     229  syslogFmt(boost::format("Sending notifications from %s to internal address %s") % originAddress.toString() % pdns.toStringWithPort()); 
    230230 
    231231  g_fdm.addReadFD(g_pdnssocket, handleInsideUDPPacket); 
  • trunk/pdns/pdns/packethandler.cc

    r1081 r1085  
    489489  DNSBackend *db=0; 
    490490  DomainInfo di; 
     491  di.serial = 0; 
    491492  if(!B.getDomainInfo(p->qdomain, di) || !(db=di.backend)) { 
    492493    L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" for which we are not authoritative"<<endl; 
     
    494495  } 
    495496     
    496   if(!db->isMaster(p->qdomain, p->getRemote())) { 
     497  string authServer(p->getRemote()); 
     498  if(p->getRemote() == arg()["trusted-notification-proxy"]) { 
     499    L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from trusted-notification-proxy "<< p->getRemote()<<endl; 
     500    if(di.masters.empty()) { 
     501      L<<Logger::Error<<"However, "<<p->qdomain<<" does not have any masters defined"<<endl; 
     502      return RCode::Refused; 
     503    } 
     504 
     505    authServer = *di.masters.begin(); 
     506 
     507  } 
     508  else if(!db->isMaster(p->qdomain, p->getRemote())) { 
    497509    L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<<p->getRemote()<<" which is not a master"<<endl; 
    498510    return RCode::Refused; 
     
    506518  Resolver resolver; 
    507519  try { 
    508     resolver.getSoaSerial(p->getRemote(),p->qdomain, &theirserial); 
     520    resolver.getSoaSerial(authServer, p->qdomain, &theirserial); 
    509521  } 
    510522  catch(ResolverException& re) { 
     
    512524    return RCode::ServFail; 
    513525  } 
    514          
    515526 
    516527  if(theirserial<=di.serial) { 
    517     L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from master "<<p->getRemote()<<", we are up to date: "<< 
     528    L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<< authServer <<", we are up to date: "<< 
    518529      theirserial<<"<="<<di.serial<<endl; 
    519530    return RCode::NoError; 
     
    523534      theirserial<<" > "<<di.serial<<endl; 
    524535 
    525     Communicator.addSuckRequest(p->qdomain, p->getRemote(),true); // priority 
     536    Communicator.addSuckRequest(p->qdomain, authServer, true); // priority 
    526537  } 
    527538  return -1;  
     
    911922  } 
    912923  catch(exception &e) { 
    913     L<<Logger::Error<<"Exception building anser packet ("<<e.what()<<") sending out servfail"<<endl; 
     924    L<<Logger::Error<<"Exception building answer packet ("<<e.what()<<") sending out servfail"<<endl; 
    914925    delete r; 
    915926    r=p->replyPacket();  // generate an empty reply packet