[1148] in linux-net channel archive
Re: "ping localhost -s 9019" gives failed checksum...
daemon@ATHENA.MIT.EDU (Tom May)
Sat Sep 30 19:33:02 1995
Date: Sat, 30 Sep 1995 11:27:31 -0700
From: ftom@netcom.com (Tom May)
To: iialan@iifeak.swan.ac.uk
CC: jappe@clinet.fi, linux-kernel@vger.rutgers.edu, linux-net@vger.rutgers.edu,
jappe@hauki.clinet.fi
In-reply-to: <m0sygJ0-00014DC@iiit.swan.ac.uk> (iialan@iifeak.swan.ac.uk)
>The checksum errors are because the assembler ip_fold_csum I
>wrote is wrong, and I've not had time to fix it (have a look in checksum.h
>if you are an assembler hacker) and in net/ipv4/icmp.c
Did somebody say assembler hacker?
--- checksum.h.0 Thu Sep 28 18:21:57 1995
+++ checksum.h Sat Sep 30 11:23:14 1995
@@ -105,18 +105,17 @@
static inline unsigned short int csum_fold(unsigned int sum)
{
- __asm__("
- movl %0, %1
- shrl $16, %1
- addw %w1, %w0
- adcl $0, %0
- notl %0
- "
- : "=&r" (sum)
- : "0" (sum)
- );
- return sum;
- }
+ unsigned int tmp;
+ __asm__ ("
+ shrl $16,%0
+ addw %w1,%w0
+ adcl $0,%0
+ notl %0
+ "
+ : "=&r" (sum), "=&r" (tmp)
+ : "0" (sum), "1" (sum));
+ return sum;
+}
/*
* this routine is used for miscellaneous IP-like checksums, mainly
Tom.