BitTorrent: how to make Transmission ignore the “private flag”

Jack SparrowSome BitTorrent files have a so-called “private flag”, which is a bit in the .torrent file telling the BitTorrent client: “please, disable DHT and peer exchange; use only trackers for the discovery of peers interested in this torrent”. This can be quite useful for private trackers, communities where the files are shared only among the members and should not “leak” outside.

But some not-so-bright people upload torrents with the private flag set on public torrent sites such as The Pirate Bay, forcing all the downloaders not to use DHT. This is meaningless and detrimental to the quality of downloads, because often trackers are taken down and DHT is a very useful, distributed technology that enables us to be less dependent on said trackers.

At this time, all BitTorrent clients enforce the private flag. One can not simply edit the .torrent file stripping out the private flag, because this would alter the hash and make the torrent file invalid. The only way to ignore the private flag is to edit the source code of the BitTorrent client and make it use DHT whether the flag is set or not.

Today I’ll show you how to make this modification to the source code of a popular free and open-source client: Transmission.

I won’t cover here the steps needed to download and compile the source code, since they are OS-dependent and well documented on the Transmission development wiki.

Once you’ve downloaded the source code, all you need to do is to make a little edit to a single line of the file libtransmission/metainfo.c.

Lines 518-522 in the original source tree look like this:

518   /* private */
519   if (!tr_variantDictFindInt (infoDict, TR_KEY_private, &i))
520     if (!tr_variantDictFindInt (meta, TR_KEY_private, &i))
521       i = 0;
522   inf->isPrivate = i != 0;

You only need to edit line 522. It should read, simply: “inf->isPrivate = 0;”. So the modified snippet looks like:

518   /* private */
519   if (!tr_variantDictFindInt (infoDict, TR_KEY_private, &i))
520     if (!tr_variantDictFindInt (meta, TR_KEY_private, &i))
521       i = 0;
522   inf->isPrivate = 0;

We’re telling that every torrent should be treated as “public”. Now save the file, compile the client, locate the executable and use it. Done! No private flag anymore. 🙂


Autore: pietrodn

Sono nato nel 1993 e studio Ingegneria Informatica al Politecnico di Milano. Amo leggere, programmare, costruire cose. Nella mia vita sono stato un Wikipediano e ho fatto parte del Consiglio di Istituto della mia scuola che è il Liceo Scientifico "Albert Einstein" di Milano. I miei interessi spaziano dall'informatica nelle sue diverse espressioni fino alla politica universitaria e a tutte le cose che possono definirsi geek.

2 pensieri riguardo “BitTorrent: how to make Transmission ignore the “private flag””

    1. Magnet links with private torrents don’t work (is this what you mean?). Anyway one can always disable DHT for all torrents in the Preferences.


Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:


Stai commentando usando il tuo account Chiudi sessione /  Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )


Connessione a %s...