summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/header/icmpv6.go
diff options
context:
space:
mode:
authorGhanan Gowripalan <ghanan@google.com>2019-10-25 16:05:31 -0700
committergVisor bot <gvisor-bot@google.com>2019-10-25 16:06:55 -0700
commit5a421058a07477e23f6ca23bb510894419224080 (patch)
tree2a195e7993861f27d0b65ea7fc2bacbdac338fa7 /pkg/tcpip/header/icmpv6.go
parent8f029b3f823342e43d23e2a238bc599596bdca24 (diff)
Validate the checksum for incoming ICMPv6 packets
This change validates the ICMPv6 checksum field before further processing an ICMPv6 packet. Tests: Unittests to make sure that only ICMPv6 packets with a valid checksum are accepted/processed. Existing tests using checker.ICMPv6 now also check the ICMPv6 checksum field. PiperOrigin-RevId: 276779148
Diffstat (limited to 'pkg/tcpip/header/icmpv6.go')
-rw-r--r--pkg/tcpip/header/icmpv6.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/tcpip/header/icmpv6.go b/pkg/tcpip/header/icmpv6.go
index c2bfd8c79..b4037b6c8 100644
--- a/pkg/tcpip/header/icmpv6.go
+++ b/pkg/tcpip/header/icmpv6.go
@@ -132,7 +132,7 @@ func (b ICMPv6) Checksum() uint16 {
return binary.BigEndian.Uint16(b[icmpv6ChecksumOffset:])
}
-// SetChecksum calculates and sets the ICMP checksum field.
+// SetChecksum sets the ICMP checksum field.
func (b ICMPv6) SetChecksum(checksum uint16) {
binary.BigEndian.PutUint16(b[icmpv6ChecksumOffset:], checksum)
}
@@ -197,7 +197,7 @@ func (b ICMPv6) Payload() []byte {
return b[ICMPv6PayloadOffset:]
}
-// ICMPv6Checksum calculates the ICMP checksum over the provided ICMP header,
+// ICMPv6Checksum calculates the ICMP checksum over the provided ICMPv6 header,
// IPv6 src/dst addresses and the payload.
func ICMPv6Checksum(h ICMPv6, src, dst tcpip.Address, vv buffer.VectorisedView) uint16 {
// Calculate the IPv6 pseudo-header upper-layer checksum.