Browse Source

publish MTU for ipv6 SSU2 address. Max MTU of 1488 for SSU1

pull/1776/head
orignal 2 years ago
parent
commit
1dd2bd0013
  1. 10
      libi2pd/RouterContext.cpp

10
libi2pd/RouterContext.cpp

@ -421,16 +421,18 @@ namespace i2p
!i2p::util::net::IsYggdrasilAddress (address->host)) !i2p::util::net::IsYggdrasilAddress (address->host))
{ {
address->host = host; address->host = host;
if (host.is_v6 () && address->transportStyle == i2p::data::RouterInfo::eTransportSSU) if (host.is_v6 () && (address->transportStyle == i2p::data::RouterInfo::eTransportSSU || address->IsSSU2 ()))
{ {
// update MTU // update MTU
auto mtu = i2p::util::net::GetMTU (host); auto mtu = i2p::util::net::GetMTU (host);
if (mtu) if (mtu)
{ {
LogPrint (eLogDebug, "Router: Our v6 MTU=", mtu); LogPrint (eLogDebug, "Router: Our v6 MTU=", mtu);
if (mtu > 1472) { // TODO: magic constant int maxMTU = address->IsSSU2 () ? 1500 : 1488; // must be multiple of 16 for SSU1
mtu = 1472; if (mtu > maxMTU)
LogPrint(eLogWarning, "Router: MTU dropped to upper limit of 1472 bytes"); {
mtu = maxMTU;
LogPrint(eLogWarning, "Router: MTU dropped to upper limit of ", maxMTU, " bytes");
} }
if (address->ssu) address->ssu->mtu = mtu; if (address->ssu) address->ssu->mtu = mtu;
} }

Loading…
Cancel
Save