RPCRepeatLimitPerPeriod
RPCRepeatLimitPerPeriod
#Overview
name: RPCRepeatLimitPerPeriod
The value of this variable can be defined or overridden in .ini config files. 2
.ini config files referencing this setting variable.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of RPCRepeatLimitPerPeriod is to control and limit the frequency of Remote Procedure Calls (RPCs) in Unreal Engine’s networking system. It’s specifically designed to prevent Denial of Service (DoS) attacks by restricting how often a single RPC can be repeated within a given time period.
This setting variable is primarily used by Unreal Engine’s networking subsystem, particularly in the RPC DoS detection module. Based on the callsites, it’s part of the Engine module and is used in the RPCDoSDetection system.
The value of this variable is typically set in configuration files, as indicated by the UPROPERTY(config) decorator in the header file. It can also be modified programmatically through the FRPCDoSStateConfig::ApplyState function.
RPCRepeatLimitPerPeriod interacts with several other variables, including:
- RPCRepeatLimitTimePeriod: Defines the time period for which the limit applies.
- RPCRepeatLimitMSPerPeriod: A related limit based on execution time rather than call count.
- bTrackRecentRPCs: A flag that’s set to true if RPCRepeatLimitPerPeriod is active.
Developers must be aware that:
- Setting this variable to -1 disables the limit.
- It works in conjunction with RPCRepeatLimitTimePeriod to define the actual limit.
- It’s part of a broader DoS prevention system and should be configured carefully to balance security and performance.
Best practices when using this variable include:
- Set it to a value that prevents DoS attacks without hindering legitimate gameplay.
- Always consider it in conjunction with RPCRepeatLimitTimePeriod.
- Monitor its effectiveness in real-world scenarios and adjust as necessary.
- Use it as part of a comprehensive network security strategy, not as a sole solution.
- Be cautious when modifying it, as it can significantly impact network behavior and game performance.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:1772, section: [RPCDoSDetection.DoS]
- INI Section:
RPCDoSDetection.DoS
- Raw value:
512
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseEngine.ini:1788, section: [RPCDoSDetection.ExpensiveDoS]
- INI Section:
RPCDoSDetection.ExpensiveDoS
- Raw value:
512
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:125
Scope (from outer to inner):
file
function void FRPCDoSState::ApplyImpliedValues
Source code excerpt:
{
EscalateQuotaTimePeriod = (EscalateQuotaRPCsPerPeriod != -1 || EscalateTimeQuotaMSPerPeriod != -1) ? EscalateQuotaTimePeriod : -1;
RPCRepeatLimitTimePeriod = (RPCRepeatLimitPerPeriod != -1 || RPCRepeatLimitMSPerPeriod != -1) ? RPCRepeatLimitTimePeriod : -1;
bTrackRecentRPCs = bTrackRecentRPCs || (RPCRepeatLimitPerPeriod != -1 && RPCRepeatLimitTimePeriod != -1);
EscalateTimeQuotaSecsPerFrame = (EscalateTimeQuotaMSPerFrame != -1 ? (EscalateTimeQuotaMSPerFrame / 1000.0) : 0.0);
EscalateTimeQuotaSecsPerPeriod = (EscalateTimeQuotaMSPerPeriod != -1 ? (EscalateTimeQuotaMSPerPeriod / 1000.0) : 0.0);
RPCRepeatLimitSecsPerPeriod = (RPCRepeatLimitMSPerPeriod != -1 ? (RPCRepeatLimitMSPerPeriod / 1000.0) : 0.0);
EscalationTimeToleranceSeconds = (EscalationTimeToleranceMS != -1 ? (EscalationTimeToleranceMS / 1000.0) : 0.0);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:289
Scope (from outer to inner):
file
function void FRPCDoSStateConfig::ValidateConfig
Source code excerpt:
ValidateTimePeriod(RPCRepeatLimitTimePeriod, TEXT("RPCRepeatLimitTimePeriod"),
(RPCRepeatLimitPerPeriod > 0 || RPCRepeatLimitMSPerPeriod > 0));
if (AutoEscalateTime > 0 && AutoEscalateTime < CooloffTime)
{
UE_LOG(LogNet, Warning, TEXT("FRPCDoSStateConfig: AutoEscalateTime must be larger than CooloffTime."));
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:318
Scope (from outer to inner):
file
function void FRPCDoSStateConfig::ApplyState
Source code excerpt:
Target.EscalateTimeQuotaMSPerPeriod = EscalateTimeQuotaMSPerPeriod;
Target.EscalateQuotaTimePeriod = EscalateQuotaTimePeriod;
Target.RPCRepeatLimitPerPeriod = RPCRepeatLimitPerPeriod;
Target.RPCRepeatLimitMSPerPeriod = RPCRepeatLimitMSPerPeriod;
Target.RPCRepeatLimitTimePeriod = RPCRepeatLimitTimePeriod;
Target.CooloffTime = CooloffTime;
Target.AutoEscalateTime = AutoEscalateTime;
Target.ApplyImpliedValues();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:1175
Scope (from outer to inner):
file
function ERPCNotifyResult FRPCDoSDetection::CheckRPCTracking
Source code excerpt:
const bool bBlockRPC = GAllowRPCDoSDetectionBlocking == 1 && RPCRepeatLimitTimePeriod != -1 &&
HasHitQuota(RPCRepeatLimitTimePeriod, RPCRepeatLimitPerPeriod, RPCRepeatLimitSecsPerPeriod);
Tracking.BlockState = bBlockRPC ? ERPCBlockState::Blocked : ERPCBlockState::NotBlocked;
}
if (Tracking.BlockState == ERPCBlockState::Blocked)
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:226
Scope: file
Source code excerpt:
/** The limit for the number of times a single RPC can be repeated, over the time period specified by RPCRepeatTimeLimitPeriod */
UPROPERTY(config)
int16 RPCRepeatLimitPerPeriod = -1;
/** The limit for the number of milliseconds a single RPC can spend executing, over the time period specified by RPCRepeatTimeLimitPeriod */
UPROPERTY(config)
int16 RPCRepeatLimitMSPerPeriod = -1;
/** The time period to use for measuring excessive execution time for a single RPC (Max: 16) */