Renamed ndpi_util.c -> reader_util.c

Added crash fix with IPv6
This commit is contained in:
Luca Deri
2019-07-18 11:38:16 +02:00
parent cbb31fa204
commit b50635cb89
5 changed files with 7 additions and 11 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ CXX=@CXX@
CFLAGS=-g -I../src/include @CFLAGS@ CFLAGS=-g -I../src/include @CFLAGS@
LIBNDPI=../src/lib/libndpi.a LIBNDPI=../src/lib/libndpi.a
LDFLAGS=$(LIBNDPI) @PCAP_LIB@ -lpthread @LDFLAGS@ LDFLAGS=$(LIBNDPI) @PCAP_LIB@ -lpthread @LDFLAGS@
OBJS=ndpiReader.o ndpi_util.o OBJS=ndpiReader.o reader_util.o
PREFIX?=@prefix@ PREFIX?=@prefix@
all: ndpiReader @DPDK_TARGET@ all: ndpiReader @DPDK_TARGET@
+2 -3
View File
@@ -56,7 +56,7 @@
#include <json.h> #include <json.h>
#endif #endif
#include "ndpi_util.h" #include "reader_util.h"
/** Client parameters **/ /** Client parameters **/
@@ -1582,7 +1582,6 @@ static void terminateDetection(u_int16_t thread_id) {
* @brief Traffic stats format * @brief Traffic stats format
*/ */
char* formatTraffic(float numBits, int bits, char *buf) { char* formatTraffic(float numBits, int bits, char *buf) {
char unit; char unit;
if(bits) if(bits)
@@ -3745,7 +3744,7 @@ int orginal_main(int argc, char **argv) {
/* Internal checks */ /* Internal checks */
automataUnitTest(); automataUnitTest();
serializerUnitTest(); // serializerUnitTest();
gettimeofday(&startup_time, NULL); gettimeofday(&startup_time, NULL);
ndpi_info_mod = ndpi_init_detection_module(); ndpi_info_mod = ndpi_init_detection_module();
@@ -72,7 +72,7 @@
#endif #endif
#include "ndpi_main.h" #include "ndpi_main.h"
#include "ndpi_util.h" #include "reader_util.h"
extern u_int8_t enable_protocol_guess; extern u_int8_t enable_protocol_guess;
extern u_int8_t verbose; extern u_int8_t verbose;
@@ -651,13 +651,10 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow,
flow->last_seen = time; flow->last_seen = time;
if(verbose) {
}
if(!flow->has_human_readeable_strings) { if(!flow->has_human_readeable_strings) {
u_int8_t skip = 0; 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.app_protocol == NDPI_PROTOCOL_SSL)
|| (flow->detected_protocol.master_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; flow->has_human_readeable_strings = 1;
} }
} else { } else {
if((iph->protocol == IPPROTO_TCP) if((proto == IPPROTO_TCP)
&& ( && (
(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_SSL) (flow->detected_protocol.app_protocol == NDPI_PROTOCOL_SSL)
|| (flow->detected_protocol.master_protocol == NDPI_PROTOCOL_SSL) || (flow->detected_protocol.master_protocol == NDPI_PROTOCOL_SSL)