add samba client
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@1718 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
383
net-misc/cisco-vpnclient-3des/files/2.6.22.patch
Normal file
383
net-misc/cisco-vpnclient-3des/files/2.6.22.patch
Normal file
@@ -0,0 +1,383 @@
|
||||
diff -Nur vpnclient.orig/frag.c vpnclient/frag.c
|
||||
--- vpnclient.orig/frag.c 2005-11-22 10:52:00.000000000 +0100
|
||||
+++ vpnclient/frag.c 2007-05-29 16:03:42.000000000 +0200
|
||||
@@ -1,4 +1,18 @@
|
||||
-#include <linux/config.h>
|
||||
+/**************************************************************************
|
||||
+ * Copyright (c) 2001, Cisco Systems, All Rights Reserved
|
||||
+ ***************************************************************************
|
||||
+ *
|
||||
+ * File: frag.c
|
||||
+ * Date: 22/03/01
|
||||
+ *
|
||||
+ * Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
|
||||
+ * Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
|
||||
+ *
|
||||
+ ***************************************************************************
|
||||
+ * This module does some really cool stuff only Cisco knows about
|
||||
+ ***************************************************************************/
|
||||
+
|
||||
+#include <linux/autoconf.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
@@ -37,9 +51,10 @@
|
||||
int ret=FALSE;
|
||||
struct frag_queue_entry *cur=NULL,*n=NULL,*prev=NULL;
|
||||
|
||||
- id = ntohs(skb->nh.iph->id);
|
||||
+ id = ntohs(CISCOVPN_SKB_NH_ID(skb));
|
||||
+
|
||||
/* look for an entry with the same id as this packet*/
|
||||
- if (frag_queue_head && id != ntohs(frag_queue_head->skb->nh.iph->id))
|
||||
+ if (frag_queue_head && id != ntohs(CISCOVPN_SKB_NH_ID(frag_queue_head->skb)))
|
||||
{
|
||||
printk(KERN_INFO "%s: incomplete fragment set destroyed",__FUNCTION__);
|
||||
cleanup_frag_queue();
|
||||
@@ -57,10 +72,13 @@
|
||||
cur = frag_queue_head;
|
||||
|
||||
prev = NULL;
|
||||
- skb_offset = ntohs(skb->nh.iph->frag_off) & IP_OFFSET;
|
||||
+
|
||||
+ skb_offset = ntohs(CISCOVPN_SKB_NH_FRAGOFF(skb)) & IP_OFFSET;
|
||||
+
|
||||
while (cur)
|
||||
{
|
||||
- cur_offset = ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET;
|
||||
+ cur_offset = ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET;
|
||||
+
|
||||
/*sanity check*/
|
||||
if (cur_offset < prev_offset)
|
||||
{
|
||||
@@ -112,8 +130,9 @@
|
||||
goto done_with_tests;
|
||||
}
|
||||
cur = frag_queue_head;
|
||||
+
|
||||
/*first in queue must be first frag.*/
|
||||
- if ((ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET) != 0)
|
||||
+ if ((ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET) != 0)
|
||||
{
|
||||
goto done_with_tests;
|
||||
}
|
||||
@@ -121,19 +140,22 @@
|
||||
by comparing adjacent offset values and packet lengths*/
|
||||
while (cur)
|
||||
{
|
||||
- cur_offset = (ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET)*8;
|
||||
- if (cur_offset != prev_end_offset)
|
||||
+ cur_offset = (ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET)*8;
|
||||
+
|
||||
+ if (cur_offset != prev_end_offset)
|
||||
{
|
||||
goto done_with_tests;
|
||||
}
|
||||
prev = cur;
|
||||
prev_offset = cur_offset;
|
||||
- prev_end_offset = prev_offset + ntohs(prev->skb->nh.iph->tot_len)
|
||||
- - (prev->skb->nh.iph->ihl*4);
|
||||
+
|
||||
+ prev_end_offset = prev_offset + ntohs(CISCOVPN_SKB_NH_TOTLEN(prev->skb))
|
||||
+ - (CISCOVPN_SKB_NH_IHL(prev->skb)*4);
|
||||
cur = cur->next;
|
||||
}
|
||||
/*last in queue must not have more frags set*/
|
||||
- if (ntohs(prev->skb->nh.iph->frag_off) & IP_MF)
|
||||
+
|
||||
+ if (ntohs(CISCOVPN_SKB_NH_FRAGOFF(prev->skb)) & IP_MF)
|
||||
{
|
||||
goto done_with_tests;
|
||||
}
|
||||
@@ -185,10 +207,12 @@
|
||||
/*not an IP packet*/
|
||||
goto done_with_tests;
|
||||
}
|
||||
- iph = skb->nh.iph;
|
||||
+
|
||||
+ iph = CISCOVPN_SKB_IPHEADER(skb);
|
||||
+
|
||||
if (!iph)
|
||||
{
|
||||
- printk(KERN_DEBUG "%s: skb->nh is NULL.", __FUNCTION__);
|
||||
+ printk(KERN_DEBUG "%s: iph (IP Header) is NULL.", __FUNCTION__);
|
||||
goto done_with_tests;
|
||||
}
|
||||
offset = ntohs(iph->frag_off);
|
||||
diff -Nur vpnclient.orig/interceptor.c vpnclient/interceptor.c
|
||||
--- vpnclient.orig/interceptor.c 2005-11-22 10:52:00.000000000 +0100
|
||||
+++ vpnclient/interceptor.c 2007-05-29 16:08:57.000000000 +0200
|
||||
@@ -5,10 +5,13 @@
|
||||
* File: interceptor.c
|
||||
* Date: 04/10/2001
|
||||
*
|
||||
+* Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
|
||||
+* Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
|
||||
+*
|
||||
***************************************************************************
|
||||
* This module implements the linux driver.
|
||||
***************************************************************************/
|
||||
-#include <linux/config.h>
|
||||
+#include <linux/autoconf.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
@@ -339,13 +342,18 @@
|
||||
|
||||
dp = NULL;
|
||||
num_target_devices = 0;
|
||||
- for (dp = dev_base; dp != NULL; dp = dp->next)
|
||||
- {
|
||||
+
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
+ for_each_netdev(dp)
|
||||
+ #else
|
||||
+ for (dp = dev_base; dp != NULL; dp = dp->next)
|
||||
+ #endif
|
||||
+ {
|
||||
if (add_netdev(dp) == 0)
|
||||
{
|
||||
num_target_devices++;
|
||||
}
|
||||
- }
|
||||
+ }
|
||||
|
||||
if (num_target_devices == 0)
|
||||
{
|
||||
@@ -550,13 +558,13 @@
|
||||
goto exit_gracefully;
|
||||
}
|
||||
|
||||
- if (skb->ip_summed == CHECKSUM_HW)
|
||||
+ if (CHECK_IP_SUMMED(skb->ip_summed))
|
||||
{
|
||||
#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);
|
||||
@@ -569,9 +577,10 @@
|
||||
}
|
||||
|
||||
reset_inject_status(&pBinding->recv_stat);
|
||||
- if (skb->mac.raw)
|
||||
+
|
||||
+ if (CISCOVPN_SKB_MACHEADER(skb))
|
||||
{
|
||||
- hard_header_len = skb->data - skb->mac.raw;
|
||||
+ hard_header_len = skb->data - CISCOVPN_SKB_MACHEADER(skb);
|
||||
if ((hard_header_len < 0) || (hard_header_len > skb_headroom(skb)))
|
||||
{
|
||||
printk(KERN_DEBUG "bad hh len %d\n", hard_header_len);
|
||||
@@ -588,7 +597,7 @@
|
||||
switch (hard_header_len)
|
||||
{
|
||||
case ETH_HLEN:
|
||||
- CniNewFragment(ETH_HLEN, skb->mac.raw, &MacHdr, CNI_USE_BUFFER);
|
||||
+ CniNewFragment(ETH_HLEN, CISCOVPN_SKB_MACHEADER(skb), &MacHdr, CNI_USE_BUFFER);
|
||||
break;
|
||||
case IPPP_MAX_HEADER:
|
||||
case 0:
|
||||
@@ -677,14 +686,14 @@
|
||||
tmp_InjectSend = NULL;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
|
||||
- if (skb->ip_summed == CHECKSUM_HW)
|
||||
+ if (CHECK_IP_SUMMED(skb->ip_summed))
|
||||
{
|
||||
#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;
|
||||
@@ -692,7 +701,8 @@
|
||||
}
|
||||
#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
|
||||
reset_inject_status(&pBinding->send_stat);
|
||||
- hard_header_len = skb->nh.raw - skb->data;
|
||||
+
|
||||
+ hard_header_len = CISCOVPN_SKB_NETWORKHEADER(skb) - skb->data;
|
||||
pBinding->send_real_hh_len = hard_header_len;
|
||||
switch (hard_header_len)
|
||||
{
|
||||
diff -Nur vpnclient.orig/IPSecDrvOS_linux.c vpnclient/IPSecDrvOS_linux.c
|
||||
--- vpnclient.orig/IPSecDrvOS_linux.c 2005-11-22 10:52:00.000000000 +0100
|
||||
+++ vpnclient/IPSecDrvOS_linux.c 2007-05-29 13:42:39.000000000 +0200
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
-#include <linux/config.h>
|
||||
+#include <linux/autoconf.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/sched.h>
|
||||
diff -Nur vpnclient.orig/linuxcniapi.c vpnclient/linuxcniapi.c
|
||||
--- vpnclient.orig/linuxcniapi.c 2005-11-22 10:52:00.000000000 +0100
|
||||
+++ vpnclient/linuxcniapi.c 2007-05-29 13:56:57.000000000 +0200
|
||||
@@ -5,11 +5,14 @@
|
||||
* File: linuxcniapi.c
|
||||
* Date: 22/03/01
|
||||
*
|
||||
+ * Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
|
||||
+ * Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
|
||||
+ *
|
||||
***************************************************************************
|
||||
* This module implements a translation layer between the CNI API and the
|
||||
* Linux Interceptor driver.
|
||||
***************************************************************************/
|
||||
-#include <linux/config.h>
|
||||
+#include <linux/autoconf.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/if.h>
|
||||
@@ -292,9 +295,19 @@
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
|
||||
{
|
||||
struct timeval timestamp;
|
||||
-
|
||||
do_gettimeofday(×tamp);
|
||||
- skb_set_timestamp(skb,×tamp);
|
||||
+ /* With Linux 2.6.22 skb_set_timestamp has been dropped.
|
||||
+ * Additionally, the attribute tstamp now is in ktime_t
|
||||
+ * where it prior to 2.6.22 was in skb_timeval.
|
||||
+ *
|
||||
+ * As a proprietary module, we may not use ktime_get_real,
|
||||
+ * so we need to do it this way
|
||||
+ */
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
+ skb->tstamp = timeval_to_ktime(timestamp);
|
||||
+ #else
|
||||
+ skb_set_timestamp(skb,×tamp);
|
||||
+ #endif
|
||||
}
|
||||
#else
|
||||
do_gettimeofday(&skb->stamp);
|
||||
@@ -328,8 +341,13 @@
|
||||
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
|
||||
- skb->nh.iph = (struct iphdr *) skb->data;
|
||||
- skb->mac.raw = pMac;
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
+ skb_reset_network_header(skb);
|
||||
+ skb_reset_mac_header(skb);
|
||||
+ #else
|
||||
+ skb->nh.iph = (struct iphdr *) skb->data;
|
||||
+ skb->mac.raw = pMac;
|
||||
+ #endif
|
||||
|
||||
pBinding->recv_stat.called = TRUE;
|
||||
|
||||
@@ -441,9 +459,19 @@
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
|
||||
{
|
||||
struct timeval timestamp;
|
||||
-
|
||||
do_gettimeofday(×tamp);
|
||||
- skb_set_timestamp(skb,×tamp);
|
||||
+ /* With Linux 2.6.22 skb_set_timestamp has been dropped.
|
||||
+ * Additionally, the attribute tstamp now is in ktime_t
|
||||
+ * where it prior to 2.6.22 was in skb_timeval.
|
||||
+ *
|
||||
+ * As a proprietary module, we may not use ktime_get_real,
|
||||
+ * so we need to do it this way
|
||||
+ */
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
+ skb->tstamp = timeval_to_ktime(timestamp);
|
||||
+ #else
|
||||
+ skb_set_timestamp(skb,×tamp);
|
||||
+ #endif
|
||||
}
|
||||
#else
|
||||
do_gettimeofday(&skb->stamp);
|
||||
@@ -451,11 +479,21 @@
|
||||
|
||||
skb->dev = pBinding->pDevice;
|
||||
|
||||
- skb->mac.raw = pMac;
|
||||
- skb->nh.raw = pIP;
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
+ skb_reset_mac_header(skb);
|
||||
+ skb_reset_network_header(skb);
|
||||
+ #else
|
||||
+ skb->mac.raw = pMac;
|
||||
+ skb->nh.raw = pIP;
|
||||
+ #endif
|
||||
|
||||
/*ip header length is in 32bit words */
|
||||
- skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
+ skb->transport_header = skb->network_header + (ip_hdr(skb)->ihl * 4);
|
||||
+ #else
|
||||
+ skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
|
||||
+ #endif
|
||||
+
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
|
||||
/* send this packet up the NIC driver */
|
||||
diff -Nur vpnclient.orig/linux_os.h vpnclient/linux_os.h
|
||||
--- vpnclient.orig/linux_os.h 2005-11-22 10:52:00.000000000 +0100
|
||||
+++ vpnclient/linux_os.h 2007-05-29 16:05:44.000000000 +0200
|
||||
@@ -5,6 +5,9 @@
|
||||
* File: linux_os.h
|
||||
* Date: 04/25/2001
|
||||
*
|
||||
+* Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
|
||||
+* Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
|
||||
+*
|
||||
***************************************************************************
|
||||
*
|
||||
* Macros for handling differences in the linux kernel api.
|
||||
@@ -30,6 +33,39 @@
|
||||
#define PACKET_TYPE_NEXT(pt) ((pt)->next)
|
||||
#endif
|
||||
|
||||
+/* With linux 2.6.19, CHECKSUM_HW was split into CHECKSUM_COMPLETE
|
||||
+ * and CHECKSUM_PARTIAL
|
||||
+ */
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
|
||||
+ #define CHECK_IP_SUMMED(n) \
|
||||
+ (((n) == CHECKSUM_COMPLETE) || ((n) == CHECKSUM_PARTIAL))
|
||||
+ #define SKB_CHECKSUM_HELP(a,b) skb_checksum_help((a))
|
||||
+#else
|
||||
+ #define CHECK_IP_SUMMED(n) ((n) == CHECKSUM_HW)
|
||||
+ #define SKB_CHECKSUM_HELP(a,b) skb_checksum_help((a),(b))
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+/* With linux 2.6.22, the sk_buff struct has changed
|
||||
+ */
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
+ #define CISCOVPN_SKB_NH_ID(a) (ip_hdr(a)->id)
|
||||
+ #define CISCOVPN_SKB_NH_FRAGOFF(a) (ip_hdr(a)->frag_off)
|
||||
+ #define CISCOVPN_SKB_NH_TOTLEN(a) (ip_hdr(a)->tot_len)
|
||||
+ #define CISCOVPN_SKB_NH_IHL(a) (ip_hdr(a)->ihl)
|
||||
+ #define CISCOVPN_SKB_IPHEADER(a) (ip_hdr(a))
|
||||
+ #define CISCOVPN_SKB_MACHEADER(a) (skb_mac_header(a))
|
||||
+ #define CISCOVPN_SKB_NETWORKHEADER(a) (skb_network_header(a))
|
||||
+#else
|
||||
+ #define CISCOVPN_SKB_NH_ID(a) (a->nh.iph->id)
|
||||
+ #define CISCOVPN_SKB_NH_FRAGOFF(a) (a->nh.iph->frag_off)
|
||||
+ #define CISCOVPN_SKB_NH_TOTLEN(a) (a->nh.iph->tot_len)
|
||||
+ #define CISCOVPN_SKB_NH_IHL(a) (a->nh.iph->ihl)
|
||||
+ #define CISCOVPN_SKB_IPHEADER(a) (a->nh.iph)
|
||||
+ #define CISCOVPN_SKB_MACHEADER(a) (a->mac.raw)
|
||||
+ #define CISCOVPN_SKB_NETWORKHEADER(a) (a->nh.raw)
|
||||
+#endif
|
||||
+
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,5)
|
||||
#include <asm/uaccess.h>
|
||||
#else
|
||||
167
net-misc/cisco-vpnclient-3des/files/2.6.24.patch
Normal file
167
net-misc/cisco-vpnclient-3des/files/2.6.24.patch
Normal file
@@ -0,0 +1,167 @@
|
||||
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;
|
||||
241
net-misc/cisco-vpnclient-3des/files/4.8.01.0640-2.6.24.patch
Normal file
241
net-misc/cisco-vpnclient-3des/files/4.8.01.0640-2.6.24.patch
Normal file
@@ -0,0 +1,241 @@
|
||||
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;
|
||||
116
net-misc/cisco-vpnclient-3des/files/4.8.01.0640-amd64.patch
Normal file
116
net-misc/cisco-vpnclient-3des/files/4.8.01.0640-amd64.patch
Normal file
@@ -0,0 +1,116 @@
|
||||
diff -u -x '*.ko*' -x '*.o*' vpnclient/frag.c vpnclient_modified/frag.c
|
||||
--- vpnclient/frag.c 2007-08-22 15:30:31.000000000 -0400
|
||||
+++ vpnclient_modified/frag.c 2008-01-11 01:41:19.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 -u -x '*.ko*' -x '*.o*' vpnclient/interceptor.c vpnclient_modified/interceptor.c
|
||||
--- vpnclient/interceptor.c 2007-08-22 15:30:31.000000000 -0400
|
||||
+++ vpnclient_modified/interceptor.c 2008-01-11 02:04:01.000000000 -0500
|
||||
@@ -636,7 +636,11 @@
|
||||
#endif
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
+ #ifdef NET_SKBUFF_DATA_USES_OFFSET
|
||||
+ hard_header_len = skb->data - (skb->head + skb->mac_header);
|
||||
+ #else
|
||||
hard_header_len = skb->data - skb->mac_header;
|
||||
+ #endif
|
||||
#else
|
||||
hard_header_len = skb->data - skb->mac.raw;
|
||||
#endif
|
||||
@@ -657,7 +661,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
|
||||
@@ -667,7 +675,7 @@
|
||||
MacHdr = build_ppp_fake_mac_frag(&ppp_dummy_buf);
|
||||
break;
|
||||
default:
|
||||
- printk(KERN_DEBUG "unknown mac header length (%d)\n", hard_header_len);
|
||||
+ printk(KERN_DEBUG "unknown mac header length (%d) CniNewFragment\n", hard_header_len);
|
||||
dev_kfree_skb(skb);
|
||||
skb = NULL;
|
||||
goto exit_gracefully;
|
||||
@@ -775,7 +783,12 @@
|
||||
#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
|
||||
reset_inject_status(&pBinding->send_stat);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
- hard_header_len = skb->network_header - skb->data;
|
||||
+ #ifdef NET_SKBUFF_DATA_USES_OFFSET
|
||||
+ hard_header_len =
|
||||
+ (skb->head + skb->network_header) - skb->data;
|
||||
+ #else
|
||||
+ hard_header_len = skb->network_header - skb->data;
|
||||
+ #endif
|
||||
#else
|
||||
hard_header_len = skb->nh.raw - skb->data;
|
||||
#endif
|
||||
diff -u -x '*.ko*' -x '*.o*' vpnclient/linuxcniapi.c vpnclient_modified/linuxcniapi.c
|
||||
--- vpnclient/linuxcniapi.c 2007-08-22 15:30:31.000000000 -0400
|
||||
+++ vpnclient_modified/linuxcniapi.c 2008-01-11 01:41:19.000000000 -0500
|
||||
@@ -338,8 +338,13 @@
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
- skb->network_header = (sk_buff_data_t) skb->data;
|
||||
- skb->mac_header = (sk_buff_data_t)pMac;
|
||||
+ #ifdef NET_SKBUFF_DATA_USES_OFFSET
|
||||
+ skb->network_header = (sk_buff_data_t) (skb->data - skb->head);
|
||||
+ skb->mac_header = (sk_buff_data_t) (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)
|
||||
- skb->mac_header = (sk_buff_data_t)pMac;
|
||||
- skb->network_header = (sk_buff_data_t)pIP;
|
||||
+ #ifdef NET_SKBUFF_DATA_USES_OFFSET
|
||||
+ skb->mac_header = (sk_buff_data_t)(pMac - skb->head);
|
||||
+ skb->network_header = (sk_buff_data_t)(pIP - 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)
|
||||
- skb->transport_header = (sk_buff_data_t)
|
||||
- (pIP + (((struct iphdr*)(skb->network_header))->ihl * 4));
|
||||
+ #ifdef NET_SKBUFF_DATA_USES_OFFSET
|
||||
+ skb->transport_header = (sk_buff_data_t)
|
||||
+ ((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
|
||||
@@ -0,0 +1,35 @@
|
||||
--- interceptor.c.orig 2008-01-10 22:19:29.000000000 +0100
|
||||
+++ interceptor.c 2008-01-10 22:19:52.000000000 +0100
|
||||
@@ -711,8 +711,18 @@
|
||||
|
||||
break;
|
||||
case CNI_DISCARD:
|
||||
+ /* patch found on ubuntuforums.org, written by aranoyas */
|
||||
+ /* override local LAN access */
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
|
||||
+ rc2 = original_ip_handler.orig_handler_func(skb, dev, type, dev);
|
||||
+#else
|
||||
+ rc2 = original_ip_handler.orig_handler_func(skb, dev, type);
|
||||
+#endif
|
||||
+
|
||||
+ /*
|
||||
dev_kfree_skb(skb);
|
||||
rx_dropped++;
|
||||
+ */
|
||||
break;
|
||||
default:
|
||||
printk(KERN_DEBUG "RECV: Unhandled case in %s rc was %x\n",
|
||||
@@ -833,8 +843,13 @@
|
||||
/* packet dropped */
|
||||
else
|
||||
{
|
||||
+ /* patch found on ubuntuforums.org, originally written by aranoyas */
|
||||
+ /* override local LAN access */
|
||||
+ rc2 = pBinding->InjectSend(skb, dev);
|
||||
+ /*
|
||||
dev_kfree_skb(skb);
|
||||
tx_dropped++;
|
||||
+ */
|
||||
}
|
||||
break;
|
||||
case CNI_CHAIN:
|
||||
@@ -0,0 +1,78 @@
|
||||
--- vpnclient.ori/interceptor.c 2009-05-21 01:16:34.000000000 +1200
|
||||
+++ vpnclient/interceptor.c 2009-09-06 22:02:39.000000000 +1200
|
||||
@@ -116,6 +116,14 @@
|
||||
};
|
||||
#endif
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
|
||||
+static struct net_device_ops interceptor_netdev_ops = {
|
||||
+ .ndo_start_xmit = interceptor_tx,
|
||||
+ .ndo_do_ioctl = interceptor_ioctl,
|
||||
+ .ndo_get_stats = interceptor_stats,
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
static struct notifier_block interceptor_notifier = {
|
||||
.notifier_call = handle_netdev_event,
|
||||
};
|
||||
@@ -129,9 +137,13 @@
|
||||
{
|
||||
ether_setup(dev);
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
|
||||
+ dev->netdev_ops = &interceptor_netdev_ops;
|
||||
+#else
|
||||
dev->hard_start_xmit = interceptor_tx;
|
||||
dev->get_stats = interceptor_stats;
|
||||
dev->do_ioctl = interceptor_ioctl;
|
||||
+#endif
|
||||
|
||||
dev->mtu = ETH_DATA_LEN-MTU_REDUCTION;
|
||||
kernel_memcpy(dev->dev_addr, interceptor_eth_addr,ETH_ALEN);
|
||||
@@ -242,6 +254,9 @@
|
||||
{
|
||||
int rc = -1;
|
||||
int i = 0;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
|
||||
+ struct net_device_ops * tmp_ops;
|
||||
+#endif
|
||||
|
||||
if (!supported_device(dev))
|
||||
{
|
||||
@@ -268,8 +283,14 @@
|
||||
Bindings[i].original_mtu = dev->mtu;
|
||||
|
||||
/*replace the original send function with our send function */
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
|
||||
+ Bindings[i].InjectSend = dev->netdev_ops->ndo_start_xmit;
|
||||
+ tmp_ops = (struct net_device_ops *) dev->netdev_ops;
|
||||
+ tmp_ops->ndo_start_xmit = replacement_dev_xmit;
|
||||
+#else
|
||||
Bindings[i].InjectSend = dev->hard_start_xmit;
|
||||
dev->hard_start_xmit = replacement_dev_xmit;
|
||||
+#endif
|
||||
|
||||
/*copy in the ip packet handler function and packet type struct */
|
||||
Bindings[i].InjectReceive = original_ip_handler.orig_handler_func;
|
||||
@@ -285,13 +306,21 @@
|
||||
{
|
||||
int rc = -1;
|
||||
BINDING *b;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
|
||||
+ struct net_device_ops * tmp_ops;
|
||||
+#endif
|
||||
|
||||
b = getbindingbydev(dev);
|
||||
|
||||
if (b)
|
||||
{
|
||||
rc = 0;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
|
||||
+ tmp_ops = (struct net_device_ops *) dev->netdev_ops;
|
||||
+ tmp_ops->ndo_start_xmit = b->InjectSend;
|
||||
+#else
|
||||
dev->hard_start_xmit = b->InjectSend;
|
||||
+#endif
|
||||
kernel_memset(b, 0, sizeof(BINDING));
|
||||
}
|
||||
else
|
||||
@@ -0,0 +1,150 @@
|
||||
diff -urN vpnclient.orig/Makefile vpnclient/Makefile
|
||||
--- vpnclient.orig/Makefile 2008-06-23 17:59:12.000000000 +0100
|
||||
+++ vpnclient/Makefile 2008-07-09 23:16:54.000000000 +0100
|
||||
@@ -12,7 +12,9 @@
|
||||
SOURCE_OBJS := linuxcniapi.o frag.o IPSecDrvOS_linux.o interceptor.o linuxkernelapi.o
|
||||
|
||||
ifeq ($(SUBARCH),x86_64)
|
||||
-CFLAGS += -mcmodel=kernel -mno-red-zone
|
||||
+# Must NOT fiddle with CFLAGS
|
||||
+# 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 -urN vpnclient.orig/frag.c vpnclient/frag.c
|
||||
--- vpnclient.orig/frag.c 2008-06-23 17:59:12.000000000 +0100
|
||||
+++ vpnclient/frag.c 2008-07-09 23:16:54.000000000 +0100
|
||||
@@ -22,7 +22,9 @@
|
||||
#include "frag.h"
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
-#define SKB_IPHDR(skb) ((struct iphdr*)skb->network_header)
|
||||
+/* 2.6.22 added an inline function for 32-/64-bit usage here, so use it.
|
||||
+ */
|
||||
+#define SKB_IPHDR(skb) ((struct iphdr*)skb_network_header)
|
||||
#else
|
||||
#define SKB_IPHDR(skb) skb->nh.iph
|
||||
#endif
|
||||
diff -urN vpnclient.orig/interceptor.c vpnclient/interceptor.c
|
||||
--- vpnclient.orig/interceptor.c 2008-06-23 17:59:12.000000000 +0100
|
||||
+++ vpnclient/interceptor.c 2008-07-09 23:34:51.000000000 +0100
|
||||
@@ -637,19 +637,30 @@
|
||||
|
||||
reset_inject_status(&pBinding->recv_stat);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
- if (skb->mac_header)
|
||||
+/* 2.6.22 added an inline function for 32-/64-bit usage here, so use it.
|
||||
+ */
|
||||
+ if (skb_mac_header_was_set(skb))
|
||||
#else
|
||||
if (skb->mac.raw)
|
||||
#endif
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
- hard_header_len = skb->data - skb->mac_header;
|
||||
+/* 2.6.22 added an inline function for 32-/64-bit usage here, so use it.
|
||||
+ */
|
||||
+ hard_header_len = skb->data - skb_mac_header(skb);
|
||||
#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, /* actualy ptr in 32-bit */
|
||||
+ skb->data,
|
||||
+ skb->head);
|
||||
+
|
||||
hard_header_len = 0;
|
||||
}
|
||||
}
|
||||
@@ -664,7 +675,9 @@
|
||||
{
|
||||
case ETH_HLEN:
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
- CniNewFragment(ETH_HLEN, skb->mac_header, &MacHdr, CNI_USE_BUFFER);
|
||||
+/* 2.6.22 added an inline function for 32-/64-bit usage here, so use it.
|
||||
+ */
|
||||
+ CniNewFragment(ETH_HLEN, skb_mac_header(skb), &MacHdr, CNI_USE_BUFFER);
|
||||
#else
|
||||
CniNewFragment(ETH_HLEN, skb->mac.raw, &MacHdr, CNI_USE_BUFFER);
|
||||
#endif
|
||||
@@ -782,7 +795,9 @@
|
||||
#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
|
||||
reset_inject_status(&pBinding->send_stat);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
- hard_header_len = skb->network_header - skb->data;
|
||||
+/* 2.6.22 added an inline function for 32-/64-bit usage here, so use it.
|
||||
+ */
|
||||
+ hard_header_len = skb_network_header(skb) - skb->data;
|
||||
#else
|
||||
hard_header_len = skb->nh.raw - skb->data;
|
||||
#endif
|
||||
diff -urN vpnclient.orig/linuxcniapi.c vpnclient/linuxcniapi.c
|
||||
--- vpnclient.orig/linuxcniapi.c 2008-06-23 17:59:12.000000000 +0100
|
||||
+++ vpnclient/linuxcniapi.c 2008-07-09 23:16:54.000000000 +0100
|
||||
@@ -338,8 +338,12 @@
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
- skb->network_header = (sk_buff_data_t) skb->data;
|
||||
- skb->mac_header = (sk_buff_data_t)pMac;
|
||||
+/* 2.6.22 added an inline function for 32-/64-bit usage here, so use it.
|
||||
+ * We have to use (pMac - skb->data) to get an offset.
|
||||
+ * We need to cast ptrs to byte ptrs and take the difference.
|
||||
+ */
|
||||
+ skb_reset_network_header(skb);
|
||||
+ skb_set_mac_header(skb, (int)((void *)pMac - (void *)skb->data));
|
||||
#else
|
||||
skb->nh.iph = (struct iphdr *) skb->data;
|
||||
skb->mac.raw = pMac;
|
||||
@@ -478,8 +482,12 @@
|
||||
skb->dev = pBinding->pDevice;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
- skb->mac_header = (sk_buff_data_t)pMac;
|
||||
- skb->network_header = (sk_buff_data_t)pIP;
|
||||
+/* 2.6.22 added an inline function for 32-/64-bit usage here, so use it.
|
||||
+ * We have to use (pIP/pMac - skb->data) to get an offset.
|
||||
+ * We need to cast ptrs to byte ptrs and take the difference.
|
||||
+ */
|
||||
+ skb_set_mac_header(skb, (int)((void *)pMac - (void *)skb->data));
|
||||
+ skb_set_network_header(skb, (int)((void *)pIP - (void *)skb->data));
|
||||
#else
|
||||
skb->mac.raw = pMac;
|
||||
skb->nh.raw = pIP;
|
||||
@@ -487,8 +495,13 @@
|
||||
|
||||
/*ip header length is in 32bit words */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
- skb->transport_header = (sk_buff_data_t)
|
||||
- (pIP + (((struct iphdr*)(skb->network_header))->ihl * 4));
|
||||
+/* 2.6.22 added an inline function for 32-/64-bit usage here, so use it.
|
||||
+ * We have to use (pIP - skb->data) to get an offset.
|
||||
+ * We need to cast ptrs to byte ptrs and take the difference.
|
||||
+ */
|
||||
+ skb_set_transport_header(skb,
|
||||
+ ((int)((void *)pIP - (void *)skb->data) +
|
||||
+ (((struct iphdr*)(skb_network_header(skb)))->ihl * 4)));
|
||||
#else
|
||||
skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
|
||||
#endif
|
||||
diff -urN vpnclient.orig/linuxkernelapi.c vpnclient/linuxkernelapi.c
|
||||
--- vpnclient.orig/linuxkernelapi.c 2008-06-23 17:59:12.000000000 +0100
|
||||
+++ vpnclient/linuxkernelapi.c 2008-07-09 23:16:54.000000000 +0100
|
||||
@@ -9,7 +9,10 @@
|
||||
void*rc = kmalloc(size, GFP_ATOMIC);
|
||||
if(NULL == rc)
|
||||
{
|
||||
- printk("<1> os_malloc size %d failed\n",size);
|
||||
+/* Allow for 32- or 64-bit size
|
||||
+ * printk("<1> os_malloc size %d failed\n",size);
|
||||
+ */
|
||||
+ printk("<1> os_malloc size %ld failed\n", (long)size);
|
||||
}
|
||||
|
||||
return rc;
|
||||
116
net-misc/cisco-vpnclient-3des/files/vpnclient.rc
Normal file
116
net-misc/cisco-vpnclient-3des/files/vpnclient.rc
Normal file
@@ -0,0 +1,116 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2004 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/net-misc/cisco-vpnclient-3des/files/vpnclient.rc,v 1.8 2006/12/12 15:08:12 wolf31o2 Exp $
|
||||
|
||||
opts="start stop status"
|
||||
|
||||
VPNCLIENT="/usr/bin/vpnclient"
|
||||
VPNDEV="cipsec0"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
}
|
||||
|
||||
checkconfig() {
|
||||
export KV="$(uname -r)"
|
||||
|
||||
export VPNMOD="cisco_ipsec"
|
||||
case "${KV}" in
|
||||
2.6.*|2.5.*) VPNMOD_FILE="${VPNMOD}.ko";;
|
||||
2.4.*|2.2.*|2.0.*) VPNMOD_FILE="${VPNMOD}.o";;
|
||||
*)
|
||||
eerror "Kernel version '${KV}' is not supported"
|
||||
return 1;;
|
||||
esac
|
||||
export VPNMOD_FILE
|
||||
return 0
|
||||
}
|
||||
|
||||
start() {
|
||||
checkconfig || return 1
|
||||
|
||||
local PC=""
|
||||
|
||||
ebegin "Starting Cisco VPN Client"
|
||||
|
||||
if [ -f /etc/resolv.conf.vpnbackup ]; then
|
||||
einfo "restoring /etc/resolv.conf"
|
||||
mv /etc/resolv.conf.vpnbackup /etc/resolv.conf
|
||||
fi
|
||||
|
||||
if [ -d /lib/modules/preferred ]; then
|
||||
PC="/lib/modules/preferred/CiscoVPN"
|
||||
else
|
||||
PC="/lib/modules/${KV}/CiscoVPN"
|
||||
fi
|
||||
|
||||
if [ -d "${PC}" ] ; then
|
||||
/sbin/insmod ${PC}/${VPNMOD_FILE} >/dev/null 2>&1
|
||||
if [ "$?" != "0" ] ; then
|
||||
eend 1 "Failed to load module '${VPNMOD}'"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
eend 1 "module directory '$PC' not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "${KV:0:3}" == "2.0" ] ; then
|
||||
# This is only needed due to a bug in 2.0.x kernels that affects
|
||||
# arp lookups.
|
||||
ifconfig $VPNDEV 222.222.222.222 ;
|
||||
if [ "$?" != "0" ] ; then
|
||||
eerror "Failed (ifconfig)"
|
||||
/sbin/rmmod ${VPNMOD}
|
||||
eend 1
|
||||
fi
|
||||
fi
|
||||
|
||||
eend 0
|
||||
}
|
||||
|
||||
stop() {
|
||||
checkconfig || return 1
|
||||
|
||||
ebegin "Stopping Cisco VPN Client"
|
||||
|
||||
/sbin/lsmod | grep -q "${VPNMOD}"
|
||||
if [ "$?" != "0" ] ; then
|
||||
eend 1 "Failed: module ${VPNMOD} is not running"
|
||||
return 1
|
||||
fi
|
||||
if [ -x $VPNCLIENT ]; then
|
||||
$VPNCLIENT disconnect > /dev/null 2>&1
|
||||
sleep 1
|
||||
fi
|
||||
/sbin/ifconfig $VPNDEV down
|
||||
if [ "$?" != "0" ] ; then
|
||||
eend 1 "Failed (ifconfig)"
|
||||
return 1
|
||||
fi
|
||||
/sbin/rmmod ${VPNMOD}
|
||||
if [ "$?" != "0" ] ; then
|
||||
eend 1 "Failed (rmmod)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
eend 0
|
||||
}
|
||||
|
||||
status() {
|
||||
checkconfig || return 1
|
||||
|
||||
/sbin/lsmod | egrep "${VPNMOD}"
|
||||
if [ "$?" != "0" ] ; then
|
||||
eerror "Failed (lsmod ${VPNMOD}): the VPN module is not loaded"
|
||||
return 1
|
||||
fi
|
||||
echo
|
||||
/sbin/ifconfig $VPNDEV
|
||||
if [ "$?" != "0" ] ; then
|
||||
echo
|
||||
eerror "Failed (ifconfig ${VPNDEV}): the virtual interface is not present"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user