summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2013-03-09 17:17:12 +0000
committerbluhm <bluhm@openbsd.org>2013-03-09 17:17:12 +0000
commita240989f25fde28454f336ef528b842a2873b8f3 (patch)
treeaaadf4104850877f19ef9fd7f219f677b86a7b08
parentre-arrange the pre-accounting of the objects in the buffer so it (diff)
downloadwireguard-openbsd-a240989f25fde28454f336ef528b842a2873b8f3.tar.xz
wireguard-openbsd-a240989f25fde28454f336ef528b842a2873b8f3.zip
Calculating the IP header checksum on Realtek 8168 is broken if the
packet has IP options. Disable IP checksum offloading for the affected revisions. From FreeBSD; OK sthen@ brad@
-rw-r--r--sys/dev/ic/re.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c
index 877fb08079c..39f824e609b 100644
--- a/sys/dev/ic/re.c
+++ b/sys/dev/ic/re.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: re.c,v 1.139 2012/05/09 13:30:12 jsg Exp $ */
+/* $OpenBSD: re.c,v 1.140 2013/03/09 17:17:12 bluhm Exp $ */
/* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -1139,8 +1139,21 @@ re_attach(struct rl_softc *sc, const char *intrstr)
m_clsetwms(ifp, MCLBYTES, 2, RL_RX_DESC_CNT);
- ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_IPv4 |
- IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ /*
+ * RTL8168/8111C generates wrong IP checksummed frame if the
+ * packet has IP options so disable TX IP checksum offloading.
+ */
+ switch (sc->sc_hwrev) {
+ case RL_HWREV_8168C:
+ case RL_HWREV_8168C_SPIN2:
+ case RL_HWREV_8168CP:
+ ifp->if_capabilities = IFCAP_VLAN_MTU |
+ IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ break;
+ default:
+ ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_IPv4 |
+ IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ }
#if NVLAN > 0
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;