Subject: Re: [PATCH 1/2] improve netem reorder flexibility

From: Stephen Hemminger <[email-masked]>
Date: Mon, 21 Dec 2009 09:54:07 -0800

On Fri, 18 Dec 2009 19:59:07 -0800 (PST)
David Miller <[email-masked]> wrote:

> From: Christian Samsel <[email-masked]>
> Date: Fri, 18 Dec 2009 19:01:28 +0100
> 
> > Am Freitag, 18. Dezember 2009 18:32:40 schrieb Stephen Hemminger:  
> >> On Fri, 18 Dec 2009 14:18:37 +0100
> >> 
> >> Christian Samsel <[email-masked]> wrote:  
> >> > This patch adds a new feature to netem: The newly introduced parameter
> >> > reorderdelay TIME is the time a reordered packet is delayed. It can be
> >> > used in a combination with delay TIME to enable netem to produce late
> >> > packets, which is not possible in the standard netem / iproute2. In the
> >> > standard version reordered packets are always sent immediately and
> >> > therefore are always early packets.  
> >> 
> >> I like the idea but is it binary compatible with older kernels/ older
> >>  iproute2 utilities?
> >>   
> > Thats a good point. I will test it. So far i think it should work.  
> 
> It won't work.
> 
> If you change the size of the tc_netem_qopt, older kernels will
> reject because the size is different from what the kernel expects.
> 
> So newer iproute2 will not work with older kernels.
> 
> You can't change these structures, add new netlink attributes
> to pass the new data instead.

The netem logic for parsing attributes is different from others for
historical reasons.  Looking at parse_attr():

If qopt is larger than expected, then the extra data is interpreted as
the following nested attribute.

If qopt is smaller than expected, then it returns -EINVAL.

Note: in early versions of netem development, the parsing was different,
and it was possible to grow the structure, but the attribute parsing got
changed and is now more restrictive.  BUT that is okay, since the correct
way to add options to netlink API's is to add new attributes, not extend
size of structures.