diff options
author | Luca <deri@ntop.org> | 2024-09-17 18:42:00 +0200 |
---|---|---|
committer | Luca <deri@ntop.org> | 2024-09-17 19:04:01 +0200 |
commit | eeb1c281adae5002d8f9c981c0b145a88a814548 (patch) | |
tree | 8489f65f8ecded301b176af350df78a8c8f6e582 /src | |
parent | a726c70f9b620015826e0ce43a8f5dd4f9513e7d (diff) |
Fixed handling of spurious TCP retransmissions
Diffstat (limited to 'src')
-rw-r--r-- | src/include/ndpi_typedefs.h | 3 | ||||
-rw-r--r-- | src/lib/ndpi_main.c | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index 263d81dc5..b095ca221 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -1245,7 +1245,8 @@ struct ndpi_flow_struct { tcp sequence number connection tracking */ u_int32_t next_tcp_seq_nr[2]; - + u_int16_t last_tcp_pkt_payload_len; + /* Flow addresses (useful for LRU lookups in ndpi_detection_giveup()) and ports. All in *network* byte order. Client and server. diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 808075515..12f51af0e 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -7131,7 +7131,8 @@ static void ndpi_connection_tracking(struct ndpi_detection_module_struct *ndpi_s /* check tcp sequence counters */ if(((u_int32_t)(ntohl(tcph->seq) - flow->next_tcp_seq_nr[packet->packet_direction])) > ndpi_str->tcp_max_retransmission_window_size) { - packet->tcp_retransmission = 1; + if(flow->last_tcp_pkt_payload_len > 0) + packet->tcp_retransmission = 1; /* CHECK IF PARTIAL RETRY IS HAPPENING */ if((flow->next_tcp_seq_nr[packet->packet_direction] - ntohl(tcph->seq) < @@ -7149,6 +7150,8 @@ static void ndpi_connection_tracking(struct ndpi_detection_module_struct *ndpi_s flow->next_tcp_seq_nr[0] = 0; flow->next_tcp_seq_nr[1] = 0; } + + flow->last_tcp_pkt_payload_len = packet->payload_packet_len; } else if(udph != NULL) { if(ndpi_str->cfg.direction_detect_enabled && (udph->source != udph->dest)) |