aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_u32.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-23 23:34:11 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:11:18 -0500
commit4b3550ef530cfc153fa91f0b37cbda448bad11c6 (patch)
tree02aba7497298f220629af8e47f48e56df86d428f /net/sched/cls_u32.c
parentcee63723b358e594225e812d6e14a2a0abfd5c88 (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/cls_u32.c')
-rw-r--r--net/sched/cls_u32.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 3228cc4ae082..b51c2c324abc 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -694,16 +694,16 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
694 struct sk_buff *skb, struct tcmsg *t) 694 struct sk_buff *skb, struct tcmsg *t)
695{ 695{
696 struct tc_u_knode *n = (struct tc_u_knode*)fh; 696 struct tc_u_knode *n = (struct tc_u_knode*)fh;
697 unsigned char *b = skb_tail_pointer(skb); 697 struct nlattr *nest;
698 struct nlattr *nla;
699 698
700 if (n == NULL) 699 if (n == NULL)
701 return skb->len; 700 return skb->len;
702 701
703 t->tcm_handle = n->handle; 702 t->tcm_handle = n->handle;
704 703
705 nla = (struct nlattr*)b; 704 nest = nla_nest_start(skb, TCA_OPTIONS);
706 NLA_PUT(skb, TCA_OPTIONS, 0, NULL); 705 if (nest == NULL)
706 goto nla_put_failure;
707 707
708 if (TC_U32_KEY(n->handle) == 0) { 708 if (TC_U32_KEY(n->handle) == 0) {
709 struct tc_u_hnode *ht = (struct tc_u_hnode*)fh; 709 struct tc_u_hnode *ht = (struct tc_u_hnode*)fh;
@@ -741,14 +741,15 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
741#endif 741#endif
742 } 742 }
743 743
744 nla->nla_len = skb_tail_pointer(skb) - b; 744 nla_nest_end(skb, nest);
745
745 if (TC_U32_KEY(n->handle)) 746 if (TC_U32_KEY(n->handle))
746 if (tcf_exts_dump_stats(skb, &n->exts, &u32_ext_map) < 0) 747 if (tcf_exts_dump_stats(skb, &n->exts, &u32_ext_map) < 0)
747 goto nla_put_failure; 748 goto nla_put_failure;
748 return skb->len; 749 return skb->len;
749 750
750nla_put_failure: 751nla_put_failure:
751 nlmsg_trim(skb, b); 752 nla_nest_cancel(skb, nest);
752 return -1; 753 return -1;
753} 754}
754 755