mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
Use stale TTL as RRset TTL in dumpdb
It is more intuitive to have the countdown 'max-stale-ttl' as the RRset TTL, instead of 0 TTL. This information was already available in a comment "; stale (will be retained for x more seconds", but Support suggested to put it in the TTL field instead.
This commit is contained in:
@@ -111,10 +111,10 @@ sleep 2
|
|||||||
echo_i "check rndc dump stale data.example ($n)"
|
echo_i "check rndc dump stale data.example ($n)"
|
||||||
rndc_dumpdb ns1 || ret=1
|
rndc_dumpdb ns1 || ret=1
|
||||||
awk '/; stale/ { x=$0; getline; print x, $0}' ns1/named_dump.db.test$n |
|
awk '/; stale/ { x=$0; getline; print x, $0}' ns1/named_dump.db.test$n |
|
||||||
grep "; stale (will be retained for 3[56].. more seconds) data\.example.*A text record with a 2 second ttl" > /dev/null 2>&1 || ret=1
|
grep "; stale data\.example.*3[56]...*TXT.*A text record with a 2 second ttl" > /dev/null 2>&1 || ret=1
|
||||||
# Also make sure the not expired data does not have a stale comment.
|
# Also make sure the not expired data does not have a stale comment.
|
||||||
awk '/; answer/ { x=$0; getline; print x, $0}' ns1/named_dump.db.test$n |
|
awk '/; answer/ { x=$0; getline; print x, $0}' ns1/named_dump.db.test$n |
|
||||||
grep "; answer longttl\.example.*A text record with a 600 second ttl" > /dev/null 2>&1 || ret=1
|
grep "; answer longttl\.example.*[56]...*TXT.*A text record with a 600 second ttl" > /dev/null 2>&1 || ret=1
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=$((status+ret))
|
status=$((status+ret))
|
||||||
|
|
||||||
|
@@ -1108,10 +1108,7 @@ again:
|
|||||||
} else {
|
} else {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
if (STALE(rds)) {
|
if (STALE(rds)) {
|
||||||
fprintf(f,
|
fprintf(f, "; stale\n");
|
||||||
"; stale (will be retained for %u more "
|
|
||||||
"seconds)\n",
|
|
||||||
rds->stale_ttl);
|
|
||||||
} else if (ANCIENT(rds)) {
|
} else if (ANCIENT(rds)) {
|
||||||
isc_buffer_t b;
|
isc_buffer_t b;
|
||||||
char buf[sizeof("YYYYMMDDHHMMSS")];
|
char buf[sizeof("YYYYMMDDHHMMSS")];
|
||||||
|
@@ -3160,7 +3160,7 @@ bind_rdataset(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rdatasetheader_t *header,
|
|||||||
}
|
}
|
||||||
rdataset->attributes |= DNS_RDATASETATTR_STALE;
|
rdataset->attributes |= DNS_RDATASETATTR_STALE;
|
||||||
rdataset->stale_ttl = stale_ttl;
|
rdataset->stale_ttl = stale_ttl;
|
||||||
rdataset->ttl = 0;
|
rdataset->ttl = stale_ttl;
|
||||||
} else if (IS_CACHE(rbtdb) && !ACTIVE(header, now)) {
|
} else if (IS_CACHE(rbtdb) && !ACTIVE(header, now)) {
|
||||||
rdataset->attributes |= DNS_RDATASETATTR_ANCIENT;
|
rdataset->attributes |= DNS_RDATASETATTR_ANCIENT;
|
||||||
rdataset->stale_ttl = header->rdh_ttl;
|
rdataset->stale_ttl = header->rdh_ttl;
|
||||||
|
@@ -248,7 +248,6 @@ dns_dbfind_staleok_test(void **state) {
|
|||||||
count++;
|
count++;
|
||||||
assert_in_range(count, 0, 49); /* loop sanity */
|
assert_in_range(count, 0, 49); /* loop sanity */
|
||||||
assert_int_equal(result, ISC_R_SUCCESS);
|
assert_int_equal(result, ISC_R_SUCCESS);
|
||||||
assert_int_equal(rdataset.ttl, 0);
|
|
||||||
assert_int_equal(rdataset.attributes &
|
assert_int_equal(rdataset.attributes &
|
||||||
DNS_RDATASETATTR_STALE,
|
DNS_RDATASETATTR_STALE,
|
||||||
DNS_RDATASETATTR_STALE);
|
DNS_RDATASETATTR_STALE);
|
||||||
|
Reference in New Issue
Block a user