Bug 1395

Summary: AODV DeferredRouteOutputTag is a bug.
Product: ns-3 Reporter: Tommaso Pecorella <tommaso.pecorella>
Component: aodvAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: Fix for the Aodv DeferredOutputTag malformed tag

Description Tommaso Pecorella 2012-03-20 16:54:42 UTC
The function is seldom used, but it's useful.
Plus the bug could affect also PacketTags scanning.

If (in any portion of the code) you do this:

std::cout << "Tags: ";
packet->PrintPacketTags(std::cout);
std::cout << std::endl;

the result is:

Tags: assert failed. cond="item.GetTypeId ().HasConstructor ()", file=../src/network/model/packet.cc, line=871

I don't know when this was broken, but it worked once upon a time (in the west).

I checked if I can fix it, but I couldn't spot the bug. Adding Mathieu to the CC'ers as it seems that he was the original author.

T.
Comment 1 Mathieu Lacage 2012-03-23 12:10:01 UTC
This simply means that one of our Header or Trailer subclasses is missing a call to AddConstructor from its GetTypeId method
Comment 2 Tommaso Pecorella 2012-03-23 12:14:05 UTC
(In reply to comment #1)
> This simply means that one of our Header or Trailer subclasses is missing a
> call to AddConstructor from its GetTypeId method

The bug is in the code, but it's not where I assumed it was.

/// Tag used by AODV implementation
struct DeferredRouteOutputTag : public Tag
^^^^

Moreover this tag does not have a constructor defined in the GetTypeId function.

This is definitely a bad idea. A leakage of this tag into the upper layers was causing this bug.

Changing the bug name and scope.
Comment 3 Tommaso Pecorella 2012-03-23 20:29:50 UTC
Created attachment 1367 [details]
Fix for the Aodv DeferredOutputTag malformed tag

Simple patch. Just changed the struct to a class and added the proper constructor.
Comment 4 Tommaso Pecorella 2012-03-25 07:47:49 UTC
fixed in changeset 7792 - e3d19bee62e8