Skip to content

Commit

Permalink
Symmetric NAT error
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Mar 1, 2021
1 parent 57c969b commit 6d88c3a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions daemon/HTTPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ namespace http {
case eRouterErrorOffline:
s << " - Offline";
break;
case eRouterErrorSymmetricNAT:
s << " - Symmetric NAT";
break;
default: ;
}
break;
Expand Down
3 changes: 2 additions & 1 deletion libi2pd/RouterContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ namespace i2p
{
eRouterErrorNone = 0,
eRouterErrorClockSkew = 1,
eRouterErrorOffline = 2
eRouterErrorOffline = 2,
eRouterErrorSymmetricNAT = 3
};

class RouterContext: public i2p::garlic::GarlicDestination
Expand Down
1 change: 1 addition & 0 deletions libi2pd/SSU.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ namespace transport
void DeleteAllSessions ();

boost::asio::io_service& GetService () { return m_Service; };
uint16_t GetPort () const { return m_Endpoint.port (); };
void SetLocalAddress (const boost::asio::ip::address& localAddress);

void Send (const uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& to);
Expand Down
2 changes: 2 additions & 0 deletions libi2pd/SSUSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,8 @@ namespace transport
buf += 2; // our port
LogPrint (eLogInfo, "SSU: Our external address is ", ourIP.to_string (), ":", ourPort);
i2p::context.UpdateAddress (ourIP);
if (ourPort != m_Server.GetPort ())
i2p::context.SetError (eRouterErrorSymmetricNAT);
uint32_t nonce = bufbe32toh (buf);
buf += 4; // nonce
auto it = m_RelayRequests.find (nonce);
Expand Down

0 comments on commit 6d88c3a

Please sign in to comment.