mirror of https://github.com/oxen-io/lokinet
more information in logs
This commit is contained in:
parent
977ea3d689
commit
caddeef2e8
|
@ -34,6 +34,15 @@ namespace llarp::iwp
|
|||
return "iwp";
|
||||
}
|
||||
|
||||
std::string
|
||||
LinkLayer::PrintableName() const
|
||||
{
|
||||
if (m_Inbound)
|
||||
return "inbound iwp link";
|
||||
else
|
||||
return "outbound iwp link";
|
||||
}
|
||||
|
||||
uint16_t
|
||||
LinkLayer::Rank() const
|
||||
{
|
||||
|
@ -60,7 +69,7 @@ namespace llarp::iwp
|
|||
}
|
||||
else
|
||||
{
|
||||
if(auto s_itr = m_AuthedLinks.find(itr->second); s_itr != m_AuthedLinks.end())
|
||||
if (auto s_itr = m_AuthedLinks.find(itr->second); s_itr != m_AuthedLinks.end())
|
||||
session = s_itr->second;
|
||||
}
|
||||
if (session)
|
||||
|
@ -92,7 +101,7 @@ namespace llarp::iwp
|
|||
std::shared_ptr<ILinkSession>
|
||||
LinkLayer::NewOutboundSession(const RouterContact& rc, const AddressInfo& ai)
|
||||
{
|
||||
if(m_Inbound)
|
||||
if (m_Inbound)
|
||||
throw std::logic_error{"inbound link cannot make outbound sessions"};
|
||||
return std::make_shared<Session>(this, rc, ai);
|
||||
}
|
||||
|
|
|
@ -56,6 +56,9 @@ namespace llarp::iwp
|
|||
void
|
||||
AddWakeup(std::weak_ptr<Session> peer);
|
||||
|
||||
std::string
|
||||
PrintableName() const;
|
||||
|
||||
private:
|
||||
void
|
||||
HandleWakeupPlaintext();
|
||||
|
|
|
@ -91,6 +91,7 @@ namespace llarp
|
|||
LogError("ident key mismatch");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_RemoteRC = msg->rc;
|
||||
GotLIM = util::memFn(&Session::GotRenegLIM, this);
|
||||
auto self = shared_from_this();
|
||||
|
@ -171,7 +172,7 @@ namespace llarp
|
|||
m_Parent->UnmapAddr(m_RemoteAddr);
|
||||
m_State = State::Closed;
|
||||
EncryptAndSend(std::move(close_msg));
|
||||
LogInfo("closing connection to ", m_RemoteAddr);
|
||||
LogInfo(m_Parent->PrintableName(), " closing connection to ", m_RemoteAddr);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -448,13 +449,15 @@ namespace llarp
|
|||
{
|
||||
if (not DecryptMessageInPlace(pkt))
|
||||
{
|
||||
LogError("failed to decrypt session request from ", m_RemoteAddr);
|
||||
LogError(
|
||||
m_Parent->PrintableName(), " failed to decrypt session request from ", m_RemoteAddr);
|
||||
return;
|
||||
}
|
||||
if (pkt.size() < token.size() + PacketOverhead)
|
||||
{
|
||||
LogError(
|
||||
"bad session request size, ",
|
||||
m_Parent->PrintableName(),
|
||||
" bad session request size, ",
|
||||
pkt.size(),
|
||||
" < ",
|
||||
token.size() + PacketOverhead,
|
||||
|
@ -465,7 +468,7 @@ namespace llarp
|
|||
const auto begin = pkt.data() + PacketOverhead;
|
||||
if (not std::equal(begin, begin + token.size(), token.data()))
|
||||
{
|
||||
LogError("token mismatch from ", m_RemoteAddr);
|
||||
LogError(m_Parent->PrintableName(), " token mismatch from ", m_RemoteAddr);
|
||||
return;
|
||||
}
|
||||
m_LastRX = m_Parent->Now();
|
||||
|
@ -478,7 +481,7 @@ namespace llarp
|
|||
{
|
||||
if (pkt.size() < (Introduction::SIZE + PacketOverhead))
|
||||
{
|
||||
LogWarn("intro too small from ", m_RemoteAddr);
|
||||
LogWarn(m_Parent->PrintableName(), " intro too small from ", m_RemoteAddr);
|
||||
return;
|
||||
}
|
||||
byte_t* ptr = pkt.data() + PacketOverhead;
|
||||
|
@ -495,7 +498,7 @@ namespace llarp
|
|||
pkt.data() + PacketOverhead, Introduction::SIZE - Signature::SIZE);
|
||||
if (!CryptoManager::instance()->verify(m_ExpectedIdent, verifybuf, Z))
|
||||
{
|
||||
LogError("intro verify failed from ", m_RemoteAddr);
|
||||
LogError(m_Parent->PrintableName(), " intro verify failed from ", m_RemoteAddr);
|
||||
return;
|
||||
}
|
||||
const PubKey pk = m_Parent->TransportSecretKey().toPublic();
|
||||
|
@ -529,7 +532,8 @@ namespace llarp
|
|||
if (pkt.size() < (token.size() + PacketOverhead))
|
||||
{
|
||||
LogError(
|
||||
"bad intro ack size ",
|
||||
m_Parent->PrintableName(),
|
||||
" bad intro ack size ",
|
||||
pkt.size(),
|
||||
" < ",
|
||||
token.size() + PacketOverhead,
|
||||
|
@ -540,7 +544,7 @@ namespace llarp
|
|||
Packet_t reply(token.size() + PacketOverhead);
|
||||
if (not DecryptMessageInPlace(pkt))
|
||||
{
|
||||
LogError("intro ack decrypt failed from ", m_RemoteAddr);
|
||||
LogError(m_Parent->PrintableName(), " intro ack decrypt failed from ", m_RemoteAddr);
|
||||
return;
|
||||
}
|
||||
m_LastRX = m_Parent->Now();
|
||||
|
@ -575,7 +579,8 @@ namespace llarp
|
|||
if (H != expected)
|
||||
{
|
||||
LogError(
|
||||
"keyed hash mismatch ",
|
||||
m_Parent->PrintableName(),
|
||||
" keyed hash mismatch ",
|
||||
H,
|
||||
" != ",
|
||||
expected,
|
||||
|
|
Loading…
Reference in New Issue