[dpdk-dev] [PATCH] bugfix: udptcp_checksum should tread tcp and udp differently

Stephen Hemminger stephen at networkplumber.org
Wed May 27 17:02:42 CEST 2020


On Wed, 27 May 2020 22:41:27 +0800
guohongzhi <guohongzhi1 at huawei.com> wrote:

> +	/* For Udp, if the computed checksum is zero,
> +	 * it is transmitted as all ones.RFC768
> +	 */
> +	if (cksum == 0 && ipv4_hdr->next_proto_id == IPPROTO_UDP)
>  		cksum = 0xffff;
>  


The comment should be reformatted to be clearer.

Maybe:
	/*
	 * Per RFC768:
	 * If the computed  checksum  is zero,it is transmitted  as all ones
	 * (the equivalent  in one's complement  arithmetic).
	 */

There is no special case required here, it is true for TCP as well.
In TCP it appears 0 is allowed but not generally used. Most implementations
use common checksum for both TCP and UDP


More information about the dev mailing list