--- a/RELEASE_NOTES Tue Jan 21 23:06:22 2014 +0100
+++ b/RELEASE_NOTES Thu Jan 23 19:31:42 2014 +0100
@@ -31,6 +31,7 @@
----------
- Bug 1739 - The endpoint is not deallocated for UDP sockets
- Bug 1786 - os << int64x64_t prints un-normalized fractional values
+- Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
- Bug 1821 - Setting an interface to Down state will cause various asserts in IPv6
- Bug 1837 - AODV crashes when using multiple interfaces
- Bug 1838 - FlowMonitorHelper must not be copied.
--- a/src/flow-monitor/model/ipv4-flow-classifier.cc Tue Jan 21 23:06:22 2014 +0100
+++ b/src/flow-monitor/model/ipv4-flow-classifier.cc Thu Jan 23 19:31:42 2014 +0100
@@ -159,11 +159,17 @@
// if the insertion succeeded, we need to assign this tuple a new flow identifier
if (insert.second)
{
- insert.first->second = GetNewFlowId ();
+ FlowId newFlowId = GetNewFlowId ();
+ insert.first->second = newFlowId;
+ m_flowPktIdMap[newFlowId] = 0;
+ }
+ else
+ {
+ m_flowPktIdMap[insert.first->second] ++;
}
*out_flowId = insert.first->second;
- *out_packetId = ipHeader.GetIdentification ();
+ *out_packetId = m_flowPktIdMap[*out_flowId];
return true;
}
--- a/src/flow-monitor/model/ipv4-flow-classifier.h Tue Jan 21 23:06:22 2014 +0100
+++ b/src/flow-monitor/model/ipv4-flow-classifier.h Thu Jan 23 19:31:42 2014 +0100
@@ -52,6 +52,9 @@
Ipv4FlowClassifier ();
/// \brief try to classify the packet into flow-id and packet-id
+ ///
+ /// \warning: it must be called only once per packet, from SendOutgoingLogger.
+ ///
/// \return true if the packet was classified, false if not (i.e. it
/// does not appear to be part of a flow).
/// \param ipHeader packet's IP header
@@ -72,6 +75,7 @@
/// Map to Flows Identifiers to FlowIds
std::map<FiveTuple, FlowId> m_flowMap;
+ std::map<FlowId, FlowPacketId> m_flowPktIdMap;
};
--- a/src/flow-monitor/model/ipv4-flow-probe.cc Tue Jan 21 23:06:22 2014 +0100
+++ b/src/flow-monitor/model/ipv4-flow-probe.cc Thu Jan 23 19:31:42 2014 +0100
@@ -260,31 +260,35 @@
void
Ipv4FlowProbe::ForwardLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface)
{
- FlowId flowId;
- FlowPacketId packetId;
+ // peek the tags that are added by Ipv4FlowProbe::SendOutgoingLogger ()
+ Ipv4FlowProbeTag fTag;
+
+ bool found = ipPayload->PeekPacketTag (fTag);
- if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
+ if (found)
{
+ FlowId flowId = fTag.GetFlowId ();
+ FlowPacketId packetId = fTag.GetPacketId ();
+
uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
NS_LOG_DEBUG ("ReportForwarding ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<");");
m_flowMonitor->ReportForwarding (this, flowId, packetId, size);
}
-
}
void
Ipv4FlowProbe::ForwardUpLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface)
{
- FlowId flowId;
- FlowPacketId packetId;
+ // remove the tags that are added by Ipv4FlowProbe::SendOutgoingLogger ()
+ Ipv4FlowProbeTag fTag;
- if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
+ // ConstCast: see http://www.nsnam.org/bugzilla/show_bug.cgi?id=904
+ bool found = ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
+
+ if (found)
{
- // remove the tags that are added by Ipv4FlowProbe::SendOutgoingLogger ()
- Ipv4FlowProbeTag fTag;
-
- // ConstCast: see http://www.nsnam.org/bugzilla/show_bug.cgi?id=904
- ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
+ FlowId flowId = fTag.GetFlowId ();
+ FlowPacketId packetId = fTag.GetPacketId ();
uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
NS_LOG_DEBUG ("ReportLastRx ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<");");
@@ -314,16 +318,16 @@
}
#endif
- FlowId flowId;
- FlowPacketId packetId;
+ // remove the tags that are added by Ipv4FlowProbe::SendOutgoingLogger ()
+ Ipv4FlowProbeTag fTag;
- if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
+ // ConstCast: see http://www.nsnam.org/bugzilla/show_bug.cgi?id=904
+ bool found = ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
+
+ if (found)
{
- // remove the tags that are added by Ipv4FlowProbe::SendOutgoingLogger ()
- Ipv4FlowProbeTag fTag;
-
- // ConstCast: see http://www.nsnam.org/bugzilla/show_bug.cgi?id=904
- ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
+ FlowId flowId = fTag.GetFlowId ();
+ FlowPacketId packetId = fTag.GetPacketId ();
uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " << reason
@@ -376,8 +380,7 @@
Ipv4FlowProbeTag fTag;
// ConstCast: see http://www.nsnam.org/bugzilla/show_bug.cgi?id=904
- bool tagFound;
- tagFound = ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
+ bool tagFound = ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
if (!tagFound)
{
return;