]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Reuse rdatset->ttl when dumping ancient RRsets
authorMatthijs Mekking <matthijs@isc.org>
Thu, 27 May 2021 07:43:21 +0000 (09:43 +0200)
committerEvan Hunt <each@isc.org>
Sun, 30 May 2021 18:48:36 +0000 (11:48 -0700)
Rather than having an expensive 'expired' (fka 'stale_ttl') in the
rdataset structure, that is only used to be printed in a comment on
ancient RRsets, reuse the TTL field of the RRset.

lib/dns/include/dns/rdataset.h
lib/dns/masterdump.c
lib/dns/rbtdb.c

index 906edd0aa3a01addd1a5244bb2438db9211bd50b..2569e40d23a4622d72ea938a650f450d50e0b86a 100644 (file)
@@ -130,13 +130,6 @@ struct dns_rdataset {
         */
        isc_stdtime_t resign;
 
-       /*
-        * When a cache rdataset's TTL has expired but it hasn't been
-        * cleaned up yet, it will have this value set so that the time
-        * it expired can be printed by dns_master_dump*().
-        */
-       isc_stdtime_t expired;
-
        /*@{*/
        /*%
         * These are for use by the rdataset implementation, and MUST NOT
index 74ec7972bafab08fd7eb9efb0d7e4d96a67b7151..c66eb7ccebc19f2e10ec258fe9746c35c6ffa02a 100644 (file)
@@ -1109,12 +1109,12 @@ again:
                        isc_result_t result;
                        if (STALE(rds)) {
                                fprintf(f, "; stale\n");
-                       } else if (ANCIENT(rds) && rds->expired != 0) {
+                       } else if (ANCIENT(rds)) {
                                isc_buffer_t b;
                                char buf[sizeof("YYYYMMDDHHMMSS")];
                                memset(buf, 0, sizeof(buf));
                                isc_buffer_init(&b, buf, sizeof(buf) - 1);
-                               dns_time64_totext((uint64_t)rds->expired, &b);
+                               dns_time64_totext((uint64_t)rds->ttl, &b);
                                fprintf(f,
                                        "; expired since %s "
                                        "(awaiting cleanup)\n",
index f1074d3fd4de23a8bf64a96f79567d27fbf50b3f..4d37a36ba32ba90d40dfe3ed20e4165374296a41 100644 (file)
@@ -3135,7 +3135,6 @@ bind_rdataset(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rdatasetheader_t *header,
        rdataset->type = RBTDB_RDATATYPE_BASE(header->type);
        rdataset->covers = RBTDB_RDATATYPE_EXT(header->type);
        rdataset->ttl = header->rdh_ttl - now;
-       rdataset->expired = 0;
        rdataset->trust = header->trust;
 
        if (NEGATIVE(header)) {
@@ -3164,8 +3163,7 @@ bind_rdataset(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rdatasetheader_t *header,
                rdataset->attributes |= DNS_RDATASETATTR_STALE;
        } else if (IS_CACHE(rbtdb) && !ACTIVE(header, now)) {
                rdataset->attributes |= DNS_RDATASETATTR_ANCIENT;
-               rdataset->expired = header->rdh_ttl;
-               rdataset->ttl = 0;
+               rdataset->ttl = header->rdh_ttl;
        }
 
        rdataset->private1 = rbtdb;