bool dumpcache;
bool dumpzones;
bool dumpadb;
- bool dumpbad;
bool dumpexpired;
bool dumpfail;
FILE *fp;
cfg_obj_log(obj, ISC_LOG_WARNING,
"disabling lame cache despite lame-ttl > 0 as it "
"may cause performance issues");
- lame_ttl = 0;
}
- dns_resolver_setlamettl(view->resolver, lame_ttl);
/*
* Set the resolver's query timeout.
}
} else {
result = dns_viewlist_findzone(&server->viewlist, name,
- (classtxt == NULL),
+ classtxt == NULL,
rdclass, zonep);
if (result == ISC_R_NOTFOUND) {
snprintf(problem, sizeof(problem),
}
}
- if ((dctx->dumpadb || dctx->dumpbad || dctx->dumpfail) &&
- dctx->cache == NULL && dctx->view->view->cachedb != NULL)
+ if ((dctx->dumpadb || dctx->dumpfail) && dctx->cache == NULL &&
+ dctx->view->view->cachedb != NULL)
{
dns_db_attach(dctx->view->view->cachedb, &dctx->cache);
}
dns_adb_detach(&adb);
}
}
- if (dctx->dumpbad) {
- dns_resolver_printbadcache(dctx->view->view->resolver,
- dctx->fp);
- }
if (dctx->dumpfail) {
dns_badcache_print(dctx->view->view->failcache,
"SERVFAIL cache", dctx->fp);
.mctx = server->mctx,
.dumpcache = true,
.dumpadb = true,
- .dumpbad = true,
.dumpfail = true,
.viewlist = ISC_LIST_INITIALIZER,
};
} else if (ptr != NULL && strcmp(ptr, "-zones") == 0) {
/* only dump zones, suppress caches */
dctx->dumpadb = false;
- dctx->dumpbad = false;
dctx->dumpcache = false;
dctx->dumpfail = false;
dctx->dumpzones = true;
ptr = next_token(lex, NULL);
} else if (ptr != NULL && strcmp(ptr, "-adb") == 0) {
/* only dump adb, suppress other caches */
- dctx->dumpbad = false;
dctx->dumpcache = false;
dctx->dumpfail = false;
ptr = next_token(lex, NULL);
} else if (ptr != NULL && strcmp(ptr, "-fail") == 0) {
/* only dump servfail cache, suppress other caches */
dctx->dumpadb = false;
- dctx->dumpbad = false;
dctx->dumpcache = false;
ptr = next_token(lex, NULL);
}
reload_status = atomic_load(&server->reload_status);
if (reload_status != NAMED_RELOAD_DONE) {
snprintf(line, sizeof(line), "reload/reconfig %s\n",
- (reload_status == NAMED_RELOAD_FAILED
- ? "failed"
- : "in progress"));
+ reload_status == NAMED_RELOAD_FAILED ? "failed"
+ : "in progress");
CHECK(putstr(text, line));
}
dns_dispatch_t *
dns_resolver_dispatchv6(dns_resolver_t *resolver);
-uint32_t
-dns_resolver_getlamettl(dns_resolver_t *resolver);
-/*%<
- * Get the resolver's lame-ttl. zero => no lame processing.
- *
- * Requires:
- *\li 'resolver' to be valid.
- */
-
-void
-dns_resolver_setlamettl(dns_resolver_t *resolver, uint32_t lame_ttl);
-/*%<
- * Set the resolver's lame-ttl. zero => no lame processing.
- *
- * Requires:
- *\li 'resolver' to be valid.
- */
-
void
dns_resolver_addalternate(dns_resolver_t *resolver, const isc_sockaddr_t *alt,
const dns_name_t *name, in_port_t port);
* \li resolver to be valid.
*/
-void
-dns_resolver_addbadcache(dns_resolver_t *resolver, const dns_name_t *name,
- dns_rdatatype_t type, isc_time_t *expire);
-/*%<
- * Add a entry to the bad cache for <name,type> that will expire at 'expire'.
- *
- * Requires:
- * \li resolver to be valid.
- * \li name to be valid.
- */
-
-isc_result_t
-dns_resolver_getbadcache(dns_resolver_t *resolver, const dns_name_t *name,
- dns_rdatatype_t type, isc_time_t *now);
-/*%<
- * Check to see if there is a unexpired entry in the bad cache for
- * <name,type>.
- *
- * Requires:
- * \li resolver to be valid.
- * \li name to be valid.
- */
-
-void
-dns_resolver_flushbadcache(dns_resolver_t *resolver, const dns_name_t *name);
-/*%<
- * Flush the bad cache of all entries at 'name' if 'name' is non NULL.
- * Flush the entire bad cache if 'name' is NULL.
- *
- * Requires:
- * \li resolver to be valid.
- */
-
-void
-dns_resolver_flushbadnames(dns_resolver_t *resolver, const dns_name_t *name);
-/*%<
- * Flush the bad cache of all entries at or below 'name'.
- *
- * Requires:
- * \li resolver to be valid.
- * \li name != NULL
- */
-
-void
-dns_resolver_printbadcache(dns_resolver_t *resolver, FILE *fp);
-/*%
- * Print out the contents of the bad cache to 'fp'.
- *
- * Requires:
- * \li resolver to be valid.
- */
-
void
dns_resolver_setmaxvalidations(dns_resolver_t *resolver, uint32_t max);
void
#include <dns/acl.h>
#include <dns/adb.h>
-#include <dns/badcache.h>
#include <dns/cache.h>
#include <dns/db.h>
#include <dns/dispatch.h>
*/
#define MAX_EDNS0_TIMEOUTS 3
-#define DNS_RESOLVER_BADCACHETTL(fctx) \
- (((fctx)->res->lame_ttl > 30) ? (fctx)->res->lame_ttl : 30)
-
typedef struct fetchctx fetchctx_t;
typedef struct query {
/* Locked by lock. */
unsigned int spillat; /* clients-per-query */
- dns_badcache_t *badcache; /* Bad cache. */
-
/* Locked by primelock. */
dns_fetch_t *primefetch;
static void
resquery_connected(isc_result_t eresult, isc_region_t *region, void *arg);
static void
-fctx_try(fetchctx_t *fctx, bool retrying, bool badcache);
+fctx_try(fetchctx_t *fctx, bool retrying);
static void
fctx_shutdown(void *arg);
static void
badns_unreachable);
fctx_cancelquery(©, NULL, true, false);
FCTX_ATTR_CLR(fctx, FCTX_ATTR_ADDRWAIT);
- fctx_try(fctx, true, false);
+ fctx_try(fctx, true);
break;
default:
fctx_cancelquery(©, NULL, true, false);
FCTX_ATTR_CLR(fctx, FCTX_ATTR_ADDRWAIT);
- fctx_try(fctx, true, false);
+ fctx_try(fctx, true);
break;
default:
fctx_done_unref(fctx, ISC_R_FAILURE);
} else if (want_try) {
- fctx_try(fctx, true, false);
+ fctx_try(fctx, true);
}
fetchctx_detach(&fctx);
}
static isc_result_t
-fctx_getaddresses(fetchctx_t *fctx, bool badcache) {
+fctx_getaddresses(fetchctx_t *fctx) {
dns_rdata_t rdata = DNS_RDATA_INIT;
isc_result_t result;
dns_resolver_t *res;
*/
result = DNS_R_WAIT;
} else {
- isc_time_t expire;
- isc_interval_t i;
/*
* We've lost completely. We don't know any
* addresses, and the ADB has told us it can't
* get them.
*/
FCTXTRACE("no addresses");
- isc_interval_set(&i, DNS_RESOLVER_BADCACHETTL(fctx), 0);
- result = isc_time_nowplusinterval(&expire, &i);
- if (badcache &&
- (fctx->type == dns_rdatatype_dnskey ||
- fctx->type == dns_rdatatype_ds) &&
- result == ISC_R_SUCCESS)
- {
- dns_resolver_addbadcache(res, fctx->name,
- fctx->type, &expire);
- }
result = ISC_R_FAILURE;
}
static void
-fctx_try(fetchctx_t *fctx, bool retrying, bool badcache) {
+fctx_try(fetchctx_t *fctx, bool retrying) {
isc_result_t result;
dns_adbaddrinfo_t *addrinfo = NULL;
dns_resolver_t *res = NULL;
/* We have no more addresses. Start over. */
fctx_cancelqueries(fctx, true, false);
fctx_cleanup(fctx);
- result = fctx_getaddresses(fctx, badcache);
+ result = fctx_getaddresses(fctx);
switch (result) {
case ISC_R_SUCCESS:
break;
fctx_cleanup(fctx);
}
- fctx_try(fctx, true, false);
+ fctx_try(fctx, true);
cleanup:
if (result != ISC_R_SUCCESS) {
* while a response is being processed normally.)
*/
fctx_starttimer(fctx);
- fctx_try(fctx, false, false);
+ fctx_try(fctx, false);
detach:
fetchctx_detach(&fctx);
done = true;
goto cleanup_fetchctx;
} else if (result == DNS_R_BROKENCHAIN) {
- isc_result_t tresult;
- isc_time_t expire;
- isc_interval_t i;
-
- isc_interval_set(&i, DNS_RESOLVER_BADCACHETTL(fctx), 0);
- tresult = isc_time_nowplusinterval(&expire, &i);
- if (negative &&
- (fctx->type == dns_rdatatype_dnskey ||
- fctx->type == dns_rdatatype_ds) &&
- tresult == ISC_R_SUCCESS)
- {
- dns_resolver_addbadcache(res, fctx->name,
- fctx->type, &expire);
- }
done = true;
goto cleanup_fetchctx;
} else {
- fctx_try(fctx, true, true);
+ fctx_try(fctx, true);
goto cleanup_fetchctx;
}
UNREACHABLE();
}
/* Try again. */
- fctx_try(fctx, true, false);
+ fctx_try(fctx, true);
break;
case ISC_R_SHUTTINGDOWN:
/*
* Try again.
*/
- fctx_try(fctx, retrying, false);
+ fctx_try(fctx, retrying);
}
/*
}
isc_mem_put(res->mctx, a, sizeof(*a));
}
- dns_badcache_destroy(&res->badcache);
dns_view_weakdetach(&res->view);
#endif
isc_refcount_init(&res->references, 1);
- res->badcache = dns_badcache_new(res->mctx, res->loopmgr);
-
isc_hashmap_create(view->mctx, RES_DOMAIN_HASH_BITS, &res->fctxs);
isc_rwlock_init(&res->fctxs_lock);
return dns_dispatchset_get(resolver->dispatches6);
}
-uint32_t
-dns_resolver_getlamettl(dns_resolver_t *resolver) {
- REQUIRE(VALID_RESOLVER(resolver));
- return resolver->lame_ttl;
-}
-
-void
-dns_resolver_setlamettl(dns_resolver_t *resolver, uint32_t lame_ttl) {
- REQUIRE(VALID_RESOLVER(resolver));
- resolver->lame_ttl = lame_ttl;
-}
-
void
dns_resolver_addalternate(dns_resolver_t *res, const isc_sockaddr_t *alt,
const dns_name_t *name, in_port_t port) {
ISC_LIST_APPEND(res->alternates, a, link);
}
-void
-dns_resolver_flushbadcache(dns_resolver_t *resolver, const dns_name_t *name) {
- if (name != NULL) {
- dns_badcache_flushname(resolver->badcache, name);
- } else {
- dns_badcache_flush(resolver->badcache);
- }
-}
-
-void
-dns_resolver_flushbadnames(dns_resolver_t *resolver, const dns_name_t *name) {
- dns_badcache_flushtree(resolver->badcache, name);
-}
-
-void
-dns_resolver_addbadcache(dns_resolver_t *resolver, const dns_name_t *name,
- dns_rdatatype_t type, isc_time_t *expire) {
-#ifdef ENABLE_AFL
- if (dns_fuzzing_resolver) {
- return;
- }
-#endif /* ifdef ENABLE_AFL */
-
- dns_badcache_add(resolver->badcache, name, type, 0,
- isc_time_seconds(expire));
-}
-
-isc_result_t
-dns_resolver_getbadcache(dns_resolver_t *resolver, const dns_name_t *name,
- dns_rdatatype_t type, isc_time_t *now) {
- return dns_badcache_find(resolver->badcache, name, type, NULL,
- isc_time_seconds(now));
-}
-
-void
-dns_resolver_printbadcache(dns_resolver_t *resolver, FILE *fp) {
- (void)dns_badcache_print(resolver->badcache, "Bad cache", fp);
-}
-
isc_result_t
dns_resolver_disable_algorithm(dns_resolver_t *resolver, const dns_name_t *name,
unsigned int alg) {