]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
files: simplify pruning logic
authorVictor Julien <victor@inliniac.net>
Fri, 22 Nov 2019 14:33:27 +0000 (15:33 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 25 Nov 2019 18:54:31 +0000 (19:54 +0100)
Since ebcc4db84ac2c1957a6cc23b5154d7d6333f4cb8 the flow worker runs
file pruning after parsing, detection and loging. This means we can
simplify the pruning logic. If a file is in state >= CLOSED, we can
prune it. Detection and outputs will have had a final chance to
process it.

Remove the calls to the pruning code from Rust. They are no longer
needed.

rust/src/filetracker.rs
src/util-file.c

index 0dbfc90fd8cafa3fc9e150cefd845f4611355ac1..233eefbedfcbd8a383a96aa656ae33a4740d6aa7 100644 (file)
@@ -110,7 +110,6 @@ impl FileTransferTracker {
         }
         self.file_open = false;
         self.tracked = 0;
-        files.files_prune();
     }
 
     pub fn trunc (&mut self, files: &mut FileContainer, flags: u16) {
@@ -120,7 +119,6 @@ impl FileTransferTracker {
         let myflags = flags | 1; // TODO util-file.c::FILE_TRUNCATED
         files.file_close(&self.track_id, myflags);
         SCLogDebug!("truncated file");
-        files.files_prune();
         self.file_is_truncated = true;
     }
 
@@ -322,7 +320,6 @@ impl FileTransferTracker {
                 consumed += data.len();
             }
         }
-        files.files_prune();
         consumed as u32
     }
 
index 88a086adce265f3b94765b3f529372be402702cb..0c1e22885401df03a49fa7f036e981d0f7bda63c 100644 (file)
@@ -332,10 +332,7 @@ static int FilePruneFile(File *file)
     SCLogDebug("file->state %d. Is >= FILE_STATE_CLOSED: %s", file->state, (file->state >= FILE_STATE_CLOSED) ? "yes" : "no");
 
     /* file is done when state is closed+, logging/storing is done (if any) */
-    if (file->state >= FILE_STATE_CLOSED &&
-        (!RunModeOutputFileEnabled() || (file->flags & FILE_LOGGED)) &&
-        (!RunModeOutputFiledataEnabled() || (file->flags & (FILE_STORED|FILE_NOSTORE))))
-    {
+    if (file->state >= FILE_STATE_CLOSED) {
         SCReturnInt(1);
     } else {
         SCReturnInt(0);