[644] in linux-net channel archive
Re: Bad c'sums from csum_partial_copy()
daemon@ATHENA.MIT.EDU (Paul Gortmaker)
Mon Jul 10 16:11:48 1995
From: Paul Gortmaker <gpg109@rsphy1.anu.edu.au>
To: ftom@netcom.com (Tom May)
Date: Mon, 10 Jul 1995 15:54:07 +1000 (EST)
Cc: gpg109@rsphy1.anu.edu.au, iialan@iifeak.swan.ac.uk,
torvalds@cs.Helsinki.FI, linux-net@vger.rutgers.edu
In-Reply-To: <199507092242.PAA27157@netcom11.netcom.com> from "Tom May" at Jul 9, 95 03:42:22 pm
Hi Tom,
> Paul, you said:
>
> >Now I can boot without exploding. Note however that the csums in
> >csum_partial_copy() are still broken and only some packets get through.
[...]
> fine. I put printk's in tcp.c and udp.c where it checks ip_summed and
> rejects packets for bad checksums, and I am not getting any rejects.
>
> I have also put csum_partial_copy() through a pretty good user-level
> test.
>
> How can your problem be reproduced?
Easy -- I just hacked this test into tcp.c just now. Look at the results.
--- /linux-oem-138/net/ipv4/tcp.c Fri Jul 7 20:09:32 1995
+++ linux/net/ipv4/tcp.c Mon Jul 10 15:15:52 1995
@@ -4516,6 +4516,17 @@
*/
skb_pull(skb, skb->h.raw-skb->data);
/*
+ * Double check the device c'sum
+ */
+ if (skb->ip_summed) {
+ u_long new_csum = csum_partial((char *)th, len, 0);
+ if (new_csum != skb->csum) { /* scream loudly */
+ printk("%s: bad csum: 0x%lX, actual=0x%lX, len=%u.\n",
+ skb->dev->name, skb->csum, new_csum, len);
+ skb->csum = new_csum; /* use the right one */
+ }
+ }
+ /*
* Try to use the device checksum if provided.
*/
if (
----------------------------------------------------------
Now here are the results of the above test, for 2 target machines.
Here is an alpha on the same subnet as testbox:
----------------------------------------------------------
testbox:~> telnet rsphy9
Trying 150.203.15.148...
Connected to rsphy9.anu.edu.au.
Escape character is '^]'.
eth0: bad csum: 0x1E62C350, actual=0x1C5FC553, len=23.
OSF/1 (rsphy9) (ttyq1)
login: gpg109
Password:
Last login: Mon Jul 10 15:10:19 from testbox.anu.edu.au
----------------------------------------------------------
It seems fine after only one bad c'sum.
Now watch when I try a sun box in another building. (again user=gpg109)
----------------------------------------------------------
testbox:~> telnet csc
Trying 150.203.2.12...
Connected to huxley.anu.edu.au.
Escape character is '^]'.
eth0: bad csum: 0x2596745F, actual=0x2596432A, len=24.
eth0: bad csum: 0x7FC42409, actual=0x4DAA1C16, len=23.
eth0: bad csum: 0xB0D55479, actual=0x90ABDC14, len=20.
SunOS UNIX (huxley)
eth0: bad csum: 0xD3ADAE22, actual=0xBAAAAF15, len=23.
login: eth0: bad csum: 0xDEFC7B24, actual=0xC6ABA514, len=21.
geth0: bad csum: 0xE0FC0F24, actual=0xC8ABA314, len=21.
peth0: bad csum: 0x340D3C83, actual=0xCAABA114, len=21.
geth0: bad csum: 0x4DD2B50, actual=0xCCAB9F14, len=21.
1eth0: bad csum: 0x3DD2950, actual=0xCEAB9D14, len=21.
0eth0: bad csum: 0xE8FBD324, actual=0xD0AB9B14, len=21.
9eth0: bad csum: 0xF4210676, actual=0xD3AB9714, len=22.
Password:
----------------------------------------------------------
All the small packets have garbage checksums. Bigger ones are ok.
I'd say that proves it pretty solidly. Let me know if you want me to
dig more info out of the skb's.
Regards,
Paul.