diff options
-rwxr-xr-x | pkg/tcpip/packet_buffer.go | 8 | ||||
-rw-r--r-- | pkg/tcpip/stack/nic.go | 6 |
2 files changed, 5 insertions, 9 deletions
diff --git a/pkg/tcpip/packet_buffer.go b/pkg/tcpip/packet_buffer.go index 04852132c..ab24372e7 100755 --- a/pkg/tcpip/packet_buffer.go +++ b/pkg/tcpip/packet_buffer.go @@ -39,12 +39,8 @@ type PacketBuffer struct { // payload. DataSize int - // 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 holds the headers of outbound packets. As a packet is passed + // down the stack, each layer adds to Header. Header buffer.Prependable // These fields are used by both inbound and outbound packets. They diff --git a/pkg/tcpip/stack/nic.go b/pkg/tcpip/stack/nic.go index e46bd86c6..cd9202aed 100644 --- a/pkg/tcpip/stack/nic.go +++ b/pkg/tcpip/stack/nic.go @@ -1246,10 +1246,10 @@ func (n *NIC) DeliverNetworkPacket(linkEP LinkEndpoint, remote, local tcpip.Link } func (n *NIC) forwardPacket(r *Route, protocol tcpip.NetworkProtocolNumber, pkt tcpip.PacketBuffer) { - // TODO(b/143425874): Decrease the TTL field in forwarded packets. + // TODO(b/143425874) Decrease the TTL field in forwarded packets. + pkt.Header = buffer.NewPrependableFromView(pkt.Data.First()) + pkt.Data.RemoveFirst() - // pkt.Header should have enough capacity to hold the link's headers. - pkt.Header = buffer.NewPrependable(int(n.linkEP.MaxHeaderLength())) if err := n.linkEP.WritePacket(r, nil /* gso */, protocol, pkt); err != nil { r.Stats().IP.OutgoingPacketErrors.Increment() return |