]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1383. [func] Track the serial number in a IXFR response and log if
authorMark Andrews <marka@isc.org>
Tue, 24 Sep 2002 01:04:03 +0000 (01:04 +0000)
committerMark Andrews <marka@isc.org>
Tue, 24 Sep 2002 01:04:03 +0000 (01:04 +0000)
                        a mismatch occurs.  This is a more specific error than
                        "not exact". [RT #3445]

CHANGES
lib/dns/xfrin.c

diff --git a/CHANGES b/CHANGES
index 51a159b4b43cdd20c1ed839f8a2c40e375fe2308..2b6a03f127836546b29d7ffd18bff61a2c80e3cb 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+1383.  [func]          Track the serial number in a IXFR response and log if
+                       a mismatch occurs.  This is a more specific error than
+                       "not exact". [RT #3445]
+
 1382.  [bug]           make install failed with --enable-libbind. [RT #3656]
 
 1381.  [bug]           named failed to correctly process answers that
index 6e465db567d33fdb2a34d950617ef969b034cc45..8f2b9a43698677da4fe5b2c859f1370b0f0b68c0 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: xfrin.c,v 1.129 2001/11/30 01:59:24 gson Exp $ */
+/* $Id: xfrin.c,v 1.130 2002/09/24 01:04:03 marka Exp $ */
 
 #include <config.h>
 
@@ -158,7 +158,7 @@ struct dns_xfrin_ctx {
 
        struct {
                isc_uint32_t    request_serial;
-               isc_uint32_t    end_serial;
+               isc_uint32_t    current_serial;
                dns_journal_t   *journal;
 
        } ixfr;
@@ -480,7 +480,7 @@ xfr_rr(dns_xfrin_ctx_t *xfr, dns_name_t *name, isc_uint32_t ttl,
                if (rdata->type == dns_rdatatype_soa) {
                        isc_uint32_t soa_serial = dns_soa_getserial(rdata);
                        xfr->state = XFRST_IXFR_ADDSOA;
-                       xfr->ixfr.end_serial = soa_serial;
+                       xfr->ixfr.current_serial = soa_serial;
                        goto redo;
                }
                CHECK(ixfr_putdata(xfr, DNS_DIFFOP_DEL, name, ttl, rdata));
@@ -499,6 +499,12 @@ xfr_rr(dns_xfrin_ctx_t *xfr, dns_name_t *name, isc_uint32_t ttl,
                        if (soa_serial == xfr->end_serial) {
                                xfr->state = XFRST_END;
                                break;
+                       } else if (soa_serial != xfr->ixfr.current_serial) {
+                               xfrin_log(xfr, ISC_LOG_ERROR,
+                                         "IXFR out of sync: "
+                                         "expected serial %u, got %u",
+                                         xfr->ixfr.current_serial, soa_serial);
+                               FAIL(DNS_R_FORMERR);
                        } else {
                                xfr->state = XFRST_IXFR_DELSOA;
                                goto redo;
@@ -727,7 +733,7 @@ xfrin_create(isc_mem_t *mctx,
        xfr->is_ixfr = ISC_FALSE;
 
        /* ixfr.request_serial */
-       /* ixfr.end_serial */
+       /* ixfr.current_serial */
        xfr->ixfr.journal = NULL;
 
        xfr->axfr.add_func = NULL;
@@ -939,6 +945,7 @@ xfrin_send_request(dns_xfrin_ctx_t *xfr) {
                CHECK(dns_db_createsoatuple(xfr->db, ver, xfr->mctx,
                                            DNS_DIFFOP_EXISTS, &soatuple));
                xfr->ixfr.request_serial = dns_soa_getserial(&soatuple->rdata);
+               xfr->ixfr.current_serial = xfr->ixfr.request_serial;
                xfrin_log(xfr, ISC_LOG_DEBUG(3),
                          "requesting IXFR for serial %u",
                          xfr->ixfr.request_serial);