<< | Thread Index | >> ]    [ << | Date Index | >> ]

Subject: Re: cipe on 2.0.x kernel
From: Stephan von Krawczynski <skraw,AT,ithnet,DOT,com>
Date: Wed, 12 Jun 2002 12:04:24 +0200
In-reply-to: <20020612105747.2e8734d9.skraw@ithnet.com>

Hello Olaf,

regarding this topic, I did the following patch. It compiles cleanly, gives
some weirdos at startup, but seems working. Someone should review that.
As you may notice I just shot down the CSUM stuff for 2.0, which should not
be a problem.

Regards,
Stephan

--- cipe-snapshot-20020506/cipe/cipe.h  Sat Apr  6 22:15:10 2002
+++ cipe-snapshot-20020506-skraw/cipe/cipe.h    Wed Jun 12 11:29:37 2002
@@ -185,6 +185,8 @@
 #endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
 #define LINUX_21
+#else
+#define LINUX_20
 #endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
 #define LINUX_23

--- cipe-snapshot-20020506/cipe/sock.c  Mon Jan  7 21:18:56 2002
+++ cipe-snapshot-20020506-skraw/cipe/sock.c    Wed Jun 12 11:33:30 2002
@@ -416,6 +416,9 @@
        int copied;
        struct sk_buff *skb, *skn;
        int er=0;
+#ifdef LINUX_20
+       int of=0;
+#endif  
        struct sockaddr_in *sin=(struct sockaddr_in *)msg->msg_name;
        SOCKTOC("cipe_recvmsg",sk,c,-ENOSYS);
 
@@ -448,6 +451,9 @@
                   Perhaps it would be better to not correct it so the
                   user level daemon can spot the difference? */
                skb->h.uh->source=c->peerport;
+#ifdef LINUX_20
+                of=skb->data-skb->head+sizeof(struct udphdr);
+#endif
                skb_pull(skb, sizeof(struct udphdr));
                break;
            }
@@ -479,7 +485,11 @@
        if (er<0)
                goto out_free;
 #else
+#ifdef LINUX_20
+        skb_copy_datagram_iovec(skb,of,msg->msg_iov,copied);
+#else
        memcpy_toiovec(msg->msg_iov, skb->data, copied);
+#endif
 #endif
        sk->stamp=skb->stamp;
 

--- cipe-snapshot-20020506/cipe/output.c        Sat Dec 29 21:23:03 2001
+++ cipe-snapshot-20020506-skraw/cipe/output.c  Wed Jun 12 11:30:17 2002
@@ -302,6 +302,7 @@
         /* Encrypted packets are checksummed already, so we can safely
           ignore the UDP checksum. Provide a means to do it nonetheless */
        udph->check  = 0;
+#ifndef LINUX_20
        if (tunnel->flags&CIPF_DO_CSUM) {
            udph->check=csum_tcpudp_magic(
                iph->saddr, iph->daddr,
@@ -310,6 +311,7 @@
            if (!udph->check)
                udph->check=-1;
        }
+#endif
 
         dprintk(DEB_OUT, (KERN_INFO
                           "%s: sending %d from %s:%d to %s:%d\n",
@@ -568,6 +570,8 @@
         /* Encrypted packets are checksummed already, so we can safely
           ignore the UDP checksum. Provide a means to do it nonetheless */
        udph->check  = 0;
+
+#ifndef LINUX_20
        if (c->flags&CIPF_DO_CSUM) {
            udph->check=csum_tcpudp_magic(
                iph->saddr, iph->daddr,
@@ -576,6 +580,7 @@
            if (!udph->check)
                udph->check=-1;
        }
+#endif
 
        skb->ip_hdr             = skb->h.iph;
        skb->protocol           =       htons(ETH_P_IP);





<< | Thread Index | >> ]    [ << | Date Index | >> ]