"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "rpzloader.cc" between
pdns-recursor-4.5.5.tar.bz2 and pdns-recursor-4.5.6.tar.bz2

About: PowerDNS - a separate release of the PowerDNS Recursor (without the authoritative nameserver).

rpzloader.cc  (pdns-recursor-4.5.5.tar.bz2):rpzloader.cc  (pdns-recursor-4.5.6.tar.bz2)
skipping to change at line 369 skipping to change at line 369
/* we can _never_ modify this zone directly, we need to do a full copy then re place the existing zone */ /* we can _never_ modify this zone directly, we need to do a full copy then re place the existing zone */
std::shared_ptr<DNSFilterEngine::Zone> oldZone = luaconfsLocal->dfe.getZone(zo neIdx); std::shared_ptr<DNSFilterEngine::Zone> oldZone = luaconfsLocal->dfe.getZone(zo neIdx);
if (!oldZone) { if (!oldZone) {
g_log<<Logger::Error<<"Unable to retrieve RPZ zone with index "<<zoneIdx<<" from the configuration, exiting"<<endl; g_log<<Logger::Error<<"Unable to retrieve RPZ zone with index "<<zoneIdx<<" from the configuration, exiting"<<endl;
return; return;
} }
// If oldZone failed to load its getRefresh() returns 0, protect against that // If oldZone failed to load its getRefresh() returns 0, protect against that
uint32_t refresh = std::max(refreshFromConf ? refreshFromConf : oldZone->getRe fresh(), 10U); uint32_t refresh = std::max(refreshFromConf ? refreshFromConf : oldZone->getRe fresh(), 10U);
DNSName zoneName = oldZone->getDomain(); DNSName zoneName = oldZone->getDomain();
std::string polName = oldZone->getName().empty() ? oldZone->getName() : zoneNa me.toString(); std::string polName = !oldZone->getName().empty() ? oldZone->getName() : zoneN ame.toStringNoDot();
while (!sr) { while (!sr) {
/* if we received an empty sr, the zone was not really preloaded */ /* if we received an empty sr, the zone was not really preloaded */
/* full copy, as promised */ /* full copy, as promised */
std::shared_ptr<DNSFilterEngine::Zone> newZone = std::make_shared<DNSFilterE ngine::Zone>(*oldZone); std::shared_ptr<DNSFilterEngine::Zone> newZone = std::make_shared<DNSFilterE ngine::Zone>(*oldZone);
for (const auto& master : masters) { for (const auto& master : masters) {
try { try {
sr = loadRPZFromServer(master, zoneName, newZone, defpol, defpolOverride Local, maxTTL, tt, maxReceivedBytes, localAddress, axfrTimeout); sr = loadRPZFromServer(master, zoneName, newZone, defpol, defpolOverride Local, maxTTL, tt, maxReceivedBytes, localAddress, axfrTimeout);
newZone->setSerial(sr->d_st.serial); newZone->setSerial(sr->d_st.serial);
skipping to change at line 459 skipping to change at line 459
} }
} }
if(deltas.empty()) { if(deltas.empty()) {
continue; continue;
} }
try { try {
g_log<<Logger::Info<<"Processing "<<deltas.size()<<" delta"<<addS(deltas)< <" for RPZ "<<zoneName<<endl; g_log<<Logger::Info<<"Processing "<<deltas.size()<<" delta"<<addS(deltas)< <" for RPZ "<<zoneName<<endl;
if (luaconfsLocal->generation != configGeneration) {
g_log<<Logger::Info<<"A more recent configuration has been found, stoppi
ng the existing RPZ update thread for "<<zoneName<<endl;
return;
}
oldZone = luaconfsLocal->dfe.getZone(zoneIdx); oldZone = luaconfsLocal->dfe.getZone(zoneIdx);
if (!oldZone || oldZone->getDomain() != zoneName) {
g_log<<Logger::Info<<"This policy is no more, stopping the existing RPZ
update thread for "<<zoneName << endl;
return;
}
/* we need to make a _full copy_ of the zone we are going to work on */ /* we need to make a _full copy_ of the zone we are going to work on */
std::shared_ptr<DNSFilterEngine::Zone> newZone = std::make_shared<DNSFilte rEngine::Zone>(*oldZone); std::shared_ptr<DNSFilterEngine::Zone> newZone = std::make_shared<DNSFilte rEngine::Zone>(*oldZone);
/* initialize the current serial to the last one */ /* initialize the current serial to the last one */
std::shared_ptr<SOARecordContent> currentSR = sr; std::shared_ptr<SOARecordContent> currentSR = sr;
int totremove=0, totadd=0; int totremove=0, totadd=0;
bool fullUpdate = false; bool fullUpdate = false;
for(const auto& delta : deltas) { for(const auto& delta : deltas) {
const auto& remove = delta.first; const auto& remove = delta.first;
const auto& add = delta.second; const auto& add = delta.second;
skipping to change at line 530 skipping to change at line 538
} }
g_log<<Logger::Info<<"Had "<<totremove<<" RPZ removal"<<addS(totremove)<<" , "<<totadd<<" addition"<<addS(totadd)<<" for "<<zoneName<<" New serial: "<<sr-> d_st.serial<<endl; g_log<<Logger::Info<<"Had "<<totremove<<" RPZ removal"<<addS(totremove)<<" , "<<totadd<<" addition"<<addS(totadd)<<" for "<<zoneName<<" New serial: "<<sr-> d_st.serial<<endl;
newZone->setSerial(sr->d_st.serial); newZone->setSerial(sr->d_st.serial);
newZone->setRefresh(sr->d_st.refresh); newZone->setRefresh(sr->d_st.refresh);
setRPZZoneNewState(polName, sr->d_st.serial, newZone->size(), fullUpdate); setRPZZoneNewState(polName, sr->d_st.serial, newZone->size(), fullUpdate);
/* we need to replace the existing zone with the new one, /* we need to replace the existing zone with the new one,
but we don't want to touch anything else, especially other zones, but we don't want to touch anything else, especially other zones,
since they might have been updated by another RPZ IXFR tracker thread. since they might have been updated by another RPZ IXFR tracker thread.
*/ */
if (luaconfsLocal->generation != configGeneration) {
g_log<<Logger::Info<<"A more recent configuration has been found, stoppi
ng the existing RPZ update thread for "<<zoneName<<endl;
return;
}
g_luaconfs.modify([zoneIdx, &newZone](LuaConfigItems& lci) { g_luaconfs.modify([zoneIdx, &newZone](LuaConfigItems& lci) {
lci.dfe.setZone(zoneIdx, newZone); lci.dfe.setZone(zoneIdx, newZone);
}); });
if (!dumpZoneFileName.empty()) { if (!dumpZoneFileName.empty()) {
dumpZoneToDisk(zoneName, newZone, dumpZoneFileName); dumpZoneToDisk(zoneName, newZone, dumpZoneFileName);
} }
refresh = std::max(refreshFromConf ? refreshFromConf : newZone->getRefresh (), 1U); refresh = std::max(refreshFromConf ? refreshFromConf : newZone->getRefresh (), 1U);
} }
catch (const std::exception& e) { catch (const std::exception& e) {
 End of changes. 4 change blocks. 
1 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)