diff --git a/src/broadcast_socket.cpp b/src/broadcast_socket.cpp index c23fa949d..6328a23fa 100644 --- a/src/broadcast_socket.cpp +++ b/src/broadcast_socket.cpp @@ -66,7 +66,10 @@ namespace libtorrent { TORRENT_TRY { #if TORRENT_USE_IPV6 - if (a.is_v6()) return a.to_v6().is_link_local(); + if (a.is_v6()) + { + return a.to_v6() == address_v6::loopback(); + } #endif address_v4 a4 = a.to_v4(); unsigned long ip = a4.to_ulong(); diff --git a/src/policy.cpp b/src/policy.cpp index 2275e9207..a80d4297f 100644 --- a/src/policy.cpp +++ b/src/policy.cpp @@ -1360,6 +1360,14 @@ namespace libtorrent if (remote.address() == address() || remote.port() == 0) return 0; +#if TORRENT_USE_IPV6 + // don't allow link-local IPv6 addresses since they + // can't be used like normal addresses, they require an interface + // and will just cause connect() to fail with EINVAL + if (remote.address().is_v6() && remote.address().to_v6().is_link_local()) + return 0; +#endif + aux::session_impl& ses = m_torrent->session(); // if this is an i2p torrent, and we don't allow mixed mode