summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorAustin Kiekintveld <akiek@google.com>2019-07-31 11:25:25 -0700
committergVisor bot <gvisor-bot@google.com>2019-07-31 11:26:41 -0700
commit12c4eb294a43f4a84a789871730869d164ef52c9 (patch)
treed765c0eed3a0d616e1bc229a68ee8e1073e96444 /pkg
parentc6e6d92cb116fb79a8acd2ee64726b6b53135ad4 (diff)
Fix ICMPv4 EchoReply packet checksum
The checksum was not being reset before being re-calculated and sent out. This caused the sent checksum to always be `0x0800`. Fixes #605. PiperOrigin-RevId: 260965059
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tcpip/network/ipv4/icmp.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/pkg/tcpip/network/ipv4/icmp.go b/pkg/tcpip/network/ipv4/icmp.go
index fbef6947d..497164cbb 100644
--- a/pkg/tcpip/network/ipv4/icmp.go
+++ b/pkg/tcpip/network/ipv4/icmp.go
@@ -94,6 +94,7 @@ func (e *endpoint) handleICMP(r *stack.Route, netHeader buffer.View, vv buffer.V
pkt := header.ICMPv4(hdr.Prepend(header.ICMPv4MinimumSize))
copy(pkt, h)
pkt.SetType(header.ICMPv4EchoReply)
+ pkt.SetChecksum(0)
pkt.SetChecksum(^header.Checksum(pkt, header.ChecksumVV(vv, 0)))
sent := stats.ICMP.V4PacketsSent
if err := r.WritePacket(nil /* gso */, hdr, vv, header.ICMPv4ProtocolNumber, r.DefaultTTL()); err != nil {