face: allow setting default UDP face MTU in config

refs #5138

Change-Id: Ibb3767b27aec2b046d1f41292f3d61001866f8c0
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index f2ccb9c..a5d9dee 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020,  Regents of the University of California,
+ * Copyright (c) 2014-2021,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -38,13 +38,15 @@
 
 UdpChannel::UdpChannel(const udp::Endpoint& localEndpoint,
                        time::nanoseconds idleTimeout,
-                       bool wantCongestionMarking)
+                       bool wantCongestionMarking,
+                       size_t defaultMtu)
   : m_localEndpoint(localEndpoint)
   , m_socket(getGlobalIoService())
   , m_idleFaceTimeout(idleTimeout)
   , m_wantCongestionMarking(wantCongestionMarking)
 {
   setUri(FaceUri(m_localEndpoint));
+  setDefaultMtu(defaultMtu);
   NFD_LOG_CHAN_INFO("Creating channel");
 }
 
@@ -122,6 +124,7 @@
   try {
     FaceParams params;
     params.persistency = ndn::nfd::FACE_PERSISTENCY_ON_DEMAND;
+    params.mtu = getDefaultMtu();
     std::tie(isCreated, face) = createFace(m_remoteEndpoint, params);
   }
   catch (const boost::system::system_error& e) {
@@ -180,9 +183,7 @@
     options.defaultCongestionThreshold = *params.defaultCongestionThreshold;
   }
 
-  if (params.mtu) {
-    options.overrideMtu = *params.mtu;
-  }
+  options.overrideMtu = params.mtu.value_or(getDefaultMtu());
 
   auto linkService = make_unique<GenericLinkService>(options);
   auto transport = make_unique<UnicastUdpTransport>(std::move(socket), params.persistency,