From b50635cb89927b7f80cee81571f1b8b1f53ae939 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Thu, 18 Jul 2019 11:38:16 +0200 Subject: [PATCH] Renamed ndpi_util.c -> reader_util.c Added crash fix with IPv6 --- example/Makefile.in | 2 +- example/ndpiReader.c | 5 ++--- example/{ndpi_util.c => reader_util.c} | 9 +++------ example/{ndpi_util.h => reader_util.h} | 0 src/lib/ndpi_utils.c | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) rename example/{ndpi_util.c => reader_util.c} (99%) rename example/{ndpi_util.h => reader_util.h} (100%) diff --git a/example/Makefile.in b/example/Makefile.in index ad75295cb..258c2d7b3 100644 --- a/example/Makefile.in +++ b/example/Makefile.in @@ -3,7 +3,7 @@ CXX=@CXX@ CFLAGS=-g -I../src/include @CFLAGS@ LIBNDPI=../src/lib/libndpi.a LDFLAGS=$(LIBNDPI) @PCAP_LIB@ -lpthread @LDFLAGS@ -OBJS=ndpiReader.o ndpi_util.o +OBJS=ndpiReader.o reader_util.o PREFIX?=@prefix@ all: ndpiReader @DPDK_TARGET@ diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 12a88a1c5..1daac81e6 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -56,7 +56,7 @@ #include #endif -#include "ndpi_util.h" +#include "reader_util.h" /** Client parameters **/ @@ -1582,7 +1582,6 @@ static void terminateDetection(u_int16_t thread_id) { * @brief Traffic stats format */ char* formatTraffic(float numBits, int bits, char *buf) { - char unit; if(bits) @@ -3745,7 +3744,7 @@ int orginal_main(int argc, char **argv) { /* Internal checks */ automataUnitTest(); - serializerUnitTest(); + // serializerUnitTest(); gettimeofday(&startup_time, NULL); ndpi_info_mod = ndpi_init_detection_module(); diff --git a/example/ndpi_util.c b/example/reader_util.c similarity index 99% rename from example/ndpi_util.c rename to example/reader_util.c index 695028364..9b03d1278 100644 --- a/example/ndpi_util.c +++ b/example/reader_util.c @@ -72,7 +72,7 @@ #endif #include "ndpi_main.h" -#include "ndpi_util.h" +#include "reader_util.h" extern u_int8_t enable_protocol_guess; extern u_int8_t verbose; @@ -651,13 +651,10 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow, flow->last_seen = time; - if(verbose) { - } - if(!flow->has_human_readeable_strings) { u_int8_t skip = 0; - if((iph->protocol == IPPROTO_TCP) + if((proto == IPPROTO_TCP) && ( (flow->detected_protocol.app_protocol == NDPI_PROTOCOL_SSL) || (flow->detected_protocol.master_protocol == NDPI_PROTOCOL_SSL) @@ -677,7 +674,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow, flow->has_human_readeable_strings = 1; } } else { - if((iph->protocol == IPPROTO_TCP) + if((proto == IPPROTO_TCP) && ( (flow->detected_protocol.app_protocol == NDPI_PROTOCOL_SSL) || (flow->detected_protocol.master_protocol == NDPI_PROTOCOL_SSL) diff --git a/example/ndpi_util.h b/example/reader_util.h similarity index 100% rename from example/ndpi_util.h rename to example/reader_util.h diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 09954cfc8..52021a365 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -655,7 +655,7 @@ int ndpi_has_human_readeable_string(struct ndpi_detection_module_struct *ndpi_st if(buffer_size <= 0) return(0); - + outbuf_len--; outbuf[outbuf_len] = '\0';