From 45d1748fc5ced02748b1b9ca1072b17c8d92ba9f Mon Sep 17 00:00:00 2001 From: Louis Royer Date: Tue, 17 Oct 2023 16:56:28 +0200 Subject: [PATCH] Fix for extension headers serialization --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index b9e1db2..835b6da 100644 --- a/main.go +++ b/main.go @@ -131,7 +131,7 @@ func (g *GTPv1U) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.Serialize binary.BigEndian.PutUint16(data[2:4], g.MessageLength) binary.BigEndian.PutUint32(data[4:8], g.TEID) if g.ExtensionHeaderFlag || g.SequenceNumberFlag || g.NPDUFlag { - data, err := b.AppendBytes(4) + data, err := b.PrependBytes(4) if err != nil { return err } @@ -143,7 +143,7 @@ func (g *GTPv1U) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.Serialize // extensionLength is in 4-octet units extensionLength := (lContent + 2) / 4 // Get two extra byte for the next extension header type and length - data, err = b.AppendBytes(lContent + 2) + data, err = b.PrependBytes(lContent + 2) if err != nil { return err }