Subject: Re: why do we mangle checksums for v6 ICMP?

From: Brian Haley <[email-masked]>
Date: Thu, 09 Nov 2006 12:32:18 -0500

Hi Al,

Al Viro wrote:
> 	AFAICS, the rules are:
> 
> (1) checksum is 16-bit one's complement of the one's complement sum of
> relevant 16bit words.
> 
> (2) for v4 UDP all-zeroes has special meaning - no checksum; if you get
> it from (1), send all-ones instead.
> 
> (3) for v6 UDP we have the same remapping as in (2), but all-zeroes has
> different meaning - not "ignore checksum" as in v4, but "reject the
> packet".
> 
> (4) there is no (4).
> 
> 	IOW, nobody except UDP has any business doing that 0->0xffff
> replacement.  However, we have
>        if (icmp6h->icmp6_cksum == 0)
>                icmp6h->icmp6_cksum = -1;

This doesn't look necessary, RFCs 4443/2463 don't mention it being 
necessary, and BSD doesn't do it either.  I'll cook-up a patch to remove 
that since I was doing some other mods in that codepath.

> and similar in net/ipv6/raw.c

Maybe here it only needs to be done if (fl->proto == IPPROTO_UDP)?

-Brian