From: Leon Xu Date: Fri, 12 Jan 2018 10:44:21 +0000 (+0800) Subject: import test for IXFR ending X-Git-Tag: dnsdist-1.3.0~120^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4f5cde492575eb62d8252df6ec413753f750e977;p=pdns import test for IXFR ending --- diff --git a/pdns/ixfr.cc b/pdns/ixfr.cc index ab0fc6210..8d02a8bf5 100644 --- a/pdns/ixfr.cc +++ b/pdns/ixfr.cc @@ -171,7 +171,8 @@ vector, vector > > 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, vector > > getIXFRDeltas(const ComboAd return ret; } masterSOA = sr; - } else { + } else if (r.first.d_type == QType::SOA) { + auto sr = getRR(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(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++; } }