[lkml]   [2008]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRE: [PATCH] IPROUTE: correct nla nested message generated by netem_parse_opt
>How was it ever supposed to work? The code looked like the following
>prior to commit b03f4672007e533c8dbf0965f995182586216bf1 which made
>it used nla_parse_nested_compat()
>- /* Handle nested options after initial queue options.
>- * Should have put all options in nested format but
>too late now.
>- */
>- if (nla_len(opt) > sizeof(*qopt)) {
>- struct nlattr *tb[TCA_NETEM_MAX + 1];
>- if (nla_parse(tb, TCA_NETEM_MAX,
>- nla_data(opt) + sizeof(*qopt),
>- nla_len(opt) - sizeof(*qopt), NULL))
>nla_parse_nested_compat() now does exactly what the above code does. So
>in what way has the kernel ABI changed?

This is exactly what I am talking about. Someone assumed it was just manually coding the nested compat format and it wasn't. It was using its own custom message format. The change you made changed the kernel ABI to support that custom format instead fixing the message sent to fit the kernel ABI format.

>There is two ways of sending a fixed struct + attributes inside an
>a) (old and outdated method)
> attr foo
> fixed struct
> [nested attr 1]
> [nested attr 2]
>This format can be parsed with nla_parse_nested_compat(attr foo)
>b) (new method)
> attr foo
> fixed struct
> attr container
> [nested attr 1]
> [nested attr 2]
>This format is parsed with nla_parse_nested(attr container)

I think you will find that format a only existed in netem prior to your changes in nla_parse_nested_compat, and the problem is option b, which was a nested compat attribute, can no longer be parsed at all. Basically what was generated before was an attribute with a nested attribute following it as data. Now what you have is an attribute followed by a series of other attributes.

Also you are incorrect about nla_parse_nested. The layout for it is something more like:

C) (nested format)
attr foo
[nested attr 1]
[nested attr 2]

This is the format parsed by nla_parse_nested. Basically what happened is that when you fixed things for netem you broke them for anyone else who might use the same message format. If you take a look at nla_nest_compat_start and nla_nest_compat_end you will see that the message generated matches format b, but now you are parsing format a. If the community insists that I can't change the kernel ABI back I am perfectly fine with that, but I think somebody needs to explain to me why we are handling two different formats and fix things so that the format is consistent.



 \ /
  Last update: 2008-08-27 18:33    [W:0.102 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site