Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Dec 2012 20:58:09 -0600
From:      Mike Karels <mike_karels@mcafee.com>
To:        <FreeBSD-gnats-submit@FreeBSD.org>
Subject:   kern/174851: UDP checksum offload is wrong in bxe driver
Message-ID:  <201212310258.qBV2w9Hl051200@mcafee.com>
Resent-Message-ID: <201212310310.qBV3A0wN048386@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         174851
>Category:       kern
>Synopsis:       UDP checksum offload is wrong in bxe driver
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 31 03:10:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Mike Karels
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
McAfee, Inc
>Environment:
System: FreeBSD freebsd-current.karels.net 10.0-CURRENT FreeBSD 10.0-CURRENT #1 r244048: Sun Dec  9 18:48:31 UTC 2012     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
	
>Description:
	UDP checksums are wrong when checksum offload is enabled with
	the bxe driver
	Note: problem was found and fixed on a FreeBSD 8.2 derivative;
	the patch compiles with -current.
>How-To-Repeat:
	send UDP traffic via bxe; note that it doesn't work because the
	checksums are bad on the receiving system.
>Fix:
Index: if_bxe.c
===================================================================
--- if_bxe.c	(revision 244606)
+++ if_bxe.c	(working copy)
@@ -9194,15 +9194,15 @@
 				 * Calculate a pseudo header checksum over
 				 * the 10 bytes	before the UDP header.
 				 */
-				tmp_csum = in_pseudo(ntohl(*tmp_uh),
-				    ntohl(*(tmp_uh + 1)),
-				    ntohl((*(tmp_uh + 2)) & 0x0000FFFF));
+				tmp_csum = in_pseudo(*tmp_uh,
+				    *(tmp_uh + 1),
+				    *(uint16_t *)(tmp_uh + 2));
 
 				/* Update the enet + IP + UDP header length. */
 				tx_parse_bd->total_hlen +=
 				    (sizeof(struct udphdr) >> 1);
 				tx_parse_bd->tcp_pseudo_csum =
-				    ~in_addword(uh->uh_sum, ~tmp_csum);
+				    ntohs(in_addword(uh->uh_sum, ~tmp_csum));
 			}
 
 			/* Update the offload flags. */
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212310258.qBV2w9Hl051200>