aboutsummaryrefslogtreecommitdiff
path: root/src/netaddress.cpp
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-05-25 01:35:48 +0200
committerJon Atack <jon@atack.com>2021-06-03 13:36:42 +0200
commit4192a74413907717d6173e393724b931f2225dd9 (patch)
treec3e911dbd53a9f65f720d69d5d644efb7ee45564 /src/netaddress.cpp
parent1d631e956fffbbc7891ed40be4fd39aeff036c52 (diff)
downloadbitcoin-4192a74413907717d6173e393724b931f2225dd9.tar.xz
p2p: ignore torv2-in-ipv6 addresses in SetLegacyIPv6()
Diffstat (limited to 'src/netaddress.cpp')
-rw-r--r--src/netaddress.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/netaddress.cpp b/src/netaddress.cpp
index 5d1f3e2652..10b482fab3 100644
--- a/src/netaddress.cpp
+++ b/src/netaddress.cpp
@@ -146,9 +146,12 @@ void CNetAddr::SetLegacyIPv6(Span<const uint8_t> ipv6)
m_net = NET_IPV4;
skip = sizeof(IPV4_IN_IPV6_PREFIX);
} else if (HasPrefix(ipv6, TORV2_IN_IPV6_PREFIX)) {
- // TORv2-in-IPv6
- m_net = NET_ONION;
- skip = sizeof(TORV2_IN_IPV6_PREFIX);
+ // TORv2-in-IPv6 (unsupported). Unserialize as !IsValid(), thus ignoring them.
+ // Mimic a default-constructed CNetAddr object which is !IsValid() and thus
+ // will not be gossiped, but continue reading next addresses from the stream.
+ m_net = NET_IPV6;
+ m_addr.assign(ADDR_IPV6_SIZE, 0x0);
+ return;
} else if (HasPrefix(ipv6, INTERNAL_IN_IPV6_PREFIX)) {
// Internal-in-IPv6
m_net = NET_INTERNAL;