aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/tipc/bearer.c16
-rw-r--r--net/tipc/node.c12
-rw-r--r--net/tipc/node.h2
3 files changed, 25 insertions, 5 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index a22caf9e5a18..2dfb492a7c94 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -697,6 +697,9 @@ static int __tipc_nl_add_bearer(struct tipc_nl_msg *msg,
697 goto prop_msg_full; 697 goto prop_msg_full;
698 if (nla_put_u32(msg->skb, TIPC_NLA_PROP_WIN, bearer->window)) 698 if (nla_put_u32(msg->skb, TIPC_NLA_PROP_WIN, bearer->window))
699 goto prop_msg_full; 699 goto prop_msg_full;
700 if (bearer->media->type_id == TIPC_MEDIA_TYPE_UDP)
701 if (nla_put_u32(msg->skb, TIPC_NLA_PROP_MTU, bearer->mtu))
702 goto prop_msg_full;
700 703
701 nla_nest_end(msg->skb, prop); 704 nla_nest_end(msg->skb, prop);
702 705
@@ -979,12 +982,23 @@ int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)
979 982
980 if (props[TIPC_NLA_PROP_TOL]) { 983 if (props[TIPC_NLA_PROP_TOL]) {
981 b->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]); 984 b->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]);
982 tipc_node_apply_tolerance(net, b); 985 tipc_node_apply_property(net, b, TIPC_NLA_PROP_TOL);
983 } 986 }
984 if (props[TIPC_NLA_PROP_PRIO]) 987 if (props[TIPC_NLA_PROP_PRIO])
985 b->priority = nla_get_u32(props[TIPC_NLA_PROP_PRIO]); 988 b->priority = nla_get_u32(props[TIPC_NLA_PROP_PRIO]);
986 if (props[TIPC_NLA_PROP_WIN]) 989 if (props[TIPC_NLA_PROP_WIN])
987 b->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]); 990 b->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]);
991 if (props[TIPC_NLA_PROP_MTU]) {
992 if (b->media->type_id != TIPC_MEDIA_TYPE_UDP)
993 return -EINVAL;
994#ifdef CONFIG_TIPC_MEDIA_UDP
995 if (tipc_udp_mtu_bad(nla_get_u32
996 (props[TIPC_NLA_PROP_MTU])))
997 return -EINVAL;
998 b->mtu = nla_get_u32(props[TIPC_NLA_PROP_MTU]);
999 tipc_node_apply_property(net, b, TIPC_NLA_PROP_MTU);
1000#endif
1001 }
988 } 1002 }
989 1003
990 return 0; 1004 return 0;
diff --git a/net/tipc/node.c b/net/tipc/node.c
index c77dd2f3c589..b71e4e376bb9 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1681,7 +1681,8 @@ discard:
1681 kfree_skb(skb); 1681 kfree_skb(skb);
1682} 1682}
1683 1683
1684void tipc_node_apply_tolerance(struct net *net, struct tipc_bearer *b) 1684void tipc_node_apply_property(struct net *net, struct tipc_bearer *b,
1685 int prop)
1685{ 1686{
1686 struct tipc_net *tn = tipc_net(net); 1687 struct tipc_net *tn = tipc_net(net);
1687 int bearer_id = b->identity; 1688 int bearer_id = b->identity;
@@ -1696,8 +1697,13 @@ void tipc_node_apply_tolerance(struct net *net, struct tipc_bearer *b)
1696 list_for_each_entry_rcu(n, &tn->node_list, list) { 1697 list_for_each_entry_rcu(n, &tn->node_list, list) {
1697 tipc_node_write_lock(n); 1698 tipc_node_write_lock(n);
1698 e = &n->links[bearer_id]; 1699 e = &n->links[bearer_id];
1699 if (e->link) 1700 if (e->link) {
1700 tipc_link_set_tolerance(e->link, b->tolerance, &xmitq); 1701 if (prop == TIPC_NLA_PROP_TOL)
1702 tipc_link_set_tolerance(e->link, b->tolerance,
1703 &xmitq);
1704 else if (prop == TIPC_NLA_PROP_MTU)
1705 tipc_link_set_mtu(e->link, b->mtu);
1706 }
1701 tipc_node_write_unlock(n); 1707 tipc_node_write_unlock(n);
1702 tipc_bearer_xmit(net, bearer_id, &xmitq, &e->maddr); 1708 tipc_bearer_xmit(net, bearer_id, &xmitq, &e->maddr);
1703 } 1709 }
diff --git a/net/tipc/node.h b/net/tipc/node.h
index f24b83500df1..bb271a37c93f 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -67,7 +67,7 @@ void tipc_node_check_dest(struct net *net, u32 onode, u8 *peer_id128,
67 struct tipc_media_addr *maddr, 67 struct tipc_media_addr *maddr,
68 bool *respond, bool *dupl_addr); 68 bool *respond, bool *dupl_addr);
69void tipc_node_delete_links(struct net *net, int bearer_id); 69void tipc_node_delete_links(struct net *net, int bearer_id);
70void tipc_node_apply_tolerance(struct net *net, struct tipc_bearer *b); 70void tipc_node_apply_property(struct net *net, struct tipc_bearer *b, int prop);
71int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node, 71int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node,
72 char *linkname, size_t len); 72 char *linkname, size_t len);
73int tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode, 73int tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode,