summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/network
diff options
context:
space:
mode:
authoraleksej <aleksej.paschenko@gmail.com>2019-10-27 15:14:35 +0300
committeraleksej <aleksej.paschenko@gmail.com>2019-10-27 15:28:15 +0300
commit352ae1022ce19de28fc72e034cc469872ad79d06 (patch)
treedaab172474c8a917a589a2142fc66ae9cba272c3 /pkg/tcpip/network
parent1c480abc39b9957606ff8bf125a5c253ad8a76cb (diff)
Add /proc/sys/net/ipv4/ip_forward
Diffstat (limited to 'pkg/tcpip/network')
-rw-r--r--pkg/tcpip/network/ipv4/ipv4.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/tcpip/network/ipv4/ipv4.go b/pkg/tcpip/network/ipv4/ipv4.go
index 1339f8474..90f4406e5 100644
--- a/pkg/tcpip/network/ipv4/ipv4.go
+++ b/pkg/tcpip/network/ipv4/ipv4.go
@@ -307,7 +307,9 @@ func (e *endpoint) WriteHeaderIncludedPacket(r *stack.Route, payload buffer.Vect
return nil
}
- hdr := buffer.NewPrependableFromView(payload.ToView())
+ // If we want to send the packet to a link-layer,
+ // we have to reserve space for an Ethernet header.
+ hdr := buffer.NewPrependableFromView(payload.ToView(), int(e.linkEP.MaxHeaderLength()))
r.Stats().IP.PacketsSent.Increment()
return e.linkEP.WritePacket(r, nil /* gso */, hdr, buffer.VectorisedView{}, ProtocolNumber)
}