All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Brian Haley <brian.haley@hp.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH] IPv6: optimize echo reply checksum calculation
Date: Fri, 10 Nov 2006 18:20:31 +0000	[thread overview]
Message-ID: <20061110182031.GO29920@ftp.linux.org.uk> (raw)
In-Reply-To: <20061110180534.GN29920@ftp.linux.org.uk>

On Fri, Nov 10, 2006 at 06:05:34PM +0000, Al Viro wrote:
> On Fri, Nov 10, 2006 at 12:51:19PM -0500, Brian Haley wrote:
> > Al Viro wrote:
> > >On Fri, Nov 10, 2006 at 11:25:53AM -0500, Brian Haley wrote:
> > >>Since the only difference between echo requests and echo replies is the 
> > >>ICMPv6 type value (which is a difference of 1), just subtracting one 
> > >>from the request checksum will result in the correct checksum for the 
> > >>reply.
> > >
> > >Um, no.  That will *not* result in correct checksum.  Please, RTFRFC 1071.
> > 
> > I verified this works for echo request/reply on my IA64 box, 
> > double-checked with ethereal/wireshark.  Is there something specific in 
> > RFC 1071 that I should be looking for?
> 
> Definition of checksum.
> 
> See also include/net/ip.h::ip_decrease_ttl() for similar situation.

Note that even on little-endian you want
	3 -> 2
	2 -> 1
	1 -> 0xffff
	0 -> 0xfffe

On big-endian you get

	0x102 -> 2
	0x101 -> 1
	0x100 -> 0xffff
	0xff  -> 0xfffe
	...
	0     -> 0xfeff

so -= 1 is broken even on ia64 and it's *always* broken on big-endian
boxen.

  reply	other threads:[~2006-11-10 18:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-08 22:13 why do we mangle checksums for v6 ICMP? Al Viro
2006-11-08 22:28 ` Al Viro
2006-11-09 17:32 ` Brian Haley
2006-11-09 23:14   ` David Miller
2006-11-10 16:24     ` [PATCH] IPv6: only modify checksum for UDP Brian Haley
2006-11-10 17:54       ` David Stevens
2006-11-14  0:50         ` David Miller
2006-11-14  1:18           ` Al Viro
2006-11-14  1:44           ` David Stevens
2006-11-14  1:52             ` Al Viro
2006-11-10 22:55       ` David Miller
2006-11-10 23:17         ` Nivedita Singhvi
2006-11-10 23:26           ` David Miller
2006-11-10 23:36             ` Nivedita Singhvi
2006-11-12  1:30             ` Brian Haley
2006-11-10 16:25     ` [PATCH] IPv6: optimize echo reply checksum calculation Brian Haley
2006-11-10 17:34       ` Al Viro
2006-11-10 17:51         ` Brian Haley
2006-11-10 18:05           ` Al Viro
2006-11-10 18:20             ` Al Viro [this message]
2006-11-10 19:04               ` Brian Haley
2006-11-10 19:17                 ` Al Viro
2006-11-10 21:06                   ` Brian Haley
2006-11-11  1:45                     ` Al Viro
2006-11-11 18:07     ` why do we mangle checksums for v6 ICMP? Bill Fink
2006-11-13  7:04       ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061110182031.GO29920@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=brian.haley@hp.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.