From: Aram Sargsyan Date: Fri, 21 Oct 2022 08:08:55 +0000 (+0000) Subject: Call dns_adb_endudpfetch() on error path, if required X-Git-Tag: v9.18.9~17^2~1 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=64feeba60f3b058229594eeec1553b04ea94822d;p=thirdparty%2Fbind9.git Call dns_adb_endudpfetch() on error path, if required 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) --- diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 6e030b17b8f..5d26ebd0ff5 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -2279,7 +2279,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 */ @@ -2290,6 +2290,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);