]> granicus.if.org Git - pdns/commitdiff
import test for IXFR ending
authorLeon Xu <cassvin91@gmail.com>
Fri, 12 Jan 2018 10:44:21 +0000 (18:44 +0800)
committerPieter Lexis <pieter.lexis@powerdns.com>
Mon, 26 Mar 2018 09:19:25 +0000 (11:19 +0200)
(cherry picked from commit 4f5cde492575eb62d8252df6ec413753f750e977)

pdns/ixfr.cc

index 152b512fd99d887a07f0e603159b9b729c742c6a..7df884454bf3e818681b40347ecfbe9b004e02f9 100644 (file)
@@ -171,7 +171,8 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > getIXFRDeltas(const ComboAd
   int8_t ixfrInProgress = -2;
 
   for(;;) {
-    if (!ixfrInProgress)
+    // IXFR end
+    if (ixfrInProgress >= 0)
       break;
 
     if(s.read((char*)&len, sizeof(len)) != sizeof(len))
@@ -217,10 +218,15 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > getIXFRDeltas(const ComboAd
           return ret;
         }
         masterSOA = sr;
-      } else {
+      } else if (r.first.d_type == QType::SOA) {
+        auto sr = getRR<SOARecordContent>(r.first);
+        if (!sr) {
+          throw std::runtime_error("Error getting the content of SOA record of IXFR answer for zone '"+zone.toLogString()+"' from master '"+master.toStringWithPort()+"'");
+        }
+
         // we hit the last SOA record
-        // ixfr is considered to be done if we hit the last SOA record twice
-        if (r.first.d_type == QType::SOA && masterSOA->d_st.serial == getRR<SOARecordContent>(r.first)->d_st.serial) {
+        // IXFR is considered to be done if we hit the last SOA record twice
+        if (masterSOA->d_st.serial == sr->d_st.serial) {
           ixfrInProgress++;
         }
       }