9front - general discussion about 9front
 help / color / mirror / Atom feed
* ip/torrent and private trackers
@ 2014-02-01  4:28 Nick Owens
  2014-02-01  9:38 ` [9front] " cinap_lenrek
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Owens @ 2014-02-01  4:28 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 1897 bytes --]

ip/torrent in certain circumstances will never make progress.
specifically, sl reported that no progress was made while contacting the
tracker at bakabt.me. investigation revealed that the tracker was
actually returing an error message:

d14:failure reason95:use of this client is not allowed on our tracker,
please see http://www.bakabt.me/whitelist.phpe

see http://www.bakabt.me/whitelist.php for the whitelist.

in short, they don't like our peerid, -NF9001-. i have just made a
request on their forum to whitelist the id, but the alternative is to
spoof the peerid. the patch below allows you to specify the 8
character peerid with the -i argument when invoking ip/torrent.

setting my peerid to '-TR282Z-', which is transmission 2.82+, allowed me
to connect to bakabt's tracker.

additionally, i'll patch ip/torrent to report errors from the tracker,
so that this situation is less confusing to the user.

diff -r 20c2c6fccfee sys/src/cmd/ip/torrent.c
--- a/sys/src/cmd/ip/torrent.c	Sat Jan 11 16:07:35 2014 +0100
+++ b/sys/src/cmd/ip/torrent.c	Fri Jan 31 03:28:25 2014 -0800
@@ -1174,13 +1174,14 @@
 {
 	int sflag, pflag, vflag, cflag, fd, i, n;
 	Dict *alist, *wlist, *info, *torrent, *d, *l;
-	char *p, *s, *e;
+	char *p, *s, *e, *pid;
 	File **fp, *f;
 	vlong len;
 
 	fmtinstall('H', Hfmt);
 	alist = wlist = nil;
 	sflag = pflag = vflag = cflag = 0;
+	pid = nil;
 	ARGBEGIN {
 	case 'm':
 		mntweb = EARGF(usage());
@@ -1206,6 +1207,9 @@
 	case 'd':
 		debug++;
 		break;
+	case 'i':
+		pid = EARGF(usage());
+		break;
 	default:
 		usage();
 	} ARGEND;
@@ -1339,7 +1343,10 @@
 	case -1:
 		sysfatal("fork: %r");
 	case 0:
-		memmove(peerid, "-NF9001-", 8);
+		if(pid)
+			memmove(peerid, pid, 8);
+		else
+			memmove(peerid, "-NF9001-", 8);
 		for(i=8; i<sizeof(peerid); i++)
 			peerid[i] = nrand(10)+'0';
 		server();


[-- Attachment #2: Type: application/pgp-signature, Size: 834 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9front] ip/torrent and private trackers
  2014-02-01  4:28 ip/torrent and private trackers Nick Owens
@ 2014-02-01  9:38 ` cinap_lenrek
  0 siblings, 0 replies; 2+ messages in thread
From: cinap_lenrek @ 2014-02-01  9:38 UTC (permalink / raw)
  To: 9front

pid is a horrible name for this. why do you not just initialize
peerid at the beginning to -NF9001- and when the argument gets
parsed, insert the string. so theres no need for temprary pid
variable. note, your code is broken right now.
you use memmove, but the string might be shorter than 8 chars.
you want to use strncpy or snprint or something here.

--
cinap


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-01  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-01  4:28 ip/torrent and private trackers Nick Owens
2014-02-01  9:38 ` [9front] " cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).