Error message from packet-metadata.cc

67 views
Skip to first unread message

PN

unread,
Dec 28, 2015, 8:00:42 PM12/28/15
to ns-3-users
Hi,

I've written an ns 3 module (netdevice and channel only) for my research. Overall it has an Access Point that transmits packets to 4 Stations. I've run and tested my code with a lot of test cases and it has given me correct results.
 
However, when I increase the number of stations to 5 and run my code, I get the following error message:

assert failed. cond="IsStateOk ()", file=../src/network/model/packet-metadata.cc, line=877
 

I read some of the previous posts on this error and the bugzilla discussion on some bug that was fixed a long time ago. I'm using the latest version of ns 3 and so I'm assuming that there is no bug with ns 3 itself and that the error is coming from something I'm doing in my code.

I'm aggregating and de-aggregating (not sure if its the right word) packets and I think its that part that is causing the error. I've copied this part of the code from the wifi module and just modified it for my purpose. The aggregation and de-aggregation parts are as follows:

Aggregate packets:
Aggregate (Ptr<Packet> packet, Ptr<Packet> aggregatedPacket, Mac48Address src, Mac48Address dest)
{
  NS_LOG_FUNCTION
(packet << aggregatedPacket << src << dest);
 
Ptr<Packet> currentPacket;
 
AmsduSubframeHeader currentHdr;

  currentHdr
.SetDestinationAddr (dest);
  currentHdr
.SetSourceAddr (src);
  currentHdr
.SetLength (packet->GetSize ());
  currentPacket
= packet->Copy ();

  currentPacket
->AddHeader (currentHdr);
  aggregatedPacket
->AddAtEnd (currentPacket);
 
return aggregatedPacket;

}

De-aggregate:
  AmsduSubframeHeader header;
 
Ptr<Packet> extractedMsdu = Create<Packet> ();
  uint32_t maxSize
= packet->GetSize ();
  uint16_t extractedLength
;
  uint32_t padding
;
  uint32_t deserialized
= 0;

 
while (deserialized < maxSize)
   
{
      deserialized
+= packet->RemoveHeader (header);
      extractedLength
= header.GetLength ();
      extractedMsdu
= packet->CreateFragment (0, static_cast<uint32_t> (extractedLength));
      packet
->RemoveAtStart (extractedLength);
      deserialized
+= extractedLength;

      padding
= 0; // I'm not adding any padding so the condition below is useless
     
if (padding > 0 && deserialized < maxSize)
       
{
          packet
->RemoveAtStart (padding);
          deserialized
+= padding;
       
}
   
     
if (!m_promiscRxCallback.IsNull ())
       
{
          m_promiscRxCallback
(this, extractedMsdu, protocol, header.GetSourceAddr (), header.GetDestinationAddr (), packetType);
       
}

     
//
     
// If this packet is not destined for some other host, it must be for us
     
// as either a broadcast, multicast or unicast.  We need to hit the mac
     
// packet received trace hook and forward the packet up the stack.
     
//
     
if (packetType != PACKET_OTHERHOST)
       
{
          m_rxCallback
(this, extractedMsdu, protocol, header.GetSourceAddr ());
       
}
   
}

You will notice that I've simply copy pasted and modified (just one-two lines) from msdu-aggregator.cc file. I don't want to do anything fancy here. I'm just trying to do send an aggregated packet. (if you have any other approach for doing packet aggregation, please share it with me).

If you think that this part is not causing the error, please let me know what could possibly cause this error and I'll try to find the bug.

Thank you.


PN

unread,
Jan 6, 2016, 12:05:19 AM1/6/16
to ns-3-users
Hey guys,

I'm still stuck with this problem. If you could help me out that would be great! Thanks.

Tommaso Pecorella

unread,
Jan 6, 2016, 6:00:52 AM1/6/16
to ns-3-users
Hi,

no idea, the problem could also be elsewhere (e.g., a memory leak).
Try running your program using valgrind. It's very annoying, but it does help a LOT (I found hidden bugs in my code with it).
O course it's allo possible that you have found a new bug, so let us know the hunt results. In case you can't figure out (again) what the problem is we can go deeper in the analysis, but we'll also need a working example to debug.

Cheers,

T.
Reply all
Reply to author
Forward
0 new messages