aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/bittorrent.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2020-09-24 23:26:03 +0200
committerLuca Deri <deri@ntop.org>2020-09-24 23:26:03 +0200
commit044ed14b4f23708ec05f5b5c85ca29acbf4b59db (patch)
treea03aea7d48eb8ec6b5d83da71c7ab2c40fcbc10c /src/lib/protocols/bittorrent.c
parent51e86346d31f270099d4169cd2ebcb0146e5e593 (diff)
Various optimizations to reduce not-necessary calls
Optimized various UDP dissectors Removed dead protocols such as pando and pplive
Diffstat (limited to 'src/lib/protocols/bittorrent.c')
-rw-r--r--src/lib/protocols/bittorrent.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/protocols/bittorrent.c b/src/lib/protocols/bittorrent.c
index 9f7620558..3509449b2 100644
--- a/src/lib/protocols/bittorrent.c
+++ b/src/lib/protocols/bittorrent.c
@@ -389,10 +389,8 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
/* This is broadcast */
if(packet->iph) {
-
if((packet->iph->saddr == 0xFFFFFFFF) || (packet->iph->daddr == 0xFFFFFFFF))
goto exclude_bt;
-
if(packet->udp) {
u_int16_t sport = ntohs(packet->udp->source), dport = ntohs(packet->udp->dest);
@@ -417,9 +415,11 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
char *bt_search = "BT-SEARCH * HTTP/1.1\r\n";
if((ntohs(packet->udp->source) < 1024)
- || (ntohs(packet->udp->dest) < 1024) /* High ports only */)
+ || (ntohs(packet->udp->dest) < 1024) /* High ports only */) {
+ NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
return;
-
+ }
+
/*
Check for uTP http://www.bittorrent.org/beps/bep_0029.html
@@ -464,7 +464,7 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
flow->bittorrent_stage++;
- if(flow->bittorrent_stage < 10) {
+ if(flow->bittorrent_stage < 5) {
/* We have detected bittorrent but we need to wait until we get a hash */
if(packet->payload_packet_len > 19 /* min size */) {
@@ -489,6 +489,7 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
return;
}
+
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
}
}