Improvements with category detection
This commit is contained in:
+19
-3
@@ -4176,13 +4176,18 @@ static ndpi_protocol ndpi_process_partial_detection(struct ndpi_detection_module
|
|||||||
strlen((const char*)flow->host_server_name),
|
strlen((const char*)flow->host_server_name),
|
||||||
&ret_match,
|
&ret_match,
|
||||||
flow->guessed_protocol_id);
|
flow->guessed_protocol_id);
|
||||||
ret.category = ret_match.protocol_category;
|
|
||||||
|
if(flow->category != NDPI_PROTOCOL_CATEGORY_UNSPECIFIED)
|
||||||
|
ret.category = flow->category;
|
||||||
|
else
|
||||||
|
ret.category = ret_match.protocol_category;
|
||||||
|
|
||||||
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_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4205,7 +4210,12 @@ ndpi_protocol ndpi_get_partial_detection(struct ndpi_detection_module_struct *nd
|
|||||||
&& (!NDPI_ISSET(&flow->excluded_protocol_bitmask, flow->guessed_host_protocol_id)))
|
&& (!NDPI_ISSET(&flow->excluded_protocol_bitmask, flow->guessed_host_protocol_id)))
|
||||||
return(ndpi_process_partial_detection(ndpi_struct, flow));
|
return(ndpi_process_partial_detection(ndpi_struct, flow));
|
||||||
else {
|
else {
|
||||||
ndpi_protocol ret = { NDPI_PROTOCOL_UNKNOWN, NDPI_PROTOCOL_UNKNOWN, NDPI_PROTOCOL_CATEGORY_UNSPECIFIED };
|
ndpi_protocol ret = { NDPI_PROTOCOL_UNKNOWN,
|
||||||
|
NDPI_PROTOCOL_UNKNOWN,
|
||||||
|
NDPI_PROTOCOL_CATEGORY_UNSPECIFIED };
|
||||||
|
|
||||||
|
if(flow) ret.category = flow->category;
|
||||||
|
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4216,7 +4226,10 @@ ndpi_protocol ndpi_detection_giveup(struct ndpi_detection_module_struct *ndpi_st
|
|||||||
struct ndpi_flow_struct *flow, u_int8_t enable_guess) {
|
struct ndpi_flow_struct *flow, u_int8_t enable_guess) {
|
||||||
ndpi_protocol ret = { NDPI_PROTOCOL_UNKNOWN, NDPI_PROTOCOL_UNKNOWN, NDPI_PROTOCOL_CATEGORY_UNSPECIFIED };
|
ndpi_protocol ret = { NDPI_PROTOCOL_UNKNOWN, NDPI_PROTOCOL_UNKNOWN, NDPI_PROTOCOL_CATEGORY_UNSPECIFIED };
|
||||||
|
|
||||||
if(flow == NULL) return(ret);
|
if(flow == NULL)
|
||||||
|
return(ret);
|
||||||
|
else
|
||||||
|
ret.category = flow->category;
|
||||||
|
|
||||||
/* TODO: add the remaining stage_XXXX protocols */
|
/* TODO: add the remaining stage_XXXX protocols */
|
||||||
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
||||||
@@ -4631,8 +4644,11 @@ ndpi_protocol ndpi_detection_process_packet(struct ndpi_detection_module_struct
|
|||||||
if(ndpi_struct->ndpi_log_level >= NDPI_LOG_TRACE)
|
if(ndpi_struct->ndpi_log_level >= NDPI_LOG_TRACE)
|
||||||
NDPI_LOG(flow ? flow->detected_protocol_stack[0]:NDPI_PROTOCOL_UNKNOWN,
|
NDPI_LOG(flow ? flow->detected_protocol_stack[0]:NDPI_PROTOCOL_UNKNOWN,
|
||||||
ndpi_struct, NDPI_LOG_TRACE, "START packet processing\n");
|
ndpi_struct, NDPI_LOG_TRACE, "START packet processing\n");
|
||||||
|
|
||||||
if(flow == NULL)
|
if(flow == NULL)
|
||||||
return(ret);
|
return(ret);
|
||||||
|
else
|
||||||
|
ret.category = flow->category;
|
||||||
|
|
||||||
flow->num_processed_pkts++;
|
flow->num_processed_pkts++;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user