diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2019-03-29 12:04:42 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-03-29 12:05:43 -0700 |
commit | 45c54b1f4e2bb6fcad14b8b7734d6a1847329901 (patch) | |
tree | edcb16a05eb4799210f2a1308677f24e64517186 /pkg/tcpip/transport/udp | |
parent | cc0e96a4bd3348ecc2a636fd90118b8e5cce672c (diff) |
Fix incorrect checksums in TCP and UDP tests.
PiperOrigin-RevId: 241025361
Change-Id: I292e7aea9a4b294b11e4f736e107010d9524586b
Diffstat (limited to 'pkg/tcpip/transport/udp')
-rw-r--r-- | pkg/tcpip/transport/udp/udp_test.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/pkg/tcpip/transport/udp/udp_test.go b/pkg/tcpip/transport/udp/udp_test.go index 0d5871615..2f4e94c58 100644 --- a/pkg/tcpip/transport/udp/udp_test.go +++ b/pkg/tcpip/transport/udp/udp_test.go @@ -195,9 +195,7 @@ func (c *testContext) sendV6Packet(payload []byte, h *headers) { }) // Calculate the UDP pseudo-header checksum. - xsum := header.Checksum([]byte(testV6Addr), 0) - xsum = header.Checksum([]byte(stackV6Addr), xsum) - xsum = header.Checksum([]byte{0, uint8(udp.ProtocolNumber)}, xsum) + xsum := header.PseudoHeaderChecksum(udp.ProtocolNumber, testV6Addr, stackV6Addr, uint16(len(u))) // Calculate the UDP checksum and set it. xsum = header.Checksum(payload, xsum) @@ -233,9 +231,7 @@ func (c *testContext) sendPacket(payload []byte, h *headers) { }) // Calculate the UDP pseudo-header checksum. - xsum := header.Checksum([]byte(testAddr), 0) - xsum = header.Checksum([]byte(stackAddr), xsum) - xsum = header.Checksum([]byte{0, uint8(udp.ProtocolNumber)}, xsum) + xsum := header.PseudoHeaderChecksum(udp.ProtocolNumber, testAddr, stackAddr, uint16(len(u))) // Calculate the UDP checksum and set it. xsum = header.Checksum(payload, xsum) |