diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-05-06 20:43:19 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-06 20:43:19 +0000 |
commit | dafa5cb5fa6f0844545a159c6bf6d1beb388dbe7 (patch) | |
tree | bd6d85028edb0ea0928e915dc5e3939a7c7cc9c2 /pkg/tcpip/link | |
parent | d5ccc14d14818e2f8cd383a124f5013962469297 (diff) | |
parent | b08222cf3a80a57e77ac4af7a410f188ba01e0f4 (diff) |
Merge release-20200422.0-36-gb08222c (automated)
Diffstat (limited to 'pkg/tcpip/link')
-rw-r--r-- | pkg/tcpip/link/sniffer/sniffer.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/tcpip/link/sniffer/sniffer.go b/pkg/tcpip/link/sniffer/sniffer.go index 0799c8f4d..da1c520ae 100644 --- a/pkg/tcpip/link/sniffer/sniffer.go +++ b/pkg/tcpip/link/sniffer/sniffer.go @@ -391,7 +391,7 @@ func logPacket(prefix string, protocol tcpip.NetworkProtocolNumber, pkt *stack.P break } udp := header.UDP(hdr) - if fragmentOffset == 0 && len(udp) >= header.UDPMinimumSize { + if fragmentOffset == 0 { srcPort = udp.SourcePort() dstPort = udp.DestinationPort() details = fmt.Sprintf("xsum: 0x%x", udp.Checksum()) @@ -405,14 +405,14 @@ func logPacket(prefix string, protocol tcpip.NetworkProtocolNumber, pkt *stack.P break } tcp := header.TCP(hdr) - if fragmentOffset == 0 && len(tcp) >= header.TCPMinimumSize { + if fragmentOffset == 0 { offset := int(tcp.DataOffset()) if offset < header.TCPMinimumSize { details += fmt.Sprintf("invalid packet: tcp data offset too small %d", offset) break } - if offset > len(tcp) && !moreFragments { - details += fmt.Sprintf("invalid packet: tcp data offset %d larger than packet buffer length %d", offset, len(tcp)) + if offset > vv.Size() && !moreFragments { + details += fmt.Sprintf("invalid packet: tcp data offset %d larger than packet buffer length %d", offset, vv.Size()) break } |