fw: AccessStrategy avoid loop back new Interest

refs #2831

Change-Id: I1680fd62cdf8f11eaa7817dd6d4b7794c305c5eb
diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index 3c1f01a..5489837 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -97,8 +97,8 @@
 
   // no measurements, or last working nexthop unavailable
 
-  // multicast to all nexthops
-  this->multicast(pitEntry, fibEntry);
+  // multicast to all nexthops except incoming face
+  this->multicast(pitEntry, fibEntry, {inFace.getId()});
 }
 
 void
@@ -108,7 +108,7 @@
                                          shared_ptr<pit::Entry> pitEntry)
 {
   NFD_LOG_DEBUG(interest << " interestFrom " << inFace.getId() << " retx-forward");
-  this->multicast(pitEntry, fibEntry, std::unordered_set<FaceId>{inFace.getId()});
+  this->multicast(pitEntry, fibEntry, {inFace.getId()});
 }
 
 bool
@@ -167,7 +167,7 @@
 
   NFD_LOG_DEBUG(pitEntry->getInterest() << " timeoutFrom " << firstOutFace <<
                 " multicast-except " << inFace << ',' << firstOutFace);
-  this->multicast(pitEntry, fibEntry, std::unordered_set<FaceId>{inFace, firstOutFace});
+  this->multicast(pitEntry, fibEntry, {inFace, firstOutFace});
 }
 
 void
diff --git a/tests/daemon/fw/access-strategy.t.cpp b/tests/daemon/fw/access-strategy.t.cpp
index 732e0e8..ddc0092 100644
--- a/tests/daemon/fw/access-strategy.t.cpp
+++ b/tests/daemon/fw/access-strategy.t.cpp
@@ -350,6 +350,23 @@
   BOOST_CHECK_EQUAL(hasData2c, true);
 }
 
+BOOST_FIXTURE_TEST_CASE(Bug2831, TwoLaptopsFixture)
+{
+  // make a two-node loop
+  topo.registerPrefix(laptopA, linkA->getFace(laptopA), "ndn:/net");
+  topo.registerPrefix(router, linkA->getFace(router), "ndn:/net");
+
+  // send Interests from laptopA to router
+  shared_ptr<TopologyAppLink> consumer = topo.addAppFace(laptopA);
+  topo.addIntervalConsumer(*consumer->getClientFace(), "ndn:/net",
+                           time::milliseconds(100), 10);
+
+  this->advanceClocks(time::milliseconds(5), time::seconds(2));
+
+  // Interest shouldn't loop back from router
+  BOOST_CHECK_EQUAL(linkA->getFace(router)->m_sentInterests.size(), 0);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace tests