]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
smb: update ts only if it changed
authorVictor Julien <victor@inliniac.net>
Sun, 17 May 2020 12:48:52 +0000 (14:48 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 16 Oct 2020 09:22:50 +0000 (11:22 +0200)
(cherry picked from commit 8aa380600da15b95e74a6649e6003a1c484c4ce0)

rust/src/smb/smb.rs

index 5dd9c77b85f7e290471010634be45fe5b529b210..e785c1cf6e0ee6cec6d47e860fe3f0b1d4a145f7 100644 (file)
@@ -930,6 +930,12 @@ impl SMBState {
         return None;
     }
 
+    fn update_ts(&mut self, ts: u64) {
+        if ts != self.ts {
+            self.ts = ts;
+        }
+    }
+
     /* generic TX has no type_data and is only used to
      * track a single cmd request/reply pair. */
 
@@ -1848,7 +1854,7 @@ pub extern "C" fn rs_smb_parse_request_tcp(flow: &mut Flow,
         state.ts_gap = true;
     }
 
-    state.ts = flow.get_last_time().as_secs();
+    state.update_ts(flow.get_last_time().as_secs());
     if state.parse_tcp_data_ts(buf) == 0 {
         return 1;
     } else {
@@ -1887,7 +1893,7 @@ pub extern "C" fn rs_smb_parse_response_tcp(flow: &mut Flow,
         state.tc_gap = true;
     }
 
-    state.ts = flow.get_last_time().as_secs();
+    state.update_ts(flow.get_last_time().as_secs());
     if state.parse_tcp_data_tc(buf) == 0 {
         return 1;
     } else {