From: Mark Andrews Date: Thu, 18 May 2006 03:14:03 +0000 (+0000) Subject: 2026. [bug] Rate limit the two recursive client exceeded messages. X-Git-Tag: v9.4.0a6~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86c440366689904d44eacb88e80eff4fcef541a4;p=thirdparty%2Fbind9.git 2026. [bug] Rate limit the two recursive client exceeded messages. [RT #16044] --- diff --git a/CHANGES b/CHANGES index db7e253db78..c6864ac0281 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2026. [bug] Rate limit the two recursive client exceeded messages. + [RT #16044] + 2025. [func] Update "zone serial unchanged" message. [RT #16026] 2024. [bug] named emited spurious "zone serial unchanged" diff --git a/bin/named/query.c b/bin/named/query.c index 4ff81368cce..2a65957a0f8 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.257.18.29 2006/05/16 03:28:16 marka Exp $ */ +/* $Id: query.c,v 1.257.18.30 2006/05/18 03:14:03 marka Exp $ */ /*! \file */ @@ -2958,17 +2958,31 @@ query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qdomain, result = isc_quota_attach(&ns_g_server->recursionquota, &client->recursionquota); if (result == ISC_R_SOFTQUOTA) { - ns_client_log(client, NS_LOGCATEGORY_CLIENT, - NS_LOGMODULE_QUERY, ISC_LOG_WARNING, - "recursive-clients soft limit exceeded, " - "aborting oldest query"); + static isc_stdtime_t last = 0; + isc_stdtime_t now; + isc_stdtime_get(&now); + if (now != last) { + last = now; + ns_client_log(client, NS_LOGCATEGORY_CLIENT, + NS_LOGMODULE_QUERY, + ISC_LOG_WARNING, + "recursive-clients soft limit " + "exceeded, aborting oldest query"); + } ns_client_killoldestquery(client); result = ISC_R_SUCCESS; } else if (result == ISC_R_QUOTA) { - ns_client_log(client, NS_LOGCATEGORY_CLIENT, - NS_LOGMODULE_QUERY, ISC_LOG_WARNING, - "no more recursive clients: %s", - isc_result_totext(result)); + static isc_stdtime_t last = 0; + isc_stdtime_t now; + isc_stdtime_get(&now); + if (now != last) { + last = now; + ns_client_log(client, NS_LOGCATEGORY_CLIENT, + NS_LOGMODULE_QUERY, + ISC_LOG_WARNING, + "no more recursive clients: %s", + isc_result_totext(result)); + } ns_client_killoldestquery(client); } if (result == ISC_R_SUCCESS && !client->mortal &&