mirror of
https://github.com/SWG-Source/src.git
synced 2026-01-17 00:04:25 -05:00
remove my currently unused code for blacklisting people as iptables seems to suffice
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
cmake-build*
|
||||||
*.geany
|
*.geany
|
||||||
PVS*
|
PVS*
|
||||||
*.cfg
|
*.cfg
|
||||||
|
|||||||
30
external/3rd/library/udplibrary/UdpLibrary.cpp
vendored
30
external/3rd/library/udplibrary/UdpLibrary.cpp
vendored
@@ -157,13 +157,6 @@ char *UdpIpAddress::GetAddress(char *buffer) const
|
|||||||
return(buffer);
|
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)
|
// 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
|
// 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
|
// 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
|
// packet telling them that we don't know who they are
|
||||||
@@ -1110,28 +1102,6 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e)
|
|||||||
con->Release();
|
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 *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const
|
||||||
{
|
{
|
||||||
UdpConnection *found = static_cast<UdpConnection *>(mAddressHashTable->FindFirst(AddressHashValue(ip, port)));
|
UdpConnection *found = static_cast<UdpConnection *>(mAddressHashTable->FindFirst(AddressHashValue(ip, port)));
|
||||||
|
|||||||
21
external/3rd/library/udplibrary/UdpLibrary.hpp
vendored
21
external/3rd/library/udplibrary/UdpLibrary.hpp
vendored
@@ -2,7 +2,6 @@
|
|||||||
#define UDPLIBRARY_HPP
|
#define UDPLIBRARY_HPP
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
#include "UdpHandler.hpp"
|
#include "UdpHandler.hpp"
|
||||||
#include "priority.hpp"
|
#include "priority.hpp"
|
||||||
@@ -101,7 +100,6 @@ class UdpIpAddress
|
|||||||
public:
|
public:
|
||||||
UdpIpAddress(unsigned int ip = 0);
|
UdpIpAddress(unsigned int ip = 0);
|
||||||
unsigned int GetAddress() const { return(mIp); }
|
unsigned int GetAddress() const { return(mIp); }
|
||||||
char *GetV4Address() const;
|
|
||||||
char *GetAddress(char *buffer) const;
|
char *GetAddress(char *buffer) const;
|
||||||
bool operator==(const UdpIpAddress& e) const { return(mIp == e.mIp); }
|
bool operator==(const UdpIpAddress& e) const { return(mIp == e.mIp); }
|
||||||
protected:
|
protected:
|
||||||
@@ -926,9 +924,6 @@ class UdpManager
|
|||||||
// to explicitly call this function.
|
// to explicitly call this function.
|
||||||
LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0);
|
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:
|
protected:
|
||||||
friend class PooledLogicalPacket;
|
friend class PooledLogicalPacket;
|
||||||
void PoolReturn(PooledLogicalPacket *packet); // so pooled packets can add themselves back to the pool
|
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
|
// typically it is recommended that all UdpConnection objects be destroyed before destroying this manager object
|
||||||
|
|
||||||
int mRefCount;
|
int mRefCount;
|
||||||
|
|
||||||
// number of strikes
|
|
||||||
static const int strikeOut = 3;
|
|
||||||
|
|
||||||
// actual count of connections for a given ip
|
|
||||||
std::unordered_map<unsigned int, int> mIpConnectionCount;
|
|
||||||
|
|
||||||
|
|
||||||
// count of strikes against a given ip - 3 successive DoS attempts and they are banned til next restart at best
|
|
||||||
std::unordered_map<unsigned int, int> blacklist;
|
|
||||||
|
|
||||||
// does what it says
|
|
||||||
void disconnectByIp (unsigned int);
|
|
||||||
|
|
||||||
// add a strike
|
|
||||||
void addStrike(UdpIpAddress clientIp, int type);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user