Commit 861d7f74 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

netem: cleanup dump code

Use nla_put_nested to update netlink attribute value.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 290f5e3b
...@@ -562,8 +562,7 @@ static void netem_destroy(struct Qdisc *sch) ...@@ -562,8 +562,7 @@ static void netem_destroy(struct Qdisc *sch)
static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
{ {
const struct netem_sched_data *q = qdisc_priv(sch); const struct netem_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb_tail_pointer(skb); struct nlattr *nla = (struct nlattr *) skb_tail_pointer(skb);
struct nlattr *nla = (struct nlattr *) b;
struct tc_netem_qopt qopt; struct tc_netem_qopt qopt;
struct tc_netem_corr cor; struct tc_netem_corr cor;
struct tc_netem_reorder reorder; struct tc_netem_reorder reorder;
...@@ -590,12 +589,10 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) ...@@ -590,12 +589,10 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
corrupt.correlation = q->corrupt_cor.rho; corrupt.correlation = q->corrupt_cor.rho;
NLA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt); NLA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt);
nla->nla_len = skb_tail_pointer(skb) - b; return nla_nest_end(skb, nla);
return skb->len;
nla_put_failure: nla_put_failure:
nlmsg_trim(skb, b); nlmsg_trim(skb, nla);
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment