Skip to content

Commit

Permalink
Fix wrong parameter in ICMPv4Checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
bemarkt authored and nekohasekai committed Feb 10, 2025
1 parent 8cc5351 commit c8c2984
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion stack_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ func (s *System) processIPv4ICMP(ipHdr header.IPv4, icmpHdr header.ICMPv4) error
sourceAddress := ipHdr.SourceAddr()
ipHdr.SetSourceAddr(ipHdr.DestinationAddr())
ipHdr.SetDestinationAddr(sourceAddress)
icmpHdr.SetChecksum(header.ICMPv4Checksum(icmpHdr, checksum.Checksum(icmpHdr.Payload(), 0)))
icmpHdr.SetChecksum(header.ICMPv4Checksum(icmpHdr[:header.ICMPv4MinimumSize], checksum.Checksum(icmpHdr.Payload(), 0)))
ipHdr.SetChecksum(0)
ipHdr.SetChecksum(^ipHdr.CalculateChecksum())
return nil
Expand Down

0 comments on commit c8c2984

Please sign in to comment.