3557. [bug] Reloading redirect zones was broken. [RT #33292]

This commit is contained in:
Mark Andrews 2013-04-29 15:20:09 +10:00
parent 7bf14f4945
commit ec8a802114
10 changed files with 89 additions and 6 deletions

View file

@ -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

View 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;
}

View 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

View file

@ -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

View 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";
};

View 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

View 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

View 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

View 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">

View 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