aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/netlink_compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/netlink_compat.c')
-rw-r--r--net/tipc/netlink_compat.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index bff9403899ed..056532b41e7e 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -569,6 +569,43 @@ static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg,
569 &link_info, sizeof(link_info)); 569 &link_info, sizeof(link_info));
570} 570}
571 571
572static int tipc_nl_compat_link_set(struct sk_buff *skb,
573 struct tipc_nl_compat_msg *msg)
574{
575 struct nlattr *link;
576 struct nlattr *prop;
577 struct tipc_link_config *lc;
578
579 lc = (struct tipc_link_config *)TLV_DATA(msg->req);
580
581 link = nla_nest_start(skb, TIPC_NLA_LINK);
582 if (!link)
583 return -EMSGSIZE;
584
585 if (nla_put_string(skb, TIPC_NLA_LINK_NAME, lc->name))
586 return -EMSGSIZE;
587
588 prop = nla_nest_start(skb, TIPC_NLA_LINK_PROP);
589 if (!prop)
590 return -EMSGSIZE;
591
592 if (msg->cmd == TIPC_CMD_SET_LINK_PRI) {
593 if (nla_put_u32(skb, TIPC_NLA_PROP_PRIO, ntohl(lc->value)))
594 return -EMSGSIZE;
595 } else if (msg->cmd == TIPC_CMD_SET_LINK_TOL) {
596 if (nla_put_u32(skb, TIPC_NLA_PROP_TOL, ntohl(lc->value)))
597 return -EMSGSIZE;
598 } else if (msg->cmd == TIPC_CMD_SET_LINK_WINDOW) {
599 if (nla_put_u32(skb, TIPC_NLA_PROP_WIN, ntohl(lc->value)))
600 return -EMSGSIZE;
601 }
602
603 nla_nest_end(skb, prop);
604 nla_nest_end(skb, link);
605
606 return 0;
607}
608
572static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) 609static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg)
573{ 610{
574 struct tipc_nl_compat_cmd_dump dump; 611 struct tipc_nl_compat_cmd_dump dump;
@@ -606,6 +643,13 @@ static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg)
606 dump.dumpit = tipc_nl_link_dump; 643 dump.dumpit = tipc_nl_link_dump;
607 dump.format = tipc_nl_compat_link_dump; 644 dump.format = tipc_nl_compat_link_dump;
608 return tipc_nl_compat_dumpit(&dump, msg); 645 return tipc_nl_compat_dumpit(&dump, msg);
646 case TIPC_CMD_SET_LINK_TOL:
647 case TIPC_CMD_SET_LINK_PRI:
648 case TIPC_CMD_SET_LINK_WINDOW:
649 msg->req_type = TIPC_TLV_LINK_CONFIG;
650 doit.doit = tipc_nl_link_set;
651 doit.transcode = tipc_nl_compat_link_set;
652 return tipc_nl_compat_doit(&doit, msg);
609 } 653 }
610 654
611 return -EOPNOTSUPP; 655 return -EOPNOTSUPP;
@@ -707,6 +751,9 @@ static int tipc_nl_compat_tmp_wrap(struct sk_buff *skb, struct genl_info *info)
707 case TIPC_CMD_DISABLE_BEARER: 751 case TIPC_CMD_DISABLE_BEARER:
708 case TIPC_CMD_SHOW_LINK_STATS: 752 case TIPC_CMD_SHOW_LINK_STATS:
709 case TIPC_CMD_GET_LINKS: 753 case TIPC_CMD_GET_LINKS:
754 case TIPC_CMD_SET_LINK_TOL:
755 case TIPC_CMD_SET_LINK_PRI:
756 case TIPC_CMD_SET_LINK_WINDOW:
710 return tipc_nl_compat_recv(skb, info); 757 return tipc_nl_compat_recv(skb, info);
711 } 758 }
712 759