]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Include expired rdatasets in iteration functions
authorMatthijs Mekking <matthijs@isc.org>
Thu, 13 Aug 2020 05:47:27 +0000 (07:47 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Wed, 23 Sep 2020 14:08:29 +0000 (16:08 +0200)
By changing the check in 'rdatasetiter_first' and 'rdatasetiter_next'
from "now > header->rdh_ttl" to "now - RBDTB_VIRTUAL > header->rdh_ttl"
we include expired rdataset entries so that they can be used for
"rndc dumpdb -expired".

lib/dns/rbtdb.c

index 5b9536efe3b400f010a82ba0088e75d3f18d8702..3218583c246c008ab7229868c3db9571d5b5d7d8 100644 (file)
@@ -9125,13 +9125,13 @@ rdatasetiter_first(dns_rdatasetiter_t *iterator) {
                                 *
                                 * Note: unlike everywhere else, we
                                 * check for now > header->rdh_ttl instead
-                                * of now >= header->rdh_ttl.  This allows
-                                * ANY and RRSIG queries for 0 TTL
-                                * rdatasets to work.
+                                * of ">=".  This allows ANY and RRSIG
+                                *  queries for 0 TTL rdatasets to work.
                                 */
                                if (NONEXISTENT(header) ||
                                    (now != 0 &&
-                                    now > header->rdh_ttl +
+                                    (now - RBTDB_VIRTUAL) >
+                                            header->rdh_ttl +
                                                     rbtdb->serve_stale_ttl))
                                {
                                        header = NULL;
@@ -9209,12 +9209,13 @@ rdatasetiter_next(dns_rdatasetiter_t *iterator) {
                                         *
                                         * Note: unlike everywhere else, we
                                         * check for now > header->ttl instead
-                                        * of now >= header->ttl.  This allows
-                                        * ANY and RRSIG queries for 0 TTL
-                                        * rdatasets to work.
+                                        * of ">=".  This allows ANY and RRSIG
+                                        * queries for 0 TTL rdatasets to work.
                                         */
                                        if (NONEXISTENT(header) ||
-                                           (now != 0 && now > header->rdh_ttl))
+                                           (now != 0 &&
+                                            (now - RBTDB_VIRTUAL) >
+                                                    header->rdh_ttl))
                                        {
                                                header = NULL;
                                        }