Closed buptczq closed 5 years ago
The checksum of echo packet is set here for raw socket: https://github.com/google/netstack/blob/bd29f38290adc0480bbfa21405f73b8e1f3e7989/tcpip/network/ipv4/icmp.go#L87-L89
The checksum of reply packet is calculated here without clearing the checksum in header: https://github.com/google/netstack/blob/bd29f38290adc0480bbfa21405f73b8e1f3e7989/tcpip/network/ipv4/icmp.go#L95-L97
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)))
That did appear to be the fix. Thanks @buptczq!
The checksum of echo packet is set here for raw socket: https://github.com/google/netstack/blob/bd29f38290adc0480bbfa21405f73b8e1f3e7989/tcpip/network/ipv4/icmp.go#L87-L89
The checksum of reply packet is calculated here without clearing the checksum in header: https://github.com/google/netstack/blob/bd29f38290adc0480bbfa21405f73b8e1f3e7989/tcpip/network/ipv4/icmp.go#L95-L97
Is it should be written as the following?