aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/genetlink.h4
-rw-r--r--net/netlink/genetlink.c21
-rw-r--r--net/openvswitch/datapath.c10
-rw-r--r--net/tipc/netlink_compat.c1
4 files changed, 5 insertions, 31 deletions
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 43c0e771f417..8d4608ce8716 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -83,7 +83,6 @@ struct genl_family {
83 * @attrs: netlink attributes 83 * @attrs: netlink attributes
84 * @_net: network namespace 84 * @_net: network namespace
85 * @user_ptr: user pointers 85 * @user_ptr: user pointers
86 * @dst_sk: destination socket
87 */ 86 */
88struct genl_info { 87struct genl_info {
89 u32 snd_seq; 88 u32 snd_seq;
@@ -94,7 +93,6 @@ struct genl_info {
94 struct nlattr ** attrs; 93 struct nlattr ** attrs;
95 possible_net_t _net; 94 possible_net_t _net;
96 void * user_ptr[2]; 95 void * user_ptr[2];
97 struct sock * dst_sk;
98}; 96};
99 97
100static inline struct net *genl_info_net(struct genl_info *info) 98static inline struct net *genl_info_net(struct genl_info *info)
@@ -188,8 +186,6 @@ int genl_unregister_family(struct genl_family *family);
188void genl_notify(struct genl_family *family, struct sk_buff *skb, 186void genl_notify(struct genl_family *family, struct sk_buff *skb,
189 struct genl_info *info, u32 group, gfp_t flags); 187 struct genl_info *info, u32 group, gfp_t flags);
190 188
191struct sk_buff *genlmsg_new_unicast(size_t payload, struct genl_info *info,
192 gfp_t flags);
193void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, 189void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
194 struct genl_family *family, int flags, u8 cmd); 190 struct genl_family *family, int flags, u8 cmd);
195 191
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 0ffd721126e7..a09132a69869 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -463,26 +463,6 @@ int genl_unregister_family(struct genl_family *family)
463EXPORT_SYMBOL(genl_unregister_family); 463EXPORT_SYMBOL(genl_unregister_family);
464 464
465/** 465/**
466 * genlmsg_new_unicast - Allocate generic netlink message for unicast
467 * @payload: size of the message payload
468 * @info: information on destination
469 * @flags: the type of memory to allocate
470 *
471 * Allocates a new sk_buff large enough to cover the specified payload
472 * plus required Netlink headers. Will check receiving socket for
473 * memory mapped i/o capability and use it if enabled. Will fall back
474 * to non-mapped skb if message size exceeds the frame size of the ring.
475 */
476struct sk_buff *genlmsg_new_unicast(size_t payload, struct genl_info *info,
477 gfp_t flags)
478{
479 size_t len = nlmsg_total_size(genlmsg_total_size(payload));
480
481 return netlink_alloc_skb(info->dst_sk, len, info->snd_portid, flags);
482}
483EXPORT_SYMBOL_GPL(genlmsg_new_unicast);
484
485/**
486 * genlmsg_put - Add generic netlink header to netlink message 466 * genlmsg_put - Add generic netlink header to netlink message
487 * @skb: socket buffer holding the message 467 * @skb: socket buffer holding the message
488 * @portid: netlink portid the message is addressed to 468 * @portid: netlink portid the message is addressed to
@@ -642,7 +622,6 @@ static int genl_family_rcv_msg(struct genl_family *family,
642 info.genlhdr = nlmsg_data(nlh); 622 info.genlhdr = nlmsg_data(nlh);
643 info.userhdr = nlmsg_data(nlh) + GENL_HDRLEN; 623 info.userhdr = nlmsg_data(nlh) + GENL_HDRLEN;
644 info.attrs = attrbuf; 624 info.attrs = attrbuf;
645 info.dst_sk = skb->sk;
646 genl_info_net_set(&info, net); 625 genl_info_net_set(&info, net);
647 memset(&info.user_ptr, 0, sizeof(info.user_ptr)); 626 memset(&info.user_ptr, 0, sizeof(info.user_ptr));
648 627
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 35a2659a277e..c4e8455d5d56 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1477,7 +1477,7 @@ error:
1477 return -EMSGSIZE; 1477 return -EMSGSIZE;
1478} 1478}
1479 1479
1480static struct sk_buff *ovs_dp_cmd_alloc_info(struct genl_info *info) 1480static struct sk_buff *ovs_dp_cmd_alloc_info(void)
1481{ 1481{
1482 return genlmsg_new(ovs_dp_cmd_msg_size(), GFP_KERNEL); 1482 return genlmsg_new(ovs_dp_cmd_msg_size(), GFP_KERNEL);
1483} 1483}
@@ -1532,7 +1532,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
1532 if (!a[OVS_DP_ATTR_NAME] || !a[OVS_DP_ATTR_UPCALL_PID]) 1532 if (!a[OVS_DP_ATTR_NAME] || !a[OVS_DP_ATTR_UPCALL_PID])
1533 goto err; 1533 goto err;
1534 1534
1535 reply = ovs_dp_cmd_alloc_info(info); 1535 reply = ovs_dp_cmd_alloc_info();
1536 if (!reply) 1536 if (!reply)
1537 return -ENOMEM; 1537 return -ENOMEM;
1538 1538
@@ -1653,7 +1653,7 @@ static int ovs_dp_cmd_del(struct sk_buff *skb, struct genl_info *info)
1653 struct datapath *dp; 1653 struct datapath *dp;
1654 int err; 1654 int err;
1655 1655
1656 reply = ovs_dp_cmd_alloc_info(info); 1656 reply = ovs_dp_cmd_alloc_info();
1657 if (!reply) 1657 if (!reply)
1658 return -ENOMEM; 1658 return -ENOMEM;
1659 1659
@@ -1686,7 +1686,7 @@ static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info)
1686 struct datapath *dp; 1686 struct datapath *dp;
1687 int err; 1687 int err;
1688 1688
1689 reply = ovs_dp_cmd_alloc_info(info); 1689 reply = ovs_dp_cmd_alloc_info();
1690 if (!reply) 1690 if (!reply)
1691 return -ENOMEM; 1691 return -ENOMEM;
1692 1692
@@ -1719,7 +1719,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)
1719 struct datapath *dp; 1719 struct datapath *dp;
1720 int err; 1720 int err;
1721 1721
1722 reply = ovs_dp_cmd_alloc_info(info); 1722 reply = ovs_dp_cmd_alloc_info();
1723 if (!reply) 1723 if (!reply)
1724 return -ENOMEM; 1724 return -ENOMEM;
1725 1725
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 2c016fdefe97..de66d8f945ed 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -1104,7 +1104,6 @@ static int tipc_nl_compat_recv(struct sk_buff *skb, struct genl_info *info)
1104 req_nlh = (struct nlmsghdr *)skb->data; 1104 req_nlh = (struct nlmsghdr *)skb->data;
1105 msg.req = nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN; 1105 msg.req = nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN;
1106 msg.cmd = req_userhdr->cmd; 1106 msg.cmd = req_userhdr->cmd;
1107 msg.dst_sk = info->dst_sk;
1108 msg.net = genl_info_net(info); 1107 msg.net = genl_info_net(info);
1109 1108
1110 if ((msg.cmd & 0xC000) && (!netlink_net_capable(skb, CAP_NET_ADMIN))) { 1109 if ((msg.cmd & 0xC000) && (!netlink_net_capable(skb, CAP_NET_ADMIN))) {