|
|
@ -571,7 +571,7 @@ namespace transport |
|
|
|
if (ri.IsUnreachable ()) |
|
|
|
if (ri.IsUnreachable ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint (eLogError, "NTCP2: Signature verification failed in SessionConfirmed"); |
|
|
|
LogPrint (eLogError, "NTCP2: Signature verification failed in SessionConfirmed"); |
|
|
|
Terminate (); |
|
|
|
SendTerminationAndTerminate (eNTCP2RouterInfoSignatureVerificationFail); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
auto addr = ri.GetNTCP2Address (); |
|
|
|
auto addr = ri.GetNTCP2Address (); |
|
|
@ -584,7 +584,7 @@ namespace transport |
|
|
|
if (memcmp (addr->ntcp2->staticKey, m_Establisher->m_RemoteStaticKey, 32)) |
|
|
|
if (memcmp (addr->ntcp2->staticKey, m_Establisher->m_RemoteStaticKey, 32)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint (eLogError, "NTCP2: Static key mistmatch in SessionConfirmed"); |
|
|
|
LogPrint (eLogError, "NTCP2: Static key mistmatch in SessionConfirmed"); |
|
|
|
Terminate (); |
|
|
|
SendTerminationAndTerminate (eNTCP2IncorrectSParameter); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -728,7 +728,7 @@ namespace transport |
|
|
|
case eNTCP2BlkTermination: |
|
|
|
case eNTCP2BlkTermination: |
|
|
|
if (size >= 9) |
|
|
|
if (size >= 9) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint (eLogDebug, "NTCP2: termination. reason=", (int)(frame[offset + 9])); |
|
|
|
LogPrint (eLogDebug, "NTCP2: termination. reason=", (int)(frame[offset + 8])); |
|
|
|
Terminate (); |
|
|
|
Terminate (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -828,6 +828,20 @@ namespace transport |
|
|
|
delete[] payload; |
|
|
|
delete[] payload; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void NTCP2Session::SendTermination (NTCP2TerminationReason reason) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
uint8_t payload[12] = { eNTCP2BlkTermination, 0, 9 }; |
|
|
|
|
|
|
|
htobe64buf (payload + 3, m_ReceiveSequenceNumber); |
|
|
|
|
|
|
|
payload[11] = (uint8_t)reason; |
|
|
|
|
|
|
|
SendNextFrame (payload, 12); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void NTCP2Session::SendTerminationAndTerminate (NTCP2TerminationReason reason) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
SendTermination (reason); |
|
|
|
|
|
|
|
m_Server.GetService ().post (std::bind (&NTCP2Session::Terminate, shared_from_this ())); // let termination message go
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void NTCP2Session::SendI2NPMessages (const std::vector<std::shared_ptr<I2NPMessage> >& msgs) |
|
|
|
void NTCP2Session::SendI2NPMessages (const std::vector<std::shared_ptr<I2NPMessage> >& msgs) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_Server.GetService ().post (std::bind (&NTCP2Session::PostI2NPMessages, shared_from_this (), msgs)); |
|
|
|
m_Server.GetService ().post (std::bind (&NTCP2Session::PostI2NPMessages, shared_from_this (), msgs)); |
|
|
|