2 * NETLINK Generic Netlink Family
4 * Authors: Jamal Hadi Salim
5 * Thomas Graf <tgraf@suug.ch>
6 * Johannes Berg <johannes@sipsolutions.net>
9 #include <linux/module.h>
10 #include <linux/kernel.h>
11 #include <linux/slab.h>
12 #include <linux/errno.h>
13 #include <linux/types.h>
14 #include <linux/socket.h>
15 #include <linux/string.h>
16 #include <linux/skbuff.h>
17 #include <linux/mutex.h>
18 #include <linux/bitmap.h>
20 #include <net/genetlink.h>
22 static DEFINE_MUTEX(genl_mutex
); /* serialization of message processing */
26 mutex_lock(&genl_mutex
);
28 EXPORT_SYMBOL(genl_lock
);
30 void genl_unlock(void)
32 mutex_unlock(&genl_mutex
);
34 EXPORT_SYMBOL(genl_unlock
);
36 #ifdef CONFIG_PROVE_LOCKING
37 int lockdep_genl_is_held(void)
39 return lockdep_is_held(&genl_mutex
);
41 EXPORT_SYMBOL(lockdep_genl_is_held
);
44 #define GENL_FAM_TAB_SIZE 16
45 #define GENL_FAM_TAB_MASK (GENL_FAM_TAB_SIZE - 1)
47 static struct list_head family_ht
[GENL_FAM_TAB_SIZE
];
49 * Bitmap of multicast groups that are currently in use.
51 * To avoid an allocation at boot of just one unsigned long,
52 * declare it global instead.
53 * Bit 0 is marked as already used since group 0 is invalid.
55 static unsigned long mc_group_start
= 0x1;
56 static unsigned long *mc_groups
= &mc_group_start
;
57 static unsigned long mc_groups_longs
= 1;
59 static int genl_ctrl_event(int event
, void *data
);
61 static inline unsigned int genl_family_hash(unsigned int id
)
63 return id
& GENL_FAM_TAB_MASK
;
66 static inline struct list_head
*genl_family_chain(unsigned int id
)
68 return &family_ht
[genl_family_hash(id
)];
71 static struct genl_family
*genl_family_find_byid(unsigned int id
)
73 struct genl_family
*f
;
75 list_for_each_entry(f
, genl_family_chain(id
), family_list
)
82 static struct genl_family
*genl_family_find_byname(char *name
)
84 struct genl_family
*f
;
87 for (i
= 0; i
< GENL_FAM_TAB_SIZE
; i
++)
88 list_for_each_entry(f
, genl_family_chain(i
), family_list
)
89 if (strcmp(f
->name
, name
) == 0)
95 static struct genl_ops
*genl_get_cmd(u8 cmd
, struct genl_family
*family
)
99 list_for_each_entry(ops
, &family
->ops_list
, ops_list
)
106 /* Of course we are going to have problems once we hit
107 * 2^16 alive types, but that can only happen by year 2K
109 static u16
genl_generate_id(void)
111 static u16 id_gen_idx
= GENL_MIN_ID
;
114 for (i
= 0; i
<= GENL_MAX_ID
- GENL_MIN_ID
; i
++) {
115 if (!genl_family_find_byid(id_gen_idx
))
117 if (++id_gen_idx
> GENL_MAX_ID
)
118 id_gen_idx
= GENL_MIN_ID
;
124 static struct genl_multicast_group notify_grp
;
127 * genl_register_mc_group - register a multicast group
129 * Registers the specified multicast group and notifies userspace
130 * about the new group.
132 * Returns 0 on success or a negative error code.
134 * @family: The generic netlink family the group shall be registered for.
135 * @grp: The group to register, must have a name.
137 int genl_register_mc_group(struct genl_family
*family
,
138 struct genl_multicast_group
*grp
)
141 unsigned long *new_groups
;
144 BUG_ON(grp
->name
[0] == '\0');
148 /* special-case our own group */
149 if (grp
== ¬ify_grp
)
152 id
= find_first_zero_bit(mc_groups
,
153 mc_groups_longs
* BITS_PER_LONG
);
156 if (id
>= mc_groups_longs
* BITS_PER_LONG
) {
157 size_t nlen
= (mc_groups_longs
+ 1) * sizeof(unsigned long);
159 if (mc_groups
== &mc_group_start
) {
160 new_groups
= kzalloc(nlen
, GFP_KERNEL
);
165 mc_groups
= new_groups
;
166 *mc_groups
= mc_group_start
;
168 new_groups
= krealloc(mc_groups
, nlen
, GFP_KERNEL
);
173 mc_groups
= new_groups
;
174 mc_groups
[mc_groups_longs
] = 0;
179 if (family
->netnsok
) {
182 netlink_table_grab();
184 for_each_net_rcu(net
) {
185 err
= __netlink_change_ngroups(net
->genl_sock
,
186 mc_groups_longs
* BITS_PER_LONG
);
189 * No need to roll back, can only fail if
190 * memory allocation fails and then the
191 * number of _possible_ groups has been
192 * increased on some sockets which is ok.
195 netlink_table_ungrab();
200 netlink_table_ungrab();
202 err
= netlink_change_ngroups(init_net
.genl_sock
,
203 mc_groups_longs
* BITS_PER_LONG
);
209 set_bit(id
, mc_groups
);
210 list_add_tail(&grp
->list
, &family
->mcast_groups
);
211 grp
->family
= family
;
213 genl_ctrl_event(CTRL_CMD_NEWMCAST_GRP
, grp
);
218 EXPORT_SYMBOL(genl_register_mc_group
);
220 static void __genl_unregister_mc_group(struct genl_family
*family
,
221 struct genl_multicast_group
*grp
)
224 BUG_ON(grp
->family
!= family
);
226 netlink_table_grab();
228 for_each_net_rcu(net
)
229 __netlink_clear_multicast_users(net
->genl_sock
, grp
->id
);
231 netlink_table_ungrab();
233 clear_bit(grp
->id
, mc_groups
);
234 list_del(&grp
->list
);
235 genl_ctrl_event(CTRL_CMD_DELMCAST_GRP
, grp
);
241 * genl_unregister_mc_group - unregister a multicast group
243 * Unregisters the specified multicast group and notifies userspace
244 * about it. All current listeners on the group are removed.
246 * Note: It is not necessary to unregister all multicast groups before
247 * unregistering the family, unregistering the family will cause
248 * all assigned multicast groups to be unregistered automatically.
250 * @family: Generic netlink family the group belongs to.
251 * @grp: The group to unregister, must have been registered successfully
254 void genl_unregister_mc_group(struct genl_family
*family
,
255 struct genl_multicast_group
*grp
)
258 __genl_unregister_mc_group(family
, grp
);
261 EXPORT_SYMBOL(genl_unregister_mc_group
);
263 static void genl_unregister_mc_groups(struct genl_family
*family
)
265 struct genl_multicast_group
*grp
, *tmp
;
267 list_for_each_entry_safe(grp
, tmp
, &family
->mcast_groups
, list
)
268 __genl_unregister_mc_group(family
, grp
);
272 * genl_register_ops - register generic netlink operations
273 * @family: generic netlink family
274 * @ops: operations to be registered
276 * Registers the specified operations and assigns them to the specified
277 * family. Either a doit or dumpit callback must be specified or the
278 * operation will fail. Only one operation structure per command
279 * identifier may be registered.
281 * See include/net/genetlink.h for more documenation on the operations
284 * Returns 0 on success or a negative error code.
286 int genl_register_ops(struct genl_family
*family
, struct genl_ops
*ops
)
290 if (ops
->dumpit
== NULL
&& ops
->doit
== NULL
)
293 if (genl_get_cmd(ops
->cmd
, family
)) {
299 ops
->flags
|= GENL_CMD_CAP_DUMP
;
301 ops
->flags
|= GENL_CMD_CAP_DO
;
303 ops
->flags
|= GENL_CMD_CAP_HASPOL
;
306 list_add_tail(&ops
->ops_list
, &family
->ops_list
);
309 genl_ctrl_event(CTRL_CMD_NEWOPS
, ops
);
314 EXPORT_SYMBOL(genl_register_ops
);
317 * genl_unregister_ops - unregister generic netlink operations
318 * @family: generic netlink family
319 * @ops: operations to be unregistered
321 * Unregisters the specified operations and unassigns them from the
322 * specified family. The operation blocks until the current message
323 * processing has finished and doesn't start again until the
324 * unregister process has finished.
326 * Note: It is not necessary to unregister all operations before
327 * unregistering the family, unregistering the family will cause
328 * all assigned operations to be unregistered automatically.
330 * Returns 0 on success or a negative error code.
332 int genl_unregister_ops(struct genl_family
*family
, struct genl_ops
*ops
)
337 list_for_each_entry(rc
, &family
->ops_list
, ops_list
) {
339 list_del(&ops
->ops_list
);
341 genl_ctrl_event(CTRL_CMD_DELOPS
, ops
);
349 EXPORT_SYMBOL(genl_unregister_ops
);
352 * genl_register_family - register a generic netlink family
353 * @family: generic netlink family
355 * Registers the specified family after validating it first. Only one
356 * family may be registered with the same family name or identifier.
357 * The family id may equal GENL_ID_GENERATE causing an unique id to
358 * be automatically generated and assigned.
360 * Return 0 on success or a negative error code.
362 int genl_register_family(struct genl_family
*family
)
366 if (family
->id
&& family
->id
< GENL_MIN_ID
)
369 if (family
->id
> GENL_MAX_ID
)
372 INIT_LIST_HEAD(&family
->ops_list
);
373 INIT_LIST_HEAD(&family
->mcast_groups
);
377 if (genl_family_find_byname(family
->name
)) {
382 if (family
->id
== GENL_ID_GENERATE
) {
383 u16 newid
= genl_generate_id();
391 } else if (genl_family_find_byid(family
->id
)) {
396 if (family
->maxattr
) {
397 family
->attrbuf
= kmalloc((family
->maxattr
+1) *
398 sizeof(struct nlattr
*), GFP_KERNEL
);
399 if (family
->attrbuf
== NULL
) {
404 family
->attrbuf
= NULL
;
406 list_add_tail(&family
->family_list
, genl_family_chain(family
->id
));
409 genl_ctrl_event(CTRL_CMD_NEWFAMILY
, family
);
418 EXPORT_SYMBOL(genl_register_family
);
421 * genl_register_family_with_ops - register a generic netlink family
422 * @family: generic netlink family
423 * @ops: operations to be registered
424 * @n_ops: number of elements to register
426 * Registers the specified family and operations from the specified table.
427 * Only one family may be registered with the same family name or identifier.
429 * The family id may equal GENL_ID_GENERATE causing an unique id to
430 * be automatically generated and assigned.
432 * Either a doit or dumpit callback must be specified for every registered
433 * operation or the function will fail. Only one operation structure per
434 * command identifier may be registered.
436 * See include/net/genetlink.h for more documenation on the operations
439 * This is equivalent to calling genl_register_family() followed by
440 * genl_register_ops() for every operation entry in the table taking
441 * care to unregister the family on error path.
443 * Return 0 on success or a negative error code.
445 int genl_register_family_with_ops(struct genl_family
*family
,
446 struct genl_ops
*ops
, size_t n_ops
)
450 err
= genl_register_family(family
);
454 for (i
= 0; i
< n_ops
; ++i
, ++ops
) {
455 err
= genl_register_ops(family
, ops
);
461 genl_unregister_family(family
);
464 EXPORT_SYMBOL(genl_register_family_with_ops
);
467 * genl_unregister_family - unregister generic netlink family
468 * @family: generic netlink family
470 * Unregisters the specified family.
472 * Returns 0 on success or a negative error code.
474 int genl_unregister_family(struct genl_family
*family
)
476 struct genl_family
*rc
;
480 genl_unregister_mc_groups(family
);
482 list_for_each_entry(rc
, genl_family_chain(family
->id
), family_list
) {
483 if (family
->id
!= rc
->id
|| strcmp(rc
->name
, family
->name
))
486 list_del(&rc
->family_list
);
487 INIT_LIST_HEAD(&family
->ops_list
);
490 kfree(family
->attrbuf
);
491 genl_ctrl_event(CTRL_CMD_DELFAMILY
, family
);
499 EXPORT_SYMBOL(genl_unregister_family
);
501 static int genl_rcv_msg(struct sk_buff
*skb
, struct nlmsghdr
*nlh
)
503 struct genl_ops
*ops
;
504 struct genl_family
*family
;
505 struct net
*net
= sock_net(skb
->sk
);
506 struct genl_info info
;
507 struct genlmsghdr
*hdr
= nlmsg_data(nlh
);
510 family
= genl_family_find_byid(nlh
->nlmsg_type
);
514 /* this family doesn't exist in this netns */
515 if (!family
->netnsok
&& !net_eq(net
, &init_net
))
518 hdrlen
= GENL_HDRLEN
+ family
->hdrsize
;
519 if (nlh
->nlmsg_len
< nlmsg_msg_size(hdrlen
))
522 ops
= genl_get_cmd(hdr
->cmd
, family
);
526 if ((ops
->flags
& GENL_ADMIN_PERM
) &&
527 !capable(CAP_NET_ADMIN
))
530 if (nlh
->nlmsg_flags
& NLM_F_DUMP
) {
531 if (ops
->dumpit
== NULL
)
535 err
= netlink_dump_start(net
->genl_sock
, skb
, nlh
,
536 ops
->dumpit
, ops
->done
, 0);
541 if (ops
->doit
== NULL
)
544 if (family
->attrbuf
) {
545 err
= nlmsg_parse(nlh
, hdrlen
, family
->attrbuf
, family
->maxattr
,
551 info
.snd_seq
= nlh
->nlmsg_seq
;
552 info
.snd_pid
= NETLINK_CB(skb
).pid
;
554 info
.genlhdr
= nlmsg_data(nlh
);
555 info
.userhdr
= nlmsg_data(nlh
) + GENL_HDRLEN
;
556 info
.attrs
= family
->attrbuf
;
557 genl_info_net_set(&info
, net
);
558 memset(&info
.user_ptr
, 0, sizeof(info
.user_ptr
));
560 if (family
->pre_doit
) {
561 err
= family
->pre_doit(ops
, skb
, &info
);
566 err
= ops
->doit(skb
, &info
);
568 if (family
->post_doit
)
569 family
->post_doit(ops
, skb
, &info
);
574 static void genl_rcv(struct sk_buff
*skb
)
577 netlink_rcv_skb(skb
, &genl_rcv_msg
);
581 /**************************************************************************
583 **************************************************************************/
585 static struct genl_family genl_ctrl
= {
589 .maxattr
= CTRL_ATTR_MAX
,
593 static int ctrl_fill_info(struct genl_family
*family
, u32 pid
, u32 seq
,
594 u32 flags
, struct sk_buff
*skb
, u8 cmd
)
598 hdr
= genlmsg_put(skb
, pid
, seq
, &genl_ctrl
, flags
, cmd
);
602 NLA_PUT_STRING(skb
, CTRL_ATTR_FAMILY_NAME
, family
->name
);
603 NLA_PUT_U16(skb
, CTRL_ATTR_FAMILY_ID
, family
->id
);
604 NLA_PUT_U32(skb
, CTRL_ATTR_VERSION
, family
->version
);
605 NLA_PUT_U32(skb
, CTRL_ATTR_HDRSIZE
, family
->hdrsize
);
606 NLA_PUT_U32(skb
, CTRL_ATTR_MAXATTR
, family
->maxattr
);
608 if (!list_empty(&family
->ops_list
)) {
609 struct nlattr
*nla_ops
;
610 struct genl_ops
*ops
;
613 nla_ops
= nla_nest_start(skb
, CTRL_ATTR_OPS
);
615 goto nla_put_failure
;
617 list_for_each_entry(ops
, &family
->ops_list
, ops_list
) {
620 nest
= nla_nest_start(skb
, idx
++);
622 goto nla_put_failure
;
624 NLA_PUT_U32(skb
, CTRL_ATTR_OP_ID
, ops
->cmd
);
625 NLA_PUT_U32(skb
, CTRL_ATTR_OP_FLAGS
, ops
->flags
);
627 nla_nest_end(skb
, nest
);
630 nla_nest_end(skb
, nla_ops
);
633 if (!list_empty(&family
->mcast_groups
)) {
634 struct genl_multicast_group
*grp
;
635 struct nlattr
*nla_grps
;
638 nla_grps
= nla_nest_start(skb
, CTRL_ATTR_MCAST_GROUPS
);
639 if (nla_grps
== NULL
)
640 goto nla_put_failure
;
642 list_for_each_entry(grp
, &family
->mcast_groups
, list
) {
645 nest
= nla_nest_start(skb
, idx
++);
647 goto nla_put_failure
;
649 NLA_PUT_U32(skb
, CTRL_ATTR_MCAST_GRP_ID
, grp
->id
);
650 NLA_PUT_STRING(skb
, CTRL_ATTR_MCAST_GRP_NAME
,
653 nla_nest_end(skb
, nest
);
655 nla_nest_end(skb
, nla_grps
);
658 return genlmsg_end(skb
, hdr
);
661 genlmsg_cancel(skb
, hdr
);
665 static int ctrl_fill_mcgrp_info(struct genl_multicast_group
*grp
, u32 pid
,
666 u32 seq
, u32 flags
, struct sk_buff
*skb
,
670 struct nlattr
*nla_grps
;
673 hdr
= genlmsg_put(skb
, pid
, seq
, &genl_ctrl
, flags
, cmd
);
677 NLA_PUT_STRING(skb
, CTRL_ATTR_FAMILY_NAME
, grp
->family
->name
);
678 NLA_PUT_U16(skb
, CTRL_ATTR_FAMILY_ID
, grp
->family
->id
);
680 nla_grps
= nla_nest_start(skb
, CTRL_ATTR_MCAST_GROUPS
);
681 if (nla_grps
== NULL
)
682 goto nla_put_failure
;
684 nest
= nla_nest_start(skb
, 1);
686 goto nla_put_failure
;
688 NLA_PUT_U32(skb
, CTRL_ATTR_MCAST_GRP_ID
, grp
->id
);
689 NLA_PUT_STRING(skb
, CTRL_ATTR_MCAST_GRP_NAME
,
692 nla_nest_end(skb
, nest
);
693 nla_nest_end(skb
, nla_grps
);
695 return genlmsg_end(skb
, hdr
);
698 genlmsg_cancel(skb
, hdr
);
702 static int ctrl_dumpfamily(struct sk_buff
*skb
, struct netlink_callback
*cb
)
706 struct genl_family
*rt
;
707 struct net
*net
= sock_net(skb
->sk
);
708 int chains_to_skip
= cb
->args
[0];
709 int fams_to_skip
= cb
->args
[1];
711 for (i
= chains_to_skip
; i
< GENL_FAM_TAB_SIZE
; i
++) {
713 list_for_each_entry(rt
, genl_family_chain(i
), family_list
) {
714 if (!rt
->netnsok
&& !net_eq(net
, &init_net
))
716 if (++n
< fams_to_skip
)
718 if (ctrl_fill_info(rt
, NETLINK_CB(cb
->skb
).pid
,
719 cb
->nlh
->nlmsg_seq
, NLM_F_MULTI
,
720 skb
, CTRL_CMD_NEWFAMILY
) < 0)
734 static struct sk_buff
*ctrl_build_family_msg(struct genl_family
*family
,
735 u32 pid
, int seq
, u8 cmd
)
740 skb
= nlmsg_new(NLMSG_DEFAULT_SIZE
, GFP_KERNEL
);
742 return ERR_PTR(-ENOBUFS
);
744 err
= ctrl_fill_info(family
, pid
, seq
, 0, skb
, cmd
);
753 static struct sk_buff
*ctrl_build_mcgrp_msg(struct genl_multicast_group
*grp
,
754 u32 pid
, int seq
, u8 cmd
)
759 skb
= nlmsg_new(NLMSG_DEFAULT_SIZE
, GFP_KERNEL
);
761 return ERR_PTR(-ENOBUFS
);
763 err
= ctrl_fill_mcgrp_info(grp
, pid
, seq
, 0, skb
, cmd
);
772 static const struct nla_policy ctrl_policy
[CTRL_ATTR_MAX
+1] = {
773 [CTRL_ATTR_FAMILY_ID
] = { .type
= NLA_U16
},
774 [CTRL_ATTR_FAMILY_NAME
] = { .type
= NLA_NUL_STRING
,
775 .len
= GENL_NAMSIZ
- 1 },
778 static int ctrl_getfamily(struct sk_buff
*skb
, struct genl_info
*info
)
781 struct genl_family
*res
= NULL
;
784 if (info
->attrs
[CTRL_ATTR_FAMILY_ID
]) {
785 u16 id
= nla_get_u16(info
->attrs
[CTRL_ATTR_FAMILY_ID
]);
786 res
= genl_family_find_byid(id
);
790 if (info
->attrs
[CTRL_ATTR_FAMILY_NAME
]) {
793 name
= nla_data(info
->attrs
[CTRL_ATTR_FAMILY_NAME
]);
794 res
= genl_family_find_byname(name
);
795 #ifdef CONFIG_MODULES
798 request_module("net-pf-%d-proto-%d-type-%s",
799 PF_NETLINK
, NETLINK_GENERIC
, name
);
801 res
= genl_family_find_byname(name
);
810 if (!res
->netnsok
&& !net_eq(genl_info_net(info
), &init_net
)) {
811 /* family doesn't exist here */
815 msg
= ctrl_build_family_msg(res
, info
->snd_pid
, info
->snd_seq
,
820 return genlmsg_reply(msg
, info
);
823 static int genl_ctrl_event(int event
, void *data
)
826 struct genl_family
*family
;
827 struct genl_multicast_group
*grp
;
829 /* genl is still initialising */
830 if (!init_net
.genl_sock
)
834 case CTRL_CMD_NEWFAMILY
:
835 case CTRL_CMD_DELFAMILY
:
837 msg
= ctrl_build_family_msg(family
, 0, 0, event
);
839 case CTRL_CMD_NEWMCAST_GRP
:
840 case CTRL_CMD_DELMCAST_GRP
:
842 family
= grp
->family
;
843 msg
= ctrl_build_mcgrp_msg(data
, 0, 0, event
);
852 if (!family
->netnsok
) {
853 genlmsg_multicast_netns(&init_net
, msg
, 0,
854 GENL_ID_CTRL
, GFP_KERNEL
);
857 genlmsg_multicast_allns(msg
, 0, GENL_ID_CTRL
, GFP_ATOMIC
);
864 static struct genl_ops genl_ctrl_ops
= {
865 .cmd
= CTRL_CMD_GETFAMILY
,
866 .doit
= ctrl_getfamily
,
867 .dumpit
= ctrl_dumpfamily
,
868 .policy
= ctrl_policy
,
871 static struct genl_multicast_group notify_grp
= {
875 static int __net_init
genl_pernet_init(struct net
*net
)
877 /* we'll bump the group number right afterwards */
878 net
->genl_sock
= netlink_kernel_create(net
, NETLINK_GENERIC
, 0,
879 genl_rcv
, &genl_mutex
,
882 if (!net
->genl_sock
&& net_eq(net
, &init_net
))
883 panic("GENL: Cannot initialize generic netlink\n");
891 static void __net_exit
genl_pernet_exit(struct net
*net
)
893 netlink_kernel_release(net
->genl_sock
);
894 net
->genl_sock
= NULL
;
897 static struct pernet_operations genl_pernet_ops
= {
898 .init
= genl_pernet_init
,
899 .exit
= genl_pernet_exit
,
902 static int __init
genl_init(void)
906 for (i
= 0; i
< GENL_FAM_TAB_SIZE
; i
++)
907 INIT_LIST_HEAD(&family_ht
[i
]);
909 err
= genl_register_family_with_ops(&genl_ctrl
, &genl_ctrl_ops
, 1);
913 netlink_set_nonroot(NETLINK_GENERIC
, NL_NONROOT_RECV
);
915 err
= register_pernet_subsys(&genl_pernet_ops
);
919 err
= genl_register_mc_group(&genl_ctrl
, ¬ify_grp
);
926 panic("GENL: Cannot register controller: %d\n", err
);
929 subsys_initcall(genl_init
);
931 static int genlmsg_mcast(struct sk_buff
*skb
, u32 pid
, unsigned long group
,
935 struct net
*net
, *prev
= NULL
;
938 for_each_net_rcu(net
) {
940 tmp
= skb_clone(skb
, flags
);
945 err
= nlmsg_multicast(prev
->genl_sock
, tmp
,
954 return nlmsg_multicast(prev
->genl_sock
, skb
, pid
, group
, flags
);
960 int genlmsg_multicast_allns(struct sk_buff
*skb
, u32 pid
, unsigned int group
,
963 return genlmsg_mcast(skb
, pid
, group
, flags
);
965 EXPORT_SYMBOL(genlmsg_multicast_allns
);
967 void genl_notify(struct sk_buff
*skb
, struct net
*net
, u32 pid
, u32 group
,
968 struct nlmsghdr
*nlh
, gfp_t flags
)
970 struct sock
*sk
= net
->genl_sock
;
974 report
= nlmsg_report(nlh
);
976 nlmsg_notify(sk
, skb
, pid
, group
, report
, flags
);
978 EXPORT_SYMBOL(genl_notify
);