time_t now = time(0);
for(auto& val : sdomains) {
DomainInfo& di(val.di);
- // might've come from the packethandler
+ // If our di comes from packethandler (caused by incoming NOTIFY), di.backend will not be filled out,
+ // and di.serial will not either.
+ // Conversely, if our di came from getUnfreshSlaveInfos, di.backend and di.serial are valid.
if(!di.backend) {
// Do not overwrite received DI just to make sure it exists in backend:
// di.masters should contain the picked master (as first entry)!
// Backend for di still doesn't exist and this might cause us to
// SEGFAULT on the setFresh command later on
di.backend = tempdi.backend;
+ di.serial = tempdi.serial;
}
if(!ssr.d_freshness.count(di.id)) { // If we don't have an answer for the domain
d_failedSlaveRefresh.erase(di.zone);
}
- bool hasSOA = false;
- SOAData sd;
- sd.serial = 0;
- try {
- // Use UeberBackend cache for SOA. Cache gets cleared after AXFR/IXFR.
- B->lookup(QType(QType::SOA), di.zone, di.id, nullptr);
- DNSZoneRecord zr;
- hasSOA = B->get(zr);
- if (hasSOA) {
- fillSOAData(zr, sd);
- while(B->get(zr));
- }
- }
- catch(...) {}
-
uint32_t theirserial = ssr.d_freshness[di.id].theirSerial;
- uint32_t ourserial = sd.serial;
+ uint32_t ourserial = di.serial;
const ComboAddress remote = *di.masters.begin();
if(rfc1982LessThan(theirserial, ourserial) && ourserial != 0 && !::arg().mustDo("axfr-lower-serial")) {
g_log<<Logger::Error<<"Domain '" << di.zone << "' more recent than master " << remote.toStringWithPortExcept(53) << ", our serial "<< ourserial<< " > their serial "<< theirserial << endl;
di.backend->setFresh(di.id);
}
- else if(hasSOA && theirserial == ourserial) {
+ else if(ourserial != 0 && theirserial == ourserial) {
uint32_t maxExpire=0, maxInception=0;
if(dk.isPresigned(di.zone)) {
B->lookup(QType(QType::RRSIG), di.zone, di.id); // can't use DK before we are done with this lookup!
}
}
else {
- if(hasSOA) {
+ if (ourserial == 0) {
+ g_log<<Logger::Warning<<"Domain '"<< di.zone << "' has serial zero, forcing transfer, master " << remote.toStringWithPortExcept(53) << " serial " << theirserial << endl;
+ } else {
g_log<<Logger::Warning<<"Domain '"<< di.zone << "' is stale, master " << remote.toStringWithPortExcept(53) << " serial " << theirserial << ", our serial " << ourserial << endl;
}
- else {
- g_log<<Logger::Warning<<"Domain '"<< di.zone << "' is empty, master " << remote.toStringWithPortExcept(53) << " serial " << theirserial << endl;
- }
addSuckRequest(di.zone, remote);
}
}