fw: strip Link object when Interest reaches producer region

refs #3893

Change-Id: I7cb0a58f75eb4275bbf0fe0c7dcdb583c8519644
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 76e4127..1e01e02 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.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-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -146,6 +146,15 @@
     return;
   }
 
+  // strip Link object if Interest has reached producer region
+  if (interest.hasLink() && m_networkRegionTable.isInProducerRegion(interest.getLink())) {
+    NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() <<
+                  " interest=" << interest.getName() << " reaching-producer-region");
+    Interest& interestRef = const_cast<Interest&>(interest);
+    interestRef.unsetLink();
+    interestRef.unsetSelectedDelegation();
+  }
+
   // PIT insert
   shared_ptr<pit::Entry> pitEntry = m_pit.insert(interest).first;
 
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 4aeb015..0419a22 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -196,7 +196,6 @@
 Strategy::lookupFib(const pit::Entry& pitEntry) const
 {
   const Fib& fib = m_forwarder.getFib();
-  const NetworkRegionTable& nrt = m_forwarder.getNetworkRegionTable();
 
   const Interest& interest = pitEntry.getInterest();
   // has Link object?
@@ -209,13 +208,8 @@
 
   const Link& link = interest.getLink();
 
-  // in producer region?
-  if (nrt.isInProducerRegion(link)) {
-    // FIB lookup with Interest name
-    const fib::Entry& fibEntry = fib.findLongestPrefixMatch(pitEntry);
-    NFD_LOG_TRACE("lookupFib inProducerRegion found=" << fibEntry.getPrefix());
-    return fibEntry;
-  }
+  // Link should have been stripped by incoming Interest pipeline when reaching producer region
+  BOOST_ASSERT(!m_forwarder.getNetworkRegionTable().isInProducerRegion(link));
 
   // has SelectedDelegation?
   if (interest.hasSelectedDelegation()) {