From: Matti Aarnio <matti.aarnio@zmailer.org>
To: Rob Ekl <lkhelp@rekl.yi.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Sendfile, loopback, and TCP header checksum
Date: Fri, 14 Mar 2003 00:09:05 +0200 [thread overview]
Message-ID: <20030313220905.GK29167@mea-ext.zmailer.org> (raw)
In-Reply-To: <Pine.LNX.4.53.0303131510060.10653@rekl.yi.org>
On Thu, Mar 13, 2003 at 03:32:58PM -0600, Rob Ekl wrote:
> Hi. I'm working on a program that uses sendfile() to copy a file to a TCP
> socket. I did some testing where the server and client processes were on
> the same machine. While watching ethereal's packet dumps, I noticed the
> packets that sendfile() creates are reported to have incorrect checksums.
> Other packets from the same program (ie created by write() or writev() )
> have the correct checksum.
copy(-and-checksum) is needed for write*(), and during copying,
the checksumming can be thrown in essentially for free.
For sendfile(), the system does not need to do such copying,
and these days devices can be reported as capable to handle
e.g. tcp checksumming built in.
Loopback device does not bother with checksums -- it is coming
from within the box, no point in checking such things.
( see: drivers/net/loopback.c -- there are most curious set
of initialized dev->features flags. )
...
> This leads me to the conclusion that using sendfile() on a loopback
> interface over a TCP connection generates packets with incorrect checksums
> in the TCP headers.
>
> I do not know if ethereal is falsely reporting that the checksums are
> incorrect, but it's a very limited scope of the source of packets with
> incorrect checksums (only sendfile-generated to loopback).
It may well be correct report, but to calculate those would be
wasted effort.
> Is this something that even needs to be addressed, since the receiver
> would discard the packet if the checksum is incorrect, but since it's over
> loopback, there's no chance of receiving data corrupted by the transport
> medium and loopback ignores the checksum?
Quite so.
> System information: 2.4.20 on both machines, ia32 CPUs, ethereal 0.9.10
> with libpcap 0.7.
/Matti Aarnio
next prev parent reply other threads:[~2003-03-13 21:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-13 21:32 Rob Ekl
2003-03-13 22:09 ` Matti Aarnio [this message]
[not found] <Pine.LNX.4.53.0303131510060.10653@rekl.yi.org.suse.lists.linux.kernel>
2003-03-13 21:58 ` Andi Kleen
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=20030313220905.GK29167@mea-ext.zmailer.org \
--to=matti.aarnio@zmailer.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkhelp@rekl.yi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®