From 81012b32017e818fc9597ce40c0c63eaf8908666 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Fri, 13 Dec 2019 12:50:52 +0100 Subject: CSV output enhancements --- example/reader_util.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'example/reader_util.c') diff --git a/example/reader_util.c b/example/reader_util.c index 14174c3d1..1d19e8b41 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -786,7 +786,7 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow newflow->iat_s_to_c = ndpi_alloc_data_analysis(DATA_ANALUYSIS_SLIDING_WINDOW); newflow->pktlen_c_to_s = ndpi_alloc_data_analysis(DATA_ANALUYSIS_SLIDING_WINDOW), newflow->pktlen_s_to_c = ndpi_alloc_data_analysis(DATA_ANALUYSIS_SLIDING_WINDOW), - newflow->iat_flow = ndpi_alloc_data_analysis(DATA_ANALUYSIS_SLIDING_WINDOW);; + newflow->iat_flow = ndpi_alloc_data_analysis(DATA_ANALUYSIS_SLIDING_WINDOW); if(version == IPVERSION) { inet_ntop(AF_INET, &newflow->src_ip, newflow->src_name, sizeof(newflow->src_name)); @@ -1170,7 +1170,9 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow, if(flow->entropy.flow_last_pkt_time.tv_sec) { ndpi_timer_sub(&when, &flow->entropy.flow_last_pkt_time, &tdiff); - if(flow->iat_flow) { + if(flow->iat_flow + && (tdiff.tv_sec >= 0) /* Discard backward time */ + ) { u_int32_t ms = ndpi_timeval_to_milliseconds(tdiff); if(ms > 0) @@ -1183,7 +1185,9 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow, if(flow->entropy.src2dst_last_pkt_time.tv_sec) { ndpi_timer_sub(&when, &flow->entropy.src2dst_last_pkt_time, &tdiff); - if(flow->iat_c_to_s) { + if(flow->iat_c_to_s + && (tdiff.tv_sec >= 0) /* Discard backward time */ + ) { u_int32_t ms = ndpi_timeval_to_milliseconds(tdiff); ndpi_data_add_value(flow->iat_c_to_s, ms); -- cgit v1.2.3