mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-12 08:08:02 +00:00
engine: server: exclude expired IP filters from check
This commit is contained in:
parent
a7c422fde6
commit
b41fe076ae
@ -286,31 +286,8 @@ typedef struct ipfilter_s
|
|||||||
|
|
||||||
static ipfilter_t *ipfilter = NULL;
|
static ipfilter_t *ipfilter = NULL;
|
||||||
|
|
||||||
static void SV_CleanExpiredIPFilters( void )
|
|
||||||
{
|
|
||||||
ipfilter_t *f, **back;
|
|
||||||
|
|
||||||
back = &ipfilter;
|
|
||||||
while( 1 )
|
|
||||||
{
|
|
||||||
f = *back;
|
|
||||||
if( !f ) return;
|
|
||||||
|
|
||||||
if( f->endTime && host.realtime > f->endTime )
|
|
||||||
{
|
|
||||||
*back = f->next;
|
|
||||||
back = &f->next;
|
|
||||||
|
|
||||||
Mem_Free( f );
|
|
||||||
}
|
|
||||||
else back = &f->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int SV_FilterToString( char *dest, size_t size, qboolean config, ipfilter_t *f )
|
static int SV_FilterToString( char *dest, size_t size, qboolean config, ipfilter_t *f )
|
||||||
{
|
{
|
||||||
const char *strformat;
|
|
||||||
|
|
||||||
if( config )
|
if( config )
|
||||||
{
|
{
|
||||||
return Q_snprintf( dest, size, "addip 0 %s/%d\n", NET_AdrToString( f->adr ), f->prefixlen );
|
return Q_snprintf( dest, size, "addip 0 %s/%d\n", NET_AdrToString( f->adr ), f->prefixlen );
|
||||||
@ -379,6 +356,9 @@ qboolean SV_CheckIP( netadr_t *adr )
|
|||||||
|
|
||||||
for( ; entry; entry = entry->next )
|
for( ; entry; entry = entry->next )
|
||||||
{
|
{
|
||||||
|
if( entry->endTime && host.realtime > entry->endTime )
|
||||||
|
continue; // expired
|
||||||
|
|
||||||
switch( entry->adr.type6 )
|
switch( entry->adr.type6 )
|
||||||
{
|
{
|
||||||
case NA_IP:
|
case NA_IP:
|
||||||
|
Loading…
Reference in New Issue
Block a user