mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 12:24:19 +00: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)
|
switch (blk)
|
||||||
{
|
{
|
||||||
case eNTCP2BlkDateTime:
|
case eNTCP2BlkDateTime:
|
||||||
|
{
|
||||||
LogPrint (eLogDebug, "NTCP2: Datetime");
|
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:
|
case eNTCP2BlkOptions:
|
||||||
LogPrint (eLogDebug, "NTCP2: Options");
|
LogPrint (eLogDebug, "NTCP2: Options");
|
||||||
break;
|
break;
|
||||||
|
@ -1617,6 +1617,7 @@ namespace transport
|
|||||||
{
|
{
|
||||||
case eSSU2SessionStateSessionRequestReceived:
|
case eSSU2SessionStateSessionRequestReceived:
|
||||||
case eSSU2SessionStateTokenRequestReceived:
|
case eSSU2SessionStateTokenRequestReceived:
|
||||||
|
case eSSU2SessionStateEstablished:
|
||||||
if (std::abs (offset) > SSU2_CLOCK_SKEW)
|
if (std::abs (offset) > SSU2_CLOCK_SKEW)
|
||||||
m_TerminationReason = eSSU2TerminationReasonClockSkew;
|
m_TerminationReason = eSSU2TerminationReasonClockSkew;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user