netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: Re: [PATCH] IPROUTE: correct nla nested message generated by netem_parse_opt
Date: Thu, 21 Aug 2008 21:19:41 -0400	[thread overview]
Message-ID: <20080821211941.66090862@speedy> (raw)
In-Reply-To: <20080822005011.4615.98303.stgit@jtkirshe-mobile.jf.intel.com>

On Thu, 21 Aug 2008 17:50:11 -0700
Jeff Kirsher <jeffrey.t.kirsher@intel.com> wrote:

> From: Alexander Duyck <alexander.h.duyck@intel.com>
> 
> netem_parse_opt was generating a malformed nested compat message.  This patch
> corrects it so that the nested arguments are contained within a nested nla
> header.
> 
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> 
>  tc/q_netem.c |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/tc/q_netem.c b/tc/q_netem.c
> index d06932e..a3365c1 100644
> --- a/tc/q_netem.c
> +++ b/tc/q_netem.c
> @@ -128,7 +128,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
>  			   struct nlmsghdr *n)
>  {
>  	size_t dist_size = 0;
> -	struct rtattr *tail;
> +	struct rtattr *nest;
>  	struct tc_netem_qopt opt;
>  	struct tc_netem_corr cor;
>  	struct tc_netem_reorder reorder;
> @@ -257,8 +257,6 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
>  		argc--; argv++;
>  	}
>  
> -	tail = NLMSG_TAIL(n);
> -
>  	if (reorder.probability) {
>  		if (opt.latency == 0) {
>  			fprintf(stderr, "reordering not possible without specifying some delay\n");
> @@ -277,8 +275,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
>  		return -1;
>  	}
>  
> -	if (addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)) < 0)
> -		return -1;
> +	nest = addattr_nest_compat(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
>  
>  	if (present[TCA_NETEM_CORR] &&
>  	    addattr_l(n, 1024, TCA_NETEM_CORR, &cor, sizeof(cor)) < 0)
> @@ -299,7 +296,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
>  			return -1;
>  		free(dist_data);
>  	}
> -	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
> +	addattr_nest_compat_end(n, nest);
>  	return 0;
>  }
>  
> 

The kernel ABI can not change? The nested attribute order should not change.

  reply	other threads:[~2008-08-22  1:19 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 [this message]
2008-08-22  2:37   ` Alexander Duyck
2008-08-22 10:44     ` David Miller
2008-08-27 14:41     ` Thomas Graf
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=20080821211941.66090862@speedy \
    --to=shemminger@vyatta.com \
    --cc=akpm@linux-foundation.org \
    --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 \
    /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).