From f56fe66b13b979f2ac96e8fce6fb0a5dec9a32e0 Mon Sep 17 00:00:00 2001 From: Ghanan Gowripalan Date: Tue, 10 Mar 2020 17:50:47 -0700 Subject: Honour the link's MaxHeaderLength when forwarding This change also updates where the IP packet buffer is held in an outbound tcpip.PacketBuffer from Header to Data. This change removes unncessary copying of the IP packet buffer when forwarding. Test: stack_test.TestNICForwarding PiperOrigin-RevId: 300217972 --- pkg/tcpip/packet_buffer.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pkg/tcpip/packet_buffer.go') diff --git a/pkg/tcpip/packet_buffer.go b/pkg/tcpip/packet_buffer.go index ab24372e7..04852132c 100644 --- a/pkg/tcpip/packet_buffer.go +++ b/pkg/tcpip/packet_buffer.go @@ -39,8 +39,12 @@ type PacketBuffer struct { // payload. DataSize int - // Header holds the headers of outbound packets. As a packet is passed - // down the stack, each layer adds to Header. + // Header holds the headers of outbound packets generated by the netstack. As + // a packet is passed down the stack, each layer adds to Header. + // + // Note, if a packet is being forwarded at the IP layer, the headers for the + // IP layer and above (transport) will be held in Data as the packet was not + // passed down the stack it arrived at before being forwarded. Header buffer.Prependable // These fields are used by both inbound and outbound packets. They -- cgit v1.2.3