]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3557. [bug] Reloading redirect zones was broken. [RT #33292]
authorMark Andrews <marka@isc.org>
Mon, 29 Apr 2013 05:20:09 +0000 (15:20 +1000)
committerMark Andrews <marka@isc.org>
Mon, 29 Apr 2013 05:20:09 +0000 (15:20 +1000)
CHANGES
bin/named/server.c
bin/tests/system/redirect/clean.sh
bin/tests/system/redirect/ns2/example.db.in [new file with mode: 0644]
bin/tests/system/redirect/ns2/named.conf
bin/tests/system/redirect/ns2/redirect.db.in [moved from bin/tests/system/redirect/ns2/redirect.db with 94% similarity]
bin/tests/system/redirect/setup.sh
bin/tests/system/redirect/tests.sh
doc/arm/Bv9ARM-book.xml
lib/dns/zone.c

diff --git a/CHANGES b/CHANGES
index 42e046ae7952c10796817d2db4f26692dde8a26e..fbd697d902b34f8e71bdc4688c87b87630ddcbf8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+3557.  [bug]           Reloading redirect zones was broken. [RT #33292]
+
 3556.  [maint]         Added AAAA for D.ROOT-SERVERS.NET.
 
 3555.  [bug]           Address theoretical race conditions in acache.c
index f22d09ee0404a32afc0b0b1f589a2d1ee0e4255f..766602e647286042c131f25b44ef8590b23490fc 100644 (file)
@@ -5935,12 +5935,16 @@ load_zones(ns_server_t *server) {
        {
                if (view->managed_keys != NULL) {
                        result = dns_zone_load(view->managed_keys);
-                       if (result != ISC_R_SUCCESS && result != DNS_R_UPTODATE)
+                       if (result != ISC_R_SUCCESS &&
+                           result != DNS_R_UPTODATE &&
+                           result != DNS_R_CONTINUE)
                                goto cleanup;
                }
                if (view->redirect != NULL) {
                        result = dns_zone_load(view->redirect);
-                       if (result != ISC_R_SUCCESS && result != DNS_R_UPTODATE)
+                       if (result != ISC_R_SUCCESS &&
+                           result != DNS_R_UPTODATE &&
+                           result != DNS_R_CONTINUE)
                                goto cleanup;
                }
 
index f043095c0f662606279f1ea5520a2d775d521d05..0eb7f5fe55a2062e6e173df354a3aa85cf5a76dc 100644 (file)
@@ -25,3 +25,5 @@ rm -f ns1/dsset-nsec3.
 rm -f */named.memstats
 rm -f */named.run
 rm -f dig.out.* random.data
+rm -f ns2/*.db
+rm -f rndc.out
diff --git a/bin/tests/system/redirect/ns2/example.db.in b/bin/tests/system/redirect/ns2/example.db.in
new file mode 100644 (file)
index 0000000..28cd646
--- /dev/null
@@ -0,0 +1,19 @@
+; Copyright (C) 2013  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.
+
+$TTL 300       ; 5 minutes
+@ IN SOA ns.example.net hostmaster.example.net 0 0 0 0 0
+@       NS     ns2
+ns2    A       10.53.0.2
+a      A       10.53.0.2
index e1d5334e838dbe67b364b6693c7be5a345c913af..b92949e38b26050f98758dd620f30e21c8187881 100644 (file)
@@ -37,6 +37,15 @@ options {
 
 };
 
+key rndc_key {
+        secret "1234abcd8765";
+        algorithm hmac-sha256;
+};
+
+controls {
+        inet 10.53.0.2 port 9953 allow { any; } keys { rndc_key; };
+};
+
 zone "." {
        type hint;
        file "../../common/root.hint";
@@ -47,3 +56,8 @@ zone "." {
        file "redirect.db";
        allow-query { !10.53.0.4; any; };
 };
+
+zone "example.nil" {
+       type master;
+       file "example.db";
+};
similarity index 94%
rename from bin/tests/system/redirect/ns2/redirect.db
rename to bin/tests/system/redirect/ns2/redirect.db.in
index 23f21ea2ca499582b5a9f7bd026ad5b2bf2eaf43..f4215f42c4b0915ec500d24f539d9be8165d1b09 100644 (file)
@@ -12,8 +12,6 @@
 ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 ; PERFORMANCE OF THIS SOFTWARE.
 
-; $Id: redirect.db,v 1.3 2011/03/01 23:48:07 tbox Exp $
-
 $TTL 300
 @ IN SOA ns.example.net hostmaster.example.net 0 0 0 0 0
 @ IN NS ns.example.net
index 4a8927ad8484f82f0325ac76ab2af494bc12af82..f3219c9df45c8221f80dccbc90acd047f98f1602 100644 (file)
@@ -20,4 +20,6 @@ sh clean.sh
 
 ../../../tools/genrandom 400 random.data
 
+cp ns2/redirect.db.in ns2/redirect.db
+cp ns2/example.db.in ns2/example.db
 cd ns1 && sh sign.sh
index 5315a064022fd6b0515eb059ae6c51b42fd8e9c3..f9239812e18bcd138982193de572e9d356686aa7 100644 (file)
@@ -332,5 +332,21 @@ n=`expr $n + 1`
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
+echo "I:checking that redirect zones reload correctly"
+ret=0
+sed -e 's/0 0 0 0 0/1 0 0 0 0/' < ns2/example.db.in > ns2/example.db
+sed -e 's/0 0 0 0 0/1 0 0 0 0/' -e 's/\.1$/.2/' < ns2/redirect.db.in > ns2/redirect.db
+$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload > rndc.out || ret=1
+sed 's/^/I:ns2 /' rndc.out
+$DIG $DIGOPTS +short @10.53.0.2 soa example.nil > dig.out.ns1.test$n || ret=1
+set -- `cat dig.out.ns1.test$n`
+[ $3 = 1 ] || ret=1
+$DIG $DIGOPTS nonexist. @10.53.0.2 -b 10.53.0.2 a > dig.out.ns2.test$n || ret=1
+grep "status: NOERROR" dig.out.ns2.test$n > /dev/null || ret=1
+grep "100.100.100.2" dig.out.ns2.test$n > /dev/null || ret=1
+n=`expr $n + 1`
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
 echo "I:exit status: $status"
 exit $status
index c89a27c2c3c282e16350fb6084478aa02ec2e705..c8fc5cfbc51d6cf0b0b41767a4a74ee7e0bbaf00 100644 (file)
@@ -11435,6 +11435,19 @@ zone <replaceable>zone_name</replaceable> <optional><replaceable>class</replacea
                         possible types; it is not limited to A and
                         AAAA records.
                       </para>
+                      <para>
+                        Because redirect zones are not referenced
+                        directly by name, they are not kept in the
+                        zone lookup table with normal master and slave
+                        zones. Consequently, it is not currently possible
+                        to use
+                        <command>rndc reload
+                                <replaceable>zonename</replaceable></command>
+                        to reload a redirect zone.  However, when using
+                        <command>rndc reload</command> without specifying
+                        a zone name, redirect zones will be reloaded along
+                        with other zones.
+                      </para>
                     </entry>
                   </row>
                   <row rowsep="0">
index 0bdd57bf003228bcdfe5a8f86fe4db573d574544..15f573a708a9749443669f2271883268301b1ad5 100644 (file)
@@ -12508,6 +12508,7 @@ zone_debuglog(dns_zone_t *zone, const char *me, int debuglevel,
        va_list ap;
        char message[4096];
        int level = ISC_LOG_DEBUG(debuglevel);
+       const char *zstr;
 
        if (isc_log_wouldlog(dns_lctx, level) == ISC_FALSE)
                return;
@@ -12515,9 +12516,21 @@ zone_debuglog(dns_zone_t *zone, const char *me, int debuglevel,
        va_start(ap, fmt);
        vsnprintf(message, sizeof(message), fmt, ap);
        va_end(ap);
+
+       switch (zone->type) {
+       case dns_zone_key:
+               zstr = "managed-keys-zone";
+               break;
+       case dns_zone_redirect:
+               zstr = "redirect-zone";
+               break;
+       default:
+               zstr = "zone";
+       }
+
        isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_ZONE,
-                     level, "%s: %s %s: %s", me, zone->type != dns_zone_key ?
-                     "zone" : "managed-keys-zone", zone->strnamerd, message);
+                     level, "%s: %s %s: %s", me, zstr, zone->strnamerd,
+                     message);
 }
 
 static int