mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
Merge pull request #5096 from Harekiet/kietC
Bind directly to an IP instead of using a network Interface
This commit is contained in:
commit
1397a951fe
5 changed files with 89 additions and 8 deletions
|
@ -1735,9 +1735,11 @@ const QStringList Session::getListeningIPs()
|
|||
QStringList IPs;
|
||||
|
||||
const QString ifaceName = pref->getNetworkInterface();
|
||||
const QString ifaceAddr = pref->getNetworkInterfaceAddress();
|
||||
const bool listenIPv6 = pref->getListenIPv6();
|
||||
|
||||
if (ifaceName.isEmpty()) {
|
||||
//No interface name or address defined just use an empty list
|
||||
if (ifaceName.isEmpty() && ifaceAddr.isEmpty()) {
|
||||
IPs.append(QString());
|
||||
return IPs;
|
||||
}
|
||||
|
@ -1764,6 +1766,13 @@ const QStringList Session::getListeningIPs()
|
|||
if ((!listenIPv6 && (protocol == QAbstractSocket::IPv6Protocol))
|
||||
|| (listenIPv6 && (protocol == QAbstractSocket::IPv4Protocol)))
|
||||
continue;
|
||||
|
||||
//If an iface address has been defined only allow ip's that match it to go through
|
||||
if (!ifaceAddr.isEmpty()) {
|
||||
if (ipString != ifaceAddr) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
IPs.append(ipString);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue