summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/link/loopback
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-05-01 23:14:25 +0000
committergVisor bot <gvisor-bot@google.com>2020-05-01 23:14:25 +0000
commitf7891792e2cd4371c22e6a5218dba42df1b14d8b (patch)
treeeeae48568d09f136ba741a4d96ff4834827927e0 /pkg/tcpip/link/loopback
parenta0b1393845a7cd6bf9da3b7d83e5c044989f204e (diff)
parent5e1e61fbcbe8fa3cc8b104fadb8cdef3ad29c31f (diff)
Merge release-20200422.0-11-g5e1e61f (automated)
Diffstat (limited to 'pkg/tcpip/link/loopback')
-rw-r--r--pkg/tcpip/link/loopback/loopback.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/tcpip/link/loopback/loopback.go b/pkg/tcpip/link/loopback/loopback.go
index 1e2255bfa..073c84ef9 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 {
- // Reject the packet if it's shorter than an ethernet header.
- if vv.Size() < header.EthernetMinimumSize {
+ // 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.
return tcpip.ErrBadAddress
}
-
- // There should be an ethernet header at the beginning of vv.
- linkHeader := header.Ethernet(vv.First()[:header.EthernetMinimumSize])
+ linkHeader := header.Ethernet(hdr)
vv.TrimFront(len(linkHeader))
e.dispatcher.DeliverNetworkPacket(e, "" /* remote */, "" /* local */, linkHeader.Type(), stack.PacketBuffer{
Data: vv,