summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_client.c5
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_public.h8
-rw-r--r--src/game/g_svcmds.c73
-rw-r--r--src/game/q_shared.h17
5 files changed, 78 insertions, 26 deletions
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 7bb6dd73..af242be3 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1103,10 +1103,13 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot )
trap_GetUserinfo( clientNum, userinfo, sizeof( userinfo ) );
+ // IP filtering
+ // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=500
+ // recommanding PB based IP / GUID banning, the builtin system is pretty limited
// check to see if they are on the banned IP list
value = Info_ValueForKey( userinfo, "ip" );
if( G_FilterPacket( value ) )
- return "Banned.";
+ return "You are banned from this server.";
// check for a password
value = Info_ValueForKey( userinfo, "password" );
diff --git a/src/game/g_local.h b/src/game/g_local.h
index d614fb28..ed67b3ee 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -806,6 +806,7 @@ void trap_FS_Read( void *buffer, int len, fileHandle_t f );
void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
void trap_FS_FCloseFile( fileHandle_t f );
int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
+int trap_FS_Seek( fileHandle_t f, long offset, int origin ); // fsOrigin_t
void trap_SendConsoleCommand( int exec_when, const char *text );
void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags );
void trap_Cvar_Update( vmCvar_t *cvar );
diff --git a/src/game/g_public.h b/src/game/g_public.h
index eb6440ed..2d639cad 100644
--- a/src/game/g_public.h
+++ b/src/game/g_public.h
@@ -23,6 +23,11 @@
// in entityStates (level eType), so the game must explicitly flag
// special server behaviors
#define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects
+
+// TTimo
+// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=551
+#define SVF_CLIENTMASK 0x00000002
+
#define SVF_BOT 0x00000008
#define SVF_BROADCAST 0x00000020 // send to all connected clients
#define SVF_PORTAL 0x00000040 // merge a second pvs at origin2 into snapshots
@@ -209,6 +214,9 @@ typedef enum {
G_TRACECAPSULE, // ( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask );
G_ENTITY_CONTACTCAPSULE, // ( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
+ // 1.32
+ G_FS_SEEK,
+
BOTLIB_SETUP = 200, // ( void );
BOTLIB_SHUTDOWN, // ( void );
BOTLIB_LIBVAR_SET,
diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c
index 7386d90b..c14eddef 100644
--- a/src/game/g_svcmds.c
+++ b/src/game/g_svcmds.c
@@ -30,7 +30,8 @@ You can add or remove addresses from the filter list with:
addip <ip>
removeip <ip>
-The ip address is specified in dot format, and any unspecified digits will match any value, so you can specify an entire class C network with "addip 192.246.40".
+The ip address is specified in dot format, and you can use '*' to match any value
+so you can specify an entire class C network with "addip 192.246.40.*"
Removeip will only remove an address specified exactly the same way. You cannot addip a subnet, then removeip a single host.
@@ -43,6 +44,10 @@ If 1 (the default), then ip addresses matching the current list will be prohibit
If 0, then only addresses matching the list will be allowed. This lets you easily set up a private game, or a game that only allows players from your local network.
+TTimo NOTE: for persistence, bans are stored in g_banIPs cvar MAX_CVAR_VALUE_STRING
+The size of the cvar string buffer is limiting the banning to around 20 masks
+this could be improved by putting some g_banIPs2 g_banIps3 etc. maybe
+still, you should rely on PB for banning instead
==============================================================================
*/
@@ -84,6 +89,17 @@ static qboolean StringToFilter( char *s, ipFilter_t *f )
{
if( *s < '0' || *s > '9' )
{
+ if( *s == '*' ) // 'match any'
+ {
+ //b[ i ] and m[ i ] to 0
+ s++;
+ if ( !*s )
+ break;
+
+ s++;
+ continue;
+ }
+
G_Printf( "Bad filter address: %s\n", s );
return qfalse;
}
@@ -95,8 +111,7 @@ static qboolean StringToFilter( char *s, ipFilter_t *f )
num[ j ] = 0;
b[ i ] = atoi( num );
- if( b[ i ] != 0 )
- m[ i ] = 255;
+ m[ i ] = 255;
if( !*s )
break;
@@ -117,23 +132,43 @@ UpdateIPBans
*/
static void UpdateIPBans( void )
{
- byte b[ 4 ];
- int i;
- char iplist[ MAX_INFO_STRING ];
+ byte b[ 4 ];
+ byte m[ 4 ];
+ int i, j;
+ char iplist_final[ MAX_CVAR_VALUE_STRING ];
+ char ip[ 64 ];
- *iplist = 0;
+ *iplist_final = 0;
- for( i = 0 ; i < numIPFilters ; i++ )
- {
- if( ipFilters[ i ].compare == 0xffffffff )
- continue;
-
- *(unsigned *)b = ipFilters[ i ].compare;
- Com_sprintf( iplist + strlen( iplist ), sizeof( iplist ) - strlen( iplist ),
- "%i.%i.%i.%i ", b[ 0 ], b[ 1 ], b[ 2 ], b[ 3 ] );
- }
-
- trap_Cvar_Set( "g_banIPs", iplist );
+ for( i = 0 ; i < numIPFilters ; i++ )
+ {
+ if( ipFilters[ i ].compare == 0xffffffff )
+ continue;
+
+ *(unsigned *)b = ipFilters[ i ].compare;
+ *(unsigned *)m = ipFilters[ i ].mask;
+ *ip = 0;
+
+ for( j = 0 ; j < 4 ; j++ )
+ {
+ if( m[ j ] != 255 )
+ Q_strcat( ip, sizeof( ip ), "*" );
+ else
+ Q_strcat( ip, sizeof( ip ), va( "%i", b[ j ] ) );
+
+ Q_strcat( ip, sizeof( ip ), ( j < 3 ) ? "." : " " );
+ }
+
+ if( strlen( iplist_final ) + strlen( ip ) < MAX_CVAR_VALUE_STRING )
+ Q_strcat( iplist_final, sizeof( iplist_final ), ip );
+ else
+ {
+ Com_Printf( "g_banIPs overflowed at MAX_CVAR_VALUE_STRING\n" );
+ break;
+ }
+ }
+
+ trap_Cvar_Set( "g_banIPs", iplist_final );
}
/*
@@ -212,7 +247,7 @@ G_ProcessIPBans
void G_ProcessIPBans( void )
{
char *s, *t;
- char str[ MAX_TOKEN_CHARS ];
+ char str[ MAX_CVAR_VALUE_STRING ];
Q_strncpyz( str, g_banIPs.string, sizeof( str ) );
diff --git a/src/game/q_shared.h b/src/game/q_shared.h
index 4ff5fa52..fefeed3b 100644
--- a/src/game/q_shared.h
+++ b/src/game/q_shared.h
@@ -20,7 +20,7 @@
// q_shared.h -- included first by ALL program modules.
// A user mod should never modify this file
-#define Q3_VERSION "Q3 1.29h"
+#define Q3_VERSION "Q3 1.32"
#define MAX_TEAMNAME 32
@@ -68,10 +68,6 @@
#ifdef Q3_VM
-//#ifdef __linux__
-//#undef __linux__
-//#endif
-
#include "bg_lib.h"
#else
@@ -444,6 +440,14 @@ void *Hunk_AllocDebug( int size, ha_pref preference, char *label, char *file, in
void *Hunk_Alloc( int size, ha_pref preference );
#endif
+#ifdef __linux__
+// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
+// custom Snd_Memset implementation for glibc memset bug workaround
+void Snd_Memset (void* dest, const int val, const size_t count);
+#else
+#define Snd_Memset Com_Memset
+#endif
+
#if !( defined __VECTORC )
void Com_Memset (void* dest, const int val, const size_t count);
void Com_Memcpy (void* dest, const void* src, const size_t count);
@@ -1378,6 +1382,7 @@ typedef struct qtime_s {
// server browser sources
+// TTimo: AS_MPLAYER is no longer used
#define AS_LOCAL 0
#define AS_MPLAYER 1
#define AS_GLOBAL 2
@@ -1405,7 +1410,7 @@ typedef enum _flag_status {
-#define MAX_GLOBAL_SERVERS 2048
+#define MAX_GLOBAL_SERVERS 4096
#define MAX_OTHER_SERVERS 128
#define MAX_PINGREQUESTS 32
#define MAX_SERVERSTATUSREQUESTS 16