.. | .. |
---|
43 | 43 | #include "bcast.h" |
---|
44 | 44 | #include "netlink.h" |
---|
45 | 45 | #include "udp_media.h" |
---|
| 46 | +#include "trace.h" |
---|
| 47 | +#include "crypto.h" |
---|
46 | 48 | |
---|
47 | 49 | #define MAX_ADDR_STR 60 |
---|
48 | 50 | |
---|
.. | .. |
---|
61 | 63 | { |
---|
62 | 64 | struct tipc_net *tn = tipc_net(net); |
---|
63 | 65 | |
---|
64 | | - return rcu_dereference_rtnl(tn->bearer_list[bearer_id]); |
---|
| 66 | + return rcu_dereference(tn->bearer_list[bearer_id]); |
---|
65 | 67 | } |
---|
66 | 68 | |
---|
67 | 69 | static void bearer_disable(struct net *net, struct tipc_bearer *b); |
---|
.. | .. |
---|
99 | 101 | /** |
---|
100 | 102 | * tipc_media_addr_printf - record media address in print buffer |
---|
101 | 103 | */ |
---|
102 | | -void tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a) |
---|
| 104 | +int tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a) |
---|
103 | 105 | { |
---|
104 | 106 | char addr_str[MAX_ADDR_STR]; |
---|
105 | 107 | struct tipc_media *m; |
---|
.. | .. |
---|
114 | 116 | |
---|
115 | 117 | ret = scnprintf(buf, len, "UNKNOWN(%u)", a->media_id); |
---|
116 | 118 | for (i = 0; i < sizeof(a->value); i++) |
---|
117 | | - ret += scnprintf(buf - ret, len + ret, |
---|
118 | | - "-%02x", a->value[i]); |
---|
| 119 | + ret += scnprintf(buf + ret, len - ret, |
---|
| 120 | + "-%x", a->value[i]); |
---|
119 | 121 | } |
---|
| 122 | + return ret; |
---|
120 | 123 | } |
---|
121 | 124 | |
---|
122 | 125 | /** |
---|
.. | .. |
---|
208 | 211 | struct tipc_bearer *b; |
---|
209 | 212 | |
---|
210 | 213 | rcu_read_lock(); |
---|
211 | | - b = rcu_dereference_rtnl(tn->bearer_list[bearer_id]); |
---|
| 214 | + b = rcu_dereference(tn->bearer_list[bearer_id]); |
---|
212 | 215 | if (b) |
---|
213 | 216 | tipc_disc_add_dest(b->disc); |
---|
214 | 217 | rcu_read_unlock(); |
---|
.. | .. |
---|
220 | 223 | struct tipc_bearer *b; |
---|
221 | 224 | |
---|
222 | 225 | rcu_read_lock(); |
---|
223 | | - b = rcu_dereference_rtnl(tn->bearer_list[bearer_id]); |
---|
| 226 | + b = rcu_dereference(tn->bearer_list[bearer_id]); |
---|
224 | 227 | if (b) |
---|
225 | 228 | tipc_disc_remove_dest(b->disc); |
---|
226 | 229 | rcu_read_unlock(); |
---|
.. | .. |
---|
246 | 249 | u32 i; |
---|
247 | 250 | |
---|
248 | 251 | if (!bearer_name_validate(name, &b_names)) { |
---|
249 | | - errstr = "illegal name"; |
---|
250 | 252 | NL_SET_ERR_MSG(extack, "Illegal name"); |
---|
251 | | - goto rejected; |
---|
| 253 | + return res; |
---|
252 | 254 | } |
---|
253 | 255 | |
---|
254 | 256 | if (prio > TIPC_MAX_LINK_PRI && prio != TIPC_MEDIA_LINK_PRI) { |
---|
.. | .. |
---|
324 | 326 | |
---|
325 | 327 | b->identity = bearer_id; |
---|
326 | 328 | b->tolerance = m->tolerance; |
---|
327 | | - b->window = m->window; |
---|
| 329 | + b->min_win = m->min_win; |
---|
| 330 | + b->max_win = m->max_win; |
---|
328 | 331 | b->domain = disc_domain; |
---|
329 | 332 | b->net_plane = bearer_id + 'A'; |
---|
330 | 333 | b->priority = prio; |
---|
331 | | - test_and_set_bit_lock(0, &b->up); |
---|
| 334 | + refcount_set(&b->refcnt, 1); |
---|
332 | 335 | |
---|
333 | 336 | res = tipc_disc_create(net, b, &b->bcast_addr, &skb); |
---|
334 | 337 | if (res) { |
---|
.. | .. |
---|
338 | 341 | goto rejected; |
---|
339 | 342 | } |
---|
340 | 343 | |
---|
| 344 | + /* Create monitoring data before accepting activate messages */ |
---|
| 345 | + if (tipc_mon_create(net, bearer_id)) { |
---|
| 346 | + bearer_disable(net, b); |
---|
| 347 | + kfree_skb(skb); |
---|
| 348 | + return -ENOMEM; |
---|
| 349 | + } |
---|
| 350 | + |
---|
| 351 | + test_and_set_bit_lock(0, &b->up); |
---|
341 | 352 | rcu_assign_pointer(tn->bearer_list[bearer_id], b); |
---|
342 | 353 | if (skb) |
---|
343 | 354 | tipc_bearer_xmit_skb(net, bearer_id, skb, &b->bcast_addr); |
---|
344 | | - |
---|
345 | | - if (tipc_mon_create(net, bearer_id)) { |
---|
346 | | - bearer_disable(net, b); |
---|
347 | | - return -ENOMEM; |
---|
348 | | - } |
---|
349 | 355 | |
---|
350 | 356 | pr_info("Enabled bearer <%s>, priority %u\n", name, prio); |
---|
351 | 357 | |
---|
.. | .. |
---|
366 | 372 | return 0; |
---|
367 | 373 | } |
---|
368 | 374 | |
---|
| 375 | +bool tipc_bearer_hold(struct tipc_bearer *b) |
---|
| 376 | +{ |
---|
| 377 | + return (b && refcount_inc_not_zero(&b->refcnt)); |
---|
| 378 | +} |
---|
| 379 | + |
---|
| 380 | +void tipc_bearer_put(struct tipc_bearer *b) |
---|
| 381 | +{ |
---|
| 382 | + if (b && refcount_dec_and_test(&b->refcnt)) |
---|
| 383 | + kfree_rcu(b, rcu); |
---|
| 384 | +} |
---|
| 385 | + |
---|
369 | 386 | /** |
---|
370 | 387 | * bearer_disable |
---|
371 | 388 | * |
---|
.. | .. |
---|
384 | 401 | if (b->disc) |
---|
385 | 402 | tipc_disc_delete(b->disc); |
---|
386 | 403 | RCU_INIT_POINTER(tn->bearer_list[bearer_id], NULL); |
---|
387 | | - kfree_rcu(b, rcu); |
---|
| 404 | + tipc_bearer_put(b); |
---|
388 | 405 | tipc_mon_delete(net, bearer_id); |
---|
389 | 406 | } |
---|
390 | 407 | |
---|
.. | .. |
---|
402 | 419 | return -ENODEV; |
---|
403 | 420 | if (tipc_mtu_bad(dev, 0)) { |
---|
404 | 421 | dev_put(dev); |
---|
| 422 | + return -EINVAL; |
---|
| 423 | + } |
---|
| 424 | + if (dev == net->loopback_dev) { |
---|
| 425 | + dev_put(dev); |
---|
| 426 | + pr_info("Enabling <%s> not permitted\n", b->name); |
---|
405 | 427 | return -EINVAL; |
---|
406 | 428 | } |
---|
407 | 429 | |
---|
.. | .. |
---|
459 | 481 | struct net_device *dev; |
---|
460 | 482 | int delta; |
---|
461 | 483 | |
---|
462 | | - dev = (struct net_device *)rcu_dereference_rtnl(b->media_ptr); |
---|
| 484 | + dev = (struct net_device *)rcu_dereference(b->media_ptr); |
---|
463 | 485 | if (!dev) |
---|
464 | 486 | return 0; |
---|
465 | 487 | |
---|
.. | .. |
---|
496 | 518 | struct tipc_bearer *b; |
---|
497 | 519 | |
---|
498 | 520 | rcu_read_lock(); |
---|
499 | | - b = rcu_dereference_rtnl(tipc_net(net)->bearer_list[bearer_id]); |
---|
| 521 | + b = rcu_dereference(tipc_net(net)->bearer_list[bearer_id]); |
---|
500 | 522 | if (b) |
---|
501 | 523 | mtu = b->mtu; |
---|
502 | 524 | rcu_read_unlock(); |
---|
.. | .. |
---|
514 | 536 | |
---|
515 | 537 | rcu_read_lock(); |
---|
516 | 538 | b = bearer_get(net, bearer_id); |
---|
517 | | - if (likely(b && (test_bit(0, &b->up) || msg_is_reset(hdr)))) |
---|
518 | | - b->media->send_msg(net, skb, b, dest); |
---|
519 | | - else |
---|
| 539 | + if (likely(b && (test_bit(0, &b->up) || msg_is_reset(hdr)))) { |
---|
| 540 | +#ifdef CONFIG_TIPC_CRYPTO |
---|
| 541 | + tipc_crypto_xmit(net, &skb, b, dest, NULL); |
---|
| 542 | + if (skb) |
---|
| 543 | +#endif |
---|
| 544 | + b->media->send_msg(net, skb, b, dest); |
---|
| 545 | + } else { |
---|
520 | 546 | kfree_skb(skb); |
---|
| 547 | + } |
---|
521 | 548 | rcu_read_unlock(); |
---|
522 | 549 | } |
---|
523 | 550 | |
---|
.. | .. |
---|
525 | 552 | */ |
---|
526 | 553 | void tipc_bearer_xmit(struct net *net, u32 bearer_id, |
---|
527 | 554 | struct sk_buff_head *xmitq, |
---|
528 | | - struct tipc_media_addr *dst) |
---|
| 555 | + struct tipc_media_addr *dst, |
---|
| 556 | + struct tipc_node *__dnode) |
---|
529 | 557 | { |
---|
530 | 558 | struct tipc_bearer *b; |
---|
531 | 559 | struct sk_buff *skb, *tmp; |
---|
.. | .. |
---|
539 | 567 | __skb_queue_purge(xmitq); |
---|
540 | 568 | skb_queue_walk_safe(xmitq, skb, tmp) { |
---|
541 | 569 | __skb_dequeue(xmitq); |
---|
542 | | - if (likely(test_bit(0, &b->up) || msg_is_reset(buf_msg(skb)))) |
---|
543 | | - b->media->send_msg(net, skb, b, dst); |
---|
544 | | - else |
---|
| 570 | + if (likely(test_bit(0, &b->up) || msg_is_reset(buf_msg(skb)))) { |
---|
| 571 | +#ifdef CONFIG_TIPC_CRYPTO |
---|
| 572 | + tipc_crypto_xmit(net, &skb, b, dst, __dnode); |
---|
| 573 | + if (skb) |
---|
| 574 | +#endif |
---|
| 575 | + b->media->send_msg(net, skb, b, dst); |
---|
| 576 | + } else { |
---|
545 | 577 | kfree_skb(skb); |
---|
| 578 | + } |
---|
546 | 579 | } |
---|
547 | 580 | rcu_read_unlock(); |
---|
548 | 581 | } |
---|
.. | .. |
---|
553 | 586 | struct sk_buff_head *xmitq) |
---|
554 | 587 | { |
---|
555 | 588 | struct tipc_net *tn = tipc_net(net); |
---|
| 589 | + struct tipc_media_addr *dst; |
---|
556 | 590 | int net_id = tn->net_id; |
---|
557 | 591 | struct tipc_bearer *b; |
---|
558 | 592 | struct sk_buff *skb, *tmp; |
---|
.. | .. |
---|
567 | 601 | msg_set_non_seq(hdr, 1); |
---|
568 | 602 | msg_set_mc_netid(hdr, net_id); |
---|
569 | 603 | __skb_dequeue(xmitq); |
---|
570 | | - b->media->send_msg(net, skb, b, &b->bcast_addr); |
---|
| 604 | + dst = &b->bcast_addr; |
---|
| 605 | +#ifdef CONFIG_TIPC_CRYPTO |
---|
| 606 | + tipc_crypto_xmit(net, &skb, b, dst, NULL); |
---|
| 607 | + if (skb) |
---|
| 608 | +#endif |
---|
| 609 | + b->media->send_msg(net, skb, b, dst); |
---|
571 | 610 | } |
---|
572 | 611 | rcu_read_unlock(); |
---|
573 | 612 | } |
---|
574 | 613 | |
---|
575 | 614 | /** |
---|
576 | 615 | * tipc_l2_rcv_msg - handle incoming TIPC message from an interface |
---|
577 | | - * @buf: the received packet |
---|
| 616 | + * @skb: the received message |
---|
578 | 617 | * @dev: the net device that the packet was received on |
---|
579 | 618 | * @pt: the packet_type structure which was used to register this handler |
---|
580 | 619 | * @orig_dev: the original receive net device in case the device is a bond |
---|
.. | .. |
---|
589 | 628 | struct tipc_bearer *b; |
---|
590 | 629 | |
---|
591 | 630 | rcu_read_lock(); |
---|
592 | | - b = rcu_dereference_rtnl(dev->tipc_ptr) ?: |
---|
593 | | - rcu_dereference_rtnl(orig_dev->tipc_ptr); |
---|
| 631 | + b = rcu_dereference(dev->tipc_ptr) ?: |
---|
| 632 | + rcu_dereference(orig_dev->tipc_ptr); |
---|
594 | 633 | if (likely(b && test_bit(0, &b->up) && |
---|
595 | 634 | (skb->pkt_type <= PACKET_MULTICAST))) { |
---|
596 | | - skb->next = NULL; |
---|
| 635 | + skb_mark_not_on_list(skb); |
---|
| 636 | + TIPC_SKB_CB(skb)->flags = 0; |
---|
597 | 637 | tipc_rcv(dev_net(b->pt.dev), skb, b); |
---|
598 | 638 | rcu_read_unlock(); |
---|
599 | 639 | return NET_RX_SUCCESS; |
---|
.. | .. |
---|
623 | 663 | if (!b) |
---|
624 | 664 | return NOTIFY_DONE; |
---|
625 | 665 | |
---|
| 666 | + trace_tipc_l2_device_event(dev, b, evt); |
---|
626 | 667 | switch (evt) { |
---|
627 | 668 | case NETDEV_CHANGE: |
---|
628 | 669 | if (netif_carrier_ok(dev) && netif_oper_up(dev)) { |
---|
629 | 670 | test_and_set_bit_lock(0, &b->up); |
---|
630 | 671 | break; |
---|
631 | 672 | } |
---|
632 | | - /* fall through */ |
---|
| 673 | + fallthrough; |
---|
633 | 674 | case NETDEV_GOING_DOWN: |
---|
634 | 675 | clear_bit_unlock(0, &b->up); |
---|
635 | 676 | tipc_reset_bearer(net, b); |
---|
.. | .. |
---|
688 | 729 | } |
---|
689 | 730 | } |
---|
690 | 731 | |
---|
| 732 | +void tipc_clone_to_loopback(struct net *net, struct sk_buff_head *pkts) |
---|
| 733 | +{ |
---|
| 734 | + struct net_device *dev = net->loopback_dev; |
---|
| 735 | + struct sk_buff *skb, *_skb; |
---|
| 736 | + int exp; |
---|
| 737 | + |
---|
| 738 | + skb_queue_walk(pkts, _skb) { |
---|
| 739 | + skb = pskb_copy(_skb, GFP_ATOMIC); |
---|
| 740 | + if (!skb) |
---|
| 741 | + continue; |
---|
| 742 | + |
---|
| 743 | + exp = SKB_DATA_ALIGN(dev->hard_header_len - skb_headroom(skb)); |
---|
| 744 | + if (exp > 0 && pskb_expand_head(skb, exp, 0, GFP_ATOMIC)) { |
---|
| 745 | + kfree_skb(skb); |
---|
| 746 | + continue; |
---|
| 747 | + } |
---|
| 748 | + |
---|
| 749 | + skb_reset_network_header(skb); |
---|
| 750 | + dev_hard_header(skb, dev, ETH_P_TIPC, dev->dev_addr, |
---|
| 751 | + dev->dev_addr, skb->len); |
---|
| 752 | + skb->dev = dev; |
---|
| 753 | + skb->pkt_type = PACKET_HOST; |
---|
| 754 | + skb->ip_summed = CHECKSUM_UNNECESSARY; |
---|
| 755 | + skb->protocol = eth_type_trans(skb, dev); |
---|
| 756 | + netif_rx_ni(skb); |
---|
| 757 | + } |
---|
| 758 | +} |
---|
| 759 | + |
---|
| 760 | +static int tipc_loopback_rcv_pkt(struct sk_buff *skb, struct net_device *dev, |
---|
| 761 | + struct packet_type *pt, struct net_device *od) |
---|
| 762 | +{ |
---|
| 763 | + consume_skb(skb); |
---|
| 764 | + return NET_RX_SUCCESS; |
---|
| 765 | +} |
---|
| 766 | + |
---|
| 767 | +int tipc_attach_loopback(struct net *net) |
---|
| 768 | +{ |
---|
| 769 | + struct net_device *dev = net->loopback_dev; |
---|
| 770 | + struct tipc_net *tn = tipc_net(net); |
---|
| 771 | + |
---|
| 772 | + if (!dev) |
---|
| 773 | + return -ENODEV; |
---|
| 774 | + |
---|
| 775 | + dev_hold(dev); |
---|
| 776 | + tn->loopback_pt.dev = dev; |
---|
| 777 | + tn->loopback_pt.type = htons(ETH_P_TIPC); |
---|
| 778 | + tn->loopback_pt.func = tipc_loopback_rcv_pkt; |
---|
| 779 | + dev_add_pack(&tn->loopback_pt); |
---|
| 780 | + return 0; |
---|
| 781 | +} |
---|
| 782 | + |
---|
| 783 | +void tipc_detach_loopback(struct net *net) |
---|
| 784 | +{ |
---|
| 785 | + struct tipc_net *tn = tipc_net(net); |
---|
| 786 | + |
---|
| 787 | + dev_remove_pack(&tn->loopback_pt); |
---|
| 788 | + dev_put(net->loopback_dev); |
---|
| 789 | +} |
---|
| 790 | + |
---|
691 | 791 | /* Caller should hold rtnl_lock to protect the bearer */ |
---|
692 | 792 | static int __tipc_nl_add_bearer(struct tipc_nl_msg *msg, |
---|
693 | 793 | struct tipc_bearer *bearer, int nlflags) |
---|
.. | .. |
---|
701 | 801 | if (!hdr) |
---|
702 | 802 | return -EMSGSIZE; |
---|
703 | 803 | |
---|
704 | | - attrs = nla_nest_start(msg->skb, TIPC_NLA_BEARER); |
---|
| 804 | + attrs = nla_nest_start_noflag(msg->skb, TIPC_NLA_BEARER); |
---|
705 | 805 | if (!attrs) |
---|
706 | 806 | goto msg_full; |
---|
707 | 807 | |
---|
708 | 808 | if (nla_put_string(msg->skb, TIPC_NLA_BEARER_NAME, bearer->name)) |
---|
709 | 809 | goto attr_msg_full; |
---|
710 | 810 | |
---|
711 | | - prop = nla_nest_start(msg->skb, TIPC_NLA_BEARER_PROP); |
---|
| 811 | + prop = nla_nest_start_noflag(msg->skb, TIPC_NLA_BEARER_PROP); |
---|
712 | 812 | if (!prop) |
---|
713 | 813 | goto prop_msg_full; |
---|
714 | 814 | if (nla_put_u32(msg->skb, TIPC_NLA_PROP_PRIO, bearer->priority)) |
---|
715 | 815 | goto prop_msg_full; |
---|
716 | 816 | if (nla_put_u32(msg->skb, TIPC_NLA_PROP_TOL, bearer->tolerance)) |
---|
717 | 817 | goto prop_msg_full; |
---|
718 | | - if (nla_put_u32(msg->skb, TIPC_NLA_PROP_WIN, bearer->window)) |
---|
| 818 | + if (nla_put_u32(msg->skb, TIPC_NLA_PROP_WIN, bearer->max_win)) |
---|
719 | 819 | goto prop_msg_full; |
---|
720 | 820 | if (bearer->media->type_id == TIPC_MEDIA_TYPE_UDP) |
---|
721 | 821 | if (nla_put_u32(msg->skb, TIPC_NLA_PROP_MTU, bearer->mtu)) |
---|
.. | .. |
---|
790 | 890 | if (!info->attrs[TIPC_NLA_BEARER]) |
---|
791 | 891 | return -EINVAL; |
---|
792 | 892 | |
---|
793 | | - err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, |
---|
794 | | - info->attrs[TIPC_NLA_BEARER], |
---|
795 | | - tipc_nl_bearer_policy, info->extack); |
---|
| 893 | + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX, |
---|
| 894 | + info->attrs[TIPC_NLA_BEARER], |
---|
| 895 | + tipc_nl_bearer_policy, info->extack); |
---|
796 | 896 | if (err) |
---|
797 | 897 | return err; |
---|
798 | 898 | |
---|
.. | .. |
---|
840 | 940 | if (!info->attrs[TIPC_NLA_BEARER]) |
---|
841 | 941 | return -EINVAL; |
---|
842 | 942 | |
---|
843 | | - err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, |
---|
844 | | - info->attrs[TIPC_NLA_BEARER], |
---|
845 | | - tipc_nl_bearer_policy, info->extack); |
---|
| 943 | + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX, |
---|
| 944 | + info->attrs[TIPC_NLA_BEARER], |
---|
| 945 | + tipc_nl_bearer_policy, info->extack); |
---|
846 | 946 | if (err) |
---|
847 | 947 | return err; |
---|
848 | 948 | |
---|
.. | .. |
---|
887 | 987 | if (!info->attrs[TIPC_NLA_BEARER]) |
---|
888 | 988 | return -EINVAL; |
---|
889 | 989 | |
---|
890 | | - err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, |
---|
891 | | - info->attrs[TIPC_NLA_BEARER], |
---|
892 | | - tipc_nl_bearer_policy, info->extack); |
---|
| 990 | + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX, |
---|
| 991 | + info->attrs[TIPC_NLA_BEARER], |
---|
| 992 | + tipc_nl_bearer_policy, info->extack); |
---|
893 | 993 | if (err) |
---|
894 | 994 | return err; |
---|
895 | 995 | |
---|
.. | .. |
---|
939 | 1039 | if (!info->attrs[TIPC_NLA_BEARER]) |
---|
940 | 1040 | return -EINVAL; |
---|
941 | 1041 | |
---|
942 | | - err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, |
---|
943 | | - info->attrs[TIPC_NLA_BEARER], |
---|
944 | | - tipc_nl_bearer_policy, info->extack); |
---|
| 1042 | + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX, |
---|
| 1043 | + info->attrs[TIPC_NLA_BEARER], |
---|
| 1044 | + tipc_nl_bearer_policy, info->extack); |
---|
945 | 1045 | if (err) |
---|
946 | 1046 | return err; |
---|
947 | 1047 | |
---|
.. | .. |
---|
983 | 1083 | if (!info->attrs[TIPC_NLA_BEARER]) |
---|
984 | 1084 | return -EINVAL; |
---|
985 | 1085 | |
---|
986 | | - err = nla_parse_nested(attrs, TIPC_NLA_BEARER_MAX, |
---|
987 | | - info->attrs[TIPC_NLA_BEARER], |
---|
988 | | - tipc_nl_bearer_policy, info->extack); |
---|
| 1086 | + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_BEARER_MAX, |
---|
| 1087 | + info->attrs[TIPC_NLA_BEARER], |
---|
| 1088 | + tipc_nl_bearer_policy, info->extack); |
---|
989 | 1089 | if (err) |
---|
990 | 1090 | return err; |
---|
991 | 1091 | |
---|
.. | .. |
---|
1014 | 1114 | if (props[TIPC_NLA_PROP_PRIO]) |
---|
1015 | 1115 | b->priority = nla_get_u32(props[TIPC_NLA_PROP_PRIO]); |
---|
1016 | 1116 | if (props[TIPC_NLA_PROP_WIN]) |
---|
1017 | | - b->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]); |
---|
| 1117 | + b->max_win = nla_get_u32(props[TIPC_NLA_PROP_WIN]); |
---|
1018 | 1118 | if (props[TIPC_NLA_PROP_MTU]) { |
---|
1019 | 1119 | if (b->media->type_id != TIPC_MEDIA_TYPE_UDP) { |
---|
1020 | 1120 | NL_SET_ERR_MSG(info->extack, |
---|
.. | .. |
---|
1060 | 1160 | if (!hdr) |
---|
1061 | 1161 | return -EMSGSIZE; |
---|
1062 | 1162 | |
---|
1063 | | - attrs = nla_nest_start(msg->skb, TIPC_NLA_MEDIA); |
---|
| 1163 | + attrs = nla_nest_start_noflag(msg->skb, TIPC_NLA_MEDIA); |
---|
1064 | 1164 | if (!attrs) |
---|
1065 | 1165 | goto msg_full; |
---|
1066 | 1166 | |
---|
1067 | 1167 | if (nla_put_string(msg->skb, TIPC_NLA_MEDIA_NAME, media->name)) |
---|
1068 | 1168 | goto attr_msg_full; |
---|
1069 | 1169 | |
---|
1070 | | - prop = nla_nest_start(msg->skb, TIPC_NLA_MEDIA_PROP); |
---|
| 1170 | + prop = nla_nest_start_noflag(msg->skb, TIPC_NLA_MEDIA_PROP); |
---|
1071 | 1171 | if (!prop) |
---|
1072 | 1172 | goto prop_msg_full; |
---|
1073 | 1173 | if (nla_put_u32(msg->skb, TIPC_NLA_PROP_PRIO, media->priority)) |
---|
1074 | 1174 | goto prop_msg_full; |
---|
1075 | 1175 | if (nla_put_u32(msg->skb, TIPC_NLA_PROP_TOL, media->tolerance)) |
---|
1076 | 1176 | goto prop_msg_full; |
---|
1077 | | - if (nla_put_u32(msg->skb, TIPC_NLA_PROP_WIN, media->window)) |
---|
| 1177 | + if (nla_put_u32(msg->skb, TIPC_NLA_PROP_WIN, media->max_win)) |
---|
1078 | 1178 | goto prop_msg_full; |
---|
1079 | 1179 | if (media->type_id == TIPC_MEDIA_TYPE_UDP) |
---|
1080 | 1180 | if (nla_put_u32(msg->skb, TIPC_NLA_PROP_MTU, media->mtu)) |
---|
.. | .. |
---|
1129 | 1229 | struct tipc_nl_msg msg; |
---|
1130 | 1230 | struct tipc_media *media; |
---|
1131 | 1231 | struct sk_buff *rep; |
---|
1132 | | - struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1]; |
---|
| 1232 | + struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1]; |
---|
1133 | 1233 | |
---|
1134 | 1234 | if (!info->attrs[TIPC_NLA_MEDIA]) |
---|
1135 | 1235 | return -EINVAL; |
---|
1136 | 1236 | |
---|
1137 | | - err = nla_parse_nested(attrs, TIPC_NLA_MEDIA_MAX, |
---|
1138 | | - info->attrs[TIPC_NLA_MEDIA], |
---|
1139 | | - tipc_nl_media_policy, info->extack); |
---|
| 1237 | + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_MEDIA_MAX, |
---|
| 1238 | + info->attrs[TIPC_NLA_MEDIA], |
---|
| 1239 | + tipc_nl_media_policy, info->extack); |
---|
1140 | 1240 | if (err) |
---|
1141 | 1241 | return err; |
---|
1142 | 1242 | |
---|
.. | .. |
---|
1178 | 1278 | int err; |
---|
1179 | 1279 | char *name; |
---|
1180 | 1280 | struct tipc_media *m; |
---|
1181 | | - struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1]; |
---|
| 1281 | + struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1]; |
---|
1182 | 1282 | |
---|
1183 | 1283 | if (!info->attrs[TIPC_NLA_MEDIA]) |
---|
1184 | 1284 | return -EINVAL; |
---|
1185 | 1285 | |
---|
1186 | | - err = nla_parse_nested(attrs, TIPC_NLA_MEDIA_MAX, |
---|
1187 | | - info->attrs[TIPC_NLA_MEDIA], |
---|
1188 | | - tipc_nl_media_policy, info->extack); |
---|
| 1286 | + err = nla_parse_nested_deprecated(attrs, TIPC_NLA_MEDIA_MAX, |
---|
| 1287 | + info->attrs[TIPC_NLA_MEDIA], |
---|
| 1288 | + tipc_nl_media_policy, info->extack); |
---|
1189 | 1289 | |
---|
1190 | 1290 | if (!attrs[TIPC_NLA_MEDIA_NAME]) |
---|
1191 | 1291 | return -EINVAL; |
---|
.. | .. |
---|
1209 | 1309 | if (props[TIPC_NLA_PROP_PRIO]) |
---|
1210 | 1310 | m->priority = nla_get_u32(props[TIPC_NLA_PROP_PRIO]); |
---|
1211 | 1311 | if (props[TIPC_NLA_PROP_WIN]) |
---|
1212 | | - m->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]); |
---|
| 1312 | + m->max_win = nla_get_u32(props[TIPC_NLA_PROP_WIN]); |
---|
1213 | 1313 | if (props[TIPC_NLA_PROP_MTU]) { |
---|
1214 | 1314 | if (m->type_id != TIPC_MEDIA_TYPE_UDP) { |
---|
1215 | 1315 | NL_SET_ERR_MSG(info->extack, |
---|