Browse Source

don't send HolePunch or PeerTest 5 to unspecified address

gha
orignal 2 months ago
parent
commit
1fb45c4b0d
  1. 6
      libi2pd/SSU2Session.cpp

6
libi2pd/SSU2Session.cpp

@ -2002,7 +2002,9 @@ namespace transport
boost::asio::ip::udp::endpoint ep; boost::asio::ip::udp::endpoint ep;
if (ExtractEndpoint (buf + 47, asz, ep)) if (ExtractEndpoint (buf + 47, asz, ep))
{ {
auto addr = ep.address ().is_v6 () ? r->GetSSU2V6Address () : r->GetSSU2V4Address (); std::shared_ptr<const i2p::data::RouterInfo::Address> addr;
if (!ep.address ().is_unspecified () && ep.port ())
addr = ep.address ().is_v6 () ? r->GetSSU2V6Address () : r->GetSSU2V4Address ();
if (addr) if (addr)
{ {
if (m_Server.IsSupported (ep.address ())) if (m_Server.IsSupported (ep.address ()))
@ -2234,7 +2236,7 @@ namespace transport
{ {
boost::asio::ip::udp::endpoint ep; boost::asio::ip::udp::endpoint ep;
std::shared_ptr<const i2p::data::RouterInfo::Address> addr; std::shared_ptr<const i2p::data::RouterInfo::Address> addr;
if (ExtractEndpoint (buf + offset + 10, asz, ep)) if (ExtractEndpoint (buf + offset + 10, asz, ep) && !ep.address ().is_unspecified () && ep.port ())
addr = r->GetSSU2Address (ep.address ().is_v4 ()); addr = r->GetSSU2Address (ep.address ().is_v4 ());
if (addr && m_Server.IsSupported (ep.address ()) && if (addr && m_Server.IsSupported (ep.address ()) &&
i2p::context.GetRouterInfo ().IsSSU2PeerTesting (ep.address ().is_v4 ())) i2p::context.GetRouterInfo ().IsSSU2PeerTesting (ep.address ().is_v4 ()))

Loading…
Cancel
Save