[master] "flushtree -all" no longer optional

Updated CHANGES note:
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]
This commit is contained in:
Evan Hunt 2013-06-30 18:53:48 -07:00
parent ea899f501b
commit 9d4ec6d2c5
7 changed files with 32 additions and 44 deletions

View file

@ -1,8 +1,7 @@
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]

View file

@ -7617,7 +7617,7 @@ ns_server_flushnode(ns_server_t *server, char *args, isc_boolean_t tree) {
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;
@ -7628,16 +7628,8 @@ ns_server_flushnode(ns_server_t *server, char *args, isc_boolean_t tree) {
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);
@ -7668,7 +7660,7 @@ ns_server_flushnode(ns_server_t *server, char *args, isc_boolean_t tree) {
* 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,

View file

@ -522,11 +522,8 @@
<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>

View file

@ -185,12 +185,12 @@ nrecords=`grep flushtest.example ns2/named_dump.db | grep -v '^;' | grep -Ew '(T
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

View file

@ -875,18 +875,12 @@ dns_view_flushcache2(dns_view_t *view, isc_boolean_t fixuponly);
*/
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.

View file

@ -8744,13 +8744,15 @@ dns_resolver_flushbadcache(dns_resolver_t *resolver, dns_name_t *name) {
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);
@ -8759,11 +8761,16 @@ dns_resolver_flushbadnames(dns_resolver_t *resolver, dns_name_t *name) {
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
@ -8778,7 +8785,6 @@ dns_resolver_flushbadnames(dns_resolver_t *resolver, dns_name_t *name) {
unlock:
UNLOCK(&resolver->lock);
}
static void

View file

@ -1556,31 +1556,31 @@ dns_view_flushcache2(dns_view_t *view, isc_boolean_t fixuponly) {
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