Skip to content

Commit c06dc7d

Browse files
committed
Core/NetworkIO: Adjust more packet throttling values
Adjust some more packet throttling values. Revert b35f831 since it's no longer needed. Modify the AntiDoS log to specify in a more readable way which opcode triggered the system and how many packets have been received.
1 parent c06a263 commit c06dc7d

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

src/server/game/Handlers/MiscHandler.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,6 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
186186
{
187187
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_WHO Message");
188188

189-
time_t now = time(NULL);
190-
if (now - timeLastWhoCommand < 5)
191-
return;
192-
else timeLastWhoCommand = now;
193-
194189
uint32 matchcount = 0;
195190

196191
uint32 level_min, level_max, racemask, classmask, zones_count, str_count;

src/server/game/Server/WorldSession.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8
121121
m_TutorialsChanged(false),
122122
recruiterId(recruiter),
123123
isRecruiter(isARecruiter),
124-
timeLastWhoCommand(0),
125124
_RBACData(NULL)
126125
{
127126
memset(m_Tutorials, 0, sizeof(m_Tutorials));
@@ -1253,8 +1252,8 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
12531252
if (++packetCounter.amountCounter > maxPacketCounterAllowed)
12541253
{
12551254
dosTriggered = true;
1256-
TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, flooding packet (opc: %u, size: %u)",
1257-
Session->GetAccountId(), Session->GetRemoteAddress().c_str(), p.GetOpcode(), (uint32)p.size());
1255+
TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, flooding packet (opc: %s (0x%X), count: %u)",
1256+
Session->GetAccountId(), Session->GetRemoteAddress().c_str(), opcodeTable[p.GetOpcode()].name, p.GetOpcode(), packetCounter.amountCounter);
12581257
}
12591258

12601259
// Then check if player is sending packets not allowed
@@ -1304,6 +1303,13 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
13041303
uint32 maxPacketCounterAllowed;
13051304
switch (opcode)
13061305
{
1306+
case CMSG_MESSAGECHAT:
1307+
{
1308+
maxPacketCounterAllowed = 500;
1309+
break;
1310+
}
1311+
1312+
case CMSG_ATTACKSTOP:
13071313
case CMSG_ITEM_QUERY_SINGLE:
13081314
case CMSG_ITEM_NAME_QUERY:
13091315
case CMSG_GUILD_QUERY:
@@ -1339,19 +1345,20 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
13391345
break;
13401346
}
13411347

1342-
case CMSG_MESSAGECHAT:
1348+
case CMSG_REQUEST_PARTY_MEMBER_STATS:
1349+
case CMSG_WHO:
13431350
{
13441351
maxPacketCounterAllowed = 50;
13451352
break;
13461353
}
13471354

1355+
case CMSG_SETSHEATHED:
13481356
case CMSG_CONTACT_LIST:
13491357
{
13501358
maxPacketCounterAllowed = 10;
13511359
break;
13521360
}
13531361

1354-
case CMSG_WHO:
13551362
case CMSG_GAMEOBJ_USE:
13561363
case CMSG_GAMEOBJ_REPORT_USE:
13571364
case CMSG_SPELLCLICK:
@@ -1429,14 +1436,12 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
14291436
case CMSG_GROUP_RAID_CONVERT:
14301437
case CMSG_GROUP_CHANGE_SUB_GROUP:
14311438
case CMSG_GROUP_ASSISTANT_LEADER:
1432-
case CMSG_REQUEST_PARTY_MEMBER_STATS:
14331439
case CMSG_OPT_OUT_OF_LOOT:
14341440
case CMSG_BATTLEMASTER_JOIN_ARENA:
14351441
case CMSG_LEAVE_BATTLEFIELD:
14361442
case CMSG_REPORT_PVP_AFK:
14371443
case CMSG_DUEL_ACCEPTED:
14381444
case CMSG_DUEL_CANCELLED:
1439-
case CMSG_SETSHEATHED:
14401445
case CMSG_CALENDAR_GET_CALENDAR:
14411446
case CMSG_CALENDAR_ADD_EVENT:
14421447
case CMSG_CALENDAR_UPDATE_EVENT:

src/server/game/Server/WorldSession.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,6 @@ class WorldSession
10201020
uint32 recruiterId;
10211021
bool isRecruiter;
10221022
ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
1023-
time_t timeLastWhoCommand;
10241023
rbac::RBACData* _RBACData;
10251024

10261025
WorldSession(WorldSession const& right) = delete;

0 commit comments

Comments
 (0)