Disable TCP and UDP transmit checksum offloading
authormikeb <mikeb@openbsd.org>
Sat, 20 Jan 2018 20:03:45 +0000 (20:03 +0000)
committermikeb <mikeb@openbsd.org>
Sat, 20 Jan 2018 20:03:45 +0000 (20:03 +0000)
In certain configurations, transmit checksum offloading doesn't
appear to work correctly, preventing correct TCP and UDP operation.
Some of these issues involving VLAN tagging are documented by the
Xen project.

Problem reported and fix tested by Imre Oolberg, thanks!

sys/dev/pv/if_xnf.c

index 1f5c391..75d29eb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_xnf.c,v 1.62 2017/12/09 14:00:21 mikeb Exp $       */
+/*     $OpenBSD: if_xnf.c,v 1.63 2018/01/20 20:03:45 mikeb Exp $       */
 
 /*
  * Copyright (c) 2015, 2016 Mike Belopuhov
@@ -1112,6 +1112,7 @@ xnf_capabilities(struct xnf_softc *sc)
        if (error == 0 && res == 1)
                sc->sc_caps |= XNF_CAP_SG;
 
+#if 0
        /* Query IPv4 checksum offloading capability, enabled by default */
        sc->sc_caps |= XNF_CAP_CSUM4;
        prop = "feature-no-csum-offload";
@@ -1128,6 +1129,7 @@ xnf_capabilities(struct xnf_softc *sc)
                goto errout;
        if (error == 0 && res == 1)
                sc->sc_caps |= XNF_CAP_CSUM6;
+#endif
 
        /* Query multicast traffic contol capability */
        prop = "feature-multicast-control";
@@ -1192,6 +1194,13 @@ xnf_init_backend(struct xnf_softc *sc)
                        goto errout;
        }
 
+       /* Disable IPv4 checksum offloading */
+       if (!(sc->sc_caps & XNF_CAP_CSUM4)) {
+               prop = "feature-no-csum-offload";
+               if (xs_setnum(sc->sc_parent, sc->sc_node, prop, 1))
+                       goto errout;
+       }
+
        /* Enable IPv6 checksum offloading */
        if (sc->sc_caps & XNF_CAP_CSUM6) {
                prop = "feature-ipv6-csum-offload";