linamh/net-misc/cisco-vpnclient-3des/files/4.8.01.0640-2.6.24.patch
geos_one 05ad5cc496 add samba client
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@1718 6952d904-891a-0410-993b-d76249ca496b
2009-12-21 18:36:54 +00:00

242 lines
7.2 KiB
Diff

diff -r 469eaa76099e GenDefs.h
--- a/GenDefs.h Mon Apr 28 10:40:53 2008 +0200
+++ b/GenDefs.h Mon Apr 28 10:47:51 2008 +0200
@@ -105,6 +105,12 @@ typedef int32 intptr_t;
#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
@@ -113,6 +119,7 @@ typedef uint32 uintptr_t;
typedef uint32 uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
+#endif
#endif
diff -r 469eaa76099e Makefile
--- a/Makefile Mon Apr 28 10:40:53 2008 +0200
+++ b/Makefile Mon Apr 28 10:47:51 2008 +0200
@@ -12,7 +12,7 @@ SOURCE_OBJS := linuxcniapi.o frag.o IPSe
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 -r 469eaa76099e interceptor.c
--- a/interceptor.c Mon Apr 28 10:40:53 2008 +0200
+++ b/interceptor.c Mon Apr 28 10:47:51 2008 +0200
@@ -28,6 +28,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"
@@ -39,7 +43,7 @@
static uint8_t interceptor_eth_addr[] = { 0x00, 0x0b, 0xfc, 0xf8, 0x01, 0x8f };
-// packet statistics
+// packet statistics
static unsigned long tx_packets;
static unsigned long tx_dropped;
static unsigned long tx_bytes;
@@ -48,7 +52,13 @@ unsigned long rx_bytes;
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);
@@ -82,12 +92,12 @@ struct packet_type_funcs
{
struct packet_type *pt;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
- int (*orig_handler_func) (struct sk_buff *,
+ int (*orig_handler_func) (struct sk_buff *,
struct net_device *,
struct packet_type *,
struct net_device *);
#else
- int (*orig_handler_func) (struct sk_buff *,
+ int (*orig_handler_func) (struct sk_buff *,
struct net_device *,
struct packet_type *);
#endif
@@ -107,16 +117,30 @@ static char interceptor_name[] = LINUX_V
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 int
+static
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+void
+#else
+int
+#endif
#else
static int __init
#endif
@@ -133,8 +157,9 @@ interceptor_init(struct net_device *dev)
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 *
@@ -270,7 +295,7 @@ add_netdev(struct net_device *dev)
Bindings[i].InjectReceive = original_ip_handler.orig_handler_func;
Bindings[i].pPT = original_ip_handler.pt;
- rc = 0;
+ rc = 0;
exit_gracefully:
return rc;
@@ -284,7 +309,7 @@ remove_netdev(struct net_device *dev)
b = getbindingbydev(dev);
if (b)
- {
+ {
rc = 0;
dev->hard_start_xmit = b->InjectSend;
kernel_memset(b, 0, sizeof(BINDING));
@@ -326,7 +351,7 @@ handle_vpnup(void)
}
/* find the handler for inbound IP packets by adding a dummy handler
* for that packet type into the kernel. Because the packet handlers
- * are stored in a hash table, we'll be able to pull the original
+ * are stored in a hash table, we'll be able to pull the original
* ip packet handler out of the list that dummy_pt was inserted into.*/
kernel_memset(&dummy_pt, 0, sizeof(dummy_pt));
dummy_pt.type = htons(ETH_P_IP);
@@ -363,7 +388,11 @@ handle_vpnup(void)
dp = NULL;
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
@@ -494,7 +523,7 @@ getbindingbydev(struct net_device *dev)
getbindingbydev(struct net_device *dev)
{
int i;
-
+
for (i=0; i <= MAX_INTERFACES; i++)
{
BINDING *b = &Bindings[i];
@@ -522,13 +551,13 @@ build_ppp_fake_mac_frag(struct ethhdr *d
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
static int
recv_ip_packet_handler(struct sk_buff *skb,
- struct net_device *dev,
+ struct net_device *dev,
struct packet_type *type,
struct net_device *orig_dev)
#else
static int
recv_ip_packet_handler(struct sk_buff *skb,
- struct net_device *dev,
+ struct net_device *dev,
struct packet_type *type)
#endif
{
@@ -932,15 +961,29 @@ interceptor_mod_init(void)
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();
}
@@ -960,7 +1003,11 @@ interceptor_mod_cleanup(void)
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;