From: Mark Andrews Date: Tue, 24 Sep 2002 01:04:03 +0000 (+0000) Subject: 1383. [func] Track the serial number in a IXFR response and log if X-Git-Tag: v9.2.3rc1~104^2~312 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=ca70688bf60b4f50c4e3ec7d40567341c9962faf;p=thirdparty%2Fbind9.git 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] --- diff --git a/CHANGES b/CHANGES index 51a159b4b43..2b6a03f1278 100644 --- 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 diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c index 6e465db567d..8f2b9a43698 100644 --- a/lib/dns/xfrin.c +++ b/lib/dns/xfrin.c @@ -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 @@ -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);