From 352ae1022ce19de28fc72e034cc469872ad79d06 Mon Sep 17 00:00:00 2001 From: aleksej Date: Sun, 27 Oct 2019 15:14:35 +0300 Subject: Add /proc/sys/net/ipv4/ip_forward --- pkg/tcpip/network/ipv4/ipv4.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pkg/tcpip/network') 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) } -- cgit v1.2.3