]> git.pld-linux.org Git - packages/cisco-vpnclient.git/blame - cisco-vpnclient-2.6.22.patch
- up to 4.8.01.0640_k9, one source for 32/64bit, correct commitlog
[packages/cisco-vpnclient.git] / cisco-vpnclient-2.6.22.patch
CommitLineData
6fa5eac0
MWP
1diff -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
4@@ -1,4 +1,18 @@
5-#include <linux/config.h>
6+/**************************************************************************
7+ * Copyright (c) 2001, Cisco Systems, All Rights Reserved
8+ ***************************************************************************
9+ *
10+ * File: frag.c
11+ * Date: 22/03/01
12+ *
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>
15+ *
16+ ***************************************************************************
17+ * This module does some really cool stuff only Cisco knows about
18+ ***************************************************************************/
19+
20+#include <linux/autoconf.h>
21 #include <linux/version.h>
22 #include <linux/netdevice.h>
23 #include <linux/etherdevice.h>
24@@ -37,9 +51,10 @@
25 int ret=FALSE;
26 struct frag_queue_entry *cur=NULL,*n=NULL,*prev=NULL;
27
28- id = ntohs(skb->nh.iph->id);
29+ id = ntohs(CISCOVPN_SKB_NH_ID(skb));
30+
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)))
34 {
35 printk(KERN_INFO "%s: incomplete fragment set destroyed",__FUNCTION__);
36 cleanup_frag_queue();
37@@ -57,10 +72,13 @@
38 cur = frag_queue_head;
39
40 prev = NULL;
41- skb_offset = ntohs(skb->nh.iph->frag_off) & IP_OFFSET;
42+
43+ skb_offset = ntohs(CISCOVPN_SKB_NH_FRAGOFF(skb)) & IP_OFFSET;
44+
45 while (cur)
46 {
47- cur_offset = ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET;
48+ cur_offset = ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET;
49+
50 /*sanity check*/
51 if (cur_offset < prev_offset)
52 {
53@@ -112,8 +130,9 @@
54 goto done_with_tests;
55 }
56 cur = frag_queue_head;
57+
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)
61 {
62 goto done_with_tests;
63 }
64@@ -121,19 +140,22 @@
65 by comparing adjacent offset values and packet lengths*/
66 while (cur)
67 {
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;
71+
72+ if (cur_offset != prev_end_offset)
73 {
74 goto done_with_tests;
75 }
76 prev = cur;
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);
80+
81+ prev_end_offset = prev_offset + ntohs(CISCOVPN_SKB_NH_TOTLEN(prev->skb))
82+ - (CISCOVPN_SKB_NH_IHL(prev->skb)*4);
83 cur = cur->next;
84 }
85 /*last in queue must not have more frags set*/
86- if (ntohs(prev->skb->nh.iph->frag_off) & IP_MF)
87+
88+ if (ntohs(CISCOVPN_SKB_NH_FRAGOFF(prev->skb)) & IP_MF)
89 {
90 goto done_with_tests;
91 }
92@@ -185,10 +207,12 @@
93 /*not an IP packet*/
94 goto done_with_tests;
95 }
96- iph = skb->nh.iph;
97+
98+ iph = CISCOVPN_SKB_IPHEADER(skb);
99+
100 if (!iph)
101 {
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;
105 }
106 offset = ntohs(iph->frag_off);
107diff -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
110@@ -5,10 +5,13 @@
111 * File: interceptor.c
112 * Date: 04/10/2001
113 *
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>
116+*
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 @@
126
127 dp = NULL;
128 num_target_devices = 0;
129- for (dp = dev_base; dp != NULL; dp = dp->next)
130- {
131+
132+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
133+ for_each_netdev(dp)
134+ #else
135+ for (dp = dev_base; dp != NULL; dp = dp->next)
136+ #endif
137+ {
138 if (add_netdev(dp) == 0)
139 {
140 num_target_devices++;
141 }
142- }
143+ }
144
145 if (num_target_devices == 0)
146 {
147@@ -550,13 +558,13 @@
148 goto exit_gracefully;
149 }
150
151- if (skb->ip_summed == CHECKSUM_HW)
152+ if (CHECK_IP_SUMMED(skb->ip_summed))
153 {
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))
158 #else
159- if (skb_checksum_help(&skb,1))
160+ if (SKB_CHECKSUM_HELP(&skb,1))
161 #endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
162 {
163 dev_kfree_skb(skb);
164@@ -569,9 +577,10 @@
165 }
166
167 reset_inject_status(&pBinding->recv_stat);
168- if (skb->mac.raw)
169+
170+ if (CISCOVPN_SKB_MACHEADER(skb))
171 {
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)))
175 {
176 printk(KERN_DEBUG "bad hh len %d\n", hard_header_len);
177@@ -588,7 +597,7 @@
178 switch (hard_header_len)
179 {
180 case ETH_HLEN:
181- CniNewFragment(ETH_HLEN, skb->mac.raw, &MacHdr, CNI_USE_BUFFER);
182+ CniNewFragment(ETH_HLEN, CISCOVPN_SKB_MACHEADER(skb), &MacHdr, CNI_USE_BUFFER);
183 break;
184 case IPPP_MAX_HEADER:
185 case 0:
186@@ -677,14 +686,14 @@
187 tmp_InjectSend = NULL;
188
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))
192 {
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))
199 #else
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)
203 {
204 goto exit_gracefully;
205@@ -692,7 +701,8 @@
206 }
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;
210+
211+ hard_header_len = CISCOVPN_SKB_NETWORKHEADER(skb) - skb->data;
212 pBinding->send_real_hh_len = hard_header_len;
213 switch (hard_header_len)
214 {
215diff -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
218@@ -11,7 +11,7 @@
219 *
220 *
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>
227diff -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
230@@ -5,11 +5,14 @@
231 * File: linuxcniapi.c
232 * Date: 22/03/01
233 *
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>
236+ *
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>
246@@ -292,9 +295,19 @@
247 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
248 {
249 struct timeval timestamp;
250-
251 do_gettimeofday(&timestamp);
252- skb_set_timestamp(skb,&timestamp);
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.
256+ *
257+ * As a proprietary module, we may not use ktime_get_real,
258+ * so we need to do it this way
259+ */
260+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
261+ skb->tstamp = timeval_to_ktime(timestamp);
262+ #else
263+ skb_set_timestamp(skb,&timestamp);
264+ #endif
265 }
266 #else
267 do_gettimeofday(&skb->stamp);
268@@ -328,8 +341,13 @@
269
270 skb->ip_summed = CHECKSUM_UNNECESSARY;
271
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);
277+ #else
278+ skb->nh.iph = (struct iphdr *) skb->data;
279+ skb->mac.raw = pMac;
280+ #endif
281
282 pBinding->recv_stat.called = TRUE;
283
284@@ -441,9 +459,19 @@
285 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
286 {
287 struct timeval timestamp;
288-
289 do_gettimeofday(&timestamp);
290- skb_set_timestamp(skb,&timestamp);
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.
294+ *
295+ * As a proprietary module, we may not use ktime_get_real,
296+ * so we need to do it this way
297+ */
298+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
299+ skb->tstamp = timeval_to_ktime(timestamp);
300+ #else
301+ skb_set_timestamp(skb,&timestamp);
302+ #endif
303 }
304 #else
305 do_gettimeofday(&skb->stamp);
306@@ -451,11 +479,21 @@
307
308 skb->dev = pBinding->pDevice;
309
310- skb->mac.raw = pMac;
311- skb->nh.raw = pIP;
312+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
313+ skb_reset_mac_header(skb);
314+ skb_reset_network_header(skb);
315+ #else
316+ skb->mac.raw = pMac;
317+ skb->nh.raw = pIP;
318+ #endif
319
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);
324+ #else
325+ skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
326+ #endif
327+
328 skb->protocol = htons(ETH_P_IP);
329
330 /* send this packet up the NIC driver */
331diff -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
334@@ -5,6 +5,9 @@
335 * File: linux_os.h
336 * Date: 04/25/2001
337 *
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>
340+*
341 ***************************************************************************
342 *
343 * Macros for handling differences in the linux kernel api.
344@@ -30,6 +33,39 @@
345 #define PACKET_TYPE_NEXT(pt) ((pt)->next)
346 #endif
347
348+/* With linux 2.6.19, CHECKSUM_HW was split into CHECKSUM_COMPLETE
349+ * and CHECKSUM_PARTIAL
350+ */
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))
355+#else
356+ #define CHECK_IP_SUMMED(n) ((n) == CHECKSUM_HW)
357+ #define SKB_CHECKSUM_HELP(a,b) skb_checksum_help((a),(b))
358+#endif
359+
360+
361+/* With linux 2.6.22, the sk_buff struct has changed
362+ */
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))
371+#else
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)
379+#endif
380+
381 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,5)
382 #include <asm/uaccess.h>
383 #else
This page took 0.088924 seconds and 4 git commands to generate.