From 8571f0c9f4381c24f01c6210794d8366d32ed04b Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 27 Dec 2016 00:00:02 -0600 Subject: [PATCH] remove my currently unused code for blacklisting people as iptables seems to suffice --- .gitignore | 1 + .../3rd/library/udplibrary/UdpLibrary.cpp | 30 ------------------- .../3rd/library/udplibrary/UdpLibrary.hpp | 21 ------------- 3 files changed, 1 insertion(+), 51 deletions(-) diff --git a/.gitignore b/.gitignore index b112824a..6bf76060 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +cmake-build* *.geany PVS* *.cfg diff --git a/external/3rd/library/udplibrary/UdpLibrary.cpp b/external/3rd/library/udplibrary/UdpLibrary.cpp index f8e7c870..8d41eb99 100755 --- a/external/3rd/library/udplibrary/UdpLibrary.cpp +++ b/external/3rd/library/udplibrary/UdpLibrary.cpp @@ -157,13 +157,6 @@ char *UdpIpAddress::GetAddress(char *buffer) const return(buffer); } -char *UdpIpAddress::GetV4Address() const -{ - struct sockaddr_in addr_serverUDP; - addr_serverUDP.sin_addr.s_addr = mIp; - return inet_ntoa(addr_serverUDP.sin_addr); -} - ///////////////////////////////////////////////////////////////////////////////////////////////////// // UdpManager::Params initializations constructor (ie. default values) ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1082,7 +1075,6 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) } } - // got a packet from somebody and we don't know who they are and the packet we got was not a connection request // just in case they are a previous client who thinks they are still connected, we will send them an internal // packet telling them that we don't know who they are @@ -1110,28 +1102,6 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) con->Release(); } -bool UdpManager::isBlacklisted(unsigned int clientAddr) -{ - return false; -} - -void UdpManager::disconnectByIp(unsigned int clientAddr) -{ - while (mConnectionList != nullptr) - { - if (mConnectionList->mIp.GetAddress() == clientAddr) - { - mConnectionList->SetSilentDisconnect(true); - mConnectionList->InternalDisconnect(0, UdpConnection::cDisconnectReasonDosAttack); - - } - } -} - -void UdpManager::addStrike(UdpIpAddress clientIp, int type) -{ -} - UdpConnection *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const { UdpConnection *found = static_cast(mAddressHashTable->FindFirst(AddressHashValue(ip, port))); diff --git a/external/3rd/library/udplibrary/UdpLibrary.hpp b/external/3rd/library/udplibrary/UdpLibrary.hpp index 52922dab..3117e386 100644 --- a/external/3rd/library/udplibrary/UdpLibrary.hpp +++ b/external/3rd/library/udplibrary/UdpLibrary.hpp @@ -2,7 +2,6 @@ #define UDPLIBRARY_HPP #include -#include #include "UdpHandler.hpp" #include "priority.hpp" @@ -101,7 +100,6 @@ class UdpIpAddress public: UdpIpAddress(unsigned int ip = 0); unsigned int GetAddress() const { return(mIp); } - char *GetV4Address() const; char *GetAddress(char *buffer) const; bool operator==(const UdpIpAddress& e) const { return(mIp == e.mIp); } protected: @@ -926,9 +924,6 @@ class UdpManager // to explicitly call this function. LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); - // is the given unsigned int expressed ip blacklisted? - bool isBlacklisted(unsigned int); - protected: friend class PooledLogicalPacket; void PoolReturn(PooledLogicalPacket *packet); // so pooled packets can add themselves back to the pool @@ -1045,22 +1040,6 @@ class UdpManager // typically it is recommended that all UdpConnection objects be destroyed before destroying this manager object int mRefCount; - - // number of strikes - static const int strikeOut = 3; - - // actual count of connections for a given ip - std::unordered_map mIpConnectionCount; - - - // count of strikes against a given ip - 3 successive DoS attempts and they are banned til next restart at best - std::unordered_map blacklist; - - // does what it says - void disconnectByIp (unsigned int); - - // add a strike - void addStrike(UdpIpAddress clientIp, int type); }; ////////////////////////////////////////////////////////////////////////////////////////////////////////////