Support changed sock_create_kern() interface from Linux 4.2. stable-1.5
authorFlorian Pose <fp@igh-essen.com>
Tue, 18 Oct 2016 10:20:47 +0200
branchstable-1.5
changeset 2662 a1079c6242a5
parent 2661 39280d5a3321
child 2665 2de506e60b21
Support changed sock_create_kern() interface from Linux 4.2.
devices/generic.c
--- a/devices/generic.c	Tue Oct 18 10:20:21 2016 +0200
+++ b/devices/generic.c	Tue Oct 18 10:20:47 2016 +0200
@@ -212,8 +212,13 @@
         return -ENOMEM;
     }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+    ret = sock_create_kern(&init_net, PF_PACKET, SOCK_RAW,
+            htons(ETH_P_ETHERCAT), &dev->socket);
+#else
     ret = sock_create_kern(PF_PACKET, SOCK_RAW, htons(ETH_P_ETHERCAT),
             &dev->socket);
+#endif
     if (ret) {
         printk(KERN_ERR PFX "Failed to create socket (ret = %i).\n", ret);
         return ret;