[ee122] clarifications from today's lecture

vern at cs.berkeley.edu vern at cs.berkeley.edu
Fri Oct 26 23:14:17 PDT 2007


There were two points that came up in today's lecture that I realized
I hadn't conveyed well enough.

(1) In TCP, *every* packet other than an initial SYN (which attempts to
    establish a new connection) contains an acknowledgment, which is
    indicated by setting the ACK bit in the "flags" field in the TCP header.
    In fact, if a TCP receives a non-initial-SYN packet that does not have
    ACK set, then it is required to discard it.

    The acknowledgment *always* reflects how far into the byte stream data
    has arrived *in sequence* (that is, no earlier missing segments) at
    the receiver who is sending the ACK.

    The sequence number associated with an acknowledgment is *always* a
    value 1 beyond the highest position in the byte stream that has arrived.

    For example, for the following segments, if the receiver generates
    a packet for each, then the righthand column gives the sequence number
    that would be present in the ACK (which every such packet will have):

	SYN (ISN = 105)		ACK=106  (105 + 1)
	data (106..115)		ACK=116
	data (115..143)		ACK=144
	data (160..180)		ACK=144  (can't be higher, since no more
					  in sequence)
	data (181..195)		ACK=144  (same as previous)
	data (144..159)		ACK=196  (now all data is in sequence)

(2) In TCP's processing, the initial steps look like:

	(a) Verify header length (must be >= 20 bytes) and checksum.
	    If either fails, *discard the packet* without any further
	    processing.

	(b) Look up the 4-tuple <IP source address, IP destination address,
	    TCP source port, TCP destination port> in the kernel's connection
	    table.

	(c) If no such connection exists, then
		(d) If the received packet has SYN set and does *not* have
		    ACK set
			(e) process it as an initial SYN attempting to
			    establish a connection
		*else*
		(f) send back a RST connection and forget about the packet,
		    since it belongs to a non-existent connection

Let me know if the above aren't clear ...

		Vern


More information about the ee122 mailing list