From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 472A9A32A2 for ; Thu, 24 Oct 2019 18:29:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1A8951EB7A; Thu, 24 Oct 2019 18:29:32 +0200 (CEST) Received: from sysclose.org (smtp.sysclose.org [69.164.214.230]) by dpdk.org (Postfix) with ESMTP id 62DBC1EB5A; Thu, 24 Oct 2019 18:29:28 +0200 (CEST) Received: by sysclose.org (Postfix, from userid 5001) id B497E2CEB; Thu, 24 Oct 2019 16:29:27 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 sysclose.org B497E2CEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sysclose.org; s=201903; t=1571934567; bh=HxgbXvNVJPqce0QUF5Qm1Rlcj0xQelE95mbWGJ3mjQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KtUhK2AUFSdRgkQl/a8ClqVnPa359K/Pr4r7Nhl43B6rjgQGv82rb848kmW2Lnnr+ /xNJhnG/QluS6iSWRBRDjx/XdgSk5I0vAqmf0HFhgjLwCtDmmSYvVQE8L3uRgliVtA 5mrZyWyGjKcOLOdpEXcSXC/eysMEfltgF11C0OQiJrkCHM7Tl3bmps7zYX1PVC1oHo v+IYrop9gccqo7i03VtlYzSF/8bI1ecXVb8cgHGHgsROjZb//51oucds/jLurB05oH bODXvZkXCuJinft1X8NAJRcBBn6Pd8N8tbAH1S949o/1na+1ouNFbks3QDazBSD8PV rf15mlyxLZIiw== X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.sysclose.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (unknown [177.183.215.210]) by sysclose.org (Postfix) with ESMTPSA id D3EA82C6C; Thu, 24 Oct 2019 16:29:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 sysclose.org D3EA82C6C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sysclose.org; s=201903; t=1571934567; bh=HxgbXvNVJPqce0QUF5Qm1Rlcj0xQelE95mbWGJ3mjQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KtUhK2AUFSdRgkQl/a8ClqVnPa359K/Pr4r7Nhl43B6rjgQGv82rb848kmW2Lnnr+ /xNJhnG/QluS6iSWRBRDjx/XdgSk5I0vAqmf0HFhgjLwCtDmmSYvVQE8L3uRgliVtA 5mrZyWyGjKcOLOdpEXcSXC/eysMEfltgF11C0OQiJrkCHM7Tl3bmps7zYX1PVC1oHo v+IYrop9gccqo7i03VtlYzSF/8bI1ecXVb8cgHGHgsROjZb//51oucds/jLurB05oH bODXvZkXCuJinft1X8NAJRcBBn6Pd8N8tbAH1S949o/1na+1ouNFbks3QDazBSD8PV rf15mlyxLZIiw== From: Flavio Leitner To: dev@dpdk.org Cc: Maxime Coquelin , Tiwei Bie , Obrembski MichalX , stable@dpdk.org Date: Thu, 24 Oct 2019 13:29:19 -0300 Message-Id: <20191024162919.15009-1-fbl@sysclose.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191024142814.10979-1-fbl@sysclose.org> References: <20191024142814.10979-1-fbl@sysclose.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v2] vhost: fix IPv4 csum calculation X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Currently the IPv4 header checksum is calculated including its current value, which can be a valid checksum or just garbage. In any case, if the original value is not zero, then the result is always wrong. The IPv4 checksum is defined in RFC791, page 14 says: Header Checksum: 16 bits The checksum algorithm is: The checksum field is the 16 bit one's complement of the one's complement sum of all 16 bit words in the header. For purposes of computing the checksum, the value of the checksum field is zero. Thus force the csum field to always be zero. Fixes: b08b8cfeb2ae ("vhost: fix IP checksum") Cc: stable@dpdk.org Signed-off-by: Flavio Leitner --- lib/librte_vhost/virtio_net.c | 1 + 1 file changed, 1 insertion(+) v2: CC stable Added 'Fixes:' line. diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index eae7825f04..cde7498c76 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -445,6 +445,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct rte_ipv4_hdr *, m_buf->l2_len); + ipv4_hdr->hdr_checksum = 0; ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } -- 2.20.1