diff options
-rw-r--r-- | source/sv_ccmds.c | 13 | ||||
-rw-r--r-- | source/sv_local.h | 1 | ||||
-rw-r--r-- | source/sv_main.c | 8 |
3 files changed, 21 insertions, 1 deletions
diff --git a/source/sv_ccmds.c b/source/sv_ccmds.c index bd20571..28daa46 100644 --- a/source/sv_ccmds.c +++ b/source/sv_ccmds.c @@ -1019,6 +1019,16 @@ static void SV_ListBans_f( void ) { SV_ListMatches_f( &sv_banlist ); } +static void SV_AddBlackHole_f( void ) { + SV_AddMatch_f( &sv_blacklist ); +} +static void SV_DelBlackHole_f( void ) { + SV_DelMatch_f( &sv_blacklist ); +} +static void SV_ListBlackHoles_f( void ) { + SV_ListMatches_f( &sv_blacklist ); +} + static list_t *SV_FindStuffList( void ) { char *s = Cmd_Argv( 1 ); @@ -1302,6 +1312,9 @@ static const cmdreg_t c_server[] = { { "addban", SV_AddBan_f }, { "delban", SV_DelBan_f }, { "listbans", SV_ListBans_f }, + { "addblackhole", SV_AddBlackHole_f }, + { "delblackhole", SV_DelBlackHole_f }, + { "listblackholes", SV_ListBlackHoles_f }, { "addstuffcmd", SV_AddStuffCmd_f, SV_StuffCmd_c }, { "delstuffcmd", SV_DelStuffCmd_f, SV_StuffCmd_c }, { "liststuffcmds", SV_ListStuffCmds_f, SV_StuffCmd_c }, diff --git a/source/sv_local.h b/source/sv_local.h index 18e9287..04f127b 100644 --- a/source/sv_local.h +++ b/source/sv_local.h @@ -391,6 +391,7 @@ typedef struct server_static_s { extern list_t sv_masterlist; // address of the master server extern list_t sv_banlist; +extern list_t sv_blacklist; extern list_t sv_cmdlist_connect; extern list_t sv_cmdlist_begin; extern list_t sv_filterlist; diff --git a/source/sv_main.c b/source/sv_main.c index 35760d3..8171002 100644 --- a/source/sv_main.c +++ b/source/sv_main.c @@ -24,6 +24,7 @@ pmoveParams_t sv_pmp; LIST_DECL( sv_masterlist ); // address of group servers LIST_DECL( sv_banlist ); +LIST_DECL( sv_blacklist ); LIST_DECL( sv_cmdlist_connect ); LIST_DECL( sv_cmdlist_begin ); LIST_DECL( sv_filterlist ); @@ -1026,6 +1027,11 @@ static void SV_ConnectionlessPacket( void ) { int i; size_t len; + if( SV_MatchAddress( &sv_blacklist, &net_from ) ) { + Com_DPrintf( "ignored blackholed connectionless packet\n" ); + return; + } + MSG_BeginReading(); MSG_ReadLong(); // skip the -1 marker @@ -1193,7 +1199,7 @@ static void SV_PacketEvent( void ) { client_t *client; netchan_t *netchan; int qport; - + // check for connectionless packet (0xffffffff) first // connectionless packets are processed even if the server is down if( *( int * )msg_read.data == -1 ) { |