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
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
Created attachment 187414 [details] rtorrent-0.8.4 ip filter ebuild ebuild to apply and build rtorrent with ipfilter support
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
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.
Any possibility to have this patch included in the standard tree, and (de)selected with a use flag?
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" .
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.
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?
Created attachment 268009 [details] rtorrent-0.8.6-r1 with ipfilter support enabled by USE="ipfilter" a few minor cleanup fixes to the ebuild
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
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
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
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. */
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.
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
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?
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).
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
Created attachment 272989 [details] rtorrent-0.8.7-r3 ebuild with ipfilter support enabled by USE="ipfilter"
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?
(In reply to comment #20) Sorry, false alarm. Installing dev-util/cppunit fixed it. Should it be added as dependency?
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
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).
(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
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!
Created attachment 283569 [details] rtorrent-0.8.7-r4 ebuild with ipfilter support enabled by USE="ipfilter" keeping up with mainline portage
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
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
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
it seemed to work for me; can you provide more details? could you also upload the patch and ebuild that worked for you?
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.
Created attachment 288653 [details] rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch.out Portage's detailed patch failure log
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
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 on attachment 288657 [details, diff] rtorrent-0.8.9-ip_filter_no_boost-fast-bsd2.patch same as patch uploaded by george
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?
(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
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.
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.
Upstream fixed this in 0.9.2 That version is already in portage