- Switch master server protocol to dpmaster for better game separation. Based partly on patch by Zack Middleton

- Get rid of ugly cvars sv_heartbeat and cl_gamename and replace with single com_gamename
- Remove sv_flatline. Flatlines are ignored by dpmaster and are considered to be insecure because flatlines can be udp-spoofed.
This commit is contained in:
Thilo Schulz 2011-07-29 13:46:50 +00:00
parent 23f6fd1633
commit ba385fa43c
9 changed files with 41 additions and 45 deletions

View file

@ -109,8 +109,6 @@ cvar_t *cl_guidServerUniq;
cvar_t *cl_consoleKeys;
cvar_t *cl_gamename;
clientActive_t cl;
clientConnection_t clc;
clientStatic_t cls;
@ -2306,9 +2304,9 @@ void CL_CheckForResend( void ) {
#endif
// The challenge request shall be followed by a client challenge so no malicious server can hijack this connection.
// Add the heartbeat gamename so the server knows we're running the correct game and can reject the client
// Add the gamename so the server knows we're running the correct game or can reject the client
// with a meaningful message
Com_sprintf(data, sizeof(data), "getchallenge %d %s", clc.challenge, Cvar_VariableString("sv_heartbeat"));
Com_sprintf(data, sizeof(data), "getchallenge %d %s", clc.challenge, com_gamename->string);
NET_OutOfBandPrint(NS_CLIENT, clc.serverAddress, "%s", data);
break;
@ -3472,8 +3470,6 @@ void CL_Init( void ) {
// ~ and `, as keys and characters
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE);
cl_gamename = Cvar_Get("cl_gamename", GAMENAME_FOR_MASTER, CVAR_TEMP);
// userinfo
Cvar_Get ("name", "UnnamedPlayer", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE );
@ -3696,9 +3692,19 @@ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
char info[MAX_INFO_STRING];
char *infoString;
int prot;
char *gamename;
infoString = MSG_ReadString( msg );
// if this isn't the correct gamename, ignore it
gamename = Info_ValueForKey( infoString, "gamename" );
if (gamename && *gamename && strcmp(gamename, com_gamename->string))
{
Com_DPrintf( "Game mismatch in info packet: %s\n", infoString );
return;
}
// if this isn't the correct protocol version, ignore it
prot = atoi( Info_ValueForKey( infoString, "protocol" ) );
@ -4078,16 +4084,17 @@ void CL_GlobalServers_f( void ) {
if(v4enabled)
{
Com_sprintf(command, sizeof(command), "getserversExt %s %s",
cl_gamename->string, Cmd_Argv(2));
com_gamename->string, Cmd_Argv(2));
}
else
{
Com_sprintf(command, sizeof(command), "getserversExt %s %s ipv6",
cl_gamename->string, Cmd_Argv(2));
com_gamename->string, Cmd_Argv(2));
}
}
else
Com_sprintf(command, sizeof(command), "getservers %s", Cmd_Argv(2));
Com_sprintf(command, sizeof(command), "getservers %s %s",
com_gamename->string, Cmd_Argv(2));
for (i=3; i < count; i++)
{