1 diff -Nur vpnclient.orig/frag.c vpnclient/frag.c
2 --- cisco-vpnclient-4.7.00.0640_k9/vpnclient.orig/frag.c 2005-11-22 10:52:00.000000000 +0100
3 +++ cisco-vpnclient-4.7.00.0640_k9/vpnclient/frag.c 2007-05-29 16:03:42.000000000 +0200
5 -#include <linux/config.h>
6 +/**************************************************************************
7 + * Copyright (c) 2001, Cisco Systems, All Rights Reserved
8 + ***************************************************************************
13 + * Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
14 + * Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
16 + ***************************************************************************
17 + * This module does some really cool stuff only Cisco knows about
18 + ***************************************************************************/
20 +#include <linux/autoconf.h>
21 #include <linux/version.h>
22 #include <linux/netdevice.h>
23 #include <linux/etherdevice.h>
26 struct frag_queue_entry *cur=NULL,*n=NULL,*prev=NULL;
28 - id = ntohs(skb->nh.iph->id);
29 + id = ntohs(CISCOVPN_SKB_NH_ID(skb));
31 /* look for an entry with the same id as this packet*/
32 - if (frag_queue_head && id != ntohs(frag_queue_head->skb->nh.iph->id))
33 + if (frag_queue_head && id != ntohs(CISCOVPN_SKB_NH_ID(frag_queue_head->skb)))
35 printk(KERN_INFO "%s: incomplete fragment set destroyed",__FUNCTION__);
38 cur = frag_queue_head;
41 - skb_offset = ntohs(skb->nh.iph->frag_off) & IP_OFFSET;
43 + skb_offset = ntohs(CISCOVPN_SKB_NH_FRAGOFF(skb)) & IP_OFFSET;
47 - cur_offset = ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET;
48 + cur_offset = ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET;
51 if (cur_offset < prev_offset)
56 cur = frag_queue_head;
58 /*first in queue must be first frag.*/
59 - if ((ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET) != 0)
60 + if ((ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET) != 0)
65 by comparing adjacent offset values and packet lengths*/
68 - cur_offset = (ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET)*8;
69 - if (cur_offset != prev_end_offset)
70 + cur_offset = (ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET)*8;
72 + if (cur_offset != prev_end_offset)
77 prev_offset = cur_offset;
78 - prev_end_offset = prev_offset + ntohs(prev->skb->nh.iph->tot_len)
79 - - (prev->skb->nh.iph->ihl*4);
81 + prev_end_offset = prev_offset + ntohs(CISCOVPN_SKB_NH_TOTLEN(prev->skb))
82 + - (CISCOVPN_SKB_NH_IHL(prev->skb)*4);
85 /*last in queue must not have more frags set*/
86 - if (ntohs(prev->skb->nh.iph->frag_off) & IP_MF)
88 + if (ntohs(CISCOVPN_SKB_NH_FRAGOFF(prev->skb)) & IP_MF)
98 + iph = CISCOVPN_SKB_IPHEADER(skb);
102 - printk(KERN_DEBUG "%s: skb->nh is NULL.", __FUNCTION__);
103 + printk(KERN_DEBUG "%s: iph (IP Header) is NULL.", __FUNCTION__);
104 goto done_with_tests;
106 offset = ntohs(iph->frag_off);
107 diff -Nur vpnclient.orig/interceptor.c vpnclient/interceptor.c
108 --- cisco-vpnclient-4.7.00.0640_k9/vpnclient.orig/interceptor.c 2005-11-22 10:52:00.000000000 +0100
109 +++ cisco-vpnclient-4.7.00.0640_k9/vpnclient/interceptor.c 2007-05-29 16:08:57.000000000 +0200
111 * File: interceptor.c
114 +* Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
115 +* Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
117 ***************************************************************************
118 * This module implements the linux driver.
119 ***************************************************************************/
120 -#include <linux/config.h>
121 +#include <linux/autoconf.h>
122 #include <linux/version.h>
123 #include <linux/module.h>
124 #include <linux/init.h>
125 @@ -339,13 +342,18 @@
128 num_target_devices = 0;
129 - for (dp = dev_base; dp != NULL; dp = dp->next)
132 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
133 + for_each_netdev(dp)
135 + for (dp = dev_base; dp != NULL; dp = dp->next)
138 if (add_netdev(dp) == 0)
140 num_target_devices++;
145 if (num_target_devices == 0)
147 @@ -550,13 +558,13 @@
148 goto exit_gracefully;
151 - if (skb->ip_summed == CHECKSUM_HW)
152 + if (CHECK_IP_SUMMED(skb->ip_summed))
154 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
155 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
156 - if (skb_checksum_help(skb,1))
157 + if (SKB_CHECKSUM_HELP(skb,1))
159 - if (skb_checksum_help(&skb,1))
160 + if (SKB_CHECKSUM_HELP(&skb,1))
161 #endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
167 reset_inject_status(&pBinding->recv_stat);
170 + if (CISCOVPN_SKB_MACHEADER(skb))
172 - hard_header_len = skb->data - skb->mac.raw;
173 + hard_header_len = skb->data - CISCOVPN_SKB_MACHEADER(skb);
174 if ((hard_header_len < 0) || (hard_header_len > skb_headroom(skb)))
176 printk(KERN_DEBUG "bad hh len %d\n", hard_header_len);
178 switch (hard_header_len)
181 - CniNewFragment(ETH_HLEN, skb->mac.raw, &MacHdr, CNI_USE_BUFFER);
182 + CniNewFragment(ETH_HLEN, CISCOVPN_SKB_MACHEADER(skb), &MacHdr, CNI_USE_BUFFER);
184 case IPPP_MAX_HEADER:
186 @@ -677,14 +686,14 @@
187 tmp_InjectSend = NULL;
189 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
190 - if (skb->ip_summed == CHECKSUM_HW)
191 + if (CHECK_IP_SUMMED(skb->ip_summed))
193 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
194 - if (skb_checksum_help(skb,0))
195 + if (SKB_CHECKSUM_HELP(skb,0))
196 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
197 - if (skb_checksum_help(&skb,0))
198 + if (SKB_CHECKSUM_HELP(&skb,0))
200 - if ((skb = skb_checksum_help(skb)) == NULL)
201 + if ((skb = SKB_CHECKSUM_HELP(skb)) == NULL)
202 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
204 goto exit_gracefully;
207 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
208 reset_inject_status(&pBinding->send_stat);
209 - hard_header_len = skb->nh.raw - skb->data;
211 + hard_header_len = CISCOVPN_SKB_NETWORKHEADER(skb) - skb->data;
212 pBinding->send_real_hh_len = hard_header_len;
213 switch (hard_header_len)
215 diff -Nur vpnclient.orig/IPSecDrvOS_linux.c vpnclient/IPSecDrvOS_linux.c
216 --- cisco-vpnclient-4.7.00.0640_k9/vpnclient.orig/IPSecDrvOS_linux.c 2005-11-22 10:52:00.000000000 +0100
217 +++ cisco-vpnclient-4.7.00.0640_k9/vpnclient/IPSecDrvOS_linux.c 2007-05-29 13:42:39.000000000 +0200
221 ***************************************************************************/
222 -#include <linux/config.h>
223 +#include <linux/autoconf.h>
224 #include <linux/version.h>
225 #include <linux/vmalloc.h>
226 #include <linux/sched.h>
227 diff -Nur vpnclient.orig/linuxcniapi.c vpnclient/linuxcniapi.c
228 --- cisco-vpnclient-4.7.00.0640_k9/vpnclient.orig/linuxcniapi.c 2005-11-22 10:52:00.000000000 +0100
229 +++ cisco-vpnclient-4.7.00.0640_k9/vpnclient/linuxcniapi.c 2007-05-29 13:56:57.000000000 +0200
231 * File: linuxcniapi.c
234 + * Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
235 + * Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
237 ***************************************************************************
238 * This module implements a translation layer between the CNI API and the
239 * Linux Interceptor driver.
240 ***************************************************************************/
241 -#include <linux/config.h>
242 +#include <linux/autoconf.h>
243 #include <linux/version.h>
244 #include <linux/netdevice.h>
245 #include <linux/if.h>
247 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
249 struct timeval timestamp;
251 do_gettimeofday(×tamp);
252 - skb_set_timestamp(skb,×tamp);
253 + /* With Linux 2.6.22 skb_set_timestamp has been dropped.
254 + * Additionally, the attribute tstamp now is in ktime_t
255 + * where it prior to 2.6.22 was in skb_timeval.
257 + * As a proprietary module, we may not use ktime_get_real,
258 + * so we need to do it this way
260 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
261 + skb->tstamp = timeval_to_ktime(timestamp);
263 + skb_set_timestamp(skb,×tamp);
267 do_gettimeofday(&skb->stamp);
270 skb->ip_summed = CHECKSUM_UNNECESSARY;
272 - skb->nh.iph = (struct iphdr *) skb->data;
273 - skb->mac.raw = pMac;
274 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
275 + skb_reset_network_header(skb);
276 + skb_reset_mac_header(skb);
278 + skb->nh.iph = (struct iphdr *) skb->data;
279 + skb->mac.raw = pMac;
282 pBinding->recv_stat.called = TRUE;
285 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
287 struct timeval timestamp;
289 do_gettimeofday(×tamp);
290 - skb_set_timestamp(skb,×tamp);
291 + /* With Linux 2.6.22 skb_set_timestamp has been dropped.
292 + * Additionally, the attribute tstamp now is in ktime_t
293 + * where it prior to 2.6.22 was in skb_timeval.
295 + * As a proprietary module, we may not use ktime_get_real,
296 + * so we need to do it this way
298 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
299 + skb->tstamp = timeval_to_ktime(timestamp);
301 + skb_set_timestamp(skb,×tamp);
305 do_gettimeofday(&skb->stamp);
306 @@ -451,11 +479,21 @@
308 skb->dev = pBinding->pDevice;
310 - skb->mac.raw = pMac;
312 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
313 + skb_reset_mac_header(skb);
314 + skb_reset_network_header(skb);
316 + skb->mac.raw = pMac;
320 /*ip header length is in 32bit words */
321 - skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
322 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
323 + skb->transport_header = skb->network_header + (ip_hdr(skb)->ihl * 4);
325 + skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
328 skb->protocol = htons(ETH_P_IP);
330 /* send this packet up the NIC driver */
331 diff -Nur vpnclient.orig/linux_os.h vpnclient/linux_os.h
332 --- cisco-vpnclient-4.7.00.0640_k9/vpnclient.orig/linux_os.h 2005-11-22 10:52:00.000000000 +0100
333 +++ cisco-vpnclient-4.7.00.0640_k9/vpnclient/linux_os.h 2007-05-29 16:05:44.000000000 +0200
338 +* Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
339 +* Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
341 ***************************************************************************
343 * Macros for handling differences in the linux kernel api.
345 #define PACKET_TYPE_NEXT(pt) ((pt)->next)
348 +/* With linux 2.6.19, CHECKSUM_HW was split into CHECKSUM_COMPLETE
349 + * and CHECKSUM_PARTIAL
351 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
352 + #define CHECK_IP_SUMMED(n) \
353 + (((n) == CHECKSUM_COMPLETE) || ((n) == CHECKSUM_PARTIAL))
354 + #define SKB_CHECKSUM_HELP(a,b) skb_checksum_help((a))
356 + #define CHECK_IP_SUMMED(n) ((n) == CHECKSUM_HW)
357 + #define SKB_CHECKSUM_HELP(a,b) skb_checksum_help((a),(b))
361 +/* With linux 2.6.22, the sk_buff struct has changed
363 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
364 + #define CISCOVPN_SKB_NH_ID(a) (ip_hdr(a)->id)
365 + #define CISCOVPN_SKB_NH_FRAGOFF(a) (ip_hdr(a)->frag_off)
366 + #define CISCOVPN_SKB_NH_TOTLEN(a) (ip_hdr(a)->tot_len)
367 + #define CISCOVPN_SKB_NH_IHL(a) (ip_hdr(a)->ihl)
368 + #define CISCOVPN_SKB_IPHEADER(a) (ip_hdr(a))
369 + #define CISCOVPN_SKB_MACHEADER(a) (skb_mac_header(a))
370 + #define CISCOVPN_SKB_NETWORKHEADER(a) (skb_network_header(a))
372 + #define CISCOVPN_SKB_NH_ID(a) (a->nh.iph->id)
373 + #define CISCOVPN_SKB_NH_FRAGOFF(a) (a->nh.iph->frag_off)
374 + #define CISCOVPN_SKB_NH_TOTLEN(a) (a->nh.iph->tot_len)
375 + #define CISCOVPN_SKB_NH_IHL(a) (a->nh.iph->ihl)
376 + #define CISCOVPN_SKB_IPHEADER(a) (a->nh.iph)
377 + #define CISCOVPN_SKB_MACHEADER(a) (a->mac.raw)
378 + #define CISCOVPN_SKB_NETWORKHEADER(a) (a->nh.raw)
381 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,5)
382 #include <asm/uaccess.h>