]> 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)
committerAram Sargsyan <aram@isc.org>
Mon, 31 Mar 2025 18:35:45 +0000 (18:35 +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.

(cherry picked from commit 12e7dfa397c92807bdc4e6f55918d46eb15e0600)

lib/dns/resolver.c

index 4d3491c4a9e5b94d93851148e9f10b60b74b5482..f8536e6f580ce6180bf424bb5fbfc45b66818636 100644 (file)
@@ -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);