Change back to the original names for the announce address

Only allow ip's through that match the currenrly selected network interface and address
This commit is contained in:
Sjoerd van der Berg 2016-04-13 10:51:29 +02:00
parent e2f43b3383
commit c7c71d3c88
5 changed files with 38 additions and 37 deletions

View file

@ -633,7 +633,7 @@ void Session::setSessionSettings()
// Include overhead in transfer limits
sessionSettings.rate_limit_ip_overhead = pref->includeOverheadInLimits();
// IP address to announce to trackers
sessionSettings.announce_ip = Utils::String::toStdString(pref->getAnnounceAddress());
sessionSettings.announce_ip = Utils::String::toStdString(pref->getNetworkAddress());
// Super seeding
sessionSettings.strict_super_seeding = pref->isSuperSeedingEnabled();
// * Max Half-open connections
@ -1658,17 +1658,12 @@ const QStringList Session::getListeningIPs()
Logger* const logger = Logger::instance();
QStringList IPs;
//Take the override addresss
const QString networkAddr = pref->getNetworkAddress();
if ( !networkAddr.isEmpty()) {
IPs.append( networkAddr);
return 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;
}
@ -1695,6 +1690,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);
}