diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index b07211b..e7e0904 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -56,19 +56,19 @@
 }
 
 void
-AccessStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
+AccessStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                                      const shared_ptr<pit::Entry>& pitEntry)
 {
   RetxSuppressionResult suppressResult = m_retxSuppression.decidePerPitEntry(*pitEntry);
   switch (suppressResult) {
   case RetxSuppressionResult::NEW:
-    this->afterReceiveNewInterest(inFace, interest, pitEntry);
+    this->afterReceiveNewInterest(ingress.face, interest, pitEntry);
     break;
   case RetxSuppressionResult::FORWARD:
-    this->afterReceiveRetxInterest(inFace, interest, pitEntry);
+    this->afterReceiveRetxInterest(ingress.face, interest, pitEntry);
     break;
   case RetxSuppressionResult::SUPPRESS:
-    NFD_LOG_DEBUG(interest << " interestFrom " << inFace.getId() << " retx-suppress");
+    NFD_LOG_DEBUG(interest << " interestFrom " << ingress << " retx-suppress");
     break;
   default:
     BOOST_ASSERT(false);
@@ -87,8 +87,7 @@
 
   // has measurements for Interest Name?
   if (mi != nullptr) {
-    NFD_LOG_DEBUG(interest << " interestFrom " << inFace.getId() <<
-                  " new-interest mi=" << miName);
+    NFD_LOG_DEBUG(interest << " interestFrom " << inFace.getId() << " new-interest mi=" << miName);
 
     // send to last working nexthop
     bool isSentToLastNexthop = this->sendToLastNexthop(inFace, interest, pitEntry, *mi, fibEntry);
@@ -98,8 +97,7 @@
     }
   }
   else {
-    NFD_LOG_DEBUG(interest << " interestFrom " << inFace.getId() <<
-                  " new-interest no-mi");
+    NFD_LOG_DEBUG(interest << " interestFrom " << inFace.getId() << " new-interest no-mi");
   }
 
   // no measurements, or last working nexthop unavailable
@@ -148,10 +146,10 @@
   }
 
   RttEstimator::Duration rto = mi.rtt.computeRto();
-  NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << mi.lastNexthop <<
-                " last-nexthop rto=" << time::duration_cast<time::microseconds>(rto).count());
+  NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << mi.lastNexthop
+                << " last-nexthop rto=" << time::duration_cast<time::microseconds>(rto).count());
 
-  this->sendInterest(pitEntry, *outFace, interest);
+  this->sendInterest(pitEntry, FaceEndpoint(*outFace, 0), interest);
 
   // schedule RTO timeout
   PitInfo* pi = pitEntry->insertStrategyInfo<PitInfo>().first;
@@ -171,8 +169,8 @@
 
   Face* inFace = this->getFace(inFaceId);
   if (inFace == nullptr) {
-    NFD_LOG_DEBUG(pitEntry->getInterest() << " timeoutFrom " << firstOutFaceId <<
-                  " inFace-gone " << inFaceId);
+    NFD_LOG_DEBUG(pitEntry->getInterest() << " timeoutFrom " << firstOutFaceId
+                  << " inFace-gone " << inFaceId);
     return;
   }
 
@@ -185,8 +183,8 @@
   const Interest& interest = inRecord->getInterest();
   const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
 
-  NFD_LOG_DEBUG(pitEntry->getInterest() << " timeoutFrom " << firstOutFaceId <<
-                " multicast-except " << firstOutFaceId);
+  NFD_LOG_DEBUG(pitEntry->getInterest() << " timeoutFrom " << firstOutFaceId
+                << " multicast-except " << firstOutFaceId);
   this->multicast(*inFace, interest, pitEntry, fibEntry, firstOutFaceId);
 }
 
@@ -202,9 +200,8 @@
         wouldViolateScope(inFace, interest, outFace)) {
       continue;
     }
-    NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << outFace.getId() <<
-                  " multicast");
-    this->sendInterest(pitEntry, outFace, interest);
+    NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << outFace.getId() << " multicast");
+    this->sendInterest(pitEntry, FaceEndpoint(outFace, 0), interest);
     ++nSent;
   }
   return nSent;
@@ -212,7 +209,7 @@
 
 void
 AccessStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                                      const Face& inFace, const Data& data)
+                                      const FaceEndpoint& ingress, const Data& data)
 {
   PitInfo* pi = pitEntry->getStrategyInfo<PitInfo>();
   if (pi != nullptr) {
@@ -220,22 +217,20 @@
   }
 
   if (!pitEntry->hasInRecords()) { // already satisfied by another upstream
-    NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << inFace.getId() <<
-                  " not-fastest");
+    NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << ingress << " not-fastest");
     return;
   }
 
-  auto outRecord = pitEntry->getOutRecord(inFace, 0);
+  auto outRecord = pitEntry->getOutRecord(ingress.face, 0);
   if (outRecord == pitEntry->out_end()) { // no out-record
-    NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << inFace.getId() <<
-                  " no-out-record");
+    NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << ingress << " no-out-record");
     return;
   }
 
   auto rtt = time::steady_clock::now() - outRecord->getLastRenewed();
-  NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << inFace.getId() <<
-                " rtt=" << time::duration_cast<time::microseconds>(rtt).count());
-  this->updateMeasurements(inFace, data, time::duration_cast<RttEstimator::Duration>(rtt));
+  NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << ingress
+                << " rtt=" << time::duration_cast<time::microseconds>(rtt).count());
+  this->updateMeasurements(ingress.face, data, time::duration_cast<RttEstimator::Duration>(rtt));
 }
 
 void
diff --git a/daemon/fw/access-strategy.hpp b/daemon/fw/access-strategy.hpp
index cdb55e2..2dc1530 100644
--- a/daemon/fw/access-strategy.hpp
+++ b/daemon/fw/access-strategy.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,
@@ -43,6 +43,8 @@
  *     the granularity of this knowledge is the parent of Data Name.
  *  3. Forward subsequent Interests to the last working nexthop.
  *     If it doesn't respond, multicast again.
+ *
+ *  \note This strategy is not EndpointId-aware.
  */
 class AccessStrategy : public Strategy
 {
@@ -55,12 +57,12 @@
 
 public: // triggers
   void
-  afterReceiveInterest(const Face& inFace, const Interest& interest,
+  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
   beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                        const Face& inFace, const Data& data) override;
+                        const FaceEndpoint& ingress, const Data& data) override;
 
 private: // StrategyInfo
   /** \brief StrategyInfo on PIT entry
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index 67d6944..779daee 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -107,7 +107,7 @@
 }
 
 void
-AsfStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
+AsfStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                                   const shared_ptr<pit::Entry>& pitEntry)
 {
   // Should the Interest be suppressed?
@@ -118,7 +118,7 @@
   case RetxSuppressionResult::FORWARD:
     break;
   case RetxSuppressionResult::SUPPRESS:
-    NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " suppressed");
+    NFD_LOG_DEBUG(interest << " from=" << ingress << " suppressed");
     return;
   }
 
@@ -126,15 +126,15 @@
   const fib::NextHopList& nexthops = fibEntry.getNextHops();
 
   if (nexthops.size() == 0) {
-    sendNoRouteNack(inFace, interest, pitEntry);
+    sendNoRouteNack(ingress, interest, pitEntry);
     this->rejectPendingInterest(pitEntry);
     return;
   }
 
-  Face* faceToUse = getBestFaceForForwarding(fibEntry, interest, inFace);
+  Face* faceToUse = getBestFaceForForwarding(fibEntry, interest, ingress.face);
 
   if (faceToUse == nullptr) {
-    sendNoRouteNack(inFace, interest, pitEntry);
+    sendNoRouteNack(ingress, interest, pitEntry);
     this->rejectPendingInterest(pitEntry);
     return;
   }
@@ -145,7 +145,7 @@
 
   // If necessary, send probe
   if (m_probing.isProbingNeeded(fibEntry, interest)) {
-    Face* faceToProbe = m_probing.getFaceToProbe(inFace, interest, fibEntry, *faceToUse);
+    Face* faceToProbe = m_probing.getFaceToProbe(ingress.face, interest, fibEntry, *faceToUse);
 
     if (faceToProbe != nullptr) {
       bool wantNewNonce = true;
@@ -157,7 +157,7 @@
 
 void
 AsfStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                                   const Face& inFace, const Data& data)
+                                   const FaceEndpoint& ingress, const Data& data)
 {
   NamespaceInfo* namespaceInfo = m_measurements.getNamespaceInfo(pitEntry->getName());
 
@@ -167,14 +167,14 @@
   }
 
   // Record the RTT between the Interest out to Data in
-  FaceInfo* faceInfo = namespaceInfo->get(inFace.getId());
+  FaceInfo* faceInfo = namespaceInfo->get(ingress.face.getId());
   if (faceInfo == nullptr) {
     return;
   }
-  faceInfo->recordRtt(pitEntry, inFace);
+  faceInfo->recordRtt(pitEntry, ingress.face);
 
   // Extend lifetime for measurements associated with Face
-  namespaceInfo->extendFaceInfoLifetime(*faceInfo, inFace.getId());
+  namespaceInfo->extendFaceInfoLifetime(*faceInfo, ingress.face.getId());
 
   if (faceInfo->isTimeoutScheduled()) {
     faceInfo->cancelTimeoutEvent(data.getName());
@@ -182,11 +182,11 @@
 }
 
 void
-AsfStrategy::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+AsfStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                               const shared_ptr<pit::Entry>& pitEntry)
 {
-  NFD_LOG_DEBUG("Nack for " << nack.getInterest() << " from=" << inFace.getId() << ": " << nack.getReason());
-  onTimeout(pitEntry->getName(), inFace.getId());
+  NFD_LOG_DEBUG("Nack for " << nack.getInterest() << " from=" << ingress << ": reason=" << nack.getReason());
+  onTimeout(pitEntry->getName(), ingress.face.getId());
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -199,34 +199,35 @@
                              Face& outFace,
                              bool wantNewNonce)
 {
+  auto egress = FaceEndpoint(outFace, 0);
+
   if (wantNewNonce) {
     //Send probe: interest with new Nonce
     Interest probeInterest(interest);
     probeInterest.refreshNonce();
     NFD_LOG_TRACE("Sending probe for " << probeInterest << probeInterest.getNonce()
-                                       << " to FaceId: " << outFace.getId());
-    this->sendInterest(pitEntry, outFace, probeInterest);
+                  << " to: " << egress);
+    this->sendInterest(pitEntry, egress, probeInterest);
   }
   else {
-    this->sendInterest(pitEntry, outFace, interest);
+    this->sendInterest(pitEntry, egress, interest);
   }
 
-  FaceInfo& faceInfo = m_measurements.getOrCreateFaceInfo(fibEntry, interest, outFace.getId());
+  FaceInfo& faceInfo = m_measurements.getOrCreateFaceInfo(fibEntry, interest, egress.face.getId());
 
   // Refresh measurements since Face is being used for forwarding
   NamespaceInfo& namespaceInfo = m_measurements.getOrCreateNamespaceInfo(fibEntry, interest);
-  namespaceInfo.extendFaceInfoLifetime(faceInfo, outFace.getId());
+  namespaceInfo.extendFaceInfoLifetime(faceInfo, egress.face.getId());
 
   if (!faceInfo.isTimeoutScheduled()) {
     // Estimate and schedule timeout
     RttEstimator::Duration timeout = faceInfo.computeRto();
 
-    NFD_LOG_TRACE("Scheduling timeout for " << fibEntry.getPrefix()
-                                            << " FaceId: " << outFace.getId()
-                                            << " in " << time::duration_cast<time::milliseconds>(timeout) << " ms");
+    NFD_LOG_TRACE("Scheduling timeout for " << fibEntry.getPrefix() << " to: " << egress
+                  << " in " << time::duration_cast<time::milliseconds>(timeout) << " ms");
 
     scheduler::EventId id = scheduler::schedule(timeout,
-        bind(&AsfStrategy::onTimeout, this, interest.getName(), outFace.getId()));
+        bind(&AsfStrategy::onTimeout, this, interest.getName(), egress.face.getId()));
 
     faceInfo.setTimeoutEvent(id, interest.getName());
   }
@@ -356,14 +357,14 @@
 }
 
 void
-AsfStrategy::sendNoRouteNack(const Face& inFace, const Interest& interest,
+AsfStrategy::sendNoRouteNack(const FaceEndpoint& ingress, const Interest& interest,
                              const shared_ptr<pit::Entry>& pitEntry)
 {
-  NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " noNextHop");
+  NFD_LOG_DEBUG(interest << " from=" << ingress << " noNextHop");
 
   lp::NackHeader nackHeader;
   nackHeader.setReason(lp::NackReason::NO_ROUTE);
-  this->sendNack(pitEntry, inFace, nackHeader);
+  this->sendNack(pitEntry, ingress, nackHeader);
 }
 
 } // namespace asf
diff --git a/daemon/fw/asf-strategy.hpp b/daemon/fw/asf-strategy.hpp
index b58e656..2155d94 100644
--- a/daemon/fw/asf-strategy.hpp
+++ b/daemon/fw/asf-strategy.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,
@@ -40,6 +40,8 @@
  *  \see Vince Lehman, Ashlesh Gawande, Rodrigo Aldecoa, Dmitri Krioukov, Beichuan Zhang, Lixia Zhang, and Lan Wang,
  *       "An Experimental Investigation of Hyperbolic Routing with a Smart Forwarding Plane in NDN,"
  *       NDN Technical Report NDN-0042, 2016. http://named-data.net/techreports.html
+ *
+ *  \note This strategy is not EndpointId-aware.
  */
 class AsfStrategy : public Strategy
 {
@@ -52,15 +54,15 @@
 
 public: // triggers
   void
-  afterReceiveInterest(const Face& inFace, const Interest& interest,
+  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
   beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                        const Face& inFace, const Data& data) override;
+                        const FaceEndpoint& ingress, const Data& data) override;
 
   void
-  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                    const shared_ptr<pit::Entry>& pitEntry) override;
 
 private:
@@ -78,7 +80,7 @@
   onTimeout(const Name& interestName, const FaceId faceId);
 
   void
-  sendNoRouteNack(const Face& inFace, const Interest& interest, const shared_ptr<pit::Entry>& pitEntry);
+  sendNoRouteNack(const FaceEndpoint& ingress, const Interest& interest, const shared_ptr<pit::Entry>& pitEntry);
 
   void
   processParams(const PartialName& parsed);
diff --git a/daemon/fw/best-route-strategy.cpp b/daemon/fw/best-route-strategy.cpp
index dbf410b..658a17a 100644
--- a/daemon/fw/best-route-strategy.cpp
+++ b/daemon/fw/best-route-strategy.cpp
@@ -35,7 +35,7 @@
 }
 
 void
-BestRouteStrategyBase::afterReceiveInterest(const Face& inFace, const Interest& interest,
+BestRouteStrategyBase::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                                             const shared_ptr<pit::Entry>& pitEntry)
 {
   if (hasPendingOutRecords(*pitEntry)) {
@@ -46,9 +46,9 @@
   const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
   for (const auto& nexthop : fibEntry.getNextHops()) {
     Face& outFace = nexthop.getFace();
-    if (!wouldViolateScope(inFace, interest, outFace) &&
+    if (!wouldViolateScope(ingress.face, interest, outFace) &&
         canForwardToLegacy(*pitEntry, outFace)) {
-      this->sendInterest(pitEntry, outFace, interest);
+      this->sendInterest(pitEntry, FaceEndpoint(outFace, 0), interest);
       return;
     }
   }
diff --git a/daemon/fw/best-route-strategy.hpp b/daemon/fw/best-route-strategy.hpp
index 3cef907..e3cc60c 100644
--- a/daemon/fw/best-route-strategy.hpp
+++ b/daemon/fw/best-route-strategy.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  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,
@@ -35,7 +35,7 @@
 {
 public:
   void
-  afterReceiveInterest(const Face& inFace, const Interest& interest,
+  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
 protected:
@@ -52,6 +52,8 @@
  *  \note This strategy is superceded by Best Route strategy version 2,
  *        which allows consumer retransmissions. This version is kept for
  *        comparison purposes and is not recommended for general usage.
+ *
+ *  \note This strategy is not EndpointId-aware.
  */
 class BestRouteStrategy : public BestRouteStrategyBase
 {
diff --git a/daemon/fw/best-route-strategy2.cpp b/daemon/fw/best-route-strategy2.cpp
index 7a1f063..ebab2ef 100644
--- a/daemon/fw/best-route-strategy2.cpp
+++ b/daemon/fw/best-route-strategy2.cpp
@@ -124,13 +124,12 @@
 }
 
 void
-BestRouteStrategy2::afterReceiveInterest(const Face& inFace, const Interest& interest,
+BestRouteStrategy2::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                                          const shared_ptr<pit::Entry>& pitEntry)
 {
   RetxSuppressionResult suppression = m_retxSuppression.decidePerPitEntry(*pitEntry);
   if (suppression == RetxSuppressionResult::SUPPRESS) {
-    NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                           << " suppressed");
+    NFD_LOG_DEBUG(interest << " from=" << ingress << " suppressed");
     return;
   }
 
@@ -141,58 +140,55 @@
   if (suppression == RetxSuppressionResult::NEW) {
     // forward to nexthop with lowest cost except downstream
     it = std::find_if(nexthops.begin(), nexthops.end(), [&] (const auto& nexthop) {
-      return isNextHopEligible(inFace, interest, nexthop, pitEntry);
+      return isNextHopEligible(ingress.face, interest, nexthop, pitEntry);
     });
 
     if (it == nexthops.end()) {
-      NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " noNextHop");
+      NFD_LOG_DEBUG(interest << " from=" << ingress << " noNextHop");
 
       lp::NackHeader nackHeader;
       nackHeader.setReason(lp::NackReason::NO_ROUTE);
-      this->sendNack(pitEntry, inFace, nackHeader);
+      this->sendNack(pitEntry, ingress, nackHeader);
 
       this->rejectPendingInterest(pitEntry);
       return;
     }
 
-    Face& outFace = it->getFace();
-    this->sendInterest(pitEntry, outFace, interest);
-    NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                           << " newPitEntry-to=" << outFace.getId());
+    auto egress = FaceEndpoint(it->getFace(), 0);
+    this->sendInterest(pitEntry, egress, interest);
+    NFD_LOG_DEBUG(interest << " from=" << ingress << " newPitEntry-to=" << egress);
     return;
   }
 
   // find an unused upstream with lowest cost except downstream
   it = std::find_if(nexthops.begin(), nexthops.end(), [&] (const auto& nexthop) {
-    return isNextHopEligible(inFace, interest, nexthop, pitEntry, true, time::steady_clock::now());
+    return isNextHopEligible(ingress.face, interest, nexthop, pitEntry, true, time::steady_clock::now());
   });
 
   if (it != nexthops.end()) {
-    Face& outFace = it->getFace();
-    this->sendInterest(pitEntry, outFace, interest);
-    NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                           << " retransmit-unused-to=" << outFace.getId());
+    auto egress = FaceEndpoint(it->getFace(), 0);
+    this->sendInterest(pitEntry, egress, interest);
+    NFD_LOG_DEBUG(interest << " from=" << ingress << " retransmit-unused-to=" << egress);
     return;
   }
 
   // find an eligible upstream that is used earliest
-  it = findEligibleNextHopWithEarliestOutRecord(inFace, interest, nexthops, pitEntry);
+  it = findEligibleNextHopWithEarliestOutRecord(ingress.face, interest, nexthops, pitEntry);
   if (it == nexthops.end()) {
-    NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " retransmitNoNextHop");
+    NFD_LOG_DEBUG(interest << " from=" << ingress << " retransmitNoNextHop");
   }
   else {
-    Face& outFace = it->getFace();
-    this->sendInterest(pitEntry, outFace, interest);
-    NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                           << " retransmit-retry-to=" << outFace.getId());
+    auto egress = FaceEndpoint(it->getFace(), 0);
+    this->sendInterest(pitEntry, egress, interest);
+    NFD_LOG_DEBUG(interest << " from=" << ingress << " retransmit-retry-to=" << egress);
   }
 }
 
 void
-BestRouteStrategy2::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+BestRouteStrategy2::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                                      const shared_ptr<pit::Entry>& pitEntry)
 {
-  this->processNack(inFace, nack, pitEntry);
+  this->processNack(ingress.face, nack, pitEntry);
 }
 
 } // namespace fw
diff --git a/daemon/fw/best-route-strategy2.hpp b/daemon/fw/best-route-strategy2.hpp
index 8d1f144..598469f 100644
--- a/daemon/fw/best-route-strategy2.hpp
+++ b/daemon/fw/best-route-strategy2.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,
@@ -49,6 +49,8 @@
  *
  *  This strategy returns Nack to all downstreams if all upstreams have returned Nacks.
  *  The reason of the sent Nack equals the least severe reason among received Nacks.
+ *
+ *  \note This strategy is not EndpointId-aware.
  */
 class BestRouteStrategy2 : public Strategy
                          , public ProcessNackTraits<BestRouteStrategy2>
@@ -61,11 +63,11 @@
   getStrategyName();
 
   void
-  afterReceiveInterest(const Face& inFace, const Interest& interest,
+  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
-  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                    const shared_ptr<pit::Entry>& pitEntry) override;
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE:
diff --git a/daemon/fw/face-endpoint.hpp b/daemon/fw/face-endpoint.hpp
new file mode 100644
index 0000000..acfbc2e
--- /dev/null
+++ b/daemon/fw/face-endpoint.hpp
@@ -0,0 +1,57 @@
+/* -*- 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_FW_FACE_ENDPOINT_HPP
+#define NFD_DAEMON_FW_FACE_ENDPOINT_HPP
+
+#include "face/face.hpp"
+
+namespace nfd {
+
+/** \brief Represents a face-endpoint pair in the forwarder
+ */
+class FaceEndpoint
+{
+public:
+  FaceEndpoint(const Face& face, EndpointId endpoint)
+    : face(const_cast<Face&>(face))
+    , endpoint(endpoint)
+  {
+  }
+
+public:
+  Face& face;
+  const EndpointId endpoint;
+};
+
+inline std::ostream&
+operator<<(std::ostream& os, const FaceEndpoint& fe)
+{
+  return os << "(" << fe.face.getId() << "," << fe.endpoint << ")";
+}
+
+} // namespace nfd
+
+#endif // NFD_DAEMON_FW_FACE_ENDPOINT_HPP
\ No newline at end of file
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index f4e5ac9..508a890 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -53,19 +53,19 @@
   m_faceTable.afterAdd.connect([this] (Face& face) {
     face.afterReceiveInterest.connect(
       [this, &face] (const Interest& interest) {
-        this->startProcessInterest(face, interest);
+        this->startProcessInterest(FaceEndpoint(face, 0), interest);
       });
     face.afterReceiveData.connect(
       [this, &face] (const Data& data) {
-        this->startProcessData(face, data);
+        this->startProcessData(FaceEndpoint(face, 0), data);
       });
     face.afterReceiveNack.connect(
       [this, &face] (const lp::Nack& nack) {
-        this->startProcessNack(face, nack);
+        this->startProcessNack(FaceEndpoint(face, 0), nack);
       });
     face.onDroppedInterest.connect(
       [this, &face] (const Interest& interest) {
-        this->onDroppedInterest(face, interest);
+        this->onDroppedInterest(FaceEndpoint(face, 0), interest);
       });
   });
 
@@ -79,20 +79,19 @@
 Forwarder::~Forwarder() = default;
 
 void
-Forwarder::onIncomingInterest(Face& inFace, const Interest& interest)
+Forwarder::onIncomingInterest(const FaceEndpoint& ingress, const Interest& interest)
 {
   // receive Interest
-  NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() <<
-                " interest=" << interest.getName());
-  interest.setTag(make_shared<lp::IncomingFaceIdTag>(inFace.getId()));
+  NFD_LOG_DEBUG("onIncomingInterest in=" << ingress << " interest=" << interest.getName());
+  interest.setTag(make_shared<lp::IncomingFaceIdTag>(ingress.face.getId()));
   ++m_counters.nInInterests;
 
   // /localhost scope control
-  bool isViolatingLocalhost = inFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
+  bool isViolatingLocalhost = ingress.face.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
                               scope_prefix::LOCALHOST.isPrefixOf(interest.getName());
   if (isViolatingLocalhost) {
-    NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() <<
-                  " interest=" << interest.getName() << " violates /localhost");
+    NFD_LOG_DEBUG("onIncomingInterest in=" << ingress
+                  << " interest=" << interest.getName() << " violates /localhost");
     // (drop)
     return;
   }
@@ -101,15 +100,15 @@
   bool hasDuplicateNonceInDnl = m_deadNonceList.has(interest.getName(), interest.getNonce());
   if (hasDuplicateNonceInDnl) {
     // goto Interest loop pipeline
-    this->onInterestLoop(inFace, interest);
+    this->onInterestLoop(ingress, interest);
     return;
   }
 
   // strip forwarding hint if Interest has reached producer region
   if (!interest.getForwardingHint().empty() &&
       m_networkRegionTable.isInProducerRegion(interest.getForwardingHint())) {
-    NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() <<
-                  " interest=" << interest.getName() << " reaching-producer-region");
+    NFD_LOG_DEBUG("onIncomingInterest in=" << ingress
+                  << " interest=" << interest.getName() << " reaching-producer-region");
     const_cast<Interest&>(interest).setForwardingHint({});
   }
 
@@ -117,49 +116,47 @@
   shared_ptr<pit::Entry> pitEntry = m_pit.insert(interest).first;
 
   // detect duplicate Nonce in PIT entry
-  int dnw = fw::findDuplicateNonce(*pitEntry, interest.getNonce(), inFace);
+  int dnw = fw::findDuplicateNonce(*pitEntry, interest.getNonce(), ingress.face);
   bool hasDuplicateNonceInPit = dnw != fw::DUPLICATE_NONCE_NONE;
-  if (inFace.getLinkType() == ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
+  if (ingress.face.getLinkType() == ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
     // for p2p face: duplicate Nonce from same incoming face is not loop
     hasDuplicateNonceInPit = hasDuplicateNonceInPit && !(dnw & fw::DUPLICATE_NONCE_IN_SAME);
   }
   if (hasDuplicateNonceInPit) {
     // goto Interest loop pipeline
-    this->onInterestLoop(inFace, interest);
+    this->onInterestLoop(ingress, interest);
     return;
   }
 
   // is pending?
   if (!pitEntry->hasInRecords()) {
     m_cs.find(interest,
-              bind(&Forwarder::onContentStoreHit, this, std::ref(inFace), pitEntry, _1, _2),
-              bind(&Forwarder::onContentStoreMiss, this, std::ref(inFace), pitEntry, _1));
+              bind(&Forwarder::onContentStoreHit, this, ingress, pitEntry, _1, _2),
+              bind(&Forwarder::onContentStoreMiss, this, ingress, pitEntry, _1));
   }
   else {
-    this->onContentStoreMiss(inFace, pitEntry, interest);
+    this->onContentStoreMiss(ingress, pitEntry, interest);
   }
 }
 
 void
-Forwarder::onInterestLoop(Face& inFace, const Interest& interest)
+Forwarder::onInterestLoop(const FaceEndpoint& ingress, const Interest& interest)
 {
   // if multi-access or ad hoc face, drop
-  if (inFace.getLinkType() != ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
-    NFD_LOG_DEBUG("onInterestLoop face=" << inFace.getId() <<
-                  " interest=" << interest.getName() <<
-                  " drop");
+  if (ingress.face.getLinkType() != ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
+    NFD_LOG_DEBUG("onInterestLoop in=" << ingress
+                  << " interest=" << interest.getName() << " drop");
     return;
   }
 
-  NFD_LOG_DEBUG("onInterestLoop face=" << inFace.getId() <<
-                " interest=" << interest.getName() <<
-                " send-Nack-duplicate");
+  NFD_LOG_DEBUG("onInterestLoop in=" << ingress << " interest=" << interest.getName()
+                << " send-Nack-duplicate");
 
   // send Nack with reason=DUPLICATE
   // note: Don't enter outgoing Nack pipeline because it needs an in-record.
   lp::Nack nack(interest);
   nack.setReason(lp::NackReason::DUPLICATE);
-  inFace.sendNack(nack);
+  ingress.face.sendNack(nack);
 }
 
 static inline bool
@@ -169,14 +166,14 @@
 }
 
 void
-Forwarder::onContentStoreMiss(const Face& inFace, const shared_ptr<pit::Entry>& pitEntry,
-                              const Interest& interest)
+Forwarder::onContentStoreMiss(const FaceEndpoint& ingress,
+                              const shared_ptr<pit::Entry>& pitEntry, const Interest& interest)
 {
   NFD_LOG_DEBUG("onContentStoreMiss interest=" << interest.getName());
   ++m_counters.nCsMisses;
 
   // insert in-record
-  pitEntry->insertOrUpdateInRecord(const_cast<Face&>(inFace), 0, interest);
+  pitEntry->insertOrUpdateInRecord(ingress.face, ingress.endpoint, interest);
 
   // set PIT expiry timer to the time that the last PIT in-record expires
   auto lastExpiring = std::max_element(pitEntry->in_begin(), pitEntry->in_end(), &compare_InRecord_expiry);
@@ -192,18 +189,18 @@
       NFD_LOG_DEBUG("onContentStoreMiss interest=" << interest.getName() << " nexthop-faceid=" << nextHopFace->getId());
       // go to outgoing Interest pipeline
       // scope control is unnecessary, because privileged app explicitly wants to forward
-      this->onOutgoingInterest(pitEntry, *nextHopFace, interest);
+      this->onOutgoingInterest(pitEntry, FaceEndpoint(*nextHopFace, 0), interest);
     }
     return;
   }
 
   // dispatch to strategy: after incoming Interest
   this->dispatchToStrategy(*pitEntry,
-    [&] (fw::Strategy& strategy) { strategy.afterReceiveInterest(inFace, interest, pitEntry); });
+    [&] (fw::Strategy& strategy) { strategy.afterReceiveInterest(ingress, interest, pitEntry); });
 }
 
 void
-Forwarder::onContentStoreHit(const Face& inFace, const shared_ptr<pit::Entry>& pitEntry,
+Forwarder::onContentStoreHit(const FaceEndpoint& ingress, const shared_ptr<pit::Entry>& pitEntry,
                              const Interest& interest, const Data& data)
 {
   NFD_LOG_DEBUG("onContentStoreHit interest=" << interest.getName());
@@ -220,28 +217,28 @@
 
   // dispatch to strategy: after Content Store hit
   this->dispatchToStrategy(*pitEntry,
-    [&] (fw::Strategy& strategy) { strategy.afterContentStoreHit(pitEntry, inFace, data); });
+    [&] (fw::Strategy& strategy) { strategy.afterContentStoreHit(pitEntry, ingress, data); });
 }
 
 void
-Forwarder::onOutgoingInterest(const shared_ptr<pit::Entry>& pitEntry, Face& outFace, const Interest& interest)
+Forwarder::onOutgoingInterest(const shared_ptr<pit::Entry>& pitEntry,
+                              const FaceEndpoint& egress, const Interest& interest)
 {
-  NFD_LOG_DEBUG("onOutgoingInterest face=" << outFace.getId() <<
-                " interest=" << pitEntry->getName());
+  NFD_LOG_DEBUG("onOutgoingInterest out=" << egress << " interest=" << pitEntry->getName());
 
   // insert out-record
-  pitEntry->insertOrUpdateOutRecord(outFace, 0, interest);
+  pitEntry->insertOrUpdateOutRecord(egress.face, egress.endpoint, interest);
 
   // send Interest
-  outFace.sendInterest(interest);
+  egress.face.sendInterest(interest);
   ++m_counters.nOutInterests;
 }
 
 void
 Forwarder::onInterestFinalize(const shared_ptr<pit::Entry>& pitEntry)
 {
-  NFD_LOG_DEBUG("onInterestFinalize interest=" << pitEntry->getName() <<
-                (pitEntry->isSatisfied ? " satisfied" : " unsatisfied"));
+  NFD_LOG_DEBUG("onInterestFinalize interest=" << pitEntry->getName()
+                << (pitEntry->isSatisfied ? " satisfied" : " unsatisfied"));
 
   // Dead Nonce List insert if necessary
   this->insertDeadNonceList(*pitEntry, 0);
@@ -260,19 +257,18 @@
 }
 
 void
-Forwarder::onIncomingData(Face& inFace, const Data& data)
+Forwarder::onIncomingData(const FaceEndpoint& ingress, const Data& data)
 {
   // receive Data
-  NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() << " data=" << data.getName());
-  data.setTag(make_shared<lp::IncomingFaceIdTag>(inFace.getId()));
+  NFD_LOG_DEBUG("onIncomingData in=" << ingress << " data=" << data.getName());
+  data.setTag(make_shared<lp::IncomingFaceIdTag>(ingress.face.getId()));
   ++m_counters.nInData;
 
   // /localhost scope control
-  bool isViolatingLocalhost = inFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
+  bool isViolatingLocalhost = ingress.face.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
                               scope_prefix::LOCALHOST.isPrefixOf(data.getName());
   if (isViolatingLocalhost) {
-    NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() <<
-                  " data=" << data.getName() << " violates /localhost");
+    NFD_LOG_DEBUG("onIncomingData in=" << ingress << " data=" << data.getName() << " violates /localhost");
     // (drop)
     return;
   }
@@ -281,7 +277,7 @@
   pit::DataMatchResult pitMatches = m_pit.findAllDataMatches(data);
   if (pitMatches.size() == 0) {
     // goto Data unsolicited pipeline
-    this->onDataUnsolicited(inFace, data);
+    this->onDataUnsolicited(ingress, data);
     return;
   }
 
@@ -299,22 +295,22 @@
 
     // trigger strategy: after receive Data
     this->dispatchToStrategy(*pitEntry,
-      [&] (fw::Strategy& strategy) { strategy.afterReceiveData(pitEntry, inFace, data); });
+      [&] (fw::Strategy& strategy) { strategy.afterReceiveData(pitEntry, ingress, data); });
 
     // mark PIT satisfied
     pitEntry->isSatisfied = true;
     pitEntry->dataFreshnessPeriod = data.getFreshnessPeriod();
 
     // Dead Nonce List insert if necessary (for out-record of inFace)
-    this->insertDeadNonceList(*pitEntry, &inFace);
+    this->insertDeadNonceList(*pitEntry, &ingress.face);
 
     // delete PIT entry's out-record
-    pitEntry->deleteOutRecord(inFace, 0);
+    pitEntry->deleteOutRecord(ingress.face, ingress.endpoint);
   }
   // when more than one PIT entry is matched, trigger strategy: before satisfy Interest,
   // and send Data to all matched out faces
   else {
-    std::set<Face*> pendingDownstreams;
+    std::set<std::pair<Face*, EndpointId>> pendingDownstreams;
     auto now = time::steady_clock::now();
 
     for (const shared_ptr<pit::Entry>& pitEntry : pitMatches) {
@@ -323,7 +319,7 @@
       // remember pending downstreams
       for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
         if (inRecord.getExpiry() > now) {
-          pendingDownstreams.insert(&inRecord.getFace());
+          pendingDownstreams.emplace(&inRecord.getFace(), inRecord.getEndpointId());
         }
       }
 
@@ -332,62 +328,60 @@
 
       // invoke PIT satisfy callback
       this->dispatchToStrategy(*pitEntry,
-        [&] (fw::Strategy& strategy) { strategy.beforeSatisfyInterest(pitEntry, inFace, data); });
+        [&] (fw::Strategy& strategy) { strategy.beforeSatisfyInterest(pitEntry, ingress, data); });
 
       // mark PIT satisfied
       pitEntry->isSatisfied = true;
       pitEntry->dataFreshnessPeriod = data.getFreshnessPeriod();
 
       // Dead Nonce List insert if necessary (for out-record of inFace)
-      this->insertDeadNonceList(*pitEntry, &inFace);
+      this->insertDeadNonceList(*pitEntry, &ingress.face);
 
       // clear PIT entry's in and out records
       pitEntry->clearInRecords();
-      pitEntry->deleteOutRecord(inFace, 0);
+      pitEntry->deleteOutRecord(ingress.face, ingress.endpoint);
     }
 
     // foreach pending downstream
-    for (Face* pendingDownstream : pendingDownstreams) {
-      if (pendingDownstream->getId() == inFace.getId() &&
-          pendingDownstream->getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) {
+    for (const auto& pendingDownstream : pendingDownstreams) {
+      if (pendingDownstream.first->getId() == ingress.face.getId() &&
+          pendingDownstream.second == ingress.endpoint &&
+          pendingDownstream.first->getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) {
         continue;
       }
       // goto outgoing Data pipeline
-      this->onOutgoingData(data, *pendingDownstream);
+      this->onOutgoingData(data, FaceEndpoint(*pendingDownstream.first, pendingDownstream.second));
     }
   }
 }
 
 void
-Forwarder::onDataUnsolicited(Face& inFace, const Data& data)
+Forwarder::onDataUnsolicited(const FaceEndpoint& ingress, const Data& data)
 {
   // accept to cache?
-  fw::UnsolicitedDataDecision decision = m_unsolicitedDataPolicy->decide(inFace, data);
+  fw::UnsolicitedDataDecision decision = m_unsolicitedDataPolicy->decide(ingress.face, data);
   if (decision == fw::UnsolicitedDataDecision::CACHE) {
     // CS insert
     m_cs.insert(data, true);
   }
 
-  NFD_LOG_DEBUG("onDataUnsolicited face=" << inFace.getId() <<
-                " data=" << data.getName() <<
-                " decision=" << decision);
+  NFD_LOG_DEBUG("onDataUnsolicited in=" << ingress << " data=" << data.getName() << " decision=" << decision);
 }
 
 void
-Forwarder::onOutgoingData(const Data& data, Face& outFace)
+Forwarder::onOutgoingData(const Data& data, FaceEndpoint egress)
 {
-  if (outFace.getId() == face::INVALID_FACEID) {
-    NFD_LOG_WARN("onOutgoingData face=invalid data=" << data.getName());
+  if (egress.face.getId() == face::INVALID_FACEID) {
+    NFD_LOG_WARN("onOutgoingData out=(invalid) data=" << data.getName());
     return;
   }
-  NFD_LOG_DEBUG("onOutgoingData face=" << outFace.getId() << " data=" << data.getName());
+  NFD_LOG_DEBUG("onOutgoingData out=" << egress << " data=" << data.getName());
 
   // /localhost scope control
-  bool isViolatingLocalhost = outFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
+  bool isViolatingLocalhost = egress.face.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
                               scope_prefix::LOCALHOST.isPrefixOf(data.getName());
   if (isViolatingLocalhost) {
-    NFD_LOG_DEBUG("onOutgoingData face=" << outFace.getId() <<
-                  " data=" << data.getName() << " violates /localhost");
+    NFD_LOG_DEBUG("onOutgoingData out=" << egress << " data=" << data.getName() << " violates /localhost");
     // (drop)
     return;
   }
@@ -395,22 +389,21 @@
   // TODO traffic manager
 
   // send Data
-  outFace.sendData(data);
+  egress.face.sendData(data);
   ++m_counters.nOutData;
 }
 
 void
-Forwarder::onIncomingNack(Face& inFace, const lp::Nack& nack)
+Forwarder::onIncomingNack(const FaceEndpoint& ingress, const lp::Nack& nack)
 {
   // receive Nack
-  nack.setTag(make_shared<lp::IncomingFaceIdTag>(inFace.getId()));
+  nack.setTag(make_shared<lp::IncomingFaceIdTag>(ingress.face.getId()));
   ++m_counters.nInNacks;
 
   // if multi-access or ad hoc face, drop
-  if (inFace.getLinkType() != ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
-    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
-                  " nack=" << nack.getInterest().getName() <<
-                  "~" << nack.getReason() << " face-is-multi-access");
+  if (ingress.face.getLinkType() != ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
+    NFD_LOG_DEBUG("onIncomingNack in=" << ingress << " nack=" << nack.getInterest().getName()
+                  << "~" << nack.getReason() << " face-is-multi-access");
     return;
   }
 
@@ -418,34 +411,30 @@
   shared_ptr<pit::Entry> pitEntry = m_pit.find(nack.getInterest());
   // if no PIT entry found, drop
   if (pitEntry == nullptr) {
-    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
-                  " nack=" << nack.getInterest().getName() <<
-                  "~" << nack.getReason() << " no-PIT-entry");
+    NFD_LOG_DEBUG("onIncomingNack in=" << ingress << " nack=" << nack.getInterest().getName()
+                  << "~" << nack.getReason() << " no-PIT-entry");
     return;
   }
 
   // has out-record?
-  pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(inFace, 0);
+  pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(ingress.face, ingress.endpoint);
   // if no out-record found, drop
   if (outRecord == pitEntry->out_end()) {
-    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
-                  " nack=" << nack.getInterest().getName() <<
-                  "~" << nack.getReason() << " no-out-record");
+    NFD_LOG_DEBUG("onIncomingNack in=" << ingress << " nack=" << nack.getInterest().getName()
+                  << "~" << nack.getReason() << " no-out-record");
     return;
   }
 
   // if out-record has different Nonce, drop
   if (nack.getInterest().getNonce() != outRecord->getLastNonce()) {
-    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
-                  " nack=" << nack.getInterest().getName() <<
-                  "~" << nack.getReason() << " wrong-Nonce " <<
-                  nack.getInterest().getNonce() << "!=" << outRecord->getLastNonce());
+    NFD_LOG_DEBUG("onIncomingNack in=" << ingress << " nack=" << nack.getInterest().getName()
+                  << "~" << nack.getReason() << " wrong-Nonce " << nack.getInterest().getNonce()
+                  << "!=" << outRecord->getLastNonce());
     return;
   }
 
-  NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
-                " nack=" << nack.getInterest().getName() <<
-                "~" << nack.getReason() << " OK");
+  NFD_LOG_DEBUG("onIncomingNack in=" << ingress << " nack=" << nack.getInterest().getName()
+                << "~" << nack.getReason() << " OK");
 
   // record Nack on out-record
   outRecord->setIncomingNack(nack);
@@ -457,59 +446,59 @@
 
   // trigger strategy: after receive NACK
   this->dispatchToStrategy(*pitEntry,
-    [&] (fw::Strategy& strategy) { strategy.afterReceiveNack(inFace, nack, pitEntry); });
+    [&] (fw::Strategy& strategy) { strategy.afterReceiveNack(ingress, nack, pitEntry); });
 }
 
 void
-Forwarder::onOutgoingNack(const shared_ptr<pit::Entry>& pitEntry, const Face& outFace,
-                          const lp::NackHeader& nack)
+Forwarder::onOutgoingNack(const shared_ptr<pit::Entry>& pitEntry,
+                          const FaceEndpoint& egress, const lp::NackHeader& nack)
 {
-  if (outFace.getId() == face::INVALID_FACEID) {
-    NFD_LOG_WARN("onOutgoingNack face=invalid" <<
-                  " nack=" << pitEntry->getInterest().getName() <<
-                  "~" << nack.getReason() << " no-in-record");
+  if (egress.face.getId() == face::INVALID_FACEID) {
+    NFD_LOG_WARN("onOutgoingNack out=(invalid)"
+                 << " nack=" << pitEntry->getInterest().getName()
+                 << "~" << nack.getReason() << " no-in-record");
     return;
   }
 
   // has in-record?
-  pit::InRecordCollection::iterator inRecord = pitEntry->getInRecord(outFace, 0);
+  pit::InRecordCollection::iterator inRecord = pitEntry->getInRecord(egress.face, egress.endpoint);
 
   // if no in-record found, drop
   if (inRecord == pitEntry->in_end()) {
-    NFD_LOG_DEBUG("onOutgoingNack face=" << outFace.getId() <<
-                  " nack=" << pitEntry->getInterest().getName() <<
-                  "~" << nack.getReason() << " no-in-record");
+    NFD_LOG_DEBUG("onOutgoingNack out=" << egress
+                  << " nack=" << pitEntry->getInterest().getName()
+                  << "~" << nack.getReason() << " no-in-record");
     return;
   }
 
   // if multi-access or ad hoc face, drop
-  if (outFace.getLinkType() != ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
-    NFD_LOG_DEBUG("onOutgoingNack face=" << outFace.getId() <<
-                  " nack=" << pitEntry->getInterest().getName() <<
-                  "~" << nack.getReason() << " face-is-multi-access");
+  if (egress.face.getLinkType() != ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
+    NFD_LOG_DEBUG("onOutgoingNack out=" << egress
+                  << " nack=" << pitEntry->getInterest().getName()
+                  << "~" << nack.getReason() << " face-is-multi-access");
     return;
   }
 
-  NFD_LOG_DEBUG("onOutgoingNack face=" << outFace.getId() <<
-                " nack=" << pitEntry->getInterest().getName() <<
-                "~" << nack.getReason() << " OK");
+  NFD_LOG_DEBUG("onOutgoingNack out=" << egress
+                << " nack=" << pitEntry->getInterest().getName()
+                << "~" << nack.getReason() << " OK");
 
   // create Nack packet with the Interest from in-record
   lp::Nack nackPkt(inRecord->getInterest());
   nackPkt.setHeader(nack);
 
   // erase in-record
-  pitEntry->deleteInRecord(outFace, 0);
+  pitEntry->deleteInRecord(egress.face, egress.endpoint);
 
   // send Nack on face
-  const_cast<Face&>(outFace).sendNack(nackPkt);
+  egress.face.sendNack(nackPkt);
   ++m_counters.nOutNacks;
 }
 
 void
-Forwarder::onDroppedInterest(Face& outFace, const Interest& interest)
+Forwarder::onDroppedInterest(const FaceEndpoint& egress, const Interest& interest)
 {
-  m_strategyChoice.findEffectiveStrategy(interest.getName()).onDroppedInterest(outFace, interest);
+  m_strategyChoice.findEffectiveStrategy(interest.getName()).onDroppedInterest(egress, interest);
 }
 
 void
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index bcb3caf..ecc4d72 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.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,
@@ -30,6 +30,7 @@
 #include "core/scheduler.hpp"
 #include "forwarder-counters.hpp"
 #include "face-table.hpp"
+#include "face-endpoint.hpp"
 #include "unsolicited-data-policy.hpp"
 #include "table/fib.hpp"
 #include "table/pit.hpp"
@@ -105,33 +106,33 @@
 
 public: // forwarding entrypoints and tables
   /** \brief start incoming Interest processing
-   *  \param face face on which Interest is received
+   *  \param ingress face on which Interest is received and endpoint of the sender
    *  \param interest the incoming Interest, must be well-formed and created with make_shared
    */
   void
-  startProcessInterest(Face& face, const Interest& interest)
+  startProcessInterest(const FaceEndpoint& ingress, const Interest& interest)
   {
-    this->onIncomingInterest(face, interest);
+    this->onIncomingInterest(ingress, interest);
   }
 
   /** \brief start incoming Data processing
-   *  \param face face on which Data is received
+   *  \param ingress face on which Data is received and endpoint of the sender
    *  \param data the incoming Data, must be well-formed and created with make_shared
    */
   void
-  startProcessData(Face& face, const Data& data)
+  startProcessData(const FaceEndpoint& ingress, const Data& data)
   {
-    this->onIncomingData(face, data);
+    this->onIncomingData(ingress, data);
   }
 
   /** \brief start incoming Nack processing
-   *  \param face face on which Nack is received
+   *  \param ingress face on which Nack is received and endpoint of the sender
    *  \param nack the incoming Nack, must be well-formed
    */
   void
-  startProcessNack(Face& face, const lp::Nack& nack)
+  startProcessNack(const FaceEndpoint& ingress, const lp::Nack& nack)
   {
-    this->onIncomingNack(face, nack);
+    this->onIncomingNack(ingress, nack);
   }
 
   NameTree&
@@ -186,28 +187,30 @@
   /** \brief incoming Interest pipeline
    */
   VIRTUAL_WITH_TESTS void
-  onIncomingInterest(Face& inFace, const Interest& interest);
+  onIncomingInterest(const FaceEndpoint& ingress, const Interest& interest);
 
   /** \brief Interest loop pipeline
    */
   VIRTUAL_WITH_TESTS void
-  onInterestLoop(Face& inFace, const Interest& interest);
+  onInterestLoop(const FaceEndpoint& ingress, const Interest& interest);
 
   /** \brief Content Store miss pipeline
   */
   VIRTUAL_WITH_TESTS void
-  onContentStoreMiss(const Face& inFace, const shared_ptr<pit::Entry>& pitEntry, const Interest& interest);
+  onContentStoreMiss(const FaceEndpoint& ingress,
+                     const shared_ptr<pit::Entry>& pitEntry, const Interest& interest);
 
   /** \brief Content Store hit pipeline
   */
   VIRTUAL_WITH_TESTS void
-  onContentStoreHit(const Face& inFace, const shared_ptr<pit::Entry>& pitEntry,
+  onContentStoreHit(const FaceEndpoint& ingress, const shared_ptr<pit::Entry>& pitEntry,
                     const Interest& interest, const Data& data);
 
   /** \brief outgoing Interest pipeline
    */
   VIRTUAL_WITH_TESTS void
-  onOutgoingInterest(const shared_ptr<pit::Entry>& pitEntry, Face& outFace, const Interest& interest);
+  onOutgoingInterest(const shared_ptr<pit::Entry>& pitEntry,
+                     const FaceEndpoint& egress, const Interest& interest);
 
   /** \brief Interest finalize pipeline
    */
@@ -217,30 +220,31 @@
   /** \brief incoming Data pipeline
    */
   VIRTUAL_WITH_TESTS void
-  onIncomingData(Face& inFace, const Data& data);
+  onIncomingData(const FaceEndpoint& ingress, const Data& data);
 
   /** \brief Data unsolicited pipeline
    */
   VIRTUAL_WITH_TESTS void
-  onDataUnsolicited(Face& inFace, const Data& data);
+  onDataUnsolicited(const FaceEndpoint& ingress, const Data& data);
 
   /** \brief outgoing Data pipeline
    */
   VIRTUAL_WITH_TESTS void
-  onOutgoingData(const Data& data, Face& outFace);
+  onOutgoingData(const Data& data, FaceEndpoint egress);
 
   /** \brief incoming Nack pipeline
    */
   VIRTUAL_WITH_TESTS void
-  onIncomingNack(Face& inFace, const lp::Nack& nack);
+  onIncomingNack(const FaceEndpoint& ingress, const lp::Nack& nack);
 
   /** \brief outgoing Nack pipeline
    */
   VIRTUAL_WITH_TESTS void
-  onOutgoingNack(const shared_ptr<pit::Entry>& pitEntry, const Face& outFace, const lp::NackHeader& nack);
+  onOutgoingNack(const shared_ptr<pit::Entry>& pitEntry,
+                 const FaceEndpoint& egress, const lp::NackHeader& nack);
 
   VIRTUAL_WITH_TESTS void
-  onDroppedInterest(Face& outFace, const Interest& interest);
+  onDroppedInterest(const FaceEndpoint& egress, const Interest& interest);
 
 PROTECTED_WITH_TESTS_ELSE_PRIVATE:
   /** \brief set a new expiry timer (now + \p duration) on a PIT entry
diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp
index 7732e09..f22514a 100644
--- a/daemon/fw/multicast-strategy.cpp
+++ b/daemon/fw/multicast-strategy.cpp
@@ -63,7 +63,7 @@
 }
 
 void
-MulticastStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
+MulticastStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                                         const shared_ptr<pit::Entry>& pitEntry)
 {
   const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
@@ -79,20 +79,18 @@
     RetxSuppressionResult suppressResult = m_retxSuppression.decidePerUpstream(*pitEntry, outFace);
 
     if (suppressResult == RetxSuppressionResult::SUPPRESS) {
-      NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                    << "to=" << outFace.getId() << " suppressed");
+      NFD_LOG_DEBUG(interest << " from=" << ingress << " to=" << outFace.getId() << " suppressed");
       isSuppressed = true;
       continue;
     }
 
-    if ((outFace.getId() == inFace.getId() && outFace.getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) ||
-        wouldViolateScope(inFace, interest, outFace)) {
+    if ((outFace.getId() == ingress.face.getId() && outFace.getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) ||
+        wouldViolateScope(ingress.face, interest, outFace)) {
       continue;
     }
 
-    this->sendInterest(pitEntry, outFace, interest);
-    NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                           << " pitEntry-to=" << outFace.getId());
+    this->sendInterest(pitEntry, FaceEndpoint(outFace, 0), interest);
+    NFD_LOG_DEBUG(interest << " from=" << ingress << " pitEntry-to=" << outFace.getId());
 
     if (suppressResult == RetxSuppressionResult::FORWARD) {
       m_retxSuppression.incrementIntervalForOutRecord(*pitEntry->getOutRecord(outFace, 0));
@@ -101,21 +99,21 @@
   }
 
   if (nEligibleNextHops == 0 && !isSuppressed) {
-    NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " noNextHop");
+    NFD_LOG_DEBUG(interest << " from=" << ingress << " noNextHop");
 
     lp::NackHeader nackHeader;
     nackHeader.setReason(lp::NackReason::NO_ROUTE);
-    this->sendNack(pitEntry, inFace, nackHeader);
+    this->sendNack(pitEntry, ingress, nackHeader);
 
     this->rejectPendingInterest(pitEntry);
   }
 }
 
 void
-MulticastStrategy::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+MulticastStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                                     const shared_ptr<pit::Entry>& pitEntry)
 {
-  this->processNack(inFace, nack, pitEntry);
+  this->processNack(ingress.face, nack, pitEntry);
 }
 
 } // namespace fw
diff --git a/daemon/fw/multicast-strategy.hpp b/daemon/fw/multicast-strategy.hpp
index d75e3a1..15f0d0c 100644
--- a/daemon/fw/multicast-strategy.hpp
+++ b/daemon/fw/multicast-strategy.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,
@@ -34,6 +34,8 @@
 namespace fw {
 
 /** \brief a forwarding strategy that forwards Interest to all FIB nexthops
+ *
+ *  \note This strategy is not EndpointId-aware.
  */
 class MulticastStrategy : public Strategy
                         , public ProcessNackTraits<MulticastStrategy>
@@ -46,11 +48,11 @@
   getStrategyName();
 
   void
-  afterReceiveInterest(const Face& inFace, const Interest& interest,
+  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
-  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                    const shared_ptr<pit::Entry>& pitEntry) override;
 
 private:
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index 778ed2b..a6c1e99 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -59,7 +59,7 @@
 }
 
 void
-NccStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
+NccStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                                   const shared_ptr<pit::Entry>& pitEntry)
 {
   const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
@@ -83,13 +83,13 @@
 
   shared_ptr<Face> bestFace = meInfo.getBestFace();
   if (bestFace != nullptr && fibEntry.hasNextHop(*bestFace, 0) &&
-      !wouldViolateScope(inFace, interest, *bestFace) &&
+      !wouldViolateScope(ingress.face, interest, *bestFace) &&
       canForwardToLegacy(*pitEntry, *bestFace)) {
     // TODO Should we use `randlow = 100 + nrand48(h->seed) % 4096U;` ?
     deferFirst = meInfo.prediction;
     deferRange = time::microseconds((deferFirst.count() + 1) / 2);
     --nUpstreams;
-    this->sendInterest(pitEntry, *bestFace, interest);
+    this->sendInterest(pitEntry, FaceEndpoint(*bestFace, 0), interest);
     pitEntryInfo->bestFaceTimeout = scheduler::schedule(
       meInfo.prediction,
       bind(&NccStrategy::timeoutOnBestFace, this, weak_ptr<pit::Entry>(pitEntry)));
@@ -99,11 +99,11 @@
     auto firstEligibleNexthop = std::find_if(nexthops.begin(), nexthops.end(),
         [&] (const fib::NextHop& nexthop) {
           Face& outFace = nexthop.getFace();
-          return !wouldViolateScope(inFace, interest, outFace) &&
+          return !wouldViolateScope(ingress.face, interest, outFace) &&
                  canForwardToLegacy(*pitEntry, outFace);
         });
     if (firstEligibleNexthop != nexthops.end()) {
-      this->sendInterest(pitEntry, firstEligibleNexthop->getFace(), interest);
+      this->sendInterest(pitEntry, FaceEndpoint(firstEligibleNexthop->getFace(), 0), interest);
     }
     else {
       this->rejectPendingInterest(pitEntry);
@@ -113,7 +113,7 @@
 
   shared_ptr<Face> previousFace = meInfo.previousFace.lock();
   if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace, 0) &&
-      !wouldViolateScope(inFace, interest, *previousFace) &&
+      !wouldViolateScope(ingress.face, interest, *previousFace) &&
       canForwardToLegacy(*pitEntry, *previousFace)) {
     --nUpstreams;
   }
@@ -129,7 +129,7 @@
     pitEntryInfo->maxInterval = deferFirst;
   }
   pitEntryInfo->propagateTimer = scheduler::schedule(deferFirst,
-    bind(&NccStrategy::doPropagate, this, inFace.getId(), weak_ptr<pit::Entry>(pitEntry)));
+    bind(&NccStrategy::doPropagate, this, ingress.face.getId(), weak_ptr<pit::Entry>(pitEntry)));
 }
 
 void
@@ -161,7 +161,7 @@
   if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace, 0) &&
       !wouldViolateScope(*inFace, interest, *previousFace) &&
       canForwardToLegacy(*pitEntry, *previousFace)) {
-    this->sendInterest(pitEntry, *previousFace, interest);
+    this->sendInterest(pitEntry, FaceEndpoint(*previousFace, 0), interest);
   }
 
   bool isForwarded = false;
@@ -170,7 +170,7 @@
     if (!wouldViolateScope(*inFace, interest, face) &&
         canForwardToLegacy(*pitEntry, face)) {
       isForwarded = true;
-      this->sendInterest(pitEntry, face, interest);
+      this->sendInterest(pitEntry, FaceEndpoint(face, 0), interest);
       break;
     }
   }
@@ -208,7 +208,7 @@
 
 void
 NccStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                                   const Face& inFace, const Data& data)
+                                   const FaceEndpoint& ingress, const Data& data)
 {
   if (!pitEntry->hasInRecords()) {
     // PIT entry has already been satisfied (and is now waiting for straggler timer to expire)
@@ -226,7 +226,7 @@
     this->getMeasurements().extendLifetime(*measurementsEntry, MEASUREMENTS_LIFETIME);
 
     MeasurementsEntryInfo& meInfo = this->getMeasurementsEntryInfo(measurementsEntry);
-    meInfo.updateBestFace(inFace);
+    meInfo.updateBestFace(ingress.face);
 
     measurementsEntry = this->getMeasurements().getParent(*measurementsEntry);
   }
@@ -239,7 +239,7 @@
     MeasurementsEntryInfo& meInfo = this->getMeasurementsEntryInfo(pitEntry);
     shared_ptr<Face> bestFace = meInfo.getBestFace();
 
-    if (bestFace.get() == &inFace)
+    if (bestFace.get() == &ingress.face)
       scheduler::cancel(pitEntryInfo->bestFaceTimeout);
   }
 }
diff --git a/daemon/fw/ncc-strategy.hpp b/daemon/fw/ncc-strategy.hpp
index 7e63333..473a87d 100644
--- a/daemon/fw/ncc-strategy.hpp
+++ b/daemon/fw/ncc-strategy.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  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,
@@ -32,6 +32,8 @@
 namespace fw {
 
 /** \brief a forwarding strategy similar to CCNx 0.7.2
+ *
+ *  \note This strategy is not EndpointId-aware.
  */
 class NccStrategy : public Strategy
 {
@@ -42,13 +44,13 @@
   static const Name&
   getStrategyName();
 
-  virtual void
-  afterReceiveInterest(const Face& inFace, const Interest& interest,
+  void
+  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
-  virtual void
+  void
   beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                        const Face& inFace, const Data& data) override;
+                        const FaceEndpoint& ingress, const Data& data) override;
 
 PUBLIC_WITH_TESTS_ELSE_PROTECTED:
   /// StrategyInfo on measurements::Entry
@@ -104,7 +106,6 @@
       return 1001;
     }
 
-    virtual
     ~PitEntryInfo() override;
 
   public:
diff --git a/daemon/fw/process-nack-traits.hpp b/daemon/fw/process-nack-traits.hpp
index fe70183..86e31e1 100644
--- a/daemon/fw/process-nack-traits.hpp
+++ b/daemon/fw/process-nack-traits.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,
@@ -81,7 +81,7 @@
   sendNackForProcessNackTraits(const shared_ptr<pit::Entry>& pitEntry, const Face& outFace,
                                const lp::NackHeader& header) override
   {
-    m_strategy->sendNack(pitEntry, outFace, header);
+    m_strategy->sendNack(pitEntry, FaceEndpoint(outFace, 0), header);
   }
 
   void
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index 92f9ae3..12e6176 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -66,73 +66,74 @@
 }
 
 void
-SelfLearningStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
+SelfLearningStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                                            const shared_ptr<pit::Entry>& pitEntry)
 {
   const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
   const fib::NextHopList& nexthops = fibEntry.getNextHops();
 
   bool isNonDiscovery = interest.getTag<lp::NonDiscoveryTag>() != nullptr;
-  auto inRecordInfo = pitEntry->getInRecord(inFace, 0)->insertStrategyInfo<InRecordInfo>().first;
+  auto inRecordInfo = pitEntry->getInRecord(ingress.face, ingress.endpoint)->insertStrategyInfo<InRecordInfo>().first;
   if (isNonDiscovery) { // "non-discovery" Interest
     inRecordInfo->isNonDiscoveryInterest = true;
     if (nexthops.empty()) { // return NACK if no matching FIB entry exists
-      NFD_LOG_DEBUG("NACK non-discovery Interest=" << interest << " from=" << inFace.getId() << " noNextHop");
+      NFD_LOG_DEBUG("NACK non-discovery Interest=" << interest << " from=" << ingress << " noNextHop");
       lp::NackHeader nackHeader;
       nackHeader.setReason(lp::NackReason::NO_ROUTE);
-      this->sendNack(pitEntry, inFace, nackHeader);
+      this->sendNack(pitEntry, ingress, nackHeader);
       this->rejectPendingInterest(pitEntry);
     }
     else { // multicast it if matching FIB entry exists
-      multicastInterest(interest, inFace, pitEntry, nexthops);
+      multicastInterest(interest, ingress.face, pitEntry, nexthops);
     }
   }
   else { // "discovery" Interest
     inRecordInfo->isNonDiscoveryInterest = false;
     if (nexthops.empty()) { // broadcast it if no matching FIB entry exists
-      broadcastInterest(interest, inFace, pitEntry);
+      broadcastInterest(interest, ingress.face, pitEntry);
     }
     else { // multicast it with "non-discovery" mark if matching FIB entry exists
       interest.setTag(make_shared<lp::NonDiscoveryTag>(lp::EmptyValue{}));
-      multicastInterest(interest, inFace, pitEntry, nexthops);
+      multicastInterest(interest, ingress.face, pitEntry, nexthops);
     }
   }
 }
 
 void
 SelfLearningStrategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                                       const Face& inFace, const Data& data)
+                                       const FaceEndpoint& ingress, const Data& data)
 {
-  OutRecordInfo* outRecordInfo = pitEntry->getOutRecord(inFace, 0)->getStrategyInfo<OutRecordInfo>();
+  OutRecordInfo* outRecordInfo = pitEntry->getOutRecord(ingress.face, ingress.endpoint)->getStrategyInfo<OutRecordInfo>();
   if (outRecordInfo && outRecordInfo->isNonDiscoveryInterest) { // outgoing Interest was non-discovery
     if (!needPrefixAnn(pitEntry)) { // no need to attach a PA (common cases)
-      sendDataToAll(pitEntry, inFace, data);
+      sendDataToAll(pitEntry, ingress, data);
     }
     else { // needs a PA (to respond discovery Interest)
-      asyncProcessData(pitEntry, inFace, data);
+      asyncProcessData(pitEntry, ingress.face, data);
     }
   }
   else { // outgoing Interest was discovery
     auto paTag = data.getTag<lp::PrefixAnnouncementTag>();
     if (paTag != nullptr) {
-      addRoute(pitEntry, inFace, data, *paTag->get().getPrefixAnn());
+      addRoute(pitEntry, ingress.face, data, *paTag->get().getPrefixAnn());
     }
     else { // Data contains no PrefixAnnouncement, upstreams do not support self-learning
     }
-    sendDataToAll(pitEntry, inFace, data);
+    sendDataToAll(pitEntry, ingress, data);
   }
 }
 
 void
-SelfLearningStrategy::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+SelfLearningStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                                        const shared_ptr<pit::Entry>& pitEntry)
 {
-  NFD_LOG_DEBUG("Nack for " << nack.getInterest() << " from=" << inFace.getId() << ": " << nack.getReason());
+  NFD_LOG_DEBUG("Nack for " << nack.getInterest() << " from=" << ingress
+                << " reason=" << nack.getReason());
   if (nack.getReason() == lp::NackReason::NO_ROUTE) { // remove FIB entries
     BOOST_ASSERT(this->lookupFib(*pitEntry).hasNextHops());
     NFD_LOG_DEBUG("Send NACK to all downstreams");
     this->sendNacks(pitEntry, nack.getHeader());
-    renewRoute(nack.getInterest().getName(), inFace.getId(), 0_ms);
+    renewRoute(nack.getInterest().getName(), ingress.face.getId(), 0_ms);
   }
 }
 
@@ -145,7 +146,7 @@
         wouldViolateScope(inFace, interest, outFace) || outFace.getScope() == ndn::nfd::FACE_SCOPE_LOCAL) {
       continue;
     }
-    this->sendInterest(pitEntry, outFace, interest);
+    this->sendInterest(pitEntry, FaceEndpoint(outFace, 0), interest);
     pitEntry->getOutRecord(outFace, 0)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
     NFD_LOG_DEBUG("send discovery Interest=" << interest << " from="
                   << inFace.getId() << " to=" << outFace.getId());
@@ -163,7 +164,7 @@
         wouldViolateScope(inFace, interest, outFace)) {
       continue;
     }
-    this->sendInterest(pitEntry, outFace, interest);
+    this->sendInterest(pitEntry, FaceEndpoint(outFace, 0), interest);
     pitEntry->getOutRecord(outFace, 0)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
     NFD_LOG_DEBUG("send non-discovery Interest=" << interest << " from="
                   << inFace.getId() << " to=" << outFace.getId());
@@ -188,7 +189,7 @@
             if (pitEntry && inFace) {
               NFD_LOG_DEBUG("found PrefixAnnouncement=" << pa.getAnnouncedName());
               data.setTag(make_shared<lp::PrefixAnnouncementTag>(lp::PrefixAnnouncementHeader(pa)));
-              this->sendDataToAll(pitEntry, *inFace, data);
+              this->sendDataToAll(pitEntry, FaceEndpoint(*inFace, 0), data);
               this->setExpiryTimer(pitEntry, 0_ms);
             }
             else {
diff --git a/daemon/fw/self-learning-strategy.hpp b/daemon/fw/self-learning-strategy.hpp
index e0c3962..7265a9e 100644
--- a/daemon/fw/self-learning-strategy.hpp
+++ b/daemon/fw/self-learning-strategy.hpp
@@ -39,6 +39,8 @@
  *  then unicasts subsequent Interests along the learned path
  *
  *  \see https://redmine.named-data.net/attachments/864/Self-learning-strategy-v1.pdf
+ *
+ *  \note This strategy is not EndpointId-aware
  */
 class SelfLearningStrategy : public Strategy
 {
@@ -79,15 +81,15 @@
 
 public: // triggers
   void
-  afterReceiveInterest(const Face& inFace, const Interest& interest,
+  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
   afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                   const Face& inFace, const Data& data) override;
+                   const FaceEndpoint& ingress, const Data& data) override;
 
   void
-  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                    const shared_ptr<pit::Entry>& pitEntry) override;
 
 private: // operations
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 378e554..54574d7 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -96,8 +96,8 @@
   }
 
   unique_ptr<Strategy> instance = found->second(forwarder, instanceName);
-  NFD_LOG_DEBUG("create " << instanceName << " found=" << found->first <<
-                " created=" << instance->getInstanceName());
+  NFD_LOG_DEBUG("create " << instanceName << " found=" << found->first
+                << " created=" << instance->getInstanceName());
   BOOST_ASSERT(!instance->getInstanceName().empty());
   return instance;
 }
@@ -150,100 +150,103 @@
 
 void
 Strategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                                const Face& inFace, const Data& data)
+                                const FaceEndpoint& ingress, const Data& data)
 {
-  NFD_LOG_DEBUG("beforeSatisfyInterest pitEntry=" << pitEntry->getName() <<
-                " inFace=" << inFace.getId() << " data=" << data.getName());
+  NFD_LOG_DEBUG("beforeSatisfyInterest pitEntry=" << pitEntry->getName()
+                << " in=" << ingress << " data=" << data.getName());
 }
 
 void
 Strategy::afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
-                               const Face& inFace, const Data& data)
+                               const FaceEndpoint& ingress, const Data& data)
 {
-  NFD_LOG_DEBUG("afterContentStoreHit pitEntry=" << pitEntry->getName() <<
-                " inFace=" << inFace.getId() << " data=" << data.getName());
+  NFD_LOG_DEBUG("afterContentStoreHit pitEntry=" << pitEntry->getName()
+                << " in=" << ingress << " data=" << data.getName());
 
-  this->sendData(pitEntry, data, inFace);
+  this->sendData(pitEntry, data, ingress);
 }
 
 void
 Strategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                           const Face& inFace, const Data& data)
+                           const FaceEndpoint& ingress, const Data& data)
 {
-  NFD_LOG_DEBUG("afterReceiveData pitEntry=" << pitEntry->getName() <<
-                " inFace=" << inFace.getId() << " data=" << data.getName());
+  NFD_LOG_DEBUG("afterReceiveData pitEntry=" << pitEntry->getName()
+                << " in=" << ingress << " data=" << data.getName());
 
-  this->beforeSatisfyInterest(pitEntry, inFace, data);
+  this->beforeSatisfyInterest(pitEntry, ingress, data);
 
-  this->sendDataToAll(pitEntry, inFace, data);
+  this->sendDataToAll(pitEntry, ingress, data);
 }
 
 void
-Strategy::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+Strategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                            const shared_ptr<pit::Entry>& pitEntry)
 {
-  NFD_LOG_DEBUG("afterReceiveNack inFace=" << inFace.getId() <<
-                " pitEntry=" << pitEntry->getName());
+  NFD_LOG_DEBUG("afterReceiveNack in=" << ingress << " pitEntry=" << pitEntry->getName());
 }
 
 void
-Strategy::onDroppedInterest(const Face& outFace, const Interest& interest)
+Strategy::onDroppedInterest(const FaceEndpoint& egress, const Interest& interest)
 {
-  NFD_LOG_DEBUG("onDroppedInterest outFace=" << outFace.getId() << " name=" << interest.getName());
+  NFD_LOG_DEBUG("onDroppedInterest out=" << egress << " name=" << interest.getName());
 }
 
 void
-Strategy::sendData(const shared_ptr<pit::Entry>& pitEntry, const Data& data, const Face& outFace)
+Strategy::sendData(const shared_ptr<pit::Entry>& pitEntry, const Data& data,
+                   const FaceEndpoint& egress)
 {
   BOOST_ASSERT(pitEntry->getInterest().matchesData(data));
 
-  // delete the PIT entry's in-record based on outFace,
-  // since Data is sent to outFace from which the Interest was received
-  pitEntry->deleteInRecord(outFace, 0);
+  // delete the PIT entry's in-record based on egress,
+  // since Data is sent to face and endpoint from which the Interest was received
+  pitEntry->deleteInRecord(egress.face, egress.endpoint);
 
-  m_forwarder.onOutgoingData(data, *const_pointer_cast<Face>(outFace.shared_from_this()));
+  m_forwarder.onOutgoingData(data, egress);
 }
 
 void
-Strategy::sendDataToAll(const shared_ptr<pit::Entry>& pitEntry, const Face& inFace, const Data& data)
+Strategy::sendDataToAll(const shared_ptr<pit::Entry>& pitEntry,
+                        const FaceEndpoint& ingress, const Data& data)
 {
-  std::set<Face*> pendingDownstreams;
+  std::set<std::pair<Face*, EndpointId>> pendingDownstreams;
   auto now = time::steady_clock::now();
 
   // remember pending downstreams
   for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
     if (inRecord.getExpiry() > now) {
-      if (inRecord.getFace().getId() == inFace.getId() &&
+      if (inRecord.getFace().getId() == ingress.face.getId() &&
+          inRecord.getEndpointId() == ingress.endpoint &&
           inRecord.getFace().getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) {
         continue;
       }
-      pendingDownstreams.insert(&inRecord.getFace());
+      pendingDownstreams.emplace(&inRecord.getFace(), inRecord.getEndpointId());
     }
   }
 
-  for (const Face* pendingDownstream : pendingDownstreams) {
-    this->sendData(pitEntry, data, *pendingDownstream);
+  for (const auto& pendingDownstream : pendingDownstreams) {
+    this->sendData(pitEntry, data, FaceEndpoint(*pendingDownstream.first, pendingDownstream.second));
   }
 }
 
 void
 Strategy::sendNacks(const shared_ptr<pit::Entry>& pitEntry, const lp::NackHeader& header,
-                    std::initializer_list<const Face*> exceptFaces)
+                    std::initializer_list<FaceEndpoint> exceptFaceEndpoints)
 {
   // populate downstreams with all downstreams faces
-  std::unordered_set<const Face*> downstreams;
+  std::set<std::pair<Face*, EndpointId>> downstreams;
   std::transform(pitEntry->in_begin(), pitEntry->in_end(), std::inserter(downstreams, downstreams.end()),
-                 [] (const pit::InRecord& inR) { return &inR.getFace(); });
+                 [] (const pit::InRecord& inR) {
+                  return std::make_pair(&inR.getFace(), inR.getEndpointId());
+                 });
 
   // delete excluded faces
-  // .erase in a loop is more efficient than std::set_difference because that requires sorted range
-  for (const Face* exceptFace : exceptFaces) {
-    downstreams.erase(exceptFace);
+  for (const auto& exceptFaceEndpoint : exceptFaceEndpoints) {
+    downstreams.erase({&exceptFaceEndpoint.face, exceptFaceEndpoint.endpoint});
   }
 
   // send Nacks
-  for (const Face* downstream : downstreams) {
-    this->sendNack(pitEntry, *downstream, header);
+  for (const auto& downstream : downstreams) {
+    this->sendNack(pitEntry, FaceEndpoint(*downstream.first, downstream.second), header);
   }
   // warning: don't loop on pitEntry->getInRecords(), because in-record is deleted when sending Nack
 }
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 0df65b9..bb50556 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.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,
@@ -138,7 +138,7 @@
    *           may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.
    */
   virtual void
-  afterReceiveInterest(const Face& inFace, const Interest& interest,
+  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                        const shared_ptr<pit::Entry>& pitEntry) = 0;
 
   /** \brief trigger before PIT entry is satisfied
@@ -162,15 +162,15 @@
    */
   virtual void
   beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                        const Face& inFace, const Data& data);
+                        const FaceEndpoint& ingress, const Data& data);
 
   /** \brief trigger after a Data is matched in CS
    *
-   *  In the base class this method sends \p data to \p inFace
+   *  In the base class this method sends \p data to \p ingress
    */
   virtual void
   afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
-                       const Face& inFace, const Data& data);
+                       const FaceEndpoint& ingress, const Data& data);
 
   /** \brief trigger after Data is received
    *
@@ -197,7 +197,7 @@
    */
   virtual void
   afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                   const Face& inFace, const Data& data);
+                   const FaceEndpoint& ingress, const Data& data);
 
   /** \brief trigger after Nack is received
    *
@@ -221,7 +221,7 @@
    *           may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.
    */
   virtual void
-  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                    const shared_ptr<pit::Entry>& pitEntry);
 
   /** \brief trigger after Interest dropped for exceeding allowed retransmissions
@@ -229,39 +229,40 @@
    *  In the base class this method does nothing.
    */
   virtual void
-  onDroppedInterest(const Face& outFace, const Interest& interest);
+  onDroppedInterest(const FaceEndpoint& egress, const Interest& interest);
 
 protected: // actions
-  /** \brief send Interest to outFace
+  /** \brief send Interest to egress
    *  \param pitEntry PIT entry
-   *  \param outFace face through which to send out the Interest
+   *  \param egress face through which to send out the Interest and destination endpoint
    *  \param interest the Interest packet
    */
   VIRTUAL_WITH_TESTS void
-  sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& outFace,
-               const Interest& interest)
+  sendInterest(const shared_ptr<pit::Entry>& pitEntry,
+               const FaceEndpoint& egress, const Interest& interest)
   {
-    m_forwarder.onOutgoingInterest(pitEntry, outFace, interest);
+    m_forwarder.onOutgoingInterest(pitEntry, egress, interest);
   }
 
-  /** \brief send \p data to \p outFace
+  /** \brief send \p data to \p egress
    *  \param pitEntry PIT entry
    *  \param data the Data packet
-   *  \param outFace face through which to send out the Data
+   *  \param egress face through which to send out the Data and destination endpoint
    */
   VIRTUAL_WITH_TESTS void
-  sendData(const shared_ptr<pit::Entry>& pitEntry, const Data& data, const Face& outFace);
+  sendData(const shared_ptr<pit::Entry>& pitEntry, const Data& data, const FaceEndpoint& egress);
 
-  /** \brief send \p data to all matched and qualified faces
+  /** \brief send \p data to all matched and qualified face-endpoint pairs
    *
-   *  A matched face is qualified if it is ad-hoc or it is NOT \p inFace
+   *  A matched face is qualified if it is ad-hoc or it is NOT \p ingress
    *
    *  \param pitEntry PIT entry
-   *  \param inFace face through which the Data comes from
+   *  \param ingress face through which the Data comes from and endpoint of the sender
    *  \param data the Data packet
    */
   VIRTUAL_WITH_TESTS void
-  sendDataToAll(const shared_ptr<pit::Entry>& pitEntry, const Face& inFace, const Data& data);
+  sendDataToAll(const shared_ptr<pit::Entry>& pitEntry,
+                const FaceEndpoint& ingress, const Data& data);
 
   /** \brief schedule the PIT entry for immediate deletion
    *
@@ -275,30 +276,29 @@
     this->setExpiryTimer(pitEntry, 0_ms);
   }
 
-  /** \brief send Nack to outFace
+  /** \brief send Nack to egress
    *  \param pitEntry PIT entry
-   *  \param outFace face through which to send out the Nack
+   *  \param egress face through which to send out the Nack and destination endpoint
    *  \param header Nack header
    *
-   *  The outFace must have a PIT in-record, otherwise this method has no effect.
+   *  The egress must have a PIT in-record, otherwise this method has no effect.
    */
   VIRTUAL_WITH_TESTS void
-  sendNack(const shared_ptr<pit::Entry>& pitEntry, const Face& outFace,
-           const lp::NackHeader& header)
+  sendNack(const shared_ptr<pit::Entry>& pitEntry,
+           const FaceEndpoint& egress, const lp::NackHeader& header)
   {
-    m_forwarder.onOutgoingNack(pitEntry, outFace, header);
+    m_forwarder.onOutgoingNack(pitEntry, egress, header);
   }
 
-  /** \brief send Nack to every face that has an in-record,
-   *         except those in \p exceptFaces
+  /** \brief send Nack to every face-endpoint pair that has an in-record, except those in \p exceptFaceEndpoints
    *  \param pitEntry PIT entry
    *  \param header NACK header
-   *  \param exceptFaces list of faces that should be excluded from sending Nacks
+   *  \param exceptFaceEndpoints list of face-endpoint pairs that should be excluded from sending Nacks
    *  \note This is not an action, but a helper that invokes the sendNack action.
    */
   void
   sendNacks(const shared_ptr<pit::Entry>& pitEntry, const lp::NackHeader& header,
-            std::initializer_list<const Face*> exceptFaces = std::initializer_list<const Face*>());
+            std::initializer_list<FaceEndpoint> exceptFaceEndpoints = {});
 
   /** \brief Schedule the PIT entry to be erased after \p duration
    */
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index 933a431..80e2603 100644
--- a/tests/daemon/fw/best-route-strategy2.t.cpp
+++ b/tests/daemon/fw/best-route-strategy2.t.cpp
@@ -91,7 +91,7 @@
   // first Interest goes to nexthop with lowest FIB cost,
   // however face1 is downstream so it cannot be used
   pitEntry->insertOrUpdateInRecord(*face1, 0, *interest);
-  strategy.afterReceiveInterest(*face1, *interest, pitEntry);
+  strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
   BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
   BOOST_CHECK_EQUAL(strategy.sendInterestHistory.back().outFaceId, face2->getId());
 
@@ -103,7 +103,7 @@
   std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
   periodicalRetxFrom4 = [&] {
     pitEntry->insertOrUpdateInRecord(*face4, 0, *interest);
-    strategy.afterReceiveInterest(*face4, *interest, pitEntry);
+    strategy.afterReceiveInterest(FaceEndpoint(*face4, 0), *interest, pitEntry);
 
     size_t nSent = strategy.sendInterestHistory.size();
     if (nSent > nSentLast) {
@@ -135,7 +135,7 @@
   for (int i = 0; i < 3; ++i) {
     this->advanceClocks(TICK, BestRouteStrategy2::RETX_SUPPRESSION_MAX * 2);
     pitEntry->insertOrUpdateInRecord(*face5, 0, *interest);
-    strategy.afterReceiveInterest(*face5, *interest, pitEntry);
+    strategy.afterReceiveInterest(FaceEndpoint(*face5, 0), *interest, pitEntry);
   }
   BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 3);
   BOOST_CHECK_NE(strategy.sendInterestHistory[0].outFaceId, face1->getId());
diff --git a/tests/daemon/fw/dummy-strategy.cpp b/tests/daemon/fw/dummy-strategy.cpp
index 1dd79dd..4497ede 100644
--- a/tests/daemon/fw/dummy-strategy.cpp
+++ b/tests/daemon/fw/dummy-strategy.cpp
@@ -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,
@@ -54,13 +54,13 @@
 }
 
 void
-DummyStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
+DummyStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                                     const shared_ptr<pit::Entry>& pitEntry)
 {
   ++afterReceiveInterest_count;
 
   if (interestOutFace != nullptr) {
-    this->sendInterest(pitEntry, *interestOutFace, interest);
+    this->sendInterest(pitEntry, FaceEndpoint(*interestOutFace, 0), interest);
   }
   else {
     this->rejectPendingInterest(pitEntry);
@@ -69,31 +69,31 @@
 
 void
 DummyStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                                     const Face& inFace, const Data& data)
+                                     const FaceEndpoint& ingress, const Data& data)
 {
   ++beforeSatisfyInterest_count;
 }
 
 void
 DummyStrategy::afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
-                                    const Face& inFace, const Data& data)
+                                    const FaceEndpoint& ingress, const Data& data)
 {
   ++afterContentStoreHit_count;
 
-  Strategy::afterContentStoreHit(pitEntry, inFace, data);
+  Strategy::afterContentStoreHit(pitEntry, ingress, data);
 }
 
 void
 DummyStrategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                                const Face& inFace, const Data& data)
+                                const FaceEndpoint& ingress, const Data& data)
 {
   ++afterReceiveData_count;
 
-  Strategy::afterReceiveData(pitEntry, inFace, data);
+  Strategy::afterReceiveData(pitEntry, ingress, data);
 }
 
 void
-DummyStrategy::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+DummyStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                                 const shared_ptr<pit::Entry>& pitEntry)
 {
   ++afterReceiveNack_count;
diff --git a/tests/daemon/fw/dummy-strategy.hpp b/tests/daemon/fw/dummy-strategy.hpp
index 697d5ae..9a2445b 100644
--- a/tests/daemon/fw/dummy-strategy.hpp
+++ b/tests/daemon/fw/dummy-strategy.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,
@@ -37,6 +37,8 @@
  *
  *  DummyStrategy registers itself as /dummy-strategy/<max-version>, so that it can be instantiated
  *  with any version number. Aliases can be created with \p registerAs function.
+ *
+ *  \note This strategy is not EndpointId-aware.
  */
 class DummyStrategy : public fw::Strategy
 {
@@ -57,27 +59,27 @@
 
   /** \brief after receive Interest trigger
    *
-   *  If \p interestOutFace is not null, Interest is forwarded to that face via send Interest action;
+   *  If \p interestOutFace is not null, Interest is forwarded to that face and endpoint via send Interest action;
    *  otherwise, reject pending Interest action is invoked.
    */
   void
-  afterReceiveInterest(const Face& inFace, const Interest& interest,
+  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
   beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                        const Face& inFace, const Data& data) override;
+                        const FaceEndpoint& ingress, const Data& data) override;
 
   void
   afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
-                       const Face& inFace, const Data& data) override;
+                       const FaceEndpoint& ingress, const Data& data) override;
 
   void
   afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                   const Face& inFace, const Data& data) override;
+                   const FaceEndpoint& ingress, const Data& data) override;
 
   void
-  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                    const shared_ptr<pit::Entry>& pitEntry) override;
 
 protected:
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index b61c927..2c7c1d2 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -141,7 +141,7 @@
 
   auto interestA2 = makeInterest("/A");
   interestA2->setNonce(1698);
-  forwarder.onOutgoingInterest(pitA, *face2, *interestA2);
+  forwarder.onOutgoingInterest(pitA, FaceEndpoint(*face2, 0), *interestA2);
 
   pit::OutRecordCollection::iterator outA2 = pitA->getOutRecord(*face2, 0);
   BOOST_REQUIRE(outA2 != pitA->out_end());
@@ -183,7 +183,7 @@
   }
 
   void
-  onDataUnsolicited(Face& inFace, const Data& data) override
+  onDataUnsolicited(const FaceEndpoint& ingress, const Data& data) override
   {
     ++onDataUnsolicited_count;
   }
@@ -211,49 +211,49 @@
   // local face, /localhost: OK
   forwarder.dispatchToStrategy_count = 0;
   shared_ptr<Interest> i1 = makeInterest("/localhost/A1");
-  forwarder.onIncomingInterest(*face1, *i1);
+  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i1);
   BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
 
   // non-local face, /localhost: violate
   forwarder.dispatchToStrategy_count = 0;
   shared_ptr<Interest> i2 = makeInterest("/localhost/A2");
-  forwarder.onIncomingInterest(*face2, *i2);
+  forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i2);
   BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 0);
 
   // local face, non-/localhost: OK
   forwarder.dispatchToStrategy_count = 0;
   shared_ptr<Interest> i3 = makeInterest("/A3");
-  forwarder.onIncomingInterest(*face1, *i3);
+  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i3);
   BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
 
   // non-local face, non-/localhost: OK
   forwarder.dispatchToStrategy_count = 0;
   shared_ptr<Interest> i4 = makeInterest("/A4");
-  forwarder.onIncomingInterest(*face2, *i4);
+  forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i4);
   BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
 
   // local face, /localhost: OK
   forwarder.onDataUnsolicited_count = 0;
   shared_ptr<Data> d1 = makeData("/localhost/B1");
-  forwarder.onIncomingData(*face1, *d1);
+  forwarder.onIncomingData(FaceEndpoint(*face1, 0), *d1);
   BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 1);
 
   // non-local face, /localhost: OK
   forwarder.onDataUnsolicited_count = 0;
   shared_ptr<Data> d2 = makeData("/localhost/B2");
-  forwarder.onIncomingData(*face2, *d2);
+  forwarder.onIncomingData(FaceEndpoint(*face2, 0), *d2);
   BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 0);
 
   // local face, non-/localhost: OK
   forwarder.onDataUnsolicited_count = 0;
   shared_ptr<Data> d3 = makeData("/B3");
-  forwarder.onIncomingData(*face1, *d3);
+  forwarder.onIncomingData(FaceEndpoint(*face1, 0), *d3);
   BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 1);
 
   // non-local face, non-/localhost: OK
   forwarder.onDataUnsolicited_count = 0;
   shared_ptr<Data> d4 = makeData("/B4");
-  forwarder.onIncomingData(*face2, *d4);
+  forwarder.onIncomingData(FaceEndpoint(*face2, 0), *d4);
   BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 1);
 }
 
@@ -271,33 +271,33 @@
   shared_ptr<Interest> interest1 = makeInterest("ndn:/A/1");
   strategyA.afterReceiveInterest_count = 0;
   strategyA.interestOutFace = face2;
-  forwarder.startProcessInterest(*face1, *interest1);
+  forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest1);
   BOOST_CHECK_EQUAL(strategyA.afterReceiveInterest_count, 1);
 
   shared_ptr<Interest> interest2 = makeInterest("ndn:/B/2");
   strategyB.afterReceiveInterest_count = 0;
   strategyB.interestOutFace = face2;
-  forwarder.startProcessInterest(*face1, *interest2);
+  forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest2);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveInterest_count, 1);
 
   this->advanceClocks(time::milliseconds(1), time::milliseconds(5));
 
   shared_ptr<Data> data1 = makeData("ndn:/A/1/a");
   strategyA.beforeSatisfyInterest_count = 0;
-  forwarder.startProcessData(*face2, *data1);
+  forwarder.startProcessData(FaceEndpoint(*face2, 0), *data1);
   BOOST_CHECK_EQUAL(strategyA.beforeSatisfyInterest_count, 1);
 
   shared_ptr<Data> data2 = makeData("ndn:/B/2/b");
   strategyB.beforeSatisfyInterest_count = 0;
-  forwarder.startProcessData(*face2, *data2);
+  forwarder.startProcessData(FaceEndpoint(*face2, 0), *data2);
   BOOST_CHECK_EQUAL(strategyB.beforeSatisfyInterest_count, 1);
 
   shared_ptr<Interest> interest3 = makeInterest("ndn:/A/3");
   interest3->setInterestLifetime(time::milliseconds(30));
-  forwarder.startProcessInterest(*face1, *interest3);
+  forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest3);
   shared_ptr<Interest> interest4 = makeInterest("ndn:/B/4");
   interest4->setInterestLifetime(time::milliseconds(5000));
-  forwarder.startProcessInterest(*face1, *interest4);
+  forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest4);
 }
 
 BOOST_AUTO_TEST_CASE(IncomingData)
@@ -326,7 +326,7 @@
   pitC->insertOrUpdateInRecord(*face4, 0, *interestC);
 
   shared_ptr<Data> dataD = makeData("ndn:/A/B/C/D");
-  forwarder.onIncomingData(*face3, *dataD);
+  forwarder.onIncomingData(FaceEndpoint(*face3, 0), *dataD);
   this->advanceClocks(time::milliseconds(1), time::milliseconds(5));
 
   BOOST_CHECK_EQUAL(face1->sentData.size(), 1);
@@ -364,14 +364,14 @@
   lp::Nack nack1 = makeNack("/A/AYJqayrzF", 562, lp::NackReason::CONGESTION);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(*face1, nack1);
+  forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack1);
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 1);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
 
   lp::Nack nack2 = makeNack("/B/EVyP73ru", 221, lp::NackReason::CONGESTION);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(*face1, nack2);
+  forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack2);
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 1);
 
@@ -385,7 +385,7 @@
   lp::Nack nack3 = makeNack("/yEcw5HhdM", 243, lp::NackReason::CONGESTION);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(*face1, nack3);
+  forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack3);
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
 
@@ -397,7 +397,7 @@
   lp::Nack nack4a = makeNack("/Etab4KpY", 157, lp::NackReason::CONGESTION);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(*face2, nack4a);
+  forwarder.onIncomingNack(FaceEndpoint(*face2, 0), nack4a);
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
 
@@ -405,7 +405,7 @@
   lp::Nack nack4b = makeNack("/Etab4KpY", 294, lp::NackReason::CONGESTION);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(*face1, nack4b);
+  forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack4b);
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
 
@@ -413,7 +413,7 @@
   pit4->insertOrUpdateOutRecord(*face3, 0, *interest4);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(*face3, nack4a);
+  forwarder.onIncomingNack(FaceEndpoint(*face3, 0), nack4a);
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
 }
@@ -442,7 +442,7 @@
   pit1->insertOrUpdateInRecord(*face1, 0, *interest1);
 
   face2->sentNacks.clear();
-  forwarder.onOutgoingNack(pit1, *face2, nackHeader);
+  forwarder.onOutgoingNack(pit1, FaceEndpoint(*face2, 0), nackHeader);
   BOOST_CHECK_EQUAL(face2->sentNacks.size(), 0);
 
   // send Nack with correct Nonce
@@ -453,7 +453,7 @@
   pit2->insertOrUpdateInRecord(*face2, 0, *interest2b);
 
   face1->sentNacks.clear();
-  forwarder.onOutgoingNack(pit2, *face1, nackHeader);
+  forwarder.onOutgoingNack(pit2, FaceEndpoint(*face1, 0), nackHeader);
   BOOST_REQUIRE_EQUAL(face1->sentNacks.size(), 1);
   BOOST_CHECK_EQUAL(face1->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
   BOOST_CHECK_EQUAL(face1->sentNacks.back().getInterest().getNonce(), 152);
@@ -464,7 +464,7 @@
 
   // send Nack with correct Nonce
   face2->sentNacks.clear();
-  forwarder.onOutgoingNack(pit2, *face2, nackHeader);
+  forwarder.onOutgoingNack(pit2, FaceEndpoint(*face2, 0), nackHeader);
   BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
   BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
   BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest().getNonce(), 808);
@@ -478,7 +478,7 @@
   pit2->insertOrUpdateInRecord(*face3, 0, *interest2c);
 
   face3->sentNacks.clear();
-  forwarder.onOutgoingNack(pit1, *face3, nackHeader);
+  forwarder.onOutgoingNack(pit1, FaceEndpoint(*face3, 0), nackHeader);
   BOOST_CHECK_EQUAL(face3->sentNacks.size(), 0);
 }
 
@@ -586,7 +586,7 @@
   Pit& pit = forwarder.getPit();
   BOOST_REQUIRE_EQUAL(pit.size(), 0);
 
-  forwarder.startProcessInterest(*face1, *interest);
+  forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest);
   this->advanceClocks(time::milliseconds(100), time::seconds(20));
   BOOST_CHECK_EQUAL(pit.size(), 0);
 }
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index 09eeac7..1ee1ae9 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -78,7 +78,7 @@
   shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face3, 0, *interest);
 
-  strategy.afterReceiveInterest(*face3, *interest, pitEntry);
+  strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
   BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
   BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 2);
   std::set<FaceId> sentInterestFaceIds;
@@ -102,7 +102,7 @@
   std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
   periodicalRetxFrom4 = [&] {
     pitEntry->insertOrUpdateInRecord(*face3, 0, *interest);
-    strategy.afterReceiveInterest(*face3, *interest, pitEntry);
+    strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
 
     size_t nSent = strategy.sendInterestHistory.size();
     if (nSent > nSentLast) {
@@ -130,7 +130,7 @@
   shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face1, 0, *interest);
 
-  strategy.afterReceiveInterest(*face1, *interest, pitEntry);
+  strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
   BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
   BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 0);
 }
diff --git a/tests/daemon/fw/ncc-strategy.t.cpp b/tests/daemon/fw/ncc-strategy.t.cpp
index fed914c..1b71aa2 100644
--- a/tests/daemon/fw/ncc-strategy.t.cpp
+++ b/tests/daemon/fw/ncc-strategy.t.cpp
@@ -75,7 +75,7 @@
   shared_ptr<pit::Entry> pitEntry1 = pit.insert(interest1).first;
 
   pitEntry1->insertOrUpdateInRecord(*face3, 0, interest1);
-  strategy.afterReceiveInterest(*face3, interest1, pitEntry1);
+  strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), interest1, pitEntry1);
 
   // forwards to face1 because routing says it's best
   // (no io run here: afterReceiveInterest has already sent the Interest)
@@ -90,7 +90,7 @@
   // face2 responds
   shared_ptr<Data> data1p = makeData("ndn:/0Jm1ajrW/%00");
   Data& data1 = *data1p;
-  strategy.beforeSatisfyInterest(pitEntry1, *face2, data1);
+  strategy.beforeSatisfyInterest(pitEntry1, FaceEndpoint(*face2, 0), data1);
   this->advanceClocks(time::milliseconds(10), time::milliseconds(500));
 
   // second Interest: strategy knows face2 is best
@@ -100,7 +100,7 @@
   shared_ptr<pit::Entry> pitEntry2 = pit.insert(interest2).first;
 
   pitEntry2->insertOrUpdateInRecord(*face3, 0, interest2);
-  strategy.afterReceiveInterest(*face3, interest2, pitEntry2);
+  strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), interest2, pitEntry2);
 
   // forwards to face2 because it responds previously
   this->advanceClocks(time::milliseconds(1));
@@ -132,7 +132,7 @@
   shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
 
   pitEntry1->insertOrUpdateInRecord(*face3, 0, *interest1);
-  strategy.afterReceiveInterest(*face3, *interest1, pitEntry1);
+  strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest1, pitEntry1);
 
   this->advanceClocks(time::milliseconds(1));
   BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
@@ -140,7 +140,7 @@
 
   // face1 responds
   shared_ptr<Data> data1 = makeData("ndn:/nztwIvHX/%00");
-  strategy.beforeSatisfyInterest(pitEntry1, *face1, *data1);
+  strategy.beforeSatisfyInterest(pitEntry1, FaceEndpoint(*face1, 0), *data1);
   this->advanceClocks(time::milliseconds(10), time::milliseconds(500));
 
   // second Interest: bestFace is face1, nUpstreams becomes 0,
@@ -150,7 +150,7 @@
   shared_ptr<pit::Entry> pitEntry2 = pit.insert(*interest2).first;
 
   pitEntry2->insertOrUpdateInRecord(*face3, 0, *interest2);
-  strategy.afterReceiveInterest(*face3, *interest2, pitEntry2);
+  strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest2, pitEntry2);
 
   // FIB entry is changed before doPropagate executes
   fibEntry.addOrUpdateNextHop(*face2, 0, 20);
@@ -184,7 +184,7 @@
   shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
 
   pitEntry1->insertOrUpdateInRecord(*face3, 0, *interest1);
-  strategy.afterReceiveInterest(*face3, *interest1, pitEntry1);
+  strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest1, pitEntry1);
   limitedIo.run(2 - strategy.sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
   BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 2);
@@ -193,11 +193,11 @@
 
   // face1 responds
   shared_ptr<Data> data1 = makeData("ndn:/seRMz5a6/%00");
-  strategy.beforeSatisfyInterest(pitEntry1, *face1, *data1);
+  strategy.beforeSatisfyInterest(pitEntry1, FaceEndpoint(*face1, 0), *data1);
   pitEntry1->clearInRecords();
   this->advanceClocks(time::milliseconds(10));
   // face2 also responds
-  strategy.beforeSatisfyInterest(pitEntry1, *face2, *data1);
+  strategy.beforeSatisfyInterest(pitEntry1, FaceEndpoint(*face2, 0), *data1);
   this->advanceClocks(time::milliseconds(10));
 
   // second Interest: bestFace should be face 1
@@ -206,7 +206,7 @@
   shared_ptr<pit::Entry> pitEntry2 = pit.insert(*interest2).first;
 
   pitEntry2->insertOrUpdateInRecord(*face3, 0, *interest2);
-  strategy.afterReceiveInterest(*face3, *interest2, pitEntry2);
+  strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest2, pitEntry2);
   limitedIo.run(3 - strategy.sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
 
@@ -238,7 +238,7 @@
   shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
 
   pitEntry1->insertOrUpdateInRecord(*face1, 0, *interest1);
-  strategy.afterReceiveInterest(*face1, *interest1, pitEntry1);
+  strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest1, pitEntry1);
   limitedIo.run(1 - strategy.sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
   BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
@@ -247,14 +247,14 @@
   // face2 responds
   shared_ptr<Data> data1 = makeData("ndn:/M4mBXCsd");
   data1->setFreshnessPeriod(time::milliseconds(5));
-  strategy.beforeSatisfyInterest(pitEntry1, *face2, *data1);
+  strategy.beforeSatisfyInterest(pitEntry1, FaceEndpoint(*face2, 0), *data1);
   pitEntry1->deleteOutRecord(*face2, 0);
   pitEntry1->clearInRecords();
   this->advanceClocks(time::milliseconds(10));
 
   // similar Interest: strategy should still forward it
   pitEntry1->insertOrUpdateInRecord(*face1, 0, *interest1);
-  strategy.afterReceiveInterest(*face1, *interest1, pitEntry1);
+  strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest1, pitEntry1);
   limitedIo.run(2 - strategy.sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
   BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 2);
@@ -283,7 +283,7 @@
   shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
   pitEntry1->insertOrUpdateInRecord(*face1, 0, *interest1);
 
-  strategy.afterReceiveInterest(*face1, *interest1, pitEntry1);
+  strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest1, pitEntry1);
 
   // Interest shall go to face2, not loop back to face1
   BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
diff --git a/tests/daemon/fw/pit-expiry.t.cpp b/tests/daemon/fw/pit-expiry.t.cpp
index b8c0418..1e0b599 100644
--- a/tests/daemon/fw/pit-expiry.t.cpp
+++ b/tests/daemon/fw/pit-expiry.t.cpp
@@ -62,10 +62,10 @@
   }
 
   void
-  afterReceiveInterest(const Face& inFace, const Interest& interest,
+  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                        const shared_ptr<pit::Entry>& pitEntry) override
   {
-    DummyStrategy::afterReceiveInterest(inFace, interest, pitEntry);
+    DummyStrategy::afterReceiveInterest(ingress, interest, pitEntry);
 
     if (afterReceiveInterest_count <= 1) {
       setExpiryTimer(pitEntry, 190_ms);
@@ -74,9 +74,9 @@
 
   void
   beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                        const Face& inFace, const Data& data) override
+                        const FaceEndpoint& ingress, const Data& data) override
   {
-    DummyStrategy::beforeSatisfyInterest(pitEntry, inFace, data);
+    DummyStrategy::beforeSatisfyInterest(pitEntry, ingress, data);
 
     if (beforeSatisfyInterest_count <= 2) {
       setExpiryTimer(pitEntry, 190_ms);
@@ -85,18 +85,18 @@
 
   void
   afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
-                       const Face& inFace, const Data& data) override
+                       const FaceEndpoint& ingress, const Data& data) override
   {
     if (afterContentStoreHit_count == 0) {
       setExpiryTimer(pitEntry, 190_ms);
     }
 
-    DummyStrategy::afterContentStoreHit(pitEntry, inFace, data);
+    DummyStrategy::afterContentStoreHit(pitEntry, ingress, data);
   }
 
   void
   afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                   const Face& inFace, const Data& data) override
+                   const FaceEndpoint& ingress, const Data& data) override
   {
     ++afterReceiveData_count;
 
@@ -104,14 +104,14 @@
       setExpiryTimer(pitEntry, 290_ms);
     }
 
-    this->sendDataToAll(pitEntry, inFace, data);
+    this->sendDataToAll(pitEntry, ingress, data);
   }
 
   void
-  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
                    const shared_ptr<pit::Entry>& pitEntry) override
   {
-    DummyStrategy::afterReceiveNack(inFace, nack, pitEntry);
+    DummyStrategy::afterReceiveNack(ingress, nack, pitEntry);
 
     if (afterReceiveNack_count <= 1) {
       setExpiryTimer(pitEntry, 50_ms);
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index ed2e9e1..86c47f6 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -111,7 +111,7 @@
   pitEntry->getOutRecord(*this->face3, 0)->setIncomingNack(nack3);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveNack(*this->face3, nack3, pitEntry); },
+    [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->face3, 0), nack3, pitEntry); },
     this->limitedIo, 2));
 
   BOOST_REQUIRE_EQUAL(this->strategy.sendNackHistory.size(), 2);
@@ -143,14 +143,14 @@
 
   lp::Nack nack3 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
   pitEntry->getOutRecord(*this->face3, 0)->setIncomingNack(nack3);
-  this->strategy.afterReceiveNack(*this->face3, nack3, pitEntry);
+  this->strategy.afterReceiveNack(FaceEndpoint(*this->face3, 0), nack3, pitEntry);
 
   BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked
 
   lp::Nack nack4 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
   pitEntry->getOutRecord(*this->face4, 0)->setIncomingNack(nack4);
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveNack(*this->face4, nack4, pitEntry); },
+    [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->face4, 0), nack4, pitEntry); },
     this->limitedIo));
 
   BOOST_REQUIRE_EQUAL(this->strategy.sendNackHistory.size(), 1);
@@ -183,7 +183,7 @@
 
   lp::Nack nack4 = makeNack("/sIYw0TXWDj", 223, lp::NackReason::CONGESTION);
   pitEntry->getOutRecord(*this->face4, 0)->setIncomingNack(nack4);
-  this->strategy.afterReceiveNack(*this->face4, nack4, pitEntry);
+  this->strategy.afterReceiveNack(FaceEndpoint(*this->face4, 0), nack4, pitEntry);
 
   BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0);
 }
@@ -329,13 +329,13 @@
 
   lp::Nack nack3 = makeNack(*interest1, Combination::getX());
   pitEntry->getOutRecord(*face3, 0)->setIncomingNack(nack3);
-  strategy.afterReceiveNack(*face3, nack3, pitEntry);
+  strategy.afterReceiveNack(FaceEndpoint(*face3, 0), nack3, pitEntry);
 
   BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
 
   lp::Nack nack4 = makeNack(*interest1, Combination::getY());
   pitEntry->getOutRecord(*face4, 0)->setIncomingNack(nack4);
-  strategy.afterReceiveNack(*face4, nack4, pitEntry);
+  strategy.afterReceiveNack(FaceEndpoint(*face4, 0), nack4, pitEntry);
 
   BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
   BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp
index 4719c5e..3c5be6b 100644
--- a/tests/daemon/fw/strategy-no-route.t.cpp
+++ b/tests/daemon/fw/strategy-no-route.t.cpp
@@ -164,7 +164,7 @@
   pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveInterest(*this->face1, *interest, pitEntry); },
+    [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->face1, 0), *interest, pitEntry); },
     this->limitedIo, 2));
 
   BOOST_REQUIRE_EQUAL(this->strategy.rejectPendingInterestHistory.size(), 1);
diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp
index 029ab0e..984c792 100644
--- a/tests/daemon/fw/strategy-scope-control.t.cpp
+++ b/tests/daemon/fw/strategy-scope-control.t.cpp
@@ -125,7 +125,7 @@
   pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveInterest(*this->localFace3, *interest, pitEntry); },
+    [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
     this->limitedIo));
 
   BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -144,7 +144,7 @@
   pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveInterest(*this->localFace3, *interest, pitEntry); },
+    [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
     this->limitedIo, 1 + T::willSendNackNoRoute()));
 
   BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -167,7 +167,7 @@
   pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveInterest(*this->localFace3, *interest, pitEntry); },
+    [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
     this->limitedIo));
 
   BOOST_REQUIRE_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -187,7 +187,7 @@
   pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, 0, *interest);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveInterest(*this->nonLocalFace1, *interest, pitEntry); },
+    [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->nonLocalFace1, 0), *interest, pitEntry); },
     this->limitedIo, 1 + T::willSendNackNoRoute()));
 
   BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -210,7 +210,7 @@
   pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, 0, *interest);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveInterest(*this->nonLocalFace1, *interest, pitEntry); },
+    [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->nonLocalFace1, 0), *interest, pitEntry); },
     this->limitedIo));
 
   BOOST_REQUIRE_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -233,7 +233,7 @@
   pitEntry->insertOrUpdateOutRecord(*this->localFace4, 0, *interest)->setIncomingNack(nack);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveNack(*this->localFace4, nack, pitEntry); },
+    [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->localFace4, 0), nack, pitEntry); },
     this->limitedIo, T::canProcessNack()));
 
   BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -258,7 +258,7 @@
   pitEntry->insertOrUpdateOutRecord(*this->localFace4, 0, *interest)->setIncomingNack(nack);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveNack(*this->localFace4, nack, pitEntry); },
+    [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->localFace4, 0), nack, pitEntry); },
     this->limitedIo, T::canProcessNack()));
 
   BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index c842327..5b5c98d 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -106,11 +106,11 @@
 
 protected:
   void
-  sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& outFace,
+  sendInterest(const shared_ptr<pit::Entry>& pitEntry, const FaceEndpoint& egress,
                const Interest& interest) override
   {
-    sendInterestHistory.push_back({pitEntry->getInterest(), outFace.getId(), interest});
-    pitEntry->insertOrUpdateOutRecord(outFace, 0, interest);
+    sendInterestHistory.push_back({pitEntry->getInterest(), egress.face.getId(), interest});
+    pitEntry->insertOrUpdateOutRecord(egress.face, egress.endpoint, interest);
     afterAction();
   }
 
@@ -122,11 +122,11 @@
   }
 
   void
-  sendNack(const shared_ptr<pit::Entry>& pitEntry, const Face& outFace,
+  sendNack(const shared_ptr<pit::Entry>& pitEntry, const FaceEndpoint& egress,
            const lp::NackHeader& header) override
   {
-    sendNackHistory.push_back({pitEntry->getInterest(), outFace.getId(), header});
-    pitEntry->deleteInRecord(outFace, 0);
+    sendNackHistory.push_back({pitEntry->getInterest(), egress.face.getId(), header});
+    pitEntry->deleteInRecord(egress.face, egress.endpoint);
     afterAction();
   }
 
diff --git a/tests/daemon/fw/unsolicited-data-policy.t.cpp b/tests/daemon/fw/unsolicited-data-policy.t.cpp
index 71f19b2..8cc7a70 100644
--- a/tests/daemon/fw/unsolicited-data-policy.t.cpp
+++ b/tests/daemon/fw/unsolicited-data-policy.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  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,
@@ -118,7 +118,7 @@
   forwarder.addFace(face1);
 
   shared_ptr<Data> data1 = makeData("/unsolicited-from-local");
-  forwarder.onIncomingData(*face1, *data1);
+  forwarder.onIncomingData(FaceEndpoint(*face1, 0), *data1);
   BOOST_CHECK_EQUAL(isInCs(*data1), T::ShouldAdmitLocal::value);
 
   auto face2 = make_shared<DummyFace>("dummy://", "dummy://",
@@ -126,7 +126,7 @@
   forwarder.addFace(face2);
 
   shared_ptr<Data> data2 = makeData("/unsolicited-from-non-local");
-  forwarder.onIncomingData(*face2, *data2);
+  forwarder.onIncomingData(FaceEndpoint(*face2, 0), *data2);
   BOOST_CHECK_EQUAL(isInCs(*data2), T::ShouldAdmitNonLocal::value);
 }
 
diff --git a/tests/other/fw/congestion-mark-strategy.cpp b/tests/other/fw/congestion-mark-strategy.cpp
index 744608f..9543fda 100644
--- a/tests/other/fw/congestion-mark-strategy.cpp
+++ b/tests/other/fw/congestion-mark-strategy.cpp
@@ -79,17 +79,17 @@
 }
 
 void
-CongestionMarkStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
+CongestionMarkStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                                              const shared_ptr<pit::Entry>& pitEntry)
 {
   auto mark = interest.getCongestionMark();
   if (mark != m_congestionMark && (!m_shouldPreserveMark || mark == 0)) {
     Interest markedInterest(interest);
     markedInterest.setCongestionMark(m_congestionMark);
-    BestRouteStrategy2::afterReceiveInterest(inFace, markedInterest, pitEntry);
+    BestRouteStrategy2::afterReceiveInterest(ingress, markedInterest, pitEntry);
   }
   else {
-    BestRouteStrategy2::afterReceiveInterest(inFace, interest, pitEntry);
+    BestRouteStrategy2::afterReceiveInterest(ingress, interest, pitEntry);
   }
 }
 
diff --git a/tests/other/fw/congestion-mark-strategy.hpp b/tests/other/fw/congestion-mark-strategy.hpp
index e8c7326..092f8b7 100644
--- a/tests/other/fw/congestion-mark-strategy.hpp
+++ b/tests/other/fw/congestion-mark-strategy.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,
@@ -39,6 +39,8 @@
  *  The value of the added CongestionMark can be specified through a strategy parameter (defaults
  *  to 1). In addition, an optional boolean parameter specifies whether the strategy will preserve
  *  existing CongestionMarks (default) or replace them.
+ *
+ *  \note This strategy is not EndpointId-aware.
  */
 class CongestionMarkStrategy : public BestRouteStrategy2
 {
@@ -50,7 +52,7 @@
   getStrategyName();
 
   void
-  afterReceiveInterest(const Face& inFace, const Interest& interest,
+  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
 private:
