Cipe (oops forgot the patch earlier)

From: Trever Adams (trever_Adams@bigfoot.com)
Date: Thu Mar 02 2000 - 19:58:15 EST


Here is the patch I was asking for help on.

Trever

P.S. Remember, no crypto here; you will need the entire package for
that.

-- 
For the finest in family and value oriented products:
http://www.daysofyore.com

diff -ur cipe-1.3.0/Makefile cipe-1.3.1/Makefile --- cipe-1.3.0/Makefile Thu Mar 2 13:39:11 2000 +++ cipe-1.3.1/Makefile Thu Mar 2 13:41:15 2000 @@ -14,7 +14,7 @@ SRC= . VERSION=1.3.0 -BUILD= 2.2.13-i386-cb +BUILD= 2.3.48-i386-cb CC= gcc TEXINFO=tex MAKEINFO=makeinfo diff -ur cipe-1.3.0/cipe.h cipe-1.3.1/cipe.h --- cipe-1.3.0/cipe.h Tue Nov 2 18:52:55 1999 +++ cipe-1.3.1/cipe.h Tue Nov 2 18:46:40 1999 @@ -134,6 +134,17 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) #define LINUX_21 #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) +#define LINUX_23 +#endif + +/* Kernel Include (device verses net_device cleanup) */ +#ifdef LINUX_23 +#define NET_DEVICE net_device +#else +#define NET_DEVICE device +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,127) #define timeout_t unsigned long @@ -161,7 +172,7 @@ #define CIPE_MAGIC (htonl(0x43495045)) struct cipe { __u32 magic; - struct device *dev; + struct NET_DEVICE *dev; /* Set by user process */ __u32 peeraddr; __u32 myaddr; @@ -220,7 +231,7 @@ struct cipe_ctrl { char name[16]; struct cipe cipe; - struct device dev; + struct NET_DEVICE dev; }; extern struct cipe_ctrl **cipe_ctrls; @@ -267,13 +278,13 @@ extern void cipe_prnpad(unsigned char *buf, int len); extern void cipe_close(struct cipe *c); /* sock.c */ -extern int cipe_attach(struct device *dev, struct siocsifcipatt *parm); +extern int cipe_attach(struct NET_DEVICE *dev, struct siocsifcipatt *parm); void cipe_fakenkey(struct cipe *c, char typ); /* output.c */ #ifdef DEBUG void cipe_dump_packet(char *title, struct sk_buff *skb); #endif -extern int cipe_xmit(struct sk_buff *skb, struct device *dev); +extern int cipe_xmit(struct sk_buff *skb, struct NET_DEVICE *dev); /* encaps.c */ extern void cipe_encrypt(struct cipe *c, unsigned char *buf, int *len, int typcode); diff -ur cipe-1.3.0/config.log cipe-1.3.1/config.log --- cipe-1.3.0/config.log Thu Mar 2 13:39:11 2000 +++ cipe-1.3.1/config.log Thu Mar 2 19:49:08 2000 @@ -1,13 +1,15 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -configure:556: checking for gcc -configure:669: checking whether the C compiler (gcc ) works -configure:685: gcc -o conftest conftest.c 1>&5 -configure:711: checking whether the C compiler (gcc ) is a cross-compiler -configure:716: checking whether we are using GNU C -configure:744: checking whether gcc accepts -g -configure:777: checking how to run the C preprocessor -configure:861: checking for texinfo -configure:896: checking for makeinfo -configure:969: checking for kernel version +configure:552: checking for gcc +configure:665: checking whether the C compiler (gcc ) works +configure:681: gcc -o conftest conftest.c 1>&5 +configure:707: checking whether the C compiler (gcc ) is a cross-compiler +configure:712: checking whether we are using GNU C +configure:740: checking whether gcc accepts -g +configure:773: checking how to run the C preprocessor +configure:857: checking for texinfo +configure:892: checking for makeinfo +configure:965: checking for kernel version +configure:974: checking for architecture +configure:979: checking for SMP diff -ur cipe-1.3.0/config.status cipe-1.3.1/config.status --- cipe-1.3.0/config.status Thu Nov 4 01:17:39 1999 +++ cipe-1.3.1/config.status Thu Mar 2 13:41:15 2000 @@ -27,7 +27,7 @@ ac_given_srcdir=. -trap 'rm -fr Makefile 2.2.13-i386-cb/Makefile 2.2.13-i386-cb/config.h conftest*; exit 1' 1 2 15 +trap 'rm -fr Makefile 2.3.48-i386-cb/Makefile 2.3.48-i386-cb/config.h conftest*; exit 1' 1 2 15 # Protect against being on the right side of a sed subst in config.status. sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; @@ -74,7 +74,7 @@ s%@ULIBS@%%g s%@KSRC@%/usr/src/linux%g s%@KINC@%/usr/src/linux/include%g -s%@KVERS@%2.2.13%g +s%@KVERS@%2.3.48%g s%@VERS@%3%g s%@CRYPTO@%Blowfish%g s%@MODULE@%cipcb.o%g @@ -83,7 +83,7 @@ s%@CCOBJS@%%g s%@CRCOBJS@%crc32.o%g s%@CRC32OBJS@%%g -s%@BUILD@%2.2.13-i386-cb%g +s%@BUILD@%2.3.48-i386-cb%g CEOF @@ -119,7 +119,7 @@ ac_sed_cmds=cat fi -CONFIG_FILES=${CONFIG_FILES-"Makefile:conf/Makefile-top.in 2.2.13-i386-cb/Makefile:conf/Makefile-obj.in"} +CONFIG_FILES=${CONFIG_FILES-"Makefile:conf/Makefile-top.in 2.3.48-i386-cb/Makefile:conf/Makefile-obj.in"} for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in @@ -191,7 +191,7 @@ ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then - CONFIG_HEADERS="2.2.13-i386-cb/config.h:conf/config.h.in" + CONFIG_HEADERS="2.3.48-i386-cb/config.h:conf/config.h.in" fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". diff -ur cipe-1.3.0/configure cipe-1.3.1/configure --- cipe-1.3.0/configure Mon Jun 14 17:09:31 1999 +++ cipe-1.3.1/configure Thu Mar 2 19:47:31 2000 @@ -2,10 +2,6 @@ # From configure.in Id: configure.in - - - - # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. @@ -546,13 +542,13 @@ -VERSION=1.3.0 +VERSION=1.3.1 SRC=. # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:556: checking for $ac_word" >&5 +echo "configure:552: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -582,7 +578,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:586: checking for $ac_word" >&5 +echo "configure:582: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -633,7 +629,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:637: checking for $ac_word" >&5 +echo "configure:633: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -665,7 +661,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:669: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:665: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -676,12 +672,12 @@ cat > conftest.$ac_ext << EOF -#line 680 "configure" +#line 676 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -707,12 +703,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:711: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:707: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:716: checking whether we are using GNU C" >&5 +echo "configure:712: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -721,7 +717,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:721: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -740,7 +736,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:744: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:740: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -773,7 +769,7 @@ test "$GCC" || { echo "configure: error: You would not have much luck compiling kernel code with non-gcc..." 1>&2; exit 1; } echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:777: checking how to run the C preprocessor" >&5 +echo "configure:773: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -788,13 +784,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 792 "configure" +#line 788 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:798: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:794: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -805,13 +801,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 809 "configure" +#line 805 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:815: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -822,13 +818,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 826 "configure" +#line 822 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:832: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:828: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -857,7 +853,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:861: checking for $ac_word" >&5 +echo "configure:857: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_TEXINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -892,7 +888,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:896: checking for $ac_word" >&5 +echo "configure:892: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -965,50 +961,37 @@ echo $ac_n "checking for kernel version""... $ac_c" 1>&6 -echo "configure:969: checking for kernel version" >&5 +echo "configure:965: checking for kernel version" >&5 KVERS=`sed -n 's:^#define *UTS_RELEASE *\"\([^"]*\).*$:\1:p' $KINC/linux/version.h` echo "$ac_t""$KVERS" 1>&6 case "$KVERS" in -2.0.*|2.1.*|2.2.*) ;; +2.0.*|2.1.*|2.2.*|2.3.*) ;; *) { echo "configure: error: Unsupported kernel version" 1>&2; exit 1; } esac echo $ac_n "checking for architecture""... $ac_c" 1>&6 -echo "configure:978: checking for architecture" >&5 +echo "configure:974: checking for architecture" >&5 ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/` echo "$ac_t""$ARCH" 1>&6 echo $ac_n "checking for SMP""... $ac_c" 1>&6 -echo "configure:983: checking for SMP" >&5 +echo "configure:979: checking for SMP" >&5 smp=0 case "$KVERS" in -2.0.*|2.1.*) if egrep "^ *SMP *= *1" $KSRC/Makefile >/dev/null 2>&1; then - smp=1 -fi - ;; -2.2.*) if egrep "^ *\#define *CONFIG_SMP" $KINC/linux/autoconf.h >/dev/null 2>&1; then - smp=1 -fi - -esac +2.0.*|2.1.*) AX_EGREP(^ *SMP *= *1, $KSRC/Makefile, smp=1) ;; +2.2.*) AX_EGREP(^ *\#define *CONFIG_SMP, $KINC/linux/autoconf.h, smp=1) ;; +2.3.*) AX_EGREP(^ *\#define *CONFIG_SMP, $KINC/config/smp.h, smp=1) esac test "$smp" = 1 && cat >> confdefs.h <<\EOF #define __SMP__ 1 EOF -x=no -test "x$smp" = "x1" && x=yes -echo "$ac_t""$x" 1>&6 +AX_MSG_RESULT_YN($smp) echo $ac_n "checking for versioned modules""... $ac_c" 1>&6 -echo "configure:1004: checking for versioned modules" >&5 +echo "configure:992: checking for versioned modules" >&5 mv=0 - if egrep "^ *\#define *CONFIG_MODVERSIONS" $KINC/linux/autoconf.h >/dev/null 2>&1; then - mv=1 -fi - -x=no -test "x$mv" = "x1" && x=yes -echo "$ac_t""$x" 1>&6 +AX_EGREP(^ *\#define *CONFIG_MODVERSIONS, $KINC/linux/autoconf.h, mv=1) +AX_MSG_RESULT_YN($mv) test "$mv" = 1 && cat >> confdefs.h <<\EOF #define MODVERSIONS 1 EOF @@ -1101,7 +1084,7 @@ if test "$e" = 1; then echo $ac_n "checking for assembler parts""... $ac_c" 1>&6 -echo "configure:1105: checking for assembler parts" >&5 +echo "configure:1088: checking for assembler parts" >&5 case "$CRYPTO" in Blowfish) cat >> confdefs.h <<\EOF #define Crypto_Blowfish 1 diff -ur cipe-1.3.0/configure.in cipe-1.3.1/configure.in --- cipe-1.3.0/configure.in Mon Jun 14 17:09:21 1999 +++ cipe-1.3.1/configure.in Thu Mar 2 19:47:27 2000 @@ -16,7 +16,7 @@ AC_CONFIG_HEADER($BUILD/config.h:conf/config.h.in) dnl $BUILD is set below - this works for autoconf 2.13, somewhat undocumented AC_SUBST(VERSION) -VERSION=1.3.0 +VERSION=1.3.1 AC_SUBST(SRC) SRC=. dnl will be moved later @@ -69,7 +69,7 @@ KVERS=`sed -n 's:^#define *UTS_RELEASE *\"\([^"]*\).*$:\1:p' $KINC/linux/version.h` AC_MSG_RESULT($KVERS) case "$KVERS" in -2.0.*|2.1.*|2.2.*) ;; +2.0.*|2.1.*|2.2.*|2.3.*) ;; *) AC_MSG_ERROR(Unsupported kernel version) esac @@ -81,8 +81,8 @@ smp=0 case "$KVERS" in 2.0.*|2.1.*) AX_EGREP([^ *SMP *= *1], $KSRC/Makefile, smp=1) ;; -2.2.*) AX_EGREP([^ *\#define *CONFIG_SMP], $KINC/linux/autoconf.h, smp=1) -esac +2.2.*) AX_EGREP([^ *\#define *CONFIG_SMP], $KINC/linux/autoconf.h, smp=1) ;; +2.3.*) AX_EGREP([^ *\#define *CONFIG_SMP], $KINC/config/smp.h, smp=1) esac test "$smp" = 1 && AC_DEFINE(__SMP__) AX_MSG_RESULT_YN($smp) diff -ur cipe-1.3.0/device.c cipe-1.3.1/device.c --- cipe-1.3.0/device.c Tue Nov 2 21:49:05 1999 +++ cipe-1.3.1/device.c Tue Nov 2 18:33:01 1999 @@ -69,7 +69,7 @@ /*** IOCTL handlers ***/ -static int cipe_getpar(struct device *dev, struct siocgifcippar *parm) +static int cipe_getpar(struct NET_DEVICE *dev, struct siocgifcippar *parm) { DEVTOCIPE(dev,c,-ENODEV); @@ -82,7 +82,7 @@ return 0; } -static int cipe_setpar(struct device *dev, struct siocsifcippar *parm) +static int cipe_setpar(struct NET_DEVICE *dev, struct siocsifcippar *parm) { DEVTOCIPE(dev,c,-ENODEV); @@ -105,7 +105,7 @@ return 0; } -static int cipe_setkey(struct device *dev, struct siocsifcipkey *parm) +static int cipe_setkey(struct NET_DEVICE *dev, struct siocsifcipkey *parm) { DEVTOCIPE(dev,c,-ENODEV); @@ -179,7 +179,7 @@ #define cipe_alloc_UNLOCK() up(&cipe_alloc_sem) #endif -static int cipe_alloc(struct device *dev, struct siocsifcipall *parm) +static int cipe_alloc(struct NET_DEVICE *dev, struct siocsifcipall *parm) { #ifdef NO_DYNDEV return -ENOSYS; @@ -223,7 +223,7 @@ #endif } -static int cipe_unalloc(struct device *dev, struct siocsifcipall *parm) +static int cipe_unalloc(struct NET_DEVICE *dev, struct siocsifcipall *parm) { #ifdef NO_DYNDEV return -ENOSYS; @@ -247,7 +247,7 @@ /*** Device operation handlers ***/ -int cipe_dev_ioctl(struct device *dev, struct ifreq *ifr, int cmd) +int cipe_dev_ioctl(struct NET_DEVICE *dev, struct ifreq *ifr, int cmd) { int e; @@ -315,7 +315,7 @@ #undef doioctl } -int cipe_dev_open(struct device *dev) +int cipe_dev_open(struct NET_DEVICE *dev) { DEVTOCIPE(dev,c,-ENODEV); if (!c->sock) @@ -330,7 +330,7 @@ dprintk(DEB_CALL, (KERN_INFO "%s: closed\n", c->dev->name)); } -int cipe_dev_close(struct device *dev) +int cipe_dev_close(struct NET_DEVICE *dev) { struct cipe *c = (struct cipe*)(dev->priv); if ((!c) || (c->magic!=CIPE_MAGIC)) { @@ -348,13 +348,10 @@ } else { cipe_close(c); } -#ifdef LINUX_23 - dev_put(dev); -#endif return 0; } -struct enet_statistics *cipe_get_stats(struct device *dev) +struct enet_statistics *cipe_get_stats(struct NET_DEVICE *dev) { DEVTOCIPE(dev,c,NULL); return &(c->stat); @@ -364,7 +361,7 @@ /*** Initialization and finalization stuff ***/ #ifndef LINUX_21 -static inline void dev_init_buffers(struct device *dev) +static inline void dev_init_buffers(struct NET_DEVICE *dev) { int i; for (i = 0; i < DEV_NUMBUFFS; i++) { @@ -373,7 +370,7 @@ } #endif -static int cipe_init_dev(struct device *dev) +static int cipe_init_dev(struct NET_DEVICE *dev) { struct cipe *c = (struct cipe*)(dev->priv); if (!c) diff -ur cipe-1.3.0/output.c cipe-1.3.1/output.c --- cipe-1.3.0/output.c Mon Jun 7 15:08:24 1999 +++ cipe-1.3.1/output.c Thu Mar 2 19:42:26 2000 @@ -20,6 +20,7 @@ #include <linux/if_arp.h> #include <linux/socket.h> #include <linux/version.h> +#include <linux/skbuff.h> #ifdef DEBUG void cipe_dump_packet(char *title, struct sk_buff *skb) @@ -59,11 +60,11 @@ /* An adapted version of Linux 2.1 net/ipv4/ipip.c output routine. */ -int cipe_xmit(struct sk_buff *skb, struct device *dev) +int cipe_xmit(struct sk_buff *skb, struct NET_DEVICE *dev) { struct cipe *tunnel = (struct cipe*)(dev->priv); struct rtable *rt = NULL; /* Route to the other host */ - struct device *tdev; /* Device to other host */ + struct NET_DEVICE *tdev; /* Device to other host */ struct iphdr *old_iph = skb->nh.iph; u8 tos = old_iph->tos; struct iphdr *iph; /* Our new IP header */ @@ -157,15 +158,30 @@ max_headroom = (((tdev->hard_header_len+15)&~15)+cipehdrlen+ ((tunnel->sockshost) ? sizeof(struct sockshdr) : 0)); max_tailroom = (tunnel->havekey) ? cipefootlen : 0; - { - unsigned long offset; - struct sk_buff *n= - alloc_skb(skb->len+max_headroom+max_tailroom, GFP_ATOMIC); + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,35) + if (max_headroom > skb_headroom(skb) + || max_tailroom > skb_tailroom(skb)) { + struct sk_buff *n= skb_copy_expand(skb, max_headroom, + max_tailroom, GFP_ATOMIC); if (!n) { printk(KERN_INFO "%s: Out of memory, dropped packet\n", dev->name); goto tx_error; } + dev_kfree_skb(skb); + skb = n; + } +#else + { + unsigned long offset; + struct sk_buff *n= + alloc_skb(skb->len+max_headroom+max_tailroom, GFP_ATOMIC); + if (!n) { + printk(KERN_INFO "%s: Out of memory, dropped packet\n", + dev->name); + goto tx_error; + } skb_reserve(n, max_headroom); /* Copy the packet over. From skb_realloc_headroom() */ offset=n->data-skb->data; @@ -190,10 +206,12 @@ n->destructor = NULL; n->security=skb->security; + if (skb->sk) + skb_set_owner_w(n, skb->sk); dev_kfree_skb(skb); skb = n; } - +#endif /* skb_copy_expand */ memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); dst_release(skb->dst); skb->dst = &rt->u.dst; @@ -241,7 +259,11 @@ iph->ihl = sizeof(struct iphdr)>>2; iph->tos = tos; iph->tot_len = htons(skb->len); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,37) iph->id = htons(ip_id_count++); +#else + iph->id = old_iph->id; +#endif iph->frag_off = old_iph->frag_off&__constant_htons(IP_DF); iph->ttl = tunnel->cttl ? tunnel->cttl : old_iph->ttl; iph->protocol = IPPROTO_UDP; @@ -275,7 +297,7 @@ cipe_dump_packet("sending", skb); #endif ip_send(skb); - ip_rt_put(rt); + ip_rt_put(rt); tunnel->recursion--; return 0; @@ -310,11 +332,11 @@ #define ipforward(s,d,o,t) (sysctl_ip_forward ? ip_forward(s,d,o,t) : -1) #endif -int cipe_xmit(struct sk_buff *skb, struct device *dev) +int cipe_xmit(struct sk_buff *skb, struct NET_DEVICE *dev) { struct enet_statistics *stats; /* This device's statistics */ struct rtable *rt; /* Route to the other host */ - struct device *tdev; /* Device to other host */ + struct NET_DEVICE *tdev; /* Device to other host */ struct iphdr *iph; /* Our new IP header */ struct udphdr *udph; __u32 target; /* The other host's IP address */ diff -ur cipe-1.3.0/sock.c cipe-1.3.1/sock.c --- cipe-1.3.0/sock.c Thu Apr 29 05:32:43 1999 +++ cipe-1.3.1/sock.c Tue Nov 2 18:28:12 1999 @@ -469,7 +469,7 @@ #include <linux/file.h> -int cipe_attach(struct device *dev, struct siocsifcipatt *parm) +int cipe_attach(struct NET_DEVICE *dev, struct siocsifcipatt *parm) { struct file *file; struct inode *inode; @@ -536,7 +536,7 @@ #define sreturn(x) {sti(); return((x));} -int cipe_attach(struct device *dev, struct siocsifcipatt *parm) +int cipe_attach(struct NET_DEVICE *dev, struct siocsifcipatt *parm) { struct file *file; struct inode *inode; @@ -588,7 +588,7 @@ /* Fill an otherwise unused field in the sock struct with this info. Actually, this is very similar to a packet socket! The ugly cast saves us one deref in the actual ops */ - sk->protinfo.af_packet.bound_dev=(struct device *)c; + sk->protinfo.af_packet.bound_dev=(struct NET_DEVICE *)c; sk->no_check=1; /* our packets are checksummed internally */ sti();

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:13 EST