aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2019-07-18 11:38:16 +0200
committerLuca Deri <deri@ntop.org>2019-07-18 11:38:16 +0200
commitb50635cb89927b7f80cee81571f1b8b1f53ae939 (patch)
tree5126af562b7ce365cc9c26b334597ddb2211cedc
parentcbb31fa2041f6da59abdc9e470cafa7e2630b388 (diff)
Renamed ndpi_util.c -> reader_util.c
Added crash fix with IPv6
-rw-r--r--example/Makefile.in2
-rw-r--r--example/ndpiReader.c5
-rw-r--r--example/reader_util.c (renamed from example/ndpi_util.c)9
-rw-r--r--example/reader_util.h (renamed from example/ndpi_util.h)0
-rw-r--r--src/lib/ndpi_utils.c2
5 files changed, 7 insertions, 11 deletions
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 <json.h>
#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
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
index b006fd8d3..b006fd8d3 100644
--- a/example/ndpi_util.h
+++ b/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';