Browse Source

close SSU session if MAC verification fails

pull/46/head
orignal 10 years ago
parent
commit
9ef8ae99e2
  1. 11
      SSU.cpp
  2. 4
      SSU.h

11
SSU.cpp

@ -418,7 +418,10 @@ namespace ssu @@ -418,7 +418,10 @@ namespace ssu
LogPrint ("Unexpected payload type ", (int)(header->flag >> 4));
}
else
{
LogPrint ("MAC verification failed");
Failed ();
}
}
else
LogPrint ("SSU is not supported");
@ -511,6 +514,14 @@ namespace ssu @@ -511,6 +514,14 @@ namespace ssu
m_DelayedMessages.clear ();
}
}
void SSUSession::Failed ()
{
m_State = eSessionStateFailed;
Close ();
if (m_Server)
m_Server->DeleteSession (this); // delete this
}
const uint8_t * SSUSession::GetIntroKey () const
{

4
SSU.h

@ -58,7 +58,8 @@ namespace ssu @@ -58,7 +58,8 @@ namespace ssu
eSessionRelayRequestSent,
eSessionRelayRequestReceived,
eSessionRelayResponseReceived,
eSessionStateEstablished
eSessionStateEstablished,
eSessionStateFailed
};
class SSUServer;
@ -91,6 +92,7 @@ namespace ssu @@ -91,6 +92,7 @@ namespace ssu
void SendSessionConfirmed (const uint8_t * y, const uint8_t * ourAddress, uint32_t relayTag);
void ProcessRelayResponse (uint8_t * buf, size_t len);
void Established ();
void Failed ();
void ProcessData (uint8_t * buf, size_t len);
void SendMsgAck (uint32_t msgID);
void SendSesionDestroyed ();

Loading…
Cancel
Save