]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix resolver responses statistics counter
authorAram Sargsyan <aram@isc.org>
Thu, 6 Mar 2025 14:26:23 +0000 (14:26 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Tue, 18 Mar 2025 16:20:59 +0000 (16:20 +0000)
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

index d3c860e9113ec8cee1074766542dc884e2a61b48..a470f27a7097683c41a29ab348edf3634f6e9f29 100644 (file)
@@ -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));