net: fix IPv4 checksum

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>
This commit is contained in:
Hongzhi Guo 2020-05-26 18:08:05 +08:00 committed by Thomas Monjalon
parent ce77f03ca3
commit 06602c671a

View 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;
}
/**