From 4af3695347fdddf10a97acb06b00f322aa890e2c Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Wed, 13 May 2026 13:08:38 +0200 Subject: [PATCH] Show BUG_CT_NEGATIVE_COUNTER also in non-DEBUGMODE and limit to 5:60. Not only that one, but all BUG_CT_* connthrottle "something isn't right here" messages. --- src/conf.c | 6 ++++++ src/modules/connthrottle.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/conf.c b/src/conf.c index c1c430c5b..0e51e0867 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1900,6 +1900,12 @@ void config_setdefaultsettings(Configuration *i) add_log_throttle_config(&i->log_throttle, "CONNTHROTTLE_IPV6_LIMIT", 100, 60, 0); add_log_throttle_config(&i->log_throttle, "MAXPERIP_LIMIT", 100, 60, 0); + add_log_throttle_config(&i->log_throttle, "BUG_CT_CHECK_DRIFT", 5, 60, 0); + add_log_throttle_config(&i->log_throttle, "BUG_CT_CHECK_NO_BUCKET", 5, 60, 0); + add_log_throttle_config(&i->log_throttle, "BUG_CT_CHECK_NO_IP", 5, 60, 0); + add_log_throttle_config(&i->log_throttle, "BUG_CT_BUCKET_MISSING", 5, 60, 0); + add_log_throttle_config(&i->log_throttle, "BUG_CT_NEGATIVE_COUNTER", 5, 60, 0); + add_log_throttle_config(&i->log_throttle, "BUG_DECREASE_IPUSERS_BUCKET", 5, 60, 0); /* TLS options */ i->tls_options = safe_alloc(sizeof(TLSOptions)); diff --git a/src/modules/connthrottle.c b/src/modules/connthrottle.c index fc8e84d6c..ed72d92a8 100644 --- a/src/modules/connthrottle.c +++ b/src/modules/connthrottle.c @@ -1116,7 +1116,6 @@ static void ct_bucket_decrement(ConnThrottleBucket *b, ConnThrottleCategory cate case CT_CATEGORY_EXCEPTED_UNKNOWNS: b->excepted_unknowns--; break; case CT_CATEGORY_UNKNOWN_USERS: b->unknown_users--; break; } -#ifdef DEBUGMODE if ((b->known_users < 0) || (b->excepted_unknowns < 0) || (b->unknown_users < 0)) { unreal_log(ULOG_ERROR, "connthrottle", "BUG_CT_NEGATIVE_COUNTER", NULL, @@ -1124,9 +1123,10 @@ static void ct_bucket_decrement(ConnThrottleBucket *b, ConnThrottleCategory cate log_data_integer("known", b->known_users), log_data_integer("excepted", b->excepted_unknowns), log_data_integer("unknown", b->unknown_users)); +#ifdef DEBUGMODE abort(); - } #endif + } } /** Classify a client into one of CT_CATEGORY_*.