kern/174851: UDP checksum offload is wrong in bxe driver
Mike Karels
mike_karels at mcafee.com
Mon Dec 31 03:10:01 UTC 2012
>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 at 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:
More information about the freebsd-bugs
mailing list