From 33fa7454d0bb3bbc34fa50a2c2d611444f3eac31 Mon Sep 17 00:00:00 2001 From: airium Date: Mon, 7 Jan 2019 20:36:05 +0800 Subject: [PATCH] Avoid announcing local ip to private tracker --- src/torrent.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/torrent.cpp b/src/torrent.cpp index 3f343ec5e..d4aa62780 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -3253,10 +3253,12 @@ namespace { && m_torrent_file->priv()) { boost::optional ep4 = m_ses.get_ipv4_interface(); - if (ep4) req.ipv4 = ep4->address().to_v4(); + if (ep4 && !is_local(ep4->address()) && !is_loopback(ep4->address())) + req.ipv4 = ep4->address().to_v4(); #if TORRENT_USE_IPV6 boost::optional ep6 = m_ses.get_ipv6_interface(); - if (ep6) req.ipv6 = ep6->address().to_v6(); + if (ep6 && !is_local(ep6->address()) && !is_loopback(ep6->address())) + req.ipv6 = ep6->address().to_v6(); #endif }