patch-1.3.9 linux/arch/alpha/lib/checksum.c
Next file: linux/arch/alpha/mm/Makefile
Previous file: linux/arch/alpha/lib/Makefile
Back to the patch index
Back to the overall index
- Lines: 28
- Date:
Mon Jul 10 16:59:58 1995
- Orig file:
v1.3.8/linux/arch/alpha/lib/checksum.c
- Orig date:
Fri Jul 7 08:54:43 1995
diff -u --recursive --new-file v1.3.8/linux/arch/alpha/lib/checksum.c linux/arch/alpha/lib/checksum.c
@@ -24,7 +24,7 @@
/*
* computes the checksum of the TCP/UDP pseudo-header
- * returns a 16-bit checksum, already complemented
+ * returns a 16-bit checksum, already complemented.
*/
unsigned short int csum_tcpudp_magic(unsigned long saddr,
unsigned long daddr,
@@ -32,7 +32,9 @@
unsigned short proto,
unsigned int sum)
{
- return ~from64to16(saddr + daddr + sum + (ntohs(len) << 16) + (proto << 8));
+ return ~from64to16(saddr + daddr + sum +
+ ((unsigned long) ntohs(len) << 16) +
+ ((unsigned long) proto << 8));
}
/*
@@ -83,6 +85,7 @@
carry = (w > result);
} while (count);
result += carry;
+ result = (result & 0xffffffff) + (result >> 32);
}
if (len & 4) {
result += *(unsigned int *) buff;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this