[P4-dev] Parsing TLV options for ICMPv6 ND (header stack?)
baptiste at bitsofnetworks.org
Thu Jun 30 11:55:07 EDT 2016
I haven't found a way to parse a stack of headers in P4, because the
number of elements in the stack (i.e. the number of "extract" operations
that needs to be run) is unknown at compile time.
I was attempting to do this to parse ICMPv6 ND options, but maybe this is
the wrong approach to this problem.
Conceptually, ICMPv6 looks like this (on top of IPv6):
Then, depending on the type, the format is different. For NS (type 135),
which is what I am interested to parse, the format is:
So far so good. The difficult part is "options", which is a list of one
or more options. Each option is TLV-formatted, see
https://tools.ietf.org/html/rfc4861#section-4.6 for details.
I think the only way to parse options is to first look at the IPv6 packet
length (to see if there actually are options), and then walk the option
list using the "length" field of each TLV. Now that I think about it, the
"header stack" idea will not work here, because not all options have the
Is parsing this even possible in P4? If so, what would be the best approach?
PS: I also have trouble implementing the checksum, since it encompasses
the whole ICMPv6 packet, but that will be for another email.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: not available
More information about the P4-dev