Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing / Checksum calc issue when crafting IPv6 ICMP6 packets #204

Open
TechnikEmpire opened this issue Oct 11, 2023 · 0 comments
Open

Comments

@TechnikEmpire
Copy link

Hi there,

I was writing some unit tests that involved crafting ICMP6 packets with your library and comparing computed checksums of your library against my own implementation of checksum calcs.

What's strange is that if I create an ICMP6 payload in a byte array, create an instance of IcmpV6Packet from that byte array, then create an instance of IPv6Packet.RandomPacket(), then make the ICMP packet the payload packet of the IPv6Packet and calc checksums, I don't get expected values. Yet, if I take a pcap payload of the same thing and simply parse it all like this:

 var ipv6Packet = new IPv6Packet(new PacketDotNet.Utils.ByteArraySegment(arr));
 var icmpPacket = ipv6Packet.PayloadPacket as PacketDotNet.IcmpV6Packet;

Everything is as expected. It looks like what is happening when crafting is that the first 32 bits of the payload are getting collapsed into the tail 32 bits of the ICMP header. I'm unsure if this is correct behaviour. To be honest I'm still not sure if this is a bug of mine or yours, I'm only leaning lightly in your direction because of the inconsistency between crafting with the API and parsing complete packets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant