core: move nfd-specific files to daemon/
Refs: #4922
Change-Id: I2243dbb87c63f9cbaf7d7051d7a0d4bca2f9fdb5
diff --git a/daemon/face/channel-log.hpp b/daemon/face/channel-log.hpp
index 59edf52..375c23a 100644
--- a/daemon/face/channel-log.hpp
+++ b/daemon/face/channel-log.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,7 +26,7 @@
#ifndef NFD_DAEMON_FACE_CHANNEL_LOG_HPP
#define NFD_DAEMON_FACE_CHANNEL_LOG_HPP
-#include "core/logger.hpp"
+#include "common/logger.hpp"
/** \defgroup ChannelLogging Channel logging macros
*
diff --git a/daemon/face/datagram-transport.hpp b/daemon/face/datagram-transport.hpp
index 135035f..fcde63b 100644
--- a/daemon/face/datagram-transport.hpp
+++ b/daemon/face/datagram-transport.hpp
@@ -28,7 +28,7 @@
#include "transport.hpp"
#include "socket-utils.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#include <array>
diff --git a/daemon/face/ethernet-channel.cpp b/daemon/face/ethernet-channel.cpp
index 4b5a072..9c27ada 100644
--- a/daemon/face/ethernet-channel.cpp
+++ b/daemon/face/ethernet-channel.cpp
@@ -27,7 +27,7 @@
#include "ethernet-protocol.hpp"
#include "generic-link-service.hpp"
#include "unicast-ethernet-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#include <boost/range/adaptor/map.hpp>
#include <pcap/pcap.h>
diff --git a/daemon/face/ethernet-transport.cpp b/daemon/face/ethernet-transport.cpp
index 0e69745..a2f3e9b 100644
--- a/daemon/face/ethernet-transport.cpp
+++ b/daemon/face/ethernet-transport.cpp
@@ -25,7 +25,7 @@
#include "ethernet-transport.hpp"
#include "ethernet-protocol.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#include <pcap/pcap.h>
diff --git a/daemon/face/face-log.hpp b/daemon/face/face-log.hpp
index 55022d1..b193d82 100644
--- a/daemon/face/face-log.hpp
+++ b/daemon/face/face-log.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,7 +26,7 @@
#ifndef NFD_DAEMON_FACE_FACE_LOG_HPP
#define NFD_DAEMON_FACE_FACE_LOG_HPP
-#include "core/logger.hpp"
+#include "common/logger.hpp"
namespace nfd {
namespace face {
diff --git a/daemon/face/face-system.cpp b/daemon/face/face-system.cpp
index 260eea7..67738aa 100644
--- a/daemon/face/face-system.cpp
+++ b/daemon/face/face-system.cpp
@@ -26,7 +26,7 @@
#include "face-system.hpp"
#include "protocol-factory.hpp"
#include "netdev-bound.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#include "fw/face-table.hpp"
namespace nfd {
diff --git a/daemon/face/face-system.hpp b/daemon/face/face-system.hpp
index 833da1b..2bcdfad 100644
--- a/daemon/face/face-system.hpp
+++ b/daemon/face/face-system.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,8 +27,9 @@
#define NFD_DAEMON_FACE_FACE_SYSTEM_HPP
#include "channel.hpp"
-#include "core/config-file.hpp"
-#include "core/network-predicate.hpp"
+#include "network-predicate.hpp"
+#include "common/config-file.hpp"
+
#include <ndn-cxx/net/network-address.hpp>
#include <ndn-cxx/net/network-interface.hpp>
#include <ndn-cxx/net/network-monitor.hpp>
diff --git a/daemon/face/internal-face.cpp b/daemon/face/internal-face.cpp
index f82bd58..764dfd7 100644
--- a/daemon/face/internal-face.cpp
+++ b/daemon/face/internal-face.cpp
@@ -26,7 +26,7 @@
#include "internal-face.hpp"
#include "generic-link-service.hpp"
#include "internal-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
namespace nfd {
namespace face {
diff --git a/daemon/face/internal-transport.cpp b/daemon/face/internal-transport.cpp
index 5b3fcac..18bfe0a 100644
--- a/daemon/face/internal-transport.cpp
+++ b/daemon/face/internal-transport.cpp
@@ -24,7 +24,7 @@
*/
#include "internal-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
namespace nfd {
namespace face {
diff --git a/daemon/face/link-service.hpp b/daemon/face/link-service.hpp
index b8e8749..0caa857 100644
--- a/daemon/face/link-service.hpp
+++ b/daemon/face/link-service.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,9 +26,9 @@
#ifndef NFD_DAEMON_FACE_LINK_SERVICE_HPP
#define NFD_DAEMON_FACE_LINK_SERVICE_HPP
-#include "core/counter.hpp"
#include "face-log.hpp"
#include "transport.hpp"
+#include "common/counter.hpp"
namespace nfd {
namespace face {
diff --git a/daemon/face/lp-reassembler.cpp b/daemon/face/lp-reassembler.cpp
index 918d296..d19f799 100644
--- a/daemon/face/lp-reassembler.cpp
+++ b/daemon/face/lp-reassembler.cpp
@@ -25,7 +25,7 @@
#include "lp-reassembler.hpp"
#include "link-service.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#include <numeric>
diff --git a/daemon/face/lp-reliability.cpp b/daemon/face/lp-reliability.cpp
index f65d3c3..7f7ee14 100644
--- a/daemon/face/lp-reliability.cpp
+++ b/daemon/face/lp-reliability.cpp
@@ -26,7 +26,7 @@
#include "lp-reliability.hpp"
#include "generic-link-service.hpp"
#include "transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
namespace nfd {
namespace face {
diff --git a/daemon/face/multicast-ethernet-transport.cpp b/daemon/face/multicast-ethernet-transport.cpp
index 80f13ea..1295764 100644
--- a/daemon/face/multicast-ethernet-transport.cpp
+++ b/daemon/face/multicast-ethernet-transport.cpp
@@ -24,7 +24,7 @@
*/
#include "multicast-ethernet-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#include <cerrno> // for errno
#include <cstring> // for memcpy(), strerror(), strncpy()
diff --git a/daemon/face/multicast-udp-transport.cpp b/daemon/face/multicast-udp-transport.cpp
index 2c61527..689b7e0 100644
--- a/daemon/face/multicast-udp-transport.cpp
+++ b/daemon/face/multicast-udp-transport.cpp
@@ -27,7 +27,7 @@
#include "socket-utils.hpp"
#include "udp-protocol.hpp"
-#include "core/privilege-helper.hpp"
+#include "common/privilege-helper.hpp"
#include <boost/functional/hash.hpp>
diff --git a/daemon/face/netdev-bound.cpp b/daemon/face/netdev-bound.cpp
index 5ed975d..124ea3a 100644
--- a/daemon/face/netdev-bound.cpp
+++ b/daemon/face/netdev-bound.cpp
@@ -25,7 +25,7 @@
#include "netdev-bound.hpp"
#include "face-system.hpp"
-#include "core/logger.hpp"
+#include "common/logger.hpp"
namespace nfd {
namespace face {
diff --git a/daemon/face/network-predicate.cpp b/daemon/face/network-predicate.cpp
new file mode 100644
index 0000000..31a2cf8
--- /dev/null
+++ b/daemon/face/network-predicate.cpp
@@ -0,0 +1,227 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2019, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "network-predicate.hpp"
+#include "common/config-file.hpp"
+#include "core/network.hpp"
+
+#include <fnmatch.h>
+
+namespace nfd {
+namespace face {
+
+NetworkPredicateBase::NetworkPredicateBase()
+{
+ this->clear();
+}
+
+NetworkPredicateBase::~NetworkPredicateBase() = default;
+
+void
+NetworkPredicateBase::clear()
+{
+ m_whitelist = std::set<std::string>{"*"};
+ m_blacklist.clear();
+}
+
+void
+NetworkPredicateBase::parseList(std::set<std::string>& set,
+ const boost::property_tree::ptree& list,
+ const std::string& section)
+{
+ set.clear();
+
+ for (const auto& item : list) {
+ if (item.first == "*") {
+ // insert wildcard
+ set.insert(item.first);
+ }
+ else {
+ if (!isRuleSupported(item.first)) {
+ NDN_THROW(ConfigFile::Error("Unrecognized rule '" + item.first +
+ "' in section '" + section + "'"));
+ }
+
+ auto value = item.second.get_value<std::string>();
+ if (!isRuleValid(item.first, value)) {
+ NDN_THROW(ConfigFile::Error("Malformed " + item.first + " '" + value +
+ "' in section '" + section + "'"));
+ }
+ set.insert(value);
+ }
+ }
+}
+
+void
+NetworkPredicateBase::parseList(std::set<std::string>& set,
+ std::initializer_list<std::pair<std::string, std::string>> list)
+{
+ set.clear();
+
+ for (const auto& item : list) {
+ if (item.first == "*") {
+ // insert wildcard
+ set.insert(item.first);
+ }
+ else {
+ if (!isRuleSupported(item.first)) {
+ NDN_THROW(std::runtime_error("Unrecognized rule '" + item.first + "'"));
+ }
+
+ if (!isRuleValid(item.first, item.second)) {
+ NDN_THROW(std::runtime_error("Malformed " + item.first + " '" + item.second + "'"));
+ }
+ set.insert(item.second);
+ }
+ }
+}
+
+void
+NetworkPredicateBase::parseWhitelist(const boost::property_tree::ptree& list)
+{
+ parseList(m_whitelist, list, "whitelist");
+}
+
+void
+NetworkPredicateBase::parseBlacklist(const boost::property_tree::ptree& list)
+{
+ parseList(m_blacklist, list, "blacklist");
+}
+
+void
+NetworkPredicateBase::assign(std::initializer_list<std::pair<std::string, std::string>> whitelist,
+ std::initializer_list<std::pair<std::string, std::string>> blacklist)
+{
+ parseList(m_whitelist, whitelist);
+ parseList(m_blacklist, blacklist);
+}
+
+bool
+NetworkInterfacePredicate::isRuleSupported(const std::string& key)
+{
+ return key == "ifname" || key == "ether" || key == "subnet";
+}
+
+bool
+NetworkInterfacePredicate::isRuleValid(const std::string& key, const std::string& value)
+{
+ if (key == "ifname") {
+ // very basic sanity check for interface names
+ return !value.empty();
+ }
+ else if (key == "ether") {
+ // validate ethernet address
+ return !ndn::ethernet::Address::fromString(value).isNull();
+ }
+ else if (key == "subnet") {
+ // example subnet: 10.0.0.0/8
+ return Network::isValidCidr(value);
+ }
+ else {
+ NDN_THROW(std::logic_error("Only supported rules are expected"));
+ }
+}
+
+bool
+IpAddressPredicate::isRuleSupported(const std::string& key)
+{
+ return key == "subnet";
+}
+
+bool
+IpAddressPredicate::isRuleValid(const std::string& key, const std::string& value)
+{
+ if (key == "subnet") {
+ // example subnet: 10.0.0.0/8
+ return Network::isValidCidr(value);
+ }
+ else {
+ NDN_THROW(std::logic_error("Only supported rules are expected"));
+ }
+}
+
+bool
+NetworkPredicateBase::operator==(const NetworkPredicateBase& other) const
+{
+ return this->m_whitelist == other.m_whitelist &&
+ this->m_blacklist == other.m_blacklist;
+}
+
+static bool
+doesMatchPattern(const std::string& ifname, const std::string& pattern)
+{
+ // use fnmatch(3) to provide unix glob-style matching for interface names
+ // fnmatch returns 0 if there is a match
+ return ::fnmatch(pattern.data(), ifname.data(), 0) == 0;
+}
+
+static bool
+doesNetifMatchRule(const ndn::net::NetworkInterface& netif, const std::string& rule)
+{
+ // if '/' is in rule, this is a subnet, check if IP in subnet
+ if (rule.find('/') != std::string::npos) {
+ Network n = boost::lexical_cast<Network>(rule);
+ for (const auto& addr : netif.getNetworkAddresses()) {
+ if (n.doesContain(addr.getIp())) {
+ return true;
+ }
+ }
+ }
+
+ return rule == "*" ||
+ doesMatchPattern(netif.getName(), rule) ||
+ netif.getEthernetAddress().toString() == rule;
+}
+
+bool
+NetworkInterfacePredicate::operator()(const ndn::net::NetworkInterface& netif) const
+{
+ return std::any_of(m_whitelist.begin(), m_whitelist.end(), bind(&doesNetifMatchRule, std::cref(netif), _1)) &&
+ std::none_of(m_blacklist.begin(), m_blacklist.end(), bind(&doesNetifMatchRule, std::cref(netif), _1));
+}
+
+static bool
+doesAddressMatchRule(const boost::asio::ip::address& address, const std::string& rule)
+{
+ // if '/' is in rule, this is a subnet, check if IP in subnet
+ if (rule.find('/') != std::string::npos) {
+ Network n = boost::lexical_cast<Network>(rule);
+ if (n.doesContain(address)) {
+ return true;
+ }
+ }
+
+ return rule == "*";
+}
+
+bool
+IpAddressPredicate::operator()(const boost::asio::ip::address& address) const
+{
+ return std::any_of(m_whitelist.begin(), m_whitelist.end(), bind(&doesAddressMatchRule, std::cref(address), _1)) &&
+ std::none_of(m_blacklist.begin(), m_blacklist.end(), bind(&doesAddressMatchRule, std::cref(address), _1));
+}
+
+} // namespace face
+} // namespace nfd
diff --git a/daemon/face/network-predicate.hpp b/daemon/face/network-predicate.hpp
new file mode 100644
index 0000000..27ac8b1
--- /dev/null
+++ b/daemon/face/network-predicate.hpp
@@ -0,0 +1,136 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2019, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_DAEMON_FACE_NETWORK_PREDICATE_HPP
+#define NFD_DAEMON_FACE_NETWORK_PREDICATE_HPP
+
+#include "core/common.hpp"
+
+#include <ndn-cxx/net/network-interface.hpp>
+
+namespace nfd {
+namespace face {
+
+class NetworkPredicateBase
+{
+public:
+ NetworkPredicateBase();
+
+ virtual
+ ~NetworkPredicateBase();
+
+ /**
+ * \brief Set the whitelist to "*" and clear the blacklist
+ */
+ void
+ clear();
+
+ void
+ parseWhitelist(const boost::property_tree::ptree& list);
+
+ void
+ parseBlacklist(const boost::property_tree::ptree& list);
+
+ void
+ assign(std::initializer_list<std::pair<std::string, std::string>> whitelist,
+ std::initializer_list<std::pair<std::string, std::string>> blacklist);
+
+ bool
+ operator==(const NetworkPredicateBase& other) const;
+
+ bool
+ operator!=(const NetworkPredicateBase& other) const
+ {
+ return !this->operator==(other);
+ }
+
+private:
+ virtual bool
+ isRuleSupported(const std::string& key) = 0;
+
+ virtual bool
+ isRuleValid(const std::string& key, const std::string& value) = 0;
+
+ void
+ parseList(std::set<std::string>& set, const boost::property_tree::ptree& list, const std::string& section);
+
+ void
+ parseList(std::set<std::string>& set, std::initializer_list<std::pair<std::string, std::string>> list);
+
+PUBLIC_WITH_TESTS_ELSE_PROTECTED:
+ std::set<std::string> m_whitelist;
+ std::set<std::string> m_blacklist;
+};
+
+/**
+ * \brief Represents a predicate to accept or reject a ndn::net::NetworkInterface.
+ *
+ * The predicate consists of a whitelist and a blacklist. Whitelist and blacklist can contain,
+ * in no particular order, interface names (e.g., `ifname eth0`), MAC addresses (e.g., `ether
+ * 85:3b:4d:d3:5f:c2`), IPv4 and IPv6 subnets (e.g., `subnet 192.0.2.0/24` or `subnet
+ * 2001:db8:2::/64`), or a wildcard (`*`) that matches all interfaces. A
+ * ndn::net::NetworkInterface is accepted if it matches any entry in the whitelist and none of
+ * the entries in the blacklist.
+ */
+class NetworkInterfacePredicate : public NetworkPredicateBase
+{
+public:
+ bool
+ operator()(const ndn::net::NetworkInterface& netif) const;
+
+private:
+ bool
+ isRuleSupported(const std::string& key) final;
+
+ bool
+ isRuleValid(const std::string& key, const std::string& value) final;
+};
+
+/**
+ * \brief Represents a predicate to accept or reject an IP address.
+ *
+ * The predicate consists of a whitelist and a blacklist. Whitelist and blacklist can contain,
+ * in no particular order, IPv4 and IPv6 subnets (e.g., `subnet 192.0.2.0/24` or `subnet
+ * 2001:db8:2::/64`) or a wildcard (`*`) that matches all IP addresses. An IP address is
+ * accepted if it matches any entry in the whitelist and none of the entries in the blacklist.
+ */
+class IpAddressPredicate : public NetworkPredicateBase
+{
+public:
+ bool
+ operator()(const boost::asio::ip::address& address) const;
+
+private:
+ bool
+ isRuleSupported(const std::string& key) final;
+
+ bool
+ isRuleValid(const std::string& key, const std::string& value) final;
+};
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_NETWORK_PREDICATE_HPP
diff --git a/daemon/face/stream-transport.hpp b/daemon/face/stream-transport.hpp
index eb7de92..e0a7d6d 100644
--- a/daemon/face/stream-transport.hpp
+++ b/daemon/face/stream-transport.hpp
@@ -28,7 +28,7 @@
#include "transport.hpp"
#include "socket-utils.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#include <queue>
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index 7ffb0f3..dc0576f 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -26,7 +26,7 @@
#include "tcp-channel.hpp"
#include "generic-link-service.hpp"
#include "tcp-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
namespace nfd {
namespace face {
diff --git a/daemon/face/tcp-transport.cpp b/daemon/face/tcp-transport.cpp
index 90c1825..58c4add 100644
--- a/daemon/face/tcp-transport.cpp
+++ b/daemon/face/tcp-transport.cpp
@@ -24,7 +24,7 @@
*/
#include "tcp-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#if defined(__linux__)
#include <linux/sockios.h>
diff --git a/daemon/face/transport.hpp b/daemon/face/transport.hpp
index 8bbfe86..aaea75a 100644
--- a/daemon/face/transport.hpp
+++ b/daemon/face/transport.hpp
@@ -26,8 +26,8 @@
#ifndef NFD_DAEMON_FACE_TRANSPORT_HPP
#define NFD_DAEMON_FACE_TRANSPORT_HPP
-#include "core/counter.hpp"
#include "face-log.hpp"
+#include "common/counter.hpp"
#include <ndn-cxx/encoding/nfd-constants.hpp>
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index b9da25e..7f4a4d9 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -26,7 +26,7 @@
#include "udp-channel.hpp"
#include "generic-link-service.hpp"
#include "unicast-udp-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
namespace nfd {
namespace face {
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index 2c8cf20..54b00b1 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -26,7 +26,7 @@
#include "udp-factory.hpp"
#include "generic-link-service.hpp"
#include "multicast-udp-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
diff --git a/daemon/face/unicast-ethernet-transport.cpp b/daemon/face/unicast-ethernet-transport.cpp
index 3ed7800..97e5c4e 100644
--- a/daemon/face/unicast-ethernet-transport.cpp
+++ b/daemon/face/unicast-ethernet-transport.cpp
@@ -24,7 +24,7 @@
*/
#include "unicast-ethernet-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#include <stdio.h> // for snprintf()
diff --git a/daemon/face/unicast-udp-transport.cpp b/daemon/face/unicast-udp-transport.cpp
index c2c0d2b..a81e1d0 100644
--- a/daemon/face/unicast-udp-transport.cpp
+++ b/daemon/face/unicast-udp-transport.cpp
@@ -25,7 +25,7 @@
#include "unicast-udp-transport.hpp"
#include "udp-protocol.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#ifdef __linux__
#include <cerrno> // for errno
diff --git a/daemon/face/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index 52a4c99..4ef1a18 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.cpp
@@ -26,7 +26,7 @@
#include "unix-stream-channel.hpp"
#include "generic-link-service.hpp"
#include "unix-stream-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
#include <boost/filesystem.hpp>
#include <sys/stat.h> // for chmod()
diff --git a/daemon/face/websocket-channel.cpp b/daemon/face/websocket-channel.cpp
index 74b4d39..f3f69ba 100644
--- a/daemon/face/websocket-channel.cpp
+++ b/daemon/face/websocket-channel.cpp
@@ -26,7 +26,7 @@
#include "websocket-channel.hpp"
#include "generic-link-service.hpp"
#include "websocket-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
namespace nfd {
namespace face {
diff --git a/daemon/face/websocket-transport.cpp b/daemon/face/websocket-transport.cpp
index 63be570..d20e54c 100644
--- a/daemon/face/websocket-transport.cpp
+++ b/daemon/face/websocket-transport.cpp
@@ -24,7 +24,7 @@
*/
#include "websocket-transport.hpp"
-#include "daemon/global.hpp"
+#include "common/global.hpp"
namespace nfd {
namespace face {