changeset 24:f22cfa761753

Update_blocklist() was setting timestamp of latest hit, this is incorrect as we do not know from whence entries already in netfilter are from. Fixed.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 15 Aug 2009 23:11:20 +0300
parents cb0a4b747cf0
children 34dcb7462043
files maltfilter
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/maltfilter	Sat Aug 15 23:05:29 2009 +0300
+++ b/maltfilter	Sat Aug 15 23:11:20 2009 +0300
@@ -463,7 +463,7 @@
         $blocklist{$2} = $mdate;
       }
       $newlist{$2} = $mdate;
-      update_entry(\%statlist, $mip, $mdate, "IPTABLES", "");
+      update_entry(\%statlist, $mip, -1, "IPTABLES", "");
     }
   }
   close(STATUS);
@@ -525,15 +525,17 @@
     $struct->{$mip}{"reason"}{$mclass}{"msg"} = $mreason;
   }
 
-  if (!defined($struct->{$mip}{"date1"})) {
-    $struct->{$mip}{"date1"} = $mdate;
-  }
-  $struct->{$mip}{"date2"} = $mdate;
+  if ($mdate > 0) {
+    if (!defined($struct->{$mip}{"date1"})) {
+      $struct->{$mip}{"date1"} = $mdate;
+    }
+    $struct->{$mip}{"date2"} = $mdate;
     
-  if (!defined($struct->{$mip}{"reason"}{$mclass}{"date2"})) {
+    if (!defined($struct->{$mip}{"reason"}{$mclass}{"date2"})) {
+      $struct->{$mip}{"reason"}{$mclass}{"date2"} = $mdate;
+    }
     $struct->{$mip}{"reason"}{$mclass}{"date2"} = $mdate;
   }
-  $struct->{$mip}{"reason"}{$mclass}{"date2"} = $mdate;
 
   return $cnt;
 }