mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-14 15:48:04 +03:00
Improved behavior of sv_filterban 0. Fixes #1027
This commit is contained in:
parent
47ffe4b257
commit
693b51c883
@ -68,6 +68,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
|
||||
<li>sv_net_incoming_decompression_max_size <16|65536> // Sets the max allowed size for decompressed file transfer data. Default: 65536 bytes
|
||||
<li>sv_net_incoming_decompression_punish // Time in minutes for which the player will be banned for malformed/abnormal bzip2 fragments (0 - Permanent, use a negative number for a kick). Default: -1
|
||||
<li>sv_tags <comma-delimited string list of tags> // Sets a string defining the "gametags" for this server, this is optional, but if it is set it allows users/scripts to filter in the matchmaking/server-browser interfaces based on the value. Default: ""
|
||||
<li>sv_filterban <-1|0|1>// Set packet filtering by IP mode. -1 - All players will be rejected without any exceptions. 0 - No checks will happen. 1 - All incoming players will be checked if they're IP banned (if they have an IP filter entry), if they are, they will be kicked. Default: 1
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
|
@ -3836,13 +3836,20 @@ void SV_ProcessFile(client_t *cl, char *filename)
|
||||
|
||||
qboolean SV_FilterPacket(void)
|
||||
{
|
||||
// sv_filterban filtering IP mode
|
||||
// -1: all players will be rejected without any exceptions
|
||||
// 0: no checks will happen
|
||||
// 1: all incoming players will be checked if they're IP banned (if they have an IP filter entry), if they are, they will be kicked
|
||||
|
||||
qboolean bNegativeFilter = (sv_filterban.value == 1) ? TRUE : FALSE;
|
||||
|
||||
for (int i = numipfilters - 1; i >= 0; i--)
|
||||
{
|
||||
ipfilter_t* curFilter = &ipfilters[i];
|
||||
if (curFilter->compare.u32 == 0xFFFFFFFF || curFilter->banEndTime == 0.0f || curFilter->banEndTime > realtime)
|
||||
{
|
||||
if ((*(uint32*)net_from.ip & curFilter->mask) == curFilter->compare.u32)
|
||||
return (int)sv_filterban.value;
|
||||
return bNegativeFilter;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3852,7 +3859,8 @@ qboolean SV_FilterPacket(void)
|
||||
--numipfilters;
|
||||
}
|
||||
}
|
||||
return sv_filterban.value == 0.0f;
|
||||
|
||||
return !bNegativeFilter;
|
||||
}
|
||||
|
||||
void SV_SendBan(void)
|
||||
|
Loading…
x
Reference in New Issue
Block a user