aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_rsvp.h
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-23 01:11:33 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:11:11 -0500
commitadd93b610a4e66d36d0cf0b2596c3d3bcfdaee39 (patch)
tree073873879eb3b87981ee015f0f1ca48da8f1c696 /net/sched/cls_rsvp.h
parent1e90474c377e92db7262a8968a45c1dd980ca9e5 (diff)
[NET_SCHED]: Convert classifiers from rtnetlink to new netlink API
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_rsvp.h')
-rw-r--r--net/sched/cls_rsvp.h48
1 files changed, 24 insertions, 24 deletions
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h
index 22f9ede70e8f..2364c79d0837 100644
--- a/net/sched/cls_rsvp.h
+++ b/net/sched/cls_rsvp.h
@@ -399,15 +399,15 @@ static u32 gen_tunnel(struct rsvp_head *data)
399 399
400static int rsvp_change(struct tcf_proto *tp, unsigned long base, 400static int rsvp_change(struct tcf_proto *tp, unsigned long base,
401 u32 handle, 401 u32 handle,
402 struct rtattr **tca, 402 struct nlattr **tca,
403 unsigned long *arg) 403 unsigned long *arg)
404{ 404{
405 struct rsvp_head *data = tp->root; 405 struct rsvp_head *data = tp->root;
406 struct rsvp_filter *f, **fp; 406 struct rsvp_filter *f, **fp;
407 struct rsvp_session *s, **sp; 407 struct rsvp_session *s, **sp;
408 struct tc_rsvp_pinfo *pinfo = NULL; 408 struct tc_rsvp_pinfo *pinfo = NULL;
409 struct rtattr *opt = tca[TCA_OPTIONS-1]; 409 struct nlattr *opt = tca[TCA_OPTIONS-1];
410 struct rtattr *tb[TCA_RSVP_MAX]; 410 struct nlattr *tb[TCA_RSVP_MAX + 1];
411 struct tcf_exts e; 411 struct tcf_exts e;
412 unsigned h1, h2; 412 unsigned h1, h2;
413 __be32 *dst; 413 __be32 *dst;
@@ -416,7 +416,7 @@ static int rsvp_change(struct tcf_proto *tp, unsigned long base,
416 if (opt == NULL) 416 if (opt == NULL)
417 return handle ? -EINVAL : 0; 417 return handle ? -EINVAL : 0;
418 418
419 if (rtattr_parse_nested(tb, TCA_RSVP_MAX, opt) < 0) 419 if (nla_parse_nested(tb, TCA_RSVP_MAX, opt, NULL) < 0)
420 return -EINVAL; 420 return -EINVAL;
421 421
422 err = tcf_exts_validate(tp, tb, tca[TCA_RATE-1], &e, &rsvp_ext_map); 422 err = tcf_exts_validate(tp, tb, tca[TCA_RATE-1], &e, &rsvp_ext_map);
@@ -429,7 +429,7 @@ static int rsvp_change(struct tcf_proto *tp, unsigned long base,
429 if (f->handle != handle && handle) 429 if (f->handle != handle && handle)
430 goto errout2; 430 goto errout2;
431 if (tb[TCA_RSVP_CLASSID-1]) { 431 if (tb[TCA_RSVP_CLASSID-1]) {
432 f->res.classid = *(u32*)RTA_DATA(tb[TCA_RSVP_CLASSID-1]); 432 f->res.classid = *(u32*)nla_data(tb[TCA_RSVP_CLASSID-1]);
433 tcf_bind_filter(tp, &f->res, base); 433 tcf_bind_filter(tp, &f->res, base);
434 } 434 }
435 435
@@ -452,30 +452,30 @@ static int rsvp_change(struct tcf_proto *tp, unsigned long base,
452 h2 = 16; 452 h2 = 16;
453 if (tb[TCA_RSVP_SRC-1]) { 453 if (tb[TCA_RSVP_SRC-1]) {
454 err = -EINVAL; 454 err = -EINVAL;
455 if (RTA_PAYLOAD(tb[TCA_RSVP_SRC-1]) != sizeof(f->src)) 455 if (nla_len(tb[TCA_RSVP_SRC-1]) != sizeof(f->src))
456 goto errout; 456 goto errout;
457 memcpy(f->src, RTA_DATA(tb[TCA_RSVP_SRC-1]), sizeof(f->src)); 457 memcpy(f->src, nla_data(tb[TCA_RSVP_SRC-1]), sizeof(f->src));
458 h2 = hash_src(f->src); 458 h2 = hash_src(f->src);
459 } 459 }
460 if (tb[TCA_RSVP_PINFO-1]) { 460 if (tb[TCA_RSVP_PINFO-1]) {
461 err = -EINVAL; 461 err = -EINVAL;
462 if (RTA_PAYLOAD(tb[TCA_RSVP_PINFO-1]) < sizeof(struct tc_rsvp_pinfo)) 462 if (nla_len(tb[TCA_RSVP_PINFO-1]) < sizeof(struct tc_rsvp_pinfo))
463 goto errout; 463 goto errout;
464 pinfo = RTA_DATA(tb[TCA_RSVP_PINFO-1]); 464 pinfo = nla_data(tb[TCA_RSVP_PINFO-1]);
465 f->spi = pinfo->spi; 465 f->spi = pinfo->spi;
466 f->tunnelhdr = pinfo->tunnelhdr; 466 f->tunnelhdr = pinfo->tunnelhdr;
467 } 467 }
468 if (tb[TCA_RSVP_CLASSID-1]) { 468 if (tb[TCA_RSVP_CLASSID-1]) {
469 err = -EINVAL; 469 err = -EINVAL;
470 if (RTA_PAYLOAD(tb[TCA_RSVP_CLASSID-1]) != 4) 470 if (nla_len(tb[TCA_RSVP_CLASSID-1]) != 4)
471 goto errout; 471 goto errout;
472 f->res.classid = *(u32*)RTA_DATA(tb[TCA_RSVP_CLASSID-1]); 472 f->res.classid = *(u32*)nla_data(tb[TCA_RSVP_CLASSID-1]);
473 } 473 }
474 474
475 err = -EINVAL; 475 err = -EINVAL;
476 if (RTA_PAYLOAD(tb[TCA_RSVP_DST-1]) != sizeof(f->src)) 476 if (nla_len(tb[TCA_RSVP_DST-1]) != sizeof(f->src))
477 goto errout; 477 goto errout;
478 dst = RTA_DATA(tb[TCA_RSVP_DST-1]); 478 dst = nla_data(tb[TCA_RSVP_DST-1]);
479 h1 = hash_dst(dst, pinfo ? pinfo->protocol : 0, pinfo ? pinfo->tunnelid : 0); 479 h1 = hash_dst(dst, pinfo ? pinfo->protocol : 0, pinfo ? pinfo->tunnelid : 0);
480 480
481 err = -ENOMEM; 481 err = -ENOMEM;
@@ -594,7 +594,7 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh,
594 struct rsvp_filter *f = (struct rsvp_filter*)fh; 594 struct rsvp_filter *f = (struct rsvp_filter*)fh;
595 struct rsvp_session *s; 595 struct rsvp_session *s;
596 unsigned char *b = skb_tail_pointer(skb); 596 unsigned char *b = skb_tail_pointer(skb);
597 struct rtattr *rta; 597 struct nlattr *nla;
598 struct tc_rsvp_pinfo pinfo; 598 struct tc_rsvp_pinfo pinfo;
599 599
600 if (f == NULL) 600 if (f == NULL)
@@ -604,32 +604,32 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh,
604 t->tcm_handle = f->handle; 604 t->tcm_handle = f->handle;
605 605
606 606
607 rta = (struct rtattr*)b; 607 nla = (struct nlattr*)b;
608 RTA_PUT(skb, TCA_OPTIONS, 0, NULL); 608 NLA_PUT(skb, TCA_OPTIONS, 0, NULL);
609 609
610 RTA_PUT(skb, TCA_RSVP_DST, sizeof(s->dst), &s->dst); 610 NLA_PUT(skb, TCA_RSVP_DST, sizeof(s->dst), &s->dst);
611 pinfo.dpi = s->dpi; 611 pinfo.dpi = s->dpi;
612 pinfo.spi = f->spi; 612 pinfo.spi = f->spi;
613 pinfo.protocol = s->protocol; 613 pinfo.protocol = s->protocol;
614 pinfo.tunnelid = s->tunnelid; 614 pinfo.tunnelid = s->tunnelid;
615 pinfo.tunnelhdr = f->tunnelhdr; 615 pinfo.tunnelhdr = f->tunnelhdr;
616 pinfo.pad = 0; 616 pinfo.pad = 0;
617 RTA_PUT(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo); 617 NLA_PUT(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo);
618 if (f->res.classid) 618 if (f->res.classid)
619 RTA_PUT(skb, TCA_RSVP_CLASSID, 4, &f->res.classid); 619 NLA_PUT(skb, TCA_RSVP_CLASSID, 4, &f->res.classid);
620 if (((f->handle>>8)&0xFF) != 16) 620 if (((f->handle>>8)&0xFF) != 16)
621 RTA_PUT(skb, TCA_RSVP_SRC, sizeof(f->src), f->src); 621 NLA_PUT(skb, TCA_RSVP_SRC, sizeof(f->src), f->src);
622 622
623 if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0) 623 if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0)
624 goto rtattr_failure; 624 goto nla_put_failure;
625 625
626 rta->rta_len = skb_tail_pointer(skb) - b; 626 nla->nla_len = skb_tail_pointer(skb) - b;
627 627
628 if (tcf_exts_dump_stats(skb, &f->exts, &rsvp_ext_map) < 0) 628 if (tcf_exts_dump_stats(skb, &f->exts, &rsvp_ext_map) < 0)
629 goto rtattr_failure; 629 goto nla_put_failure;
630 return skb->len; 630 return skb->len;
631 631
632rtattr_failure: 632nla_put_failure:
633 nlmsg_trim(skb, b); 633 nlmsg_trim(skb, b);
634 return -1; 634 return -1;
635} 635}