Bug 53 - Bug in Packet::AddTrailer
Bug in Packet::AddTrailer
Status: RESOLVED INVALID
Product: ns-3
Classification: Unclassified
Component: core
pre-release
PC Linux
: P1 blocker
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-17 09:44 EDT by Gustavo J. A. M. Carneiro
Modified: 2007-07-17 09:55 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo J. A. M. Carneiro 2007-07-17 09:44:49 EDT
I think there's a bug here, from what I could learn from the Buffer unit tests.  This patch should fix it:

diff -r e12a99f2e698 src/common/packet.h
--- a/src/common/packet.h       Tue Jul 17 14:34:27 2007 +0100
+++ b/src/common/packet.h       Tue Jul 17 14:43:13 2007 +0100
@@ -343,6 +343,7 @@ Packet::AddTrailer (T const &trailer)
   uint32_t size = trailer.GetSize ();
   m_buffer.AddAtEnd (size);
   Buffer::Iterator end = m_buffer.End ();
+  end.Prev (size);
   trailer.Serialize (end);
   m_metadata.AddTrailer (trailer, size);
 }
Comment 1 Mathieu Lacage 2007-07-17 09:55:34 EDT
This is not a bug: if you read the documentation for Trailer::SerializeTo and Trailer::DeserializeFrom, this behavior is clearly explained.