New Cvars:

sv_minqfversion: Set to the minimum allowable QuakeForge version you want
to allow on a server. QF clients prior to current CVS _will_not_work_ with
this cvar, as the QF version was not reported previously.

sv_maxrate: Change maximum rate algorithm; if sv_maxrate is nonzero, it is
the maximum rate allowed by the server. If it is unset, the maximum is
10000 like it used to be. The rate is silently capped, so it won't kick.

Cvar fixed: sv_timekick and friends; Now kicks on too little time passed
as well.

Functionality removed: "Last message repeated X times". It causes too much
trouble.
This commit is contained in:
Jeff Teunissen 2000-11-25 14:20:04 +00:00
parent 10fc22f7a0
commit 6f40c97643
3 changed files with 92 additions and 88 deletions

View file

@ -50,94 +50,89 @@
#include <strings.h>
#endif
quakeparms_t host_parms;
quakeparms_t host_parms;
qboolean host_initialized; // true if into command execution
qboolean host_initialized; // true if into command execution
double sv_frametime;
double realtime; // without any filtering or bounding
// (compatability)
int host_hunklevel;
double sv_frametime;
double realtime; // without any filtering or bounding
netadr_t master_adr[MAX_MASTERS]; // address of group servers
int host_hunklevel;
netadr_t master_adr[MAX_MASTERS]; // address of group servers
client_t *host_client; // current client
client_t *host_client; // current client
// DoS protection
// FLOOD_PING, FLOOD_LOG, FLOOD_CONNECT, FLOOD_STATUS, FLOOD_RCON, FLOOD_BAN
// fixme: these default values need to be tweaked after more testing
double netdosexpire[DOSFLOODCMDS] = { 1, 1, 2, 0.9, 1, 5 };
double netdosvalues[DOSFLOODCMDS] = { 12, 1, 3, 1, 1, 1 };
double netdosexpire[DOSFLOODCMDS] = { 1, 1, 2, 0.9, 1, 5 };
double netdosvalues[DOSFLOODCMDS] = { 12, 1, 3, 1, 1, 1 };
cvar_t *sv_netdosprotect; // tone down DoS from quake servers
cvar_t *sv_netdosprotect; // tone down DoS from quake servers
cvar_t *sv_allow_status;
cvar_t *sv_allow_log;
cvar_t *sv_allow_ping;
cvar_t *sv_allow_status;
cvar_t *sv_allow_log;
cvar_t *sv_allow_ping;
cvar_t *fs_globalcfg;
cvar_t *fs_globalcfg;
cvar_t *sv_mintic; // bound the size of the
cvar_t *sv_maxtic; // physics time tic
cvar_t *sv_mintic; // bound the size of the
cvar_t *sv_maxtic; // physics time tic
cvar_t *developer; // show extra messages
cvar_t *developer; // show extra messages
cvar_t *timeout; // seconds without any message
cvar_t *zombietime; // seconds to sink messages
cvar_t *timeout; // seconds without any message
cvar_t *zombietime; // seconds to sink messages after disconnect
// after disconnect
cvar_t *rcon_password; // password for remote server commands
cvar_t *rcon_password; // password for remote server
cvar_t *password; // password for entering the game
cvar_t *spectator_password; // password for entering as a spectator
// commands
cvar_t *password; // password for entering the game
cvar_t *spectator_password; // password for entering as a
cvar_t *allow_download;
cvar_t *allow_download_skins;
cvar_t *allow_download_models;
cvar_t *allow_download_sounds;
cvar_t *allow_download_maps;
// spectator
cvar_t *sv_highchars;
cvar_t *allow_download;
cvar_t *allow_download_skins;
cvar_t *allow_download_models;
cvar_t *allow_download_sounds;
cvar_t *allow_download_maps;
cvar_t *sv_phs;
cvar_t *sv_highchars;
cvar_t *pausable;
cvar_t *sv_phs;
extern cvar_t *sv_timekick;
extern cvar_t *sv_timekick_fuzz;
extern cvar_t *sv_timekick_interval;
cvar_t *pausable;
cvar_t *sv_minqfversion; // Minimum QF version allowed to connect
cvar_t *sv_maxrate; // Maximum allowable rate (silently capped)
extern cvar_t *sv_timekick;
extern cvar_t *sv_timekick_fuzz;
extern cvar_t *sv_timekick_interval;
cvar_t *sv_timestamps;
cvar_t *sv_timefmt;
cvar_t *sv_timestamps;
cvar_t *sv_timefmt;
//
// game rules mirrored in svs.info
//
cvar_t *fraglimit;
cvar_t *timelimit;
cvar_t *teamplay;
cvar_t *samelevel;
cvar_t *maxclients;
cvar_t *maxspectators;
cvar_t *deathmatch; // 0, 1, or 2
cvar_t *spawn;
cvar_t *watervis;
cvar_t *fraglimit;
cvar_t *timelimit;
cvar_t *teamplay;
cvar_t *samelevel;
cvar_t *maxclients;
cvar_t *maxspectators;
cvar_t *deathmatch; // 0, 1, or 2
cvar_t *spawn;
cvar_t *watervis;
cvar_t *hostname;
cvar_t *hostname;
QFile *sv_logfile;
QFile *sv_fraglogfile;
QFile *sv_logfile;
QFile *sv_fraglogfile;
void SV_AcceptClient (netadr_t adr, int userid, char *userinfo);
void Master_Shutdown (void);
void PR_Init_Cvars (void);
void SV_AcceptClient (netadr_t adr, int userid, char *userinfo);
void Master_Shutdown (void);
void PR_Init_Cvars (void);
//============================================================================
@ -673,6 +668,20 @@ SVC_DirectConnect (void)
A2C_PRINT);
return;
}
s = Info_ValueForKey (userinfo, "*qf_version");
if ((!s[0]) || sv_minqfversion->value) { // kick old clients?
if ((atof (s) + 0.005) < sv_minqfversion->value) {
Con_Printf ("%s: QF version %g is less than minimum version %g.\n",
NET_AdrToString (net_from),
atof (s),
sv_minqfversion->value);
Netchan_OutOfBandPrint (net_from,
"%c\nserver requires QuakeForge v%g or greater. Get it from http://www.quakeforge.net/\n",
A2C_PRINT, sv_minqfversion->value);
return;
}
}
// check for password or spectator_password
s = Info_ValueForKey (userinfo, "spectator");
if (s[0] && strcmp (s, "0")) {
@ -1498,7 +1507,7 @@ SV_InitLocal (void)
sv_aim = Cvar_Get ("sv_aim", "2", CVAR_NONE, "None");
sv_timekick =
Cvar_Get ("sv_timekick", "3", CVAR_NONE, "Time cheat protection");
Cvar_Get ("sv_timekick", "3", CVAR_SERVERINFO, "Time cheat protection");
sv_timekick_fuzz =
Cvar_Get ("sv_timekick_fuzz", "15", CVAR_NONE,
"Time cheat \"fuzz factor\"");
@ -1506,6 +1515,12 @@ SV_InitLocal (void)
Cvar_Get ("sv_timekick_interval", "30", CVAR_NONE,
"Time cheat check interval");
sv_minqfversion =
Cvar_Get ("sv_minqfversion", "0", CVAR_SERVERINFO, "Minimum QF version on client");
sv_maxrate =
Cvar_Get ("sv_maxrate", "0", CVAR_SERVERINFO, "Maximum allowable rate");
sv_allow_log =
Cvar_Get ("sv_allow_log", "1", CVAR_NONE, "Allow remote logging");
sv_allow_status =
@ -1746,10 +1761,12 @@ SV_ExtractFromUserinfo (client_t *cl)
val = Info_ValueForKey (cl->userinfo, "rate");
if (strlen (val)) {
i = atoi (val);
if (i < 500)
i = 500;
if (i > 10000)
i = 10000;
if ((sv_maxrate->int_val) && (i > sv_maxrate->int_val)) {
i = bound (500, i, sv_maxrate->int_val);
} else {
i = bound (500, i, 10000);
}
cl->netchan.rate = 1.0 / i;
}
// msg command

View file

@ -135,9 +135,6 @@ void Con_Printf (char *fmt, ...)
char msg2[MAXPRINTMSG];
char msg3[MAXPRINTMSG];
static char lastmessage[MAXPRINTMSG];
static int msgcount = 0;
time_t mytime = 0;
struct tm *local = NULL;
qboolean timestamps = false;
@ -152,19 +149,6 @@ void Con_Printf (char *fmt, ...)
strcat (outputbuf, msg);
return;
} else { // We want to output to console and maybe logfile
if (strncmp (lastmessage, msg, MAXPRINTMSG) == 0) {
msgcount += 1;
return;
} else {
strncpy (lastmessage, msg, MAXPRINTMSG);
if (msgcount > 0) {
Sys_Printf ("Last message repeated %d times\n", msgcount);
if (sv_logfile)
Qprintf (sv_logfile, "Last message repeated %d times\n", msgcount);
msgcount=0;
}
}
if (sv_timestamps && sv_timefmt && sv_timefmt->string && sv_timestamps->int_val)
timestamps = true;

View file

@ -1453,28 +1453,31 @@ extern qboolean nouse; // 1999-10-29 +USE fix by Maddes
void SV_RunCmd (usercmd_t *ucmd, qboolean inside)
{
edict_t *ent;
int i, n, oldmsec;
double tmp_time;
int i, n, oldmsec;
double tmp_time;
int tmp_time1, tmp_time2;
// To prevent a infinite loop
if (!inside) {
host_client->msecs += ucmd->msec;
if ((sv_timekick->int_val >= 1) &&
(tmp_time = realtime - host_client->last_check) >=
sv_timekick_interval->value) {
tmp_time *= (1000 + sv_timekick_fuzz->value);
if (host_client->msecs > (int) tmp_time) {
if ((sv_timekick->int_val)
&& (tmp_time = realtime - host_client->last_check) >= sv_timekick_interval->value) {
tmp_time1 = tmp_time * (1000 + sv_timekick_fuzz->value);
tmp_time2 = tmp_time * (1000 - sv_timekick_fuzz->value);
if ((host_client->msecs > (int) tmp_time1) || (host_client->msecs < (int) tmp_time2)) {
host_client->msec_cheating++;
SV_BroadcastPrintf( PRINT_HIGH,
SV_BroadcastPrintf (PRINT_HIGH,
va("%s thinks %d msecs pass in %f msecs. (Strike %d/%d)\n",
host_client->name, host_client->msecs, tmp_time,
host_client->msec_cheating, sv_timekick->int_val));
if (host_client->msec_cheating >= sv_timekick->int_val) {
SV_BroadcastPrintf(PRINT_HIGH, va("Strike %d for %s!!\n",
SV_BroadcastPrintf (PRINT_HIGH, va("Strike %d for %s!!\n",
host_client->msec_cheating, host_client->name));
SV_BroadcastPrintf(PRINT_HIGH, "Please see http://www.quakeforge.net/speed_cheat.php for infomation on QuakeForge's time cheat protection, and to explain how some may be cheating without knowing it.\n"
SV_BroadcastPrintf (PRINT_HIGH, "Please see http://www.quakeforge.net/speed_cheat.php for infomation on QuakeForge's time cheat protection, and to explain how some may be cheating without knowing it.\n"
);
SV_DropClient(host_client);
}