I am trying to understand the UDP checksum calculation method for IPv6.
I have this packet:
IPv6 Header is -- 60 00 00 00 00 0c 11 fd 21 00 00 00 00 00 00 01 ab cd 00 00 00 00 00 01 fd 00 00 00 00 00 00 00 00 00 00 00 00 00 01 60
UDP Header is -- 26 92 26 92 00 0c 7e d5
Data is -- 12 34 56 78
As per the checksum calculation, the checksum is 7ed5. Can anyone explain how the checksum ended up with that value? I want to calculate it manually to understand the method.
In case this question hasn't been answered yet, and for the benefit of others.
Your IPv6 Packet UDP Packet (in Hex format)
Steps for calculating the checksum (0x7ED5) in the UDP header. All numbers are represented in hexadecimal format.
Step 1) Calculate 16-bit sum of pseudo header. The pseudo header contains Source IP, Destination IP, Protocol, UDP/TCP Length (header+body)
The sum of your pseudo header is:
Step 2) Calculate 16-bit sum of UDP Header + Data (excluding checksum)
The sum of your UDP section is:
Step 3) Calculate Total
Step 4) Calculate 16-bit Sum from total (since it is > 0xFFFF)
Step 5) Calculate one's compliment of the 16-bit Sum
Your checksum is 0x7ED5
The procedure is the same as with IPv4. The difference is just the length of the Source and Destination IP in the pseudo header (in step 1).