aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_tcindex.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_tcindex.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_tcindex.c')
-rw-r--r--net/sched/cls_tcindex.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index 6b84d276e5ac..cd350d38bdaf 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -437,13 +437,16 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
437 struct tcindex_data *p = PRIV(tp); 437 struct tcindex_data *p = PRIV(tp);
438 struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh; 438 struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh;
439 unsigned char *b = skb_tail_pointer(skb); 439 unsigned char *b = skb_tail_pointer(skb);
440 struct nlattr *nla; 440 struct nlattr *nest;
441 441
442 pr_debug("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n", 442 pr_debug("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n",
443 tp, fh, skb, t, p, r, b); 443 tp, fh, skb, t, p, r, b);
444 pr_debug("p->perfect %p p->h %p\n", p->perfect, p->h); 444 pr_debug("p->perfect %p p->h %p\n", p->perfect, p->h);
445 nla = (struct nlattr *) b; 445
446 NLA_PUT(skb, TCA_OPTIONS, 0, NULL); 446 nest = nla_nest_start(skb, TCA_OPTIONS);
447 if (nest == NULL)
448 goto nla_put_failure;
449
447 if (!fh) { 450 if (!fh) {
448 t->tcm_handle = ~0; /* whatever ... */ 451 t->tcm_handle = ~0; /* whatever ... */
449 NLA_PUT(skb, TCA_TCINDEX_HASH, sizeof(p->hash), &p->hash); 452 NLA_PUT(skb, TCA_TCINDEX_HASH, sizeof(p->hash), &p->hash);
@@ -451,7 +454,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
451 NLA_PUT(skb, TCA_TCINDEX_SHIFT, sizeof(p->shift), &p->shift); 454 NLA_PUT(skb, TCA_TCINDEX_SHIFT, sizeof(p->shift), &p->shift);
452 NLA_PUT(skb, TCA_TCINDEX_FALL_THROUGH, sizeof(p->fall_through), 455 NLA_PUT(skb, TCA_TCINDEX_FALL_THROUGH, sizeof(p->fall_through),
453 &p->fall_through); 456 &p->fall_through);
454 nla->nla_len = skb_tail_pointer(skb) - b; 457 nla_nest_end(skb, nest);
455 } else { 458 } else {
456 if (p->perfect) { 459 if (p->perfect) {
457 t->tcm_handle = r-p->perfect; 460 t->tcm_handle = r-p->perfect;
@@ -474,7 +477,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
474 477
475 if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) 478 if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0)
476 goto nla_put_failure; 479 goto nla_put_failure;
477 nla->nla_len = skb_tail_pointer(skb) - b; 480 nla_nest_end(skb, nest);
478 481
479 if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0) 482 if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0)
480 goto nla_put_failure; 483 goto nla_put_failure;