aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_main.c
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2024-05-06 10:20:40 +0200
committerGitHub <noreply@github.com>2024-05-06 10:20:40 +0200
commitb7d77972bceb250e888139319d64d125112ee502 (patch)
tree4fbdd54b0752e53f0323c5aadca0cb08e3970a62 /src/lib/ndpi_main.c
parente31ef00715581c56d429d7a0ea849db74a1fa956 (diff)
Remove workaround for TCP flows with multiple SYNs (#2421)
Deciding when a session starts and ends is responsability of the applicationi (via its flow manager)i, not of the library. BTW, the removed code is incomplete at beast
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r--src/lib/ndpi_main.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 2a081f8a4..3d897edfd 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -6714,42 +6714,6 @@ static int ndpi_init_packet(struct ndpi_detection_module_struct *ndpi_str,
if(l4_packet_len >= packet->tcp->doff * 4) {
packet->payload_packet_len = l4_packet_len - packet->tcp->doff * 4;
packet->payload = ((u_int8_t *) packet->tcp) + (packet->tcp->doff * 4);
-
- /* check for new tcp syn packets, here
- * idea: reset detection state if a connection is unknown
- */
- if(packet->tcp->syn != 0 && packet->tcp->ack == 0 && flow->init_finished != 0 &&
- flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
- u_int16_t guessed_protocol_id, guessed_protocol_id_by_ip;
- u_int16_t packet_direction_counter[2];
- u_int8_t num_processed_pkts;
-
-#define flow_save(a) a = flow->a
-#define flow_restore(a) flow->a = a
-
- flow_save(packet_direction_counter[0]);
- flow_save(packet_direction_counter[1]);
- flow_save(num_processed_pkts);
- flow_save(guessed_protocol_id);
- flow_save(guessed_protocol_id_by_ip);
-
- ndpi_free_flow_data(flow);
- memset(flow, 0, sizeof(*(flow)));
-
- /* Restore pointers */
- flow->l4_proto = IPPROTO_TCP;
-
- flow_restore(packet_direction_counter[0]);
- flow_restore(packet_direction_counter[1]);
- flow_restore(num_processed_pkts);
- flow_restore(guessed_protocol_id);
- flow_restore(guessed_protocol_id_by_ip);
-
-#undef flow_save
-#undef flow_restore
-
- NDPI_LOG_DBG(ndpi_str, "tcp syn packet for unknown protocol, reset detection state\n");
- }
} else {
/* tcp header not complete */
return(1);