mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-10 14:52:08 +00:00
Basic DoS flood attack protections.
Commands added: netdosexpire, netdosvalues (oops, forgot from last ;)
This commit is contained in:
parent
afc467b84f
commit
bafb8f7239
1 changed files with 68 additions and 0 deletions
|
@ -1167,6 +1167,70 @@ void SV_WriteIP_f (void)
|
|||
fclose (f);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
netDoSexpire_f
|
||||
=================
|
||||
*/
|
||||
void SV_netDoSexpire_f (void)
|
||||
{
|
||||
int arg1;
|
||||
int i;
|
||||
|
||||
if (Cmd_Argc() == 1)
|
||||
{
|
||||
Con_Printf ("Current DoS prot. expire settings: ");
|
||||
for (i=0;i<DOSFLOODCMDS;i++) Con_Printf("%d ",netdosexpire[i]);
|
||||
Con_Printf("\n");
|
||||
if (!sv_netdosprotect->value) Con_Printf("(disabled)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Cmd_Argc() != DOSFLOODCMDS+1)
|
||||
{
|
||||
Con_Printf ("Usage: netdosexpire <ping> <log> <connect> <status> <rcon> <ban>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0;i<DOSFLOODCMDS;i++) {
|
||||
arg1 = atoi(Cmd_Argv(i+1));
|
||||
if (arg1>0) netdosexpire[i]=arg1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
DoSvalues_f
|
||||
=================
|
||||
*/
|
||||
void SV_netDoSvalues_f (void)
|
||||
{
|
||||
int arg1;
|
||||
int i;
|
||||
|
||||
if (Cmd_Argc() == 1)
|
||||
{
|
||||
Con_Printf ("Current DoS prot. value settings: ");
|
||||
for (i=0;i<DOSFLOODCMDS;i++) Con_Printf("%d ",netdosvalues[i]);
|
||||
Con_Printf("\n");
|
||||
if (!sv_netdosprotect->value) Con_Printf("(disabled)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Cmd_Argc() != DOSFLOODCMDS+1)
|
||||
{
|
||||
Con_Printf ("Usage: netdosvalues <ping> <log> <connect> <status> <rcon> <ban>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0;i<DOSFLOODCMDS;i++) {
|
||||
arg1 = atoi(Cmd_Argv(i+1));
|
||||
if (arg1>0) netdosvalues[i]=arg1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SV_SendBan
|
||||
|
@ -1517,6 +1581,10 @@ void SV_InitLocal (void)
|
|||
|
||||
pausable = Cvar_Get("pausable", "1", CVAR_NONE, "None");
|
||||
|
||||
// DoS protection
|
||||
Cmd_AddCommand ("dosexpire", SV_netDoSexpire_f);
|
||||
Cmd_AddCommand ("dosvalues", SV_netDoSvalues_f);
|
||||
|
||||
Cmd_AddCommand ("addip", SV_AddIP_f);
|
||||
Cmd_AddCommand ("removeip", SV_RemoveIP_f);
|
||||
Cmd_AddCommand ("listip", SV_ListIP_f);
|
||||
|
|
Loading…
Reference in a new issue