[dpdk-stable] patch 'net: fix unneeded replacement of TCP checksum 0' has been queued to stable release 19.11.4

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Jul 24 13:59:23 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/26/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From 5da4bb34fba48f2455382261d59b2c97283bcf6f Mon Sep 17 00:00:00 2001
From: Hongzhi Guo <guohongzhi1 at huawei.com>
Date: Fri, 10 Jul 2020 14:55:51 +0800
Subject: [PATCH] net: fix unneeded replacement of TCP checksum 0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit d5df2ae0428a147b80bbb65d623f88f75d28b226 ]

Per RFC768:
If the computed checksum is zero, it is transmitted as all ones.
An all zero transmitted checksum value means that the transmitter
generated no checksum.

RFC793 for TCP has no such special treatment for the checksum of zero.

Fixes: 6006818cfb26 ("net: new checksum functions")

Signed-off-by: Hongzhi Guo <guohongzhi1 at huawei.com>
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
Acked-by: Morten Brørup <mb at smartsharesystems.com>
---
 lib/librte_net/rte_ip.h | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index ece2e433c..6254c5cc6 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -324,8 +324,7 @@ rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
  * @param l4_hdr
  *   The pointer to the beginning of the L4 header.
  * @return
- *   The complemented checksum to set in the IP packet
- *   or 0 on error
+ *   The complemented checksum to set in the IP packet.
  */
 static inline uint16_t
 rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
@@ -344,7 +343,12 @@ rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
 
 	cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
 	cksum = (~cksum) & 0xffff;
-	if (cksum == 0)
+	/*
+	 * Per RFC 768:If the computed checksum is zero for UDP,
+	 * it is transmitted as all ones
+	 * (the equivalent in one's complement arithmetic).
+	 */
+	if (cksum == 0 && ipv4_hdr->next_proto_id == IPPROTO_UDP)
 		cksum = 0xffff;
 
 	return (uint16_t)cksum;
@@ -436,7 +440,12 @@ rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
 
 	cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
 	cksum = (~cksum) & 0xffff;
-	if (cksum == 0)
+	/*
+	 * Per RFC 768: If the computed checksum is zero for UDP,
+	 * it is transmitted as all ones
+	 * (the equivalent in one's complement arithmetic).
+	 */
+	if (cksum == 0 && ipv6_hdr->proto == IPPROTO_UDP)
 		cksum = 0xffff;
 
 	return (uint16_t)cksum;
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-07-24 12:53:53.360013436 +0100
+++ 0125-net-fix-unneeded-replacement-of-TCP-checksum-0.patch	2020-07-24 12:53:48.419008919 +0100
@@ -1,4 +1,4 @@
-From d5df2ae0428a147b80bbb65d623f88f75d28b226 Mon Sep 17 00:00:00 2001
+From 5da4bb34fba48f2455382261d59b2c97283bcf6f Mon Sep 17 00:00:00 2001
 From: Hongzhi Guo <guohongzhi1 at huawei.com>
 Date: Fri, 10 Jul 2020 14:55:51 +0800
 Subject: [PATCH] net: fix unneeded replacement of TCP checksum 0
@@ -6,6 +6,8 @@
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
 
+[ upstream commit d5df2ae0428a147b80bbb65d623f88f75d28b226 ]
+
 Per RFC768:
 If the computed checksum is zero, it is transmitted as all ones.
 An all zero transmitted checksum value means that the transmitter
@@ -14,7 +16,6 @@
 RFC793 for TCP has no such special treatment for the checksum of zero.
 
 Fixes: 6006818cfb26 ("net: new checksum functions")
-Cc: stable at dpdk.org
 
 Signed-off-by: Hongzhi Guo <guohongzhi1 at huawei.com>
 Acked-by: Olivier Matz <olivier.matz at 6wind.com>
@@ -24,7 +25,7 @@
  1 file changed, 13 insertions(+), 4 deletions(-)
 
 diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
-index 292f63fd7..a9ffc3357 100644
+index ece2e433c..6254c5cc6 100644
 --- a/lib/librte_net/rte_ip.h
 +++ b/lib/librte_net/rte_ip.h
 @@ -324,8 +324,7 @@ rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
@@ -51,7 +52,7 @@
  		cksum = 0xffff;
  
  	return (uint16_t)cksum;
-@@ -438,7 +442,12 @@ rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
+@@ -436,7 +440,12 @@ rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
  
  	cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
  	cksum = (~cksum) & 0xffff;


More information about the stable mailing list