Remove detected_protocol_stack field from ndpi_packet_struct (#1317)

This field is an exact copy of `ndpi_flow_struct->detected_protocol_stack[2]`:
* at the very beginning of packet dissection, the value saved in
`flow->detected_protocol_stack` is copied in `packet->detected_protocol_stack`
(via `ndpi_detection_process_packet()` -> `ndpi_init_packet_header()`)

* every time we update `flow->detected_protocol_stack` we update
`packet->detected_protocol_stack` too (via `ndpi_int_change_protocol()`
-> `ndpi_int_change_packet_protocol()`)

These two fields are always in sync: keeping the same value in two
different places is useless.
This commit is contained in:
Ivan Nardi
2021-09-29 13:11:32 +02:00
committed by GitHub
parent 721031210b
commit 5cf3fef8f7
51 changed files with 77 additions and 156 deletions
+2 -2
View File
@@ -403,7 +403,7 @@ void ndpi_search_directconnect(struct ndpi_detection_module_struct
NDPI_LOG_DBG(ndpi_struct, "search DC\n");
if(packet->detected_protocol_stack[0] == NDPI_PROTOCOL_DIRECTCONNECT) {
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_DIRECTCONNECT) {
if(src != NULL && ((u_int32_t)
(packet->current_time_ms -
src->directconnect_last_safe_access_time) <
@@ -416,7 +416,7 @@ void ndpi_search_directconnect(struct ndpi_detection_module_struct
ndpi_struct->directconnect_connection_ip_tick_timeout)) {
dst->directconnect_last_safe_access_time = packet->current_time_ms;
} else {
packet->detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN;
flow->detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN;
NDPI_LOG_DBG2(ndpi_struct, "skipping as unknown due to timeout\n");
}
return;