diff options
author | Luca Deri <deri@ntop.org> | 2019-04-01 16:12:44 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2019-04-01 16:12:44 +0200 |
commit | 6693151052a98e6eddc722c139886d7fe84f35e4 (patch) | |
tree | cf77f7c9a2f0cd298c25c841c044bfeb00ab7baa | |
parent | 1915a63cf29fbe3d2b0a983b2875929518d242ad (diff) |
Added custom category support to ndpi_get_partial_detection()
-rw-r--r-- | example/ndpiReader.c | 3 | ||||
-rw-r--r-- | src/lib/ndpi_main.c | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 72eaecca4..0b0fa889b 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -1505,7 +1505,8 @@ static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) { if(category) { int fields[4]; - // printf("Loading %s\t%s\n", name, category); + + if(verbose) printf("[Category] Loading %s\t%s\n", name, category); if(sscanf(name, "%d.%d.%d.%d", &fields[0], &fields[1], &fields[2], &fields[3]) == 4) ndpi_load_ip_category(ndpi_thread_info[thread_id].workflow->ndpi_struct, diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index acbe5b8ec..cc5637cbc 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -2474,7 +2474,7 @@ static int hyperscanCustomEventHandler(unsigned int id, /* *********************************************** */ int ndpi_match_custom_category(struct ndpi_detection_module_struct *ndpi_struct, - char *name, unsigned long *id) { + char *name, unsigned long *id) { #ifdef DEBUG printf("[NDPI] %s(%s) [enable_category_substring_match: %u]\n", __FUNCTION__, name, ndpi_struct->enable_category_substring_match); @@ -2518,7 +2518,7 @@ int ndpi_match_custom_category(struct ndpi_detection_module_struct *ndpi_struct, /* *********************************************** */ int ndpi_get_custom_category_match(struct ndpi_detection_module_struct *ndpi_struct, - char *name_or_ip, unsigned long *id) { + char *name_or_ip, unsigned long *id) { char ipbuf[64]; struct in_addr pin; @@ -4180,7 +4180,8 @@ static ndpi_protocol ndpi_process_partial_detection(struct ndpi_detection_module if(ret.app_protocol == NDPI_PROTOCOL_UNKNOWN) ret.app_protocol = ret.master_protocol; - + + ndpi_fill_protocol_category(ndpi_struct, flow, &ret); ndpi_int_change_protocol(ndpi_struct, flow, ret.app_protocol, ret.master_protocol); return(ret); } @@ -6090,7 +6091,6 @@ static int ndpi_automa_match_string_subprotocol(struct ndpi_detection_module_str matching_protocol_id = ndpi_match_string_subprotocol(ndpi_struct, string_to_match, string_to_match_len, ret_match, is_host_match); - #else struct hs *hs = (struct hs*)ndpi_struct->hyperscan; hs_error_t status; |