Skip to content

Commit

Permalink
prevent duplicate slave notications caused by different ipv6 address …
Browse files Browse the repository at this point in the history
…formatting
  • Loading branch information
mind04 committed Dec 25, 2013
1 parent d951e52 commit eac85b1
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions pdns/mastercommunicator.cc
Expand Up @@ -44,42 +44,48 @@
void CommunicatorClass::queueNotifyDomain(const string &domain, DNSBackend *B)
{
bool hasQueuedItem=false;
set<string> ips;
FindNS fns;

set<string> nsset, ips;
DNSResourceRecord rr;
set<string> nsset;
FindNS fns;

B->lookup(QType(QType::NS),domain);
while(B->get(rr))
while(B->get(rr))
nsset.insert(rr.content);

for(set<string>::const_iterator j=nsset.begin();j!=nsset.end();++j) {
vector<string> nsips=fns.lookup(*j, B);
if(nsips.empty())
L<<Logger::Warning<<"Unable to queue notification of domain '"<<domain<<"': nameservers do not resolve!"<<endl;
for(vector<string>::const_iterator k=nsips.begin();k!=nsips.end();++k)
ips.insert(*k);
else
for(vector<string>::const_iterator k=nsips.begin();k!=nsips.end();++k) {
const ComboAddress caIp(*k, 53);
if(!d_preventSelfNotification || !AddressIsUs(caIp))
ips.insert(caIp.toStringWithPort());
}
}

// make calls to d_nq.add(domain, ip);

for(set<string>::const_iterator j=ips.begin();j!=ips.end();++j) {
L<<Logger::Warning<<"Queued notification of domain '"<<domain<<"' to "<<*j<<endl;
d_nq.add(domain,*j);
hasQueuedItem=true;
}

set<string>alsoNotify;
B->alsoNotifies(domain, &alsoNotify);

for(set<string>::const_iterator j=alsoNotify.begin();j!=alsoNotify.end();++j) {
L<<Logger::Warning<<"Queued also-notification of domain '"<<domain<<"' to "<<*j<<endl;
d_nq.add(domain,*j);
const ComboAddress caIp(*j, 53);
L<<Logger::Warning<<"Queued also-notification of domain '"<<domain<<"' to "<<caIp.toStringWithPort()<<endl;
if (!ips.count(caIp.toStringWithPort()))
d_nq.add(domain, caIp.toStringWithPort());
hasQueuedItem=true;
}

if (!hasQueuedItem)
L<<Logger::Warning<<"Request to queue notification for domain '"<<domain<<"' was processed, but no nameservers or ALSO-NOTIFYs found. Not notifying!"<<endl;

}


bool CommunicatorClass::notifyDomain(const string &domain)
{
DomainInfo di;
Expand Down

0 comments on commit eac85b1

Please sign in to comment.