2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-29 08:05:50 +03:00

Added sv_rehlds_maxclients_from_single_ip cvar

Correctly reject overlimit connections
This commit is contained in:
Asmodai 2018-05-04 00:39:14 +03:00
parent ce163a323b
commit 204b843068
2 changed files with 12 additions and 0 deletions

View File

@ -54,6 +54,7 @@ Bugfixed version of rehlds contains an additional cvars:
<li>sv_rehlds_stringcmdrate_burst_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
<li>sv_rehlds_userinfo_transmitted_fields // Userinfo fields only with these keys will be transmitted to clients via network. If not set then all fields will be transmitted (except prefixed with underscore). Each key must be prefixed by backslash, for example "\name\model\*sid\*hltv\bottomcolor\topcolor". Default: ""
<li>sv_rehlds_attachedentities_playeranimationspeed_fix // Fixes bug with gait animation speed increase when player has some attached entities (aiments). Can cause animation lags when cl_updaterate is low. Default: 0
<li>sv_rehlds_maxclients_from_single_ip // Limit number of connections from the single ip address. Default: 5
</ul>
## Commands

View File

@ -202,6 +202,7 @@ cvar_t sv_rehlds_userinfo_transmitted_fields = { "sv_rehlds_userinfo_transmitted
cvar_t sv_rehlds_attachedentities_playeranimationspeed_fix = {"sv_rehlds_attachedentities_playeranimationspeed_fix", "0", 0, 0.0f, nullptr};
cvar_t sv_rehlds_local_gametime = {"sv_rehlds_local_gametime", "0", 0, 0.0f, nullptr};
cvar_t sv_rehlds_send_mapcycle = { "sv_rehlds_send_mapcycle", "0", 0, 0.0f, nullptr };
cvar_t sv_rehlds_maxclients_from_single_ip = { "sv_rehlds_maxclients_from_single_ip", "5", 0, 5.0f, nullptr };
#endif
delta_t *SV_LookupDelta(char *name)
@ -1860,11 +1861,20 @@ int SV_CheckIPConnectionReuse(netadr_t *adr)
}
}
#ifdef REHLDS_FIXES
if (count > (int)sv_rehlds_maxclients_from_single_ip.value)
{
Log_Printf("Too many connect packets from %s (%i>%i)\n", NET_AdrToString(*adr), count, (int)sv_rehlds_maxclients_from_single_ip.value);
SV_RejectConnection(adr, "Too many connect packets from your ip address\n");
return 0;
}
#else
if (count > 5)
{
Log_Printf("Too many connect packets from %s\n", NET_AdrToString(*adr));
return 0;
}
#endif
return 1;
}
@ -7804,6 +7814,7 @@ void SV_Init(void)
Cvar_RegisterVariable(&sv_rehlds_attachedentities_playeranimationspeed_fix);
Cvar_RegisterVariable(&sv_rehlds_local_gametime);
Cvar_RegisterVariable(&sv_rehlds_send_mapcycle);
Cvar_RegisterVariable(&sv_rehlds_maxclients_from_single_ip);
Cvar_RegisterVariable(&sv_rollspeed);
Cvar_RegisterVariable(&sv_rollangle);