Commit 53cf6718 authored by Mark Andrews's avatar Mark Andrews
Browse files

1445. [bug] DNS_ADBFIND_STARTATROOT broke stub zones. This has

                        been replaced with DNS_ADBFIND_STARTATZONE which
                        causes the search to start using the closest zone.

1444.   [func]          dns_view_findzonecut2() allows you to specify if the
                        cache should be searched for zonecuts.
developer: marka
reviewer: explorer
parent 888bb8bf
1445. [bug] DNS_ADBFIND_STARTATROOT broke stub zones. This has
been replaced with DNS_ADBFIND_STARTATZONE which
causes the search to start using the closest zone.
1444. [func] dns_view_findzonecut2() allows you to specify if the
cache should be searched for zonecuts.
1443. [func] Masters lists can now be specified and referenced
in zone masters clauses and other masters lists.
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: adb.c,v 1.201 2002/11/27 09:52:54 marka Exp $ */
/* $Id: adb.c,v 1.202 2003/02/26 22:54:28 marka Exp $ */
/*
* Implementation notes
......@@ -328,7 +328,7 @@ static void water(void *arg, int mark);
#define NAME_IS_DEAD 0x40000000
#define NAME_HINT_OK DNS_ADBFIND_HINTOK
#define NAME_GLUE_OK DNS_ADBFIND_GLUEOK
#define NAME_STARTATROOT DNS_ADBFIND_STARTATROOT
#define NAME_STARTATZONE DNS_ADBFIND_STARTATZONE
#define NAME_DEAD(n) (((n)->flags & NAME_IS_DEAD) != 0)
#define NAME_NEEDSPOKE(n) (((n)->flags & NAME_NEEDS_POKE) != 0)
#define NAME_GLUEOK(n) (((n)->flags & NAME_GLUE_OK) != 0)
......@@ -362,7 +362,7 @@ static void water(void *arg, int mark);
#define FIND_WANTEMPTYEVENT(fn) (((fn)->options & DNS_ADBFIND_EMPTYEVENT) != 0)
#define FIND_AVOIDFETCHES(fn) (((fn)->options & DNS_ADBFIND_AVOIDFETCHES) \
!= 0)
#define FIND_STARTATROOT(fn) (((fn)->options & DNS_ADBFIND_STARTATROOT) \
#define FIND_STARTATZONE(fn) (((fn)->options & DNS_ADBFIND_STARTATZONE) \
!= 0)
#define FIND_HINTOK(fn) (((fn)->options & DNS_ADBFIND_HINTOK) != 0)
#define FIND_GLUEOK(fn) (((fn)->options & DNS_ADBFIND_GLUEOK) != 0)
......@@ -386,8 +386,8 @@ static void water(void *arg, int mark);
#define GLUE_OK(nf, o) (!NAME_GLUEOK(nf) || (((o) & DNS_ADBFIND_GLUEOK) != 0))
#define HINT_OK(nf, o) (!NAME_HINTOK(nf) || (((o) & DNS_ADBFIND_HINTOK) != 0))
#define GLUEHINT_OK(nf, o) (GLUE_OK(nf, o) || HINT_OK(nf, o))
#define STARTATROOT_MATCHES(nf, o) (((nf)->flags & NAME_STARTATROOT) == \
((o) & DNS_ADBFIND_STARTATROOT))
#define STARTATZONE_MATCHES(nf, o) (((nf)->flags & NAME_STARTATZONE) == \
((o) & DNS_ADBFIND_STARTATZONE))
#define ENTER_LEVEL ISC_LOG_DEBUG(50)
#define EXIT_LEVEL ENTER_LEVEL
......@@ -1587,7 +1587,7 @@ find_name_and_lock(dns_adb_t *adb, dns_name_t *name,
if (!NAME_DEAD(adbname)) {
if (dns_name_equal(name, &adbname->name)
&& GLUEHINT_OK(adbname, options)
&& STARTATROOT_MATCHES(adbname, options))
&& STARTATZONE_MATCHES(adbname, options))
return (adbname);
}
adbname = ISC_LIST_NEXT(adbname, plink);
......@@ -2260,7 +2260,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
dns_adbfind_t *find;
dns_adbname_t *adbname;
int bucket;
isc_boolean_t want_event, start_at_root, alias, have_address;
isc_boolean_t want_event, start_at_zone, alias, have_address;
isc_result_t result;
unsigned int wanted_addresses;
unsigned int wanted_fetches;
......@@ -2282,7 +2282,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
wanted_fetches = 0;
query_pending = 0;
want_event = ISC_FALSE;
start_at_root = ISC_FALSE;
start_at_zone = ISC_FALSE;
alias = ISC_FALSE;
if (now == 0)
......@@ -2352,8 +2352,8 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
adbname->flags |= NAME_HINT_OK;
if (FIND_GLUEOK(find))
adbname->flags |= NAME_GLUE_OK;
if (FIND_STARTATROOT(find))
adbname->flags |= NAME_STARTATROOT;
if (FIND_STARTATZONE(find))
adbname->flags |= NAME_STARTATZONE;
}
/*
......@@ -2467,14 +2467,14 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
* be acceptable so we have to launch fetches.
*/
if (FIND_STARTATROOT(find))
start_at_root = ISC_TRUE;
if (FIND_STARTATZONE(find))
start_at_zone = ISC_TRUE;
/*
* Start V4.
*/
if (WANT_INET(wanted_fetches) &&
fetch_name(adbname, start_at_root,
fetch_name(adbname, start_at_zone,
dns_rdatatype_a) == ISC_R_SUCCESS) {
DP(DEF_LEVEL,
"dns_adb_createfind: started A fetch for name %p",
......@@ -2485,7 +2485,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
* Start V6.
*/
if (WANT_INET6(wanted_fetches) &&
fetch_name(adbname, start_at_root,
fetch_name(adbname, start_at_zone,
dns_rdatatype_aaaa) == ISC_R_SUCCESS) {
DP(DEF_LEVEL,
"dns_adb_createfind: "
......@@ -3222,12 +3222,13 @@ fetch_callback(isc_task_t *task, isc_event_t *ev) {
static isc_result_t
fetch_name(dns_adbname_t *adbname,
isc_boolean_t start_at_root,
isc_boolean_t start_at_zone,
dns_rdatatype_t type)
{
isc_result_t result;
dns_adbfetch_t *fetch = NULL;
dns_adb_t *adb;
dns_fixedname_t fixed;
dns_name_t *name;
dns_rdataset_t rdataset;
dns_rdataset_t *nameservers;
......@@ -3247,12 +3248,14 @@ fetch_name(dns_adbname_t *adbname,
dns_rdataset_init(&rdataset);
options = 0;
if (start_at_root) {
DP(50, "fetch_name: starting at DNS root for name %p",
if (start_at_zone) {
DP(50, "fetch_name: starting at zone for %p",
adbname);
name = dns_rootname;
result = dns_view_simplefind(adb->view, name, dns_rdatatype_ns,
0, 0, ISC_TRUE, &rdataset, NULL);
dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
result = dns_view_findzonecut2(adb->view, &adbname->name, name,
0, 0, ISC_TRUE, ISC_FALSE,
&rdataset, NULL);
if (result != ISC_R_SUCCESS && result != DNS_R_HINT)
goto cleanup;
nameservers = &rdataset;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: adb.h,v 1.72 2002/11/27 09:52:56 marka Exp $ */
/* $Id: adb.h,v 1.73 2003/02/26 22:54:29 marka Exp $ */
#ifndef DNS_ADB_H
#define DNS_ADB_H 1
......@@ -145,9 +145,9 @@ struct dns_adbfind {
* If set, fetches will not be generated unless no addresses are
* available in any of the address families requested.
*
* _STARTATROOT:
* Fetches will start at the root nameservers, instead of the closest
* ancestor. This is useful for reestablishing glue that has expired.
* _STARTATZONE:
* Fetches will start using the closest zone data or use the root servers.
* This is useful for reestablishing glue that has expired.
*
* _GLUEOK:
* _HINTOK:
......@@ -168,7 +168,7 @@ struct dns_adbfind {
#define DNS_ADBFIND_EMPTYEVENT 0x00000004
#define DNS_ADBFIND_WANTEVENT 0x00000008
#define DNS_ADBFIND_AVOIDFETCHES 0x00000010
#define DNS_ADBFIND_STARTATROOT 0x00000020
#define DNS_ADBFIND_STARTATZONE 0x00000020
#define DNS_ADBFIND_GLUEOK 0x00000040
#define DNS_ADBFIND_HINTOK 0x00000080
#define DNS_ADBFIND_RETURNLAME 0x00000100
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: view.h,v 1.80 2002/11/27 09:52:56 marka Exp $ */
/* $Id: view.h,v 1.81 2003/02/26 22:54:29 marka Exp $ */
#ifndef DNS_VIEW_H
#define DNS_VIEW_H 1
......@@ -513,6 +513,12 @@ dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
isc_stdtime_t now, unsigned int options,
isc_boolean_t use_hints,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
isc_result_t
dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
isc_stdtime_t now, unsigned int options,
isc_boolean_t use_hints, isc_boolean_t use_cache,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
/*
* Find the best known zonecut containing 'name'.
*
......@@ -526,6 +532,9 @@ dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
* If 'use_hints' is ISC_TRUE, and the view has a hints database, then
* it will be searched last.
*
* If 'use_cache' is ISC_TRUE, and the view has a cache, then it will be
* searched.
*
* If 'sigrdataset' is not NULL, and there is a SIG rdataset which
* covers 'type', then 'sigrdataset' will be bound to it.
*
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resolver.c,v 1.261 2003/02/26 02:03:59 marka Exp $ */
/* $Id: resolver.c,v 1.262 2003/02/26 22:54:28 marka Exp $ */
#include <config.h>
......@@ -1579,20 +1579,13 @@ findname(fetchctx_t *fctx, dns_name_t *name, in_port_t port,
unshared = ISC_TF((fctx->options | DNS_FETCHOPT_UNSHARED) != 0);
/*
* If this name is a subdomain of the query domain, tell
* the ADB to start looking at "." if it doesn't know the
* address. This keeps us from getting stuck if the
* nameserver is beneath the zone cut and we don't know its
* address (e.g. because the A record has expired).
* By restarting from ".", we ensure that any missing glue
* will be reestablished.
*
* A further optimization would be to get the ADB to start
* looking at the most enclosing zone cut above fctx->domain.
* We don't expect this situation to happen very frequently,
* so we've chosen the simple solution.
* the ADB to start looking using zone/hint data. This keeps us
* from getting stuck if the nameserver is beneath the zone cut
* and we don't know its address (e.g. because the A record has
* expired).
*/
if (dns_name_issubdomain(name, &fctx->domain))
options |= DNS_ADBFIND_STARTATROOT;
options |= DNS_ADBFIND_STARTATZONE;
options |= DNS_ADBFIND_GLUEOK;
options |= DNS_ADBFIND_HINTOK;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: view.c,v 1.114 2002/11/27 09:52:55 marka Exp $ */
/* $Id: view.c,v 1.115 2003/02/26 22:54:28 marka Exp $ */
#include <config.h>
......@@ -862,8 +862,19 @@ dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
isc_result_t
dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
isc_stdtime_t now, unsigned int options,
isc_boolean_t use_hints,
isc_boolean_t use_hints,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
{
return(dns_view_findzonecut2(view, name, fname, now, options,
use_hints, ISC_TRUE,
rdataset, sigrdataset));
}
isc_result_t
dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
isc_stdtime_t now, unsigned int options,
isc_boolean_t use_hints, isc_boolean_t use_cache,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
{
isc_result_t result;
dns_db_t *db;
......@@ -901,7 +912,7 @@ dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
* is it a subdomain of any zone for which we're
* authoritative.
*/
if (view->cachedb != NULL) {
if (use_cache && view->cachedb != NULL) {
/*
* We have a cache; try it.
*/
......@@ -932,7 +943,7 @@ dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
result = ISC_R_SUCCESS;
else if (result != ISC_R_SUCCESS)
goto cleanup;
if (view->cachedb != NULL && db != view->hints) {
if (use_cache && view->cachedb != NULL && db != view->hints) {
/*
* We found an answer, but the cache may be better.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment