fw: forward Interest/Data to ad hoc incoming face
Change-Id: Ia2eacf2a54d65ea4bffb607a709e1d1263547fd7
Refs: #3968
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index 871ff2f..baf8230 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -60,7 +60,7 @@
const Name&
AsfStrategy::getStrategyName()
{
- static Name strategyName("/localhost/nfd/strategy/asf/%FD%01");
+ static Name strategyName("/localhost/nfd/strategy/asf/%FD%02");
return strategyName;
}
@@ -246,7 +246,8 @@
for (const fib::NextHop& hop : fibEntry.getNextHops()) {
Face& hopFace = hop.getFace();
- if (hopFace.getId() == inFace.getId() || wouldViolateScope(inFace, interest, hopFace)) {
+ if ((hopFace.getId() == inFace.getId() && hopFace.getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) ||
+ wouldViolateScope(inFace, interest, hopFace)) {
continue;
}
diff --git a/daemon/fw/best-route-strategy2.cpp b/daemon/fw/best-route-strategy2.cpp
index 1666e81..11add67 100644
--- a/daemon/fw/best-route-strategy2.cpp
+++ b/daemon/fw/best-route-strategy2.cpp
@@ -57,7 +57,7 @@
const Name&
BestRouteStrategy2::getStrategyName()
{
- static Name strategyName("/localhost/nfd/strategy/best-route/%FD%04");
+ static Name strategyName("/localhost/nfd/strategy/best-route/%FD%05");
return strategyName;
}
@@ -78,8 +78,8 @@
{
const Face& outFace = nexthop.getFace();
- // do not forward back to the same face
- if (&outFace == &inFace)
+ // do not forward back to the same face, unless it is ad hoc
+ if (outFace.getId() == inFace.getId() && outFace.getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC)
return false;
// forwarding would violate scope
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 052258a..41ab2e2 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -375,7 +375,8 @@
// foreach pending downstream
for (Face* pendingDownstream : pendingDownstreams) {
- if (pendingDownstream == &inFace) {
+ if (pendingDownstream->getId() == inFace.getId() &&
+ pendingDownstream->getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) {
continue;
}
// goto outgoing Data pipeline
@@ -595,7 +596,7 @@
}
// Dead Nonce List insert
- if (upstream == 0) {
+ if (upstream == nullptr) {
// insert all outgoing Nonces
const pit::OutRecordCollection& outRecords = pitEntry.getOutRecords();
std::for_each(outRecords.begin(), outRecords.end(),
diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp
index 9543e6f..7b38bc1 100644
--- a/daemon/fw/multicast-strategy.cpp
+++ b/daemon/fw/multicast-strategy.cpp
@@ -58,7 +58,7 @@
const Name&
MulticastStrategy::getStrategyName()
{
- static Name strategyName("/localhost/nfd/strategy/multicast/%FD%02");
+ static Name strategyName("/localhost/nfd/strategy/multicast/%FD%03");
return strategyName;
}
@@ -85,12 +85,15 @@
for (const auto& nexthop : nexthops) {
Face& outFace = nexthop.getFace();
- if (&outFace != &inFace && !wouldViolateScope(inFace, interest, outFace)) {
- this->sendInterest(pitEntry, outFace, interest);
- NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
- << " pitEntry-to=" << outFace.getId());
- ++nEligibleNextHops;
+ if ((outFace.getId() == inFace.getId() && outFace.getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) ||
+ wouldViolateScope(inFace, interest, outFace)) {
+ continue;
}
+
+ this->sendInterest(pitEntry, outFace, interest);
+ NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
+ << " pitEntry-to=" << outFace.getId());
+ ++nEligibleNextHops;
}
if (nEligibleNextHops == 0) {