summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authornaddy <naddy@openbsd.org>2009-06-04 04:48:24 +0000
committernaddy <naddy@openbsd.org>2009-06-04 04:48:24 +0000
commit4bb1c97e2f822ecf1dc209141d4935a124e959f7 (patch)
tree3d8518bba95d267e7fa26988f2a00f8810848e05 /sys
parentAdd "rde rib <name>" to the config and allow the rde to use these other RIBs. (diff)
downloadwireguard-openbsd-4bb1c97e2f822ecf1dc209141d4935a124e959f7.tar.xz
wireguard-openbsd-4bb1c97e2f822ecf1dc209141d4935a124e959f7.zip
Fix IPv4 rx checksumming for the non-TCP/UDP case. DESCV2 chips
don't set RL_RDESC_STAT_PROTOID for non-TCP/UDP IP packets, only RL_RDESC_IPV[46]. Also check RL_RDESC_IPV[46] before inspecting the TCP/UDP checksum bits to make IPv6 TCP/UDP checksum offload work intentionally. Gleaned from NetBSD.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/re.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c
index 2c0c3af8973..ec0094aa5af 100644
--- a/sys/dev/ic/re.c
+++ b/sys/dev/ic/re.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: re.c,v 1.106 2009/06/03 00:11:19 sthen Exp $ */
+/* $OpenBSD: re.c,v 1.107 2009/06/04 04:48:24 naddy Exp $ */
/* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -1445,16 +1445,16 @@ re_rxeof(struct rl_softc *sc)
if (sc->rl_flags & RL_FLAG_DESCV2) {
/* Check IP header checksum */
- if ((rxstat & RL_RDESC_STAT_PROTOID) &&
- !(rxstat & RL_RDESC_STAT_IPSUMBAD) &&
- (rxvlan & RL_RDESC_IPV4))
+ if ((rxvlan & RL_RDESC_IPV4) &&
+ !(rxstat & RL_RDESC_STAT_IPSUMBAD))
m->m_pkthdr.csum_flags |= M_IPV4_CSUM_IN_OK;
/* Check TCP/UDP checksum */
- if (((rxstat & RL_RDESC_STAT_TCP) &&
+ if ((rxvlan & (RL_RDESC_IPV4|RL_RDESC_IPV6)) &&
+ (((rxstat & RL_RDESC_STAT_TCP) &&
!(rxstat & RL_RDESC_STAT_TCPSUMBAD)) ||
((rxstat & RL_RDESC_STAT_UDP) &&
- !(rxstat & RL_RDESC_STAT_UDPSUMBAD)))
+ !(rxstat & RL_RDESC_STAT_UDPSUMBAD))))
m->m_pkthdr.csum_flags |= M_TCP_CSUM_IN_OK |
M_UDP_CSUM_IN_OK;
} else {