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

This commit is contained in:
orignal 2022-07-13 15:52:19 -04:00
parent 5c62726992
commit 1dd2bd0013

View File

@ -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;
} }