From nobody@FreeBSD.org  Tue Aug 21 09:28:45 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1A6EB16A535
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 21 Aug 2007 09:28:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 820DF13C461
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 21 Aug 2007 09:28:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l7L9SdWB057019
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 21 Aug 2007 09:28:39 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.1/8.14.1/Submit) id l7L9SdKq057001;
	Tue, 21 Aug 2007 09:28:39 GMT
	(envelope-from nobody)
Message-Id: <200708210928.l7L9SdKq057001@www.freebsd.org>
Date: Tue, 21 Aug 2007 09:28:39 GMT
From: Yuri Bushmelev <jay-dev@simcom.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: All tcp/udp packet have wrong checksums on -current
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         115678
>Category:       kern
>Synopsis:       All tcp/udp packet have wrong checksums on -current
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 21 09:30:17 GMT 2007
>Closed-Date:    Sun Oct 21 19:16:58 UTC 2007
>Last-Modified:  Fri Oct 26 07:20:01 UTC 2007
>Originator:     Yuri Bushmelev
>Release:        FreeBSD 7.0-CURRENT
>Organization:
>Environment:
FreeBSD installer.home 7.0-CURRENT FreeBSD 7.0-CURRENT #2: Tue Aug 21 11:54:41 UTC 2007 root@installer.home:/usr/obj/usr/src/sys/GATE.HOME i386
>Description:
Today I've upgraded 6.2-RELEASE on my test computer to 7.0-CURRENT via sources (for gjournal, tmpfs and zfs testing).
After upgrade no one of tcp/udp packets come between my home desktop (6.2-REL p4) and test computer. tcpdump show that all tcp/udp packets have incorrect checksums. Same problem between my wife's desktop (WinXP/FreeBSD 6.1) and test machine.
But between test computer and my adsl router (ZyXEL P-660RT EE) tcp session was successfully established (telnet to ports 23 and 80 works fine). May be router's IP stack does not control checksums?

My test machine is VIA EPIA ML6000EA with VIA Eden processor onboard. Problem reported with this NICs: vr, rl, em. em was tested on IBM xSeries 306 server with and without rxcsum/txcsum ifconfig options. All NIC's was loaded as modules from loader.conf. I have no NIC's compiled in kernel.

I have pf on my desktop, but it is disabled at time of tests.

Here is tcpdump from my desktop:
12:43:49.933700 IP (tos 0x0, ttl  64, id 29, offset 0, flags [none], proto: UDP (17), length: 70) 192.168.1.234.63954 > 192.168.1.253.53: [bad udp cksum fffe!]  61074+ PTR? 1.1.168.192.in-addr.arpa. (42)
12:43:59.933957 arp who-has 192.168.1.1 tell 192.168.1.234
12:44:14.685070 IP (tos 0x0, ttl  64, id 34, offset 0, flags [none], proto: UDP (17), length: 72) 192.168.1.234.61272 > 192.168.1.253.53: [bad udp cksum fffe!]  47829+ PTR? 253.1.168.192.in-addr.arpa. (44)
12:44:19.684848 IP (tos 0x0, ttl  64, id 35, offset 0, flags [none], proto: UDP (17), length: 72) 192.168.1.234.61272 > 192.168.1.253.53: [bad udp cksum fffe!]  47829+ PTR? 253.1.168.192.in-addr.arpa. (44)
12:44:29.685005 IP (tos 0x10, ttl  64, id 36, offset 0, flags [DF], proto: TCP (6), length: 60) 192.168.1.234.56412 > 192.168.1.253.80: S, cksum 0xde00 (incorrect (-> 0xdd00), 2892320748:2892320748(0) win 65535 <mss 1460,nop,wscale 8,sackOK,timestamp 396482 0>
12:44:32.683734 IP (tos 0x10, ttl  64, id 37, offset 0, flags [DF], proto: TCP (6), length: 60) 192.168.1.234.56412 > 192.168.1.253.80: S, cksum 0xd248 (incorrect (-> 0xd148), 2892320748:2892320748(0) win 65535 <mss 1460,nop,wscale 8,sackOK,timestamp 399482 0>
12:44:35.883155 IP (tos 0x10, ttl  64, id 38, offset 0, flags [DF], proto: TCP (6), length: 60) 192.168.1.234.56412 > 192.168.1.253.80: S, cksum 0xc5c8 (incorrect (-> 0xc4c8), 2892320748:2892320748(0) win 65535 <mss 1460,nop,wscale 8,sackOK,timestamp 402682 0>

Please note that checksum differs only by one in 3rd byte.

World was first time compiled with CPUTYPE?=c3 CFLAGS='-O2 -fno-strict-aliasing -pipe'. But when I see that kernel maked with same CFLAGS (bug?), I have recompiled only kernel with CFLAGS='-O -pipe'.

>How-To-Repeat:
Install FreeBSD 7.0-CURRENT today (around Aug 21 11:54:41 UTC 2007) and try to telnet to port 22 e.g. Or try to telnet from this computer to another. "tcpdump -i <nic> -nvvv" must show packets with incorrect checksums.
>Fix:


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: bz 
State-Changed-When: Sat Oct 20 22:19:46 UTC 2007 
State-Changed-Why:  
Committed a patch to HEAD, needs review if it helps. 


Responsible-Changed-From-To: freebsd-bugs->bz 
Responsible-Changed-By: bz 
Responsible-Changed-When: Sat Oct 20 22:19:46 UTC 2007 
Responsible-Changed-Why:  
Committed a patch to HEAD, keep trak of this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115678 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/115678: commit references a PR
Date: Sat, 20 Oct 2007 22:18:50 +0000 (UTC)

 bz          2007-10-20 22:18:42 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/i386/i386        in_cksum.c 
     sys/i386/include     in_cksum.h 
   Log:
   Fold multiple asm statements into one so that the compiler at a certain
   optimization level (-march=pentium-mmx for example) does not insert
   intermediate ops which would trash the carry.
   
   Change both sys/i386/i386/in_cksum.c[1] and sys/i386/include/in_cksum.h.
   
   To my best understanding the same problem was addressed in rev. 1.16
   of src/sys/i386/include/in_cksum.h for just a single function 3y ago.
   
   Reviewed by:  jhb
   Submitted by: Zhouyi ZHOU <zhouzhouyi FreeBSD.org> (intial version of [1])
   MFC after:    5 days
   PR:           115678, 69257
   
   Revision  Changes    Path
   1.29      +77 -43    src/sys/i386/i386/in_cksum.c
   1.18      +14 -7     src/sys/i386/include/in_cksum.h
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
To: jay-dev@simcom.ru
Cc: bug-followup@FreeBSD.org
Subject: Re: kern/115678: All tcp/udp packet have wrong checksums on -current
Date: Sat, 20 Oct 2007 22:31:10 +0000 (UTC)

 On Sat, 20 Oct 2007, bz@FreeBSD.org wrote:
 
 Hi,
 
 could you try the changes that came with this commit
 
 http://docs.freebsd.org/cgi/mid.cgi?200710202218.l9KMIgpL068209
 
 and let me know if it helps you?
 
 -- 
 Bjoern A. Zeeb                                 bzeeb at Zabbadoz dot NeT
 Software is harder than hardware  so better get it right the first time.

From: Yuri Bushmelev <jay-dev@simcom.ru>
To: "Bjoern A. Zeeb" <bz@freebsd.org>
Cc: bug-followup@freebsd.org
Subject: Re: kern/115678: All tcp/udp packet have wrong checksums on -current
Date: Sun, 21 Oct 2007 20:58:42 +0400

 > On Sat, 20 Oct 2007, bz@FreeBSD.org wrote:
 >
 > Hi,
 >
 > could you try the changes that came with this commit
 >
 > http://docs.freebsd.org/cgi/mid.cgi?200710202218.l9KMIgpL068209
 >
 > and let me know if it helps you?
 
 Sorry, I can't try this changes right now.. This installation was downgraded 
 to 6-STABLE and I have no test machine now. I'll try this within next 
 month.
 
 -- 
 Yuri Bushmelev
State-Changed-From-To: feedback->closed 
State-Changed-By: bz 
State-Changed-When: Sun Oct 21 19:16:06 UTC 2007 
State-Changed-Why:  
Sumbmitter, in private mail, said it's fine to close it. He'll come 
back and re-open it in case the problem still exists once he can test it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115678 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/115678: commit references a PR
Date: Fri, 26 Oct 2007 07:15:11 +0000 (UTC)

 bz          2007-10-26 07:15:04 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     sys/i386/i386        in_cksum.c 
     sys/i386/include     in_cksum.h 
   Log:
   MFC: rev. 1.29 sys/i386/i386/in_cksum.c
        rev. 1.18 sys/i386/include/in_cksum.h
   
     Fold multiple asm statements into one so that the compiler at a certain
     optimization level (-march=pentium-mmx for example) does not insert
     intermediate ops which would trash the carry.
   
     Change both sys/i386/i386/in_cksum.c[1] and sys/i386/include/in_cksum.h.
   
     To my best understanding the same problem was addressed in rev. 1.16
     of src/sys/i386/include/in_cksum.h for just a single function 3y ago.
   
     Reviewed by:  jhb
     Submitted by: Zhouyi ZHOU <zhouzhouyi FreeBSD.org> (intial version of [1])
     PR:           115678, 69257
   
   Approved by:    re (kensmith)
   
   Revision   Changes    Path
   1.28.10.1  +77 -43    src/sys/i386/i386/in_cksum.c
   1.17.10.1  +14 -7     src/sys/i386/include/in_cksum.h
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
