/*
PowerDNS Versatile Database Driven Nameserver
- Copyright (C) 2002-2005 PowerDNS.COM BV
+ Copyright (C) 2002-2007 PowerDNS.COM BV
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
#include <errno.h>
#include "communicator.hh"
#include <set>
-
+#include <boost/utility.hpp>
#include "dnsbackend.hh"
#include "ueberbackend.hh"
#include "packethandler.hh"
bool first=true;
try {
Resolver resolver;
- resolver.axfr(remote,domain.c_str());
+ resolver.axfr(remote, domain.c_str());
UeberBackend *B=dynamic_cast<UeberBackend *>(P.getBackend());
Resolver resolver;
resolver.makeUDPSocket();
d_slaveschanged=true;
- uint32_t ourserial=i->serial,theirserial=0;
+ uint32_t ourserial=i->serial, theirserial=0;
+
+ if(d_havepriosuckrequest) {
+ d_havepriosuckrequest=false;
+ break;
+ }
- try {
- if(d_havepriosuckrequest) {
- d_havepriosuckrequest=false;
+ vector<string> masters;
+ stringtok(masters, i->master, ", \t");
+ for(vector<string>::const_iterator iter = masters.begin(); iter != masters.end(); ++iter) {
+ try {
+ resolver.getSoaSerial(*iter, i->zone, &theirserial);
+
+ if(theirserial<i->serial) {
+ L<<Logger::Error<<"Domain "<<i->zone<<" more recent than master, our serial "<<ourserial<<" > their serial "<<theirserial<<endl;
+ i->backend->setFresh(i->id);
+ }
+ else if(theirserial==i->serial) {
+ L<<Logger::Warning<<"Domain "<<i->zone<<" is fresh"<<endl;
+ i->backend->setFresh(i->id);
+ }
+ else {
+ L<<Logger::Warning<<"Domain "<<i->zone<<" is stale, master serial "<<theirserial<<", our serial "<<i->serial<<endl;
+ addSuckRequest(i->zone, *iter);
+ }
break;
}
-
- resolver.getSoaSerial(i->master, i->zone, &theirserial);
-
- if(theirserial<i->serial) {
- L<<Logger::Error<<"Domain "<<i->zone<<" more recent than master, our serial "<<ourserial<<" > their serial "<<theirserial<<endl;
- i->backend->setFresh(i->id);
- }
- else if(theirserial==i->serial) {
- L<<Logger::Warning<<"Domain "<<i->zone<<" is fresh"<<endl;
- i->backend->setFresh(i->id);
+ catch(ResolverException &re) {
+ L<<Logger::Error<<"Error trying to retrieve/refresh '"+i->zone+"': "+re.reason<<endl;
+ if(next(iter) != masters.end())
+ L<<Logger::Error<<"Trying next master for '"+i->zone+"'"<<endl;
}
- else {
- L<<Logger::Warning<<"Domain "<<i->zone<<" is stale, master serial "<<theirserial<<", our serial "<<i->serial<<endl;
- addSuckRequest(i->zone,i->master);
+ catch(AhuException &re) {
+ L<<Logger::Error<<"Error trying to retrieve/refresh '"+i->zone+"': "+re.reason<<endl;
+ if(next(iter) != masters.end())
+ L<<Logger::Error<<"Trying next master for '"+i->zone+"'"<<endl;
}
}
- catch(ResolverException &re) {
- L<<Logger::Error<<"Error trying to retrieve/refresh '"+i->zone+"': "+re.reason<<endl;
- }
}
}
-
-
int CommunicatorClass::doNotifications()
{
ComboAddress from;
create table domains (
id INT auto_increment,
name VARCHAR(255) NOT NULL,
- master VARCHAR(20) DEFAULT NULL,
+ master VARCHAR(128) DEFAULT NULL,
last_check INT DEFAULT NULL,
type VARCHAR(6) NOT NULL,
notified_serial INT DEFAULT NULL,
create table domains (
id INT auto_increment,
name VARCHAR(255) NOT NULL,
- master VARCHAR(20) DEFAULT NULL,
+ master VARCHAR(128) DEFAULT NULL,
last_check INT DEFAULT NULL,
type VARCHAR(6) NOT NULL,
notified_serial INT DEFAULT NULL,
create table domains (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
- master VARCHAR(20) DEFAULT NULL,
+ master VARCHAR(128) DEFAULT NULL,
last_check INT DEFAULT NULL,
type VARCHAR(6) NOT NULL,
notified_serial INT DEFAULT NULL,
create table domains (
id NUMBER,
name VARCHAR(255) NOT NULL,
- master VARCHAR(20) DEFAULT NULL,
+ master VARCHAR(128) DEFAULT NULL,
last_check INT DEFAULT NULL,
type VARCHAR(6) NOT NULL,
notified_serial INT DEFAULT NULL,
create table Domains (
ID number(11) NOT NULL,
NAME VARCHAR(255) NOT NULL,
- MASTER VARCHAR(20) DEFAULT NULL,
+ MASTER VARCHAR(128) DEFAULT NULL,
LAST_CHECK INT DEFAULT NULL,
TYPE VARCHAR(6) NOT NULL,
NOTIFIED_SERIAL INT DEFAULT NULL,
create table domains (
id INTEGER PRIMARY KEY,
name VARCHAR(255) NOT NULL,
- master VARCHAR(20) DEFAULT NULL,
+ master VARCHAR(128) DEFAULT NULL,
last_check INTEGER DEFAULT NULL,
type VARCHAR(6) NOT NULL,
notified_serial INTEGER DEFAULT NULL,