From e597b879677d023165298adadfb88db031883ff4 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Wed, 8 Jul 2015 14:32:31 -0300 Subject: [PATCH] Linux 4.2: Pass namespace to sock_create_kern 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 Reviewed-by: Perry Ruiter Reviewed-by: Chas Williams <3chas3@gmail.com> Reviewed-by: Benjamin Kaduk Reviewed-by: Jeffrey Altman --- acinclude.m4 | 3 +++ src/rx/LINUX/rx_knet.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 959e3c5208..3937f15a20 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1053,6 +1053,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) AC_CHECK_LINUX_FUNC([sock_create_kern], [#include ], [sock_create_kern(0, 0, 0, NULL);]) + AC_CHECK_LINUX_FUNC([sock_create_kern_ns], + [#include ], + [sock_create_kern(NULL, 0, 0, 0, NULL);]) AC_CHECK_LINUX_FUNC([splice_direct_to_actor], [#include ], [splice_direct_to_actor(NULL,NULL,NULL);]) diff --git a/src/rx/LINUX/rx_knet.c b/src/rx/LINUX/rx_knet.c index ec1cd60263..3398b2d322 100644 --- a/src/rx/LINUX/rx_knet.c +++ b/src/rx/LINUX/rx_knet.c @@ -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);