]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
nfs: update ts only if it changed
authorVictor Julien <victor@inliniac.net>
Mon, 20 Jul 2020 12:18:52 +0000 (14:18 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 21 Jul 2020 14:50:26 +0000 (16:50 +0200)
Based on 8aa380600da15b95e74a6649e6003a1c484c4ce0

rust/src/nfs/nfs.rs

index 9f06c7c02e84f7611f055fb16421d4042546427f..2fbe6566f6c0f989ca7f9f9cc9dc22d1123dd99d 100644 (file)
@@ -376,6 +376,13 @@ impl NFSState {
             ts: 0,
         }
     }
+
+    fn update_ts(&mut self, ts: u64) {
+        if ts != self.ts {
+            self.ts = ts;
+        }
+    }
+
     pub fn free(&mut self) {
         self.files.free();
     }
@@ -1425,7 +1432,7 @@ pub extern "C" fn rs_nfs_parse_request(flow: &mut Flow,
     let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
     SCLogDebug!("parsing {} bytes of request data", input_len);
 
-    state.ts = flow.get_last_time().as_secs();
+    state.update_ts(flow.get_last_time().as_secs());
     state.parse_tcp_data_ts(buf)
 }
 
@@ -1450,7 +1457,7 @@ pub extern "C" fn rs_nfs_parse_response(flow: &mut Flow,
     SCLogDebug!("parsing {} bytes of response data", input_len);
     let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
 
-    state.ts = flow.get_last_time().as_secs();
+    state.update_ts(flow.get_last_time().as_secs());
     state.parse_tcp_data_tc(buf)
 }