mgmt+face: allow MTU of datagram faces to be overridden
refs #4005
Change-Id: I01d98b88cdee41b633f6fb9a5600088efe8de749
diff --git a/daemon/face/unicast-ethernet-transport.cpp b/daemon/face/unicast-ethernet-transport.cpp
index e28fa93..60059bb 100644
--- a/daemon/face/unicast-ethernet-transport.cpp
+++ b/daemon/face/unicast-ethernet-transport.cpp
@@ -35,7 +35,8 @@
UnicastEthernetTransport::UnicastEthernetTransport(const ndn::net::NetworkInterface& localEndpoint,
const ethernet::Address& remoteEndpoint,
ndn::nfd::FacePersistency persistency,
- time::nanoseconds idleTimeout)
+ time::nanoseconds idleTimeout,
+ optional<ssize_t> overrideMtu)
: EthernetTransport(localEndpoint, remoteEndpoint)
, m_idleTimeout(idleTimeout)
{
@@ -44,7 +45,13 @@
this->setScope(ndn::nfd::FACE_SCOPE_NON_LOCAL);
this->setPersistency(persistency);
this->setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT);
- this->setMtu(localEndpoint.getMtu());
+
+ if (overrideMtu) {
+ this->setMtu(std::min<ssize_t>(localEndpoint.getMtu(), *overrideMtu));
+ }
+ else {
+ this->setMtu(localEndpoint.getMtu());
+ }
NFD_LOG_FACE_INFO("Creating transport");