diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2020-03-10 17:50:47 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-03-10 17:52:31 -0700 |
commit | f56fe66b13b979f2ac96e8fce6fb0a5dec9a32e0 (patch) | |
tree | e73883f0d5b4f56eefee4eea8755592332d1f3a4 /pkg/tcpip/packet_buffer.go | |
parent | d6440ec5a125746b76f189c0a5d5946dde9afc37 (diff) |
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
Diffstat (limited to 'pkg/tcpip/packet_buffer.go')
-rw-r--r-- | pkg/tcpip/packet_buffer.go | 8 |
1 files changed, 6 insertions, 2 deletions
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 |