Bug 305187 - Sending of IPv6 adress confuses (a certain) tracker
Summary: Sending of IPv6 adress confuses (a certain) tracker
Status: RESOLVED FIXED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
: 308624 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-08-15 10:09 UTC by tankyuushin
Modified: 2015-01-24 22:46 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tankyuushin 2012-08-15 10:09:21 UTC
Please excuse my strange description, I am neither a programmer nor familiar with the torrent protocol. So I am not quite sure if this is a ktorrent bug or a tracker bug. To top it off, English is not my main language.

Anyway, I managed to pinpoint the offending bit of code.
I am talking about libktorrent-1.2.1-2.

Some Background:
For some time now, I have noticed the following behaviour: 

A torrent doesn't download, it is orange in the torrent list.
In the InfoWidget->Trackers Panel, Status field shows
"Error: Could not resolve hostname"
Clicking on the "Update Trackers" button, the error disappears, it shows OK and a numer of seeds/leechers.
However, the torrent still does not download.
Right-clicking on the torrent and choosing "Manual Announce" makes the error reappear.

I copied the announce URL from the log panel and tried downloading it with wget:

wget -O - -q "http://ehtracker.org/514504/announce?peer_id=-KT4210-N5yhZ4QELxfk&port=51241&uploaded=0&downloade3547&ip=FE80%3A%3A21A%3A4DFF%3AFE4C%3AD692&event=started&info_hash=*E%25%40%be%a1j%8c%16%9a%1d%1e%d3%a2%08%d0s%d3%0c%8e"

gives: 
d14:failure reason27:Could not resolve host namee

So the error is the actual answer from the tracker. 

I noticed that there is an &ip=FE80%3A%3A21A%3A4DFF%3AFE4C%3AD692 field in the request. 
This is inserted in 
libktorrent-1.2.1-2/src/tracker/httptracker.cpp:234-240:
		QString cip = Tracker::getCustomIP();
		if (cip.isNull())
			cip = CurrentIPv6Address();
		
		if (!cip.isEmpty())
			u.addQueryItem("ip", cip);
		
Since my box does not have IPv6 connectivity to the internet this is only a link local address.
Modifying the request, deleting the ip field (and adding no_peer_id=1 to satisfy the tracker) like this:

wget -O - -q "http://ehtracker.org/514504/announce?peer_id=-KT4210-N5yhZ4QELxfk&port=51241&uploaded=0&downloade3547&event=started&info_hash=*E%25%40%be%a1j%8c%16%9a%1d%1e%d3%a2%08%d0s%d3%0c%8e&no_peer_id=1"

I get an (presumably) valid answer:
d8:intervali1588e5:peersld2:ip15:219.126.153.1864:porti43442eed2:ip13:106.169.30.314:porti44585eed2:ip12:200.132.1.174:porti40021eed2:ip14:119.173.192.254:porti20638eed2:ip14:27.133.210.1924:porti27586eeee

So not sending an ip-address seems ok, while sending a (invalid?) ipv6-address gives an error. Maybe the tracker does not support ipv6 and so can not resolve the address.

I don't know if sending the ip-address is a protocol requirement, but sending a link local ipv6-address certainly seems wrong to me.

Please excuse my convoluted description.

Reproducible: Sometimes




The torrent I am referring to is 
http://ehtracker.org/t/514504/2a452540bea16a8c169a1d1ed3a208d073d30c8e.torrent
Comment 1 Joris Guisson 2012-08-22 18:16:27 UTC
Git commit 96dce603fc4e6ac4d089ba4f22f3b17da3c24c84 by Joris Guisson.
Committed on 22/08/2012 at 20:16.
Pushed by guisson into branch 'master'.

Do not pass link local IPv6 addresses to ip parameter of tracker

M  +3    -0    ChangeLog
M  +2    -2    src/util/functions.cpp

http://commits.kde.org/libktorrent/96dce603fc4e6ac4d089ba4f22f3b17da3c24c84
Comment 2 Joris Guisson 2012-08-22 18:17:52 UTC
Git commit ea2a6dc65fdac698c2be86ef1e194dde11969949 by Joris Guisson.
Committed on 22/08/2012 at 20:16.
Pushed by guisson into branch '1.3'.

Backport to 1.3: Do not pass link local IPv6 addresses to ip parameter of tracker

M  +3    -0    ChangeLog
M  +2    -2    src/util/functions.cpp

http://commits.kde.org/libktorrent/ea2a6dc65fdac698c2be86ef1e194dde11969949
Comment 3 Joris Guisson 2012-11-02 11:42:49 UTC
*** Bug 308624 has been marked as a duplicate of this bug. ***
Comment 4 karl.r.ernst 2013-06-25 16:51:31 UTC
The same thing still happens with the most recent version of TKorrent
Comment 5 abelius 2014-08-21 08:13:19 UTC
Indeed, the problem seems to be back in version 4.3.1 on KDE 4.14.0
Comment 6 Keren Sky 2015-01-24 22:46:43 UTC
I see this problem when using Ktorrent on FreeBSD 10.1. The steps outlined by "tankyuushin@gmail.com" can be reproduced and the torrent client has no peers to connect to. Any progress?

Best regards,