]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3180. [func] Local copies of slave zones are now saved in raw
authorEvan Hunt <each@isc.org>
Wed, 26 Oct 2011 15:23:37 +0000 (15:23 +0000)
committerEvan Hunt <each@isc.org>
Wed, 26 Oct 2011 15:23:37 +0000 (15:23 +0000)
format by default, to improve startup performance.
'masterfile-format text;' can be used to override
the default, if desired. [RT #25867]

CHANGES
bin/named/zoneconf.c
bin/tests/system/masterformat/clean.sh
bin/tests/system/masterformat/ns1/named.conf
bin/tests/system/masterformat/ns2/formerly-text.db.in [new file with mode: 0644]
bin/tests/system/masterformat/ns2/named.conf
bin/tests/system/masterformat/setup.sh
bin/tests/system/masterformat/tests.sh
bin/tests/system/upforwd/ns3/named.conf
bin/tests/system/xferquota/setup.pl
doc/arm/Bv9ARM-book.xml

diff --git a/CHANGES b/CHANGES
index dd31dc3b8dc51f2d82e4ceabde43c2d5cbdd2a1b..63d99c848792d89ca250bfb9d4f78254be5db7dc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+3180.  [func]          Local copies of slave zones are now saved in raw
+                       format by default, to improve startup performance.
+                       'masterfile-format text;' can be used to override
+                       the default, if desired. [RT #25867]
+
 3179.  [port]          kfreebsd: build issues. [RT #26273]
 
 3178.  [bug]           A race condition introduced by change #3163 could
index ab3fba21ae8ab3dd8716841997e018ec56cec4dd..68387d8cec9b8c1bbd52e4b6e4e16c4fbbf776b1 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: zoneconf.c,v 1.184 2011/10/12 00:10:19 marka Exp $ */
+/* $Id: zoneconf.c,v 1.185 2011/10/26 15:23:36 each Exp $ */
 
 /*% */
 
@@ -909,7 +909,10 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
                return (ISC_R_FAILURE);
        }
 
-       masterformat = dns_masterformat_text;
+       if (ztype == dns_zone_slave)
+               masterformat = dns_masterformat_raw;
+       else
+               masterformat = dns_masterformat_text;
        obj = NULL;
        result= ns_config_get(maps, "masterfile-format", &obj);
        if (result == ISC_R_SUCCESS) {
index 1909dc2ed3bda19872e873f02fe32d7779c2c3a2..8bf14ca4bf83ef99e1f878a523f2007d5aab0c3b 100755 (executable)
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: clean.sh,v 1.5 2007/09/26 03:22:44 marka Exp $
+# $Id: clean.sh,v 1.6 2011/10/26 15:23:36 each Exp $
 
 rm -f named-compilezone
 rm -f ns1/example.db.raw
 rm -f ns2/example.db
 rm -f dig.out.*
 rm -f */named.memstats
+rm -f ns2/transfer.db.*
+rm -f ns2/formerly-text.db
index a2971f5c1deaef3a377b724225fa6b0612056dfa..52575dc555f395d9afec246950239a085e4dd604 100644 (file)
@@ -14,7 +14,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: named.conf,v 1.4 2007/06/19 23:47:04 tbox Exp $ */
+/* $Id: named.conf,v 1.5 2011/10/26 15:23:36 each Exp $ */
 
 // NS1
 
@@ -23,6 +23,7 @@ controls { /* empty */ };
 options {
        pid-file "named.pid";
        listen-on port 5300 { 10.53.0.1; };
+        port 5300;
        listen-on-v6 { none; };
        recursion no;
        notify no;
@@ -34,3 +35,21 @@ zone "example" {
        masterfile-format raw;
        file "example.db.raw";
 };
+
+zone "transfer1" {
+        type master;
+        file "example.db";
+        allow-transfer { any; };
+};
+
+zone "transfer2" {
+        type master;
+        file "example.db";
+        allow-transfer { any; };
+};
+
+zone "transfer3" {
+        type master;
+        file "example.db";
+        allow-transfer { any; };
+};
diff --git a/bin/tests/system/masterformat/ns2/formerly-text.db.in b/bin/tests/system/masterformat/ns2/formerly-text.db.in
new file mode 100644 (file)
index 0000000..98b83b4
--- /dev/null
@@ -0,0 +1,37 @@
+$ORIGIN .
+$TTL 86400     ; 1 day
+transfer3              IN SOA  ns.transfer3. hostmaster.transfer3. (
+                               1          ; serial
+                               3600       ; refresh (1 hour)
+                               1800       ; retry (30 minutes)
+                               1814400    ; expire (3 weeks)
+                               3          ; minimum (3 seconds)
+                               )
+                       NS      ns.transfer3.
+$ORIGIN transfer3.
+a                      A       10.53.0.1
+                       A       10.53.0.2
+aaaa                   AAAA    2001:db8::53
+cname                  CNAME   cname-target
+dname                  DNAME   dname-target
+$TTL 300       ; 5 minutes
+dnskey                 DNSKEY  256 3 1 (
+                               AQPTpWyReB/e9Ii6mVGnakS8hX2zkh/iUYAg+Ge4noWR
+                               OpTWOIBvm76zeJPWs4Zfqa1IsswDIx5Mqeg0zwclz59u
+                               ecKsKyx5w9IhtZ8plc4Rb9VIE5x7KNHAYTvTO5d4S8M=
+                               ) ; ZSK; alg = RSAMD5; key id = 30795
+ds                     DS      30795 1 1 (
+                               310D27F4D82C1FC2400704EA9939FE6E1CEAA3B9 )
+$TTL 86400     ; 1 day
+mx                     MX      10 mail
+ns                     A       10.53.0.1
+$TTL 600       ; 10 minutes
+nsec                   NSEC    nsecnext.transfer3. NS DS RRSIG NSEC
+$TTL 300       ; 5 minutes
+rrsig                  RRSIG   SOA 1 0 300 (
+                               20050714214747 20050614214747 30795 .
+                               yi/RRPAQmn6rnjDQaCqVValBa+ICF00ZldKfZSDaoew5
+                               mMUh83DlrrPPNeAxrzMSNzDGlJ6PfdyIFgzPn/CvthF4
+                               kjBUAiJTp4r2zhlaUJQ+QFo+drYXYgVJo6aA36fj )
+$TTL 86400     ; 1 day
+txt                    TXT     "this is text"
index 3cda00e4e949298440b0839768b339c42ffb6292..2ff19c08c1dacb4285b38b91051206ff558af5d2 100644 (file)
@@ -14,7 +14,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: named.conf,v 1.4 2007/06/19 23:47:04 tbox Exp $ */
+/* $Id: named.conf,v 1.5 2011/10/26 15:23:37 each Exp $ */
 
 // NS2
 
@@ -24,6 +24,7 @@ options {
        pid-file "named.pid";
        listen-on port 5300 { 10.53.0.2; };
        listen-on-v6 { none; };
+        port 5300;
        recursion no;
        notify no;
        dnssec-enable yes;
@@ -33,3 +34,22 @@ zone "example" {
        type master;
        file "example.db";
 };
+
+zone "transfer1" {
+        type slave;
+        masters { 10.53.0.1; };
+        file "transfer.db.raw";
+};
+
+zone "transfer2" {
+        type slave;
+        masters { 10.53.0.1; };
+        masterfile-format text;
+        file "transfer.db.txt";
+};
+
+zone "transfer3" {
+        type slave;
+        masters { 10.53.0.1; };
+        file "formerly-text.db";
+};
index 4c85ab74c18af7fe6bc6177696b717ac7a6b1fdd..1406c35ec83c72f2bd62ebad4925c22c9e19d99e 100755 (executable)
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: setup.sh,v 1.6 2007/06/19 23:47:04 tbox Exp $
+# $Id: setup.sh,v 1.7 2011/10/26 15:23:36 each Exp $
 
 ln -s $CHECKZONE named-compilezone
 rm -f ns1/example.db.raw
 cp ns1/example.db ns2/
+cp ns2/formerly-text.db.in ns2/formerly-text.db
 cd ns1 && sh compile.sh
index 71c115d21ee23bc232c604ff19b9d8416844c693..f86fde66c946a99eac2118e706ea4235bc2692c1 100755 (executable)
@@ -1,46 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2005, 2007  Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# $Id: tests.sh,v 1.4 2007/06/19 23:47:04 tbox Exp $
-
-SYSTEMTESTTOP=..
-. $SYSTEMTESTTOP/conf.sh
-
-DIGOPTS="+tcp +noauth +noadd +nosea +nostat +noquest +nocomm +nocmd"
-
-status=0
-
-echo "I:checking that master file in the raw format worked"
-
-for server in 1 2
-do
-       for name in ns mx a aaaa cname dname txt rrsig nsec dnskey ds
-       do
-               $DIG $DIGOPTS $name.example. $name @10.53.0.$server -p 5300
-               echo
-       done > dig.out.$server
-done
-
-diff dig.out.1 dig.out.2 || status=1
-
-echo "I:exit status: $status"
-exit $status
-#!/bin/sh
-#
-# Copyright (C) 2005  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2005, 2007, 2011  Internet Systems Consortium, Inc. ("ISC")
 #
 # Permission to use, copy, modify, and distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -54,17 +14,24 @@ exit $status
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: tests.sh,v 1.4 2007/06/19 23:47:04 tbox Exp $
+# $Id: tests.sh,v 1.5 2011/10/26 15:23:36 each Exp $
 
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
 
+israw () {
+    cat $1 | perl -e '$input = <STDIN>;
+                      ($style, $version) = unpack("NN", $input);
+                      exit 1 if ($style != 2 || $version != 0);'
+    return $?
+}
+
 DIGOPTS="+tcp +noauth +noadd +nosea +nostat +noquest +nocomm +nocmd"
 
 status=0
 
 echo "I:checking that master file in the raw format worked"
-
+ret=0
 for server in 1 2
 do
        for name in ns mx a aaaa cname dname txt rrsig nsec dnskey ds
@@ -73,8 +40,30 @@ do
                echo
        done > dig.out.$server
 done
-
-diff dig.out.1 dig.out.2 || status=1
+$PERL ../digcomp.pl dig.out.1 dig.out.2 || ret=1
+[ $ret -eq 0 ] || echo "I:failed"
+status=`expr $status + $ret`
+
+echo "I:waiting for transfers to complete"
+sleep 1
+
+echo "I:checking that slave was saved in raw format by default"
+ret=0
+israw ns2/transfer.db.raw || ret=1
+[ $ret -eq 0 ] || echo "I:failed"
+status=`expr $status + $ret`
+
+echo "I:checking that slave was saved in text format when configured"
+ret=0
+israw ns2/transfer.db.txt && ret=1
+[ $ret -eq 0 ] || echo "I:failed"
+status=`expr $status + $ret`
+
+echo "I:checking that slave formerly in text format is now raw"
+ret=0
+israw ns2/formerly-text.db || ret=1
+[ $ret -eq 0 ] || echo "I:failed"
+status=`expr $status + $ret`
 
 echo "I:exit status: $status"
 exit $status
index 365785d209a8a2a9a2865a5159b239768353188e..3737fb5e38b094c3e28efa5a34af8431ea5fdfcc 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: named.conf,v 1.13 2011/09/02 02:25:07 marka Exp $ */
+/* $Id: named.conf,v 1.14 2011/10/26 15:23:37 each Exp $ */
 
 controls { /* empty */ };
 
@@ -43,5 +43,6 @@ zone "nomaster" {
        type slave;
        file "nomaster1.db";
        allow-update-forwarding { any; };
+       masterfile-format text;
        masters { 10.53.0.4; };
 };
index 19ed4e84c89b76603d81b4bb741cbe7b1a22e9d1..cc6da1839b363391309ffea3344fafe84d1bfade 100644 (file)
@@ -15,7 +15,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: setup.pl,v 1.14 2007/06/19 23:47:07 tbox Exp $
+# $Id: setup.pl,v 1.15 2011/10/26 15:23:37 each Exp $
 
 #
 # Set up test data for zone transfer quota tests.
@@ -28,7 +28,7 @@ my $slaveconf  = new FileHandle("ns2/zones.conf", "w") or die;
 for ($z = 0; $z < 300; $z++) {
     my $zn = sprintf("zone%06d.example", $z);
     print $masterconf "zone \"$zn\" { type master; file \"$zn.db\"; };\n";
-    print $slaveconf  "zone \"$zn\" { type slave; file \"$zn.bk\"; masters { 10.53.0.1; }; };\n";
+    print $slaveconf  "zone \"$zn\" { type slave; file \"$zn.bk\"; masterfile-format text; masters { 10.53.0.1; }; };\n";
     my $fn = "ns1/$zn.db";
     my $f = new FileHandle($fn, "w") or die "open: $fn: $!";
     print $f "\$TTL 300
index a77f99d10caa4b248733ba547a044e6bc2569aa4..dc375203a8386302ce3b20e69b3b61f6cbc3e52a 100644 (file)
@@ -18,7 +18,7 @@
  - PERFORMANCE OF THIS SOFTWARE.
 -->
 
-<!-- File: $Id: Bv9ARM-book.xml,v 1.507 2011/10/25 01:54:21 marka Exp $ -->
+<!-- File: $Id: Bv9ARM-book.xml,v 1.508 2011/10/26 15:23:37 each Exp $ -->
 <book xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>BIND 9 Administrator Reference Manual</title>
 
@@ -8828,9 +8828,14 @@ avoid-v6-udp-ports { 40000; range 50000 60000; };
                  the file format of zone files (see
                  <xref linkend="zonefile_format"/>).
                  The default value is <constant>text</constant>, which is the
-                 standard textual representation.  Files in other formats
-                 than <constant>text</constant> are typically expected
-                 to be generated by the <command>named-compilezone</command> tool.
+                 standard textual representation, except for slave zones,
+                  in which the default value is <constant>raw</constant>.
+                  Files in other formats than <constant>text</constant> are
+                  typically expected to be generated by the
+                  <command>named-compilezone</command> tool, or dumped by
+                  <command>named</command>.
+                </para>
+                <para>
                  Note that when a zone file in a different format than
                  <constant>text</constant> is loaded, <command>named</command>
                  may omit some of the checks which would be performed for a