mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9573] Add config option Network.KickOnBadPacket. If enabled, player will be kicked on badly formatted (wrong structure) packet.
This commit is contained in:
parent
bd6d27998b
commit
8f0da43638
6 changed files with 30 additions and 5 deletions
|
|
@ -725,6 +725,8 @@ void World::LoadConfigSettings(bool reload)
|
|||
|
||||
setConfig(CONFIG_BOOL_OFFHAND_CHECK_AT_TALENTS_RESET, "OffhandCheckAtTalentsReset", false);
|
||||
|
||||
setConfig(CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET, "Network.KickOnBadPacket", false);
|
||||
|
||||
if(int clientCacheId = sConfig.GetIntDefault("ClientCacheVersion", 0))
|
||||
{
|
||||
// overwrite DB/old value
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ enum eConfigBoolValues
|
|||
CONFIG_BOOL_ARENA_AUTO_DISTRIBUTE_POINTS,
|
||||
CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_JOIN,
|
||||
CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT,
|
||||
CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET,
|
||||
CONFIG_BOOL_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -248,15 +248,23 @@ bool WorldSession::Update(uint32 /*diff*/)
|
|||
break;
|
||||
}
|
||||
}
|
||||
catch(ByteBufferException &)
|
||||
catch (ByteBufferException &)
|
||||
{
|
||||
sLog.outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
|
||||
sLog.outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i.",
|
||||
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
|
||||
if(sLog.IsOutDebug())
|
||||
{
|
||||
sLog.outDebug("Dumping error causing packet:");
|
||||
packet->hexlike();
|
||||
}
|
||||
|
||||
if (sWorld.getConfig(CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET))
|
||||
{
|
||||
sLog.outDetail("Disconnecting session [account id %u / address %s] for badly formatted packet.",
|
||||
GetAccountId(), GetRemoteAddress().c_str());
|
||||
|
||||
KickPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
delete packet;
|
||||
|
|
|
|||
|
|
@ -713,7 +713,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
|
|||
}
|
||||
catch (ByteBufferException &)
|
||||
{
|
||||
sLog.outError("WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.",
|
||||
sLog.outError("WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i.",
|
||||
opcode, GetRemoteAddress().c_str(), m_Session?m_Session->GetAccountId():-1);
|
||||
if(sLog.IsOutDebug())
|
||||
{
|
||||
|
|
@ -721,7 +721,15 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
|
|||
new_pct->hexlike();
|
||||
}
|
||||
|
||||
return -1;
|
||||
if (sWorld.getConfig(CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET))
|
||||
{
|
||||
sLog.outDetail("Disconnecting session [account id %i / address %s] for badly formatted packet.",
|
||||
m_Session?m_Session->GetAccountId():-1, GetRemoteAddress().c_str());
|
||||
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACE_NOTREACHED (return 0);
|
||||
|
|
|
|||
|
|
@ -1348,12 +1348,18 @@ Arena.ArenaSeason.InProgress = 1
|
|||
# Default: 0 (enable Nagle algorithm, less traffic, more latency)
|
||||
# 1 (TCP_NO_DELAY, disable Nagle algorithm, more traffic but less latency)
|
||||
#
|
||||
# Network.KickOnBadPacket
|
||||
# Kick player on bad packet format.
|
||||
# Default: 0 - do not kick
|
||||
# 1 - kick
|
||||
#
|
||||
###################################################################################################################
|
||||
|
||||
Network.Threads = 1
|
||||
Network.OutKBuff = -1
|
||||
Network.OutUBuff = 65536
|
||||
Network.TcpNodelay = 1
|
||||
Network.KickOnBadPacket = 0
|
||||
|
||||
###################################################################################################################
|
||||
# CONSOLE, REMOTE ACCESS AND SOAP
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9572"
|
||||
#define REVISION_NR "9573"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue