Browse Source

close SSU session if MAC verification fails

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

11
SSU.cpp

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

4
SSU.h

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

Loading…
Cancel
Save