diff options
Diffstat (limited to 'pkg/tcpip/transport/tcp/testing')
-rw-r--r-- | pkg/tcpip/transport/tcp/testing/context/context.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/pkg/tcpip/transport/tcp/testing/context/context.go b/pkg/tcpip/transport/tcp/testing/context/context.go index fb4ae4a1b..aa2a73829 100644 --- a/pkg/tcpip/transport/tcp/testing/context/context.go +++ b/pkg/tcpip/transport/tcp/testing/context/context.go @@ -332,9 +332,8 @@ func (c *Context) BuildSegment(payload []byte, h *Headers) buffer.VectorisedView xsum = header.Checksum([]byte{0, uint8(tcp.ProtocolNumber)}, xsum) // Calculate the TCP checksum and set it. - length := uint16(header.TCPMinimumSize + len(h.TCPOpts) + len(payload)) xsum = header.Checksum(payload, xsum) - t.SetChecksum(^t.CalculateChecksum(xsum, length)) + t.SetChecksum(^t.CalculateChecksum(xsum)) // Inject packet. return buf.ToVectorisedView() @@ -487,9 +486,8 @@ func (c *Context) SendV6Packet(payload []byte, h *Headers) { xsum = header.Checksum([]byte{0, uint8(tcp.ProtocolNumber)}, xsum) // Calculate the TCP checksum and set it. - length := uint16(header.TCPMinimumSize + len(payload)) xsum = header.Checksum(payload, xsum) - t.SetChecksum(^t.CalculateChecksum(xsum, length)) + t.SetChecksum(^t.CalculateChecksum(xsum)) // Inject packet. c.linkEP.Inject(ipv6.ProtocolNumber, buf.ToVectorisedView()) |