compare only first 8 bytes for temporary addreses

This commit is contained in:
orignal 2023-02-05 19:19:20 -05:00
parent 21123e2afa
commit 3c02cade58
2 changed files with 6 additions and 2 deletions

View file

@ -701,7 +701,9 @@ namespace transport
Terminate ();
return;
}
if (addr->IsPublishedNTCP2 () && m_RemoteEndpoint.address () != addr->host)
if (addr->IsPublishedNTCP2 () && m_RemoteEndpoint.address () != addr->host &&
(!m_RemoteEndpoint.address ().is_v6 () ||
memcmp (m_RemoteEndpoint.address ().to_v6 ().to_bytes ().data (), addr->host.to_v6 ().to_bytes ().data (), 8))) // temporary address
{
LogPrint (eLogError, "NTCP2: Host mismatch between published address ", addr->host, " and actual endpoint ", m_RemoteEndpoint.address ());
Terminate ();