netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: Alexander Duyck <alexander.duyck@gmail.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Alexander Duyck <alexander.h.duyck@intel.com>
Subject: Re: [PATCH] IPROUTE: correct nla nested message generated by netem_parse_opt
Date: Wed, 27 Aug 2008 16:41:22 +0200	[thread overview]
Message-ID: <20080827144122.GT20815@postel.suug.ch> (raw)
In-Reply-To: <5f2db9d90808211937o1d9b33t9ad933938872e08d@mail.gmail.com>

* 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)

  parent reply	other threads:[~2008-08-27 14:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-22  0:50 [PATCH] IPROUTE: correct nla nested message generated by netem_parse_opt Jeff Kirsher
2008-08-22  1:19 ` Stephen Hemminger
2008-08-22  2:37   ` Alexander Duyck
2008-08-22 10:44     ` David Miller
2008-08-27 14:41     ` Thomas Graf [this message]
2008-08-27 16:30       ` Duyck, Alexander H
2008-08-27 20:47         ` Thomas Graf
2008-08-27 21:10           ` Stephen Hemminger
2008-08-28  6:47       ` David Miller
2008-08-28 10:18         ` Thomas Graf
2008-08-28 10:19           ` David Miller
2008-08-28 13:03             ` [PATCH 2.6.26.y] sch_prio: Fix nla_parse_nested_compat() regression Thomas Graf
2008-09-03  0:31               ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080827144122.GT20815@postel.suug.ch \
    --to=tgraf@suug.ch \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.duyck@gmail.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).