diff --git a/CHANGES b/CHANGES index d9f060c3e2..4b93b761a0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +5249. [bug] Fix a possible underflow in recursion clients + statistics when hitting recursive clients + soft quota. [GL #1067] + 5248. [func] To clarify the configuration of DNSSEC keys, the "managed-keys" and "trusted-keys" options have both been deprecated. The new "dnssec-keys" diff --git a/lib/ns/query.c b/lib/ns/query.c index 06f2b2fb27..d990f4a150 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -2487,12 +2487,18 @@ query_prefetch(ns_client_t *client, dns_name_t *qname, if (client->recursionquota == NULL) { result = isc_quota_attach(&client->sctx->recursionquota, &client->recursionquota); - if (result == ISC_R_SUCCESS && !client->mortal && !TCP(client)) + if (result == ISC_R_SUCCESS || result == ISC_R_SOFTQUOTA) { + ns_stats_increment(client->sctx->nsstats, + ns_statscounter_recursclients); + } + if (result == ISC_R_SUCCESS && !client->mortal && + !TCP(client)) + { result = ns_client_replace(client); - if (result != ISC_R_SUCCESS) + } + if (result != ISC_R_SUCCESS) { return; - ns_stats_increment(client->sctx->nsstats, - ns_statscounter_recursclients); + } } tmprdataset = ns_client_newrdataset(client); @@ -2694,12 +2700,18 @@ query_rpzfetch(ns_client_t *client, dns_name_t *qname, dns_rdatatype_t type) { if (client->recursionquota == NULL) { result = isc_quota_attach(&client->sctx->recursionquota, &client->recursionquota); - if (result == ISC_R_SUCCESS && !client->mortal && !TCP(client)) + if (result == ISC_R_SUCCESS || result == ISC_R_SOFTQUOTA) { + ns_stats_increment(client->sctx->nsstats, + ns_statscounter_recursclients); + } + if (result == ISC_R_SUCCESS && !client->mortal && + !TCP(client)) + { result = ns_client_replace(client); - if (result != ISC_R_SUCCESS) + } + if (result != ISC_R_SUCCESS) { return; - ns_stats_increment(client->sctx->nsstats, - ns_statscounter_recursclients); + } } tmprdataset = ns_client_newrdataset(client); @@ -5720,9 +5732,10 @@ ns_query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname, if (client->recursionquota == NULL) { result = isc_quota_attach(&client->sctx->recursionquota, &client->recursionquota); - - ns_stats_increment(client->sctx->nsstats, - ns_statscounter_recursclients); + if (result == ISC_R_SUCCESS || result == ISC_R_SOFTQUOTA) { + ns_stats_increment(client->sctx->nsstats, + ns_statscounter_recursclients); + } if (result == ISC_R_SOFTQUOTA) { static atomic_uint_fast32_t last = 0;