aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_route.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/cls_route.c')
-rw-r--r--net/sched/cls_route.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index e70edd0f7bc8..b1aae84cbadc 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -325,7 +325,7 @@ static int route4_delete(struct tcf_proto *tp, unsigned long arg)
325 325
326static int route4_set_parms(struct tcf_proto *tp, unsigned long base, 326static int route4_set_parms(struct tcf_proto *tp, unsigned long base,
327 struct route4_filter *f, u32 handle, struct route4_head *head, 327 struct route4_filter *f, u32 handle, struct route4_head *head,
328 struct rtattr **tb, struct rtattr *est, int new) 328 struct nlattr **tb, struct nlattr *est, int new)
329{ 329{
330 int err; 330 int err;
331 u32 id = 0, to = 0, nhandle = 0x8000; 331 u32 id = 0, to = 0, nhandle = 0x8000;
@@ -339,34 +339,34 @@ static int route4_set_parms(struct tcf_proto *tp, unsigned long base,
339 return err; 339 return err;
340 340
341 err = -EINVAL; 341 err = -EINVAL;
342 if (tb[TCA_ROUTE4_CLASSID-1]) 342 if (tb[TCA_ROUTE4_CLASSID])
343 if (RTA_PAYLOAD(tb[TCA_ROUTE4_CLASSID-1]) < sizeof(u32)) 343 if (nla_len(tb[TCA_ROUTE4_CLASSID]) < sizeof(u32))
344 goto errout; 344 goto errout;
345 345
346 if (tb[TCA_ROUTE4_TO-1]) { 346 if (tb[TCA_ROUTE4_TO]) {
347 if (new && handle & 0x8000) 347 if (new && handle & 0x8000)
348 goto errout; 348 goto errout;
349 if (RTA_PAYLOAD(tb[TCA_ROUTE4_TO-1]) < sizeof(u32)) 349 if (nla_len(tb[TCA_ROUTE4_TO]) < sizeof(u32))
350 goto errout; 350 goto errout;
351 to = *(u32*)RTA_DATA(tb[TCA_ROUTE4_TO-1]); 351 to = *(u32*)nla_data(tb[TCA_ROUTE4_TO]);
352 if (to > 0xFF) 352 if (to > 0xFF)
353 goto errout; 353 goto errout;
354 nhandle = to; 354 nhandle = to;
355 } 355 }
356 356
357 if (tb[TCA_ROUTE4_FROM-1]) { 357 if (tb[TCA_ROUTE4_FROM]) {
358 if (tb[TCA_ROUTE4_IIF-1]) 358 if (tb[TCA_ROUTE4_IIF])
359 goto errout; 359 goto errout;
360 if (RTA_PAYLOAD(tb[TCA_ROUTE4_FROM-1]) < sizeof(u32)) 360 if (nla_len(tb[TCA_ROUTE4_FROM]) < sizeof(u32))
361 goto errout; 361 goto errout;
362 id = *(u32*)RTA_DATA(tb[TCA_ROUTE4_FROM-1]); 362 id = *(u32*)nla_data(tb[TCA_ROUTE4_FROM]);
363 if (id > 0xFF) 363 if (id > 0xFF)
364 goto errout; 364 goto errout;
365 nhandle |= id << 16; 365 nhandle |= id << 16;
366 } else if (tb[TCA_ROUTE4_IIF-1]) { 366 } else if (tb[TCA_ROUTE4_IIF]) {
367 if (RTA_PAYLOAD(tb[TCA_ROUTE4_IIF-1]) < sizeof(u32)) 367 if (nla_len(tb[TCA_ROUTE4_IIF]) < sizeof(u32))
368 goto errout; 368 goto errout;
369 id = *(u32*)RTA_DATA(tb[TCA_ROUTE4_IIF-1]); 369 id = *(u32*)nla_data(tb[TCA_ROUTE4_IIF]);
370 if (id > 0x7FFF) 370 if (id > 0x7FFF)
371 goto errout; 371 goto errout;
372 nhandle |= (id | 0x8000) << 16; 372 nhandle |= (id | 0x8000) << 16;
@@ -398,20 +398,20 @@ static int route4_set_parms(struct tcf_proto *tp, unsigned long base,
398 } 398 }
399 399
400 tcf_tree_lock(tp); 400 tcf_tree_lock(tp);
401 if (tb[TCA_ROUTE4_TO-1]) 401 if (tb[TCA_ROUTE4_TO])
402 f->id = to; 402 f->id = to;
403 403
404 if (tb[TCA_ROUTE4_FROM-1]) 404 if (tb[TCA_ROUTE4_FROM])
405 f->id = to | id<<16; 405 f->id = to | id<<16;
406 else if (tb[TCA_ROUTE4_IIF-1]) 406 else if (tb[TCA_ROUTE4_IIF])
407 f->iif = id; 407 f->iif = id;
408 408
409 f->handle = nhandle; 409 f->handle = nhandle;
410 f->bkt = b; 410 f->bkt = b;
411 tcf_tree_unlock(tp); 411 tcf_tree_unlock(tp);
412 412
413 if (tb[TCA_ROUTE4_CLASSID-1]) { 413 if (tb[TCA_ROUTE4_CLASSID]) {
414 f->res.classid = *(u32*)RTA_DATA(tb[TCA_ROUTE4_CLASSID-1]); 414 f->res.classid = *(u32*)nla_data(tb[TCA_ROUTE4_CLASSID]);
415 tcf_bind_filter(tp, &f->res, base); 415 tcf_bind_filter(tp, &f->res, base);
416 } 416 }
417 417
@@ -425,14 +425,14 @@ errout:
425 425
426static int route4_change(struct tcf_proto *tp, unsigned long base, 426static int route4_change(struct tcf_proto *tp, unsigned long base,
427 u32 handle, 427 u32 handle,
428 struct rtattr **tca, 428 struct nlattr **tca,
429 unsigned long *arg) 429 unsigned long *arg)
430{ 430{
431 struct route4_head *head = tp->root; 431 struct route4_head *head = tp->root;
432 struct route4_filter *f, *f1, **fp; 432 struct route4_filter *f, *f1, **fp;
433 struct route4_bucket *b; 433 struct route4_bucket *b;
434 struct rtattr *opt = tca[TCA_OPTIONS-1]; 434 struct nlattr *opt = tca[TCA_OPTIONS];
435 struct rtattr *tb[TCA_ROUTE4_MAX]; 435 struct nlattr *tb[TCA_ROUTE4_MAX + 1];
436 unsigned int h, th; 436 unsigned int h, th;
437 u32 old_handle = 0; 437 u32 old_handle = 0;
438 int err; 438 int err;
@@ -440,7 +440,7 @@ static int route4_change(struct tcf_proto *tp, unsigned long base,
440 if (opt == NULL) 440 if (opt == NULL)
441 return handle ? -EINVAL : 0; 441 return handle ? -EINVAL : 0;
442 442
443 if (rtattr_parse_nested(tb, TCA_ROUTE4_MAX, opt) < 0) 443 if (nla_parse_nested(tb, TCA_ROUTE4_MAX, opt, NULL) < 0)
444 return -EINVAL; 444 return -EINVAL;
445 445
446 if ((f = (struct route4_filter*)*arg) != NULL) { 446 if ((f = (struct route4_filter*)*arg) != NULL) {
@@ -451,7 +451,7 @@ static int route4_change(struct tcf_proto *tp, unsigned long base,
451 old_handle = f->handle; 451 old_handle = f->handle;
452 452
453 err = route4_set_parms(tp, base, f, handle, head, tb, 453 err = route4_set_parms(tp, base, f, handle, head, tb,
454 tca[TCA_RATE-1], 0); 454 tca[TCA_RATE], 0);
455 if (err < 0) 455 if (err < 0)
456 return err; 456 return err;
457 457
@@ -474,7 +474,7 @@ static int route4_change(struct tcf_proto *tp, unsigned long base,
474 goto errout; 474 goto errout;
475 475
476 err = route4_set_parms(tp, base, f, handle, head, tb, 476 err = route4_set_parms(tp, base, f, handle, head, tb,
477 tca[TCA_RATE-1], 1); 477 tca[TCA_RATE], 1);
478 if (err < 0) 478 if (err < 0)
479 goto errout; 479 goto errout;
480 480
@@ -550,7 +550,7 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh,
550{ 550{
551 struct route4_filter *f = (struct route4_filter*)fh; 551 struct route4_filter *f = (struct route4_filter*)fh;
552 unsigned char *b = skb_tail_pointer(skb); 552 unsigned char *b = skb_tail_pointer(skb);
553 struct rtattr *rta; 553 struct nlattr *nla;
554 u32 id; 554 u32 id;
555 555
556 if (f == NULL) 556 if (f == NULL)
@@ -558,34 +558,34 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh,
558 558
559 t->tcm_handle = f->handle; 559 t->tcm_handle = f->handle;
560 560
561 rta = (struct rtattr*)b; 561 nla = (struct nlattr*)b;
562 RTA_PUT(skb, TCA_OPTIONS, 0, NULL); 562 NLA_PUT(skb, TCA_OPTIONS, 0, NULL);
563 563
564 if (!(f->handle&0x8000)) { 564 if (!(f->handle&0x8000)) {
565 id = f->id&0xFF; 565 id = f->id&0xFF;
566 RTA_PUT(skb, TCA_ROUTE4_TO, sizeof(id), &id); 566 NLA_PUT(skb, TCA_ROUTE4_TO, sizeof(id), &id);
567 } 567 }
568 if (f->handle&0x80000000) { 568 if (f->handle&0x80000000) {
569 if ((f->handle>>16) != 0xFFFF) 569 if ((f->handle>>16) != 0xFFFF)
570 RTA_PUT(skb, TCA_ROUTE4_IIF, sizeof(f->iif), &f->iif); 570 NLA_PUT(skb, TCA_ROUTE4_IIF, sizeof(f->iif), &f->iif);
571 } else { 571 } else {
572 id = f->id>>16; 572 id = f->id>>16;
573 RTA_PUT(skb, TCA_ROUTE4_FROM, sizeof(id), &id); 573 NLA_PUT(skb, TCA_ROUTE4_FROM, sizeof(id), &id);
574 } 574 }
575 if (f->res.classid) 575 if (f->res.classid)
576 RTA_PUT(skb, TCA_ROUTE4_CLASSID, 4, &f->res.classid); 576 NLA_PUT(skb, TCA_ROUTE4_CLASSID, 4, &f->res.classid);
577 577
578 if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) 578 if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0)
579 goto rtattr_failure; 579 goto nla_put_failure;
580 580
581 rta->rta_len = skb_tail_pointer(skb) - b; 581 nla->nla_len = skb_tail_pointer(skb) - b;
582 582
583 if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0) 583 if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0)
584 goto rtattr_failure; 584 goto nla_put_failure;
585 585
586 return skb->len; 586 return skb->len;
587 587
588rtattr_failure: 588nla_put_failure:
589 nlmsg_trim(skb, b); 589 nlmsg_trim(skb, b);
590 return -1; 590 return -1;
591} 591}