mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
Print in dump-file stale ttl
This change makes rndc dumpdb correctly print the "; stale" line. It also provides extra information on how long this data may still be served to clients (in other words how long the stale RRset may still be used).
This commit is contained in:
committed by
Evan Hunt
parent
9a58b25f7f
commit
924ebc605d
@@ -81,6 +81,9 @@ struct dns_master_style {
|
||||
*/
|
||||
#define DNS_TOTEXT_LINEBREAK_MAXLEN 100
|
||||
|
||||
/*% Does the rdataset 'r' contain a stale answer? */
|
||||
#define STALE(r) (((r)->attributes & DNS_RDATASETATTR_STALE) != 0)
|
||||
|
||||
/*%
|
||||
* Context structure for a masterfile dump in progress.
|
||||
*/
|
||||
@@ -1040,8 +1043,11 @@ dump_rdatasets_text(isc_mem_t *mctx, const dns_name_t *name,
|
||||
/* Omit negative cache entries */
|
||||
} else {
|
||||
isc_result_t result;
|
||||
if (rds->ttl < ctx->serve_stale_ttl)
|
||||
fprintf(f, "; stale\n");
|
||||
if (STALE(rds)) {
|
||||
fprintf(f, "; stale (for %u more seconds)\n",
|
||||
(rds->stale_ttl -
|
||||
ctx->serve_stale_ttl));
|
||||
}
|
||||
result = dump_rdataset(mctx, name, rds, ctx, buffer, f);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
dumpresult = result;
|
||||
@@ -1509,13 +1515,14 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
|
||||
|
||||
dctx->do_date = dns_db_iscache(dctx->db);
|
||||
if (dctx->do_date) {
|
||||
/*
|
||||
* Adjust the date backwards by the serve-stale TTL, if any.
|
||||
* This is so the TTL will be loaded correctly when next started.
|
||||
*/
|
||||
(void)dns_db_getservestalettl(dctx->db,
|
||||
&dctx->tctx.serve_stale_ttl);
|
||||
dctx->now -= dctx->tctx.serve_stale_ttl;
|
||||
/*
|
||||
* Adjust the date backwards by the serve-stale TTL, if any.
|
||||
* This is so the TTL will be loaded correctly when next
|
||||
* started.
|
||||
*/
|
||||
(void)dns_db_getservestalettl(dctx->db,
|
||||
&dctx->tctx.serve_stale_ttl);
|
||||
dctx->now -= dctx->tctx.serve_stale_ttl;
|
||||
}
|
||||
|
||||
if (dctx->format == dns_masterformat_text &&
|
||||
|
Reference in New Issue
Block a user