Bug #2764
closedHopCount Calculation "broken" due to content store
100%
Description
It seems that when data is added to the content store, the hop count tag is not removed.
Therefore, when data is SERVED from the content store, the hop count tag is not reset to 0. Instead, the old hop count tag is served, leading to wrong results on the client.
Details:
You can reproduce this problem by looking at the ndnsim website:
http://ndnsim.net/2.0/metric.html#application-level-trace-helper
ndn-tree-app-delay-tracer.cpp will serve as an example, the result is as follows
Time Node AppId SeqNo Type DelayS DelayUS RetxCount HopCount
10.0057 leaf-1 257 0 LastDelay 0.0057344 5734.4 1 2
10.0057 leaf-1 257 0 FullDelay 9.00573 9.00573e+06 3 2
10.0066 leaf-1 257 1 LastDelay 0.0065808 6580.8 1 2
10.0066 leaf-1 257 1 FullDelay 0.0065808 6580.8 1 2
11.0029 leaf-2 257 0 LastDelay 0.0028672 2867.2 1 2
11.0029 leaf-2 257 0 FullDelay 0.0028672 2867.2 1 2
11.0057 leaf-3 257 0 LastDelay 0.0057344 5734.4 1 2
11.0057 leaf-3 257 0 FullDelay 0.0057344 5734.4 1 2
In addition, the website states that
"HopCount the number of hops that the retrieved Data packet traveled on the way back from producer application or cache."
Which is obviously not true in this example, the hop counts should not all be 2 (leaf 2 or 3 should be served out of the cache).
How To Fix:
I digged into the code, and saw that the forwarder is not aware of the tags, and the netdevice is not aware of the cache - so I was only able to "hotfix" this in a quick and dirty way, by modifying the behaviour of NFD/daemon/fw/forwarder.cpp - Forwarder::onIncomingData(Face& inFace, const Data& data).
The diff file is attached, basically I removed the hopcount tag before adding the data packet to the cache. I changed
// CS insert
if (m_csFromNdnSim == nullptr)
m_cs.insert(data);
else
m_csFromNdnSim->Add(data.shared_from_this());
to
// remove hop count tag before adding to content store !!!
ns3::Ptrns3::Packet tmpPacket = ns3::ndn::Convert::ToPacket(data);
ns3::ndn::FwHopCountTag tag;
tmpPacket->RemovePacketTag(tag);
// CS insert
if (m_csFromNdnSim == nullptr)
m_cs.insert(*(ns3::ndn::Convert::FromPacket(tmpPacket)));
else
m_csFromNdnSim->Add(ns3::ndn::Convert::FromPacket(tmpPacket));
The results are promising:
Time Node AppId SeqNo Type DelayS DelayUS RetxCount HopCount
10.0057 leaf-1 257 0 LastDelay 0.0057344 5734.4 1 2
10.0057 leaf-1 257 0 FullDelay 9.00573 9.00573e+06 3 2
10.0066 leaf-1 257 1 LastDelay 0.0065808 6580.8 1 2
10.0066 leaf-1 257 1 FullDelay 0.0065808 6580.8 1 2
11.0029 leaf-2 257 0 LastDelay 0.0028672 2867.2 1 1
11.0029 leaf-2 257 0 FullDelay 0.0028672 2867.2 1 1
11.0057 leaf-3 257 0 LastDelay 0.0057344 5734.4 1 2
11.0057 leaf-3 257 0 FullDelay 0.0057344 5734.4 1 2
I am not sure if my way to fix it is the right way, I'm quite sure there is a better way to do it.
Best regards,
Christian
Files