temporary disable ip check:

when i2pd s starting, default ip address is set as 127.0.0.1
that causes problem that SSUv4 is not appers after start in RI
This commit is contained in:
R4SAS 2019-06-04 21:27:23 +03:00
parent 21cf4cfe2f
commit 06066a4df5
3 changed files with 21 additions and 13 deletions

View file

@ -483,16 +483,22 @@ namespace i2p
{ {
// create new address // create new address
m_RouterInfo.AddNTCPAddress (host.to_string ().c_str (), port); m_RouterInfo.AddNTCPAddress (host.to_string ().c_str (), port);
auto mtu = i2p::util::net::GetMTU (host); /*bool ssu; i2p::config::GetOption("ssu", ssu);
if (mtu) if (ssu)
{ {
LogPrint (eLogDebug, "Router: Our v6 MTU=", mtu); auto mtu = i2p::util::net::GetMTU (host);
if (mtu > 1472) { // TODO: magic constant if (mtu)
mtu = 1472; {
LogPrint(eLogWarning, "Router: MTU dropped to upper limit of 1472 bytes"); LogPrint (eLogDebug, "Router: Our v6 MTU=", mtu);
if (mtu > 1472) { // TODO: magic constant
mtu = 1472;
LogPrint(eLogWarning, "Router: MTU dropped to upper limit of 1472 bytes");
}
} }
} else
m_RouterInfo.AddSSUAddress (host.to_string ().c_str (), port, GetIdentHash (), mtu ? mtu : 1472); // TODO mtu = 1472;
m_RouterInfo.AddSSUAddress (host.to_string ().c_str (), port, GetIdentHash (), mtu);
}*/
updated = true; updated = true;
} }
if (updated) if (updated)
@ -526,7 +532,7 @@ namespace i2p
if (!found && port) // we have found NTCP2 v4 but not v6 if (!found && port) // we have found NTCP2 v4 but not v6
{ {
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, host, port); m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, host, port);
bool ntcp; i2p::config::GetOption("ntcp", ntcp); /*bool ntcp; i2p::config::GetOption("ntcp", ntcp);
bool ssu; i2p::config::GetOption("ssu", ssu); bool ssu; i2p::config::GetOption("ssu", ssu);
if (!ntcp && ssu) if (!ntcp && ssu)
{ {
@ -544,7 +550,7 @@ namespace i2p
else else
mtu = 1472; mtu = 1472;
m_RouterInfo.AddSSUAddress (host.to_string ().c_str (), port, GetIdentHash (), mtu); m_RouterInfo.AddSSUAddress (host.to_string ().c_str (), port, GetIdentHash (), mtu);
} }*/
updated = true; updated = true;
} }
if (updated) if (updated)

View file

@ -212,7 +212,8 @@ namespace data
if (!ecode) if (!ecode)
{ {
#if BOOST_VERSION >= 104900 #if BOOST_VERSION >= 104900
if (!hostaddr.is_unspecified () && ((i2p::context.GetNetID () != I2PD_NET_ID) || !i2p::util::net::IsInReservedRange(hostaddr))) //if (!hostaddr.is_unspecified () && ((i2p::context.GetNetID () != I2PD_NET_ID) || !i2p::util::net::IsInReservedRange(hostaddr)))
if (!hostaddr.is_unspecified ())
#else #else
hostaddr.to_string (ecode); hostaddr.to_string (ecode);
if (!ecode && ((i2p::context.GetNetID () != I2PD_NET_ID) || !i2p::util::net::IsInReservedRange(hostaddr))) if (!ecode && ((i2p::context.GetNetID () != I2PD_NET_ID) || !i2p::util::net::IsInReservedRange(hostaddr)))

View file

@ -208,6 +208,7 @@ namespace transport
auto& addresses = context.GetRouterInfo ().GetAddresses (); auto& addresses = context.GetRouterInfo ().GetAddresses ();
for (const auto& address : addresses) for (const auto& address : addresses)
{ {
LogPrint (eLogInfo, "Transports: Iteration through address ", address->host.to_string() ,":", address->port);
if (!address) continue; if (!address) continue;
if (m_NTCPServer == nullptr && enableNTCP) if (m_NTCPServer == nullptr && enableNTCP)
{ {
@ -227,9 +228,9 @@ namespace transport
{ {
if (m_SSUServer == nullptr && enableSSU) if (m_SSUServer == nullptr && enableSSU)
{ {
m_SSUServer = new SSUServer (address->port);
LogPrint (eLogInfo, "Transports: Start listening UDP port ", address->port);
try { try {
m_SSUServer = new SSUServer (address->port);
LogPrint (eLogInfo, "Transports: Start listening UDP port ", address->port);
m_SSUServer->Start (); m_SSUServer->Start ();
} catch ( std::exception & ex ) { } catch ( std::exception & ex ) {
LogPrint(eLogError, "Transports: Failed to bind to UDP port", address->port); LogPrint(eLogError, "Transports: Failed to bind to UDP port", address->port);