Bug 53

Summary: Bug in Packet::AddTrailer
Product: ns-3 Reporter: Gustavo J. A. M. Carneiro <gjcarneiro>
Component: coreAssignee: ns-bugs <ns-bugs>
Status: RESOLVED INVALID    
Severity: blocker    
Priority: P1    
Version: pre-release   
Hardware: PC   
OS: Linux   

Description Gustavo J. A. M. Carneiro 2007-07-17 09:44:49 UTC
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 UTC
This is not a bug: if you read the documentation for Trailer::SerializeTo and Trailer::DeserializeFrom, this behavior is clearly explained.