[comp.protocols.tcp-ip] ? : TCP Data Integrity

mock@watt.support.Corp.Sun.COM (Joseph Mocker) (02/28/91)

o.k. you TCP Guru's, Heres one for ya!

I've been reading up on the TCP/IP protocol suite and I got a question about
TCP. I can't seem to find out how TCP insures data integrity? in the
TCP Segment header, there is a checksum field, but that seems to be only
for the Header information. So by that, we know that the data got to the
right place, but there is nothing that checksums the data sent. Is this up
to the user program? How is data integrity kept in a TCP transaction?

thanks...joe
--
------------------------------------------------------------------------------
Joe Mocker//USAC//PC-NFS Support :: mock@Corp.Sun.COM :: Sun Microsystems Inc.

  :: there's still lofty dreams  ::  meager desires  ::  still sillyness ::  

romkey@ASYLUM.SF.CA.US (John Romkey) (02/28/91)

The TCP checksum includes the TCP header, the psuedoheader (which
isn't transmitted) and the TCP data. The IP checksum only includes the
IP header.
		- john romkey			Epilogue Technology
USENET/UUCP/Internet:  romkey@asylum.sf.ca.us	FAX: 415 594-1141

barmar@think.com (Barry Margolin) (02/28/91)

In article <MOCK.91Feb27120033@watt.support.Corp.Sun.COM> mock@watt.support.Corp.Sun.COM (Joseph Mocker) writes:
>I've been reading up on the TCP/IP protocol suite and I got a question about
>TCP. I can't seem to find out how TCP insures data integrity? in the
>TCP Segment header, there is a checksum field, but that seems to be only
>for the Header information. So by that, we know that the data got to the
>right place, but there is nothing that checksums the data sent. Is this up
>to the user program? How is data integrity kept in a TCP transaction?

You apparently misread.  TCP checksums the entire segment.  UDP's optional
checksum is also of the entire datagram.

IP, however, has a header-only checksum, but IP doesn't claim to ensure
data integrity.  It was designed so that it could be used by applications
that care more about speed than accuracy (e.g. digitized voice).
--
Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar

kasten@EUROPA.CLEARPOINT.COM (Frank Kastenholz) (02/28/91)

 > From tcp-ip-RELAY@NIC.DDN.MIL Thu Feb 28 00:23:15 1991
 > From: sun-barr!newstop!jethro!mock@apple.com  (Joseph Mocker)
 > Organization: Sun Microsystems Inc.
 > Subject: ? : TCP Data Integrity
 > Sender: tcp-ip-relay@nic.ddn.mil
 > To: tcp-ip@nic.ddn.mil
 > 
 > o.k. you TCP Guru's, Heres one for ya!
 > 
 > I've been reading up on the TCP/IP protocol suite and I got a question about
 > TCP. I can't seem to find out how TCP insures data integrity? in the
 > TCP Segment header, there is a checksum field, but that seems to be only
 > for the Header information. So by that, we know that the data got to the
 > right place, but there is nothing that checksums the data sent. Is this up
 > to the user program? How is data integrity kept in a TCP transaction?
 > 
 > thanks...joe
 > --
 > ------------------------------------------------------------------------------
 > Joe Mocker//USAC//PC-NFS Support :: mock@Corp.Sun.COM :: Sun Microsystems Inc.
 > 
 >   :: there's still lofty dreams  ::  meager desires  ::  still sillyness ::  

Joe,
 
From the TCP RFC (RFC793)
 
  Checksum:  16 bits
 
    The checksum field is the 16 bit one's complement of the one's
    complement sum of all 16 bit words in the header and text.  If a
    segment contains an odd number of header and text octets to be
                                             ^^^^^^^^
                                             aka the data
    checksummed, the last octet is padded on the right with zeros to
    form a 16 bit word for checksum purposes.  The pad is not
    transmitted as part of the segment.  While computing the checksum,
    the checksum field itself is replaced with zeros.
 
    The checksum also covers a 96 bit pseudo header conceptually

 
[Page 16]
^L

September 1981
                                           Transmission Control Protocol
                                                Functional Specification
 
 

    prefixed to the TCP header.  This pseudo header contains the Source
    Address, the Destination Address, the Protocol, and TCP length.
    This gives the TCP protection against misrouted segments.  This
    information is carried in the Internet Protocol and is transferred
    across the TCP/Network interface in the arguments or results of
    calls by the TCP on the IP.
 
                     +--------+--------+--------+--------+
                     |           Source Address          |
                     +--------+--------+--------+--------+
                     |         Destination Address       |
                     +--------+--------+--------+--------+
                     |  zero  |  PTCL  |    TCP Length   |
                     +--------+--------+--------+--------+
 
      The TCP Length is the TCP header length plus the data length in
      octets (this is not an explicitly transmitted quantity, but is
      computed), and it does not count the 12 octets of the pseudo
      header.