fw: /localhost scope control on outgoing path
refs #1230
Change-Id: I25e38e1b2bf538a72d2185889c1be5401ed93b68
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index d438f10..a605ef0 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -117,8 +117,7 @@
}
// insert InRecord
- pit::InRecordCollection::iterator inRecordIt =
- pitEntry->insertOrUpdateInRecord(inFace.shared_from_this(), interest);
+ pitEntry->insertOrUpdateInRecord(inFace.shared_from_this(), interest);
// app chosen nexthops
bool isAppChosenNexthops = false; // TODO get from local control header
@@ -150,13 +149,21 @@
{
NFD_LOG_DEBUG("onOutgoingInterest face=" << outFace.getId() << " interest=" << pitEntry->getName());
+ // /localhost scope control
+ bool violatesLocalhost = !outFace.isLocal() &&
+ s_localhostName.isPrefixOf(pitEntry->getName());
+ if (violatesLocalhost) {
+ NFD_LOG_DEBUG("onOutgoingInterest face=" << outFace.getId()
+ << " interest=" << pitEntry->getName() << " violates /localhost");
+ return;
+ }
+
// pick Interest
const Interest& interest = pitEntry->getInterest();
// TODO pick the last incoming Interest
// insert OutRecord
- pit::OutRecordCollection::iterator outRecordIt =
- pitEntry->insertOrUpdateOutRecord(outFace.shared_from_this(), interest);
+ pitEntry->insertOrUpdateOutRecord(outFace.shared_from_this(), interest);
// set PIT unsatisfy timer
this->setUnsatisfyTimer(pitEntry);
@@ -198,7 +205,7 @@
s_localhostName.isPrefixOf(data.getName());
if (violatesLocalhost) {
NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId()
- << " interest=" << data.getName() << " violates /localhost");
+ << " data=" << data.getName() << " violates /localhost");
return;
}
@@ -269,6 +276,15 @@
{
NFD_LOG_DEBUG("onOutgoingData face=" << outFace.getId() << " data=" << data.getName());
+ // /localhost scope control
+ bool violatesLocalhost = !outFace.isLocal() &&
+ s_localhostName.isPrefixOf(data.getName());
+ if (violatesLocalhost) {
+ NFD_LOG_DEBUG("onOutgoingData face=" << outFace.getId()
+ << " data=" << data.getName() << " violates /localhost");
+ return;
+ }
+
// traffic manager
// pass through