- 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

@ -294,8 +294,6 @@ extern cvar_t *sv_lanForceRate;
extern cvar_t *sv_strictAuth;
#endif
extern cvar_t *sv_banFile;
extern cvar_t *sv_heartbeat;
extern cvar_t *sv_flatline;
extern serverBan_t serverBans[SERVER_MAXBANS];
extern int serverBansCount;

View file

@ -70,10 +70,10 @@ void SV_GetChallenge(netadr_t from)
if(gameName && *gameName)
{
// reject client if the heartbeat string sent by the client doesn't match ours
if(strcmp(gameName, sv_heartbeat->string))
if(strcmp(gameName, com_gamename->string))
{
NET_OutOfBandPrint(NS_SERVER, from, "print\nGame mismatch: This is a %s server\n",
sv_heartbeat->string);
com_gamename->string);
return;
}
}

View file

@ -686,8 +686,6 @@ void SV_Init (void)
sv_strictAuth = Cvar_Get ("sv_strictAuth", "1", CVAR_ARCHIVE );
#endif
sv_banFile = Cvar_Get("sv_banFile", "serverbans.dat", CVAR_ARCHIVE);
sv_heartbeat = Cvar_Get("sv_heartbeat", HEARTBEAT_FOR_MASTER, CVAR_INIT);
sv_flatline = Cvar_Get("sv_flatline", FLATLINE_FOR_MASTER, CVAR_INIT);
// initialize bot cvars so they are listed and can be set before loading the botlib
SV_BotInitCvars();

View file

@ -61,9 +61,6 @@ cvar_t *sv_lanForceRate; // dedicated 1 (LAN) server forces local client rates t
cvar_t *sv_strictAuth;
#endif
cvar_t *sv_banFile;
cvar_t *sv_heartbeat; // Heartbeat string that is sent to the master
cvar_t *sv_flatline; // If the master server supports it we can send a flatline
// when server is killed
serverBan_t serverBans[SERVER_MAXBANS];
int serverBansCount = 0;
@ -338,11 +335,11 @@ Informs all masters that this server is going down
void SV_MasterShutdown( void ) {
// send a hearbeat right now
svs.nextHeartbeatTime = -9999;
SV_MasterHeartbeat(sv_flatline->string);
SV_MasterHeartbeat(HEARTBEAT_FOR_MASTER);
// send it again to minimize chance of drops
svs.nextHeartbeatTime = -9999;
SV_MasterHeartbeat(sv_flatline->string);
SV_MasterHeartbeat(HEARTBEAT_FOR_MASTER);
// when the master tries to poll the server, it won't respond, so
// it will be removed from the list
@ -644,6 +641,8 @@ void SVC_Info( netadr_t from ) {
// to prevent timed spoofed reply packets that add ghost servers
Info_SetValueForKey( infostring, "challenge", Cmd_Argv(1) );
Info_SetValueForKey( infostring, "gamename", com_gamename->string );
#ifdef LEGACY_PROTOCOL
if(com_legacyprotocol->integer > 0)
Info_SetValueForKey(infostring, "protocol", va("%i", com_legacyprotocol->integer));
@ -1154,7 +1153,7 @@ void SV_Frame( int msec ) {
SV_SendClientMessages();
// send a heartbeat to the master if needed
SV_MasterHeartbeat(sv_heartbeat->string);
SV_MasterHeartbeat(HEARTBEAT_FOR_MASTER);
}
/*