From bafb8f72391806d3a7ee811707ec0c3810340078 Mon Sep 17 00:00:00 2001 From: Dabb Date: Sun, 13 Aug 2000 14:34:49 +0000 Subject: [PATCH] Basic DoS flood attack protections. Commands added: netdosexpire, netdosvalues (oops, forgot from last ;) --- source/sv_main.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/source/sv_main.c b/source/sv_main.c index 3b2d5a9..821af79 100644 --- a/source/sv_main.c +++ b/source/sv_main.c @@ -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;ivalue) Con_Printf("(disabled)\n"); + return; + } + + if (Cmd_Argc() != DOSFLOODCMDS+1) + { + Con_Printf ("Usage: netdosexpire \n"); + return; + } + + for (i=0;i0) 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;ivalue) Con_Printf("(disabled)\n"); + return; + } + + if (Cmd_Argc() != DOSFLOODCMDS+1) + { + Con_Printf ("Usage: netdosvalues \n"); + return; + } + + for (i=0;i0) 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);