From 7a976dd5f27fb2bed9b903020d96bd5e61ecc14b Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 31 Oct 2014 18:27:51 -0400 Subject: [PATCH] specify actual mtu in our RI for i2pv6 --- RouterContext.cpp | 8 +++++++- util.cpp | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RouterContext.cpp b/RouterContext.cpp index 9e17af0e..b8b6baf6 100644 --- a/RouterContext.cpp +++ b/RouterContext.cpp @@ -162,7 +162,13 @@ namespace i2p { // create new address m_RouterInfo.AddNTCPAddress (host.to_string ().c_str (), port); - m_RouterInfo.AddSSUAddress (host.to_string ().c_str (), port, GetIdentHash (), 1472); // TODO + auto mtu = i2p::util::net::GetMTU (host); + if (mtu) + { + LogPrint ("Our v6 MTU=", mtu); + if (mtu > 1472) mtu = 1472; + } + m_RouterInfo.AddSSUAddress (host.to_string ().c_str (), port, GetIdentHash (), mtu ? mtu : 1472); // TODO updated = true; } if (updated) diff --git a/util.cpp b/util.cpp index befffa33..f0689833 100644 --- a/util.cpp +++ b/util.cpp @@ -411,6 +411,7 @@ namespace net // loook for interface matching local address for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next) { + if (!ifa->ifa_addr) continue; family = ifa->ifa_addr->sa_family; if (family == AF_INET && localAddress.is_v4 ()) {