lkml.org 
[lkml]   [2008]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] IPROUTE: correct nla nested message generated by netem_parse_opt
* Alexander Duyck <alexander.duyck@gmail.com> 2008-08-21 19:37
> The problem is the current kernel ABI was changed in commit
> b9a2f2e450b0f770bb4347ae8d48eb2dea701e24 "netlink: Fix
> nla_parse_nested_compat() to call nla_parse() directly" to support a
> format that I have only seen generated in netem_parse_opt. The kernel
> and prio_parse_opt qdisc both generate the other format which includes
> the extra attribute header to contain the nested attributes. This
> patch fixes tc so that netem will use the correct nested attribute
> order for kernels prior to this commit and once this commit has been
> reverted.

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?

There is two ways of sending a fixed struct + attributes inside an
attribute:

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)


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