Subject: [ipfix-protocol] variable length IE's and padding

From: Paul Aitken <[email-masked]>
Date: Tue, 06 Dec 2005 16:02:01 +0000

Section 7 of the IPFIX protocol draft specifies two formats for variable 
length Information Elements: a shorter format for length < 255 octets, 
and a longer format for length 255 to 65535 octets.

With the shorter format, lengths of L = { 0 ... 254 } result in L + 1 
data octets, since one octet is required for the length itself.

With the longer format, lengths of L = { 255 ... 65535 } result in L + 3 
data octets, since three octets are required for the 255 and 16 bit length.

But consider the case of variable length padding. There's a gap between 
these two ranges, so it's not possible to make padding of 256 or 257 
octets! The shorter format allows a maximum of 255 padding octets, while 
the longer format allows a minimum of 258 padding octets!

So I propose that the restriction on the longer format be lifted, so it 
may be used for sizes from 0 to 65535 octets - ie the "255 to 65535" be 
replaced with "0 to 65535", or simply removed.

This may also simplify smaller exporters, which may not then need to 
impliment the shorter format.

Any comments?

-- 
Paul Aitken
Cisco Systems Ltd, Edinburgh, Scotland.

--
Help        mailto:[email-masked] and say "help" in message body
Unsubscribe mailto:[email-masked] and say
"unsubscribe ipfix" in message body
Archive     http://ipfix.doit.wisc.edu/archive/

---

From: Benoit Claise <[email-masked]>
Date: Thu, 08 Dec 2005 09:09:57 +0100

Paul,
> Section 7 of the IPFIX protocol draft specifies two formats for 
> variable length Information Elements: a shorter format for length < 
> 255 octets, and a longer format for length 255 to 65535 octets.
>
> With the longer format, lengths of L = { 255 ... 65535 } result in L + 
> 3 data octets, since three octets are required for the 255 and 16 bit 
> length.
>
> But consider the case of variable length padding. There's a gap 
> between these two ranges, so it's not possible to make padding of 256 
> or 257 octets! The shorter format allows a maximum of 255 padding 
> octets, while the longer format allows a minimum of 258 padding octets!
>
> So I propose that the restriction on the longer format be lifted, so 
> it may be used for sizes from 0 to 65535 octets - ie the "255 to 
> 65535" be replaced with "0 to 65535", or simply removed.
>
That makes sense to me.
Would the following text be OK?

In most cases the length of the Information Element will be less than 
255 octets.  The following length encoding mechanism optimizes the 
overhead of carrying the Information Element length in this majority 
case.  The length is carried in the octet before the Information 
Element, as shown in Figure R.

    0                   1                   2                   3

    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   | Length (< 255)|          Information element                  |

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   |                      ... continuing as needed                 |

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

 Figure R: Variable Length Information Element (length < 255 octets)

If the length of the Information Element is greater than or equal to 255 
octets, the length is encoded into 3 octets before the Information 
Element. The first octet is 255 and the length is carried in the second 
and third octets, as shown in Figure S.

    0                   1                   2                   3

    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   |      255      |      Length (0 to 65535)      |       IE      |

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   |                      ... continuing as needed                 |

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Figure S: Variable Length Information Element
            (length 255 to 65535) octets

Regards, Benoit.

---

From: Stewart Bryant <[email-masked]>
Date: Thu, 08 Dec 2005 17:51:48 +0000

Benoit Clais

>  
>
> If the length of the Information Element is greater than or equal to 
> 255 octets, the length is
>
MAY be great than or equal to 255 - you may use the format for 0..254 if 
it is more
convenient.

> encoded into 3 octets before the Information Element. The first octet 
> is 255 and the length is carried in the second and third octets, as 
> shown in Figure S.
>
>  
>
SNIP

>             (length 255 to 65535) octets
length 0 to 65535

- Stewart

---

From: Benoit Claise <[email-masked]>
Date: Fri, 09 Dec 2005 00:30:02 +0100

Stewart,
> MAY be great than or equal to 255 - you may use the format for 0..254 
> if it is more
> convenient.
See below.
>>             (length 255 to 65535) octets
Corrected. Thanks.

This is what I have so far. Don't you think that this is enough?
We say:
    - first format is optimized for length < 255
    - if length >= 255 you must use the second format
    - and from the second format description, we see that it allows also 
< 255

    0                   1                   2                   3

    0                   1                   2                   3

   Figure S: Variable Length Information Element
            (length 0 to 65535) octets

Regards, Benoit.