From 29a1b13e7ac8f20512b7a066c351bad614998f83 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Tue, 25 Jan 2022 11:16:41 +0100 Subject: Improved Plotly/Dash example. It is now somehow informative. * TCP timeout after FIN/RST: switched back to the value from a35fc1d5ea8570609cc0c8cf6edadc81f8f5bb76 * py-flow-info: reset 'guessed' flag after detection/detection-update received Signed-off-by: Toni Uhlig --- nDPId.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'nDPId.c') diff --git a/nDPId.c b/nDPId.c index 3320f5733..c4666c3ca 100644 --- a/nDPId.c +++ b/nDPId.c @@ -1540,12 +1540,13 @@ static uint64_t get_l4_protocol_idle_time(uint8_t l4_protocol) static int is_l4_protocol_timed_out(struct nDPId_workflow const * const workflow, struct nDPId_flow_basic const * const flow_basic) { + uint64_t sdiff = flow_basic->last_seen % nDPId_options.flow_scan_interval; uint64_t itime = - get_l4_protocol_idle_time(flow_basic->l4_protocol) - (flow_basic->last_seen % nDPId_options.flow_scan_interval); + get_l4_protocol_idle_time(flow_basic->l4_protocol) - sdiff; return (flow_basic->last_seen + itime <= workflow->last_time) || (flow_basic->tcp_fin_rst_seen == 1 && - flow_basic->last_seen + nDPId_options.tcp_max_post_end_flow_time <= workflow->last_time); + flow_basic->last_seen + nDPId_options.tcp_max_post_end_flow_time - sdiff <= workflow->last_time); } static int is_flow_update_required(struct nDPId_workflow const * const workflow, @@ -3339,7 +3340,7 @@ static void ndpi_process_packet(uint8_t * const args, struct nDPId_flow_basic * const flow_basic_to_process = *(struct nDPId_flow_basic **)tree_result; /* Update last seen timestamp for timeout handling. */ flow_basic_to_process->last_seen = workflow->last_time; - /* TCP-FIN: indicates that at least one side wants to end the connection. */ + /* TCP-FIN/TCP-RST: indicates that at least one side wants to end the connection. */ if (flow_basic.tcp_fin_rst_seen != 0) { flow_basic_to_process->tcp_fin_rst_seen = 1; @@ -4380,7 +4381,7 @@ int main(int argc, char ** argv) sleep(1); } - if (nDPId_main_thread_shutdown == 1 && stop_reader_threads() != 0) + if (stop_reader_threads() != 0) { return 1; } -- cgit v1.2.3