]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Call dns_adb_endudpfetch() on error path, if required
authorAram Sargsyan <aram@isc.org>
Fri, 21 Oct 2022 08:08:55 +0000 (08:08 +0000)
committerAram Sargsyan <aram@isc.org>
Fri, 21 Oct 2022 08:46:43 +0000 (08:46 +0000)
For UDP queries, after calling dns_adb_beginudpfetch() in fctx_query(),
make sure that dns_adb_endudpfetch() is also called on error path, in
order to adjust the quota back.

(cherry picked from commit 5da79e2be01700c1dd01e5a3f69617129036bb02)

lib/dns/resolver.c

index 73a0ee9f7795d456d1a8feb291a40d4fc56253f8..f01231d41a97975aa82f7b909e7983fa6735c7c5 100644 (file)
@@ -2309,7 +2309,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
 
                result = resquery_send(query);
                if (result != ISC_R_SUCCESS) {
-                       goto cleanup_dispatch;
+                       goto cleanup_udpfetch;
                }
        }
 
@@ -2335,6 +2335,14 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
 cleanup_socket:
        isc_socket_detach(&query->tcpsocket);
 
+cleanup_udpfetch:
+       if (!RESQUERY_CANCELED(query)) {
+               if ((query->options & DNS_FETCHOPT_TCP) == 0) {
+                       /* Inform the ADB that we're ending a UDP fetch */
+                       dns_adb_endudpfetch(fctx->adb, addrinfo);
+               }
+       }
+
 cleanup_dispatch:
        if (query->dispatch != NULL) {
                dns_dispatch_detach(&query->dispatch);