Skip to content
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 doesn't honor "Optional address to bind to" setting when making outgoing connections in the case of a single ethernet adapter with multiple IP addresses #12421

Closed
rwasef1830 opened this issue Apr 5, 2020 · 2 comments · Fixed by #12430
Labels
Network Issues related to network connectivity

Comments

@rwasef1830
Copy link
Contributor

rwasef1830 commented Apr 5, 2020

Please provide the following information

qBittorrent version and Operating System

qBittorrent 4.2.3 - Ubuntu 16.04 compiled static link with libtorrent-rasterbar commit: arvidn/libtorrent@983b1d6 and QT commit qt/qtbase@8ed14a3 and latest OpenSSL 1.1.1 stable branch.

What is the problem

I set eth4 as the listen address and I set one of its IPs as the "Optional address to bind to". qBittorrent listens on the correct address, but when making outgoing connections to peers it uses different addresses of eth4, not the specific one I chose. (checked using lsof -i tcp -i udp -L -n -P | grep qbit).

What is the expected behavior

qBittorrent does as I tell it. It seems the problem is that it doesn't seem to set outgoing_interfaces of libtorrent to the "optional address" to bind to.

Is there any workaround or pull request or undocumented config setting I can try ?

EDIT: I initially thought it was a libtorrent bug: arvidn/libtorrent#4482 but when testing with its client_test it was honoring the setting correctly.

EDIT: Seems it tries to configure the outgoing_address by taking the listen IPs first, something is going wrong in that... and only if the outgoingInterfaces ends up empty does it take the general interface name..

@thalieht thalieht added the Network Issues related to network connectivity label Apr 5, 2020
@rwasef1830
Copy link
Contributor Author

I compiled libtorrent in debug mode and qBittorrent with --enable-debug and added a log at the point where outgoing_interface is set. I see qBittorrent is passing the interface name (eth4) to libtorrent as the outgoing interface and not the IP address. See https://github.com/rwasef1830/qBittorrent/tree/log-interface-settings

I will add some more messages and try to debug the problem.

@rwasef1830
Copy link
Contributor Author

I found the problem

const QHostAddress addr {ip};

In the first branch if the QHostAddress instance is not null. The IP is added to endpoints, but outgoingInterfaces is not populated. @thalieht

I will make a pull request.

rwasef1830 added a commit to rwasef1830/qBittorrent that referenced this issue Apr 6, 2020
Assignment was missing in main branch of condition statement.
Closes qbittorrent#12421
sledgehammer999 pushed a commit that referenced this issue Apr 22, 2020
Assignment was missing in main branch of condition statement.
Closes #12421
@qbittorrent qbittorrent locked and limited conversation to collaborators Feb 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Network Issues related to network connectivity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants