summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/link/loopback
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-04-27 19:30:05 +0000
committergVisor bot <gvisor-bot@google.com>2020-04-27 19:30:05 +0000
commit78ea854d8b4053e084a87298f0d3f99ac1684473 (patch)
treef2c17744543bfb81ea8b3df199941a3b3082c063 /pkg/tcpip/link/loopback
parent423dc64b50359fac50ecce08d7a2815ed4607da2 (diff)
parent55f0c3316af8ea2a1fcc16511efc580f307623f6 (diff)
Merge release-20200323.0-253-g55f0c33 (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 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,