aboutsummaryrefslogtreecommitdiff
path: root/example/reader_util.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2019-12-13 12:50:52 +0100
committerLuca Deri <deri@ntop.org>2019-12-13 12:50:52 +0100
commit81012b32017e818fc9597ce40c0c63eaf8908666 (patch)
tree069975da60f2534a1bea8b8b5cdf7b2ba406d98f /example/reader_util.c
parent406aa12468bcab3850df74e28398780294094508 (diff)
CSV output enhancements
Diffstat (limited to 'example/reader_util.c')
-rw-r--r--example/reader_util.c10
1 files changed, 7 insertions, 3 deletions
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);