Browse Source

enable RI catch for OBEP back

pull/308/head
orignal 9 years ago
parent
commit
be358f3f2e
  1. 34
      TunnelEndpoint.cpp

34
TunnelEndpoint.cpp

@ -225,36 +225,32 @@ namespace tunnel
void TunnelEndpoint::HandleNextMessage (const TunnelMessageBlock& msg) void TunnelEndpoint::HandleNextMessage (const TunnelMessageBlock& msg)
{ {
LogPrint (eLogInfo, "TunnelMessage: handle fragment of ", msg.data->GetLength ()," bytes. Msg type ", (int)msg.data->GetTypeID ()); auto typeID = msg.data->GetTypeID ();
LogPrint (eLogInfo, "TunnelMessage: handle fragment of ", msg.data->GetLength ()," bytes. Msg type ", (int)typeID);
switch (msg.deliveryType) switch (msg.deliveryType)
{ {
case eDeliveryTypeLocal: case eDeliveryTypeLocal:
i2p::HandleI2NPMessage (msg.data); i2p::HandleI2NPMessage (msg.data);
break; break;
case eDeliveryTypeTunnel: case eDeliveryTypeTunnel:
i2p::transport::transports.SendMessage (msg.hash, i2p::CreateTunnelGatewayMsg (msg.tunnelID, msg.data)); if (!m_IsInbound) // outbound transit tunnel
break; i2p::transport::transports.SendMessage (msg.hash, i2p::CreateTunnelGatewayMsg (msg.tunnelID, msg.data));
case eDeliveryTypeRouter:
if (msg.hash == i2p::context.GetRouterInfo ().GetIdentHash ()) // check if message is sent to us
i2p::HandleI2NPMessage (msg.data);
else else
{ LogPrint (eLogError, "Delivery type tunnel arrived from an inbound tunnel. Dropped");
// to somebody else break;
if (!m_IsInbound) // outbound transit tunnel case eDeliveryTypeRouter:
{ if (!m_IsInbound) // outbound transit tunnel
/* auto typeID = msg.data->GetTypeID (); i2p::transport::transports.SendMessage (msg.hash, msg.data);
if (typeID == eI2NPDatabaseStore || typeID == eI2NPDatabaseSearchReply ) else // we shouldn't send this message. possible leakage
// catch RI or reply with new list of routers LogPrint (eLogError, "Delivery type router arrived from an inbound tunnel. Dropped");
i2p::data::netdb.PostI2NPMsg (msg.data);*/
i2p::transport::transports.SendMessage (msg.hash, msg.data);
}
else // we shouldn't send this message. possible leakage
LogPrint (eLogError, "Message to another router arrived from an inbound tunnel. Dropped");
}
break; break;
default: default:
LogPrint (eLogError, "TunnelMessage: Unknown delivery type ", (int)msg.deliveryType); LogPrint (eLogError, "TunnelMessage: Unknown delivery type ", (int)msg.deliveryType);
}; };
// catch RI or reply with new list of routers
if ((typeID == eI2NPDatabaseStore || typeID == eI2NPDatabaseSearchReply) &&
!m_IsInbound && msg.deliveryType != eDeliveryTypeLocal)
i2p::data::netdb.PostI2NPMsg (msg.data);
} }
} }
} }

Loading…
Cancel
Save