SOURCES: cisco-vpnclient-2.6.24.patch (NEW), cisco-vpnclient-skbuf...
blekot
blekot at pld-linux.org
Wed Mar 5 12:46:37 CET 2008
Author: blekot Date: Wed Mar 5 11:46:36 2008 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- new, fixes build on 2.6.24
---- Files affected:
SOURCES:
cisco-vpnclient-2.6.24.patch (NONE -> 1.1) (NEW), cisco-vpnclient-skbuff_offset.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/cisco-vpnclient-2.6.24.patch
diff -u /dev/null SOURCES/cisco-vpnclient-2.6.24.patch:1.1
--- /dev/null Wed Mar 5 12:46:37 2008
+++ SOURCES/cisco-vpnclient-2.6.24.patch Wed Mar 5 12:46:31 2008
@@ -0,0 +1,144 @@
+diff -Nur vpnclient/GenDefs.h vpnclient.new/GenDefs.h
+--- vpnclient/GenDefs.h 2007-08-22 21:30:31.000000000 +0200
++++ vpnclient.new/GenDefs.h 2008-01-25 08:56:46.000000000 +0100
+@@ -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 at 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/interceptor.c vpnclient.new/interceptor.c
+--- vpnclient/interceptor.c 2007-08-22 21:30:31.000000000 +0200
++++ vpnclient.new/interceptor.c 2008-01-25 09:50:52.000000000 +0100
+@@ -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"
+@@ -48,7 +52,7 @@
+ unsigned long rx_bytes;
+
+ /*methods of the cipsec network device*/
+-static int interceptor_init(struct net_device *);
++static void 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);
+@@ -107,18 +111,27 @@
+
+ BINDING Bindings[MAX_INTERFACES];
+
++/* 2.6.24 handles net_devices a little bit different
++ *
++ * by Alexander Griesser <work at 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 void
+ #else
+-static int __init
++static void __init
+ #endif
+ interceptor_init(struct net_device *dev)
+ {
+@@ -133,8 +146,6 @@
+ dev->flags |= IFF_NOARP;
+ dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST);
+ kernel_memset(dev->broadcast, 0xFF, ETH_ALEN);
+-
+- return 0;
+ }
+
+ static struct net_device_stats *
+@@ -362,8 +373,13 @@
+
+ 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
+@@ -919,15 +935,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 at 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();
+
+ }
+@@ -947,7 +977,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;
================================================================
Index: SOURCES/cisco-vpnclient-skbuff_offset.patch
diff -u /dev/null SOURCES/cisco-vpnclient-skbuff_offset.patch:1.1
--- /dev/null Wed Mar 5 12:46:37 2008
+++ SOURCES/cisco-vpnclient-skbuff_offset.patch Wed Mar 5 12:46:31 2008
@@ -0,0 +1,132 @@
+diff -ur vpnclient.old/frag.c vpnclient.new/frag.c
+--- vpnclient.old/frag.c 2007-08-22 15:30:31.000000000 -0400
++++ vpnclient/frag.c 2007-11-09 09:19:48.000000000 -0500
+@@ -22,7 +22,11 @@
+ #include "frag.h"
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++#ifdef NET_SKBUFF_DATA_USES_OFFSET
++#define SKB_IPHDR(skb) ((struct iphdr*)(skb->head+skb->network_header))
++#else
+ #define SKB_IPHDR(skb) ((struct iphdr*)skb->network_header)
++#endif
+ #else
+ #define SKB_IPHDR(skb) skb->nh.iph
+ #endif
+diff -ur vpnclient.old/interceptor.c vpnclient.new/interceptor.c
+--- vpnclient.old/interceptor.c 2007-08-22 15:30:31.000000000 -0400
++++ vpnclient/interceptor.c 2007-11-09 10:03:01.000000000 -0500
+@@ -630,19 +630,31 @@
+
+ reset_inject_status(&pBinding->recv_stat);
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++#ifdef NET_SKBUFF_DATA_USES_OFFSET
++ if (skb->mac_header >= (skb->data-skb->head))
++#else
+ if (skb->mac_header)
++#endif
+ #else
+ if (skb->mac.raw)
+ #endif
+ {
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++#ifdef NET_SKBUFF_DATA_USES_OFFSET
++ hard_header_len = skb->mac_header - (skb->data - skb->head);
++#else
+ hard_header_len = skb->data - skb->mac_header;
++#endif
+ #else
+ hard_header_len = skb->data - skb->mac.raw;
+ #endif
+ if ((hard_header_len < 0) || (hard_header_len > skb_headroom(skb)))
+ {
+- printk(KERN_DEBUG "bad hh len %d\n", hard_header_len);
++ printk(KERN_DEBUG "bad hh len %d, mac: %d, data: %p, head: %p\n",
++ hard_header_len,
++ skb->mac_header,
++ skb->data,
++ skb->head);
+ hard_header_len = 0;
+ }
+ }
+@@ -657,7 +669,11 @@
+ {
+ case ETH_HLEN:
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++#ifdef NET_SKBUFF_DATA_USES_OFFSET
++ CniNewFragment(ETH_HLEN, skb->head+skb->mac_header, &MacHdr, CNI_USE_BUFFER);
++#else
+ CniNewFragment(ETH_HLEN, skb->mac_header, &MacHdr, CNI_USE_BUFFER);
++#endif
+ #else
+ CniNewFragment(ETH_HLEN, skb->mac.raw, &MacHdr, CNI_USE_BUFFER);
+ #endif
+@@ -775,7 +791,11 @@
+ #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+ reset_inject_status(&pBinding->send_stat);
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++#ifdef NET_SKBUFF_DATA_USES_OFFSET
++ hard_header_len = skb->network_header - (skb->data - skb->head);
++#else
+ hard_header_len = skb->network_header - skb->data;
++#endif
+ #else
+ hard_header_len = skb->nh.raw - skb->data;
+ #endif
+diff -ur vpnclient.old/linuxcniapi.c vpnclient.new/linuxcniapi.c
+--- vpnclient.old/linuxcniapi.c 2007-08-22 15:30:31.000000000 -0400
++++ vpnclient/linuxcniapi.c 2007-11-09 09:17:50.000000000 -0500
+@@ -338,8 +338,13 @@
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++#ifdef NET_SKBUFF_DATA_USES_OFFSET
++ skb->network_header = skb->data - skb->head;
++ skb->mac_header = pMac - skb->head;
++#else
+ skb->network_header = (sk_buff_data_t) skb->data;
+ skb->mac_header = (sk_buff_data_t)pMac;
++#endif
+ #else
+ skb->nh.iph = (struct iphdr *) skb->data;
+ skb->mac.raw = pMac;
+@@ -478,8 +483,13 @@
+ skb->dev = pBinding->pDevice;
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++#ifdef NET_SKBUFF_DATA_USES_OFFSET
++ skb->network_header = skb->data - skb->head;
++ skb->mac_header = pMac - skb->head;
++#else
+ skb->mac_header = (sk_buff_data_t)pMac;
+ skb->network_header = (sk_buff_data_t)pIP;
++#endif
+ #else
+ skb->mac.raw = pMac;
+ skb->nh.raw = pIP;
+@@ -487,8 +497,13 @@
+
+ /*ip header length is in 32bit words */
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++#ifdef NET_SKBUFF_DATA_USES_OFFSET
++ skb->transport_header =
++ (pIP + (((struct iphdr*)(skb->head+skb->network_header))->ihl * 4)) - skb->head;
++#else
+ skb->transport_header = (sk_buff_data_t)
+ (pIP + (((struct iphdr*)(skb->network_header))->ihl * 4));
++#endif
+ #else
+ skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
+ #endif
+diff -ur vpnclient.old/linuxkernelapi.c vpnclient.new/linuxkernelapi.c
+--- vpnclient.old/linuxkernelapi.c 2007-08-22 15:30:31.000000000 -0400
++++ vpnclient/linuxkernelapi.c 2007-11-09 09:23:21.000000000 -0500
+@@ -9,7 +9,7 @@
+ void*rc = kmalloc(size, GFP_ATOMIC);
+ if(NULL == rc)
+ {
+- printk("<1> os_malloc size %d failed\n",size);
++ printk("<1> os_malloc size %ld failed\n",size);
+ }
+
+ return rc;
================================================================
More information about the pld-cvs-commit
mailing list