face: Configurable IP subnets for "local" TCP faces
Change-Id: Idaddfe4b2c304b552d2e132235f4c3d3e6c2ebcb
Refs: #4546
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index 821c6d7..058bbe5 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -24,9 +24,9 @@
*/
#include "tcp-channel.hpp"
+#include "core/global-io.hpp"
#include "generic-link-service.hpp"
#include "tcp-transport.hpp"
-#include "core/global-io.hpp"
namespace nfd {
namespace face {
@@ -35,11 +35,13 @@
namespace ip = boost::asio::ip;
-TcpChannel::TcpChannel(const tcp::Endpoint& localEndpoint, bool wantCongestionMarking)
+TcpChannel::TcpChannel(const tcp::Endpoint& localEndpoint, bool wantCongestionMarking,
+ DetermineFaceScopeFromAddress determineFaceScope)
: m_localEndpoint(localEndpoint)
, m_acceptor(getGlobalIoService())
, m_socket(getGlobalIoService())
, m_wantCongestionMarking(wantCongestionMarking)
+ , m_determineFaceScope(std::move(determineFaceScope))
{
setUri(FaceUri(m_localEndpoint));
NFD_LOG_CHAN_INFO("Creating channel");
@@ -122,7 +124,9 @@
}
auto linkService = make_unique<GenericLinkService>(options);
- auto transport = make_unique<TcpTransport>(std::move(socket), params.persistency);
+ auto faceScope = m_determineFaceScope(socket.local_endpoint().address(),
+ socket.remote_endpoint().address());
+ auto transport = make_unique<TcpTransport>(std::move(socket), params.persistency, faceScope);
face = make_shared<Face>(std::move(linkService), std::move(transport));
m_channelFaces[remoteEndpoint] = face;