Project

General

Profile

Bug #2764

HopCount Calculation "broken" due to content store

Added by Christian Kreuzberger over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
NFD
Target version:
-
Start date:
04/22/2015
Due date:
% Done:

100%

Estimated time:

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

hopcount.diff (1.49 KB) hopcount.diff Christian Kreuzberger, 04/22/2015 01:51 AM

History

#1 Updated by Yuanzhi Gao over 4 years ago

  • Status changed from New to In Progress
  • Assignee set to Yuanzhi Gao

#2 Updated by Yuanzhi Gao over 4 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Hi Christian,

I think you are right that hop count tag should be removed before the data is inserted into content store, otherwise the hop count would be wrong when data is retrieved from cache.

Thank you very much.

Best regards,
Yuanzhi

#3 Updated by Alex Afanasyev about 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF