diff options
author | Luca Deri <deri@ntop.org> | 2017-05-24 16:06:23 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2017-05-24 16:06:23 +0200 |
commit | 904210e87cc792d48b610356647995f506c15e4e (patch) | |
tree | 79ef5494f8e2bb03987f219874f964fc14c19bdd /example/ndpi_util.c | |
parent | 50e26ca400f8b6473fdf4487383aebc22d8b9373 (diff) |
Split src2dst / dst2src traffic
Diffstat (limited to 'example/ndpi_util.c')
-rw-r--r-- | example/ndpi_util.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/example/ndpi_util.c b/example/ndpi_util.c index e90400b8f..ef4353e81 100644 --- a/example/ndpi_util.c +++ b/example/ndpi_util.c @@ -511,7 +511,12 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow, workflow->stats.total_wire_bytes += rawsize + 24 /* CRC etc */, workflow->stats.total_ip_bytes += rawsize; ndpi_flow = flow->ndpi_flow; - flow->packets++, flow->bytes += rawsize; + + if(src_to_dst_direction) + flow->src2dst_packets++, flow->src2dst_bytes += rawsize; + else + flow->dst2src_packets++, flow->dst2src_bytes += rawsize; + flow->last_seen = time; } else { // flow is NULL workflow->stats.total_discarded_bytes++; @@ -526,8 +531,8 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow, ipsize, time, src, dst); if((flow->detected_protocol.app_protocol != NDPI_PROTOCOL_UNKNOWN) - || ((proto == IPPROTO_UDP) && (flow->packets > 8)) - || ((proto == IPPROTO_TCP) && (flow->packets > 10))) { + || ((proto == IPPROTO_UDP) && ((flow->src2dst_packets + flow->dst2src_packets) > 8)) + || ((proto == IPPROTO_TCP) && ((flow->src2dst_packets + flow->dst2src_packets) > 10))) { /* New protocol detected or give up */ flow->detection_completed = 1; |