diff --git a/src/extraflib/expiredflowshash.h b/src/extraflib/expiredflowshash.h index 9b2eb887184385f4bf3112e2aa7127bdad50eff4..6ff9979352847dc0f6233cd574793d83a0dc033c 100644 --- a/src/extraflib/expiredflowshash.h +++ b/src/extraflib/expiredflowshash.h @@ -3,8 +3,10 @@ #include "protocols.h" typedef struct eflow_data { - unsigned long long timestamp; - unsigned long long packets_count, bytes_count; + unsigned long long timestamp_first; + unsigned long long timestamp_last; + unsigned long long packets_count; + unsigned long long bytes_count; ip_addr saddr, daddr; u_short sport, dport; u_char ptcl; @@ -14,8 +16,10 @@ typedef struct eflow_data { } eflow_data; typedef struct flow_data { - unsigned long long timestamp; - unsigned long long packets_count, bytes_count; + unsigned long long timestamp_first; + unsigned long long timestamp_last; + unsigned long long packets_count; + unsigned long long bytes_count; ip_addr saddr, daddr; u_short sport, dport; u_char ptcl; diff --git a/src/extraflib/exprflow.c b/src/extraflib/exprflow.c index 3be69e3dfcc3ea1d3ecc40e7f99eea6cb39951a1..ee43b9c8d7ffb143b8842666094cbcf69cb5853e 100644 --- a/src/extraflib/exprflow.c +++ b/src/extraflib/exprflow.c @@ -73,6 +73,7 @@ void add_toflow(struct exfl_data *data, eflow_data record, flows_stat *stats) { lookup->node->flow.packets_count++; lookup->node->flow.bytes_count += record.bytes_count; lookup->node->flow.epoch = data->epoch; + lookup->node->flow.timestamp_last = record.timestamp_last; shift_node(data, lookup->node); pthread_mutex_unlock( &(data->mutex) ); @@ -533,7 +534,8 @@ static int exprflow_process(mapidflib_function_instance_t *instance, MAPI_UNUSED record.daddr = ip->daddr; record.sport = ntohs(tcp->sport); record.dport = ntohs(tcp->dport); - record.timestamp = pkt_head->ts; + record.timestamp_first = pkt_head->ts; + record.timestamp_last = pkt_head->ts; record.epoch = data->epoch; record.valid = data->epoch > TIMEOUT; record.ptcl = ip->ptcl; @@ -548,7 +550,8 @@ static int exprflow_process(mapidflib_function_instance_t *instance, MAPI_UNUSED record.daddr = ip->daddr; record.sport = ntohs(udp->sport); record.dport = ntohs(udp->dport); - record.timestamp = pkt_head->ts; + record.timestamp_first = pkt_head->ts; + record.timestamp_last = pkt_head->ts; record.epoch = data->epoch; record.valid = data->epoch > TIMEOUT; record.ptcl = ip->ptcl; @@ -561,7 +564,8 @@ static int exprflow_process(mapidflib_function_instance_t *instance, MAPI_UNUSED record.saddr = ip->saddr; record.daddr = ip->daddr; record.sport = record.dport = ntohs(0); - record.timestamp = pkt_head->ts; + record.timestamp_first = pkt_head->ts; + record.timestamp_last = pkt_head->ts; record.epoch = data->epoch; record.valid = data->epoch > TIMEOUT; record.ptcl = ip->ptcl;