All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next 1/6] [PATCH 5/9] netem: cleanup dump code
Date: Wed, 23 Feb 2011 15:04:17 -0800	[thread overview]
Message-ID: <20110223230534.078421197@vyatta.com> (raw)
In-Reply-To: 20110223230416.532009518@vyatta.com

[-- Attachment #1: netem-dump.patch --]
[-- Type: text/plain, Size: 1115 bytes --]

Use nla_put_nested to update netlink attribute value.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 net/sched/sch_netem.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

--- a/net/sched/sch_netem.c	2011-02-23 14:43:09.114302606 -0800
+++ b/net/sched/sch_netem.c	2011-02-23 14:43:27.598650361 -0800
@@ -562,8 +562,7 @@ static void netem_destroy(struct Qdisc *
 static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
 	const struct netem_sched_data *q = qdisc_priv(sch);
-	unsigned char *b = skb_tail_pointer(skb);
-	struct nlattr *nla = (struct nlattr *) b;
+	struct nlattr *nla = (struct nlattr *) skb_tail_pointer(skb);
 	struct tc_netem_qopt qopt;
 	struct tc_netem_corr cor;
 	struct tc_netem_reorder reorder;
@@ -590,12 +589,10 @@ static int netem_dump(struct Qdisc *sch,
 	corrupt.correlation = q->corrupt_cor.rho;
 	NLA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt);
 
-	nla->nla_len = skb_tail_pointer(skb) - b;
-
-	return skb->len;
+	return nla_nest_end(skb, nla);
 
 nla_put_failure:
-	nlmsg_trim(skb, b);
+	nlmsg_trim(skb, nla);
 	return -1;
 }
 



  reply	other threads:[~2011-02-23 23:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-23 23:04 [PATCH net-next 0/6] netem patches Stephen Hemminger
2011-02-23 23:04 ` Stephen Hemminger [this message]
2011-02-23 23:04 ` [PATCH net-next 2/6] netem: use vmalloc for distribution table Stephen Hemminger
2011-02-23 23:04 ` [PATCH net-next 3/6] netem: define NETEM_DIST_MAX Stephen Hemminger
2011-02-23 23:04 ` [PATCH net-next 4/6] [PATCH] Revert "sch_netem: Remove classful functionality" Stephen Hemminger
2011-02-23 23:04 ` [PATCH net-next 5/6] netem: revised correlated loss generator Stephen Hemminger
2011-02-23 23:04 ` [PATCH net-next 6/6] netem: update version and cleanup Stephen Hemminger
2011-02-25  6:14 ` [PATCH net-next 0/6] netem patches 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=20110223230534.078421197@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.