zone "sub.example" {
type master;
- file "sub.example.db.in";
+ file "sub.example.db.signed";
};
zone "initially-unavailable" {
keys_to_trust=""
-for zonename in example initially-unavailable; do
+for zonename in sub.example example initially-unavailable; do
zone=$zonename
infile=$zonename.db.in
zonefile=$zonename.db
cat $infile $keyname1.key $keyname2.key > $zonefile
- $SIGNER -P -o $zone $zonefile > /dev/null
+ $SIGNER -P -g -o $zone $zonefile > /dev/null
done
# Only add the key for "initially-unavailable" to the list of keys trusted by
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
+n=`expr $n + 1`
+echo_i "checking delegations sourced from a mirror zone ($n)"
+ret=0
+$DIG $DIGOPTS @10.53.0.3 foo.example A +norec > dig.out.ns3.test$n 2>&1 || ret=1
+# Check response code and flags in the answer.
+grep "NOERROR" dig.out.ns3.test$n > /dev/null || ret=1
+grep "flags:.* ad" dig.out.ns3.test$n > /dev/null && ret=1
+# Check that a delegation containing a DS RRset and glue is present.
+grep "ANSWER: 0" dig.out.ns3.test$n > /dev/null || ret=1
+grep "example.*IN.*NS" dig.out.ns3.test$n > /dev/null || ret=1
+grep "example.*IN.*DS" dig.out.ns3.test$n > /dev/null || ret=1
+grep "ns2.example.*A.*10.53.0.2" dig.out.ns3.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
n=`expr $n + 1`
echo_i "checking that resolution involving a mirror zone works as expected ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.3 sub.example. NS > dig.out.ns3.test$n.1 2>&1 || ret=1
# Ensure the child-side NS RRset is returned.
grep "NOERROR" dig.out.ns3.test$n.1 > /dev/null || ret=1
-grep "ANSWER: 1" dig.out.ns3.test$n.1 > /dev/null || ret=1
+grep "ANSWER: 2" dig.out.ns3.test$n.1 > /dev/null || ret=1
grep "sub.example.*IN.*NS" dig.out.ns3.test$n.1 > /dev/null || ret=1
# Issue a non-recursive query for something below the cached zone cut.
$DIG $DIGOPTS @10.53.0.3 +norec foo.sub.example. A > dig.out.ns3.test$n.2 2>&1 || ret=1
-# Ensure the cached NS RRset is returned in a delegation.
+# Ensure the cached NS RRset is returned in a delegation, along with the
+# parent-side DS RRset.
grep "NOERROR" dig.out.ns3.test$n.2 > /dev/null || ret=1
grep "ANSWER: 0" dig.out.ns3.test$n.2 > /dev/null || ret=1
grep "sub.example.*IN.*NS" dig.out.ns3.test$n.2 > /dev/null || ret=1
+grep "sub.example.*IN.*DS" dig.out.ns3.test$n.2 > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
dns_dbnode_t *node; /* DB node */
dns_db_t *zdb; /* zone DB values, saved */
- dns_name_t *zfname; /* while searching cache */
- dns_dbversion_t *zversion; /* for a better answer */
+ dns_dbnode_t *znode; /* while searching cache */
+ dns_name_t *zfname; /* for a better answer */
+ dns_dbversion_t *zversion;
dns_rdataset_t *zrdataset;
dns_rdataset_t *zsigrdataset;
qctx->zsigrdataset = NULL;
qctx->zversion = NULL;
qctx->node = NULL;
+ qctx->znode = NULL;
qctx->db = NULL;
qctx->zdb = NULL;
qctx->version = NULL;
}
if (qctx->zdb != NULL) {
+ query_putrdataset(qctx->client, &qctx->zsigrdataset);
query_putrdataset(qctx->client, &qctx->zrdataset);
- if (qctx->zsigrdataset != NULL)
- query_putrdataset(qctx->client, &qctx->zsigrdataset);
- if (qctx->zfname != NULL)
- query_releasename(qctx->client, &qctx->zfname);
+ query_releasename(qctx->client, &qctx->zfname);
+ dns_db_detachnode(qctx->zdb, &qctx->znode);
dns_db_detach(&qctx->zdb);
}
* we'll restore these values there.
*/
query_keepname(qctx->client, qctx->fname, qctx->dbuf);
- dns_db_detachnode(qctx->db, &qctx->node);
SAVE(qctx->zdb, qctx->db);
+ SAVE(qctx->znode, qctx->node);
SAVE(qctx->zfname, qctx->fname);
SAVE(qctx->zversion, qctx->version);
SAVE(qctx->zrdataset, qctx->rdataset);
&qctx->sigrdataset);
qctx->version = NULL;
+ dns_db_detachnode(qctx->db, &qctx->node);
+ dns_db_detach(&qctx->db);
+ RESTORE(qctx->db, qctx->zdb);
+ RESTORE(qctx->node, qctx->znode);
RESTORE(qctx->fname, qctx->zfname);
RESTORE(qctx->version, qctx->zversion);
RESTORE(qctx->rdataset, qctx->zrdataset);
RESTORE(qctx->sigrdataset, qctx->zsigrdataset);
-
- /*
- * We don't clean up zdb here because we
- * may still need it. It will get cleaned
- * up by the main cleanup code in query_done().
- */
}
if (RECURSIONOK(qctx->client)) {
qctx->client->query.attributes |= NS_QUERYATTR_CACHEGLUEOK;
qctx->client->query.isreferral = ISC_TRUE;
- if (qctx->zdb != NULL && qctx->client->query.gluedb == NULL &&
- !(qctx->zone != NULL && dns_zone_ismirror(qctx->zone)))
- {
- dns_db_attach(qctx->zdb, &qctx->client->query.gluedb);
+ if (!dns_db_iscache(qctx->db) && qctx->client->query.gluedb == NULL) {
+ dns_db_attach(qctx->db, &qctx->client->query.gluedb);
detach = ISC_TRUE;
}