TCP/IP Illustracted Vol2. 제목 : TCP Input 2005. 6. 13( 월 ) 한 민 규

Slides:



Advertisements
Similar presentations
Introduction 1 Lecture 13 Transport Layer (Transmission Control Protocol) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer.
Advertisements

TCP/IP Christopher Zacky. lolwut Decimal Numbers.
1 Transport Protocols & TCP CSE 3213 Fall April 2015.
Prentice HallHigh Performance TCP/IP Networking, Hassan-Jain Chapter 2 TCP/IP Fundamentals.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Guide to TCP/IP, Third Edition
Transport Layer3-1 TCP. Transport Layer3-2 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection.
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
1 Transport Layer Lecture 9 Imran Ahmed University of Management & Technology.
TCP & UDP - Protocol Details Yen-Cheng Chen
Chapter 12 Transport protocols. Outline 12.1 introduction 12.2 TCP/IP protocol suite.
1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
1 CS 4396 Computer Networks Lab Transmission Control Protocol (TCP) Part I.
TCP: Transmission Control Protocol Overview Connection set-up and termination Interactive Bulk transfer Timers Improvements.
5/6/2015© 2010 Raymond P. Jefferis IIILect Transport Layer.
Provides a reliable unicast end-to-end byte stream over an unreliable internetwork.
Transport Layer – TCP (Part1) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
Computer Networks 2 Lecture 2 TCP – I - Transport Protocols: TCP Segments, Flow control and Connection Setup.
CSCI-1680 Transport Layer I Based partly on lecture notes by David Mazières, Phil Levis, John Jannotti Rodrigo Fonseca.
Transmission Control Protocol (RFC 793) TCP provides a connection-oriented, reliable, byte stream service. Connection-oriented implies that two applications.
TCP© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer Science Department.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
CSCE 515: Computer Network Programming TCP Details Wenyuan Xu Department of Computer Science and Engineering.
EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
1 ELEN 602 Lecture 15 More on IP TCP. 2 byte stream Send buffer segments Receive buffer byte stream Application ACKs Transmitter Receiver TCP Streams.
EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
RFC 1323: TCP Extensions for High Performance
COMT 4291 Communications Protocols and TCP/IP COMT 429.
TCP Timers Chia-tai Tsai Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.
Copyright © Lopamudra Roychoudhuri
3: Transport Layer3b-1 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection m MSS: maximum.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Transmission Control Protocol
Chapter 12 Transmission Control Protocol (TCP)
CSE679: Computer Network Review r Review of the uncounted quiz r Computer network review.
1 CS 4396 Computer Networks Lab TCP – Part II. 2 Flow Control Congestion Control Retransmission Timeout TCP:
1 TCP Timeout And Retransmission Chapter 21 TCP sets a timeout when it sends data and if data is not acknowledged before timeout expires it retransmits.
Internet Networking recitation #11
TCP Timeout and Retransmission
© Jörg Liebeherr (modified by Malathi Veeraraghavan) 1 Overview Formats, Data Transfer, etc. Connection Management.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
CSEN 404 Transport Layer II Amr El Mougy Lamia AlBadrawy.
11 CS716 Advanced Computer Networks By Dr. Amir Qayyum.
1 Transmission Control Protocol (TCP) RFC: Introduction The TCP is intended to provide a reliable process-to-process communication service in a.
Two Transport Protocols Available Transmission Control Protocol (TCP) User Datagram Protocol (UDP) Provides unreliable transfer Requires minimal – Overhead.
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
Advanced Computer Networks
Review of TCP/IP.
Fast Retransmit For sliding windows flow control we waited for a timer to expire before beginning retransmission of a packet TCP uses an additional mechanism.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Chapter 15 Transmission Control Protocol (TCP)
Introduction to Networks
Transport Control Protocol
Introduction to Networks
5. End-to-end protocols (part 1)
Chapter 17 and 18: TCP is connection oriented
TCP.
TCP - Part I Karim El Defrawy
Hojun Lee TCP enhancements Hojun Lee 11/8/2018.
CSCI-1680 Transport Layer I
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Chapter 12 Transmission Control Protocol
Transport Control Protocol
CS4470 Computer Networking Protocols
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Transport Protocols: TCP Segments, Flow control and Connection Setup
Presentation transcript:

TCP/IP Illustracted Vol2. 제목 : TCP Input ( 월 ) 한 민 규

Content  Introduction  Preliminary Processing  Header Prediction  ACK Processing

Introduction  The tcp_input function is called by ipintr when a datagram is received with a protocol field of TCP

Introduction (Con’t) Introduction 1.Validate the input segment & locate the PCB for this connection 2.The term drop means to drop the segment being processed, not drop the connection, but when an RST is sent by dropwithreset it it normally causes the connection to be dropped  Fast path slow path  normal flow

Preliminary Processing  Declarations and preliminary processing If the number of bytes in the first mbuf in the chain is less than the size of the combined IP/TCP header (40bytes), m_pullup moves the first 40 bytes into the first mbuf. tcp statistic value Convert data pointer of tcpiphdr *

Preliminary Processing tlen is the TCP length, the number of bytes following the IP header Dataoffset : 4bit 로 구성된 dataoffset 항목은 32bit word. 즉 한 bit 가 4byte 를 나타내어 TCP 헤더의 전체 길이를 표시한다.

Preliminary Processing If all three conditions are true, ts_present is set to 1 The benefit in recognizing the timestamp option this way is to avoid calling the general option processing function tcp_dooptions later in the code

Preliminary Processing The two 16-bit port numbers are left in network byte order TCP maintains a one-behind cache(tcp_last_inpcb) conaining the address of the PCB for the last recevied TCP segment If the PCB was not found, the input segment is dropped and an RST is sent as a reply IF the PCB exists but a corresponding TCP control block does not exist, the socket is probably being closed, so the input segment is dropped and an RST is sent as a reply

Preliminary Processing Socket has had listen() tcp_saveti : These become arguments to tcp_trace when it is called at the end of the function When a segment arrives for a listening socket, a new socket is created by sonewconn Compute window scale factor RFC793 window size 16bit : 64k  extend (scale option with SYN)

Preliminary Processing t_idle is set to 0 since a segment has been received on the connection. The keep-alive timer is also reset to 2hours If options are present in the TCP header, and if the connection state is not LISTEN, tcp_dooptions processes the options

tcp_dooptions Function MSS Option: If the length is not 4(TCPOLEN_MAXSEG), or the segment does not have the SYN flag set, the option is ignored Window scale Option

Header Prediction Header prediction helps unidirectional data transfer by handling the two common cases. 1.If TCP is sending data, the next expected segment for this connection is an ACK for outstanding data. 2.If TCP is sending data, the next expected segment for this connections is the next in- sequence data segment  Faster then the general processing 1. Check if segment is the next expected The connection state musth be ESTABLISHED SYN,FIN,RST, or URG control flags must not be on ts_val > ts_recent ti_seq ==rcv_nxt tiwin(adv window) must be nonzero snd_nxt must equal the highest sequence number sent(snd_max) 2. If a timestamp option is present, Update ts_recent from received timestamp

Header Prediction Update RTT estimators Delete acknowledged bytes from send buffer Stop retransmit timer ??? Awaken waiting process : If a process must be awakened when the send buffer is modified

Header Prediction

TCP input: Slow Path Processing We continue with the code that’s executed if header prediction fails, the slow path through tcp_input. win is set to he number of bytes available in the socket’s receive buffer Receive window setting

Initiation of Passive Open, Completion of Active Open If the state is LISTEN or SYN_SENT, expected segment in these two states is a SYN, and we’ll see that any other received segment is dropped Drop if RST, ACK, or no SYN

Initiation of Passive Open, Completion of Active Open TCP is defined only for unicast applications. Recall that the M_BCAST and M_MCAST flags wre set by ether_input, based on the destination hardware address of the frame Get mbuf for client’s IP address and port Set local address in PCB Connect PCB to peer

Complete processing of SYN received in LISTEN state Initialize sequence number variables in control block TF_ACKNOW flag is set since the ACK of a SYN is not delayed The connection state becomes SYN_RCVD The connection-establishment timer is set to 75 seconds(TCPTV_KEEP_INIT)  tcp_output will be called

Completion of Active Open TCP is expecting to receive a SYN tcp_sendseqinit sets all four of these variables to 365 Acceptable ACK and RST

Process received SYN in response to an active open Since data can arrive for a connection befoe the connection is established, any such data is now placed in the receive by calling tcp_reass If the SYN that is ACKed was being timed, tcp_xmit_timer initializes the RTT estimators based on the measured RTT for the SYN Active Open complete Simultaneous Open

Simultaneous open If it is greater than the receive winodw, the excess data is dropped by m_adj()

PAWS:Protecion Against Wrapped Sequence Numbers

Trim Segment so Data is Within Window duplicate data at the beginning of the received segment is discarded Data that is beyond the end of the window is discarded from the end of the segment These data bytes have already been acknowledged and passed to the applications

Handle completely duplicate segment rcv_nxtti_seq This normally ocuurs when the other end did not receive our ACK, causing the other end to retransmit the segment.

Handle data that arrives after the process terminates If the socket has no descriptor referencing it, the process has closed t he connection The segment is then dropped and an RST is output

Calculate number of bytes beyond right edge of window todrop would be (6+5) – (4+6) = 1

Reomove data beyond right edge of window Check for new incarnation of a connection in the TIME_WAIT state - the SYN flag is set, - the connection is in the TIME_WAIT state - the new starting sequence number is greater then the final sequence number for the connection This is allowed by RFC 1122, - the ISS for the new connection must be greater than the last sequence number used(rcv_nxt). TCP adds 128,000(TCP_ISSNCR), which becomes the ISS check for pobe of closed window Drop other segments that are completely outside window The data to the right of the window is discarded from the mbuf chain by m_adj and ti_len is updated

When to Drop an Ack In an actual scenario, when both ends of a connection had a hole in the data on the reassembly queue and both ends enter the persist state, the connection becomes deadlocked as both ends throw away perfectly good ACKs

Self-Connects and Simultaneous Opens

Record Timestamp

Process RST flag SYN_RCVD state - Normally it is entered from the LISTEN state - This state can also be entered by a simultaneous open, after a process has called connect The other end sent its SYN and then terminated before the reply arrived, causing it to end an RST This state can also be entered by a simultaneous open, after a process has called connect Other states - The receipt of an RST in the ESTABLISHED, FIN_WAIT1, FIN_WAIT2, or CLOSE_WAIT states returns the error ECONNRESET

ACK Processing

Received ACK in SYN_RCVD state snd_una snd_max Available wndsize ti_ack Accept, select

Fast Retransmit and Fast Recovery  The fast retransmit algorithm occurs when TCP deduces from a small number (normally 3) of consecutive duplicate ACKs that a segment has been lost and deduces the starting sequence number of the missing segment  The fast recovery algorithm says that after the fast retransmit algorithm (that is, after the missing segment has been retransmitted), congestion avoidance but not slow start is performed

Check for completely duplicate ACK snd_una < acknowledgment field <= snd_max

Duplicate ACK processing t_dupacks equals 3(tcprexmtthresh). Congestion avoidance is performed and the missing segment is retransmitted t_dupacks exceeds 3. Increase the congestion window and perform normal TCP output t_dupacks is less than 3. Do nothing. Set snd_nxt Set congestion window Number of consecutive duplicate ACKS exceeds threshold of 3

Value of cwnd and send sequence while data is being transmitted

ACK Processing Congestion window reset Check for out-of-range ACK (Acceptable ACK)

RTT measurements and retransmission timer Base on Delayed-ACK ts_ecr : timestamp echo reply needoutput : 1 This flag forces a call to tcp_output at the end of this function

Open congestion window in response to ACKs

Remove acknowledged data from send buffer Reomve from the send buffer /* actual chars in buffer */

Receipt of ACK in FIN_WAIT_1 state 한쪽 호스트에서 연결 종료과정 초기의 FIN-ACK 세그먼트가 전송된 상태

Receipt of ACK in CLOSING state FIN-ACK 가 수신되었지만 이에 대한 ACK 는 전송되지 않은상태. Simultaneous close 상태

Receipt of ACK in LAST_ACK state 수신된 FIN-ACK 에 대한 ACK 의 전송

Receipt of ACK in TIME_WAIT state 양 호스트의 TCP 가 FIN-ACK 와 이에 대한 응답을 교환하고 TCP 연결종료 과정을 마무리한 상태. 이 상태가 되면 Maximum segment lifetime(Default 120 초 ) 의 두배의 시간동안 기다렸다가 해당 연결의 포트번호를 다시 사용할 수 있다.

Update window information snd_w11 records the sequence number of the last segment used to update the send window snd_w12 records the acknowledgement number of the last segment used to update the send window snd_nxtsnd_una snd_wnd ti_seq snd_w11 snd_nxtsnd_una snd_wnd ti_seq snd_w11 snd_w12 ti_ack Needoutput is set to 1 since the new value of snd_wnd might enable a segment to be sent

Urgent mode processing URG flag is ignored in the CLOSE_WAIT, CLOSING, LAST_ACK, or TIME_WAIT state If the urgent offset plus the number of bytes already in the receive buffer exceeds the maximum size of a socket buffer

Processing of received urgent pointer A new urgent pointer has been received

Place out-of-band byte into t_iobc

Merge received data into sequencing queue for socket

FIN Processing(first half) /* can't receive more data from peer */

FIN Processing (second half) TIME_WAIT state - If a FIN arrives in the TIME_WAIT state, it is a duplicate, the TIME_WAIT timer is restarted with a value of twice the MSL

Final Processing