]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Exempt prefetches from the fetches-per-server quota
authorAram Sargsyan <aram@isc.org>
Fri, 7 Jun 2024 16:24:00 +0000 (16:24 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Mon, 26 Aug 2024 15:50:21 +0000 (15:50 +0000)
Give prefetches a free pass through the quota so that the cache
entries for popular zones could be updated successfully even if the
quota for is already reached.

lib/dns/adb.c
lib/dns/include/dns/adb.h
lib/dns/resolver.c

index 52568129f9d490924dac52885a84f575178d1170..6e63965982ae5676604fa6ca674478efd1a35c9a 100644 (file)
@@ -1478,7 +1478,9 @@ copy_namehook_lists(dns_adb_t *adb, dns_adbfind_t *find, dns_adbname_t *name) {
                        dns_adbaddrinfo_t *addrinfo = NULL;
                        entry = namehook->entry;
 
-                       if (adbentry_overquota(entry)) {
+                       if ((find->options & DNS_ADBFIND_QUOTAEXEMPT) == 0 &&
+                           adbentry_overquota(entry))
+                       {
                                find->options |= DNS_ADBFIND_OVERQUOTA;
                                goto nextv4;
                        }
@@ -1500,7 +1502,9 @@ copy_namehook_lists(dns_adb_t *adb, dns_adbfind_t *find, dns_adbname_t *name) {
                        dns_adbaddrinfo_t *addrinfo = NULL;
                        entry = namehook->entry;
 
-                       if (adbentry_overquota(entry)) {
+                       if ((find->options & DNS_ADBFIND_QUOTAEXEMPT) == 0 &&
+                           adbentry_overquota(entry))
+                       {
                                find->options |= DNS_ADBFIND_OVERQUOTA;
                                goto nextv6;
                        }
index cf725b62fc816d9ab5bf60814ca2a886e662e984..65acb09ccf3a31029084545aeb11b5a851a6da21 100644 (file)
@@ -179,6 +179,10 @@ struct dns_adbfind {
  *     This is useful for reestablishing glue that has expired.
  */
 #define DNS_ADBFIND_STARTATZONE 0x00000020
+/*%
+ *     Fetches will be exempted from the quota.
+ */
+#define DNS_ADBFIND_QUOTAEXEMPT 0x00000040
 /*%
  *      The server's fetch quota is exceeded; it will be treated as
  *      lame for this query.
index b1c98f2faa82b74c4dc616af630864bfac3d9288..6a96aae5d9a94f6196618a7af32417418e2115b9 100644 (file)
@@ -3257,6 +3257,13 @@ findname(fetchctx_t *fctx, const dns_name_t *name, in_port_t port,
                options |= DNS_ADBFIND_STARTATZONE;
        }
 
+       /*
+        * Exempt prefetches from ADB quota.
+        */
+       if ((fctx->options & DNS_FETCHOPT_PREFETCH) != 0) {
+               options |= DNS_ADBFIND_QUOTAEXEMPT;
+       }
+
        /*
         * See what we know about this address.
         */