summaryrefslogtreecommitdiff
path: root/drivers/vlan_mon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vlan_mon')
-rw-r--r--drivers/vlan_mon/vlan_mon.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/vlan_mon/vlan_mon.c b/drivers/vlan_mon/vlan_mon.c
index db6d022f..b6476d4c 100644
--- a/drivers/vlan_mon/vlan_mon.c
+++ b/drivers/vlan_mon/vlan_mon.c
@@ -663,14 +663,6 @@ static struct genl_ops vlan_mon_nl_ops[] = {
},
};
-static struct genl_family vlan_mon_nl_family = {
- .id = GENL_ID_GENERATE,
- .name = VLAN_MON_GENL_NAME,
- .version = VLAN_MON_GENL_VERSION,
- .hdrsize = 0,
- .maxattr = VLAN_MON_ATTR_MAX,
-};
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
static struct genl_multicast_group vlan_mon_nl_mcg = {
.name = VLAN_MON_GENL_MCG,
@@ -681,6 +673,23 @@ static struct genl_multicast_group vlan_mon_nl_mcgs[] = {
};
#endif
+static struct genl_family vlan_mon_nl_family = {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
+ .id = GENL_ID_GENERATE,
+#endif
+ .name = VLAN_MON_GENL_NAME,
+ .version = VLAN_MON_GENL_VERSION,
+ .hdrsize = 0,
+ .maxattr = VLAN_MON_ATTR_MAX,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
+ .module = THIS_MODULE,
+ .ops = vlan_mon_nl_ops,
+ .n_ops = ARRAY_SIZE(vlan_mon_nl_ops),
+ .mcgrps = vlan_mon_nl_mcgs,
+ .n_mcgrps = ARRAY_SIZE(vlan_mon_nl_mcgs),
+#endif
+};
+
static struct packet_type vlan_pt __read_mostly = {
.type = __constant_htons(ETH_P_ALL),
.func = vlan_pt_recv,
@@ -699,8 +708,10 @@ static int __init vlan_mon_init(void)
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
err = genl_register_family_with_ops(&vlan_mon_nl_family, vlan_mon_nl_ops, ARRAY_SIZE(vlan_mon_nl_ops));
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
err = genl_register_family_with_ops_groups(&vlan_mon_nl_family, vlan_mon_nl_ops, vlan_mon_nl_mcgs);
+#else
+ err = genl_register_family(&vlan_mon_nl_family);
#endif
if (err < 0) {
printk(KERN_INFO "vlan_mon: can't register netlink interface\n");