diff options
Diffstat (limited to 'net/tipc/bearer.c')
| -rw-r--r-- | net/tipc/bearer.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 48852c2dcc03..70e3dacbf84a 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
| @@ -48,6 +48,9 @@ static struct tipc_media * const media_info_array[] = { | |||
| 48 | #ifdef CONFIG_TIPC_MEDIA_IB | 48 | #ifdef CONFIG_TIPC_MEDIA_IB |
| 49 | &ib_media_info, | 49 | &ib_media_info, |
| 50 | #endif | 50 | #endif |
| 51 | #ifdef CONFIG_TIPC_MEDIA_UDP | ||
| 52 | &udp_media_info, | ||
| 53 | #endif | ||
| 51 | NULL | 54 | NULL |
| 52 | }; | 55 | }; |
| 53 | 56 | ||
| @@ -216,7 +219,8 @@ void tipc_bearer_remove_dest(struct net *net, u32 bearer_id, u32 dest) | |||
| 216 | * tipc_enable_bearer - enable bearer with the given name | 219 | * tipc_enable_bearer - enable bearer with the given name |
| 217 | */ | 220 | */ |
| 218 | static int tipc_enable_bearer(struct net *net, const char *name, | 221 | static int tipc_enable_bearer(struct net *net, const char *name, |
| 219 | u32 disc_domain, u32 priority) | 222 | u32 disc_domain, u32 priority, |
| 223 | struct nlattr *attr[]) | ||
| 220 | { | 224 | { |
| 221 | struct tipc_net *tn = net_generic(net, tipc_net_id); | 225 | struct tipc_net *tn = net_generic(net, tipc_net_id); |
| 222 | struct tipc_bearer *b_ptr; | 226 | struct tipc_bearer *b_ptr; |
| @@ -304,7 +308,7 @@ restart: | |||
| 304 | 308 | ||
| 305 | strcpy(b_ptr->name, name); | 309 | strcpy(b_ptr->name, name); |
| 306 | b_ptr->media = m_ptr; | 310 | b_ptr->media = m_ptr; |
| 307 | res = m_ptr->enable_media(net, b_ptr); | 311 | res = m_ptr->enable_media(net, b_ptr, attr); |
| 308 | if (res) { | 312 | if (res) { |
| 309 | pr_warn("Bearer <%s> rejected, enable failure (%d)\n", | 313 | pr_warn("Bearer <%s> rejected, enable failure (%d)\n", |
| 310 | name, -res); | 314 | name, -res); |
| @@ -372,7 +376,8 @@ static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr, | |||
| 372 | kfree_rcu(b_ptr, rcu); | 376 | kfree_rcu(b_ptr, rcu); |
| 373 | } | 377 | } |
| 374 | 378 | ||
| 375 | int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b) | 379 | int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b, |
| 380 | struct nlattr *attr[]) | ||
| 376 | { | 381 | { |
| 377 | struct net_device *dev; | 382 | struct net_device *dev; |
| 378 | char *driver_name = strchr((const char *)b->name, ':') + 1; | 383 | char *driver_name = strchr((const char *)b->name, ':') + 1; |
| @@ -586,14 +591,14 @@ void tipc_bearer_stop(struct net *net) | |||
| 586 | 591 | ||
| 587 | /* Caller should hold rtnl_lock to protect the bearer */ | 592 | /* Caller should hold rtnl_lock to protect the bearer */ |
| 588 | static int __tipc_nl_add_bearer(struct tipc_nl_msg *msg, | 593 | static int __tipc_nl_add_bearer(struct tipc_nl_msg *msg, |
| 589 | struct tipc_bearer *bearer) | 594 | struct tipc_bearer *bearer, int nlflags) |
| 590 | { | 595 | { |
| 591 | void *hdr; | 596 | void *hdr; |
| 592 | struct nlattr *attrs; | 597 | struct nlattr *attrs; |
| 593 | struct nlattr *prop; | 598 | struct nlattr *prop; |
| 594 | 599 | ||
| 595 | hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, | 600 | hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, |
| 596 | NLM_F_MULTI, TIPC_NL_BEARER_GET); | 601 | nlflags, TIPC_NL_BEARER_GET); |
| 597 | if (!hdr) | 602 | if (!hdr) |
| 598 | return -EMSGSIZE; | 603 | return -EMSGSIZE; |
| 599 | 604 | ||
| @@ -652,7 +657,7 @@ int tipc_nl_bearer_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
| 652 | if (!bearer) | 657 | if (!bearer) |
| 653 | continue; | 658 | continue; |
| 654 | 659 | ||
| 655 | err = __tipc_nl_add_bearer(&msg, bearer); | 660 | err = __tipc_nl_add_bearer(&msg, bearer, NLM_F_MULTI); |
| 656 | if (err) | 661 | if (err) |
| 657 | break; | 662 | break; |
| 658 | } | 663 | } |
| @@ -700,7 +705,7 @@ int tipc_nl_bearer_get(struct sk_buff *skb, struct genl_info *info) | |||
| 700 | goto err_out; | 705 | goto err_out; |
| 701 | } | 706 | } |
| 702 | 707 | ||
| 703 | err = __tipc_nl_add_bearer(&msg, bearer); | 708 | err = __tipc_nl_add_bearer(&msg, bearer, 0); |
| 704 | if (err) | 709 | if (err) |
| 705 | goto err_out; | 710 | goto err_out; |
| 706 | rtnl_unlock(); | 711 | rtnl_unlock(); |
| @@ -791,7 +796,7 @@ int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info) | |||
| 791 | } | 796 | } |
| 792 | 797 | ||
| 793 | rtnl_lock(); | 798 | rtnl_lock(); |
| 794 | err = tipc_enable_bearer(net, bearer, domain, prio); | 799 | err = tipc_enable_bearer(net, bearer, domain, prio, attrs); |
| 795 | if (err) { | 800 | if (err) { |
| 796 | rtnl_unlock(); | 801 | rtnl_unlock(); |
| 797 | return err; | 802 | return err; |
| @@ -852,14 +857,14 @@ int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) | |||
| 852 | } | 857 | } |
| 853 | 858 | ||
| 854 | static int __tipc_nl_add_media(struct tipc_nl_msg *msg, | 859 | static int __tipc_nl_add_media(struct tipc_nl_msg *msg, |
| 855 | struct tipc_media *media) | 860 | struct tipc_media *media, int nlflags) |
| 856 | { | 861 | { |
| 857 | void *hdr; | 862 | void *hdr; |
| 858 | struct nlattr *attrs; | 863 | struct nlattr *attrs; |
| 859 | struct nlattr *prop; | 864 | struct nlattr *prop; |
| 860 | 865 | ||
| 861 | hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, | 866 | hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, |
| 862 | NLM_F_MULTI, TIPC_NL_MEDIA_GET); | 867 | nlflags, TIPC_NL_MEDIA_GET); |
| 863 | if (!hdr) | 868 | if (!hdr) |
| 864 | return -EMSGSIZE; | 869 | return -EMSGSIZE; |
| 865 | 870 | ||
| @@ -911,7 +916,8 @@ int tipc_nl_media_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
| 911 | 916 | ||
| 912 | rtnl_lock(); | 917 | rtnl_lock(); |
| 913 | for (; media_info_array[i] != NULL; i++) { | 918 | for (; media_info_array[i] != NULL; i++) { |
| 914 | err = __tipc_nl_add_media(&msg, media_info_array[i]); | 919 | err = __tipc_nl_add_media(&msg, media_info_array[i], |
| 920 | NLM_F_MULTI); | ||
| 915 | if (err) | 921 | if (err) |
| 916 | break; | 922 | break; |
| 917 | } | 923 | } |
| @@ -958,7 +964,7 @@ int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info) | |||
| 958 | goto err_out; | 964 | goto err_out; |
| 959 | } | 965 | } |
| 960 | 966 | ||
| 961 | err = __tipc_nl_add_media(&msg, media); | 967 | err = __tipc_nl_add_media(&msg, media, 0); |
| 962 | if (err) | 968 | if (err) |
| 963 | goto err_out; | 969 | goto err_out; |
| 964 | rtnl_unlock(); | 970 | rtnl_unlock(); |
