+11
-16
@@ -419,13 +419,13 @@ struct ndpi_workflow* ndpi_workflow_init(const struct ndpi_workflow_prefs * pref
|
||||
module = ndpi_init_detection_module(ndpi_no_prefs);
|
||||
|
||||
if(module == NULL) {
|
||||
NDPI_LOG(0, NULL, NDPI_LOG_ERROR, "global structure initialization failed\n");
|
||||
LOG(NDPI_LOG_ERROR, "global structure initialization failed\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
workflow = ndpi_calloc(1, sizeof(struct ndpi_workflow));
|
||||
if(workflow == NULL) {
|
||||
NDPI_LOG(0, NULL, NDPI_LOG_ERROR, "global structure initialization failed\n");
|
||||
LOG(NDPI_LOG_ERROR, "global structure initialization failed\n");
|
||||
ndpi_free(module);
|
||||
exit(-1);
|
||||
}
|
||||
@@ -441,13 +441,8 @@ struct ndpi_workflow* ndpi_workflow_init(const struct ndpi_workflow_prefs * pref
|
||||
exit(-1);
|
||||
_debug_protocols_ok = 1;
|
||||
}
|
||||
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
NDPI_BITMASK_RESET(module->debug_bitmask);
|
||||
|
||||
if(_debug_protocols_ok)
|
||||
module->debug_bitmask = debug_bitmask;
|
||||
#endif
|
||||
ndpi_set_debug_bitmask(module, debug_bitmask);
|
||||
|
||||
workflow->ndpi_flows_root = ndpi_calloc(workflow->prefs.num_roots, sizeof(void *));
|
||||
|
||||
@@ -817,7 +812,7 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
|
||||
|
||||
if(ret == NULL) {
|
||||
if(workflow->stats.ndpi_flow_count == workflow->prefs.max_ndpi_flows) {
|
||||
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_ERROR,
|
||||
LOG(NDPI_LOG_ERROR,
|
||||
"maximum flow count (%u) has been exceeded\n",
|
||||
workflow->prefs.max_ndpi_flows);
|
||||
exit(-1);
|
||||
@@ -825,7 +820,7 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
|
||||
struct ndpi_flow_info *newflow = (struct ndpi_flow_info*)malloc(sizeof(struct ndpi_flow_info));
|
||||
|
||||
if(newflow == NULL) {
|
||||
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_ERROR, "[NDPI] %s(1): not enough memory\n", __FUNCTION__);
|
||||
LOG(NDPI_LOG_ERROR, "[NDPI] %s(1): not enough memory\n", __FUNCTION__);
|
||||
return(NULL);
|
||||
} else
|
||||
workflow->num_allocated_flows++;
|
||||
@@ -862,7 +857,7 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
|
||||
}
|
||||
|
||||
if((newflow->ndpi_flow = ndpi_flow_malloc(SIZEOF_FLOW_STRUCT)) == NULL) {
|
||||
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_ERROR, "[NDPI] %s(2): not enough memory\n", __FUNCTION__);
|
||||
LOG(NDPI_LOG_ERROR, "[NDPI] %s(2): not enough memory\n", __FUNCTION__);
|
||||
#ifdef DIRECTION_BINS
|
||||
ndpi_free_bin(&newflow->payload_len_bin_src2dst), ndpi_free_bin(&newflow->payload_len_bin_dst2src);
|
||||
#else
|
||||
@@ -874,7 +869,7 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
|
||||
memset(newflow->ndpi_flow, 0, SIZEOF_FLOW_STRUCT);
|
||||
|
||||
if((newflow->src_id = ndpi_malloc(SIZEOF_ID_STRUCT)) == NULL) {
|
||||
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_ERROR, "[NDPI] %s(3): not enough memory\n", __FUNCTION__);
|
||||
LOG(NDPI_LOG_ERROR, "[NDPI] %s(3): not enough memory\n", __FUNCTION__);
|
||||
#ifdef DIRECTION_BINS
|
||||
ndpi_free_bin(&newflow->payload_len_bin_src2dst), ndpi_free_bin(&newflow->payload_len_bin_dst2src);
|
||||
#else
|
||||
@@ -886,7 +881,7 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
|
||||
memset(newflow->src_id, 0, SIZEOF_ID_STRUCT);
|
||||
|
||||
if((newflow->dst_id = ndpi_malloc(SIZEOF_ID_STRUCT)) == NULL) {
|
||||
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_ERROR, "[NDPI] %s(4): not enough memory\n", __FUNCTION__);
|
||||
LOG(NDPI_LOG_ERROR, "[NDPI] %s(4): not enough memory\n", __FUNCTION__);
|
||||
#ifdef DIRECTION_BINS
|
||||
ndpi_free_bin(&newflow->payload_len_bin_src2dst), ndpi_free_bin(&newflow->payload_len_bin_dst2src);
|
||||
#else
|
||||
@@ -1760,7 +1755,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
||||
|
||||
if(cap_warning_used == 0) {
|
||||
if(!workflow->prefs.quiet_mode)
|
||||
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_DEBUG,
|
||||
LOG(NDPI_LOG_DEBUG,
|
||||
"\n\nWARNING: packet capture size is smaller than packet size, DETECTION MIGHT NOT WORK CORRECTLY\n\n");
|
||||
cap_warning_used = 1;
|
||||
}
|
||||
@@ -1783,7 +1778,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
||||
|
||||
if(ipv4_frags_warning_used == 0) {
|
||||
if(!workflow->prefs.quiet_mode)
|
||||
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_DEBUG, "\n\nWARNING: IPv4 fragments are not handled by this demo (nDPI supports them)\n");
|
||||
LOG(NDPI_LOG_DEBUG, "\n\nWARNING: IPv4 fragments are not handled by this demo (nDPI supports them)\n");
|
||||
ipv4_frags_warning_used = 1;
|
||||
}
|
||||
|
||||
@@ -1817,7 +1812,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
||||
v4_warning:
|
||||
if(ipv4_warning_used == 0) {
|
||||
if(!workflow->prefs.quiet_mode)
|
||||
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_DEBUG,
|
||||
LOG(NDPI_LOG_DEBUG,
|
||||
"\n\nWARNING: only IPv4/IPv6 packets are supported in this demo (nDPI supports both IPv4 and IPv6), all other packets will be discarded\n\n");
|
||||
ipv4_warning_used = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user