Mon Mar 16 12:13:04 2009 UTC ()
Pull a fix from hme.c rev 1.73 (to #if 0'ed out part):
> Fix a bug in calculation of checksum deduction:
> - To get 16 bit one's complement value from uint32_t variable,
>   higher 16 bits should be ignored.
> - RFC 1624 describes methods to recalculate checksum field in headers,
>   i.e. one's complement of one's complement sum that could be 0x0000,
>   but we don't have to use the strategy to deduct one's complement sum
>   itself which won't be zero but should be 0xffff.


(tsutsui)
diff -r1.128 -r1.129 src/sys/dev/ic/i82557.c

cvs diff -r1.128 -r1.129 src/sys/dev/ic/i82557.c (expand / switch to context diff)
--- src/sys/dev/ic/i82557.c 2009/03/15 14:48:11 1.128
+++ src/sys/dev/ic/i82557.c 2009/03/16 12:13:04 1.129
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82557.c,v 1.128 2009/03/15 14:48:11 tsutsui Exp $	*/
+/*	$NetBSD: i82557.c,v 1.129 2009/03/16 12:13:04 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.128 2009/03/15 14:48:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.129 2009/03/16 12:13:04 tsutsui Exp $");
 
 #include "bpfilter.h"
 #include "rnd.h"
@@ -1330,7 +1330,7 @@
 			while (hsum >> 16)
 				hsum = (hsum >> 16) + (hsum & 0xffff);
 
-			csum_data = ~(~csum_data - ~hsum);
+			csum_data += (uint16_t)~hsum;
 
 			while (csum_data >> 16)
 				csum_data =