diff --git a/daemon/face/ethernet-face.cpp b/daemon/face/ethernet-face.cpp
index 2fc24ab..ea9e522 100644
--- a/daemon/face/ethernet-face.cpp
+++ b/daemon/face/ethernet-face.cpp
@@ -49,12 +49,12 @@
 NFD_LOG_INIT("EthernetFace");
 
 EthernetFace::EthernetFace(const shared_ptr<boost::asio::posix::stream_descriptor>& socket,
-                           const shared_ptr<NetworkInterfaceInfo>& interface,
+                           const NetworkInterfaceInfo& interface,
                            const ethernet::Address& address)
-  : Face(FaceUri(address), FaceUri::fromDev(interface->name))
+  : Face(FaceUri(address), FaceUri::fromDev(interface.name))
   , m_socket(socket)
-  , m_interfaceName(interface->name)
-  , m_srcAddress(interface->etherAddress)
+  , m_interfaceName(interface.name)
+  , m_srcAddress(interface.etherAddress)
   , m_destAddress(address)
 {
   NFD_LOG_INFO("Creating ethernet face on " << m_interfaceName << ": "
diff --git a/daemon/face/ethernet-face.hpp b/daemon/face/ethernet-face.hpp
index 8f44eab..4383246 100644
--- a/daemon/face/ethernet-face.hpp
+++ b/daemon/face/ethernet-face.hpp
@@ -56,7 +56,7 @@
   };
 
   EthernetFace(const shared_ptr<boost::asio::posix::stream_descriptor>& socket,
-               const shared_ptr<NetworkInterfaceInfo>& interface,
+               const NetworkInterfaceInfo& interface,
                const ethernet::Address& address);
 
   virtual
diff --git a/daemon/face/ethernet-factory.cpp b/daemon/face/ethernet-factory.cpp
index b96a0b4..314614e 100644
--- a/daemon/face/ethernet-factory.cpp
+++ b/daemon/face/ethernet-factory.cpp
@@ -35,14 +35,13 @@
 NFD_LOG_INIT("EthernetFactory");
 
 shared_ptr<EthernetFace>
-EthernetFactory::createMulticastFace(const shared_ptr<NetworkInterfaceInfo> &interface,
+EthernetFactory::createMulticastFace(const NetworkInterfaceInfo& interface,
                                      const ethernet::Address &address)
 {
   if (!address.isMulticast())
     throw Error(address.toString() + " is not a multicast address");
 
-  const std::string& name = interface->name;
-  shared_ptr<EthernetFace> face = findMulticastFace(name, address);
+  shared_ptr<EthernetFace> face = findMulticastFace(interface.name, address);
   if (face)
     return face;
 
@@ -51,8 +50,8 @@
 
   face = make_shared<EthernetFace>(socket, interface, address);
   face->onFail += bind(&EthernetFactory::afterFaceFailed,
-                       this, name, address);
-  m_multicastFaces[std::make_pair(name, address)] = face;
+                       this, interface.name, address);
+  m_multicastFaces[std::make_pair(interface.name, address)] = face;
 
   return face;
 }
diff --git a/daemon/face/ethernet-factory.hpp b/daemon/face/ethernet-factory.hpp
index f7f6588..b7d5ec0 100644
--- a/daemon/face/ethernet-factory.hpp
+++ b/daemon/face/ethernet-factory.hpp
@@ -72,7 +72,7 @@
    * \throws EthernetFactory::Error or EthernetFace::Error
    */
   shared_ptr<EthernetFace>
-  createMulticastFace(const shared_ptr<NetworkInterfaceInfo>& interface,
+  createMulticastFace(const NetworkInterfaceInfo& interface,
                       const ethernet::Address& address);
 
   /**
diff --git a/daemon/face/tcp-factory.cpp b/daemon/face/tcp-factory.cpp
index 792068b..bdc8c24 100644
--- a/daemon/face/tcp-factory.cpp
+++ b/daemon/face/tcp-factory.cpp
@@ -35,7 +35,6 @@
 TcpFactory::TcpFactory(const std::string& defaultPort/* = "6363"*/)
   : m_defaultPort(defaultPort)
 {
-
 }
 
 void
@@ -68,22 +67,11 @@
 {
   using namespace boost::asio::ip;
 
-  const std::list<shared_ptr<NetworkInterfaceInfo> > nicList(listNetworkInterfaces());
-
-  for (std::list<shared_ptr<NetworkInterfaceInfo> >::const_iterator i = nicList.begin();
-       i != nicList.end();
-       ++i)
-    {
-      const shared_ptr<NetworkInterfaceInfo>& nic = *i;
-      const std::vector<address_v4>& ipv4Addresses = nic->ipv4Addresses;
-
-      for (std::vector<address_v4>::const_iterator j = ipv4Addresses.begin();
-           j != ipv4Addresses.end();
-           ++j)
-        {
-          prohibitEndpoint(tcp::Endpoint(*j, port));
-        }
+  for (const NetworkInterfaceInfo& nic : listNetworkInterfaces()) {
+    for (const address_v4& addr : nic.ipv4Addresses) {
+      prohibitEndpoint(tcp::Endpoint(addr, port));
     }
+  }
 }
 
 void
@@ -91,29 +79,18 @@
 {
   using namespace boost::asio::ip;
 
-  const std::list<shared_ptr<NetworkInterfaceInfo> > nicList(listNetworkInterfaces());
-
-  for (std::list<shared_ptr<NetworkInterfaceInfo> >::const_iterator i = nicList.begin();
-       i != nicList.end();
-       ++i)
-    {
-      const shared_ptr<NetworkInterfaceInfo>& nic = *i;
-      const std::vector<address_v6>& ipv6Addresses = nic->ipv6Addresses;
-
-      for (std::vector<address_v6>::const_iterator j = ipv6Addresses.begin();
-           j != ipv6Addresses.end();
-           ++j)
-        {
-          prohibitEndpoint(tcp::Endpoint(*j, port));
-        }
+  for (const NetworkInterfaceInfo& nic : listNetworkInterfaces()) {
+    for (const address_v6& addr : nic.ipv6Addresses) {
+      prohibitEndpoint(tcp::Endpoint(addr, port));
     }
+  }
 }
 
 shared_ptr<TcpChannel>
 TcpFactory::createChannel(const tcp::Endpoint& endpoint)
 {
   shared_ptr<TcpChannel> channel = findChannel(endpoint);
-  if(static_cast<bool>(channel))
+  if (static_cast<bool>(channel))
     return channel;
 
   channel = make_shared<TcpChannel>(endpoint);
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index d6954af..dcb819d 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -43,8 +43,6 @@
 {
 }
 
-
-
 void
 UdpFactory::prohibitEndpoint(const udp::Endpoint& endpoint)
 {
@@ -77,29 +75,18 @@
 
   static const address_v4 INVALID_BROADCAST(address_v4::from_string("0.0.0.0"));
 
-  const std::list<shared_ptr<NetworkInterfaceInfo> > nicList(listNetworkInterfaces());
-
-  for (std::list<shared_ptr<NetworkInterfaceInfo> >::const_iterator i = nicList.begin();
-       i != nicList.end();
-       ++i)
-    {
-      const shared_ptr<NetworkInterfaceInfo>& nic = *i;
-      const std::vector<address_v4>& ipv4Addresses = nic->ipv4Addresses;
-
-      for (std::vector<address_v4>::const_iterator j = ipv4Addresses.begin();
-           j != ipv4Addresses.end();
-           ++j)
-        {
-          prohibitEndpoint(udp::Endpoint(*j, port));
-        }
-
-      if (nic->isBroadcastCapable() && nic->broadcastAddress != INVALID_BROADCAST)
-        {
-          NFD_LOG_TRACE("prohibiting broadcast address: " << nic->broadcastAddress.to_string());
-          prohibitEndpoint(udp::Endpoint(nic->broadcastAddress, port));
-        }
+  for (const NetworkInterfaceInfo& nic : listNetworkInterfaces()) {
+    for (const address_v4& addr : nic.ipv4Addresses) {
+      prohibitEndpoint(udp::Endpoint(addr, port));
     }
 
+    if (nic.isBroadcastCapable() && nic.broadcastAddress != INVALID_BROADCAST)
+    {
+      NFD_LOG_TRACE("prohibiting broadcast address: " << nic.broadcastAddress.to_string());
+      prohibitEndpoint(udp::Endpoint(nic.broadcastAddress, port));
+    }
+  }
+
   prohibitEndpoint(udp::Endpoint(address::from_string("255.255.255.255"), port));
 }
 
@@ -108,35 +95,23 @@
 {
   using namespace boost::asio::ip;
 
-  const std::list<shared_ptr<NetworkInterfaceInfo> > nicList(listNetworkInterfaces());
-
-  for (std::list<shared_ptr<NetworkInterfaceInfo> >::const_iterator i = nicList.begin();
-       i != nicList.end();
-       ++i)
-    {
-      const shared_ptr<NetworkInterfaceInfo>& nic = *i;
-      const std::vector<address_v6>& ipv6Addresses = nic->ipv6Addresses;
-
-      for (std::vector<address_v6>::const_iterator j = ipv6Addresses.begin();
-           j != ipv6Addresses.end();
-           ++j)
-        {
-          prohibitEndpoint(udp::Endpoint(*j, port));
-        }
+  for (const NetworkInterfaceInfo& nic : listNetworkInterfaces()) {
+    for (const address_v6& addr : nic.ipv6Addresses) {
+      prohibitEndpoint(udp::Endpoint(addr, port));
     }
+  }
 }
 
 shared_ptr<UdpChannel>
 UdpFactory::createChannel(const udp::Endpoint& endpoint,
                           const time::seconds& timeout)
 {
-  NFD_LOG_DEBUG("Creating unicast " << endpoint);
+  NFD_LOG_DEBUG("Creating unicast channel " << endpoint);
 
   shared_ptr<UdpChannel> channel = findChannel(endpoint);
   if (static_cast<bool>(channel))
     return channel;
 
-
   //checking if the endpoint is already in use for multicast face
   shared_ptr<MulticastUdpFace> multicast = findMulticastFace(endpoint);
   if (static_cast<bool>(multicast))
@@ -161,8 +136,7 @@
                           const std::string& localPort,
                           const time::seconds& timeout)
 {
-  return createChannel(UdpResolver::syncResolve(localHost, localPort),
-                       timeout);
+  return createChannel(UdpResolver::syncResolve(localHost, localPort), timeout);
 }
 
 shared_ptr<MulticastUdpFace>
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index 712d096..c88329c 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -166,55 +166,53 @@
   bool hasSeenEther = false;
   bool hasSeenWebSocket = false;
 
-  const std::list<shared_ptr<NetworkInterfaceInfo> > nicList(listNetworkInterfaces());
+  const std::vector<NetworkInterfaceInfo> nicList(listNetworkInterfaces());
 
-  for (ConfigSection::const_iterator item = configSection.begin();
-       item != configSection.end();
-       ++item)
+  for (const auto& item : configSection)
     {
-      if (item->first == "unix")
+      if (item.first == "unix")
         {
           if (hasSeenUnix)
             throw Error("Duplicate \"unix\" section");
           hasSeenUnix = true;
 
-          processSectionUnix(item->second, isDryRun);
+          processSectionUnix(item.second, isDryRun);
         }
-      else if (item->first == "tcp")
+      else if (item.first == "tcp")
         {
           if (hasSeenTcp)
             throw Error("Duplicate \"tcp\" section");
           hasSeenTcp = true;
 
-          processSectionTcp(item->second, isDryRun);
+          processSectionTcp(item.second, isDryRun);
         }
-      else if (item->first == "udp")
+      else if (item.first == "udp")
         {
           if (hasSeenUdp)
             throw Error("Duplicate \"udp\" section");
           hasSeenUdp = true;
 
-          processSectionUdp(item->second, isDryRun, nicList);
+          processSectionUdp(item.second, isDryRun, nicList);
         }
-      else if (item->first == "ether")
+      else if (item.first == "ether")
         {
           if (hasSeenEther)
             throw Error("Duplicate \"ether\" section");
           hasSeenEther = true;
 
-          processSectionEther(item->second, isDryRun, nicList);
+          processSectionEther(item.second, isDryRun, nicList);
         }
-      else if (item->first == "websocket")
+      else if (item.first == "websocket")
         {
           if (hasSeenWebSocket)
             throw Error("Duplicate \"websocket\" section");
           hasSeenWebSocket = true;
 
-          processSectionWebSocket(item->second, isDryRun);
+          processSectionWebSocket(item.second, isDryRun);
         }
       else
         {
-          throw Error("Unrecognized option \"" + item->first + "\"");
+          throw Error("Unrecognized option \"" + item.first + "\"");
         }
     }
 }
@@ -342,7 +340,7 @@
           return;
         }
 
-      shared_ptr<TcpFactory> factory = ndn::make_shared<TcpFactory>(port);
+      shared_ptr<TcpFactory> factory = make_shared<TcpFactory>(port);
       m_factories.insert(std::make_pair("tcp", factory));
 
       if (enableV4)
@@ -376,7 +374,7 @@
 void
 FaceManager::processSectionUdp(const ConfigSection& configSection,
                                bool isDryRun,
-                               const std::list<shared_ptr<NetworkInterfaceInfo> >& nicList)
+                               const std::vector<NetworkInterfaceInfo>& nicList)
 {
   // ; the udp section contains settings of UDP faces and channels
   // udp
@@ -520,7 +518,7 @@
         factory = static_pointer_cast<UdpFactory>(m_factories["udp"]);
       }
       else {
-        factory = ndn::make_shared<UdpFactory>(port);
+        factory = make_shared<UdpFactory>(port);
         m_factories.insert(std::make_pair("udp", factory));
       }
 
@@ -547,25 +545,21 @@
 
       if (useMcast && enableV4)
         {
-          std::list<shared_ptr<NetworkInterfaceInfo> > ipv4MulticastInterfaces;
-          for (std::list<shared_ptr<NetworkInterfaceInfo> >::const_iterator i = nicList.begin();
-               i != nicList.end();
-               ++i)
+          std::vector<NetworkInterfaceInfo> ipv4MulticastInterfaces;
+          for (const auto& nic : nicList)
             {
-              const shared_ptr<NetworkInterfaceInfo>& nic = *i;
-              if (nic->isUp() && nic->isMulticastCapable() && !nic->ipv4Addresses.empty())
+              if (nic.isUp() && nic.isMulticastCapable() && !nic.ipv4Addresses.empty())
                 {
                   ipv4MulticastInterfaces.push_back(nic);
                 }
             }
 
           bool isNicNameNecessary = false;
-
 #if defined(__linux__)
           if (ipv4MulticastInterfaces.size() > 1)
             {
-              //On Linux, if we have more than one MulticastUdpFace we need to specify
-              //the name of the interface
+              // On Linux if we have more than one MulticastUdpFace
+              // we need to specify the name of the interface
               isNicNameNecessary = true;
             }
 #endif
@@ -579,18 +573,13 @@
               multicastFacesToRemove.push_back(i->second);
             }
 
-          for (std::list<shared_ptr<NetworkInterfaceInfo> >::const_iterator i =
-                 ipv4MulticastInterfaces.begin();
-               i != ipv4MulticastInterfaces.end();
-               ++i)
+          for (const auto& nic : ipv4MulticastInterfaces)
             {
-              const shared_ptr<NetworkInterfaceInfo>& nic = *i;
               shared_ptr<MulticastUdpFace> newFace;
-              newFace = factory->createMulticastFace(nic->ipv4Addresses[0].to_string(),
+              newFace = factory->createMulticastFace(nic.ipv4Addresses[0].to_string(),
                                                      mcastGroup,
                                                      mcastPort,
-                                                     isNicNameNecessary ? nic->name : "");
-
+                                                     isNicNameNecessary ? nic.name : "");
               addCreatedFaceToForwarder(newFace);
               multicastFacesToRemove.remove(newFace);
             }
@@ -628,7 +617,7 @@
 void
 FaceManager::processSectionEther(const ConfigSection& configSection,
                                  bool isDryRun,
-                                 const std::list<shared_ptr<NetworkInterfaceInfo> >& nicList)
+                                 const std::vector<NetworkInterfaceInfo>& nicList)
 {
   // ; the ether section contains settings of Ethernet faces and channels
   // ether
@@ -639,11 +628,8 @@
   // }
 
 #if defined(HAVE_LIBPCAP)
-
-  using ethernet::Address;
-
   bool useMcast = true;
-  Address mcastGroup(ethernet::getDefaultMulticastAddress());
+  ethernet::Address mcastGroup(ethernet::getDefaultMulticastAddress());
 
   for (ConfigSection::const_iterator i = configSection.begin();
        i != configSection.end();
@@ -656,7 +642,7 @@
 
       else if (i->first == "mcast_group")
         {
-          mcastGroup = Address::fromString(i->second.get_value<std::string>());
+          mcastGroup = ethernet::Address::fromString(i->second.get_value<std::string>());
           if (mcastGroup.isNull())
             {
               throw ConfigFile::Error("Invalid value for option \"" +
@@ -676,7 +662,7 @@
         factory = static_pointer_cast<EthernetFactory>(m_factories["ether"]);
       }
       else {
-        factory = ndn::make_shared<EthernetFactory>();
+        factory = make_shared<EthernetFactory>();
         m_factories.insert(std::make_pair("ether", factory));
       }
 
@@ -691,12 +677,9 @@
               multicastFacesToRemove.push_back(i->second);
             }
 
-          for (std::list<shared_ptr<NetworkInterfaceInfo> >::const_iterator i = nicList.begin();
-               i != nicList.end();
-               ++i)
+          for (const auto& nic : nicList)
             {
-              const shared_ptr<NetworkInterfaceInfo>& nic = *i;
-              if (nic->isUp() && nic->isMulticastCapable())
+              if (nic.isUp() && nic.isMulticastCapable())
                 {
                   try
                     {
@@ -825,7 +808,7 @@
           return;
         }
 
-      shared_ptr<WebSocketFactory> factory = ndn::make_shared<WebSocketFactory>(port);
+      shared_ptr<WebSocketFactory> factory = make_shared<WebSocketFactory>(port);
       m_factories.insert(std::make_pair("websocket", factory));
 
       if (enableV6 && enableV4)
@@ -1190,5 +1173,4 @@
     return shared_ptr<ProtocolFactory>();
 }
 
-
 } // namespace nfd
diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp
index bb06f2b..d4d979b 100644
--- a/daemon/mgmt/face-manager.hpp
+++ b/daemon/mgmt/face-manager.hpp
@@ -60,7 +60,6 @@
   /**
    * \throws FaceManager::Error if localPort is an invalid port number
    */
-
   FaceManager(FaceTable& faceTable,
               shared_ptr<InternalFace> face,
               ndn::KeyChain& keyChain);
@@ -90,7 +89,6 @@
   findFactory(const std::string& protocol);
 
 PROTECTED_WITH_TESTS_ELSE_PRIVATE:
-
   void
   onValidatedFaceRequest(const shared_ptr<const Interest>& request);
 
@@ -150,12 +148,12 @@
   void
   processSectionUdp(const ConfigSection& configSection,
                     bool isDryRun,
-                    const std::list<shared_ptr<NetworkInterfaceInfo> >& nicList);
+                    const std::vector<NetworkInterfaceInfo>& nicList);
 
   void
   processSectionEther(const ConfigSection& configSection,
                       bool isDryRun,
-                      const std::list<shared_ptr<NetworkInterfaceInfo> >& nicList);
+                      const std::vector<NetworkInterfaceInfo>& nicList);
 
   void
   processSectionWebSocket(const ConfigSection& configSection, bool isDryRun);
@@ -170,8 +168,7 @@
              const std::string& sectionName);
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE:
-  typedef std::map< std::string/*protocol*/, shared_ptr<ProtocolFactory> > FactoryMap;
-
+  typedef std::map<std::string/*protocol*/, shared_ptr<ProtocolFactory>> FactoryMap;
   FactoryMap m_factories;
 
 private:
@@ -192,7 +189,6 @@
   typedef std::map<Name::Component, UnsignedVerbProcessor> UnsignedVerbDispatchTable;
   typedef std::pair<Name::Component, UnsignedVerbProcessor> UnsignedVerbAndProcessor;
 
-
   const SignedVerbDispatchTable m_signedVerbDispatch;
   const UnsignedVerbDispatchTable m_unsignedVerbDispatch;
 
@@ -239,7 +235,6 @@
   throw ConfigFile::Error("Invalid value for option \"" +
                           optionName + "\" in \"" +
                           sectionName + "\" section");
-
 }
 
 inline void
