From: bert hubert Date: Mon, 11 Jan 2016 12:59:35 +0000 (+0100) Subject: implement ixfr-falls-back-to-axfr support X-Git-Tag: dnsdist-1.0.0-alpha2~98 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7eafc52fef02ca87b5564de584d672aa51eac2a4;p=pdns implement ixfr-falls-back-to-axfr support --- diff --git a/pdns/filterpo.cc b/pdns/filterpo.cc index c50f7e55c..19b0210b7 100644 --- a/pdns/filterpo.cc +++ b/pdns/filterpo.cc @@ -101,6 +101,16 @@ void DNSFilterEngine::assureZones(int zone) d_zones.resize(zone+1); } +void DNSFilterEngine::clear(int zone) +{ + assureZones(zone); + auto& z = d_zones[zone]; + z.qpolAddr.clear(); + z.postpolAddr.clear(); + z.propolName.clear(); + z.qpolName.clear(); +} + void DNSFilterEngine::addClientTrigger(const Netmask& nm, Policy pol, int zone) { assureZones(zone); diff --git a/pdns/ixfr.cc b/pdns/ixfr.cc index c9bb5e48f..ad4ef2d6d 100644 --- a/pdns/ixfr.cc +++ b/pdns/ixfr.cc @@ -4,7 +4,9 @@ #include "dnsrecords.hh" #include "dnssecinfra.hh" -vector, vector > > getIXFRDeltas(const ComboAddress& master, const DNSName& zone, const DNSRecord& oursr, const TSIGTriplet& tt) + +// if you the remove,add pairs always remove a SOA and add a new one. If you get an empty remove, it means you got an AXFR! +vector, vector > > getIXFRDeltas(const ComboAddress& master, const DNSName& zone, const DNSRecord& oursr, const TSIGTriplet& tt) { vector, vector > > ret; vector packet; @@ -82,10 +84,14 @@ vector, vector > > getIXFRDeltas(const Combo done:; for(unsigned int pos = 1;pos < records.size();) { auto sr = std::dynamic_pointer_cast(records[pos].d_content); + vector remove, add; + if(!sr) { // this is an actual AXFR! + return {{remove, records}}; + } if(sr->d_st.serial == masterSOA->d_st.serial) break; - vector remove, add; + remove.push_back(records[pos]); // this adds the SOA for(pos++; pos < records.size() && records[pos].d_type != QType::SOA; ++pos) { remove.push_back(records[pos]); diff --git a/pdns/ixplore.cc b/pdns/ixplore.cc index ca663495e..be45c1694 100644 --- a/pdns/ixplore.cc +++ b/pdns/ixplore.cc @@ -300,6 +300,7 @@ try cout<<"Got "<(rr.d_content)->d_st.serial; } } + cout<<"This delta ("<getZoneRepresentation()<