aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNardi Ivan <nardi.ivan@gmail.com>2024-08-05 11:26:08 +0200
committerIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2024-09-03 12:39:07 +0200
commit5d8edccef8adcbf05bb5b01bd78b44ed2e80694e (patch)
tree591f91fd6da3997589c4e912d308b83baa990d7b /src
parent91531ed040933ea96eaa4c3f3cd9d11159acf586 (diff)
Bittorrent: improve detection of UTPv1 and avoid false positives
Diffstat (limited to 'src')
-rw-r--r--src/lib/protocols/bittorrent.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/protocols/bittorrent.c b/src/lib/protocols/bittorrent.c
index c0f5955c9..01080906f 100644
--- a/src/lib/protocols/bittorrent.c
+++ b/src/lib/protocols/bittorrent.c
@@ -104,6 +104,8 @@ static u_int8_t is_utpv1_pkt(const u_int8_t *payload, u_int payload_len) {
if(h->next_extension > 2) return(0);
if(h->h_type == 4 /* SYN */ && (h->tdiff_usec != 0 ||
payload_len != (u_int)h_length)) return(0);
+ if(h->h_type == 2 /* STATE */ &&
+ payload_len != (u_int)h_length) return(0);
if(h->h_type == 0 /* DATA */ &&
payload_len == (u_int)h_length) return(0);
if(h->connection_id == 0) return(0);