]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use stale TTL as RRset TTL in dumpdb
authorMatthijs Mekking <matthijs@isc.org>
Fri, 12 Mar 2021 15:27:45 +0000 (16:27 +0100)
committerMatthijs Mekking <matthijs@isc.org>
Tue, 13 Apr 2021 08:59:17 +0000 (10:59 +0200)
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.

(cherry picked from commit a83c8cb0afd88d54b9cf67239f2495c9b0391e97)

bin/tests/system/serve-stale/tests.sh
lib/dns/masterdump.c
lib/dns/rbtdb.c
lib/dns/tests/db_test.c

index 08dd39fd1a196418a47c758bc957407a56cdc357..3c1ce67d9a81ed99dff9a886c8dc5ec1b2521016 100755 (executable)
@@ -112,10 +112,10 @@ sleep 2
 echo_i "check rndc dump stale data.example ($n)"
 rndc_dumpdb ns1 || ret=1
 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.
 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
 status=$((status+ret))
 
index 8a4eb4de473b997cf8d21a192e31f89e5a39d5f8..c8dcce5aa2c41d68da7903aacdd86c27e6a79545 100644 (file)
@@ -1108,10 +1108,7 @@ again:
                } else {
                        isc_result_t result;
                        if (STALE(rds)) {
-                               fprintf(f,
-                                       "; stale (will be retained for %u more "
-                                       "seconds)\n",
-                                       rds->stale_ttl);
+                               fprintf(f, "; stale\n");
                        } else if (ANCIENT(rds)) {
                                isc_buffer_t b;
                                char buf[sizeof("YYYYMMDDHHMMSS")];
index 6595b975206668b8d0853ca3e419656452d5b1fd..6e7d4f4a337500e22e1553b827b122ed0f53b231 100644 (file)
@@ -3161,7 +3161,7 @@ bind_rdataset(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rdatasetheader_t *header,
                }
                rdataset->attributes |= DNS_RDATASETATTR_STALE;
                rdataset->stale_ttl = stale_ttl;
-               rdataset->ttl = 0;
+               rdataset->ttl = stale_ttl;
        } else if (IS_CACHE(rbtdb) && !ACTIVE(header, now)) {
                rdataset->attributes |= DNS_RDATASETATTR_ANCIENT;
                rdataset->stale_ttl = header->rdh_ttl;
index c12e90ee1c159fddc812e1a89c0e9f777e0b88e5..e41a63c0cf469ed32e3ae433160bc59f88030e5a 100644 (file)
@@ -248,7 +248,6 @@ dns_dbfind_staleok_test(void **state) {
                                count++;
                                assert_in_range(count, 0, 49); /* loop sanity */
                                assert_int_equal(result, ISC_R_SUCCESS);
-                               assert_int_equal(rdataset.ttl, 0);
                                assert_int_equal(rdataset.attributes &
                                                         DNS_RDATASETATTR_STALE,
                                                 DNS_RDATASETATTR_STALE);