From 3263f6fefca43a4da6abc550554342f5b251cc44 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 10 Feb 2015 15:54:07 -0500 Subject: [PATCH] ban abusing ipv6 addresses --- NTCPSession.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/NTCPSession.cpp b/NTCPSession.cpp index b770de58..aab7f9cd 100644 --- a/NTCPSession.cpp +++ b/NTCPSession.cpp @@ -901,7 +901,20 @@ namespace transport if (!ec) { LogPrint (eLogInfo, "Connected from ", ep); - conn->ServerLogin (); + auto it = m_BanList.find (ep.address ()); + if (it != m_BanList.end ()) + { + uint32_t ts = i2p::util::GetSecondsSinceEpoch (); + if (ts < it->second) + { + LogPrint (eLogInfo, ep.address (), " is banned for ", it->second - ts, " more seconds"); + conn = nullptr; + } + else + m_BanList.erase (it); + } + if (conn) + conn->ServerLogin (); } else LogPrint (eLogError, "Connected from error ", ec.message ());