mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
disconnect established session if clock skew detected
This commit is contained in:
parent
234540f9e7
commit
ac94341203
@ -884,8 +884,20 @@ namespace transport
|
||||
switch (blk)
|
||||
{
|
||||
case eNTCP2BlkDateTime:
|
||||
{
|
||||
LogPrint (eLogDebug, "NTCP2: Datetime");
|
||||
break;
|
||||
if (m_IsEstablished)
|
||||
{
|
||||
uint64_t ts = i2p::util::GetSecondsSinceEpoch ();
|
||||
uint64_t tsA = bufbe32toh (frame + offset);
|
||||
if (tsA < ts - NTCP2_CLOCK_SKEW || tsA > ts + NTCP2_CLOCK_SKEW)
|
||||
{
|
||||
LogPrint (eLogWarning, "NTCP2: Established session time difference ", (int)(ts - tsA), " exceeds clock skew");
|
||||
SendTerminationAndTerminate (eNTCP2ClockSkew);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case eNTCP2BlkOptions:
|
||||
LogPrint (eLogDebug, "NTCP2: Options");
|
||||
break;
|
||||
|
@ -1617,6 +1617,7 @@ namespace transport
|
||||
{
|
||||
case eSSU2SessionStateSessionRequestReceived:
|
||||
case eSSU2SessionStateTokenRequestReceived:
|
||||
case eSSU2SessionStateEstablished:
|
||||
if (std::abs (offset) > SSU2_CLOCK_SKEW)
|
||||
m_TerminationReason = eSSU2TerminationReasonClockSkew;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user