net: fix IPv4 checksum
authorHongzhi Guo <guohongzhi1@huawei.com>
Tue, 26 May 2020 10:08:05 +0000 (18:08 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 24 Jun 2020 21:42:20 +0000 (23:42 +0200)
0xffff is invalid for IPv4 checksum (RFC1624)

Fixes: 6006818cfb26 ("net: new checksum functions")
Cc: stable@dpdk.org
Signed-off-by: Hongzhi Guo <guohongzhi1@huawei.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
lib/librte_net/rte_ip.h

index 4c4437a..292f63f 100644 (file)
@@ -267,7 +267,7 @@ rte_ipv4_cksum(const struct rte_ipv4_hdr *ipv4_hdr)
 {
        uint16_t cksum;
        cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr));
-       return (cksum == 0xffff) ? cksum : (uint16_t)~cksum;
+       return (uint16_t)~cksum;
 }
 
 /**