05ad5cc496
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@1718 6952d904-891a-0410-993b-d76249ca496b
168 lines
4.5 KiB
Diff
168 lines
4.5 KiB
Diff
diff -Nur vpnclient/GenDefs.h vpnclient.new/GenDefs.h
|
|
--- vpnclient/GenDefs.h 2005-11-22 04:43:57.000000000 -0500
|
|
+++ vpnclient.new/GenDefs.h 2008-02-03 22:37:16.000000000 -0500
|
|
@@ -105,6 +105,12 @@
|
|
#define _INTPTR_T_DEFINED
|
|
#endif
|
|
|
|
+/* uintptr_t has been defined in include/linux/types.h in 2.6.24.
|
|
+ * No need to define it here again (will only lead to compile errors)
|
|
+ *
|
|
+ * by Alexander Griesser <work@tuxx-home.at>, 2008-01-11
|
|
+ */
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
|
|
#ifndef _UINTPTR_T_DEFINED
|
|
#if defined(_LP64)
|
|
#warning 64 bit
|
|
@@ -114,6 +120,7 @@
|
|
#endif
|
|
#define _UINTPTR_T_DEFINED
|
|
#endif
|
|
+#endif
|
|
|
|
|
|
typedef int BOOL;
|
|
diff -Nur vpnclient/Makefile vpnclient.new/Makefile
|
|
--- vpnclient/Makefile 2005-11-22 04:43:57.000000000 -0500
|
|
+++ vpnclient.new/Makefile 2008-02-03 22:40:31.000000000 -0500
|
|
@@ -12,7 +12,7 @@
|
|
SOURCE_OBJS := linuxcniapi.o frag.o IPSecDrvOS_linux.o interceptor.o linuxkernelapi.o
|
|
|
|
ifeq ($(SUBARCH),x86_64)
|
|
-CFLAGS += -mcmodel=kernel -mno-red-zone
|
|
+EXTRA_CFLAGS += -mcmodel=kernel -mno-red-zone
|
|
NO_SOURCE_OBJS := libdriver64.so
|
|
else
|
|
NO_SOURCE_OBJS := libdriver.so
|
|
diff -Nur vpnclient/interceptor.c vpnclient.new/interceptor.c
|
|
--- vpnclient/interceptor.c 2008-02-03 22:39:23.000000000 -0500
|
|
+++ vpnclient.new/interceptor.c 2008-02-03 22:37:16.000000000 -0500
|
|
@@ -27,6 +27,10 @@
|
|
#include <linux/udp.h>
|
|
#include <net/protocol.h>
|
|
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+#include <net/net_namespace.h>
|
|
+#endif
|
|
+
|
|
#include "linux_os.h"
|
|
|
|
#include "vpn_ioctl_linux.h"
|
|
@@ -47,7 +51,13 @@
|
|
unsigned long rx_bytes;
|
|
|
|
/*methods of the cipsec network device*/
|
|
-static int interceptor_init(struct net_device *);
|
|
+static
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+void
|
|
+#else
|
|
+int
|
|
+#endif
|
|
+interceptor_init(struct net_device *);
|
|
static struct net_device_stats *interceptor_stats(struct net_device *dev);
|
|
static int interceptor_ioctl(struct net_device *dev, struct ifreq *ifr,
|
|
int cmd);
|
|
@@ -91,15 +101,33 @@
|
|
|
|
BINDING Bindings[MAX_INTERFACES];
|
|
|
|
+/* 2.6.24 handles net_devices a little bit different
|
|
+ *
|
|
+ * by Alexander Griesser <work@tuxx-home.at>, 2008-01-11
|
|
+ */
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+static struct net_device* interceptor_dev;
|
|
+#else
|
|
static struct net_device interceptor_dev = {
|
|
.name = interceptor_name,
|
|
.init = interceptor_init
|
|
};
|
|
+#endif
|
|
+
|
|
static struct notifier_block interceptor_notifier = {
|
|
.notifier_call = handle_netdev_event,
|
|
};
|
|
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
|
+static
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+void
|
|
+#else
|
|
+int
|
|
+#endif
|
|
+#else
|
|
static int __init
|
|
+#endif
|
|
interceptor_init(struct net_device *dev)
|
|
{
|
|
ether_setup(dev);
|
|
@@ -113,8 +141,9 @@
|
|
dev->flags |= IFF_NOARP;
|
|
dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST);
|
|
kernel_memset(dev->broadcast, 0xFF, ETH_ALEN);
|
|
-
|
|
- return 0;
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
|
|
+ return 0;
|
|
+#endif
|
|
}
|
|
|
|
static struct net_device_stats *
|
|
@@ -344,7 +373,11 @@
|
|
num_target_devices = 0;
|
|
|
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
|
- for_each_netdev(dp)
|
|
+ for_each_netdev(
|
|
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ &init_net,
|
|
+ #endif
|
|
+ dp)
|
|
#else
|
|
for (dp = dev_base; dp != NULL; dp = dp->next)
|
|
#endif
|
|
@@ -843,15 +876,29 @@
|
|
|
|
rc = CniPluginLoad(&pcDeviceName, &PCNICallbackTable);
|
|
|
|
+/* 2.6.24 needs to allocate each netdevice before registering it, otherwise
|
|
+ * the kernel BUG()s.
|
|
+ *
|
|
+ * by Alexander Griesser <work@tuxx-home.at>, 2008-01-11
|
|
+ */
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ if(! (interceptor_dev = alloc_netdev(sizeof(struct net_device), interceptor_name, interceptor_init)))
|
|
+ return 0;
|
|
+#endif
|
|
+
|
|
if (CNI_IS_SUCCESS(rc))
|
|
{
|
|
|
|
CNICallbackTable = *PCNICallbackTable;
|
|
CniPluginDeviceCreated();
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ if ((status = register_netdev(interceptor_dev)) != 0)
|
|
+#else
|
|
if ((status = register_netdev(&interceptor_dev)) != 0)
|
|
+#endif
|
|
{
|
|
printk(KERN_INFO "%s: error %d registering device \"%s\".\n",
|
|
- LINUX_VPN_IFNAME, status, interceptor_dev.name);
|
|
+ LINUX_VPN_IFNAME, status, interceptor_name);
|
|
CniPluginUnload();
|
|
|
|
}
|
|
@@ -871,7 +918,11 @@
|
|
cleanup_frag_queue();
|
|
CniPluginUnload();
|
|
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ unregister_netdev(interceptor_dev);
|
|
+#else
|
|
unregister_netdev(&interceptor_dev);
|
|
+#endif
|
|
unregister_netdevice_notifier(&interceptor_notifier);
|
|
|
|
return;
|