Subject: kern/32653: -current ipv6 broken with in6_cksum.c rev. 1.18
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <mrt@notwork.org>
List: netbsd-bugs
Date: 01/27/2006 19:25:00
>Number:         32653
>Category:       kern
>Synopsis:       -current ipv6 broken with in6_cksum.c rev. 1.18 by checksum miscalculation.
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 27 19:25:00 +0000 2006
>Originator:     mrt@notwork.org
>Release:        NetBSD 3.99.15
>Organization:
Notwork.
>Environment:
System: NetBSD fons-adae 3.99.15 NetBSD 3.99.15 (WILLIAM) #188: Sat Jan 28 04:01:32 JST 2006 mrt@fons-adae:/sys/arch/amd64/compile/WILLIAM amd64
Architecture: x86_64
Machine: amd64
>Description:
-current in6_cksum() of in6_cksum.c rev. 1.18 produces wrong checksum because
of double addition of first 16 bit of the ipv6 source address. It seems the
line:
	sum += w[0];
is accidentally left there.
>How-To-Repeat:
build kernel and run with ipv6 enabled.
>Fix:
Apply following:

Index: in6_cksum.c
===================================================================
RCS file: /home/mrt/src/netbsdcvs/src/sys/netinet6/in6_cksum.c,v
retrieving revision 1.18
diff -u -r1.18 in6_cksum.c
--- in6_cksum.c	21 Jan 2006 00:15:36 -0000	1.18
+++ in6_cksum.c	27 Jan 2006 19:01:03 -0000
@@ -147,7 +147,6 @@
 	in6 = ip6->ip6_src;
 	in6_clearscope(&in6);
 	w = (u_int16_t *)&in6;
-	sum += w[0];
 	sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3];
 	sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7];