From 12e7dfa397c92807bdc4e6f55918d46eb15e0600 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Thu, 6 Mar 2025 14:26:23 +0000 Subject: [PATCH] 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. --- lib/dns/resolver.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index d3c860e911..a470f27a70 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -7462,10 +7462,12 @@ resquery_response(isc_result_t eresult, isc_region_t *region, void *arg) { QTRACE("response"); - if (isc_sockaddr_pf(&query->addrinfo->sockaddr) == PF_INET) { - inc_stats(fctx->res, dns_resstatscounter_responsev4); - } else { - inc_stats(fctx->res, dns_resstatscounter_responsev6); + 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 = isc_mem_get(fctx->mctx, sizeof(*rctx));