diff options
author | Patrick McHardy <kaber@trash.net> | 2008-01-23 23:34:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:11:18 -0500 |
commit | 4b3550ef530cfc153fa91f0b37cbda448bad11c6 (patch) | |
tree | 02aba7497298f220629af8e47f48e56df86d428f /net/sched/sch_atm.c | |
parent | cee63723b358e594225e812d6e14a2a0abfd5c88 (diff) |
[NET_SCHED]: Use nla_nest_start/nla_nest_end
Use nla_nest_start/nla_nest_end for dumping nested attributes.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_atm.c')
-rw-r--r-- | net/sched/sch_atm.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index aaa32a22726d..19c00074ba1f 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -605,8 +605,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | |||
605 | { | 605 | { |
606 | struct atm_qdisc_data *p = qdisc_priv(sch); | 606 | struct atm_qdisc_data *p = qdisc_priv(sch); |
607 | struct atm_flow_data *flow = (struct atm_flow_data *)cl; | 607 | struct atm_flow_data *flow = (struct atm_flow_data *)cl; |
608 | unsigned char *b = skb_tail_pointer(skb); | 608 | struct nlattr *nest; |
609 | struct nlattr *nla; | ||
610 | 609 | ||
611 | pr_debug("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n", | 610 | pr_debug("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n", |
612 | sch, p, flow, skb, tcm); | 611 | sch, p, flow, skb, tcm); |
@@ -614,8 +613,11 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | |||
614 | return -EINVAL; | 613 | return -EINVAL; |
615 | tcm->tcm_handle = flow->classid; | 614 | tcm->tcm_handle = flow->classid; |
616 | tcm->tcm_info = flow->q->handle; | 615 | tcm->tcm_info = flow->q->handle; |
617 | nla = (struct nlattr *)b; | 616 | |
618 | NLA_PUT(skb, TCA_OPTIONS, 0, NULL); | 617 | nest = nla_nest_start(skb, TCA_OPTIONS); |
618 | if (nest == NULL) | ||
619 | goto nla_put_failure; | ||
620 | |||
619 | NLA_PUT(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr); | 621 | NLA_PUT(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr); |
620 | if (flow->vcc) { | 622 | if (flow->vcc) { |
621 | struct sockaddr_atmpvc pvc; | 623 | struct sockaddr_atmpvc pvc; |
@@ -636,11 +638,12 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | |||
636 | 638 | ||
637 | NLA_PUT(skb, TCA_ATM_EXCESS, sizeof(zero), &zero); | 639 | NLA_PUT(skb, TCA_ATM_EXCESS, sizeof(zero), &zero); |
638 | } | 640 | } |
639 | nla->nla_len = skb_tail_pointer(skb) - b; | 641 | |
642 | nla_nest_end(skb, nest); | ||
640 | return skb->len; | 643 | return skb->len; |
641 | 644 | ||
642 | nla_put_failure: | 645 | nla_put_failure: |
643 | nlmsg_trim(skb, b); | 646 | nla_nest_cancel(skb, nest); |
644 | return -1; | 647 | return -1; |
645 | } | 648 | } |
646 | static int | 649 | static int |