diff --git a/CHANGES b/CHANGES index 42e046ae79..fbd697d902 100644 --- 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 diff --git a/bin/named/server.c b/bin/named/server.c index f22d09ee04..766602e647 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -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; } diff --git a/bin/tests/system/redirect/clean.sh b/bin/tests/system/redirect/clean.sh index f043095c0f..0eb7f5fe55 100644 --- a/bin/tests/system/redirect/clean.sh +++ b/bin/tests/system/redirect/clean.sh @@ -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 index 0000000000..28cd646158 --- /dev/null +++ b/bin/tests/system/redirect/ns2/example.db.in @@ -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 diff --git a/bin/tests/system/redirect/ns2/named.conf b/bin/tests/system/redirect/ns2/named.conf index e1d5334e83..b92949e38b 100644 --- a/bin/tests/system/redirect/ns2/named.conf +++ b/bin/tests/system/redirect/ns2/named.conf @@ -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"; +}; diff --git a/bin/tests/system/redirect/ns2/redirect.db b/bin/tests/system/redirect/ns2/redirect.db.in similarity index 94% rename from bin/tests/system/redirect/ns2/redirect.db rename to bin/tests/system/redirect/ns2/redirect.db.in index 23f21ea2ca..f4215f42c4 100644 --- a/bin/tests/system/redirect/ns2/redirect.db +++ b/bin/tests/system/redirect/ns2/redirect.db.in @@ -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 diff --git a/bin/tests/system/redirect/setup.sh b/bin/tests/system/redirect/setup.sh index 4a8927ad84..f3219c9df4 100644 --- a/bin/tests/system/redirect/setup.sh +++ b/bin/tests/system/redirect/setup.sh @@ -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 diff --git a/bin/tests/system/redirect/tests.sh b/bin/tests/system/redirect/tests.sh index 5315a06402..f9239812e1 100644 --- a/bin/tests/system/redirect/tests.sh +++ b/bin/tests/system/redirect/tests.sh @@ -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 diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml index c89a27c2c3..c8fc5cfbc5 100644 --- a/doc/arm/Bv9ARM-book.xml +++ b/doc/arm/Bv9ARM-book.xml @@ -11435,6 +11435,19 @@ zone zone_name class + + 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 + rndc reload + zonename + to reload a redirect zone. However, when using + rndc reload without specifying + a zone name, redirect zones will be reloaded along + with other zones. + diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 0bdd57bf00..15f573a708 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -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