Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 182755 | Differences between
and this patch

Collapse All | Expand All

(-)vpnclient.orig/frag.c (-13 / +37 lines)
Lines 1-4 Link Here
1
#include <linux/config.h>
1
/**************************************************************************
2
 *           Copyright (c) 2001, Cisco Systems, All Rights Reserved
3
 ***************************************************************************
4
 *
5
 *  File:    frag.c
6
 *  Date:    22/03/01
7
 *
8
 *  Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
9
 *  Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
10
 *
11
 ***************************************************************************
12
 * This module does some really cool stuff only Cisco knows about
13
 ***************************************************************************/
14
15
#include <linux/autoconf.h>
2
#include <linux/version.h>
16
#include <linux/version.h>
3
#include <linux/netdevice.h>
17
#include <linux/netdevice.h>
4
#include <linux/etherdevice.h>
18
#include <linux/etherdevice.h>
Lines 37-45 Link Here
37
    int ret=FALSE;
51
    int ret=FALSE;
38
    struct frag_queue_entry *cur=NULL,*n=NULL,*prev=NULL;
52
    struct frag_queue_entry *cur=NULL,*n=NULL,*prev=NULL;
39
53
40
    id = ntohs(skb->nh.iph->id);
54
    id = ntohs(CISCOVPN_SKB_NH_ID(skb));
55
41
    /* look for an entry with the same id as this packet*/
56
    /* look for an entry with the same id as this packet*/
42
    if (frag_queue_head && id != ntohs(frag_queue_head->skb->nh.iph->id))
57
    if (frag_queue_head && id != ntohs(CISCOVPN_SKB_NH_ID(frag_queue_head->skb)))
43
    {
58
    {
44
        printk(KERN_INFO "%s: incomplete fragment set destroyed",__FUNCTION__);
59
        printk(KERN_INFO "%s: incomplete fragment set destroyed",__FUNCTION__);
45
        cleanup_frag_queue();
60
        cleanup_frag_queue();
Lines 57-66 Link Here
57
    cur = frag_queue_head;
72
    cur = frag_queue_head;
58
73
59
    prev = NULL;
74
    prev = NULL;
60
    skb_offset = ntohs(skb->nh.iph->frag_off) & IP_OFFSET;
75
76
    skb_offset = ntohs(CISCOVPN_SKB_NH_FRAGOFF(skb)) & IP_OFFSET;
77
61
    while (cur)
78
    while (cur)
62
    {
79
    {
63
        cur_offset = ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET;
80
        cur_offset = ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET;
81
64
        /*sanity check*/
82
        /*sanity check*/
65
        if (cur_offset < prev_offset)
83
        if (cur_offset < prev_offset)
66
        {
84
        {
Lines 112-119 Link Here
112
        goto done_with_tests;
130
        goto done_with_tests;
113
    }
131
    }
114
    cur = frag_queue_head;
132
    cur = frag_queue_head;
133
115
    /*first in queue must be first frag.*/
134
    /*first in queue must be first frag.*/
116
    if ((ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET) != 0)
135
    if ((ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET) != 0)
117
    {
136
    {
118
        goto done_with_tests;
137
        goto done_with_tests;
119
    }
138
    }
Lines 121-139 Link Here
121
       by comparing adjacent offset values and packet lengths*/
140
       by comparing adjacent offset values and packet lengths*/
122
    while (cur)
141
    while (cur)
123
    {
142
    {
124
        cur_offset = (ntohs(cur->skb->nh.iph->frag_off) & IP_OFFSET)*8;
143
	cur_offset = (ntohs(CISCOVPN_SKB_NH_FRAGOFF(cur->skb)) & IP_OFFSET)*8;
125
        if (cur_offset != prev_end_offset)
144
145
	if (cur_offset != prev_end_offset)
126
        { 
146
        { 
127
            goto done_with_tests;
147
            goto done_with_tests;
128
        }
148
        }
129
        prev = cur;
149
        prev = cur;
130
        prev_offset = cur_offset;
150
        prev_offset = cur_offset;
131
        prev_end_offset = prev_offset + ntohs(prev->skb->nh.iph->tot_len)
151
132
                          - (prev->skb->nh.iph->ihl*4);
152
        prev_end_offset = prev_offset + ntohs(CISCOVPN_SKB_NH_TOTLEN(prev->skb))
153
	                  - (CISCOVPN_SKB_NH_IHL(prev->skb)*4);
133
        cur = cur->next;
154
        cur = cur->next;
134
    } 
155
    } 
135
    /*last in queue must not have more frags set*/
156
    /*last in queue must not have more frags set*/
136
    if (ntohs(prev->skb->nh.iph->frag_off) & IP_MF)
157
158
    if (ntohs(CISCOVPN_SKB_NH_FRAGOFF(prev->skb)) & IP_MF)
137
    {
159
    {
138
        goto done_with_tests;
160
        goto done_with_tests;
139
    }
161
    }
Lines 185-194 Link Here
185
        /*not an IP packet*/
207
        /*not an IP packet*/
186
        goto done_with_tests;
208
        goto done_with_tests;
187
    }
209
    }
188
    iph = skb->nh.iph;
210
211
    iph = CISCOVPN_SKB_IPHEADER(skb);
212
189
    if (!iph)
213
    if (!iph)
190
    {
214
    {
191
        printk(KERN_DEBUG "%s: skb->nh is NULL.", __FUNCTION__);
215
        printk(KERN_DEBUG "%s: iph (IP Header) is NULL.", __FUNCTION__);
192
        goto done_with_tests;
216
        goto done_with_tests;
193
    }
217
    }
194
    offset = ntohs(iph->frag_off);
218
    offset = ntohs(iph->frag_off);
(-)vpnclient.orig/interceptor.c (-15 / +25 lines)
Lines 5-14 Link Here
5
*  File:    interceptor.c
5
*  File:    interceptor.c
6
*  Date:    04/10/2001
6
*  Date:    04/10/2001
7
*
7
*
8
*  Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
9
*  Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
10
*
8
***************************************************************************
11
***************************************************************************
9
* This module implements the linux driver.
12
* This module implements the linux driver.
10
***************************************************************************/
13
***************************************************************************/
11
#include <linux/config.h>
14
#include <linux/autoconf.h>
12
#include <linux/version.h>
15
#include <linux/version.h>
13
#include <linux/module.h>
16
#include <linux/module.h>
14
#include <linux/init.h>
17
#include <linux/init.h>
Lines 339-351 Link Here
339
342
340
    dp = NULL;
343
    dp = NULL;
341
    num_target_devices = 0;
344
    num_target_devices = 0;
342
    for (dp = dev_base; dp != NULL; dp = dp->next)
345
343
    {
346
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
347
      for_each_netdev(dp)
348
    #else
349
      for (dp = dev_base; dp != NULL; dp = dp->next)
350
    #endif
351
      {
344
        if (add_netdev(dp) == 0)
352
        if (add_netdev(dp) == 0)
345
        {
353
        {
346
            num_target_devices++;
354
            num_target_devices++;
347
        }
355
        }
348
    }
356
      }
349
357
350
    if (num_target_devices == 0)
358
    if (num_target_devices == 0)
351
    {
359
    {
Lines 550-562 Link Here
550
        goto exit_gracefully;
558
        goto exit_gracefully;
551
    }
559
    }
552
560
553
    if (skb->ip_summed == CHECKSUM_HW)
561
    if (CHECK_IP_SUMMED(skb->ip_summed))
554
    {
562
    {
555
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
563
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
556
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
564
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
557
       if (skb_checksum_help(skb,1))
565
       if (SKB_CHECKSUM_HELP(skb,1))
558
#else
566
#else
559
       if (skb_checksum_help(&skb,1))
567
       if (SKB_CHECKSUM_HELP(&skb,1))
560
#endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
568
#endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
561
       {
569
       {
562
           dev_kfree_skb(skb);
570
           dev_kfree_skb(skb);
Lines 569-577 Link Here
569
    }
577
    }
570
578
571
    reset_inject_status(&pBinding->recv_stat);
579
    reset_inject_status(&pBinding->recv_stat);
572
    if (skb->mac.raw)
580
581
    if (CISCOVPN_SKB_MACHEADER(skb))
573
    {
582
    {
574
        hard_header_len = skb->data - skb->mac.raw;
583
        hard_header_len = skb->data - CISCOVPN_SKB_MACHEADER(skb);
575
        if ((hard_header_len < 0) || (hard_header_len > skb_headroom(skb)))
584
        if ((hard_header_len < 0) || (hard_header_len > skb_headroom(skb)))
576
        {
585
        {
577
            printk(KERN_DEBUG "bad hh len %d\n", hard_header_len);
586
            printk(KERN_DEBUG "bad hh len %d\n", hard_header_len);
Lines 588-594 Link Here
588
    switch (hard_header_len)
597
    switch (hard_header_len)
589
    {
598
    {
590
    case ETH_HLEN:
599
    case ETH_HLEN:
591
        CniNewFragment(ETH_HLEN, skb->mac.raw, &MacHdr, CNI_USE_BUFFER);
600
        CniNewFragment(ETH_HLEN, CISCOVPN_SKB_MACHEADER(skb), &MacHdr, CNI_USE_BUFFER);
592
        break;
601
        break;
593
    case IPPP_MAX_HEADER:
602
    case IPPP_MAX_HEADER:
594
    case 0:
603
    case 0:
Lines 677-690 Link Here
677
    tmp_InjectSend = NULL;
686
    tmp_InjectSend = NULL;
678
687
679
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
688
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
680
    if (skb->ip_summed == CHECKSUM_HW)
689
    if (CHECK_IP_SUMMED(skb->ip_summed))
681
    {
690
    {
682
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
691
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
683
       if (skb_checksum_help(skb,0))
692
       if (SKB_CHECKSUM_HELP(skb,0))
684
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
693
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
685
       if (skb_checksum_help(&skb,0))
694
       if (SKB_CHECKSUM_HELP(&skb,0))
686
#else
695
#else
687
       if ((skb = skb_checksum_help(skb)) == NULL)
696
       if ((skb = SKB_CHECKSUM_HELP(skb)) == NULL)
688
#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
697
#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7)
689
       {
698
       {
690
           goto exit_gracefully;
699
           goto exit_gracefully;
Lines 692-698 Link Here
692
    }
701
    }
693
#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
702
#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
694
    reset_inject_status(&pBinding->send_stat);
703
    reset_inject_status(&pBinding->send_stat);
695
    hard_header_len = skb->nh.raw - skb->data;
704
705
    hard_header_len = CISCOVPN_SKB_NETWORKHEADER(skb) - skb->data;
696
    pBinding->send_real_hh_len = hard_header_len;
706
    pBinding->send_real_hh_len = hard_header_len;
697
    switch (hard_header_len)
707
    switch (hard_header_len)
698
    {
708
    {
(-)vpnclient.orig/IPSecDrvOS_linux.c (-1 / +1 lines)
Lines 11-17 Link Here
11
*   
11
*   
12
*
12
*
13
***************************************************************************/
13
***************************************************************************/
14
#include <linux/config.h>
14
#include <linux/autoconf.h>
15
#include <linux/version.h>
15
#include <linux/version.h>
16
#include <linux/vmalloc.h>
16
#include <linux/vmalloc.h>
17
#include <linux/sched.h>
17
#include <linux/sched.h>
(-)vpnclient.orig/linuxcniapi.c (-10 / +48 lines)
Lines 5-15 Link Here
5
 *  File:    linuxcniapi.c
5
 *  File:    linuxcniapi.c
6
 *  Date:    22/03/01
6
 *  Date:    22/03/01
7
 *
7
 *
8
 *  Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
9
 *  Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
10
 *
8
 ***************************************************************************
11
 ***************************************************************************
9
 * This module implements a translation layer between the CNI API and the
12
 * This module implements a translation layer between the CNI API and the
10
 * Linux Interceptor driver.
13
 * Linux Interceptor driver.
11
 ***************************************************************************/
14
 ***************************************************************************/
12
#include <linux/config.h>
15
#include <linux/autoconf.h>
13
#include <linux/version.h>
16
#include <linux/version.h>
14
#include <linux/netdevice.h>
17
#include <linux/netdevice.h>
15
#include <linux/if.h>
18
#include <linux/if.h>
Lines 292-300 Link Here
292
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
295
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
293
    {
296
    {
294
        struct timeval timestamp;
297
        struct timeval timestamp;
295
296
        do_gettimeofday(&timestamp);
298
        do_gettimeofday(&timestamp);
297
        skb_set_timestamp(skb,&timestamp);
299
	/* With Linux 2.6.22 skb_set_timestamp has been dropped.
300
	 * Additionally, the attribute tstamp now is in ktime_t
301
	 * where it prior to 2.6.22 was in skb_timeval.
302
	 *
303
	 * As a proprietary module, we may not use ktime_get_real,
304
	 * so we need to do it this way
305
	 */
306
	#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
307
          skb->tstamp = timeval_to_ktime(timestamp);
308
	#else
309
          skb_set_timestamp(skb,&timestamp);
310
	#endif
298
    }
311
    }
299
#else
312
#else
300
    do_gettimeofday(&skb->stamp);
313
    do_gettimeofday(&skb->stamp);
Lines 328-335 Link Here
328
341
329
    skb->ip_summed = CHECKSUM_UNNECESSARY;
342
    skb->ip_summed = CHECKSUM_UNNECESSARY;
330
343
331
    skb->nh.iph = (struct iphdr *) skb->data;
344
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
332
    skb->mac.raw = pMac;
345
      skb_reset_network_header(skb);
346
      skb_reset_mac_header(skb);
347
    #else
348
      skb->nh.iph = (struct iphdr *) skb->data;
349
      skb->mac.raw = pMac;
350
    #endif
333
351
334
    pBinding->recv_stat.called = TRUE;
352
    pBinding->recv_stat.called = TRUE;
335
353
Lines 441-449 Link Here
441
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
459
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
442
    {
460
    {
443
        struct timeval timestamp;
461
        struct timeval timestamp;
444
445
        do_gettimeofday(&timestamp);
462
        do_gettimeofday(&timestamp);
446
        skb_set_timestamp(skb,&timestamp);
463
        /* With Linux 2.6.22 skb_set_timestamp has been dropped.
464
         * Additionally, the attribute tstamp now is in ktime_t
465
         * where it prior to 2.6.22 was in skb_timeval.
466
         *
467
         * As a proprietary module, we may not use ktime_get_real,
468
         * so we need to do it this way
469
         */
470
        #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
471
          skb->tstamp = timeval_to_ktime(timestamp);
472
        #else
473
          skb_set_timestamp(skb,&timestamp);
474
        #endif
447
    }
475
    }
448
#else
476
#else
449
    do_gettimeofday(&skb->stamp);
477
    do_gettimeofday(&skb->stamp);
Lines 451-461 Link Here
451
479
452
    skb->dev = pBinding->pDevice;
480
    skb->dev = pBinding->pDevice;
453
481
454
    skb->mac.raw = pMac;
482
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
455
    skb->nh.raw = pIP;
483
      skb_reset_mac_header(skb);
484
      skb_reset_network_header(skb);
485
    #else
486
      skb->mac.raw = pMac;
487
      skb->nh.raw = pIP;
488
    #endif
456
489
457
    /*ip header length is in 32bit words */
490
    /*ip header length is in 32bit words */
458
    skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
491
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
492
      skb->transport_header = skb->network_header + (ip_hdr(skb)->ihl * 4);
493
    #else
494
      skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
495
    #endif
496
459
    skb->protocol = htons(ETH_P_IP);
497
    skb->protocol = htons(ETH_P_IP);
460
498
461
    /* send this packet up the NIC driver */
499
    /* send this packet up the NIC driver */
(-)vpnclient.orig/linux_os.h (+36 lines)
Lines 5-10 Link Here
5
*  File:    linux_os.h
5
*  File:    linux_os.h
6
*  Date:    04/25/2001
6
*  Date:    04/25/2001
7
*
7
*
8
*  Updated to work with Linux kernels >=2.6.19 (including 2.6.22) by
9
*  Alexander Griesser 29/05/07 <cisco@tuxx-home.at>
10
*
8
***************************************************************************
11
***************************************************************************
9
*
12
*
10
* Macros for handling differences in the linux kernel api.
13
* Macros for handling differences in the linux kernel api.
Lines 30-35 Link Here
30
#define PACKET_TYPE_NEXT(pt) ((pt)->next)
33
#define PACKET_TYPE_NEXT(pt) ((pt)->next)
31
#endif
34
#endif
32
35
36
/* With linux 2.6.19, CHECKSUM_HW was split into CHECKSUM_COMPLETE
37
 * and CHECKSUM_PARTIAL
38
 */
39
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
40
  #define CHECK_IP_SUMMED(n) \
41
    (((n) == CHECKSUM_COMPLETE) || ((n) == CHECKSUM_PARTIAL))
42
  #define SKB_CHECKSUM_HELP(a,b)        skb_checksum_help((a))
43
#else
44
  #define CHECK_IP_SUMMED(n) ((n) == CHECKSUM_HW)
45
  #define SKB_CHECKSUM_HELP(a,b)        skb_checksum_help((a),(b))
46
#endif
47
48
49
/* With linux 2.6.22, the sk_buff struct has changed
50
 */
51
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
52
  #define CISCOVPN_SKB_NH_ID(a)           (ip_hdr(a)->id)
53
  #define CISCOVPN_SKB_NH_FRAGOFF(a)      (ip_hdr(a)->frag_off)
54
  #define CISCOVPN_SKB_NH_TOTLEN(a)       (ip_hdr(a)->tot_len)
55
  #define CISCOVPN_SKB_NH_IHL(a)          (ip_hdr(a)->ihl)
56
  #define CISCOVPN_SKB_IPHEADER(a)        (ip_hdr(a))
57
  #define CISCOVPN_SKB_MACHEADER(a)       (skb_mac_header(a))
58
  #define CISCOVPN_SKB_NETWORKHEADER(a)   (skb_network_header(a))
59
#else
60
  #define CISCOVPN_SKB_NH_ID(a)           (a->nh.iph->id)
61
  #define CISCOVPN_SKB_NH_FRAGOFF(a)      (a->nh.iph->frag_off)
62
  #define CISCOVPN_SKB_NH_TOTLEN(a)       (a->nh.iph->tot_len)
63
  #define CISCOVPN_SKB_NH_IHL(a)          (a->nh.iph->ihl)
64
  #define CISCOVPN_SKB_IPHEADER(a)        (a->nh.iph)
65
  #define CISCOVPN_SKB_MACHEADER(a)       (a->mac.raw)
66
  #define CISCOVPN_SKB_NETWORKHEADER(a)   (a->nh.raw)
67
#endif
68
33
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,5)
69
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,5)
34
#include <asm/uaccess.h>
70
#include <asm/uaccess.h>
35
#else
71
#else

Return to bug 182755