EXTRA_KCFLAGS="$tmp_flags"
]) # LN_CONFIG_TCP_SENDPAGE
+# LN_CONFIG_SOCK_CREATE_KERN
+#
+# 4.x sock_create_kern() added a first parameter as 'struct net *'
+# instead of int.
+#
+AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
+sock_create_kern_net, [
+ #include <linux/net.h>
+ #include <net/net_namespace.h>
+],[
+ sock_create_kern((struct net*)0, 0, 0, 0, NULL);
+],[
+ AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
+ [sock_create_kern use net as first parameter])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_CONFIG_SOCK_CREATE_KERN
+
#
# LN_CONFIG_SK_DATA_READY
#
LN_CONFIG_SK_SLEEP
# 2.6.36
LN_CONFIG_TCP_SENDPAGE
+# 4.x
+LN_CONFIG_SOCK_CREATE_KERN
# 3.15
LN_CONFIG_SK_DATA_READY
]) # LN_PROG_LINUX
int fd = -1;
int rc;
- rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock);
+#ifdef HAVE_SOCK_CREATE_KERN_USE_NET
+ rc = sock_create_kern(&init_net, PF_INET, SOCK_STREAM, 0, &sock);
+#else
+ rc = sock_create_kern(PF_INET, SOCK_STREAM, 0, &sock);
+#endif
if (rc != 0) {
CERROR("Can't create socket: %d\n", rc);
return rc;
/* All errors are fatal except bind failure if the port is in use */
*fatal = 1;
- rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock);
+#ifdef HAVE_SOCK_CREATE_KERN_USE_NET
+ rc = sock_create_kern(&init_net, PF_INET, SOCK_STREAM, 0, &sock);
+#else
+ rc = sock_create_kern(PF_INET, SOCK_STREAM, 0, &sock);
+#endif
*sockp = sock;
if (rc != 0) {
CERROR("Can't create socket: %d\n", rc);