From: Victor Julien Date: Mon, 20 Jul 2020 12:18:52 +0000 (+0200) Subject: nfs: update ts only if it changed X-Git-Tag: suricata-6.0.0-beta1~123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d65e5a7481628d533dd7d8fdedd675b46867d80;p=thirdparty%2Fsuricata.git nfs: update ts only if it changed Based on 8aa380600da15b95e74a6649e6003a1c484c4ce0 --- diff --git a/rust/src/nfs/nfs.rs b/rust/src/nfs/nfs.rs index 9f06c7c02e..2fbe6566f6 100644 --- a/rust/src/nfs/nfs.rs +++ b/rust/src/nfs/nfs.rs @@ -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) }