gvisor icon indicating copy to clipboard operation
gvisor copied to clipboard

packet buffer headers should have protocol number associated.

Open jelischer opened this issue 4 years ago • 12 comments

Packet headers are now tracked in the packet buffer structure using a special 'header' structure. This structure should maintain what type each header is as well as what layer it is (which is all it has now). In parts of the code where it is important to look at the transport header for example it is expensive to go back to re-examine the IPv6 header to find which kind of transport header is in the transport header storage (tcp? udp? icmp?). Since we already know this information at some stage it is probably worth while to save it with the header.

jelischer avatar Aug 30 '20 19:08 jelischer

It turns out that to do this we probably should fix the fact that ICMP never does a Consume() operation on the packet for the transport header, but leaves it in the Data segment. The reason for this is that ICMP processing happens even if the ICMP protocol is not available for use by upper layers and the setting of the header into its own section would normally be done by the upper ICMP code. The answer would be to have it done at the lower ICMP code in network/ipv[46]/icmp.c which is always present.

jelischer avatar Aug 30 '20 19:08 jelischer

cc @kevinGC

tamird avatar Aug 30 '20 21:08 tamird

Yes, there is a confusing coupling between ICMP sockets (enabled via stack.Options.TransportProtocols) and ICMP handling. They should share code, but the latter shouldn't depend on enabling the former.

For context: this came up when we added early header parsing, but wasn't needed immediately and so nobody allocated cycles for it.

kevinGC avatar Sep 02 '20 17:09 kevinGC

I could add some cycles to it while I have it fully loaded in my head.

jelischer avatar Sep 02 '20 23:09 jelischer

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Feb 04 '21 00:02 github-actions[bot]

This is done - packet buffers hold the network/transport protocol numbers

ghananigans avatar Dec 22 '21 18:12 ghananigans

There are still 5 TODOs referencing this issue.

tamird avatar Dec 22 '21 20:12 tamird

A friendly reminder that this issue had no activity for 120 days.

github-actions[bot] avatar Sep 14 '23 00:09 github-actions[bot]

This issue has been closed due to lack of activity.

github-actions[bot] avatar Dec 13 '23 00:12 github-actions[bot]

There are TODOs still referencing this issue:

  1. pkg/tcpip/network/ipv4/ipv4.go:1296: when we sort out ICMP and transport
  2. pkg/tcpip/transport/tcp/testing/context/context.go:351: Remove when protocol numbers are part
  3. pkg/tcpip/transport/tcp/testing/context/context.go:401: Remove when protocol numbers are part

Search TODO

github-actions[bot] avatar Dec 14 '23 00:12 github-actions[bot]

There are TODOs still referencing this issue:

  1. pkg/tcpip/stack/packet_buffer.go:128: This and the network protocol number should

Search TODO

github-actions[bot] avatar Dec 14 '23 00:12 github-actions[bot]

A friendly reminder that this issue had no activity for 120 days.

github-actions[bot] avatar Apr 13 '24 00:04 github-actions[bot]