mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
Core/NetworkIO: Adjust more packet throttling values
Ignore some opcodes that don't cause any trouble. Remove old Allow/Disable Anti-DoS system since it's no longer required.
This commit is contained in:
@@ -638,8 +638,6 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData)
|
||||
recvData >> apply;
|
||||
|
||||
group->SetGroupMemberFlag(guid, apply, MEMBER_FLAG_ASSISTANT);
|
||||
|
||||
group->SendUpdate();
|
||||
}
|
||||
|
||||
void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData)
|
||||
|
||||
@@ -1246,6 +1246,12 @@ void WorldSession::InvalidateRBACData()
|
||||
|
||||
bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) const
|
||||
{
|
||||
uint32 maxPacketCounterAllowed = GetMaxPacketCounterAllowed(p.GetOpcode());
|
||||
|
||||
// Return true if there no limit for the opcode
|
||||
if (!maxPacketCounterAllowed)
|
||||
return true;
|
||||
|
||||
PacketCounter& packetCounter = _PacketThrottlingMap[p.GetOpcode()];
|
||||
if (packetCounter.lastReceiveTime != time)
|
||||
{
|
||||
@@ -1253,29 +1259,14 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
packetCounter.amountCounter = 0;
|
||||
}
|
||||
|
||||
uint32 maxPacketCounterAllowed = GetMaxPacketCounterAllowed(p.GetOpcode());
|
||||
|
||||
bool dosTriggered = false;
|
||||
// Check if player is flooding some packets
|
||||
if (++packetCounter.amountCounter > maxPacketCounterAllowed)
|
||||
{
|
||||
dosTriggered = true;
|
||||
TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, Ping: %u, Character: %s, flooding packet (opc: %s (0x%X), count: %u)",
|
||||
Session->GetAccountId(), Session->GetRemoteAddress().c_str(), Session->GetLatency(), Session->GetPlayerName().c_str(),
|
||||
opcodeTable[p.GetOpcode()].name, p.GetOpcode(), packetCounter.amountCounter);
|
||||
}
|
||||
|
||||
// Then check if player is sending packets not allowed
|
||||
if (!IsOpcodeAllowed(p.GetOpcode()))
|
||||
{
|
||||
dosTriggered = true;
|
||||
// Opcode not allowed, let the punishment begin
|
||||
TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, sent unacceptable packet (opc: %u, size: %u)",
|
||||
Session->GetAccountId(), Session->GetRemoteAddress().c_str(), p.GetOpcode(), (uint32)p.size());
|
||||
}
|
||||
|
||||
// Return true if everything is fine, otherwise apply the configured policy
|
||||
if (!dosTriggered)
|
||||
return true;
|
||||
|
||||
switch (_policy)
|
||||
@@ -1312,207 +1303,220 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
|
||||
uint32 maxPacketCounterAllowed;
|
||||
switch (opcode)
|
||||
{
|
||||
// These opcodes are spammed by few addons so a very high limit is required
|
||||
case CMSG_QUEST_QUERY:
|
||||
case CMSG_MESSAGECHAT:
|
||||
case CMSG_ITEM_QUERY_SINGLE:
|
||||
case CMSG_ITEM_NAME_QUERY:
|
||||
case CMSG_GAMEOBJECT_QUERY:
|
||||
case CMSG_NAME_QUERY:
|
||||
case CMSG_PET_NAME_QUERY:
|
||||
case CMSG_CREATURE_QUERY:
|
||||
case CMSG_NPC_TEXT_QUERY:
|
||||
case CMSG_QUESTGIVER_STATUS_QUERY:
|
||||
// CPU usage sending 2000 packets/second on a 3.70 GHz 4 cores on Win x64
|
||||
// [% CPU mysqld] [%CPU worldserver RelWithDebInfo]
|
||||
case CMSG_PLAYER_LOGIN: // 0 0.5
|
||||
case CMSG_NAME_QUERY: // 0 1
|
||||
case CMSG_PET_NAME_QUERY: // 0 1
|
||||
case CMSG_NPC_TEXT_QUERY: // 0 1
|
||||
case CMSG_ATTACKSTOP: // 0 1
|
||||
case CMSG_QUERY_QUESTS_COMPLETED: // 0 1
|
||||
case CMSG_QUERY_TIME: // 0 1
|
||||
case CMSG_CORPSE_MAP_POSITION_QUERY: // 0 1
|
||||
case CMSG_MOVE_TIME_SKIPPED: // 0 1
|
||||
case MSG_QUERY_NEXT_MAIL_TIME: // 0 1
|
||||
case CMSG_SETSHEATHED: // 0 1
|
||||
case MSG_RAID_TARGET_UPDATE: // 0 1
|
||||
case CMSG_PLAYER_LOGOUT: // 0 1
|
||||
case CMSG_LOGOUT_REQUEST: // 0 1
|
||||
case CMSG_PET_RENAME: // 0 1
|
||||
case CMSG_QUESTGIVER_CANCEL: // 0 1
|
||||
case CMSG_QUESTGIVER_REQUEST_REWARD: // 0 1
|
||||
case CMSG_COMPLETE_CINEMATIC: // 0 1
|
||||
case CMSG_BANKER_ACTIVATE: // 0 1
|
||||
case CMSG_BUY_BANK_SLOT: // 0 1
|
||||
case CMSG_OPT_OUT_OF_LOOT: // 0 1
|
||||
case CMSG_DUEL_ACCEPTED: // 0 1
|
||||
case CMSG_DUEL_CANCELLED: // 0 1
|
||||
case CMSG_CALENDAR_COMPLAIN: // 0 1
|
||||
case CMSG_QUEST_QUERY: // 0 1.5
|
||||
case CMSG_ITEM_QUERY_SINGLE: // 0 1.5
|
||||
case CMSG_ITEM_NAME_QUERY: // 0 1.5
|
||||
case CMSG_GAMEOBJECT_QUERY: // 0 1.5
|
||||
case CMSG_CREATURE_QUERY: // 0 1.5
|
||||
case CMSG_QUESTGIVER_STATUS_QUERY: // 0 1.5
|
||||
case CMSG_GUILD_QUERY: // 0 1.5
|
||||
case CMSG_ARENA_TEAM_QUERY: // 0 1.5
|
||||
case CMSG_TAXINODE_STATUS_QUERY: // 0 1.5
|
||||
case CMSG_TAXIQUERYAVAILABLENODES: // 0 1.5
|
||||
case CMSG_QUESTGIVER_QUERY_QUEST: // 0 1.5
|
||||
case CMSG_PAGE_TEXT_QUERY: // 0 1.5
|
||||
case MSG_QUERY_GUILD_BANK_TEXT: // 0 1.5
|
||||
case MSG_CORPSE_QUERY: // 0 1.5
|
||||
case MSG_MOVE_SET_FACING: // 0 1.5
|
||||
case CMSG_REQUEST_PARTY_MEMBER_STATS: // 0 1.5
|
||||
case CMSG_QUESTGIVER_COMPLETE_QUEST: // 0 1.5
|
||||
case CMSG_SET_ACTION_BUTTON: // 0 1.5
|
||||
case CMSG_RESET_INSTANCES: // 0 1.5
|
||||
case CMSG_HEARTH_AND_RESURRECT: // 0 1.5
|
||||
case CMSG_TOGGLE_PVP: // 0 1.5
|
||||
case CMSG_PET_ABANDON: // 0 1.5
|
||||
case CMSG_ACTIVATETAXIEXPRESS: // 0 1.5
|
||||
case CMSG_ACTIVATETAXI: // 0 1.5
|
||||
case CMSG_SELF_RES: // 0 1.5
|
||||
case CMSG_UNLEARN_SKILL: // 0 1.5
|
||||
case CMSG_EQUIPMENT_SET_SAVE: // 0 1.5
|
||||
case CMSG_DELETEEQUIPMENT_SET: // 0 1.5
|
||||
case CMSG_DISMISS_CRITTER: // 0 1.5
|
||||
case CMSG_REPOP_REQUEST: // 0 1.5
|
||||
case CMSG_GROUP_INVITE: // 0 1.5
|
||||
case CMSG_GROUP_DECLINE: // 0 1.5
|
||||
case CMSG_GROUP_ACCEPT: // 0 1.5
|
||||
case CMSG_GROUP_UNINVITE_GUID: // 0 1.5
|
||||
case CMSG_GROUP_UNINVITE: // 0 1.5
|
||||
case CMSG_GROUP_DISBAND: // 0 1.5
|
||||
case CMSG_BATTLEMASTER_JOIN_ARENA: // 0 1.5
|
||||
case CMSG_LEAVE_BATTLEFIELD: // 0 1.5
|
||||
case MSG_GUILD_BANK_LOG_QUERY: // 0 2
|
||||
case CMSG_LOGOUT_CANCEL: // 0 2
|
||||
case CMSG_REALM_SPLIT: // 0 2
|
||||
case CMSG_ALTER_APPEARANCE: // 0 2
|
||||
case CMSG_QUEST_CONFIRM_ACCEPT: // 0 2
|
||||
case MSG_GUILD_EVENT_LOG_QUERY: // 0 2.5
|
||||
case CMSG_READY_FOR_ACCOUNT_DATA_TIMES: // 0 2.5
|
||||
case CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY: // 0 2.5
|
||||
case CMSG_BEGIN_TRADE: // 0 2.5
|
||||
case CMSG_INITIATE_TRADE: // 0 3
|
||||
case CMSG_MESSAGECHAT: // 0 3.5
|
||||
case CMSG_INSPECT: // 0 3.5
|
||||
case CMSG_AREA_SPIRIT_HEALER_QUERY: // not profiled
|
||||
{
|
||||
maxPacketCounterAllowed = 5000;
|
||||
// "0" is a magic number meaning there's no limit for the opcode.
|
||||
// All the opcodes above must cause little CPU usage and no sync/async database queries at all
|
||||
maxPacketCounterAllowed = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case CMSG_ATTACKSTOP:
|
||||
case CMSG_GUILD_QUERY:
|
||||
case CMSG_ARENA_TEAM_QUERY:
|
||||
case CMSG_TAXINODE_STATUS_QUERY:
|
||||
case CMSG_TAXIQUERYAVAILABLENODES:
|
||||
case CMSG_QUESTGIVER_QUERY_QUEST:
|
||||
case CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY:
|
||||
case CMSG_QUERY_QUESTS_COMPLETED:
|
||||
case CMSG_QUEST_POI_QUERY:
|
||||
case CMSG_QUERY_TIME:
|
||||
case CMSG_PAGE_TEXT_QUERY:
|
||||
case CMSG_PETITION_QUERY:
|
||||
case CMSG_QUERY_INSPECT_ACHIEVEMENTS:
|
||||
case CMSG_AREA_SPIRIT_HEALER_QUERY:
|
||||
case CMSG_CORPSE_MAP_POSITION_QUERY:
|
||||
case CMSG_MOVE_TIME_SKIPPED:
|
||||
case CMSG_GUILD_BANK_QUERY_TAB:
|
||||
case MSG_GUILD_BANK_LOG_QUERY:
|
||||
case MSG_QUERY_GUILD_BANK_TEXT:
|
||||
case MSG_CORPSE_QUERY:
|
||||
case MSG_QUERY_NEXT_MAIL_TIME:
|
||||
case MSG_GUILD_EVENT_LOG_QUERY:
|
||||
case MSG_MOVE_SET_FACING:
|
||||
case CMSG_INSPECT:
|
||||
case CMSG_QUESTGIVER_ACCEPT_QUEST: // 0 4
|
||||
case CMSG_QUESTLOG_REMOVE_QUEST: // 0 4
|
||||
case CMSG_QUESTGIVER_CHOOSE_REWARD: // 0 4
|
||||
case CMSG_CONTACT_LIST: // 0 5
|
||||
case CMSG_LEARN_PREVIEW_TALENTS: // 0 6
|
||||
case CMSG_AUTOBANK_ITEM: // 0 6
|
||||
case CMSG_AUTOSTORE_BANK_ITEM: // 0 6
|
||||
case CMSG_WHO: // 0 7
|
||||
case CMSG_PLAYER_VEHICLE_ENTER: // 0 8
|
||||
case CMSG_LEARN_PREVIEW_TALENTS_PET: // not profiled
|
||||
case MSG_MOVE_HEARTBEAT:
|
||||
{
|
||||
maxPacketCounterAllowed = 500;
|
||||
maxPacketCounterAllowed = 200;
|
||||
break;
|
||||
}
|
||||
|
||||
case CMSG_REQUEST_PARTY_MEMBER_STATS:
|
||||
case CMSG_WHO:
|
||||
case CMSG_SETSHEATHED:
|
||||
case CMSG_CONTACT_LIST:
|
||||
case CMSG_GUILD_SET_PUBLIC_NOTE:
|
||||
case CMSG_GUILD_SET_OFFICER_NOTE:
|
||||
case CMSG_GUILD_SET_PUBLIC_NOTE: // 1 2 1 async db query
|
||||
case CMSG_GUILD_SET_OFFICER_NOTE: // 1 2 1 async db query
|
||||
case CMSG_SET_CONTACT_NOTES: // 1 2.5 1 async db query
|
||||
case CMSG_CALENDAR_GET_CALENDAR: // 0 1.5 medium upload bandwidth usage
|
||||
case CMSG_GUILD_BANK_QUERY_TAB: // 0 3.5 medium upload bandwidth usage
|
||||
case CMSG_QUERY_INSPECT_ACHIEVEMENTS: // 0 13 high upload bandwidth usage
|
||||
{
|
||||
maxPacketCounterAllowed = 50;
|
||||
break;
|
||||
}
|
||||
|
||||
case CMSG_SPELLCLICK:
|
||||
case CMSG_GAMEOBJ_USE:
|
||||
case CMSG_GAMEOBJ_REPORT_USE:
|
||||
case MSG_RAID_TARGET_UPDATE:
|
||||
case CMSG_QUESTGIVER_COMPLETE_QUEST:
|
||||
case CMSG_PLAYER_VEHICLE_ENTER:
|
||||
case CMSG_PETITION_SIGN:
|
||||
case CMSG_QUEST_POI_QUERY: // 0 25 very high upload bandwidth usage
|
||||
{
|
||||
maxPacketCounterAllowed = MAX_QUEST_LOG_SIZE;
|
||||
break;
|
||||
}
|
||||
|
||||
case CMSG_GM_REPORT_LAG: // 1 3 1 async db query
|
||||
case CMSG_SPELLCLICK: // not profiled
|
||||
case CMSG_GAMEOBJ_USE: // not profiled
|
||||
case CMSG_GAMEOBJ_REPORT_USE: // not profiled
|
||||
case CMSG_REMOVE_GLYPH: // not profiled
|
||||
{
|
||||
maxPacketCounterAllowed = 20;
|
||||
break;
|
||||
}
|
||||
|
||||
case CMSG_PLAYER_LOGOUT:
|
||||
case CMSG_LOGOUT_REQUEST:
|
||||
case CMSG_LOGOUT_CANCEL:
|
||||
case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE:
|
||||
case CMSG_REQUEST_VEHICLE_PREV_SEAT:
|
||||
case CMSG_REQUEST_VEHICLE_NEXT_SEAT:
|
||||
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
|
||||
case CMSG_TOGGLE_PVP:
|
||||
case CMSG_ADD_FRIEND:
|
||||
case CMSG_DEL_FRIEND:
|
||||
case CMSG_SET_CONTACT_NOTES:
|
||||
case CMSG_RESET_INSTANCES:
|
||||
case CMSG_HEARTH_AND_RESURRECT:
|
||||
case CMSG_CHAR_CREATE:
|
||||
case CMSG_READY_FOR_ACCOUNT_DATA_TIMES:
|
||||
case CMSG_CHAR_ENUM:
|
||||
case CMSG_REALM_SPLIT:
|
||||
case CMSG_CHAR_DELETE:
|
||||
case CMSG_PLAYER_LOGIN:
|
||||
case CMSG_PET_ABANDON:
|
||||
case CMSG_PET_RENAME:
|
||||
case CMSG_CHAR_RENAME:
|
||||
case CMSG_CHAR_CUSTOMIZE:
|
||||
case CMSG_CHAR_RACE_CHANGE:
|
||||
case CMSG_CHAR_FACTION_CHANGE:
|
||||
case CMSG_GMTICKET_CREATE:
|
||||
case CMSG_GMTICKET_UPDATETEXT:
|
||||
case CMSG_GMTICKET_DELETETICKET:
|
||||
case CMSG_GMSURVEY_SUBMIT:
|
||||
case CMSG_GM_REPORT_LAG:
|
||||
case CMSG_BUG:
|
||||
case CMSG_GMRESPONSE_RESOLVE:
|
||||
case CMSG_ACTIVATETAXIEXPRESS:
|
||||
case CMSG_ACTIVATETAXI:
|
||||
case CMSG_SELF_RES:
|
||||
case CMSG_INITIATE_TRADE:
|
||||
case CMSG_BEGIN_TRADE:
|
||||
case CMSG_UNLEARN_SKILL:
|
||||
case CMSG_DISMISS_CONTROLLED_VEHICLE:
|
||||
case CMSG_REQUEST_VEHICLE_EXIT:
|
||||
case CMSG_LEARN_PREVIEW_TALENTS:
|
||||
case CMSG_LEARN_PREVIEW_TALENTS_PET:
|
||||
case CMSG_CONTROLLER_EJECT_PASSENGER:
|
||||
case CMSG_EQUIPMENT_SET_SAVE:
|
||||
case CMSG_DELETEEQUIPMENT_SET:
|
||||
case CMSG_REMOVE_GLYPH:
|
||||
case CMSG_ALTER_APPEARANCE:
|
||||
case CMSG_QUESTGIVER_ACCEPT_QUEST:
|
||||
case CMSG_QUESTGIVER_CHOOSE_REWARD:
|
||||
case CMSG_QUESTGIVER_REQUEST_REWARD:
|
||||
case CMSG_QUESTGIVER_CANCEL:
|
||||
case CMSG_QUESTLOG_REMOVE_QUEST:
|
||||
case CMSG_QUEST_CONFIRM_ACCEPT:
|
||||
case CMSG_DISMISS_CRITTER:
|
||||
case CMSG_REPOP_REQUEST:
|
||||
case CMSG_PETITION_BUY:
|
||||
case CMSG_TURN_IN_PETITION:
|
||||
case CMSG_COMPLETE_CINEMATIC:
|
||||
case CMSG_ITEM_REFUND:
|
||||
case CMSG_SOCKET_GEMS:
|
||||
case CMSG_WRAP_ITEM:
|
||||
case CMSG_BUY_BANK_SLOT:
|
||||
case CMSG_GROUP_ACCEPT:
|
||||
case CMSG_GROUP_DECLINE:
|
||||
case CMSG_GROUP_UNINVITE_GUID:
|
||||
case CMSG_GROUP_UNINVITE:
|
||||
case CMSG_GROUP_SET_LEADER:
|
||||
case CMSG_GROUP_DISBAND:
|
||||
case CMSG_GROUP_RAID_CONVERT:
|
||||
case CMSG_GROUP_CHANGE_SUB_GROUP:
|
||||
case CMSG_GROUP_ASSISTANT_LEADER:
|
||||
case CMSG_OPT_OUT_OF_LOOT:
|
||||
case CMSG_BATTLEMASTER_JOIN_ARENA:
|
||||
case CMSG_LEAVE_BATTLEFIELD:
|
||||
case CMSG_REPORT_PVP_AFK:
|
||||
case CMSG_DUEL_ACCEPTED:
|
||||
case CMSG_DUEL_CANCELLED:
|
||||
case CMSG_CALENDAR_GET_CALENDAR:
|
||||
case CMSG_CALENDAR_ADD_EVENT:
|
||||
case CMSG_CALENDAR_UPDATE_EVENT:
|
||||
case CMSG_CALENDAR_REMOVE_EVENT:
|
||||
case CMSG_CALENDAR_COPY_EVENT:
|
||||
case CMSG_CALENDAR_EVENT_INVITE:
|
||||
case CMSG_CALENDAR_EVENT_SIGNUP:
|
||||
case CMSG_CALENDAR_EVENT_RSVP:
|
||||
case CMSG_CALENDAR_EVENT_REMOVE_INVITE:
|
||||
case CMSG_CALENDAR_EVENT_MODERATOR_STATUS:
|
||||
case CMSG_CALENDAR_COMPLAIN:
|
||||
case CMSG_ARENA_TEAM_INVITE:
|
||||
case CMSG_ARENA_TEAM_ACCEPT:
|
||||
case CMSG_ARENA_TEAM_DECLINE:
|
||||
case CMSG_ARENA_TEAM_LEAVE:
|
||||
case CMSG_ARENA_TEAM_DISBAND:
|
||||
case CMSG_ARENA_TEAM_REMOVE:
|
||||
case CMSG_ARENA_TEAM_LEADER:
|
||||
case CMSG_LOOT_METHOD:
|
||||
case CMSG_GUILD_INVITE:
|
||||
case CMSG_GUILD_ACCEPT:
|
||||
case CMSG_GUILD_DECLINE:
|
||||
case CMSG_GUILD_LEAVE:
|
||||
case CMSG_GUILD_DISBAND:
|
||||
case CMSG_GUILD_LEADER:
|
||||
case CMSG_GUILD_MOTD:
|
||||
case CMSG_GUILD_RANK:
|
||||
case CMSG_GUILD_ADD_RANK:
|
||||
case CMSG_GUILD_DEL_RANK:
|
||||
case CMSG_GUILD_INFO_TEXT:
|
||||
case CMSG_GUILD_BANK_DEPOSIT_MONEY:
|
||||
case CMSG_GUILD_BANK_WITHDRAW_MONEY:
|
||||
case CMSG_GUILD_BANK_BUY_TAB:
|
||||
case CMSG_GUILD_BANK_UPDATE_TAB:
|
||||
case CMSG_SET_GUILD_BANK_TEXT:
|
||||
case MSG_SAVE_GUILD_EMBLEM:
|
||||
case MSG_PETITION_RENAME:
|
||||
case MSG_PETITION_DECLINE:
|
||||
case MSG_TALENT_WIPE_CONFIRM:
|
||||
case MSG_SET_DUNGEON_DIFFICULTY:
|
||||
case MSG_SET_RAID_DIFFICULTY:
|
||||
case MSG_RANDOM_ROLL:
|
||||
case MSG_PARTY_ASSIGNMENT:
|
||||
case MSG_RAID_READY_CHECK:
|
||||
case CMSG_PETITION_SIGN: // 9 4 2 sync 1 async db queries
|
||||
case CMSG_TURN_IN_PETITION: // 8 5.5 2 sync db query
|
||||
case CMSG_GROUP_CHANGE_SUB_GROUP: // 6 5 1 sync 1 async db queries
|
||||
case CMSG_PETITION_QUERY: // 4 3.5 1 sync db query
|
||||
case CMSG_CHAR_RACE_CHANGE: // 5 4 1 sync db query
|
||||
case CMSG_CHAR_CUSTOMIZE: // 5 5 1 sync db query
|
||||
case CMSG_CHAR_FACTION_CHANGE: // 5 5 1 sync db query
|
||||
case CMSG_CHAR_DELETE: // 4 4 1 sync db query
|
||||
case CMSG_DEL_FRIEND: // 7 5 1 async db query
|
||||
case CMSG_ADD_FRIEND: // 6 4 1 async db query
|
||||
case CMSG_CHAR_RENAME: // 5 3 1 async db query
|
||||
case CMSG_GMSURVEY_SUBMIT: // 2 3 1 async db query
|
||||
case CMSG_BUG: // 1 1 1 async db query
|
||||
case CMSG_GROUP_SET_LEADER: // 1 2 1 async db query
|
||||
case CMSG_GROUP_RAID_CONVERT: // 1 5 1 async db query
|
||||
case CMSG_GROUP_ASSISTANT_LEADER: // 1 2 1 async db query
|
||||
case CMSG_CALENDAR_ADD_EVENT: // 21 10 2 async db query
|
||||
case CMSG_PETITION_BUY: // not profiled 1 sync 1 async db queries
|
||||
case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE: // not profiled
|
||||
case CMSG_REQUEST_VEHICLE_PREV_SEAT: // not profiled
|
||||
case CMSG_REQUEST_VEHICLE_NEXT_SEAT: // not profiled
|
||||
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT: // not profiled
|
||||
case CMSG_DISMISS_CONTROLLED_VEHICLE: // not profiled
|
||||
case CMSG_REQUEST_VEHICLE_EXIT: // not profiled
|
||||
case CMSG_CONTROLLER_EJECT_PASSENGER: // not profiled
|
||||
case CMSG_ITEM_REFUND: // not profiled
|
||||
case CMSG_SOCKET_GEMS: // not profiled
|
||||
case CMSG_WRAP_ITEM: // not profiled
|
||||
case CMSG_REPORT_PVP_AFK: // not profiled
|
||||
{
|
||||
maxPacketCounterAllowed = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
case CMSG_CHAR_CREATE: // 7 5 3 async db queries
|
||||
case CMSG_CHAR_ENUM: // 22 3 2 async db queries
|
||||
case CMSG_GMTICKET_CREATE: // 1 25 1 async db query
|
||||
case CMSG_GMTICKET_UPDATETEXT: // 0 15 1 async db query
|
||||
case CMSG_GMTICKET_DELETETICKET: // 1 25 1 async db query
|
||||
case CMSG_GMRESPONSE_RESOLVE: // 1 25 1 async db query
|
||||
case CMSG_CALENDAR_UPDATE_EVENT: // not profiled
|
||||
case CMSG_CALENDAR_REMOVE_EVENT: // not profiled
|
||||
case CMSG_CALENDAR_COPY_EVENT: // not profiled
|
||||
case CMSG_CALENDAR_EVENT_INVITE: // not profiled
|
||||
case CMSG_CALENDAR_EVENT_SIGNUP: // not profiled
|
||||
case CMSG_CALENDAR_EVENT_RSVP: // not profiled
|
||||
case CMSG_CALENDAR_EVENT_REMOVE_INVITE: // not profiled
|
||||
case CMSG_CALENDAR_EVENT_MODERATOR_STATUS: // not profiled
|
||||
case CMSG_ARENA_TEAM_INVITE: // not profiled
|
||||
case CMSG_ARENA_TEAM_ACCEPT: // not profiled
|
||||
case CMSG_ARENA_TEAM_DECLINE: // not profiled
|
||||
case CMSG_ARENA_TEAM_LEAVE: // not profiled
|
||||
case CMSG_ARENA_TEAM_DISBAND: // not profiled
|
||||
case CMSG_ARENA_TEAM_REMOVE: // not profiled
|
||||
case CMSG_ARENA_TEAM_LEADER: // not profiled
|
||||
case CMSG_LOOT_METHOD: // not profiled
|
||||
case CMSG_GUILD_INVITE: // not profiled
|
||||
case CMSG_GUILD_ACCEPT: // not profiled
|
||||
case CMSG_GUILD_DECLINE: // not profiled
|
||||
case CMSG_GUILD_LEAVE: // not profiled
|
||||
case CMSG_GUILD_DISBAND: // not profiled
|
||||
case CMSG_GUILD_LEADER: // not profiled
|
||||
case CMSG_GUILD_MOTD: // not profiled
|
||||
case CMSG_GUILD_RANK: // not profiled
|
||||
case CMSG_GUILD_ADD_RANK: // not profiled
|
||||
case CMSG_GUILD_DEL_RANK: // not profiled
|
||||
case CMSG_GUILD_INFO_TEXT: // not profiled
|
||||
case CMSG_GUILD_BANK_DEPOSIT_MONEY: // not profiled
|
||||
case CMSG_GUILD_BANK_WITHDRAW_MONEY: // not profiled
|
||||
case CMSG_GUILD_BANK_BUY_TAB: // not profiled
|
||||
case CMSG_GUILD_BANK_UPDATE_TAB: // not profiled
|
||||
case CMSG_SET_GUILD_BANK_TEXT: // not profiled
|
||||
case MSG_SAVE_GUILD_EMBLEM: // not profiled
|
||||
case MSG_PETITION_RENAME: // not profiled
|
||||
case MSG_PETITION_DECLINE: // not profiled
|
||||
case MSG_TALENT_WIPE_CONFIRM: // not profiled
|
||||
case MSG_SET_DUNGEON_DIFFICULTY: // not profiled
|
||||
case MSG_SET_RAID_DIFFICULTY: // not profiled
|
||||
case MSG_RANDOM_ROLL: // not profiled
|
||||
case MSG_PARTY_ASSIGNMENT: // not profiled
|
||||
case MSG_RAID_READY_CHECK: // not profiled
|
||||
{
|
||||
maxPacketCounterAllowed = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
case CMSG_SET_ACTION_BUTTON:
|
||||
{
|
||||
maxPacketCounterAllowed = MAX_ACTION_BUTTONS;
|
||||
break;
|
||||
}
|
||||
|
||||
case CMSG_ITEM_REFUND_INFO:
|
||||
case CMSG_ITEM_REFUND_INFO: // not profiled
|
||||
{
|
||||
maxPacketCounterAllowed = PLAYER_SLOTS_COUNT;
|
||||
break;
|
||||
|
||||
@@ -937,7 +937,6 @@ class WorldSession
|
||||
public:
|
||||
DosProtection(WorldSession* s) : Session(s), _policy((Policy)sWorld->getIntConfig(CONFIG_PACKET_SPOOF_POLICY)) { }
|
||||
bool EvaluateOpcode(WorldPacket& p, time_t time) const;
|
||||
void AllowOpcode(uint16 opcode, bool allow) { _isOpcodeAllowed[opcode] = allow; }
|
||||
protected:
|
||||
enum Policy
|
||||
{
|
||||
@@ -946,22 +945,11 @@ class WorldSession
|
||||
POLICY_BAN,
|
||||
};
|
||||
|
||||
bool IsOpcodeAllowed(uint16 opcode) const
|
||||
{
|
||||
OpcodeStatusMap::const_iterator itr = _isOpcodeAllowed.find(opcode);
|
||||
if (itr == _isOpcodeAllowed.end())
|
||||
return true; // No presence in the map indicates this is the first time the opcode was sent this session, so allow
|
||||
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
uint32 GetMaxPacketCounterAllowed(uint16 opcode) const;
|
||||
|
||||
WorldSession* Session;
|
||||
|
||||
private:
|
||||
typedef std::unordered_map<uint16, bool> OpcodeStatusMap;
|
||||
OpcodeStatusMap _isOpcodeAllowed; // could be bool array, but wouldn't be practical for game versions with non-linear opcodes
|
||||
Policy _policy;
|
||||
typedef std::unordered_map<uint16, PacketCounter> PacketThrottlingMap;
|
||||
// mark this member as "mutable" so it can be modified even in const functions
|
||||
|
||||
Reference in New Issue
Block a user