Merge pull request #5096 from Harekiet/kietC

Bind directly to an IP instead of using a network Interface
This commit is contained in:
sledgehammer999 2016-05-26 17:36:22 -05:00
commit 1397a951fe
5 changed files with 89 additions and 8 deletions

View file

@ -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);
}