netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* tcp/udp checksum on loopback interface
@ 2011-07-22  8:01 Pierre Louis Aublin
  2011-07-26  0:04 ` Chris Friesen
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Louis Aublin @ 2011-07-22  8:01 UTC (permalink / raw)
  To: netdev

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-26  0:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-22  8:01 tcp/udp checksum on loopback interface Pierre Louis Aublin
2011-07-26  0:04 ` Chris Friesen

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).