|
|
@ -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: |
|
|
|