Skip to content

Commit

Permalink
move decoded into tcpParser
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcacheux committed Oct 16, 2024
1 parent 6dade5e commit 2b97362
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/networkpath/traceroute/tcp/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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)
}

Expand Down

0 comments on commit 2b97362

Please sign in to comment.