mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-23 15:02:52 +00:00
Merge pull request #2272 from HardenedSteel/fix
feat: change published port if full-cone
This commit is contained in:
1 file changed
+11
-2
+11
-2
@@ -1831,20 +1831,27 @@ namespace transport
|
||||
bool isV4 = ep.address ().is_v4 ();
|
||||
if (ep.port () != m_Server.GetPort (isV4))
|
||||
{
|
||||
LogPrint (eLogInfo, "SSU2: Our port ", ep.port (), " received from ", m_RemoteEndpoint, " is different from ", m_Server.GetPort (isV4));
|
||||
// TODO: External port detected incorrectly.
|
||||
// LogPrint (eLogInfo, "SSU2: Our port ", ep.port (), " received from ", m_RemoteEndpoint, " is different from ", m_Server.GetPort (isV4));
|
||||
if (isV4)
|
||||
{
|
||||
if (i2p::context.GetTesting ())
|
||||
i2p::context.SetError (eRouterErrorSymmetricNAT);
|
||||
else if (m_State == eSSU2SessionStatePeerTest)
|
||||
{
|
||||
i2p::context.SetError (eRouterErrorFullConeNAT);
|
||||
i2p::context.UpdatePort((int)ep.port ());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i2p::context.GetTestingV6 ())
|
||||
i2p::context.SetErrorV6 (eRouterErrorSymmetricNAT);
|
||||
else if (m_State == eSSU2SessionStatePeerTest)
|
||||
{
|
||||
i2p::context.SetErrorV6 (eRouterErrorFullConeNAT);
|
||||
i2p::context.UpdatePort((int)ep.port ());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2437,7 +2444,9 @@ namespace transport
|
||||
session->SendPeerTest (6, buf + offset, len - offset, addr, true);
|
||||
}
|
||||
SetTestingState (false);
|
||||
if (GetRouterStatus () != eRouterStatusFirewalled && addr->IsPeerTesting ())
|
||||
if (i2p::context.GetError () == eRouterErrorFullConeNAT)
|
||||
SetRouterStatus (eRouterStatusOK);
|
||||
else if (GetRouterStatus () != eRouterStatusFirewalled && addr->IsPeerTesting ())
|
||||
{
|
||||
SetRouterStatus (eRouterStatusFirewalled);
|
||||
session->SetStatusChanged ();
|
||||
|
||||
Reference in new issue
Block a user