Refs #27 Merge branch 'issue-27-hop-count-fix'
diff --git a/model/fw/nacks.cc b/model/fw/nacks.cc
index 8c24157..00bf840 100644
--- a/model/fw/nacks.cc
+++ b/model/fw/nacks.cc
@@ -27,6 +27,7 @@
#include "ns3/ndn-pit.h"
#include "ns3/ndn-fib.h"
#include "ns3/ndn-content-store.h"
+#include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.h"
#include "ns3/assert.h"
#include "ns3/ptr.h"
@@ -118,6 +119,16 @@
Ptr<Packet> nack = Create<Packet> ();
nack->AddHeader (*nackHeader);
+ FwHopCountTag hopCountTag;
+ if (origPacket->PeekPacketTag (hopCountTag))
+ {
+ nack->AddPacketTag (hopCountTag);
+ }
+ else
+ {
+ NS_LOG_DEBUG ("No FwHopCountTag tag associated with received duplicated Interest");
+ }
+
inFace->Send (nack);
m_outNacks (nackHeader, inFace);
}
@@ -136,6 +147,16 @@
nackHeader->SetNack (InterestHeader::NACK_GIVEUP_PIT);
packet->AddHeader (*nackHeader);
+ FwHopCountTag hopCountTag;
+ if (origPacket->PeekPacketTag (hopCountTag))
+ {
+ packet->AddPacketTag (hopCountTag);
+ }
+ else
+ {
+ NS_LOG_DEBUG ("No FwHopCountTag tag associated with original Interest");
+ }
+
BOOST_FOREACH (const pit::IncomingFace &incoming, pitEntry->GetIncoming ())
{
NS_LOG_DEBUG ("Send NACK for " << boost::cref (nackHeader->GetName ()) << " to " << boost::cref (*incoming.m_face));
@@ -186,6 +207,16 @@
nonNackHeader->SetNack (InterestHeader::NORMAL_INTEREST);
nonNackInterest->AddHeader (*nonNackHeader);
+ FwHopCountTag hopCountTag;
+ if (origPacket->PeekPacketTag (hopCountTag))
+ {
+ nonNackInterest->AddPacketTag (hopCountTag);
+ }
+ else
+ {
+ NS_LOG_DEBUG ("No FwHopCountTag tag associated with received NACK");
+ }
+
bool propagated = DoPropagateInterest (inFace, nonNackHeader, nonNackInterest, pitEntry);
if (!propagated)
{