bRPCDoSAnalytics
bRPCDoSAnalytics
#Overview
name: bRPCDoSAnalytics
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 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bRPCDoSAnalytics is to enable or disable analytics for RPC (Remote Procedure Call) Denial of Service (DoS) detection in Unreal Engine 5. This setting variable is part of the network security and performance monitoring system within the engine.
Based on the callsites, this variable is primarily used in the Engine module, specifically within the networking subsystem. It’s closely related to the RPC DoS detection feature, which is designed to protect game servers from potential DoS attacks through excessive RPC calls.
The value of this variable is set in the URPCDoSDetectionConfig class, which is likely loaded from a configuration file. It can be modified through engine configuration settings.
bRPCDoSAnalytics interacts with several other variables and systems:
- bRPCDoSDetection: The main switch for RPC DoS detection.
- RPCDoSAnalyticsData: A data structure for storing analytics information.
- AnalyticsAggregator: Used to register and manage analytics data.
Developers should be aware of the following when using this variable:
- Enabling this variable will incur some performance overhead due to additional data collection and processing.
- It works in conjunction with the overall RPC DoS detection system, so it should be enabled only when that system is active (bRPCDoSDetection is true).
- When enabled, it triggers the automatic updating of game thread CPU time, which could impact performance measurements.
Best practices for using this variable include:
- Enable it in development and testing environments to gather data on potential RPC DoS vulnerabilities.
- Consider the performance impact when enabling it in production environments.
- Use the collected analytics data to fine-tune other RPC DoS detection parameters and improve overall network security.
- Regularly review the analytics data to identify patterns or anomalies that might indicate attempted DoS attacks or unoptimized network code.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:1699, section: [GameNetDriver RPCDoSDetection]
- INI Section:
GameNetDriver RPCDoSDetection
- Raw value:
false
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseEngine.ini:1716, section: [BeaconNetDriver RPCDoSDetection]
- INI Section:
BeaconNetDriver RPCDoSDetection
- Raw value:
false
- 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:341
Scope (from outer to inner):
file
function void FRPCDoSDetection::Init
Source code excerpt:
InitConfig(NetDriverName);
if (bRPCDoSDetection && bRPCDoSAnalytics && AnalyticsAggregator.IsValid())
{
RPCDoSAnalyticsData = REGISTER_NET_ANALYTICS(AnalyticsAggregator, FRPCDoSAnalyticsData, TEXT("Core.ServerRPCDoS"));
if (RPCDoSAnalyticsData.IsValid())
{
RPCDoSAnalyticsData->WorldFunc = MoveTemp(InWorldFunc);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:355
Scope (from outer to inner):
file
function void FRPCDoSDetection::Init
Source code excerpt:
InitState(CurSeconds);
if (bRPCDoSAnalytics)
{
FPlatformTime::AutoUpdateGameThreadCPUTime(0.25);
}
// NetConnection's are created mid-TickDispatch, when this is initialized.
PreTickDispatch(CurSeconds);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:372
Scope (from outer to inner):
file
function void FRPCDoSDetection::InitConfig
Source code excerpt:
{
bRPCDoSDetection = CurConfigObj->bRPCDoSDetection;
bRPCDoSAnalytics = CurConfigObj->bRPCDoSAnalytics;
HitchTimeQuotaMS = CurConfigObj->HitchTimeQuotaMS;
HitchSuspendDetectionTimeMS = CurConfigObj->HitchSuspendDetectionTimeMS;
if (NextTimeQuotaCheck == 0.0 && CurConfigObj->InitialConnectToleranceMS > 0)
{
NextTimeQuotaCheck = FPlatformTime::Seconds() + (CurConfigObj->InitialConnectToleranceMS / 1000.0);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:653
Scope (from outer to inner):
file
function void FRPCDoSDetection::UpdateSeverity_Private
Source code excerpt:
WorstAnalyticsState = ActiveState;
if (bRPCDoSAnalytics && bSendEscalateAnalytics && RPCDoSAnalyticsData.IsValid() &&
RPCDoSAnalyticsData->WorstAnalyticsState < WorstAnalyticsState)
{
const FString& PlayerIP = GetPlayerAddress();
const FString& PlayerUID = GetPlayerUID();
// Estimate the worst per second RPC execution time/count, that may have triggered this escalation, for ranking
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:879
Scope (from outer to inner):
file
function void FRPCDoSDetection::PostSequentialRPC
Source code excerpt:
RPCCounter->AccumRPCTime += (TimeSeconds - StartTime);
if (bRPCDoSAnalytics)
{
TArray<TSharedPtr<FRPCAnalytics>>& RPCTrackingAnalytics = AnalyticsVars.RPCTrackingAnalytics;
const bool bTrackingFull = RPCTrackingAnalytics.Num() == AnalyticsVars.MaxRPCAnalytics;
const bool bAnalyticsThreshold = !bTrackingFull || RPCCounter->AccumRPCTime > AnalyticsMinTimePerSecThreshold;
TSharedPtr<FRPCAnalytics>& RPCTrackingAnalyticsEntry = RPCTrackingInfo->RPCTrackingAnalyticsEntry;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetectionConfig.h:62
Scope (from outer to inner):
file
class class URPCDoSDetectionConfig : public UObject
Source code excerpt:
/** Whether or not analytics for RPC DoS detection is enabled */
UPROPERTY(config)
bool bRPCDoSAnalytics;
/** The amount of time since the previous frame, for detecting hitches, to prevent false positives from built-up packets */
UPROPERTY(config)
int32 HitchTimeQuotaMS;
/** The amount of time to suspend RPC DoS Detection, once a hitch is encountered, prevent false positives from built-up packets */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:1128
Scope (from outer to inner):
file
class class FRPCDoSDetection : protected FRPCDoSState
Source code excerpt:
/** Whether or not analytics for RPC DoS detection is enabled */
bool bRPCDoSAnalytics = false;
/** The amount of time since the previous frame, for detecting hitches, to prevent false positives from built-up packets */
int32 HitchTimeQuotaMS = 0;
/** The amount of time to suspend RPC DoS Detection, once a hitch is encountered, to prevent false positives from built-up packets */
int32 HitchSuspendDetectionTimeMS = 0;