Skip to content

Commit

Permalink
disable ip mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusKysel committed Feb 7, 2024
1 parent 140f39d commit b5611fb
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions libraries/aleth/libp2p/NodeTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,22 +553,22 @@ std::shared_ptr<NodeEntry> NodeTable::handleFindNode(bi::udp::endpoint const& _f
}

NodeIPEndpoint NodeTable::getSourceEndpoint(bi::udp::endpoint const& from, PingNode const& packet) {
if (from.address() != packet.source.address() && !isLocalHostAddress(packet.source.address())) {
if (isPrivateAddress(from.address()) && !isPrivateAddress(packet.source.address())) {
Guard l(x_ips);
if (m_id2IpMap.contains(packet.sourceid)) {
if (m_id2IpMap[packet.sourceid] != from) {
m_ipMappings.erase(m_id2IpMap[packet.sourceid]);
m_id2IpMap[packet.sourceid] = from;
}
} else {
m_id2IpMap[packet.sourceid] = from;
}
m_ipMappings[from] = {packet.source.address(), packet.source.udpPort(), packet.source.tcpPort()};
return m_ipMappings[from];
}
}
return {from.address(), packet.source.udpPort(), packet.source.tcpPort()};
// if (from.address() != packet.source.address() && !isLocalHostAddress(packet.source.address())) {
// if (isPrivateAddress(from.address()) && !isPrivateAddress(packet.source.address())) {
// Guard l(x_ips);
// if (m_id2IpMap.contains(packet.sourceid)) {
// if (m_id2IpMap[packet.sourceid] != from) {
// m_ipMappings.erase(m_id2IpMap[packet.sourceid]);
// m_id2IpMap[packet.sourceid] = from;
// }
// } else {
// m_id2IpMap[packet.sourceid] = from;
// }
// m_ipMappings[from] = {packet.source.address(), packet.source.udpPort(), packet.source.tcpPort()};
// return m_ipMappings[from];
// }
// }
return {from.address(), from.port(), packet.source.tcpPort()};
}

std::shared_ptr<NodeEntry> NodeTable::handlePingNode(bi::udp::endpoint const& _from, DiscoveryDatagram const& _packet) {
Expand Down

0 comments on commit b5611fb

Please sign in to comment.