--- /dev/null
+--- dip-3.3.7o/command.c.andor Thu Apr 10 11:53:52 1997
++++ dip-3.3.7o/command.c Thu Apr 10 11:59:11 1997
+@@ -2714,17 +2714,16 @@
+ #endif
+
+ if (
+- (strcmp(argv[0], "if") == 0) &&
+- (strcmp(argv[0], "goto") == 0) &&
++ (strcmp(argv[0], "if") == 0) ||
++ (strcmp(argv[0], "goto") == 0) ||
+ (strcmp(argv[0], "print") == 0)
+ )
+ {
+ errlevel_flag=0; /* don't modify errlevel value */
++ } else {
++ errlevel_flag=1; /* allow to modify errlevel with the new rc */
+ errlevel = 0; /* allow print of $errlvl after error detected */
+ }
+- else {
+- errlevel_flag=1; /* allow to modify errlevel with the new rc */
+- }
+
+ /* Now, check which command it is. */
+ if (strcmp(argv[0], "exit") != 0) {
--- /dev/null
+--- dip-3.3.7o/Makefile.nfsstnd Wed Aug 28 16:57:56 1996
++++ dip-3.3.7o/Makefile Wed Aug 28 16:58:15 1996
+@@ -50,7 +50,7 @@
+ CC = gcc
+
+ # If you wish, add -g flag to the next line
+-CFLAGS = -DLINUX $(SKEYDEF) $(SECUREID) -pipe -O6 -Wall -m486
++CFLAGS = -DLINUX $(SKEYDEF) $(SECUREID) -DFSSTND -pipe -Wall $(RPM_OPT_FLAGS)
+
+ #LD = ld
+ LD = $(CC)
--- /dev/null
+--- dip-3.3.7o/skey/skeysubr.c.glibc Thu Jul 17 16:00:39 1997
++++ dip-3.3.7o/skey/skeysubr.c Thu Jul 17 16:00:39 1997
+@@ -42,6 +42,7 @@
+ # define gtty(fd,buf) ioctl((fd),TIOCGETP,(buf))
+ #else
+ # include <termio.h>
++# include <sys/ioctl.h>
+ # define TTYSTRUCT termio
+ # define stty(fd,buf) ioctl((fd),TCSETA,(buf))
+ # define gtty(fd,buf) ioctl((fd),TCGETA,(buf))
+--- dip-3.3.7o/skey/Makefile.glibc Mon Jul 24 20:22:49 1995
++++ dip-3.3.7o/skey/Makefile Thu Jul 17 16:03:17 1997
+@@ -12,7 +12,7 @@
+ CC = gcc
+ CFLAGS = -pipe -O2 #-DUSE_ECHO
+ #SYSLIBS = -lshadow -ldbm
+-SYSLIBS = -ldbm # For ELF - no shadow needed (included in libc).
++SYSLIBS = -ldb -lcrypt # For ELF - no shadow needed (included in libc).
+
+ LIB = libskey.a
+ PROGS = key keyinit keysh
+--- dip-3.3.7o/skey/skeyinit.c.glibc Thu Jul 17 16:00:39 1997
++++ dip-3.3.7o/skey/skeyinit.c Thu Jul 17 16:00:39 1997
+@@ -13,10 +13,7 @@
+ #include <string.h>
+ #include <pwd.h>
+ #ifdef linux
+-# ifndef __alpha__
+-# undef SHADOW
+ # include <shadow.h>
+-# endif
+ #endif
+ #include <sys/resource.h>
+ #include <time.h>
+--- dip-3.3.7o/skey/md4.c.glibc Thu Jul 17 16:02:37 1997
++++ dip-3.3.7o/skey/md4.c Thu Jul 17 16:02:47 1997
+@@ -7,6 +7,8 @@
+ */
+ #include <sys/types.h>
+
++typedef unsigned int __u32;
++
+ /*
+ * To use MD4:
+ * -- Include md4.h in your program
+--- dip-3.3.7o/skey/put.c.glibc Thu Jul 17 16:02:58 1997
++++ dip-3.3.7o/skey/put.c Thu Jul 17 16:03:05 1997
+@@ -16,6 +16,8 @@
+ #include <sys/types.h>
+ #include "skey.h"
+
++typedef unsigned int __u32;
++
+ static __u32 extract __ARGS ((char *s, int start, int length));
+ static void standard __ARGS ((char *word));
+ static void insert __ARGS ((char *s, int x, int start, int length));
+--- dip-3.3.7o/dip.h.glibc Thu Jul 17 16:00:39 1997
++++ dip-3.3.7o/dip.h Thu Jul 17 16:00:39 1997
+@@ -40,9 +40,10 @@
+ #include <sys/socket.h>
+ #include <sys/ioctl.h>
+ #include <sys/time.h>
++#include <netinet/in.h>
++#include <netinet/ip.h>
+ #include <arpa/inet.h>
+ #include <arpa/nameser.h>
+-#include <netinet/in.h>
+ #include <net/if_arp.h>
+ #include <netdb.h>
+ #include <resolv.h>
+--- dip-3.3.7o/command.c.glibc Thu Jul 17 16:00:39 1997
++++ dip-3.3.7o/command.c Thu Jul 17 16:06:32 1997
+@@ -29,11 +29,13 @@
+ * your option) any later version.
+ */
+ #include "dip.h"
+-#include <linux/types.h>
+-#include <linux/ip.h>
+-#include <linux/udp.h>
++#include <netinet/ip.h>
++#include <netinet/udp.h>
+ #include <sys/wait.h>
+
++typedef unsigned int __u32;
++typedef unsigned short __u16;
++
+ #define HASHSIZE 128
+
+ struct variable {
+@@ -680,7 +682,7 @@
+ nargv = malloc (argc*sizeof(char*)); /* allocate the array of pointers */
+ if (nargv == NULL) /* Ooops? */
+ {
+- fprintf (stderr, "error: Couldn't allocate %d bytes for" /* Ooops! */
++ fprintf (stderr, "error: Couldn't allocate %ld bytes for" /* Ooops! */
+ " onexit commands array: `%s'\n",
+ argc*sizeof(char*), strerror (errno) );
+ return -1;
+@@ -694,7 +696,7 @@
+ nargv[cnt] = malloc (strlen(argv[cnt]) + 1); /* allocate */
+ if (nargv[cnt] == NULL) /* Oops? */
+ {
+- fprintf (stderr, "error: Couldn't allocate %d bytes for argument %d"
++ fprintf (stderr, "error: Couldn't allocate %ld bytes for argument %d"
+ " of the onexit command: `%s'\n",
+ strlen (argv[cnt]), cnt, strerror (errno) );
+ arg_clean (argc, nargv); /* clean */
+--- dip-3.3.7o/tty.c.glibc Thu Jul 17 16:03:48 1997
++++ dip-3.3.7o/tty.c Thu Jul 17 16:03:56 1997
+@@ -29,8 +29,6 @@
+ #include "dip.h"
+ #include <sys/stat.h>
+ #ifdef LINUX
+-# include <linux/fs.h>
+-# include <linux/tty.h>
+ #ifndef NO_SERIAL
+ # include <linux/serial.h> /* for Linux-1.1.13 */
+ #endif /* ~NO_SERIAL */
+--- dip-3.3.7o/attach.c.glibc Thu Jul 17 16:04:32 1997
++++ dip-3.3.7o/attach.c Thu Jul 17 16:05:12 1997
+@@ -130,10 +130,12 @@
+
+ #include <sys/socket.h>
+ #include <net/if.h>
+-#include <linux/route.h>
+-#include <linux/if_ether.h>
++#include <net/route.h>
++#include <netinet/if_ether.h>
+ #include <netinet/in.h>
+ #include <time.h>
++
++typedef unsigned int __u32;
+
+ #define MAX_IFS 512
+
--- /dev/null
+--- dip-3.3.7o/skey/md4.c.misc Wed Jun 22 19:53:50 1994
++++ dip-3.3.7o/skey/md4.c Thu Jan 21 15:48:47 1999
+@@ -5,6 +5,7 @@
+ *
+ * Portability nits fixed and reformatted - 2/12/91 Phil Karn
+ */
++#include <sys/types.h>
+
+ /*
+ * To use MD4:
+@@ -38,7 +39,7 @@
+ #define FALSE 0
+
+ #if (defined(__MSDOS__) || defined(MPU8086) || defined(MPU8080) \
+- || defined(vax) || defined (MIPSEL))
++ || defined(vax) || defined (MIPSEL) || defined(__alpha__))
+ #define LOWBYTEFIRST TRUE /* Low order bytes are first in memory */
+ #else /* Almost all other machines are big-endian */
+ #define LOWBYTEFIRST FALSE
+@@ -87,7 +88,7 @@
+ #define gg(A,B,C,D,i,s) A = rot((A + g(B,C,D) + X[i] + C2),s)
+ #define hh(A,B,C,D,i,s) A = rot((A + h(B,C,D) + X[i] + C3),s)
+
+-void MDreverse __ARGS((unsigned long *X));
++void MDreverse __ARGS((__u32 *X));
+
+ /* MDprint(MDp)
+ * Print message digest buffer MDp as 32 hexadecimal digits.
+@@ -134,9 +135,9 @@
+ *X++ = ((t & 0xFF00FF00) >> 8) | ((t & 0x00FF00FF) << 8); }
+ void
+ MDreverse(X)
+-unsigned long *X;
++__u32 *X;
+ {
+- register unsigned long t;
++ register __u32 t;
+
+ revx;
+ revx;
+@@ -165,9 +166,9 @@
+ static void
+ MDblock(MDp,X)
+ MDptr MDp;
+-unsigned long *X;
++__u32 *X;
+ {
+- register unsigned long tmp, A, B, C, D;
++ register __u32 tmp, A, B, C, D;
+
+ #if LOWBYTEFIRST == FALSE
+ MDreverse(X);
+@@ -251,7 +252,7 @@
+ unsigned int count;
+ {
+ int i,bit,byte,mask;
+- unsigned long tmp;
++ __u32 tmp;
+ unsigned char XX[64];
+ unsigned char *p;
+
+@@ -276,7 +277,7 @@
+ /* Process data */
+ if(count == 512){
+ /* Full block of data to handle */
+- MDblock(MDp,(unsigned long *)X);
++ MDblock(MDp,(__u32 *)X);
+ } else if(count > 512){
+ /* Check for count too large */
+ printf("\nError: MDupdate called with illegal count value %ld.",count);
+@@ -299,15 +300,15 @@
+ if(byte <= 55){
+ for(i=0;i<8;i++)
+ XX[56+i] = MDp->count[i];
+- MDblock(MDp,(unsigned long *)XX);
++ MDblock(MDp,(__u32 *)XX);
+ } else {
+ /* need to do two blocks to finish up */
+- MDblock(MDp,(unsigned long *)XX);
++ MDblock(MDp,(__u32 *)XX);
+ for(i=0;i<56;i++)
+ XX[i] = 0;
+ for(i=0;i<8;i++)
+ XX[56+i] = MDp->count[i];
+- MDblock(MDp,(unsigned long *)XX);
++ MDblock(MDp,(__u32 *)XX);
+ }
+ /* Set flag saying we're done with MD computation */
+ MDp->done = 1;
+--- dip-3.3.7o/skey/put.c.misc Wed Jun 22 19:53:50 1994
++++ dip-3.3.7o/skey/put.c Thu Jan 21 15:48:47 1999
+@@ -13,9 +13,10 @@
+ #include <string.h>
+ #include <assert.h>
+ #include <ctype.h>
++#include <sys/types.h>
+ #include "skey.h"
+
+-static unsigned long extract __ARGS ((char *s, int start, int length));
++static __u32 extract __ARGS ((char *s, int start, int length));
+ static void standard __ARGS ((char *word));
+ static void insert __ARGS ((char *s, int x, int start, int length));
+ static int wsrch __ARGS ((char *w, int low, int high));
+@@ -2244,7 +2245,7 @@
+ unsigned char cl;
+ unsigned char cc;
+ unsigned char cr;
+- unsigned long y;
++ __u32 y;
+ int shift;
+
+ assert (length <= 11);
+@@ -2295,7 +2296,7 @@
+ }
+
+ /* Extract 'length' bits from the char array 's' starting with bit 'start' */
+-static unsigned long
++static __u32
+ extract (s, start, length)
+ char *s;
+ int start, length;
+@@ -2303,7 +2304,7 @@
+ unsigned char cl;
+ unsigned char cc;
+ unsigned char cr;
+- unsigned long x;
++ __u32 x;
+
+ assert (length <= 11);
+ assert (start >= 0);
+--- dip-3.3.7o/skey/skeyinit.c.misc Wed Jun 22 19:53:50 1994
++++ dip-3.3.7o/skey/skeyinit.c Thu Jan 21 15:48:47 1999
+@@ -13,8 +13,10 @@
+ #include <string.h>
+ #include <pwd.h>
+ #ifdef linux
+-#undef SHADOW
+-#include <shadow.h>
++# ifndef __alpha__
++# undef SHADOW
++# include <shadow.h>
++# endif
+ #endif
+ #include <sys/resource.h>
+ #include <time.h>
+@@ -141,7 +143,7 @@
+ switch (rval)
+ {
+ case -1:
+- perror ("Error opening database: ");
++ perror ("Error opening database");
+ exit (1);
+ case 0:
+ printf ("[Updating %s]\n", pp->pw_name);
+--- dip-3.3.7o/skey/skeylogin.c.misc Wed Jun 22 19:53:50 1994
++++ dip-3.3.7o/skey/skeylogin.c Thu Jan 21 15:48:47 1999
+@@ -352,7 +352,7 @@
+ char *username;
+ {
+ int i;
+- char str [50];
++ static char str [50];
+
+ struct skey skey;
+
+--- dip-3.3.7o/skey/skeysubr.c.misc Wed Jun 22 19:53:51 1994
++++ dip-3.3.7o/skey/skeysubr.c Thu Jan 21 15:48:47 1999
+@@ -11,6 +11,7 @@
+ * S/KEY misc routines.
+ */
+
++#include <malloc.h>
+ #include <stdio.h>
+
+ #ifdef HAS_STD_LIB
+@@ -86,7 +87,7 @@
+ unsigned int buflen;
+ #ifndef LITTLE_ENDIAN
+ int i;
+- register long tmp;
++ register __u32 tmp;
+ #endif
+
+ buflen = strlen(seed) + strlen(passwd);
+@@ -134,7 +135,7 @@
+ {
+ MDstruct md;
+ #ifndef LITTLE_ENDIAN
+- register long tmp;
++ __u32 tmp;
+ #endif
+
+ MDbegin(&md);
+--- dip-3.3.7o/attach.c.misc Mon Sep 18 17:41:06 1995
++++ dip-3.3.7o/attach.c Thu Jan 21 15:48:47 1999
+@@ -144,14 +144,14 @@
+ int s;
+ time_t online;
+
+-static u_long proxy_arp = 0;
++static __u32 proxy_arp = 0;
+
+ /*
+ * Make a string representation of a network IP address.
+ */
+ inline static char *
+ ip_ntoa(ipaddr)
+-u_long ipaddr;
++__u32 ipaddr;
+ {
+ static char b[64];
+
+@@ -166,9 +166,9 @@
+ }
+
+ static
+-int get_ether_addr (u_long ipaddr, struct sockaddr *hwaddr)
++int get_ether_addr (__u32 ipaddr, struct sockaddr *hwaddr)
+ {
+- u_long ina, mask;
++ __u32 ina, mask;
+ struct ifreq *ifr, *ifend;
+ #if 0
+ struct sockaddr_dl *dla;
+@@ -266,8 +266,8 @@
+
+ static int sifproxyarp (struct dip *dip)
+ {
+- u_long his_adr;
+- u_long my_adr;
++ __u32 his_adr;
++ __u32 my_adr;
+ struct arpreq arpreq;
+
+ memset (&arpreq, '\0', sizeof(arpreq));
+@@ -417,7 +417,7 @@
+ typedef struct
+ {
+ int acct;
+- unsigned long sa, da, sm, dm, iface;
++ __u32 sa, da, sm, dm, iface;
+ unsigned int nsp, ndp;
+ unsigned long npkt, nbyt;
+ unsigned int fw_pts[10];
+@@ -448,7 +448,7 @@
+ while (fgets(buf, 255, f))
+ { /* read in the data */
+ sscanf(buf,
+- "%lX/%lX->%lX/%lX %lX %X %u %u %lu %lu %u %u %u %u %u %u %u %u %u %u",
++ "%X/%X->%X/%X %X %X %u %u %lu %lu %u %u %u %u %u %u %u %u %u %u",
+ &rec->sa, &rec->sm, &rec->da, &rec->dm, &rec->iface,
+ &rec->fw_flg, &rec->nsp, &rec->ndp, &rec->npkt, &rec->nbyt,
+ &rec->fw_pts[0], &rec->fw_pts[1], &rec->fw_pts[2], &rec->fw_pts[3],
+@@ -478,7 +478,9 @@
+ char buff[1024];
+ static int flag = 0;
+ extern int opt_i;
++#ifdef CONFIG_IP_ACCT
+ u_long b_in=0, b_out=0, p_in=0, p_out=0;
++#endif
+ char *p;
+ char in_b[10], out_b[10];
+
+--- dip-3.3.7o/command.c.misc Mon Feb 12 21:01:16 1996
++++ dip-3.3.7o/command.c Thu Jan 21 15:48:47 1999
+@@ -2174,8 +2174,8 @@
+ return(0);
+ }
+
+-#define int32 unsigned long
+-#define int16 unsigned short
++#define int32 __u32
++#define int16 __u16
+
+ struct bootp {
+ char op; /* packet opcode type */
+@@ -2225,6 +2225,135 @@
+ }
+ }
+
++#ifdef __alpha__
++
++/*
++ * The following routines come from linux/arch/alpha/lib/checksum.c and
++ * linux/net/ipv4/udp.c. See, I'm in a hurry to get this working... :)
++ */
++
++static inline unsigned short
++from64to16(unsigned long x)
++{
++ /* add up 32-bit words for 33 bits */
++ x = (x & 0xffffffff) + (x >> 32);
++ /* add up 16-bit and 17-bit words for 17+c bits */
++ x = (x & 0xffff) + (x >> 16);
++ /* add up 16-bit and 2-bit for 16+c bit */
++ x = (x & 0xffff) + (x >> 16);
++ /* add up carry.. */
++ x = (x & 0xffff) + (x >> 16);
++ return x;
++}
++
++/*
++ * Do a 64-bit checksum on an arbitrary memory area..
++ *
++ * This isn't a great routine, but it's not _horrible_ either. The
++ * inner loop could be unrolled a bit further, and there are better
++ * ways to do the carry, but this is reasonable.
++ */
++static inline unsigned long
++do_csum(unsigned char * buff, int len)
++{
++ int odd, count;
++ unsigned long result = 0;
++
++ if (len <= 0)
++ goto out;
++ odd = 1 & (unsigned long) buff;
++ if (odd) {
++ result = *buff << 8;
++ len--;
++ buff++;
++ }
++ count = len >> 1; /* nr of 16-bit words.. */
++ if (count) {
++ if (2 & (unsigned long) buff) {
++ result += *(unsigned short *) buff;
++ count--;
++ len -= 2;
++ buff += 2;
++ }
++ count >>= 1; /* nr of 32-bit words.. */
++ if (count) {
++ if (4 & (unsigned long) buff) {
++ result += *(unsigned int *) buff;
++ count--;
++ len -= 4;
++ buff += 4;
++ }
++ count >>= 1; /* nr of 64-bit words.. */
++ if (count) {
++ unsigned long carry = 0;
++ do {
++ unsigned long w = *(unsigned long *) buff;
++ count--;
++ buff += 8;
++ result += carry;
++ result += w;
++ carry = (w > result);
++ } while (count);
++ result += carry;
++ result = (result & 0xffffffff) + (result >> 32);
++ }
++ if (len & 4) {
++ result += *(unsigned int *) buff;
++ buff += 4;
++ }
++ }
++ if (len & 2) {
++ result += *(unsigned short *) buff;
++ buff += 2;
++ }
++ }
++ if (len & 1)
++ result += *buff;
++ result = from64to16(result);
++ if (odd)
++ result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
++out:
++ return result;
++}
++
++
++/*
++ * This is a version of ip_compute_csum() optimized for IP headers,
++ * which always checksum on 4 octet boundaries.
++ */
++unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl)
++{
++ return ~do_csum(iph,ihl*4);
++}
++
++/*
++ * computes the checksum of the TCP/UDP pseudo-header
++ * returns a 16-bit checksum, already complemented.
++ */
++unsigned short int csum_tcpudp_magic(unsigned long saddr,
++ unsigned long daddr,
++ unsigned short len,
++ unsigned short proto,
++ unsigned int sum)
++{
++ return ~from64to16(saddr + daddr + sum +
++ ((unsigned long) ntohs(len) << 16) +
++ ((unsigned long) proto << 8));
++}
++
++
++static unsigned short
++udp_check(struct udphdr *uh, int len,
++ unsigned long saddr, unsigned long daddr)
++{
++ return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, 0));
++}
++
++
++
++#else /* !__alpha__ */
++
++
+ /* This is a version of ip_compute_csum() optimized for IP headers, which
+ always checksum on 4 octet boundaries. */
+ static inline unsigned short
+@@ -2308,6 +2437,8 @@
+ /* We only want the bottom 16 bits, but we never cleared the top 16. */
+ return((~sum) & 0xffff);
+ }
++
++#endif /* !__alpha__ */
+
+ static void put_bootreq(void)
+ {
+--- dip-3.3.7o/dip.h.misc Wed Sep 6 10:42:50 1995
++++ dip-3.3.7o/dip.h Thu Jan 21 15:51:51 1999
+@@ -43,11 +43,10 @@
+ #include <arpa/inet.h>
+ #include <arpa/nameser.h>
+ #include <netinet/in.h>
++#include <net/if_arp.h>
+ #include <netdb.h>
+ #include <resolv.h>
+ #include <net/if_arp.h>
+-
+-#include <linux/autoconf.h>
+
+ #include "pathnames.h"
+
+--- dip-3.3.7o/Makefile.misc Thu Feb 8 15:06:16 1996
++++ dip-3.3.7o/Makefile Thu Jan 21 15:48:47 1999
+@@ -45,8 +45,7 @@
+ #SNKLIB=
+
+ SKEYDEF = -DSKEY
+-#SKEYLIB = -L. -L./skey -L/usr/local/lib -lskey
+-SKEYLIB = -lskey
++SKEYLIB = -L. -L./skey -lskey
+
+ CC = gcc
+
--- /dev/null
+(Message inbox:1936)
+From davem@caip.rutgers.edu Tue Sep 3 03:56:22 1996
+Return-Path: davem@caip.rutgers.edu
+Received: from caipfs.rutgers.edu (caipfs.rutgers.edu [128.6.155.100]) by redhat.com (8.7.4/8.7.3) with SMTP id DAA05119 for <djb@redhat.com>; Tue, 3 Sep 1996 03:56:19 -0400
+Received: from huahaga.rutgers.edu (huahaga.rutgers.edu [128.6.155.53]) by caipfs.rutgers.edu (8.6.9+bestmx+oldruq+newsunq+grosshack/8.6.9) with ESMTP id DAA23814 for <djb@redhat.com>; Tue, 3 Sep 1996 03:56:19 -0400
+Received: (davem@localhost) by huahaga.rutgers.edu (8.6.9+bestmx+oldruq+newsunq+grosshack/8.6.9) id DAA03010; Tue, 3 Sep 1996 03:56:18 -0400
+Date: Tue, 3 Sep 1996 03:56:18 -0400
+Message-Id: <199609030756.DAA03010@huahaga.rutgers.edu>
+From: "David S. Miller" <davem@caip.rutgers.edu>
+To: djb@redhat.com
+In-reply-to: <199609021829.OAA08401@marvin.redhat.com> (message from Donnie
+ Barnes on Mon, 02 Sep 1996 14:29:39 -0400)
+Subject: Dip patch
+
+ Date: Mon, 02 Sep 1996 14:29:39 -0400
+ From: Donnie Barnes <djb@redhat.com>
+
+ > I'd like to ship dip on the SPARC.
+ >
+ > Tell me which SRPM you'd like me to look at, I'll make it work (ftp
+ > location please, thanks).
+
+ ftp.redhat.com:/pub/redhat/devel/srpms/SRPMS/dip-3.3.7o-7.src.rpm
+
+Here ya go, kind sir.
+
+--- command.c.~3~ Tue Sep 3 07:33:28 1996
++++ command.c Tue Sep 3 07:46:15 1996
+@@ -2350,9 +2350,154 @@
+ }
+
+
++#elif defined(__sparc__)
+
+-#else /* !__alpha__ */
++/* ihl is always 5 or greater, almost always is 5, and iph is not always
++ * word aligned, although that case is seldom.
++ */
++static __inline__ unsigned short ip_fast_csum(__const__ unsigned char *iph,
++ unsigned int ihl)
++{
++ unsigned long tmp1, tmp2, tmp3, tmp4;
++ unsigned short sum;
++
++ __asm__ __volatile__("
++ andcc %1, 3, %%g0
++ be,a 7f ! 4 byte aligned
++ sub %2, 4, %2
++
++ sll %2, 2, %5 ! number of bytes
++ andcc %1, 1, %%g0
++ be,a 2f ! 2 byte aligned
++ mov %%g0, %0
++
++ ldub [%1], %0
++ dec %5
++ inc %1
++
++ 2:
++ andcc %1, 2, %%g0
++ be 3f ! 4 byte aligned
++ srl %5, 1, %6 ! number of half words
++
++ lduh [%1], %3
++ add %3, %0, %0 ! no carry, add two half words
++ add %1, 2, %1
++ sub %5, 2, %5
++ dec %6
++
++ 3:
++ srl %6, 1, %6 ! number of words
++ ld [%1], %4
++
++ 4:
++ addcc %4, %0, %0 ! sum up words
++ add %1, 4, %1
++ addx %0, %%g0, %0
++ subcc %6, 1, %6
++ be,a 5f
++ andcc %5, 2, %%g0
++
++ b 4b
++ ld [%1], %4
++
++ 5:
++ be,a 6f ! no half words left
++ andcc %5, 1, %%g0
++
++ lduh [%1], %3
++ addcc %3, %0, %0
++ add %1, 2, %1
++ addx %0, %%g0, %0
++ andcc %5, 1, %%g0
++
++ 6:
++ be,a 9f ! no bytes left
++ sll %0, 16, %3
++
++ ldub [%1], %3 ! single byte left
++ sll %3, 8, %3
++ addcc %3, %0, %0
++ addx %0, %%g0, %0
++ sll %0, 16, %3
++
++ addcc %0, %3, %3 ! merge to half word
++ srl %3, 16, %0
++ addx %0, %%g0, %0
++
++ srl %0, 8, %3 ! must have been odd if we get here
++ and %3, 0xff, %3
++ sll %0, 8, %0
++ b 10f
++ add %3, %0, %0
++
++ 7:
++ ld [%1 + 0x00], %0
++ ld [%1 + 0x04], %3
++ addcc %3, %0, %0
++ ld [%1 + 0x08], %4
++ addxcc %4, %0, %0
++ ld [%1 + 0x0c], %3
++ addxcc %3, %0, %0
++ ld [%1 + 0x10], %4
++ addx %0, %%g0, %0
++ 8:
++ addcc %4, %0, %0
++ add %1, 4, %1
++ addxcc %0, %%g0, %0
++ subcc %2, 1, %2
++ be,a 9f
++ sll %0, 16, %3
++
++ b 8b
++ ld [%1 + 0x10], %4
++ 9:
++ addcc %0, %3, %3
++ srl %3, 16, %0
++ addx %0, %%g0, %0
++ 10:
++ xnor %%g0, %0, %0
++ " : "=r" (sum), "=&r" (iph), "=&r" (ihl),
++ "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4)
++ : "1" (iph), "2" (ihl));
++
++ return sum;
++}
++
++/*
++ * computes the checksum of the TCP/UDP pseudo-header
++ * returns a 16-bit checksum, already complemented
++ */
++static __inline__ unsigned short csum_tcpudp_magic(unsigned long saddr,
++ unsigned long daddr,
++ int len,
++ unsigned short proto,
++ unsigned int sum)
++{
++ __asm__ __volatile__("
++ addcc %1, %0, %0
++ addxcc %2, %0, %0
++ addxcc %3, %0, %0
++ addx %0, %%g0, %0
++ sll %0, 16, %1
++ addcc %1, %0, %0
++ srl %0, 16, %0
++ addx %0, %%g0, %0
++ xnor %%g0, %0, %0
++ " : "=r" (sum), "=r" (saddr)
++ : "r" (daddr), "r" ((proto<<16)+len), "0" (sum), "1" (saddr));
++
++ return sum;
++}
+
++static unsigned short
++udp_check(struct udphdr *uh, int len,
++ unsigned long saddr, unsigned long daddr)
++{
++ return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, 0));
++}
++
++#elif defined(__i386__) /* !__alpha__ && !__sparc__ */
+
+ /* This is a version of ip_compute_csum() optimized for IP headers, which
+ always checksum on 4 octet boundaries. */
+@@ -2438,7 +2583,11 @@
+ return((~sum) & 0xffff);
+ }
+
+-#endif /* !__alpha__ */
++#else
++
++#error You need to write tcp/ip checksum routines for your architecture
++
++#endif /* !__alpha__ && !__sparc__ && !__i386__*/
+
+ static void put_bootreq(void)
+ {
+
--- /dev/null
+--- dip-3.3.7o/main.c.orig Wed Aug 28 16:50:42 1996
++++ dip-3.3.7o/main.c Wed Aug 28 16:55:13 1996
+@@ -428,7 +428,6 @@
+ strncpy(path, argv[optind], sizeof(path) - sizeof(DIP_SFX) + 1);
+ if ((sp = strrchr(path, '/')) != (char *)NULL) sp++;
+ else sp = path;
+- if (strchr(sp, '.') == (char *)NULL) strcat(path, DIP_SFX);
+
+ /* set euid to ruid */
+ if (setreuid(geteuid(), getuid()) != 0){
+@@ -438,8 +437,11 @@
+ }
+ /* open file with real uid */
+ if ((fp = fopen(path, "r")) == (FILE *)NULL) {
+- fprintf(stderr, "dip: %s: %s\n", path, strerror(errno));
+- exit(-1);
++ if (strchr(sp, '.') == (char *)NULL) strcat(path, DIP_SFX);
++ if ((fp = fopen(path, "r")) == (FILE *)NULL) {
++ fprintf(stderr, "dip: %s: %s\n", path, strerror(errno));
++ exit(-1);
++ }
+ }
+ /* set uids back */
+ if (setreuid(geteuid(), getuid()) != 0){
--- /dev/null
+--- dip-3.3.7o/command.c.orig Thu Jan 21 15:37:13 1999
++++ dip-3.3.7o/command.c Thu Jan 21 15:45:04 1999
+@@ -2585,6 +2585,92 @@
+ return((~sum) & 0xffff);
+ }
+
++#elif defined (__arm__)
++
++/*
++ * This is a version of ip_compute_csum() optimized for IP headers,
++ * which always checksum on 4 octet boundaries.
++ *
++ * Converted and optimised for ARM by R. M. King.
++ *
++ * Note: the order that the LDM registers are loaded with respect to
++ * the adc's doesn't matter.
++ */
++static inline unsigned short
++ip_fast_csum(unsigned char * iph, unsigned int ihl)
++{
++ unsigned int sum, tmp1;
++
++ __asm__ __volatile__("
++ sub %2, %2, #5
++ ldr %0, [%1], #4
++ ldr %3, [%1], #4
++ adds %0, %0, %3
++ ldr %3, [%1], #4
++ adcs %0, %0, %3
++ ldr %3, [%1], #4
++ adcs %0, %0, %3
++1: ldr %3, [%1], #4
++ adcs %0, %0, %3
++ tst %2, #15
++ subne %2, %2, #1
++ bne 1b
++ adc %0, %0, #0
++ adds %0, %0, %0, lsl #16
++ addcs %0, %0, #0x10000
++ mvn %0, %0
++ mov %0, %0, lsr #16
++ "
++ : "=&r" (sum), "=&r" (iph), "=&r" (ihl), "=&r" (tmp1)
++ : "1" (iph), "2" (ihl));
++ return(sum);
++}
++
++/*
++ * Fold a partial checksum without adding pseudo headers
++ */
++static inline unsigned int
++csum_fold(unsigned int sum)
++{
++ __asm__("
++ adds %0, %0, %0, lsl #16
++ addcs %0, %0, #0x10000"
++ : "=r" (sum)
++ : "0" (sum));
++ return (~sum) >> 16;
++}
++
++static inline unsigned long
++csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
++ unsigned short proto, unsigned int sum)
++{
++ __asm__("
++ adds %0, %0, %1
++ adcs %0, %0, %2
++ adcs %0, %0, %3
++ adc %0, %0, #0"
++ : "=&r"(sum)
++ : "r" (daddr), "r" (saddr), "r" ((ntohs(len)<<16)+proto*256), "0" (sum));
++ return sum;
++}
++/*
++ * computes the checksum of the TCP/UDP pseudo-header
++ * returns a 16-bit checksum, already complemented
++ */
++static inline unsigned short int
++csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
++ unsigned short proto, unsigned int sum)
++{
++ return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
++}
++
++static unsigned short
++udp_check(struct udphdr *uh, int len,
++ unsigned long saddr, unsigned long daddr)
++{
++ return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, 0));
++}
++
+ #else
+
+ #error You need to write tcp/ip checksum routines for your architecture