diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-04-21 14:21:23 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-21 14:21:23 +0000 |
commit | 80adf98cbdd5306410c005fc5ea1fe994cefb793 (patch) | |
tree | 6072591d14247853d92d3f0eeb72e7dfc960fd5f /pkg/tcpip/link/loopback | |
parent | 3e147501a7ad79a1eeee7530acbd74081cd5a8a3 (diff) | |
parent | 120d3b50f4875824ec69f0cc39a09ac84fced35c (diff) |
Merge release-20200323.0-199-g120d3b5 (automated)
Diffstat (limited to 'pkg/tcpip/link/loopback')
-rw-r--r-- | pkg/tcpip/link/loopback/loopback.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/tcpip/link/loopback/loopback.go b/pkg/tcpip/link/loopback/loopback.go index 073c84ef9..1e2255bfa 100644 --- a/pkg/tcpip/link/loopback/loopback.go +++ b/pkg/tcpip/link/loopback/loopback.go @@ -98,13 +98,13 @@ func (e *endpoint) WritePackets(*stack.Route, *stack.GSO, stack.PacketBufferList // WriteRawPacket implements stack.LinkEndpoint.WriteRawPacket. func (e *endpoint) WriteRawPacket(vv buffer.VectorisedView) *tcpip.Error { - // There should be an ethernet header at the beginning of vv. - hdr, ok := vv.PullUp(header.EthernetMinimumSize) - if !ok { - // Reject the packet if it's shorter than an ethernet header. + // Reject the packet if it's shorter than an ethernet header. + if vv.Size() < header.EthernetMinimumSize { return tcpip.ErrBadAddress } - linkHeader := header.Ethernet(hdr) + + // There should be an ethernet header at the beginning of vv. + linkHeader := header.Ethernet(vv.First()[:header.EthernetMinimumSize]) vv.TrimFront(len(linkHeader)) e.dispatcher.DeliverNetworkPacket(e, "" /* remote */, "" /* local */, linkHeader.Type(), stack.PacketBuffer{ Data: vv, |