Linux 4.2: Pass namespace to sock_create_kern
authorMarc Dionne <marc.dionne@your-file-system.com>
Wed, 8 Jul 2015 17:32:31 +0000 (14:32 -0300)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 23 Jul 2015 14:53:39 +0000 (10:53 -0400)
sock_create_kern gains an additional network namespace
argument.

Pass in the default system namesapce.

Change-Id: I640e9497510242788e5060759779785ffb563a81
Reviewed-on: http://gerrit.openafs.org/11925
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

acinclude.m4
src/rx/LINUX/rx_knet.c

index 959e3c5..3937f15 100644 (file)
@@ -1053,6 +1053,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_FUNC([sock_create_kern],
                                     [#include <linux/net.h>],
                                     [sock_create_kern(0, 0, 0, NULL);])
+                AC_CHECK_LINUX_FUNC([sock_create_kern_ns],
+                                    [#include <linux/net.h>],
+                                    [sock_create_kern(NULL, 0, 0, 0, NULL);])
                 AC_CHECK_LINUX_FUNC([splice_direct_to_actor],
                                     [#include <linux/splice.h>],
                                     [splice_direct_to_actor(NULL,NULL,NULL);])
index ec1cd60..3398b2d 100644 (file)
@@ -48,7 +48,9 @@ rxk_NewSocketHost(afs_uint32 ahost, short aport)
     int pmtu = IP_PMTUDISC_DONT;
 #endif
 
-#ifdef HAVE_LINUX_SOCK_CREATE_KERN
+#ifdef HAVE_LINUX_SOCK_CREATE_KERN_NS
+    code = sock_create_kern(&init_net, AF_INET, SOCK_DGRAM, IPPROTO_UDP, &sockp);
+#elif defined(HAVE_LINUX_SOCK_CREATE_KERN)
     code = sock_create_kern(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &sockp);
 #elif defined(LINUX_KERNEL_SOCK_CREATE_V)
     code = sock_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &sockp, 0);