aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/tipc/link.c73
-rw-r--r--net/tipc/link.h1
-rw-r--r--net/tipc/netlink.c5
3 files changed, 79 insertions, 0 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index bdc4b5e5bf56..6785dcfd2d23 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2441,6 +2441,79 @@ int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[])
2441 return 0; 2441 return 0;
2442} 2442}
2443 2443
2444int tipc_nl_link_set(struct sk_buff *skb, struct genl_info *info)
2445{
2446 int err;
2447 int res = 0;
2448 int bearer_id;
2449 char *name;
2450 struct tipc_link *link;
2451 struct tipc_node *node;
2452 struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1];
2453
2454 if (!info->attrs[TIPC_NLA_LINK])
2455 return -EINVAL;
2456
2457 err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX,
2458 info->attrs[TIPC_NLA_LINK],
2459 tipc_nl_link_policy);
2460 if (err)
2461 return err;
2462
2463 if (!attrs[TIPC_NLA_LINK_NAME])
2464 return -EINVAL;
2465
2466 name = nla_data(attrs[TIPC_NLA_LINK_NAME]);
2467
2468 node = tipc_link_find_owner(name, &bearer_id);
2469 if (!node)
2470 return -EINVAL;
2471
2472 tipc_node_lock(node);
2473
2474 link = node->links[bearer_id];
2475 if (!link) {
2476 res = -EINVAL;
2477 goto out;
2478 }
2479
2480 if (attrs[TIPC_NLA_LINK_PROP]) {
2481 struct nlattr *props[TIPC_NLA_PROP_MAX + 1];
2482
2483 err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_LINK_PROP],
2484 props);
2485 if (err) {
2486 res = err;
2487 goto out;
2488 }
2489
2490 if (props[TIPC_NLA_PROP_TOL]) {
2491 u32 tol;
2492
2493 tol = nla_get_u32(props[TIPC_NLA_PROP_TOL]);
2494 link_set_supervision_props(link, tol);
2495 tipc_link_proto_xmit(link, STATE_MSG, 0, 0, tol, 0, 0);
2496 }
2497 if (props[TIPC_NLA_PROP_PRIO]) {
2498 u32 prio;
2499
2500 prio = nla_get_u32(props[TIPC_NLA_PROP_PRIO]);
2501 link->priority = prio;
2502 tipc_link_proto_xmit(link, STATE_MSG, 0, 0, 0, prio, 0);
2503 }
2504 if (props[TIPC_NLA_PROP_WIN]) {
2505 u32 win;
2506
2507 win = nla_get_u32(props[TIPC_NLA_PROP_WIN]);
2508 tipc_link_set_queue_limits(link, win);
2509 }
2510 }
2511
2512out:
2513 tipc_node_unlock(node);
2514
2515 return res;
2516}
2444int __tipc_nl_add_stats(struct sk_buff *skb, struct tipc_stats *s) 2517int __tipc_nl_add_stats(struct sk_buff *skb, struct tipc_stats *s)
2445{ 2518{
2446 int i; 2519 int i;
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 8e3542a4a037..3738ba11ce00 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -242,6 +242,7 @@ void tipc_link_retransmit(struct tipc_link *l_ptr,
242 242
243int tipc_nl_link_dump(struct sk_buff *skb, struct netlink_callback *cb); 243int tipc_nl_link_dump(struct sk_buff *skb, struct netlink_callback *cb);
244int tipc_nl_link_get(struct sk_buff *skb, struct genl_info *info); 244int tipc_nl_link_get(struct sk_buff *skb, struct genl_info *info);
245int tipc_nl_link_set(struct sk_buff *skb, struct genl_info *info);
245int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]); 246int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]);
246 247
247/* 248/*
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index ea168b889caa..d4444e59bf98 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -144,6 +144,11 @@ static const struct genl_ops tipc_genl_v2_ops[] = {
144 .doit = tipc_nl_link_get, 144 .doit = tipc_nl_link_get,
145 .dumpit = tipc_nl_link_dump, 145 .dumpit = tipc_nl_link_dump,
146 .policy = tipc_nl_policy, 146 .policy = tipc_nl_policy,
147 },
148 {
149 .cmd = TIPC_NL_LINK_SET,
150 .doit = tipc_nl_link_set,
151 .policy = tipc_nl_policy,
147 } 152 }
148}; 153};
149 154