summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprocter <procter@openbsd.org>2020-07-04 06:06:16 +0000
committerprocter <procter@openbsd.org>2020-07-04 06:06:16 +0000
commit8069430e8c6975766de84de2d430a4593ff92410 (patch)
tree00a23146ce11aa6ba045519766b2cbbc24c361a4
parentIncrement line number when skipping multi-line comments. (diff)
downloadwireguard-openbsd-8069430e8c6975766de84de2d430a4593ff92410.tar.xz
wireguard-openbsd-8069430e8c6975766de84de2d430a4593ff92410.zip
Permit the stack to check transport and network checksums. Although the link
provides stronger integrity checks, it needn't cover the end-to-end transport path. And it is in any case a layer violation for one layer to disable the checks of another. Skipping the network check saved ~2.4% +/- ~0.2% of cp_time (sys+intr) on the forwarding path of a 1Ghz AMD G-T40N (apu1). Other checksum speedups exist which do not skip the check. ok claudio@ kn@ stsp@
-rw-r--r--sys/net/if_wg.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/sys/net/if_wg.c b/sys/net/if_wg.c
index 3f59681fed8..a1b4d409deb 100644
--- a/sys/net/if_wg.c
+++ b/sys/net/if_wg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wg.c,v 1.7 2020/06/23 10:03:49 tobhe Exp $ */
+/* $OpenBSD: if_wg.c,v 1.8 2020/07/04 06:06:16 procter Exp $ */
/*
* Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
@@ -1660,14 +1660,8 @@ wg_decap(struct wg_softc *sc, struct mbuf *m)
goto error;
}
- /*
- * We can mark incoming packet csum OK. We mark all flags OK
- * irrespective to the packet type.
- */
- m->m_pkthdr.csum_flags |= (M_IPV4_CSUM_IN_OK | M_TCP_CSUM_IN_OK |
- M_UDP_CSUM_IN_OK | M_ICMP_CSUM_IN_OK);
- m->m_pkthdr.csum_flags &= ~(M_IPV4_CSUM_IN_BAD | M_TCP_CSUM_IN_BAD |
- M_UDP_CSUM_IN_BAD | M_ICMP_CSUM_IN_BAD);
+ /* tunneled packet was not offloaded */
+ m->m_pkthdr.csum_flags = 0;
m->m_pkthdr.ph_ifidx = sc->sc_if.if_index;
m->m_pkthdr.ph_rtableid = sc->sc_if.if_rdomain;