Skip to content

Instantly share code, notes, and snippets.

@qwertos
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qwertos/d26f94a4d4068c96fe01 to your computer and use it in GitHub Desktop.
Save qwertos/d26f94a4d4068c96fe01 to your computer and use it in GitHub Desktop.
--- vmnet-only/filter.c 2014-12-04 04:41:04.784301973 -0500
+++ vmnet-only/filter.c 2014-12-04 04:45:13.628290878 -0500
@@ -27,6 +27,7 @@
#include "compat_module.h"
#include <linux/mutex.h>
#include <linux/netdevice.h>
+#include <linux/version.h>
#if COMPAT_LINUX_VERSION_CHECK_LT(3, 2, 0)
# include <linux/module.h>
#else
@@ -203,7 +204,11 @@
#endif
static unsigned int
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
VNetFilterHookFn(unsigned int hooknum, // IN:
+#else
+VNetFilterHookFn(const struct nf_hook_ops *ops, // IN:
+#endif
#ifdef VMW_NFHOOK_USES_SKB
struct sk_buff *skb, // IN:
#else
@@ -252,7 +257,12 @@
/* When the host transmits, hooknum is VMW_NF_INET_POST_ROUTING. */
/* When the host receives, hooknum is VMW_NF_INET_LOCAL_IN. */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
transmit = (hooknum == VMW_NF_INET_POST_ROUTING);
+#else
+ transmit = (ops->hooknum == VMW_NF_INET_POST_ROUTING);
+#endif
packetHeader = compat_skb_network_header(skb);
ip = (struct iphdr*)packetHeader;
@qwertos
Copy link
Author

qwertos commented Dec 4, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment