Dissectors shouldn't update flow->guessed_host_protocol_id

The field `flow->guessed_host_protocol_id` is set at the beginning of
the flow analysis and it represents the "classification by ip" of the flow
itself.

This field should never be changed. Dissectors which want to provide an
"hint" about the classification, should update `flow->guessed_protocol_id`
instead. Such "hint" is useless if the dissector set the "extra-dissection"
data-path.

Rename such field to `guessed_protocol_id_by_ip` to better describe its
role.

Preliminary work necessary for #1687
This commit is contained in:
Nardi Ivan
2022-09-14 17:51:39 +02:00
committed by Toni
parent b4f5243716
commit 7571f48392
13 changed files with 50 additions and 48 deletions
+1 -2
View File
@@ -140,8 +140,7 @@ void ndpi_search_wireguard(struct ndpi_detection_module_struct
u_int32_t receiver_index = get_u_int32_t(payload, 4);
/* We speculate this is wireguard, so let's remember it */
if(flow->guessed_host_protocol_id == NDPI_PROTOCOL_UNKNOWN)
flow->guessed_host_protocol_id = NDPI_PROTOCOL_WIREGUARD;
flow->guessed_protocol_id = NDPI_PROTOCOL_WIREGUARD;
if (flow->l4.udp.wireguard_stage == 0) {
flow->l4.udp.wireguard_stage = 3 + packet->packet_direction;