diff options
| author | jackpoz <giacomopoz@gmail.com> | 2014-05-24 22:04:03 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2014-05-24 22:34:06 +0200 |
| commit | a4ba54fbdbb690377c873ea34f1d3541002872b5 (patch) | |
| tree | b23da22c6e76dc2aebeb2b7c65d2e18bd1fcbb00 /src/server/game/Server/Protocol | |
| parent | f091713086eab1ef928bc2f79eb0dc3b0bc4ce2f (diff) | |
Core/NetworkIO: Improve packet spam solution
Implement an improved packet Anti-DoS by counting how many times the same opcode has been sent in the last second and applying the policy specified in the configs if the amount of packets exceeds a reasonable amount.
Credits to the original author who decided to share this with TrinityCore team.
Diffstat (limited to 'src/server/game/Server/Protocol')
| -rw-r--r-- | src/server/game/Server/Protocol/Opcodes.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index e581d7d1544..7b07abdf962 100644 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -25,12 +25,6 @@ #include "Common.h" -// Note: this include need for be sure have full definition of class WorldSession -// if this class definition not complete then VS for x64 release use different size for -// struct OpcodeHandler in this header and Opcode.cpp and get totally wrong data from -// table opcodeTable in source when Opcode.h included but WorldSession.h not included -#include "WorldSession.h" - /// List of Opcodes enum Opcodes { @@ -1366,8 +1360,15 @@ enum PacketProcessing PROCESS_THREADSAFE //packet is thread-safe - process it in Map::Update() }; +class WorldSession; class WorldPacket; +#if defined(__GNUC__) +#pragma pack(1) +#else +#pragma pack(push, 1) +#endif + struct OpcodeHandler { char const* name; @@ -1378,6 +1379,12 @@ struct OpcodeHandler extern OpcodeHandler opcodeTable[NUM_MSG_TYPES]; +#if defined(__GNUC__) +#pragma pack() +#else +#pragma pack(pop) +#endif + /// Lookup opcode name for human understandable logging inline const char* LookupOpcodeName(uint16 id) { |
