From 86c0accdceb53a686a6d3d5321d1e0d49109a42d Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 3 Jun 2022 13:18:37 -0400 Subject: [PATCH] check nonce for peer test msg 5 --- libi2pd/SSU2.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libi2pd/SSU2.cpp b/libi2pd/SSU2.cpp index 92631350..2eec58c8 100644 --- a/libi2pd/SSU2.cpp +++ b/libi2pd/SSU2.cpp @@ -1002,7 +1002,7 @@ namespace transport HandleRelayIntro (buf + offset, size); break; case eSSU2BlkPeerTest: - LogPrint (eLogDebug, "SSU2: PeerTest"); + LogPrint (eLogDebug, "SSU2: PeerTest msg=", (int)buf[offset], " code=", (int)buf[offset+1]); HandlePeerTest (buf + offset, size); break; case eSSU2BlkNextNonce: @@ -1320,6 +1320,8 @@ namespace transport it->second.first->SendData (payload, payloadSize); m_PeerTests.erase (it); } + else + LogPrint (eLogWarning, "SSU2: Unknown peer test 3 nonce ", nonce); break; } case 4: // Alice from Bob @@ -1330,9 +1332,13 @@ namespace transport // TODO: update Charlie's session RouterInfo m_PeerTests.erase (it); } + else + LogPrint (eLogWarning, "SSU2: Unknown peer test 4 nonce ", nonce); break; } - case 5: // Alice from Chralie 1 + case 5: // Alice from Charlie 1 + if (htobe64 (((uint64_t)nonce << 32) | nonce) != m_SourceConnID) + LogPrint (eLogWarning, "SSU2: Peer test 5 nonce mismatch ", nonce); break; case 6: // Chralie from Alice break;