]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix find_coveringnsec in qpcache.c
authorMark Andrews <marka@isc.org>
Tue, 15 Jul 2025 05:14:23 +0000 (15:14 +1000)
committerMark Andrews <marka@isc.org>
Mon, 21 Jul 2025 15:05:50 +0000 (17:05 +0200)
dns_qp_lookup was returning ISC_R_NOTFOUND rather than DNS_R_PARTIALMATCH
when there wasn't a parent with a NSEC record in the cache.  This was
causing find_coveringnsec to fail rather than returing the covering NSEC.

lib/dns/qpcache.c

index 7e685318b88d3b654cd1f2dc98fe876dc9e149bd..eaafdfcf5d27e35bc14a8736a3b50a4fb4f961d0 100644 (file)
@@ -1397,7 +1397,13 @@ find_coveringnsec(qpc_search_t *search, const dns_name_t *name,
         */
        result = dns_qp_lookup(search->qpdb->nsec, name, DNS_DBNAMESPACE_NSEC,
                               NULL, &iter, NULL, (void **)&node, NULL);
-       if (result != DNS_R_PARTIALMATCH) {
+       /*
+        * When DNS_R_PARTIALMATCH or ISC_R_NOTFOUND is returned from
+        * dns_qp_lookup there is potentially a covering NSEC present
+        * in the cache so we need to search for it.  Otherwise we are
+        * done here.
+        */
+       if (result != DNS_R_PARTIALMATCH && result != ISC_R_NOTFOUND) {
                return ISC_R_NOTFOUND;
        }