mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
update right ipv6 only
This commit is contained in:
parent
fef4f13b8f
commit
ea19802d3f
@ -550,13 +550,15 @@ namespace i2p
|
|||||||
|
|
||||||
void RouterContext::UpdateNTCP2V6Address (const boost::asio::ip::address& host)
|
void RouterContext::UpdateNTCP2V6Address (const boost::asio::ip::address& host)
|
||||||
{
|
{
|
||||||
|
bool isYgg = i2p::util::net::IsYggdrasilAddress (host);
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
auto& addresses = m_RouterInfo.GetAddresses ();
|
auto& addresses = m_RouterInfo.GetAddresses ();
|
||||||
for (auto& addr: addresses)
|
for (auto& addr: addresses)
|
||||||
{
|
{
|
||||||
if (addr->IsPublishedNTCP2 ())
|
if (addr->IsPublishedNTCP2 ())
|
||||||
{
|
{
|
||||||
if (addr->host.is_v6 ())
|
bool isYgg1 = i2p::util::net::IsYggdrasilAddress (addr->host);
|
||||||
|
if (addr->host.is_v6 () && ((isYgg && isYgg1) || (!isYgg && !isYgg1)))
|
||||||
{
|
{
|
||||||
if (addr->host != host)
|
if (addr->host != host)
|
||||||
{
|
{
|
||||||
|
@ -449,6 +449,7 @@ namespace net
|
|||||||
{
|
{
|
||||||
boost::asio::ip::address_v6::bytes_type bytes;
|
boost::asio::ip::address_v6::bytes_type bytes;
|
||||||
memcpy (bytes.data (), &sa->sin6_addr, 16);
|
memcpy (bytes.data (), &sa->sin6_addr, 16);
|
||||||
|
freeifaddrs(addrs);
|
||||||
return boost::asio::ip::address_v6 (bytes);
|
return boost::asio::ip::address_v6 (bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user