IPv4 checksum oddness (gcc compiler bug?)

From: Mike Bristow <mike_at_urgle.com>
Date: Tue, 24 Aug 2004 22:52:42 +0100
Hi,

I've been suffering from really horrid (~60-70%) packet loss for a while,
but only with IPv4.

I've spent some time thinking I had a hardware problem, as it started
at the same time as changed some networking bits but it doesn't
appear to be the case:  older (5.2.1) version of FreeBSD don't have
this problem.

I've just cvsuped to RELENG_5 box (cvsup'ed with tag=RELENG_5
date=2004.08.24.00.00.00), and with the attached patch I see
many entries like in my logs:

csum calc discrepancy: 45:10:00:64:b0:22:40:00:40:06:98:95:50:b1:28:36:50:b1:28:34
csum calc discrepancy: 45:10:00:84:b0:23:40:00:40:06:98:74:50:b1:28:36:50:b1:28:34

However, my patch is obviously wrong.  

The only thing that I can think of that might possibly be the cause
is a compiler optimization bug - but I'm not sure that that's the
case, either.  My make.conf is boring (http://www.urgle.com/~mike/make.conf
if you want to see its dullness).    I can't believe that this is
a real problem, rather than an artifact of my stupidity, because
if it was a real problem everyone with old PIIs would be screaming
the place down.   

Has anyone any ideas as to how to debug this?  

The kernel is GENERIC; possibly interesting other facts include:

hw.model: Pentium II/Pentium II Xeon/Celeron
hw.ncpu: 2
vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 80.177.40.52 netmask 0xfffffff0 broadcast 80.177.40.63
        inet6 fe80::280:c8ff:feea:8041%vr0 prefixlen 64 scopeid 0x1
        inet6 2002:50b1:2836:1:280:c8ff:feea:8041 prefixlen 64 autoconf
        ether 00:80:c8:ea:80:41
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active


--- ip_input.c.orig     Tue Aug 24 22:24:45 2004
+++ ip_input.c  Tue Aug 24 22:24:45 2004
_at__at_ -366,6 +366,14 _at__at_
        } else {
                if (hlen == sizeof(struct ip)) {
                        sum = in_cksum_hdr(ip);
+                       if (sum) {
+                               u_short sumchk;
+                               sumchk = in_cksum(m, hlen);
+                               if (!sumchk) {
+                                       printf("csum calc discrepancy: %20D\n", (u_char *)ip, ":");
+                                       sum = 0;
+                               }
+                       }
                } else {
                        sum = in_cksum(m, hlen);
                }


-- 
You dont have to be illiterate to use the Internet, but it help's.
Received on Tue Aug 24 2004 - 19:52:51 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:08 UTC