From a81683c37110b4ea67bdb2976c5fdad50650ffa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Date: Tue, 7 Mar 2017 09:18:52 +0000 Subject: [PATCH] xen/netfront: fix inbound packet flags for checksum offload Currently netfront is setting the flags of inbound packets with the checksum not present (offloaded) to (CSUM_IP_CHECKED | CSUM_IP_VALID | CSUM_DATA_VALID | CSUM_PSEUDO_HDR). According to the mbuf(9) man page this is not the correct combination of flags, it should instead be (CSUM_DATA_VALID | CSUM_PSEUDO_HDR). Reviewed by: Wei Liu MFC after: 2 weeks Sponsored by: Citrix Systems R&D Differential revision: https://reviews.freebsd.org/D9831 --- sys/dev/xen/netfront/netfront.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c index dea722a35a4..99ccdaaf500 100644 --- a/sys/dev/xen/netfront/netfront.c +++ b/sys/dev/xen/netfront/netfront.c @@ -1192,15 +1192,17 @@ xn_rxeof(struct netfront_rxq *rxq) m->m_pkthdr.rcvif = ifp; if ( rx->flags & NETRXF_data_validated ) { - /* Tell the stack the checksums are okay */ /* - * XXX this isn't necessarily the case - need to add - * check + * According to mbuf(9) the correct way to tell + * the stack that the checksum of an inbound + * packet is correct, without it actually being + * present (because the underlying interface + * doesn't provide it), is to set the + * CSUM_DATA_VALID and CSUM_PSEUDO_HDR flags, + * and the csum_data field to 0xffff. */ - - m->m_pkthdr.csum_flags |= - (CSUM_IP_CHECKED | CSUM_IP_VALID | CSUM_DATA_VALID - | CSUM_PSEUDO_HDR); + m->m_pkthdr.csum_flags |= (CSUM_DATA_VALID + | CSUM_PSEUDO_HDR); m->m_pkthdr.csum_data = 0xffff; } if ((rx->flags & NETRXF_extra_info) != 0 &&