Added fix for discarding core protocols as subprotocols

This commit is contained in:
Luca Deri
2019-06-05 23:15:06 +02:00
parent c43bec826d
commit 4e8055742e
+7 -4
View File
@@ -325,10 +325,13 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
if "detected" in flow == 0 then "detected" = "guess" if "detected" in flow == 0 then "detected" = "guess"
else "guess" = "detected" else "guess" = "detected"
**/ **/
if(flow->detected_protocol_stack[1] == 0) { if(flow->detected_protocol_stack[1] == NDPI_PROTOCOL_UNKNOWN) {
flow->detected_protocol_stack[1] = flow->guessed_protocol_id; /* Avoid putting as subprotocol a "core" protocol such as SSL or DNS */
if(flow->detected_protocol_stack[0] == 0) if(ndpi_struct->proto_defaults[flow->guessed_protocol_id].can_have_a_subprotocol == 0) {
flow->detected_protocol_stack[0] = flow->guessed_host_protocol_id; flow->detected_protocol_stack[1] = flow->guessed_protocol_id;
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN)
flow->detected_protocol_stack[0] = flow->guessed_host_protocol_id;
}
} }
else { else {
if(flow->detected_protocol_stack[1] != flow->guessed_protocol_id) if(flow->detected_protocol_stack[1] != flow->guessed_protocol_id)