Merge branch 'vpiserchia-dev' into dev
This commit is contained in:
@@ -35,3 +35,11 @@ stamp-h1
|
|||||||
/m4/ltsugar.m4
|
/m4/ltsugar.m4
|
||||||
/m4/ltversion.m4
|
/m4/ltversion.m4
|
||||||
/m4/lt~obsolete.m4
|
/m4/lt~obsolete.m4
|
||||||
|
/autom4te.cache/
|
||||||
|
/compile
|
||||||
|
/example/.deps/
|
||||||
|
/src/lib/.deps/
|
||||||
|
/src/lib/protocols/.deps/
|
||||||
|
/src/lib/third_party/src/.deps/
|
||||||
|
/test-driver
|
||||||
|
/tests/Makefile
|
||||||
|
|||||||
+9
-9
@@ -328,7 +328,7 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
|
|||||||
flow.lower_port = lower_port, flow.upper_port = upper_port;
|
flow.lower_port = lower_port, flow.upper_port = upper_port;
|
||||||
|
|
||||||
if(0)
|
if(0)
|
||||||
NDPI_LOG(0, workflow.ndpi_struct, NDPI_LOG_DEBUG, "[NDPI] [%u][%u:%u <-> %u:%u]\n",
|
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_DEBUG, "[NDPI] [%u][%u:%u <-> %u:%u]\n",
|
||||||
iph->protocol, lower_ip, ntohs(lower_port), upper_ip, ntohs(upper_port));
|
iph->protocol, lower_ip, ntohs(lower_port), upper_ip, ntohs(upper_port));
|
||||||
|
|
||||||
idx = (vlan_id + lower_ip + upper_ip + iph->protocol + lower_port + upper_port) % workflow->prefs.num_roots;
|
idx = (vlan_id + lower_ip + upper_ip + iph->protocol + lower_port + upper_port) % workflow->prefs.num_roots;
|
||||||
@@ -336,13 +336,13 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
|
|||||||
|
|
||||||
if(ret == NULL) {
|
if(ret == NULL) {
|
||||||
if(workflow->stats.ndpi_flow_count == workflow->prefs.max_ndpi_flows) {
|
if(workflow->stats.ndpi_flow_count == workflow->prefs.max_ndpi_flows) {
|
||||||
NDPI_LOG(0, workflow.ndpi_struct, NDPI_LOG_ERROR, "maximum flow count (%u) has been exceeded\n", workflow->prefs.max_ndpi_flows);
|
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_ERROR, "maximum flow count (%u) has been exceeded\n", workflow->prefs.max_ndpi_flows);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
} else {
|
} else {
|
||||||
struct ndpi_flow_info *newflow = (struct ndpi_flow_info*)malloc(sizeof(struct ndpi_flow_info));
|
struct ndpi_flow_info *newflow = (struct ndpi_flow_info*)malloc(sizeof(struct ndpi_flow_info));
|
||||||
|
|
||||||
if(newflow == NULL) {
|
if(newflow == NULL) {
|
||||||
NDPI_LOG(0, workflow.ndpi_struct, NDPI_LOG_ERROR, "[NDPI] %s(1): not enough memory\n", __FUNCTION__);
|
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_ERROR, "[NDPI] %s(1): not enough memory\n", __FUNCTION__);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,21 +363,21 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((newflow->ndpi_flow = ndpi_malloc(SIZEOF_FLOW_STRUCT)) == NULL) {
|
if((newflow->ndpi_flow = ndpi_malloc(SIZEOF_FLOW_STRUCT)) == NULL) {
|
||||||
NDPI_LOG(0, workflow.ndpi_struct, NDPI_LOG_ERROR, "[NDPI] %s(2): not enough memory\n", __FUNCTION__);
|
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_ERROR, "[NDPI] %s(2): not enough memory\n", __FUNCTION__);
|
||||||
free(newflow);
|
free(newflow);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
} else
|
} else
|
||||||
memset(newflow->ndpi_flow, 0, SIZEOF_FLOW_STRUCT);
|
memset(newflow->ndpi_flow, 0, SIZEOF_FLOW_STRUCT);
|
||||||
|
|
||||||
if((newflow->src_id = ndpi_malloc(SIZEOF_ID_STRUCT)) == NULL) {
|
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__);
|
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_ERROR, "[NDPI] %s(3): not enough memory\n", __FUNCTION__);
|
||||||
free(newflow);
|
free(newflow);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
} else
|
} else
|
||||||
memset(newflow->src_id, 0, SIZEOF_ID_STRUCT);
|
memset(newflow->src_id, 0, SIZEOF_ID_STRUCT);
|
||||||
|
|
||||||
if((newflow->dst_id = ndpi_malloc(SIZEOF_ID_STRUCT)) == NULL) {
|
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__);
|
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_ERROR, "[NDPI] %s(4): not enough memory\n", __FUNCTION__);
|
||||||
free(newflow);
|
free(newflow);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
} else
|
} else
|
||||||
@@ -741,7 +741,7 @@ void ndpi_workflow_process_packet (struct ndpi_workflow * workflow,
|
|||||||
|
|
||||||
if(cap_warning_used == 0) {
|
if(cap_warning_used == 0) {
|
||||||
if(!workflow->prefs.quiet_mode)
|
if(!workflow->prefs.quiet_mode)
|
||||||
NDPI_LOG(0, workflow.ndpi_struct, NDPI_LOG_DEBUG, "\n\nWARNING: packet capture size is smaller than packet size, DETECTION MIGHT NOT WORK CORRECTLY\n\n");
|
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_DEBUG, "\n\nWARNING: packet capture size is smaller than packet size, DETECTION MIGHT NOT WORK CORRECTLY\n\n");
|
||||||
cap_warning_used = 1;
|
cap_warning_used = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -762,7 +762,7 @@ void ndpi_workflow_process_packet (struct ndpi_workflow * workflow,
|
|||||||
|
|
||||||
if(ipv4_frags_warning_used == 0) {
|
if(ipv4_frags_warning_used == 0) {
|
||||||
if(!workflow->prefs.quiet_mode)
|
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");
|
NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_DEBUG, "\n\nWARNING: IPv4 fragments are not handled by this demo (nDPI supports them)\n");
|
||||||
ipv4_frags_warning_used = 1;
|
ipv4_frags_warning_used = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -788,7 +788,7 @@ void ndpi_workflow_process_packet (struct ndpi_workflow * workflow,
|
|||||||
v4_warning:
|
v4_warning:
|
||||||
if(ipv4_warning_used == 0) {
|
if(ipv4_warning_used == 0) {
|
||||||
if(!workflow->prefs.quiet_mode)
|
if(!workflow->prefs.quiet_mode)
|
||||||
NDPI_LOG(0, workflow.ndpi_struct, 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");
|
NDPI_LOG(0, workflow->ndpi_struct, 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;
|
ipv4_warning_used = 1;
|
||||||
}
|
}
|
||||||
workflow->stats.total_discarded_bytes += header->len;
|
workflow->stats.total_discarded_bytes += header->len;
|
||||||
|
|||||||
@@ -181,13 +181,17 @@
|
|||||||
|
|
||||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||||
|
|
||||||
#define NDPI_LOG(proto, mod, log_level, args...) \
|
#define NDPI_LOG(proto, m, log_level, args...) \
|
||||||
{ \
|
{ \
|
||||||
|
struct ndpi_detection_module_struct *mod = (struct ndpi_detection_module_struct*) m; \
|
||||||
if(mod != NULL) { \
|
if(mod != NULL) { \
|
||||||
mod->ndpi_debug_print_file=__FILE__; \
|
mod->ndpi_debug_print_file=__FILE__; \
|
||||||
mod->ndpi_debug_print_function=__FUNCTION__; \
|
mod->ndpi_debug_print_function=__FUNCTION__; \
|
||||||
mod->ndpi_debug_print_line=__LINE__; \
|
mod->ndpi_debug_print_line=__LINE__; \
|
||||||
mod->ndpi_debug_printf(proto, mod, log_level, args); \
|
if (mod->ndpi_debug_printf != NULL) \
|
||||||
|
mod->ndpi_debug_printf(proto, mod, log_level, args); \
|
||||||
|
else \
|
||||||
|
printf(args, proto, mod, log_level); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -1716,7 +1716,10 @@ void set_ndpi_free(void (*__ndpi_free)(void *ptr)) { _ndpi_free = __ndpi_
|
|||||||
|
|
||||||
void set_ndpi_debug_function(struct ndpi_detection_module_struct *ndpi_str, ndpi_debug_function_ptr ndpi_debug_printf) {
|
void set_ndpi_debug_function(struct ndpi_detection_module_struct *ndpi_str, ndpi_debug_function_ptr ndpi_debug_printf) {
|
||||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||||
ndpi_str->ndpi_debug_printf = ndpi_debug_printf;
|
if (ndpi_debug_printf != NULL)
|
||||||
|
ndpi_str->ndpi_debug_printf = ndpi_debug_printf;
|
||||||
|
else
|
||||||
|
ndpi_str->ndpi_debug_printf = (ndpi_debug_function_ptr) printf;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1727,7 +1730,7 @@ struct ndpi_detection_module_struct *ndpi_init_detection_module(void) {
|
|||||||
|
|
||||||
if(ndpi_str == NULL) {
|
if(ndpi_str == NULL) {
|
||||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||||
ndpi_debug_printf(0, NULL, NDPI_LOG_DEBUG, "ndpi_init_detection_module initial malloc failed\n");
|
printf(0, NULL, NDPI_LOG_DEBUG, "ndpi_init_detection_module initial malloc failed\n");
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void ndpi_search_mssql_tds(struct ndpi_detection_module_struct *ndpi_struct, str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NDPI_LOG(NDPI_PROTOCOL_MSSQL, ndpi_struct, NDPI_LOG_DEBUG, "exclude mssql_tds\n");
|
NDPI_LOG(NDPI_PROTOCOL_MSSQL_TDS, ndpi_struct, NDPI_LOG_DEBUG, "exclude mssql_tds\n");
|
||||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MSSQL_TDS);
|
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MSSQL_TDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user