Gentoo Archives: gentoo-commits

From: "Chris Gianelloni
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-misc/cisco-vpnclient-3des/files: 4.7.00.0640-2.6.22.patch
Date: Fri, 07 Sep 2007 18:38:09
Message-Id: E1ITi6Q-0001jV-0s@stork.gentoo.org
1 wolf31o2 07/09/07 17:58:46
2
3 Added: 4.7.00.0640-2.6.22.patch
4 Log:
5 Added a patch from Antti Mäkelä <zarhan@××××××.fi> for 2.6.22 support. Closing bug #191572.
6 (Portage version: 2.1.3.7)
7
8 Revision Changes Path
9 1.1 net-misc/cisco-vpnclient-3des/files/4.7.00.0640-2.6.22.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/cisco-vpnclient-3des/files/4.7.00.0640-2.6.22.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/cisco-vpnclient-3des/files/4.7.00.0640-2.6.22.patch?rev=1.1&content-type=text/plain
13
14 Index: 4.7.00.0640-2.6.22.patch
15 ===================================================================
16 --- IPSecDrvOS_linux.c 2005-09-14 05:40:56.000000000 +0300
17 +++ IPSecDrvOS_linux.c 2007-07-14 13:25:53.150630303 +0300
18 @@ -11,7 +11,7 @@
19 *
20 *
21 ***************************************************************************/
22 -#include <linux/config.h>
23 +#include <linux/autoconf.h>
24 #include <linux/version.h>
25 #include <linux/vmalloc.h>
26 #include <linux/sched.h>
27 --- frag.c 2005-09-14 05:40:56.000000000 +0300
28 +++ frag.c 2007-07-14 13:25:53.150630303 +0300
29 @@ -1,4 +1,18 @@
30 -#include <linux/config.h>
31 +/**************************************************************************
32 + * Copyright (c) 2001, Cisco Systems, All Rights Reserved
33 + ***************************************************************************
34 + *
35 + * File: frag.c
36 + * Date: 22/03/01
37 + *
38 + * Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
39 + * Alexander Griesser 29/05/07 <cisco@×××××××××.at>
40 + *
41 + ***************************************************************************
42 + * This module does some really cool stuff only Cisco knows about
43 + ***************************************************************************/
44 +
45 +#include <linux/autoconf.h>
46 #include <linux/version.h>
47 #include <linux/netdevice.h>
48 #include <linux/etherdevice.h>
49 @@ -37,9 +51,10 @@
50 int ret=FALSE;
51 struct frag_queue_entry *cur=NULL,*n=NULL,*prev=NULL;
52
53 - id = ntohs(skb->nh.iph->id);
54 + id = ntohs(CISCOVPN_SKB_NH_ID(skb));
55 +
56 /* look for an entry with the same id as this packet*/
57 - if (frag_queue_head && id != ntohs(frag_queue_head->skb->nh.iph->id))
58 + if (frag_queue_head && id != ntohs(CISCOVPN_SKB_NH_ID(frag_queue_head->skb)))
59 {
60 printk(KERN_INFO "%s: incomplete fragment set destroyed",__FUNCTION__);
61 cleanup_frag_queue();
62 @@ -57,10 +72,13 @@
63 cur = frag_queue_head;
64
65 prev = NULL;
66 - skb_offset = ntohs(skb->nh.iph->frag_off) & IP_OFFSET;
67 +
68 + skb_offset = ntohs(CISCOVPN_SKB_NH_FRAGOFF(skb)) & IP_OFFSET;
69 +
70 while (cur)
71 {
72 - cur_offset = ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET;
73 + cur_offset = ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET;
74 +
75 /*sanity check*/
76 if (cur_offset < prev_offset)
77 {
78 @@ -112,8 +130,9 @@
79 goto done_with_tests;
80 }
81 cur = frag_queue_head;
82 +
83 /*first in queue must be first frag.*/
84 - if ((ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET) != 0)
85 + if ((ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET) != 0)
86 {
87 goto done_with_tests;
88 }
89 @@ -121,19 +140,22 @@
90 by comparing adjacent offset values and packet lengths*/
91 while (cur)
92 {
93 - cur_offset = (ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET)*8;
94 - if (cur_offset != prev_end_offset)
95 + cur_offset = (ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET)*8;
96 +
97 + if (cur_offset != prev_end_offset)
98 {
99 goto done_with_tests;
100 }
101 prev = cur;
102 prev_offset = cur_offset;
103 - prev_end_offset = prev_offset + ntohs(prev->skb->nh.iph->tot_len)
104 - - (prev->skb->nh.iph->ihl*4);
105 +
106 + prev_end_offset = prev_offset + ntohs(CISCOVPN_SKB_NH_TOTLEN(prev->skb))
107 + - (CISCOVPN_SKB_NH_IHL(prev->skb)*4);
108 cur = cur->next;
109 }
110 /*last in queue must not have more frags set*/
111 - if (ntohs(prev->skb->nh.iph->frag_off) & IP_MF)
112 +
113 + if (ntohs(CISCOVPN_SKB_NH_FRAGOFF(prev->skb)) & IP_MF)
114 {
115 goto done_with_tests;
116 }
117 @@ -185,10 +207,12 @@
118 /*not an IP packet*/
119 goto done_with_tests;
120 }
121 - iph = skb->nh.iph;
122 +
123 + iph = CISCOVPN_SKB_IPHEADER(skb);
124 +
125 if (!iph)
126 {
127 - printk(KERN_DEBUG "%s: skb->nh is NULL.", __FUNCTION__);
128 + printk(KERN_DEBUG "%s: iph (IP Header) is NULL.", __FUNCTION__);
129 goto done_with_tests;
130 }
131 offset = ntohs(iph->frag_off);
132 --- interceptor.c 2005-09-14 05:40:56.000000000 +0300
133 +++ interceptor.c 2007-07-14 13:25:53.150630303 +0300
134 @@ -5,10 +5,13 @@
135 * File: interceptor.c
136 * Date: 04/10/2001
137 *
138 +* Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
139 +* Alexander Griesser 29/05/07 <cisco@×××××××××.at>
140 +*
141 ***************************************************************************
142 * This module implements the linux driver.
143 ***************************************************************************/
144 -#include <linux/config.h>
145 +#include <linux/autoconf.h>
146 #include <linux/version.h>
147 #include <linux/module.h>
148 #include <linux/init.h>
149 @@ -339,13 +342,18 @@
150
151 dp = NULL;
152 num_target_devices = 0;
153 - for (dp = dev_base; dp != NULL; dp = dp->next)
154 - {
155 +
156 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
157 + for_each_netdev(dp)
158 + #else
159 + for (dp = dev_base; dp != NULL; dp = dp->next)
160 + #endif
161 + {
162 if (add_netdev(dp) == 0)
163 {
164 num_target_devices++;
165 }
166 - }
167 + }
168
169 if (num_target_devices == 0)
170 {
171 @@ -550,13 +558,13 @@
172 goto exit_gracefully;
173 }
174
175 - if (skb->ip_summed == CHECKSUM_HW)
176 + if (CHECK_IP_SUMMED(skb->ip_summed))
177 {
178 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
179 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
180 - if (skb_checksum_help(skb,1))
181 + if (SKB_CHECKSUM_HELP(skb,1))
182 #else
183 - if (skb_checksum_help(&skb,1))
184 + if (SKB_CHECKSUM_HELP(&skb,1))
185 #endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
186 {
187 dev_kfree_skb(skb);
188 @@ -569,9 +577,10 @@
189 }
190
191 reset_inject_status(&pBinding->recv_stat);
192 - if (skb->mac.raw)
193 +
194 + if (CISCOVPN_SKB_MACHEADER(skb))
195 {
196 - hard_header_len = skb->data - skb->mac.raw;
197 + hard_header_len = skb->data - CISCOVPN_SKB_MACHEADER(skb);
198 if ((hard_header_len < 0) || (hard_header_len > skb_headroom(skb)))
199 {
200 printk(KERN_DEBUG "bad hh len %d\n", hard_header_len);
201 @@ -588,7 +597,7 @@
202 switch (hard_header_len)
203 {
204 case ETH_HLEN:
205 - CniNewFragment(ETH_HLEN, skb->mac.raw, &MacHdr, CNI_USE_BUFFER);
206 + CniNewFragment(ETH_HLEN, CISCOVPN_SKB_MACHEADER(skb), &MacHdr, CNI_USE_BUFFER);
207 break;
208 case IPPP_MAX_HEADER:
209 case 0:
210 @@ -677,14 +686,14 @@
211 tmp_InjectSend = NULL;
212
213 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
214 - if (skb->ip_summed == CHECKSUM_HW)
215 + if (CHECK_IP_SUMMED(skb->ip_summed))
216 {
217 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
218 - if (skb_checksum_help(skb,0))
219 + if (SKB_CHECKSUM_HELP(skb,0))
220 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
221 - if (skb_checksum_help(&skb,0))
222 + if (SKB_CHECKSUM_HELP(&skb,0))
223 #else
224 - if ((skb = skb_checksum_help(skb)) == NULL)
225 + if ((skb = SKB_CHECKSUM_HELP(skb)) == NULL)
226 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
227 {
228 goto exit_gracefully;
229 @@ -692,7 +701,8 @@
230 }
231 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
232 reset_inject_status(&pBinding->send_stat);
233 - hard_header_len = skb->nh.raw - skb->data;
234 +
235 + hard_header_len = CISCOVPN_SKB_NETWORKHEADER(skb) - skb->data;
236 pBinding->send_real_hh_len = hard_header_len;
237 switch (hard_header_len)
238 {
239 --- linux_os.h 2005-09-14 05:40:56.000000000 +0300
240 +++ linux_os.h 2007-07-14 13:25:53.150630303 +0300
241 @@ -5,6 +5,9 @@
242 * File: linux_os.h
243 * Date: 04/25/2001
244 *
245 +* Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
246 +* Alexander Griesser 29/05/07 <cisco@×××××××××.at>
247 +*
248 ***************************************************************************
249 *
250 * Macros for handling differences in the linux kernel api.
251 @@ -30,6 +33,39 @@
252 #define PACKET_TYPE_NEXT(pt) ((pt)->next)
253 #endif
254
255 +/* With linux 2.6.19, CHECKSUM_HW was split into CHECKSUM_COMPLETE
256 + * and CHECKSUM_PARTIAL
257 + */
258 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
259 + #define CHECK_IP_SUMMED(n) \
260 + (((n) == CHECKSUM_COMPLETE) || ((n) == CHECKSUM_PARTIAL))
261 + #define SKB_CHECKSUM_HELP(a,b) skb_checksum_help((a))
262 +#else
263 + #define CHECK_IP_SUMMED(n) ((n) == CHECKSUM_HW)
264 + #define SKB_CHECKSUM_HELP(a,b) skb_checksum_help((a),(b))
265 +#endif
266 +
267 +
268 +/* With linux 2.6.22, the sk_buff struct has changed
269 + */
270 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
271 + #define CISCOVPN_SKB_NH_ID(a) (ip_hdr(a)->id)
272 + #define CISCOVPN_SKB_NH_FRAGOFF(a) (ip_hdr(a)->frag_off)
273 + #define CISCOVPN_SKB_NH_TOTLEN(a) (ip_hdr(a)->tot_len)
274 + #define CISCOVPN_SKB_NH_IHL(a) (ip_hdr(a)->ihl)
275 + #define CISCOVPN_SKB_IPHEADER(a) (ip_hdr(a))
276 + #define CISCOVPN_SKB_MACHEADER(a) (skb_mac_header(a))
277 + #define CISCOVPN_SKB_NETWORKHEADER(a) (skb_network_header(a))
278 +#else
279 + #define CISCOVPN_SKB_NH_ID(a) (a->nh.iph->id)
280 + #define CISCOVPN_SKB_NH_FRAGOFF(a) (a->nh.iph->frag_off)
281 + #define CISCOVPN_SKB_NH_TOTLEN(a) (a->nh.iph->tot_len)
282 + #define CISCOVPN_SKB_NH_IHL(a) (a->nh.iph->ihl)
283 + #define CISCOVPN_SKB_IPHEADER(a) (a->nh.iph)
284 + #define CISCOVPN_SKB_MACHEADER(a) (a->mac.raw)
285 + #define CISCOVPN_SKB_NETWORKHEADER(a) (a->nh.raw)
286 +#endif
287 +
288 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,5)
289 #include <asm/uaccess.h>
290 #else
291 --- linuxcniapi.c 2007-07-14 13:31:21.152541062 +0300
292 +++ linuxcniapi.c 2007-07-14 13:29:40.151949943 +0300
293 @@ -5,11 +5,14 @@
294 * File: linuxcniapi.c
295 * Date: 22/03/01
296 *
297 + * Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
298 + * Alexander Griesser 29/05/07 <cisco@×××××××××.at>
299 + *
300 ***************************************************************************
301 * This module implements a translation layer between the CNI API and the
302 * Linux Interceptor driver.
303 ***************************************************************************/
304 -#include <linux/config.h>
305 +#include <linux/autoconf.h>
306 #include <linux/version.h>
307 #include <linux/netdevice.h>
308 #include <linux/if.h>
309 @@ -291,7 +294,11 @@
310 }
311 /* move the data into the packet */
312 do_gettimeofday(&stamp);
313 - skb_set_timestamp(skb, &stamp);
314 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
315 + skb->tstamp = timeval_to_ktime(stamp);
316 + #else
317 + skb_set_timestamp(skb,&stamp);
318 + #endif
319
320 pIP = skb_put(skb, lpPacketDescriptor->uiPacketSize);
321
322 @@ -321,8 +328,13 @@
323
324 skb->ip_summed = CHECKSUM_UNNECESSARY;
325
326 - skb->nh.iph = (struct iphdr *) skb->data;
327 - skb->mac.raw = pMac;
328 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
329 + skb_reset_network_header(skb);
330 + skb_reset_mac_header(skb);
331 + #else
332 + skb->nh.iph = (struct iphdr *) skb->data;
333 + skb->mac.raw = pMac;
334 + #endif
335
336 pBinding->recv_stat.called = TRUE;
337
338 @@ -433,15 +445,29 @@
339
340 /* put the mac header on */
341 do_gettimeofday(&stamp);
342 - skb_set_timestamp(skb, &stamp);
343 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
344 + skb->tstamp = timeval_to_ktime(stamp);
345 + #else
346 + skb_set_timestamp(skb,&stamp);
347 + #endif
348
349 skb->dev = pBinding->pDevice;
350
351 - skb->mac.raw = pMac;
352 - skb->nh.raw = pIP;
353 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
354 + skb_reset_mac_header(skb);
355 + skb_reset_network_header(skb);
356 + #else
357 + skb->mac.raw = pMac;
358 + skb->nh.raw = pIP;
359 + #endif
360
361 /*ip header length is in 32bit words */
362 - skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
363 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
364 + skb->transport_header = skb->network_header + (ip_hdr(skb)->ihl * 4);
365 + #else
366 + skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
367 + #endif
368 +
369 skb->protocol = htons(ETH_P_IP);
370
371 /* send this packet up the NIC driver */
372
373
374
375 --
376 gentoo-commits@g.o mailing list