XDP mode IPv6 header handling
Hi!
While reviewing the XDP RX implementation in Knot, I noticed that the IPv6 header handling appears to be assuming one of the following two fixed header sequences:
- IPv6 header
- Fragment header
- Upper-Layer header
or
- IPv6 header
- Upper-Layer header
However, there can be other types of IPv6 extension headers that can intervene between the IPv6 header and the fragment header, or between the fragment header and the upper-layer header, or between the IPv6 header and the upper-layer header. The recommended extension header order listed in RFC 8200 section 4.1 is:
- IPv6 header
- Hop-by-Hop Options header
- Destination Options header
- Routing header
- Fragment header
- Authentication header
- Encapsulating Security Payload header
- Destination Options header
- Upper-Layer header
I noticed there is an <xdp/parsing_helpers.h>
header shipped by libxdp that includes a basic IPv6 extension header skipping implementation although it's probably not usable as-is since it doesn't indicate to the caller whether a fragment header was encountered in the header chain, which the Knot XDP implementation needs later in order to make a decision on the packet.