Bug 115678

Summary: All tcp/udp packet have wrong checksums on -current
Product: Base System Reporter: Yuri Bushmelev <jay-dev>
Component: kernAssignee: Bjoern A. Zeeb <bz>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 7.0-CURRENT   
Hardware: Any   
OS: Any   

Description Yuri Bushmelev 2007-08-21 10:30:17 UTC
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 r23 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.
Comment 1 dfilter service freebsd_committer freebsd_triage 2007-10-20 23:18:50 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"
Comment 2 Bjoern A. Zeeb freebsd_committer freebsd_triage 2007-10-20 23:19:46 UTC
State Changed
From-To: open->feedback

Committed a patch to HEAD, needs review if it helps. 


Comment 3 Bjoern A. Zeeb freebsd_committer freebsd_triage 2007-10-20 23:19:46 UTC
Responsible Changed
From-To: freebsd-bugs->bz

Committed a patch to HEAD, keep trak of this.
Comment 4 Bjoern A. Zeeb freebsd_committer freebsd_triage 2007-10-20 23:31:10 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.
Comment 5 Yuri Bushmelev 2007-10-21 17:58:42 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?

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
Comment 6 Bjoern A. Zeeb freebsd_committer freebsd_triage 2007-10-21 20:16:06 UTC
State Changed
From-To: feedback->closed

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.
Comment 7 dfilter service freebsd_committer freebsd_triage 2007-10-26 08:15:11 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"