Added custom category support to ndpi_get_partial_detection()
This commit is contained in:
@@ -1505,7 +1505,8 @@ static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) {
|
|||||||
if(category) {
|
if(category) {
|
||||||
int fields[4];
|
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)
|
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,
|
ndpi_load_ip_category(ndpi_thread_info[thread_id].workflow->ndpi_struct,
|
||||||
|
|||||||
+3
-3
@@ -2474,7 +2474,7 @@ static int hyperscanCustomEventHandler(unsigned int id,
|
|||||||
/* *********************************************** */
|
/* *********************************************** */
|
||||||
|
|
||||||
int ndpi_match_custom_category(struct ndpi_detection_module_struct *ndpi_struct,
|
int ndpi_match_custom_category(struct ndpi_detection_module_struct *ndpi_struct,
|
||||||
char *name, unsigned long *id) {
|
char *name, unsigned long *id) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("[NDPI] %s(%s) [enable_category_substring_match: %u]\n",
|
printf("[NDPI] %s(%s) [enable_category_substring_match: %u]\n",
|
||||||
__FUNCTION__, name, ndpi_struct->enable_category_substring_match);
|
__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,
|
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];
|
char ipbuf[64];
|
||||||
struct in_addr pin;
|
struct in_addr pin;
|
||||||
|
|
||||||
@@ -4181,6 +4181,7 @@ static ndpi_protocol ndpi_process_partial_detection(struct ndpi_detection_module
|
|||||||
if(ret.app_protocol == NDPI_PROTOCOL_UNKNOWN)
|
if(ret.app_protocol == NDPI_PROTOCOL_UNKNOWN)
|
||||||
ret.app_protocol = ret.master_protocol;
|
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);
|
ndpi_int_change_protocol(ndpi_struct, flow, ret.app_protocol, ret.master_protocol);
|
||||||
return(ret);
|
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,
|
matching_protocol_id = ndpi_match_string_subprotocol(ndpi_struct, string_to_match,
|
||||||
string_to_match_len, ret_match,
|
string_to_match_len, ret_match,
|
||||||
is_host_match);
|
is_host_match);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
struct hs *hs = (struct hs*)ndpi_struct->hyperscan;
|
struct hs *hs = (struct hs*)ndpi_struct->hyperscan;
|
||||||
hs_error_t status;
|
hs_error_t status;
|
||||||
|
|||||||
Reference in New Issue
Block a user