Bug 281245 - IP-Filter does not work
Summary: IP-Filter does not work
Status: RESOLVED FIXED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-03 03:07 UTC by Baconmon
Modified: 2012-03-28 18:06 UTC (History)
1 user (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 Baconmon 2011-09-03 03:07:17 UTC
Version:           unspecified (using KDE 4.6.5) 
OS:                Linux

The block-list plug-in in KTorrent works good..

However, the "IP Filter" in the File menu does not work (either some times, or all the time, I can't tell)..

I will add IPs, or some times ranges.. But then I will see peers get connected to in that list any way, even after a restart..

Reproducible: Always

Steps to Reproduce:
Put an IP or range in IP-Filter, for instance maybe "79.176.0.0-79.183.255.255"..

Actual Results:  
You will eventually see people get connected to from that range any way for instance maybe IP 79.180.233.58 (just making up random numbers BTW)..

Expected Results:  
No one in IP-Filter gets connected to..
Comment 1 Joris Guisson 2011-10-04 17:40:06 UTC
Git commit 2e0afa885254456f1e04afcb97f0686a9e4acd97 by Joris Guisson.
Committed on 04/10/2011 at 19:38.
Pushed by guisson into branch 'master'.

Revamp IP filter widget 

BUG: 281245

M  +1    -0    ChangeLog
M  +67   -106  ktorrent/ipfilterlist.cpp
M  +13   -12   ktorrent/ipfilterlist.h
M  +15   -15   ktorrent/ipfilterwidget.cpp

http://commits.kde.org/ktorrent/2e0afa885254456f1e04afcb97f0686a9e4acd97
Comment 2 Baconmon 2012-03-27 05:48:12 UTC
This bug needs to be reopened..
I have upgraded to ktorrent 4.2.0 on KDE 4.7.4, and ktorrent still has the same issue it seems..

Even though the IP filter might have like, for example, to filter out IP address ranges from 79.176.0.0-79.183.255.255, it will still allow things like 79.182.199.70 for example to connect..

I want to thank you for trying to commit some thing to fix it last time, and I am not sure what you changed because I am too dumb to be a programmer, but it seems some thing may still be amiss some where in there..
Comment 3 Joris Guisson 2012-03-27 16:25:53 UTC
The range 0.0.0.0-100.255.255.255 seems to work, I get messages like this in the log:

Tue Mar 27 18:17:00 2012: Accepted connection from 97.97.92.181
Tue Mar 27 18:17:00 2012: A client with a blocked IP address (97.97.92.181) tried to connect !

I tried your range, but couldn't find any peers from that range.
Comment 4 Joris Guisson 2012-03-27 16:26:48 UTC
On what kind of hardware are you actually running ?
Comment 5 Baconmon 2012-03-27 17:16:33 UTC
Hardware?.. Like my computer parts?.. It is just a normal PC I think.. Not sure how that would make a difference.. But:

Motherboard: Asus A770DE+
Memory: 2 x 2GB G.SKILL (Model: F2-8500CL5D-4GBPK)
Processor: AMD Phenom II X4 (Model: HDZ940XCGIBOX)
Graphics: SAPPHIRE Radeon HD 6670 (Model: 100326DDR3L)
Hard drive: Plextor 128GB SSD (Model: PX-128M3)
OS: Debian linux testing branch

Also, this wasn't just a freak occurrence.. Even at the time I wrote the comment on 2012-03-27, I had two IPs (not just one) that slipped through and that I was watching on the Peers tab on the bottom.. I can give you as much information as you need on any thing, or screen-shots et cetera.. I was actually excited waiting for ktorrent 4.2.0 to finally trickle down in to debian testing so I could use it, so I promise you I am not like making this up or just some crazy person..

So according to you, it looks like it DOES catch some IPs in the filter, but for some reason it is not catching mine.. I am not a programmer, and I wish I could help more.. Is there maybe some where else in the code that it adds IPs to the list and mistakenly doesn't check against the IP filter or some thing?..

Any way, thanks for working on this as much as you have..
Comment 6 Joris Guisson 2012-03-28 17:31:48 UTC
Incoming connections are always checked, outgoing connections are checked before they are initiated.

Whet is possible though is that a peer connects to you and then you add a new entry in the dialog for that peer. In that situation we won't check the existing connections.

Looking at the code, we check if the address is IPv4 or IPv6, and do nothing if it is IPv6.
But there are also IPv4 addresses mapped into the IPv6 address space. KTorrent binds on all addresses on all interfaces, including IPv6 addrresses. If a connection was accepted on the socket bound to an IPv6 address, then ktorrent would see a mapped address, and it would pass the filter check.

That sounds like a very plausible scenario, but I'm not sure if it is possible, I need to do some investigation on the linux dual stack implementation to confirm this.
Comment 7 Joris Guisson 2012-03-28 17:52:48 UTC
OK my theory is bogus, it is a totally different problem, it turns out that the filter list is only registered the first time you open the dialog and not at startup. A bit stupid.
Comment 8 Joris Guisson 2012-03-28 17:55:48 UTC
Git commit 67e907af044347c955ce110141a5c04acc6a8cbc by Joris Guisson.
Committed on 28/03/2012 at 19:55.
Pushed by guisson into branch 'master'.

Fix IP filter widget list not getting registered at startup

M  +3    -0    ChangeLog
M  +2    -0    ktorrent/gui.cpp
M  +6    -2    ktorrent/ipfilterlist.cpp
M  +76   -72   ktorrent/ipfilterwidget.cpp
M  +4    -1    ktorrent/ipfilterwidget.h

http://commits.kde.org/ktorrent/67e907af044347c955ce110141a5c04acc6a8cbc
Comment 9 Joris Guisson 2012-03-28 17:58:07 UTC
Git commit f04bf2d9dbac3ac77e07075a14f4c31379faeed1 by Joris Guisson.
Committed on 28/03/2012 at 19:55.
Pushed by guisson into branch '4.2'.

Backport to 4.2: Fix IP filter widget list not getting registered at startup

Conflicts:

	ChangeLog

M  +3    -0    ChangeLog
M  +2    -0    ktorrent/gui.cpp
M  +6    -2    ktorrent/ipfilterlist.cpp
M  +76   -72   ktorrent/ipfilterwidget.cpp
M  +4    -1    ktorrent/ipfilterwidget.h

http://commits.kde.org/ktorrent/f04bf2d9dbac3ac77e07075a14f4c31379faeed1
Comment 10 Baconmon 2012-03-28 18:06:20 UTC
Awesome!.. Finally found that pesky bug!..

Thanks a lot for taking time out to work on this bug and even fixing it and every thing.. A lot of people will probably appreciate it when they try to use the IP filter list (like me!(`・ω・´))

Any way, thanks again and stuff!..