-3606. [func] "rndc flushtree -all" flushes matching
- records in the ADB and bad cache as well as
- the DNS cache. (Without the "-all" option,
- flushtree will still only flush records from
- the DNS cache.) [RT #33970]
+3606. [func] "rndc flushtree" now flushes matching
+ records in the address database and bad cache
+ as well as the DNS cache. (Previously only the
+ DNS cache was flushed.) [RT #33970]
3605. [port] win32: Addressed several compatibility issues
with newer versions of Visual Studio. [RT #33916]
char *target, *viewname;
dns_view_t *view;
isc_boolean_t flushed;
- isc_boolean_t found, all = ISC_FALSE;
+ isc_boolean_t found;
isc_result_t result;
isc_buffer_t b;
dns_fixedname_t fixed;
if (target == NULL)
return (ISC_R_UNEXPECTEDEND);
- target = next_token(&args, " \t");
- if (target == NULL)
- return (ISC_R_UNEXPECTEDEND);
-
- if (strcmp(target, "-all") == 0) {
- all = ISC_TRUE;
- target = next_token(&args, " \t");
- }
-
/* Find the domain name to flush. */
+ target = next_token(&args, " \t");
if (target == NULL)
return (ISC_R_UNEXPECTEDEND);
* if some of the views share a single cache. But since the
* operation is lightweight we prefer simplicity here.
*/
- result = dns_view_flushnode(view, name, tree, all);
+ result = dns_view_flushnode(view, name, tree);
if (result != ISC_R_SUCCESS) {
flushed = ISC_FALSE;
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
<listitem>
<para>
Flushes the given name, and all of its subdomains,
- from the server's DNS cache. By default, this does
- <emphasis>not</emphasis> affect the server's address
- database or bad-server cache. To eliminate matching
- names from those databases as well, use
- the <option>-all</option> option.
+ from the server's DNS cache, the address database,
+ and the bad server cache.
</para>
</listitem>
</varlistentry>
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
-echo "I:check flushtree -all clears adb correctly"
+echo "I:check flushtree clears adb correctly"
ret=0
load_cache
dump_cache
awk '/Address database/ {getline; getline; if ($2 == "ns.flushtest.example") exit(0); exit(1); }' ns2/named_dump.db || ret=1
-$RNDC $RNDCOPTS flushtree -all flushtest.example || ret=1
+$RNDC $RNDCOPTS flushtree flushtest.example || ret=1
dump_cache
awk '/Address database/ {getline; getline; if ($2 == "ns.flushtest.example") exit(1); exit(0); }' ns2/named_dump.db || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
*/
isc_result_t
-dns_view_flushnode(dns_view_t *view, dns_name_t *name,
- isc_boolean_t cachetree, isc_boolean_t all);
+dns_view_flushnode(dns_view_t *view, dns_name_t *name, isc_boolean_t tree);
/*%<
* Flush the given name from the view's cache (and optionally ADB/badcache).
*
- * If 'cachetree' or 'all' is true, flush 'name' and all names below it
- * from the cache.
- * If 'all' is true, flush 'name' and all names below it from the ADB
- * and badcache.
- *
- * If 'cachetree' and 'all' are false, flush 'name' from both the
- * cache and ADB, but do not touch any other nodes.
+ * Flush the given name from the cache, ADB, and bad cache. If 'tree'
+ * is true, also flush all subdomains of 'name'.
*
* Requires:
*\li 'view' is valid.
unlock:
UNLOCK(&resolver->lock);
-
}
void
dns_resolver_flushbadnames(dns_resolver_t *resolver, dns_name_t *name) {
dns_badcache_t *bad, *prev, *next;
unsigned int i;
+ int n;
+ isc_time_t now;
+ isc_result_t result;
REQUIRE(VALID_RESOLVER(resolver));
REQUIRE(name != NULL);
if (resolver->badcache == NULL)
goto unlock;
+ result = isc_time_now(&now);
+ if (result != ISC_R_SUCCESS)
+ isc_time_settoepoch(&now);
+
for (i = 0; i < resolver->badhash; i++) {
prev = NULL;
for (bad = resolver->badcache[i]; bad != NULL; bad = next) {
next = bad->next;
- if (dns_name_issubdomain(&bad->name, name)) {
+ n = isc_time_compare(&bad->expire, &now);
+ if (n < 0 || dns_name_issubdomain(&bad->name, name)) {
if (prev == NULL)
resolver->badcache[i] = bad->next;
else
unlock:
UNLOCK(&resolver->lock);
-
}
static void
isc_result_t
dns_view_flushname(dns_view_t *view, dns_name_t *name) {
- return (dns_view_flushnode(view, name, ISC_FALSE, ISC_FALSE));
+ return (dns_view_flushnode(view, name, ISC_FALSE));
}
isc_result_t
-dns_view_flushnode(dns_view_t *view, dns_name_t *name,
- isc_boolean_t cachetree, isc_boolean_t all)
-{
+dns_view_flushnode(dns_view_t *view, dns_name_t *name, isc_boolean_t tree) {
+ isc_result_t result = ISC_R_SUCCESS;
REQUIRE(DNS_VIEW_VALID(view));
- if (all) {
+ if (tree) {
if (view->adb != NULL)
dns_adb_flushnames(view->adb, name);
if (view->resolver != NULL)
dns_resolver_flushbadnames(view->resolver, name);
- } else if (!cachetree) {
+ } else {
if (view->adb != NULL)
dns_adb_flushname(view->adb, name);
- if (view->cache == NULL)
- return (ISC_R_SUCCESS);
if (view->resolver != NULL)
dns_resolver_flushbadcache(view->resolver, name);
}
- return (dns_cache_flushnode(view->cache, name, cachetree || all));
+ if (view->cache != NULL)
+ result = dns_cache_flushnode(view->cache, name, tree);
+
+ return (result);
}
isc_result_t