]> 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:08:55 +0000 (08:08 +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.

lib/dns/resolver.c

index 70fd0c204e6af50cde410a8bcac528cc2637afda..cc552ea33ac684500f4d483ba4f70b695c7bd55a 100644 (file)
@@ -2316,7 +2316,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
                resquery_senddone, resquery_response, query, &query->id,
                &query->dispentry);
        if (result != ISC_R_SUCCESS) {
-               goto cleanup_dispatch;
+               goto cleanup_udpfetch;
        }
 
        /* Connect the socket */
@@ -2327,6 +2327,14 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
 
        return (result);
 
+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:
        fctx_detach(&query->fctx);