From 1b3de449a1192a2d834f43901f4dd8b45edbf011 Mon Sep 17 00:00:00 2001 From: Nardi Ivan Date: Tue, 6 Sep 2022 12:02:23 +0200 Subject: HTTP: correctly set the classification protocols Classification should always be set via `ndpi_set_detected_protocol()` to be sure to set a correct `confidence` value, too. Having a "known" protocol stack with `NDPI_CONFIDENCE_UNKNOWN` as confidence, is not valid. This code in HTTP dissector likely needs some more thoughts (the classification itself of the attached example doesn't make a lot of sense), but the goal of this commit is only to always have a valid `confidence` value. --- src/lib/protocols/http.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index f9d6abd90..5a088c7c8 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -762,8 +762,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_ if(ndpi_struct->proto_defaults[flow->guessed_protocol_id].subprotocol_count == 0) { if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN && flow->guessed_host_protocol_id != NDPI_PROTOCOL_UNKNOWN) { - flow->detected_protocol_stack[0] = flow->guessed_host_protocol_id; - flow->detected_protocol_stack[1] = flow->guessed_protocol_id; + ndpi_set_detected_protocol(ndpi_struct, flow, flow->guessed_host_protocol_id, flow->guessed_protocol_id, NDPI_CONFIDENCE_DPI); } } } -- cgit v1.2.3