]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove the ixfr-from-differences side-effect which causes an AXFR and extend
authorScott Mann <smann@isc.org>
Tue, 6 Sep 2011 22:29:33 +0000 (22:29 +0000)
committerScott Mann <smann@isc.org>
Tue, 6 Sep 2011 22:29:33 +0000 (22:29 +0000)
request-ixfr to the zone level.

13 files changed:
CHANGES
bin/named/named.conf.docbook
bin/named/server.c
bin/named/zoneconf.c
bin/tests/system/ixfr/clean.sh
bin/tests/system/ixfr/setup.sh
bin/tests/system/ixfr/tests.sh
doc/arm/Bv9ARM-book.xml
lib/dns/include/dns/view.h
lib/dns/include/dns/zone.h
lib/dns/view.c
lib/dns/zone.c
lib/isccfg/namedconf.c

diff --git a/CHANGES b/CHANGES
index 997e7ee24e8f3afafa4870b79d61d966170ff5c1..382f9f553baca66eddf9b2c9a4b742900099e850 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3153.  [func]          Extend request-ixfr to zone level and remove the
+                       side effect of forcing an AXFR.
+
 3152.  [cleanup]       Some versions of gcc and clang failed due to
                        incorrect use of __builtin_expect. [RT #25183]
 
index 5fd45f0947dbab37f048ba32e8c2b3a5670f0d61..104a46c26e5e46939b56e100fd18ca443d04ef70 100644 (file)
@@ -17,7 +17,7 @@
  - PERFORMANCE OF THIS SOFTWARE.
 -->
 
-<!-- $Id: named.conf.docbook,v 1.52 2011/05/06 21:23:50 each Exp $ -->
+<!-- $Id: named.conf.docbook,v 1.53 2011/09/06 22:29:32 smann Exp $ -->
 <refentry>
   <refentryinfo>
     <date>Aug 13, 2004</date>
@@ -630,6 +630,7 @@ zone <replaceable>string</replaceable> <replaceable>optional_class</replaceable>
        max-refresh-time <replaceable>integer</replaceable>;
        min-refresh-time <replaceable>integer</replaceable>;
        multi-master <replaceable>boolean</replaceable>;
+       request-ixfr <replaceable>boolean</replaceable>;
        sig-validity-interval <replaceable>integer</replaceable>;
 
        transfer-source ( <replaceable>ipv4_address</replaceable> | * )
index d724fd13e49e645abc285ca79914881ec574fe0a..7091c2acd7d6a1ec80921fdae085737dd9f82872 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: server.c,v 1.618 2011/09/02 21:15:30 each Exp $ */
+/* $Id: server.c,v 1.619 2011/09/06 22:29:32 smann Exp $ */
 
 /*! \file */
 
@@ -2550,11 +2550,6 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
                                         "allow-update-forwarding", NULL, actx,
                                         ns_g_mctx, &view->upfwdacl));
 
-       obj = NULL;
-       result = ns_config_get(maps, "request-ixfr", &obj);
-       INSIST(result == ISC_R_SUCCESS);
-       view->requestixfr = cfg_obj_asboolean(obj);
-
        obj = NULL;
        result = ns_config_get(maps, "provide-ixfr", &obj);
        INSIST(result == ISC_R_SUCCESS);
index fb0e3a337995389726e7576d926bcb2be59162a1..4046d2a406ac8a653b743876ee8345bbd11dc181 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: zoneconf.c,v 1.181 2011/08/30 23:46:51 tbox Exp $ */
+/* $Id: zoneconf.c,v 1.182 2011/09/06 22:29:32 smann Exp $ */
 
 /*% */
 
@@ -1133,6 +1133,11 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
                        dns_zone_setoption(zone, DNS_ZONEOPT_IXFRFROMDIFFS,
                                           ixfrdiff);
 
+               obj = NULL;
+               result = ns_config_get(maps, "request-ixfr", &obj);
+               INSIST(result == ISC_R_SUCCESS);
+               dns_zone_setrequestixfr(zone, cfg_obj_asboolean(obj));
+
                checknames(ztype, maps, &obj);
                INSIST(obj != NULL);
                if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
index 530f458522c45519dfeb0c1bac791cb49de79aa1..c517e65a6dade9390277402ce130da99682e7d1d 100644 (file)
@@ -15,7 +15,9 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: clean.sh,v 1.6 2007/09/26 03:22:43 marka Exp $
+# $Id: clean.sh,v 1.7 2011/09/06 22:29:32 smann Exp $
 
 rm -f ns1/named.conf ns1/myftp.db
+rm -f ns3/*.jnl ns3/mytest.db ns3/subtest.db
+rm -f ns4/*.jnl ns4/*.db
 rm -f */named.memstats
index 6e5b8e42fbc7a77d7d622e69d19f43bdd03992bd..100643502b061cffdfc1e8f7d67262316c3beba8 100644 (file)
@@ -15,9 +15,9 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: setup.sh,v 1.4 2007/06/19 23:47:03 tbox Exp $
+# $Id: setup.sh,v 1.5 2011/09/06 22:29:32 smann Exp $
 
-rm -f ns1/*.db ns1/*.jnl
+rm -f ns1/*.db ns1/*.jnl ns3/*.jnl ns4/*.jnl
 
 cat <<EOF >ns1/named.conf
 options {
@@ -41,3 +41,7 @@ controls {
        inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; };
 };
 EOF
+
+# Setup initial db files for ns3
+cp ns3/mytest0.db ns3/mytest.db
+cp ns3/subtest0.db ns3/subtest.db
index 9897a72326186fa4227ea3b00226533a994c00f5..a3e8f36d4083e6bb727fd67f204119c4da4aad72 100644 (file)
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: tests.sh,v 1.7 2011/03/05 23:52:29 tbox Exp $
+# $Id: tests.sh,v 1.8 2011/09/06 22:29:32 smann Exp $
+
+
+# WARNING: The test labelled "testing request-ixfr option in view vs zone"
+#          is fragile because it depends upon counting instances of records
+#          in the log file - need a better approach <sdm> - until then,
+#          if you add any tests above that point, you will break the test.
 
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
@@ -132,5 +138,67 @@ $DIGCMD nil. TXT | grep 'fallback AXFR' >/dev/null || {
     status=1
 }
 
+echo "I:testing ixfr-from-differences option"
+# ns3 is master; ns4 is slave 
+$CHECKZONE test. ns3/mytest.db > /dev/null 2>&1
+if [ $? -ne 0 ]
+then
+    echo "I:named-checkzone returned failure on ns3/mytest.db"
+fi
+# modify the master
+#echo "I: digging against master: "
+#$DIG $DIGOPTS @10.53.0.3 -p 5300 a host1.test.
+#echo "I: digging against slave: "
+#$DIG $DIGOPTS @10.53.0.4 -p 5300 a host1.test.
+
+cp ns3/mytest1.db ns3/mytest.db
+$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf reload
+sleep 2
+
+# slave should have gotten notify and updated
+
+INCR=`grep "test/IN/primary" ns4/named.run|grep "got incremental"|wc -l`
+if [ $INCR -ne 1 ]
+then
+    echo "I:failed to get incremental response"
+    status=1
+fi
+
+echo "I:testing request-ixfr option in view vs zone"
+# There's a view with 2 zones. In the view, "request-ixfr yes"
+# but in the zone "sub.test", request-ixfr no"
+# we want to make sure that a change to sub.test results in AXFR, while
+# changes to test. result in IXFR
+
+echo "I: this result should be AXFR"
+cp ns3/subtest1.db ns3/subtest.db # change to sub.test zone, should be AXFR
+$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf reload
+sleep 2
+
+echo "I: this result should be AXFR"
+NONINCR=`grep 'sub\.test/IN/primary' ns4/named.run|grep "got nonincremental" | wc -l`
+if [ $NONINCR -ne 2 ]
+then
+    echo "I:failed to get nonincremental response in 2nd AXFR test"
+    status=1
+else
+    echo "I:  success: AXFR it was"
+fi
+
+echo "I: this result should be IXFR"
+cp ns3/mytest2.db ns3/mytest.db # change to test zone, should be IXFR
+$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf reload
+sleep 2
+
+INCR=`grep "test/IN/primary" ns4/named.run|grep "got incremental"|wc -l`
+if [ $INCR -ne 2 ]
+then
+    echo "I:failed to get incremental response in 2nd IXFR test"
+    status=1
+else
+    echo "I:  success: IXFR it was"
+fi
+
+
 echo "I:exit status: $status"
 exit $status
index e72a791530e80f66aa35fb8726ccac887fc727d2..61114d20b43afe02856310fe4c9cf4f0a44fd3e8 100644 (file)
@@ -18,7 +18,7 @@
  - PERFORMANCE OF THIS SOFTWARE.
 -->
 
-<!-- File: $Id: Bv9ARM-book.xml,v 1.501 2011/08/30 05:16:13 marka Exp $ -->
+<!-- File: $Id: Bv9ARM-book.xml,v 1.502 2011/09/06 22:29:32 smann Exp $ -->
 <book xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>BIND 9 Administrator Reference Manual</title>
 
@@ -9555,8 +9555,9 @@ ns.domain.com.rpz-nsdname   CNAME   .
             the local server, acting as a slave, will request incremental zone
             transfers from the given remote server, a master. If not set, the
             value of the <command>request-ixfr</command> option in
-            the view or
-            global options block is used as a default.
+            the view or global options block is used as a default. It may
+            also be set in the zone block and, if set there, it will
+            override the global or view setting for that zone.
           </para>
 
           <para>
@@ -10093,6 +10094,7 @@ view "external" {
     <optional> ixfr-base <replaceable>string</replaceable> ; </optional>
     <optional> ixfr-from-differences <replaceable>yes_or_no</replaceable>; </optional>
     <optional> ixfr-tmp-file <replaceable>string</replaceable> ; </optional>
+    <optional> request-ixfr <replaceable>yes_or_no</replaceable> ; </optional>
     <optional> maintain-ixfr-base <replaceable>yes_or_no</replaceable> ; </optional>
     <optional> max-ixfr-log-size <replaceable>number</replaceable> ; </optional>
     <optional> max-transfer-idle-out <replaceable>number</replaceable> ; </optional>
index 720499fa610171d9983dd6d9a0e6709a6e47c0f8..51099d891dbda31a022973d343bf5b2a2b8d7b54 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: view.h,v 1.135 2011/09/02 21:15:36 each Exp $ */
+/* $Id: view.h,v 1.136 2011/09/06 22:29:33 smann Exp $ */
 
 #ifndef DNS_VIEW_H
 #define DNS_VIEW_H 1
@@ -142,7 +142,6 @@ struct dns_view {
        dns_rbt_t *                     answeracl_exclude;
        dns_rbt_t *                     denyanswernames;
        dns_rbt_t *                     answernames_exclude;
-       isc_boolean_t                   requestixfr;
        isc_boolean_t                   provideixfr;
        isc_boolean_t                   requestnsid;
        dns_ttl_t                       maxcachettl;
index 1e2ccc4fc3676c165aab20e008d6a7737e4d864e..714b88bedb7ef97ae9045bdf729c115a8c1ba9ac 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: zone.h,v 1.193 2011/09/02 21:15:36 each Exp $ */
+/* $Id: zone.h,v 1.194 2011/09/06 22:29:33 smann Exp $ */
 
 #ifndef DNS_ZONE_H
 #define DNS_ZONE_H 1
@@ -1932,6 +1932,25 @@ dns_zone_setrefreshkeyinterval(dns_zone_t *zone, isc_uint32_t interval);
  * \li 'zone' to be valid.
  */
 
+isc_boolean_t
+dns_zone_getrequestixfr(dns_zone_t *zone);
+/*%
+ * Returns the true/false value of the request-ixfr option in the zone.
+ *
+ * Requires:
+ * \li 'zone' to be valid.
+ */
+
+void
+dns_zone_setrequestixfr(dns_zone_t *zone, isc_boolean_t flag);
+/*%
+ * Sets the request-ixfr option for the zone. Either true or false. The
+ * default value is determined by the setting of this option in the view.
+ *
+ * Requires:
+ * \li 'zone' to be valid.
+ */
+
 void
 dns_zone_setserialupdatemethod(dns_zone_t *zone, dns_updatemethod_t method);
 /*%
index 695e48b08aea5e47f10eb331ec4b8bab6ff65317..0c6c615189098ec3005a2a1f392119f61d7300bc 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: view.c,v 1.183 2011/09/02 21:15:35 each Exp $ */
+/* $Id: view.c,v 1.184 2011/09/06 22:29:33 smann Exp $ */
 
 /*! \file */
 
@@ -181,7 +181,6 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
        view->answeracl_exclude = NULL;
        view->denyanswernames = NULL;
        view->answernames_exclude = NULL;
-       view->requestixfr = ISC_TRUE;
        view->provideixfr = ISC_TRUE;
        view->maxcachettl = 7 * 24 * 3600;
        view->maxncachettl = 3 * 3600;
index d1c171a00c1482501b1ff6b6ca67f5af0e7d31c5..34a59fdf1f8ef4d161a23a3c8ca891f27ce348fc 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: zone.c,v 1.631 2011/09/03 16:15:08 each Exp $ */
+/* $Id: zone.c,v 1.632 2011/09/06 22:29:33 smann Exp $ */
 
 /*! \file */
 
@@ -350,6 +350,11 @@ struct dns_zone {
         */
        dns_updatemethod_t      updatemethod;
 
+       /*%
+        * whether ixfr is requested
+        */
+       isc_boolean_t           requestixfr;
+
        /*%
         * Outstanding forwarded UPDATE requests.
         */
@@ -12824,7 +12829,7 @@ queue_xfrin(dns_zone_t *zone) {
  */
 static void
 got_transfer_quota(isc_task_t *task, isc_event_t *event) {
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        dns_peer_t *peer = NULL;
        char master[ISC_SOCKADDR_FORMATSIZE];
        char source[ISC_SOCKADDR_FORMATSIZE];
@@ -12872,16 +12877,6 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) {
                             "no database exists yet, requesting AXFR of "
                             "initial version from %s", master);
                xfrtype = dns_rdatatype_axfr;
-#if 0
-       } else if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_IXFRFROMDIFFS)) {
-               dns_zone_log(zone, ISC_LOG_DEBUG(1), "ixfr-from-differences "
-                            "set, requesting %sAXFR from %s", soa_before,
-                            master);
-               if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_SOABEFOREAXFR))
-                       xfrtype = dns_rdatatype_soa;
-               else
-                       xfrtype = dns_rdatatype_axfr;
-#endif
        } else if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_FORCEXFER)) {
                dns_zone_log(zone, ISC_LOG_DEBUG(1),
                             "forced reload, requesting AXFR of "
@@ -12897,13 +12892,10 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) {
                UNLOCK_ZONE(zone);
        } else {
                isc_boolean_t use_ixfr = ISC_TRUE;
-               if (peer != NULL &&
-                   dns_peer_getrequestixfr(peer, &use_ixfr) ==
-                   ISC_R_SUCCESS) {
-                       ; /* Using peer setting */
-               } else {
-                       use_ixfr = zone->view->requestixfr;
-               }
+               if (peer != NULL)
+                       result = dns_peer_getrequestixfr(peer, &use_ixfr);
+               if (peer == NULL || result != ISC_R_SUCCESS)
+                       use_ixfr = zone->requestixfr;
                if (use_ixfr == ISC_FALSE) {
                        dns_zone_log(zone, ISC_LOG_DEBUG(1),
                                     "IXFR disabled, requesting %sAXFR from %s",
@@ -15256,6 +15248,18 @@ dns_zone_setrefreshkeyinterval(dns_zone_t *zone, isc_uint32_t interval) {
        return (ISC_R_SUCCESS);
 }
 
+void
+dns_zone_setrequestixfr(dns_zone_t *zone, isc_boolean_t bool) {
+       REQUIRE(DNS_ZONE_VALID(zone));
+       zone->requestixfr = bool;
+}
+
+isc_boolean_t
+dns_zone_getrequestixfr(dns_zone_t *zone) {
+       REQUIRE(DNS_ZONE_VALID(zone));
+       return (zone->requestixfr);
+}
+
 void
 dns_zone_setserialupdatemethod(dns_zone_t *zone, dns_updatemethod_t method) {
        REQUIRE(DNS_ZONE_VALID(zone));
index c9486b82e748e0fe6f498dee23575abc91d340b4..62fd560b497d8b63a918b08278be6b2441b922eb 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: namedconf.c,v 1.140 2011/08/30 05:16:15 marka Exp $ */
+/* $Id: namedconf.c,v 1.141 2011/09/06 22:29:33 smann Exp $ */
 
 /*! \file */
 
@@ -1395,6 +1395,7 @@ zone_clauses[] = {
        { "notify-to-soa", &cfg_type_boolean, 0 },
        { "nsec3-test-zone", &cfg_type_boolean, CFG_CLAUSEFLAG_TESTONLY },
        { "serial-update-method", &cfg_type_updatemethod, 0 },
+       { "request-ixfr", &cfg_type_boolean, 0 },
        { "sig-signing-nodes", &cfg_type_uint32, 0 },
        { "sig-signing-signatures", &cfg_type_uint32, 0 },
        { "sig-signing-type", &cfg_type_uint32, 0 },