diff options
author | Campus <campus@ntop.org> | 2016-11-03 15:39:28 +0100 |
---|---|---|
committer | Campus <campus@ntop.org> | 2016-11-03 15:39:28 +0100 |
commit | 58e97c966c3aef178580d8f362df95274fbe9c8a (patch) | |
tree | 2276b88ff75811e44d48336c3ee4d1303e297940 /src | |
parent | 002b8b04e9ff06aa75a93af4466361636ef38820 (diff) | |
parent | e3d15ef4e7f896ca62773cbd9b207967055d96b0 (diff) |
Merge branch 'vpiserchia-dev' into dev
Diffstat (limited to 'src')
-rw-r--r-- | src/include/ndpi_define.h | 8 | ||||
-rw-r--r-- | src/lib/ndpi_main.c | 7 | ||||
-rw-r--r-- | src/lib/protocols/mssql_tds.c | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/include/ndpi_define.h b/src/include/ndpi_define.h index cc237128a..ce6149e5e 100644 --- a/src/include/ndpi_define.h +++ b/src/include/ndpi_define.h @@ -181,13 +181,17 @@ #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) { \ mod->ndpi_debug_print_file=__FILE__; \ mod->ndpi_debug_print_function=__FUNCTION__; \ 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); \ } \ } diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index c6a39394d..c8d2d3d7d 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -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) { #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 } @@ -1727,7 +1730,7 @@ struct ndpi_detection_module_struct *ndpi_init_detection_module(void) { if(ndpi_str == NULL) { #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 return NULL; } diff --git a/src/lib/protocols/mssql_tds.c b/src/lib/protocols/mssql_tds.c index 73dfe29a0..8a78266a9 100644 --- a/src/lib/protocols/mssql_tds.c +++ b/src/lib/protocols/mssql_tds.c @@ -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); } |