X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fnet%2Fslhc.c;h=d640c0f5470be3bf315c5f53a5d37274a2afdbce;hb=b63a2cb30405777033d58045c562a3b04d87d702;hp=9a540e2092b9a658f7b6ba6234e3675bd87d68aa;hpb=b4d01327e4c05ab555a4cf38a33f4b4fa2f75e64;p=linux-2.6-omap-h63xx.git diff --git a/drivers/net/slhc.c b/drivers/net/slhc.c index 9a540e2092b..d640c0f5470 100644 --- a/drivers/net/slhc.c +++ b/drivers/net/slhc.c @@ -42,7 +42,7 @@ * Modularization. * - Jan 1995 Bjorn Ekwall * Use ip_fast_csum from ip.h - * - July 1995 Christos A. Polyzols + * - July 1995 Christos A. Polyzols * Spotted bug in tcp option checking * * @@ -174,7 +174,7 @@ put16(unsigned char *cp, unsigned short x) /* Encode a number */ -unsigned char * +static unsigned char * encode(unsigned char *cp, unsigned short n) { if(n >= 256 || n == 0){ @@ -199,7 +199,7 @@ pull16(unsigned char **cpp) } /* Decode a number */ -long +static long decode(unsigned char **cpp) { register int x; @@ -233,15 +233,16 @@ slhc_compress(struct slcompress *comp, unsigned char *icp, int isize, register unsigned char *cp = new_seq; struct iphdr *ip; struct tcphdr *th, *oth; + __sum16 csum; /* * Don't play with runt packets. */ - + if(isizecheck); + csum = th->check; memcpy(&cs->cs_ip,ip,20); memcpy(&cs->cs_tcp,th,20); /* We want to use the original packet as our compressed packet. @@ -449,7 +450,8 @@ found: *cpp = ocp; *cp++ = changes; } - cp = put16(cp,(short)deltaA); /* Write TCP checksum */ + *(__sum16 *)cp = csum; + cp += 2; /* deltaS is now the size of the change section of the compressed header */ memcpy(cp,new_seq,deltaS); /* Write list of deltas */ memcpy(cp+deltaS,icp+hlen,isize-hlen); @@ -519,10 +521,8 @@ slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize) thp = &cs->cs_tcp; ip = &cs->cs_ip; - if((x = pull16(&cp)) == -1) { /* Read the TCP checksum */ - goto bad; - } - thp->check = htons(x); + thp->check = *(__sum16 *)cp; + cp += 2; thp->psh = (changes & TCP_PUSH_BIT) ? 1 : 0; /*