fw: set incomingFaceId for incoming packets

refs #1237

Change-Id: I8d62aca2c5a08945fdab8511e7c3e4aaf5d02205
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 1ce3b8f..67aeba7 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -73,6 +73,7 @@
 {
   // receive Interest
   NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() << " interest=" << interest.getName());
+  const_cast<Interest&>(interest).setIncomingFaceId(inFace.getId());
   
   // PIT insert
   std::pair<shared_ptr<pit::Entry>, bool>
@@ -181,6 +182,7 @@
 {
   // receive Data
   NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() << " data=" << data.getName());
+  const_cast<Data&>(data).setIncomingFaceId(inFace.getId());
   
   // PIT match
   shared_ptr<pit::DataMatchResult> pitMatches = m_pit.findAllDataMatches(data);
diff --git a/tests/fw/forwarder.cpp b/tests/fw/forwarder.cpp
index cf5115f..23d8828 100644
--- a/tests/fw/forwarder.cpp
+++ b/tests/fw/forwarder.cpp
@@ -107,12 +107,14 @@
   io.reset();
   BOOST_REQUIRE_EQUAL(face2->m_sentInterests.size(), 1);
   BOOST_CHECK(face2->m_sentInterests[0].getName().equals(nameAB));
+  BOOST_CHECK_EQUAL(face2->m_sentInterests[0].getIncomingFaceId(), face1->getId());
   
   face2->receiveData(dataABC);
   io.run();
   io.reset();
   BOOST_REQUIRE_EQUAL(face1->m_sentDatas.size(), 1);
   BOOST_CHECK(face1->m_sentDatas[0].getName().equals(nameABC));
+  BOOST_CHECK_EQUAL(face1->m_sentDatas[0].getIncomingFaceId(), face2->getId());
 }
 
 BOOST_AUTO_TEST_SUITE_END()