diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2020-11-05 16:05:54 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2020-12-03 00:31:32 +0000 |
commit | c64b94bd14f1f04aa1f8d3069dbf9ea7bb5cfcac (patch) | |
tree | 3bc127beaf51e5611249e0a72483ee5f5a8fadae | |
parent | p2p: make this work with boost <= 1.65 (pffff) (diff) | |
download | monero-c64b94bd14f1f04aa1f8d3069dbf9ea7bb5cfcac.tar.xz |
p2p: fix endianness when checking IPv6 addresses mapping to IPv4
-rw-r--r-- | src/p2p/net_node.inl | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 7976b6fa0..41377775a 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -1518,11 +1518,9 @@ namespace nodetool if (actual_ip.is_v4_mapped()) { boost::asio::ip::address_v4 v4ip = make_address_v4_from_v6(actual_ip); -#if BOOST_VERSION >= 106600 - return epee::net_utils::ipv4_network_address(v4ip.to_uint(), 0).host_str(); -#else - return epee::net_utils::ipv4_network_address(v4ip.to_ulong(), 0).host_str(); -#endif + uint32_t actual_ipv4; + memcpy(&actual_ipv4, v4ip.to_bytes().data(), sizeof(actual_ipv4)); + return epee::net_utils::ipv4_network_address(actual_ipv4, 0).host_str(); } } return address.host_str(); |