-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qBittorrent uTP bypasses routing table, sends packets to the internet on the interface with no default route #15325
Comments
so did you set qbittorrent to use the wireguard interface via tools>options>advanced>network interfaces? |
@cwmcd nope, it's set to "Any interface". |
If you do not select a specific interface/IP to listen to, qBt will listen on all interfaces and leak your IP. |
I still think qBittorrent does the wrong thing that accidentally happens to work on Linux. Like dude, there's no route to the public internet on this network interface, why are you sending stuff to it? |
I'm interested in improving this. Have you looked at the logic that decides which interfaces to use, and identified the issue there. The routing table is taken into account, but I recall wireguard setting up its network interface in a different way than other VPNs (with a point-to-point connection) that warranted some special rules in libtorrent. |
It seems libtorrent chooses random socket ( bool const local
= ipface.interface_address.is_loopback()
|| is_link_local(ipface.interface_address)
|| (ipface.flags & if_flags::loopback)
|| (!is_global(ipface.interface_address)
&& !(ipface.flags & if_flags::pointopoint)
&& has_any_internet_route(routes)
&& !has_internet_route(ipface.name, family(ipface.interface_address), routes)); This condition looks weird. I'm not sure what exactly is special with p2p links wrt routing. They don't have a concept of gateways, sure, but otherwise they work the same. However, WireGuard in particular uses policy-based routing in many configurations. My example is not one, you'd need to use
This trick is described in detail here: https://www.wireguard.com/netns/#routing-all-your-traffic But this whole thing looks very strange to me. Perhaps, there was a reason why the code was written the way it is, but I don't understand why libtorrent bothers to enumerate interfaces to send a packet somewhere. Just bind the socket to the any address ( |
This comment has been minimized.
This comment has been minimized.
@WGH- Fundamentally the reason libtorrent does this is to support multi-homed systems. i.e. systems that might have multiple paths to the internet, for example via IPv4 and IPv6. This support has been generalized to also support specifying which interfaces/IPs to use (and not use any others). When announcing to trackers, each local IP that can reach the tracker needs to announce, so that all of our external IP addresses are recorded by the tracker. Additionally, the way the DHT handles multiple external IPs is by effectively running separate nodes, with separate routing tables, on each. It's been a while since I was looking at that code, but iirc, looking for a gateway and default route was a heuristic to determine whether this interface/source IP has a possibility to reach the internet at all. |
It will be nice to have a good µTP (uTP) support for I2P: cc: @zzzi2p. |
Description
qBittorrent sends UDP traffic to the internet through network interfaces that have no default route configured.
qBittorrent info and operating system(s)
If on Linux,
libtorrent-rasterbar
andQt
versionsWhat is the problem
I have a WireGuard interface set up without default route set.
However, qBittorrent still sends DHT/LSD/uTP traffic through it. Which is pretty bad, since I didn't expect any public internet traffic to go through it, especially BitTorrent one, since that could get me into trouble with the VPS hoster.
Detailed steps to reproduce the problem
ip link add name wg-foobar type wireguard
ip addr add 192.168.3.2/24 dev wg-foobar
ip link set dev wg-foobar up
tcpdump -i wg-foobar -n
What is the expected behavior
qBittorrent should never bypass system routing table.
Extra info (if any)
This looks somewhat similar to #13094 and arvidn/libtorrent#4850, but what I see is that the source IP address is selected correctly. In fact, the remote WireGuard peer actually routes the traffic to the public internet, and qBittorrent gets response.
/cc @arvidn
The text was updated successfully, but these errors were encountered: