Skip to content
This repository has been archived by the owner on May 20, 2020. It is now read-only.

ICMPv4 EchoReply packet's checksum is wrong #26

Closed
buptczq opened this issue Jul 10, 2019 · 1 comment
Closed

ICMPv4 EchoReply packet's checksum is wrong #26

buptczq opened this issue Jul 10, 2019 · 1 comment

Comments

@buptczq
Copy link

buptczq commented Jul 10, 2019

60971295-6778dd80-a356-11e9-8078-b867f449333d

The checksum of echo packet is set here for raw socket:

// It's possible that a raw socket expects to receive this.
h.SetChecksum(wantChecksum)
e.dispatcher.DeliverTransportPacket(r, header.ICMPv4ProtocolNumber, netHeader, vv)

The checksum of reply packet is calculated here without clearing the checksum in header:

copy(pkt, h)
pkt.SetType(header.ICMPv4EchoReply)
pkt.SetChecksum(^header.Checksum(pkt, header.ChecksumVV(vv, 0)))

Is it should be written as the following?

		pkt.SetType(header.ICMPv4EchoReply)
		// Clear the checksum
		pkt.SetChecksum(0)
		pkt.SetChecksum(^header.Checksum(pkt, header.ChecksumVV(vv, 0)))
@hbhasker
Copy link
Contributor

Do you mind refiling this under github.com/google/gvisor. This repo is a read-only fork of the netstack included in gVisor. This repo is not usually actively monitored nor do we directly commit to this repo.

@buptczq buptczq closed this as completed Jul 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants