+++ /dev/null
-/*********************************************************
- * Copyright (C) 2007 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- *********************************************************/
-
-/*
- * Detect whether the old or new sk_filter() interface is used. This was
- * changed in 2.4.21, but it's backported to some distro kernels.
- *
- * This test will fail to build on kernels with the new interface.
- */
-
-#include "compat_version.h"
-#include "compat_autoconf.h"
-
-/*
- * We'd restrict this test to 2.4.21 and earlier kernels, but Mandrake's
- * enterprise-2.4.21-013mdk-9.1 appears to really be 2.4.20 with some patches,
- * and not the patches we care about, so let's test on 2.4.21 kernels too.
- */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 22)
-#include <linux/stddef.h>
-#include <linux/socket.h>
-#include <net/sock.h>
-#include <linux/filter.h>
-
-struct sk_buff test_skbuff;
-struct sk_filter test_filter;
-
-int
-sk_filter_test(void)
-{
- struct sk_buff *skb = &test_skbuff;
- struct sk_filter *filter = &test_filter;
-
- return sk_filter(skb, filter);
-}
-#else
-#error "This test intentionally fails on 2.4.22 or newer kernels."
-#endif
# define compat_sock_owned_by_user(sk) sock_owned_by_user(sk)
#endif
-/*
- * Up until 2.4.21 for the 2.4 series and 2.5.60 for the 2.5 series,
- * sk_filter() calls were protected with CONFIG_FILTER. Wrapping our compat
- * definition in a similar check allows us to build on those kernels.
- *
- */
-#ifdef CONFIG_FILTER
-/*
- * Unfortunately backports for certain kernels require the use of an autoconf
- * program to check the interface for sk_filter().
- */
-# ifndef VMW_HAVE_NEW_SKFILTER
-/*
- * Up until 2.4.21 for the 2.4 series and 2.5.60 for the 2.5 series,
- * callers to sk->filter were responsible for ensuring that the filter
- * was not NULL.
- * Additionally, the new version of sk_filter returns 0 or -EPERM on error
- * while the old function returned 0 or 1. Return -EPERM here as well to
- * be consistent.
- */
-# define compat_sk_filter(sk, skb, needlock) \
- ({ \
- int rc = 0; \
- \
- if ((sk)->filter) { \
- rc = sk_filter(skb, (sk)->filter); \
- if (rc) { \
- rc = -EPERM; \
- } \
- } \
- \
- rc; \
- })
-# else
-# define compat_sk_filter(sk, skb, needlock) sk_filter(sk, skb, needlock)
-# endif
-#else
-# define compat_sk_filter(sk, skb, needlock) 0
-#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
+
+#ifndef CONFIG_FILTER
+# define sk_filter(sk, skb, needlock) 0
+#endif
+
/* Taken from 2.6.16's sock.h and modified for macro. */
# define compat_sk_receive_skb(sk, skb, nested) \
({ \
int rc = NET_RX_SUCCESS; \
\
- if (compat_sk_filter(sk, skb, 0)) { \
+ if (sk_filter(sk, skb, 0)) { \
kfree_skb(skb); \
- sock_put(sk); \
} else { \
skb->dev = NULL; \
bh_lock_sock(sk); \
sk_add_backlog(sk, skb); \
} \
bh_unlock_sock(sk); \
- sock_put(sk); \
} \
\
+ sock_put(sk); \
rc; \
})
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/setnice.c, -DVMW_HAVE_SET_USER_NICE, )
EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/netcreate_num_params.c, -DVMW_NETCREATE_KERNARG, )
-# This test is inverted.
-EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/sk_filter.c,, -DVMW_HAVE_NEW_SKFILTER )
-
MODPOST_VMCI_SYMVERS := $(wildcard $(MODULEBUILDDIR)/VMwareVMCIModule.symvers)