mirror of
https://github.com/rehlds/rehlds.git
synced 2024-12-27 23:25:45 +03:00
Added sv_rehlds_maxclients_from_single_ip cvar (#610)
Correctly reject overlimit connections
This commit is contained in:
parent
19c22d7538
commit
87a10a1e41
@ -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". See [wiki](https://github.com/dreamstalker/rehlds/wiki/Userinfo-keys) to collect sufficient set of keys for your server. 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
|
||||
|
@ -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;
|
||||
}
|
||||
@ -7798,6 +7808,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);
|
||||
|
Loading…
Reference in New Issue
Block a user