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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/