Using STDMA along with OnOffApplication ( UDPSocketFactory) giving SIGSEGV

56 views
Skip to first unread message

Gopala Krishnan

unread,
Apr 6, 2020, 1:19:51 PM4/6/20
to ns-3-users
Hi all,

I have been using the STDMA module from here: https://github.com/m00re/ns-3-stdma/tree/master/sources

Kindly find the implementation where I have used STDMA for the reference.

When running the code, I get a SIGSEGV. 

Upon inspection using gdb I found the problem to be in the function

stdma::StdmaMac::PerformNetworkEntry(unsigned int, double) (stdma_mac.cc)
where it is calling the  ns3::Packet::Copy() function.

particularly this line: 
// 3) Perform transmission, which means we need to get a packet from the transmission queue,
// add a STDMA header, and then forward it to the physical layer
ns3::WifiMacHeader wifiMacHdr;
ns3::Ptr<ns3::Packet> packet = m_queue->Dequeue(&wifiMacHdr)->Copy();



Has anyone come across this issue when using STDMA? would be really great if you could share how you solved it.

Thanks!

Here is my STDMA Implementation
ns3::SeedManager::SetSeed (1);
stdma::StdmaHelper stdma;
stdma.SetStandard(ns3::WIFI_PHY_STANDARD_80211p_CCH);
stdma::StdmaMacHelper stdmaMac = stdma::StdmaMacHelper::Default();
ns3::Config::SetDefault ("stdma::StdmaMac::FrameDuration", ns3::TimeValue(ns3::Seconds(1.0)));
ns3::Config::SetDefault ("stdma::StdmaMac::MaximumPacketSize", ns3::UintegerValue(1000));
ns3::Config::SetDefault ("stdma::StdmaMac::ReportRate", ns3::UintegerValue(10));
ns3::Config::SetDefault ("stdma::StdmaMac::Timeout", ns3::RandomVariableValue (ns3::UniformVariable(8, 8)));

m_adaptiveDevices = stdma.Install(nodePhy,stdmaMac,m_adaptiveNodes);
m_baseDevices = stdma.Install(basePhy,stdmaMac,m_baseNodes);

m_allDevices.Add(m_baseDevices);
m_allDevices.Add(m_adaptiveDevices);

InternetStackHelper stack;
stack.Install(m_allNodes);

Ipv4AddressHelper addressAdhoc;
addressAdhoc.SetBase ("10.1.0.0", "255.255.0.0");
m_allInterfaces = addressAdhoc.Assign (m_allDevices);
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();


OnOffHelper onoff1 ("ns3::UdpSocketFactory",Address (InetSocketAddress(m_allInterfaces.GetAddress(0),8080)));

onoff1.SetAttribute ("PacketSize", ns3::UintegerValue (400 - GetProtocolOverheads()));
onoff1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
onoff1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));
//Base station Sink
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
Ptr<Socket> sink = Socket::CreateSocket (m_baseNodes.Get(0), tid);
InetSocketAddress local = InetSocketAddress (m_allInterfaces.GetAddress(0), 8080);

//Now lets Tell all the other nodes to send packet to the sink.
for(uint32_t i=0;i<m_adaptiveNodes.GetN();i++){
ApplicationContainer temp = onoff1.Install (m_adaptiveNodes.Get (i));
temp.Start (Seconds (10));
temp.Stop (Seconds (m_totalSimTime - 15));
}

Gopala Krishnan

unread,
Apr 6, 2020, 1:22:26 PM4/6/20
to ns-3-users
Just as an addition, I believe it is not a generic issue as the code works  when using AdhocWifiMac.

Gopala Krishnan

unread,
Apr 12, 2020, 12:02:06 PM4/12/20
to ns-3-users
I figured out the error. It seems for STDMA to work, every node which has the mac should have a packet ready to be transmitted in the queue.
In my case the base_devices were not transmitting any packets due to which it was giving seg fault. 

We need to make sure that every device should transmit atleast one packet.


On Monday, April 6, 2020 at 10:49:51 PM UTC+5:30, Gopala Krishnan wrote:

BIKASH MAZUMDAR

unread,
Jun 10, 2022, 6:15:09 AM6/10/22
to ns-3-users
Can you please share how did you debug the issue?
Reply all
Reply to author
Forward
0 new messages