comparison maltfilter @ 57:a70493b6c916

Clear %statlist and %ignorelist when re-initializing (due to HUP), so we don't count stats twice.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 16 Aug 2009 22:14:48 +0300
parents 30a5b56b753e
children a780a23e19a8
comparison
equal deleted inserted replaced
56:e81bca155440 57:a70493b6c916
8 ############################################################################# 8 #############################################################################
9 use strict; 9 use strict;
10 use Date::Parse; 10 use Date::Parse;
11 use Net::IP; 11 use Net::IP;
12 12
13 my $progversion = "0.13.0"; 13 my $progversion = "0.13.1";
14 my $progbanner = 14 my $progbanner =
15 "Malicious Attack Livid Termination Filter daemon (maltfilter) v$progversion\n". 15 "Malicious Attack Livid Termination Filter daemon (maltfilter) v$progversion\n".
16 "Programmed by Matti 'ccr' Hamalainen <ccr\@tnsp.org>\n". 16 "Programmed by Matti 'ccr' Hamalainen <ccr\@tnsp.org>\n".
17 "(C) Copyright 2009 Tecnic Software productions (TNSP)\n"; 17 "(C) Copyright 2009 Tecnic Software productions (TNSP)\n";
18 18
728 } 728 }
729 729
730 ### Initialize 730 ### Initialize
731 sub malt_init 731 sub malt_init
732 { 732 {
733 %statlist = ();
734 undef(%statlist);
735 %ignorelist = ();
736 undef(%ignorelist);
737 mlog(0, "Updating initial blocklist from netfilter.\n");
738 update_blocklist(-1);
739
733 foreach my $filename (@scanfiles_once) { 740 foreach my $filename (@scanfiles_once) {
734 mlog(0, "Parsing [once] ".$filename." ...\n"); 741 mlog(0, "Parsing [once] ".$filename." ...\n");
735 if (open(INFILE, "<", $filename)) { 742 if (open(INFILE, "<", $filename)) {
736 while (<INFILE>) { 743 while (<INFILE>) {
737 chomp; 744 chomp;
988 open($LOGFILE, ">>", $settings{"LOGFILE"}) or die("Could not open logfile '".$settings{"LOGFILE"}."' for writing!\n"); 995 open($LOGFILE, ">>", $settings{"LOGFILE"}) or die("Could not open logfile '".$settings{"LOGFILE"}."' for writing!\n");
989 mlog(-1, "Log started\n"); 996 mlog(-1, "Log started\n");
990 } 997 }
991 998
992 # Initialize 999 # Initialize
993 mlog(0, "Updating initial blocklist from netfilter.\n");
994 update_blocklist(-1);
995 malt_init(); 1000 malt_init();
996 1001
997 # Fork to background, unless dry-running 1002 # Fork to background, unless dry-running
998 if ($settings{"DRY_RUN"}) { 1003 if ($settings{"DRY_RUN"}) {
999 if ($reportmode) { 1004 if ($reportmode) {