From: Remi Gacogne Date: Fri, 15 May 2026 14:51:11 +0000 (+0200) Subject: dnsdist: Keep concurrent connection entries for live connections X-Git-Tag: auth-5.1.0~34^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=74afa35cedb1f1698d638df8d227fd50b912f783;p=thirdparty%2Fpdns.git dnsdist: Keep concurrent connection entries for live connections Otherwise clients that manage to keep their connections around for a long time can bypass the limit. Signed-off-by: Remi Gacogne --- diff --git a/pdns/dnsdistdist/dnsdist-concurrent-connections.cc b/pdns/dnsdistdist/dnsdist-concurrent-connections.cc index dc414f2105..9db4b5a11f 100644 --- a/pdns/dnsdistdist/dnsdist-concurrent-connections.cc +++ b/pdns/dnsdistdist/dnsdist-concurrent-connections.cc @@ -160,9 +160,14 @@ void IncomingConcurrentTCPConnectionsManager::cleanup(time_t now) const auto interval = immutable.d_tcpConnectionsRatePerClientInterval; const auto cutOff = static_cast(now - (interval * 60U)); // interval in minutes for (auto& shard : s_tcpClientsConnectionMetrics) { - auto db = shard.lock(); - auto& index = db->get(); + auto clients = shard.lock(); + auto& index = clients->get(); for (auto entry = index.begin(); entry != index.end();) { + if (entry->d_concurrentConnections > 0) { + /* we need to keep this around as we still have open connections */ + ++entry; + continue; + } if (entry->d_lastSeen >= cutOff) { /* this index is ordered on timestamps, so the first valid entry we see means we are done */