Bug 1078

Summary: PacketTagList::Add performs NS_ASSERT counting one byte too few
Product: ns-3 Reporter: Christian <c.facchini>
Component: coreAssignee: Mathieu Lacage <mathieu.lacage>
Severity: trivial CC: ns-bugs
Priority: P5    
Version: pre-release   
Hardware: All   
OS: All   

Description Christian 2011-03-24 09:27:05 EDT
The PacketTagList::Add (Tag) method checks that the tag being added is not greater than PACKET_TAG_MAX_SIZE.

  NS_ASSERT (tag.GetSerializedSize () < PACKET_TAG_MAX_SIZE);

PACKET_TAG_MAX_SIZE is set to 20.
The Tag in questions *can* contain an Inet6SocketAddress.
If that is the case its size will be:
  16 (IPv6 address) + 2 (port number) + 1+1 (as defined in Address::GetSerializedSize()) which sums up to 20, and systematically fails the assert.

I think that replacing '<' with '<=' fixes the issue.
Comment 1 Mathieu Lacage 2011-03-24 10:16:08 EDT
changeset afe2960e58b7