1 #include <net/genetlink.h>
2 #include <linux/version.h>
4 #ifndef HAVE_GENL_NOTIFY_TAKES_FAMILY
8 void rpl_genl_notify(struct rpl_genl_family *family, struct sk_buff *skb,
9 struct net *net, u32 portid, u32 group,
10 struct nlmsghdr *nlh, gfp_t flags)
12 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
13 struct sock *sk = net->genl_sock;
17 report = nlmsg_report(nlh);
19 nlmsg_notify(sk, skb, portid, group, report, flags);
21 genl_notify(skb, net, portid, group, nlh, flags);
24 EXPORT_SYMBOL_GPL(rpl_genl_notify);
26 int rpl___genl_register_family(struct rpl_genl_family *f)
30 f->compat_family.id = f->id;
31 f->compat_family.hdrsize = f->hdrsize;
32 strncpy(f->compat_family.name, f->name, GENL_NAMSIZ);
33 f->compat_family.version = f->version;
34 f->compat_family.maxattr = f->maxattr;
35 f->compat_family.netnsok = f->netnsok;
36 #ifdef HAVE_PARALLEL_OPS
37 f->compat_family.parallel_ops = f->parallel_ops;
39 err = genl_register_family_with_ops(&f->compat_family,
40 (struct genl_ops *) f->ops, f->n_ops);
45 /* Need to Fix GROUP_ID() for more than one group. */
46 BUG_ON(f->n_mcgrps > 1);
47 err = genl_register_mc_group(&f->compat_family,
48 (struct genl_multicast_group *) f->mcgrps);
56 EXPORT_SYMBOL_GPL(rpl___genl_register_family);
58 #endif /* kernel version < 3.13.0 */