mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
correct parsing of caught RouterInfo at IBGW and OBEP
This commit is contained in:
parent
0ce15ffc91
commit
ead6a6dca3
|
@ -791,20 +791,23 @@ namespace data
|
||||||
LogPrint (eLogError, "NetDb: Database store msg with reply token is too short ", len, ". Dropped");
|
LogPrint (eLogError, "NetDb: Database store msg with reply token is too short ", len, ". Dropped");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto deliveryStatus = CreateDeliveryStatusMsg (replyToken);
|
|
||||||
uint32_t tunnelID = bufbe32toh (buf + offset);
|
uint32_t tunnelID = bufbe32toh (buf + offset);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
if (!tunnelID) // send response directly
|
if (replyToken != 0xFFFFFFFFU) // if not caught on OBEP or IBGW
|
||||||
transports.SendMessage (buf + offset, deliveryStatus);
|
{
|
||||||
else
|
auto deliveryStatus = CreateDeliveryStatusMsg (replyToken);
|
||||||
{
|
if (!tunnelID) // send response directly
|
||||||
auto pool = i2p::tunnel::tunnels.GetExploratoryPool ();
|
transports.SendMessage (buf + offset, deliveryStatus);
|
||||||
auto outbound = pool ? pool->GetNextOutboundTunnel () : nullptr;
|
|
||||||
if (outbound)
|
|
||||||
outbound->SendTunnelDataMsgTo (buf + offset, tunnelID, deliveryStatus);
|
|
||||||
else
|
else
|
||||||
LogPrint (eLogWarning, "NetDb: No outbound tunnels for DatabaseStore reply found");
|
{
|
||||||
}
|
auto pool = i2p::tunnel::tunnels.GetExploratoryPool ();
|
||||||
|
auto outbound = pool ? pool->GetNextOutboundTunnel () : nullptr;
|
||||||
|
if (outbound)
|
||||||
|
outbound->SendTunnelDataMsgTo (buf + offset, tunnelID, deliveryStatus);
|
||||||
|
else
|
||||||
|
LogPrint (eLogWarning, "NetDb: No outbound tunnels for DatabaseStore reply found");
|
||||||
|
}
|
||||||
|
}
|
||||||
offset += 32;
|
offset += 32;
|
||||||
}
|
}
|
||||||
// we must send reply back before this check
|
// we must send reply back before this check
|
||||||
|
|
|
@ -593,7 +593,7 @@ namespace tunnel
|
||||||
{
|
{
|
||||||
// transit DatabaseStore might contain new/updated RI
|
// transit DatabaseStore might contain new/updated RI
|
||||||
auto m = CopyI2NPMessage (msg);
|
auto m = CopyI2NPMessage (msg);
|
||||||
memset (m->GetPayload () + DATABASE_STORE_REPLY_TOKEN_OFFSET, 0, 4); // no reply
|
memset (m->GetPayload () + DATABASE_STORE_REPLY_TOKEN_OFFSET, 0xFF, 4); // fake replyToken meaning no reply
|
||||||
i2p::data::netdb.PostI2NPMsg (m);
|
i2p::data::netdb.PostI2NPMsg (m);
|
||||||
}
|
}
|
||||||
tunnel->SendTunnelDataMsg (msg);
|
tunnel->SendTunnelDataMsg (msg);
|
||||||
|
|
|
@ -331,7 +331,7 @@ namespace tunnel
|
||||||
else if (IsRouterInfoMsg (msg.data))
|
else if (IsRouterInfoMsg (msg.data))
|
||||||
{
|
{
|
||||||
auto m = CopyI2NPMessage (msg.data);
|
auto m = CopyI2NPMessage (msg.data);
|
||||||
memset (m->GetPayload () + DATABASE_STORE_REPLY_TOKEN_OFFSET, 0, 4); // no reply
|
memset (m->GetPayload () + DATABASE_STORE_REPLY_TOKEN_OFFSET, 0xFF, 4); // fake replyToken meaning no reply
|
||||||
i2p::data::netdb.PostI2NPMsg (m);
|
i2p::data::netdb.PostI2NPMsg (m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue