Bittorrent: fix keys in cache code (#1670)

This commit is contained in:
Ivan Nardi
2022-07-22 12:10:43 +02:00
committed by GitHub
parent e85d6d7db7
commit ce6f11840d
+2 -2
View File
@@ -142,9 +142,9 @@ static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struc
/* Also add +2 ports of the sender in order to catch additional sockets open by the same client */
for(i=0; i<2; i++) {
if(packet->udp)
key1 = ndpi_ip_port_hash_funct(packet->iph->saddr, htons(ntohs(packet->udp->source)+1));
key1 = ndpi_ip_port_hash_funct(packet->iph->saddr, htons(ntohs(packet->udp->source)+1+i));
else
key1 = ndpi_ip_port_hash_funct(packet->iph->saddr, htons(ntohs(packet->tcp->source)+1));
key1 = ndpi_ip_port_hash_funct(packet->iph->saddr, htons(ntohs(packet->tcp->source)+1+i));
ndpi_lru_add_to_cache(ndpi_struct->bittorrent_cache, key1, NDPI_PROTOCOL_BITTORRENT);
}