diff options
Diffstat (limited to 'example')
-rw-r--r-- | example/ndpiReader.c | 10 | ||||
-rw-r--r-- | example/ndpiSimpleIntegration.c | 2 | ||||
-rw-r--r-- | example/reader_util.c | 4 |
3 files changed, 10 insertions, 6 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index d2c37c2af..7aa0d2ae6 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -92,7 +92,7 @@ static char* domain_to_check = NULL; static char* ip_port_to_check = NULL; static u_int8_t ignore_vlanid = 0; /** User preferences **/ -u_int8_t enable_realtime_output = 0, enable_protocol_guess = 1, enable_payload_analyzer = 0, num_bin_clusters = 0, extcap_exit = 0; +u_int8_t enable_realtime_output = 0, enable_protocol_guess = NDPI_GIVEUP_GUESS_BY_PORT | NDPI_GIVEUP_GUESS_BY_IP, enable_payload_analyzer = 0, num_bin_clusters = 0, extcap_exit = 0; u_int8_t verbose = 0, enable_flow_stats = 0; struct cfg { @@ -557,7 +557,7 @@ static void help(u_int long_help) { " | 0 - List known protocols\n" " | 1 - List known categories\n" " | 2 - List known risks\n" - " -d | Disable protocol guess and use only DPI\n" + " -d | Disable protocol guess (by ip and by port) and use only DPI. It is a shortcut to --cfg=,NULL,guess_on_giveup,0\n" " -e <len> | Min human readeable string match len. Default %u\n" " -q | Quiet mode\n" " -F | Enable flow stats\n" @@ -1021,6 +1021,10 @@ static void parseOptions(int argc, char **argv) { case 'd': enable_protocol_guess = 0; + if(reader_add_cfg(NULL, "guess_on_giveup", "0", 1) == 1) { + printf("Invalid parameter [%s] [num:%d/%d]\n", optarg, num_cfgs, MAX_NUM_CFGS); + exit(1); + } break; case 'D': @@ -2180,7 +2184,7 @@ static void node_proto_guess_walker(const void *node, ndpi_VISIT which, int dept malloc_size_stats = 1; flow->detected_protocol = ndpi_detection_giveup(ndpi_thread_info[0].workflow->ndpi_struct, - flow->ndpi_flow, enable_protocol_guess, &proto_guessed); + flow->ndpi_flow, &proto_guessed); malloc_size_stats = 0; if(proto_guessed) ndpi_thread_info[thread_id].workflow->stats.guessed_flow_protocols++; diff --git a/example/ndpiSimpleIntegration.c b/example/ndpiSimpleIntegration.c index 2cc18057f..edc37090c 100644 --- a/example/ndpiSimpleIntegration.c +++ b/example/ndpiSimpleIntegration.c @@ -880,7 +880,7 @@ static void ndpi_process_packet(uint8_t * const args, flow_to_process->guessed_protocol = ndpi_detection_giveup(workflow->ndpi_struct, flow_to_process->ndpi_flow, - 1, &protocol_was_guessed); + &protocol_was_guessed); if (protocol_was_guessed != 0) { printf("[%8llu, %d, %4d][GUESSED] protocol: %s | app protocol: %s | category: %s\n", workflow->packets_captured, diff --git a/example/reader_util.c b/example/reader_util.c index 9f8a76c1c..0fe629ac6 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -73,7 +73,7 @@ #include "reader_util.h" #include "ndpi_classify.h" -extern u_int8_t enable_protocol_guess, enable_flow_stats, enable_payload_analyzer; +extern u_int8_t enable_flow_stats, enable_payload_analyzer; extern u_int8_t verbose, human_readeable_string_len; extern u_int8_t max_num_udp_dissected_pkts /* 24 */, max_num_tcp_dissected_pkts /* 80 */; static u_int32_t flow_id = 0; @@ -1729,7 +1729,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow, u_int8_t proto_guessed; flow->detected_protocol = ndpi_detection_giveup(workflow->ndpi_struct, flow->ndpi_flow, - enable_protocol_guess, &proto_guessed); + &proto_guessed); if(proto_guessed) workflow->stats.guessed_flow_protocols++; } |