I am trying to use flow monitor in an example of ns3-dce with Linux kernel. when I use :
"std::string stack = "ns3";"
and in the following
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());
std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator iter = stats.begin (); iter != stats.end (); ++iter)
{
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (iter->first);
NS_LOG_UNCOND("Flow ID: " << iter->first << " Src Addr " << t.sourceAddress << " Dst Addr " << t.destinationAddress);
NS_LOG_UNCOND("Tx Packets = " << iter->second.txPackets);
NS_LOG_UNCOND("Rx Packets = " << iter->second.rxPackets);
}
monitor->SerializeToXmlFile("file.flowmon", true, true);
it is ok and I will receive the result correctly but when I change the stack to
std::string stack = "linux";
then it is not working and I receive :
Command ['/home/user/dce/source/ns-3-dce/build/bin/dce-sample'] terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").
in gdb:
#0 0x00000000004179d6 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, ns3::FlowMonitor::FlowStats>, std::_Select1st<std::pair<unsigned int const, ns3::FlowMonitor::FlowStats> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, ns3::FlowMonitor::FlowStats> > >::_M_root (this=0x20)
at /usr/include/c++/4.8/bits/stl_tree.h:482
#1 0x00000000004168b9 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, ns3::FlowMonitor::FlowStats>, std::_Select1st<std::pair<unsigned int const, ns3::FlowMonitor::FlowStats> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, ns3::FlowMonitor::FlowStats> > >::_Rb_tree (
this=0x7fffffffd4d0, __x=...) at /usr/include/c++/4.8/bits/stl_tree.h:657
#2 0x0000000000415879 in std::map<unsigned int, ns3::FlowMonitor::FlowStats, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, ns3::FlowMonitor::FlowStats> > >::map (this=0x7fffffffd4d0,
__x=<error reading variable: Cannot access memory at address 0x48>)
at /usr/include/c++/4.8/bits/stl_map.h:181
#3 0x0000000000413abc in main (argc=2, argv=0x7fffffffd798)
at ../example/dce-sample.cc:251
Could you please tell me is it possible to use flowmonitor with linux stack or not? if it is not possible is there any other way to monitor the links? do you have any example that i can use?