From 2b973623e968c3f1b7c1c90063ec4be303a40903 Mon Sep 17 00:00:00 2001 From: Paul Cacheux Date: Wed, 16 Oct 2024 19:54:14 +0200 Subject: [PATCH] move decoded into `tcpParser` --- pkg/networkpath/traceroute/tcp/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/networkpath/traceroute/tcp/utils.go b/pkg/networkpath/traceroute/tcp/utils.go index 83a86ce56abc7e..fc5d887623d132 100644 --- a/pkg/networkpath/traceroute/tcp/utils.go +++ b/pkg/networkpath/traceroute/tcp/utils.go @@ -312,6 +312,7 @@ func parseICMP(header *ipv4.Header, payload []byte) (*icmpResponse, error) { type tcpParser struct { layer layers.TCP + decoded []gopacket.LayerType decodingLayerParser *gopacket.DecodingLayerParser } @@ -327,8 +328,7 @@ func (tp *tcpParser) parseTCP(header *ipv4.Header, payload []byte) (*tcpResponse return nil, fmt.Errorf("invalid IP header for TCP packet: %+v", header) } - var decoded []gopacket.LayerType - if err := tp.decodingLayerParser.DecodeLayers(payload, &decoded); err != nil { + if err := tp.decodingLayerParser.DecodeLayers(payload, &tp.decoded); err != nil { return nil, fmt.Errorf("failed to decode TCP packet: %w", err) }