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.
This commit is contained in:
tsutsui 2009-03-16 12:13:04 +00:00
parent 24a0836984
commit 7a44ef30a5
1 changed files with 3 additions and 3 deletions

View File

@ -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 @@ fxp_rx_hwcksum(struct fxp_softc *sc, struct mbuf *m, const struct fxp_rfa *rfa,
while (hsum >> 16)
hsum = (hsum >> 16) + (hsum & 0xffff);
csum_data = ~(~csum_data - ~hsum);
csum_data += (uint16_t)~hsum;
while (csum_data >> 16)
csum_data =