aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--example/ndpiReader.c15
-rw-r--r--src/lib/ndpi_main.c1
2 files changed, 10 insertions, 6 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index bcab28568..189321968 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -64,8 +64,8 @@ static FILE *results_file = NULL;
static char *results_path = NULL;
static char * bpfFilter = NULL; /**< bpf filter */
static char *_protoFilePath = NULL; /**< Protocol file path */
-static char *_statsFilePath = NULL; /**< Top stats file path */
#ifdef HAVE_JSON_C
+static char *_statsFilePath = NULL; /**< Top stats file path */
static char *_diagnoseFilePath = NULL; /**< Top stats file path */
static char *_jsonFilePath = NULL; /**< JSON file path */
static FILE *stats_fp = NULL; /**< for Top Stats JSON file */
@@ -78,7 +78,10 @@ static u_int8_t live_capture = 0;
static u_int8_t undetected_flows_deleted = 0;
/** User preferences **/
static u_int8_t enable_protocol_guess = 1, verbose = 0, nDPI_traceLevel = 0, json_flag = 0;
-static u_int8_t stats_flag = 0, file_first_time = 1, bpf_filter_flag = 0;
+static u_int8_t stats_flag = 0, bpf_filter_flag = 0;
+#ifdef HAVE_JSON_C
+static u_int8_t file_first_time = 1;
+#endif
static u_int32_t pcap_analysis_duration = (u_int32_t)-1;
static u_int16_t decode_tunnels = 0;
static u_int16_t num_loops = 1;
@@ -1030,6 +1033,7 @@ static void updatePortStats(struct port_stats **stats, u_int32_t port,
/* *********************************************** */
+#ifdef HAVE_JSON_C
static void deleteScanners(struct single_flow_info *scanners) {
struct single_flow_info *s, *tmp;
struct port_flow_info *p, *tmp2;
@@ -1043,6 +1047,7 @@ static void deleteScanners(struct single_flow_info *scanners) {
free(s);
}
}
+#endif
/* *********************************************** */
@@ -1355,6 +1360,7 @@ static int port_stats_sort(void *_a, void *_b) {
/* *********************************************** */
+#ifdef HAVE_JSON_C
static int scanners_sort(void *_a, void *_b) {
struct single_flow_info *a = (struct single_flow_info *)_a;
struct single_flow_info *b = (struct single_flow_info *)_b;
@@ -1371,6 +1377,7 @@ static int scanners_port_sort(void *_a, void *_b) {
return(b->num_flows - a->num_flows);
}
+#endif
/* *********************************************** */
static int info_pair_cmp (const void *_a, const void *_b)
@@ -1383,6 +1390,7 @@ static int info_pair_cmp (const void *_a, const void *_b)
/* *********************************************** */
+#ifdef HAVE_JSON_C
static int top_stats_sort(void *_a, void *_b) {
struct top_stats *a = (struct top_stats*)_a;
struct top_stats *b = (struct top_stats*)_b;
@@ -1441,7 +1449,6 @@ static int getTopStats(struct top_stats **topStats, struct port_stats *stats) {
/* *********************************************** */
-#ifdef HAVE_JSON_C
static void saveScannerStats(json_object **jObj_group, struct single_flow_info *scanners) {
struct single_flow_info *s, *tmp;
struct port_flow_info *p, *tmp2;
@@ -2278,7 +2285,6 @@ void automataUnitTest() {
void bpf_filter_produce_filter(int port_array[], int p_size, const char *host_array[48], int h_size, char *filePath) {
FILE *fp = NULL;
char _filterFilePath[1024];
- char *fileName;
char filter[2048];
int produced = 0;
int i = 0;
@@ -2330,7 +2336,6 @@ void bpf_filter_produce_filter(int port_array[], int p_size, const char *host_ar
produced = 1;
}
- fileName = basename(filePath);
snprintf(_filterFilePath, sizeof(_filterFilePath), "%s.bpf", filePath);
if((fp = fopen(_filterFilePath,"w")) == NULL) {
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 537893567..84e43e660 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -4678,7 +4678,6 @@ int ndpi_match_string_subprotocol(struct ndpi_detection_module_struct *ndpi_stru
int matching_protocol_id = NDPI_PROTOCOL_UNKNOWN;
AC_TEXT_t ac_input_text;
ndpi_automa *automa = is_host_match ? &ndpi_struct->host_automa : &ndpi_struct->content_automa;
- int rc;
if((automa->ac_automa == NULL) || (string_to_match_len == 0)) return(NDPI_PROTOCOL_UNKNOWN);