|
LQ Newbie
Registered: Feb 2007
Posts: 6
Rep:
|
patch
I collected all the patch tidbits I found by googling for "cisco vpnclient CHECKSUM_HW" and other similar strings referring to error messages in my build output. I pulled them together, and wrote this patch, which compiled and ran for me on kernel 2.6.20.
Apply and build:
tar -xvzf vpnclient-linux-x86_64-4.8.00.0490-k9.tar.gz
patch -p0 vpnclient-linux-x86_64-4.8.00.0490-k9.patch
cd vpnclient
./vpn_install
Contents of vpnclient-linux-x86_64-4.8.00.0490-k9.patch :
--- vpnclient/IPSecDrvOS_linux.c 2005-11-22 03:43:57.000000000 -0600
+++ vpnclient.new/IPSecDrvOS_linux.c 2007-04-23 17:12:58.000000000 -0500
@@ -11,8 +11,17 @@
*
*
***************************************************************************/
-#include <linux/config.h>
#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
+#include <linux/utsrelease.h>
+#endif
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include <linux/vmalloc.h>
#include <linux/sched.h>
#include <linux/string.h>
diff -Naur vpnclient/frag.c vpnclient.new/frag.c
--- vpnclient/frag.c 2005-11-22 03:43:57.000000000 -0600
+++ vpnclient.new/frag.c 2007-04-23 17:13:22.000000000 -0500
@@ -1,5 +1,14 @@
-#include <linux/config.h>
#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
+#include <linux/utsrelease.h>
+#endif
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
diff -Naur vpnclient/interceptor.c vpnclient.new/interceptor.c
--- vpnclient/interceptor.c 2005-11-22 03:43:57.000000000 -0600
+++ vpnclient.new/interceptor.c 2007-04-23 18:24:33.000000000 -0500
@@ -8,8 +8,17 @@
***************************************************************************
* This module implements the linux driver.
***************************************************************************/
-#include <linux/config.h>
#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
+#include <linux/utsrelease.h>
+#endif
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
@@ -33,6 +42,14 @@
#include "mtu.h"
#include "unixkernelapi.h"
+// With linux 2.6.19, they renamed CHECKSUM_HW to CHECKSUM_COMPLETE
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+ #define CHECKSUM_HW CHECKSUM_COMPLETE
+ #define SKB_CHECKSUM_HELP(a,b) skb_checksum_help((a))
+#else
+ #define SKB_CHECKSUM_HELP(a,b) skb_checksum_help((a),(b))
+#endif
+
static uint8_t interceptor_eth_addr[] = { 0x00, 0x0b, 0xfc, 0xf8, 0x01, 0x8f };
// packet statistics
@@ -61,7 +78,12 @@
/*packet handler functions*/
static int recv_ip_packet_handler(struct sk_buff *skb,
struct net_device *dev,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
struct packet_type *type);
+#else
+ struct packet_type *type,
+ struct net_device *tbd);
+#endif
static int replacement_dev_xmit(struct sk_buff *skb, struct net_device *dev);
static int handle_netdev_event(struct notifier_block *self, unsigned long,
@@ -71,7 +93,11 @@
{
struct packet_type *pt;
int (*orig_handler_func) (struct sk_buff *, struct net_device *,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
struct packet_type *);
+#else
+ struct packet_type *, struct net_device *);
+#endif
};
static struct packet_type_funcs original_ip_handler;
@@ -494,7 +520,12 @@
static int
recv_ip_packet_handler(struct sk_buff *skb,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
struct net_device *dev, struct packet_type *type)
+#else
+ struct net_device *dev, struct packet_type *type,
+ struct net_device *tbd)
+#endif
{
int rc2 = 0;
int tmp_rc = 0;
@@ -513,14 +544,22 @@
#endif
if (dev->type == ARPHRD_LOOPBACK)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
rc2 = original_ip_handler.orig_handler_func(skb, dev, type);
+#else
+ rc2 = original_ip_handler.orig_handler_func(skb, dev, type, 0);
+#endif
goto exit_gracefully;
}
/* Don't handle non-eth non-ppp packets */
if (!supported_device(dev))
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
rc2 = original_ip_handler.orig_handler_func(skb, dev, type);
+#else
+ rc2 = original_ip_handler.orig_handler_func(skb, dev, type, 0);
+#endif
goto exit_gracefully;
}
@@ -539,14 +578,22 @@
firsttime = 0;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
rc2 = original_ip_handler.orig_handler_func(skb, dev, type);
+#else
+ rc2 = original_ip_handler.orig_handler_func(skb, dev, type, 0);
+#endif
goto exit_gracefully;
}
//only need to handle IP packets.
if (skb->protocol != htons(ETH_P_IP))
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
rc2 = original_ip_handler.orig_handler_func(skb, dev, type);
+#else
+ rc2 = original_ip_handler.orig_handler_func(skb, dev, type, 0);
+#endif
goto exit_gracefully;
}
@@ -554,9 +601,9 @@
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
- if (skb_checksum_help(skb,1))
+ if (SKB_CHECKSUM_HELP(skb,1))
#else
- if (skb_checksum_help(&skb,1))
+ if (SKB_CHECKSUM_HELP(&skb,1))
#endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
{
dev_kfree_skb(skb);
@@ -626,7 +673,11 @@
tmp_rc = CNICallbackTable.ReceiveComplete(pBinding,
lpReceiveContext, NewPacket);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
rc2 = original_ip_handler.orig_handler_func(skb, dev, type);
+#else
+ rc2 = original_ip_handler.orig_handler_func(skb, dev, type, 0);
+#endif
if (pBinding->recv_stat.called)
{
@@ -680,11 +731,11 @@
if (skb->ip_summed == CHECKSUM_HW)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
- if (skb_checksum_help(skb,0))
+ if (SKB_CHECKSUM_HELP(skb,0))
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
- if (skb_checksum_help(&skb,0))
+ if (SKB_CHECKSUM_HELP(&skb,0))
#else
- if ((skb = skb_checksum_help(skb)) == NULL)
+ if ((skb = SKB_CHECKSUM_HELP(skb)) == NULL)
#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
{
goto exit_gracefully;
diff -Naur vpnclient/linuxcniapi.c vpnclient.new/linuxcniapi.c
--- vpnclient/linuxcniapi.c 2005-11-22 03:43:57.000000000 -0600
+++ vpnclient.new/linuxcniapi.c 2007-04-23 18:25:22.000000000 -0500
@@ -9,8 +9,17 @@
* This module implements a translation layer between the CNI API and the
* Linux Interceptor driver.
***************************************************************************/
-#include <linux/config.h>
#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
+#include <linux/utsrelease.h>
+#endif
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include <linux/netdevice.h>
#include <linux/if.h>
#include <linux/if_arp.h>
@@ -342,7 +351,11 @@
rx_bytes+=skb->len;
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
pBinding->recv_stat.rc = pBinding->InjectReceive(skb, skb->dev, pBinding->pPT);
+#else
+ pBinding->recv_stat.rc = pBinding->InjectReceive(skb, skb->dev, pBinding->pPT, 0);
+#endif
exit_gracefully:
CNICallbackTable.ReceiveComplete(Binding, ReceiveContext, Packet);
diff -Naur vpnclient/linuxcniapi.h vpnclient.new/linuxcniapi.h
--- vpnclient/linuxcniapi.h 2005-11-22 03:43:57.000000000 -0600
+++ vpnclient.new/linuxcniapi.h 2007-04-23 18:26:24.000000000 -0500
@@ -23,7 +23,11 @@
struct net_device *pDevice;
struct packet_type *pPT;
int (*InjectReceive) (struct sk_buff *, struct net_device *,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
struct packet_type *);
+#else
+ struct packet_type *, struct net_device *);
+#endif
int (*InjectSend) (struct sk_buff * skb, struct net_device * dev);
int recv_real_hh_len;
|