diff options
Diffstat (limited to 'net/netlink/genetlink.c')
-rw-r--r-- | net/netlink/genetlink.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 713671ae45af..b1dcdb932a86 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -461,6 +461,26 @@ int genl_unregister_family(struct genl_family *family) | |||
461 | EXPORT_SYMBOL(genl_unregister_family); | 461 | EXPORT_SYMBOL(genl_unregister_family); |
462 | 462 | ||
463 | /** | 463 | /** |
464 | * genlmsg_new_unicast - Allocate generic netlink message for unicast | ||
465 | * @payload: size of the message payload | ||
466 | * @info: information on destination | ||
467 | * @flags: the type of memory to allocate | ||
468 | * | ||
469 | * Allocates a new sk_buff large enough to cover the specified payload | ||
470 | * plus required Netlink headers. Will check receiving socket for | ||
471 | * memory mapped i/o capability and use it if enabled. Will fall back | ||
472 | * to non-mapped skb if message size exceeds the frame size of the ring. | ||
473 | */ | ||
474 | struct sk_buff *genlmsg_new_unicast(size_t payload, struct genl_info *info, | ||
475 | gfp_t flags) | ||
476 | { | ||
477 | size_t len = nlmsg_total_size(genlmsg_total_size(payload)); | ||
478 | |||
479 | return netlink_alloc_skb(info->dst_sk, len, info->snd_portid, flags); | ||
480 | } | ||
481 | EXPORT_SYMBOL_GPL(genlmsg_new_unicast); | ||
482 | |||
483 | /** | ||
464 | * genlmsg_put - Add generic netlink header to netlink message | 484 | * genlmsg_put - Add generic netlink header to netlink message |
465 | * @skb: socket buffer holding the message | 485 | * @skb: socket buffer holding the message |
466 | * @portid: netlink portid the message is addressed to | 486 | * @portid: netlink portid the message is addressed to |
@@ -600,6 +620,7 @@ static int genl_family_rcv_msg(struct genl_family *family, | |||
600 | info.genlhdr = nlmsg_data(nlh); | 620 | info.genlhdr = nlmsg_data(nlh); |
601 | info.userhdr = nlmsg_data(nlh) + GENL_HDRLEN; | 621 | info.userhdr = nlmsg_data(nlh) + GENL_HDRLEN; |
602 | info.attrs = attrbuf; | 622 | info.attrs = attrbuf; |
623 | info.dst_sk = skb->sk; | ||
603 | genl_info_net_set(&info, net); | 624 | genl_info_net_set(&info, net); |
604 | memset(&info.user_ptr, 0, sizeof(info.user_ptr)); | 625 | memset(&info.user_ptr, 0, sizeof(info.user_ptr)); |
605 | 626 | ||