From: Evan Hunt Date: Tue, 22 Jan 2013 23:49:50 +0000 (-0800) Subject: [master] dump masterfile after successful xfrin X-Git-Tag: v9.10.0a1~554 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=214836c18496e0d2630df1cda5eeee13c38b9068;p=thirdparty%2Fbind9.git [master] dump masterfile after successful xfrin 3470. [bug] Slave zones could fail to dump when successfully refreshing after an initial failure. [RT #31276] --- diff --git a/CHANGES b/CHANGES index 9808534c9f2..85568410ed1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3470. [bug] Slave zones could fail to dump when successfully + refreshing after an initial failure. [RT #31276] + 3469. [bug] Handle DLZ lookup failures more gracefully. Improve backward compatibility between versions of DLZ dlopen API. [RT #32275] diff --git a/bin/tests/system/xfer/clean.sh b/bin/tests/system/xfer/clean.sh index 747490f5818..b9c45a60305 100644 --- a/bin/tests/system/xfer/clean.sh +++ b/bin/tests/system/xfer/clean.sh @@ -24,7 +24,7 @@ rm -f dig.out.ns1 dig.out.ns2 dig.out.ns3 dig.out.ns4 rm -f dig.out.ns5 dig.out.ns6 dig.out.ns7 rm -f axfr.out -rm -f ns1/slave.db +rm -f ns1/slave.db ns2/slave.db rm -f ns2/example.db ns2/tsigzone.db ns2/example.db.jnl rm -f ns3/example.bk ns3/tsigzone.bk ns3/example.bk.jnl rm -f ns3/master.bk ns3/master.bk.jnl diff --git a/bin/tests/system/xfer/ns2/named.conf b/bin/tests/system/xfer/ns2/named.conf index 53a64ab9626..5f010740f84 100644 --- a/bin/tests/system/xfer/ns2/named.conf +++ b/bin/tests/system/xfer/ns2/named.conf @@ -59,3 +59,10 @@ zone "tsigzone" { file "tsigzone.db"; allow-transfer { tzkey; }; }; + +zone "slave" { + type slave; + file "slave.db"; + masters { 10.53.0.1; }; + masterfile-format text; +}; diff --git a/bin/tests/system/xfer/ns2/slave.db.in b/bin/tests/system/xfer/ns2/slave.db.in new file mode 100644 index 00000000000..a67eef0777b --- /dev/null +++ b/bin/tests/system/xfer/ns2/slave.db.in @@ -0,0 +1,8 @@ +$TTL 5 + +@ IN SOA ns1 hostmaster 1 5 5 5 5 +@ NS ns1 +ns1 A 10.53.0.1 +a01 A 1.1.1.1 +a02 A 255.255.255.255 + diff --git a/bin/tests/system/xfer/setup.sh b/bin/tests/system/xfer/setup.sh index b9a97b4446e..4bf4752c261 100644 --- a/bin/tests/system/xfer/setup.sh +++ b/bin/tests/system/xfer/setup.sh @@ -32,3 +32,6 @@ rm -f ns4/*.db ns4/*.jnl cp -f ns4/root.db.in ns4/root.db $PERL -e 'for ($i=0;$i<10000;$i++){ printf("x%u 0 in a 10.53.0.1\n", $i);}' >> ns4/root.db cp -f ns4/named.conf.base ns4/named.conf + +cp ns2/slave.db.in ns2/slave.db +touch -t 200101010000 ns2/slave.db diff --git a/bin/tests/system/xfer/tests.sh b/bin/tests/system/xfer/tests.sh index 621f01f6dd0..414e95499c8 100644 --- a/bin/tests/system/xfer/tests.sh +++ b/bin/tests/system/xfer/tests.sh @@ -116,6 +116,14 @@ $RNDC -c ../common/rndc.conf -s 10.53.0.7 -p 9953 reload 2>&1 | sed 's/^/I:ns7 / sleep 3 +echo "I:testing zone is dumped after successful transfer" +$DIG $DIGOPTS +noall +answer +multi @10.53.0.2 -p 5300 \ + slave. soa > dig.out.ns2 || tmp=1 +grep "1397051952 ; serial" dig.out.ns2 > /dev/null 2>&1 || tmp=1 +grep "1397051952 ; serial" ns2/slave.db > /dev/null 2>&1 || tmp=1 +if test $tmp != 0 ; then echo "I:failed"; fi +status=`expr $status + $tmp` + echo "I:testing ixfr-from-differences yes;" tmp=0 diff --git a/lib/dns/zone.c b/lib/dns/zone.c index a051d17a969..b38836dcb40 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -8959,6 +8959,7 @@ dns_zone_dump(dns_zone_t *zone) { static void zone_needdump(dns_zone_t *zone, unsigned int delay) { + const char me[] = "zone_needdump"; isc_time_t dumptime; isc_time_t now; @@ -8968,6 +8969,7 @@ zone_needdump(dns_zone_t *zone, unsigned int delay) { REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(LOCKED_ZONE(zone)); + ENTER; /* * Do we have a place to dump to and are we loaded? @@ -13326,6 +13328,8 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) { * won't hurt with an AXFR. */ if (zone->masterfile != NULL || zone->journal != NULL) { + unsigned int delay = DNS_DUMP_DELAY; + result = ISC_R_FAILURE; if (zone->journal != NULL) result = isc_file_settime(zone->journal, &now); @@ -13333,14 +13337,16 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) { zone->masterfile != NULL) result = isc_file_settime(zone->masterfile, &now); - /* Someone removed the file from underneath us! */ - if (result == ISC_R_FILENOTFOUND && - zone->masterfile != NULL) { - unsigned int delay = DNS_DUMP_DELAY; - if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NODELAY)) - delay = 0; + + if ((DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NODELAY) != 0) || + result == ISC_R_FILENOTFOUND) + delay = 0; + + if ((result == ISC_R_SUCCESS || + result == ISC_R_FILENOTFOUND) && + zone->masterfile != NULL) zone_needdump(zone, delay); - } else if (result != ISC_R_SUCCESS) + else if (result != ISC_R_SUCCESS) dns_zone_log(zone, ISC_LOG_ERROR, "transfer: could not set file " "modification time of '%s': %s",