On Wed, 27 May 2020 22:41:27 +0800
guohongzhi <guohongz...@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

Reply via email to