netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Louis Aublin <pierre-louis.aublin@inria.fr>
To: netdev@vger.kernel.org
Subject: tcp/udp checksum on loopback interface
Date: Fri, 22 Jul 2011 10:01:21 +0200	[thread overview]
Message-ID: <4E292E51.4040802@inria.fr> (raw)

Hello everybody

I am interested in the reliability of TCP and UDP using the loopback 
interface.
I found that there is no checksum verification on the body of packets 
transmitted through the loopback interface : 
http://kerneltrap.org/mailarchive/linux-netdev/2007/10/2/327241
I ran a simple test using iperf and wireshark and I indeed found the 
validation of the checksum is disabled at packets reception.

At the reception, I guess the piece of code responsible for this 
behaviour is (line 1196 of net/ipv4/udp.c, in udp_recvmsg() for UDP) :
if (skb_csum_unnecessary(skb))
     err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), 
msg->msg_iov, len);
Is this the responsible piece of code? If yes, where does the 
CHECKSUM_UNNECESSARY flag is set?

However, I am not sure whether the checksum is computed on the whole 
packet at emission.
In __ip_append_data (net/ipv4/ip_output.c), I found the flag csummode is 
at the beginning at CHECKSUM_NONE.
Then, it is augmented using the dev->features flag of the network device 
(e.g. the loopback interface).
As the loopback interface has the NETIF_F_NO_CSUM flag, csummode stays 
at CHECKSUM_NONE and the checksum is not computed on the body of the 
message.
Can you confirm the checksum is computed only on the header of the 
packet when sending it through the loopback interface?

Finally, why this behaviour? Is it because you assume message can not 
get corrupted while staying on the same machine?

Thank you in advance
Pierre Louis Aublin

             reply	other threads:[~2011-07-22  8:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22  8:01 Pierre Louis Aublin [this message]
2011-07-26  0:04 ` tcp/udp checksum on loopback interface Chris Friesen

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=4E292E51.4040802@inria.fr \
    --to=pierre-louis.aublin@inria.fr \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).