[SOLVED] Format for ipv4_filter.load file

dsouvik215

Member
May 25, 2018
896
0
16
With regards to IP Filtering, I have attempted to add the following an ipfilter config to rtorrent:

config file = rtorrent.rc

Code:
ipv4_filter.load=./ipfilter.file

I tried several different formats, but I could not get rtorrent to successfully load with any of the following formats:

utorrent ipfilter.dat:
Code:
002.001.227.239 - 002.001.227.239 , 000 , Tor
generic (with spaces):
Code:
1.227.196.123 1.227.196.123
generic (with hyphens):
Code:
1.227.196.123-1.227.196.123
ipchains:
Code:
A INPUT -s 1.227.196.123 -j LOG --log-prefix "IPTABLES FAKE-LOCAL-ADDRESS"
A INPUT -s 1.227.196.123 -j DROP
CIDR:
Code:
1.179.144.0/22
The only reference I could find was to utilize CIDR format, but that did not work.

Does anyone know what format a text file should be in in order to support the ipv4.filter capabilities of rtorrent?
 

dsouvik215

Member
May 25, 2018
896
0
16
Thanks for the reference document.

The correct file format is CIDR:
Code:
1.179.144.0/22

The correct syntax for the rtorrent.rc configuration file is:
Code:
ipv4_filter.load = /storage./xbmc/userdata/addon_data/service.downloadmanager.rTorrent/ipfilter.rtorrent.cidr.txt, unwanted

I assume that the syntax is correct as both rtorrent and rutorrent appear to load, but there is no indication in the rutorrent log window that the ipfilter data has successfully loaded.

Are there any indications that the ipv4_filter data has properly loaded? I set rtorrent logging to debug, but there was no reference to it in the log file.
Code:
log.open_file = "rtorrent.log", "/var/log/rtorrent.log"
log.add_output = "debug", "rtorrent.log"
 

jith45

Member
May 25, 2018
960
0
16
you should get a line such as
1354867989 I Loaded 1 unwanted address blocks (6 kb in-memory) from '~/.rtorrent/ipfilter'.
in your logs (INFO level and higher) if it has successfully loaded
 

dsouvik215

Member
May 25, 2018
896
0
16
I'm afraid I didn't see any mention of ipv4_filter in the rtorrent console or the rtorrent.log (see attached). Would you be able to offer any other suggestions?
 

jith45

Member
May 25, 2018
960
0
16
well its obvious the problem, your using the -n flag which doesnt load your .rtorrent.rc
 

dsouvik215

Member
May 25, 2018
896
0
16
I am not using ~/.rtorrent.rc, because I am loading the configuration from the ~/.xbmc/userdata/addon_data/service.downloadmanager.rTorrent directory:

ls -la
total 5856
drwxr-xr-x 4 root root 4096 Dec 8 02:20 .
drwxr-xr-x 10 root root 4096 Dec 7 21:23 ..
-rw-r--r-- 1 root root 5952146 Dec 6 23:28 ipfilter.rtorrent.cidr.txt
-rw-r--r-- 1 root root 930 Dec 9 12:44 rtorrent.rc

I know it is using the above references rtorrent.rc file, because it is loading the logging configuration and producing the log file referenced.

I have attached the script that I am using to start rtorrent.
 

dsouvik215

Member
May 25, 2018
896
0
16
Is there a size limit to the file that can be loaded with ipv4_filter.load?

The file I was originally trying to load was almost 6 MB in size, and even though I could communicate with trackers, I could not download from peers.

When I tried to load files less than 1 MB in size, everything operated as expected.

The Level 1 list from Bluetack is over 4 MB, so this would probably be the minimum that would need to be supported.
 

dsouvik215

Member
May 25, 2018
896
0
16
I turned on as many logging facilities as I could. For some reason, with IP filtering enabled, rtorrent could not update the trackers. I could see that once a torrent was loaded though, rtorrent was able to get peer information from the trackers. Once IP filtering was disabled, rtorrent could communicate with the trackers. I confirmed that the tracker IP addresses were not in the list that was loaded.

Does anyone have any thoughts as to why I am experiencing this behavior with my rtorrent instance?
 

dsouvik215

Member
May 25, 2018
896
0
16
I have found a resolution to this problem.

First, my filter.txt file had "Carriage Return" (CR) and "Line Feed" (LF) characters at the end of each line. I modified the file so that it only has "Line Feed" (LF) at the end of each line.

Second, I found that the "ipv4_filter.load" configuration needed to be at the end of the rtorrent.rc file.

Once I made the two configuration changes above, I was able to confirm that IP Address filtering was enabled via the logging daemon:
Code:
cat /var/log/rtorrent.log | grep address
1357143596 I Loaded 247272 unwanted address blocks (12051 kb in-memory) from '/storage/filter.txt'.
#