summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-11-07 00:04:28 +0000
committergVisor bot <gvisor-bot@google.com>2020-11-07 00:04:28 +0000
commit51af19d9f51d289d1e8d9ffed260d0b6a754ec7d (patch)
tree5e9663e1886713d052365777ec76c00b8a049c86 /pkg
parent09a83772adfcb3ee5c833883978492c55ad5567f (diff)
parent5288e194156a72a3efae7794e46e44f1dd0d7427 (diff)
Merge release-20201030.0-46-g5288e1941 (automated)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tcpip/link/sniffer/sniffer.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/tcpip/link/sniffer/sniffer.go b/pkg/tcpip/link/sniffer/sniffer.go
index 560477926..b3e8c4b92 100644
--- a/pkg/tcpip/link/sniffer/sniffer.go
+++ b/pkg/tcpip/link/sniffer/sniffer.go
@@ -205,7 +205,12 @@ func logPacket(prefix string, protocol tcpip.NetworkProtocolNumber, pkt *stack.P
//
// We don't clone the original packet buffer so that the new packet buffer
// does not have any of its headers set.
- pkt = stack.NewPacketBuffer(stack.PacketBufferOptions{Data: buffer.NewVectorisedView(pkt.Size(), pkt.Views())})
+ //
+ // We trim the link headers from the cloned buffer as the sniffer doesn't
+ // handle link headers.
+ vv := buffer.NewVectorisedView(pkt.Size(), pkt.Views())
+ vv.TrimFront(len(pkt.LinkHeader().View()))
+ pkt = stack.NewPacketBuffer(stack.PacketBufferOptions{Data: vv})
switch protocol {
case header.IPv4ProtocolNumber:
if ok := parse.IPv4(pkt); !ok {