Browse Source

Merge pull request #14504 from treysis/ipv6-outgoing-interfaces

Fix bad IPv6 address format for outgoingInterfaces
adaptive-webui-19844
Mike Tzou 4 years ago committed by GitHub
parent
commit
4bf4d45389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/base/bittorrent/session.cpp

12
src/base/bittorrent/session.cpp

@ -1457,12 +1457,14 @@ void Session::configureNetworkInterfaces(lt::settings_pack &settingsPack)
const QHostAddress addr {ip}; const QHostAddress addr {ip};
if (!addr.isNull()) if (!addr.isNull())
{ {
const QString ip = ((addr.protocol() == QAbstractSocket::IPv6Protocol) const bool isIPv6 = (addr.protocol() == QAbstractSocket::IPv6Protocol);
? ('[' + Utils::Net::canonicalIPv6Addr(addr).toString() + ']') const QString ip = isIPv6
: addr.toString()); ? Utils::Net::canonicalIPv6Addr(addr).toString()
endpoints << (ip + portString); : addr.toString();
endpoints << ((isIPv6 ? ('[' + ip + ']') : ip) + portString);
if ((ip != "0.0.0.0") && (ip != "[::]")) if ((ip != QLatin1String("0.0.0.0")) && (ip != QLatin1String("::")))
outgoingInterfaces << ip; outgoingInterfaces << ip;
} }
else else

Loading…
Cancel
Save