]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
VSOCK: remove compat_sk_filter
authorVMware, Inc <>
Thu, 17 Jun 2010 22:18:39 +0000 (15:18 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 17 Jun 2010 22:18:39 +0000 (15:18 -0700)
Filter interface has stabilized in the kernels that we do
support so we can clean up our code a bit.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/modules/linux/shared/autoconf/sk_filter.c [deleted file]
open-vm-tools/modules/linux/shared/compat_sock.h
open-vm-tools/modules/linux/vsock/Makefile.kernel

diff --git a/open-vm-tools/modules/linux/shared/autoconf/sk_filter.c b/open-vm-tools/modules/linux/shared/autoconf/sk_filter.c
deleted file mode 100644 (file)
index f8bb288..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*********************************************************
- * 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
index 00ea8cf6029118f0392876c017aae32eac960788..581e61e8ae512f95d01b805a741305adacc00a95 100644 (file)
@@ -113,55 +113,20 @@ static inline wait_queue_head_t *sk_sleep(struct sock *sk)
 # 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);                               \
@@ -171,9 +136,9 @@ static inline wait_queue_head_t *sk_sleep(struct 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)
index 9776c55eec7b7d08bb2404bcc192535935c72fdd..1534cf08ddca68969183f17e034a8ed005e1e18f 100644 (file)
@@ -30,9 +30,6 @@ EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/epoll.c,   -DVMW_HAVE_EPO
 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)