Skip to content

Commit c8c2984

Browse files
bemarktnekohasekai
authored andcommitted
Fix wrong parameter in ICMPv4Checksum
1 parent 8cc5351 commit c8c2984

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stack_system.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ func (s *System) processIPv4ICMP(ipHdr header.IPv4, icmpHdr header.ICMPv4) error
586586
sourceAddress := ipHdr.SourceAddr()
587587
ipHdr.SetSourceAddr(ipHdr.DestinationAddr())
588588
ipHdr.SetDestinationAddr(sourceAddress)
589-
icmpHdr.SetChecksum(header.ICMPv4Checksum(icmpHdr, checksum.Checksum(icmpHdr.Payload(), 0)))
589+
icmpHdr.SetChecksum(header.ICMPv4Checksum(icmpHdr[:header.ICMPv4MinimumSize], checksum.Checksum(icmpHdr.Payload(), 0)))
590590
ipHdr.SetChecksum(0)
591591
ipHdr.SetChecksum(^ipHdr.CalculateChecksum())
592592
return nil

0 commit comments

Comments
 (0)