Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiny gnutella improvement if gtk-gnutella used. #1525

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/lib/protocols/gnutella.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,20 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
}
}
} else if (packet->udp != NULL) {
/* Check for Mojito-DHT encapsulated gnutella (gtk-gnutella). */
if (packet->payload_packet_len >= 28 &&
ntohl(get_u_int32_t(packet->payload, 24)) == 0x47544b47 /* GTKG */)
{
u_int32_t gnutella_payload_len = le32toh(get_u_int32_t(packet->payload, 19));

if (gnutella_payload_len == (u_int32_t)packet->payload_packet_len - 23)
{
NDPI_LOG_DBG2(ndpi_struct, "detected mojito-dht/gnutella udp\n");
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_CONFIDENCE_DPI);
return;
}
}

/* observations:
* all the following patterns send out many packets which are the only ones of their flows,
* often on the very beginning of the traces, or flows with many packets in one direction only.
Expand Down
Loading