From: Aram Sargsyan Date: Thu, 6 Mar 2025 14:26:23 +0000 (+0000) Subject: Fix resolver responses statistics counter X-Git-Tag: v9.18.36~7^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a3ba4856a3fe30b4748ff062382e8aa080856ae;p=thirdparty%2Fbind9.git Fix resolver responses statistics counter The resquery_response() function increases the response counter without checking if the response was successful. Increase the counter only when the result indicates success. (cherry picked from commit 12e7dfa397c92807bdc4e6f55918d46eb15e0600) --- diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 4d3491c4a9e..f8536e6f580 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -7943,12 +7943,12 @@ resquery_response(isc_result_t eresult, isc_region_t *region, void *arg) { if (result == ISC_R_COMPLETE) { return; } - } - - if (isc_sockaddr_pf(&query->addrinfo->sockaddr) == PF_INET) { - inc_stats(fctx->res, dns_resstatscounter_responsev4); - } else { - inc_stats(fctx->res, dns_resstatscounter_responsev6); + } else if (eresult == ISC_R_SUCCESS) { + if (isc_sockaddr_pf(&query->addrinfo->sockaddr) == PF_INET) { + inc_stats(fctx->res, dns_resstatscounter_responsev4); + } else { + inc_stats(fctx->res, dns_resstatscounter_responsev6); + } } rctx_respinit(query, fctx, eresult, region, &rctx);