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

From: Bill Fink <[email-masked]>
Date: Sat, 11 Nov 2006 13:07:24 -0500

On Thu, 09 Nov 2006, David Miller wrote:

> From: Brian Haley <[email-masked]>
> Date: Thu, 09 Nov 2006 12:32:18 -0500
> 
> > 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.
> 
> This is how things look to me too.
> 
> > > and similar in net/ipv6/raw.c
> > 
> > Maybe here it only needs to be done if (fl->proto == IPPROTO_UDP)?
> 
> Yes, I believe that is what is needed.

On a raw IPv6 socket, shouldn't the IP checksum just be left
unchanged, so you can test transmission of IPv6 packets with
an invalid zero IP checksum.  Or is raw not fully raw?

						-Bill