From 3ba3a08141f0c60ab8e970e744ecf7540319b093 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 2 Aug 2017 20:15:21 +0200 Subject: Implemented flow sort based on total bytes so that we can (with -v X) immediately spot elephants and mice --- example/ndpi_util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'example/ndpi_util.c') diff --git a/example/ndpi_util.c b/example/ndpi_util.c index 1fc3af15a..618a51882 100644 --- a/example/ndpi_util.c +++ b/example/ndpi_util.c @@ -106,7 +106,6 @@ static void free_wrapper(void *freeable) { /* ***************************************************** */ struct ndpi_workflow * ndpi_workflow_init(const struct ndpi_workflow_prefs * prefs, pcap_t * pcap_handle) { - set_ndpi_malloc(malloc_wrapper), set_ndpi_free(free_wrapper); set_ndpi_flow_malloc(NULL), set_ndpi_flow_free(NULL); /* TODO: just needed here to init ndpi malloc wrapper */ @@ -309,7 +308,8 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow if(newflow == NULL) { NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_ERROR, "[NDPI] %s(1): not enough memory\n", __FUNCTION__); return(NULL); - } + } else + workflow->num_allocated_flows++; memset(newflow, 0, sizeof(struct ndpi_flow_info)); newflow->hashval = hashval; @@ -544,6 +544,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow, /* TODO: When half_free is deprecated, get rid of this */ ndpi_free_flow_info_half(flow); } + return(flow->detected_protocol); } -- cgit v1.2.3