[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about TLV, subTLVs and length



Hello,

The current text defining the length of TLVs is the following:

>    The Length field defines the length of the value portion in octets
>    (thus a TLV with no value portion would have a length of zero).  The
>    TLV is padded to four-octet alignment; padding is not included in the
>    length field (so a three octet value would have a length of three,
>    but the total size of the TLV would be eight octets).  Nested TLVs
>    are also 32-bit aligned.  For example, a one-byte value would have
>    the length field set to 1, and three octets of padding would be added
>    to the end of the value portion of the TLV.  Unrecognized types are
>    ignored.

To me this seems very unclear about the handling of lengths of subTLVs,
and their impact on the length of the upper TLV.
The padding after a subTLV should of course not be included in the
length of that subTLV. But should that padding be included in the length
of the (enclosing) TLV?

I would think that the padding for the subTLV should be included in the
length of the enclosing TLV. Most of the time it is possible to deduce
the length, but if more than 4 bytes of padding are added, you run into
problems.

I really couldn't find a definitive answer on this anywhere, it may be
worth defining this somewhere, as the current wording is not clear on
this issue.

Jeroen.