// we are up to date
return ret;
}
+ if(soaRecord->d_st.serial < getRR<SOARecordContent>(oursr)->d_st.serial) {
+ // we have a higher SOA than the auth? Should not happen, but what can we do?
+ throw std::runtime_error("Our serial is higher than remote one for zone '" + zone.toLogString() + "' from primary '" + primary.toStringWithPort() + "': ours " + std::to_string(getRR<SOARecordContent>(oursr)->d_st.serial) + " theirs " + std::to_string(soaRecord->d_st.serial));
+ }
primarySOA = std::move(soaRecord);
++primarySOACount;
} else if (r.d_type == QType::SOA) {
static bool dumpZoneToDisk(Logr::log_t logger, const std::shared_ptr<DNSFilterEngine::Zone>& newZone, const std::string& dumpZoneFileName)
{
logger->info(Logr::Debug, "Dumping zone to disk", "destination_file", Logging::Loggable(dumpZoneFileName));
+ DNSRecord soa = newZone->getSOA();
+ uint32_t serial = 0;
+ DNSName zone;
+ if (auto soaContent = getRR<SOARecordContent>(soa)) {
+ serial = soaContent->d_st.serial;
+ }
+ if (newZone->getSerial() != serial) {
+ logger->info(Logr::Error, "Inconsistency of internal serial and SOA serial", "serial", Logging::Loggable(newZone->getSerial()), "soaserial", Logging::Loggable(serial));
+ }
+
+ if (newZone->getDomain() != soa.d_name) {
+ logger->info(Logr::Error, "Inconsistency of internal name and SOA name", "zone", Logging::Loggable(newZone->getDomain()), "soaname", Logging::Loggable(soa.d_name));
+ }
std::string temp = dumpZoneFileName + "XXXXXX";
int fileDesc = mkstemp(&temp.at(0));
if (fileDesc < 0) {
continue;
}
if (resourceRecord.d_type == QType::SOA) {
- auto tempSR = getRR<SOARecordContent>(resourceRecord);
- if (tempSR) {
+ if (auto tempSR = getRR<SOARecordContent>(resourceRecord)) {
+ dnsRecord = resourceRecord;
+ // IXFR leaves us a relative name, fix that
+ dnsRecord.d_name = newZone->getDomain();
currentSR = std::move(tempSR);
}
}
/* only update sr now that all changes have been converted */
if (currentSR) {
+ newZone->setSOA(dnsRecord);
params.zoneXFRParams.soaRecordContent = std::move(currentSR);
}
SLOG(g_log << Logger::Info << "Had " << totremove << " RPZ removal" << addS(totremove) << ", " << totadd << " addition" << addS(totadd) << " for " << zoneName << " New serial: " << params.soaRecordContent->d_st.serial << endl,