From 5b98dcf3a36f43bf335f6888d9515bdb614cbd6d Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 30 Mar 2024 00:34:28 +0100 Subject: Limit ipv6 udp replies to an amount that does not create too large UDP packets. Credits to anonymous donor --- trackerlogic.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'trackerlogic.c') diff --git a/trackerlogic.c b/trackerlogic.c index 719f8a2..47e0085 100644 --- a/trackerlogic.c +++ b/trackerlogic.c @@ -259,8 +259,12 @@ static size_t return_peers_selection( struct ot_workstruct *ws, ot_peerlist *pee } /* Compiles a list of random peers for a torrent - * reply must have enough space to hold 92+6*amount bytes - * does not yet check not to return self + * Reply must have enough space to hold: + * 92 + 6 * amount bytes for TCP/IPv4 + * 92 + 18 * amount bytes for TCP/IPv6 + * 12 + 6 * amount bytes for UDP/IPv4 + * 12 + 18 * amount bytes for UDP/IPv6 + * Does not yet check not to return self */ size_t return_peers_for_torrent( struct ot_workstruct * ws, ot_torrent *torrent, size_t amount, char *reply, PROTO_FLAG proto ) { ot_peerlist *peer_list = torrent->peer_list; -- cgit v1.2.3