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

Collapse All | Expand All

(-)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>
(-)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);
(-)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
    {
(-)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
(-)linuxcniapi.c (-8 / +34 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 291-297 Link Here
291
    }
294
    }
292
    /* move the data into the packet */
295
    /* move the data into the packet */
293
    do_gettimeofday(&stamp);
296
    do_gettimeofday(&stamp);
294
    skb_set_timestamp(skb, &stamp);
297
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
298
        skb->tstamp = timeval_to_ktime(stamp);
299
    #else
300
            skb_set_timestamp(skb,&stamp);
301
    #endif
295
302
296
    pIP = skb_put(skb, lpPacketDescriptor->uiPacketSize);
303
    pIP = skb_put(skb, lpPacketDescriptor->uiPacketSize);
297
304
Lines 321-328 Link Here
321
328
322
    skb->ip_summed = CHECKSUM_UNNECESSARY;
329
    skb->ip_summed = CHECKSUM_UNNECESSARY;
323
330
324
    skb->nh.iph = (struct iphdr *) skb->data;
331
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
325
    skb->mac.raw = pMac;
332
      skb_reset_network_header(skb);
333
      skb_reset_mac_header(skb);
334
    #else
335
      skb->nh.iph = (struct iphdr *) skb->data;
336
      skb->mac.raw = pMac;
337
    #endif
326
338
327
    pBinding->recv_stat.called = TRUE;
339
    pBinding->recv_stat.called = TRUE;
328
340
Lines 433-447 Link Here
433
445
434
    /* put the mac header on */
446
    /* put the mac header on */
435
    do_gettimeofday(&stamp);
447
    do_gettimeofday(&stamp);
436
    skb_set_timestamp(skb, &stamp);
448
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
449
        skb->tstamp = timeval_to_ktime(stamp);
450
    #else
451
        skb_set_timestamp(skb,&stamp);
452
    #endif
437
453
438
    skb->dev = pBinding->pDevice;
454
    skb->dev = pBinding->pDevice;
439
455
440
    skb->mac.raw = pMac;
456
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
441
    skb->nh.raw = pIP;
457
      skb_reset_mac_header(skb);
458
      skb_reset_network_header(skb);
459
    #else
460
      skb->mac.raw = pMac;
461
      skb->nh.raw = pIP;
462
    #endif
442
463
443
    /*ip header length is in 32bit words */
464
    /*ip header length is in 32bit words */
444
    skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
465
    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
466
      skb->transport_header = skb->network_header + (ip_hdr(skb)->ihl * 4);
467
    #else
468
      skb->h.raw = pIP + (skb->nh.iph->ihl * 4);
469
    #endif
470
445
    skb->protocol = htons(ETH_P_IP);
471
    skb->protocol = htons(ETH_P_IP);
446
472
447
    /* send this packet up the NIC driver */
473
    /* send this packet up the NIC driver */

Return to bug 183713