diff options
author | Simone Mainardi <simonemainardi@gmail.com> | 2016-07-08 15:10:33 +0200 |
---|---|---|
committer | Simone Mainardi <simonemainardi@gmail.com> | 2016-07-08 15:23:45 +0200 |
commit | 72e3930e088c9e6df51f7f314935167c63b8d0ad (patch) | |
tree | c94af77134d6de80ad01a0fcc5f988ace24c4392 /example | |
parent | 6fb81f146e2542cfbf7fab7d53678339c7747b35 (diff) | |
parent | 31140c8da74aaceb76709c11082e4cb2e07e11e9 (diff) |
Fixes nDPI protocol initialization for Git
[NDPI] ndpi_init_protocol_defaults(missing protoId=226) INTERNAL ERROR: not all protocols have been initialized
This is actually a merge of branch 'dev' into 1.8-stable.
Diffstat (limited to 'example')
-rw-r--r-- | example/ndpiReader.c | 14 | ||||
-rw-r--r-- | example/ndpi_util.c | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index f558d7b0d..deb61b681 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -620,8 +620,8 @@ static void debug_printf(u_int32_t protocol, void *id_struct, static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) { NDPI_PROTOCOL_BITMASK all; - struct ndpi_workflow_prefs prefs; + memset(&prefs, 0, sizeof(prefs)); prefs.decode_tunnels = decode_tunnels; prefs.num_roots = NUM_ROOTS; @@ -630,9 +630,13 @@ static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) { memset(&ndpi_thread_info[thread_id], 0, sizeof(ndpi_thread_info[thread_id])); ndpi_thread_info[thread_id].workflow = ndpi_workflow_init(&prefs, pcap_handle); - /* ndpi_thread_info[thread_id].workflow->ndpi_struct->http_dont_dissect_response = 1; */ - ndpi_workflow_set_flow_detected_callback(ndpi_thread_info[thread_id].workflow, on_protocol_discovered, (void *)(uintptr_t)thread_id); + /* Preferences */ + ndpi_thread_info[thread_id].workflow->ndpi_struct->http_dont_dissect_response = 0; + ndpi_thread_info[thread_id].workflow->ndpi_struct->dns_dissect_response = 0; + + ndpi_workflow_set_flow_detected_callback(ndpi_thread_info[thread_id].workflow, + on_protocol_discovered, (void *)(uintptr_t)thread_id); // enable all protocols NDPI_BITMASK_SET_ALL(all); @@ -769,7 +773,9 @@ static void printResults(u_int64_t tot_usec) { memset(&cumulative_stats, 0, sizeof(cumulative_stats)); for(thread_id = 0; thread_id < num_threads; thread_id++) { - if(ndpi_thread_info[thread_id].workflow->stats.total_wire_bytes == 0) continue; + if((ndpi_thread_info[thread_id].workflow->stats.total_wire_bytes == 0) + && (ndpi_thread_info[thread_id].workflow->stats.raw_packet_count == 0)) + continue; for(i=0; i<NUM_ROOTS; i++) ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i], node_proto_guess_walker, &thread_id); diff --git a/example/ndpi_util.c b/example/ndpi_util.c index 939b3efd0..57a6505e9 100644 --- a/example/ndpi_util.c +++ b/example/ndpi_util.c @@ -736,7 +736,7 @@ void ndpi_workflow_process_packet (struct ndpi_workflow * workflow, goto iph_check; } - if((frag_off & 0x3FFF) != 0) { + if((frag_off & 0x1FFF) != 0) { static u_int8_t ipv4_frags_warning_used = 0; workflow->stats.fragmented_count++; |