Skip to content

Commit

Permalink
Revert "genl: Add genlmsg_new_unicast() for unicast message allocation"
Browse files Browse the repository at this point in the history
This reverts commit bb9b18f ("genl: Add genlmsg_new_unicast() for
unicast message allocation")'.

Nothing wrong with it; its no longer needed since this was only for
mmapped netlink support.

Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Florian Westphal authored and davem330 committed Feb 18, 2016
1 parent 551ddc0 commit 263ea09
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 31 deletions.
4 changes: 0 additions & 4 deletions include/net/genetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ struct genl_family {
* @attrs: netlink attributes
* @_net: network namespace
* @user_ptr: user pointers
* @dst_sk: destination socket
*/
struct genl_info {
u32 snd_seq;
Expand All @@ -94,7 +93,6 @@ struct genl_info {
struct nlattr ** attrs;
possible_net_t _net;
void * user_ptr[2];
struct sock * dst_sk;
};

static inline struct net *genl_info_net(struct genl_info *info)
Expand Down Expand Up @@ -188,8 +186,6 @@ int genl_unregister_family(struct genl_family *family);
void genl_notify(struct genl_family *family, struct sk_buff *skb,
struct genl_info *info, u32 group, gfp_t flags);

struct sk_buff *genlmsg_new_unicast(size_t payload, struct genl_info *info,
gfp_t flags);
void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
struct genl_family *family, int flags, u8 cmd);

Expand Down
21 changes: 0 additions & 21 deletions net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,26 +462,6 @@ int genl_unregister_family(struct genl_family *family)
}
EXPORT_SYMBOL(genl_unregister_family);

/**
* genlmsg_new_unicast - Allocate generic netlink message for unicast
* @payload: size of the message payload
* @info: information on destination
* @flags: the type of memory to allocate
*
* Allocates a new sk_buff large enough to cover the specified payload
* plus required Netlink headers. Will check receiving socket for
* memory mapped i/o capability and use it if enabled. Will fall back
* to non-mapped skb if message size exceeds the frame size of the ring.
*/
struct sk_buff *genlmsg_new_unicast(size_t payload, struct genl_info *info,
gfp_t flags)
{
size_t len = nlmsg_total_size(genlmsg_total_size(payload));

return netlink_alloc_skb(info->dst_sk, len, info->snd_portid, flags);
}
EXPORT_SYMBOL_GPL(genlmsg_new_unicast);

/**
* genlmsg_put - Add generic netlink header to netlink message
* @skb: socket buffer holding the message
Expand Down Expand Up @@ -642,7 +622,6 @@ static int genl_family_rcv_msg(struct genl_family *family,
info.genlhdr = nlmsg_data(nlh);
info.userhdr = nlmsg_data(nlh) + GENL_HDRLEN;
info.attrs = attrbuf;
info.dst_sk = skb->sk;
genl_info_net_set(&info, net);
memset(&info.user_ptr, 0, sizeof(info.user_ptr));

Expand Down
10 changes: 5 additions & 5 deletions net/openvswitch/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
return -EMSGSIZE;
}

static struct sk_buff *ovs_dp_cmd_alloc_info(struct genl_info *info)
static struct sk_buff *ovs_dp_cmd_alloc_info(void)
{
return genlmsg_new(ovs_dp_cmd_msg_size(), GFP_KERNEL);
}
Expand Down Expand Up @@ -1532,7 +1532,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
if (!a[OVS_DP_ATTR_NAME] || !a[OVS_DP_ATTR_UPCALL_PID])
goto err;

reply = ovs_dp_cmd_alloc_info(info);
reply = ovs_dp_cmd_alloc_info();
if (!reply)
return -ENOMEM;

Expand Down Expand Up @@ -1653,7 +1653,7 @@ static int ovs_dp_cmd_del(struct sk_buff *skb, struct genl_info *info)
struct datapath *dp;
int err;

reply = ovs_dp_cmd_alloc_info(info);
reply = ovs_dp_cmd_alloc_info();
if (!reply)
return -ENOMEM;

Expand Down Expand Up @@ -1686,7 +1686,7 @@ static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info)
struct datapath *dp;
int err;

reply = ovs_dp_cmd_alloc_info(info);
reply = ovs_dp_cmd_alloc_info();
if (!reply)
return -ENOMEM;

Expand Down Expand Up @@ -1719,7 +1719,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)
struct datapath *dp;
int err;

reply = ovs_dp_cmd_alloc_info(info);
reply = ovs_dp_cmd_alloc_info();
if (!reply)
return -ENOMEM;

Expand Down
1 change: 0 additions & 1 deletion net/tipc/netlink_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,6 @@ static int tipc_nl_compat_recv(struct sk_buff *skb, struct genl_info *info)
req_nlh = (struct nlmsghdr *)skb->data;
msg.req = nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN;
msg.cmd = req_userhdr->cmd;
msg.dst_sk = info->dst_sk;
msg.net = genl_info_net(info);

if ((msg.cmd & 0xC000) && (!netlink_net_capable(skb, CAP_NET_ADMIN))) {
Expand Down

0 comments on commit 263ea09

Please sign in to comment.