Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 265024 - net-p2p/rtorrent: ip filter support (patch and ebuild)
Summary: net-p2p/rtorrent: ip filter support (patch and ebuild)
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement with 4 votes (vote)
Assignee: Gentoo net-p2p team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-05 21:10 UTC by George Waksman
Modified: 2014-06-16 06:57 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
rtorrent-0.8.4 ip filter patch (rtorrent-0.8.4-ip_filter_no_boost.patch,26.90 KB, patch)
2009-04-05 21:14 UTC, George Waksman
Details | Diff
rtorrent-0.8.4 ip filter ebuild (rtorrent-0.8.4-r2.ebuild,2.07 KB, text/plain)
2009-04-05 21:15 UTC, George Waksman
Details
Patch for IpFilter in version 0.8.6 as provided by libtorrent.rakshasa.no (rtorrent-0.8.6-ip_filter_no_boost-fast-bsd2.patch,32.35 KB, patch)
2010-05-05 19:18 UTC, John
Details | Diff
rtorrent-0.8.6-r1 with ipfilter support (rtorrent-0.8.6-r1.ebuild,1.69 KB, text/plain)
2010-05-05 19:20 UTC, John
Details
rtorrent-0.8.6-r1 with ipfilter support enabled by USE="ipfilter" (rtorrent-0.8.6-r1.ebuild,1.74 KB, text/plain)
2010-06-22 20:48 UTC, George Waksman
Details
rtorrent-0.8.6-r1 with ipfilter support enabled by USE="ipfilter" and fixed tabs (rtorrent-0.8.6-r1.ebuild,1.73 KB, text/plain)
2010-06-22 20:50 UTC, George Waksman
Details
rtorrent-0.8.6-r1 with ipfilter support enabled by USE="ipfilter" (rtorrent-0.8.6-r1.ebuild,1.68 KB, text/plain)
2011-03-31 17:40 UTC, George Waksman
Details
rtorrent-0.8.6-r2 with ipfilter support enabled by USE="ipfilter" (rtorrent-0.8.6-r2.ebuild,1.73 KB, text/plain)
2011-03-31 17:42 UTC, George Waksman
Details
rtorrent-0.8.7 IP filter patch (rtorrent-0.8.7-ip_filter_no_boost-fast-bsd2.patch,32.31 KB, patch)
2011-04-04 20:31 UTC, George Waksman
Details | Diff
rtorrent-0.8.7 ebuild with ipfilter support enabled by USE="ipfilter" (rtorrent-0.8.7.ebuild,1.74 KB, text/plain)
2011-04-04 20:32 UTC, George Waksman
Details
rtorrent-0.8.7-r1 ebuild with ipfilter support enabled by USE="ipfilter" (rtorrent-0.8.7-r1.ebuild,1.75 KB, text/plain)
2011-04-13 18:29 UTC, George Waksman
Details
rtorrent-0.8.7-r2 ebuild with ipfilter support enabled by USE="ipfilter" (rtorrent-0.8.7-r2.ebuild,1.84 KB, patch)
2011-04-21 01:54 UTC, George Waksman
Details | Diff
rtorrent-0.8.7-r3 ebuild with ipfilter support enabled by USE="ipfilter" (rtorrent-0.8.7-r3.ebuild,1.84 KB, text/plain)
2011-05-12 21:54 UTC, George Waksman
Details
rtorrent-0.8.7-r3 ebuild with ipfilter support enabled by USE="ipfilter" (rtorrent-0.8.7-r3.ebuild,1.87 KB, application/octet-stream)
2011-06-10 15:42 UTC, George Waksman
Details
rtorrent-0.8.7-r4 ebuild with ipfilter support enabled by USE="ipfilter" (rtorrent-0.8.7-r4.ebuild,1.90 KB, text/plain)
2011-08-16 14:55 UTC, George Waksman
Details
rtorrent-0.8.9 IP filter patch (rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch,32.36 KB, patch)
2011-09-30 19:02 UTC, George Waksman
Details | Diff
rtorrent-0.8.9 ebuild with ipfilter support enabled by USE="ipfilter" (rtorrent-0.8.9.ebuild,1.92 KB, text/plain)
2011-09-30 19:03 UTC, George Waksman
Details
rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch.out (rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch.out,2.22 KB, text/plain)
2011-10-03 09:36 UTC, jannis
Details
rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch (rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch,32.36 KB, patch)
2011-10-03 09:38 UTC, jannis
Details | Diff
rtorrent-0.9.1-ip_filter_no_boost-fast-bsd2.patch (rtorrent-0.9.1-ip_filter_no_boost-fast-bsd2.patch,32.31 KB, patch)
2012-05-13 00:50 UTC, Vilbrekin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description George Waksman 2009-04-05 21:10:59 UTC
Support for filtering ip ranges is a powerful and important feature of many modern torrent clients. Out of the box, rtorrent does not have support for ip range filtering.

Although patches have existed in the rtorrent community for almost a year, this feature has not made it into the mainline code ( http://libtorrent.rakshasa.no/ticket/239 ).

Reproducible: Always

Steps to Reproduce:
1. Run rtorrent
Comment 1 George Waksman 2009-04-05 21:14:28 UTC
Created attachment 187412 [details, diff]
rtorrent-0.8.4 ip filter patch

This is an ever so slightly tweaked version of the no boost ip filter patch for rtorrent taken from http://libtorrent.rakshasa.no/ticket/239
Comment 2 George Waksman 2009-04-05 21:15:36 UTC
Created attachment 187414 [details]
rtorrent-0.8.4 ip filter ebuild

ebuild to apply and build rtorrent with ipfilter support
Comment 3 John 2010-05-05 19:18:17 UTC
Created attachment 230535 [details, diff]
Patch for IpFilter in version 0.8.6 as provided by libtorrent.rakshasa.no

Patch for IpFilter in version 0.8.6 as provided by http://libtorrent.rakshasa.no/ticket/239
Comment 4 John 2010-05-05 19:20:49 UTC
Created attachment 230537 [details]
rtorrent-0.8.6-r1 with ipfilter support

Patch for including ipfilter support in 0.8.6, compiled fine on x86_64 and has run as expected for some hours now. Please help test the patch/ebuild, and comment if I should change anything.
Comment 5 John 2010-05-05 19:23:33 UTC
Any possibility to have this patch included in the standard tree, and (de)selected with a use flag?
Comment 6 George Waksman 2010-06-22 20:48:40 UTC
Created attachment 236273 [details]
rtorrent-0.8.6-r1 with ipfilter support enabled by USE="ipfilter"

Slight modification to John's rtorrent-0.8.6-r1 ebuild separating the patch to be enabled by USE="ipfilter" .
Comment 7 George Waksman 2010-06-22 20:50:55 UTC
Created attachment 236275 [details]
rtorrent-0.8.6-r1 with ipfilter support enabled by USE="ipfilter" and fixed tabs

Fixed the tabs in my previous ebuild.
Comment 8 George Waksman 2010-10-25 15:14:57 UTC
We have a solution; it works; I've been running with the attached patch and ebuild for months without problem; what needs to be done to get this pushed into the mainline portage tree?
Comment 9 George Waksman 2011-03-31 17:40:59 UTC
Created attachment 268009 [details]
rtorrent-0.8.6-r1 with ipfilter support enabled by USE="ipfilter"

a few minor cleanup fixes to the ebuild
Comment 10 George Waksman 2011-03-31 17:42:23 UTC
Created attachment 268011 [details]
rtorrent-0.8.6-r2 with ipfilter support enabled by USE="ipfilter"

updated ebuild to keep in step with main portage tree
Comment 11 George Waksman 2011-04-04 20:31:27 UTC
Created attachment 268511 [details, diff]
rtorrent-0.8.7 IP filter patch

updated patch for rtorrent 0.8.7 taken from

fixed-rtorrent-0.8.7-ip_filter_no_boost-fast-bsd2.patch

at

http://libtorrent.rakshasa.no/ticket/239
Comment 12 George Waksman 2011-04-04 20:32:41 UTC
Created attachment 268513 [details]
rtorrent-0.8.7 ebuild with ipfilter support enabled by USE="ipfilter"

updated ebuild to apply the IP filter patch to rtorrent-0.8.7
Comment 13 diamond 2011-04-05 11:36:31 UTC
How do you filter IPs? Do you use ipfilter.dat, like in utorrent? What is a format of your ipfilter.dat? Do you support IPv6 addresses in ipfilter? 

For example, utorrent accoding it's manual chm file have the following format (with IPv6 support):

 /* ipfilter.dat is a simple text file that specifies IP ranges to block. Only blocks are supported; any allows will be ignored. The format is as follows: 
IPv4: xxx.xxx.xxx.xxx - yyy.yyy.yyy.yyy for each line, where each x and each y corresponds to arbitrary decimal values between 0 and 9. 
IPv6: [xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx] - [yyyy:yyyy:yyyy:yyyy:yyyy:yyyy:yyyy:yyyy] for each line, where each x and each y corresponds to arbitrary hexadecimal values between 0 and F. Zero-grouped IPv6 addresses are accepted. 
Single IPs can be specified on a line without having to write it in IP range notation. This file can be reloaded via the context menu in the Peers tab. If you wish to make use of this file, ipfilter.enable should be enabled. Note that only peer connections are blocked by ipfilter.dat; tracker connections (including DHT) are not blocked, even if their IPs fall within any ranges specified in ipfilter.dat. */
Comment 14 George Waksman 2011-04-05 20:07:37 UTC
It looks to me like the ipfilter.dat file that you describe is of a similar format to the ones that this patch supports. I don't know if IPv6 is supported.

As for usage, to quote the original author of the patch from: http://libtorrent.rakshasa.no/ticket/239

"The filter files are the ones from bluetack.co.uk. Multiple files can be used. Overlapping ranges are merged automatically. Both incoming and outgoing connections are checked against the filter. Exclusions are not supported, so connection to/from IPs in all the loaded ranges will be disallowed and dropped.

"Include "ip_filter=<file,...>" directive in .rtorrent.rc. For example mine looks like: 

"ip_filter=ipfilter/level1,ipfilter/level2,ipfilter/bogon,ipfilter/dshield,ipfilter/Microsoft,ipfilter/templist

There are other details on the original page, if you want to read further.
Comment 15 George Waksman 2011-04-13 18:29:41 UTC
Created attachment 269859 [details]
rtorrent-0.8.7-r1 ebuild with ipfilter support enabled by USE="ipfilter"

just keeping up with mainline portage tree; it'd sure be nice if we could get this moved into mainline portage and stop maintaining a parallel set of ebuilds
Comment 16 Stanislav Ochotnicky (RETIRED) gentoo-dev 2011-04-13 19:34:53 UTC
From my POV, adding this modified ebuild & patch would be a mistake unless upstream actually merges these changes. The patch itself is quite big and while it's basically just additions with minor changes to current code, results could still cause problems. 

I afraid that after adding this patch some user will hit a bug caused by it and we won't be able to get upstream help if need be. While I see a possibility to add this with an ewarn message when ipfilter USE flag is enabled, I have other suggestion as well

Try to split the patch into smaller chunks, maybe then upstream will be more motivated to merge it into trunk?
Comment 17 George Waksman 2011-04-16 18:46:00 UTC
The patch is taken from a ticket on the rtorrent bug tracking site. I do not maintain the patch; I merely maintain the ebuild.

The patch does appear to have active maintainers on the rtorrent bug tracking site but it is unclear why it is not being pushed into rtorrent mainline (perhaps the one rtorrent maintainer has other things that he is more interested in).
Comment 18 George Waksman 2011-04-21 01:54:37 UTC
Created attachment 270731 [details, diff]
rtorrent-0.8.7-r2 ebuild with ipfilter support enabled by USE="ipfilter"

updated ebuild to 0.8.8-r2 to keep up with portage
Comment 19 George Waksman 2011-05-12 21:54:08 UTC
Created attachment 272989 [details]
rtorrent-0.8.7-r3 ebuild with ipfilter support enabled by USE="ipfilter"
Comment 20 jannis 2011-06-10 14:39:02 UTC
Hi, I'm trying to install rtorrent with the IP filter on an amd64 Gentoo system. With USE="-ipfilter" it works but when I enable the USE-flag it gives me:

>>> Source configured.
>>> Compiling source in /var/tmp/portage/net-p2p/rtorrent-0.8.7-r3/work/rtorrent-0.8.7 ...
make -j2 
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /var/tmp/portage/net-p2p/rtorrent-0.8.7-r3/work/rtorrent-0.8.7/missing --run aclocal-1.11 -I scripts
configure.ac:5: warning: macro `AM_PATH_CPPUNIT' not found in library
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /var/tmp/portage/net-p2p/rtorrent-0.8.7-r3/work/rtorrent-0.8.7/missing --run autoconf
 cd . && /bin/sh /var/tmp/portage/net-p2p/rtorrent-0.8.7-r3/work/rtorrent-0.8.7/missing --run automake-1.11 --gnu
configure.ac:5: error: possibly undefined macro: AM_PATH_CPPUNIT
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
make: *** [configure] Error 1
make: *** Waiting for unfinished jobs....
emake failed

any ideas?
Comment 21 jannis 2011-06-10 14:44:12 UTC
(In reply to comment #20)
Sorry, false alarm. Installing dev-util/cppunit fixed it. Should it be added as dependency?
Comment 22 George Waksman 2011-06-10 15:42:55 UTC
Created attachment 276533 [details]
rtorrent-0.8.7-r3 ebuild with ipfilter support enabled by USE="ipfilter"

added USE="ipfilter" dependency on dev-util/cppunit
Comment 23 jannis 2011-06-10 19:15:32 UTC
Has anyone ever experienced rtorrent-crashes with this patch? I don't have much information for now since it is running on my NAS-system (which doesn't have any debugging enabled) but it crashed three times today. I'll investigate further to track the issue down. Maybe it's just because of the update, it was running the stable version until today, now it's the ~amd64 one (+ the patch + colors patch).
Comment 24 jannis 2011-06-10 21:58:22 UTC
(In reply to comment #23)
I got news here. First thing: It's not related to the ipfilter patch. I got a server-monitoring-tool (munin) that requested stats from rtorrent via xmlrpc every 5 minutes. And these xmlrpc-requests made rtorrent crash. Seems to be somewhere in the update from libtorrent-0.12.6 -> 0.12.7 or rtorrent-0.8.6 -> 0.8.7
Comment 25 jannis 2011-06-10 22:16:48 UTC
I'm really sorry for the noise today :(

Update: libtorrent-0.12.8 and rtorrent-0.8.8 do work fine (no crashes when doing xmlrpc). AND: ipfilter-patch from 0.8.7 applies fine to 0.8.8 :)
So finally I have an up-to-date rtorrent-install that does xmlrpc and IP filtering.

And I forgot to thank you for your very quick update of the ebuild. Thanks!
Comment 26 George Waksman 2011-08-16 14:55:47 UTC
Created attachment 283569 [details]
rtorrent-0.8.7-r4 ebuild with ipfilter support enabled by USE="ipfilter"

keeping up with mainline portage
Comment 27 George Waksman 2011-09-30 19:02:11 UTC
Created attachment 288397 [details, diff]
rtorrent-0.8.9 IP filter patch

new version of the patch; found here: https://plus.google.com/115694272762812695651/posts/3ivQFYwtZVM
Comment 28 George Waksman 2011-09-30 19:03:03 UTC
Created attachment 288399 [details]
rtorrent-0.8.9 ebuild with ipfilter support enabled by USE="ipfilter"

updated ebuild for rtorrent-0.8.9 with ipfilter
Comment 29 jannis 2011-10-01 10:20:07 UTC
Thanks for your work George! The new (attached) patch for 0.8.9 doesn't work (patch fails to apply) but the one used for 0.8.8 works fine with 0.8.9
Comment 30 George Waksman 2011-10-03 01:36:49 UTC
it seemed to work for me; can you provide more details?

could you also upload the patch and ebuild that worked for you?
Comment 31 jannis 2011-10-03 09:34:53 UTC
I downloaded attachment 288397 [details, diff] and stored it as "files/rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch", downloaded attachment 288399 [details] and stored it as "rtorrent-0.8.9.ebuild". The other two patches in files ("rtorrent-0.8.9-canvas-fix.patch" and "rtorrent-0.8.9-ncurses.patch") were copied over from official portage tree.
When I try to emerge then, I get this error:
 * Failed Patch: rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch !
 *  ( /usr/local/portage/net-p2p/rtorrent/files/rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch )

I'll upload the detailed patch failure as attachment.

Using the file from "http://www.fateyev.com/files/coding/rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch" as patch works so I think somewhere between downlodaing the file and uploading it here it got corrupted.
Comment 32 jannis 2011-10-03 09:36:10 UTC
Created attachment 288653 [details]
rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch.out

Portage's detailed patch failure log
Comment 33 jannis 2011-10-03 09:38:04 UTC
Created attachment 288657 [details, diff]
rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch

Version of the patch downloaded from the URL (Google+-post) George provided
Comment 34 jannis 2011-10-03 09:42:48 UTC
Okay, this is getting strange here. I downloaded the patch from bugzilla and the Google+-post again and this time the sha1sums are identical. Maybe you better just ignore it since I assume that something about downloading the patch the first time from bugzilla failed.
Comment 35 jannis 2011-10-03 09:43:25 UTC
Comment on attachment 288657 [details, diff]
rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch

same as patch uploaded by george
Comment 36 jannis 2012-03-18 14:50:44 UTC
The patch for version 0.8.9 applies and compiles fine. No functional testing done, however.
Nevertheless, color don't work anymore: https://bugs.gentoo.org/show_bug.cgi?id=407525

Time to get IP-filter-support in the official tree?
Comment 37 jannis 2012-03-18 14:51:21 UTC
(In reply to comment #36)
> The patch for version 0.8.9 applies and compiles fine.

I meant: it applies and compiles with rtorrent-0.9.0
Comment 38 Vilbrekin 2012-05-13 00:50:23 UTC
Created attachment 311553 [details, diff]
rtorrent-0.9.1-ip_filter_no_boost-fast-bsd2.patch

Adapted the previous patch to work with rtorrent 0.9.1 ebuild.
Compiled and ran fine here, although not deeply tested yet.
Comment 39 Vilbrekin 2013-04-01 22:30:12 UTC
I think we can close this one, as ip filtering is now part of mainstream rtorrent since 0.9.2.
See https://github.com/rakshasa/rtorrent/blob/master/doc/manual/ip_filtering.md and http://forums.rutorrent.org/index.php?PHPSESSID=0e22f16000adb115f103481721bd2ffc&topic=4096.msg12403#msg12403.
Comment 40 Víctor Ostorga (RETIRED) gentoo-dev 2014-06-16 00:19:53 UTC
Upstream fixed this in 0.9.2
That version is already in portage