HTTP: fix classification (#1692)
If we have a valid HTTP sessions, we should ignore `flow->guessed_protocol_id` field (i.e. classification "by-port") altogheter. The attached trace was classified as "SIP/HTTP" only because the *client* port was 5060... As a general rule, having a classification such as "XXXX/HTTP" is *extremely* suspicious.
This commit is contained in:
@@ -759,9 +759,10 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
||||
if(flow->detected_protocol_stack[1] == NDPI_PROTOCOL_UNKNOWN) {
|
||||
/* Avoid putting as subprotocol a "core" protocol such as SSL or DNS */
|
||||
if(ndpi_struct->proto_defaults[flow->guessed_protocol_id].subprotocol_count == 0) {
|
||||
flow->detected_protocol_stack[1] = flow->guessed_protocol_id;
|
||||
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN)
|
||||
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
||||
flow->detected_protocol_stack[0] = flow->guessed_host_protocol_id;
|
||||
flow->detected_protocol_stack[1] = flow->guessed_protocol_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user