mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 08:14:15 +00:00
send DeliveryStatus back through a tunnel from same tunnel pool
This commit is contained in:
parent
2b5382ce9b
commit
f741b14664
14
Garlic.cpp
14
Garlic.cpp
@ -345,7 +345,7 @@ namespace garlic
|
|||||||
it->second->SetIV (iv);
|
it->second->SetIV (iv);
|
||||||
it->second->Decrypt (buf + 32, length - 32, buf + 32);
|
it->second->Decrypt (buf + 32, length - 32, buf + 32);
|
||||||
it->second->UseTag ();
|
it->second->UseTag ();
|
||||||
HandleAESBlock (buf + 32, length - 32, it->second);
|
HandleAESBlock (buf + 32, length - 32, it->second, msg->from);
|
||||||
if (!it->second->GetTagCount ()) delete it->second; // all tags were used
|
if (!it->second->GetTagCount ()) delete it->second; // all tags were used
|
||||||
m_SessionTags.erase (it); // tag might be used only once
|
m_SessionTags.erase (it); // tag might be used only once
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ namespace garlic
|
|||||||
CryptoPP::SHA256().CalculateDigest(iv, elGamal.preIV, 32);
|
CryptoPP::SHA256().CalculateDigest(iv, elGamal.preIV, 32);
|
||||||
decryption->SetIV (iv);
|
decryption->SetIV (iv);
|
||||||
decryption->Decrypt(buf + 514, length - 514, buf + 514);
|
decryption->Decrypt(buf + 514, length - 514, buf + 514);
|
||||||
HandleAESBlock (buf + 514, length - 514, decryption);
|
HandleAESBlock (buf + 514, length - 514, decryption, msg->from);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LogPrint ("Failed to decrypt garlic");
|
LogPrint ("Failed to decrypt garlic");
|
||||||
@ -374,7 +374,7 @@ namespace garlic
|
|||||||
DeleteI2NPMessage (msg);
|
DeleteI2NPMessage (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GarlicRouting::HandleAESBlock (uint8_t * buf, size_t len, SessionDecryption * decryption)
|
void GarlicRouting::HandleAESBlock (uint8_t * buf, size_t len, SessionDecryption * decryption, i2p::tunnel::InboundTunnel * from)
|
||||||
{
|
{
|
||||||
uint16_t tagCount = be16toh (*(uint16_t *)buf);
|
uint16_t tagCount = be16toh (*(uint16_t *)buf);
|
||||||
buf += 2;
|
buf += 2;
|
||||||
@ -406,10 +406,10 @@ namespace garlic
|
|||||||
LogPrint ("Wrong payload hash");
|
LogPrint ("Wrong payload hash");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HandleGarlicPayload (buf, payloadSize);
|
HandleGarlicPayload (buf, payloadSize, from);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GarlicRouting::HandleGarlicPayload (uint8_t * buf, size_t len)
|
void GarlicRouting::HandleGarlicPayload (uint8_t * buf, size_t len, i2p::tunnel::InboundTunnel * from)
|
||||||
{
|
{
|
||||||
int numCloves = buf[0];
|
int numCloves = buf[0];
|
||||||
LogPrint (numCloves," cloves");
|
LogPrint (numCloves," cloves");
|
||||||
@ -454,7 +454,9 @@ namespace garlic
|
|||||||
buf += 32;
|
buf += 32;
|
||||||
uint32_t gwTunnel = be32toh (*(uint32_t *)buf);
|
uint32_t gwTunnel = be32toh (*(uint32_t *)buf);
|
||||||
buf += 4;
|
buf += 4;
|
||||||
auto tunnel = i2p::tunnel::tunnels.GetNextOutboundTunnel ();
|
i2p::tunnel::OutboundTunnel * tunnel = nullptr;
|
||||||
|
if (from && from->GetTunnelPool ())
|
||||||
|
tunnel = from->GetTunnelPool ()->GetNextOutboundTunnel ();
|
||||||
if (tunnel) // we have send it through an outbound tunnel
|
if (tunnel) // we have send it through an outbound tunnel
|
||||||
{
|
{
|
||||||
I2NPMessage * msg = CreateI2NPMessage (buf, GetI2NPMessageLength (buf));
|
I2NPMessage * msg = CreateI2NPMessage (buf, GetI2NPMessageLength (buf));
|
||||||
|
4
Garlic.h
4
Garlic.h
@ -113,8 +113,8 @@ namespace garlic
|
|||||||
|
|
||||||
void Run ();
|
void Run ();
|
||||||
void ProcessGarlicMessage (I2NPMessage * msg);
|
void ProcessGarlicMessage (I2NPMessage * msg);
|
||||||
void HandleAESBlock (uint8_t * buf, size_t len, SessionDecryption * decryption);
|
void HandleAESBlock (uint8_t * buf, size_t len, SessionDecryption * decryption, i2p::tunnel::InboundTunnel * from);
|
||||||
void HandleGarlicPayload (uint8_t * buf, size_t len);
|
void HandleGarlicPayload (uint8_t * buf, size_t len, i2p::tunnel::InboundTunnel * from);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user