google / google/gopacket

reading icmpv6 packet payload with ApplicationLayer.Payload() includes last 4 bytes of icmpv6 header

Open
#840 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Hello! I am receiving packets that can be icmpv4 or icmpv6, so I would like to read their payloads like this:

```golang
appLayer := packet.ApplicationLayer()
icmpPayload := appLayer.Payload()
````

When I receive an ICMPv4 packet, the payload doesn't include the icmp message body, or the final 4 bytes of the icmp header.
When I receive an ICMPv6 packet, the payload includes the icmp message body.

So for an identical payload received from some device, eg of 58 bytes, I would receive 58 bytes from an ICMPv4 packet decoded as above, and 62 from an ICMPv6 packet decoded as above.

Please let me know if this is expected!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.